commit 00d72e70f4049257335165aac71c6343025d5981 Author: Elijah Date: Fri Oct 30 16:26:37 2026 -0700 Create Kaleido Desktop, a cinematic Plex client for Windows Tauri 2 shell with a React/TypeScript interface and libmpv playback composed beneath the web view (DirectComposition on Windows). Shared code with per-OS platform modules and configs so macOS and Linux can follow. - Plex sign-in (browser, plex.tv/link or manual), server selection, Plex Home - Home, Movies and TV Shows (Discover, Library, Collections), search, people - Title pages with logos, ratings, cast, extras, seasons and episodes - Direct play with Plex conversion fallback, tracks, markers, autoplay - Metadata editing, artwork, fix match, refresh, analyze and deletion - Resumable offline downloads - App settings and Plex server administration with a live dashboard - Signed updater feed and Forgejo CI Co-Authored-By: Claude Opus 5.5 diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..733e1e8 --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,70 @@ +name: Validate and publish Kaleido Desktop +on: + push: + branches: [main] + tags: ['v*'] + workflow_dispatch: + +jobs: + # Shared code: typecheck and unit tests for the interface, and a Linux + # compile of the Rust core (keeps the cross-platform build honest). + validate: + runs-on: ubuntu-latest + container: + image: node:22-bookworm + timeout-minutes: 40 + steps: + - uses: https://data.forgejo.org/actions/checkout@v4.4.0 + - name: Interface + run: | + npm ci + npm run typecheck + npm test + - name: Rust core (Linux) + run: | + set -eu + apt-get update + apt-get install -y --no-install-recommends curl build-essential pkg-config libwebkit2gtk-4.1-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev libmpv-dev libdbus-1-dev + curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal + . "$HOME/.cargo/env" + mkdir -p dist && cargo check --manifest-path src-tauri/Cargo.toml + + # Signed installers per platform for version tags. Each OS needs a runner with + # that label; jobs for platforms without a runner simply wait or can be removed. + build: + if: startsWith(github.ref, 'refs/tags/v') + needs: validate + strategy: + fail-fast: false + matrix: + include: + - os: windows + runner: windows-latest + # - os: macos + # runner: macos-latest + # - os: linux + # runner: ubuntu-latest + runs-on: ${{ matrix.runner }} + timeout-minutes: 90 + steps: + - uses: https://data.forgejo.org/actions/checkout@v4.4.0 + - name: Build (Windows) + if: matrix.os == 'windows' + shell: pwsh + env: + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} + run: ./scripts/build.ps1 + - name: Build (macOS / Linux) + if: matrix.os != 'windows' + env: + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} + run: | + sh scripts/fetch-libmpv.sh + npm ci + npx tauri build + - uses: https://data.forgejo.org/actions/upload-artifact@v4 + with: + name: kaleido-${{ matrix.os }} + path: src-tauri/target/release/bundle/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..71072a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +node_modules/ +dist/ +src-tauri/target/ +src-tauri/gen/ +# Native libraries are fetched per OS by scripts/fetch-libmpv.* +vendor/mpv/*/ +!vendor/mpv/README.md +# Updater signing key (never commit) +.tools/ +.env +.env.* +evidence/ +*.log +.claude/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..7c51d00 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,27 @@ +# Kaleido Desktop + +## Working rules + +- This is a real desktop Plex client (Tauri 2 + React/TypeScript + libmpv), sibling of the + Android TV app at git.elijahkuntz.com/Elijah/Kaleido. Preserve working Plex + functionality; never substitute mock content or prototype playback. +- Design for mouse and keyboard first. Keep Kaleido's artwork-led look (clear logos, + backdrop fading into the page, UltraBlur colour wash, neutral near-black chrome) but + don't port remote-control patterns that feel wrong with a pointer. +- Keep the interface restrained: no redundant buttons or navigation. +- `.env` (`PLEX_SERVER_URL`, `PLEX_TOKEN`) is for local testing only. Never print, + commit or embed credentials. `.tools/updater.key` signs updates; never commit or + replace it. +- Shared code goes in `src/` and `src-tauri/src/`; anything OS-specific goes in + `src-tauri/src/platform/.rs` or `tauri..conf.json`. + +## Testing + +- `npm run typecheck`, `npm test`, `cargo check --manifest-path src-tauri/Cargo.toml`. +- UI: `npm run dev` and a browser at http://localhost:1420 (signs in from `.env`). +- Native: `npm run tauri dev` with `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9333`; + `window.__kaleido` exposes the stores in development. +- Mute before playback tests (`__kaleido.useSettings.getState().set('volume', 0)`). + Playback changes real Plex progress and track selections; restore them. + +See `docs/architecture.md` and `docs/development.md`. diff --git a/README.md b/README.md new file mode 100644 index 0000000..65ea395 --- /dev/null +++ b/README.md @@ -0,0 +1,92 @@ +# Kaleido for Desktop + +A cinematic Plex client for the desktop, built in the same artwork-led style as +[Kaleido for Android TV](https://git.elijahkuntz.com/Elijah/Kaleido), and designed for +mouse and keyboard. + +Windows is supported today. The repository is structured for Windows, macOS and Linux: +the interface and nearly all of the native core are shared, and each platform's +differences live in one place (see [Architecture](docs/architecture.md)). + +## What's in the app + +### Browse +- **Home** features recently released, highly rated and recommended titles in a rotating + cinematic hero, with Continue Watching and your server's shelves beneath it. +- **Movies** and **TV Shows** each have **Discover**, **Library** and **Collections**. + Discover leads with Continue Watching (Next Episodes for TV), new seasons, recent + releases and Plex's recommendations. Library is the full catalog: a fast, virtualized + poster grid with search, server-provided filters (genre, year, decade, content rating, + resolution, HDR, Dolby Vision, Atmos, unwatched and more), every Plex sort, an A–Z jump + rail and three poster sizes. If you have several libraries of a kind, pick which one + each destination shows. +- **Search** finds movies, shows, episodes, people and collections, with recent searches. +- **Title pages** show clear-logo art over the title's backdrop with its colour wash, + Rotten Tomatoes and IMDb scores, 4K/HDR/Atmos badges, cast and crew (select a person + for their filmography in your library), trailers and extras, related titles and an + About panel with credits and media details. Shows list their seasons and episodes. +- Rest the pointer on a poster for a quick preview; right-click any title for actions. + +### Watch +- Playback uses **mpv**, so original files play directly — HEVC, AV1, Dolby Vision, + TrueHD/Atmos, DTS-HD, PGS subtitles — with hardware decoding and HDR passthrough. Plex + conversion (4K/1080p/720p/480p) is available per network type or from the player. +- Audio and subtitle tracks, subtitle timing and size, speed, chapters and versions. +- Server preview thumbnails on the timeline, Skip Intro/Credits (button or automatic), + and a next-episode countdown. +- Progress, watched state and Now Playing sync with your Plex server. + +### Manage +- Mark watched/unwatched, remove from Continue Watching, rate, add to collections and + playlists, play from the beginning or pick a version. +- For server owners: edit metadata (with field locks), change posters, backgrounds and + logos, refresh metadata, analyze, fix match, unmatch, split apart and delete. + +### Downloads +- Download movies, episodes or whole seasons in original quality. Downloads pause, + resume (including after restarting) and play offline; artwork is kept for offline + browsing. + +### Settings and server administration +- App settings for account and server, playback, audio and subtitles, interface, + downloads, keyboard shortcuts and updates. +- Plex server settings: a live **dashboard** (streams with stop-stream, bandwidth, CPU + and memory), activity and watch history, general, remote access, library, network, + transcoder, extras, scheduled tasks and DLNA settings, **library management** (scan, + refresh, analyze, empty trash, add/edit/delete with a server folder browser), devices, + troubleshooting (logs, database, clean bundles, optimize) and a live console. + Live TV/DVR and Plex's online catalog are intentionally not included. + +## Keyboard + +| Browsing | | Player | | +| --- | --- | --- | --- | +| Ctrl+K | Search | Space / K | Play/pause | +| Arrow keys | Move between titles | ← / → | Seek (Shift: 1 min) | +| Enter / Space | Open / play | ↑ / ↓, wheel | Volume | +| Menu or Shift+F10 | Title actions | F, double-click | Full screen | +| Alt+← / mouse back | Back | C | Next subtitle | +| / | Focus search | Shift+N | Next episode | +| F11 | Full screen | Esc | Exit full screen, then player | + +## Build from source + +Requirements: Node 22+, Rust (stable), and on Windows the Visual Studio C++ build tools +and 7-Zip. + +```powershell +npm ci +.\scripts\fetch-libmpv.ps1 # libmpv for Windows into vendor/mpv/windows +npm run tauri dev # development app +.\scripts\build.ps1 # signed release installer (NSIS) +``` + +During development the app signs in automatically from an ignored `.env` in the +repository root (`PLEX_SERVER_URL`, `PLEX_TOKEN`). Release builds never read it. +`npm run dev` serves the interface alone in a browser for UI work (no playback or +downloads). `npm test` runs unit tests; `npm run typecheck` checks types. + +Releases and the update feed are described in [docs/development.md](docs/development.md). + +Kaleido is an independent project and is not affiliated with Plex. Video playback uses +libmpv (LGPL). diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 0000000..5af3343 --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,72 @@ +# Architecture + +Kaleido Desktop is a [Tauri 2](https://tauri.app) application: a Rust core hosts the +system web view (WebView2 on Windows, WKWebView on macOS, WebKitGTK on Linux), which runs +the React/TypeScript interface. Video is decoded and rendered by libmpv and composed +**beneath** the transparent web view, so the player's controls are ordinary interface +elements drawn over the video — the same arrangement Plex HTPC and Jellyfin Media +Player use. + +``` +src/ Shared interface (all platforms) + app/ Session, router, settings, queries, actions, shell, updater + plex/ Plex client: account (plex.tv), library API, admin, playback, parsing + player/ Playback controller (store.ts), mpv bridge, player overlay + downloads/ Download catalog and actions + screens/ Home, Movies/TV (Discover/Library/Collections), title pages, + search, people, downloads, settings, dialogs + ui/ Design system: primitives, menus/dialogs/toasts, cards, hero + styles/ Tokens and styles (base, ui, app, screens, player) + platform/native.ts The only module that talks to the host (Tauri or browser) +src-tauri/ Shared Rust core + src/mpv.rs Dynamically loaded libmpv binding (node ↔ JSON) + src/player.rs One long-lived mpv instance, event stream to the interface + src/downloads.rs Resumable downloads with a JSON catalog + src/system.rs Credentials (OS keychain), paths, disk space, file saving + src/platform/ Everything OS-specific (see below) + tauri.conf.json Shared configuration (+ tauri..conf.json overrides) +vendor/mpv// libmpv per platform (fetched by scripts, ignored by git) +scripts/ build, libmpv fetch, update-feed generation +updates/latest.json Signed update feed for every platform +``` + +## Platform boundary + +`src-tauri/src/platform/mod.rs` selects one of `windows.rs`, `macos.rs` or `linux.rs`. +Each exposes the same items: + +| Item | Windows implementation | +| --- | --- | +| `VideoSurface` | mpv renders with `d3d11-output-mode=composition`; its swapchain (`display-swapchain`) is set as the content of a DirectComposition visual targeted at the window with `topmost = false`, i.e. behind the web view's child windows. | +| `MPV_LIBRARIES` | `libmpv-2.dll` | +| `hold_awake` | `SetThreadExecutionState` while video plays | + +macOS and Linux currently provide stubs for `VideoSurface` (browsing, downloads, +settings and updates work; playback reports that it is unavailable). To add playback +there, render through mpv's render API into a layer beneath the web view and implement +the same five methods. Per-OS bundling (libmpv, targets, dependencies) lives in +`tauri.macos.conf.json` and `tauri.linux.conf.json`. Credentials use the platform's +keychain through the `keyring` crate with per-OS features in `Cargo.toml`. + +On Windows the main window is created transparent and the page background turns +transparent only while video is visible (`html.video-active`), so browsing is opaque. + +## Interface + +- **State**: zustand stores for the session (`app/session.ts`), navigation history + (`app/router.ts`, with scroll and per-screen state restored on Back), preferences + (`app/settings.ts`, persisted) and the player (`player/store.ts`). Server data goes + through TanStack Query; every key starts with the server's machine identifier. +- **Plex HTTP** goes through the host's native HTTP client (`@tauri-apps/plugin-http`), + avoiding CORS and local-network restrictions. Artwork uses Plex's photo transcoder, + sized for the display's pixel ratio (PNG for transparent clear logos). +- **Library sync**: the section list is polled every 20 seconds; a change refreshes + browsing caches. +- **Playback** (`player/store.ts`): Original quality plays the part URL directly (multi + part titles are joined with an mpv EDL); other qualities request Plex HLS with + timestamps kept absolute. If direct play fails, playback retries through Plex once. + Plex streams are matched to mpv tracks by stream index; external subtitles are added + on demand. Timeline reports every 10 seconds make the session appear in Plex, and the + title is marked watched at the configured percentage. +- **Updates**: `app/updater.ts` checks the signed feed on start; installs need the + user's confirmation and then relaunch. diff --git a/docs/development.md b/docs/development.md new file mode 100644 index 0000000..d2b497d --- /dev/null +++ b/docs/development.md @@ -0,0 +1,50 @@ +# Development + +## Setup (Windows) + +1. Node 22+, Rust stable (MSVC), Visual Studio C++ build tools, 7-Zip. +2. `npm ci` +3. `.\scripts\fetch-libmpv.ps1` downloads the shinchiro `mpv-dev-x86_64` build (the + Windows libmpv builds linked from mpv.io) into `vendor/mpv/windows`. +4. Put a `.env` in the repository root for the development sign-in: + `PLEX_SERVER_URL=...` and `PLEX_TOKEN=...`. It is ignored by git and only read by + debug builds and the Vite dev server. Never commit or print it. +5. `npm run tauri dev` + +The interface alone runs in a browser with `npm run dev` (port 1420), which is handy for +layout work; playback, downloads and native dialogs need the desktop app. In development +builds the stores are available as `window.__kaleido` for debugging. + +To drive the desktop app from scripts, start it with +`WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9333` and attach over the +Chrome DevTools Protocol. + +## Checks + +```powershell +npm run typecheck +npm test +cargo check --manifest-path src-tauri/Cargo.toml +``` + +Playback tests change real Plex progress; resume an in-progress title near its saved +position, or restore it afterwards. Selecting audio or subtitle tracks is saved to Plex +for that file. + +## Releases + +1. Bump the version in `package.json`, `src-tauri/Cargo.toml` and + `src-tauri/tauri.conf.json`. +2. `.\scripts\build.ps1` builds the NSIS installer and its signed updater artifact. The + updater key is read from `.tools/updater.key` (ignored; keep it safe — replacing it + breaks in-app updates for existing installs) or from `TAURI_SIGNING_PRIVATE_KEY`. +3. Create the release (tag `vX.Y.Z`) and upload the files from + `src-tauri/target/release/bundle/nsis/`. +4. `node scripts/update-manifest.mjs X.Y.Z https://git.elijahkuntz.com/Elijah/Kaleido-Desktop/releases/download/vX.Y.Z notes.md` + and commit `updates/latest.json`. Installed copies offer the update on their next + start. + +For macOS and Linux, build on those systems (`scripts/fetch-libmpv.sh`, then +`npx tauri build`) and merge their bundles into the same feed with `KALEIDO_BUNDLES`. +CI (`.forgejo/workflows/release.yml`) validates every push and builds installers for +tags on runners for each enabled platform. diff --git a/index.html b/index.html new file mode 100644 index 0000000..09f20c1 --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + + + Kaleido + + +
+ + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..5d2bdf3 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1584 @@ +{ + "name": "kaleido-desktop", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "kaleido-desktop", + "version": "0.1.0", + "dependencies": { + "@fontsource-variable/inter": "^5.3.0", + "@tanstack/react-query": "^5.105.0", + "@tanstack/react-virtual": "^3.14.24", + "@tauri-apps/api": "^2.12.4", + "@tauri-apps/plugin-dialog": "^2.8.4", + "@tauri-apps/plugin-http": "^2.8.3", + "@tauri-apps/plugin-opener": "^2.7.2", + "@tauri-apps/plugin-process": "^2.4.0", + "@tauri-apps/plugin-updater": "^2.14.1", + "@tauri-apps/plugin-window-state": "^2.5.0", + "react": "^19.3.1", + "react-dom": "^19.3.1", + "zustand": "^5.0.16" + }, + "devDependencies": { + "@tauri-apps/cli": "^2.12.4", + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "@vitejs/plugin-react": "^6.1.2", + "typescript": "~5.9", + "vite": "^8.3.5", + "vitest": "^5.0.5" + } + }, + "node_modules/@fontsource-variable/inter": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource-variable/inter/-/inter-5.3.0.tgz", + "integrity": "sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.16.tgz", + "integrity": "sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.16.tgz", + "integrity": "sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.16.tgz", + "integrity": "sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.16.tgz", + "integrity": "sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.16.tgz", + "integrity": "sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.16.tgz", + "integrity": "sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.16.tgz", + "integrity": "sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.16.tgz", + "integrity": "sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.16.tgz", + "integrity": "sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.16.tgz", + "integrity": "sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.16.tgz", + "integrity": "sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.16.tgz", + "integrity": "sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.16.tgz", + "integrity": "sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.16.tgz", + "integrity": "sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.16.tgz", + "integrity": "sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tanstack/query-core": { + "version": "5.105.0", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.105.0.tgz", + "integrity": "sha512-7p56vRmT/z4UJ6sctGIdl5WRUQyUv53IUpUwEKi2g97zMbO7zh8ZsCLffGAvCPBR4xD72e3VXsDyLwXHhoNTMQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/react-query": { + "version": "5.105.0", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.105.0.tgz", + "integrity": "sha512-y+hMuDERvgg6ay1da0V1a6ZC0ZONt7dELxSFkqRZuwm7p1TTZs0MoXrPlBRflIpRoYjvzQVYxycnLImpFLhWrw==", + "license": "MIT", + "dependencies": { + "@tanstack/query-core": "5.105.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "@types/react": "^18 || ^19", + "react": "^18 || ^19" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@tanstack/react-virtual": { + "version": "3.14.24", + "resolved": "https://registry.npmjs.org/@tanstack/react-virtual/-/react-virtual-3.14.24.tgz", + "integrity": "sha512-JoNsByXR68fNlB2NZuT3bSk8uYBxuOWl6YNJ7djTrw7IMwBWuaOtffxj/TcuMa80WmL6byb+80i1NEM/8Qmocw==", + "license": "MIT", + "dependencies": { + "@tanstack/virtual-core": "3.19.9" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@tanstack/virtual-core": { + "version": "3.19.9", + "resolved": "https://registry.npmjs.org/@tanstack/virtual-core/-/virtual-core-3.19.9.tgz", + "integrity": "sha512-Syiaf3w69dFyYv4o2mqJ1/2VtBJTNq5Hu5cVXfnzOuJKFpUojukQR13ZW+5NvdMJM7GFHeNPmveMNhoIubiFyA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tauri-apps/api": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.12.4.tgz", + "integrity": "sha512-pVmfis+4zT8H0Qhp3xPZx9Ju7kpzvA6rr/PSJPyuwfvucTQ8sVt61NYU9KMkK703UFlYadFmjKA4HhybOtN0gg==", + "license": "Apache-2.0 OR MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/tauri" + } + }, + "node_modules/@tauri-apps/cli": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.12.4.tgz", + "integrity": "sha512-JI9bHfudSRJikGOrjbXEm6RjzzvmKuLc+JixB1NE8hNzQkNlCCIC3pTES3uypkR9lxHrsbxzcnSwhI2IxBQphw==", + "dev": true, + "license": "Apache-2.0 OR MIT", + "bin": { + "tauri": "tauri.js" + }, + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/tauri" + }, + "optionalDependencies": { + "@tauri-apps/cli-darwin-arm64": "2.12.4", + "@tauri-apps/cli-darwin-x64": "2.12.4", + "@tauri-apps/cli-linux-arm-gnueabihf": "2.12.4", + "@tauri-apps/cli-linux-arm64-gnu": "2.12.4", + "@tauri-apps/cli-linux-arm64-musl": "2.12.4", + "@tauri-apps/cli-linux-riscv64-gnu": "2.12.4", + "@tauri-apps/cli-linux-x64-gnu": "2.12.4", + "@tauri-apps/cli-linux-x64-musl": "2.12.4", + "@tauri-apps/cli-win32-arm64-msvc": "2.12.4", + "@tauri-apps/cli-win32-ia32-msvc": "2.12.4", + "@tauri-apps/cli-win32-x64-msvc": "2.12.4" + } + }, + "node_modules/@tauri-apps/cli-darwin-arm64": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.12.4.tgz", + "integrity": "sha512-OxqKSckIkoJ6vX2AjifIJpTasFC0Hbdoo7gEiCmAjauABO3U8m2MRsLWe+QTiBwDx1mIrvgA+rvI7tvDnbnHVg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-darwin-x64": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.12.4.tgz", + "integrity": "sha512-fz76/77wMMJOaaUN6n3CybRG0P/MTEjjqYk81mGPyhi9m6Ue5T+LWBnJP/AkPooNatBPI2vtulGqomyMJ44lCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-arm-gnueabihf": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.12.4.tgz", + "integrity": "sha512-K0w8Bof6Lt8QKLAYhRy0yy36ZH5iA/35VuSOvnxyjvCUZ+A3JKsUTlALviH/sVgAlisaPzzmeJSH8XOn4Q2HBA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-arm64-gnu": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.12.4.tgz", + "integrity": "sha512-j5rOnjmRUwWrm1oosf0zBYl4D+fqydgUROFCk0hvKZxvbTT8SOERes0QB7rBV/XWNy+kM6pCKzb3oSm2sRglzg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-arm64-musl": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.12.4.tgz", + "integrity": "sha512-aOue3Fy6Jb7+oWcfAVUsVHfeTybSCt2CZoU06aO4jv4d2Ks/KnaTPwMAK3CLEduGOvBLY1lbBBrIyomqLLH5Sg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-riscv64-gnu": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-riscv64-gnu/-/cli-linux-riscv64-gnu-2.12.4.tgz", + "integrity": "sha512-Fx6GShY/RvST+t6LMlTHAwd66+1tEaAAGrnU7cysVfaiRP1BKng5Vl6rVmO6rSLOA1Sp1dRzNYM4f0OWQGb7qA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-x64-gnu": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.12.4.tgz", + "integrity": "sha512-tNzZSa79Z1nRpHxEpQ38lsAFpKlFlYvoXzjTV+lRRn/zSf3wrdUC3wnLcq2XEadchPu4ttK0zivhYzr+XGD19Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-x64-musl": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.12.4.tgz", + "integrity": "sha512-jmZ1pr0xEqUhuEusWtt9Yt+GF6lCnGHUmIL+KIknpbjK/XQ2qkhDBhaxK/JMHM2A8dAacVXCxXJk2EXpwhQUfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-win32-arm64-msvc": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.12.4.tgz", + "integrity": "sha512-fGo8pgEHZxdSYgZ/J98m1usJ7NHKmKbq7k6uT0x1rpOq6Bg2YVzzpaAblWk710f5LHYBJIL5QIFS5IrD+4gmTg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-win32-ia32-msvc": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.12.4.tgz", + "integrity": "sha512-ezl8sQIcjYsye3TUnTH5VcWmWzccZASlQm7hlZt0dYyj1XD0qpVW47u2xYVrIKui0F8uQv/7QGZixdWiClBsbg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-win32-x64-msvc": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.12.4.tgz", + "integrity": "sha512-DJhDeCqjLDNMWYFy7ZS8cfeAHX2RK0RbQMLiA3bMVVkXRDJ4NBYiHriGqsUhsr9iG41aTb+dJGkFPmPw1gWwVw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/plugin-dialog": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-dialog/-/plugin-dialog-2.8.4.tgz", + "integrity": "sha512-+6ZOiXenOaxXwb8qCbBPdT2jX2cFPaVVHGIskrpmJLpmWj+qKRTD6X/z9x7hTdSQn7NedcoXCkWGej4a7dC4lw==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.12.0" + } + }, + "node_modules/@tauri-apps/plugin-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-http/-/plugin-http-2.8.3.tgz", + "integrity": "sha512-MrgCnnxSnzxkMX+Tk1XXB8rSI9hfhUHQmtbn0EpflEDcSx04K1BDfrv51tcK27SCuU/B1j8sNHL0UZur/1iqKA==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.12.0" + } + }, + "node_modules/@tauri-apps/plugin-opener": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-opener/-/plugin-opener-2.7.2.tgz", + "integrity": "sha512-LyybP1VSzTMQiaFYcsbAse47KpivlyXdLZMQzGLEnkgQacGESnpjAfFoQ6h5sqWgAdZDH9szYjPzHMpv0Sz+TQ==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.12.0" + } + }, + "node_modules/@tauri-apps/plugin-process": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-process/-/plugin-process-2.4.0.tgz", + "integrity": "sha512-GddrmsSLAYrLa/yTXlXK/YRDzUgYeeOnUXTbiyvJWkmI424RmDPD3FVLeqcon7rv6O6ZfhBilcrHWnSo7o6hIQ==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.12.0" + } + }, + "node_modules/@tauri-apps/plugin-updater": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-updater/-/plugin-updater-2.14.1.tgz", + "integrity": "sha512-Hr7nlBm1wT6xbwzjZ/S36YULazu8MNlj5vvOwMl47fXI7HTa5Bjl1PbDEwVHaZTAKzE1VZsUy35UqnbrQxmYQw==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.12.0" + } + }, + "node_modules/@tauri-apps/plugin-window-state": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-window-state/-/plugin-window-state-2.5.0.tgz", + "integrity": "sha512-ySI/32fpC1ZTslIZ00/wf9HujyDnkG3OPL16uuLjG53y1hTgjIJ9G2VPuOL1IV8GVr3xeF6lnr6h2T73HuGXow==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.12.0" + } + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", + "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", + "devOptional": true, + "license": "MIT", + "peer": true, + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.3.0" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.1.2.tgz", + "integrity": "sha512-fhJNGUdscQa4HkI0xFxwonWyhnVReCPDbXI7FH7jmzpnVCrFQI7PRrhWecO263610vOrs9tr2Y4xcf8uAdFxbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", + "babel-plugin-react-compiler": "^1.0.0", + "oxc-transform-react": "^0.152.0", + "vite": "^8.0.0" + }, + "peerDependenciesMeta": { + "@rolldown/plugin-babel": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "oxc-transform-react": { + "optional": true + } + } + }, + "node_modules/@vitest/mocker": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz", + "integrity": "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.31", + "@vitest/spy": "5.0.5", + "estree-walker": "^3.0.3", + "magic-string": "^1.4.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9 || ^3.0.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/spy": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.5.tgz", + "integrity": "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/chai": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, + "license": "MIT" + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/obug": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz", + "integrity": "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz", + "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/react": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz", + "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "scheduler": "^0.28.0" + }, + "peerDependencies": { + "react": "^19.3.1" + } + }, + "node_modules/rolldown": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.16.tgz", + "integrity": "sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.156.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.16", + "@rolldown/binding-android-arm64": "1.2.16", + "@rolldown/binding-darwin-arm64": "1.2.16", + "@rolldown/binding-darwin-x64": "1.2.16", + "@rolldown/binding-freebsd-x64": "1.2.16", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.16", + "@rolldown/binding-linux-arm64-gnu": "1.2.16", + "@rolldown/binding-linux-arm64-musl": "1.2.16", + "@rolldown/binding-linux-ppc64-gnu": "1.2.16", + "@rolldown/binding-linux-s390x-gnu": "1.2.16", + "@rolldown/binding-linux-x64-gnu": "1.2.16", + "@rolldown/binding-linux-x64-musl": "1.2.16", + "@rolldown/binding-openharmony-arm64": "1.2.16", + "@rolldown/binding-win32-arm64-msvc": "1.2.16", + "@rolldown/binding-win32-x64-msvc": "1.2.16" + } + }, + "node_modules/scheduler": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "license": "MIT" + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/std-env": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", + "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinybench": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.2.tgz", + "integrity": "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/tinyexec": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/vite": { + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz", + "integrity": "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.30", + "rolldown": "~1.2.14", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.5.tgz", + "integrity": "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/mocker": "5.0.5", + "chai": "^6.3.0", + "es-module-lexer": "^2.3.2", + "expect-type": "^1.4.0", + "magic-string": "^1.4.3", + "obug": "^3.0.0", + "picomatch": "^4.0.7", + "std-env": "^4.3.0", + "tinybench": "^6.2.2", + "tinyexec": "^1.3.1", + "tinyglobby": "^0.2.17", + "why-is-node-running": "3.2.1" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^22.12.0 || ^24.0.0 || >=26.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "5.0.5", + "@vitest/browser-preview": "5.0.5", + "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", + "@vitest/coverage-istanbul": "5.0.5", + "@vitest/coverage-v8": "5.0.5", + "@vitest/ui": "5.0.5", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/why-is-node-running": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz", + "integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==", + "dev": true, + "license": "MIT", + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=20.11" + } + }, + "node_modules/zustand": { + "version": "5.0.16", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.16.tgz", + "integrity": "sha512-Uv7e327ihlCfayfja3hDc0M64Upev1LWBKpRobdK4NyovDDPeeX4imWXc/wzC1yc6fkYPoAY/ncKVPAs2jrtQw==", + "license": "MIT", + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "@types/react": ">=18.0.0", + "immer": ">=9.0.6", + "react": ">=18.0.0", + "use-sync-external-store": ">=1.2.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + }, + "use-sync-external-store": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..12ad1c8 --- /dev/null +++ b/package.json @@ -0,0 +1,37 @@ +{ + "name": "kaleido-desktop", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc --noEmit && vite build", + "typecheck": "tsc --noEmit", + "test": "vitest run", + "tauri": "tauri" + }, + "dependencies": { + "@fontsource-variable/inter": "^5.3.0", + "@tanstack/react-query": "^5.105.0", + "@tanstack/react-virtual": "^3.14.24", + "@tauri-apps/api": "^2.12.4", + "@tauri-apps/plugin-dialog": "^2.8.4", + "@tauri-apps/plugin-http": "^2.8.3", + "@tauri-apps/plugin-opener": "^2.7.2", + "@tauri-apps/plugin-process": "^2.4.0", + "@tauri-apps/plugin-updater": "^2.14.1", + "@tauri-apps/plugin-window-state": "^2.5.0", + "react": "^19.3.1", + "react-dom": "^19.3.1", + "zustand": "^5.0.16" + }, + "devDependencies": { + "@tauri-apps/cli": "^2.12.4", + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "@vitejs/plugin-react": "^6.1.2", + "typescript": "~5.9", + "vite": "^8.3.5", + "vitest": "^5.0.5" + } +} diff --git a/scripts/build.ps1 b/scripts/build.ps1 new file mode 100644 index 0000000..b519092 --- /dev/null +++ b/scripts/build.ps1 @@ -0,0 +1,30 @@ +# Builds Kaleido for Windows: the NSIS installer plus signed updater artifacts. +# .\scripts\build.ps1 # release installer +# .\scripts\build.ps1 -Debug # faster unoptimized build +param([switch]$Debug) +$ErrorActionPreference = "Stop" +$root = Split-Path -Parent $PSScriptRoot +Set-Location $root + +& "$PSScriptRoot\fetch-libmpv.ps1" + +# The updater signing key stays outside git (.tools/). CI provides it as a secret. +if (-not $env:TAURI_SIGNING_PRIVATE_KEY) { + $keyFile = Join-Path $root ".tools\updater.key" + if (Test-Path $keyFile) { + $env:TAURI_SIGNING_PRIVATE_KEY = Get-Content $keyFile -Raw + if (-not $env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD) { $env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = "" } + } else { + Write-Warning "No updater signing key; building without update artifacts." + $env:TAURI_CONFIG = '{"bundle":{"createUpdaterArtifacts":false}}' + } +} + +if (-not (Test-Path (Join-Path $root "node_modules"))) { npm ci } +$buildArgs = @("tauri", "build") +if ($Debug) { $buildArgs += "--debug" } +npx @buildArgs +if ($LASTEXITCODE -ne 0) { throw "Build failed" } + +$profile = if ($Debug) { "debug" } else { "release" } +Get-ChildItem (Join-Path $root "src-tauri\target\$profile\bundle\nsis") | Select-Object Name, Length diff --git a/scripts/fetch-libmpv.ps1 b/scripts/fetch-libmpv.ps1 new file mode 100644 index 0000000..063fda8 --- /dev/null +++ b/scripts/fetch-libmpv.ps1 @@ -0,0 +1,15 @@ +# Downloads libmpv for Windows into vendor/mpv/windows. +# Source: https://github.com/shinchiro/mpv-winbuild-cmake (the builds linked from mpv.io). +param([string]$Tag = "20261021", [string]$Build = "mpv-dev-x86_64-20261021-git-e471496c56") +$ErrorActionPreference = "Stop" +$root = Split-Path -Parent $PSScriptRoot +$dest = Join-Path $root "vendor\mpv\windows" +if (Test-Path (Join-Path $dest "libmpv-2.dll")) { Write-Host "libmpv already present in $dest"; exit 0 } +$tmp = Join-Path ([IO.Path]::GetTempPath()) ("kaleido-mpv-" + [guid]::NewGuid()) +New-Item -ItemType Directory -Force $tmp, $dest | Out-Null +$archive = Join-Path $tmp "mpv-dev.7z" +Invoke-WebRequest "https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/$Tag/$Build.7z" -OutFile $archive +& 7z x $archive "-o$tmp\x" -y | Out-Null +Copy-Item "$tmp\x\libmpv-2.dll" $dest +Remove-Item -Recurse -Force $tmp +Write-Host "libmpv installed to $dest" diff --git a/scripts/fetch-libmpv.sh b/scripts/fetch-libmpv.sh new file mode 100644 index 0000000..da866db --- /dev/null +++ b/scripts/fetch-libmpv.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +# macOS: copies Homebrew's libmpv into vendor/mpv/macos for bundling. +# Linux: libmpv comes from the system package (libmpv2); nothing to copy. +set -eu +root=$(cd "$(dirname "$0")/.." && pwd) +case "$(uname -s)" in + Darwin) + brew list mpv >/dev/null 2>&1 || brew install mpv + mkdir -p "$root/vendor/mpv/macos" + cp "$(brew --prefix mpv)/lib/libmpv.2.dylib" "$root/vendor/mpv/macos/" + echo "libmpv copied to vendor/mpv/macos" ;; + Linux) + echo "Install libmpv from your distribution (e.g. apt install libmpv2 libmpv-dev)." ;; + *) echo "Use scripts/fetch-libmpv.ps1 on Windows." ;; +esac diff --git a/scripts/update-manifest.mjs b/scripts/update-manifest.mjs new file mode 100644 index 0000000..11d2711 --- /dev/null +++ b/scripts/update-manifest.mjs @@ -0,0 +1,47 @@ +// Writes updates/latest.json, the feed Kaleido's updater reads, from built bundles. +// Usage: node scripts/update-manifest.mjs [notesFile] +// Each platform's signed artifact (and its .sig) must be in src-tauri/target/release/bundle, +// or pass several bundle folders via KALEIDO_BUNDLES (path;path) when collecting CI outputs. +import fs from 'node:fs'; +import path from 'node:path'; + +const [version, baseUrl, notesFile] = process.argv.slice(2); +if (!version || !baseUrl) { + console.error('usage: node scripts/update-manifest.mjs [notesFile]'); + process.exit(1); +} +const root = path.resolve(import.meta.dirname, '..'); +const bundles = (process.env.KALEIDO_BUNDLES ?? path.join(root, 'src-tauri/target/release/bundle')).split(';'); + +/** Tauri updater platform keys and the artifact each one installs. */ +const PLATFORMS = [ + { key: 'windows-x86_64', dir: 'nsis', match: /-setup\.exe$/ }, + { key: 'darwin-aarch64', dir: 'macos', match: /aarch64.*\.app\.tar\.gz$/ }, + { key: 'darwin-x86_64', dir: 'macos', match: /x64.*\.app\.tar\.gz$/ }, + { key: 'linux-x86_64', dir: 'appimage', match: /\.AppImage$/ }, +]; + +const manifestPath = path.join(root, 'updates/latest.json'); +const manifest = fs.existsSync(manifestPath) ? JSON.parse(fs.readFileSync(manifestPath, 'utf8')) : { platforms: {} }; +manifest.version = version; +manifest.notes = notesFile ? fs.readFileSync(notesFile, 'utf8').trim() : manifest.notes ?? ''; +manifest.pub_date = new Date().toISOString(); +manifest.platforms ??= {}; + +for (const bundle of bundles) { + for (const p of PLATFORMS) { + const dir = path.join(bundle, p.dir); + if (!fs.existsSync(dir)) continue; + const file = fs.readdirSync(dir).find((f) => p.match.test(f) && f.includes(version)); + if (!file || !fs.existsSync(path.join(dir, `${file}.sig`))) continue; + manifest.platforms[p.key] = { + signature: fs.readFileSync(path.join(dir, `${file}.sig`), 'utf8').trim(), + url: `${baseUrl.replace(/\/$/, '')}/${encodeURIComponent(file)}`, + }; + console.log(`${p.key}: ${file}`); + } +} + +fs.mkdirSync(path.dirname(manifestPath), { recursive: true }); +fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n'); +console.log(`Wrote ${path.relative(root, manifestPath)}`); diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock new file mode 100644 index 0000000..66ad156 --- /dev/null +++ b/src-tauri/Cargo.lock @@ -0,0 +1,6368 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures 0.2.17", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a" + +[[package]] +name = "alloc-stdlib" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5c1865780388bfa186411ab5f247819487fc4864c6e9c3106611fa347586e1" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix", +] + +[[package]] +name = "async-recursion" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "atk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b" +dependencies = [ + "atk-sys", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "blocking" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "brotli" +version = "9.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "627b7cfb0578f0eafce087a90fcd40add1231900b69e4d4de2d456260a4f5d81" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "6.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34c6783f42c21c952ad7112b354f0ba2f10760e9decea5b1b60523d6e270faaf" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" +dependencies = [ + "serde", +] + +[[package]] +name = "cairo-rs" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" +dependencies = [ + "bitflags 2.13.2", + "cairo-sys-rs", + "glib", + "libc", + "once_cell", + "thiserror 1.0.69", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "camino" +version = "1.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbad30e4b4c14a39e3cc8aed085a12a327257c316619c93581e017bc52be591" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "cargo_toml" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f4b26e751e711a5302649417f2da046dce6391b2ea30a4820f37462314f0b9" +dependencies = [ + "semver", + "serde", + "toml 1.1.8+spec-1.1.0", +] + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + +[[package]] +name = "cc" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfb" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a347dcabdae9c31b0825fd6a8bed285ec9c2acb89c47827126d52fa4f59cece3" +dependencies = [ + "fnv", + "uuid", + "web-time", +] + +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link 0.2.1", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "cookie" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "cookie_store" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b2c103cf610ec6cae3da84a766285b42fd16aad564758459e6ecf128c75206" +dependencies = [ + "cookie", + "document-features", + "idna", + "log", + "publicsuffix", + "serde", + "serde_derive", + "serde_json", + "time", + "url", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "libc", +] + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "cssparser" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9cdaae01d5ed7882b04d795e7f752f46ff52d2fa3b50a20d28c464510bba98" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a" +dependencies = [ + "quote", + "syn 3.0.9", +] + +[[package]] +name = "ctor" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d" + +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.9", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "data-url" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" + +[[package]] +name = "dbus" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab69f03cc8c4340c9c8e315114e1658e6775a9b16a04357973aa21cec22b32e" +dependencies = [ + "libc", + "libdbus-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "dbus-secret-service" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "708b509edf7889e53d7efb0ffadd994cc6c2345ccb62f55cfd6b0682165e4fa6" +dependencies = [ + "aes", + "block-padding", + "cbc", + "dbus", + "fastrand", + "hkdf", + "num", + "once_cell", + "sha2", + "zeroize", +] + +[[package]] +name = "defmt" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366" +dependencies = [ + "defmt-parser", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "defmt-parser" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "deranged" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "dirs" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "block2", + "libc", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "dlopen2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c5bd4158e66d1e215c49b837e11d62f3267b30c92f1d171c4d3105e3dc4d4" +dependencies = [ + "dlopen2_derive", + "libc", + "once_cell", + "winapi", +] + +[[package]] +name = "dlopen2_derive" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbbb781877580993a8707ec48672673ec7b81eeba04cfd2310bd28c08e47c8f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "dom_query" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac5fca71e65e94cc718a6e2af65d6e0f9c6027751c2aa562fbb5087fda639bc" +dependencies = [ + "bit-set", + "cssparser", + "foldhash", + "html5ever", + "precomputed-hash", + "selectors", + "tendril", +] + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" +dependencies = [ + "serde", +] + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "embed-resource" +version = "3.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6168487b5e7eb2673e6efe1200b1848016e436a6ca0b8031bf04bd9d493a249f" +dependencies = [ + "cc", + "memchr", + "rustc_version", + "toml 1.1.8+spec-1.1.0", + "vswhom", + "winreg", +] + +[[package]] +name = "embed_plist" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" + +[[package]] +name = "encoding_rs" +version = "0.8.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "endi" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "erased-serde" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e59b668157f32d3459d4bd634861a06ffa2503a461ca5f0916b9f0252605e66" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "filetime" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" +dependencies = [ + "cfg-if", + "libc", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gdk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691" +dependencies = [ + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", + "once_cell", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gdk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gdkwayland-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "140071d506d223f7572b9f09b5e155afbd77428cd5cc7af8f2694c41d98dfe69" +dependencies = [ + "gdk-sys", + "glib-sys", + "gobject-sys", + "libc", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gdkx11" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3caa00e14351bebbc8183b3c36690327eb77c49abc2268dd4bd36b856db3fbfe" +dependencies = [ + "gdk", + "gdkx11-sys", + "gio", + "glib", + "libc", + "x11", +] + +[[package]] +name = "gdkx11-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e7445fe01ac26f11601db260dd8608fe172514eb63b3b5e261ea6b0f4428d" +dependencies = [ + "gdk-sys", + "glib-sys", + "libc", + "system-deps", + "x11", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasm-bindgen", +] + +[[package]] +name = "gio" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fc8f532f87b79cbc51a79748f16a6828fb784be93145a322fa14d06d354c73" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "once_cell", + "pin-project-lite", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "gio-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "winapi", +] + +[[package]] +name = "glib" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" +dependencies = [ + "bitflags 2.13.2", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "once_cell", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "glib-macros" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" +dependencies = [ + "heck 0.4.1", + "proc-macro-crate 2.0.2", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "glib-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "gobject-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gtk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a" +dependencies = [ + "atk", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "gtk3-macros" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "h2" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.14.2", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "html5ever" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a1761807faccc9a19e86944bbf40610014066306f96edcdedc2fb714bcb7b8" +dependencies = [ + "log", + "markup5ever", +] + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "http-range" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2149c4b4b83390c71fab669730347d578ec6bdf759f2160c581ad8b8819733b4" + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ico" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75e94d66081e4d8dcd098bd8dc5254800fea14a26389b298410158d834de167" +dependencies = [ + "byteorder", + "png", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "serde", + "serde_core", +] + +[[package]] +name = "infer" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4200d433cbd5178df7797c9c2e75b348b728e39631cf14520d1e2fc424201f4" +dependencies = [ + "cfb", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "javascriptcore-rs" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca5671e9ffce8ffba57afc24070e906da7fc4b1ba66f2cabebf61bf2ea257fcc" +dependencies = [ + "bitflags 1.3.2", + "glib", + "javascriptcore-rs-sys", +] + +[[package]] +name = "javascriptcore-rs-sys" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1be78d14ffa4b75b66df31840478fef72b51f8c2465d4ca7c194da9f7a5124" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "jiff" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b005715dcbeb0089a3c0dab99f2ff1cc3b2525323552703d648585d342a383" +dependencies = [ + "defmt", + "jiff-core", + "jiff-static", + "jiff-tzdb-platform", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link 0.2.1", +] + +[[package]] +name = "jiff-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c" +dependencies = [ + "defmt", + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cc9817253cf7c7ee4684451bd327e88d6f3658014e54a29198625590650695c" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa8377070c6bae868759445e5a77f66d84f0b72f3a054bfb00e6d038b8282da7" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" +dependencies = [ + "jiff-tzdb", +] + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link 0.2.1", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7421438de105a0827e44fadd05377727847d717c80ce29a229f85fd04c427b72" +dependencies = [ + "jsonptr", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "jsonptr" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5a3cc660ba5d72bce0b3bb295bf20847ccbb40fd423f3f05b61273672e561fe" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "kaleido" +version = "0.1.0" +dependencies = [ + "fs2", + "futures-util", + "keyring", + "libloading 0.8.9", + "log", + "once_cell", + "parking_lot", + "reqwest 0.12.28", + "serde", + "serde_json", + "tauri", + "tauri-build", + "tauri-plugin-dialog", + "tauri-plugin-http", + "tauri-plugin-opener", + "tauri-plugin-process", + "tauri-plugin-updater", + "tauri-plugin-window-state", + "tokio", + "windows 0.61.3", +] + +[[package]] +name = "keyboard-types" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" +dependencies = [ + "bitflags 2.13.2", + "serde", +] + +[[package]] +name = "keyring" +version = "3.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebcc3aff044e5944a8fbaf69eb277d11986064cba30c468730e8b9909fb551c" +dependencies = [ + "byteorder", + "dbus-secret-service", + "log", + "secret-service", + "security-framework 2.11.1", + "security-framework 3.7.0", + "windows-sys 0.60.2", + "zeroize", +] + +[[package]] +name = "libappindicator" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03589b9607c868cc7ae54c0b2a22c8dc03dd41692d48f2d7df73615c6a95dc0a" +dependencies = [ + "glib", + "gtk", + "gtk-sys", + "libappindicator-sys", + "log", +] + +[[package]] +name = "libappindicator-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" +dependencies = [ + "gtk-sys", + "libloading 0.7.4", + "once_cell", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libdbus-sys" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "328c4789d42200f1eeec05bd86c9c13c7f091d2ba9a6ea35acdf51f31bc0f043" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "litrs" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "lru-slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" + +[[package]] +name = "markup5ever" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7122d987ec5f704ee56f6e5b41a7d93722e9aae27ae07cafa4036c4d3f9757de" +dependencies = [ + "log", + "tendril", + "web_atoms", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minisign-verify" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "871285dc19d8d0ebe0eef3d0e99a205f2a71363b122632cbbfa4a6c370a960ce" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "muda" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cca139e57da4383727f189e43e66e84fa372347027fc996f9f1a007ec0a37996" +dependencies = [ + "crossbeam-channel", + "dpi", + "gtk", + "keyboard-types", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "once_cell", + "png", + "serde", + "thiserror 2.0.21", + "windows-sys 0.61.2", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", + "memoffset", +] + +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", + "objc2-exception-helper", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-quartz-core", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-data" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-location" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-exception-helper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7a1c5fbb72d7735b076bb47b578523aedc40f3c439bea6dfd595c089d79d98a" +dependencies = [ + "cc", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "block2", + "libc", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-osa-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-app-kit", + "objc2-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-image", + "objc2-core-location", + "objc2-core-text", + "objc2-foundation", + "objc2-quartz-core", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-web-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "open" +version = "5.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d8c8b8e725ad26404d6896eb2f064294a0a7b4f1d9120210d85544684c4ca95" +dependencies = [ + "dunce", + "is-wsl", + "libc", +] + +[[package]] +name = "openssl-probe" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "osakit" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b" +dependencies = [ + "objc2", + "objc2-foundation", + "objc2-osa-kit", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "pango" +version = "0.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4" +dependencies = [ + "gio", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link 0.2.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plist" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327a4cb2ad49dc48adfdc9da89e22c64d488b508c67a044d71ba729e4521a285" +dependencies = [ + "base64 0.23.1", + "indexmap 2.14.2", + "quick-xml", + "serde", + "time", +] + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +dependencies = [ + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.17+spec-1.1.0", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psl-types" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac" + +[[package]] +name = "publicsuffix" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42ea446cab60335f76979ec15e12619a2165b5ae2c12166bef27d283a9fadf" +dependencies = [ + "idna", + "psl-types", +] + +[[package]] +name = "quick-xml" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" +dependencies = [ + "memchr", +] + +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.21", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" +dependencies = [ + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.3", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.21", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_users" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" +dependencies = [ + "libredox", + "thiserror 2.0.21", +] + +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "cookie", + "cookie_store", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams 0.4.2", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "reqwest" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams 0.5.0", + "web-sys", +] + +[[package]] +name = "rfd" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20dafead71c16a34e1ff357ddefc8afc11e7d51d6d2b9fbd07eaa48e3e540220" +dependencies = [ + "block2", + "dispatch2", + "glib-sys", + "gobject-sys", + "gtk-sys", + "js-sys", + "libc", + "log", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "percent-encoding", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework 3.7.0", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni 0.22.4", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework 3.7.0", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" + +[[package]] +name = "rustls-webpki" +version = "0.103.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "indexmap 1.9.3", + "schemars_derive", + "serde", + "serde_json", + "url", + "uuid", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.119", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "secret-service" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4d35ad99a181be0a60ffcbe85d680d98f87bdc4d7644ade319b87076b9dbfd4" +dependencies = [ + "aes", + "cbc", + "futures-util", + "generic-array", + "hkdf", + "num", + "once_cell", + "rand 0.8.8", + "serde", + "sha2", + "zbus 4.4.0", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "selectors" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adfa1c298912827b8a28b223b3b874357397ae706e6190acd9bf28cee99114d" +dependencies = [ + "bitflags 2.13.2", + "cssparser", + "derive_more", + "log", + "new_debug_unreachable", + "phf", + "phf_codegen", + "precomputed-hash", + "rustc-hash", + "servo_arc", + "smallvec", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-untagged" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" +dependencies = [ + "erased-serde", + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9adc193c780ef8f159aee8b61e2d5801aaa555e6eb0947fe45530ec506296f" +dependencies = [ + "base64 0.23.1", + "bs58", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.14.2", + "jiff", + "schemars 0.9.0", + "schemars 1.2.3", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e17bbc68e28663bbbb90df47e058aa7eda4fb445b89fe70457bb94fbccf6e49" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serialize-to-javascript" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f3666a07a197cdb77cdf306c32be9b7f598d7060d50cfd4d5aa04bfd92f6c5" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772ee033c0916d670af7860b6e1ef7d658a4629a6d0b4c8c3e67f09b3765b75d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "servo_arc" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170fb83ab34de17dc69aa7c67482b22218ddb85da56546f9bd6b929e32a05930" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "softbuffer" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac18da81ebbf05109ab275b157c22a653bb3c12cf884450179942f81bcbf6c3" +dependencies = [ + "bytemuck", + "js-sys", + "ndk", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-quartz-core", + "raw-window-handle", + "redox_syscall", + "tracing", + "wasm-bindgen", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "soup3" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "471f924a40f31251afc77450e781cb26d55c0b650842efafc9c6cbd2f7cc4f9f" +dependencies = [ + "futures-channel", + "gio", + "glib", + "libc", + "soup3-sys", +] + +[[package]] +name = "soup3-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebe8950a680a12f24f15ebe1bf70db7af98ad242d9db43596ad3108aab86c27" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "static_vcruntime" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff7589a1859b09232522bb9edf076ca7fcf14ded96685d3fa629db73023ffbb7" + +[[package]] +name = "string_cache" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared", + "precomputed-hash", +] + +[[package]] +name = "string_cache_codegen" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "swift-rs" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cefd87076fd385308ee4aff597256c902f1fbb4d031de1558efc12f8ffefadd9" +dependencies = [ + "base64 0.21.7", + "serde", + "serde_json", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck 0.5.0", + "pkg-config", + "toml 0.8.2", + "version-compare", +] + +[[package]] +name = "tao" +version = "0.37.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5777b06fe6435126ae8d816eba269e050e1e10d302cf5461e9c49eccabc3548" +dependencies = [ + "bitflags 2.13.2", + "block2", + "core-foundation 0.10.1", + "core-graphics", + "crossbeam-channel", + "dbus", + "dispatch2", + "dlopen2", + "dpi", + "gdkwayland-sys", + "gdkx11-sys", + "gtk", + "jni 0.21.1", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "parking_lot", + "percent-encoding", + "raw-window-handle", + "tao-macros", + "unicode-segmentation", + "url", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-version", + "x11-dl", +] + +[[package]] +name = "tao-macros" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7eeb6d99155545da6150a1795945f16ac9c178deb2a5f2e74d776107bd5849" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tar" +version = "0.4.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tauri" +version = "2.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb0244332cfb9cee7e2a568bf5da29a36ed8fdbd717f6f47a66b6b7b358c072" +dependencies = [ + "anyhow", + "bytes", + "cookie", + "dirs", + "dunce", + "embed_plist", + "getrandom 0.3.4", + "glob", + "gtk", + "heck 0.5.0", + "http", + "http-range", + "jni 0.21.1", + "libc", + "log", + "mime", + "muda", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "objc2-web-kit", + "percent-encoding", + "plist", + "raw-window-handle", + "reqwest 0.13.5", + "serde", + "serde_json", + "serde_repr", + "serialize-to-javascript", + "swift-rs", + "tauri-build", + "tauri-macros", + "tauri-runtime", + "tauri-runtime-wry", + "tauri-utils", + "thiserror 2.0.21", + "tokio", + "tray-icon", + "url", + "webkit2gtk", + "webview2-com", + "window-vibrancy", + "windows 0.62.2", +] + +[[package]] +name = "tauri-build" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adddb0e648752aaac5da9c3c3c6a68e1e87cab55e3b757b18a9441ef8c3ac614" +dependencies = [ + "anyhow", + "cargo_toml", + "dirs", + "glob", + "heck 0.5.0", + "json-patch", + "schemars 0.8.22", + "semver", + "serde", + "serde_json", + "static_vcruntime", + "strsim", + "tauri-utils", + "tauri-winres", + "walkdir", +] + +[[package]] +name = "tauri-codegen" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb37631cf71dab5e8ab55e1bdd701e18a52653d90b78e71d0e5598b1e0a61316" +dependencies = [ + "base64 0.23.1", + "brotli", + "ico", + "json-patch", + "plist", + "png", + "proc-macro2", + "quote", + "semver", + "serde", + "serde_json", + "sha2", + "syn 2.0.119", + "tauri-utils", + "thiserror 2.0.21", + "time", + "url", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-macros" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc38db58854c10fb5f91a887ed8bf82d3239bb92b5d8db86eda09e96d9963d1" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", + "tauri-codegen", + "tauri-utils", +] + +[[package]] +name = "tauri-plugin" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67fb21a77e8f94e8beb3325e583102488659365af0a3948b7ea244c5b779c291" +dependencies = [ + "anyhow", + "glob", + "plist", + "schemars 0.8.22", + "serde", + "serde_json", + "tauri-utils", + "walkdir", +] + +[[package]] +name = "tauri-plugin-dialog" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce0fb9c2b6d34a9720627ed930ebc8af26f61e648695aecaeb03d5c33c5896f5" +dependencies = [ + "log", + "raw-window-handle", + "rfd", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "tauri-plugin-fs", + "thiserror 2.0.21", + "url", +] + +[[package]] +name = "tauri-plugin-fs" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d58eb1d4984e535f47a642ffec09a2da6f5c18a12b5902d12126cb7626d628b" +dependencies = [ + "anyhow", + "dunce", + "glob", + "log", + "objc2-foundation", + "percent-encoding", + "schemars 0.8.22", + "serde", + "serde_json", + "serde_repr", + "tauri", + "tauri-plugin", + "tauri-utils", + "thiserror 2.0.21", + "toml 1.1.8+spec-1.1.0", + "url", +] + +[[package]] +name = "tauri-plugin-http" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c57e3451553f95a1db3bfed6a358a77ce5080b6399a242c6eadac113f97abd2" +dependencies = [ + "bytes", + "cookie_store", + "data-url", + "http", + "regex", + "reqwest 0.12.28", + "schemars 0.8.22", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "tauri-plugin-fs", + "thiserror 2.0.21", + "tokio", + "url", + "urlpattern", +] + +[[package]] +name = "tauri-plugin-opener" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53810be1b4fed22bb6ac3f4cab5a2b80d9391d1af436bda145607532bc0bb219" +dependencies = [ + "dunce", + "glob", + "objc2-app-kit", + "objc2-foundation", + "open", + "schemars 0.8.22", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.21", + "url", + "windows 0.62.2", + "zbus 5.19.0", +] + +[[package]] +name = "tauri-plugin-process" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74ae3d8549ae564c0397377373e262f340908eb23a5b9fbe03f2a00007dc0038" +dependencies = [ + "tauri", + "tauri-plugin", +] + +[[package]] +name = "tauri-plugin-updater" +version = "2.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d957abbcb3f9f6c76d22a3a0f012f30880640d0bccb5634d2b12a9937e4c872b" +dependencies = [ + "base64 0.23.1", + "dirs", + "flate2", + "futures-util", + "http", + "infer", + "libc", + "log", + "minisign-verify", + "osakit", + "percent-encoding", + "reqwest 0.13.5", + "rustls", + "semver", + "serde", + "serde_json", + "tar", + "tauri", + "tauri-plugin", + "tempfile", + "thiserror 2.0.21", + "time", + "tokio", + "url", + "windows-sys 0.61.2", + "zip", +] + +[[package]] +name = "tauri-plugin-window-state" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6815cab7b212f9cfe16a9d79d8d22f9e14159e4a9460f7dec1467167a008e3" +dependencies = [ + "bitflags 2.13.2", + "log", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.21", +] + +[[package]] +name = "tauri-runtime" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c55766d99cea69055904d1735b93c2049302b2e09effd462120deb5581d78e9" +dependencies = [ + "cookie", + "dpi", + "gtk", + "http", + "jni 0.21.1", + "objc2", + "objc2-ui-kit", + "objc2-web-kit", + "raw-window-handle", + "serde", + "serde_json", + "tauri-utils", + "thiserror 2.0.21", + "url", + "webkit2gtk", + "webview2-com", + "windows 0.62.2", +] + +[[package]] +name = "tauri-runtime-wry" +version = "2.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1aa9d8b7a120f879f44fdc1053f7b7dbf416bf0bbc6a72b714dec46b782b52f" +dependencies = [ + "gtk", + "http", + "jni 0.21.1", + "log", + "objc2", + "objc2-app-kit", + "percent-encoding", + "raw-window-handle", + "softbuffer", + "tao", + "tauri-runtime", + "tauri-utils", + "url", + "webkit2gtk", + "webview2-com", + "windows 0.62.2", + "wry", +] + +[[package]] +name = "tauri-utils" +version = "2.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "362ab21cd4cc713f2a02b1a9b5688198b1541cfb6907c4281e9190e0f0ef4aa3" +dependencies = [ + "anyhow", + "brotli", + "cargo_metadata", + "ctor", + "dom_query", + "dunce", + "glob", + "http", + "infer", + "json-patch", + "log", + "memchr", + "phf", + "plist", + "proc-macro2", + "quote", + "regex", + "schemars 0.8.22", + "semver", + "serde", + "serde-untagged", + "serde_json", + "serde_with", + "swift-rs", + "thiserror 2.0.21", + "toml 1.1.8+spec-1.1.0", + "url", + "urlpattern", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-winres" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c52bb6904475a6ca662f15ef787f18ade61d5740a1ee12c45d3b748efdb6f796" +dependencies = [ + "dunce", + "embed-resource", + "toml 1.1.8+spec-1.1.0", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "tendril" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fed54709c5b3a53d09bb1c113ea4f5ceafd1e772ddcb0030a82e1d56c087b08" +dependencies = [ + "new_debug_unreachable", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +dependencies = [ + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "toml" +version = "1.1.8+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d" +dependencies = [ + "indexmap 2.14.2", + "serde_core", + "serde_spanned 1.1.2", + "toml_datetime 1.1.2+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 1.0.4", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.14.2", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +dependencies = [ + "indexmap 2.14.2", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.25.17+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" +dependencies = [ + "indexmap 2.14.2", + "toml_datetime 1.1.2+spec-1.1.0", + "toml_parser", + "winnow 1.0.4", +] + +[[package]] +name = "toml_parser" +version = "1.1.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +dependencies = [ + "winnow 1.0.4", +] + +[[package]] +name = "toml_writer" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags 2.13.2", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tray-icon" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b9c52859a94554803ccd4a24b98f74148ebc73b90676d783f3490b1bff9d72" +dependencies = [ + "crossbeam-channel", + "dirs", + "libappindicator", + "muda", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "once_cell", + "png", + "serde", + "thiserror 2.0.21", + "windows-sys 0.61.2", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typed-path" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "urlpattern" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df16f50ef4cc145211879a3867ba757076b25dfee812040dcb0658bd9ae7904b" +dependencies = [ + "icu_properties", + "regex", + "serde", + "url", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "uuid" +version = "1.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "version-compare" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.9", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wasm-streams" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web_atoms" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba8b815c1b593dc0baf78dd0f4fc8fdb2de53198fb1163738093e9a311c33fb3" +dependencies = [ + "phf", + "phf_codegen", + "string_cache", + "string_cache_codegen", +] + +[[package]] +name = "webkit2gtk" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1027150013530fb2eaf806408df88461ae4815a45c541c8975e61d6f2fc4793" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk", + "gdk-sys", + "gio", + "gio-sys", + "glib", + "glib-sys", + "gobject-sys", + "gtk", + "gtk-sys", + "javascriptcore-rs", + "libc", + "once_cell", + "soup3", + "webkit2gtk-sys", +] + +[[package]] +name = "webkit2gtk-sys" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "916a5f65c2ef0dfe12fff695960a2ec3d4565359fdbb2e9943c974e06c734ea5" +dependencies = [ + "bitflags 1.3.2", + "cairo-sys-rs", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "gtk-sys", + "javascriptcore-rs-sys", + "libc", + "pkg-config", + "soup3-sys", + "system-deps", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e49d0e65abc00c142e8f9428da991da9f1a250c39be97459901eb12b9b49f62a" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "webpki-roots" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5f280bbb2b287bc8e7de7e3852945a0ff50d1bbcb5ed42b6c7a568c546df171" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "webview2-com" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f89fca7a704cee10dcb3654c1dbb8941d1783132f1917358af75bec37a7d7e6" +dependencies = [ + "webview2-com-macros", + "webview2-com-sys", + "windows 0.62.2", + "windows-core 0.62.2", +] + +[[package]] +name = "webview2-com-macros" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a921c1b6914c367b2b823cd4cde6f96beec77d30a939c8199bb377cf9b9b54" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "webview2-com-sys" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb" +dependencies = [ + "thiserror 2.0.21", + "windows 0.62.2", + "windows-core 0.62.2", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "window-vibrancy" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111e51caca442cafd9bab396628ac4d814880eaea4e63dfd76a12e9f342b5580" +dependencies = [ + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "objc2-quartz-core", + "raw-window-handle", + "windows-sys 0.61.2", + "windows-version", +] + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections 0.2.0", + "windows-core 0.61.2", + "windows-future 0.2.1", + "windows-link 0.1.3", + "windows-numerics 0.2.0", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections 0.3.2", + "windows-core 0.62.2", + "windows-future 0.3.2", + "windows-numerics 0.3.1", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading 0.1.0", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core 0.62.2", + "windows-link 0.2.1", + "windows-threading 0.2.1", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core 0.62.2", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-version" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10" +dependencies = [ + "cfg-if", + "windows-sys 0.61.2", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "wry" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759c50ddad0ef9913bb5496cb9d509a50433a3b78cb0238d61105526589cf0e9" +dependencies = [ + "base64 0.23.1", + "block2", + "cookie", + "crossbeam-channel", + "dirs", + "dom_query", + "dpi", + "dunce", + "gdkx11", + "gtk", + "http", + "javascriptcore-rs", + "jni 0.21.1", + "libc", + "ndk", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "objc2-ui-kit", + "objc2-web-kit", + "percent-encoding", + "raw-window-handle", + "sha2", + "soup3", + "tao-macros", + "thiserror 2.0.21", + "url", + "webkit2gtk", + "webkit2gtk-sys", + "webview2-com", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-version", + "x11-dl", +] + +[[package]] +name = "x11" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "xattr" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "963d6fab92d5504b971dc8bd90ca743c2575e590bc8071ea5bc571598667ae08" +dependencies = [ + "libc", + "rustix", +] + +[[package]] +name = "xdg-home" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zbus" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725" +dependencies = [ + "async-broadcast", + "async-process", + "async-recursion", + "async-trait", + "enumflags2", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix 0.29.0", + "ordered-stream", + "rand 0.8.8", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "windows-sys 0.52.0", + "xdg-home", + "zbus_macros 4.4.0", + "zbus_names 3.0.0", + "zvariant 4.2.0", +] + +[[package]] +name = "zbus" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix", + "serde", + "serde_repr", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow 1.0.4", + "zbus_macros 5.19.0", + "zbus_names 4.3.5", + "zvariant 5.15.1", +] + +[[package]] +name = "zbus_macros" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267db9407081e90bbfa46d841d3cbc60f59c0351838c4bc65199ecd79ab1983e" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", + "zvariant_utils 2.1.0", +] + +[[package]] +name = "zbus_macros" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 3.0.9", + "zbus_names 4.3.5", + "zvariant 5.15.1", + "zvariant_utils 4.2.0", +] + +[[package]] +name = "zbus_names" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" +dependencies = [ + "serde", + "static_assertions", + "zvariant 4.2.0", +] + +[[package]] +name = "zbus_names" +version = "4.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" +dependencies = [ + "serde", + "winnow 1.0.4", + "zvariant 5.15.1", +] + +[[package]] +name = "zcheapstr" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "939f186d9ecebe044315a5cb6d6f78568bbc21152adc954d5a0c2f58bdbc9920" +dependencies = [ + "serde", +] + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "zip" +version = "9.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1156b39d142a34b999c2310a50455e0cb3760bf7efad0122f796d813bee26ccb" +dependencies = [ + "crc32fast", + "getrandom 0.4.3", + "indexmap 2.14.2", + "memchr", + "nix 0.31.3", + "typed-path", + "windows-sys 0.61.2", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zvariant" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe" +dependencies = [ + "endi", + "enumflags2", + "serde", + "static_assertions", + "zvariant_derive 4.2.0", +] + +[[package]] +name = "zvariant" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow 1.0.4", + "zcheapstr", + "zvariant_derive 5.15.1", + "zvariant_utils 4.2.0", +] + +[[package]] +name = "zvariant_derive" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", + "zvariant_utils 2.1.0", +] + +[[package]] +name = "zvariant_derive" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 3.0.9", + "zvariant_utils 4.2.0", +] + +[[package]] +name = "zvariant_utils" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zvariant_utils" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.9", + "winnow 1.0.4", +] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml new file mode 100644 index 0000000..0eba538 --- /dev/null +++ b/src-tauri/Cargo.toml @@ -0,0 +1,63 @@ +[package] +name = "kaleido" +version = "0.1.0" +description = "Kaleido — a Plex client for Windows" +authors = ["Elijah"] +edition = "2021" + +[lib] +name = "kaleido_lib" +crate-type = ["staticlib", "cdylib", "rlib"] + +[build-dependencies] +tauri-build = { version = "2", features = [] } + +[dependencies] +tauri = { version = "2", features = ["protocol-asset"] } +tauri-plugin-http = "2" +tauri-plugin-dialog = "2" +tauri-plugin-opener = "2" +tauri-plugin-window-state = "2" +tauri-plugin-updater = "2" +tauri-plugin-process = "2" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +libloading = "0.8" +tokio = { version = "1", features = ["rt-multi-thread", "macros", "fs", "io-util", "sync", "time"] } +reqwest = { version = "0.12", default-features = false, features = ["stream", "rustls-tls", "json"] } +futures-util = "0.3" +fs2 = "0.4" +parking_lot = "0.12" +once_cell = "1" +log = "0.4" + +# Credentials use each OS's native store: Credential Manager, Keychain, Secret Service. +[target.'cfg(target_os = "macos")'.dependencies] +keyring = { version = "3", features = ["apple-native"] } + +[target.'cfg(target_os = "linux")'.dependencies] +keyring = { version = "3", features = ["sync-secret-service", "crypto-rust"] } + +[target.'cfg(windows)'.dependencies] +keyring = { version = "3", features = ["windows-native"] } +windows = { version = "0.61", features = [ + "Win32_Foundation", + "Win32_UI_WindowsAndMessaging", + "Win32_Graphics_Gdi", + "Win32_System_LibraryLoader", + "Win32_UI_Shell", + "Win32_System_Power", + "Win32_Storage_FileSystem", + "Win32_Graphics_DirectComposition", + "Win32_Graphics_Dxgi", + "Win32_Graphics_Dxgi_Common", + "Win32_Graphics_Direct3D", + "Win32_Graphics_Direct3D11", + "Foundation_Numerics", +] } + +[profile.release] +codegen-units = 1 +lto = true +opt-level = 3 +strip = true diff --git a/src-tauri/build.rs b/src-tauri/build.rs new file mode 100644 index 0000000..d860e1e --- /dev/null +++ b/src-tauri/build.rs @@ -0,0 +1,3 @@ +fn main() { + tauri_build::build() +} diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json new file mode 100644 index 0000000..790c2f4 --- /dev/null +++ b/src-tauri/capabilities/default.json @@ -0,0 +1,47 @@ +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "default", + "description": "Kaleido main window", + "windows": [ + "main" + ], + "permissions": [ + "core:default", + "core:window:allow-minimize", + "core:window:allow-toggle-maximize", + "core:window:allow-maximize", + "core:window:allow-unmaximize", + "core:window:allow-close", + "core:window:allow-start-dragging", + "core:window:allow-set-fullscreen", + "core:window:allow-is-fullscreen", + "core:window:allow-is-maximized", + "core:window:allow-show", + "core:window:allow-set-focus", + "core:window:allow-set-title", + "dialog:default", + "opener:default", + "opener:allow-open-path", + "opener:allow-reveal-item-in-dir", + "window-state:default", + { + "identifier": "http:default", + "allow": [ + { + "url": "https://*" + }, + { + "url": "http://*" + }, + { + "url": "https://*:*" + }, + { + "url": "http://*:*" + } + ] + }, + "updater:default", + "process:allow-restart" + ] +} \ No newline at end of file diff --git a/src-tauri/icons/128x128.png b/src-tauri/icons/128x128.png new file mode 100644 index 0000000..f19c9e3 Binary files /dev/null and b/src-tauri/icons/128x128.png differ diff --git a/src-tauri/icons/128x128@2x.png b/src-tauri/icons/128x128@2x.png new file mode 100644 index 0000000..0a234dc Binary files /dev/null and b/src-tauri/icons/128x128@2x.png differ diff --git a/src-tauri/icons/32x32.png b/src-tauri/icons/32x32.png new file mode 100644 index 0000000..177c6d8 Binary files /dev/null and b/src-tauri/icons/32x32.png differ diff --git a/src-tauri/icons/64x64.png b/src-tauri/icons/64x64.png new file mode 100644 index 0000000..d61b68b Binary files /dev/null and b/src-tauri/icons/64x64.png differ diff --git a/src-tauri/icons/Square107x107Logo.png b/src-tauri/icons/Square107x107Logo.png new file mode 100644 index 0000000..e88f1d6 Binary files /dev/null and b/src-tauri/icons/Square107x107Logo.png differ diff --git a/src-tauri/icons/Square142x142Logo.png b/src-tauri/icons/Square142x142Logo.png new file mode 100644 index 0000000..ef54123 Binary files /dev/null and b/src-tauri/icons/Square142x142Logo.png differ diff --git a/src-tauri/icons/Square150x150Logo.png b/src-tauri/icons/Square150x150Logo.png new file mode 100644 index 0000000..fd902ae Binary files /dev/null and b/src-tauri/icons/Square150x150Logo.png differ diff --git a/src-tauri/icons/Square284x284Logo.png b/src-tauri/icons/Square284x284Logo.png new file mode 100644 index 0000000..1df9325 Binary files /dev/null and b/src-tauri/icons/Square284x284Logo.png differ diff --git a/src-tauri/icons/Square30x30Logo.png b/src-tauri/icons/Square30x30Logo.png new file mode 100644 index 0000000..1f93a8f Binary files /dev/null and b/src-tauri/icons/Square30x30Logo.png differ diff --git a/src-tauri/icons/Square310x310Logo.png b/src-tauri/icons/Square310x310Logo.png new file mode 100644 index 0000000..7411624 Binary files /dev/null and b/src-tauri/icons/Square310x310Logo.png differ diff --git a/src-tauri/icons/Square44x44Logo.png b/src-tauri/icons/Square44x44Logo.png new file mode 100644 index 0000000..4ebcd76 Binary files /dev/null and b/src-tauri/icons/Square44x44Logo.png differ diff --git a/src-tauri/icons/Square71x71Logo.png b/src-tauri/icons/Square71x71Logo.png new file mode 100644 index 0000000..d019d26 Binary files /dev/null and b/src-tauri/icons/Square71x71Logo.png differ diff --git a/src-tauri/icons/Square89x89Logo.png b/src-tauri/icons/Square89x89Logo.png new file mode 100644 index 0000000..e0f50f7 Binary files /dev/null and b/src-tauri/icons/Square89x89Logo.png differ diff --git a/src-tauri/icons/StoreLogo.png b/src-tauri/icons/StoreLogo.png new file mode 100644 index 0000000..0001c65 Binary files /dev/null and b/src-tauri/icons/StoreLogo.png differ diff --git a/src-tauri/icons/app-icon.png b/src-tauri/icons/app-icon.png new file mode 100644 index 0000000..50b89b3 Binary files /dev/null and b/src-tauri/icons/app-icon.png differ diff --git a/src-tauri/icons/icon.icns b/src-tauri/icons/icon.icns new file mode 100644 index 0000000..b349829 Binary files /dev/null and b/src-tauri/icons/icon.icns differ diff --git a/src-tauri/icons/icon.ico b/src-tauri/icons/icon.ico new file mode 100644 index 0000000..ee99ae5 Binary files /dev/null and b/src-tauri/icons/icon.ico differ diff --git a/src-tauri/icons/icon.png b/src-tauri/icons/icon.png new file mode 100644 index 0000000..7f56025 Binary files /dev/null and b/src-tauri/icons/icon.png differ diff --git a/src-tauri/src/downloads.rs b/src-tauri/src/downloads.rs new file mode 100644 index 0000000..2d3490c --- /dev/null +++ b/src-tauri/src/downloads.rs @@ -0,0 +1,428 @@ +//! Offline downloads: resumable HTTP transfers of Plex media parts with a small +//! JSON catalog, so downloaded titles stay browsable and playable offline. +//! +//! URLs carrying Plex tokens are only held in memory. The catalog stores the +//! server-relative source path; resuming after a restart asks the interface for +//! a freshly signed URL. + +use std::collections::HashMap; +use std::path::{Path, PathBuf}; +use std::sync::Arc; +use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; + +use futures_util::StreamExt; +use parking_lot::Mutex; +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use tauri::{AppHandle, Emitter, Manager, Runtime}; +use tokio::io::AsyncWriteExt; +use tokio::sync::{watch, Semaphore}; + +const MAX_ACTIVE: usize = 2; + +#[derive(Clone, Serialize, Deserialize, PartialEq, Debug)] +#[serde(rename_all = "lowercase")] +pub enum Status { + Queued, + Downloading, + Paused, + Completed, + Failed, +} + +#[derive(Clone, Serialize, Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct Item { + pub id: String, + pub file_path: String, + pub total: u64, + pub received: u64, + pub status: Status, + #[serde(default)] + pub error: Option, + #[serde(default)] + pub meta: Value, + pub created_at: u64, + #[serde(default)] + pub speed: u64, +} + +pub struct Downloads { + items: Mutex>, + dir: Mutex>, + cancels: Mutex>>, + permits: Arc, + client: reqwest::Client, +} + +impl Default for Downloads { + fn default() -> Self { + Downloads { + items: Mutex::new(Vec::new()), + dir: Mutex::new(None), + cancels: Mutex::new(HashMap::new()), + permits: Arc::new(Semaphore::new(MAX_ACTIVE)), + client: reqwest::Client::builder() + .connect_timeout(Duration::from_secs(20)) + .user_agent("Kaleido") + .build() + .expect("http client"), + } + } +} + +fn now() -> u64 { + SystemTime::now().duration_since(UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) +} + +fn catalog_path(app: &AppHandle) -> PathBuf { + crate::system::data_dir(app).join("downloads.json") +} + +fn save(app: &AppHandle) { + let state = app.state::(); + let items = state.items.lock().clone(); + let path = catalog_path(app); + if let Some(parent) = path.parent() { + let _ = std::fs::create_dir_all(parent); + } + if let Ok(text) = serde_json::to_string_pretty(&items) { + let tmp = path.with_extension("json.tmp"); + if std::fs::write(&tmp, text).is_ok() { + let _ = std::fs::rename(tmp, path); + } + } +} + +/// Loads the catalog at startup. Interrupted transfers become paused: their +/// signed URLs were never persisted. +pub fn restore(app: &AppHandle) { + let Ok(text) = std::fs::read_to_string(catalog_path(app)) else { return }; + let Ok(mut items) = serde_json::from_str::>(&text) else { return }; + for item in items.iter_mut() { + if matches!(item.status, Status::Downloading | Status::Queued) { + // Marked so the interface resumes it once it has a signed URL again. + item.status = Status::Paused; + item.error = Some("interrupted".into()); + } + if item.status == Status::Completed && !Path::new(&item.file_path).exists() { + item.status = Status::Failed; + item.error = Some("The downloaded file is missing.".into()); + } + item.speed = 0; + } + *app.state::().items.lock() = items; +} + +fn update(app: &AppHandle, id: &str, f: impl FnOnce(&mut Item)) -> Option { + let state = app.state::(); + let mut items = state.items.lock(); + let item = items.iter_mut().find(|i| i.id == id)?; + f(item); + let snapshot = item.clone(); + drop(items); + let _ = app.emit("download", &snapshot); + Some(snapshot) +} + +fn sanitize(name: &str) -> String { + let cleaned: String = name + .chars() + .map(|c| if "<>:\"/\\|?*".contains(c) || c.is_control() { '_' } else { c }) + .collect(); + let trimmed = cleaned.trim().trim_end_matches('.').to_string(); + if trimmed.is_empty() { + "Untitled".into() + } else { + trimmed.chars().take(120).collect() + } +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct StartRequest { + id: String, + url: String, + folder: String, + file_name: String, + #[serde(default)] + meta: Value, + /// Artwork to keep with the download: name → signed URL. + #[serde(default)] + assets: HashMap, +} + +#[tauri::command] +pub async fn download_start(app: AppHandle, request: StartRequest) -> Result { + let state = app.state::(); + let dir = state.dir.lock().clone().ok_or("Choose a download folder first.")?; + // The folder may be nested ("Show/Season 1"); sanitize each component. + let folder = request + .folder + .split(['/', '\\']) + .filter(|c| !c.trim().is_empty() && *c != "." && *c != "..") + .fold(dir.clone(), |p, c| p.join(sanitize(c))); + tokio::fs::create_dir_all(&folder).await.map_err(|e| format!("Cannot create the download folder: {e}"))?; + let file_path = folder.join(sanitize(&request.file_name)); + + let mut meta = request.meta.clone(); + if let Value::Object(map) = &mut meta { + let mut local = serde_json::Map::new(); + for (name, url) in &request.assets { + let target = folder.join(format!(".{}.jpg", sanitize(name))); + if fetch_to(&state.client, url, &target).await.is_ok() { + local.insert(name.clone(), Value::String(target.display().to_string())); + } + } + map.insert("localAssets".into(), Value::Object(local)); + } + + let item = Item { + id: request.id.clone(), + file_path: file_path.display().to_string(), + total: 0, + received: 0, + status: Status::Queued, + error: None, + meta, + created_at: now(), + speed: 0, + }; + { + let mut items = state.items.lock(); + items.retain(|i| i.id != item.id); + items.insert(0, item.clone()); + } + save(&app); + let _ = app.emit("download", &item); + spawn(app.clone(), request.id, request.url); + Ok(item) +} + +async fn fetch_to(client: &reqwest::Client, url: &str, target: &Path) -> Result<(), String> { + let bytes = client.get(url).send().await.map_err(|e| e.to_string())?.error_for_status().map_err(|e| e.to_string())?.bytes().await.map_err(|e| e.to_string())?; + tokio::fs::write(target, bytes).await.map_err(|e| e.to_string()) +} + +fn spawn(app: AppHandle, id: String, url: String) { + let (tx, rx) = watch::channel(false); + app.state::().cancels.lock().insert(id.clone(), tx); + tauri::async_runtime::spawn(async move { + let permits = app.state::().permits.clone(); + let _permit = tokio::select! { + p = permits.acquire_owned() => p, + _ = cancelled(rx.clone()) => return, + }; + let result = transfer(&app, &id, &url, rx).await; + app.state::().cancels.lock().remove(&id); + match result { + Ok(true) => { + update(&app, &id, |i| { + i.status = Status::Completed; + i.speed = 0; + i.received = i.total.max(i.received); + }); + } + Ok(false) => {} + Err(e) => { + update(&app, &id, |i| { + i.status = Status::Failed; + i.error = Some(e); + i.speed = 0; + }); + } + } + save(&app); + }); +} + +async fn cancelled(mut rx: watch::Receiver) { + while !*rx.borrow() { + if rx.changed().await.is_err() { + std::future::pending::<()>().await; + } + } +} + +/// Returns Ok(true) when complete, Ok(false) when paused/removed. +async fn transfer(app: &AppHandle, id: &str, url: &str, rx: watch::Receiver) -> Result { + let Some(item) = app.state::().items.lock().iter().find(|i| i.id == id).cloned() else { return Ok(false) }; + let final_path = PathBuf::from(&item.file_path); + let part_path = final_path.with_extension(format!( + "{}.part", + final_path.extension().and_then(|e| e.to_str()).unwrap_or("bin") + )); + let existing = tokio::fs::metadata(&part_path).await.map(|m| m.len()).unwrap_or(0); + + let client = app.state::().client.clone(); + let mut request = client.get(url); + if existing > 0 { + request = request.header("Range", format!("bytes={existing}-")); + } + let response = request.send().await.map_err(|e| format!("Could not reach the server: {e}"))?; + let status = response.status(); + if status.as_u16() == 401 || status.as_u16() == 403 { + return Err("The server does not allow downloads for this account.".into()); + } + if !status.is_success() { + return Err(format!("The server could not provide this file ({status}).")); + } + let resumed = status.as_u16() == 206; + let start = if resumed { existing } else { 0 }; + let total = response.content_length().map(|l| l + start).unwrap_or(0); + let mut file = tokio::fs::OpenOptions::new() + .create(true) + .write(true) + .append(resumed) + .truncate(!resumed) + .open(&part_path) + .await + .map_err(|e| format!("Cannot write the download: {e}"))?; + + update(app, id, |i| { + i.status = Status::Downloading; + i.total = total; + i.received = start; + i.error = None; + }); + save(app); + + let mut stream = response.bytes_stream(); + let mut received = start; + let mut last_emit = Instant::now(); + let mut last_save = Instant::now(); + let mut window_bytes = 0u64; + let mut window_start = Instant::now(); + let mut speed = 0u64; + loop { + if *rx.borrow() { + file.flush().await.ok(); + return Ok(false); + } + let chunk = tokio::select! { + c = stream.next() => c, + _ = cancelled(rx.clone()) => { file.flush().await.ok(); return Ok(false); } + }; + let Some(chunk) = chunk else { break }; + let chunk = chunk.map_err(|e| format!("The transfer was interrupted: {e}"))?; + file.write_all(&chunk).await.map_err(|e| format!("Cannot write the download: {e}"))?; + received += chunk.len() as u64; + window_bytes += chunk.len() as u64; + let elapsed = window_start.elapsed(); + if elapsed >= Duration::from_secs(1) { + speed = (window_bytes as f64 / elapsed.as_secs_f64()) as u64; + window_bytes = 0; + window_start = Instant::now(); + } + if last_emit.elapsed() >= Duration::from_millis(250) { + last_emit = Instant::now(); + update(app, id, |i| { + i.received = received; + i.speed = speed; + }); + } + if last_save.elapsed() >= Duration::from_secs(5) { + last_save = Instant::now(); + save(app); + } + } + file.flush().await.map_err(|e| e.to_string())?; + drop(file); + if total > 0 && received < total { + return Err("The transfer ended early. Resume to continue.".into()); + } + tokio::fs::rename(&part_path, &final_path).await.map_err(|e| format!("Cannot finish the download: {e}"))?; + update(app, id, |i| i.received = received); + Ok(true) +} + +fn cancel(app: &AppHandle, id: &str) { + if let Some(tx) = app.state::().cancels.lock().remove(id) { + let _ = tx.send(true); + } +} + +#[tauri::command] +pub fn download_pause(app: AppHandle, id: String) { + cancel(&app, &id); + update(&app, &id, |i| { + if i.status != Status::Completed { + i.status = Status::Paused; + i.speed = 0; + } + }); + save(&app); +} + +#[tauri::command] +pub fn download_resume(app: AppHandle, id: String, url: String) { + cancel(&app, &id); + update(&app, &id, |i| { + i.status = Status::Queued; + i.error = None; + }); + spawn(app, id, url); +} + +#[tauri::command] +pub async fn download_remove(app: AppHandle, id: String, delete_files: bool) -> Result<(), String> { + cancel(&app, &id); + let removed = { + let state = app.state::(); + let mut items = state.items.lock(); + let pos = items.iter().position(|i| i.id == id); + pos.map(|p| items.remove(p)) + }; + if let (Some(item), true) = (removed, delete_files) { + let path = PathBuf::from(&item.file_path); + // Give the cancelled transfer a moment to release its file handle. + tokio::time::sleep(Duration::from_millis(150)).await; + let _ = tokio::fs::remove_file(&path).await; + let part = path.with_extension(format!("{}.part", path.extension().and_then(|e| e.to_str()).unwrap_or("bin"))); + let _ = tokio::fs::remove_file(&part).await; + if let Value::Object(assets) = &item.meta["localAssets"] { + for v in assets.values() { + if let Some(p) = v.as_str() { + let _ = tokio::fs::remove_file(p).await; + } + } + } + // Remove now-empty folders (season, then show), never the download root. + let root = app.state::().dir.lock().clone(); + let mut folder = path.parent().map(|p| p.to_path_buf()); + while let Some(f) = folder { + if Some(&f) == root.as_ref() || tokio::fs::remove_dir(&f).await.is_err() { + break; + } + folder = f.parent().map(|p| p.to_path_buf()); + } + } + save(&app); + let _ = app.emit("download-removed", &id); + Ok(()) +} + +#[tauri::command] +pub fn download_list(app: AppHandle) -> Vec { + app.state::().items.lock().clone() +} + +#[tauri::command] +pub fn download_set_dir(app: AppHandle, dir: String) -> Result<(), String> { + let path = PathBuf::from(dir); + std::fs::create_dir_all(&path).map_err(|e| format!("Cannot use this folder: {e}"))?; + *app.state::().dir.lock() = Some(path); + Ok(()) +} + +#[tauri::command] +pub fn download_write_meta(app: AppHandle, id: String, meta: Value) { + update(&app, &id, |i| { + let assets = i.meta.get("localAssets").cloned(); + i.meta = meta; + if let (Some(a), Value::Object(m)) = (assets, &mut i.meta) { + m.insert("localAssets".into(), a); + } + }); + save(&app); +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs new file mode 100644 index 0000000..3fad8f2 --- /dev/null +++ b/src-tauri/src/lib.rs @@ -0,0 +1,64 @@ +mod downloads; +mod mpv; +mod platform; +mod player; +mod system; + +use tauri::{Manager, WindowEvent}; + +pub fn run() { + tauri::Builder::default() + .plugin(tauri_plugin_http::init()) + .plugin(tauri_plugin_dialog::init()) + .plugin(tauri_plugin_opener::init()) + .plugin(tauri_plugin_updater::Builder::new().build()) + .plugin(tauri_plugin_process::init()) + .plugin( + tauri_plugin_window_state::Builder::default() + .with_state_flags( + tauri_plugin_window_state::StateFlags::SIZE + | tauri_plugin_window_state::StateFlags::POSITION + | tauri_plugin_window_state::StateFlags::MAXIMIZED, + ) + .build(), + ) + .manage(player::PlayerState::default()) + .manage(downloads::Downloads::default()) + .setup(|app| { + let handle = app.handle().clone(); + downloads::restore(&handle); + if let Some(window) = app.get_webview_window("main") { + let w = window.clone(); + window.on_window_event(move |event| { + if let WindowEvent::Resized(_) | WindowEvent::ScaleFactorChanged { .. } = event { + player::on_resize(&w); + } + }); + } + Ok(()) + }) + .invoke_handler(tauri::generate_handler![ + player::player_init, + player::player_show, + player::player_command, + player::player_set, + player::player_get, + system::secret_get, + system::secret_set, + system::secret_delete, + system::app_info, + system::dev_session, + system::keep_awake, + system::disk_space, + system::save_url, + downloads::download_start, + downloads::download_pause, + downloads::download_resume, + downloads::download_remove, + downloads::download_list, + downloads::download_set_dir, + downloads::download_write_meta, + ]) + .run(tauri::generate_context!()) + .expect("error while running Kaleido"); +} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs new file mode 100644 index 0000000..6355d32 --- /dev/null +++ b/src-tauri/src/main.rs @@ -0,0 +1,6 @@ +// Prevents an additional console window on Windows in release. +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +fn main() { + kaleido_lib::run() +} diff --git a/src-tauri/src/mpv.rs b/src-tauri/src/mpv.rs new file mode 100644 index 0000000..3e9a3f2 --- /dev/null +++ b/src-tauri/src/mpv.rs @@ -0,0 +1,370 @@ +//! A small, dynamically loaded binding to libmpv's client API. +//! +//! libmpv is loaded at runtime (`libmpv-2.dll` beside the executable, or the +//! repository's `vendor/mpv` folder during development) so the application can +//! still start, browse and report a useful error if the library is missing. + +use std::ffi::{c_char, c_int, c_void, CStr, CString}; +use std::path::{Path, PathBuf}; +use std::sync::Arc; + +use libloading::Library; +use serde_json::{Map, Number, Value}; + +const FORMAT_NONE: c_int = 0; +const FORMAT_STRING: c_int = 1; +const FORMAT_FLAG: c_int = 3; +const FORMAT_INT64: c_int = 4; +const FORMAT_DOUBLE: c_int = 5; +const FORMAT_NODE: c_int = 6; +const FORMAT_NODE_ARRAY: c_int = 7; +const FORMAT_NODE_MAP: c_int = 8; + +pub const EVENT_NONE: c_int = 0; +pub const EVENT_SHUTDOWN: c_int = 1; +pub const EVENT_LOG_MESSAGE: c_int = 2; +pub const EVENT_START_FILE: c_int = 6; +pub const EVENT_END_FILE: c_int = 7; +pub const EVENT_FILE_LOADED: c_int = 8; +pub const EVENT_PLAYBACK_RESTART: c_int = 21; +pub const EVENT_PROPERTY_CHANGE: c_int = 22; +pub const EVENT_SEEK: c_int = 20; + +#[repr(C)] +#[derive(Clone, Copy)] +union NodeValue { + string: *mut c_char, + flag: c_int, + int64: i64, + double: f64, + list: *mut NodeList, +} + +#[repr(C)] +pub struct Node { + u: NodeValue, + format: c_int, +} + +#[repr(C)] +struct NodeList { + num: c_int, + values: *mut Node, + keys: *mut *mut c_char, +} + +#[repr(C)] +pub struct RawEvent { + pub event_id: c_int, + pub error: c_int, + pub reply_userdata: u64, + pub data: *mut c_void, +} + +#[repr(C)] +struct EventProperty { + name: *const c_char, + format: c_int, + data: *mut c_void, +} + +#[repr(C)] +struct EventEndFile { + reason: c_int, + error: c_int, + playlist_entry_id: i64, + playlist_insert_id: i64, + playlist_insert_num_entries: c_int, +} + +#[repr(C)] +struct EventLogMessage { + prefix: *const c_char, + level: *const c_char, + text: *const c_char, + log_level: c_int, +} + +type Handle = *mut c_void; + +struct Api { + _lib: Library, + create: unsafe extern "C" fn() -> Handle, + initialize: unsafe extern "C" fn(Handle) -> c_int, + terminate_destroy: unsafe extern "C" fn(Handle), + set_option_string: unsafe extern "C" fn(Handle, *const c_char, *const c_char) -> c_int, + command: unsafe extern "C" fn(Handle, *mut *const c_char) -> c_int, + set_property: unsafe extern "C" fn(Handle, *const c_char, c_int, *mut c_void) -> c_int, + get_property: unsafe extern "C" fn(Handle, *const c_char, c_int, *mut c_void) -> c_int, + observe_property: unsafe extern "C" fn(Handle, u64, *const c_char, c_int) -> c_int, + wait_event: unsafe extern "C" fn(Handle, f64) -> *mut RawEvent, + free_node_contents: unsafe extern "C" fn(*mut Node), + error_string: unsafe extern "C" fn(c_int) -> *const c_char, + request_log_messages: unsafe extern "C" fn(Handle, *const c_char) -> c_int, +} + +/// Candidate locations for libmpv, in priority order: bundled resources, the +/// executable's folder, the repository's `vendor/mpv/` (development), and +/// finally bare names for the system library search path. +pub fn library_candidates(resource_dir: Option) -> Vec { + let os = if cfg!(target_os = "windows") { + "windows" + } else if cfg!(target_os = "macos") { + "macos" + } else { + "linux" + }; + let mut dirs: Vec = Vec::new(); + if let Some(dir) = resource_dir { + dirs.push(dir.join("lib")); + dirs.push(dir); + } + if let Ok(exe) = std::env::current_exe() { + if let Some(dir) = exe.parent() { + dirs.push(dir.to_path_buf()); + dirs.push(dir.join("../Frameworks")); + } + } + dirs.push(Path::new(env!("CARGO_MANIFEST_DIR")).join("../vendor/mpv").join(os)); + let mut out: Vec = dirs + .iter() + .flat_map(|d| crate::platform::MPV_LIBRARIES.iter().map(move |n| d.join(n))) + .filter(|p| p.exists()) + .collect(); + out.extend(crate::platform::MPV_LIBRARIES.iter().map(PathBuf::from)); + out +} + +pub struct Mpv { + api: Api, + handle: Handle, +} + +// libmpv's client API is thread safe: every function may be called from any thread. +unsafe impl Send for Mpv {} +unsafe impl Sync for Mpv {} + +#[derive(Debug)] +pub enum Event { + Shutdown, + StartFile, + FileLoaded, + PlaybackRestart, + Seek, + EndFile { reason: &'static str, error: Option }, + Property { name: String, value: Value }, + Log { level: String, prefix: String, text: String }, + Other, +} + +impl Mpv { + pub fn load(candidates: &[PathBuf]) -> Result, String> { + unsafe { + let lib = candidates + .iter() + .find_map(|p| Library::new(p).ok()) + .ok_or_else(|| "libmpv was not found. Reinstall Kaleido to restore video playback.".to_string())?; + macro_rules! sym { + ($name:literal) => { + *lib.get(concat!($name, "\0").as_bytes()).map_err(|e| format!("libmpv is missing {}: {e}", $name))? + }; + } + let api = Api { + create: sym!("mpv_create"), + initialize: sym!("mpv_initialize"), + terminate_destroy: sym!("mpv_terminate_destroy"), + set_option_string: sym!("mpv_set_option_string"), + command: sym!("mpv_command"), + set_property: sym!("mpv_set_property"), + get_property: sym!("mpv_get_property"), + observe_property: sym!("mpv_observe_property"), + wait_event: sym!("mpv_wait_event"), + free_node_contents: sym!("mpv_free_node_contents"), + error_string: sym!("mpv_error_string"), + request_log_messages: sym!("mpv_request_log_messages"), + _lib: lib, + }; + let handle = (api.create)(); + if handle.is_null() { + return Err("libmpv could not create a player.".into()); + } + Ok(Arc::new(Mpv { api, handle })) + } + } + + fn error(&self, code: c_int) -> String { + unsafe { CStr::from_ptr((self.api.error_string)(code)).to_string_lossy().into_owned() } + } + + fn check(&self, code: c_int, what: &str) -> Result<(), String> { + if code < 0 { + Err(format!("{what}: {}", self.error(code))) + } else { + Ok(()) + } + } + + pub fn set_option(&self, name: &str, value: &str) -> Result<(), String> { + let n = CString::new(name).unwrap(); + let v = CString::new(value).unwrap(); + self.check(unsafe { (self.api.set_option_string)(self.handle, n.as_ptr(), v.as_ptr()) }, name) + } + + pub fn initialize(&self) -> Result<(), String> { + self.check(unsafe { (self.api.initialize)(self.handle) }, "initialize") + } + + pub fn request_log_messages(&self, level: &str) { + let l = CString::new(level).unwrap(); + unsafe { (self.api.request_log_messages)(self.handle, l.as_ptr()) }; + } + + pub fn command(&self, args: &[String]) -> Result<(), String> { + let owned: Vec = args.iter().map(|a| CString::new(a.as_str()).unwrap_or_default()).collect(); + let mut ptrs: Vec<*const c_char> = owned.iter().map(|c| c.as_ptr()).collect(); + ptrs.push(std::ptr::null()); + let what = args.first().cloned().unwrap_or_default(); + self.check(unsafe { (self.api.command)(self.handle, ptrs.as_mut_ptr()) }, &what) + } + + pub fn set_property(&self, name: &str, value: &Value) -> Result<(), String> { + let n = CString::new(name).unwrap(); + // Scalars use their native formats; anything else goes through a string. + unsafe { + let code = match value { + Value::Bool(b) => { + let mut v: c_int = *b as c_int; + (self.api.set_property)(self.handle, n.as_ptr(), FORMAT_FLAG, &mut v as *mut _ as *mut c_void) + } + Value::Number(num) if num.is_i64() => { + let mut v: i64 = num.as_i64().unwrap(); + (self.api.set_property)(self.handle, n.as_ptr(), FORMAT_INT64, &mut v as *mut _ as *mut c_void) + } + Value::Number(num) => { + let mut v: f64 = num.as_f64().unwrap_or(0.0); + (self.api.set_property)(self.handle, n.as_ptr(), FORMAT_DOUBLE, &mut v as *mut _ as *mut c_void) + } + Value::String(s) => { + let c = CString::new(s.as_str()).unwrap_or_default(); + let mut p = c.as_ptr(); + (self.api.set_property)(self.handle, n.as_ptr(), FORMAT_STRING, &mut p as *mut _ as *mut c_void) + } + Value::Null => { + let c = CString::new("no").unwrap(); + let mut p = c.as_ptr(); + (self.api.set_property)(self.handle, n.as_ptr(), FORMAT_STRING, &mut p as *mut _ as *mut c_void) + } + other => { + let c = CString::new(other.to_string()).unwrap_or_default(); + let mut p = c.as_ptr(); + (self.api.set_property)(self.handle, n.as_ptr(), FORMAT_STRING, &mut p as *mut _ as *mut c_void) + } + }; + self.check(code, name) + } + } + + pub fn get_property(&self, name: &str) -> Result { + let n = CString::new(name).unwrap(); + unsafe { + let mut node: Node = std::mem::zeroed(); + let code = (self.api.get_property)(self.handle, n.as_ptr(), FORMAT_NODE, &mut node as *mut _ as *mut c_void); + self.check(code, name)?; + let value = node_to_json(&node); + (self.api.free_node_contents)(&mut node); + Ok(value) + } + } + + pub fn observe(&self, id: u64, name: &str) { + let n = CString::new(name).unwrap(); + unsafe { (self.api.observe_property)(self.handle, id, n.as_ptr(), FORMAT_NODE) }; + } + + /// Blocks for up to `timeout` seconds. Only one thread may wait for events. + pub fn wait_event(&self, timeout: f64) -> Option { + unsafe { + let ev = &*(self.api.wait_event)(self.handle, timeout); + Some(match ev.event_id { + EVENT_NONE => return None, + EVENT_SHUTDOWN => Event::Shutdown, + EVENT_START_FILE => Event::StartFile, + EVENT_FILE_LOADED => Event::FileLoaded, + EVENT_PLAYBACK_RESTART => Event::PlaybackRestart, + EVENT_SEEK => Event::Seek, + EVENT_END_FILE => { + let data = &*(ev.data as *const EventEndFile); + let reason = match data.reason { + 0 => "eof", + 2 => "stop", + 3 => "quit", + 4 => "error", + 5 => "redirect", + _ => "unknown", + }; + let error = if data.reason == 4 { Some(self.error(data.error)) } else { None }; + Event::EndFile { reason, error } + } + EVENT_PROPERTY_CHANGE => { + let data = &*(ev.data as *const EventProperty); + let name = CStr::from_ptr(data.name).to_string_lossy().into_owned(); + let value = if data.format == FORMAT_NODE && !data.data.is_null() { + node_to_json(&*(data.data as *const Node)) + } else { + Value::Null + }; + Event::Property { name, value } + } + EVENT_LOG_MESSAGE => { + let data = &*(ev.data as *const EventLogMessage); + Event::Log { + level: CStr::from_ptr(data.level).to_string_lossy().into_owned(), + prefix: CStr::from_ptr(data.prefix).to_string_lossy().into_owned(), + text: CStr::from_ptr(data.text).to_string_lossy().trim_end().to_string(), + } + } + _ => Event::Other, + }) + } + } +} + +impl Drop for Mpv { + fn drop(&mut self) { + unsafe { (self.api.terminate_destroy)(self.handle) } + } +} + +unsafe fn node_to_json(node: &Node) -> Value { + match node.format { + FORMAT_STRING => { + if node.u.string.is_null() { + Value::Null + } else { + Value::String(CStr::from_ptr(node.u.string).to_string_lossy().into_owned()) + } + } + FORMAT_FLAG => Value::Bool(node.u.flag != 0), + FORMAT_INT64 => Value::Number(node.u.int64.into()), + FORMAT_DOUBLE => Number::from_f64(node.u.double).map(Value::Number).unwrap_or(Value::Null), + FORMAT_NODE_ARRAY => { + let list = &*node.u.list; + let mut out = Vec::with_capacity(list.num.max(0) as usize); + for i in 0..list.num as isize { + out.push(node_to_json(&*list.values.offset(i))); + } + Value::Array(out) + } + FORMAT_NODE_MAP => { + let list = &*node.u.list; + let mut out = Map::new(); + for i in 0..list.num as isize { + let key = CStr::from_ptr(*list.keys.offset(i)).to_string_lossy().into_owned(); + out.insert(key, node_to_json(&*list.values.offset(i))); + } + Value::Object(out) + } + FORMAT_NONE => Value::Null, + _ => Value::Null, + } +} diff --git a/src-tauri/src/platform/linux.rs b/src-tauri/src/platform/linux.rs new file mode 100644 index 0000000..d287122 --- /dev/null +++ b/src-tauri/src/platform/linux.rs @@ -0,0 +1,31 @@ +//! Linux: render mpv through its render API (OpenGL) beneath the WebKitGTK +//! view, then implement `VideoSurface` here. +//! +//! Browsing, downloads, settings and updates already work here; only native +//! video composition remains to be written. + +use tauri::{Runtime, WebviewWindow}; + +use crate::mpv::Mpv; + +pub const SURFACE_PROPERTIES: &[&str] = &[]; +pub const MPV_LIBRARIES: &[&str] = &["libmpv.so.2", "libmpv.so"]; + +pub struct VideoSurface; + +impl VideoSurface { + pub fn create(_: &WebviewWindow) -> Result { + Err("Video playback is not available on this platform yet.".into()) + } + pub fn mpv_options(&self) -> Vec<(&'static str, String)> { + Vec::new() + } + pub fn on_property(&mut self, _: &str, _: &serde_json::Value) {} + pub fn show(&mut self, _: bool) {} + pub fn fit(&mut self, _: &WebviewWindow, _: Option<&Mpv>) {} +} + +pub fn hold_awake(rx: std::sync::mpsc::Receiver<()>) { + // TODO(Linux): org.freedesktop.ScreenSaver.Inhibit over D-Bus. + let _ = rx.recv(); +} diff --git a/src-tauri/src/platform/macos.rs b/src-tauri/src/platform/macos.rs new file mode 100644 index 0000000..44a51bc --- /dev/null +++ b/src-tauri/src/platform/macos.rs @@ -0,0 +1,31 @@ +//! macOS: render mpv through its render API (libplacebo) into a CAMetalLayer +//! placed beneath the WKWebView, then implement `VideoSurface` here. +//! +//! Browsing, downloads, settings and updates already work here; only native +//! video composition remains to be written. + +use tauri::{Runtime, WebviewWindow}; + +use crate::mpv::Mpv; + +pub const SURFACE_PROPERTIES: &[&str] = &[]; +pub const MPV_LIBRARIES: &[&str] = &["libmpv.2.dylib", "libmpv.dylib"]; + +pub struct VideoSurface; + +impl VideoSurface { + pub fn create(_: &WebviewWindow) -> Result { + Err("Video playback is not available on this platform yet.".into()) + } + pub fn mpv_options(&self) -> Vec<(&'static str, String)> { + Vec::new() + } + pub fn on_property(&mut self, _: &str, _: &serde_json::Value) {} + pub fn show(&mut self, _: bool) {} + pub fn fit(&mut self, _: &WebviewWindow, _: Option<&Mpv>) {} +} + +pub fn hold_awake(rx: std::sync::mpsc::Receiver<()>) { + // TODO(macOS): IOPMAssertionCreateWithName(PreventUserIdleDisplaySleep). + let _ = rx.recv(); +} diff --git a/src-tauri/src/platform/mod.rs b/src-tauri/src/platform/mod.rs new file mode 100644 index 0000000..2478be7 --- /dev/null +++ b/src-tauri/src/platform/mod.rs @@ -0,0 +1,23 @@ +//! Everything that differs between operating systems lives in this module. +//! Each platform file exposes the same items: +//! +//! - `VideoSurface`: composes mpv's output beneath the web view +//! (`create`, `mpv_options`, `on_property`, `show`, `fit`). +//! - `SURFACE_PROPERTIES`: mpv properties the surface observes. +//! - `MPV_LIBRARIES`: libmpv file names to look for. +//! - `hold_awake`: prevents display sleep until the receiver closes. + +#[cfg(target_os = "windows")] +mod windows; +#[cfg(target_os = "windows")] +pub use self::windows::*; + +#[cfg(target_os = "macos")] +mod macos; +#[cfg(target_os = "macos")] +pub use self::macos::*; + +#[cfg(target_os = "linux")] +mod linux; +#[cfg(target_os = "linux")] +pub use self::linux::*; diff --git a/src-tauri/src/platform/windows.rs b/src-tauri/src/platform/windows.rs new file mode 100644 index 0000000..9ec0543 --- /dev/null +++ b/src-tauri/src/platform/windows.rs @@ -0,0 +1,133 @@ +//! Windows: DirectComposition video surface, libmpv names and power requests. + +use std::ffi::c_void; +use tauri::{Runtime, WebviewWindow}; +use ::windows::core::{IUnknown, Interface}; +use ::windows::Win32::Foundation::{HWND, RECT}; +use ::windows::Win32::Graphics::DirectComposition::*; +use ::windows::Win32::UI::WindowsAndMessaging::GetClientRect; + +use crate::mpv::Mpv; + +pub struct VideoSurface { + attached: usize, + device: IDCompositionDevice, + _target: IDCompositionTarget, + root: IDCompositionVisual, + visible: bool, + pub width: i32, + pub height: i32, +} + +// DirectComposition objects may be used from any thread when access is +// serialized; the surface always sits behind PlayerState's mutex. +unsafe impl Send for VideoSurface {} + +fn client_size(hwnd: HWND) -> (i32, i32) { + let mut rect = RECT::default(); + unsafe { + let _ = GetClientRect(hwnd, &mut rect); + } + ((rect.right - rect.left).max(16), (rect.bottom - rect.top).max(16)) +} + +impl VideoSurface { + pub fn create(window: &WebviewWindow) -> Result { + let hwnd = HWND(window.hwnd().map_err(|e| e.to_string())?.0 as _); + unsafe { + let device: IDCompositionDevice = + DCompositionCreateDevice2(None).map_err(|e| format!("DirectComposition is unavailable: {e}"))?; + // topmost = false: the visual tree is composed behind the window's children. + let target = device.CreateTargetForHwnd(hwnd, false).map_err(|e| e.to_string())?; + let root = device.CreateVisual().map_err(|e| e.to_string())?; + let (width, height) = client_size(hwnd); + device.Commit().map_err(|e| e.to_string())?; + let _ = ⌖ + Ok(VideoSurface { + attached: 0, + device, + _target: target, + root, + visible: false, + width, + height, + }) + } + } + + /// mpv renders into a composition swapchain (`display-swapchain`), shown + /// in a DirectComposition visual behind the web view's child windows. + pub fn mpv_options(&self) -> Vec<(&'static str, String)> { + vec![ + ("vo", "gpu-next".into()), + ("gpu-api", "d3d11".into()), + ("d3d11-output-mode", "composition".into()), + ("d3d11-composition-size", format!("{}x{}", self.width, self.height)), + ] + } + + pub fn on_property(&mut self, name: &str, value: &serde_json::Value) { + if name == "display-swapchain" { + self.attach(value.as_i64().unwrap_or(0) as usize); + } + } + + /// Shows mpv's current swapchain; mpv recreates it with its video output. + fn attach(&mut self, swapchain: usize) { + if swapchain == self.attached { + return; + } + self.attached = swapchain; + unsafe { + let raw = swapchain as *mut c_void; + let result = match IUnknown::from_raw_borrowed(&raw) { + Some(unknown) if swapchain != 0 => self.root.SetContent(unknown), + _ => self.root.SetContent(None::<&IUnknown>), + }; + if let Err(e) = result { + eprintln!("[video] could not attach swapchain: {e}"); + } + let _ = self.device.Commit(); + } + } + + pub fn show(&mut self, visible: bool) { + if self.visible == visible { + return; + } + self.visible = visible; + unsafe { + let _ = if visible { self._target.SetRoot(&self.root) } else { self._target.SetRoot(None::<&IDCompositionVisual>) }; + let _ = self.device.Commit(); + } + } + + pub fn fit(&mut self, window: &WebviewWindow, mpv: Option<&Mpv>) { + let Ok(h) = window.hwnd() else { return }; + let (w, h) = client_size(HWND(h.0 as _)); + if (w, h) == (self.width, self.height) { + return; + } + self.width = w; + self.height = h; + if let Some(mpv) = mpv { + let _ = mpv.set_property("d3d11-composition-size", &serde_json::Value::String(format!("{w}x{h}"))); + } + } +} + +/// mpv properties the surface needs to observe. +pub const SURFACE_PROPERTIES: &[&str] = &["display-swapchain"]; + +/// File names libmpv may have on this platform. +pub const MPV_LIBRARIES: &[&str] = &["libmpv-2.dll", "mpv-2.dll"]; + +/// Keeps the display awake until `rx` closes or receives. +pub fn hold_awake(rx: std::sync::mpsc::Receiver<()>) { + use ::windows::Win32::System::Power::*; + unsafe { + SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED); + let _ = rx.recv(); + SetThreadExecutionState(ES_CONTINUOUS); + } +} diff --git a/src-tauri/src/player.rs b/src-tauri/src/player.rs new file mode 100644 index 0000000..43f2d3e --- /dev/null +++ b/src-tauri/src/player.rs @@ -0,0 +1,207 @@ +//! Video playback: one long-lived libmpv instance whose output is composed +//! beneath the (transparent) web view, so the interface draws its controls +//! directly over the video. How the video reaches the screen is platform +//! specific; see `platform::VideoSurface`. + +use std::sync::Arc; +use std::time::{Duration, Instant}; + +use parking_lot::Mutex; +use serde::Deserialize; +use serde_json::{json, Value}; +use tauri::{AppHandle, Emitter, Manager, Runtime, WebviewWindow}; + +use crate::mpv::{self, Event, Mpv}; +use crate::platform::VideoSurface; + +#[derive(Default)] +pub struct PlayerState { + mpv: Mutex>>, + surface: Mutex>, +} + +/// Properties streamed to the interface as they change. +const OBSERVED: &[&str] = &[ + "time-pos", + "duration", + "pause", + "paused-for-cache", + "cache-buffering-state", + "demuxer-cache-time", + "eof-reached", + "idle-active", + "track-list", + "volume", + "mute", + "speed", + "sub-delay", + "audio-delay", + "video-params", + "hwdec-current", + "chapter-list", + "seeking", +]; + +#[derive(Deserialize, Default)] +#[serde(rename_all = "camelCase")] +pub struct InitOptions { + #[serde(default)] + pub hwdec: Option, + #[serde(default)] + pub hdr: Option, + #[serde(default)] + pub extra: Vec<(String, String)>, +} + +fn emit(app: &AppHandle, payload: Value) { + let _ = app.emit("mpv", payload); +} + +fn create_player(app: &AppHandle, window: &WebviewWindow, opts: &InitOptions) -> Result, String> { + let resource_dir = app.path().resource_dir().ok(); + let mpv = Mpv::load(&mpv::library_candidates(resource_dir))?; + let surface = VideoSurface::create(window)?; + let render_options = surface.mpv_options(); + *app.state::().surface.lock() = Some(surface); + + let set = |k: &str, v: &str| mpv.set_option(k, v); + for (k, v) in &render_options { + set(k, v)?; + } + set("hwdec", opts.hwdec.as_deref().unwrap_or("auto-safe"))?; + set("keep-open", "yes")?; + set("idle", "yes")?; + set("force-window", "yes")?; + set("osc", "no")?; + set("osd-level", "0")?; + set("input-default-bindings", "no")?; + set("input-vo-keyboard", "no")?; + set("input-cursor", "no")?; + set("cursor-autohide", "no")?; + set("terminal", "no")?; + set("ytdl", "no")?; + set("sub-auto", "no")?; + set("audio-client-name", "Kaleido")?; + set("title", "Kaleido")?; + set("cache", "yes")?; + set("demuxer-max-bytes", "300MiB")?; + set("demuxer-max-back-bytes", "100MiB")?; + set("demuxer-readahead-secs", "30")?; + set("network-timeout", "30")?; + set("hr-seek", "yes")?; + set("background-color", "#000000")?; + set("user-agent", "Kaleido")?; + if opts.hdr.unwrap_or(true) { + let _ = set("target-colorspace-hint", "yes"); + } + for (k, v) in &opts.extra { + let _ = set(k, v); + } + mpv.request_log_messages("warn"); + mpv.initialize()?; + for (i, name) in OBSERVED.iter().chain(crate::platform::SURFACE_PROPERTIES).enumerate() { + mpv.observe(i as u64 + 1, name); + } + + let events = mpv.clone(); + let app = app.clone(); + std::thread::Builder::new() + .name("mpv-events".into()) + .spawn(move || event_loop(app, events)) + .map_err(|e| e.to_string())?; + Ok(mpv) +} + +fn event_loop(app: AppHandle, mpv: Arc) { + let mut last_time = Instant::now() - Duration::from_secs(1); + let mut last_pos = -1.0f64; + loop { + let Some(event) = mpv.wait_event(1.0) else { continue }; + match event { + Event::Shutdown => break, + Event::StartFile => emit(&app, json!({"type": "start-file"})), + Event::FileLoaded => emit(&app, json!({"type": "file-loaded"})), + Event::PlaybackRestart => emit(&app, json!({"type": "playback-restart"})), + Event::Seek => emit(&app, json!({"type": "seek"})), + Event::EndFile { reason, error } => emit(&app, json!({"type": "end-file", "reason": reason, "error": error})), + Event::Property { name, value } => { + if crate::platform::SURFACE_PROPERTIES.contains(&name.as_str()) { + let state = app.state::(); + let mut surface = state.surface.lock(); + if let Some(surface) = surface.as_mut() { + surface.on_property(&name, &value); + } + continue; + } + if name == "time-pos" { + // Positions change every frame; a few updates a second suffice. + let pos = value.as_f64().unwrap_or(-1.0); + let now = Instant::now(); + if now.duration_since(last_time) < Duration::from_millis(200) && (pos - last_pos).abs() < 1.5 { + continue; + } + last_time = now; + last_pos = pos; + } + emit(&app, json!({"type": "property", "name": name, "value": value})); + } + Event::Log { level, prefix, text } => { + eprintln!("[mpv {level}] {prefix}: {text}"); + emit(&app, json!({"type": "log", "level": level, "prefix": prefix, "text": text})); + } + Event::Other => {} + } + } +} + +fn player(app: &AppHandle) -> Result, String> { + app.state::().mpv.lock().clone().ok_or_else(|| "The player has not started.".to_string()) +} + +#[tauri::command] +pub async fn player_init(app: AppHandle, window: WebviewWindow, options: Option) -> Result<(), String> { + let state = app.state::(); + let mut guard = state.mpv.lock(); + if guard.is_none() { + *guard = Some(create_player(&app, &window, &options.unwrap_or_default())?); + } + Ok(()) +} + +#[tauri::command] +pub async fn player_show(app: AppHandle, window: WebviewWindow, visible: bool) -> Result<(), String> { + let state = app.state::(); + let mpv = state.mpv.lock().clone(); + let mut surface = state.surface.lock(); + if let Some(surface) = surface.as_mut() { + surface.fit(&window, mpv.as_deref()); + surface.show(visible); + } + Ok(()) +} + +#[tauri::command] +pub async fn player_command(app: AppHandle, args: Vec) -> Result<(), String> { + player(&app)?.command(&args) +} + +#[tauri::command] +pub async fn player_set(app: AppHandle, name: String, value: Value) -> Result<(), String> { + player(&app)?.set_property(&name, &value) +} + +#[tauri::command] +pub async fn player_get(app: AppHandle, name: String) -> Result { + player(&app)?.get_property(&name) +} + +/// Keeps the video surface matched to the window's client area. +pub fn on_resize(window: &WebviewWindow) { + let app = window.app_handle(); + let state = app.state::(); + let mpv = state.mpv.lock().clone(); + let mut surface = state.surface.lock(); + if let Some(surface) = surface.as_mut() { + surface.fit(window, mpv.as_deref()); + } +} diff --git a/src-tauri/src/system.rs b/src-tauri/src/system.rs new file mode 100644 index 0000000..c7999e8 --- /dev/null +++ b/src-tauri/src/system.rs @@ -0,0 +1,161 @@ +//! Small platform services: credential storage, app paths, power and disk. + +use std::sync::mpsc::{channel, Sender}; + +use parking_lot::Mutex; +use serde::Serialize; +use serde_json::{json, Value}; +use tauri::{AppHandle, Manager, Runtime}; + +const SERVICE: &str = "tv.kaleido.desktop"; + +fn entry(key: &str) -> Result { + keyring::Entry::new(SERVICE, key).map_err(|e| e.to_string()) +} + +/// Secrets (Plex tokens) live in Windows Credential Manager, never in plain files. +#[tauri::command] +pub fn secret_get(key: String) -> Result, String> { + match entry(&key)?.get_password() { + Ok(v) => Ok(Some(v)), + Err(keyring::Error::NoEntry) => Ok(None), + Err(e) => Err(e.to_string()), + } +} + +#[tauri::command] +pub fn secret_set(key: String, value: String) -> Result<(), String> { + entry(&key)?.set_password(&value).map_err(|e| e.to_string()) +} + +#[tauri::command] +pub fn secret_delete(key: String) -> Result<(), String> { + match entry(&key)?.delete_credential() { + Ok(()) | Err(keyring::Error::NoEntry) => Ok(()), + Err(e) => Err(e.to_string()), + } +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct AppInfo { + version: String, + data_dir: String, + default_download_dir: String, + platform: String, + device_name: String, +} + +#[tauri::command] +pub fn app_info(app: AppHandle) -> AppInfo { + let paths = app.path(); + let data = paths.app_data_dir().map(|p| p.display().to_string()).unwrap_or_default(); + let downloads = paths + .video_dir() + .map(|p| p.join("Kaleido")) + .or_else(|_| paths.app_data_dir().map(|p| p.join("Downloads"))) + .map(|p| p.display().to_string()) + .unwrap_or_default(); + AppInfo { + version: app.package_info().version.to_string(), + data_dir: data, + default_download_dir: downloads, + platform: std::env::consts::OS.to_string(), + device_name: std::env::var("COMPUTERNAME").unwrap_or_else(|_| "Windows PC".into()), + } +} + +/// Development builds can start signed in from the repository's ignored `.env` +/// (`PLEX_SERVER_URL`, `PLEX_TOKEN`). Release builds never read it. +#[tauri::command] +pub fn dev_session() -> Option { + if !cfg!(debug_assertions) { + return None; + } + let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join(".."); + let path = std::env::var("KALEIDO_DEV_ENV") + .ok() + .map(std::path::PathBuf::from) + .into_iter() + .chain([root.join(".env"), root.join("../Custom plex client/.env")]) + .find(|p| p.exists())?; + let text = std::fs::read_to_string(path).ok()?; + let mut server = None; + let mut token = None; + for line in text.lines() { + if let Some((k, v)) = line.split_once('=') { + let v = v.trim().trim_matches('"').to_string(); + match k.trim() { + "PLEX_SERVER_URL" => server = Some(v), + "PLEX_TOKEN" => token = Some(v), + _ => {} + } + } + } + Some(json!({ "server": server?, "token": token? })) +} + +static AWAKE: Mutex>> = Mutex::new(None); + +/// Prevents display sleep during playback. +#[tauri::command] +pub fn keep_awake(enabled: bool) { + let mut guard = AWAKE.lock(); + if let Some(stop) = guard.take() { + let _ = stop.send(()); + } + if !enabled { + return; + } + let (tx, rx) = channel::<()>(); + *guard = Some(tx); + std::thread::spawn(move || crate::platform::hold_awake(rx)); +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DiskSpace { + free: u64, + total: u64, +} + +#[tauri::command] +pub fn disk_space(path: String) -> Result { + // Walk up to an existing folder; the download folder may not exist yet. + let mut p = std::path::PathBuf::from(&path); + while !p.exists() { + if !p.pop() { + break; + } + } + Ok(DiskSpace { + free: fs2::available_space(&p).map_err(|e| e.to_string())?, + total: fs2::total_space(&p).map_err(|e| e.to_string())?, + }) +} + +#[allow(dead_code)] +pub fn data_dir(app: &AppHandle) -> std::path::PathBuf { + app.path().app_data_dir().unwrap_or_else(|_| std::env::temp_dir().join("Kaleido")) +} + +/// Saves a URL (e.g. server logs) to a file the user chose. +#[tauri::command] +pub async fn save_url(url: String, path: String) -> Result { + use futures_util::StreamExt; + use tokio::io::AsyncWriteExt; + let response = reqwest::Client::new().get(&url).send().await.map_err(|e| e.to_string())?; + if !response.status().is_success() { + return Err(format!("The server returned {}", response.status())); + } + let mut file = tokio::fs::File::create(&path).await.map_err(|e| e.to_string())?; + let mut stream = response.bytes_stream(); + let mut total = 0u64; + while let Some(chunk) = stream.next().await { + let chunk = chunk.map_err(|e| e.to_string())?; + total += chunk.len() as u64; + file.write_all(&chunk).await.map_err(|e| e.to_string())?; + } + file.flush().await.map_err(|e| e.to_string())?; + Ok(total) +} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json new file mode 100644 index 0000000..2ce1da6 --- /dev/null +++ b/src-tauri/tauri.conf.json @@ -0,0 +1,64 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "productName": "Kaleido", + "version": "0.1.0", + "identifier": "tv.kaleido.desktop", + "build": { + "beforeDevCommand": "npm run dev", + "devUrl": "http://localhost:1420", + "beforeBuildCommand": "npm run build", + "frontendDist": "../dist" + }, + "app": { + "withGlobalTauri": false, + "windows": [ + { + "label": "main", + "title": "Kaleido", + "width": 1480, + "height": 900, + "minWidth": 900, + "minHeight": 580, + "center": true, + "decorations": false, + "transparent": false, + "shadow": true, + "visible": false, + "dragDropEnabled": false + } + ], + "security": { + "csp": null, + "assetProtocol": { + "enable": true, + "scope": [ + "**" + ] + } + } + }, + "bundle": { + "active": true, + "createUpdaterArtifacts": true, + "icon": [ + "icons/32x32.png", + "icons/128x128.png", + "icons/128x128@2x.png", + "icons/icon.icns", + "icons/icon.ico" + ], + "shortDescription": "Kaleido for Plex", + "longDescription": "Kaleido is a cinematic Plex client for the desktop.", + "category": "Video", + "copyright": "\u00a9 Elijah Kuntz", + "publisher": "Kaleido" + }, + "plugins": { + "updater": { + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEU0MTA2RjI0OUFFQzU1QzUKUldURlZleWFKRzhRNUlqTTR3U095STFYS3BsUXd2UnZMYlRrQmt3aUk5YU5WSjdqcUxVcHllU1EK", + "endpoints": [ + "https://git.elijahkuntz.com/Elijah/Kaleido-Desktop/raw/branch/main/updates/latest.json" + ] + } + } +} \ No newline at end of file diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json new file mode 100644 index 0000000..c06ec5d --- /dev/null +++ b/src-tauri/tauri.linux.conf.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "bundle": { + "targets": [ + "appimage", + "deb" + ], + "linux": { + "deb": { + "depends": [ + "libmpv2" + ] + } + } + } +} \ No newline at end of file diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json new file mode 100644 index 0000000..3f75d23 --- /dev/null +++ b/src-tauri/tauri.macos.conf.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "bundle": { + "targets": [ + "app", + "dmg" + ], + "macOS": { + "minimumSystemVersion": "12.0", + "frameworks": [ + "../vendor/mpv/macos/libmpv.2.dylib" + ] + } + } +} \ No newline at end of file diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json new file mode 100644 index 0000000..b61b0c3 --- /dev/null +++ b/src-tauri/tauri.windows.conf.json @@ -0,0 +1,45 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "app": { + "windows": [ + { + "label": "main", + "title": "Kaleido", + "width": 1480, + "height": 900, + "minWidth": 900, + "minHeight": 580, + "center": true, + "decorations": false, + "transparent": true, + "shadow": true, + "visible": false, + "dragDropEnabled": false + } + ] + }, + "bundle": { + "targets": [ + "nsis" + ], + "resources": { + "../vendor/mpv/windows/libmpv-2.dll": "libmpv-2.dll" + }, + "windows": { + "nsis": { + "installMode": "currentUser", + "installerIcon": "icons/icon.ico" + }, + "webviewInstallMode": { + "type": "downloadBootstrapper" + } + } + }, + "plugins": { + "updater": { + "windows": { + "installMode": "passive" + } + } + } +} \ No newline at end of file diff --git a/src/app/App.tsx b/src/app/App.tsx new file mode 100644 index 0000000..77cf583 --- /dev/null +++ b/src/app/App.tsx @@ -0,0 +1,258 @@ +import { lazy, Suspense, useEffect, useLayoutEffect, useRef, useState } from 'react'; +import { QueryClientProvider } from '@tanstack/react-query'; +import { queryClient, invalidateLibrary } from './queries'; +import { useSession } from './session'; +import { useRouter, navigate, type Route } from './router'; +import { useSettings } from './settings'; +import { TopBar } from './TopBar'; +import { MenuHost, ToastHost, ConfirmHost } from '../ui/overlays'; +import { HoverPreviewHost } from '../ui/HoverPreview'; +import { PageLoader } from '../ui/primitives'; +import { Splash } from '../screens/Splash'; +import { SignIn } from '../screens/SignIn'; +import { ServerPicker } from '../screens/ServerPicker'; +import { win } from '../platform/native'; +import { usePlayer } from '../player/store'; +import { PlayerOverlay } from '../player/PlayerOverlay'; +import { DialogHost } from '../screens/dialogs/DialogHost'; +import { useDownloads } from '../downloads/store'; +import { libraryRevision } from '../plex/api'; +import { checkForUpdate } from './updater'; +import { Home } from '../screens/Home'; +import { SectionScreen } from '../screens/Section'; +import { ItemScreen } from '../screens/Item'; + +const Search = lazy(() => import('../screens/Search')); +const Downloads = lazy(() => import('../screens/Downloads')); +const Settings = lazy(() => import('../screens/settings/Settings')); +const Person = lazy(() => import('../screens/Person')); +const HubScreen = lazy(() => import('../screens/HubScreen')); + +function Screen({ route }: { route: Route }) { + switch (route.name) { + case 'home': + return ; + case 'section': + return ; + case 'item': + return ; + case 'person': + return ; + case 'hub': + return ; + case 'search': + return ; + case 'downloads': + return ; + case 'settings': + return ; + } +} + +/** One scroll container per history entry; its position is restored on Back. */ +function Page({ onScrolled }: { onScrolled: (top: number) => void }) { + const entry = useRouter((s) => s.current); + const ref = useRef(null); + + useLayoutEffect(() => { + const el = ref.current; + if (!el) return; + const target = entry.scroll; + el.scrollTop = target; + onScrolled(target); + if (!target) return; + // Content may still be loading; keep trying briefly until it is tall enough. + let tries = 0; + const t = setInterval(() => { + if (!ref.current || tries++ > 30) return clearInterval(t); + ref.current.scrollTop = target; + if (Math.abs(ref.current.scrollTop - target) < 2) clearInterval(t); + }, 50); + return () => clearInterval(t); + }, [entry]); + + return ( +
{ + const top = (e.target as HTMLDivElement).scrollTop; + entry.scroll = top; + onScrolled(top); + }} + > + }> +
+ +
+
+
+ ); +} + +function useGlobalShortcuts() { + useEffect(() => { + const isTyping = (t: EventTarget | null) => t instanceof HTMLElement && (t.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(t.tagName)); + const onKey = (e: KeyboardEvent) => { + if (usePlayer.getState().open) return; + if ((e.ctrlKey || e.metaKey) && (e.key === 'k' || e.key === 'f')) { + e.preventDefault(); + navigate({ name: 'search' }); + } else if (e.altKey && e.key === 'ArrowLeft') { + e.preventDefault(); + useRouter.getState().back(); + } else if (e.altKey && e.key === 'ArrowRight') { + e.preventDefault(); + useRouter.getState().forward(); + } else if (e.key === 'F11') { + e.preventDefault(); + win.isFullscreen().then((fs) => win.setFullscreen(!fs)); + } else if ((e.key === 'Escape' || e.key === 'Backspace') && !isTyping(e.target) && !document.querySelector('.menu-layer, .dialog-layer')) { + if (e.key === 'Escape' && document.fullscreenElement) return; + useRouter.getState().back(); + } else if ((e.ctrlKey || e.metaKey) && e.key === ',') { + e.preventDefault(); + navigate({ name: 'settings', mode: 'app', tab: 'general' }); + } + }; + // Mouse back/forward buttons. + const onMouse = (e: MouseEvent) => { + if (usePlayer.getState().open) return; + if (e.button === 3) { + e.preventDefault(); + useRouter.getState().back(); + } else if (e.button === 4) { + e.preventDefault(); + useRouter.getState().forward(); + } + }; + window.addEventListener('keydown', onKey); + window.addEventListener('mouseup', onMouse); + return () => { + window.removeEventListener('keydown', onKey); + window.removeEventListener('mouseup', onMouse); + }; + }, []); +} + +/** Refreshes browsing when the server's libraries change. */ +function useLibrarySync() { + const server = useSession((s) => s.server); + useEffect(() => { + if (!server) return; + let last = ''; + let stopped = false; + const tick = async () => { + if (stopped || document.hidden || usePlayer.getState().open) return; + try { + const rev = await libraryRevision(server); + if (last && rev !== last) invalidateLibrary(); + last = rev; + } catch { + /* transient */ + } + }; + tick(); + const t = setInterval(tick, 20000); + const onVisible = () => !document.hidden && tick(); + document.addEventListener('visibilitychange', onVisible); + return () => { + stopped = true; + clearInterval(t); + document.removeEventListener('visibilitychange', onVisible); + }; + }, [server]); +} + +function Shell() { + const [scrolled, setScrolled] = useState(false); + const playerOpen = usePlayer((s) => s.open); + const startPage = useSettings.getState().startPage; + useGlobalShortcuts(); + useLibrarySync(); + useEffect(() => { + if (startPage !== 'home') useRouter.getState().reset(startPage === 'movies' ? { name: 'section', kind: 'movie', tab: 'discover' } : { name: 'section', kind: 'show', tab: 'discover' }); + useDownloads.getState().init().then(() => useDownloads.getState().resumeInterrupted()); + const t = setTimeout(() => checkForUpdate(false), 8000); + return () => clearTimeout(t); + }, []); + return ( + <> +
+ + setScrolled(top > 24)} /> +
+ + + ); +} + +function OfflineShell() { + const error = useSession((s) => s.error); + const init = useSession((s) => s.init); + useEffect(() => { + useDownloads.getState().init(); + useRouter.getState().reset({ name: 'downloads' }); + }, []); + return ( + <> +
+
+ {error || 'You’re offline.'} + +
+
+ }> + + +
+
+ + + ); +} + +export function App() { + const status = useSession((s) => s.status); + const hasServer = useSession((s) => !!s.server); + const reducedMotion = useSettings((s) => s.reducedMotion); + const [splashDone, setSplashDone] = useState(false); + + useEffect(() => { + useSession.getState().init(); + // The window appears once the first frame is painted (no white flash). + requestAnimationFrame(() => win.show()); + }, []); + + useEffect(() => { + document.documentElement.classList.toggle('reduced-motion', reducedMotion); + }, [reducedMotion]); + + // Switching servers or users starts browsing fresh. + const serverId = useSession((s) => s.server?.machineId); + useEffect(() => { + if (serverId) useRouter.getState().reset({ name: 'home' }); + }, [serverId]); + + let body; + if (status === 'loading') body = null; + else if (status === 'signed-out') body = ; + else if (status === 'choose-server' || (status === 'connecting' && !hasServer)) body = ; + else if (status === 'offline') body = ; + else body = ; + + return ( + + {body} + {(!splashDone || status === 'loading') && setSplashDone(true)} />} + + + + + + + ); +} diff --git a/src/app/TopBar.tsx b/src/app/TopBar.tsx new file mode 100644 index 0000000..0e05da2 --- /dev/null +++ b/src/app/TopBar.tsx @@ -0,0 +1,126 @@ +import { useEffect, useState } from 'react'; +import { navigate, topLevel, useRouter } from './router'; +import { useSession } from './session'; +import { useSettings } from './settings'; +import { Icon } from '../ui/Icon'; +import { KaleidoMark } from '../ui/primitives'; +import { openMenu, type MenuItem } from '../ui/overlays'; +import { isNative, win } from '../platform/native'; +import { useDownloads } from '../downloads/store'; +import { useHomeUsers } from './useHomeUsers'; + +const NAV = [ + { id: 'home', label: 'Home', route: { name: 'home' } as const }, + { id: 'movies', label: 'Movies', route: { name: 'section', kind: 'movie', tab: 'discover' } as const }, + { id: 'shows', label: 'TV Shows', route: { name: 'section', kind: 'show', tab: 'discover' } as const }, + { id: 'downloads', label: 'Downloads', route: { name: 'downloads' } as const }, +]; + +function WindowControls() { + const [maximized, setMaximized] = useState(false); + useEffect(() => { + if (!isNative) return; + let off: (() => void) | undefined; + const sync = () => win.isMaximized().then(setMaximized); + sync(); + win.onResized(sync).then((u) => (off = u)); + return () => off?.(); + }, []); + if (!isNative) return null; + return ( +
+ + + +
+ ); +} + +function Avatar() { + const user = useSession((s) => s.user); + const server = useSession((s) => s.server); + const connection = useSession((s) => s.connection); + const showServerPicker = useSession((s) => s.showServerPicker); + const signOut = useSession((s) => s.signOut); + const home = useHomeUsers(); + const initial = (user?.title || server?.name || 'K').slice(0, 1).toUpperCase(); + const menu = (el: HTMLElement) => { + const items: MenuItem[] = [ + { heading: user ? user.title : 'Kaleido' }, + { + label: server ? `${server.name}` : 'No server', + hint: connection ? (connection.relay ? 'Relay' : connection.local ? 'Local' : 'Remote') : '', + icon: 'server', + onSelect: showServerPicker, + }, + ]; + if (home.users.length > 1) { + items.push({ + label: 'Switch profile', + icon: 'users', + submenu: home.users.map((u) => ({ label: u.title, checked: u.uuid === user?.uuid, onSelect: () => home.switchTo(u) })), + }); + } + items.push( + { divider: true }, + { label: 'Settings', icon: 'settings', onSelect: () => navigate({ name: 'settings', mode: 'app', tab: 'general' }) }, + ); + if (server?.owned) items.push({ label: 'Server dashboard', icon: 'activity', onSelect: () => navigate({ name: 'settings', mode: 'server', tab: 'dashboard' }) }); + items.push({ divider: true }, { label: 'Sign out', icon: 'logout', onSelect: signOut }); + openMenu(items, el, { align: 'end', minWidth: 250 }); + }; + return ( + + ); +} + +export function TopBar({ solid }: { solid: boolean }) { + const current = useRouter((s) => s.current.route); + const canBack = useRouter((s) => s.index > 0); + const back = useRouter((s) => s.back); + const active = topLevel(current); + const activeDownloads = useDownloads((s) => s.items.filter((d) => d.status === 'downloading' || d.status === 'queued').length); + const startPage = useSettings((s) => s.startPage); + void startPage; + const showBack = canBack && !active; + + return ( +
+
+ + + +
+
+ + + + +
+
+ ); +} diff --git a/src/app/actions.ts b/src/app/actions.ts new file mode 100644 index 0000000..6612629 --- /dev/null +++ b/src/app/actions.ts @@ -0,0 +1,230 @@ +import { create } from 'zustand'; +import * as api from '../plex/api'; +import type { Item } from '../plex/types'; +import { navigate } from './router'; +import { useSession } from './session'; +import { invalidateItem, invalidateLibrary } from './queries'; +import { isWatched } from './format'; +import { useSettings } from './settings'; +import { usePlayer, type PlayOptions } from '../player/store'; +import { confirmDialog, toast, toastError, type MenuItem } from '../ui/overlays'; +import { useDownloads } from '../downloads/store'; + +const server = () => { + const s = useSession.getState().server; + if (!s) throw new Error('Not connected to a server.'); + return s; +}; + +export const canManage = () => !!useSession.getState().server?.owned; + +export function openItem(item: Item) { + if (item.type === 'clip') { + playItem(item, { resume: false }); + return; + } + if (item.type === 'person') { + navigate({ name: 'person', id: item.id, title: item.title, thumb: item.thumb }); + return; + } + navigate({ name: 'item', id: item.id, title: item.title }); +} + +/** Plays a title. Shows and seasons play their next episode. */ +export async function playItem(item: Item, opts: PlayOptions = {}) { + try { + if (item.type === 'show' || item.type === 'season') { + const s = server(); + const full = await api.metadata(s, item.id); + let next = await api.onDeckFor(s, full); + if (!next) { + const leaves = await api.allLeaves(s, item.id); + next = leaves.find((e) => !isWatched(e)) ?? leaves[0] ?? null; + } + if (!next) throw new Error('There are no episodes to play.'); + await usePlayer.getState().play(next, { resume: true, ...opts }); + return; + } + if (item.type === 'collection') { + const items = await api.collectionItems(server(), item.id); + if (items[0]) await playItem(items[0], opts); + return; + } + const local = useDownloads.getState().localFileFor(item.id); + if (local && !opts.localFile && !useSession.getState().server) opts = { ...opts, localFile: local }; + await usePlayer.getState().play(item, { resume: true, ...opts }); + } catch (e) { + toastError(e); + } +} + +export async function shuffleItem(item: Item) { + try { + const leaves = await api.allLeaves(server(), item.id); + if (!leaves.length) return; + const pick = leaves[Math.floor(Math.random() * leaves.length)]; + await usePlayer.getState().play(pick, { resume: false }); + } catch (e) { + toastError(e); + } +} + +export async function setWatched(item: Item, watched: boolean) { + try { + await api.setWatched(server(), item.id, watched); + toast(watched ? `Marked “${item.title}” watched` : `Marked “${item.title}” unwatched`, 'success'); + invalidateLibrary(); + } catch (e) { + toastError(e); + } +} + +export async function removeFromContinueWatching(item: Item) { + try { + await api.removeFromContinueWatching(server(), item.id); + toast('Removed from Continue Watching', 'success'); + invalidateLibrary(); + } catch (e) { + toastError(e); + } +} + +async function run(label: string, fn: () => Promise, done?: string) { + try { + await fn(); + if (done) toast(done, 'success'); + } catch (e) { + toastError(e); + } + void label; +} + +export const admin = { + refresh: (item: Item) => + run('refresh', async () => { + await api.refreshMetadata(server(), item.id); + setTimeout(() => invalidateItem(item.id), 4000); + }, `Refreshing metadata for “${item.title}”`), + analyze: (item: Item) => run('analyze', () => api.analyze(server(), item.id), `Analyzing “${item.title}”`), + unmatch: async (item: Item) => { + if (!(await confirmDialog({ title: 'Unmatch this title?', message: `Plex will remove the metadata for “${item.title}” and show it by its file name until it is matched again.`, confirm: 'Unmatch', danger: true }))) return; + await run('unmatch', async () => { + await api.unmatch(server(), item.id); + invalidateLibrary(); + }, 'Title unmatched'); + }, + split: async (item: Item) => { + if (!(await confirmDialog({ title: 'Split apart?', message: `Each version of “${item.title}” will become a separate title.`, confirm: 'Split apart' }))) return; + await run('split', async () => { + await api.splitApart(server(), item.id); + invalidateLibrary(); + }, 'Versions split apart'); + }, + remove: async (item: Item, onDone?: () => void) => { + const ok = await confirmDialog({ + title: `Delete “${item.title}”?`, + message: 'This permanently deletes the media files from the server’s disk and removes the title from the library. This cannot be undone.', + confirm: 'Delete files', + danger: true, + }); + if (!ok) return; + try { + await api.deleteItem(server(), item.id); + toast(`Deleted “${item.title}”`, 'success'); + invalidateLibrary(); + onDone?.(); + } catch (e: any) { + toast(e?.status === 403 || e?.status === 401 ? 'The server does not allow media deletion. Enable it in Settings › Plex server › Library.' : e.message, 'error'); + } + }, +}; + +// —— Dialog routing —————————————————————————————————————————————— + +export type DialogRequest = + | { kind: 'edit'; item: Item } + | { kind: 'match'; item: Item } + | { kind: 'info'; item: Item } + | { kind: 'artwork'; item: Item; type: 'poster' | 'art' | 'clearLogo' } + | { kind: 'collection'; item: Item } + | { kind: 'playlist'; item: Item } + | { kind: 'trailer'; item: Item } + | { kind: 'synopsis'; item: Item } + | { kind: 'versions'; item: Item; onPick: (index: number) => void }; + +export const useDialogs = create<{ dialog: DialogRequest | null; open(d: DialogRequest): void; close(): void }>((set) => ({ + dialog: null, + open: (dialog) => set({ dialog }), + close: () => set({ dialog: null }), +})); +export const openDialog = (d: DialogRequest) => useDialogs.getState().open(d); + +/** Plays with a version choice when a title has several. */ +export function playWithVersion(item: Item, opts: PlayOptions = {}) { + if (item.media.length > 1 && opts.mediaIndex === undefined) { + openDialog({ kind: 'versions', item, onPick: (mediaIndex) => playItem(item, { ...opts, mediaIndex }) }); + return; + } + playItem(item, opts); +} + +/** The full context menu for a title, as on cards and the detail page "More" button. */ +export function itemMenu(item: Item, ctx: { continueWatching?: boolean; onDeleted?: () => void; detail?: boolean } = {}): MenuItem[] { + const owned = canManage(); + const playable = ['movie', 'episode', 'show', 'season', 'clip'].includes(item.type); + const watched = isWatched(item, useSettings.getState().watchedPercent); + const downloads = useDownloads.getState(); + const items: MenuItem[] = []; + if (playable) { + items.push({ label: item.viewOffset ? 'Resume' : 'Play', icon: 'play', onSelect: () => playWithVersion(item) }); + if (item.viewOffset) items.push({ label: 'Play from beginning', icon: 'replay10', onSelect: () => playWithVersion(item, { offsetMs: 0, resume: false }) }); + if (item.type === 'show' || item.type === 'season') items.push({ label: 'Shuffle episodes', icon: 'shuffle', onSelect: () => shuffleItem(item) }); + } + if (!ctx.detail) items.push({ label: 'Details', icon: 'info', onSelect: () => openItem(item) }); + if (item.type === 'episode') { + items.push({ label: 'Go to season', icon: 'layers', onSelect: () => navigate({ name: 'item', id: item.parentId }) }); + items.push({ label: 'Go to show', icon: 'tv', onSelect: () => navigate({ name: 'item', id: item.grandparentId }) }); + } + if (item.type === 'season') items.push({ label: 'Go to show', icon: 'tv', onSelect: () => navigate({ name: 'item', id: item.parentId }) }); + if (playable && item.type !== 'clip') { + items.push({ divider: true }); + items.push({ label: watched ? 'Mark unwatched' : 'Mark watched', icon: watched ? 'minus' : 'check', onSelect: () => setWatched(item, !watched) }); + if (ctx.continueWatching || (item.viewOffset > 0 && !watched)) items.push({ label: 'Remove from Continue Watching', icon: 'x', onSelect: () => removeFromContinueWatching(item) }); + } + if (item.type === 'movie' || item.type === 'episode') { + const dl = downloads.items.find((d) => d.id === downloads.idFor(item.id)); + items.push( + dl + ? { label: dl.status === 'completed' ? 'Downloaded' : 'Downloading…', icon: 'downloaded', onSelect: () => navigate({ name: 'downloads' }) } + : { label: 'Download', icon: 'download', onSelect: () => downloads.start(item) }, + ); + } else if (item.type === 'season' || item.type === 'show') { + items.push({ label: item.type === 'show' ? 'Download all episodes' : 'Download season', icon: 'download', onSelect: () => downloads.startAll(item) }); + } + if (['movie', 'show', 'season', 'episode'].includes(item.type)) { + items.push({ label: 'Add to playlist…', icon: 'queue', onSelect: () => openDialog({ kind: 'playlist', item }) }); + } + if (owned && ['movie', 'show'].includes(item.type)) items.push({ label: 'Add to collection…', icon: 'collection', onSelect: () => openDialog({ kind: 'collection', item }) }); + if (['movie', 'episode'].includes(item.type)) items.push({ label: 'Media info', icon: 'info', onSelect: () => openDialog({ kind: 'info', item }) }); + if (owned && ['movie', 'show', 'season', 'episode', 'collection'].includes(item.type)) { + const manage: MenuItem[] = [ + { label: 'Edit metadata…', icon: 'edit', onSelect: () => openDialog({ kind: 'edit', item }) }, + { label: 'Change poster…', icon: 'image', onSelect: () => openDialog({ kind: 'artwork', item, type: 'poster' }) }, + { label: 'Change background…', icon: 'image', onSelect: () => openDialog({ kind: 'artwork', item, type: 'art' }) }, + { label: 'Refresh metadata', icon: 'refresh', onSelect: () => admin.refresh(item) }, + ]; + if (item.type !== 'collection') manage.push({ label: 'Analyze', icon: 'activity', onSelect: () => admin.analyze(item) }); + if (item.type === 'movie' || item.type === 'show') { + manage.push({ label: 'Fix match…', icon: 'wand', onSelect: () => openDialog({ kind: 'match', item }) }); + manage.push({ label: 'Unmatch', icon: 'unlink', onSelect: () => admin.unmatch(item) }); + } + if (item.type === 'movie' && item.media.length > 1) manage.push({ label: 'Split apart', icon: 'split', onSelect: () => admin.split(item) }); + if (item.type !== 'collection') { + manage.push({ divider: true }); + manage.push({ label: 'Delete from server…', icon: 'trash', danger: true, onSelect: () => admin.remove(item, ctx.onDeleted) }); + } + items.push({ divider: true }); + items.push({ label: 'Manage', icon: 'tool', submenu: manage }); + } + return items; +} diff --git a/src/app/format.ts b/src/app/format.ts new file mode 100644 index 0000000..47d138a --- /dev/null +++ b/src/app/format.ts @@ -0,0 +1,190 @@ +import type { Item, Media } from '../plex/types'; + +export function duration(ms: number): string { + if (!ms || ms < 0) return ''; + const m = Math.round(ms / 60000); + if (m < 60) return `${m}m`; + const h = Math.floor(m / 60); + return m % 60 ? `${h}h ${m % 60}m` : `${h}h`; +} + +export function clock(seconds: number, forceHours = false): string { + if (!Number.isFinite(seconds) || seconds < 0) seconds = 0; + const s = Math.floor(seconds % 60); + const m = Math.floor((seconds / 60) % 60); + const h = Math.floor(seconds / 3600); + const pad = (n: number) => String(n).padStart(2, '0'); + return h || forceHours ? `${h}:${pad(m)}:${pad(s)}` : `${m}:${pad(s)}`; +} + +export function remaining(item: Item): string { + if (!item.duration || !item.viewOffset) return ''; + const left = Math.max(0, item.duration - item.viewOffset); + const m = Math.round(left / 60000); + if (m < 1) return 'Almost done'; + return m >= 60 ? `${Math.floor(m / 60)}h ${m % 60}m left` : `${m}m left`; +} + +export function episodeLabel(item: Item, long = false): string { + if (item.type !== 'episode') return ''; + if (long) return `Season ${item.parentIndex} · Episode ${item.index}`; + return `S${item.parentIndex} · E${item.index}`; +} + +export function progress(item: Item): number { + if (!item.duration || !item.viewOffset) return 0; + return Math.min(1, Math.max(0, item.viewOffset / item.duration)); +} + +export function isWatched(item: Item, percent = 90): boolean { + if (item.type === 'show' || item.type === 'season') return item.leafCount > 0 && item.viewedLeafCount >= item.leafCount; + if (item.viewOffset > 0 && item.duration > 0) return item.viewCount > 0 && item.viewOffset / item.duration >= percent / 100; + return item.viewCount > 0; +} + +export function remainingEpisodes(item: Item): number { + return Math.max(0, item.leafCount - item.viewedLeafCount); +} + +export function displayTitle(item: Item): string { + if (item.type === 'episode') return item.grandparentTitle || item.title; + if (item.type === 'season') return item.parentTitle ? `${item.parentTitle}` : item.title; + return item.title; +} + +export function subtitleFor(item: Item): string { + switch (item.type) { + case 'episode': + return `${episodeLabel(item)} ${item.title}`; + case 'season': + return item.title + (item.leafCount ? ` · ${item.leafCount} episodes` : ''); + case 'show': + return [item.year || '', item.childCount ? `${item.childCount} season${item.childCount === 1 ? '' : 's'}` : ''].filter(Boolean).join(' · '); + case 'collection': + return item.childCount ? `${item.childCount} titles` : 'Collection'; + case 'clip': + return [extraLabel(item), duration(item.duration)].filter(Boolean).join(' · '); + default: + return [item.year || '', duration(item.duration)].filter(Boolean).join(' · '); + } +} + +export function extraLabel(item: Item): string { + const map: Record = { + trailer: 'Trailer', + behindTheScenes: 'Behind the scenes', + deletedScene: 'Deleted scene', + featurette: 'Featurette', + interview: 'Interview', + sceneOrSample: 'Scene', + short: 'Short', + }; + return map[item.subtype] ?? (item.type === 'clip' ? 'Extra' : ''); +} + +/** Image path choices per presentation. */ +export const art = { + poster(item: Item): string { + if (item.type === 'episode') return item.grandparentThumb || item.parentThumb || item.thumb; + if (item.type === 'season') return item.thumb || item.parentThumb; + return item.thumb; + }, + landscape(item: Item): string { + if (item.type === 'episode' || item.type === 'clip') return item.thumb || item.art; + return item.art || item.grandparentArt || item.thumb; + }, + backdrop(item: Item): string { + if (item.type === 'episode') return item.grandparentArt || item.art || item.thumb; + return item.art || item.grandparentArt || item.thumb; + }, +}; + +export function resolutionLabel(m?: Media): string { + if (!m) return ''; + const r = m.videoResolution.toLowerCase(); + if (r === '4k') return '4K'; + if (r === 'sd') return 'SD'; + if (/^\d+$/.test(r)) return `${r}p`; + if (m.height >= 2000) return '4K'; + if (m.height >= 1000) return '1080p'; + if (m.height >= 700) return '720p'; + return r.toUpperCase(); +} + +export function channelLabel(n: number): string { + return n === 1 ? 'Mono' : n === 2 ? 'Stereo' : n === 6 ? '5.1' : n === 8 ? '7.1' : n ? `${n} ch` : ''; +} + +/** Format badges: 4K, HDR flavor, Atmos/5.1 — the facts that matter at a glance. */ +export function formatBadges(item: Item): string[] { + const m = item.media[0]; + if (!m) return []; + const out: string[] = []; + const res = resolutionLabel(m); + if (res === '4K' || res === '1080p' || res === '720p') out.push(res.toUpperCase()); + if (m.dynamicRange === 'Dolby Vision') out.push('DOLBY VISION'); + else if (m.dynamicRange) out.push(m.dynamicRange === 'HDR10' ? 'HDR' : m.dynamicRange); + if (m.atmos) out.push('ATMOS'); + else if (m.audioChannels >= 6) out.push(channelLabel(m.audioChannels)); + return out; +} + +export function technicalLine(m?: Media): string { + if (!m) return ''; + return [ + m.videoCodec.toUpperCase(), + [m.audioCodec.toUpperCase(), channelLabel(m.audioChannels)].filter(Boolean).join(' '), + m.bitrate ? `${Math.round(m.bitrate / 1000)} Mbps` : '', + ] + .filter(Boolean) + .join(' · '); +} + +export function fileSize(bytes: number): string { + if (!bytes) return ''; + if (bytes >= 1e12) return `${(bytes / 1e12).toFixed(2)} TB`; + if (bytes >= 1e9) return `${(bytes / 1e9).toFixed(1)} GB`; + if (bytes >= 1e6) return `${Math.round(bytes / 1e6)} MB`; + return `${Math.round(bytes / 1e3)} KB`; +} + +export function bitrate(kbps: number): string { + if (!kbps) return ''; + return kbps >= 1000 ? `${(kbps / 1000).toFixed(kbps >= 10000 ? 0 : 1)} Mbps` : `${kbps} kbps`; +} + +export function date(value: string | number): string { + if (!value) return ''; + const d = typeof value === 'number' ? new Date(value * 1000) : new Date(value); + if (Number.isNaN(d.getTime())) return ''; + return d.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' }); +} + +export function relativeTime(seconds: number): string { + if (!seconds) return ''; + const diff = Date.now() / 1000 - seconds; + if (diff < 60) return 'just now'; + if (diff < 3600) return `${Math.floor(diff / 60)} min ago`; + if (diff < 86400) return `${Math.floor(diff / 3600)} hr ago`; + if (diff < 86400 * 30) return `${Math.floor(diff / 86400)} days ago`; + return date(seconds); +} + +export function plural(n: number, word: string, pluralWord = `${word}s`) { + return `${n.toLocaleString()} ${n === 1 ? word : pluralWord}`; +} + +/** Hex UltraBlur colors → CSS gradient layers for the artwork colour wash. */ +export function washGradient(u: Item['ultraBlur'], strength = 1): string { + if (!u) return ''; + const c = (hex: string, a: number) => { + const n = parseInt(hex, 16); + return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${(a * strength).toFixed(3)})`; + }; + return [ + `radial-gradient(ellipse at 100% 0%, ${c(u.topRight, 0.95)} 0%, transparent 62%)`, + `radial-gradient(ellipse at 0% 0%, ${c(u.topLeft, 0.7)} 0%, transparent 55%)`, + `radial-gradient(ellipse at 100% 100%, ${c(u.bottomRight, 0.55)} 0%, transparent 60%)`, + `radial-gradient(ellipse at 0% 100%, ${c(u.bottomLeft, 0.45)} 0%, transparent 60%)`, + ].join(', '); +} diff --git a/src/app/keyboardNav.ts b/src/app/keyboardNav.ts new file mode 100644 index 0000000..8a77535 --- /dev/null +++ b/src/app/keyboardNav.ts @@ -0,0 +1,91 @@ +/** + * Arrow-key movement between titles, for keyboard users. Focus moves to the + * nearest card in the pressed direction (by on-screen geometry), so it works + * the same across shelves, grids, episode lists and people rows. + */ +const TARGETS = '.card, .person-card:not(:disabled), .episode-row, .shelf-title-link'; + +function center(r: DOMRect) { + return { x: r.left + r.width / 2, y: r.top + r.height / 2 }; +} + +function nearest(from: HTMLElement, dir: 'left' | 'right' | 'up' | 'down'): HTMLElement | null { + const a = from.getBoundingClientRect(); + const ac = center(a); + const scope = from.closest('.main-scroll') ?? document; + let best: HTMLElement | null = null; + let bestScore = Infinity; + for (const el of scope.querySelectorAll(TARGETS)) { + if (el === from || el.offsetParent === null) continue; + const b = el.getBoundingClientRect(); + const bc = center(b); + const dx = bc.x - ac.x; + const dy = bc.y - ac.y; + let primary: number; + let secondary: number; + switch (dir) { + case 'right': + if (b.left < a.right - 4 || Math.abs(dy) > a.height * 0.6) continue; + primary = dx; + secondary = Math.abs(dy); + break; + case 'left': + if (b.right > a.left + 4 || Math.abs(dy) > a.height * 0.6) continue; + primary = -dx; + secondary = Math.abs(dy); + break; + case 'down': + if (b.top < a.bottom - 4) continue; + primary = dy; + secondary = Math.abs(dx); + break; + case 'up': + if (b.bottom > a.top + 4) continue; + primary = -dy; + secondary = Math.abs(dx); + break; + } + // Prefer the next row/column first, then the closest within it. + const score = primary + secondary * (dir === 'up' || dir === 'down' ? 0.35 : 2); + if (score < bestScore) { + bestScore = score; + best = el; + } + } + return best; +} + +export function installKeyboardNav() { + window.addEventListener('keydown', (e) => { + if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) return; + const target = e.target as HTMLElement; + if (document.documentElement.classList.contains('player-open')) return; + if (document.querySelector('.menu-layer, .dialog-layer')) return; + + // "/" focuses the nearest search field. + if (e.key === '/' && !target.closest('input, textarea')) { + const field = document.querySelector('.lib-search input, .search-field input'); + if (field) { + e.preventDefault(); + field.focus(); + field.select(); + } + return; + } + + if (!target.matches?.(TARGETS)) return; + if ((e.key === 'ContextMenu' || (e.shiftKey && e.key === 'F10')) && !target.matches('.shelf-title-link')) { + e.preventDefault(); + const r = target.getBoundingClientRect(); + target.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, cancelable: true, clientX: r.left + 24, clientY: r.top + 24 })); + return; + } + const dir = ({ ArrowLeft: 'left', ArrowRight: 'right', ArrowUp: 'up', ArrowDown: 'down' } as const)[e.key as 'ArrowLeft']; + if (!dir) return; + const next = nearest(target, dir); + if (!next) return; + e.preventDefault(); + next.focus({ preventScroll: true }); + next.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'smooth' }); + }); +} diff --git a/src/app/queries.ts b/src/app/queries.ts new file mode 100644 index 0000000..d8fcdd5 --- /dev/null +++ b/src/app/queries.ts @@ -0,0 +1,53 @@ +import { QueryClient, useQuery, type UseQueryOptions } from '@tanstack/react-query'; +import * as api from '../plex/api'; +import type { Item, Section } from '../plex/types'; +import { useServer } from './session'; +import { useSettings } from './settings'; + +export const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 60_000, + gcTime: 30 * 60_000, + retry: 1, + refetchOnWindowFocus: false, + }, + }, +}); + +/** Every key starts with the server so switching servers never mixes caches. */ +export function useKey(...parts: unknown[]) { + const server = useServer(); + return [server.machineId, ...parts]; +} + +export function useServerQuery(parts: unknown[], fn: (s: ReturnType) => Promise, opts: Partial> = {}) { + const server = useServer(); + return useQuery({ queryKey: [server.machineId, ...parts], queryFn: () => fn(server), ...opts } as UseQueryOptions); +} + +export const useSections = () => useServerQuery(['sections'], (s) => api.sections(s), { staleTime: 5 * 60_000 }); + +/** The library a Movies or TV destination shows: the user's choice, else the first. */ +export function useSectionFor(kind: 'movie' | 'show'): { section: Section | null; all: Section[]; loading: boolean } { + const { data, isLoading } = useSections(); + const chosen = useSettings((s) => (kind === 'movie' ? s.movieSection : s.showSection)); + const all = (data ?? []).filter((s) => s.type === kind && !s.hidden); + return { section: all.find((s) => s.id === chosen) ?? all[0] ?? null, all, loading: isLoading }; +} + +export const useItem = (id: string | undefined, opts: Partial> = {}) => + useServerQuery(['item', id], (s) => api.metadata(s, id!), { enabled: !!id, staleTime: 30_000, ...opts }); + +export const useChildren = (id: string | undefined) => useServerQuery(['children', id], (s) => api.children(s, id!), { enabled: !!id, staleTime: 30_000 }); + +export const useRelated = (id: string | undefined) => useServerQuery(['related', id], (s) => api.related(s, id!), { enabled: !!id, staleTime: 10 * 60_000 }); + +/** After a watched-state or metadata change, refresh everything that may show it. */ +export function invalidateLibrary() { + queryClient.invalidateQueries({ predicate: (q) => !['sections', 'libraryMeta', 'filterOptions', 'serverPrefs'].includes(String(q.queryKey[1])) }); +} + +export function invalidateItem(id: string) { + queryClient.invalidateQueries({ predicate: (q) => q.queryKey.includes(id) }); +} diff --git a/src/app/router.ts b/src/app/router.ts new file mode 100644 index 0000000..943b176 --- /dev/null +++ b/src/app/router.ts @@ -0,0 +1,101 @@ +import { create } from 'zustand'; + +export type SectionKind = 'movie' | 'show'; +export type SectionTab = 'discover' | 'library' | 'collections'; + +export type Route = + | { name: 'home' } + | { name: 'section'; kind: SectionKind; tab: SectionTab } + | { name: 'item'; id: string; title?: string } + | { name: 'person'; id: string; title: string; thumb?: string } + | { name: 'hub'; key: string; title: string } + | { name: 'search'; query?: string } + | { name: 'downloads' } + | { name: 'settings'; mode: 'app' | 'server'; tab: string }; + +export interface Entry { + id: number; + route: Route; + scroll: number; + /** Per-screen state to restore on Back (e.g. selected season, library offset). */ + state: Record; +} + +interface RouterState { + entries: Entry[]; + index: number; + current: Entry; + navigate(route: Route, opts?: { replace?: boolean }): void; + back(): void; + forward(): void; + canBack(): boolean; + saveScroll(scroll: number): void; + setState(patch: Record): void; + reset(route: Route): void; +} + +let nextId = 1; +const entry = (route: Route): Entry => ({ id: nextId++, route, scroll: 0, state: {} }); +const MAX = 60; + +const sameDestination = (a: Route, b: Route) => JSON.stringify(a) === JSON.stringify(b); + +export const useRouter = create((set, get) => { + const first = entry({ name: 'home' }); + return { + entries: [first], + index: 0, + current: first, + navigate(route, opts) { + const { entries, index } = get(); + if (sameDestination(entries[index].route, route)) return; + const e = entry(route); + let next = entries.slice(0, index + 1); + if (opts?.replace) next[next.length - 1] = e; + else next.push(e); + if (next.length > MAX) next = next.slice(next.length - MAX); + set({ entries: next, index: next.length - 1, current: e }); + }, + back() { + const { entries, index } = get(); + if (index > 0) set({ index: index - 1, current: entries[index - 1] }); + }, + forward() { + const { entries, index } = get(); + if (index < entries.length - 1) set({ index: index + 1, current: entries[index + 1] }); + }, + canBack: () => get().index > 0, + saveScroll(scroll) { + get().current.scroll = scroll; + }, + setState(patch) { + const cur = get().current; + cur.state = { ...cur.state, ...patch }; + }, + reset(route) { + const e = entry(route); + set({ entries: [e], index: 0, current: e }); + }, + }; +}); + +export const navigate = (route: Route, opts?: { replace?: boolean }) => useRouter.getState().navigate(route, opts); +export const goBack = () => useRouter.getState().back(); + +/** The top-level destination a route belongs to, for the navigation highlight. */ +export function topLevel(route: Route): string { + switch (route.name) { + case 'home': + return 'home'; + case 'section': + return route.kind === 'movie' ? 'movies' : 'shows'; + case 'search': + return 'search'; + case 'downloads': + return 'downloads'; + case 'settings': + return 'settings'; + default: + return ''; + } +} diff --git a/src/app/session.ts b/src/app/session.ts new file mode 100644 index 0000000..3cf2eac --- /dev/null +++ b/src/app/session.ts @@ -0,0 +1,213 @@ +import { create } from 'zustand'; +import { appInfo, devSession, isNative, secrets } from '../platform/native'; +import { configureClient, PlexError, PlexServer } from '../plex/client'; +import * as account from '../plex/account'; +import type { PlexUser, ServerResource } from '../plex/types'; + +export type Status = 'loading' | 'signed-out' | 'choose-server' | 'connecting' | 'ready' | 'offline'; + +interface StoredServer { + id: string; + name: string; + uri: string; + owned: boolean; + manual?: boolean; +} + +interface SessionState { + status: Status; + error: string; + accountToken: string | null; + user: PlexUser | null; + resources: ServerResource[]; + server: PlexServer | null; + connection: { local: boolean; relay: boolean } | null; + init(): Promise; + completeSignIn(token: string): Promise; + refreshResources(): Promise; + chooseServer(resource: ServerResource): Promise; + connectManual(uri: string, token: string): Promise; + reconnect(): Promise; + switchUser(token: string): Promise; + showServerPicker(): void; + signOut(): Promise; +} + +const SERVER_KEY = 'kaleido.server'; +const loadStoredServer = (): StoredServer | null => { + try { + return JSON.parse(localStorage.getItem(SERVER_KEY) ?? 'null'); + } catch { + return null; + } +}; +const storeServer = (s: StoredServer | null) => (s ? localStorage.setItem(SERVER_KEY, JSON.stringify(s)) : localStorage.removeItem(SERVER_KEY)); + +export const useSession = create((set, get) => ({ + status: 'loading', + error: '', + accountToken: null, + user: null, + resources: [], + server: null, + connection: null, + + async init() { + const info = await appInfo(); + configureClient({ version: info.version, deviceName: info.deviceName }); + let token = await secrets.get('account-token'); + const stored = loadStoredServer(); + + if (!token) { + const dev = await devSession(); + if (dev) { + // The development token is the owner's account token. + try { + await account.getUser(dev.token); + token = dev.token; + await secrets.set('account-token', token); + } catch { + try { + await get().connectManual(dev.server, dev.token); + return; + } catch { + /* fall through to sign-in */ + } + } + } + } + + if (stored?.manual) { + const serverToken = await secrets.get('server-token'); + if (serverToken) { + try { + await get().connectManual(stored.uri, serverToken); + return; + } catch (e: any) { + set({ status: 'offline', error: e.message }); + return; + } + } + } + + if (!token) { + set({ status: 'signed-out' }); + return; + } + set({ accountToken: token }); + try { + const user = await account.getUser(token); + set({ user }); + } catch (e: any) { + if (e instanceof PlexError && (e.status === 401 || e.status === 403)) { + await secrets.delete('account-token'); + set({ status: 'signed-out', accountToken: null, error: 'Your Plex session has expired. Sign in again.' }); + return; + } + // plex.tv unreachable: try the last server directly. + if (stored) { + const serverToken = (await secrets.get('server-token')) ?? token; + try { + await get().connectManual(stored.uri, serverToken); + return; + } catch { + /* offline */ + } + } + set({ status: 'offline', error: 'Kaleido cannot reach Plex right now. Downloaded titles are still available.' }); + return; + } + const resources = await get().refreshResources().catch(() => [] as ServerResource[]); + const preferred = resources.find((r) => r.id === stored?.id); + if (preferred) { + await get().chooseServer(preferred); + return; + } + if (resources.length === 1) { + await get().chooseServer(resources[0]); + return; + } + set({ status: resources.length ? 'choose-server' : 'choose-server', error: resources.length ? '' : 'No Plex Media Servers are available to this account.' }); + }, + + async completeSignIn(token) { + await secrets.set('account-token', token); + set({ accountToken: token, error: '', status: 'connecting' }); + const user = await account.getUser(token); + set({ user }); + const resources = await get().refreshResources(); + if (resources.length === 1) await get().chooseServer(resources[0]); + else set({ status: 'choose-server' }); + }, + + async refreshResources() { + const token = get().accountToken; + if (!token) return []; + const resources = await account.getResources(token); + resources.sort((a, b) => Number(b.owned) - Number(a.owned) || Number(b.presence) - Number(a.presence) || a.name.localeCompare(b.name)); + set({ resources }); + return resources; + }, + + async chooseServer(resource) { + set({ status: 'connecting', error: '' }); + const stored = loadStoredServer(); + try { + const r = await account.connect(resource, stored?.id === resource.id ? stored.uri : undefined); + const server = new PlexServer(r.uri, resource.accessToken, r.machineId, resource.name, resource.owned, r.local); + storeServer({ id: resource.id, name: resource.name, uri: r.uri, owned: resource.owned }); + await secrets.set('server-token', resource.accessToken); + set({ server, status: 'ready', connection: { local: r.local, relay: r.relay } }); + } catch (e: any) { + set({ status: 'choose-server', error: e.message ?? String(e) }); + } + }, + + async connectManual(uri, token) { + set({ status: 'connecting', error: '' }); + const r = await account.connectManual(uri, token); + const owned = await account + .getUser(token) + .then(() => true) + .catch(() => false); + const server = new PlexServer(r.uri, token, r.machineId, r.name, owned, r.local); + storeServer({ id: r.machineId, name: r.name, uri: r.uri, owned, manual: !get().accountToken }); + await secrets.set('server-token', token); + set({ server, status: 'ready', connection: { local: r.local, relay: false } }); + }, + + async reconnect() { + const { resources, server } = get(); + const resource = resources.find((r) => r.id === server?.machineId); + if (resource) await get().chooseServer(resource); + else await get().init(); + }, + + async switchUser(token) { + await secrets.set('account-token', token); + storeServer(null); + set({ accountToken: token, server: null, status: 'connecting' }); + await get().init(); + }, + + showServerPicker() { + set({ status: 'choose-server', error: '' }); + get().refreshResources().catch(() => {}); + }, + + async signOut() { + const token = get().accountToken; + if (token && isNative) await account.signOut(token); + await secrets.delete('account-token'); + await secrets.delete('server-token'); + storeServer(null); + set({ status: 'signed-out', accountToken: null, user: null, server: null, resources: [], connection: null, error: '' }); + }, +})); + +/** The connected server. Only call beneath screens rendered when status is ready. */ +export function useServer(): PlexServer { + const s = useSession((st) => st.server); + if (!s) throw new Error('No server connection'); + return s; +} diff --git a/src/app/settings.ts b/src/app/settings.ts new file mode 100644 index 0000000..314a7cd --- /dev/null +++ b/src/app/settings.ts @@ -0,0 +1,102 @@ +import { create } from 'zustand'; +import { persist } from 'zustand/middleware'; + +export type Quality = 'original' | '2160' | '1080' | '720' | '480'; +export type SkipMode = 'off' | 'button' | 'auto'; +export type SubtitleMode = 'auto' | 'always' | 'forced' | 'off'; + +export interface Preferences { + // Playback + quality: Quality; + remoteQuality: Quality; + hwdec: boolean; + hdrPassthrough: boolean; + autoplayNext: boolean; + countdownSeconds: number; + skipIntro: SkipMode; + skipCredits: SkipMode; + watchedPercent: number; + audioLanguage: string; + subtitleMode: SubtitleMode; + subtitleLanguage: string; + subtitleScale: number; + subtitleBackground: boolean; + volume: number; + seekStep: number; + // Interface + startPage: 'home' | 'movies' | 'shows'; + colorWash: boolean; + reducedMotion: boolean; + posterSize: 'compact' | 'comfortable' | 'large'; + heroRotation: boolean; + themeMusic: boolean; + themeVolume: number; + // Libraries shown for Movies and TV Shows + movieSection: string; + showSection: string; + // Downloads + downloadDir: string; + // Remembered library views per section + libraryViews: Record }>; +} + +export const defaults: Preferences = { + quality: 'original', + remoteQuality: '1080', + hwdec: true, + hdrPassthrough: true, + autoplayNext: true, + countdownSeconds: 8, + skipIntro: 'button', + skipCredits: 'button', + watchedPercent: 90, + audioLanguage: '', + subtitleMode: 'auto', + subtitleLanguage: '', + subtitleScale: 1, + subtitleBackground: false, + volume: 100, + seekStep: 10, + startPage: 'home', + colorWash: true, + reducedMotion: false, + posterSize: 'comfortable', + heroRotation: true, + themeMusic: false, + themeVolume: 30, + movieSection: '', + showSection: '', + downloadDir: '', + libraryViews: {}, +}; + +interface SettingsState extends Preferences { + set(key: K, value: Preferences[K]): void; + reset(): void; +} + +export const useSettings = create()( + persist( + (set) => ({ + ...defaults, + set: (key, value) => set({ [key]: value } as Partial), + reset: () => set({ ...defaults }), + }), + { name: 'kaleido.settings', version: 1 }, + ), +); + +export const QUALITY_LABEL: Record = { + original: 'Original quality', + '2160': '4K (40 Mbps)', + '1080': '1080p (20 Mbps)', + '720': '720p (4 Mbps)', + '480': '480p (1.5 Mbps)', +}; + +export const QUALITY_PROFILE: Record, { kbps: number; width: number; height: number }> = { + '2160': { kbps: 40000, width: 3840, height: 2160 }, + '1080': { kbps: 20000, width: 1920, height: 1080 }, + '720': { kbps: 4000, width: 1280, height: 720 }, + '480': { kbps: 1500, width: 854, height: 480 }, +}; diff --git a/src/app/updater.ts b/src/app/updater.ts new file mode 100644 index 0000000..a4e5275 --- /dev/null +++ b/src/app/updater.ts @@ -0,0 +1,64 @@ +/** + * Application updates through Tauri's signed updater. The feed + * (`updates/latest.json`) lists a build per platform, so the same flow serves + * Windows, macOS and Linux. + */ +import { create } from 'zustand'; +import { isNative } from '../platform/native'; +import { toast } from '../ui/overlays'; + +interface UpdaterState { + checking: boolean; + installing: boolean; + progress: number; + checkedAt: number; + error: string; + available: { version: string; notes: string } | null; +} + +export const useUpdater = create(() => ({ + checking: false, + installing: false, + progress: 0, + checkedAt: 0, + error: '', + available: null, +})); + +let pending: import('@tauri-apps/plugin-updater').Update | null = null; + +export async function checkForUpdate(manual = false) { + if (!isNative || useUpdater.getState().checking) return; + useUpdater.setState({ checking: true, error: '' }); + try { + const { check } = await import('@tauri-apps/plugin-updater'); + const update = await check({ timeout: 15000 }); + pending = update; + useUpdater.setState({ available: update ? { version: update.version, notes: update.body ?? '' } : null, checkedAt: Date.now() }); + if (update && !manual) toast(`Kaleido ${update.version} is available`, 'info', { label: 'Install', onClick: installUpdate }); + } catch (e: any) { + if (manual) useUpdater.setState({ error: `Couldn’t check for updates: ${e?.message ?? e}` }); + } finally { + useUpdater.setState({ checking: false }); + } +} + +export async function installUpdate() { + if (!pending) return; + useUpdater.setState({ installing: true, progress: 0 }); + try { + let total = 0; + let received = 0; + await pending.downloadAndInstall((event) => { + if (event.event === 'Started') total = event.data.contentLength ?? 0; + else if (event.event === 'Progress') { + received += event.data.chunkLength; + if (total) useUpdater.setState({ progress: received / total }); + } + }); + const { relaunch } = await import('@tauri-apps/plugin-process'); + await relaunch(); + } catch (e: any) { + useUpdater.setState({ installing: false, error: `The update couldn’t be installed: ${e?.message ?? e}` }); + } +} diff --git a/src/app/useHomeUsers.ts b/src/app/useHomeUsers.ts new file mode 100644 index 0000000..7fc7ad4 --- /dev/null +++ b/src/app/useHomeUsers.ts @@ -0,0 +1,41 @@ +import { useQuery } from '@tanstack/react-query'; +import { getHomeUsers, switchHomeUser } from '../plex/account'; +import type { HomeUser } from '../plex/types'; +import { promptDialog, toastError } from '../ui/overlays'; +import { useSession } from './session'; +import { queryClient } from './queries'; + +/** Plex Home profiles available to the signed-in account. */ +export function useHomeUsers() { + const token = useSession((s) => s.accountToken); + const home = useSession((s) => s.user?.home); + const { data } = useQuery({ + queryKey: ['homeUsers', token], + queryFn: () => getHomeUsers(token!), + enabled: !!token && !!home, + staleTime: 10 * 60_000, + }); + return { + users: data ?? [], + async switchTo(u: HomeUser) { + try { + let pin: string | undefined; + if (u.protected) { + const v = await promptDialog({ + title: `Switch to ${u.title}`, + message: 'This profile is protected by a PIN.', + confirm: 'Switch', + input: { label: 'PIN', type: 'password', placeholder: '4-digit PIN' }, + }); + if (v === null) return; + pin = v; + } + const next = await switchHomeUser(token!, u.uuid, pin); + queryClient.clear(); + await useSession.getState().switchUser(next); + } catch (e) { + toastError(e); + } + }, + }; +} diff --git a/src/assets/brand-mark.svg b/src/assets/brand-mark.svg new file mode 100644 index 0000000..2c1d24a --- /dev/null +++ b/src/assets/brand-mark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/imdb.svg b/src/assets/imdb.svg new file mode 100644 index 0000000..c8233d5 --- /dev/null +++ b/src/assets/imdb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/rt-hot.svg b/src/assets/rt-hot.svg new file mode 100644 index 0000000..7040aa8 --- /dev/null +++ b/src/assets/rt-hot.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/rt-stale.svg b/src/assets/rt-stale.svg new file mode 100644 index 0000000..a0c6d5d --- /dev/null +++ b/src/assets/rt-stale.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/downloads/store.ts b/src/downloads/store.ts new file mode 100644 index 0000000..9820dc8 --- /dev/null +++ b/src/downloads/store.ts @@ -0,0 +1,191 @@ +import { create } from 'zustand'; +import * as api from '../plex/api'; +import { parseItem } from '../plex/parse'; +import type { Item } from '../plex/types'; +import { appInfo, invoke, isNative, listen } from '../platform/native'; +import { useSession } from '../app/session'; +import { useSettings } from '../app/settings'; +import { isWatched } from '../app/format'; +import { toast, toastError } from '../ui/overlays'; + +export type DownloadStatus = 'queued' | 'downloading' | 'paused' | 'completed' | 'failed'; + +export interface DownloadMeta { + serverId: string; + serverName: string; + ratingKey: string; + partKey: string; + raw: any; + localAssets?: Record; +} + +export interface Download { + id: string; + filePath: string; + total: number; + received: number; + status: DownloadStatus; + error?: string | null; + meta: DownloadMeta; + createdAt: number; + speed: number; +} + +interface DownloadsState { + items: Download[]; + ready: boolean; + dir: string; + init(): Promise; + idFor(ratingKey: string, serverId?: string): string; + localFileFor(ratingKey: string): string | null; + start(item: Item): Promise; + startAll(item: Item): Promise; + pause(id: string): void; + resume(id: string): Promise; + remove(id: string): Promise; + resumeInterrupted(): void; + setDir(dir: string): Promise; + itemOf(d: Download): Item; +} + +function sanitize(s: string) { + return s.replace(/[<>:"/\\|?*\u0000-\u001f]/g, '_').trim() || 'Untitled'; +} + +/** Trims metadata kept for offline display: no extras, related hubs or raw blobs. */ +function slim(raw: any) { + const { Extras, Related, OnDeck, ...rest } = raw ?? {}; + void Extras; + void Related; + void OnDeck; + return rest; +} + +export const useDownloads = create((set, get) => ({ + items: [], + ready: false, + dir: '', + + async init() { + if (!isNative || get().ready) return; + const info = await appInfo(); + const dir = useSettings.getState().downloadDir || info.defaultDownloadDir; + await invoke('download_set_dir', { dir }).catch(() => {}); + const items = await invoke('download_list'); + set({ items, ready: true, dir }); + listen('download', (d) => { + const prev = get().items.find((x) => x.id === d.id); + set({ items: prev ? get().items.map((x) => (x.id === d.id ? d : x)) : [d, ...get().items] }); + if (d.status === 'completed' && prev && prev.status !== 'completed') toast(`Downloaded “${d.meta.raw?.title ?? 'title'}”`, 'success'); + if (d.status === 'failed' && prev?.status !== 'failed' && d.error) toast(d.error, 'error'); + }); + listen('download-removed', (id) => set({ items: get().items.filter((x) => x.id !== id) })); + }, + + idFor(ratingKey, serverId) { + const sid = serverId ?? useSession.getState().server?.machineId ?? 'offline'; + return `${sid}-${ratingKey}`; + }, + + localFileFor(ratingKey) { + const d = get().items.find((x) => x.meta.ratingKey === ratingKey && x.status === 'completed'); + return d?.filePath ?? null; + }, + + async start(input) { + const server = useSession.getState().server; + if (!isNative) { + toast('Downloads are available in the Kaleido desktop app.', 'error'); + return; + } + if (!server) return; + try { + await get().init(); + const item = await api.metadata(server, input.id); + const media = item.media[0]; + const part = media?.parts[0]; + if (!part) throw new Error('This title has no downloadable file.'); + const id = get().idFor(item.id); + if (get().items.some((d) => d.id === id && d.status !== 'failed')) { + toast('This title is already in Downloads.'); + return; + } + const ext = part.file.split('.').pop() || part.container || media.container || 'mkv'; + const baseName = part.file.split(/[\\/]/).pop() || `${item.title}.${ext}`; + const folder = + item.type === 'episode' + ? `${sanitize(item.grandparentTitle)}/Season ${item.parentIndex}` + : sanitize(item.year ? `${item.title} (${item.year})` : item.title); + const assets: Record = {}; + const poster = item.type === 'episode' ? item.grandparentThumb : item.thumb; + if (poster) assets.poster = server.image(poster, 360, 540); + if (item.type === 'episode' && item.thumb) assets.still = server.image(item.thumb, 640, 360); + const backdrop = item.type === 'episode' ? item.grandparentArt : item.art; + if (backdrop) assets.art = server.image(backdrop, 1280, 720); + if (item.logo) assets.logo = server.image(item.logo, 600, 200, { format: 'png' }); + await invoke('download_start', { + request: { + id, + url: server.signed(part.key, { download: 1 }), + folder, + fileName: sanitize(baseName), + meta: { serverId: server.machineId, serverName: server.name, ratingKey: item.id, partKey: part.key, raw: slim(item.raw) } satisfies DownloadMeta, + assets, + }, + }); + toast(`Downloading “${item.type === 'episode' ? `${item.grandparentTitle} · ${item.title}` : item.title}”`, 'success'); + } catch (e) { + toastError(e); + } + }, + + async startAll(item) { + const server = useSession.getState().server; + if (!server) return; + try { + const leaves = await api.allLeaves(server, item.id); + const percent = useSettings.getState().watchedPercent; + const todo = leaves.filter((e) => !isWatched(e, percent)); + const list = todo.length ? todo : leaves; + toast(`Queued ${list.length} episode${list.length === 1 ? '' : 's'} for download`, 'success'); + for (const e of list) await get().start(e); + } catch (e) { + toastError(e); + } + }, + + pause(id) { + invoke('download_pause', { id }).catch(toastError); + }, + + async resume(id) { + const d = get().items.find((x) => x.id === id); + const server = useSession.getState().server; + if (!d || !server) return; + if (server.machineId !== d.meta.serverId) { + toast(`Connect to ${d.meta.serverName} to resume this download.`, 'error'); + return; + } + await invoke('download_resume', { id, url: server.signed(d.meta.partKey, { download: 1 }) }).catch(toastError); + }, + + async remove(id) { + await invoke('download_remove', { id, deleteFiles: true }).catch(toastError); + }, + + resumeInterrupted() { + const server = useSession.getState().server; + if (!server) return; + for (const d of get().items) if (d.status === 'paused' && d.error === 'interrupted' && d.meta.serverId === server.machineId) get().resume(d.id); + }, + + async setDir(dir) { + await invoke('download_set_dir', { dir }); + useSettings.getState().set('downloadDir', dir); + set({ dir }); + }, + + itemOf(d) { + return parseItem(d.meta.raw ?? {}); + }, +})); diff --git a/src/main.tsx b/src/main.tsx new file mode 100644 index 0000000..ccf9b98 --- /dev/null +++ b/src/main.tsx @@ -0,0 +1,30 @@ +import { StrictMode } from 'react'; +import { createRoot } from 'react-dom/client'; +import '@fontsource-variable/inter'; +import './styles/base.css'; +import './styles/ui.css'; +import './styles/app.css'; +import './styles/screens.css'; +import './styles/player.css'; +import { App } from './app/App'; +import { installKeyboardNav } from './app/keyboardNav'; +import { useSession } from './app/session'; +import { useRouter } from './app/router'; +import { usePlayer } from './player/store'; +import { useSettings } from './app/settings'; + +if (import.meta.env.DEV) (window as any).__kaleido = { useSession, useRouter, usePlayer, useSettings }; + +// No browser context menu or text-selection chrome outside inputs: this is an app. +window.addEventListener('contextmenu', (e) => { + const t = e.target as HTMLElement; + if (!t.closest('input, textarea, .selectable')) e.preventDefault(); +}); + +installKeyboardNav(); + +createRoot(document.getElementById('root')!).render( + + + , +); diff --git a/src/platform/native.ts b/src/platform/native.ts new file mode 100644 index 0000000..b8fd3d2 --- /dev/null +++ b/src/platform/native.ts @@ -0,0 +1,161 @@ +/** + * The boundary between Kaleido and its host. In the desktop app this talks to + * the Rust side through Tauri; in a plain browser (used for UI development) it + * degrades gracefully: no video, no downloads, tokens in localStorage. + */ +import type { UnlistenFn } from '@tauri-apps/api/event'; + +export const isNative = typeof window !== 'undefined' && '__TAURI_INTERNALS__' in window; + +export async function invoke(cmd: string, args?: Record): Promise { + if (!isNative) throw new Error(`${cmd} is only available in the desktop app.`); + const { invoke } = await import('@tauri-apps/api/core'); + return invoke(cmd, args); +} + +export async function listen(event: string, handler: (payload: T) => void): Promise { + if (!isNative) return () => {}; + const { listen } = await import('@tauri-apps/api/event'); + return listen(event, (e) => handler(e.payload)); +} + +/** HTTP for Plex APIs: native requests avoid CORS and local-network limits. */ +let nativeFetch: typeof fetch | null = null; +export async function httpFetch(input: string, init?: RequestInit): Promise { + if (!isNative) return fetch(input, init); + if (!nativeFetch) nativeFetch = (await import('@tauri-apps/plugin-http')).fetch as typeof fetch; + return nativeFetch(input, init); +} + +export const secrets = { + async get(key: string): Promise { + if (!isNative) return localStorage.getItem(`kaleido.dev.secret.${key}`); + return invoke('secret_get', { key }); + }, + async set(key: string, value: string): Promise { + if (!isNative) return localStorage.setItem(`kaleido.dev.secret.${key}`, value); + await invoke('secret_set', { key, value }); + }, + async delete(key: string): Promise { + if (!isNative) return localStorage.removeItem(`kaleido.dev.secret.${key}`); + await invoke('secret_delete', { key }); + }, +}; + +export interface AppInfo { + version: string; + dataDir: string; + defaultDownloadDir: string; + platform: string; + deviceName: string; +} + +let info: AppInfo | null = null; +export async function appInfo(): Promise { + if (info) return info; + info = isNative + ? await invoke('app_info') + : { version: '0.1.0-dev', dataDir: '', defaultDownloadDir: '', platform: 'browser', deviceName: 'Browser preview' }; + return info; +} + +/** Local development only: start signed in from the Android project's `.env`. */ +export async function devSession(): Promise<{ server: string; token: string } | null> { + if (!import.meta.env.DEV) return null; + try { + if (isNative) return await invoke<{ server: string; token: string } | null>('dev_session'); + const r = await fetch('/__dev/session'); + if (!r.ok) return null; + const j = await r.json(); + return j.server && j.token ? j : null; + } catch { + return null; + } +} + +export const win = { + async current() { + const { getCurrentWindow } = await import('@tauri-apps/api/window'); + return getCurrentWindow(); + }, + async minimize() { + if (isNative) (await this.current()).minimize(); + }, + async toggleMaximize() { + if (isNative) (await this.current()).toggleMaximize(); + }, + async close() { + if (isNative) (await this.current()).close(); + }, + async isMaximized() { + return isNative ? (await this.current()).isMaximized() : false; + }, + async setFullscreen(on: boolean) { + if (isNative) return (await this.current()).setFullscreen(on); + if (on) await document.documentElement.requestFullscreen?.().catch(() => {}); + else if (document.fullscreenElement) await document.exitFullscreen().catch(() => {}); + }, + async isFullscreen() { + return isNative ? (await this.current()).isFullscreen() : !!document.fullscreenElement; + }, + async show() { + if (isNative) { + const w = await this.current(); + await w.show(); + await w.setFocus(); + } + }, + async onResized(cb: () => void): Promise { + if (!isNative) { + window.addEventListener('resize', cb); + return () => window.removeEventListener('resize', cb); + } + return (await this.current()).onResized(cb); + }, +}; + +export async function openExternal(url: string) { + if (!isNative) { + window.open(url, '_blank', 'noopener'); + return; + } + const { openUrl } = await import('@tauri-apps/plugin-opener'); + await openUrl(url); +} + +export async function revealPath(path: string) { + if (!isNative) return; + const { revealItemInDir } = await import('@tauri-apps/plugin-opener'); + await revealItemInDir(path); +} + +export async function pickFolder(defaultPath?: string): Promise { + if (!isNative) return null; + const { open } = await import('@tauri-apps/plugin-dialog'); + const r = await open({ directory: true, defaultPath, multiple: false }); + return typeof r === 'string' ? r : null; +} + +export async function pickFile(filters?: { name: string; extensions: string[] }[]): Promise { + if (!isNative) return null; + const { open } = await import('@tauri-apps/plugin-dialog'); + const r = await open({ directory: false, multiple: false, filters }); + return typeof r === 'string' ? r : null; +} + +export async function saveFile(defaultPath: string): Promise { + if (!isNative) return null; + const { save } = await import('@tauri-apps/plugin-dialog'); + return (await save({ defaultPath })) ?? null; +} + +/** Converts a local file path to a URL the web view may load (offline artwork). */ +export async function localFileUrl(path: string): Promise { + if (!isNative || !path) return ''; + const { convertFileSrc } = await import('@tauri-apps/api/core'); + return convertFileSrc(path); +} + +export function keepAwake(enabled: boolean) { + if (isNative) invoke('keep_awake', { enabled }).catch(() => {}); +} diff --git a/src/player/PlayerOverlay.tsx b/src/player/PlayerOverlay.tsx new file mode 100644 index 0000000..9a026c9 --- /dev/null +++ b/src/player/PlayerOverlay.tsx @@ -0,0 +1,566 @@ +import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react'; +import { usePlayer } from './store'; +import { useSession } from '../app/session'; +import { useSettings, QUALITY_LABEL, type Quality } from '../app/settings'; +import { clock, episodeLabel } from '../app/format'; +import { Icon } from '../ui/Icon'; +import { Facts, TitleArt } from '../ui/media'; +import { Button, Spinner } from '../ui/primitives'; +import { win, isNative } from '../platform/native'; +import type { Item } from '../plex/types'; + +const HIDE_AFTER = 3000; + +function useAutoHide(paused: boolean, pinned: boolean) { + const [visible, setVisible] = useState(true); + const timer = useRef | null>(null); + const poke = useCallback(() => { + setVisible(true); + if (timer.current) clearTimeout(timer.current); + timer.current = setTimeout(() => setVisible(false), HIDE_AFTER); + }, []); + useEffect(() => { + if (paused || pinned) { + if (timer.current) clearTimeout(timer.current); + setVisible(true); + } else poke(); + }, [paused, pinned, poke]); + return { visible, poke }; +} + +function Timeline({ onScrub }: { onScrub: (active: boolean) => void }) { + const position = usePlayer((s) => s.position); + const duration = usePlayer((s) => s.duration); + const cacheTime = usePlayer((s) => s.cacheTime); + const chapters = usePlayer((s) => s.chapters); + const markers = usePlayer((s) => s.item?.markers ?? []); + const seek = usePlayer((s) => s.seek); + const previewAt = usePlayer((s) => s.previewAt); + const ref = useRef(null); + const [hover, setHover] = useState<{ x: number; t: number } | null>(null); + const [drag, setDrag] = useState(null); + + const timeAt = (clientX: number) => { + const r = ref.current!.getBoundingClientRect(); + const f = Math.min(1, Math.max(0, (clientX - r.left) / r.width)); + return { f, t: f * duration, x: clientX - r.left }; + }; + + useEffect(() => { + if (drag === null) return; + const move = (e: PointerEvent) => { + const { t, x } = timeAt(e.clientX); + setDrag(t); + setHover({ x, t }); + }; + const up = (e: PointerEvent) => { + const { t } = timeAt(e.clientX); + seek(t); + setDrag(null); + setHover(null); + onScrub(false); + }; + window.addEventListener('pointermove', move); + window.addEventListener('pointerup', up, { once: true }); + return () => { + window.removeEventListener('pointermove', move); + window.removeEventListener('pointerup', up); + }; + }, [drag !== null]); + + const shown = drag ?? position; + const pct = duration ? (shown / duration) * 100 : 0; + const buffered = duration ? Math.min(100, (Math.max(cacheTime, position) / duration) * 100) : 0; + const preview = hover ? previewAt(hover.t) : ''; + const chapter = hover ? [...chapters].reverse().find((c) => c.time <= hover.t) : null; + const width = ref.current?.clientWidth ?? 0; + + return ( +
{ + if (drag === null && duration) { + const { t, x } = timeAt(e.clientX); + setHover({ x, t }); + } + }} + onPointerLeave={() => drag === null && setHover(null)} + onPointerDown={(e) => { + if (!duration) return; + e.preventDefault(); + const { t, x } = timeAt(e.clientX); + setDrag(t); + setHover({ x, t }); + onScrub(true); + }} + role="slider" + aria-label="Seek" + aria-valuemin={0} + aria-valuemax={Math.round(duration)} + aria-valuenow={Math.round(position)} + > +
+
+
+ {duration > 0 && + markers + .filter((m) => m.type === 'intro' || m.type === 'credits') + .map((m) =>
)} + {duration > 0 && chapters.slice(1).map((c) =>
)} +
+
+ {hover && ( +
+ {preview && } +
+ {chapter && chapters.length > 1 && {chapter.title}} + {clock(hover.t, duration >= 3600)} +
+
+ )} +
+ ); +} + +function Panel({ title, onClose, children, className = '' }: { title: string; onClose: () => void; children: ReactNode; className?: string }) { + useEffect(() => { + const onKey = (e: KeyboardEvent) => { + if (e.key === 'Escape') { + e.stopPropagation(); + onClose(); + } + }; + window.addEventListener('keydown', onKey, true); + return () => window.removeEventListener('keydown', onKey, true); + }, [onClose]); + return ( +
e.stopPropagation()} onDoubleClick={(e) => e.stopPropagation()}> +
{title}
+ {children} +
+ ); +} + +function Option({ selected, label, detail, onClick }: { selected: boolean; label: string; detail?: string; onClick: () => void }) { + return ( + + ); +} + +function TracksPanel({ onClose }: { onClose: () => void }) { + const st = usePlayer(); + return ( + +
+
+

Audio

+ {st.audioTracks.map((t) => ( +
+
+

Subtitles

+
+
+
+ ); +} + +function SettingsPanel({ onClose }: { onClose: () => void }) { + const st = usePlayer(); + const [view, setView] = useState<'main' | 'quality' | 'speed' | 'version' | 'chapters'>('main'); + const speeds = [0.5, 0.75, 1, 1.25, 1.5, 2]; + const media = st.item?.media ?? []; + const local = st.delivery?.mode === 'local'; + if (view === 'quality') + return ( + + {(Object.keys(QUALITY_LABEL) as Quality[]).map((q) => ( + + ); + if (view === 'speed') + return ( + + {speeds.map((s) => ( + + ); + if (view === 'version') + return ( + + {media.map((m, i) => ( + + ); + if (view === 'chapters') + return ( + + {st.chapters.map((c) => ( + + ); + const row = (label: string, value: string, go: () => void, disabled = false) => ( + + ); + return ( + + {!local && row('Quality', QUALITY_LABEL[st.quality], () => setView('quality'))} + {row('Speed', st.speed === 1 ? 'Normal' : `${st.speed}×`, () => setView('speed'))} + {media.length > 1 && !local && row('Version', `${st.mediaIndex + 1} of ${media.length}`, () => setView('version'))} + {st.chapters.length > 1 && row('Chapters', `${st.chapters.length}`, () => setView('chapters'))} +
+ {st.delivery?.mode === 'direct' && 'Direct play'} + {st.delivery?.mode === 'transcode' && `Converting to ${st.delivery.label}`} + {st.delivery?.mode === 'local' && 'Playing from this computer'} + {st.video && st.video.width > 0 && ` · ${st.video.width}×${st.video.height}`} + {st.video?.codec && ` · ${st.video.codec.toUpperCase()}`} + {st.video?.hwdec && st.video.hwdec !== 'no' ? ' · Hardware decoding' : ''} +
+
+ ); +} + +function Volume() { + const volume = usePlayer((s) => s.volume); + const muted = usePlayer((s) => s.muted); + const setVolume = usePlayer((s) => s.setVolume); + const toggleMute = usePlayer((s) => s.toggleMute); + const icon = muted || volume === 0 ? 'mute' : volume < 50 ? 'volumeLow' : 'volume'; + return ( +
+ + setVolume(Number(e.target.value))} + style={{ ['--v' as string]: `${muted ? 0 : Math.min(100, volume)}%` }} + aria-label="Volume" + /> +
+ ); +} + +function SkipButton() { + const item = usePlayer((s) => s.item); + const position = usePlayer((s) => s.position); + const seek = usePlayer((s) => s.seek); + const nextUp = usePlayer((s) => s.nextUp); + const countdown = usePlayer((s) => s.countdown); + const skipIntro = useSettings((s) => s.skipIntro); + const skipCredits = useSettings((s) => s.skipCredits); + const autoSkipped = useRef(new Set()); + const ms = position * 1000; + const marker = item?.markers.find((m) => (m.type === 'intro' || m.type === 'credits') && ms >= m.start && ms < m.end - 1000); + const mode = marker?.type === 'intro' ? skipIntro : skipCredits; + useEffect(() => { + if (marker && mode === 'auto' && !autoSkipped.current.has(marker.id + marker.start) && !(marker.type === 'credits' && nextUp)) { + autoSkipped.current.add(marker.id + marker.start); + seek(marker.end / 1000); + } + }, [marker?.id, marker?.start, mode]); + if (!marker || mode === 'off' || countdown !== null) return null; + if (marker.type === 'credits' && nextUp) return null; + return ( + + ); +} + +function PostPlay() { + const server = useSession((s) => s.server); + const nextUp = usePlayer((s) => s.nextUp); + const countdown = usePlayer((s) => s.countdown); + const playNext = usePlayer((s) => s.playNext); + const cancel = usePlayer((s) => s.cancelCountdown); + if (!nextUp || countdown === null || !server) return null; + return ( +
e.stopPropagation()} onDoubleClick={(e) => e.stopPropagation()}> +
+ + {countdown > 0 && ( + + + + )} +
+
+ Next episode{countdown > 0 ? ` in ${countdown}` : ''} + + {episodeLabel(nextUp)} · {nextUp.title} + +
+ + +
+
+
+ ); +} + +function TitleBlock({ item }: { item: Item }) { + return ( +
+ i.type === 'clearLogo')?.url ?? '' } : item} maxWidth={240} maxHeight={60} as="h2" /> + {item.type === 'episode' && ( +
+ {episodeLabel(item)} · {item.title} +
+ )} + {item.type !== 'clip' && } +
+ ); +} + +export function PlayerOverlay() { + const st = usePlayer(); + const server = useSession((s) => s.server); + const [panel, setPanel] = useState<'' | 'tracks' | 'settings'>(''); + const [scrubbing, setScrubbing] = useState(false); + const [flash, setFlash] = useState<{ icon: string; key: number } | null>(null); + const { visible, poke } = useAutoHide(st.paused || st.ended, !!panel || scrubbing || st.countdown !== null); + const clickTimer = useRef | null>(null); + const seekStep = useSettings((s) => s.seekStep); + + const showFlash = (icon: string) => setFlash({ icon, key: Date.now() }); + + useEffect(() => { + if (!st.open) setPanel(''); + }, [st.open]); + + useEffect(() => { + if (!st.open) return; + const onKey = async (e: KeyboardEvent) => { + if ((e.target as HTMLElement)?.tagName === 'INPUT' && (e.target as HTMLInputElement).type !== 'range') return; + const p = usePlayer.getState(); + let handled = true; + switch (e.key) { + case ' ': + case 'k': + case 'K': + p.togglePause(); + showFlash(p.paused ? 'play' : 'pause'); + break; + case 'ArrowLeft': + case 'j': + case 'J': + p.seekBy(e.shiftKey ? -60 : e.key === 'ArrowLeft' ? -seekStep : -10); + showFlash('replay10'); + break; + case 'ArrowRight': + case 'l': + case 'L': + p.seekBy(e.shiftKey ? 60 : e.key === 'ArrowRight' ? seekStep : 10); + showFlash('forward10'); + break; + case 'ArrowUp': + p.setVolume(p.volume + 5); + break; + case 'ArrowDown': + p.setVolume(p.volume - 5); + break; + case 'm': + case 'M': + p.toggleMute(); + break; + case 'f': + case 'F': + case 'F11': + p.toggleFullscreen(); + break; + case 'n': + case 'N': + if (e.shiftKey && p.nextUp) p.playNext(); + else handled = false; + break; + case 'c': + case 'C': { + const subs = p.subTracks; + const i = subs.findIndex((t) => t.key === p.subKey); + p.selectSubtitle(i + 1 < subs.length ? subs[i + 1].key : ''); + break; + } + case 'Escape': { + const fs = await win.isFullscreen().catch(() => false); + if (fs) p.toggleFullscreen(); + else p.close(); + break; + } + case 'Backspace': + p.close(); + break; + case 'Home': + p.seek(0); + break; + default: + if (/^[0-9]$/.test(e.key) && p.duration) p.seek((Number(e.key) / 10) * p.duration); + else handled = false; + } + if (handled) { + e.preventDefault(); + e.stopPropagation(); + poke(); + } + }; + window.addEventListener('keydown', onKey); + return () => window.removeEventListener('keydown', onKey); + }, [st.open, seekStep, poke]); + + if (!st.open || !st.item) return null; + const item = st.item; + const loading = !st.firstFrame && !st.error; + const art = item.type === 'episode' ? item.grandparentArt || item.art : item.art; + const hideChrome = !visible && !loading && !st.error; + + return ( +
{ + if (panel) return setPanel(''); + if (clickTimer.current) return; + clickTimer.current = setTimeout(() => { + clickTimer.current = null; + if (!loading && !st.error) { + st.togglePause(); + showFlash(st.paused ? 'play' : 'pause'); + } + }, 220); + }} + onDoubleClick={() => { + if (clickTimer.current) clearTimeout(clickTimer.current); + clickTimer.current = null; + st.toggleFullscreen(); + }} + onWheel={(e) => st.setVolume(st.volume + (e.deltaY < 0 ? 5 : -5))} + > + {(loading || st.error) && server && ( +
+ {art && } +
+
+ )} +
+
+ +
e.stopPropagation()} onDoubleClick={(e) => e.stopPropagation()}> + +
+ + {(loading || st.buffering || st.seeking) && !st.error && ( +
+ +
+ )} + {flash && !loading && ( +
+ +
+ )} + + {st.error && ( +
e.stopPropagation()}> + +

Playback stopped

+

{st.error}

+
+ + +
+
+ )} + + + + + {!st.error && ( +
e.stopPropagation()} onDoubleClick={(e) => e.stopPropagation()}> +
+ +
{st.delivery?.mode === 'transcode' ? st.delivery.label : st.delivery?.mode === 'local' ? 'Offline' : ''}
+
+ +
+
+ + + + {st.nextUp && ( + + )} + + + {clock(st.position, st.duration >= 3600)} / {clock(st.duration, st.duration >= 3600)} + +
+
+ + + +
+
+ {panel === 'tracks' && setPanel('')} />} + {panel === 'settings' && setPanel('')} />} +
+ )} +
+ ); +} diff --git a/src/player/engine.ts b/src/player/engine.ts new file mode 100644 index 0000000..139b47a --- /dev/null +++ b/src/player/engine.ts @@ -0,0 +1,43 @@ +/** Thin typed wrapper over the native mpv commands and its event stream. */ +import { invoke, isNative, listen } from '../platform/native'; + +export interface MpvTrack { + id: number; + type: 'video' | 'audio' | 'sub'; + title?: string; + lang?: string; + codec?: string; + default?: boolean; + forced?: boolean; + external?: boolean; + selected?: boolean; + 'ff-index'?: number; + 'demux-channel-count'?: number; + 'external-filename'?: string; +} + +export type MpvEvent = + | { type: 'property'; name: string; value: any } + | { type: 'start-file' | 'file-loaded' | 'playback-restart' | 'seek' } + | { type: 'end-file'; reason: string; error?: string | null } + | { type: 'log'; level: string; prefix: string; text: string }; + +let initialized: Promise | null = null; + +export const mpv = { + available: isNative, + init(options: { hwdec: boolean; hdr: boolean }) { + if (!initialized) { + initialized = invoke('player_init', { options: { hwdec: options.hwdec ? 'auto-safe' : 'no', hdr: options.hdr, extra: [] } }).catch((e) => { + initialized = null; + throw e; + }); + } + return initialized; + }, + command: (...args: (string | number)[]) => invoke('player_command', { args: args.map(String) }), + set: (name: string, value: unknown) => invoke('player_set', { name, value }), + get: (name: string) => invoke('player_get', { name }), + show: (visible: boolean) => invoke('player_show', { visible }), + on: (handler: (e: MpvEvent) => void) => listen('mpv', handler), +}; diff --git a/src/player/store.ts b/src/player/store.ts new file mode 100644 index 0000000..f77ae7e --- /dev/null +++ b/src/player/store.ts @@ -0,0 +1,693 @@ +import { create } from 'zustand'; +import * as api from '../plex/api'; +import { directUrl, previewUrl, reportTimeline, stopTranscode, transcodeUrl, type Delivery } from '../plex/playback'; +import type { Item, Stream } from '../plex/types'; +import { useSession } from '../app/session'; +import { useSettings, type Quality } from '../app/settings'; +import { channelLabel } from '../app/format'; +import { invalidateLibrary } from '../app/queries'; +import { keepAwake, isNative, win } from '../platform/native'; +import { mpv, type MpvEvent, type MpvTrack } from './engine'; +import { toast } from '../ui/overlays'; +import { stopThemeMusic } from './theme'; + +export interface Track { + key: string; // stable UI key + mpvId: number | null; // null until loaded (external subs) + stream?: Stream; // Plex stream, when known + label: string; + detail: string; + language: string; + forced: boolean; + external: boolean; +} + +export interface PlayOptions { + /** Start position in ms. Defaults to the saved resume point when `resume` is true. */ + offsetMs?: number; + resume?: boolean; + mediaIndex?: number; + /** A local file path (offline download). */ + localFile?: string; + quality?: Quality; +} + +interface PlayerState { + open: boolean; + item: Item | null; + delivery: Delivery | null; + mediaIndex: number; + quality: Quality; + firstFrame: boolean; + error: string; + position: number; + duration: number; + cacheTime: number; + paused: boolean; + buffering: boolean; + seeking: boolean; + volume: number; + muted: boolean; + speed: number; + subDelay: number; + audioTracks: Track[]; + subTracks: Track[]; + audioKey: string; + subKey: string; // '' when off + chapters: { title: string; time: number }[]; + video: { width: number; height: number; hwdec: string; codec: string } | null; + ended: boolean; + nextUp: Item | null; + countdown: number | null; + postPlayDismissed: boolean; + fullscreen: boolean; + + play(item: Item, opts?: PlayOptions): Promise; + close(): Promise; + togglePause(): void; + seek(seconds: number): void; + seekBy(delta: number): void; + setVolume(v: number): void; + toggleMute(): void; + setSpeed(s: number): void; + setSubDelay(s: number): void; + selectAudio(key: string): Promise; + selectSubtitle(key: string): Promise; + setQuality(q: Quality): Promise; + selectVersion(index: number): Promise; + playNext(): Promise; + cancelCountdown(): void; + toggleFullscreen(): Promise; + previewAt(seconds: number): string; +} + +let session = ''; +let startOffsetMs = 0; +let lastReport = 0; +let reportTimer: ReturnType | null = null; +let countdownTimer: ReturnType | null = null; +let scrobbled = false; +let unlisten: (() => void) | null = null; +let loadToken = 0; +let wasFullscreenBeforePlay = false; +let pendingExternal: Track | null = null; + +const server = () => useSession.getState().server; + +function languageName(code: string, fallback: string) { + if (!code) return fallback; + try { + return new Intl.DisplayNames([navigator.language || 'en'], { type: 'language' }).of(code) || fallback; + } catch { + return fallback; + } +} + +function audioTrackFromStream(s: Stream): Track { + const lang = s.language || languageName(s.languageCode, 'Unknown'); + const parts = [s.codec.toUpperCase().replace('DCA', 'DTS'), channelLabel(s.channels) || s.audioChannelLayout].filter(Boolean); + const title = s.title && !s.title.toLowerCase().includes(lang.toLowerCase()) ? s.title : ''; + return { + key: `p${s.id}`, + mpvId: null, + stream: s, + label: lang, + detail: title || parts.join(' '), + language: s.languageCode, + forced: false, + external: false, + }; +} + +function subTrackFromStream(s: Stream): Track { + const lang = s.language || languageName(s.languageCode, 'Unknown'); + const flags = [s.forced ? 'Forced' : '', s.hearingImpaired ? 'SDH' : ''].filter(Boolean); + return { + key: `p${s.id}`, + mpvId: null, + stream: s, + label: [lang, ...flags].join(' · '), + detail: [s.title && s.title !== lang ? s.title : '', s.codec.toUpperCase(), s.key ? 'External' : ''].filter(Boolean).join(' · '), + language: s.languageCode, + forced: s.forced, + external: !!s.key, + }; +} + +function mpvTrackLabel(t: MpvTrack): Track { + const lang = t.lang ? languageName(t.lang, t.lang) : t.type === 'sub' ? 'Subtitles' : 'Audio'; + return { + key: `m${t.id}`, + mpvId: t.id, + label: t.title ? `${lang} · ${t.title}` : lang, + detail: [t.codec?.toUpperCase(), t['demux-channel-count'] ? channelLabel(t['demux-channel-count']) : ''].filter(Boolean).join(' '), + language: t.lang ?? '', + forced: !!t.forced, + external: !!t.external, + }; +} + +function report(state: 'playing' | 'paused' | 'buffering' | 'stopped') { + const s = server(); + const { item, position, delivery } = usePlayer.getState(); + if (!s || !item || !session || item.type === 'clip') return; + lastReport = Date.now(); + const extra: Record = {}; + if (delivery?.mode === 'transcode' && delivery.session) extra['X-Plex-Session-Identifier'] = delivery.session; + reportTimeline(s, item, state, position * 1000, session, extra).catch(() => {}); +} + +function checkScrobble() { + const { item, position, duration } = usePlayer.getState(); + const s = server(); + if (!item || !s || scrobbled || !duration || item.type === 'clip') return; + const percent = useSettings.getState().watchedPercent; + if (position / duration >= percent / 100) { + scrobbled = true; + api + .setWatched(s, item.id, true) + .then(() => invalidateLibrary()) + .catch(() => (scrobbled = false)); + } +} + +async function findNext(item: Item): Promise { + const s = server(); + if (!s || item.type !== 'episode' || !item.grandparentId) return null; + try { + const leaves = await api.allLeaves(s, item.grandparentId); + const i = leaves.findIndex((e) => e.id === item.id); + return i >= 0 ? (leaves[i + 1] ?? null) : null; + } catch { + return null; + } +} + +function startCountdown() { + const st = usePlayer.getState(); + if (!st.nextUp || st.countdown !== null || st.postPlayDismissed) return; + const settings = useSettings.getState(); + if (!settings.autoplayNext) { + usePlayer.setState({ countdown: -1 }); + return; + } + usePlayer.setState({ countdown: settings.countdownSeconds }); + countdownTimer && clearInterval(countdownTimer); + countdownTimer = setInterval(() => { + const c = usePlayer.getState().countdown; + if (c === null || c < 0) return; + if (c <= 1) { + clearInterval(countdownTimer!); + countdownTimer = null; + usePlayer.getState().playNext(); + } else usePlayer.setState({ countdown: c - 1 }); + }, 1000); +} + +function stopCountdown() { + if (countdownTimer) clearInterval(countdownTimer); + countdownTimer = null; +} + +/** Applies Plex/user track preferences once mpv has loaded the file. */ +async function applyInitialTracks(tracks: MpvTrack[]) { + const st = usePlayer.getState(); + const prefs = useSettings.getState(); + const direct = st.delivery?.mode !== 'transcode'; + const byFF = (type: string, idx: number) => tracks.find((t) => t.type === type && t['ff-index'] === idx && !t.external); + + let audio = st.audioTracks; + let subs = st.subTracks; + if (direct) { + audio = audio.map((t) => ({ ...t, mpvId: t.stream ? (byFF('audio', t.stream.index)?.id ?? null) : t.mpvId })); + subs = subs.map((t) => ({ ...t, mpvId: t.stream && !t.external ? (byFF('sub', t.stream.index)?.id ?? null) : t.mpvId })); + // Files without Plex stream info (offline) use mpv's own list. + if (!audio.length) audio = tracks.filter((t) => t.type === 'audio').map(mpvTrackLabel); + if (!subs.length) subs = tracks.filter((t) => t.type === 'sub').map(mpvTrackLabel); + } + + // Audio: preferred language, else Plex's selection, else the file default. + let audioKey = st.audioKey; + if (!audioKey) { + const lang = prefs.audioLanguage; + audioKey = + (lang && audio.find((t) => t.language === lang)?.key) || + audio.find((t) => t.stream?.selected)?.key || + audio.find((t) => t.stream?.default)?.key || + audio[0]?.key || + ''; + } + // Subtitles: follow the subtitle mode. + let subKey = st.subKey; + if (subKey === '__init') { + const lang = prefs.subtitleLanguage || audio.find((t) => t.key === audioKey)?.language || ''; + const inLang = subs.filter((t) => !lang || t.language === lang); + switch (prefs.subtitleMode) { + case 'off': + subKey = ''; + break; + case 'always': + subKey = (inLang.find((t) => !t.forced) ?? inLang[0] ?? subs[0])?.key ?? ''; + break; + case 'forced': + subKey = inLang.find((t) => t.forced)?.key ?? ''; + break; + default: + subKey = subs.find((t) => t.stream?.selected)?.key ?? inLang.find((t) => t.forced)?.key ?? ''; + } + } + usePlayer.setState({ audioTracks: audio, subTracks: subs, audioKey, subKey }); + if (direct) { + const a = audio.find((t) => t.key === audioKey); + if (a?.mpvId) mpv.set('aid', a.mpvId).catch(() => {}); + await setMpvSubtitle(subKey); + } +} + +async function setMpvSubtitle(key: string) { + const st = usePlayer.getState(); + const t = st.subTracks.find((x) => x.key === key); + if (!t) { + await mpv.set('sid', 'no').catch(() => {}); + return; + } + if (t.mpvId) { + await mpv.set('sid', t.mpvId).catch(() => {}); + } else if (t.external && t.stream?.key && server()) { + pendingExternal = t; + const url = server()!.signed(t.stream.key); + await mpv.command('sub-add', url, 'select', t.label, t.language || 'und').catch(() => toast('This subtitle could not be loaded.', 'error')); + } +} + +function onEvent(e: MpvEvent) { + const st = usePlayer.getState(); + if (!st.open) return; + switch (e.type) { + case 'property': { + const v = e.value; + switch (e.name) { + case 'time-pos': + if (typeof v === 'number') { + usePlayer.setState({ position: v }); + checkScrobble(); + if (Date.now() - lastReport > 10000) report(st.paused ? 'paused' : 'playing'); + maybeCredits(v); + } + break; + case 'duration': + if (typeof v === 'number' && v > 0) usePlayer.setState({ duration: v }); + break; + case 'pause': + usePlayer.setState({ paused: !!v }); + report(v ? 'paused' : 'playing'); + keepAwake(!v); + break; + case 'paused-for-cache': + usePlayer.setState({ buffering: !!v }); + break; + case 'seeking': + usePlayer.setState({ seeking: !!v }); + break; + case 'demuxer-cache-time': + if (typeof v === 'number') usePlayer.setState({ cacheTime: v }); + break; + case 'volume': + if (typeof v === 'number') usePlayer.setState({ volume: v }); + break; + case 'mute': + usePlayer.setState({ muted: !!v }); + break; + case 'speed': + if (typeof v === 'number') usePlayer.setState({ speed: v }); + break; + case 'sub-delay': + if (typeof v === 'number') usePlayer.setState({ subDelay: v }); + break; + case 'chapter-list': + if (Array.isArray(v) && v.length > 1 && !st.chapters.length) + usePlayer.setState({ chapters: v.map((c: any, i: number) => ({ title: c.title && !/^\d\d:\d\d/.test(c.title) ? c.title : `Chapter ${i + 1}`, time: c.time })) }); + break; + case 'video-params': + if (v?.w) usePlayer.setState({ video: { ...(st.video ?? { hwdec: '', codec: '' }), width: v.w, height: v.h } }); + break; + case 'hwdec-current': + usePlayer.setState({ video: { ...(st.video ?? { width: 0, height: 0, codec: '' }), hwdec: v ?? '' } }); + break; + case 'track-list': + if (Array.isArray(v)) { + if (pendingExternal) { + const ext = (v as MpvTrack[]).filter((t) => t.type === 'sub' && t.external).pop(); + if (ext) { + const key = pendingExternal.key; + pendingExternal = null; + usePlayer.setState({ subTracks: usePlayer.getState().subTracks.map((t) => (t.key === key ? { ...t, mpvId: ext.id } : t)) }); + } + } + const video = (v as MpvTrack[]).find((t) => t.type === 'video' && t.selected); + if (video) usePlayer.setState({ video: { ...(usePlayer.getState().video ?? { width: 0, height: 0, hwdec: '' }), codec: video.codec ?? '' } }); + } + break; + case 'eof-reached': + if (v === true) onEnded(); + break; + } + break; + } + case 'file-loaded': + mpv + .get('track-list') + .then(applyInitialTracks) + .catch(() => {}); + break; + case 'playback-restart': + if (!st.firstFrame) usePlayer.setState({ firstFrame: true }); + usePlayer.setState({ buffering: false }); + break; + case 'end-file': + if (e.reason === 'error') { + usePlayer.setState({ error: e.error ? `Playback failed: ${e.error}` : 'This video could not be played.' }); + fallbackAfterError(); + } else if (e.reason === 'eof') onEnded(); + break; + case 'log': + if (e.level === 'error' && /http|stream|open/i.test(e.prefix + e.text) && !st.firstFrame) console.warn('[mpv]', e.prefix, e.text); + break; + } +} + +/** Direct play failed: retry once through Plex's converter. */ +let triedFallback = false; +function fallbackAfterError() { + const st = usePlayer.getState(); + if (triedFallback || !st.item || st.delivery?.mode !== 'direct') return; + triedFallback = true; + toast('Direct playback failed. Asking Plex to convert this video.'); + usePlayer.setState({ error: '' }); + st.play(st.item, { offsetMs: st.position * 1000 || startOffsetMs, mediaIndex: st.mediaIndex, quality: '1080' }); +} + +function maybeCredits(pos: number) { + const st = usePlayer.getState(); + if (st.item?.type !== 'episode' || !st.nextUp || st.countdown !== null) return; + const credits = st.item.markers.find((m) => m.type === 'credits' && (m.final || m.end >= st.item!.duration - 5000)); + if (credits && pos * 1000 >= credits.start && pos * 1000 < credits.end && useSettings.getState().skipCredits !== 'off') startCountdown(); +} + +function onEnded() { + const st = usePlayer.getState(); + if (st.ended) return; + usePlayer.setState({ ended: true }); + report('stopped'); + checkScrobble(); + if (st.nextUp) startCountdown(); +} + +export const usePlayer = create((set, get) => ({ + open: false, + item: null, + delivery: null, + mediaIndex: 0, + quality: 'original', + firstFrame: false, + error: '', + position: 0, + duration: 0, + cacheTime: 0, + paused: false, + buffering: false, + seeking: false, + volume: 100, + muted: false, + speed: 1, + subDelay: 0, + audioTracks: [], + subTracks: [], + audioKey: '', + subKey: '', + chapters: [], + video: null, + ended: false, + nextUp: null, + countdown: null, + postPlayDismissed: false, + fullscreen: false, + + async play(input, opts = {}) { + const token = ++loadToken; + const s = server(); + const prefs = useSettings.getState(); + stopThemeMusic(); + stopCountdown(); + if (!isNative) { + toast('Video playback is available in the Kaleido desktop app.', 'error'); + return; + } + const previous = get(); + if (previous.open && previous.item) { + report('stopped'); + if (previous.delivery?.session && s) stopTranscode(s, previous.delivery.session); + } + if (!previous.open) { + triedFallback = false; + wasFullscreenBeforePlay = await win.isFullscreen().catch(() => false); + } + set({ + open: true, + item: input, + firstFrame: false, + error: '', + position: (opts.offsetMs ?? 0) / 1000, + duration: input.duration / 1000, + cacheTime: 0, + paused: false, + buffering: true, + ended: false, + nextUp: null, + countdown: null, + postPlayDismissed: false, + chapters: [], + audioTracks: [], + subTracks: [], + audioKey: '', + subKey: '__init', + video: null, + fullscreen: wasFullscreenBeforePlay, + }); + document.documentElement.classList.add('player-open'); + + try { + // Full metadata: streams, markers and chapters. + let item = input; + if (!opts.localFile && s && (!input.media.length || !input.media[0].parts[0]?.streams.length || !input.raw?.Marker)) { + item = await api.metadata(s, input.id).catch(() => input); + } + if (token !== loadToken) return; + const mediaIndex = Math.min(opts.mediaIndex ?? 0, Math.max(0, item.media.length - 1)); + const media = item.media[mediaIndex]; + let offsetMs = opts.offsetMs ?? (opts.resume !== false && item.viewOffset && item.viewOffset < item.duration * 0.97 ? item.viewOffset : 0); + startOffsetMs = offsetMs; + const local = useSession.getState().connection?.local ?? true; + const quality: Quality = opts.quality ?? (local ? prefs.quality : prefs.remoteQuality); + session = crypto.randomUUID(); + scrobbled = false; + + let delivery: Delivery; + if (opts.localFile) { + delivery = { url: opts.localFile, mode: 'local', label: 'Downloaded', absoluteTime: false }; + } else if (!s || !media) { + throw new Error('This title has no playable media.'); + } else if (quality === 'original') { + delivery = { url: directUrl(s, media), mode: 'direct', label: 'Original', absoluteTime: false }; + } else { + const tsession = crypto.randomUUID(); + delivery = { + url: transcodeUrl(s, item, { mediaIndex, quality, offsetMs, session: tsession, local }), + mode: 'transcode', + session: tsession, + label: quality === '2160' ? '4K' : `${quality}p`, + absoluteTime: true, + }; + } + + const streams = media?.parts.flatMap((p) => p.streams) ?? []; + set({ + item, + delivery, + mediaIndex, + quality, + duration: (item.duration || media?.duration || 0) / 1000, + audioTracks: streams.filter((x) => x.streamType === 2).map(audioTrackFromStream), + subTracks: streams.filter((x) => x.streamType === 3).map(subTrackFromStream), + }); + + await mpv.init({ hwdec: prefs.hwdec, hdr: prefs.hdrPassthrough }); + if (!unlisten) unlisten = await mpv.on(onEvent); + if (token !== loadToken) return; + await mpv.set('mute', false); + await mpv.set('volume', prefs.volume); + await mpv.set('speed', 1); + await mpv.set('sub-scale', prefs.subtitleScale); + await mpv.set('sub-back-color', prefs.subtitleBackground ? '#C0000000' : '#00000000'); + await mpv.set('sub-border-style', prefs.subtitleBackground ? 'opaque-box' : 'outline-and-shadow'); + await mpv.set('force-media-title', item.type === 'episode' ? `${item.grandparentTitle} — ${item.title}` : item.title); + await mpv.show(true); + const fileOpts = [ + delivery.mode === 'transcode' ? 'rebase-start-time=no' : 'rebase-start-time=yes', + offsetMs > 0 && delivery.mode !== 'transcode' ? `start=${(offsetMs / 1000).toFixed(2)}` : 'start=none', + ].join(','); + await mpv.command('loadfile', delivery.url, 'replace', -1, fileOpts); + keepAwake(true); + report('buffering'); + reportTimer && clearInterval(reportTimer); + reportTimer = setInterval(() => { + const st = get(); + if (st.open && !st.ended) report(st.paused ? 'paused' : st.buffering ? 'buffering' : 'playing'); + }, 10000); + findNext(item).then((next) => token === loadToken && set({ nextUp: next })); + } catch (e: any) { + if (token !== loadToken) return; + set({ error: e?.message ?? String(e), buffering: false }); + } + }, + + async close() { + loadToken++; + const st = get(); + stopCountdown(); + if (reportTimer) clearInterval(reportTimer); + reportTimer = null; + if (st.item && !st.error) report('stopped'); + const s = server(); + if (st.delivery?.session && s) stopTranscode(s, st.delivery.session); + keepAwake(false); + if (isNative) { + await mpv.command('stop').catch(() => {}); + await mpv.show(false).catch(() => {}); + } + document.documentElement.classList.remove('player-open', 'video-active'); + set({ open: false, item: null, delivery: null, error: '', countdown: null, nextUp: null, firstFrame: false }); + const fs = await win.isFullscreen().catch(() => false); + if (fs && !wasFullscreenBeforePlay) win.setFullscreen(false); + if (st.item) invalidateLibrary(); + }, + + togglePause() { + const st = get(); + if (st.ended) { + st.seek(0); + set({ ended: false }); + } + mpv.command('cycle', 'pause').catch(() => {}); + }, + + seek(seconds) { + const st = get(); + const target = Math.max(0, Math.min(seconds, (st.duration || seconds) - 0.5)); + set({ position: target, ended: false }); + if (st.countdown !== null) { + stopCountdown(); + set({ countdown: null }); + } + mpv.command('seek', target.toFixed(3), 'absolute+exact').catch(() => {}); + }, + + seekBy(delta) { + const st = get(); + st.seek(st.position + delta); + }, + + setVolume(v) { + const volume = Math.max(0, Math.min(150, Math.round(v))); + set({ volume }); + useSettings.getState().set('volume', Math.min(100, volume)); + mpv.set('volume', volume).catch(() => {}); + if (get().muted && volume > 0) mpv.set('mute', false).catch(() => {}); + }, + + toggleMute() { + mpv.command('cycle', 'mute').catch(() => {}); + }, + + setSpeed(speed) { + mpv.set('speed', speed).catch(() => {}); + }, + + setSubDelay(delay) { + mpv.set('sub-delay', delay).catch(() => {}); + }, + + async selectAudio(key) { + const st = get(); + const t = st.audioTracks.find((x) => x.key === key); + if (!t) return; + set({ audioKey: key }); + const s = server(); + const part = st.item?.media[st.mediaIndex]?.parts[0]; + if (s && part && t.stream) api.selectStreams(s, part.id, { audioStreamID: t.stream.id }).catch(() => {}); + if (st.delivery?.mode === 'transcode' && st.item) { + await st.play(st.item, { offsetMs: st.position * 1000, mediaIndex: st.mediaIndex, quality: st.quality }); + return; + } + if (t.mpvId) await mpv.set('aid', t.mpvId).catch(() => {}); + }, + + async selectSubtitle(key) { + const st = get(); + set({ subKey: key }); + const s = server(); + const part = st.item?.media[st.mediaIndex]?.parts[0]; + const t = st.subTracks.find((x) => x.key === key); + if (s && part) api.selectStreams(s, part.id, { subtitleStreamID: t?.stream?.id ?? '0' }).catch(() => {}); + if (st.delivery?.mode === 'transcode' && st.item) { + await st.play(st.item, { offsetMs: st.position * 1000, mediaIndex: st.mediaIndex, quality: st.quality }); + usePlayer.setState({ subKey: key }); + return; + } + await setMpvSubtitle(key); + }, + + async setQuality(q) { + const st = get(); + if (!st.item || q === st.quality) return; + await st.play(st.item, { offsetMs: st.position * 1000, mediaIndex: st.mediaIndex, quality: q }); + }, + + async selectVersion(index) { + const st = get(); + if (!st.item || index === st.mediaIndex) return; + await st.play(st.item, { offsetMs: st.position * 1000, mediaIndex: index, quality: st.quality }); + }, + + async playNext() { + const st = get(); + stopCountdown(); + if (!st.nextUp) return; + await st.play(st.nextUp, { resume: true, quality: st.quality }); + }, + + cancelCountdown() { + stopCountdown(); + set({ countdown: null, postPlayDismissed: true }); + }, + + async toggleFullscreen() { + const fs = await win.isFullscreen().catch(() => false); + await win.setFullscreen(!fs); + set({ fullscreen: !fs }); + }, + + previewAt(seconds) { + const st = get(); + const s = server(); + if (!s || !st.item || st.delivery?.mode === 'local') return ''; + return previewUrl(s, st.item.media[st.mediaIndex], seconds * 1000); + }, +})); + +/** Shown once the first frame is ready, the page turns transparent over the video. */ +usePlayer.subscribe((st, prev) => { + if (st.firstFrame !== prev.firstFrame || st.open !== prev.open || st.error !== prev.error) { + document.documentElement.classList.toggle('video-active', st.open && st.firstFrame && !st.error); + } +}); diff --git a/src/player/theme.ts b/src/player/theme.ts new file mode 100644 index 0000000..348f9ed --- /dev/null +++ b/src/player/theme.ts @@ -0,0 +1,52 @@ +/** Optional title theme music on detail pages, faded in and out. */ +import { useSession } from '../app/session'; +import { useSettings } from '../app/settings'; + +let audio: HTMLAudioElement | null = null; +let current = ''; +let fade: ReturnType | null = null; + +function fadeTo(target: number, done?: () => void) { + if (!audio) return; + if (fade) clearInterval(fade); + const a = audio; + fade = setInterval(() => { + const step = 0.02; + if (Math.abs(a.volume - target) <= step) { + a.volume = target; + clearInterval(fade!); + fade = null; + done?.(); + } else a.volume += a.volume < target ? step : -step; + }, 40); +} + +export function playThemeMusic(path: string) { + const prefs = useSettings.getState(); + const server = useSession.getState().server; + if (!prefs.themeMusic || !path || !server || document.documentElement.classList.contains('player-open')) return; + if (path === current && audio && !audio.paused) return; + stopThemeMusic(true); + current = path; + audio = new Audio(server.signed(path)); + audio.volume = 0; + audio.loop = false; + audio.play().then(() => fadeTo(prefs.themeVolume / 100), () => {}); +} + +export function stopThemeMusic(immediate = false) { + current = ''; + if (!audio) return; + const a = audio; + audio = null; + if (immediate) { + a.pause(); + return; + } + const prev = audio; + audio = a; + fadeTo(0, () => { + a.pause(); + if (audio === a) audio = prev; + }); +} diff --git a/src/plex/account.ts b/src/plex/account.ts new file mode 100644 index 0000000..7244a7b --- /dev/null +++ b/src/plex/account.ts @@ -0,0 +1,182 @@ +import { arr, bool, num, str } from './parse'; +import { clientIdentifier, PlexError, plexRequest, PRODUCT } from './client'; +import type { HomeUser, PlexUser, ServerConnection, ServerResource } from './types'; + +const TV = 'https://plex.tv/api/v2'; + +export interface Pin { + id: number; + code: string; +} + +export async function createPin(strong: boolean): Promise { + const j = await plexRequest(`${TV}/pins`, null, { method: 'POST', params: { strong } }); + return { id: num(j.id), code: str(j.code) }; +} + +export async function checkPin(pin: Pin): Promise { + const j = await plexRequest(`${TV}/pins/${pin.id}`, null); + const token = str(j.authToken); + return token && token !== 'null' ? token : null; +} + +/** The browser sign-in page for a strong PIN. */ +export function authUrl(pin: Pin): string { + const params = new URLSearchParams({ + clientID: clientIdentifier(), + code: pin.code, + 'context[device][product]': PRODUCT, + 'context[device][platform]': 'Windows', + 'context[device][device]': 'Windows', + }); + return `https://app.plex.tv/auth#?${params.toString()}`; +} + +export async function getUser(token: string): Promise { + const j = await plexRequest(`${TV}/user`, token); + return { + id: num(j.id), + uuid: str(j.uuid), + username: str(j.username), + title: str(j.title || j.friendlyName || j.username), + email: str(j.email), + thumb: str(j.thumb), + home: bool(j.home), + homeAdmin: bool(j.homeAdmin), + protected: bool(j.protected), + subscription: bool(j.subscription?.active), + }; +} + +export async function signOut(token: string) { + await plexRequest(`${TV}/users/signout`, token, { method: 'DELETE' }).catch(() => {}); +} + +export async function getResources(token: string): Promise { + const list = await plexRequest(`${TV}/resources`, token, { + params: { includeHttps: 1, includeRelay: 1, includeIPv6: 1 }, + }); + return arr(list) + .filter((r) => str(r.provides).split(',').includes('server')) + .map((r) => ({ + id: str(r.clientIdentifier), + name: str(r.name), + owned: bool(r.owned), + accessToken: str(r.accessToken) || token, + productVersion: str(r.productVersion), + platform: str(r.platform), + presence: bool(r.presence), + publicAddress: str(r.publicAddress), + sourceTitle: str(r.sourceTitle), + httpsRequired: bool(r.httpsRequired), + connections: arr(r.connections).map( + (c): ServerConnection => ({ + uri: str(c.uri), + local: bool(c.local), + relay: bool(c.relay), + protocol: str(c.protocol), + address: str(c.address), + port: num(c.port), + IPv6: bool(c.IPv6), + }), + ), + })); +} + +export async function getHomeUsers(token: string): Promise { + const j = await plexRequest(`${TV}/home/users`, token); + return arr(j.users ?? j).map((u: any) => ({ + id: num(u.id), + uuid: str(u.uuid), + title: str(u.title || u.username), + username: str(u.username), + thumb: str(u.thumb), + admin: bool(u.admin), + protected: bool(u.protected), + restricted: bool(u.restricted), + guest: bool(u.guest), + })); +} + +/** Switches to a Plex Home user; returns that user's account token. */ +export async function switchHomeUser(token: string, uuid: string, pin?: string): Promise { + const j = await plexRequest(`${TV}/home/users/${uuid}/switch`, token, { method: 'POST', params: { pin } }); + const t = str(j.authToken); + if (!t) throw new PlexError('Plex did not accept this profile PIN.', 401); + return t; +} + +/** Whether a server address is on this network: plex.direct names encode the server's IP. */ +export function isLocalAddress(url: string): boolean { + let host = ''; + try { + host = new URL(url).hostname.toLowerCase().replace(/^\[|\]$/g, ''); + } catch { + return false; + } + const ip = host.endsWith('.plex.direct') ? host.split('.')[0].replace(/-/g, '.') : host; + if (host === 'localhost' || host.endsWith('.local') || (!host.includes('.') && !host.includes(':'))) return true; + if (ip.startsWith('fd') || ip.startsWith('fe80')) return true; + const o = ip.split('.').map(Number); + if (o.length !== 4 || o.some((n) => !Number.isInteger(n) || n < 0 || n > 255)) return false; + const [a, b] = o; + return a === 10 || a === 127 || (a === 192 && b === 168) || (a === 172 && b >= 16 && b <= 31) || (a === 169 && b === 254) || (a === 100 && b >= 64 && b <= 127); +} + +export interface Reachable { + uri: string; + machineId: string; + name: string; + local: boolean; + relay: boolean; + latency: number; +} + +async function probe(uri: string, token: string, timeout: number): Promise { + const start = performance.now(); + const j = await plexRequest(`${uri.replace(/\/$/, '')}/identity`, token, { timeout }); + const machineId = str(j?.MediaContainer?.machineIdentifier); + if (!machineId) throw new PlexError('Not a Plex Media Server'); + return { uri, machineId, name: '', local: isLocalAddress(uri), relay: false, latency: performance.now() - start }; +} + +/** + * Finds the best reachable connection. Local direct connections win, then + * remote direct, then Plex Relay. Each tier is probed concurrently. + */ +export async function connect(resource: ServerResource, preferred?: string): Promise { + const conns = resource.connections.filter((c) => c.uri.startsWith('http')); + const tiers: ServerConnection[][] = []; + if (preferred) { + const p = conns.find((c) => c.uri === preferred); + if (p) tiers.push([p]); + } + tiers.push( + conns.filter((c) => c.local && !c.relay), + conns.filter((c) => !c.local && !c.relay), + conns.filter((c) => c.relay), + ); + for (const tier of tiers) { + if (!tier.length) continue; + try { + const winner = await Promise.any( + tier.map((c) => + probe(c.uri, resource.accessToken, c.relay ? 12000 : 6000).then((r) => ({ ...r, local: c.local, relay: c.relay, name: resource.name })), + ), + ); + return winner; + } catch { + /* next tier */ + } + } + throw new PlexError(`Cannot reach ${resource.name}. Check that the server is online and reachable from this computer.`); +} + +/** Validates a manual server address with a token. */ +export async function connectManual(uri: string, token: string): Promise { + const base = uri.replace(/\/$/, ''); + const j = await plexRequest(`${base}/`, token, { timeout: 8000 }); + const mc = j?.MediaContainer; + if (!mc?.machineIdentifier) throw new PlexError('This address is not a Plex Media Server.'); + return { uri: base, machineId: str(mc.machineIdentifier), name: str(mc.friendlyName) || 'Plex', local: isLocalAddress(base), relay: false, latency: 0 }; +} diff --git a/src/plex/admin.ts b/src/plex/admin.ts new file mode 100644 index 0000000..149a456 --- /dev/null +++ b/src/plex/admin.ts @@ -0,0 +1,361 @@ +/** Plex Media Server administration (owner accounts). */ +import type { PlexServer } from './client'; +import { arr, bool, num, parseItem, parseSection, str } from './parse'; +import type { Item, Section } from './types'; + +export interface ServerSetting { + id: string; + label: string; + summary: string; + type: 'text' | 'bool' | 'int' | 'double' | string; + default: unknown; + value: unknown; + hidden: boolean; + advanced: boolean; + group: string; + options: { value: string; label: string }[] | null; +} + +export async function prefs(s: PlexServer): Promise { + const mc = await s.container('/:/prefs'); + return arr(mc.Setting).map((x: any) => ({ + id: str(x.id), + label: str(x.label) || str(x.id), + summary: str(x.summary), + type: str(x.type), + default: x.default, + value: x.value, + hidden: bool(x.hidden), + advanced: bool(x.advanced), + group: str(x.group), + options: x.enumValues + ? str(x.enumValues) + .split('|') + .map((pair) => { + const i = pair.indexOf(':'); + return i < 0 ? { value: pair, label: pair } : { value: pair.slice(0, i), label: pair.slice(i + 1) }; + }) + : null, + })); +} + +export async function setPrefs(s: PlexServer, values: Record) { + const params: Record = {}; + for (const [k, v] of Object.entries(values)) params[k] = typeof v === 'boolean' ? (v ? 'true' : 'false') : String(v); + await s.send('PUT', '/:/prefs', params); +} + +export interface Session { + sessionKey: string; + sessionId: string; + item: Item; + user: { title: string; thumb: string }; + player: { title: string; product: string; platform: string; device: string; state: string; local: boolean; address: string; secure: boolean }; + bandwidth: number; + location: string; + decision: { video: string; audio: string; container: string; transcodeHw: boolean; progress: number; speed: number; throttled: boolean; videoCodec: string; audioCodec: string; reason: string } | null; + viewOffset: number; +} + +export async function sessions(s: PlexServer): Promise { + const mc = await s.container('/status/sessions'); + return arr(mc.Metadata).map((m: any) => { + const t = m.TranscodeSession; + const sess = m.Session ?? {}; + return { + sessionKey: str(m.sessionKey), + sessionId: str(sess.id), + item: parseItem(m), + user: { title: str(m.User?.title), thumb: str(m.User?.thumb) }, + player: { + title: str(m.Player?.title), + product: str(m.Player?.product), + platform: str(m.Player?.platform), + device: str(m.Player?.device), + state: str(m.Player?.state), + local: bool(m.Player?.local), + address: str(m.Player?.address), + secure: bool(m.Player?.secure), + }, + bandwidth: num(sess.bandwidth), + location: str(sess.location), + viewOffset: num(m.viewOffset), + decision: t + ? { + video: str(t.videoDecision), + audio: str(t.audioDecision), + container: str(t.container), + transcodeHw: bool(t.transcodeHwRequested) || bool(t.transcodeHwFullPipeline), + progress: num(t.progress), + speed: num(t.speed), + throttled: bool(t.throttled), + videoCodec: str(t.videoCodec), + audioCodec: str(t.audioCodec), + reason: str(t.transcodeReason ?? ''), + } + : null, + }; + }); +} + +export const terminateSession = (s: PlexServer, sessionId: string, reason: string) => s.get('/status/sessions/terminate', { sessionId, reason }); + +export interface HistoryEntry { + id: string; + title: string; + subtitle: string; + thumb: string; + viewedAt: number; + accountId: number; + deviceId: number; + type: string; +} + +export async function history(s: PlexServer, size = 30): Promise { + const mc = await s.container('/status/sessions/history/all', { sort: 'viewedAt:desc', 'X-Plex-Container-Size': size, 'X-Plex-Container-Start': 0 }); + return arr(mc.Metadata).map((m: any) => ({ + id: str(m.historyKey ?? m.ratingKey), + title: str(m.grandparentTitle || m.title), + subtitle: m.type === 'episode' ? `S${num(m.parentIndex)} · E${num(m.index)} ${str(m.title)}` : str(m.year ?? ''), + thumb: str(m.grandparentThumb || m.thumb), + viewedAt: num(m.viewedAt), + accountId: num(m.accountID), + deviceId: num(m.deviceID), + type: str(m.type), + })); +} + +export async function accounts(s: PlexServer): Promise> { + const mc = await s.container('/accounts'); + return Object.fromEntries(arr(mc.Account).map((a: any) => [num(a.id), str(a.name) || 'Owner'])); +} + +export interface Device { + id: number; + name: string; + platform: string; + clientIdentifier: string; + createdAt: number; +} + +export async function devices(s: PlexServer): Promise { + const mc = await s.container('/devices'); + return arr(mc.Device).map((d: any) => ({ id: num(d.id), name: str(d.name), platform: str(d.platform), clientIdentifier: str(d.clientIdentifier), createdAt: num(d.createdAt) })); +} + +export const removeDevice = (s: PlexServer, id: number) => s.send('DELETE', `/devices/${id}`); + +export interface BandwidthPoint { + at: number; + lan: number; + wan: number; +} + +/** Bandwidth samples grouped by time (bytes per sample interval). */ +export async function bandwidth(s: PlexServer, timespan = 6): Promise<{ points: BandwidthPoint[]; devices: Record }> { + const mc = await s.container('/statistics/bandwidth', { timespan }); + const byAt = new Map(); + for (const b of arr(mc.StatisticsBandwidth)) { + const at = num(b.at); + const p = byAt.get(at) ?? { at, lan: 0, wan: 0 }; + if (bool(b.lan)) p.lan += num(b.bytes); + else p.wan += num(b.bytes); + byAt.set(at, p); + } + return { + points: [...byAt.values()].sort((a, b) => a.at - b.at), + devices: Object.fromEntries(arr(mc.Device).map((d: any) => [num(d.id), str(d.name)])), + }; +} + +export interface ResourcePoint { + at: number; + hostCpu: number; + processCpu: number; + hostMemory: number; + processMemory: number; +} + +export async function resources(s: PlexServer, timespan = 6): Promise { + const mc = await s.container('/statistics/resources', { timespan }); + return arr(mc.StatisticsResources) + .map((r: any) => ({ + at: num(r.at), + hostCpu: num(r.hostCpuUtilization), + processCpu: num(r.processCpuUtilization), + hostMemory: num(r.hostMemoryUtilization), + processMemory: num(r.processMemoryUtilization), + })) + .sort((a, b) => a.at - b.at); +} + +export interface Activity { + uuid: string; + type: string; + title: string; + subtitle: string; + progress: number; + cancellable: boolean; +} + +export async function activities(s: PlexServer): Promise { + const mc = await s.container('/activities'); + return arr(mc.Activity).map((a: any) => ({ + uuid: str(a.uuid), + type: str(a.type), + title: str(a.title), + subtitle: str(a.subtitle), + progress: num(a.progress), + cancellable: bool(a.cancellable), + })); +} + +export const cancelActivity = (s: PlexServer, uuid: string) => s.send('DELETE', `/activities/${uuid}`); + +export interface ButlerTask { + name: string; + title: string; + description: string; + interval: number; + enabled: boolean; +} + +export async function butlerTasks(s: PlexServer): Promise { + const j = await s.get('/butler'); + return arr(j?.ButlerTasks?.ButlerTask).map((t: any) => ({ + name: str(t.name), + title: str(t.title) || str(t.name).replace(/^ButlerTask/, '').replace(/([a-z])([A-Z])/g, '$1 $2'), + description: str(t.description), + interval: num(t.interval), + enabled: bool(t.enabled), + })); +} + +export const runButlerTask = (s: PlexServer, name: string) => s.send('POST', `/butler/${name}`); +export const stopButlerTasks = (s: PlexServer) => s.send('DELETE', '/butler'); + +export interface RemoteAccess { + mappingState: string; + mappingError: string; + signInState: string; + publicAddress: string; + publicPort: number; + privateAddress: string; + privatePort: number; + reachabilityPending: boolean; +} + +export async function remoteAccess(s: PlexServer): Promise { + const j = await s.get('/myplex/account'); + const m = j?.MyPlex ?? {}; + return { + mappingState: str(m.mappingState), + mappingError: str(m.mappingError), + signInState: str(m.signInState), + publicAddress: str(m.publicAddress), + publicPort: num(m.publicPort), + privateAddress: str(m.privateAddress), + privatePort: num(m.privatePort), + reachabilityPending: bool(m.reachabilityPending), + }; +} + +export const refreshReachability = (s: PlexServer) => s.send('PUT', '/myplex/refreshReachability'); + +// —— Libraries —————————————————————————————————————————————————————— + +export const scanLibrary = (s: PlexServer, id: string, force = false) => s.get(`/library/sections/${id}/refresh`, force ? { force: 1 } : undefined); +export const cancelScan = (s: PlexServer, id: string) => s.send('DELETE', `/library/sections/${id}/refresh`); +export const emptyTrash = (s: PlexServer, id: string) => s.send('PUT', `/library/sections/${id}/emptyTrash`); +export const analyzeLibrary = (s: PlexServer, id: string) => s.send('PUT', `/library/sections/${id}/analyze`); +export const deleteLibrary = (s: PlexServer, id: string) => s.send('DELETE', `/library/sections/${id}`); +export const cleanBundles = (s: PlexServer) => s.send('PUT', '/library/clean/bundles'); +export const optimizeDatabase = (s: PlexServer) => s.send('PUT', '/library/optimize', { async: 1 }); +export const scanAll = (s: PlexServer) => s.get('/library/sections/all/refresh'); + +export async function librarySize(s: PlexServer, sec: Section): Promise { + const mc = await s.container(`/library/sections/${sec.id}/all`, { 'X-Plex-Container-Size': 0, type: sec.type === 'show' ? 2 : sec.type === 'artist' ? 8 : undefined }); + return num(mc.totalSize ?? mc.size); +} + +export interface Agent { + identifier: string; + name: string; +} + +export async function agents(s: PlexServer, mediaType: number): Promise { + const mc = await s.container('/system/agents', { mediaType }); + return arr(mc.Agent).map((a: any) => ({ identifier: str(a.identifier), name: str(a.name ?? a.title) })); +} + +export async function scanners(s: PlexServer, type: number): Promise { + const mc = await s.container(`/system/scanners/${type}`); + return arr(mc.Scanner).map((x: any) => str(x.name)); +} + +export interface BrowseEntry { + key: string; + path: string; + title: string; +} + +/** The server's file system, for choosing library folders. */ +export async function browse(s: PlexServer, key?: string): Promise { + const mc = await s.container(key ?? '/services/browse', { includeFiles: 0 }); + return arr(mc.Path).map((p: any) => ({ key: str(p.key), path: str(p.path), title: str(p.title) })); +} + +export async function createLibrary(s: PlexServer, opts: { name: string; type: 'movie' | 'show'; agent: string; scanner: string; language: string; locations: string[] }) { + const u = new URL(s.url('/library/sections')); + u.searchParams.set('name', opts.name); + u.searchParams.set('type', opts.type); + u.searchParams.set('agent', opts.agent); + u.searchParams.set('scanner', opts.scanner); + u.searchParams.set('language', opts.language); + for (const l of opts.locations) u.searchParams.append('location', l); + await s.send('POST', u.toString()); +} + +export async function updateLibrary(s: PlexServer, sec: Section, opts: { name: string; locations: string[] }) { + const u = new URL(s.url(`/library/sections/${sec.id}`)); + u.searchParams.set('name', opts.name); + u.searchParams.set('agent', sec.agent); + u.searchParams.set('language', sec.language); + for (const l of opts.locations) u.searchParams.append('location', l); + await s.send('PUT', u.toString()); +} + +export async function sectionDetail(s: PlexServer, id: string): Promise
{ + const mc = await s.container('/library/sections'); + const d = arr(mc.Directory).find((x: any) => str(x.key) === id); + return parseSection(d ?? {}); +} + +// —— Updates & diagnostics ———————————————————————————————————————————— + +export interface UpdateStatus { + canInstall: boolean; + checkedAt: number; + status: number; + version: string; + added: string; + fixed: string; + state: string; +} + +export async function updateStatus(s: PlexServer): Promise { + const mc = await s.container('/updater/status'); + const r = arr(mc.Release)[0]; + return { + canInstall: bool(mc.canInstall), + checkedAt: num(mc.checkedAt), + status: num(mc.status), + version: str(r?.version), + added: str(r?.added), + fixed: str(r?.fixed), + state: str(r?.state), + }; +} + +export const checkForUpdates = (s: PlexServer) => s.send('PUT', '/updater/check', { download: 1 }); +export const applyUpdate = (s: PlexServer) => s.send('PUT', '/updater/apply'); diff --git a/src/plex/api.ts b/src/plex/api.ts new file mode 100644 index 0000000..4eb9f54 --- /dev/null +++ b/src/plex/api.ts @@ -0,0 +1,348 @@ +/** Library browsing and title operations against one server. */ +import type { PlexServer, Params } from './client'; +import { arr, num, parseHub, parseItem, parseSection, str } from './parse'; +import type { FilterOption, Hub, Item, Page, Section } from './types'; + +const items = (mc: any) => arr(mc.Metadata).map(parseItem); + +export async function sections(s: PlexServer): Promise { + const mc = await s.container('/library/sections'); + return arr(mc.Directory).map(parseSection); +} + +export async function serverInfo(s: PlexServer) { + return s.container('/'); +} + +const VIDEO_TYPES = new Set(['movie', 'show', 'season', 'episode', 'collection', 'clip']); + +export async function homeHubs(s: PlexServer): Promise { + const mc = await s.container('/hubs', { count: 20, includeExternalMetadata: 1, includeLibraryPlaylists: 0 }); + return arr(mc.Hub) + .map(parseHub) + .filter((h) => h.items.length && VIDEO_TYPES.has(h.items[0].type)); +} + +export async function sectionHubs(s: PlexServer, sectionId: string): Promise { + const mc = await s.container(`/hubs/sections/${sectionId}`, { count: 20, includeExternalMetadata: 1 }); + return arr(mc.Hub) + .map(parseHub) + .filter((h) => h.items.length && VIDEO_TYPES.has(h.items[0].type)); +} + +/** Continue Watching across libraries (Plex's own hub honors removals). */ +export async function continueWatching(s: PlexServer, sectionId?: string): Promise { + const path = sectionId ? `/hubs/sections/${sectionId}/continueWatching/items` : '/hubs/continueWatching/items'; + try { + const mc = await s.container(path, { 'X-Plex-Container-Size': 40, includeExternalMetadata: 1 }); + return items(mc); + } catch { + const mc = await s.container('/library/onDeck', { 'X-Plex-Container-Size': 40 }); + return items(mc).filter((i) => !sectionId || i.librarySectionId === sectionId); + } +} + +export async function hubItems(s: PlexServer, key: string, start = 0, size = 60): Promise> { + const mc = await s.container(key, { 'X-Plex-Container-Start': start, 'X-Plex-Container-Size': size, includeExternalMetadata: 1 }); + const list = items(mc).length ? items(mc) : arr(mc.Hub).flatMap((h: any) => arr(h.Metadata).map(parseItem)); + return { items: list, total: num(mc.totalSize ?? mc.size), offset: start }; +} + +/** Metadata types used by library queries. */ +export const TYPE_ID: Record = { movie: 1, show: 2, season: 3, episode: 4, collection: 18 }; + +export async function libraryPage( + s: PlexServer, + sectionId: string, + opts: { type?: number; sort?: string; filters?: Record; title?: string; start: number; size: number }, +): Promise> { + const params: Params = { + 'X-Plex-Container-Start': opts.start, + 'X-Plex-Container-Size': opts.size, + type: opts.type, + sort: opts.sort, + includeGuids: 0, + ...opts.filters, + }; + if (opts.title) params['title'] = opts.title; + const mc = await s.container(`/library/sections/${sectionId}/all`, params); + return { items: items(mc), total: num(mc.totalSize ?? mc.size), offset: opts.start }; +} + +export interface LibraryMeta { + filters: { filter: string; type: string; title: string; key: string }[]; + sorts: { key: string; title: string; defaultDirection: string }[]; +} + +export async function libraryMeta(s: PlexServer, sectionId: string, type: number): Promise { + const mc = await s.container(`/library/sections/${sectionId}/all`, { includeMeta: 1, 'X-Plex-Container-Size': 0, type }); + const name = Object.entries(TYPE_ID).find(([, v]) => v === type)?.[0]; + const t = arr(mc.Meta?.Type).find((x: any) => x.type === name) ?? arr(mc.Meta?.Type)[0]; + return { + filters: arr(t?.Filter).map((f: any) => ({ filter: str(f.filter), type: str(f.filterType), title: str(f.title), key: str(f.key) })), + sorts: arr(t?.Sort).map((x: any) => ({ key: str(x.key), title: str(x.title), defaultDirection: str(x.defaultDirection) || 'asc' })), + }; +} + +export async function filterOptions(s: PlexServer, path: string, type?: number): Promise { + const mc = await s.container(path, { type }); + return arr(mc.Directory).map((d: any) => ({ key: str(d.key), title: str(d.title) })); +} + +export async function firstCharacters(s: PlexServer, sectionId: string, params: Params): Promise<{ key: string; title: string; size: number }[]> { + const mc = await s.container(`/library/sections/${sectionId}/firstCharacter`, params); + return arr(mc.Directory).map((d: any) => ({ key: str(d.key), title: str(d.title), size: num(d.size) })); +} + +export async function collections(s: PlexServer, sectionId: string): Promise { + const mc = await s.container(`/library/sections/${sectionId}/collections`, { includeCollections: 1, sort: 'titleSort:asc' }); + return items(mc); +} + +export async function metadata(s: PlexServer, id: string): Promise { + const mc = await s.container(`/library/metadata/${id}`, { + includeMarkers: 1, + includeChapters: 1, + includeExtras: 1, + includeConcerts: 1, + includeOnDeck: 1, + includeReviews: 0, + includePreferences: 1, + includeExternalMedia: 0, + checkFiles: 1, + asyncAugmentMetadata: 0, + }); + const first = arr(mc.Metadata)[0]; + if (!first) throw new Error('This title is unavailable.'); + const item = parseItem(first); + item.raw.__librarySectionID = mc.librarySectionID; + if (!item.librarySectionId) item.librarySectionId = str(mc.librarySectionID); + return item; +} + +export async function children(s: PlexServer, id: string): Promise { + const mc = await s.container(`/library/metadata/${id}/children`, { includeMarkers: 0, excludeAllLeaves: 1 }); + return items(mc); +} + +export async function allLeaves(s: PlexServer, id: string): Promise { + const mc = await s.container(`/library/metadata/${id}/allLeaves`); + return items(mc); +} + +/** The show's next episode (Plex's OnDeck), if any. */ +export async function onDeckFor(_s: PlexServer, item: Item): Promise { + const od = arr(item.raw?.OnDeck?.Metadata)[0]; + if (od) return parseItem(od); + return null; +} + +export async function related(s: PlexServer, id: string): Promise { + const mc = await s.container(`/library/metadata/${id}/related`, { includeExternalMetadata: 1, count: 20 }); + return arr(mc.Hub).map(parseHub).filter((h) => h.items.length); +} + +export async function collectionItems(s: PlexServer, id: string): Promise { + const mc = await s.container(`/library/collections/${id}/children`); + return items(mc); +} + +/** Titles featuring a person, across the server's movie and TV libraries. */ +export async function personTitles(s: PlexServer, personId: string, libs: Section[]): Promise { + const video = libs.filter((l) => l.type === 'movie' || l.type === 'show'); + const results = await Promise.all( + video.map(async (l) => { + const out: Item[] = []; + let start = 0; + for (let guard = 0; guard < 10; guard++) { + const mc = await s.container(`/library/sections/${l.id}/all`, { + actor: personId, + sort: 'originallyAvailableAt:desc', + 'X-Plex-Container-Start': start, + 'X-Plex-Container-Size': 100, + }); + const batch = items(mc); + out.push(...batch); + start += batch.length; + if (!batch.length || start >= num(mc.totalSize ?? mc.size)) break; + } + // Directors and writers too, when the person has no acting credits here. + if (!out.length) { + for (const tag of ['director', 'writer']) { + const mc = await s.container(`/library/sections/${l.id}/all`, { [tag]: personId, sort: 'originallyAvailableAt:desc' }); + out.push(...items(mc)); + } + } + return out; + }), + ); + const seen = new Set(); + return results.flat().filter((i) => (seen.has(i.id) ? false : (seen.add(i.id), true))); +} + +export async function person(s: PlexServer, id: string): Promise { + try { + const mc = await s.container(`/library/people/${id}`); + return arr(mc.Directory)[0] ?? arr(mc.Metadata)[0] ?? null; + } catch { + return null; + } +} + +export interface SearchResult { + hubs: Hub[]; + people: { id: string; tag: string; thumb: string }[]; +} + +export async function search(s: PlexServer, query: string, sectionId?: string): Promise { + const mc = await s.container('/hubs/search', { query, limit: 30, includeCollections: 1, sectionId, includeExternalMedia: 0 }); + const hubs = arr(mc.Hub); + const people = hubs + .filter((h: any) => h.type === 'actor' || h.type === 'director') + .flatMap((h: any) => arr(h.Directory ?? h.Metadata)) + .map((p: any) => ({ id: str(p.id ?? p.ratingKey), tag: str(p.tag ?? p.title), thumb: str(p.thumb) })) + .filter((p: any) => p.id && p.tag); + const seenPeople = new Set(); + return { + hubs: hubs + .map(parseHub) + .filter((h) => h.items.length && VIDEO_TYPES.has(h.items[0].type)), + people: people.filter((p) => (seenPeople.has(p.id) ? false : (seenPeople.add(p.id), true))), + }; +} + +// —— Watch state ———————————————————————————————————————————————— + +export async function setWatched(s: PlexServer, id: string, watched: boolean) { + await s.get(watched ? '/:/scrobble' : '/:/unscrobble', { key: id, identifier: 'com.plexapp.plugins.library' }); +} + +export async function removeFromContinueWatching(s: PlexServer, id: string) { + await s.send('PUT', '/actions/removeFromContinueWatching', { ratingKey: id }); +} + +export async function rate(s: PlexServer, id: string, rating: number) { + await s.send('PUT', '/:/rate', { key: id, identifier: 'com.plexapp.plugins.library', rating: rating < 0 ? -1 : rating }); +} + +export async function selectStreams(s: PlexServer, partId: string, sel: { audioStreamID?: string; subtitleStreamID?: string }) { + await s.send('PUT', `/library/parts/${partId}`, { allParts: 1, ...sel }); +} + +// —— Library management —————————————————————————————————————————— + +export const refreshMetadata = (s: PlexServer, id: string, force = true) => s.send('PUT', `/library/metadata/${id}/refresh`, { force: force ? 1 : 0 }); +export const analyze = (s: PlexServer, id: string) => s.send('PUT', `/library/metadata/${id}/analyze`); +export const unmatch = (s: PlexServer, id: string) => s.send('PUT', `/library/metadata/${id}/unmatch`); +export const splitApart = (s: PlexServer, id: string) => s.send('PUT', `/library/metadata/${id}/split`); +export const merge = (s: PlexServer, id: string, others: string[]) => s.send('PUT', `/library/metadata/${id}/merge`, { ids: others.join(',') }); +export const deleteItem = (s: PlexServer, id: string) => s.send('DELETE', `/library/metadata/${id}`); +export const deleteMedia = (s: PlexServer, id: string, mediaId: string) => s.send('DELETE', `/library/metadata/${id}/media/${mediaId}`); + +export interface MatchCandidate { + guid: string; + name: string; + year: number; + score: number; + thumb: string; + summary: string; + matched: boolean; +} + +export async function matches(s: PlexServer, id: string, opts: { title?: string; year?: string; agent?: string; language?: string }): Promise { + const mc = await s.container(`/library/metadata/${id}/matches`, { + manual: 1, + title: opts.title, + year: opts.year, + agent: opts.agent, + language: opts.language, + }); + return arr(mc.SearchResult).map((r: any) => ({ + guid: str(r.guid), + name: str(r.name), + year: num(r.year), + score: num(r.score), + thumb: str(r.thumb), + summary: str(r.summary), + matched: r.matched === 1 || r.matched === true || r.matched === '1', + })); +} + +export const applyMatch = (s: PlexServer, id: string, guid: string, name: string, year?: number) => + s.send('PUT', `/library/metadata/${id}/match`, { guid, name, year }); + +export async function artworkOptions(s: PlexServer, id: string, kind: 'posters' | 'arts' | 'clearLogos'): Promise<{ key: string; thumb: string; selected: boolean; provider: string }[]> { + const mc = await s.container(`/library/metadata/${id}/${kind}`); + return arr(mc.Metadata).map((m: any) => ({ key: str(m.key), thumb: str(m.thumb || m.key), selected: m.selected === true || m.selected === 1, provider: str(m.provider) })); +} + +export const selectArtwork = (s: PlexServer, id: string, kind: 'poster' | 'art' | 'clearLogo', url: string) => + s.send('PUT', `/library/metadata/${id}/${kind}`, { url }); + +export async function uploadArtwork(s: PlexServer, id: string, kind: 'posters' | 'arts' | 'clearLogos', data: Blob) { + await s.send('POST', `/library/metadata/${id}/${kind}`, undefined, { body: data }); +} + +/** + * Edits metadata through the section `all` endpoint, as Plex Web does. Field + * values are locked so later refreshes keep them. + */ +export async function editMetadata( + s: PlexServer, + item: Item, + fields: Record, + tagFields: Record = {}, + locks: Record = {}, +) { + const type = TYPE_ID[item.type] ?? 1; + const params: Params = { type, id: item.id, includeExternalMedia: 1 }; + for (const [k, v] of Object.entries(fields)) { + params[`${k}.value`] = v; + params[`${k}.locked`] = locks[k] === false ? 0 : 1; + } + for (const [tag, change] of Object.entries(tagFields)) { + change.add.forEach((v, i) => (params[`${tag}[${i}].tag.tag`] = v)); + if (change.remove.length) params[`${tag}[].tag.tag-`] = change.remove.join(','); + params[`${tag}.locked`] = locks[tag] === false ? 0 : 1; + } + for (const [k, locked] of Object.entries(locks)) { + if (!(k in fields) && !(k in tagFields)) params[`${k}.locked`] = locked ? 1 : 0; + } + const section = item.librarySectionId || str(item.raw?.__librarySectionID); + await s.send('PUT', `/library/sections/${section}/all`, params); +} + +/** Collections: create, add, remove. */ +export async function addToCollection(s: PlexServer, item: Item, collection: string) { + await editMetadata(s, item, {}, { collection: { add: [collection], remove: [] } }); +} + +export async function removeFromCollection(s: PlexServer, collectionId: string, itemId: string) { + await s.send('DELETE', `/library/collections/${collectionId}/items/${itemId}`); +} + +export async function playlists(s: PlexServer): Promise { + const mc = await s.container('/playlists', { playlistType: 'video', smart: 0 }); + return items(mc); +} + +export async function addToPlaylist(s: PlexServer, playlistId: string, machineId: string, itemId: string) { + await s.send('PUT', `/playlists/${playlistId}/items`, { uri: `server://${machineId}/com.plexapp.plugins.library/library/metadata/${itemId}` }); +} + +export async function createPlaylist(s: PlexServer, title: string, machineId: string, itemId: string) { + await s.send('POST', '/playlists', { + type: 'video', + title, + smart: 0, + uri: `server://${machineId}/com.plexapp.plugins.library/library/metadata/${itemId}`, + }); +} + +/** Library change detection: small response; compared every few seconds. */ +export async function libraryRevision(s: PlexServer): Promise { + const mc = await s.container('/library/sections'); + return arr(mc.Directory) + .map((d: any) => [d.key, d.contentChangedAt, d.scannedAt, d.updatedAt].join(':')) + .join('|'); +} diff --git a/src/plex/client.ts b/src/plex/client.ts new file mode 100644 index 0000000..285a4ba --- /dev/null +++ b/src/plex/client.ts @@ -0,0 +1,183 @@ +import { httpFetch } from '../platform/native'; + +export const PRODUCT = 'Kaleido'; +export const PLATFORM = 'Windows'; + +export class PlexError extends Error { + constructor( + message: string, + public status = 0, + ) { + super(message); + } +} + +let clientId = ''; +let version = '0.1.0'; +let deviceName = 'Windows PC'; + +/** A stable, random identifier for this installation (not secret). */ +export function clientIdentifier(): string { + if (clientId) return clientId; + clientId = localStorage.getItem('kaleido.clientId') ?? ''; + if (!clientId) { + clientId = crypto.randomUUID(); + localStorage.setItem('kaleido.clientId', clientId); + } + return clientId; +} + +export function configureClient(opts: { version?: string; deviceName?: string }) { + if (opts.version) version = opts.version; + if (opts.deviceName) deviceName = opts.deviceName; +} + +export function plexHeaders(token?: string | null): Record { + const h: Record = { + Accept: 'application/json', + 'X-Plex-Product': PRODUCT, + 'X-Plex-Version': version, + 'X-Plex-Client-Identifier': clientIdentifier(), + 'X-Plex-Platform': PLATFORM, + 'X-Plex-Platform-Version': '11', + 'X-Plex-Device': 'Windows', + 'X-Plex-Device-Name': `Kaleido (${deviceName})`, + 'X-Plex-Model': 'Desktop', + 'X-Plex-Provides': 'player', + 'X-Plex-Language': navigator.language || 'en', + }; + if (token) h['X-Plex-Token'] = token; + return h; +} + +/** Query-string equivalents of the identification headers (for media URLs). */ +export function plexQuery(token?: string | null): Record { + const q: Record = { + 'X-Plex-Product': PRODUCT, + 'X-Plex-Version': version, + 'X-Plex-Client-Identifier': clientIdentifier(), + 'X-Plex-Platform': PLATFORM, + 'X-Plex-Device': 'Windows', + 'X-Plex-Device-Name': `Kaleido (${deviceName})`, + }; + if (token) q['X-Plex-Token'] = token; + return q; +} + +export type Params = Record; + +export function withParams(url: string, params?: Params): string { + if (!params) return url; + const u = new URL(url); + for (const [k, v] of Object.entries(params)) { + if (v === undefined || v === null || v === '') continue; + u.searchParams.set(k, typeof v === 'boolean' ? (v ? '1' : '0') : String(v)); + } + return u.toString(); +} + +export interface RequestOptions { + method?: 'GET' | 'POST' | 'PUT' | 'DELETE'; + params?: Params; + body?: BodyInit | null; + headers?: Record; + timeout?: number; + signal?: AbortSignal; + /** Return raw text instead of parsed JSON. */ + text?: boolean; +} + +const statusMessage = (status: number) => + status === 401 || status === 403 + ? 'Plex declined this request. Sign in again or check your access to this server.' + : status === 404 + ? 'This item is no longer available.' + : status === 400 + ? 'Plex could not process this request.' + : status >= 500 + ? `The Plex server reported an error (${status}).` + : `Plex could not complete the request (${status}).`; + +export async function plexRequest(url: string, token: string | null | undefined, opts: RequestOptions = {}): Promise { + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), opts.timeout ?? 30000); + const onAbort = () => controller.abort(); + opts.signal?.addEventListener('abort', onAbort); + let response: Response; + try { + response = await httpFetch(withParams(url, opts.params), { + method: opts.method ?? 'GET', + headers: { ...plexHeaders(token), ...opts.headers }, + body: opts.body ?? undefined, + signal: controller.signal, + }); + } catch (e: any) { + if (opts.signal?.aborted) throw e; + throw new PlexError(controller.signal.aborted ? 'The server took too long to respond.' : 'Could not reach the server.', 0); + } finally { + clearTimeout(timer); + opts.signal?.removeEventListener('abort', onAbort); + } + if (!response.ok) throw new PlexError(statusMessage(response.status), response.status); + const text = await response.text(); + if (opts.text) return text as unknown as T; + if (!text.trim()) return {} as T; + try { + return JSON.parse(text); + } catch { + return text as unknown as T; + } +} + +/** A connection to one Plex Media Server. */ +export class PlexServer { + constructor( + public readonly uri: string, + public readonly token: string, + public readonly machineId: string, + public readonly name: string, + public readonly owned: boolean, + public readonly local: boolean, + ) {} + + url(path: string, params?: Params): string { + const base = path.startsWith('http') ? path : `${this.uri.replace(/\/$/, '')}/${path.replace(/^\//, '')}`; + return withParams(base, params); + } + + /** URL including the token, for media loaded outside fetch (images, video). */ + signed(path: string, params?: Params): string { + return this.url(path, { ...params, 'X-Plex-Token': this.token }); + } + + async get(path: string, params?: Params, opts: RequestOptions = {}): Promise { + return plexRequest(this.url(path), this.token, { ...opts, params }); + } + + async container(path: string, params?: Params, opts: RequestOptions = {}): Promise { + const j = await this.get(path, params, opts); + return j?.MediaContainer ?? {}; + } + + async send(method: 'POST' | 'PUT' | 'DELETE', path: string, params?: Params, opts: RequestOptions = {}): Promise { + return plexRequest(this.url(path), this.token, { ...opts, method, params }); + } + + /** Photo transcoder URL, sized for the device pixel ratio. */ + image(path: string | undefined, width: number, height: number, opts: { blur?: number; quality?: number; format?: 'jpeg' | 'png' } = {}): string { + if (!path) return ''; + const dpr = Math.min(window.devicePixelRatio || 1, 2); + const w = Math.round(width * dpr); + const h = Math.round(height * dpr); + return this.signed('/photo/:/transcode', { + url: path, + width: w, + height: h, + minSize: 1, + upscale: 1, + quality: opts.quality, + blur: opts.blur, + format: opts.format ?? 'jpeg', + }); + } +} diff --git a/src/plex/parse.ts b/src/plex/parse.ts new file mode 100644 index 0000000..1835fd3 --- /dev/null +++ b/src/plex/parse.ts @@ -0,0 +1,248 @@ +import type { AudienceScore, Chapter, Hub, Item, Marker, Media, Part, Role, Section, Stream, Tag } from './types'; + +const arr = (v: any): any[] => (Array.isArray(v) ? v : v ? [v] : []); +const str = (v: any): string => (v === undefined || v === null ? '' : String(v)); +const num = (v: any): number => { + const n = Number(v); + return Number.isFinite(n) ? n : 0; +}; +const bool = (v: any): boolean => v === true || v === 1 || v === '1' || v === 'true'; + +const tags = (v: any): Tag[] => + arr(v).map((t) => ({ id: str(t.id), tag: str(t.tag), filter: str(t.filter) })).filter((t) => t.tag); + +export function parseStream(s: any): Stream { + return { + id: str(s.id), + streamType: num(s.streamType), + codec: str(s.codec), + index: s.index === undefined ? -1 : num(s.index), + language: str(s.language), + languageCode: str(s.languageCode ?? s.languageTag), + displayTitle: str(s.displayTitle ?? s.title ?? s.language), + extendedDisplayTitle: str(s.extendedDisplayTitle ?? s.displayTitle), + title: str(s.title), + selected: bool(s.selected), + default: bool(s.default), + forced: bool(s.forced), + key: str(s.key), + channels: num(s.channels), + audioChannelLayout: str(s.audioChannelLayout), + bitrate: num(s.bitrate), + width: num(s.width), + height: num(s.height), + frameRate: num(s.frameRate), + profile: str(s.profile), + colorTrc: str(s.colorTrc), + colorPrimaries: str(s.colorPrimaries), + bitDepth: num(s.bitDepth), + doviPresent: bool(s.DOVIPresent), + hearingImpaired: bool(s.hearingImpaired), + samplingRate: num(s.samplingRate), + }; +} + +function parsePart(p: any): Part { + return { + id: str(p.id), + key: str(p.key), + file: str(p.file), + size: num(p.size), + duration: num(p.duration), + container: str(p.container), + indexes: str(p.indexes), + streams: arr(p.Stream).map(parseStream), + accessible: p.accessible === undefined ? true : bool(p.accessible), + exists: p.exists === undefined ? true : bool(p.exists), + }; +} + +export function dynamicRange(video?: Stream): string { + if (!video) return ''; + if (video.doviPresent) return 'Dolby Vision'; + if (video.colorTrc === 'smpte2084') return 'HDR10'; + if (video.colorTrc === 'arib-std-b67') return 'HLG'; + return ''; +} + +function parseMedia(m: any): Media { + const parts = arr(m.Part).map(parsePart); + const streams = parts.flatMap((p) => p.streams); + const video = streams.find((s) => s.streamType === 1); + const audio = streams.filter((s) => s.streamType === 2); + return { + id: str(m.id), + container: str(m.container), + videoCodec: str(m.videoCodec), + audioCodec: str(m.audioCodec), + videoResolution: str(m.videoResolution), + width: num(m.width), + height: num(m.height), + bitrate: num(m.bitrate), + duration: num(m.duration), + audioChannels: num(m.audioChannels), + videoProfile: str(m.videoProfile), + videoFrameRate: str(m.videoFrameRate), + aspectRatio: num(m.aspectRatio), + optimizedForStreaming: bool(m.optimizedForStreaming), + title: str(m.title), + parts, + dynamicRange: dynamicRange(video) || (str(m.videoDynamicRange ?? '') === 'HDR' ? 'HDR10' : ''), + atmos: audio.some((s) => /atmos/i.test(s.displayTitle + s.extendedDisplayTitle + s.title)), + }; +} + +/** Plex normalizes external ratings to 0–10. Never substitute the critic `rating` field. */ +export function parseScores(j: any): AudienceScore[] { + const out: AudienceScore[] = []; + const add = (image: string, value: number, kind: 'audience' | 'critic') => { + if (!Number.isFinite(value) || value < 0 || value > 10 || !image) return; + let source: AudienceScore['source'] | null = null; + if (image.startsWith('rottentomatoes://')) source = 'Rotten Tomatoes'; + else if (image.startsWith('imdb://')) source = 'IMDb'; + else if (image.startsWith('themoviedb://')) source = 'TMDB'; + else if (image.startsWith('thetvdb://') || image.startsWith('tvdb://')) source = 'TVDB'; + if (!source || out.some((s) => s.source === source && s.kind === kind)) return; + out.push({ source, value, kind, image }); + }; + for (const r of arr(j.Rating)) add(str(r.image), num(r.value), r.type === 'critic' ? 'critic' : 'audience'); + if (j.audienceRatingImage) add(str(j.audienceRatingImage), num(j.audienceRating), 'audience'); + if (j.ratingImage) add(str(j.ratingImage), num(j.rating), 'critic'); + return out; +} + +function parseUltraBlur(j: any): Item['ultraBlur'] { + const u = arr(j.UltraBlurColors)[0]; + if (!u?.topLeft) return null; + return { topLeft: str(u.topLeft), topRight: str(u.topRight), bottomRight: str(u.bottomRight), bottomLeft: str(u.bottomLeft) }; +} + +export function parseItem(j: any): Item { + const images = arr(j.Image); + const image = (type: string) => str(images.find((i) => i.type === type)?.url); + const roles: Role[] = arr(j.Role) + .map((r) => ({ + id: str(r.id) || str(r.filter).replace(/^actor=/, ''), + tag: str(r.tag), + filter: str(r.filter), + role: str(r.role), + thumb: str(r.thumb), + })) + .filter((r) => r.tag); + const type = str(j.type); + return { + id: str(j.ratingKey ?? j.key), + key: str(j.key), + guid: str(j.guid), + guids: arr(j.Guid).map((g) => str(g.id)), + type, + subtype: str(j.subtype), + title: str(j.title), + titleSort: str(j.titleSort), + originalTitle: str(j.originalTitle), + summary: str(j.summary), + tagline: str(j.tagline), + year: num(j.year ?? j.parentYear), + originallyAvailableAt: str(j.originallyAvailableAt), + duration: num(j.duration), + viewOffset: num(j.viewOffset), + viewCount: num(j.viewCount), + lastViewedAt: num(j.lastViewedAt), + addedAt: num(j.addedAt), + updatedAt: num(j.updatedAt), + thumb: str(j.thumb), + art: str(j.art ?? j.grandparentArt ?? j.parentArt), + logo: image('clearLogo'), + theme: str(j.theme ?? j.parentTheme ?? j.grandparentTheme), + contentRating: str(j.contentRating), + studio: str(j.studio), + parentId: str(j.parentRatingKey), + parentKey: str(j.parentKey), + parentTitle: str(j.parentTitle), + parentIndex: num(j.parentIndex), + parentThumb: str(j.parentThumb), + grandparentId: str(j.grandparentRatingKey), + grandparentKey: str(j.grandparentKey), + grandparentTitle: str(j.grandparentTitle), + grandparentThumb: str(j.grandparentThumb), + grandparentArt: str(j.grandparentArt), + index: num(j.index), + leafCount: num(j.leafCount), + viewedLeafCount: num(j.viewedLeafCount), + childCount: num(j.childCount), + genres: tags(j.Genre), + directors: tags(j.Director), + writers: tags(j.Writer), + producers: tags(j.Producer), + countries: tags(j.Country), + labels: tags(j.Label), + collections: tags(j.Collection), + roles, + scores: parseScores(j), + userRating: num(j.userRating), + media: arr(j.Media).map(parseMedia), + markers: arr(j.Marker).map( + (m): Marker => ({ + id: str(m.id), + type: str(m.type), + start: num(m.startTimeOffset), + end: num(m.endTimeOffset), + final: bool(m.final), + }), + ), + chapters: arr(j.Chapter).map( + (c, i): Chapter => ({ + index: num(c.index) || i + 1, + title: str(c.tag ?? c.title) || `Chapter ${i + 1}`, + start: num(c.startTimeOffset), + end: num(c.endTimeOffset), + thumb: str(c.thumb), + }), + ), + extras: arr(j.Extras?.Metadata).map(parseItem), + librarySectionId: str(j.librarySectionID), + librarySectionTitle: str(j.librarySectionTitle), + librarySectionKey: str(j.librarySectionKey), + smart: bool(j.smart), + editionTitle: str(j.editionTitle), + skipChildren: bool(j.skipChildren), + ultraBlur: parseUltraBlur(j), + raw: j, + }; +} + +export function parseHub(h: any): Hub { + return { + id: str(h.hubIdentifier ?? h.key ?? h.title), + key: str(h.key), + title: str(h.title), + type: str(h.type), + context: str(h.context), + size: num(h.size), + more: bool(h.more), + style: str(h.style), + items: arr(h.Metadata).map(parseItem), + }; +} + +export function parseSection(d: any): Section { + return { + id: str(d.key), + key: str(d.key), + title: str(d.title), + type: str(d.type), + agent: str(d.agent), + scanner: str(d.scanner), + language: str(d.language), + thumb: str(d.thumb), + art: str(d.art), + locations: arr(d.Location).map((l) => ({ id: str(l.id), path: str(l.path) })), + scannedAt: num(d.scannedAt), + updatedAt: num(d.updatedAt), + contentChangedAt: num(d.contentChangedAt), + refreshing: bool(d.refreshing), + hidden: num(d.hidden) > 0, + }; +} + +export { arr, str, num, bool }; diff --git a/src/plex/playback.ts b/src/plex/playback.ts new file mode 100644 index 0000000..4a44ba2 --- /dev/null +++ b/src/plex/playback.ts @@ -0,0 +1,109 @@ +/** Delivery decisions, stream URLs and progress reporting for playback. */ +import { plexQuery, type PlexServer } from './client'; +import type { Item, Media, Part } from './types'; +import { QUALITY_PROFILE, type Quality } from '../app/settings'; + +export interface Delivery { + url: string; + mode: 'direct' | 'transcode' | 'local'; + /** Plex transcode session; stopped when playback ends. */ + session?: string; + label: string; + /** Media timestamps are absolute (Plex HLS); don't rebase to zero. */ + absoluteTime: boolean; +} + +/** mpv EDL joins multi-part files (CD1/CD2) into one timeline. */ +function edl(urls: string[]): string { + return 'edl://' + urls.map((u) => `%${new TextEncoder().encode(u).length}%${u}`).join(';'); +} + +export function directUrl(server: PlexServer, media: Media): string { + const urls = media.parts.map((p) => server.signed(p.key, plexQuery())); + return urls.length > 1 ? edl(urls) : urls[0]; +} + +export function transcodeUrl( + server: PlexServer, + item: Item, + opts: { mediaIndex: number; quality: Exclude | 'remux'; offsetMs: number; session: string; local: boolean; audioStreamID?: string; subtitleStreamID?: string }, +): string { + const media = item.media[opts.mediaIndex]; + const profile = opts.quality === 'remux' ? null : QUALITY_PROFILE[opts.quality]; + const extra = [ + 'add-transcode-target(type=videoProfile&context=streaming&protocol=hls&container=mpegts&videoCodec=h264,hevc&audioCodec=aac,ac3,eac3,mp3,opus)', + 'add-limitation(scope=videoCodec&scopeName=hevc&type=upperBound&name=video.bitDepth&value=10)', + ].join('+'); + return server.signed('/video/:/transcode/universal/start.m3u8', { + ...plexQuery(), + path: `/library/metadata/${item.id}`, + mediaIndex: opts.mediaIndex, + partIndex: 0, + protocol: 'hls', + session: opts.session, + offset: (opts.offsetMs / 1000).toFixed(1), + fastSeek: 1, + directPlay: 0, + directStream: profile ? 1 : 1, + directStreamAudio: 1, + copyts: 1, + hasMDE: 1, + mediaBufferSize: 102400, + location: opts.local ? 'lan' : 'wan', + videoQuality: 100, + maxVideoBitrate: profile ? profile.kbps : Math.max(media?.bitrate ?? 0, 200000), + videoResolution: profile ? `${profile.width}x${profile.height}` : `${media?.width || 3840}x${media?.height || 2160}`, + subtitles: 'burn', + subtitleSize: 100, + audioBoost: 100, + autoAdjustQuality: 0, + 'X-Plex-Session-Identifier': opts.session, + 'X-Plex-Client-Profile-Extra': extra, + }); +} + +export function partAt(media: Media, timeMs: number): { part: Part; local: number } { + let start = 0; + for (const p of media.parts) { + if (!p.duration || timeMs < start + p.duration) return { part: p, local: timeMs - start }; + start += p.duration; + } + const last = media.parts[media.parts.length - 1]; + return { part: last, local: timeMs - (start - (last?.duration ?? 0)) }; +} + +/** Server-generated preview thumbnail for a position, if the part has an index. */ +export function previewUrl(server: PlexServer, media: Media | undefined, timeMs: number): string { + if (!media) return ''; + const { part, local } = partAt(media, timeMs); + if (!part?.indexes.split(',').includes('sd')) return ''; + return server.signed(`/library/parts/${part.id}/indexes/sd/${Math.max(0, Math.floor(local / 5000) * 5000)}`); +} + +export async function reportTimeline( + server: PlexServer, + item: Item, + state: 'playing' | 'paused' | 'buffering' | 'stopped', + timeMs: number, + session: string, + extra: Record = {}, +) { + await server.get( + '/:/timeline', + { + ratingKey: item.id, + key: item.key || `/library/metadata/${item.id}`, + state, + time: Math.max(0, Math.round(timeMs)), + duration: Math.round(item.duration), + identifier: 'com.plexapp.plugins.library', + hasMDE: 1, + ...extra, + }, + { headers: { 'X-Plex-Session-Identifier': session }, timeout: 10000 }, + ); +} + +export async function stopTranscode(server: PlexServer, session: string) { + await server.get('/video/:/transcode/universal/stop', { session }).catch(() => {}); +} diff --git a/src/plex/plex.test.ts b/src/plex/plex.test.ts new file mode 100644 index 0000000..1af6fe0 --- /dev/null +++ b/src/plex/plex.test.ts @@ -0,0 +1,114 @@ +import { describe, expect, it } from 'vitest'; +import { parseItem, parseScores } from './parse'; +import { isLocalAddress } from './account'; +import { partAt } from './playback'; +import { duration, formatBadges, isWatched, remaining, washGradient } from '../app/format'; +import { buildFeatures } from '../screens/discover'; +import type { Hub } from './types'; + +const movie = (over: Record = {}) => + parseItem({ + ratingKey: '9776', + key: '/library/metadata/9776', + type: 'movie', + title: '2 Fast 2 Furious', + summary: 'An ex-cop…', + art: '/art', + year: 2003, + duration: 6000000, + Image: [{ type: 'clearLogo', url: '/logo' }], + UltraBlurColors: [{ topLeft: '162e4f', topRight: '30618f', bottomRight: '345e96', bottomLeft: '1c2c56' }], + Media: [ + { + id: '1', + videoResolution: '4k', + audioChannels: 8, + Part: [ + { + id: '10', + key: '/library/parts/10/file.mkv', + duration: 3000000, + Stream: [ + { id: 's1', streamType: 1, codec: 'hevc', DOVIPresent: true, index: 0 }, + { id: 's2', streamType: 2, codec: 'truehd', displayTitle: 'English (TrueHD 7.1 Atmos)', index: 1 }, + ], + }, + { id: '11', key: '/library/parts/11/file.mkv', duration: 3000000 }, + ], + }, + ], + ...over, + }); + +describe('parsing', () => { + it('reads logos, UltraBlur colors and format facts', () => { + const m = movie(); + expect(m.logo).toBe('/logo'); + expect(m.ultraBlur?.topRight).toBe('30618f'); + expect(m.media[0].dynamicRange).toBe('Dolby Vision'); + expect(m.media[0].atmos).toBe(true); + expect(formatBadges(m)).toEqual(['4K', 'DOLBY VISION', 'ATMOS']); + }); + + it('keeps audience scores and never substitutes critic ratings', () => { + const scores = parseScores({ + Rating: [ + { image: 'rottentomatoes://image.rating.upright', value: 7.9, type: 'audience' }, + { image: 'rottentomatoes://image.rating.ripe', value: 9.1, type: 'critic' }, + { image: 'imdb://image.rating', value: 7.2, type: 'audience' }, + ], + }); + expect(scores.filter((s) => s.kind === 'audience').map((s) => s.source)).toEqual(['Rotten Tomatoes', 'IMDb']); + expect(scores.find((s) => s.kind === 'critic')?.value).toBe(9.1); + }); +}); + +describe('watched rules', () => { + it('treats a resumed title as watched only past the threshold', () => { + expect(isWatched(movie({ viewCount: 1, viewOffset: 3000000 }), 90)).toBe(false); + expect(isWatched(movie({ viewCount: 1, viewOffset: 5700000 }), 90)).toBe(true); + expect(isWatched(movie({ viewCount: 1 }), 90)).toBe(true); + }); + + it('uses episode counts for shows', () => { + expect(isWatched(parseItem({ type: 'show', leafCount: 10, viewedLeafCount: 10 }))).toBe(true); + expect(isWatched(parseItem({ type: 'show', leafCount: 10, viewedLeafCount: 3 }))).toBe(false); + }); + + it('formats durations and time left', () => { + expect(duration(6000000)).toBe('1h 40m'); + expect(duration(45 * 60000)).toBe('45m'); + expect(remaining(movie({ viewOffset: 3000000 }))).toBe('50m left'); + }); +}); + +describe('connections', () => { + it('recognizes local plex.direct and private addresses', () => { + expect(isLocalAddress('https://192-168-50-81.abc.plex.direct:32400')).toBe(true); + expect(isLocalAddress('http://10.0.0.5:32400')).toBe(true); + expect(isLocalAddress('https://38-130-3-235.abc.plex.direct:27015')).toBe(false); + }); +}); + +describe('playback', () => { + it('maps a position to the right part of a multi-part title', () => { + const m = movie().media[0]; + expect(partAt(m, 1000).part.id).toBe('10'); + expect(partAt(m, 4000000)).toMatchObject({ local: 1000000 }); + }); +}); + +describe('features', () => { + it('interleaves sources, skips in-progress titles and needs artwork', () => { + const hub = (id: string, items: Record[]): Hub => ({ id, key: '', title: id, type: 'movie', context: '', size: items.length, more: false, style: '', items: items.map((i) => movie(i)) }); + const features = buildFeatures([ + hub('movie.recentlyreleased.1', [{ ratingKey: 'a' }, { ratingKey: 'b', viewOffset: 100 }]), + hub('movie.topunwatched.1', [{ ratingKey: 'c' }, { ratingKey: 'd', art: '' }]), + ]); + expect(features.map((f) => f.item.id).sort()).toEqual(['a', 'c']); + }); + + it('builds an artwork wash from UltraBlur colors', () => { + expect(washGradient(movie().ultraBlur)).toContain('rgba(48, 97, 143'); + }); +}); diff --git a/src/plex/types.ts b/src/plex/types.ts new file mode 100644 index 0000000..a1e3ef0 --- /dev/null +++ b/src/plex/types.ts @@ -0,0 +1,277 @@ +/** Normalized Plex models. Parsing lives in parse.ts; raw JSON is kept for editors. */ + +export type ItemType = + | 'movie' + | 'show' + | 'season' + | 'episode' + | 'collection' + | 'clip' + | 'playlist' + | 'person' + | 'artist' + | 'album' + | 'track' + | 'photo' + | string; + +export interface Stream { + id: string; + streamType: 1 | 2 | 3 | number; // video, audio, subtitle + codec: string; + index: number; + language: string; + languageCode: string; + displayTitle: string; + extendedDisplayTitle: string; + title: string; + selected: boolean; + default: boolean; + forced: boolean; + key: string; // external subtitle path + channels: number; + audioChannelLayout: string; + bitrate: number; + width: number; + height: number; + frameRate: number; + profile: string; + colorTrc: string; + colorPrimaries: string; + bitDepth: number; + doviPresent: boolean; + hearingImpaired: boolean; + samplingRate: number; +} + +export interface Part { + id: string; + key: string; + file: string; + size: number; + duration: number; + container: string; + indexes: string; + streams: Stream[]; + accessible: boolean; + exists: boolean; +} + +export interface Media { + id: string; + container: string; + videoCodec: string; + audioCodec: string; + videoResolution: string; + width: number; + height: number; + bitrate: number; + duration: number; + audioChannels: number; + videoProfile: string; + videoFrameRate: string; + aspectRatio: number; + optimizedForStreaming: boolean; + title: string; + parts: Part[]; + dynamicRange: string; // 'Dolby Vision' | 'HDR10' | 'HLG' | '' + atmos: boolean; +} + +export interface Marker { + id: string; + type: 'intro' | 'credits' | 'commercial' | string; + start: number; + end: number; + final: boolean; +} + +export interface Chapter { + index: number; + title: string; + start: number; + end: number; + thumb: string; +} + +export interface Tag { + id: string; + tag: string; + filter: string; +} + +export interface Role extends Tag { + role: string; + thumb: string; +} + +export interface AudienceScore { + source: 'Rotten Tomatoes' | 'IMDb' | 'TMDB' | 'TVDB'; + value: number; // 0–10 + kind: 'audience' | 'critic'; + image: string; +} + +export interface Item { + id: string; + key: string; + guid: string; + guids: string[]; + type: ItemType; + subtype: string; + title: string; + titleSort: string; + originalTitle: string; + summary: string; + tagline: string; + year: number; + originallyAvailableAt: string; + duration: number; + viewOffset: number; + viewCount: number; + lastViewedAt: number; + addedAt: number; + updatedAt: number; + thumb: string; + art: string; + logo: string; + theme: string; + contentRating: string; + studio: string; + parentId: string; + parentKey: string; + parentTitle: string; + parentIndex: number; + parentThumb: string; + grandparentId: string; + grandparentKey: string; + grandparentTitle: string; + grandparentThumb: string; + grandparentArt: string; + index: number; + leafCount: number; + viewedLeafCount: number; + childCount: number; + genres: Tag[]; + directors: Tag[]; + writers: Tag[]; + producers: Tag[]; + countries: Tag[]; + labels: Tag[]; + collections: Tag[]; + roles: Role[]; + scores: AudienceScore[]; + userRating: number; + media: Media[]; + markers: Marker[]; + chapters: Chapter[]; + extras: Item[]; + librarySectionId: string; + librarySectionTitle: string; + librarySectionKey: string; + /** For collections: number of members. For people (search hubs): unused. */ + smart: boolean; + editionTitle: string; + skipChildren: boolean; + /** Plex UltraBlur corner colors (hex without #), for artwork-led washes. */ + ultraBlur: { topLeft: string; topRight: string; bottomRight: string; bottomLeft: string } | null; + raw: any; +} + +export interface Hub { + id: string; + key: string; + title: string; + type: string; + context: string; + size: number; + more: boolean; + style: string; + items: Item[]; +} + +export interface Section { + id: string; + key: string; + title: string; + type: 'movie' | 'show' | 'artist' | 'photo' | string; + agent: string; + scanner: string; + language: string; + thumb: string; + art: string; + locations: { id: string; path: string }[]; + scannedAt: number; + updatedAt: number; + contentChangedAt: number; + refreshing: boolean; + hidden: boolean; +} + +export interface Page { + items: T[]; + total: number; + offset: number; +} + +export interface PlexUser { + id: number; + uuid: string; + username: string; + title: string; + email: string; + thumb: string; + home: boolean; + homeAdmin: boolean; + protected: boolean; + subscription: boolean; +} + +export interface HomeUser { + id: number; + uuid: string; + title: string; + username: string; + thumb: string; + admin: boolean; + protected: boolean; + restricted: boolean; + guest: boolean; +} + +export interface ServerConnection { + uri: string; + local: boolean; + relay: boolean; + protocol: string; + address: string; + port: number; + IPv6: boolean; +} + +export interface ServerResource { + id: string; // clientIdentifier / machineIdentifier + name: string; + owned: boolean; + accessToken: string; + productVersion: string; + platform: string; + presence: boolean; + publicAddress: string; + connections: ServerConnection[]; + sourceTitle: string; + httpsRequired: boolean; +} + +export interface FilterOption { + key: string; + title: string; +} + +export interface LibraryQuery { + sectionId: string; + type?: number; // 1 movie, 2 show, 3 season, 4 episode + sort: string; // e.g. titleSort:asc + filters: Record; // e.g. genre=12, unwatched=1 + title?: string; +} diff --git a/src/screens/Downloads.tsx b/src/screens/Downloads.tsx new file mode 100644 index 0000000..51ae915 --- /dev/null +++ b/src/screens/Downloads.tsx @@ -0,0 +1,222 @@ +import { useEffect, useState } from 'react'; +import { useDownloads, type Download } from '../downloads/store'; +import { useSession } from '../app/session'; +import { navigate } from '../app/router'; +import { duration, episodeLabel, fileSize } from '../app/format'; +import { usePlayer } from '../player/store'; +import { invoke, isNative, localFileUrl, revealPath } from '../platform/native'; +import { Button, EmptyState, IconButton } from '../ui/primitives'; +import { Icon } from '../ui/Icon'; +import { confirmDialog, openMenu } from '../ui/overlays'; + +function useLocalArt(d: Download, key: string) { + const [url, setUrl] = useState(''); + const path = d.meta.localAssets?.[key]; + useEffect(() => { + if (path) localFileUrl(path).then(setUrl); + }, [path]); + return url; +} + +function DownloadRow({ d }: { d: Download }) { + const store = useDownloads(); + const server = useSession((s) => s.server); + const item = store.itemOf(d); + const still = useLocalArt(d, item.type === 'episode' ? 'still' : 'art'); + const poster = useLocalArt(d, 'poster'); + const pct = d.total ? Math.min(100, (d.received / d.total) * 100) : 0; + const isEp = item.type === 'episode'; + const onServer = server?.machineId === d.meta.serverId; + const play = () => usePlayer.getState().play(item, { localFile: d.filePath, resume: true }); + const remove = async () => { + if (await confirmDialog({ title: 'Remove download?', message: `“${item.title}” will be deleted from this computer. It stays available on your Plex server.`, confirm: 'Remove', danger: true })) store.remove(d.id); + }; + const status = + d.status === 'completed' + ? fileSize(d.total || d.received) + : d.status === 'downloading' + ? `${fileSize(d.received)} of ${fileSize(d.total)}${d.speed ? ` · ${fileSize(d.speed)}/s` : ''}` + : d.status === 'queued' + ? 'Waiting…' + : d.status === 'paused' + ? `Paused · ${fileSize(d.received)} of ${fileSize(d.total)}` + : (d.error ?? 'Failed'); + return ( +
+ +
+

{isEp ? item.grandparentTitle : item.title}

+

+ {isEp ? `${episodeLabel(item)} · ${item.title}` : [item.year, duration(item.duration)].filter(Boolean).join(' · ')} + {d.meta.serverName && · {d.meta.serverName}} +

+ {d.status !== 'completed' ? ( +
+ + + + {status} +
+ ) : ( + + Ready offline · {status} + + )} +
+
+ {d.status === 'completed' && ( + + )} + {d.status === 'downloading' || d.status === 'queued' ? ( + store.pause(d.id)} /> + ) : d.status === 'paused' || d.status === 'failed' ? ( + store.resume(d.id)} /> + ) : null} + + openMenu( + [ + ...(onServer ? [{ label: 'Details', icon: 'info', onSelect: () => navigate({ name: 'item', id: item.id }) }] : []), + ...(d.status === 'completed' ? [{ label: 'Show in folder', icon: 'folder', onSelect: () => revealPath(d.filePath) }] : []), + { divider: true }, + { label: 'Remove download', icon: 'trash', danger: true, onSelect: remove }, + ], + e.currentTarget, + { align: 'end' }, + ) + } + /> +
+
+ ); +} + +export default function Downloads({ offline }: { offline?: boolean }) { + const store = useDownloads(); + const [space, setSpace] = useState<{ free: number; total: number } | null>(null); + useEffect(() => { + store.init(); + }, []); + useEffect(() => { + if (isNative && store.dir) invoke<{ free: number; total: number }>('disk_space', { path: store.dir }).then(setSpace).catch(() => {}); + }, [store.dir, store.items.length]); + + const active = store.items.filter((d) => d.status !== 'completed'); + const done = store.items.filter((d) => d.status === 'completed'); + const used = store.items.reduce((a, d) => a + (d.status === 'completed' ? d.total || d.received : d.received), 0); + const movies = done.filter((d) => d.meta.raw?.type !== 'episode'); + const episodes = done.filter((d) => d.meta.raw?.type === 'episode'); + const shows = new Map(); + for (const e of episodes) { + const k = e.meta.raw?.grandparentTitle ?? 'Episodes'; + shows.set(k, [...(shows.get(k) ?? []), e]); + } + + return ( +
+
+
+
Offline · This computer
+

Downloads

+

Movies and episodes saved to this computer play without a connection. Progress syncs to Plex when you’re back online.

+
+ {isNative && ( +
+
+ Storage + {space ? `${fileSize(space.free)} free` : ''} +
+
+ {space && ( + <> + + + + )} +
+
+ {fileSize(used) || '0 MB'} used by Kaleido + {store.dir && ( + + )} +
+
+ )} +
+ + {!isNative && ( + + Install Kaleido for Windows to save movies and episodes for offline viewing. + + )} + {isNative && !store.items.length && ( + navigate({ name: 'section', kind: 'movie', tab: 'library' })}>Browse movies}> + Choose Download on a movie or episode, or download a whole season from its page. + + )} + + {active.length > 0 && ( +
+
+

+ In progress {active.length} +

+
+ {active.some((d) => d.status === 'downloading' || d.status === 'queued') ? ( + + ) : ( + + )} +
+
+ {active.map((d) => ( + + ))} +
+ )} + {movies.length > 0 && ( +
+
+

+ Movies {movies.length} +

+
+ {movies.map((d) => ( + + ))} +
+ )} + {[...shows.entries()].map(([show, list]) => ( +
+
+

+ {show} {list.length} episode{list.length === 1 ? '' : 's'} +

+
+ {list + .sort((a, b) => (a.meta.raw.parentIndex - b.meta.raw.parentIndex) * 1000 + (a.meta.raw.index - b.meta.raw.index)) + .map((d) => ( + + ))} +
+ ))} +
+ ); +} diff --git a/src/screens/Home.tsx b/src/screens/Home.tsx new file mode 100644 index 0000000..d652522 --- /dev/null +++ b/src/screens/Home.tsx @@ -0,0 +1,53 @@ +import { useMemo } from 'react'; +import { useQuery } from '@tanstack/react-query'; +import * as api from '../plex/api'; +import { useSections, useServerQuery } from '../app/queries'; +import { useServer } from '../app/session'; +import { navigate } from '../app/router'; +import { Hero } from '../ui/Hero'; +import { HubShelf } from '../ui/media'; +import { ErrorState, PageLoader } from '../ui/primitives'; +import { buildFeatures, HIDDEN_HUBS } from './discover'; + +export function Home() { + const server = useServer(); + const sections = useSections(); + const video = (sections.data ?? []).filter((s) => (s.type === 'movie' || s.type === 'show') && !s.hidden); + + const home = useServerQuery(['homeHubs'], (s) => api.homeHubs(s)); + const continueWatching = useServerQuery(['continue'], (s) => api.continueWatching(s), { staleTime: 15_000 }); + // Section hubs feed the hero and the release shelves; shared with Discover. + const sectionHubs = useQuery({ + queryKey: [server.machineId, 'sectionHubsAll', video.map((s) => s.id).join(',')], + queryFn: async () => (await Promise.all(video.map((s) => api.sectionHubs(server, s.id).catch(() => [])))).flat(), + enabled: video.length > 0, + staleTime: 60_000, + }); + + const features = useMemo(() => buildFeatures(sectionHubs.data ?? [], 8), [sectionHubs.data]); + const extra = (sectionHubs.data ?? []).filter((h) => /recentlyreleased|recentlyaired|topunwatched|toprated/.test(h.id)); + + if (home.isError && !home.data) return home.refetch()} />; + if (!home.data || sections.isLoading) return ; + + const hubs = home.data.filter((h) => !HIDDEN_HUBS.test(h.id)); + const cw = continueWatching.data ?? []; + const homeIds = new Set(hubs.map((h) => h.title)); + + return ( +
+ +
+ + {hubs.map((h) => ( + navigate({ name: 'hub', key: h.key, title: h.title }) : undefined} /> + ))} + {extra + .filter((h) => !homeIds.has(h.title)) + .map((h) => ( + navigate({ name: 'hub', key: h.key, title: h.title })} /> + ))} +
+
+ ); +} diff --git a/src/screens/HubScreen.tsx b/src/screens/HubScreen.tsx new file mode 100644 index 0000000..c27b1c0 --- /dev/null +++ b/src/screens/HubScreen.tsx @@ -0,0 +1,43 @@ +import { useInfiniteQuery } from '@tanstack/react-query'; +import { useEffect, useRef } from 'react'; +import * as api from '../plex/api'; +import { useServer } from '../app/session'; +import { LandscapeCard, PosterCard } from '../ui/media'; +import { EmptyState, ErrorState, PageLoader, Spinner } from '../ui/primitives'; + +/** "View all" for a hub, paged as it scrolls. */ +export default function HubScreen({ hubKey, title }: { hubKey: string; title: string }) { + const server = useServer(); + const q = useInfiniteQuery({ + queryKey: [server.machineId, 'hubAll', hubKey], + queryFn: ({ pageParam }) => api.hubItems(server, hubKey, pageParam, 72), + initialPageParam: 0, + getNextPageParam: (last, pages) => { + const loaded = pages.reduce((a, p) => a + p.items.length, 0); + return last.items.length && loaded < last.total ? loaded : undefined; + }, + }); + const sentinel = useRef(null); + useEffect(() => { + const el = sentinel.current; + if (!el) return; + const io = new IntersectionObserver(([e]) => e.isIntersecting && q.hasNextPage && !q.isFetchingNextPage && q.fetchNextPage(), { rootMargin: '800px' }); + io.observe(el); + return () => io.disconnect(); + }, [q.hasNextPage, q.isFetchingNextPage]); + + const items = q.data?.pages.flatMap((p) => p.items) ?? []; + const wide = items.length > 0 && items.every((i) => i.type === 'episode'); + return ( +
+

{title}

+ {q.isError && q.refetch()} />} + {q.isLoading && } + {q.data && !items.length && } +
{items.map((i) => (wide ? : ))}
+
+ {q.isFetchingNextPage && } +
+
+ ); +} diff --git a/src/screens/Item.tsx b/src/screens/Item.tsx new file mode 100644 index 0000000..fe77b94 --- /dev/null +++ b/src/screens/Item.tsx @@ -0,0 +1,616 @@ +import { useEffect, useMemo, useState, type ReactNode } from 'react'; +import * as api from '../plex/api'; +import type { Item } from '../plex/types'; +import { invalidateLibrary, useChildren, useItem, useRelated, useServerQuery } from '../app/queries'; +import { useServer } from '../app/session'; +import { useSettings } from '../app/settings'; +import { goBack, navigate, useRouter } from '../app/router'; +import { canManage, itemMenu, openDialog, openItem, playItem, playWithVersion, setWatched, shuffleItem } from '../app/actions'; +import { bitrate, channelLabel, date, duration, episodeLabel, extraLabel, fileSize, isWatched, remaining, resolutionLabel, technicalLine } from '../app/format'; +import { Backdrop } from '../ui/Backdrop'; +import { Facts, HubShelf, LandscapeCard, PersonCard, PosterCard, Shelf, TitleArt } from '../ui/media'; +import { Artwork, Button, EmptyState, ErrorState, IconButton, PageLoader, Select } from '../ui/primitives'; +import { Icon } from '../ui/Icon'; +import { openMenu, toastError } from '../ui/overlays'; +import { useDownloads } from '../downloads/store'; +import { playThemeMusic, stopThemeMusic } from '../player/theme'; + +export function ItemScreen({ id }: { id: string }) { + const q = useItem(id); + const item = q.data; + useEffect(() => { + if (item?.theme && item.type !== 'collection') playThemeMusic(item.theme); + }, [item?.theme]); + useEffect(() => () => stopThemeMusic(), []); + if (q.isError) return
q.refetch()} />
; + if (!item) return ; + switch (item.type) { + case 'show': + return ; + case 'season': + return ; + case 'episode': + return ; + case 'collection': + return ; + default: + return ; + } +} + +// —— Shared pieces ———————————————————————————————————————————————— + +function Synopsis({ item, text }: { item: Item; text: string }) { + const [clamped, setClamped] = useState(false); + if (!text) return null; + return ( +
+

{ + if (el) setClamped(el.scrollHeight > el.clientHeight + 2); + }} + > + {text} +

+ {clamped && ( + + )} +
+ ); +} + +function WatchedButton({ item }: { item: Item }) { + const percent = useSettings((s) => s.watchedPercent); + const watched = isWatched(item, percent); + return ( + + ); +} + +function DownloadButton({ item }: { item: Item }) { + const downloads = useDownloads(); + const isSeries = item.type === 'show' || item.type === 'season'; + const dl = downloads.items.find((d) => d.id === downloads.idFor(item.id)); + if (isSeries) return downloads.startAll(item)} />; + if (dl?.status === 'completed') return navigate({ name: 'downloads' })} />; + if (dl) { + const pct = dl.total ? Math.round((dl.received / dl.total) * 100) : 0; + return ( + + ); + } + return downloads.start(item)} />; +} + +function MoreButton({ item, onDeleted }: { item: Item; onDeleted?: () => void }) { + return openMenu(itemMenu(item, { detail: true, onDeleted }), e.currentTarget)} />; +} + +function TrailerButton({ item }: { item: Item }) { + const trailer = item.extras.find((e) => e.subtype === 'trailer' && e.media.length); + if (!trailer) return null; + return ( + + ); +} + +function DetailHero({ item, backdropItem, children, title, below }: { item: Item; backdropItem?: Item; children: ReactNode; title?: ReactNode; below?: ReactNode }) { + return ( + <> + +
+
+ {title ?? } + {children} +
+ {below} +
+ + ); +} + +function CastRow({ item, title = 'Cast & Crew' }: { item: Item; title?: string }) { + const people = [ + ...item.roles.map((r) => ({ id: r.id, name: r.tag, role: r.role, thumb: r.thumb })), + ...item.directors.map((d) => ({ id: d.id, name: d.tag, role: 'Director', thumb: (d as any).thumb ?? item.raw?.Director?.find((x: any) => x.tag === d.tag)?.thumb })), + ...item.writers.slice(0, 3).map((d) => ({ id: d.id, name: d.tag, role: 'Writer', thumb: item.raw?.Writer?.find((x: any) => x.tag === d.tag)?.thumb })), + ]; + if (!people.length) return null; + return ( + + {people.map((p, i) => ( + navigate({ name: 'person', id: p.id, title: p.name, thumb: p.thumb }) : undefined} /> + ))} + + ); +} + +function ExtrasRow({ item }: { item: Item }) { + const extras = item.extras.filter((e) => e.media.length); + if (!extras.length) return null; + return ( + + {extras.map((e) => ( +
playItem(e, { resume: false })} onKeyDown={(ev) => ev.key === 'Enter' && playItem(e, { resume: false })}> + +
+
{e.title}
+
{[extraLabel(e), duration(e.duration)].filter(Boolean).join(' · ')}
+
+
+ ))} +
+ ); +} + +function ExtraCover({ item }: { item: Item }) { + const server = useServer(); + return ( +
+ +
+ + + +
+ ); +} + +function RelatedRows({ item }: { item: Item }) { + const related = useRelated(item.id); + const hubs = (related.data ?? []).map((h) => ({ ...h, items: h.items.filter((i) => i.id !== item.id && ['movie', 'show'].includes(i.type)) })).filter((h) => h.items.length); + return ( + <> + {hubs.slice(0, 3).map((h) => ( + + ))} + + ); +} + +function StarRating({ item }: { item: Item }) { + const server = useServer(); + const [value, setValue] = useState(item.userRating); + const [hover, setHover] = useState(0); + useEffect(() => setValue(item.userRating), [item.userRating]); + const set = async (stars: number) => { + const rating = stars * 2 === value ? -1 : stars * 2; + setValue(Math.max(0, rating)); + try { + await api.rate(server, item.id, rating); + invalidateLibrary(); + } catch (e) { + toastError(e); + } + }; + const shown = hover || value / 2; + return ( + setHover(0)} aria-label="Your rating"> + {[1, 2, 3, 4, 5].map((n) => ( + + ))} + + ); +} + +function AboutPanel({ item }: { item: Item }) { + const m = item.media[0]; + const rows: [string, ReactNode][] = []; + const tags = (list: { tag: string; id: string }[], filter: string, limit = 3) => + list.slice(0, limit).map((t, i) => ( + + {i > 0 && ', '} + {filter === 'person' ? ( + + ) : ( + t.tag + )} + + )); + if (item.directors.length) rows.push([item.directors.length > 1 ? 'Directors' : 'Director', tags(item.directors, 'person')]); + if (item.writers.length) rows.push(['Writers', tags(item.writers, 'person')]); + if (item.studio) rows.push([item.type === 'show' || item.type === 'episode' ? 'Network' : 'Studio', item.studio]); + if (item.originallyAvailableAt) rows.push([item.type === 'show' ? 'Premiered' : 'Released', date(item.originallyAvailableAt)]); + if (item.genres.length) rows.push(['Genres', item.genres.map((g) => g.tag).join(', ')]); + if (item.countries.length) rows.push(['Country', item.countries.map((c) => c.tag).join(', ')]); + if (item.contentRating) rows.push(['Rated', item.contentRating]); + if (item.duration && item.type !== 'show') rows.push(['Runtime', duration(item.duration)]); + for (const s of item.scores) rows.push([`${s.source}${s.kind === 'critic' ? ' critics' : ''}`, s.source === 'Rotten Tomatoes' ? `${Math.round(s.value * 10)}%` : `${s.value.toFixed(1)} / 10`]); + if (item.collections.length) rows.push(['Collections', item.collections.map((c) => c.tag).join(', ')]); + if (item.labels.length) rows.push(['Labels', item.labels.map((c) => c.tag).join(', ')]); + if (item.editionTitle) rows.push(['Edition', item.editionTitle]); + if (m) { + rows.push(['Video', [resolutionLabel(m), m.dynamicRange, m.videoCodec.toUpperCase(), m.videoFrameRate].filter(Boolean).join(' · ')]); + rows.push(['Audio', [m.audioCodec.toUpperCase(), channelLabel(m.audioChannels), m.atmos ? 'Atmos' : ''].filter(Boolean).join(' · ')]); + if (m.bitrate) rows.push(['Bitrate', bitrate(m.bitrate)]); + const size = m.parts.reduce((a, p) => a + p.size, 0); + if (size) rows.push(['File size', fileSize(size)]); + if (item.media.length > 1) rows.push(['Versions', `${item.media.length} available`]); + } + if (item.addedAt) rows.push(['Added', date(item.addedAt)]); + return ( + + ); +} + +// —— Movie —————————————————————————————————————————————————————————— + +function MovieDetail({ item }: { item: Item }) { + const resume = item.viewOffset > 0 && !isWatched(item); + return ( +
+ + + +
+ + {resume && ( + + )} + + + + +
+ {resume && ( +
+ + + +
+ )} +
{technicalLine(item.media[0])}
+
+
+
+ + + +
+ +
+
+ ); +} + +// —— Shows and seasons ———————————————————————————————————————————— + +function EpisodeRow({ ep }: { ep: Item }) { + const server = useServer(); + const percent = useSettings((s) => s.watchedPercent); + const watched = isWatched(ep, percent); + const p = ep.viewOffset && ep.duration ? ep.viewOffset / ep.duration : 0; + return ( +
openItem(ep)} + onKeyDown={(e) => e.key === 'Enter' && openItem(ep)} + onContextMenu={(e) => { + e.preventDefault(); + openMenu(itemMenu(ep), { x: e.clientX, y: e.clientY }); + }} + > +
{ep.index || '–'}
+
+ + + {p > 0 && !watched && ( + + + + )} +
+
+

+ {ep.title} + {watched && } +

+
+ {[duration(ep.duration), ep.originallyAvailableAt ? date(ep.originallyAvailableAt) : '', ep.viewOffset && !watched ? remaining(ep) : ''].filter(Boolean).join(' · ')} +
+ {ep.summary &&

{ep.summary}

} +
+ +
+ ); +} + +function Episodes({ seasons, initialSeason, showPicker = true }: { seasons: Item[]; initialSeason?: string; showPicker?: boolean }) { + const saved = useRouter((s) => s.current.state.season as string | undefined); + const [seasonId, setSeasonId] = useState(saved ?? initialSeason ?? seasons[0]?.id); + useEffect(() => { + if (!seasonId && seasons[0]) setSeasonId(initialSeason ?? seasons[0].id); + }, [seasons, initialSeason]); + const episodes = useChildren(seasonId); + const season = seasons.find((s) => s.id === seasonId); + if (!seasons.length) return null; + return ( +
+
+

Episodes

+ {showPicker && seasons.length > 1 && ( + setQuery(e.target.value)} onKeyDown={(e) => e.key === 'Escape' && (e.stopPropagation(), setQuery(''))} /> + {query && ( + + )} +
+ +
+ setQuery(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter' && query.trim()) remember(query.trim()); + if (e.key === 'Escape') { + e.stopPropagation(); + if (query) setQuery(''); + else useRouter.getState().back(); + } + }} + /> + {results.isFetching && } + {query && ( + + )} +
+
+ + {!debounced && ( +
+ {recent.length > 0 && ( +
+

Recent searches

+
+ {recent.map((r) => ( + + ))} + +
+
+ )} + {recentlyAdded.data + ?.filter((h) => /recent/.test(h.id)) + .slice(0, 2) + .map((h) => ( + + {h.items.map((i) => ( + + ))} + + ))} +
+ )} + + {debounced && results.isError && results.refetch()} />} + {debounced && results.data && !all.length && !people.length && ( + + Check the spelling, or search for an actor, director or episode title. + + )} + {debounced && results.data && ( +
remember(debounced)}> + {top.length > 0 && ( +
+

Top results

+
+ {top.map((i) => ( + + ))} +
+
+ )} + {moreMovies.length > 0 && ( + + {moreMovies.map((i) => ( + + ))} + + )} + {moreShows.length > 0 && ( + + {moreShows.map((i) => ( + + ))} + + )} + {episodes.length > 0 && ( + + {episodes.map((i) => ( + + ))} + + )} + {people.length > 0 && ( + + {people.map((p) => ( + navigate({ name: 'person', id: p.id, title: p.tag, thumb: p.thumb })} /> + ))} + + )} + {collections.length > 0 && ( + + {collections.map((i) => ( + + ))} + + )} +
+ )} +
+ ); +} diff --git a/src/screens/Section.tsx b/src/screens/Section.tsx new file mode 100644 index 0000000..3cc41a3 --- /dev/null +++ b/src/screens/Section.tsx @@ -0,0 +1,111 @@ +import { useMemo } from 'react'; +import * as api from '../plex/api'; +import { useSectionFor, useServerQuery } from '../app/queries'; +import { navigate, type SectionKind, type SectionTab } from '../app/router'; +import { useSettings } from '../app/settings'; +import type { Section } from '../plex/types'; +import { Hero } from '../ui/Hero'; +import { HubShelf, PosterCard } from '../ui/media'; +import { EmptyState, ErrorState, PageLoader, Select } from '../ui/primitives'; +import { buildFeatures, HIDDEN_HUBS, recentSeasons } from './discover'; +import { LibraryBrowser } from './LibraryBrowser'; + +const TABS: { id: SectionTab; label: string }[] = [ + { id: 'discover', label: 'Discover' }, + { id: 'library', label: 'Library' }, + { id: 'collections', label: 'Collections' }, +]; + +function SectionHeader({ kind, tab, section, all, overlay }: { kind: SectionKind; tab: SectionTab; section: Section; all: Section[]; overlay: boolean }) { + const set = useSettings((s) => s.set); + return ( +
+

{kind === 'movie' ? 'Movies' : 'TV Shows'}

+ + {all.length > 1 && ( + setUrl(e.target.value)} /> + + +
+ + +
+ + + )} + {error && ( +
+ {error} +
+ )} + {mode === 'start' && ( + + )} +
+
+ ); +} diff --git a/src/screens/Splash.tsx b/src/screens/Splash.tsx new file mode 100644 index 0000000..887a429 --- /dev/null +++ b/src/screens/Splash.tsx @@ -0,0 +1,44 @@ +import { useEffect, useState } from 'react'; +import { useSettings } from '../app/settings'; + +const FACETS = [ + { fill: '#C3E8D3', d: 'M33,4 L55.5,17 L42.5,24.5 L33,19 Z' }, + { fill: '#71B9B0', d: 'M56.5,19 L56.5,45 L43.5,37.5 L43.5,26.5 Z' }, + { fill: '#3D7C7B', d: 'M55.5,47 L33,60 L33,45 L42.5,39.5 Z' }, + { fill: '#D0A977', d: 'M31,60 L8.5,47 L21.5,39.5 L31,45 Z' }, + { fill: '#E9D8AE', d: 'M7.5,45 L7.5,19 L20.5,26.5 L20.5,37.5 Z' }, + { fill: '#EEF2DD', d: 'M8.5,17 L31,4 L31,19 L21.5,24.5 Z' }, +]; + +/** + * The cold-start aperture: the six facets twist open around the dark center, + * hold until startup data is ready, then the view flies through the aperture. + */ +export function Splash({ ready, onDone }: { ready: boolean; onDone: () => void }) { + const reduced = useSettings((s) => s.reducedMotion); + const [phase, setPhase] = useState<'opening' | 'held' | 'leaving'>('opening'); + useEffect(() => { + const t = setTimeout(() => setPhase('held'), reduced ? 0 : 1100); + return () => clearTimeout(t); + }, [reduced]); + useEffect(() => { + if (phase === 'held' && ready) setPhase('leaving'); + }, [phase, ready]); + useEffect(() => { + if (phase !== 'leaving') return; + const t = setTimeout(onDone, reduced ? 0 : 620); + return () => clearTimeout(t); + }, [phase]); + return ( +
+
+ + KALEIDO +
+
+ ); +} diff --git a/src/screens/WindowDrag.tsx b/src/screens/WindowDrag.tsx new file mode 100644 index 0000000..7a15c09 --- /dev/null +++ b/src/screens/WindowDrag.tsx @@ -0,0 +1,22 @@ +import { isNative, win } from '../platform/native'; +import { Icon } from '../ui/Icon'; + +/** A draggable strip with window controls for full-screen states without the top bar. */ +export function WindowDrag() { + if (!isNative) return null; + return ( +
+
+ + + +
+
+ ); +} diff --git a/src/screens/dialogs/Artwork.tsx b/src/screens/dialogs/Artwork.tsx new file mode 100644 index 0000000..3bb7a3f --- /dev/null +++ b/src/screens/dialogs/Artwork.tsx @@ -0,0 +1,96 @@ +import { useState } from 'react'; +import * as api from '../../plex/api'; +import type { Item } from '../../plex/types'; +import { useServer } from '../../app/session'; +import { invalidateItem, invalidateLibrary, useServerQuery } from '../../app/queries'; +import { Dialog, promptDialog, toast, toastError } from '../../ui/overlays'; +import { Button, EmptyState, PageLoader } from '../../ui/primitives'; +import { Icon } from '../../ui/Icon'; + +const KIND = { poster: 'posters', art: 'arts', clearLogo: 'clearLogos' } as const; +const LABEL = { poster: 'poster', art: 'background', clearLogo: 'logo' } as const; + +export function ArtworkDialog({ item, type, onClose }: { item: Item; type: 'poster' | 'art' | 'clearLogo'; onClose: () => void }) { + const server = useServer(); + const options = useServerQuery(['artwork', item.id, type], (s) => api.artworkOptions(s, item.id, KIND[type]), { staleTime: 0 }); + const [busy, setBusy] = useState(''); + + const choose = async (key: string) => { + setBusy(key); + try { + await api.selectArtwork(server, item.id, type, key); + toast(`Updated the ${LABEL[type]}`, 'success'); + invalidateItem(item.id); + invalidateLibrary(); + onClose(); + } catch (e) { + toastError(e); + } finally { + setBusy(''); + } + }; + + const upload = () => { + const input = document.createElement('input'); + input.type = 'file'; + input.accept = 'image/jpeg,image/png,image/webp'; + input.onchange = async () => { + const file = input.files?.[0]; + if (!file) return; + setBusy('upload'); + try { + await api.uploadArtwork(server, item.id, KIND[type], file); + toast(`Uploaded a new ${LABEL[type]}`, 'success'); + invalidateItem(item.id); + invalidateLibrary(); + onClose(); + } catch (e) { + toastError(e); + } finally { + setBusy(''); + } + }; + input.click(); + }; + + const fromUrl = async () => { + const url = await promptDialog({ title: `Use an image from the web`, message: `Plex downloads the image and uses it as the ${LABEL[type]}.`, confirm: 'Use image', input: { label: 'Image URL', placeholder: 'https://…' } }); + if (url) choose(url); + }; + + const shape = type === 'poster' ? 'poster' : type === 'art' ? 'landscape' : 'logo'; + return ( + + + +
+ } + > + {options.isLoading && } + {options.data && !options.data.length && Upload an image or use one from the web.} +
+ {options.data?.map((o) => ( + + ))} +
+ + ); +} diff --git a/src/screens/dialogs/DialogHost.tsx b/src/screens/dialogs/DialogHost.tsx new file mode 100644 index 0000000..57f0204 --- /dev/null +++ b/src/screens/dialogs/DialogHost.tsx @@ -0,0 +1,60 @@ +import { useDialogs } from '../../app/actions'; +import { useSession } from '../../app/session'; +import { Dialog } from '../../ui/overlays'; +import { EditMetadataDialog } from './EditMetadata'; +import { FixMatchDialog } from './FixMatch'; +import { ArtworkDialog } from './Artwork'; +import { MediaInfoDialog } from './MediaInfo'; +import { CollectionDialog, PlaylistDialog } from './Lists'; +import { channelLabel, resolutionLabel } from '../../app/format'; + +export function DialogHost() { + const dialog = useDialogs((s) => s.dialog); + const close = useDialogs((s) => s.close); + const server = useSession((s) => s.server); + if (!dialog || !server) return null; + switch (dialog.kind) { + case 'edit': + return ; + case 'match': + return ; + case 'artwork': + return ; + case 'info': + return ; + case 'collection': + return ; + case 'playlist': + return ; + case 'synopsis': + return ( + +

{dialog.item.summary}

+
+ ); + case 'versions': + return ( + +
+ {dialog.item.media.map((m, i) => ( + + ))} +
+
+ ); + default: + return null; + } +} diff --git a/src/screens/dialogs/EditMetadata.tsx b/src/screens/dialogs/EditMetadata.tsx new file mode 100644 index 0000000..7ed93a2 --- /dev/null +++ b/src/screens/dialogs/EditMetadata.tsx @@ -0,0 +1,208 @@ +import { useState } from 'react'; +import * as api from '../../plex/api'; +import type { Item } from '../../plex/types'; +import { useServer } from '../../app/session'; +import { invalidateItem, invalidateLibrary, useItem } from '../../app/queries'; +import { openDialog } from '../../app/actions'; +import { Dialog, toast, toastError } from '../../ui/overlays'; +import { Button, PageLoader, Segmented } from '../../ui/primitives'; +import { Icon } from '../../ui/Icon'; + +type Tab = 'general' | 'tags' | 'artwork'; + +const FIELDS: { key: string; label: string; types: string[]; multiline?: boolean; type?: string }[] = [ + { key: 'title', label: 'Title', types: ['movie', 'show', 'season', 'episode', 'collection'] }, + { key: 'titleSort', label: 'Sort title', types: ['movie', 'show', 'collection'] }, + { key: 'originalTitle', label: 'Original title', types: ['movie', 'show'] }, + { key: 'originallyAvailableAt', label: 'Release date', types: ['movie', 'show', 'episode'], type: 'date' }, + { key: 'contentRating', label: 'Content rating', types: ['movie', 'show', 'collection'] }, + { key: 'studio', label: 'Studio', types: ['movie', 'show'] }, + { key: 'tagline', label: 'Tagline', types: ['movie', 'show'] }, + { key: 'summary', label: 'Summary', types: ['movie', 'show', 'season', 'episode', 'collection'], multiline: true }, +]; + +const TAGS: { key: string; label: string; source: keyof Item; types: string[] }[] = [ + { key: 'genre', label: 'Genres', source: 'genres', types: ['movie', 'show'] }, + { key: 'collection', label: 'Collections', source: 'collections', types: ['movie', 'show'] }, + { key: 'label', label: 'Labels', source: 'labels', types: ['movie', 'show', 'episode', 'season', 'collection'] }, + { key: 'director', label: 'Directors', source: 'directors', types: ['movie', 'episode'] }, + { key: 'writer', label: 'Writers', source: 'writers', types: ['movie', 'episode'] }, + { key: 'country', label: 'Countries', source: 'countries', types: ['movie', 'show'] }, +]; + +function TagEditor({ label, values, onChange, locked, onLock }: { label: string; values: string[]; onChange: (v: string[]) => void; locked: boolean; onLock: () => void }) { + const [draft, setDraft] = useState(''); + const add = () => { + const v = draft.trim(); + if (v && !values.includes(v)) onChange([...values, v]); + setDraft(''); + }; + return ( +
+ + {label} + + +
+ {values.map((v) => ( + + {v} + + + ))} + setDraft(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ',') { + e.preventDefault(); + add(); + } else if (e.key === 'Backspace' && !draft && values.length) onChange(values.slice(0, -1)); + }} + onBlur={add} + /> +
+
+ ); +} + +function LockToggle({ locked, onClick }: { locked: boolean; onClick: () => void }) { + return ( + + ); +} + +export function EditMetadataDialog({ item: initial, onClose }: { item: Item; onClose: () => void }) { + const server = useServer(); + const full = useItem(initial.id); + const item = full.data ?? initial; + const [tab, setTab] = useState('general'); + const [values, setValues] = useState | null>(null); + const [tags, setTags] = useState | null>(null); + const [locks, setLocks] = useState>({}); + const [busy, setBusy] = useState(false); + + const fields = FIELDS.filter((f) => f.types.includes(item.type)); + const tagFields = TAGS.filter((t) => t.types.includes(item.type)); + const lockedFields: Record = Object.fromEntries((item.raw?.Field ?? []).map((f: any) => [f.name, !!f.locked])); + + if (full.data && !values) { + setValues(Object.fromEntries(fields.map((f) => [f.key, String(item.raw?.[f.key] ?? '')]))); + setTags(Object.fromEntries(tagFields.map((t) => [t.key, ((item[t.source] as { tag: string }[]) ?? []).map((x) => x.tag)]))); + setLocks(lockedFields); + } + + const save = async () => { + if (!values || !tags) return; + setBusy(true); + try { + const changed: Record = {}; + for (const f of fields) if ((values[f.key] ?? '') !== String(item.raw?.[f.key] ?? '')) changed[f.key] = values[f.key]; + const tagChanges: Record = {}; + for (const t of tagFields) { + const before = ((item[t.source] as { tag: string }[]) ?? []).map((x) => x.tag); + const after = tags[t.key]; + if (before.join('\u0000') !== after.join('\u0000')) tagChanges[t.key] = { add: after, remove: before.filter((b) => !after.includes(b)) }; + } + const lockChanges: Record = {}; + for (const [k, v] of Object.entries(locks)) if (!!lockedFields[k] !== v) lockChanges[k] = v; + for (const k of [...Object.keys(changed), ...Object.keys(tagChanges)]) if (!(k in lockChanges)) lockChanges[k] = true; + if (!Object.keys(changed).length && !Object.keys(tagChanges).length && !Object.keys(lockChanges).length) { + onClose(); + return; + } + await api.editMetadata(server, item, changed, tagChanges, lockChanges); + toast('Metadata saved', 'success'); + invalidateItem(item.id); + invalidateLibrary(); + onClose(); + } catch (e) { + toastError(e); + } finally { + setBusy(false); + } + }; + + return ( + + + Edited fields are locked so metadata refreshes keep them. + +
+ + +
+ + } + > + + {!values || !tags ? ( + + ) : tab === 'general' ? ( +
+ {fields.map((f) => ( +