From 8968560565b3cede82507e3db8f13a51cbddd757 Mon Sep 17 00:00:00 2001 From: drjones Date: Sun, 29 Mar 2026 09:32:55 -0700 Subject: [PATCH] Add PN532 toolkit firmware, web UI, and embedded SPIFFS assets Includes ESP-IDF NFC stack (deep capture, 4K Classic geometry, UL write API, open SoftAP), React dashboard with live tag diagnostics, and docs. README updated for APIs and lab Wi-Fi defaults. Made-with: Cursor --- .gitignore | 7 + README.md | 123 +- docs/FLASHING.md | 34 + docs/LIMITATIONS.md | 9 + docs/PINOUT.md | 22 + docs/WORKFLOWS.md | 28 + firmware/CMakeLists.txt | 5 + .../components/net_service/CMakeLists.txt | 6 + firmware/components/net_service/app_net.c | 908 ++++++ .../net_service/include/net_service/app_net.h | 17 + firmware/components/nfc_engine/CMakeLists.txt | 5 + .../nfc_engine/include/nfc_engine/jobs.h | 26 + .../nfc_engine/include/nfc_engine/nfc_brute.h | 26 + .../nfc_engine/include/nfc_engine/nfc_deep.h | 18 + .../include/nfc_engine/nfc_engine.h | 48 + .../include/nfc_engine/session_capture.h | 35 + firmware/components/nfc_engine/jobs.c | 23 + firmware/components/nfc_engine/nfc_brute.c | 232 ++ firmware/components/nfc_engine/nfc_deep.c | 188 ++ firmware/components/nfc_engine/nfc_engine.c | 255 ++ .../components/nfc_engine/session_capture.c | 129 + firmware/components/pn532_host/CMakeLists.txt | 7 + firmware/components/pn532_host/Kconfig | 84 + .../include/pn532_host/pn532_core.h | 68 + .../include/pn532_host/pn532_transport.h | 28 + firmware/components/pn532_host/pn532_core.c | 114 + .../components/pn532_host/pn532_transport.c | 361 +++ firmware/data/assets/index-EAAhhled.js | 80 + firmware/data/assets/index-hoMg1Qkq.css | 1 + firmware/data/index.html | 20 + firmware/flash.sh | 12 + firmware/main/CMakeLists.txt | 3 + firmware/main/Kconfig.projbuild | 18 + firmware/main/board_rgb_off.c | 37 + firmware/main/board_rgb_off.h | 4 + firmware/main/idf_component.yml | 3 + firmware/main/main.c | 17 + firmware/partitions.csv | 9 + firmware/sdkconfig.defaults | 34 + web/index.html | 19 + web/package-lock.json | 2757 +++++++++++++++++ web/package.json | 28 + web/postcss.config.js | 6 + web/scripts/sync-fw-data.mjs | 15 + web/src/App.tsx | 129 + web/src/BrowserLogBar.tsx | 49 + web/src/FlashBackdrop.tsx | 19 + web/src/LabFixtureLoad.tsx | 99 + web/src/NfcWsContext.tsx | 189 ++ web/src/ScanCashFlourish.tsx | 234 ++ web/src/api.ts | 62 + web/src/index.css | 127 + web/src/main.tsx | 22 + web/src/nfcUtils.ts | 85 + web/src/pages/Brute.tsx | 113 + web/src/pages/Capture.tsx | 168 + web/src/pages/Dashboard.tsx | 234 ++ web/src/pages/Emulate.tsx | 74 + web/src/pages/KeyLab.tsx | 203 ++ web/src/pages/Keys.tsx | 137 + web/src/pages/Library.tsx | 133 + web/src/pages/RawConsole.tsx | 77 + web/src/pages/ReadAnalyze.tsx | 117 + web/src/pages/Settings.tsx | 55 + web/src/pages/WriteClone.tsx | 153 + web/src/toast.tsx | 52 + web/src/ui/HeroVisual.tsx | 83 + web/src/ui/Panel.tsx | 44 + web/src/useWebSocket.ts | 58 + web/src/validationFixtures.ts | 137 + web/tailwind.config.js | 81 + web/tsconfig.json | 16 + web/vite.config.ts | 11 + 73 files changed, 8802 insertions(+), 28 deletions(-) create mode 100644 .gitignore create mode 100644 docs/FLASHING.md create mode 100644 docs/LIMITATIONS.md create mode 100644 docs/PINOUT.md create mode 100644 docs/WORKFLOWS.md create mode 100644 firmware/CMakeLists.txt create mode 100644 firmware/components/net_service/CMakeLists.txt create mode 100644 firmware/components/net_service/app_net.c create mode 100644 firmware/components/net_service/include/net_service/app_net.h create mode 100644 firmware/components/nfc_engine/CMakeLists.txt create mode 100644 firmware/components/nfc_engine/include/nfc_engine/jobs.h create mode 100644 firmware/components/nfc_engine/include/nfc_engine/nfc_brute.h create mode 100644 firmware/components/nfc_engine/include/nfc_engine/nfc_deep.h create mode 100644 firmware/components/nfc_engine/include/nfc_engine/nfc_engine.h create mode 100644 firmware/components/nfc_engine/include/nfc_engine/session_capture.h create mode 100644 firmware/components/nfc_engine/jobs.c create mode 100644 firmware/components/nfc_engine/nfc_brute.c create mode 100644 firmware/components/nfc_engine/nfc_deep.c create mode 100644 firmware/components/nfc_engine/nfc_engine.c create mode 100644 firmware/components/nfc_engine/session_capture.c create mode 100644 firmware/components/pn532_host/CMakeLists.txt create mode 100644 firmware/components/pn532_host/Kconfig create mode 100644 firmware/components/pn532_host/include/pn532_host/pn532_core.h create mode 100644 firmware/components/pn532_host/include/pn532_host/pn532_transport.h create mode 100644 firmware/components/pn532_host/pn532_core.c create mode 100644 firmware/components/pn532_host/pn532_transport.c create mode 100644 firmware/data/assets/index-EAAhhled.js create mode 100644 firmware/data/assets/index-hoMg1Qkq.css create mode 100644 firmware/data/index.html create mode 100755 firmware/flash.sh create mode 100644 firmware/main/CMakeLists.txt create mode 100644 firmware/main/Kconfig.projbuild create mode 100644 firmware/main/board_rgb_off.c create mode 100644 firmware/main/board_rgb_off.h create mode 100644 firmware/main/idf_component.yml create mode 100644 firmware/main/main.c create mode 100644 firmware/partitions.csv create mode 100644 firmware/sdkconfig.defaults create mode 100644 web/index.html create mode 100644 web/package-lock.json create mode 100644 web/package.json create mode 100644 web/postcss.config.js create mode 100644 web/scripts/sync-fw-data.mjs create mode 100644 web/src/App.tsx create mode 100644 web/src/BrowserLogBar.tsx create mode 100644 web/src/FlashBackdrop.tsx create mode 100644 web/src/LabFixtureLoad.tsx create mode 100644 web/src/NfcWsContext.tsx create mode 100644 web/src/ScanCashFlourish.tsx create mode 100644 web/src/api.ts create mode 100644 web/src/index.css create mode 100644 web/src/main.tsx create mode 100644 web/src/nfcUtils.ts create mode 100644 web/src/pages/Brute.tsx create mode 100644 web/src/pages/Capture.tsx create mode 100644 web/src/pages/Dashboard.tsx create mode 100644 web/src/pages/Emulate.tsx create mode 100644 web/src/pages/KeyLab.tsx create mode 100644 web/src/pages/Keys.tsx create mode 100644 web/src/pages/Library.tsx create mode 100644 web/src/pages/RawConsole.tsx create mode 100644 web/src/pages/ReadAnalyze.tsx create mode 100644 web/src/pages/Settings.tsx create mode 100644 web/src/pages/WriteClone.tsx create mode 100644 web/src/toast.tsx create mode 100644 web/src/ui/HeroVisual.tsx create mode 100644 web/src/ui/Panel.tsx create mode 100644 web/src/useWebSocket.ts create mode 100644 web/src/validationFixtures.ts create mode 100644 web/tailwind.config.js create mode 100644 web/tsconfig.json create mode 100644 web/vite.config.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dda2f09 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +firmware/build/ +firmware/sdkconfig +firmware/sdkconfig.old +firmware/managed_components/ +web/node_modules/ +web/dist/ +.DS_Store diff --git a/README.md b/README.md index 6348af5..91638a6 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,73 @@ -# PN532 NFC Toolkit (ESP32-S3) +# PN532 NFC Toolkit -Production-style firmware and embedded web UI for **PN532** NFC controllers attached to **ESP32-S3** (and other ESP32-class targets with minor config tweaks). +**The browser-native NFC lab that fits in your pocket.** +ESP32-S3 + PN532 + a serious web UI — no desktop app, no dongle software, no mystery binaries. You join Wi‑Fi, open a URL, and you’re operating the reader from **any phone or laptop**. -## Features +--- -- **Wi-Fi AP** default: SSID `PN532-Toolkit`, password `nfc-toolkit`, URL [http://192.168.4.1](http://192.168.4.1) -- **mDNS** hostname `pn532tool.local` (HTTP port 80) -- **REST API**: poll tags, MIFARE Classic read/write, Ultralight page read, PN532 general status, raw command injection, OTA stub (`501` — extend with `esp_https_ota`) -- **WebSocket** `/ws`: continuous tag presence stream when enabled from the UI -- **Web UI** (Vite + React + Tailwind + Framer Motion): dashboard, read/analyze, write helpers, local tag library, key dictionary, raw console, settings +## Why this is the best tool for PN532 workflows -## Build — Web UI +1. **Full remote control in the browser** — Dashboard, live scan, deep capture, read/write helpers, raw PN532 frames, and status — all over HTTP + WebSocket. You can stand across the room with your phone while the hardware sits on the bench. + +2. **“Deep capture” is actually deep (for a PN532)** — On each new tag we don’t stop at UID: we pull **PN532 general status bytes**, **full inventory (ATQA/SAK/UID)**, then either a **MIFARE Classic sector sweep** (default key set, Key A and Key B per sector trailer) with **every readable block as hex**, or an **Ultralight/NTAG-style page sweep** until the tag stops responding. Unknown SAKs still get inventory + controller status so nothing is silently dropped. + +3. **RAM session buffer with hard stop + phone download** — Captures are stored in **on-chip RAM** (default **48 KB** of NDJSON lines). When the buffer is full, **RF polling pauses** so you never lose data to silent overflow. You tap **Download NDJSON** on your phone, get a single file with every profile, then **Clear** to resume. That workflow is purpose-built for field audits and clone/research sessions. + +4. **Self-hosted on the device** — Default **open SoftAP** SSID `PN532-Toolkit` (no password, lab default), **mDNS** `pn532tool.local`. No cloud, no account, no telemetry. + +5. **Honest architecture** — ESP-IDF, explicit components (`pn532_host`, `nfc_engine`, `net_service`), embedded Vite/React UI flashed to SPIFFS. You can extend it like real firmware, not a black-box sketch. + +6. **Raw frame escape hatch** — When the high-level UI isn’t enough, hit **Raw** and send PN532 command bytes (frame wrapper handled in firmware). That’s how you stay aligned with the real chip, not a toy abstraction. + +This stack is **not** a Proxmark replacement (no LF, no raw carrier manipulation). For **hosted NFC with PN532**, it’s built to be the **most complete pocket operator**: remote UI, deep reads, session export, and a path to grow. + +--- + +## Remote deep capture (how to use it) + +1. **Power on** → firmware starts **continuous scan** automatically (you can still toggle it on the Dashboard). +2. **Read-all** (Capture page) → enable **passive read-all** (`POST /api/session/deep`) when you want automatic full dumps per new tag into device RAM. +3. Present tags; each **new UID** appends one **NDJSON** line: full deep profile JSON. +4. When the **progress bar hits the end**, scanning **pauses** automatically. +5. Tap **Download NDJSON** on your phone (or laptop) — browser saves `pn532-deep-capture-*.ndjson`. +6. Tap **Clear buffer** to free RAM and **resume** scanning. + +API (for automation): + +| Method | Path | Purpose | +|--------|------|---------| +| `GET` | `/api/status` | Includes `session.usedBytes`, `maxBytes`, `lines`, `full`, `deepCapture` | +| `POST` | `/api/session/deep` | Body `{"enable":true}` — toggle deep capture | +| `GET` | `/api/session/export` | Attachment: all captured lines | +| `POST` | `/api/session/clear` | Wipe buffer, clear `full` | + +WebSocket `/ws`: channels `scan` (inventory) and `capture` (recorded / bufferFull events). + +### Browser memory log (nothing missed in the UI) + +The SPA keeps the **last 5 000** WebSocket events in **sessionStorage** (scan + capture + anything else the firmware pushes). Use the top bar **Download log JSON** to save a pretty file on your phone or PC without touching device RAM. Clear the log separately from the device capture buffer. + +### “Maximum sensitivity” (firmware) + +On init the PN532 is configured for **high passive-activation retries** (`RFConfiguration` 0x05), and the poll loop runs at **~65 ms** when not doing deep capture — weak coupling / marginal tags get more chances to answer. + +### Dictionary “brute” (Classic) + +**Brute** page → pick **Classic 1K / 4K map**, optional **variations**, paste extra keys. Firmware runs **`POST /api/mifare/dictionary-attack`**: built-in **public default keys** (subset of community lists such as the [Proxmark3 mfc_default_keys.dic](https://github.com/RfidResearchGroup/proxmark3/blob/master/client/dictionaries/mfc_default_keys.dic)) plus your lines, Key **A** then **B** per sector trailer. **Variations** add bounded XOR / nibble tweaks — **not** a full 2⁴⁸ keyspace search. You will **not** magically open every door; you will systematically try keys people actually leak online. ### Emulation + +**Emulate** sends raw **`TgInitAsTarget` (0x8C)** payloads via **`POST /api/nfc/emulate-raw`**. You are responsible for correct bytes (NXP UM0701). This is **experimental**; bad sequences can require a power cycle. + +| Method | Path | Purpose | +|--------|------|---------| +| `POST` | `/api/mifare/dictionary-attack` | Body: `readerType`, `variations`, optional `keysHex[]` | +| `POST` | `/api/nfc/emulate-raw` | Body: `{ "hex": "8C..." }` | +| `POST` | `/api/ul/write-page` | Body: `{ "page": 4, "data": "AABBCCDD" }` (8 hex) | + +--- + +## Build + +### Web UI → flash image ```bash cd web @@ -18,37 +75,47 @@ npm install npm run build:fw ``` -This compiles the SPA and copies `dist/*` into `firmware/data/` for SPIFFS embedding. - -## Build — Firmware (ESP-IDF 5.x) +### Firmware (ESP-IDF 5.x) ```bash cd firmware idf.py set-target esp32s3 -idf.py menuconfig # PN532 Host → SPI / I2C / UART pins (Kconfig) +idf.py menuconfig # PN532 Host: SPI / I2C / UART + pins idf.py build flash monitor ``` -Partition table targets a **8MB** flash module (adjust `partitions.csv` + `sdkconfig` for 4MB/16MB). +See [docs/FLASHING.md](docs/FLASHING.md) and [docs/PINOUT.md](docs/PINOUT.md). -## Hardware / Kconfig +--- -Open **Component config → PN532 Host** in `menuconfig`: +## 9 meaningful upgrades we don’t have yet (roadmap) -- **SPI** (default): MOSI / MISO / SCLK / CS + clock Hz (start **100 kHz** if unstable) -- **I2C**: SDA / SCL, **7-bit address `0x24`** (left-shifted to `0x48` on the wire) -- **UART (HSU)**: TX/RX, **115200** +1. **FeliCa / Type B surfaces** — More first-class UI for non–Type A paths the PN532 can speak. -Refer to [docs/PINOUT.md](docs/PINOUT.md) for ESP32-S3-DevKitC-1 wiring notes. +2. **Configurable RAM budget + optional PSRAM** — Compile-time or NVS `maxBytes`, and external SPIRAM for **multi‑hundred‑KB** sessions on N8R8 modules. -## Repository layout +3. **Chunked / resumable export** — HTTP range or multipart export so **multi‑MB** captures don’t require one giant `httpd_resp_send`. -| Path | Purpose | -|------|---------| -| `firmware/` | ESP-IDF project, `components/pn532_host`, `nfc_engine`, `net_service` | -| `web/` | SPA source | -| `docs/` | Flashing, workflows, limitations | +4. **User-supplied key dictionary on device** — Upload common keys file to flash and run **automatic sector retries** without typing keys in the UI. -## Legal / ethics +5. **NDEF record editor** — Parse TLV/NDEF in the browser, edit records, write back through page/block APIs with lock-byte warnings. -Use only on tags and systems you own or are explicitly authorized to test. +6. **ISO14443-4 / Type B automation** — Higher-layer APDU helpers where PN532 allows; clearer UI for “Type A only” vs “RATS/PPS” paths. + +7. **Wi-Fi STA onboarding** — Captive portal or dedicated SSID scan + save credentials to NVS (today defaults to AP). + +8. **Real OTA from the UI** — Replace `501` stub with signed `esp_https_ota` + rollback partition sanity checks. + +9. **Installable PWA + richer diagnostics** — `manifest.json`, icons, `theme-color`, and UI for **error histograms / timing** from the PN532 status path. + +10. **Magic UID / Gen2** — Not exposed; PN532 is a legitimate reader/writer, not a UID-spoofing modem. + +--- + +## Repo layout + +| Path | Role | +|------|------| +| `firmware/` | ESP-IDF: PN532 transport, NFC engine, **session RAM buffer**, **deep profile**, HTTP/WS | +| `web/` | React UI: Dashboard, **Capture**, Read/Write, Library, Keys, Raw, Settings | +| `docs/` | Flashing, pinout, workflows, limitations | diff --git a/docs/FLASHING.md b/docs/FLASHING.md new file mode 100644 index 0000000..6f59f2a --- /dev/null +++ b/docs/FLASHING.md @@ -0,0 +1,34 @@ +# Flashing + +## Prerequisites + +- [ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/latest/esp-idf-en-latest-esp32s3/esp32s3/get-started-esp32s3.html) **v5.x** installed and exported (`get_idf`) +- USB cable to the DevKit **USB** port (USB‑JTAG / serial) +- PN532 module wired per [PINOUT.md](PINOUT.md) + +## Steps + +1. Build the web assets (embeds into SPIFFS): + + ```bash + cd web && npm install && npm run build:fw + ``` + +2. Configure & flash: + + ```bash + cd firmware + idf.py set-target esp32s3 + idf.py menuconfig # set PN532 transport + GPIOs + idf.py build flash monitor + ``` + +3. Connect to AP **PN532-Toolkit** / **nfc-toolkit**, browse to **http://192.168.4.1** or **http://pn532tool.local**. + +## SPIFFS / UI missing? + +If `firmware/data/` is empty, the device serves a placeholder HTML. Always run `npm run build:fw` before `idf.py build` if you changed the UI. + +## Flash size + +`partitions.csv` assumes **8MB** flash. For **4MB**, shrink `factory` / OTA / `storage` regions and disable dual OTA if needed. diff --git a/docs/LIMITATIONS.md b/docs/LIMITATIONS.md new file mode 100644 index 0000000..5de3021 --- /dev/null +++ b/docs/LIMITATIONS.md @@ -0,0 +1,9 @@ +# Capabilities & limitations + +The PN532 is a **hosted NFC controller**, not a low-level RF lab instrument. This project exposes PN532 features honestly: + +- **ISO14443-B**: reader support exists with **chip-level caveats** (anticollision / stack-dependent behavior). No promises of full mobile/PICC coverage. +- **Card emulation / TG modes**: PN532 firmware supports target commands; real-world mimicry depends on timing, UID size, and reader expectations — expose experimentally, not as “propable MIFARE magic.” +- **Key recovery**: on-device “brute force” at Proxmark scale is **infeasible**. The UI provides **dictionary / manual** key workflows. +- **Signal / RF metrics**: diagnostics use **PN532 status / timings / retries**, not calibrated dBm. +- **OTA via UI**: `POST /api/ota` is a **stub** (`501`) — ship OTA with `esp_https_ota` + signed images when you need production updates. diff --git a/docs/PINOUT.md b/docs/PINOUT.md new file mode 100644 index 0000000..28b09b2 --- /dev/null +++ b/docs/PINOUT.md @@ -0,0 +1,22 @@ +# Pinout notes (ESP32-S3-DevKitC-1) + +Strapping and USB pins differ by revision — **avoid** GPIO `19–20` for PN532 when using USB-Serial/JTAG on many boards. Prefer **SPI2** on free GPIOs from the [DevKitC-1 user guide](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-devkitc-1/user_guide_v1.1.html). + +## Kconfig defaults (examples only) + +The firmware Kconfig ships **example** GPIOs: + +- **SPI**: MOSI `11`, MISO `13`, SCLK `12`, CS `10` +- **I2C**: SDA `8`, SCL `9` + +**You must verify** these against your PCB/breadboard and PN532 breakout (Adafruit / Elechouse / clones often label SPI and I2C jumpers). + +## PN532 wiring checklist + +- **SPI**: connect `RSTO`/`RST` to MCU if exposed; some breakouts auto-reset via I2C/SPI activity. +- **I2C**: set address pins per module (usually **0x24** 7‑bit). +- **Power**: **3.3V** logic on ESP32; ensure PN532 module is 3.3V compliant (level-shift if using a 5V Arduino-style shield). + +## Transport selection + +Start with the bus your breakout is jumpered for — **I2C is often simplest** on ESP32 for bring-up; SPI may require **lower clock** initially (e.g. **100 kHz**). diff --git a/docs/WORKFLOWS.md b/docs/WORKFLOWS.md new file mode 100644 index 0000000..c56b4d5 --- /dev/null +++ b/docs/WORKFLOWS.md @@ -0,0 +1,28 @@ +# Example workflows + +## 1. Read a MIFARE Classic sector + +1. Dashboard → **Poll once** to verify presence and UID. +2. **Read** tab → enter default key (e.g. `FFFFFFFFFFFF`), block number, **MIFARE read block**. +3. Copy hex → save to **Library** (local browser). + +## 2. Write a known-good block + +1. Authenticate with a key that still allows write on that sector. +2. **Write** tab → paste **32 hex chars** (16 bytes) → confirm dialog. +3. Re-read the block to verify. + +## 3. Ultralight / NTAG pages + +1. Use **Read** → **Ultralight read page** with page index (start at `0` for UID/lock pages per datasheet — exercise caution on OTP/lock bytes). + +## 4. Raw PN532 frames + +1. **Raw** tab → send e.g. `4A0100` (`InListPassiveTarget`, 1 target, 106 kbps Type A). +2. Interpret response bytes per NXP **UM0701** / PN532 user manual. + +## 5. Continuous scan to WebSocket consumers + +1. Dashboard → **Start live scan**. +2. Connect a WebSocket client to `ws://192.168.4.1/ws` (or `ws://pn532tool.local/ws`). +3. Messages look like: `{"channel":"scan","payload":{...}}` diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt new file mode 100644 index 0000000..56b453c --- /dev/null +++ b/firmware/CMakeLists.txt @@ -0,0 +1,5 @@ +# PN532 NFC Toolkit — ESP-IDF root +cmake_minimum_required(VERSION 3.16) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(pn532_nfc_toolkit) diff --git a/firmware/components/net_service/CMakeLists.txt b/firmware/components/net_service/CMakeLists.txt new file mode 100644 index 0000000..b5d345d --- /dev/null +++ b/firmware/components/net_service/CMakeLists.txt @@ -0,0 +1,6 @@ +idf_component_register( + SRCS "app_net.c" + INCLUDE_DIRS "include" + REQUIRES esp_http_server http_parser esp_wifi esp_netif nvs_flash mdns esp_timer + json spiffs vfs freertos nfc_engine pn532_host +) diff --git a/firmware/components/net_service/app_net.c b/firmware/components/net_service/app_net.c new file mode 100644 index 0000000..b3a58b2 --- /dev/null +++ b/firmware/components/net_service/app_net.c @@ -0,0 +1,908 @@ +#include "net_service/app_net.h" +#include "esp_log.h" +#include "esp_system.h" +#include "esp_http_server.h" +#include "esp_netif.h" +#include "esp_spiffs.h" +#include "esp_timer.h" +#include "esp_wifi.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "mdns.h" +#include "nfc_engine/nfc_brute.h" +#include "nfc_engine/nfc_deep.h" +#include "nfc_engine/nfc_engine.h" +#include "nfc_engine/session_capture.h" +#include "nvs_flash.h" +#include "pn532_host/pn532_core.h" +#include "cJSON.h" +#include "http_parser.h" +#include +#include +#include +#include +#include + +static const char *TAG = "app_net"; + +/* SoftAP: open network (no password) for lab / fastest join. Change SSID here if you want. */ +#define SOFTAP_SSID "PN532-Toolkit" + +#define MAX_JSON 4096 +#define WS_BROADCAST_BUF 4096 + +static httpd_handle_t s_server; +static bool s_scan = true; +static TaskHandle_t s_scan_task; + +static int hexval(char c) +{ + if (c >= '0' && c <= '9') { + return c - '0'; + } + if (c >= 'a' && c <= 'f') { + return 10 + c - 'a'; + } + if (c >= 'A' && c <= 'F') { + return 10 + c - 'A'; + } + return -1; +} + +static bool hex_to_bin(const char *hex, uint8_t *out, size_t out_len) +{ + size_t n = strlen(hex); + if (n != out_len * 2) { + return false; + } + for (size_t i = 0; i < out_len; i++) { + int h = hexval(hex[i * 2]); + int l = hexval(hex[i * 2 + 1]); + if (h < 0 || l < 0) { + return false; + } + out[i] = (uint8_t)((h << 4) | l); + } + return true; +} + +static bool hex_decode_flex(const char *hex, uint8_t *out, size_t out_cap, size_t *out_len) +{ + size_t n = strlen(hex); + if (n % 2 || n / 2 > out_cap) { + return false; + } + *out_len = n / 2; + return hex_to_bin(hex, out, *out_len); +} + +/** Read full POST body (httpd may return partial data in multiple recv calls). */ +static int recv_body_capped(httpd_req_t *req, char *buf, size_t cap) +{ + if (!buf || cap < 2) { + return -1; + } + size_t cl = req->content_len; + if (cl >= cap) { + return -1; + } + if (cl == 0) { + buf[0] = '\0'; + return 0; + } + size_t got = 0; + while (got < cl) { + int r = httpd_req_recv(req, buf + got, cl - got); + if (r <= 0) { + return -1; + } + got += (size_t)r; + } + buf[got] = '\0'; + return (int)got; +} + +static char *recv_body_alloc(httpd_req_t *req, size_t max_len, int *out_len) +{ + size_t cl = req->content_len; + if (cl == 0 || cl > max_len) { + return NULL; + } + char *buf = malloc(cl + 1); + if (!buf) { + return NULL; + } + size_t got = 0; + while (got < cl) { + int r = httpd_req_recv(req, buf + got, cl - got); + if (r <= 0) { + free(buf); + return NULL; + } + got += (size_t)r; + } + buf[cl] = '\0'; + if (out_len) { + *out_len = (int)cl; + } + return buf; +} + +esp_err_t app_net_broadcast_json(const char *channel, const char *json_text) +{ + (void)channel; + if (!s_server || !json_text) { + return ESP_ERR_INVALID_STATE; + } + char line[WS_BROADCAST_BUF]; + int n = snprintf(line, sizeof(line), "{\"channel\":\"%s\",\"payload\":%s}", channel ? channel : "event", + json_text); + if (n < 0 || n >= (int)sizeof(line)) { + return ESP_ERR_NO_MEM; + } + int fds[16]; + size_t fdcount = sizeof(fds) / sizeof(fds[0]); + esp_err_t er = httpd_get_client_list(s_server, &fdcount, fds); + if (er != ESP_OK) { + return er; + } + httpd_ws_frame_t pkt = {.type = HTTPD_WS_TYPE_TEXT, .payload = (uint8_t *)line, .len = (size_t)n}; + for (size_t i = 0; i < fdcount; i++) { + if (httpd_ws_get_fd_info(s_server, fds[i]) == HTTPD_WS_CLIENT_WEBSOCKET) { + (void)httpd_ws_send_frame_async(s_server, fds[i], &pkt); + } + } + return ESP_OK; +} + +static esp_err_t send_json(httpd_req_t *req, cJSON *j, int status) +{ + char *p = cJSON_PrintUnformatted(j); + cJSON_Delete(j); + if (!p) { + return ESP_ERR_NO_MEM; + } + httpd_resp_set_type(req, "application/json"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Methods", "GET, POST, OPTIONS"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Headers", "Content-Type"); + httpd_resp_set_status(req, status == 200 ? "200 OK" : "400 Bad Request"); + esp_err_t e = httpd_resp_send(req, p, HTTPD_RESP_USE_STRLEN); + free(p); + return e; +} + +static esp_err_t api_status(httpd_req_t *req) +{ + cJSON *o = cJSON_CreateObject(); + cJSON_AddStringToObject(o, "app", "pn532_nfc_toolkit"); + cJSON_AddNumberToObject(o, "uptimeMs", (double)(esp_timer_get_time() / 1000)); + cJSON_AddNumberToObject(o, "freeHeap", (double)esp_get_free_heap_size()); + wifi_mode_t mode; + esp_wifi_get_mode(&mode); + cJSON_AddNumberToObject(o, "wifiMode", mode); + uint8_t ic = 0, hi = 0, lo = 0; + if (pn532_get_firmware_version(&ic, &hi, &lo) == ESP_OK) { + cJSON *pn = cJSON_CreateObject(); + cJSON_AddNumberToObject(pn, "ic", ic); + cJSON_AddNumberToObject(pn, "fwHi", hi); + cJSON_AddNumberToObject(pn, "fwLo", lo); + cJSON_AddItemToObject(o, "pn532", pn); + } + cJSON_AddBoolToObject(o, "scanning", s_scan); + size_t cap_u = 0; + uint32_t cap_l = 0; + bool cap_f = false; + session_capture_get_status(&cap_u, &cap_l, &cap_f); + cJSON *cap = cJSON_CreateObject(); + cJSON_AddNumberToObject(cap, "usedBytes", (double)cap_u); + cJSON_AddNumberToObject(cap, "maxBytes", (double)session_capture_max()); + cJSON_AddNumberToObject(cap, "lines", (double)cap_l); + cJSON_AddBoolToObject(cap, "full", cap_f); + cJSON_AddBoolToObject(cap, "deepCapture", session_capture_deep_enabled()); + cJSON_AddItemToObject(o, "session", cap); + return send_json(req, o, 200); +} + +static void tag_uid_hex(const nfc_tag_info_t *tag, char *out, size_t out_sz) +{ + if (!out || out_sz == 0) { + return; + } + out[0] = 0; + size_t p = 0; + for (int i = 0; i < tag->uid_len && p + 2 < out_sz; i++) { + p += (size_t)snprintf(out + p, out_sz - p, "%02X", tag->uid[i]); + } +} + +static esp_err_t api_session_export(httpd_req_t *req) +{ + size_t n = session_capture_export_size(); + if (n == 0) { + httpd_resp_set_type(req, "text/plain"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + return httpd_resp_send(req, "empty", HTTPD_RESP_USE_STRLEN); + } + char *buf = malloc(n); + if (!buf) { + return send_json(req, cJSON_CreateString("out of memory"), 400); + } + size_t got = 0; + session_capture_copy_to(buf, n, &got); + httpd_resp_set_type(req, "application/x-ndjson"); + httpd_resp_set_hdr(req, "Content-Disposition", "attachment; filename=\"pn532-deep-capture.ndjson\""); + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + esp_err_t er = httpd_resp_send(req, buf, got); + free(buf); + return er; +} + +static esp_err_t api_session_clear(httpd_req_t *req) +{ + char drain[128]; + (void)recv_body_capped(req, drain, sizeof(drain)); + session_capture_clear(); + cJSON *o = cJSON_CreateObject(); + cJSON_AddBoolToObject(o, "ok", true); + return send_json(req, o, 200); +} + +static esp_err_t api_session_deep(httpd_req_t *req) +{ + char buf[128]; + int r = recv_body_capped(req, buf, sizeof(buf)); + if (r < 0) { + return send_json(req, cJSON_CreateString("body required or too large"), 400); + } + cJSON *j = cJSON_Parse(buf); + if (!j) { + return send_json(req, cJSON_CreateString("bad json"), 400); + } + cJSON *en = cJSON_GetObjectItem(j, "enable"); + if (cJSON_IsBool(en)) { + session_capture_set_deep(cJSON_IsTrue(en)); + } + cJSON_Delete(j); + cJSON *o = cJSON_CreateObject(); + cJSON_AddBoolToObject(o, "deepCapture", session_capture_deep_enabled()); + return send_json(req, o, 200); +} + +static esp_err_t api_nfc_poll(httpd_req_t *req) +{ + char drain[128]; + (void)recv_body_capped(req, drain, sizeof(drain)); + + nfc_tag_info_t tag; + esp_err_t e = nfc_poll_passive_target(&tag); + if (e == ESP_ERR_NOT_FOUND) { + cJSON *o = cJSON_CreateObject(); + cJSON_AddBoolToObject(o, "present", false); + return send_json(req, o, 200); + } + if (e != ESP_OK) { + cJSON *o = cJSON_CreateObject(); + cJSON_AddStringToObject(o, "error", esp_err_to_name(e)); + return send_json(req, o, 400); + } + cJSON *o = cJSON_CreateObject(); + cJSON_AddBoolToObject(o, "present", true); + cJSON_AddItemToObject(o, "tag", nfc_tag_to_json(&tag)); + return send_json(req, o, 200); +} + +static esp_err_t api_scan(httpd_req_t *req) +{ + char buf[128]; + int r = recv_body_capped(req, buf, sizeof(buf)); + if (r < 0) { + return send_json(req, cJSON_CreateString("no body or too large"), 400); + } + cJSON *j = cJSON_Parse(buf); + if (!j) { + return send_json(req, cJSON_CreateString("bad json"), 400); + } + cJSON *en = cJSON_GetObjectItem(j, "enable"); + if (cJSON_IsBool(en)) { + app_net_set_continuous_scan(cJSON_IsTrue(en)); + } + cJSON_Delete(j); + cJSON *o = cJSON_CreateObject(); + cJSON_AddBoolToObject(o, "enable", s_scan); + return send_json(req, o, 200); +} + +static esp_err_t api_general_status(httpd_req_t *req) +{ + uint8_t gs[32]; + size_t gl = 0; + esp_err_t e = pn532_get_general_status(gs, sizeof(gs), &gl); + if (e != ESP_OK) { + cJSON *o = cJSON_CreateObject(); + cJSON_AddStringToObject(o, "error", esp_err_to_name(e)); + return send_json(req, o, 400); + } + cJSON *o = cJSON_CreateObject(); + cJSON *arr = cJSON_CreateArray(); + for (size_t i = 0; i < gl; i++) { + cJSON_AddItemToArray(arr, cJSON_CreateNumber(gs[i])); + } + cJSON_AddItemToObject(o, "raw", arr); + return send_json(req, o, 200); +} + +static esp_err_t api_mifare_read(httpd_req_t *req) +{ + char buf[512]; + int r = recv_body_capped(req, buf, sizeof(buf)); + if (r < 0) { + return send_json(req, cJSON_CreateString("no body or too large"), 400); + } + cJSON *j = cJSON_Parse(buf); + if (!j) { + return send_json(req, cJSON_CreateString("bad json"), 400); + } + cJSON *jbk = cJSON_GetObjectItem(j, "block"); + cJSON *jk = cJSON_GetObjectItem(j, "key"); + int block = cJSON_IsNumber(jbk) ? (int)cJSON_GetNumberValue(jbk) : -1; + const char *key_hex = cJSON_IsString(jk) ? jk->valuestring : NULL; + cJSON *jb = cJSON_GetObjectItem(j, "keyB"); + bool key_b = cJSON_IsTrue(jb); + cJSON_Delete(j); + if (block < 0 || !key_hex) { + return send_json(req, cJSON_CreateString("block/key required"), 400); + } + uint8_t keyb[6]; + if (!hex_to_bin(key_hex, keyb, 6)) { + return send_json(req, cJSON_CreateString("key must be 12 hex chars"), 400); + } + nfc_tag_info_t tag; + if (nfc_poll_passive_target(&tag) != ESP_OK) { + return send_json(req, cJSON_CreateString("no tag"), 400); + } + nfc_mifare_key_t k = {.key_b = key_b}; + memcpy(k.key, keyb, 6); + if (nfc_mifare_authenticate_block(&tag, (uint8_t)block, &k) != ESP_OK) { + return send_json(req, cJSON_CreateString("auth failed"), 400); + } + uint8_t blk[NFC_BLOCK_LEN]; + if (nfc_mifare_read_block((uint8_t)block, blk) != ESP_OK) { + return send_json(req, cJSON_CreateString("read failed"), 400); + } + char hexout[NFC_BLOCK_LEN * 2 + 1]; + for (int i = 0; i < NFC_BLOCK_LEN; i++) { + snprintf(hexout + i * 2, 3, "%02X", blk[i]); + } + cJSON *o = cJSON_CreateObject(); + cJSON_AddNumberToObject(o, "block", block); + cJSON_AddStringToObject(o, "data", hexout); + return send_json(req, o, 200); +} + +static esp_err_t api_mifare_write(httpd_req_t *req) +{ + char buf[512]; + int r = recv_body_capped(req, buf, sizeof(buf)); + if (r < 0) { + return send_json(req, cJSON_CreateString("no body or too large"), 400); + } + cJSON *j = cJSON_Parse(buf); + if (!j) { + return send_json(req, cJSON_CreateString("bad json"), 400); + } + cJSON *jbk = cJSON_GetObjectItem(j, "block"); + cJSON *jk = cJSON_GetObjectItem(j, "key"); + cJSON *jd = cJSON_GetObjectItem(j, "data"); + int block = cJSON_IsNumber(jbk) ? (int)cJSON_GetNumberValue(jbk) : -1; + const char *key_hex = cJSON_IsString(jk) ? jk->valuestring : NULL; + const char *data_hex = cJSON_IsString(jd) ? jd->valuestring : NULL; + cJSON *jb = cJSON_GetObjectItem(j, "keyB"); + bool key_b = cJSON_IsTrue(jb); + cJSON_Delete(j); + if (block < 0 || !key_hex || !data_hex) { + return send_json(req, cJSON_CreateString("block/key/data required"), 400); + } + uint8_t keyb[6], blk[NFC_BLOCK_LEN]; + if (!hex_to_bin(key_hex, keyb, 6) || !hex_to_bin(data_hex, blk, NFC_BLOCK_LEN)) { + return send_json(req, cJSON_CreateString("bad hex"), 400); + } + nfc_tag_info_t tag; + if (nfc_poll_passive_target(&tag) != ESP_OK) { + return send_json(req, cJSON_CreateString("no tag"), 400); + } + nfc_mifare_key_t k = {.key_b = key_b}; + memcpy(k.key, keyb, 6); + if (nfc_mifare_authenticate_block(&tag, (uint8_t)block, &k) != ESP_OK) { + return send_json(req, cJSON_CreateString("auth failed"), 400); + } + if (nfc_mifare_write_block((uint8_t)block, blk) != ESP_OK) { + return send_json(req, cJSON_CreateString("write failed"), 400); + } + return send_json(req, cJSON_CreateObject(), 200); +} + +static esp_err_t api_ul_read(httpd_req_t *req) +{ + char buf[128]; + int r = recv_body_capped(req, buf, sizeof(buf)); + if (r < 0) { + return send_json(req, cJSON_CreateString("no body or too large"), 400); + } + cJSON *j = cJSON_Parse(buf); + if (!j) { + return send_json(req, cJSON_CreateString("bad json"), 400); + } + cJSON *jp = cJSON_GetObjectItem(j, "page"); + int page = cJSON_IsNumber(jp) ? (int)cJSON_GetNumberValue(jp) : -1; + cJSON_Delete(j); + if (page < 0) { + return send_json(req, cJSON_CreateString("page required"), 400); + } + uint8_t d[4]; + if (nfc_ultralight_read_page((uint8_t)page, d) != ESP_OK) { + return send_json(req, cJSON_CreateString("read failed"), 400); + } + char hx[9]; + snprintf(hx, sizeof hx, "%02X%02X%02X%02X", d[0], d[1], d[2], d[3]); + cJSON *o = cJSON_CreateObject(); + cJSON_AddNumberToObject(o, "page", page); + cJSON_AddStringToObject(o, "data", hx); + return send_json(req, o, 200); +} + +static esp_err_t api_ul_write(httpd_req_t *req) +{ + char buf[128]; + int r = recv_body_capped(req, buf, sizeof(buf)); + if (r < 0) { + return send_json(req, cJSON_CreateString("no body or too large"), 400); + } + cJSON *j = cJSON_Parse(buf); + if (!j) { + return send_json(req, cJSON_CreateString("bad json"), 400); + } + cJSON *jp = cJSON_GetObjectItem(j, "page"); + cJSON *jd = cJSON_GetObjectItem(j, "data"); + int page = cJSON_IsNumber(jp) ? (int)cJSON_GetNumberValue(jp) : -1; + const char *data_hex = cJSON_IsString(jd) ? jd->valuestring : NULL; + cJSON_Delete(j); + if (page < 0 || !data_hex) { + return send_json(req, cJSON_CreateString("page and data (8 hex) required"), 400); + } + uint8_t d[4]; + if (!hex_to_bin(data_hex, d, 4)) { + return send_json(req, cJSON_CreateString("data must be 8 hex chars (4 bytes)"), 400); + } + if (nfc_ultralight_write_page((uint8_t)page, d) != ESP_OK) { + return send_json(req, cJSON_CreateString("write failed"), 400); + } + cJSON *o = cJSON_CreateObject(); + cJSON_AddNumberToObject(o, "page", page); + cJSON_AddBoolToObject(o, "ok", true); + return send_json(req, o, 200); +} + +static esp_err_t api_ota_stub(httpd_req_t *req) +{ + (void)req; + cJSON *o = cJSON_CreateString("Use idf.py app-flash or extend with esp_https_ota + bundle URL"); + char *p = cJSON_PrintUnformatted(o); + cJSON_Delete(o); + if (!p) { + return ESP_ERR_NO_MEM; + } + httpd_resp_set_type(req, "application/json"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + httpd_resp_set_status(req, "501 Not Implemented"); + esp_err_t e = httpd_resp_send(req, p, HTTPD_RESP_USE_STRLEN); + free(p); + return e; +} + +static esp_err_t api_mifare_dictionary_attack(httpd_req_t *req) +{ + char *body = recv_body_alloc(req, 8192, NULL); + if (!body) { + return send_json(req, cJSON_CreateString("no body or too large"), 400); + } + cJSON *j = cJSON_Parse(body); + free(body); + if (!j) { + return send_json(req, cJSON_CreateString("bad json"), 400); + } + cJSON *jr = cJSON_GetObjectItem(j, "readerType"); + const char *rtype = cJSON_IsString(jr) ? jr->valuestring : NULL; + uint8_t s0 = 0; + uint8_t s1 = 15; + cJSON *jf = cJSON_GetObjectItem(j, "sectorFirst"); + cJSON *jl = cJSON_GetObjectItem(j, "sectorLast"); + if (cJSON_IsNumber(jf)) { + s0 = (uint8_t)cJSON_GetNumberValue(jf); + } + if (cJSON_IsNumber(jl)) { + s1 = (uint8_t)cJSON_GetNumberValue(jl); + } else if (rtype && strcmp(rtype, "classic4k") == 0) { + s1 = 39; + } + bool variations = cJSON_IsTrue(cJSON_GetObjectItem(j, "variations")); + uint8_t extra[96 * 6]; + size_t extra_n = 0; + cJSON *keys = cJSON_GetObjectItem(j, "keysHex"); + if (cJSON_IsArray(keys)) { + int n = cJSON_GetArraySize(keys); + for (int i = 0; i < n && extra_n < 96; i++) { + cJSON *it = cJSON_GetArrayItem(keys, i); + if (!cJSON_IsString(it)) { + continue; + } + if (hex_to_bin(it->valuestring, extra + extra_n * 6, 6)) { + extra_n++; + } + } + } + cJSON_Delete(j); + + nfc_tag_info_t tag; + if (nfc_poll_passive_target(&tag) != ESP_OK) { + return send_json(req, cJSON_CreateString("no tag present"), 400); + } + int attempts = 0; + cJSON *out = nfc_mifare_dictionary_attack(&tag, s0, s1, extra_n ? extra : NULL, extra_n, variations, &attempts); + if (!out) { + return send_json(req, cJSON_CreateString("attack failed"), 400); + } + char *p = cJSON_PrintUnformatted(out); + cJSON_Delete(out); + if (!p) { + return send_json(req, cJSON_CreateString("print failed"), 400); + } + httpd_resp_set_type(req, "application/json"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + httpd_resp_set_status(req, "200 OK"); + esp_err_t e = httpd_resp_send(req, p, HTTPD_RESP_USE_STRLEN); + free(p); + return e; +} + +static esp_err_t api_nfc_emulate_raw(httpd_req_t *req) +{ + char buf[1024]; + int r = recv_body_capped(req, buf, sizeof(buf)); + if (r < 0) { + return send_json(req, cJSON_CreateString("no body or too large"), 400); + } + cJSON *j = cJSON_Parse(buf); + if (!j) { + return send_json(req, cJSON_CreateString("bad json"), 400); + } + cJSON *jh = cJSON_GetObjectItem(j, "hex"); + const char *hex = cJSON_IsString(jh) ? jh->valuestring : NULL; + cJSON_Delete(j); + uint8_t bin[260]; + size_t blen = 0; + if (!hex || !hex_decode_flex(hex, bin, sizeof(bin), &blen)) { + return send_json(req, cJSON_CreateString("hex command required"), 400); + } + uint8_t resp[300]; + size_t rlen = 0; + esp_err_t err = pn532_send_cmd(bin, blen, resp, sizeof(resp), &rlen, 800); + if (err != ESP_OK) { + cJSON *o = cJSON_CreateObject(); + cJSON_AddStringToObject(o, "error", esp_err_to_name(err)); + return send_json(req, o, 400); + } + char *rh = calloc(1, rlen * 2 + 1); + for (size_t i = 0; i < rlen; i++) { + snprintf(rh + i * 2, 3, "%02X", resp[i]); + } + cJSON *o = cJSON_CreateObject(); + cJSON_AddStringToObject(o, "response", rh); + free(rh); + return send_json(req, o, 200); +} + +static esp_err_t api_raw_pn532(httpd_req_t *req) +{ + char buf[1024]; + int r = recv_body_capped(req, buf, sizeof(buf)); + if (r < 0) { + return send_json(req, cJSON_CreateString("no body or too large"), 400); + } + cJSON *j = cJSON_Parse(buf); + if (!j) { + return send_json(req, cJSON_CreateString("bad json"), 400); + } + cJSON *jf = cJSON_GetObjectItem(j, "frame"); + const char *hex = cJSON_IsString(jf) ? jf->valuestring : NULL; + cJSON_Delete(j); + size_t blen = 0; + uint8_t bin[260]; + if (!hex || !hex_decode_flex(hex, bin, sizeof(bin), &blen)) { + return send_json(req, cJSON_CreateString("frame hex required, even length, max 260B"), 400); + } + uint8_t resp[300]; + size_t rlen = 0; + esp_err_t e = pn532_send_cmd(bin, blen, resp, sizeof(resp), &rlen, 300); + if (e != ESP_OK) { + cJSON *o = cJSON_CreateObject(); + cJSON_AddStringToObject(o, "error", esp_err_to_name(e)); + return send_json(req, o, 400); + } + char *rh = calloc(1, rlen * 2 + 1); + for (size_t i = 0; i < rlen; i++) { + snprintf(rh + i * 2, 3, "%02X", resp[i]); + } + cJSON *o = cJSON_CreateObject(); + cJSON_AddStringToObject(o, "response", rh); + free(rh); + return send_json(req, o, 200); +} + +static esp_err_t api_cors_preflight(httpd_req_t *req) +{ + (void)req; + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Methods", "GET, POST, OPTIONS"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Headers", "Content-Type"); + httpd_resp_set_hdr(req, "Access-Control-Max-Age", "86400"); + httpd_resp_set_status(req, "204 No Content"); + return httpd_resp_send(req, "", 0); +} + +static esp_err_t static_any(httpd_req_t *req) +{ + if (strcmp(req->uri, "/") == 0) { + httpd_resp_set_hdr(req, "Cache-Control", "no-cache"); + FILE *f = fopen("/spiffs/index.html", "r"); + if (!f) { + httpd_resp_send(req, "

PN532 Toolkit

Build web UI into /data

", HTTPD_RESP_USE_STRLEN); + return ESP_OK; + } + char buf[512]; + size_t n; + httpd_resp_set_type(req, "text/html"); +httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + while ((n = fread(buf, 1, sizeof(buf), f)) > 0) { + if (httpd_resp_send_chunk(req, buf, n) != ESP_OK) { + fclose(f); + return ESP_FAIL; + } + } + fclose(f); + return httpd_resp_send_chunk(req, NULL, 0); + } + if (strstr(req->uri, "..") != NULL) { + httpd_resp_send_err(req, HTTPD_400_BAD_REQUEST, "bad path"); + return ESP_FAIL; + } + char path[96]; + snprintf(path, sizeof path, "/spiffs%s", req->uri); + struct stat st; + if (stat(path, &st) != 0) { + httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, "not found"); + return ESP_FAIL; + } + FILE *f = fopen(path, "r"); + if (!f) { + httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, "not found"); + return ESP_FAIL; + } + if (strstr(req->uri, ".js")) { + httpd_resp_set_type(req, "application/javascript"); +httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + } else if (strstr(req->uri, ".css")) { + httpd_resp_set_type(req, "text/css"); +httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + } + char buf[512]; + size_t n; + while ((n = fread(buf, 1, sizeof(buf), f)) > 0) { + if (httpd_resp_send_chunk(req, buf, n) != ESP_OK) { + fclose(f); + return ESP_FAIL; + } + } + fclose(f); + return httpd_resp_send_chunk(req, NULL, 0); +} + +static esp_err_t ws_handler(httpd_req_t *req) +{ + if (req->method == HTTP_GET) { + ESP_LOGI(TAG, "WS handshake"); + return ESP_OK; + } + httpd_ws_frame_t ws = {.type = HTTPD_WS_TYPE_TEXT}; + uint8_t buf[128]; + ws.payload = buf; + esp_err_t ret = httpd_ws_recv_frame(req, &ws, sizeof(buf)); + if (ret != ESP_OK) { + return ret; + } + if (ws.type == HTTPD_WS_TYPE_TEXT && ws.len < sizeof(buf)) { + buf[ws.len] = 0; + if (strcmp((char *)buf, "ping") == 0) { + ws.type = HTTPD_WS_TYPE_TEXT; + ws.payload = (uint8_t *)"{\"channel\":\"pong\"}"; + ws.len = strlen((char *)ws.payload); + return httpd_ws_send_frame(req, &ws); + } + } + return ESP_OK; +} + +static void scan_loop_task(void *arg) +{ + (void)arg; + nfc_tag_info_t last; + memset(&last, 0, sizeof(last)); + while (1) { + if (!s_scan) { + vTaskDelay(pdMS_TO_TICKS(200)); + continue; + } + if (session_capture_deep_enabled() && session_capture_is_full()) { + vTaskDelay(pdMS_TO_TICKS(400)); + continue; + } + nfc_tag_info_t tag; + esp_err_t e = nfc_poll_passive_target(&tag); + if (e == ESP_OK) { + bool is_new = (last.uid_len != tag.uid_len || memcmp(last.uid, tag.uid, tag.uid_len) != 0); + if (is_new) { + last = tag; + cJSON *j = nfc_tag_to_json(&tag); + char *raw = cJSON_PrintUnformatted(j); + cJSON_Delete(j); + if (raw) { + app_net_broadcast_json("scan", raw); + free(raw); + } + if (session_capture_deep_enabled() && !session_capture_is_full()) { + cJSON *deep = nfc_tag_deep_profile(&tag); + char *line = deep ? cJSON_PrintUnformatted(deep) : NULL; + cJSON_Delete(deep); + if (line) { + if (!session_capture_append_line(line)) { + cJSON *mini = cJSON_CreateObject(); + cJSON_AddStringToObject(mini, "event", "bufferFull"); + cJSON_AddBoolToObject(mini, "paused", true); + char *m = cJSON_PrintUnformatted(mini); + cJSON_Delete(mini); + if (m) { + app_net_broadcast_json("capture", m); + free(m); + } + } else { + size_t u = 0; + uint32_t lc = 0; + bool f = false; + session_capture_get_status(&u, &lc, &f); + char uh[32]; + tag_uid_hex(&tag, uh, sizeof uh); + cJSON *ev = cJSON_CreateObject(); + cJSON_AddStringToObject(ev, "event", "recorded"); + cJSON_AddStringToObject(ev, "uid", uh); + cJSON_AddNumberToObject(ev, "usedBytes", (double)u); + cJSON_AddNumberToObject(ev, "lines", (double)lc); + cJSON_AddBoolToObject(ev, "full", f); + char *es = cJSON_PrintUnformatted(ev); + cJSON_Delete(ev); + if (es) { + app_net_broadcast_json("capture", es); + free(es); + } + } + free(line); + } + } + } + } else { + if (last.uid_len) { + memset(&last, 0, sizeof(last)); + app_net_broadcast_json("scan", "{\"present\":false}"); + } + } + vTaskDelay(pdMS_TO_TICKS(session_capture_deep_enabled() ? 220 : 65)); + } +} + +void app_net_set_continuous_scan(bool on) { s_scan = on; } + +bool app_net_continuous_scan(void) { return s_scan; } + +static httpd_handle_t start_server(void) +{ + httpd_config_t cfg = HTTPD_DEFAULT_CONFIG(); + cfg.lru_purge_enable = true; + cfg.max_uri_handlers = 48; + cfg.stack_size = 8192; + httpd_handle_t s = NULL; + if (httpd_start(&s, &cfg) != ESP_OK) { + return NULL; + } + + httpd_uri_t u = {.uri = "/*", .method = HTTP_OPTIONS, .handler = api_cors_preflight}; + httpd_register_uri_handler(s, &u); + + u = (httpd_uri_t){.uri = "/api/status", .method = HTTP_GET, .handler = api_status}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/nfc/poll", .method = HTTP_POST, .handler = api_nfc_poll}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/nfc/scan", .method = HTTP_POST, .handler = api_scan}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/pn532/general-status", .method = HTTP_GET, .handler = api_general_status}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/mifare/read-block", .method = HTTP_POST, .handler = api_mifare_read}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/mifare/write-block", .method = HTTP_POST, .handler = api_mifare_write}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/ul/read-page", .method = HTTP_POST, .handler = api_ul_read}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/ul/write-page", .method = HTTP_POST, .handler = api_ul_write}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/raw/pn532", .method = HTTP_POST, .handler = api_raw_pn532}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/ota", .method = HTTP_POST, .handler = api_ota_stub}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/session/export", .method = HTTP_GET, .handler = api_session_export}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/session/clear", .method = HTTP_POST, .handler = api_session_clear}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/session/deep", .method = HTTP_POST, .handler = api_session_deep}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/mifare/dictionary-attack", .method = HTTP_POST, + .handler = api_mifare_dictionary_attack}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/api/nfc/emulate-raw", .method = HTTP_POST, .handler = api_nfc_emulate_raw}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/ws", .method = HTTP_GET, .handler = ws_handler, .is_websocket = true}; + httpd_register_uri_handler(s, &u); + u = (httpd_uri_t){.uri = "/*", .method = HTTP_GET, .handler = static_any}; + httpd_register_uri_handler(s, &u); + + return s; +} + +esp_err_t app_net_init(void) +{ + ESP_ERROR_CHECK(nvs_flash_init()); + + esp_netif_init(); + esp_event_loop_create_default(); + esp_netif_create_default_wifi_ap(); + + wifi_init_config_t wcfg = WIFI_INIT_CONFIG_DEFAULT(); + ESP_ERROR_CHECK(esp_wifi_init(&wcfg)); + wifi_config_t ap = {0}; + strncpy((char *)ap.ap.ssid, SOFTAP_SSID, sizeof(ap.ap.ssid)); + ap.ap.ssid_len = (uint8_t)strlen(SOFTAP_SSID); + ap.ap.channel = 6; + ap.ap.max_connection = 8; + ap.ap.authmode = WIFI_AUTH_OPEN; + ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP)); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &ap)); + ESP_ERROR_CHECK(esp_wifi_start()); + + esp_vfs_spiffs_conf_t sp = { + .base_path = "/spiffs", + .partition_label = "storage", + .max_files = 16, + .format_if_mount_failed = true, + }; + ESP_ERROR_CHECK(esp_vfs_spiffs_register(&sp)); + + mdns_init(); + mdns_hostname_set("pn532tool"); + mdns_instance_name_set("PN532 NFC Toolkit"); + mdns_service_add(NULL, "_http", "_tcp", 80, NULL, 0); + + s_server = start_server(); + if (!s_server) { + return ESP_FAIL; + } + + xTaskCreate(scan_loop_task, "nfc_scan", 20480, NULL, 5, &s_scan_task); + return ESP_OK; +} diff --git a/firmware/components/net_service/include/net_service/app_net.h b/firmware/components/net_service/include/net_service/app_net.h new file mode 100644 index 0000000..484722d --- /dev/null +++ b/firmware/components/net_service/include/net_service/app_net.h @@ -0,0 +1,17 @@ +#pragma once + +#include "esp_err.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +esp_err_t app_net_init(void); +void app_net_set_continuous_scan(bool on); +bool app_net_continuous_scan(void); +esp_err_t app_net_broadcast_json(const char *channel, const char *json_text); + +#ifdef __cplusplus +} +#endif diff --git a/firmware/components/nfc_engine/CMakeLists.txt b/firmware/components/nfc_engine/CMakeLists.txt new file mode 100644 index 0000000..940ff15 --- /dev/null +++ b/firmware/components/nfc_engine/CMakeLists.txt @@ -0,0 +1,5 @@ +idf_component_register( + SRCS "nfc_engine.c" "jobs.c" "session_capture.c" "nfc_deep.c" "nfc_brute.c" + INCLUDE_DIRS "include" + REQUIRES pn532_host esp_common freertos json esp_timer esp_system +) diff --git a/firmware/components/nfc_engine/include/nfc_engine/jobs.h b/firmware/components/nfc_engine/include/nfc_engine/jobs.h new file mode 100644 index 0000000..1935b4a --- /dev/null +++ b/firmware/components/nfc_engine/include/nfc_engine/jobs.h @@ -0,0 +1,26 @@ +#pragma once + +#include "esp_err.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*job_progress_cb_t)(int pct, const char *msg, void *ctx); + +typedef struct { + uint32_t id; + char name[32]; + volatile int pct; + volatile int done; +} nfc_job_t; + +uint32_t jobs_create(const char *name); +void jobs_set_progress(uint32_t id, int pct, const char *msg); +void jobs_finish(uint32_t id); + +#ifdef __cplusplus +} +#endif diff --git a/firmware/components/nfc_engine/include/nfc_engine/nfc_brute.h b/firmware/components/nfc_engine/include/nfc_engine/nfc_brute.h new file mode 100644 index 0000000..3d7cab9 --- /dev/null +++ b/firmware/components/nfc_engine/include/nfc_engine/nfc_brute.h @@ -0,0 +1,26 @@ +#pragma once + +#include "nfc_engine/nfc_engine.h" +#include "cJSON.h" +#include "esp_err.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Dictionary attack on MIFARE Classic sector trailer (Key A then Key B per candidate). + * `extra` = packed 6-byte keys, `extra_n` = number of keys. + * If `variations`, expands each base key with bounded bit/nibble tweaks (not full 2^48 space). + * Returns JSON object: { "attempts": N, "sectorHits": [ {sector, keyHex, keyType}, ... ] } + * Caller cJSON_Delete(). + */ +cJSON *nfc_mifare_dictionary_attack(nfc_tag_info_t *tag, uint8_t sector_first, uint8_t sector_last, + const uint8_t *extra, size_t extra_n, bool variations, + int *attempts_out); + +#ifdef __cplusplus +} +#endif diff --git a/firmware/components/nfc_engine/include/nfc_engine/nfc_deep.h b/firmware/components/nfc_engine/include/nfc_engine/nfc_deep.h new file mode 100644 index 0000000..d0256e5 --- /dev/null +++ b/firmware/components/nfc_engine/include/nfc_engine/nfc_deep.h @@ -0,0 +1,18 @@ +#pragma once + +#include "nfc_engine/nfc_engine.h" +#include "cJSON.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Best-effort deep read for PN532 path: inventory + general status + MIFARE sector sweep + * (common keys) and/or Ultralight/NTAG page sweep. Caller must cJSON_Delete() result. + */ +cJSON *nfc_tag_deep_profile(nfc_tag_info_t *tag); + +#ifdef __cplusplus +} +#endif diff --git a/firmware/components/nfc_engine/include/nfc_engine/nfc_engine.h b/firmware/components/nfc_engine/include/nfc_engine/nfc_engine.h new file mode 100644 index 0000000..c10d8a6 --- /dev/null +++ b/firmware/components/nfc_engine/include/nfc_engine/nfc_engine.h @@ -0,0 +1,48 @@ +#pragma once + +#include +#include +#include +#include "cJSON.h" +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define NFC_MAX_UID_LEN 10 +#define NFC_BLOCK_LEN 16 + +typedef struct { + uint8_t uid_len; + uint8_t uid[NFC_MAX_UID_LEN]; + uint16_t atqa; + uint8_t sak; + uint8_t type_hint; /* 0 unknown, 1 classic, 2 ultralight/ntag */ +} nfc_tag_info_t; + +typedef struct { + uint8_t key[6]; + bool key_b; +} nfc_mifare_key_t; + +esp_err_t nfc_engine_init(void); + +esp_err_t nfc_poll_passive_target(nfc_tag_info_t *out); + +esp_err_t nfc_mifare_authenticate_block(const nfc_tag_info_t *tag, uint8_t block_no, + const nfc_mifare_key_t *key); +esp_err_t nfc_mifare_read_block(uint8_t block_no, uint8_t block[NFC_BLOCK_LEN]); +esp_err_t nfc_mifare_write_block(uint8_t block_no, const uint8_t block[NFC_BLOCK_LEN]); + +esp_err_t nfc_ultralight_read_page(uint8_t page, uint8_t data[4]); +esp_err_t nfc_ultralight_write_page(uint8_t page, const uint8_t data[4]); + +esp_err_t nfc_ul_fast_read(uint8_t start_page, uint8_t *out, size_t out_max, size_t *got); + +/** Build JSON snapshot of last seen tag + optional blocks (caller frees cJSON). */ +cJSON *nfc_tag_to_json(const nfc_tag_info_t *tag); + +#ifdef __cplusplus +} +#endif diff --git a/firmware/components/nfc_engine/include/nfc_engine/session_capture.h b/firmware/components/nfc_engine/include/nfc_engine/session_capture.h new file mode 100644 index 0000000..15da6a5 --- /dev/null +++ b/firmware/components/nfc_engine/include/nfc_engine/session_capture.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#include +#include +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** RAM-only capture buffer (NDJSON lines). When full, NFC deep capture pauses until clear. */ +void session_capture_init(void); +void session_capture_clear(void); + +bool session_capture_is_full(void); +bool session_capture_deep_enabled(void); +void session_capture_set_deep(bool on); + +size_t session_capture_max(void); +void session_capture_get_status(size_t *used_bytes, uint32_t *line_count, bool *full); + +/** Append one NDJSON line (no trailing newline in `line`). Returns false if buffer full. */ +bool session_capture_append_line(const char *line); + +/** Export raw bytes (entire buffer) for HTTP download. */ +size_t session_capture_export_size(void); +const char *session_capture_export_ptr(void); + +/** Copy up to `cap` bytes (typically cap >= session_capture_export_size()). */ +void session_capture_copy_to(char *dst, size_t cap, size_t *out_len); + +#ifdef __cplusplus +} +#endif diff --git a/firmware/components/nfc_engine/jobs.c b/firmware/components/nfc_engine/jobs.c new file mode 100644 index 0000000..4844e6b --- /dev/null +++ b/firmware/components/nfc_engine/jobs.c @@ -0,0 +1,23 @@ +#include "nfc_engine/jobs.h" +#include "esp_log.h" +#include + +static const char *TAG = "nfc_jobs"; + +uint32_t jobs_create(const char *name) +{ + static uint32_t s_next = 1; + (void)name; + ESP_LOGI(TAG, "job %s id=%lu", name ? name : "?", (unsigned long)s_next); + return s_next++; +} + +void jobs_set_progress(uint32_t id, int pct, const char *msg) +{ + ESP_LOGD(TAG, "job %lu %d%% %s", (unsigned long)id, pct, msg ? msg : ""); +} + +void jobs_finish(uint32_t id) +{ + ESP_LOGI(TAG, "job %lu done", (unsigned long)id); +} diff --git a/firmware/components/nfc_engine/nfc_brute.c b/firmware/components/nfc_engine/nfc_brute.c new file mode 100644 index 0000000..c811c8a --- /dev/null +++ b/firmware/components/nfc_engine/nfc_brute.c @@ -0,0 +1,232 @@ +#include "nfc_engine/nfc_brute.h" +#include "esp_log.h" +#include "esp_task_wdt.h" +#include "esp_timer.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include + +static const char *TAG = "nfc_brute"; + +/* Community default keys (subset from public Proxmark3 / MCT-style lists). */ +static const uint8_t k_builtin[][6] = { + {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}, {0xA5, 0xA4, 0xA3, 0xA2, 0xA1, 0xA0}, + {0x89, 0xEC, 0xA9, 0x7F, 0x8C, 0x2A}, {0x5C, 0x8F, 0xF9, 0x99, 0x0D, 0xA2}, + {0x75, 0xCC, 0xB5, 0x9C, 0x9B, 0xED}, {0xD0, 0x1A, 0xFE, 0xEB, 0x89, 0x0A}, + {0x4B, 0x79, 0x1B, 0xEA, 0x7B, 0xCC}, {0x26, 0x12, 0xC6, 0xDE, 0x84, 0xCA}, + {0x70, 0x7B, 0x11, 0xFC, 0x14, 0x81}, {0x03, 0xF9, 0x06, 0x76, 0x46, 0xAE}, + {0x23, 0x52, 0xC5, 0xB5, 0x6D, 0x85}, {0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5}, + {0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5}, {0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5}, + {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}, {0x4D, 0x3A, 0x99, 0xC3, 0x51, 0xDD}, + {0x1A, 0x98, 0x2C, 0x7E, 0x45, 0x9A}, {0xFA, 0xFA, 0xFA, 0xFA, 0xFA, 0xFA}, + {0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB}, {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7}, + {0x5A, 0x1B, 0x85, 0xFC, 0xE2, 0x0A}, {0x71, 0x4C, 0x5C, 0x88, 0x6E, 0x97}, + {0x58, 0x7E, 0xE5, 0xF9, 0x35, 0x0F}, {0xA0, 0x47, 0x8C, 0xC3, 0x90, 0x91}, + {0x53, 0x3C, 0xB6, 0xC7, 0x23, 0xF6}, {0x8F, 0xD0, 0xA4, 0xF2, 0x56, 0xE9}, + {0xE0, 0x00, 0x00, 0x00, 0x00, 0x00}, {0xE7, 0xD6, 0x06, 0x4C, 0x58, 0x60}, + {0xB2, 0x7C, 0xCA, 0xB3, 0x0D, 0xBD}, {0xD2, 0xEC, 0xE8, 0xB9, 0x39, 0x5E}, + {0x14, 0x94, 0xE8, 0x16, 0x63, 0xD7}, {0x7C, 0x9F, 0xB8, 0x47, 0x42, 0x42}, + {0x56, 0x93, 0x69, 0xC5, 0xA0, 0xE5}, {0x63, 0x21, 0x93, 0xBE, 0x1C, 0x3C}, + {0x8E, 0x26, 0x5B, 0xE2, 0x45, 0xBF}, {0xF4, 0x6B, 0x6D, 0xC0, 0xD6, 0xC4}, + {0x2A, 0xA0, 0x5E, 0xD1, 0x85, 0x6F}, {0xAE, 0x3F, 0xF4, 0xEE, 0xA0, 0xDB}, +}; + +#define NBUILTIN (sizeof(k_builtin) / sizeof(k_builtin[0])) +#define MAX_VARIANTS_PER_KEY 14 +#define MAX_TRIES_BEFORE_WDT 48 + +static int push_variant(const uint8_t base[6], int idx, uint8_t out[6]) +{ + memcpy(out, base, 6); + switch (idx) { + case 0: + return 0; + case 1: + out[5] ^= 0xFF; + return 0; + case 2: + out[0] ^= 0xFF; + return 0; + case 3: + out[5] ^= 0xAA; + return 0; + case 4: + out[5] ^= 0x55; + return 0; + default: { + int n = idx - 5; + if (n >= 0 && n < 10) { + out[5] = (uint8_t)((out[5] & 0xF0) | (uint8_t)n); + return 0; + } + } + return -1; + } +} + +static bool try_key_on_trailer(nfc_tag_info_t *tag, uint8_t trailer, const uint8_t key[6], bool key_b) +{ + nfc_mifare_key_t k; + memcpy(k.key, key, 6); + k.key_b = key_b; + return nfc_mifare_authenticate_block(tag, trailer, &k) == ESP_OK; +} + +/** Trailer block for MIFARE Classic sector index (0..15 for 1K, 0..39 for 4K). */ +static uint8_t classic_trailer_for_sector(const nfc_tag_info_t *tag, uint8_t sec) +{ + if (tag->sak == 0x19) { + if (sec <= 31) { + return (uint8_t)(sec * 4 + 3); + } + if (sec <= 39) { + return (uint8_t)(128 + (sec - 32) * 16 + 15); + } + return 0xFF; + } + return (uint8_t)(sec * 4 + 3); +} + +cJSON *nfc_mifare_dictionary_attack(nfc_tag_info_t *tag, uint8_t sector_first, uint8_t sector_last, + const uint8_t *extra, size_t extra_n, bool variations, + int *attempts_out) +{ + int64_t t0_us = esp_timer_get_time(); + int attempts = 0; + cJSON *root = cJSON_CreateObject(); + cJSON *hits = cJSON_CreateArray(); + if (!root || !hits) { + cJSON_Delete(root); + cJSON_Delete(hits); + return NULL; + } + + if (tag->type_hint != 1) { + cJSON_AddStringToObject(root, "error", "not_classic_sak_hint"); + cJSON_AddItemToObject(root, "sectorHits", hits); + if (attempts_out) { + *attempts_out = 0; + } + return root; + } + + if (sector_first > sector_last) { + uint8_t t = sector_first; + sector_first = sector_last; + sector_last = t; + } + + for (uint8_t sec = sector_first; sec <= sector_last; sec++) { + uint8_t trailer = classic_trailer_for_sector(tag, sec); + if (trailer == 0xFF) { + continue; + } + bool got = false; + + for (size_t bi = 0; bi < NBUILTIN && !got; bi++) { + uint8_t trial[6]; + int maxv = variations ? MAX_VARIANTS_PER_KEY : 1; + for (int vi = 0; vi < maxv; vi++) { + if (push_variant(k_builtin[bi], vi, trial) != 0) { + break; + } + attempts++; + if (try_key_on_trailer(tag, trailer, trial, false)) { + char hx[16]; + for (int i = 0; i < 6; i++) { + snprintf(hx + i * 2, 3, "%02X", trial[i]); + } + hx[12] = 0; + cJSON *h = cJSON_CreateObject(); + cJSON_AddNumberToObject(h, "sector", sec); + cJSON_AddStringToObject(h, "keyHex", hx); + cJSON_AddStringToObject(h, "keyType", "A"); + cJSON_AddItemToArray(hits, h); + got = true; + break; + } + if (try_key_on_trailer(tag, trailer, trial, true)) { + char hx[16]; + for (int i = 0; i < 6; i++) { + snprintf(hx + i * 2, 3, "%02X", trial[i]); + } + hx[12] = 0; + cJSON *h = cJSON_CreateObject(); + cJSON_AddNumberToObject(h, "sector", sec); + cJSON_AddStringToObject(h, "keyHex", hx); + cJSON_AddStringToObject(h, "keyType", "B"); + cJSON_AddItemToArray(hits, h); + got = true; + break; + } + if ((attempts % MAX_TRIES_BEFORE_WDT) == 0) { + esp_task_wdt_reset(); + vTaskDelay(pdMS_TO_TICKS(1)); + } + } + } + + for (size_t ei = 0; ei < extra_n && !got; ei++) { + const uint8_t *ek = extra + ei * 6; + uint8_t trial[6]; + int maxv = variations ? MAX_VARIANTS_PER_KEY : 1; + for (int vi = 0; vi < maxv; vi++) { + if (push_variant(ek, vi, trial) != 0) { + break; + } + attempts++; + if (try_key_on_trailer(tag, trailer, trial, false)) { + char hx[16]; + for (int i = 0; i < 6; i++) { + snprintf(hx + i * 2, 3, "%02X", trial[i]); + } + hx[12] = 0; + cJSON *h = cJSON_CreateObject(); + cJSON_AddNumberToObject(h, "sector", sec); + cJSON_AddStringToObject(h, "keyHex", hx); + cJSON_AddStringToObject(h, "keyType", "A"); + cJSON_AddItemToArray(hits, h); + got = true; + break; + } + if (try_key_on_trailer(tag, trailer, trial, true)) { + char hx[16]; + for (int i = 0; i < 6; i++) { + snprintf(hx + i * 2, 3, "%02X", trial[i]); + } + hx[12] = 0; + cJSON *h = cJSON_CreateObject(); + cJSON_AddNumberToObject(h, "sector", sec); + cJSON_AddStringToObject(h, "keyHex", hx); + cJSON_AddStringToObject(h, "keyType", "B"); + cJSON_AddItemToArray(hits, h); + got = true; + break; + } + if ((attempts % MAX_TRIES_BEFORE_WDT) == 0) { + esp_task_wdt_reset(); + vTaskDelay(pdMS_TO_TICKS(1)); + } + } + } + + if (!got) { + cJSON *h = cJSON_CreateObject(); + cJSON_AddNumberToObject(h, "sector", sec); + cJSON_AddBoolToObject(h, "miss", true); + cJSON_AddItemToArray(hits, h); + } + } + + cJSON_AddItemToObject(root, "sectorHits", hits); + cJSON_AddNumberToObject(root, "attempts", attempts); + cJSON_AddNumberToObject(root, "durationMs", (double)((esp_timer_get_time() - t0_us) / 1000)); + cJSON_AddStringToObject(root, "note", + "Dictionary + bounded variants only — not exhaustive 48-bit keyspace."); + if (attempts_out) { + *attempts_out = attempts; + } + ESP_LOGI(TAG, "dictionary attack attempts=%d", attempts); + return root; +} diff --git a/firmware/components/nfc_engine/nfc_deep.c b/firmware/components/nfc_engine/nfc_deep.c new file mode 100644 index 0000000..477a862 --- /dev/null +++ b/firmware/components/nfc_engine/nfc_deep.c @@ -0,0 +1,188 @@ +#include "nfc_engine/nfc_deep.h" +#include "nfc_engine/nfc_engine.h" +#include "pn532_host/pn532_core.h" +#include "esp_log.h" +#include "esp_timer.h" +#include +#include + +static const char *TAG = "nfc_deep"; + +#define MAX_UL_PAGES 240 + +static const uint8_t k_default_keys[][6] = { + {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}, + {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, +}; + +static void block_to_hex(const uint8_t blk[NFC_BLOCK_LEN], char *out33) +{ + for (int i = 0; i < NFC_BLOCK_LEN; i++) { + snprintf(out33 + i * 2, 3, "%02X", blk[i]); + } + out33[32] = 0; +} + +static void key_to_hex(const uint8_t k[6], char *out13) +{ + for (int i = 0; i < 6; i++) { + snprintf(out13 + i * 2, 3, "%02X", k[i]); + } + out13[12] = 0; +} + +/** Classic 1K: 16 sectors x 4 blocks. Classic 4K: sectors 0–31 x 4 blocks, sectors 32–39 x 16 blocks. */ +static bool mfc_sector_layout(const nfc_tag_info_t *tag, int sector, int *first_block, int *num_blocks, + uint8_t *trailer_block) +{ + bool is4k = (tag->sak == 0x19); + if (!is4k) { + if (sector < 0 || sector > 15) { + return false; + } + *first_block = sector * 4; + *num_blocks = 4; + *trailer_block = (uint8_t)(sector * 4 + 3); + return true; + } + if (sector < 0 || sector > 39) { + return false; + } + if (sector <= 31) { + *first_block = sector * 4; + *num_blocks = 4; + *trailer_block = (uint8_t)(sector * 4 + 3); + } else { + int r = sector - 32; + *first_block = 128 + r * 16; + *num_blocks = 16; + *trailer_block = (uint8_t)(128 + r * 16 + 15); + } + return true; +} + +static bool try_sector(nfc_tag_info_t *tag, int sector, cJSON *sec_out) +{ + int fb = 0; + int nb = 0; + uint8_t trailer = 0; + if (!mfc_sector_layout(tag, sector, &fb, &nb, &trailer)) { + return false; + } + cJSON_AddNumberToObject(sec_out, "sector", sector); + cJSON_AddNumberToObject(sec_out, "firstBlock", fb); + cJSON_AddNumberToObject(sec_out, "trailerBlock", trailer); + cJSON_AddNumberToObject(sec_out, "blockCount", nb); + + for (size_t ki = 0; ki < sizeof(k_default_keys) / 6; ki++) { + nfc_mifare_key_t key; + memcpy(key.key, k_default_keys[ki], 6); + key.key_b = false; + if (nfc_mifare_authenticate_block(tag, trailer, &key) == ESP_OK) { + cJSON_AddStringToObject(sec_out, "keyType", "A"); + char kh[16]; + key_to_hex(key.key, kh); + cJSON_AddStringToObject(sec_out, "keyHex", kh); + cJSON *blocks = cJSON_CreateArray(); + for (int b = 0; b < nb; b++) { + uint8_t bn = (uint8_t)(fb + b); + uint8_t blk[NFC_BLOCK_LEN]; + if (nfc_mifare_read_block(bn, blk) == ESP_OK) { + char hx[36]; + block_to_hex(blk, hx); + cJSON_AddItemToArray(blocks, cJSON_CreateString(hx)); + } else { + cJSON_AddItemToArray(blocks, cJSON_CreateNull()); + } + } + cJSON_AddItemToObject(sec_out, "blocksHex", blocks); + return true; + } + key.key_b = true; + if (nfc_mifare_authenticate_block(tag, trailer, &key) == ESP_OK) { + cJSON_AddStringToObject(sec_out, "keyType", "B"); + char kh[16]; + key_to_hex(key.key, kh); + cJSON_AddStringToObject(sec_out, "keyHex", kh); + cJSON *blocks = cJSON_CreateArray(); + for (int b = 0; b < nb; b++) { + uint8_t bn = (uint8_t)(fb + b); + uint8_t blk[NFC_BLOCK_LEN]; + if (nfc_mifare_read_block(bn, blk) == ESP_OK) { + char hx[36]; + block_to_hex(blk, hx); + cJSON_AddItemToArray(blocks, cJSON_CreateString(hx)); + } else { + cJSON_AddItemToArray(blocks, cJSON_CreateNull()); + } + } + cJSON_AddItemToObject(sec_out, "blocksHex", blocks); + return true; + } + } + cJSON_AddBoolToObject(sec_out, "authFailed", true); + return false; +} + +static void add_mifare_classic(nfc_tag_info_t *tag, cJSON *root) +{ + int sectors = (tag->sak == 0x19) ? 40 : 16; + cJSON *arr = cJSON_CreateArray(); + for (int s = 0; s < sectors; s++) { + cJSON *sec = cJSON_CreateObject(); + (void)try_sector(tag, s, sec); + cJSON_AddItemToArray(arr, sec); + } + cJSON_AddItemToObject(root, "mifareClassic", arr); +} + +static void add_ultralight(nfc_tag_info_t *tag, cJSON *root) +{ + (void)tag; + cJSON *pages = cJSON_CreateArray(); + uint8_t buf[4]; + for (int p = 0; p < MAX_UL_PAGES; p++) { + if (nfc_ultralight_read_page((uint8_t)p, buf) != ESP_OK) { + break; + } + char line[12]; + snprintf(line, sizeof line, "%02X%02X%02X%02X", buf[0], buf[1], buf[2], buf[3]); + cJSON_AddItemToArray(pages, cJSON_CreateString(line)); + } + cJSON_AddItemToObject(root, "ultralightPagesHex", pages); +} + +cJSON *nfc_tag_deep_profile(nfc_tag_info_t *tag) +{ + cJSON *o = cJSON_CreateObject(); + if (!o) { + return NULL; + } + cJSON_AddNumberToObject(o, "capturedMs", (double)(esp_timer_get_time() / 1000)); + cJSON_AddItemToObject(o, "tag", nfc_tag_to_json(tag)); + + uint8_t gs[32]; + size_t gl = 0; + if (pn532_get_general_status(gs, sizeof(gs), &gl) == ESP_OK && gl > 0) { + cJSON *g = cJSON_CreateArray(); + for (size_t i = 0; i < gl; i++) { + cJSON_AddItemToArray(g, cJSON_CreateNumber(gs[i])); + } + cJSON_AddItemToObject(o, "pn532GeneralStatus", g); + } + + if (tag->type_hint == 1) { + add_mifare_classic(tag, o); + } else if (tag->type_hint == 2) { + add_ultralight(tag, o); + } else { + cJSON_AddStringToObject( + o, "note", + "Unknown type from SAK/ATQA — stored inventory + PN532 status only. Use Raw console for ISO14443-4 / other stacks."); + } + + ESP_LOGI(TAG, "deep profile done type_hint=%u", tag->type_hint); + return o; +} diff --git a/firmware/components/nfc_engine/nfc_engine.c b/firmware/components/nfc_engine/nfc_engine.c new file mode 100644 index 0000000..963be46 --- /dev/null +++ b/firmware/components/nfc_engine/nfc_engine.c @@ -0,0 +1,255 @@ +#include "nfc_engine/nfc_engine.h" +#include "pn532_host/pn532_core.h" +#include "esp_log.h" +#include +#include + +static const char *TAG = "nfc_engine"; + +static uint8_t s_tg = 1; + +static void hint_type(nfc_tag_info_t *t) +{ + switch (t->sak) { + case 0x08: + case 0x00: + t->type_hint = 2; + break; + case 0x09: + case 0x18: + case 0x19: + t->type_hint = 1; + break; + default: + t->type_hint = 0; + break; + } +} + +esp_err_t nfc_engine_init(void) +{ + esp_err_t e = pn532_core_init(); + if (e != ESP_OK) { + return e; + } + e = pn532_sam_config_normal(); + if (e != ESP_OK) { + ESP_LOGW(TAG, "SAM config: %s", esp_err_to_name(e)); + } + uint8_t ic = 0, hi = 0, lo = 0; + if (pn532_get_firmware_version(&ic, &hi, &lo) == ESP_OK) { + ESP_LOGI(TAG, "PN532 fw ic=0x%02x %u.%u", ic, hi, lo); + } + if (pn532_rf_max_retries() != ESP_OK) { + ESP_LOGW(TAG, "RF max retries config failed"); + } + return ESP_OK; +} + +esp_err_t nfc_poll_passive_target(nfc_tag_info_t *out) +{ + memset(out, 0, sizeof(*out)); + uint8_t resp[64]; + size_t rlen = 0; + esp_err_t e = pn532_in_list_passive_target(1, 0x00, resp, sizeof(resp), &rlen); + if (e != ESP_OK) { + return e; + } + if (rlen < 2 || resp[0] != 0x00) { + return ESP_ERR_INVALID_RESPONSE; + } + if (resp[1] < 1) { + return ESP_ERR_NOT_FOUND; + } + if (rlen < 8) { + return ESP_ERR_INVALID_RESPONSE; + } + s_tg = resp[2]; + out->atqa = (uint16_t)(((uint16_t)resp[3] << 8) | resp[4]); + out->sak = resp[5]; + out->uid_len = resp[6]; + if (out->uid_len > NFC_MAX_UID_LEN || (size_t)(7 + out->uid_len) > rlen) { + return ESP_ERR_INVALID_RESPONSE; + } + memcpy(out->uid, resp + 7, out->uid_len); + hint_type(out); + return ESP_OK; +} + +static esp_err_t in_data_tg(const uint8_t *data, size_t data_len, uint8_t *response, size_t response_max, + size_t *response_len) +{ + uint8_t buf[64]; + if (data_len > sizeof(buf) - 3) { + return ESP_ERR_INVALID_SIZE; + } + buf[0] = PN532_CMD_INDATAEXCHANGE; + buf[1] = s_tg; + memcpy(buf + 2, data, data_len); + return pn532_send_cmd(buf, 2 + data_len, response, response_max, response_len, 500); +} + +esp_err_t nfc_mifare_authenticate_block(const nfc_tag_info_t *tag, uint8_t block_no, + const nfc_mifare_key_t *key) +{ + uint8_t data[12]; + data[0] = key->key_b ? PN532_MIFARE_CMD_AUTH_B : PN532_MIFARE_CMD_AUTH_A; + data[1] = block_no; + memcpy(data + 2, key->key, 6); + uint8_t uid_use[4]; + if (tag->uid_len == 4) { + memcpy(uid_use, tag->uid, 4); + } else if (tag->uid_len >= 7) { + memcpy(uid_use, tag->uid + tag->uid_len - 4, 4); + } else if (tag->uid_len > 4) { + memcpy(uid_use, tag->uid + tag->uid_len - 4, 4); + } else { + return ESP_ERR_INVALID_ARG; + } + memcpy(data + 8, uid_use, 4); + uint8_t resp[32]; + size_t rlen = 0; + esp_err_t e = in_data_tg(data, sizeof(data), resp, sizeof(resp), &rlen); + if (e != ESP_OK) { + return e; + } + if (rlen < 1 || resp[0] != 0x00) { + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t nfc_mifare_read_block(uint8_t block_no, uint8_t block[NFC_BLOCK_LEN]) +{ + uint8_t d[] = {PN532_MIFARE_CMD_READ, block_no}; + uint8_t resp[32]; + size_t rlen = 0; + esp_err_t e = in_data_tg(d, sizeof(d), resp, sizeof(resp), &rlen); + if (e != ESP_OK) { + return e; + } + if (rlen < 1 + NFC_BLOCK_LEN || resp[0] != 0x00) { + return ESP_ERR_INVALID_RESPONSE; + } + memcpy(block, resp + 1, NFC_BLOCK_LEN); + return ESP_OK; +} + +esp_err_t nfc_mifare_write_block(uint8_t block_no, const uint8_t block[NFC_BLOCK_LEN]) +{ + uint8_t d[2 + NFC_BLOCK_LEN]; + d[0] = PN532_MIFARE_CMD_WRITE; + d[1] = block_no; + memcpy(d + 2, block, NFC_BLOCK_LEN); + uint8_t resp[16]; + size_t rlen = 0; + esp_err_t e = in_data_tg(d, sizeof(d), resp, sizeof(resp), &rlen); + if (e != ESP_OK) { + return e; + } + if (rlen < 1 || resp[0] != 0x00) { + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t nfc_ultralight_read_page(uint8_t page, uint8_t data[4]) +{ + uint8_t d[] = {PN532_MIFARE_CMD_READ, page}; + uint8_t resp[32]; + size_t rlen = 0; + esp_err_t e = in_data_tg(d, sizeof(d), resp, sizeof(resp), &rlen); + if (e != ESP_OK) { + return e; + } + if (rlen < 1 + 16 || resp[0] != 0x00) { + return ESP_ERR_INVALID_RESPONSE; + } + memcpy(data, resp + 1, 4); + return ESP_OK; +} + +esp_err_t nfc_ultralight_write_page(uint8_t page, const uint8_t data[4]) +{ + uint8_t d[6] = {0xA2, page, data[0], data[1], data[2], data[3]}; + uint8_t resp[16]; + size_t rlen = 0; + esp_err_t e = in_data_tg(d, sizeof(d), resp, sizeof(resp), &rlen); + if (e != ESP_OK) { + return e; + } + if (rlen < 1 || resp[0] != 0x00) { + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t nfc_ul_fast_read(uint8_t start_page, uint8_t *out, size_t out_max, size_t *got) +{ + *got = 0; + size_t off = 0; + uint8_t d[2] = {0x3A, start_page}; + uint8_t resp[256]; + size_t rlen = 0; + esp_err_t e = in_data_tg(d, sizeof(d), resp, sizeof(resp), &rlen); + if (e != ESP_OK) { + return e; + } + if (rlen < 2 || resp[0] != 0x00) { + return ESP_ERR_INVALID_RESPONSE; + } + size_t payload = rlen - 1; + if (payload > out_max) { + payload = out_max; + } + memcpy(out, resp + 1, payload); + off = payload; + *got = off; + return ESP_OK; +} + +cJSON *nfc_tag_to_json(const nfc_tag_info_t *tag) +{ + cJSON *o = cJSON_CreateObject(); + if (!o) { + return NULL; + } + char uidhex[NFC_MAX_UID_LEN * 2 + 4]; + for (int i = 0; i < tag->uid_len; i++) { + snprintf(uidhex + i * 2, 3, "%02X", tag->uid[i]); + } + uidhex[tag->uid_len * 2] = 0; + cJSON_AddStringToObject(o, "uid", uidhex); + cJSON_AddNumberToObject(o, "uidLen", tag->uid_len); + cJSON_AddNumberToObject(o, "atqa", tag->atqa); + cJSON_AddNumberToObject(o, "sak", tag->sak); + cJSON_AddNumberToObject(o, "typeHint", tag->type_hint); + + char aq[8]; + snprintf(aq, sizeof aq, "%04X", (unsigned)tag->atqa); + cJSON_AddStringToObject(o, "atqaHex", aq); + char sk[8]; + snprintf(sk, sizeof sk, "%02X", tag->sak); + cJSON_AddStringToObject(o, "sakHex", sk); + + const char *guess = "Unknown / use Raw or RATS"; + if (tag->type_hint == 1) { + guess = (tag->sak == 0x19) ? "MIFARE Classic 4K" : "MIFARE Classic 1K or compatible"; + } else if (tag->type_hint == 2) { + guess = "Ultralight / NTAG / Type 2 family"; + } + cJSON_AddStringToObject(o, "typeGuess", guess); + + uint8_t gs[32]; + size_t gl = 0; + if (pn532_get_general_status(gs, sizeof(gs), &gl) == ESP_OK && gl > 0) { + cJSON *arr = cJSON_CreateArray(); + if (arr) { + for (size_t i = 0; i < gl; i++) { + cJSON_AddItemToArray(arr, cJSON_CreateNumber(gs[i])); + } + cJSON_AddItemToObject(o, "pn532GeneralStatus", arr); + } + } + return o; +} diff --git a/firmware/components/nfc_engine/session_capture.c b/firmware/components/nfc_engine/session_capture.c new file mode 100644 index 0000000..7390e3d --- /dev/null +++ b/firmware/components/nfc_engine/session_capture.c @@ -0,0 +1,129 @@ +#include "nfc_engine/session_capture.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include + +#define SESSION_CAPTURE_BYTES (48 * 1024) + +static char s_buf[SESSION_CAPTURE_BYTES]; +static size_t s_len; +static uint32_t s_lines; +static bool s_full; +static bool s_deep; +static SemaphoreHandle_t s_mu; + +void session_capture_init(void) +{ + s_mu = xSemaphoreCreateMutex(); + session_capture_clear(); + s_deep = false; +} + +void session_capture_clear(void) +{ + if (s_mu) { + xSemaphoreTake(s_mu, portMAX_DELAY); + } + s_len = 0; + s_lines = 0; + s_full = false; + s_buf[0] = 0; + if (s_mu) { + xSemaphoreGive(s_mu); + } +} + +bool session_capture_is_full(void) +{ + return s_full; +} + +bool session_capture_deep_enabled(void) { return s_deep; } + +void session_capture_set_deep(bool on) { s_deep = on; } + +size_t session_capture_max(void) { return sizeof(s_buf) - 2; } + +void session_capture_get_status(size_t *used_bytes, uint32_t *line_count, bool *full) +{ + if (s_mu) { + xSemaphoreTake(s_mu, portMAX_DELAY); + } + if (used_bytes) { + *used_bytes = s_len; + } + if (line_count) { + *line_count = s_lines; + } + if (full) { + *full = s_full; + } + if (s_mu) { + xSemaphoreGive(s_mu); + } +} + +bool session_capture_append_line(const char *line) +{ + if (!line || s_full) { + return false; + } + size_t l = strlen(line); + size_t need = l + 1; /* newline */ + if (s_mu) { + xSemaphoreTake(s_mu, portMAX_DELAY); + } + if (s_full || s_len + need >= sizeof(s_buf)) { + s_full = true; + if (s_mu) { + xSemaphoreGive(s_mu); + } + return false; + } + memcpy(s_buf + s_len, line, l); + s_len += l; + s_buf[s_len++] = '\n'; + s_buf[s_len] = 0; + s_lines++; + if (s_len + 2 >= sizeof(s_buf)) { + s_full = true; + } + if (s_mu) { + xSemaphoreGive(s_mu); + } + return true; +} + +size_t session_capture_export_size(void) +{ + if (s_mu) { + xSemaphoreTake(s_mu, portMAX_DELAY); + } + size_t n = s_len; + if (s_mu) { + xSemaphoreGive(s_mu); + } + return n; +} + +const char *session_capture_export_ptr(void) { return s_buf; } + +void session_capture_copy_to(char *dst, size_t cap, size_t *out_len) +{ + if (s_mu) { + xSemaphoreTake(s_mu, portMAX_DELAY); + } + size_t n = s_len; + if (n > cap) { + n = cap; + } + if (dst && n) { + memcpy(dst, s_buf, n); + } + if (out_len) { + *out_len = n; + } + if (s_mu) { + xSemaphoreGive(s_mu); + } +} diff --git a/firmware/components/pn532_host/CMakeLists.txt b/firmware/components/pn532_host/CMakeLists.txt new file mode 100644 index 0000000..8998faa --- /dev/null +++ b/firmware/components/pn532_host/CMakeLists.txt @@ -0,0 +1,7 @@ +idf_component_register( + SRCS + "pn532_transport.c" + "pn532_core.c" + INCLUDE_DIRS "include" + REQUIRES driver esp_timer freertos +) diff --git a/firmware/components/pn532_host/Kconfig b/firmware/components/pn532_host/Kconfig new file mode 100644 index 0000000..461b71e --- /dev/null +++ b/firmware/components/pn532_host/Kconfig @@ -0,0 +1,84 @@ +menu "PN532 Host" + +choice PN532_TRANSPORT + prompt "PN532 bus" + default PN532_TRANSPORT_SPI + config PN532_TRANSPORT_SPI + bool "SPI" + config PN532_TRANSPORT_I2C + bool "I2C" + config PN532_TRANSPORT_HSU + bool "UART (HSU)" +endchoice + +config PN532_SPI_HOST + int "SPI host (2=SPI2, 3=SPI3)" + default 2 + depends on PN532_TRANSPORT_SPI + +config PN532_SPI_MOSI_GPIO + int "SPI MOSI GPIO" + default 11 + depends on PN532_TRANSPORT_SPI + +config PN532_SPI_MISO_GPIO + int "SPI MISO GPIO" + default 13 + depends on PN532_TRANSPORT_SPI + +config PN532_SPI_SCLK_GPIO + int "SPI SCLK GPIO" + default 12 + depends on PN532_TRANSPORT_SPI + +config PN532_SPI_CS_GPIO + int "SPI CS GPIO" + default 10 + depends on PN532_TRANSPORT_SPI + +config PN532_SPI_CLOCK_HZ + int "SPI clock Hz" + default 100000 + depends on PN532_TRANSPORT_SPI + +config PN532_I2C_PORT + int "I2C port" + default 0 + depends on PN532_TRANSPORT_I2C + +config PN532_I2C_SDA_GPIO + int "I2C SDA GPIO" + default 8 + depends on PN532_TRANSPORT_I2C + +config PN532_I2C_SCL_GPIO + int "I2C SCL GPIO" + default 9 + depends on PN532_TRANSPORT_I2C + +config PN532_I2C_ADDR + hex "PN532 I2C 7-bit address" + default 0x24 + depends on PN532_TRANSPORT_I2C + +config PN532_HSU_UART_NUM + int "UART num for HSU" + default 1 + depends on PN532_TRANSPORT_HSU + +config PN532_HSU_TX_GPIO + int "UART TX GPIO" + default 17 + depends on PN532_TRANSPORT_HSU + +config PN532_HSU_RX_GPIO + int "UART RX GPIO" + default 18 + depends on PN532_TRANSPORT_HSU + +config PN532_HSU_BAUD + int "UART baud" + default 115200 + depends on PN532_TRANSPORT_HSU + +endmenu diff --git a/firmware/components/pn532_host/include/pn532_host/pn532_core.h b/firmware/components/pn532_host/include/pn532_host/pn532_core.h new file mode 100644 index 0000000..cedd138 --- /dev/null +++ b/firmware/components/pn532_host/include/pn532_host/pn532_core.h @@ -0,0 +1,68 @@ +#pragma once + +#include +#include +#include +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define PN532_HOST_TO_PN532 0xD4 +#define PN532_PN532_TO_HOST 0xD5 + +#define PN532_CMD_GETFIRMWAREVERSION 0x02 +#define PN532_CMD_GETGENERALSTATUS 0x04 +#define PN532_CMD_SAMCONFIGURATION 0x14 +#define PN532_CMD_INLISTPASSIVETARGET 0x4A +#define PN532_CMD_INDATAEXCHANGE 0x40 +#define PN532_CMD_INCOMMUNICATETHRU 0x42 +#define PN532_CMD_RFCONFIGURATION 0x32 +#define PN532_CMD_TGINITASTARGET 0x8C +#define PN532_CMD_TGGETDATA 0x86 +#define PN532_CMD_TGSETDATA 0x8E +#define PN532_CMD_POWERDOWN 0x16 + +#define PN532_MIFARE_CMD_AUTH_A 0x60 +#define PN532_MIFARE_CMD_AUTH_B 0x61 +#define PN532_MIFARE_CMD_READ 0x30 +#define PN532_MIFARE_CMD_WRITE 0xA0 +#define PN532_MIFARE_CMD_TRANSFER 0xB0 + +#define PN532_EEPROM_MAX_CMD_PAYLOAD 254 + +esp_err_t pn532_core_init(void); +esp_err_t pn532_sam_config_normal(void); +esp_err_t pn532_get_firmware_version(uint8_t *ic_ver, uint8_t *fw_ver_hi, uint8_t *fw_ver_lo); +esp_err_t pn532_get_general_status(uint8_t *buf, size_t buf_len, size_t *out_len); + +/** + * Send full command body after TFI: [cmd] [params...] + * response_data is pn532 payload after response TFI (first byte often status 0x00 = OK). + */ +esp_err_t pn532_send_cmd(const uint8_t *cmd_and_data, size_t len, + uint8_t *response, size_t response_max, + size_t *response_len, int timeout_ms); + +esp_err_t pn532_in_list_passive_target(uint8_t max_targets, uint8_t baud, + uint8_t *response, size_t response_max, + size_t *response_len); + +esp_err_t pn532_in_data_exchange(const uint8_t *data, size_t data_len, + uint8_t *response, size_t response_max, + size_t *response_len); + +esp_err_t pn532_in_communicate_thru(const uint8_t *data, size_t data_len, + uint8_t *response, size_t response_max, + size_t *response_len); + +/** RF field on/off via RFConfiguration (0x32) item 0x01, RF field */ +esp_err_t pn532_rf_field(bool on); + +/** Max passive activation / RF retries (0x32 item 0x05) — improves weak-coupling reads */ +esp_err_t pn532_rf_max_retries(void); + +#ifdef __cplusplus +} +#endif diff --git a/firmware/components/pn532_host/include/pn532_host/pn532_transport.h b/firmware/components/pn532_host/include/pn532_host/pn532_transport.h new file mode 100644 index 0000000..de558f4 --- /dev/null +++ b/firmware/components/pn532_host/include/pn532_host/pn532_transport.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + PN532_SPI, + PN532_I2C, + PN532_HSU, +} pn532_bus_t; + +esp_err_t pn532_transport_init(void); +void pn532_transport_lock(void); +void pn532_transport_unlock(void); + +/** Raw PN532 frame body: TFI + payload (caller builds payload after TFI). */ +esp_err_t pn532_transport_exchange(const uint8_t *tx_body, size_t tx_body_len, + uint8_t *rx_body, size_t rx_body_max, + size_t *rx_body_len, int timeout_ms); + +#ifdef __cplusplus +} +#endif diff --git a/firmware/components/pn532_host/pn532_core.c b/firmware/components/pn532_host/pn532_core.c new file mode 100644 index 0000000..b778e65 --- /dev/null +++ b/firmware/components/pn532_host/pn532_core.c @@ -0,0 +1,114 @@ +#include "pn532_host/pn532_core.h" +#include "pn532_host/pn532_transport.h" +#include "esp_log.h" +#include + +static const char *TAG = "pn532_core"; + +esp_err_t pn532_send_cmd(const uint8_t *cmd_and_data, size_t len, uint8_t *response, size_t response_max, + size_t *response_len, int timeout_ms) +{ + if (!cmd_and_data || !response || !response_len) { + return ESP_ERR_INVALID_ARG; + } + pn532_transport_lock(); + esp_err_t err = + pn532_transport_exchange(cmd_and_data, len, response, response_max, response_len, timeout_ms); + pn532_transport_unlock(); + if (err != ESP_OK) { + return err; + } + if (*response_len < 1) { + return ESP_ERR_INVALID_RESPONSE; + } + if (response[0] != 0x00) { + ESP_LOGW(TAG, "chip status 0x%02x", response[0]); + } + return ESP_OK; +} + +esp_err_t pn532_core_init(void) +{ + return pn532_transport_init(); +} + +esp_err_t pn532_get_firmware_version(uint8_t *ic_ver, uint8_t *fw_ver_hi, uint8_t *fw_ver_lo) +{ + uint8_t cmd = PN532_CMD_GETFIRMWAREVERSION; + uint8_t resp[16]; + size_t rlen = 0; + esp_err_t e = pn532_send_cmd(&cmd, 1, resp, sizeof(resp), &rlen, 200); + if (e != ESP_OK) { + return e; + } + if (rlen < 4) { + return ESP_ERR_INVALID_RESPONSE; + } + *ic_ver = resp[1]; + *fw_ver_hi = resp[2]; + *fw_ver_lo = resp[3]; + return ESP_OK; +} + +esp_err_t pn532_sam_config_normal(void) +{ + uint8_t buf[] = {PN532_CMD_SAMCONFIGURATION, 0x01, 0x14, 0x01}; + uint8_t resp[8]; + size_t rlen = 0; + return pn532_send_cmd(buf, sizeof(buf), resp, sizeof(resp), &rlen, 200); +} + +esp_err_t pn532_get_general_status(uint8_t *buf, size_t buf_len, size_t *out_len) +{ + uint8_t cmd = PN532_CMD_GETGENERALSTATUS; + return pn532_send_cmd(&cmd, 1, buf, buf_len, out_len, 200); +} + +esp_err_t pn532_rf_field(bool on) +{ + uint8_t buf[] = {PN532_CMD_RFCONFIGURATION, 0x01, on ? 0x01 : 0x00}; + uint8_t resp[8]; + size_t rlen = 0; + return pn532_send_cmd(buf, sizeof(buf), resp, sizeof(resp), &rlen, 200); +} + +esp_err_t pn532_rf_max_retries(void) +{ + /* RFConfiguration 0x05 MaxRetries: ATR/PSL/PassiveActivation — high values = more sensitivity to marginal tags */ + uint8_t buf[] = {PN532_CMD_RFCONFIGURATION, 0x05, 0xFF, 0xFF, 0xFF}; + uint8_t resp[8]; + size_t rlen = 0; + return pn532_send_cmd(buf, sizeof(buf), resp, sizeof(resp), &rlen, 200); +} + +esp_err_t pn532_in_list_passive_target(uint8_t max_targets, uint8_t baud, uint8_t *response, + size_t response_max, size_t *response_len) +{ + uint8_t buf[] = {PN532_CMD_INLISTPASSIVETARGET, max_targets, baud}; + return pn532_send_cmd(buf, sizeof(buf), response, response_max, response_len, 500); +} + +esp_err_t pn532_in_data_exchange(const uint8_t *data, size_t data_len, uint8_t *response, + size_t response_max, size_t *response_len) +{ + if (!data || data_len == 0 || data_len > PN532_EEPROM_MAX_CMD_PAYLOAD - 1) { + return ESP_ERR_INVALID_ARG; + } + uint8_t buf[PN532_EEPROM_MAX_CMD_PAYLOAD + 1]; + buf[0] = PN532_CMD_INDATAEXCHANGE; + buf[1] = 0x01; /* logical target 1 */ + memcpy(buf + 2, data, data_len); + return pn532_send_cmd(buf, 2 + data_len, response, response_max, response_len, 500); +} + +esp_err_t pn532_in_communicate_thru(const uint8_t *data, size_t data_len, uint8_t *response, + size_t response_max, size_t *response_len) +{ + if (!data || data_len > PN532_EEPROM_MAX_CMD_PAYLOAD - 1) { + return ESP_ERR_INVALID_ARG; + } + uint8_t buf[PN532_EEPROM_MAX_CMD_PAYLOAD + 1]; + buf[0] = PN532_CMD_INCOMMUNICATETHRU; + memcpy(buf + 1, data, data_len); + return pn532_send_cmd(buf, 1 + data_len, response, response_max, response_len, 500); +} diff --git a/firmware/components/pn532_host/pn532_transport.c b/firmware/components/pn532_host/pn532_transport.c new file mode 100644 index 0000000..4c9d6ea --- /dev/null +++ b/firmware/components/pn532_host/pn532_transport.c @@ -0,0 +1,361 @@ +#include "pn532_host/pn532_transport.h" +#include "sdkconfig.h" +#include "driver/gpio.h" +#include "esp_timer.h" +#include "driver/i2c.h" +#include "driver/spi_master.h" +#include "driver/uart.h" +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include +#include + +#define PN532_HOST_TO_PN532 0xD4 +#define PN532_TXBUF_MAX 264 + +static const char *TAG = "pn532_xport"; + +#if defined(CONFIG_PN532_TRANSPORT_SPI) +static spi_host_device_t pn532_spi_host(void) +{ + return CONFIG_PN532_SPI_HOST == 3 ? SPI3_HOST : SPI2_HOST; +} +#endif + +static SemaphoreHandle_t s_bus_mutex; + +#if defined(CONFIG_PN532_TRANSPORT_SPI) +static spi_device_handle_t s_spi; +static int s_spi_cs_gpio = CONFIG_PN532_SPI_CS_GPIO; + +static esp_err_t spi_wait_ready(int timeout_ms) +{ + uint8_t status = 0; + const int64_t end = esp_timer_get_time() / 1000 + timeout_ms; + while ((esp_timer_get_time() / 1000) < (uint64_t)end) { + spi_transaction_t t = {}; + uint8_t tx = 0x02; /* SPIstatus read */ + t.length = 8; + t.tx_buffer = &tx; + t.rx_buffer = &status; + gpio_set_level(s_spi_cs_gpio, 0); + esp_err_t e = spi_device_polling_transmit(s_spi, &t); + gpio_set_level(s_spi_cs_gpio, 1); + if (e != ESP_OK) { + return e; + } + if (status & 0x01) { + return ESP_OK; + } + vTaskDelay(pdMS_TO_TICKS(1)); + } + return ESP_ERR_TIMEOUT; +} + +static esp_err_t spi_write_frame(const uint8_t *data, size_t len) +{ + ESP_RETURN_ON_ERROR(spi_wait_ready(200), TAG, "wait before write"); + gpio_set_level(s_spi_cs_gpio, 0); + vTaskDelay(pdMS_TO_TICKS(2)); + uint8_t hdr = 0x04; /* Data write */ + spi_transaction_t t0 = {}; + t0.length = 8; + t0.tx_buffer = &hdr; + ESP_RETURN_ON_ERROR(spi_device_polling_transmit(s_spi, &t0), TAG, "hdr"); + for (size_t i = 0; i < len; i++) { + spi_transaction_t t = {}; + t.length = 8; + t.tx_buffer = &data[i]; + ESP_RETURN_ON_ERROR(spi_device_polling_transmit(s_spi, &t), TAG, "w"); + } + gpio_set_level(s_spi_cs_gpio, 1); + return ESP_OK; +} + +static esp_err_t spi_read_bytes(uint8_t *out, size_t len) +{ + ESP_RETURN_ON_ERROR(spi_wait_ready(300), TAG, "wait read"); + gpio_set_level(s_spi_cs_gpio, 0); + vTaskDelay(pdMS_TO_TICKS(2)); + uint8_t hdr = 0x03; /* Data read */ + spi_transaction_t t0 = {}; + t0.length = 8; + t0.tx_buffer = &hdr; + ESP_RETURN_ON_ERROR(spi_device_polling_transmit(s_spi, &t0), TAG, "rhdr"); + for (size_t i = 0; i < len; i++) { + spi_transaction_t t = {}; + uint8_t tx = 0xFF; + t.length = 8; + t.tx_buffer = &tx; + t.rx_buffer = &out[i]; + ESP_RETURN_ON_ERROR(spi_device_polling_transmit(s_spi, &t), TAG, "r"); + } + gpio_set_level(s_spi_cs_gpio, 1); + return ESP_OK; +} + +#elif defined(CONFIG_PN532_TRANSPORT_I2C) +#define PN532_I2C_PORT ((i2c_port_t)CONFIG_PN532_I2C_PORT) + +static esp_err_t i2c_wakeup(void) +{ + const uint8_t w[] = {0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + i2c_cmd_handle_t c = i2c_cmd_link_create(); + i2c_master_start(c); + i2c_master_write_byte(c, (CONFIG_PN532_I2C_ADDR << 1) | I2C_MASTER_WRITE, true); + i2c_master_write(c, w, sizeof(w), I2C_MASTER_LAST_NACK); + i2c_master_stop(c); + esp_err_t e = i2c_master_cmd_begin(PN532_I2C_PORT, c, pdMS_TO_TICKS(50)); + i2c_cmd_link_delete(c); + vTaskDelay(pdMS_TO_TICKS(10)); + return e; +} + +static esp_err_t i2c_write_raw(const uint8_t *buf, size_t len) +{ + i2c_cmd_handle_t c = i2c_cmd_link_create(); + i2c_master_start(c); + i2c_master_write_byte(c, (CONFIG_PN532_I2C_ADDR << 1) | I2C_MASTER_WRITE, true); + i2c_master_write(c, buf, len, I2C_MASTER_LAST_NACK); + i2c_master_stop(c); + esp_err_t e = i2c_master_cmd_begin(PN532_I2C_PORT, c, pdMS_TO_TICKS(200)); + i2c_cmd_link_delete(c); + return e; +} + +static esp_err_t i2c_read_raw(uint8_t *buf, size_t len) +{ + i2c_cmd_handle_t c = i2c_cmd_link_create(); + i2c_master_start(c); + i2c_master_write_byte(c, (CONFIG_PN532_I2C_ADDR << 1) | I2C_MASTER_READ, true); + if (len > 1) { + i2c_master_read(c, buf, len - 1, I2C_MASTER_ACK); + } + i2c_master_read_byte(c, buf + len - 1, I2C_MASTER_NACK); + i2c_master_stop(c); + esp_err_t e = i2c_master_cmd_begin(PN532_I2C_PORT, c, pdMS_TO_TICKS(200)); + i2c_cmd_link_delete(c); + return e; +} + +#elif defined(CONFIG_PN532_TRANSPORT_HSU) +#define PN532_UART ((uart_port_t)CONFIG_PN532_HSU_UART_NUM) + +static esp_err_t hsu_write_raw(const uint8_t *buf, size_t len) +{ + int n = uart_write_bytes(PN532_UART, buf, len); + return (n == (int)len) ? ESP_OK : ESP_FAIL; +} + +static esp_err_t hsu_read_raw(uint8_t *buf, size_t len, int timeout_ms) +{ + size_t got = 0; + int64_t start = esp_timer_get_time(); + while (got < len) { + int n = uart_read_bytes(PN532_UART, buf + got, len - got, + pdMS_TO_TICKS(MAX(1, timeout_ms))); + if (n > 0) { + got += (size_t)n; + } + if ((esp_timer_get_time() - start) / 1000 > timeout_ms) { + break; + } + } + return got == len ? ESP_OK : ESP_ERR_TIMEOUT; +} +#endif + +void pn532_transport_lock(void) { xSemaphoreTake(s_bus_mutex, portMAX_DELAY); } + +void pn532_transport_unlock(void) { xSemaphoreGive(s_bus_mutex); } + +static esp_err_t read_ack(int timeout_ms) +{ + const uint8_t ack_ok[] = {0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00}; + uint8_t ack[6]; +#if defined(CONFIG_PN532_TRANSPORT_SPI) + ESP_RETURN_ON_ERROR(spi_read_bytes(ack, sizeof(ack)), TAG, "read ack spi"); +#elif defined(CONFIG_PN532_TRANSPORT_I2C) + vTaskDelay(pdMS_TO_TICKS(5)); + ESP_RETURN_ON_ERROR(i2c_read_raw(ack, sizeof(ack)), TAG, "read ack i2c"); +#elif defined(CONFIG_PN532_TRANSPORT_HSU) + ESP_RETURN_ON_ERROR(hsu_read_raw(ack, sizeof(ack), timeout_ms), TAG, "read ack hsu"); +#endif + if (memcmp(ack, ack_ok, 6) != 0) { + ESP_LOG_BUFFER_HEX_LEVEL(TAG, ack, 6, ESP_LOG_WARN); + return ESP_ERR_INVALID_RESPONSE; + } + return ESP_OK; +} + +static esp_err_t read_response_frame(uint8_t *body_out, size_t body_max, size_t *body_len, int timeout_ms) +{ + uint8_t hdr[8]; +#if defined(CONFIG_PN532_TRANSPORT_SPI) + ESP_RETURN_ON_ERROR(spi_read_bytes(hdr, 6), TAG, "hdr spi"); +#elif defined(CONFIG_PN532_TRANSPORT_I2C) + { + int64_t t0 = esp_timer_get_time() / 1000; + bool ok = false; + while (((esp_timer_get_time() / 1000) - t0) < timeout_ms) { + uint8_t peek[1]; + if (i2c_read_raw(peek, 1) == ESP_OK && peek[0] == 0x01) { + ok = true; + break; + } + vTaskDelay(pdMS_TO_TICKS(2)); + } + if (!ok) { + return ESP_ERR_TIMEOUT; + } + ESP_RETURN_ON_ERROR(i2c_read_raw(hdr, 6), TAG, "hdr i2c"); + } +#elif defined(CONFIG_PN532_TRANSPORT_HSU) + ESP_RETURN_ON_ERROR(hsu_read_raw(hdr, 6, timeout_ms), TAG, "hdr hsu"); +#endif + if (hdr[0] != 0x00 || hdr[1] != 0x00 || hdr[2] != 0xFF) { + ESP_LOG_BUFFER_HEX_LEVEL(TAG, hdr, 6, ESP_LOG_WARN); + return ESP_ERR_INVALID_RESPONSE; + } + uint16_t L = (uint16_t)(hdr[3] * 256 + hdr[4]); + uint8_t lcs = hdr[5]; + if ((uint8_t)((hdr[3] + hdr[4] + lcs) & 0xFF) != 0) { + return ESP_ERR_INVALID_CRC; + } + if (L < 2) { + return ESP_ERR_INVALID_SIZE; + } + /* Read TFI..data (L bytes) + DCS — L includes TFI through last payload byte */ + const size_t read_total = (size_t)L + 1; + if (read_total > 270) { + return ESP_ERR_INVALID_SIZE; + } + uint8_t chunk[272]; +#if defined(CONFIG_PN532_TRANSPORT_SPI) + ESP_RETURN_ON_ERROR(spi_read_bytes(chunk, read_total), TAG, "payload spi"); +#elif defined(CONFIG_PN532_TRANSPORT_I2C) + ESP_RETURN_ON_ERROR(i2c_read_raw(chunk, read_total), TAG, "payload i2c"); +#elif defined(CONFIG_PN532_TRANSPORT_HSU) + ESP_RETURN_ON_ERROR(hsu_read_raw(chunk, read_total, timeout_ms), TAG, "payload hsu"); +#endif + uint8_t tfi = chunk[0]; + if (tfi != 0xD5) { + return ESP_ERR_INVALID_RESPONSE; + } + uint8_t sum = 0; + for (uint16_t i = 0; i < L; i++) { + sum += chunk[i]; + } + uint8_t dcs = chunk[L]; + if ((uint8_t)((sum + dcs) & 0xFF) != 0) { + return ESP_ERR_INVALID_CRC; + } + *body_len = (size_t)L - 1; + if (*body_len > body_max) { + return ESP_ERR_INVALID_SIZE; + } + memcpy(body_out, chunk + 1, *body_len); + return ESP_OK; +} + +esp_err_t pn532_transport_exchange(const uint8_t *tx_body, size_t tx_body_len, uint8_t *rx_body, + size_t rx_body_max, size_t *rx_body_len, int timeout_ms) +{ + if (tx_body_len == 0 || tx_body_len > 255) { + return ESP_ERR_INVALID_ARG; + } + uint16_t L = (uint16_t)(1 + tx_body_len); + uint8_t lcs = (uint8_t)(0x100 - (uint8_t)(((L >> 8) + (L & 0xFF)) & 0xFF)); + uint8_t sum = PN532_HOST_TO_PN532; + for (size_t i = 0; i < tx_body_len; i++) { + sum += tx_body[i]; + } + dcs = (uint8_t)(256 - sum); + + uint8_t frame[PN532_TXBUF_MAX]; + size_t pos = 0; + frame[pos++] = 0x00; + frame[pos++] = 0x00; + frame[pos++] = 0xFF; + frame[pos++] = (uint8_t)((L >> 8) & 0xFF); + frame[pos++] = (uint8_t)(L & 0xFF); + frame[pos++] = lcs; + frame[pos++] = PN532_HOST_TO_PN532; + memcpy(frame + pos, tx_body, tx_body_len); + pos += tx_body_len; + frame[pos++] = dcs; + +#if defined(CONFIG_PN532_TRANSPORT_SPI) + ESP_RETURN_ON_ERROR(spi_write_frame(frame, pos), TAG, "spi wr"); +#elif defined(CONFIG_PN532_TRANSPORT_I2C) + i2c_wakeup(); + ESP_RETURN_ON_ERROR(i2c_write_raw(frame, pos), TAG, "i2c wr"); +#elif defined(CONFIG_PN532_TRANSPORT_HSU) + ESP_RETURN_ON_ERROR(hsu_write_raw(frame, pos), TAG, "hsu wr"); +#endif + + ESP_RETURN_ON_ERROR(read_ack(timeout_ms), TAG, "ack"); + return read_response_frame(rx_body, rx_body_max, rx_body_len, timeout_ms); +} + +esp_err_t pn532_transport_init(void) +{ + s_bus_mutex = xSemaphoreCreateMutex(); + if (!s_bus_mutex) { + return ESP_ERR_NO_MEM; + } +#if defined(CONFIG_PN532_TRANSPORT_SPI) + spi_bus_config_t buscfg = { + .mosi_io_num = CONFIG_PN532_SPI_MOSI_GPIO, + .miso_io_num = CONFIG_PN532_SPI_MISO_GPIO, + .sclk_io_num = CONFIG_PN532_SPI_SCLK_GPIO, + .quadwp_io_num = -1, + .quadhd_io_num = -1, + .max_transfer_sz = 512, + }; + spi_host_device_t host = pn532_spi_host(); + ESP_RETURN_ON_ERROR(spi_bus_initialize(host, &buscfg, SPI_DMA_CH_AUTO), TAG, "spi bus"); + spi_device_interface_config_t devcfg = { + .clock_speed_hz = CONFIG_PN532_SPI_CLOCK_HZ, + .mode = 0, + .spics_io_num = -1, /* manual CS */ + .queue_size = 4, + }; + ESP_RETURN_ON_ERROR(spi_bus_add_device(host, &devcfg, &s_spi), TAG, "spi dev"); + gpio_reset_pin((gpio_num_t)s_spi_cs_gpio); + gpio_set_direction((gpio_num_t)s_spi_cs_gpio, GPIO_MODE_OUTPUT); + gpio_set_level(s_spi_cs_gpio, 1); +#elif defined(CONFIG_PN532_TRANSPORT_I2C) + i2c_config_t ic = { + .mode = I2C_MODE_MASTER, + .sda_io_num = CONFIG_PN532_I2C_SDA_GPIO, + .scl_io_num = CONFIG_PN532_I2C_SCL_GPIO, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master = {.clk_speed = 400000}, + }; + ESP_RETURN_ON_ERROR(i2c_param_config(PN532_I2C_PORT, &ic), TAG, "i2c cfg"); + ESP_RETURN_ON_ERROR(i2c_driver_install(PN532_I2C_PORT, I2C_MODE_MASTER, 0, 0, 0), TAG, "i2c drvr"); +#elif defined(CONFIG_PN532_TRANSPORT_HSU) + uart_config_t uc = { + .baud_rate = CONFIG_PN532_HSU_BAUD, + .data_bits = UART_DATA_8_BITS, + .parity = UART_PARITY_DISABLE, + .stop_bits = UART_STOP_BITS_1, + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, + .source_clk = UART_SCLK_DEFAULT, + }; + ESP_RETURN_ON_ERROR(uart_driver_install(PN532_UART, 2048, 2048, 0, NULL, 0), TAG, "uart"); + ESP_RETURN_ON_ERROR(uart_param_config(PN532_UART, &uc), TAG, "uart cfg"); + ESP_RETURN_ON_ERROR(uart_set_pin(PN532_UART, CONFIG_PN532_HSU_TX_GPIO, CONFIG_PN532_HSU_RX_GPIO, + UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE), + TAG, "uart pins"); +#endif + return ESP_OK; +} + +Fixing a typo in `pn532_transport.c` and correcting the DCS checksum calculation. + +<|tool▁calls▁begin|><|tool▁call▁begin|> +Read \ No newline at end of file diff --git a/firmware/data/assets/index-EAAhhled.js b/firmware/data/assets/index-EAAhhled.js new file mode 100644 index 0000000..d1131fb --- /dev/null +++ b/firmware/data/assets/index-EAAhhled.js @@ -0,0 +1,80 @@ +function Bg(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function Ug(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Df={exports:{}},Ii={},Ff={exports:{}},M={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var as=Symbol.for("react.element"),zg=Symbol.for("react.portal"),$g=Symbol.for("react.fragment"),Wg=Symbol.for("react.strict_mode"),Kg=Symbol.for("react.profiler"),Hg=Symbol.for("react.provider"),Gg=Symbol.for("react.context"),Xg=Symbol.for("react.forward_ref"),Qg=Symbol.for("react.suspense"),Yg=Symbol.for("react.memo"),Zg=Symbol.for("react.lazy"),Gu=Symbol.iterator;function Jg(e){return e===null||typeof e!="object"?null:(e=Gu&&e[Gu]||e["@@iterator"],typeof e=="function"?e:null)}var Mf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_f=Object.assign,Vf={};function tr(e,t,n){this.props=e,this.context=t,this.refs=Vf,this.updater=n||Mf}tr.prototype.isReactComponent={};tr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};tr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Of(){}Of.prototype=tr.prototype;function ml(e,t,n){this.props=e,this.context=t,this.refs=Vf,this.updater=n||Mf}var gl=ml.prototype=new Of;gl.constructor=ml;_f(gl,tr.prototype);gl.isPureReactComponent=!0;var Xu=Array.isArray,If=Object.prototype.hasOwnProperty,yl={current:null},Bf={key:!0,ref:!0,__self:!0,__source:!0};function Uf(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)If.call(t,r)&&!Bf.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1>>1,ie=j[Z];if(0>>1;Zs(ho,D))Yts(ks,ho)?(j[Z]=ks,j[Yt]=D,Z=Yt):(j[Z]=ho,j[Qt]=D,Z=Qt);else if(Yts(ks,D))j[Z]=ks,j[Yt]=D,Z=Yt;else break e}}return L}function s(j,L){var D=j.sortIndex-L.sortIndex;return D!==0?D:j.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,f=null,h=3,g=!1,v=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(j){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=j)r(u),L.sortIndex=L.expirationTime,t(l,L);else break;L=n(u)}}function b(j){if(w=!1,y(j),!v)if(n(l)!==null)v=!0,Ss(k);else{var L=n(u);L!==null&&ne(b,L.startTime-j)}}function k(j,L){v=!1,w&&(w=!1,m(P),P=-1),g=!0;var D=h;try{for(y(L),f=n(l);f!==null&&(!(f.expirationTime>L)||j&&!ee());){var Z=f.callback;if(typeof Z=="function"){f.callback=null,h=f.priorityLevel;var ie=Z(f.expirationTime<=L);L=e.unstable_now(),typeof ie=="function"?f.callback=ie:f===n(l)&&r(l),y(L)}else r(l);f=n(l)}if(f!==null)var bs=!0;else{var Qt=n(u);Qt!==null&&ne(b,Qt.startTime-L),bs=!1}return bs}finally{f=null,h=D,g=!1}}var C=!1,E=null,P=-1,F=5,A=-1;function ee(){return!(e.unstable_now()-Aj||125Z?(j.sortIndex=D,t(u,j),n(l)===null&&j===n(u)&&(w?(m(P),P=-1):w=!0,ne(b,D-Z))):(j.sortIndex=ie,t(l,j),v||g||(v=!0,Ss(k))),j},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(j){var L=h;return function(){var D=h;h=L;try{return j.apply(this,arguments)}finally{h=D}}}})(Gf);Hf.exports=Gf;var c0=Hf.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var d0=x,Re=c0;function T(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),na=Object.prototype.hasOwnProperty,f0=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Yu={},Zu={};function h0(e){return na.call(Zu,e)?!0:na.call(Yu,e)?!1:f0.test(e)?Zu[e]=!0:(Yu[e]=!0,!1)}function p0(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function m0(e,t,n,r){if(t===null||typeof t>"u"||p0(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Se(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var de={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){de[e]=new Se(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];de[t]=new Se(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){de[e]=new Se(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){de[e]=new Se(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){de[e]=new Se(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){de[e]=new Se(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){de[e]=new Se(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){de[e]=new Se(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){de[e]=new Se(e,5,!1,e.toLowerCase(),null,!1,!1)});var xl=/[\-:]([a-z])/g;function wl(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(xl,wl);de[t]=new Se(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(xl,wl);de[t]=new Se(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(xl,wl);de[t]=new Se(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){de[e]=new Se(e,1,!1,e.toLowerCase(),null,!1,!1)});de.xlinkHref=new Se("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){de[e]=new Se(e,1,!1,e.toLowerCase(),null,!0,!0)});function Sl(e,t,n,r){var s=de.hasOwnProperty(t)?de[t]:null;(s!==null?s.type!==0:r||!(2a||s[o]!==i[a]){var l=` +`+s[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{go=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?gr(e):""}function g0(e){switch(e.tag){case 5:return gr(e.type);case 16:return gr("Lazy");case 13:return gr("Suspense");case 19:return gr("SuspenseList");case 0:case 2:case 15:return e=yo(e.type,!1),e;case 11:return e=yo(e.type.render,!1),e;case 1:return e=yo(e.type,!0),e;default:return""}}function oa(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case bn:return"Fragment";case Sn:return"Portal";case ra:return"Profiler";case bl:return"StrictMode";case sa:return"Suspense";case ia:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Yf:return(e.displayName||"Context")+".Consumer";case Qf:return(e._context.displayName||"Context")+".Provider";case kl:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Cl:return t=e.displayName||null,t!==null?t:oa(e.type)||"Memo";case kt:t=e._payload,e=e._init;try{return oa(e(t))}catch{}}return null}function y0(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oa(t);case 8:return t===bl?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function It(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Jf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function v0(e){var t=Jf(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ts(e){e._valueTracker||(e._valueTracker=v0(e))}function qf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Jf(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function oi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function aa(e,t){var n=t.checked;return G({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function qu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=It(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function eh(e,t){t=t.checked,t!=null&&Sl(e,"checked",t,!1)}function la(e,t){eh(e,t);var n=It(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ua(e,t.type,n):t.hasOwnProperty("defaultValue")&&ua(e,t.type,It(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ec(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ua(e,t,n){(t!=="number"||oi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var yr=Array.isArray;function On(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Es.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Or(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Cr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},x0=["Webkit","ms","Moz","O"];Object.keys(Cr).forEach(function(e){x0.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Cr[t]=Cr[e]})});function sh(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Cr.hasOwnProperty(e)&&Cr[e]?(""+t).trim():t+"px"}function ih(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=sh(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var w0=G({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fa(e,t){if(t){if(w0[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(T(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(T(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(T(61))}if(t.style!=null&&typeof t.style!="object")throw Error(T(62))}}function ha(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pa=null;function Pl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ma=null,In=null,Bn=null;function rc(e){if(e=cs(e)){if(typeof ma!="function")throw Error(T(280));var t=e.stateNode;t&&(t=Wi(t),ma(e.stateNode,e.type,t))}}function oh(e){In?Bn?Bn.push(e):Bn=[e]:In=e}function ah(){if(In){var e=In,t=Bn;if(Bn=In=null,rc(e),t)for(e=0;e>>=0,e===0?32:31-(R0(e)/L0|0)|0}var js=64,Ns=4194304;function vr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ci(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=vr(a):(i&=o,i!==0&&(r=vr(i)))}else o=n&~s,o!==0?r=vr(o):i!==0&&(r=vr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function ls(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Qe(t),e[t]=n}function _0(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Tr),fc=" ",hc=!1;function Eh(e,t){switch(e){case"keyup":return cy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var kn=!1;function fy(e,t){switch(e){case"compositionend":return jh(t);case"keypress":return t.which!==32?null:(hc=!0,fc);case"textInput":return e=t.data,e===fc&&hc?null:e;default:return null}}function hy(e,t){if(kn)return e==="compositionend"||!Dl&&Eh(e,t)?(e=Ph(),Xs=Al=Et=null,kn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=yc(n)}}function Lh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Lh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dh(){for(var e=window,t=oi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=oi(e.document)}return t}function Fl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function by(e){var t=Dh(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Lh(n.ownerDocument.documentElement,n)){if(r!==null&&Fl(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=vc(n,i);var o=vc(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Cn=null,Sa=null,jr=null,ba=!1;function xc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ba||Cn==null||Cn!==oi(r)||(r=Cn,"selectionStart"in r&&Fl(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jr&&Wr(jr,r)||(jr=r,r=hi(Sa,"onSelect"),0En||(e.current=ja[En],ja[En]=null,En--)}function I(e,t){En++,ja[En]=e.current,e.current=t}var Bt={},ye=Wt(Bt),Ce=Wt(!1),cn=Bt;function Kn(e,t){var n=e.type.contextTypes;if(!n)return Bt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Pe(e){return e=e.childContextTypes,e!=null}function mi(){U(Ce),U(ye)}function Tc(e,t,n){if(ye.current!==Bt)throw Error(T(168));I(ye,t),I(Ce,n)}function zh(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(T(108,y0(e)||"Unknown",s));return G({},n,r)}function gi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Bt,cn=ye.current,I(ye,e),I(Ce,Ce.current),!0}function Ec(e,t,n){var r=e.stateNode;if(!r)throw Error(T(169));n?(e=zh(e,t,cn),r.__reactInternalMemoizedMergedChildContext=e,U(Ce),U(ye),I(ye,e)):U(Ce),I(Ce,n)}var at=null,Ki=!1,Ro=!1;function $h(e){at===null?at=[e]:at.push(e)}function Fy(e){Ki=!0,$h(e)}function Kt(){if(!Ro&&at!==null){Ro=!0;var e=0,t=V;try{var n=at;for(V=1;e>=o,s-=o,lt=1<<32-Qe(t)+s|n<P?(F=E,E=null):F=E.sibling;var A=h(m,E,y[P],b);if(A===null){E===null&&(E=F);break}e&&E&&A.alternate===null&&t(m,E),p=i(A,p,P),C===null?k=A:C.sibling=A,C=A,E=F}if(P===y.length)return n(m,E),$&&Jt(m,P),k;if(E===null){for(;PP?(F=E,E=null):F=E.sibling;var ee=h(m,E,A.value,b);if(ee===null){E===null&&(E=F);break}e&&E&&ee.alternate===null&&t(m,E),p=i(ee,p,P),C===null?k=ee:C.sibling=ee,C=ee,E=F}if(A.done)return n(m,E),$&&Jt(m,P),k;if(E===null){for(;!A.done;P++,A=y.next())A=f(m,A.value,b),A!==null&&(p=i(A,p,P),C===null?k=A:C.sibling=A,C=A);return $&&Jt(m,P),k}for(E=r(m,E);!A.done;P++,A=y.next())A=g(E,m,P,A.value,b),A!==null&&(e&&A.alternate!==null&&E.delete(A.key===null?P:A.key),p=i(A,p,P),C===null?k=A:C.sibling=A,C=A);return e&&E.forEach(function(wt){return t(m,wt)}),$&&Jt(m,P),k}function S(m,p,y,b){if(typeof y=="object"&&y!==null&&y.type===bn&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Ps:e:{for(var k=y.key,C=p;C!==null;){if(C.key===k){if(k=y.type,k===bn){if(C.tag===7){n(m,C.sibling),p=s(C,y.props.children),p.return=m,m=p;break e}}else if(C.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===kt&&Ac(k)===C.type){n(m,C.sibling),p=s(C,y.props),p.ref=fr(m,C,y),p.return=m,m=p;break e}n(m,C);break}else t(m,C);C=C.sibling}y.type===bn?(p=ln(y.props.children,m.mode,b,y.key),p.return=m,m=p):(b=ni(y.type,y.key,y.props,null,m.mode,b),b.ref=fr(m,p,y),b.return=m,m=b)}return o(m);case Sn:e:{for(C=y.key;p!==null;){if(p.key===C)if(p.tag===4&&p.stateNode.containerInfo===y.containerInfo&&p.stateNode.implementation===y.implementation){n(m,p.sibling),p=s(p,y.children||[]),p.return=m,m=p;break e}else{n(m,p);break}else t(m,p);p=p.sibling}p=Io(y,m.mode,b),p.return=m,m=p}return o(m);case kt:return C=y._init,S(m,p,C(y._payload),b)}if(yr(y))return v(m,p,y,b);if(ar(y))return w(m,p,y,b);_s(m,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,p!==null&&p.tag===6?(n(m,p.sibling),p=s(p,y),p.return=m,m=p):(n(m,p),p=Oo(y,m.mode,b),p.return=m,m=p),o(m)):n(m,p)}return S}var Gn=Gh(!0),Xh=Gh(!1),xi=Wt(null),wi=null,An=null,Ol=null;function Il(){Ol=An=wi=null}function Bl(e){var t=xi.current;U(xi),e._currentValue=t}function Ra(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function zn(e,t){wi=e,Ol=An=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ke=!0),e.firstContext=null)}function ze(e){var t=e._currentValue;if(Ol!==e)if(e={context:e,memoizedValue:t,next:null},An===null){if(wi===null)throw Error(T(308));An=e,wi.dependencies={lanes:0,firstContext:e}}else An=An.next=e;return t}var rn=null;function Ul(e){rn===null?rn=[e]:rn.push(e)}function Qh(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Ul(t)):(n.next=s.next,s.next=n),t.interleaved=n,mt(e,r)}function mt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ct=!1;function zl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Yh(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ct(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ft(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,_&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,mt(e,n)}return s=r.interleaved,s===null?(t.next=t,Ul(r)):(t.next=s.next,s.next=t),r.interleaved=t,mt(e,n)}function Ys(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,El(e,n)}}function Rc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Si(e,t,n,r){var s=e.updateQueue;Ct=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?i=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(i!==null){var f=s.baseState;o=0,c=u=l=null,a=i;do{var h=a.lane,g=a.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=e,w=a;switch(h=t,g=n,w.tag){case 1:if(v=w.payload,typeof v=="function"){f=v.call(g,f,h);break e}f=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=w.payload,h=typeof v=="function"?v.call(g,f,h):v,h==null)break e;f=G({},f,h);break e;case 2:Ct=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[a]:h.push(a))}else g={eventTime:g,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=g,l=f):c=c.next=g,o|=h;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;h=a,a=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(c===null&&(l=f),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=c,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);hn|=o,e.lanes=o,e.memoizedState=f}}function Lc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Do.transition;Do.transition={};try{e(!1),t()}finally{V=n,Do.transition=r}}function hp(){return $e().memoizedState}function Oy(e,t,n){var r=_t(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},pp(e))mp(t,n);else if(n=Qh(e,t,n,r),n!==null){var s=xe();Ye(n,e,r,s),gp(n,t,r)}}function Iy(e,t,n){var r=_t(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(pp(e))mp(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,Ze(a,o)){var l=t.interleaved;l===null?(s.next=s,Ul(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=Qh(e,t,s,r),n!==null&&(s=xe(),Ye(n,e,r,s),gp(n,t,r))}}function pp(e){var t=e.alternate;return e===H||t!==null&&t===H}function mp(e,t){Nr=ki=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gp(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,El(e,n)}}var Ci={readContext:ze,useCallback:fe,useContext:fe,useEffect:fe,useImperativeHandle:fe,useInsertionEffect:fe,useLayoutEffect:fe,useMemo:fe,useReducer:fe,useRef:fe,useState:fe,useDebugValue:fe,useDeferredValue:fe,useTransition:fe,useMutableSource:fe,useSyncExternalStore:fe,useId:fe,unstable_isNewReconciler:!1},By={readContext:ze,useCallback:function(e,t){return et().memoizedState=[e,t===void 0?null:t],e},useContext:ze,useEffect:Fc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Js(4194308,4,lp.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Js(4194308,4,e,t)},useInsertionEffect:function(e,t){return Js(4,2,e,t)},useMemo:function(e,t){var n=et();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=et();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Oy.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=et();return e={current:e},t.memoizedState=e},useState:Dc,useDebugValue:Yl,useDeferredValue:function(e){return et().memoizedState=e},useTransition:function(){var e=Dc(!1),t=e[0];return e=Vy.bind(null,e[1]),et().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,s=et();if($){if(n===void 0)throw Error(T(407));n=n()}else{if(n=t(),ae===null)throw Error(T(349));fn&30||ep(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Fc(np.bind(null,r,i,e),[e]),r.flags|=2048,Jr(9,tp.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=et(),t=ae.identifierPrefix;if($){var n=ut,r=lt;n=(r&~(1<<32-Qe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Yr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[tt]=t,e[Gr]=r,Tp(e,t,!1,!1),t.stateNode=e;e:{switch(o=ha(n,r),n){case"dialog":B("cancel",e),B("close",e),s=r;break;case"iframe":case"object":case"embed":B("load",e),s=r;break;case"video":case"audio":for(s=0;sYn&&(t.flags|=128,r=!0,hr(i,!1),t.lanes=4194304)}else{if(!r)if(e=bi(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),hr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!$)return he(t),null}else 2*q()-i.renderingStartTime>Yn&&n!==1073741824&&(t.flags|=128,r=!0,hr(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=q(),t.sibling=null,n=W.current,I(W,r?n&1|2:n&1),t):(he(t),null);case 22:case 23:return nu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ee&1073741824&&(he(t),t.subtreeFlags&6&&(t.flags|=8192)):he(t),null;case 24:return null;case 25:return null}throw Error(T(156,t.tag))}function Xy(e,t){switch(_l(t),t.tag){case 1:return Pe(t.type)&&mi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xn(),U(Ce),U(ye),Kl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Wl(t),null;case 13:if(U(W),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(T(340));Hn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(W),null;case 4:return Xn(),null;case 10:return Bl(t.type._context),null;case 22:case 23:return nu(),null;case 24:return null;default:return null}}var Os=!1,me=!1,Qy=typeof WeakSet=="function"?WeakSet:Set,N=null;function Rn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Q(e,t,r)}else n.current=null}function Ba(e,t,n){try{n()}catch(r){Q(e,t,r)}}var Kc=!1;function Yy(e,t){if(ka=di,e=Dh(),Fl(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,f=e,h=null;t:for(;;){for(var g;f!==n||s!==0&&f.nodeType!==3||(a=o+s),f!==i||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(g=f.firstChild)!==null;)h=f,f=g;for(;;){if(f===e)break t;if(h===n&&++u===s&&(a=o),h===i&&++c===r&&(l=o),(g=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=g}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ca={focusedElem:e,selectionRange:n},di=!1,N=t;N!==null;)if(t=N,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,N=e;else for(;N!==null;){t=N;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,S=v.memoizedState,m=t.stateNode,p=m.getSnapshotBeforeUpdate(t.elementType===t.type?w:He(t.type,w),S);m.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(T(163))}}catch(b){Q(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,N=e;break}N=t.return}return v=Kc,Kc=!1,v}function Ar(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Ba(t,n,i)}s=s.next}while(s!==r)}}function Xi(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ua(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Np(e){var t=e.alternate;t!==null&&(e.alternate=null,Np(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[tt],delete t[Gr],delete t[Ea],delete t[Ly],delete t[Dy])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ap(e){return e.tag===5||e.tag===3||e.tag===4}function Hc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ap(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function za(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=pi));else if(r!==4&&(e=e.child,e!==null))for(za(e,t,n),e=e.sibling;e!==null;)za(e,t,n),e=e.sibling}function $a(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for($a(e,t,n),e=e.sibling;e!==null;)$a(e,t,n),e=e.sibling}var le=null,Ge=!1;function St(e,t,n){for(n=n.child;n!==null;)Rp(e,t,n),n=n.sibling}function Rp(e,t,n){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(Bi,n)}catch{}switch(n.tag){case 5:me||Rn(n,t);case 6:var r=le,s=Ge;le=null,St(e,t,n),le=r,Ge=s,le!==null&&(Ge?(e=le,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):le.removeChild(n.stateNode));break;case 18:le!==null&&(Ge?(e=le,n=n.stateNode,e.nodeType===8?Ao(e.parentNode,n):e.nodeType===1&&Ao(e,n),zr(e)):Ao(le,n.stateNode));break;case 4:r=le,s=Ge,le=n.stateNode.containerInfo,Ge=!0,St(e,t,n),le=r,Ge=s;break;case 0:case 11:case 14:case 15:if(!me&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Ba(n,t,o),s=s.next}while(s!==r)}St(e,t,n);break;case 1:if(!me&&(Rn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Q(n,t,a)}St(e,t,n);break;case 21:St(e,t,n);break;case 22:n.mode&1?(me=(r=me)||n.memoizedState!==null,St(e,t,n),me=r):St(e,t,n);break;default:St(e,t,n)}}function Gc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Qy),t.forEach(function(r){var s=iv.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function We(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=q()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Jy(r/1960))-r,10e?16:e,jt===null)var r=!1;else{if(e=jt,jt=null,Ei=0,_&6)throw Error(T(331));var s=_;for(_|=4,N=e.current;N!==null;){var i=N,o=i.child;if(N.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lq()-eu?an(e,0):ql|=n),Te(e,t)}function Ip(e,t){t===0&&(e.mode&1?(t=Ns,Ns<<=1,!(Ns&130023424)&&(Ns=4194304)):t=1);var n=xe();e=mt(e,t),e!==null&&(ls(e,t,n),Te(e,n))}function sv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ip(e,n)}function iv(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(T(314))}r!==null&&r.delete(t),Ip(e,n)}var Bp;Bp=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ce.current)ke=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ke=!1,Hy(e,t,n);ke=!!(e.flags&131072)}else ke=!1,$&&t.flags&1048576&&Wh(t,vi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;qs(e,t),e=t.pendingProps;var s=Kn(t,ye.current);zn(t,n),s=Gl(null,t,r,e,s,n);var i=Xl();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Pe(r)?(i=!0,gi(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,zl(t),s.updater=Gi,t.stateNode=s,s._reactInternals=t,Da(t,r,e,n),t=_a(null,t,r,!0,i,n)):(t.tag=0,$&&i&&Ml(t),ve(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(qs(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=av(r),e=He(r,e),s){case 0:t=Ma(null,t,r,e,n);break e;case 1:t=zc(null,t,r,e,n);break e;case 11:t=Bc(null,t,r,e,n);break e;case 14:t=Uc(null,t,r,He(r.type,e),n);break e}throw Error(T(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:He(r,s),Ma(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:He(r,s),zc(e,t,r,s,n);case 3:e:{if(kp(t),e===null)throw Error(T(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Yh(e,t),Si(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Qn(Error(T(423)),t),t=$c(e,t,r,n,s);break e}else if(r!==s){s=Qn(Error(T(424)),t),t=$c(e,t,r,n,s);break e}else for(je=Dt(t.stateNode.containerInfo.firstChild),Ne=t,$=!0,Xe=null,n=Xh(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Hn(),r===s){t=gt(e,t,n);break e}ve(e,t,r,n)}t=t.child}return t;case 5:return Zh(t),e===null&&Aa(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Pa(r,s)?o=null:i!==null&&Pa(r,i)&&(t.flags|=32),bp(e,t),ve(e,t,o,n),t.child;case 6:return e===null&&Aa(t),null;case 13:return Cp(e,t,n);case 4:return $l(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Gn(t,null,r,n):ve(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:He(r,s),Bc(e,t,r,s,n);case 7:return ve(e,t,t.pendingProps,n),t.child;case 8:return ve(e,t,t.pendingProps.children,n),t.child;case 12:return ve(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,I(xi,r._currentValue),r._currentValue=o,i!==null)if(Ze(i.value,o)){if(i.children===s.children&&!Ce.current){t=gt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=ct(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Ra(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(T(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Ra(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ve(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,zn(t,n),s=ze(s),r=r(s),t.flags|=1,ve(e,t,r,n),t.child;case 14:return r=t.type,s=He(r,t.pendingProps),s=He(r.type,s),Uc(e,t,r,s,n);case 15:return wp(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:He(r,s),qs(e,t),t.tag=1,Pe(r)?(e=!0,gi(t)):e=!1,zn(t,n),yp(t,r,s),Da(t,r,s,n),_a(null,t,r,!0,e,n);case 19:return Pp(e,t,n);case 22:return Sp(e,t,n)}throw Error(T(156,t.tag))};function Up(e,t){return ph(e,t)}function ov(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Be(e,t,n,r){return new ov(e,t,n,r)}function su(e){return e=e.prototype,!(!e||!e.isReactComponent)}function av(e){if(typeof e=="function")return su(e)?1:0;if(e!=null){if(e=e.$$typeof,e===kl)return 11;if(e===Cl)return 14}return 2}function Vt(e,t){var n=e.alternate;return n===null?(n=Be(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ni(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")su(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case bn:return ln(n.children,s,i,t);case bl:o=8,s|=8;break;case ra:return e=Be(12,n,t,s|2),e.elementType=ra,e.lanes=i,e;case sa:return e=Be(13,n,t,s),e.elementType=sa,e.lanes=i,e;case ia:return e=Be(19,n,t,s),e.elementType=ia,e.lanes=i,e;case Zf:return Yi(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Qf:o=10;break e;case Yf:o=9;break e;case kl:o=11;break e;case Cl:o=14;break e;case kt:o=16,r=null;break e}throw Error(T(130,e==null?e:typeof e,""))}return t=Be(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function ln(e,t,n,r){return e=Be(7,e,r,t),e.lanes=n,e}function Yi(e,t,n,r){return e=Be(22,e,r,t),e.elementType=Zf,e.lanes=n,e.stateNode={isHidden:!1},e}function Oo(e,t,n){return e=Be(6,e,null,t),e.lanes=n,e}function Io(e,t,n){return t=Be(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function lv(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=xo(0),this.expirationTimes=xo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xo(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function iu(e,t,n,r,s,i,o,a,l){return e=new lv(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Be(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},zl(i),e}function uv(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kp)}catch(e){console.error(e)}}Kp(),Kf.exports=De;var pv=Kf.exports,td=pv;ta.createRoot=td.createRoot,ta.hydrateRoot=td.hydrateRoot;/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function es(){return es=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function to(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function gv(){return Math.random().toString(36).substr(2,8)}function rd(e,t){return{usr:e.state,key:e.key,idx:t}}function Xa(e,t,n,r){return n===void 0&&(n=null),es({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?yn(t):t,{state:n,key:t&&t.key||r||gv()})}function Ai(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function yn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function yv(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,a=Nt.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(es({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function f(){a=Nt.Pop;let S=c(),m=S==null?null:S-u;u=S,l&&l({action:a,location:w.location,delta:m})}function h(S,m){a=Nt.Push;let p=Xa(w.location,S,m);n&&n(p,S),u=c()+1;let y=rd(p,u),b=w.createHref(p);try{o.pushState(y,"",b)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;s.location.assign(b)}i&&l&&l({action:a,location:w.location,delta:1})}function g(S,m){a=Nt.Replace;let p=Xa(w.location,S,m);n&&n(p,S),u=c();let y=rd(p,u),b=w.createHref(p);o.replaceState(y,"",b),i&&l&&l({action:a,location:w.location,delta:0})}function v(S){let m=s.location.origin!=="null"?s.location.origin:s.location.href,p=typeof S=="string"?S:Ai(S);return p=p.replace(/ $/,"%20"),Y(m,"No window.location.(origin|href) available to create URL for href: "+p),new URL(p,m)}let w={get action(){return a},get location(){return e(s,o)},listen(S){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(nd,f),l=S,()=>{s.removeEventListener(nd,f),l=null}},createHref(S){return t(s,S)},createURL:v,encodeLocation(S){let m=v(S);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:h,replace:g,go(S){return o.go(S)}};return w}var sd;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(sd||(sd={}));function vv(e,t,n){return n===void 0&&(n="/"),xv(e,t,n)}function xv(e,t,n,r){let s=typeof t=="string"?yn(t):t,i=Zn(s.pathname||"/",n);if(i==null)return null;let o=Hp(e);wv(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(Y(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Ot([r,l.relativePath]),c=n.concat(l);i.children&&i.children.length>0&&(Y(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Hp(i.children,t,c,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:Ev(u,i.index),routesMeta:c})};return e.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))s(i,o);else for(let l of Gp(i.path))s(i,o,l)}),t}function Gp(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=Gp(r.join("/")),a=[];return a.push(...o.map(l=>l===""?i:[i,l].join("/"))),s&&a.push(...o),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function wv(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:jv(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Sv=/^:[\w-]+$/,bv=3,kv=2,Cv=1,Pv=10,Tv=-2,id=e=>e==="*";function Ev(e,t){let n=e.split("/"),r=n.length;return n.some(id)&&(r+=Tv),t&&(r+=kv),n.filter(s=>!id(s)).reduce((s,i)=>s+(Sv.test(i)?bv:i===""?Cv:Pv),r)}function jv(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function Nv(e,t,n){let{routesMeta:r}=e,s={},i="/",o=[];for(let a=0;a{let{paramName:h,isOptional:g}=c;if(h==="*"){let w=a[f]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const v=a[f];return g&&!v?u[h]=void 0:u[h]=(v||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function Av(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),to(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function Rv(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return to(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Zn(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const Lv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dv=e=>Lv.test(e);function Fv(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?yn(e):e,i;if(n)if(Dv(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),to(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=od(n.substring(1),"/"):i=od(n,t)}else i=t;return{pathname:i,search:Vv(r),hash:Ov(s)}}function od(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Bo(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Mv(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Xp(e,t){let n=Mv(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Qp(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=yn(e):(s=es({},e),Y(!s.pathname||!s.pathname.includes("?"),Bo("?","pathname","search",s)),Y(!s.pathname||!s.pathname.includes("#"),Bo("#","pathname","hash",s)),Y(!s.search||!s.search.includes("#"),Bo("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,a;if(o==null)a=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}a=f>=0?t[f]:"/"}let l=Fv(s,a),u=o&&o!=="/"&&o.endsWith("/"),c=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Ot=e=>e.join("/").replace(/\/\/+/g,"/"),_v=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Vv=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ov=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Iv(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Yp=["post","put","patch","delete"];new Set(Yp);const Bv=["get",...Yp];new Set(Bv);/** + * React Router v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function ts(){return ts=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),x.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let f=Qp(u,JSON.parse(o),i,c.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Ot([t,f.pathname])),(c.replace?r.replace:r.push)(f,c.state,c)},[t,r,o,i,e])}function so(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=x.useContext(Ht),{matches:s}=x.useContext(vn),{pathname:i}=hs(),o=JSON.stringify(Xp(s,r.v7_relativeSplatPath));return x.useMemo(()=>Qp(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function Wv(e,t){return Kv(e,t)}function Kv(e,t,n,r){fs()||Y(!1);let{navigator:s}=x.useContext(Ht),{matches:i}=x.useContext(vn),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=hs(),c;if(t){var f;let S=typeof t=="string"?yn(t):t;l==="/"||(f=S.pathname)!=null&&f.startsWith(l)||Y(!1),c=S}else c=u;let h=c.pathname||"/",g=h;if(l!=="/"){let S=l.replace(/^\//,"").split("/");g="/"+h.replace(/^\//,"").split("/").slice(S.length).join("/")}let v=vv(e,{pathname:g}),w=Yv(v&&v.map(S=>Object.assign({},S,{params:Object.assign({},a,S.params),pathname:Ot([l,s.encodeLocation?s.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?l:Ot([l,s.encodeLocation?s.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),i,n,r);return t&&w?x.createElement(ro.Provider,{value:{location:ts({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Nt.Pop}},w):w}function Hv(){let e=ex(),t=Iv(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:s},n):null,null)}const Gv=x.createElement(Hv,null);class Xv extends x.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?x.createElement(vn.Provider,{value:this.props.routeContext},x.createElement(Jp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Qv(e){let{routeContext:t,match:n,children:r}=e,s=x.useContext(no);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(vn.Provider,{value:t},r)}function Yv(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=(s=n)==null?void 0:s.errors;if(a!=null){let c=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);c>=0||Y(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,f,h)=>{let g,v=!1,w=null,S=null;n&&(g=a&&f.route.id?a[f.route.id]:void 0,w=f.route.errorElement||Gv,l&&(u<0&&h===0?(nx("route-fallback"),v=!0,S=null):u===h&&(v=!0,S=f.route.hydrateFallbackElement||null)));let m=t.concat(o.slice(0,h+1)),p=()=>{let y;return g?y=w:v?y=S:f.route.Component?y=x.createElement(f.route.Component,null):f.route.element?y=f.route.element:y=c,x.createElement(Qv,{match:f,routeContext:{outlet:c,matches:m,isDataRoute:n!=null},children:y})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?x.createElement(Xv,{location:n.location,revalidation:n.revalidation,component:w,error:g,children:p(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):p()},null)}var em=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(em||{}),tm=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(tm||{});function Zv(e){let t=x.useContext(no);return t||Y(!1),t}function Jv(e){let t=x.useContext(Zp);return t||Y(!1),t}function qv(e){let t=x.useContext(vn);return t||Y(!1),t}function nm(e){let t=qv(),n=t.matches[t.matches.length-1];return n.route.id||Y(!1),n.route.id}function ex(){var e;let t=x.useContext(Jp),n=Jv(),r=nm();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function tx(){let{router:e}=Zv(em.UseNavigateStable),t=nm(tm.UseNavigateStable),n=x.useRef(!1);return qp(()=>{n.current=!0}),x.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,ts({fromRouteId:t},i)))},[e,t])}const ad={};function nx(e,t,n){ad[e]||(ad[e]=!0)}function rx(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function _e(e){Y(!1)}function sx(e){let{basename:t="/",children:n=null,location:r,navigationType:s=Nt.Pop,navigator:i,static:o=!1,future:a}=e;fs()&&Y(!1);let l=t.replace(/^\/*/,"/"),u=x.useMemo(()=>({basename:l,navigator:i,static:o,future:ts({v7_relativeSplatPath:!1},a)}),[l,a,i,o]);typeof r=="string"&&(r=yn(r));let{pathname:c="/",search:f="",hash:h="",state:g=null,key:v="default"}=r,w=x.useMemo(()=>{let S=Zn(c,l);return S==null?null:{location:{pathname:S,search:f,hash:h,state:g,key:v},navigationType:s}},[l,c,f,h,g,v,s]);return w==null?null:x.createElement(Ht.Provider,{value:u},x.createElement(ro.Provider,{children:n,value:w}))}function ix(e){let{children:t,location:n}=e;return Wv(Ya(t),n)}new Promise(()=>{});function Ya(e,t){t===void 0&&(t=[]);let n=[];return x.Children.forEach(e,(r,s)=>{if(!x.isValidElement(r))return;let i=[...t,s];if(r.type===x.Fragment){n.push.apply(n,Ya(r.props.children,i));return}r.type!==_e&&Y(!1),!r.props.index||!r.props.children||Y(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Ya(r.props.children,i)),n.push(o)}),n}/** + * React Router DOM v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Ri(){return Ri=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function ox(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ax(e,t){return e.button===0&&(!t||t==="_self")&&!ox(e)}const lx=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ux=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],cx="6";try{window.__reactRouterVersion=cx}catch{}const dx=x.createContext({isTransitioning:!1}),fx="startTransition",ld=r0[fx];function hx(e){let{basename:t,children:n,future:r,window:s}=e,i=x.useRef();i.current==null&&(i.current=mv({window:s,v5Compat:!0}));let o=i.current,[a,l]=x.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=x.useCallback(f=>{u&&ld?ld(()=>l(f)):l(f)},[l,u]);return x.useLayoutEffect(()=>o.listen(c),[o,c]),x.useEffect(()=>rx(r),[r]),x.createElement(sx,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const px=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",mx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,sm=x.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:a,target:l,to:u,preventScrollReset:c,viewTransition:f}=t,h=rm(t,lx),{basename:g}=x.useContext(Ht),v,w=!1;if(typeof u=="string"&&mx.test(u)&&(v=u,px))try{let y=new URL(window.location.href),b=u.startsWith("//")?new URL(y.protocol+u):new URL(u),k=Zn(b.pathname,g);b.origin===y.origin&&k!=null?u=k+b.search+b.hash:w=!0}catch{}let S=Uv(u,{relative:s}),m=vx(u,{replace:o,state:a,target:l,preventScrollReset:c,relative:s,viewTransition:f});function p(y){r&&r(y),y.defaultPrevented||m(y)}return x.createElement("a",Ri({},h,{href:v||S,onClick:w||i?r:p,ref:n,target:l}))}),gx=x.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:s=!1,className:i="",end:o=!1,style:a,to:l,viewTransition:u,children:c}=t,f=rm(t,ux),h=so(l,{relative:f.relative}),g=hs(),v=x.useContext(Zp),{navigator:w,basename:S}=x.useContext(Ht),m=v!=null&&xx(h)&&u===!0,p=w.encodeLocation?w.encodeLocation(h).pathname:h.pathname,y=g.pathname,b=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;s||(y=y.toLowerCase(),b=b?b.toLowerCase():null,p=p.toLowerCase()),b&&S&&(b=Zn(b,S)||b);const k=p!=="/"&&p.endsWith("/")?p.length-1:p.length;let C=y===p||!o&&y.startsWith(p)&&y.charAt(k)==="/",E=b!=null&&(b===p||!o&&b.startsWith(p)&&b.charAt(p.length)==="/"),P={isActive:C,isPending:E,isTransitioning:m},F=C?r:void 0,A;typeof i=="function"?A=i(P):A=[i,C?"active":null,E?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let ee=typeof a=="function"?a(P):a;return x.createElement(sm,Ri({},f,{"aria-current":F,className:A,ref:n,style:ee,to:l,viewTransition:u}),typeof c=="function"?c(P):c)});var Za;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Za||(Za={}));var ud;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ud||(ud={}));function yx(e){let t=x.useContext(no);return t||Y(!1),t}function vx(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:a}=t===void 0?{}:t,l=zv(),u=hs(),c=so(e,{relative:o});return x.useCallback(f=>{if(ax(f,n)){f.preventDefault();let h=r!==void 0?r:Ai(u)===Ai(c);l(e,{replace:h,state:s,preventScrollReset:i,relative:o,viewTransition:a})}},[u,l,c,r,s,n,e,i,o,a])}function xx(e,t){t===void 0&&(t={});let n=x.useContext(dx);n==null&&Y(!1);let{basename:r}=yx(Za.useViewTransitionState),s=so(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Zn(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Zn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Qa(s.pathname,o)!=null||Qa(s.pathname,i)!=null}const uu=x.createContext({});function cu(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const io=x.createContext(null),du=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class wx extends x.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Sx({children:e,isPresent:t}){const n=x.useId(),r=x.useRef(null),s=x.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=x.useContext(du);return x.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:u}=s.current;if(t||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const c=document.createElement("style");return i&&(c.nonce=i),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(` + [data-motion-pop-id="${n}"] { + position: absolute !important; + width: ${o}px !important; + height: ${a}px !important; + top: ${l}px !important; + left: ${u}px !important; + } + `),()=>{document.head.removeChild(c)}},[t]),d.jsx(wx,{isPresent:t,childRef:r,sizeRef:s,children:x.cloneElement(e,{ref:r})})}const bx=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const a=cu(kx),l=x.useId(),u=x.useCallback(f=>{a.set(f,!0);for(const h of a.values())if(!h)return;r&&r()},[a,r]),c=x.useMemo(()=>({id:l,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(a.set(f,!1),()=>a.delete(f))}),i?[Math.random(),u]:[n,u]);return x.useMemo(()=>{a.forEach((f,h)=>a.set(h,!1))},[n]),x.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),o==="popLayout"&&(e=d.jsx(Sx,{isPresent:n,children:e})),d.jsx(io.Provider,{value:c,children:e})};function kx(){return new Map}function im(e=!0){const t=x.useContext(io);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=x.useId();x.useEffect(()=>{e&&s(i)},[e]);const o=x.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const Us=e=>e.key||"";function cd(e){const t=[];return x.Children.forEach(e,n=>{x.isValidElement(n)&&t.push(n)}),t}const fu=typeof window<"u",om=fu?x.useLayoutEffect:x.useEffect,am=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1})=>{const[a,l]=im(o),u=x.useMemo(()=>cd(e),[e]),c=o&&!a?[]:u.map(Us),f=x.useRef(!0),h=x.useRef(u),g=cu(()=>new Map),[v,w]=x.useState(u),[S,m]=x.useState(u);om(()=>{f.current=!1,h.current=u;for(let b=0;b{const k=Us(b),C=o&&!a?!1:u===S||c.includes(k),E=()=>{if(g.has(k))g.set(k,!0);else return;let P=!0;g.forEach(F=>{F||(P=!1)}),P&&(y==null||y(),m(h.current),o&&(l==null||l()),r&&r())};return d.jsx(bx,{isPresent:C,initial:!f.current||n?void 0:!1,custom:C?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:C?void 0:E,children:b},k)})})},Ae=e=>e;let lm=Ae;function hu(e){let t;return()=>(t===void 0&&(t=e()),t)}const Jn=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},dt=e=>e*1e3,ft=e=>e/1e3,Cx={useManualTiming:!1};function Px(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(u){i.has(u)&&(l.schedule(u),e()),u(o)}const l={schedule:(u,c=!1,f=!1)=>{const g=f&&r?t:n;return c&&i.add(u),g.has(u)||g.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(a),t.clear(),r=!1,s&&(s=!1,l.process(u))}};return l}const zs=["read","resolveKeyframes","update","preRender","render","postRender"],Tx=40;function um(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=zs.reduce((m,p)=>(m[p]=Px(i),m),{}),{read:a,resolveKeyframes:l,update:u,preRender:c,render:f,postRender:h}=o,g=()=>{const m=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(m-s.timestamp,Tx),1),s.timestamp=m,s.isProcessing=!0,a.process(s),l.process(s),u.process(s),c.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(g))},v=()=>{n=!0,r=!0,s.isProcessing||e(g)};return{schedule:zs.reduce((m,p)=>{const y=o[p];return m[p]=(b,k=!1,C=!1)=>(n||v(),y.schedule(b,k,C)),m},{}),cancel:m=>{for(let p=0;pdd[e].some(n=>!!t[n])};function Ex(e){for(const t in e)qn[t]={...qn[t],...e[t]}}const jx=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Li(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||jx.has(e)}let dm=e=>!Li(e);function Nx(e){e&&(dm=t=>t.startsWith("on")?!Li(t):e(t))}try{Nx(require("@emotion/is-prop-valid").default)}catch{}function Ax(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(dm(s)||n===!0&&Li(s)||!t&&!Li(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function Rx(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const oo=x.createContext({});function ns(e){return typeof e=="string"||Array.isArray(e)}function ao(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const pu=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],mu=["initial",...pu];function lo(e){return ao(e.animate)||mu.some(t=>ns(e[t]))}function fm(e){return!!(lo(e)||e.variants)}function Lx(e,t){if(lo(e)){const{initial:n,animate:r}=e;return{initial:n===!1||ns(n)?n:void 0,animate:ns(r)?r:void 0}}return e.inherit!==!1?t:{}}function Dx(e){const{initial:t,animate:n}=Lx(e,x.useContext(oo));return x.useMemo(()=>({initial:t,animate:n}),[fd(t),fd(n)])}function fd(e){return Array.isArray(e)?e.join(" "):e}const Fx=Symbol.for("motionComponentSymbol");function Dn(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Mx(e,t,n){return x.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Dn(n)&&(n.current=r))},[t])}const gu=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),_x="framerAppearId",hm="data-"+gu(_x),{schedule:yu}=um(queueMicrotask,!1),pm=x.createContext({});function Vx(e,t,n,r,s){var i,o;const{visualElement:a}=x.useContext(oo),l=x.useContext(cm),u=x.useContext(io),c=x.useContext(du).reducedMotion,f=x.useRef(null);r=r||l.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:a,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:c}));const h=f.current,g=x.useContext(pm);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&Ox(f.current,n,s,g);const v=x.useRef(!1);x.useInsertionEffect(()=>{h&&v.current&&h.update(n,u)});const w=n[hm],S=x.useRef(!!w&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,w))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,w)));return om(()=>{h&&(v.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),yu.render(h.render),S.current&&h.animationState&&h.animationState.animateChanges())}),x.useEffect(()=>{h&&(!S.current&&h.animationState&&h.animationState.animateChanges(),S.current&&(queueMicrotask(()=>{var m;(m=window.MotionHandoffMarkAsComplete)===null||m===void 0||m.call(window,w)}),S.current=!1))}),h}function Ox(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:mm(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&Dn(a),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function mm(e){if(e)return e.options.allowProjection!==!1?e.projection:mm(e.parent)}function Ix({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,o;e&&Ex(e);function a(u,c){let f;const h={...x.useContext(du),...u,layoutId:Bx(u)},{isStatic:g}=h,v=Dx(u),w=r(u,g);if(!g&&fu){Ux();const S=zx(h);f=S.MeasureLayout,v.visualElement=Vx(s,w,h,t,S.ProjectionNode)}return d.jsxs(oo.Provider,{value:v,children:[f&&v.visualElement?d.jsx(f,{visualElement:v.visualElement,...h}):null,n(s,u,Mx(w,v.visualElement,c),w,g,v.visualElement)]})}a.displayName=`motion.${typeof s=="string"?s:`create(${(o=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&o!==void 0?o:""})`}`;const l=x.forwardRef(a);return l[Fx]=s,l}function Bx({layoutId:e}){const t=x.useContext(uu).id;return t&&e!==void 0?t+"-"+e:e}function Ux(e,t){x.useContext(cm).strict}function zx(e){const{drag:t,layout:n}=qn;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const $x=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function vu(e){return typeof e!="string"||e.includes("-")?!1:!!($x.indexOf(e)>-1||/[A-Z]/u.test(e))}function hd(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function xu(e,t,n,r){if(typeof t=="function"){const[s,i]=hd(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=hd(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const Ja=e=>Array.isArray(e),Wx=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),Kx=e=>Ja(e)?e[e.length-1]||0:e,ge=e=>!!(e&&e.getVelocity);function ri(e){const t=ge(e)?e.get():e;return Wx(t)?t.toValue():t}function Hx({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const o={latestValues:Gx(r,s,i,e),renderState:t()};return n&&(o.onMount=a=>n({props:r,current:a,...o}),o.onUpdate=a=>n(a)),o}const gm=e=>(t,n)=>{const r=x.useContext(oo),s=x.useContext(io),i=()=>Hx(e,t,r,s);return n?i():cu(i)};function Gx(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=ri(i[h]);let{initial:o,animate:a}=e;const l=lo(e),u=fm(e);t&&u&&!l&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let c=n?n.initial===!1:!1;c=c||o===!1;const f=c?a:o;if(f&&typeof f!="boolean"&&!ao(f)){const h=Array.isArray(f)?f:[f];for(let g=0;gt=>typeof t=="string"&&t.startsWith(e),vm=ym("--"),Xx=ym("var(--"),wu=e=>Xx(e)?Qx.test(e.split("/*")[0].trim()):!1,Qx=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,xm=(e,t)=>t&&typeof e=="number"?t.transform(e):e,yt=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},rs={...ir,transform:e=>yt(0,1,e)},$s={...ir,default:1},ps=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),bt=ps("deg"),st=ps("%"),R=ps("px"),Yx=ps("vh"),Zx=ps("vw"),pd={...st,parse:e=>st.parse(e)/100,transform:e=>st.transform(e*100)},Jx={borderWidth:R,borderTopWidth:R,borderRightWidth:R,borderBottomWidth:R,borderLeftWidth:R,borderRadius:R,radius:R,borderTopLeftRadius:R,borderTopRightRadius:R,borderBottomRightRadius:R,borderBottomLeftRadius:R,width:R,maxWidth:R,height:R,maxHeight:R,top:R,right:R,bottom:R,left:R,padding:R,paddingTop:R,paddingRight:R,paddingBottom:R,paddingLeft:R,margin:R,marginTop:R,marginRight:R,marginBottom:R,marginLeft:R,backgroundPositionX:R,backgroundPositionY:R},qx={rotate:bt,rotateX:bt,rotateY:bt,rotateZ:bt,scale:$s,scaleX:$s,scaleY:$s,scaleZ:$s,skew:bt,skewX:bt,skewY:bt,distance:R,translateX:R,translateY:R,translateZ:R,x:R,y:R,z:R,perspective:R,transformPerspective:R,opacity:rs,originX:pd,originY:pd,originZ:R},md={...ir,transform:Math.round},Su={...Jx,...qx,zIndex:md,size:R,fillOpacity:rs,strokeOpacity:rs,numOctaves:md},e1={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},t1=sr.length;function n1(e,t,n){let r="",s=!0;for(let i=0;i({style:{},transform:{},transformOrigin:{},vars:{}}),wm=()=>({...Cu(),attrs:{}}),Pu=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Sm(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const bm=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function km(e,t,n,r){Sm(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(bm.has(s)?s:gu(s),t.attrs[s])}const Di={};function a1(e){Object.assign(Di,e)}function Cm(e,{layout:t,layoutId:n}){return xn.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Di[e]||e==="opacity")}function Tu(e,t,n){var r;const{style:s}=e,i={};for(const o in s)(ge(s[o])||t.style&&ge(t.style[o])||Cm(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function Pm(e,t,n){const r=Tu(e,t,n);for(const s in e)if(ge(e[s])||ge(t[s])){const i=sr.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function l1(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const yd=["x","y","width","height","cx","cy","r"],u1={useVisualState:gm({scrapeMotionValuesFromProps:Pm,createRenderState:wm,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const a in s)if(xn.has(a)){i=!0;break}}if(!i)return;let o=!t;if(t)for(let a=0;a{l1(n,r),z.render(()=>{ku(r,s,Pu(n.tagName),e.transformTemplate),km(n,r)})})}})},c1={useVisualState:gm({scrapeMotionValuesFromProps:Tu,createRenderState:Cu})};function Tm(e,t,n){for(const r in t)!ge(t[r])&&!Cm(r,n)&&(e[r]=t[r])}function d1({transformTemplate:e},t){return x.useMemo(()=>{const n=Cu();return bu(n,t,e),Object.assign({},n.vars,n.style)},[t])}function f1(e,t){const n=e.style||{},r={};return Tm(r,n,e),Object.assign(r,d1(e,t)),r}function h1(e,t){const n={},r=f1(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function p1(e,t,n,r){const s=x.useMemo(()=>{const i=wm();return ku(i,t,Pu(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Tm(i,e.style,e),s.style={...i,...s.style}}return s}function m1(e=!1){return(n,r,s,{latestValues:i},o)=>{const l=(vu(n)?p1:h1)(r,i,o,n),u=Ax(r,typeof n=="string",e),c=n!==x.Fragment?{...u,...l,ref:s}:{},{children:f}=r,h=x.useMemo(()=>ge(f)?f.get():f,[f]);return x.createElement(n,{...c,children:h})}}function g1(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...vu(r)?u1:c1,preloadedFeatures:e,useRender:m1(s),createVisualElement:t,Component:r};return Ix(o)}}function Em(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rwindow.ScrollTimeline!==void 0);class v1{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(y1()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class x1 extends v1{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function Eu(e,t){return e?e[t]||e.default||e:void 0}const qa=2e4;function jm(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=qa?1/0:t}function ju(e){return typeof e=="function"}function vd(e,t){e.timeline=t,e.onfinish=null}const Nu=e=>Array.isArray(e)&&typeof e[0]=="number",w1={linearEasing:void 0};function S1(e,t){const n=hu(e);return()=>{var r;return(r=w1[t])!==null&&r!==void 0?r:n()}}const Fi=S1(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Nm=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i`cubic-bezier(${e}, ${t}, ${n}, ${r})`,el={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:wr([0,.65,.55,1]),circOut:wr([.55,0,1,.45]),backIn:wr([.31,.01,.66,-.59]),backOut:wr([.33,1.53,.69,.99])};function Rm(e,t){if(e)return typeof e=="function"&&Fi()?Nm(e,t):Nu(e)?wr(e):Array.isArray(e)?e.map(n=>Rm(n,t)||el.easeOut):el[e]}const Ke={x:!1,y:!1};function Lm(){return Ke.x||Ke.y}function b1(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function Dm(e,t){const n=b1(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function xd(e){return t=>{t.pointerType==="touch"||Lm()||e(t)}}function k1(e,t,n={}){const[r,s,i]=Dm(e,n),o=xd(a=>{const{target:l}=a,u=t(a);if(typeof u!="function"||!l)return;const c=xd(f=>{u(f),l.removeEventListener("pointerleave",c)});l.addEventListener("pointerleave",c,s)});return r.forEach(a=>{a.addEventListener("pointerenter",o,s)}),i}const Fm=(e,t)=>t?e===t?!0:Fm(e,t.parentElement):!1,Au=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,C1=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function P1(e){return C1.has(e.tagName)||e.tabIndex!==-1}const Sr=new WeakSet;function wd(e){return t=>{t.key==="Enter"&&e(t)}}function zo(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const T1=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=wd(()=>{if(Sr.has(n))return;zo(n,"down");const s=wd(()=>{zo(n,"up")}),i=()=>zo(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Sd(e){return Au(e)&&!Lm()}function E1(e,t,n={}){const[r,s,i]=Dm(e,n),o=a=>{const l=a.currentTarget;if(!Sd(a)||Sr.has(l))return;Sr.add(l);const u=t(a),c=(g,v)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!Sd(g)||!Sr.has(l))&&(Sr.delete(l),typeof u=="function"&&u(g,{success:v}))},f=g=>{c(g,n.useGlobalTarget||Fm(l,g.target))},h=g=>{c(g,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(a=>{!P1(a)&&a.getAttribute("tabindex")===null&&(a.tabIndex=0),(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,s),a.addEventListener("focus",u=>T1(u,s),s)}),i}function j1(e){return e==="x"||e==="y"?Ke[e]?null:(Ke[e]=!0,()=>{Ke[e]=!1}):Ke.x||Ke.y?null:(Ke.x=Ke.y=!0,()=>{Ke.x=Ke.y=!1})}const Mm=new Set(["width","height","top","left","right","bottom",...sr]);let si;function N1(){si=void 0}const it={now:()=>(si===void 0&&it.set(ue.isProcessing||Cx.useManualTiming?ue.timestamp:performance.now()),si),set:e=>{si=e,queueMicrotask(N1)}};function Ru(e,t){e.indexOf(t)===-1&&e.push(t)}function Lu(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Du{constructor(){this.subscriptions=[]}add(t){return Ru(this.subscriptions,t),()=>Lu(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i!isNaN(parseFloat(e));class R1{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=it.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=it.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=A1(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Du);const r=this.events[t].add(n);return t==="change"?()=>{r(),z.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=it.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>bd)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,bd);return _m(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ss(e,t){return new R1(e,t)}function L1(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ss(n))}function D1(e,t){const n=uo(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const a=Kx(i[o]);L1(e,o,a)}}function F1(e){return!!(ge(e)&&e.add)}function tl(e,t){const n=e.getValue("willChange");if(F1(n))return n.add(t)}function Vm(e){return e.props[hm]}const Om=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,M1=1e-7,_1=12;function V1(e,t,n,r,s){let i,o,a=0;do o=t+(n-t)/2,i=Om(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>M1&&++a<_1);return o}function ms(e,t,n,r){if(e===t&&n===r)return Ae;const s=i=>V1(i,0,1,e,n);return i=>i===0||i===1?i:Om(s(i),t,r)}const Im=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Bm=e=>t=>1-e(1-t),Um=ms(.33,1.53,.69,.99),Fu=Bm(Um),zm=Im(Fu),$m=e=>(e*=2)<1?.5*Fu(e):.5*(2-Math.pow(2,-10*(e-1))),Mu=e=>1-Math.sin(Math.acos(e)),Wm=Bm(Mu),Km=Im(Mu),Hm=e=>/^0[^.\s]+$/u.test(e);function O1(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Hm(e):!0}const Dr=e=>Math.round(e*1e5)/1e5,_u=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function I1(e){return e==null}const B1=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Vu=(e,t)=>n=>!!(typeof n=="string"&&B1.test(n)&&n.startsWith(e)||t&&!I1(n)&&Object.prototype.hasOwnProperty.call(n,t)),Gm=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,a]=r.match(_u);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},U1=e=>yt(0,255,e),$o={...ir,transform:e=>Math.round(U1(e))},on={test:Vu("rgb","red"),parse:Gm("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+$o.transform(e)+", "+$o.transform(t)+", "+$o.transform(n)+", "+Dr(rs.transform(r))+")"};function z1(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const nl={test:Vu("#"),parse:z1,transform:on.transform},Fn={test:Vu("hsl","hue"),parse:Gm("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+st.transform(Dr(t))+", "+st.transform(Dr(n))+", "+Dr(rs.transform(r))+")"},pe={test:e=>on.test(e)||nl.test(e)||Fn.test(e),parse:e=>on.test(e)?on.parse(e):Fn.test(e)?Fn.parse(e):nl.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?on.transform(e):Fn.transform(e)},$1=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function W1(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(_u))===null||t===void 0?void 0:t.length)||0)+(((n=e.match($1))===null||n===void 0?void 0:n.length)||0)>0}const Xm="number",Qm="color",K1="var",H1="var(",kd="${}",G1=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function is(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=t.replace(G1,l=>(pe.test(l)?(r.color.push(i),s.push(Qm),n.push(pe.parse(l))):l.startsWith(H1)?(r.var.push(i),s.push(K1),n.push(l)):(r.number.push(i),s.push(Xm),n.push(parseFloat(l))),++i,kd)).split(kd);return{values:n,split:a,indexes:r,types:s}}function Ym(e){return is(e).values}function Zm(e){const{split:t,types:n}=is(e),r=t.length;return s=>{let i="";for(let o=0;otypeof e=="number"?0:e;function Q1(e){const t=Ym(e);return Zm(e)(t.map(X1))}const zt={test:W1,parse:Ym,createTransformer:Zm,getAnimatableNone:Q1},Y1=new Set(["brightness","contrast","saturate","opacity"]);function Z1(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(_u)||[];if(!r)return e;const s=n.replace(r,"");let i=Y1.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const J1=/\b([a-z-]*)\(.*?\)/gu,rl={...zt,getAnimatableNone:e=>{const t=e.match(J1);return t?t.map(Z1).join(" "):e}},q1={...Su,color:pe,backgroundColor:pe,outlineColor:pe,fill:pe,stroke:pe,borderColor:pe,borderTopColor:pe,borderRightColor:pe,borderBottomColor:pe,borderLeftColor:pe,filter:rl,WebkitFilter:rl},Ou=e=>q1[e];function Jm(e,t){let n=Ou(e);return n!==rl&&(n=zt),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const ew=new Set(["auto","none","0"]);function tw(e,t,n){let r=0,s;for(;re===ir||e===R,Pd=(e,t)=>parseFloat(e.split(", ")[t]),Td=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return Pd(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?Pd(i[1],e):0}},nw=new Set(["x","y","z"]),rw=sr.filter(e=>!nw.has(e));function sw(e){const t=[];return rw.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const er={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Td(4,13),y:Td(5,14)};er.translateX=er.x;er.translateY=er.y;const un=new Set;let sl=!1,il=!1;function qm(){if(il){const e=Array.from(un).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=sw(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}il=!1,sl=!1,un.forEach(e=>e.complete()),un.clear()}function eg(){un.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(il=!0)})}function iw(){eg(),qm()}class Iu{constructor(t,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(un.add(this),sl||(sl=!0,z.read(eg),z.resolveKeyframes(qm))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),ow=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function aw(e){const t=ow.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function ng(e,t,n=1){const[r,s]=aw(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return tg(o)?parseFloat(o):o}return wu(s)?ng(s,t,n+1):s}const rg=e=>t=>t.test(e),lw={test:e=>e==="auto",parse:e=>e},sg=[ir,R,st,bt,Zx,Yx,lw],Ed=e=>sg.find(rg(e));class ig extends Iu{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l{n.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const jd=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(zt.test(e)||e==="0")&&!e.startsWith("url("));function uw(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function co(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(dw),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const fw=40;class og{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=it.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>fw?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&iw(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=it.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:a,onUpdate:l,isGenerator:u}=this.options;if(!u&&!cw(t,r,s,i))if(o)this.options.duration=0;else{l&&l(co(t,this.options,n)),a&&a(),this.resolveFinishedPromise();return}const c=this.initPlayback(t,n);c!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...c},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const K=(e,t,n)=>e+(t-e)*n;function Wo(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function hw({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;s=Wo(l,a,e+1/3),i=Wo(l,a,e),o=Wo(l,a,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Mi(e,t){return n=>n>0?t:e}const Ko=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},pw=[nl,on,Fn],mw=e=>pw.find(t=>t.test(e));function Nd(e){const t=mw(e);if(!t)return!1;let n=t.parse(e);return t===Fn&&(n=hw(n)),n}const Ad=(e,t)=>{const n=Nd(e),r=Nd(t);if(!n||!r)return Mi(e,t);const s={...n};return i=>(s.red=Ko(n.red,r.red,i),s.green=Ko(n.green,r.green,i),s.blue=Ko(n.blue,r.blue,i),s.alpha=K(n.alpha,r.alpha,i),on.transform(s))},gw=(e,t)=>n=>t(e(n)),gs=(...e)=>e.reduce(gw),ol=new Set(["none","hidden"]);function yw(e,t){return ol.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function vw(e,t){return n=>K(e,t,n)}function Bu(e){return typeof e=="number"?vw:typeof e=="string"?wu(e)?Mi:pe.test(e)?Ad:Sw:Array.isArray(e)?ag:typeof e=="object"?pe.test(e)?Ad:xw:Mi}function ag(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>Bu(i)(i,t[o]));return i=>{for(let o=0;o{for(const i in r)n[i]=r[i](s);return n}}function ww(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i{const n=zt.createTransformer(t),r=is(e),s=is(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?ol.has(e)&&!s.values.length||ol.has(t)&&!r.values.length?yw(e,t):gs(ag(ww(r,s),s.values),n):Mi(e,t)};function lg(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?K(e,t,n):Bu(e)(e,t)}const bw=5;function ug(e,t,n){const r=Math.max(t-bw,0);return _m(n-e(r),t-r)}const X={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Ho=.001;function kw({duration:e=X.duration,bounce:t=X.bounce,velocity:n=X.velocity,mass:r=X.mass}){let s,i,o=1-t;o=yt(X.minDamping,X.maxDamping,o),e=yt(X.minDuration,X.maxDuration,ft(e)),o<1?(s=u=>{const c=u*o,f=c*e,h=c-n,g=al(u,o),v=Math.exp(-f);return Ho-h/g*v},i=u=>{const f=u*o*e,h=f*n+n,g=Math.pow(o,2)*Math.pow(u,2)*e,v=Math.exp(-f),w=al(Math.pow(u,2),o);return(-s(u)+Ho>0?-1:1)*((h-g)*v)/w}):(s=u=>{const c=Math.exp(-u*e),f=(u-n)*e+1;return-Ho+c*f},i=u=>{const c=Math.exp(-u*e),f=(n-u)*(e*e);return c*f});const a=5/e,l=Pw(s,i,a);if(e=dt(e),isNaN(l))return{stiffness:X.stiffness,damping:X.damping,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const Cw=12;function Pw(e,t,n){let r=n;for(let s=1;se[n]!==void 0)}function jw(e){let t={velocity:X.velocity,stiffness:X.stiffness,damping:X.damping,mass:X.mass,isResolvedFromDuration:!1,...e};if(!Rd(e,Ew)&&Rd(e,Tw))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*yt(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:X.mass,stiffness:s,damping:i}}else{const n=kw(e);t={...t,...n,mass:X.mass},t.isResolvedFromDuration=!0}return t}function cg(e=X.visualDuration,t=X.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:l,damping:u,mass:c,duration:f,velocity:h,isResolvedFromDuration:g}=jw({...n,velocity:-ft(n.velocity||0)}),v=h||0,w=u/(2*Math.sqrt(l*c)),S=o-i,m=ft(Math.sqrt(l/c)),p=Math.abs(S)<5;r||(r=p?X.restSpeed.granular:X.restSpeed.default),s||(s=p?X.restDelta.granular:X.restDelta.default);let y;if(w<1){const k=al(m,w);y=C=>{const E=Math.exp(-w*m*C);return o-E*((v+w*m*S)/k*Math.sin(k*C)+S*Math.cos(k*C))}}else if(w===1)y=k=>o-Math.exp(-m*k)*(S+(v+m*S)*k);else{const k=m*Math.sqrt(w*w-1);y=C=>{const E=Math.exp(-w*m*C),P=Math.min(k*C,300);return o-E*((v+w*m*S)*Math.sinh(P)+k*S*Math.cosh(P))/k}}const b={calculatedDuration:g&&f||null,next:k=>{const C=y(k);if(g)a.done=k>=f;else{let E=0;w<1&&(E=k===0?dt(v):ug(y,k,C));const P=Math.abs(E)<=r,F=Math.abs(o-C)<=s;a.done=P&&F}return a.value=a.done?o:C,a},toString:()=>{const k=Math.min(jm(b),qa),C=Nm(E=>b.next(k*E).value,k,30);return k+"ms "+C}};return b}function Ld({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:c}){const f=e[0],h={done:!1,value:f},g=P=>a!==void 0&&Pl,v=P=>a===void 0?l:l===void 0||Math.abs(a-P)-w*Math.exp(-P/r),y=P=>m+p(P),b=P=>{const F=p(P),A=y(P);h.done=Math.abs(F)<=u,h.value=h.done?m:A};let k,C;const E=P=>{g(h.value)&&(k=P,C=cg({keyframes:[h.value,v(h.value)],velocity:ug(y,P,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:c}))};return E(0),{calculatedDuration:null,next:P=>{let F=!1;return!C&&k===void 0&&(F=!0,b(P),E(P)),k!==void 0&&P>=k?C.next(P-k):(!F&&b(P),h)}}}const Nw=ms(.42,0,1,1),Aw=ms(0,0,.58,1),dg=ms(.42,0,.58,1),Rw=e=>Array.isArray(e)&&typeof e[0]!="number",Lw={linear:Ae,easeIn:Nw,easeInOut:dg,easeOut:Aw,circIn:Mu,circInOut:Km,circOut:Wm,backIn:Fu,backInOut:zm,backOut:Um,anticipate:$m},Dd=e=>{if(Nu(e)){lm(e.length===4);const[t,n,r,s]=e;return ms(t,n,r,s)}else if(typeof e=="string")return Lw[e];return e};function Dw(e,t,n){const r=[],s=n||lg,i=e.length-1;for(let o=0;ot[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Dw(t,r,s),l=a.length,u=c=>{if(o&&c1)for(;fu(yt(e[0],e[i-1],c)):u}function Mw(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Jn(0,t,r);e.push(K(n,1,s))}}function _w(e){const t=[0];return Mw(t,e.length-1),t}function Vw(e,t){return e.map(n=>n*t)}function Ow(e,t){return e.map(()=>t||dg).splice(0,e.length-1)}function _i({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=Rw(r)?r.map(Dd):Dd(r),i={done:!1,value:t[0]},o=Vw(n&&n.length===t.length?n:_w(t),e),a=Fw(o,t,{ease:Array.isArray(s)?s:Ow(t,s)});return{calculatedDuration:e,next:l=>(i.value=a(l),i.done=l>=e,i)}}const Iw=e=>{const t=({timestamp:n})=>e(n);return{start:()=>z.update(t,!0),stop:()=>Ut(t),now:()=>ue.isProcessing?ue.timestamp:it.now()}},Bw={decay:Ld,inertia:Ld,tween:_i,keyframes:_i,spring:cg},Uw=e=>e/100;class Uu extends og{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||Iu,a=(l,u)=>this.onKeyframesResolved(l,u);this.resolver=new o(i,a,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,a=ju(n)?n:Bw[n]||_i;let l,u;a!==_i&&typeof t[0]!="number"&&(l=gs(Uw,lg(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});i==="mirror"&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=jm(c));const{calculatedDuration:f}=c,h=f+s,g=h*(r+1)-s;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:h,totalDuration:g}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:P}=this.options;return{done:!0,value:P[P.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:u,totalDuration:c,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:g,repeatType:v,repeatDelay:w,onUpdate:S}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const m=this.currentTime-h*(this.speed>=0?1:-1),p=this.speed>=0?m<0:m>c;this.currentTime=Math.max(m,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=c);let y=this.currentTime,b=i;if(g){const P=Math.min(this.currentTime,c)/f;let F=Math.floor(P),A=P%1;!A&&P>=1&&(A=1),A===1&&F--,F=Math.min(F,g+1),!!(F%2)&&(v==="reverse"?(A=1-A,w&&(A-=w/f)):v==="mirror"&&(b=o)),y=yt(0,1,A)*f}const k=p?{done:!1,value:l[0]}:b.next(y);a&&(k.value=a(k.value));let{done:C}=k;!p&&u!==null&&(C=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return E&&s!==void 0&&(k.value=co(l,this.options,s)),S&&S(k.value),E&&this.finish(),k}get duration(){const{resolved:t}=this;return t?ft(t.calculatedDuration):0}get time(){return ft(this.currentTime)}set time(t){t=dt(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=ft(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=Iw,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const zw=new Set(["opacity","clipPath","filter","transform"]);function $w(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a="easeInOut",times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=Rm(a,s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const Ww=hu(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Vi=10,Kw=2e4;function Hw(e){return ju(e.type)||e.type==="spring"||!Am(e.ease)}function Gw(e,t){const n=new Uu({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&ithis.onKeyframesResolved(o,a),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:o,motionValue:a,name:l,startTime:u}=this.options;if(!a.owner||!a.owner.current)return!1;if(typeof i=="string"&&Fi()&&Xw(i)&&(i=fg[i]),Hw(this.options)){const{onComplete:f,onUpdate:h,motionValue:g,element:v,...w}=this.options,S=Gw(t,w);t=S.keyframes,t.length===1&&(t[1]=t[0]),r=S.duration,s=S.times,i=S.ease,o="keyframes"}const c=$w(a.owner.current,l,t,{...this.options,duration:r,times:s,ease:i});return c.startTime=u??this.calcStartTime(),this.pendingTimeline?(vd(c,this.pendingTimeline),this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:f}=this.options;a.set(co(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:r,times:s,type:o,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return ft(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return ft(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=dt(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return Ae;const{animation:r}=n;vd(r,t)}return Ae}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:a}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:c,onComplete:f,element:h,...g}=this.options,v=new Uu({...g,keyframes:r,duration:s,type:i,ease:o,times:a,isGenerator:!0}),w=dt(this.time);u.setWithVelocity(v.sample(w-Vi).value,v.sample(w).value,Vi)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:a}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=n.owner.getProps();return Ww()&&r&&zw.has(r)&&!l&&!u&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}}const Qw={type:"spring",stiffness:500,damping:25,restSpeed:10},Yw=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Zw={type:"keyframes",duration:.8},Jw={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},qw=(e,{keyframes:t})=>t.length>2?Zw:xn.has(e)?e.startsWith("scale")?Yw(t[1]):Qw:Jw;function eS({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length}const zu=(e,t,n,r={},s,i)=>o=>{const a=Eu(r,e)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-dt(l);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:h=>{t.set(h),a.onUpdate&&a.onUpdate(h)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:i?void 0:s};eS(a)||(c={...c,...qw(e,c)}),c.duration&&(c.duration=dt(c.duration)),c.repeatDelay&&(c.repeatDelay=dt(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let f=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(c.duration=0,c.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const h=co(c.keyframes,a);if(h!==void 0)return z.update(()=>{c.onUpdate(h),c.onComplete()}),new x1([])}return!i&&Fd.supports(c)?new Fd(c):new Uu(c)};function tS({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function hg(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=e.getDefaultTransition(),transitionEnd:a,...l}=t;r&&(o=r);const u=[],c=s&&e.animationState&&e.animationState.getState()[s];for(const f in l){const h=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),g=l[f];if(g===void 0||c&&tS(c,f))continue;const v={delay:n,...Eu(o||{},f)};let w=!1;if(window.MotionHandoffAnimation){const m=Vm(e);if(m){const p=window.MotionHandoffAnimation(m,f,z);p!==null&&(v.startTime=p,w=!0)}}tl(e,f),h.start(zu(f,h,g,e.shouldReduceMotion&&Mm.has(f)?{type:!1}:v,e,w));const S=h.animation;S&&u.push(S)}return a&&Promise.all(u).then(()=>{z.update(()=>{a&&D1(e,a)})}),u}function ll(e,t,n={}){var r;const s=uo(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(hg(e,s,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:h}=i;return nS(e,t,c+u,f,h,n)}:()=>Promise.resolve(),{when:l}=i;if(l){const[u,c]=l==="beforeChildren"?[o,a]:[a,o];return u().then(()=>c())}else return Promise.all([o(),a(n.delay)])}function nS(e,t,n=0,r=0,s=1,i){const o=[],a=(e.variantChildren.size-1)*r,l=s===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(rS).forEach((u,c)=>{u.notify("AnimationStart",t),o.push(ll(u,t,{...i,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function rS(e,t){return e.sortNodePosition(t)}function sS(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>ll(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=ll(e,t,n);else{const s=typeof t=="function"?uo(e,t,n.custom):t;r=Promise.all(hg(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const iS=mu.length;function pg(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?pg(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>sS(e,n,r)))}function uS(e){let t=lS(e),n=Md(),r=!0;const s=l=>(u,c)=>{var f;const h=uo(e,c,l==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:g,transitionEnd:v,...w}=h;u={...u,...w,...v}}return u};function i(l){t=l(e)}function o(l){const{props:u}=e,c=pg(e.parent)||{},f=[],h=new Set;let g={},v=1/0;for(let S=0;Sv&&b,F=!1;const A=Array.isArray(y)?y:[y];let ee=A.reduce(s(m),{});k===!1&&(ee={});const{prevResolvedValues:wt={}}=p,Xt={...wt,...ee},or=ne=>{P=!0,h.has(ne)&&(F=!0,h.delete(ne)),p.needsAnimating[ne]=!0;const j=e.getValue(ne);j&&(j.liveStyle=!1)};for(const ne in Xt){const j=ee[ne],L=wt[ne];if(g.hasOwnProperty(ne))continue;let D=!1;Ja(j)&&Ja(L)?D=!Em(j,L):D=j!==L,D?j!=null?or(ne):h.add(ne):j!==void 0&&h.has(ne)?or(ne):p.protectedKeys[ne]=!0}p.prevProp=y,p.prevResolvedValues=ee,p.isActive&&(g={...g,...ee}),r&&e.blockInitialAnimation&&(P=!1),P&&(!(C&&E)||F)&&f.push(...A.map(ne=>({animation:ne,options:{type:m}})))}if(h.size){const S={};h.forEach(m=>{const p=e.getBaseTarget(m),y=e.getValue(m);y&&(y.liveStyle=!0),S[m]=p??null}),f.push({animation:S})}let w=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(w=!1),r=!1,w?t(f):Promise.resolve()}function a(l,u){var c;if(n[l].isActive===u)return Promise.resolve();(c=e.variantChildren)===null||c===void 0||c.forEach(h=>{var g;return(g=h.animationState)===null||g===void 0?void 0:g.setActive(l,u)}),n[l].isActive=u;const f=o(l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>n,reset:()=>{n=Md(),r=!0}}}function cS(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Em(t,e):!1}function Zt(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Md(){return{animate:Zt(!0),whileInView:Zt(),whileHover:Zt(),whileTap:Zt(),whileDrag:Zt(),whileFocus:Zt(),exit:Zt()}}class Gt{constructor(t){this.isMounted=!1,this.node=t}update(){}}class dS extends Gt{constructor(t){super(t),t.animationState||(t.animationState=uS(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();ao(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let fS=0;class hS extends Gt{constructor(){super(...arguments),this.id=fS++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const pS={animation:{Feature:dS},exit:{Feature:hS}};function os(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function ys(e){return{point:{x:e.pageX,y:e.pageY}}}const mS=e=>t=>Au(t)&&e(t,ys(t));function Fr(e,t,n,r){return os(e,t,mS(n),r)}const _d=(e,t)=>Math.abs(e-t);function gS(e,t){const n=_d(e.x,t.x),r=_d(e.y,t.y);return Math.sqrt(n**2+r**2)}class mg{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Xo(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,g=gS(f.offset,{x:0,y:0})>=3;if(!h&&!g)return;const{point:v}=f,{timestamp:w}=ue;this.history.push({...v,timestamp:w});const{onStart:S,onMove:m}=this.handlers;h||(S&&S(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Go(h,this.transformPagePoint),z.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:g,onSessionEnd:v,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=Xo(f.type==="pointercancel"?this.lastMoveEventInfo:Go(h,this.transformPagePoint),this.history);this.startEvent&&g&&g(f,S),v&&v(f,S)},!Au(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=ys(t),a=Go(o,this.transformPagePoint),{point:l}=a,{timestamp:u}=ue;this.history=[{...l,timestamp:u}];const{onSessionStart:c}=n;c&&c(t,Xo(a,this.history)),this.removeListeners=gs(Fr(this.contextWindow,"pointermove",this.handlePointerMove),Fr(this.contextWindow,"pointerup",this.handlePointerUp),Fr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ut(this.updatePoint)}}function Go(e,t){return t?{point:t(e.point)}:e}function Vd(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xo({point:e},t){return{point:e,delta:Vd(e,gg(t)),offset:Vd(e,yS(t)),velocity:vS(t,.1)}}function yS(e){return e[0]}function gg(e){return e[e.length-1]}function vS(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=gg(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>dt(t)));)n--;if(!r)return{x:0,y:0};const i=ft(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const yg=1e-4,xS=1-yg,wS=1+yg,vg=.01,SS=0-vg,bS=0+vg;function Le(e){return e.max-e.min}function kS(e,t,n){return Math.abs(e-t)<=n}function Od(e,t,n,r=.5){e.origin=r,e.originPoint=K(t.min,t.max,e.origin),e.scale=Le(n)/Le(t),e.translate=K(n.min,n.max,e.origin)-e.originPoint,(e.scale>=xS&&e.scale<=wS||isNaN(e.scale))&&(e.scale=1),(e.translate>=SS&&e.translate<=bS||isNaN(e.translate))&&(e.translate=0)}function Mr(e,t,n,r){Od(e.x,t.x,n.x,r?r.originX:void 0),Od(e.y,t.y,n.y,r?r.originY:void 0)}function Id(e,t,n){e.min=n.min+t.min,e.max=e.min+Le(t)}function CS(e,t,n){Id(e.x,t.x,n.x),Id(e.y,t.y,n.y)}function Bd(e,t,n){e.min=t.min-n.min,e.max=e.min+Le(t)}function _r(e,t,n){Bd(e.x,t.x,n.x),Bd(e.y,t.y,n.y)}function PS(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?K(n,e,r.max):Math.min(e,n)),e}function Ud(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function TS(e,{top:t,left:n,bottom:r,right:s}){return{x:Ud(e.x,n,s),y:Ud(e.y,t,r)}}function zd(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Jn(t.min,t.max-r,e.min):r>s&&(n=Jn(e.min,e.max-s,t.min)),yt(0,1,n)}function NS(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ul=.35;function AS(e=ul){return e===!1?e=0:e===!0&&(e=ul),{x:$d(e,"left","right"),y:$d(e,"top","bottom")}}function $d(e,t,n){return{min:Wd(e,t),max:Wd(e,n)}}function Wd(e,t){return typeof e=="number"?e:e[t]||0}const Kd=()=>({translate:0,scale:1,origin:0,originPoint:0}),Mn=()=>({x:Kd(),y:Kd()}),Hd=()=>({min:0,max:0}),J=()=>({x:Hd(),y:Hd()});function Ve(e){return[e("x"),e("y")]}function xg({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function RS({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function LS(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Qo(e){return e===void 0||e===1}function cl({scale:e,scaleX:t,scaleY:n}){return!Qo(e)||!Qo(t)||!Qo(n)}function en(e){return cl(e)||wg(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function wg(e){return Gd(e.x)||Gd(e.y)}function Gd(e){return e&&e!=="0%"}function Oi(e,t,n){const r=e-n,s=t*r;return n+s}function Xd(e,t,n,r,s){return s!==void 0&&(e=Oi(e,s,r)),Oi(e,n,r)+t}function dl(e,t=0,n=1,r,s){e.min=Xd(e.min,t,n,r,s),e.max=Xd(e.max,t,n,r,s)}function Sg(e,{x:t,y:n}){dl(e.x,t.translate,t.scale,t.originPoint),dl(e.y,n.translate,n.scale,n.originPoint)}const Qd=.999999999999,Yd=1.0000000000001;function DS(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let a=0;aQd&&(t.x=1),t.yQd&&(t.y=1)}function _n(e,t){e.min=e.min+t,e.max=e.max+t}function Zd(e,t,n,r,s=.5){const i=K(e.min,e.max,s);dl(e,t,n,i,r)}function Vn(e,t){Zd(e.x,t.x,t.scaleX,t.scale,t.originX),Zd(e.y,t.y,t.scaleY,t.scale,t.originY)}function bg(e,t){return xg(LS(e.getBoundingClientRect(),t))}function FS(e,t,n){const r=bg(e,n),{scroll:s}=t;return s&&(_n(r.x,s.offset.x),_n(r.y,s.offset.y)),r}const kg=({current:e})=>e?e.ownerDocument.defaultView:null,MS=new WeakMap;class _S{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=J(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=c=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(ys(c).point)},i=(c,f)=>{const{drag:h,dragPropagation:g,onDragStart:v}=this.getProps();if(h&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=j1(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ve(S=>{let m=this.getAxisMotionValue(S).get()||0;if(st.test(m)){const{projection:p}=this.visualElement;if(p&&p.layout){const y=p.layout.layoutBox[S];y&&(m=Le(y)*(parseFloat(m)/100))}}this.originPoint[S]=m}),v&&z.postRender(()=>v(c,f)),tl(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},o=(c,f)=>{const{dragPropagation:h,dragDirectionLock:g,onDirectionLock:v,onDrag:w}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:S}=f;if(g&&this.currentDirection===null){this.currentDirection=VS(S),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",f.point,S),this.updateAxis("y",f.point,S),this.visualElement.render(),w&&w(c,f)},a=(c,f)=>this.stop(c,f),l=()=>Ve(c=>{var f;return this.getAnimationState(c)==="paused"&&((f=this.getAxisMotionValue(c).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new mg(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:kg(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&z.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Ws(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=PS(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&Dn(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=TS(s.layoutBox,n):this.constraints=!1,this.elastic=AS(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Ve(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=NS(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Dn(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=FS(r,s.root,this.visualElement.getTransformPagePoint());let o=ES(s.layout.layoutBox,i);if(n){const a=n(RS(o));this.hasMutatedConstraints=!!a,a&&(o=xg(a))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Ve(c=>{if(!Ws(c,n,this.currentDirection))return;let f=l&&l[c]||{};o&&(f={min:0,max:0});const h=s?200:1e6,g=s?40:1e7,v={type:"inertia",velocity:r?t[c]:0,bounceStiffness:h,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(c,v)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return tl(this.visualElement,t),r.start(zu(t,r,0,n,this.visualElement,!1))}stopAnimation(){Ve(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ve(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ve(n=>{const{drag:r}=this.getProps();if(!Ws(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n];i.set(t[n]-K(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Dn(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ve(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=jS({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ve(o=>{if(!Ws(o,t,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(K(l,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;MS.set(this.visualElement,this);const t=this.visualElement.current,n=Fr(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Dn(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),z.read(r);const o=os(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ve(c=>{const f=this.getAxisMotionValue(c);f&&(this.originPoint[c]+=l[c].translate,f.set(f.get()+l[c].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=ul,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function Ws(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function VS(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class OS extends Gt{constructor(t){super(t),this.removeGroupControls=Ae,this.removeListeners=Ae,this.controls=new _S(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ae}unmount(){this.removeGroupControls(),this.removeListeners()}}const Jd=e=>(t,n)=>{e&&z.postRender(()=>e(t,n))};class IS extends Gt{constructor(){super(...arguments),this.removePointerDownListener=Ae}onPointerDown(t){this.session=new mg(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:kg(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Jd(t),onStart:Jd(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&z.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Fr(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const ii={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function qd(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const mr={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(R.test(e))e=parseFloat(e);else return e;const n=qd(e,t.target.x),r=qd(e,t.target.y);return`${n}% ${r}%`}},BS={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=zt.parse(e);if(s.length>5)return r;const i=zt.createTransformer(e),o=typeof s[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;s[0+o]/=a,s[1+o]/=l;const u=K(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class US extends x.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;a1(zS),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),ii.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||z.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),yu.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Cg(e){const[t,n]=im(),r=x.useContext(uu);return d.jsx(US,{...e,layoutGroup:r,switchLayoutGroup:x.useContext(pm),isPresent:t,safeToRemove:n})}const zS={borderRadius:{...mr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:mr,borderTopRightRadius:mr,borderBottomLeftRadius:mr,borderBottomRightRadius:mr,boxShadow:BS};function $S(e,t,n){const r=ge(e)?e:ss(e);return r.start(zu("",r,t,n)),r.animation}function WS(e){return e instanceof SVGElement&&e.tagName!=="svg"}const KS=(e,t)=>e.depth-t.depth;class HS{constructor(){this.children=[],this.isDirty=!1}add(t){Ru(this.children,t),this.isDirty=!0}remove(t){Lu(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(KS),this.isDirty=!1,this.children.forEach(t)}}function GS(e,t){const n=it.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Ut(r),e(i-t))};return z.read(r,!0),()=>Ut(r)}const Pg=["TopLeft","TopRight","BottomLeft","BottomRight"],XS=Pg.length,ef=e=>typeof e=="string"?parseFloat(e):e,tf=e=>typeof e=="number"||R.test(e);function QS(e,t,n,r,s,i){s?(e.opacity=K(0,n.opacity!==void 0?n.opacity:1,YS(r)),e.opacityExit=K(t.opacity!==void 0?t.opacity:1,0,ZS(r))):i&&(e.opacity=K(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;ort?1:n(Jn(e,t,r))}function rf(e,t){e.min=t.min,e.max=t.max}function Me(e,t){rf(e.x,t.x),rf(e.y,t.y)}function sf(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function of(e,t,n,r,s){return e-=t,e=Oi(e,1/n,r),s!==void 0&&(e=Oi(e,1/s,r)),e}function JS(e,t=0,n=1,r=.5,s,i=e,o=e){if(st.test(t)&&(t=parseFloat(t),t=K(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=K(i.min,i.max,r);e===i&&(a-=t),e.min=of(e.min,t,n,a,s),e.max=of(e.max,t,n,a,s)}function af(e,t,[n,r,s],i,o){JS(e,t[n],t[r],t[s],t.scale,i,o)}const qS=["x","scaleX","originX"],eb=["y","scaleY","originY"];function lf(e,t,n,r){af(e.x,t,qS,n?n.x:void 0,r?r.x:void 0),af(e.y,t,eb,n?n.y:void 0,r?r.y:void 0)}function uf(e){return e.translate===0&&e.scale===1}function Eg(e){return uf(e.x)&&uf(e.y)}function cf(e,t){return e.min===t.min&&e.max===t.max}function tb(e,t){return cf(e.x,t.x)&&cf(e.y,t.y)}function df(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function jg(e,t){return df(e.x,t.x)&&df(e.y,t.y)}function ff(e){return Le(e.x)/Le(e.y)}function hf(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class nb{constructor(){this.members=[]}add(t){Ru(this.members,t),t.scheduleRender()}remove(t){if(Lu(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function rb(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:c,rotateX:f,rotateY:h,skewX:g,skewY:v}=n;u&&(r=`perspective(${u}px) ${r}`),c&&(r+=`rotate(${c}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),g&&(r+=`skewX(${g}deg) `),v&&(r+=`skewY(${v}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const tn={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},br=typeof window<"u"&&window.MotionDebug!==void 0,Yo=["","X","Y","Z"],sb={visibility:"hidden"},pf=1e3;let ib=0;function Zo(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Ng(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Vm(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",z,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Ng(r)}function Ag({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=t==null?void 0:t()){this.id=ib++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,br&&(tn.totalNodes=tn.resolvedTargetDeltas=tn.recalculatedProjection=0),this.nodes.forEach(lb),this.nodes.forEach(hb),this.nodes.forEach(pb),this.nodes.forEach(ub),br&&window.MotionDebug.record(tn)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=GS(h,250),ii.hasAnimatedSinceResize&&(ii.hasAnimatedSinceResize=!1,this.nodes.forEach(gf))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:g,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||c.getDefaultTransition()||xb,{onLayoutAnimationStart:S,onLayoutAnimationComplete:m}=c.getProps(),p=!this.targetLayout||!jg(this.targetLayout,v)||g,y=!h&&g;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||h&&(p||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,y);const b={...Eu(w,"layout"),onPlay:S,onComplete:m};(c.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else h||gf(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ut(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(mb),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Ng(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const k=b/1e3;yf(f.x,o.x,k),yf(f.y,o.y,k),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(_r(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),yb(this.relativeTarget,this.relativeTargetOrigin,h,k),y&&tb(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=J()),Me(y,this.relativeTarget)),w&&(this.animationValues=c,QS(c,u,this.latestValues,k,p,m)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ut(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=z.update(()=>{ii.hasAnimatedSinceResize=!0,this.currentAnimation=$S(0,pf,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(pf),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&Rg(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||J();const f=Le(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const h=Le(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+h}Me(a,l),Vn(a,c),Mr(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new nb),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&Zo("z",o,u,this.animationValues);for(let c=0;c{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(mf),this.root.sharedNodes.clear()}}}function ob(e){e.updateLayout()}function ab(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,o=n.source!==e.layout.source;i==="size"?Ve(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],g=Le(h);h.min=r[f].min,h.max=h.min+g}):Rg(i,n.layoutBox,r)&&Ve(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],g=Le(r[f]);h.max=h.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+g)});const a=Mn();Mr(a,r,n.layoutBox);const l=Mn();o?Mr(l,e.applyTransform(s,!0),n.measuredBox):Mr(l,r,n.layoutBox);const u=!Eg(a);let c=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:g}=f;if(h&&g){const v=J();_r(v,n.layoutBox,h.layoutBox);const w=J();_r(w,r,g.layoutBox),jg(v,w)||(c=!0),f.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=v,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function lb(e){br&&tn.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function ub(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function cb(e){e.clearSnapshot()}function mf(e){e.clearMeasurements()}function db(e){e.isLayoutDirty=!1}function fb(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function gf(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function hb(e){e.resolveTargetDelta()}function pb(e){e.calcProjection()}function mb(e){e.resetSkewAndRotation()}function gb(e){e.removeLeadSnapshot()}function yf(e,t,n){e.translate=K(t.translate,0,n),e.scale=K(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function vf(e,t,n,r){e.min=K(t.min,n.min,r),e.max=K(t.max,n.max,r)}function yb(e,t,n,r){vf(e.x,t.x,n.x,r),vf(e.y,t.y,n.y,r)}function vb(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const xb={duration:.45,ease:[.4,0,.1,1]},xf=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),wf=xf("applewebkit/")&&!xf("chrome/")?Math.round:Ae;function Sf(e){e.min=wf(e.min),e.max=wf(e.max)}function wb(e){Sf(e.x),Sf(e.y)}function Rg(e,t,n){return e==="position"||e==="preserve-aspect"&&!kS(ff(t),ff(n),.2)}function Sb(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const bb=Ag({attachResizeListener:(e,t)=>os(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Jo={current:void 0},Lg=Ag({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Jo.current){const e=new bb({});e.mount(window),e.setOptions({layoutScroll:!0}),Jo.current=e}return Jo.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),kb={pan:{Feature:IS},drag:{Feature:OS,ProjectionNode:Lg,MeasureLayout:Cg}};function bf(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&z.postRender(()=>i(t,ys(t)))}class Cb extends Gt{mount(){const{current:t}=this.node;t&&(this.unmount=k1(t,n=>(bf(this.node,n,"Start"),r=>bf(this.node,r,"End"))))}unmount(){}}class Pb extends Gt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=gs(os(this.node.current,"focus",()=>this.onFocus()),os(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function kf(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&z.postRender(()=>i(t,ys(t)))}class Tb extends Gt{mount(){const{current:t}=this.node;t&&(this.unmount=E1(t,n=>(kf(this.node,n,"Start"),(r,{success:s})=>kf(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const fl=new WeakMap,qo=new WeakMap,Eb=e=>{const t=fl.get(e.target);t&&t(e)},jb=e=>{e.forEach(Eb)};function Nb({root:e,...t}){const n=e||document;qo.has(n)||qo.set(n,{});const r=qo.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(jb,{root:e,...t})),r[s]}function Ab(e,t,n){const r=Nb(t);return fl.set(e,n),r.observe(e),()=>{fl.delete(e),r.unobserve(e)}}const Rb={some:0,all:1};class Lb extends Gt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:Rb[s]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:f}=this.node.getProps(),h=u?c:f;h&&h(l)};return Ab(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(Db(t,n))&&this.startObserver()}unmount(){}}function Db({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Fb={inView:{Feature:Lb},tap:{Feature:Tb},focus:{Feature:Pb},hover:{Feature:Cb}},Mb={layout:{ProjectionNode:Lg,MeasureLayout:Cg}},hl={current:null},Dg={current:!1};function _b(){if(Dg.current=!0,!!fu)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>hl.current=e.matches;e.addListener(t),t()}else hl.current=!1}const Vb=[...sg,pe,zt],Ob=e=>Vb.find(rg(e)),Cf=new WeakMap;function Ib(e,t,n){for(const r in t){const s=t[r],i=n[r];if(ge(s))e.addValue(r,s);else if(ge(i))e.addValue(r,ss(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,ss(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Pf=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Bb{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Iu,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const g=it.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),Dg.current||_b(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:hl.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Cf.delete(this.current),this.projection&&this.projection.unmount(),Ut(this.notifyUpdate),Ut(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=xn.has(t),s=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&z.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in qn){const n=qn[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):J()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=ss(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(tg(s)||Hm(s))?s=parseFloat(s):!Ob(s)&&zt.test(n)&&(s=Jm(t,n)),this.setBaseTarget(t,ge(s)?s.get():s)),ge(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=xu(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!ge(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Du),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class Fg extends Bb{constructor(){super(...arguments),this.KeyframeResolver=ig}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ge(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Ub(e){return window.getComputedStyle(e)}class zb extends Fg{constructor(){super(...arguments),this.type="html",this.renderInstance=Sm}readValueFromInstance(t,n){if(xn.has(n)){const r=Ou(n);return r&&r.default||0}else{const r=Ub(t),s=(vm(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return bg(t,n)}build(t,n,r){bu(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return Tu(t,n,r)}}class $b extends Fg{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=J}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(xn.has(n)){const r=Ou(n);return r&&r.default||0}return n=bm.has(n)?n:gu(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Pm(t,n,r)}build(t,n,r){ku(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){km(t,n,r,s)}mount(t){this.isSVGTag=Pu(t.tagName),super.mount(t)}}const Wb=(e,t)=>vu(e)?new $b(t):new zb(t,{allowProjection:e!==x.Fragment}),Kb=g1({...pS,...Fb,...kb,...Mb},Wb),O=Rx(Kb);function Mg(){return(localStorage.getItem("apiBase")||"").replace(/\/+$/,"")}function vs(e){const t=Mg(),n=e.startsWith("/")?e:`/${e}`;return t?`${t}${n}`:n}async function $u(e){const t=await fetch(vs(e));if(!t.ok)throw new Error(await t.text());return t.json()}async function vt(e,t){const n=await fetch(vs(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await n.text());return n.json()}const Hb=()=>{const e=Mg();if(e)try{const r=new URL(e.includes("://")?e:`http://${e}`);return`${r.protocol==="https:"?"wss:":"ws:"}//${r.host}/ws`}catch{}const t=window.location;return`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}/ws`};function Gb(e){const[t,n]=x.useState(!1),r=x.useRef(e);return r.current=e,x.useEffect(()=>{let s=!1,i=0,o,a=null;const l=()=>{s||(a=new WebSocket(Hb()),a.onopen=()=>{i=0,n(!0),a==null||a.send("ping")},a.onclose=()=>{n(!1),i+=1,o=setTimeout(l,Math.min(8e3,500+i*400))},a.onerror=()=>a==null?void 0:a.close(),a.onmessage=u=>r.current(String(u.data)))};return l(),()=>{s=!0,clearTimeout(o),a==null||a.close()}},[]),t}const _g=x.createContext(null),Wu=5e3,Ku="pn532_browser_log_v1";function Xb(){try{const e=sessionStorage.getItem(Ku);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.slice(-Wu):[]}catch{return[]}}function Qb(e){try{sessionStorage.setItem(Ku,JSON.stringify(e.slice(-Wu)))}catch{}}function Yb(e,t,n){if(typeof e=="object"&&e&&"present"in e&&e.present===!1){t(null),n(!1);return}n(!0),typeof e=="object"&&e&&"uid"in e&&t(e)}function Zb(e){if(!e||typeof e!="object")return!1;const t=e;return t.present===!1?!1:typeof t.uid=="string"&&t.uid.length>0}function Jb(e){return!e||typeof e!="object"?!1:e.event==="recorded"}function qb({children:e}){const[t,n]=x.useState(null),[r,s]=x.useState(!1),[i,o]=x.useState(()=>Xb()),[a,l]=x.useState(0),[u,c]=x.useState("tag"),f=x.useRef(0),h=x.useCallback(y=>{const b=Date.now();y==="tag"&&b-f.current<280||(f.current=b,c(y),l(k=>k+1))},[]),g=x.useCallback(y=>{try{const b=JSON.parse(y),k=b.channel||"unknown";o(C=>{const E=[...C,{t:Date.now(),channel:k,payload:b.payload}].slice(-Wu);return Qb(E),E}),k==="scan"?(Yb(b.payload,n,s),Zb(b.payload)&&h("tag")):k==="capture"&&Jb(b.payload)&&h("vault")}catch{}},[h]),v=Gb(g),w=x.useCallback((y,b)=>{if(!y){n(null),s(!1);return}b&&(n(b),s(!0),h("tag"))},[h]),S=x.useCallback(()=>{o([]),sessionStorage.removeItem(Ku)},[]),m=x.useCallback(()=>{const y=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),b=URL.createObjectURL(y),k=document.createElement("a");k.href=b,k.download=`pn532-browser-log-${Date.now()}.json`,k.click(),URL.revokeObjectURL(b)},[i]),p=x.useMemo(()=>({wsOk:v,lastTag:t,tagPresent:r,log:i,cashWave:a,cashVariant:u,clearBrowserLog:S,exportBrowserLog:m,applyScanPoll:w}),[v,t,r,i,a,u,S,m,w]);return d.jsx(_g.Provider,{value:p,children:e})}function xs(){const e=x.useContext(_g);if(!e)throw new Error("useNfcWs outside NfcWsProvider");return e}function e2(){const{log:e,exportBrowserLog:t,clearBrowserLog:n,wsOk:r}=xs();return d.jsxs("div",{className:"flash-log-bar relative z-40 mx-auto flex max-w-6xl flex-wrap items-center justify-between gap-2 overflow-hidden border-b border-bubble-accent/15 px-4 py-2.5 font-mono text-[10px] text-bubble-mint/80 sm:text-xs",children:[d.jsx("div",{className:"pointer-events-none absolute inset-0 overflow-hidden",children:d.jsx("div",{className:"absolute inset-y-0 left-0 w-1/3 bg-gradient-to-r from-bubble-accent/10 to-transparent animate-shimmerLine"})}),d.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1",children:[d.jsx("span",{className:"shrink-0 animate-pulse text-bubble-volt",children:"◆"}),d.jsxs("span",{className:"truncate",children:[d.jsx("span",{className:"text-bubble-accent/70",children:"BUF"})," ",d.jsx("span",{className:"text-glow-matrix font-bold text-bubble-mint",children:e.length}),d.jsx("span",{className:"text-bubble-mint/40",children:"_evt"})]}),d.jsx("span",{className:"hidden text-bubble-mint/20 sm:inline",children:"│"}),d.jsxs("span",{children:[d.jsx("span",{className:"text-bubble-accent/60",children:"WS"})," ",d.jsx("span",{className:r?"text-glow-matrix font-bold tracking-wide text-bubble-mint":"animate-pulse text-glow-rose font-semibold text-bubble-rose",children:r?"SYNC":"WAIT"})]})]}),d.jsxs("div",{className:"relative flex shrink-0 gap-2",children:[d.jsx("button",{type:"button",onClick:t,className:"btn-neon rounded-md border border-bubble-accent/50 bg-gradient-to-r from-bubble-accent/25 to-bubble-mint/15 px-3 py-1.5 text-[10px] font-bold uppercase tracking-wider text-bubble-accent sm:text-xs",children:"Exfil"}),d.jsx("button",{type:"button",onClick:n,className:"rounded-md border border-bubble-rose/40 bg-bubble-rose/10 px-3 py-1.5 text-[10px] font-bold uppercase tracking-wide text-bubble-rose transition hover:border-bubble-rose hover:bg-bubble-rose/20 sm:text-xs",children:"Purge"})]})]})}function t2(){return d.jsxs("div",{className:"pointer-events-none fixed inset-0 z-[2] overflow-hidden",children:[d.jsx("div",{className:"absolute -left-[20%] top-[10%] h-[min(70vh,520px)] w-[min(70vh,520px)] rounded-full bg-fuchsia-600/25 blur-[100px] animate-pulseGlow",style:{animationDelay:"0s"}}),d.jsx("div",{className:"absolute -right-[15%] bottom-[5%] h-[min(55vh,440px)] w-[min(55vh,440px)] rounded-full bg-cyan-400/20 blur-[90px] animate-pulseGlow",style:{animationDelay:"1.2s"}}),d.jsx("div",{className:"absolute left-[35%] top-[40%] h-[min(45vh,360px)] w-[min(45vh,360px)] -translate-x-1/2 -translate-y-1/2 rounded-full bg-emerald-400/15 blur-[80px] animate-floatSlow"}),d.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_0%,rgba(2,4,8,0.75)_100%)]"})]})}const Tf=16,n2=7;function r2(){var e;try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const n=new t,r=n.createGain();r.gain.value=.11,r.connect(n.destination);const s=(c,f,h)=>{const g=n.createOscillator(),v=n.createGain();g.type="sine",g.frequency.setValueAtTime(c,f),v.gain.setValueAtTime(0,f),v.gain.linearRampToValueAtTime(1,f+.02),v.gain.exponentialRampToValueAtTime(.01,f+h),g.connect(v),v.connect(r),g.start(f),g.stop(f+h+.05)},i=n.currentTime;s(523.25,i,.11),s(659.25,i+.055,.13),s(783.99,i+.1,.16),s(1046.5,i+.14,.2);const o=n.createBufferSource(),a=n.createBuffer(1,n.sampleRate*.07,n.sampleRate),l=a.getChannelData(0);for(let c=0;cvoid n.close(),700)}catch{}}function s2(){const{cashWave:e,cashVariant:t,lastTag:n}=xs(),[r,s]=x.useState(!1),[i,o]=x.useState(0);return x.useEffect(()=>{if(e===0)return;o(e),s(!0),r2();const a=window.setTimeout(()=>s(!1),1650);return()=>window.clearTimeout(a)},[e]),d.jsx("div",{className:"pointer-events-none fixed left-2 top-[4.25rem] z-[55] sm:left-4 sm:top-[4.5rem] md:top-[5.25rem]",children:d.jsx(am,{mode:"wait",children:r?d.jsxs(O.div,{className:"relative flex flex-col items-start",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,scale:.92,filter:"blur(4px)"},transition:{duration:.4},children:[d.jsx(O.div,{className:"absolute -left-8 -top-8 h-40 w-40 rounded-full bg-gradient-to-br from-amber-400/45 via-yellow-200/30 to-bubble-mint/35 blur-2xl",initial:{scale:.2,opacity:0},animate:{scale:[.2,1.35,1],opacity:[0,1,.7]},transition:{duration:.5,ease:[.22,1,.36,1]}}),Array.from({length:Tf}).map((a,l)=>{const u=l/Tf*Math.PI*2,c=56+l%4*10;return d.jsx(O.span,{className:"absolute left-8 top-9 h-2 w-2 rounded-full bg-gradient-to-br from-yellow-100 to-amber-500 shadow-[0_0_12px_rgba(250,204,21,1)]",initial:{x:0,y:0,opacity:0,scale:0},animate:{x:Math.cos(u)*c,y:Math.sin(u)*c,opacity:[0,1,0],scale:[0,1.3,.3]},transition:{duration:.8,delay:l*.018,ease:"easeOut"}},`s-${l}`)}),Array.from({length:n2}).map((a,l)=>d.jsx(O.span,{className:"absolute left-8 top-8 text-xl sm:text-2xl",initial:{x:0,y:0,opacity:0,rotate:-30,scale:0},animate:{x:(l%2===0?1:-1)*(36+l*12),y:-32-l*11,opacity:[0,1,0],rotate:l*35,scale:[0,1.15,.85]},transition:{duration:.9,delay:.04+l*.035,ease:[.22,1,.36,1]},children:"🪙"},`c-${l}`)),d.jsxs(O.div,{className:"relative flex h-[4.75rem] w-[4.75rem] items-center justify-center sm:h-[5.5rem] sm:w-[5.5rem]",initial:{scale:0,rotate:-40},animate:{scale:[0,1.3,.92,1.06,1],rotate:[-40,12,-6,3,0]},transition:{duration:.7,ease:[.34,1.56,.64,1]},children:[d.jsx(O.div,{className:"absolute inset-0 rounded-2xl border-2 border-yellow-200/90",animate:{boxShadow:["0 0 25px rgba(250,204,21,0.55), inset 0 0 22px rgba(254,240,138,0.2)","0 0 50px rgba(0,255,157,0.5), inset 0 0 28px rgba(0,229,255,0.15)","0 0 28px rgba(250,204,21,0.6), inset 0 0 18px rgba(254,240,138,0.25)"]},transition:{duration:1.1,repeat:2}}),d.jsxs("svg",{viewBox:"0 0 100 100",className:"relative z-[1] h-[72%] w-[72%] drop-shadow-[0_0_14px_rgba(250,204,21,0.9)]","aria-hidden":!0,children:[d.jsxs("defs",{children:[d.jsxs("linearGradient",{id:"cashGold",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[d.jsx("stop",{offset:"0%",stopColor:"#fef9c3"}),d.jsx("stop",{offset:"40%",stopColor:"#facc15"}),d.jsx("stop",{offset:"100%",stopColor:"#a16207"})]}),d.jsxs("filter",{id:"cashGlow",x:"-50%",y:"-50%",width:"200%",height:"200%",children:[d.jsx("feGaussianBlur",{stdDeviation:"1.2",result:"b"}),d.jsxs("feMerge",{children:[d.jsx("feMergeNode",{in:"b"}),d.jsx("feMergeNode",{in:"SourceGraphic"})]})]})]}),d.jsx("circle",{cx:"50",cy:"50",r:"44",fill:"url(#cashGold)",filter:"url(#cashGlow)"}),d.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:"#422006",strokeOpacity:"0.28",strokeWidth:"2"}),d.jsx("text",{x:"50",y:"64",textAnchor:"middle",fill:"#713f12",fontSize:"54",fontWeight:"700",fontFamily:"Audiowide, Orbitron, system-ui, sans-serif",children:"$"})]}),d.jsx(O.div,{className:"pointer-events-none absolute inset-0 overflow-hidden rounded-2xl",initial:!1,children:d.jsx(O.div,{className:"absolute inset-y-2 w-2/5 bg-gradient-to-r from-transparent via-white/60 to-transparent skew-x-[-18deg]",initial:{left:"-40%"},animate:{left:"140%"},transition:{duration:.55,delay:.12,ease:"easeInOut"}})})]}),d.jsxs(O.div,{className:"relative -mt-0.5 max-w-[12rem] pl-0.5",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.12,type:"spring",stiffness:320,damping:22},children:[d.jsx(O.p,{className:"font-display text-[10px] tracking-[0.42em] text-yellow-100 sm:text-[11px]",animate:{textShadow:["0 0 10px rgba(250,204,21,0.95)","0 0 22px rgba(0,255,157,0.75)","0 0 12px rgba(250,204,21,0.9)"]},transition:{duration:.75,repeat:3},children:t==="vault"?"VAULT · LOCKED":"CHA-CHING · HIT"}),n!=null&&n.uid?d.jsx(O.p,{className:"mt-1 truncate font-mono text-[10px] font-bold tracking-[0.15em] text-bubble-mint sm:text-xs",initial:{opacity:0,x:-6},animate:{opacity:1,x:0},transition:{delay:.22},children:n.uid}):null]})]},i):null})})}const Vg=x.createContext(()=>{});function i2({children:e}){const[t,n]=x.useState([]),r=x.useCallback((i,o="info")=>{const a=Date.now();n(l=>[...l,{id:a,msg:i,kind:o}]),setTimeout(()=>n(l=>l.filter(u=>u.id!==a)),4200)},[]),s=x.useMemo(()=>r,[r]);return d.jsxs(Vg.Provider,{value:s,children:[e,d.jsx("div",{className:"pointer-events-none fixed bottom-5 right-5 z-[60] flex max-w-sm flex-col gap-3",children:d.jsx(am,{children:t.map(i=>d.jsxs(O.div,{initial:{opacity:0,x:40,rotate:-2,scale:.92},animate:{opacity:1,x:0,rotate:0,scale:1},exit:{opacity:0,x:20,scale:.9},transition:{type:"spring",stiffness:380,damping:26},className:`pointer-events-auto relative overflow-hidden border-2 px-5 py-3.5 font-mono text-xs backdrop-blur-md ${i.kind==="err"?"border-bubble-rose bg-bubble-950/95 text-bubble-rose shadow-glowRose":"border-bubble-mint bg-bubble-900/95 text-bubble-mint shadow-glow"} `,children:[d.jsx("div",{className:`pointer-events-none absolute inset-0 opacity-30 ${i.kind==="err"?"bg-gradient-to-r from-bubble-rose/20 to-transparent":"bg-gradient-to-r from-bubble-accent/20 to-bubble-mint/10"}`}),d.jsx("span",{className:"relative mr-2 font-black opacity-80",children:i.kind==="err"?"!!":"»"}),d.jsx("span",{className:"relative",children:i.msg})]},i.id))})})]})}function Je(){return x.useContext(Vg)}function o2(e){const t=e.replace(/\s/g,"");if(t.length!==32)return null;const n=new Uint8Array(16);for(let u=0;u<16;u++)n[u]=parseInt(t.slice(u*2,u*2+2),16);const r=n[6],s=n[7],i=n[8],o=r>>4&1|s>>0&2|i>>0&4,a=r>>5&1|s>>1&2|i>>1&4,l=r>>6&1|s>>2&2|i>>2&4;return{c1:o,c2:a,c3:l}}function Og(e){switch(e){case 8:return"Ultralight family";case 9:return"Mini / Classic";case 24:return"Classic 1K";case 25:return"Classic 4K";default:return`SAK 0x${e.toString(16).toUpperCase()}`}}function Ig(e){var n;const t=e.replace(/\s/g,"");return t.length%2!==0?e:((n=t.match(/.{2}/g))==null?void 0:n.join(":"))??t}function a2(e){switch(e){case 1:return"Classic-style (MIFARE)";case 2:return"Type 2 / Ultralight-style";default:return"Unknown (check SAK/ATQA)"}}function l2(e){const t=[];return e.uidLen===4?t.push("4-byte UID — single cascade level (CL1)."):e.uidLen===7?t.push("7-byte UID — double cascade (CL1 + CL2) typical for 7B tags."):e.uidLen===10&&t.push("10-byte UID — triple cascade path."),e.sak===8&&t.push("SAK 0x08 — often Ultralight / Type 2; use page read/write for user memory."),(e.sak===24||e.sak===25)&&t.push("MIFARE Classic — authenticate per sector trailer, then block read/write."),(e.atqa===68||e.atqa===17408)&&t.push("ATQA 0x4400 pattern — very common Type A inventory response."),t}function u2(e){return e.map(t=>(Number(t)&255).toString(16).toUpperCase().padStart(2,"0")).join(" ")}function c2({className:e=""}){return d.jsx("div",{className:`relative ${e}`.trim(),children:d.jsxs("svg",{viewBox:"0 0 400 220",className:"h-auto w-full max-w-md text-bubble-mint/90","aria-hidden":!0,children:[d.jsxs("defs",{children:[d.jsxs("linearGradient",{id:"g1",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[d.jsx("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.9"}),d.jsx("stop",{offset:"100%",stopColor:"#00e5ff",stopOpacity:"0.35"})]}),d.jsxs("filter",{id:"glow",children:[d.jsx("feGaussianBlur",{stdDeviation:"2",result:"b"}),d.jsxs("feMerge",{children:[d.jsx("feMergeNode",{in:"b"}),d.jsx("feMergeNode",{in:"SourceGraphic"})]})]})]}),[0,1,2,3].map(t=>d.jsx("ellipse",{cx:"200",cy:"110",rx:40+t*38,ry:28+t*26,fill:"none",stroke:"currentColor",strokeWidth:"0.6",strokeOpacity:.22-t*.04,className:"origin-center animate-[spin_32s_linear_infinite]",style:{transformOrigin:"200px 110px",animationDelay:`${t*2}s`}},t)),d.jsx("g",{filter:"url(#glow)",children:d.jsx("path",{d:"M200 110 L360 110 A160 80 0 0 1 200 190 Z",fill:"url(#g1)",fillOpacity:"0.12",className:"origin-center animate-[spin_6s_linear_infinite]",style:{transformOrigin:"200px 110px"}})}),d.jsx("circle",{cx:"200",cy:"110",r:"36",fill:"none",stroke:"currentColor",strokeWidth:"1.2",opacity:"0.5"}),d.jsx("circle",{cx:"200",cy:"110",r:"22",fill:"none",stroke:"#00e5ff",strokeWidth:"0.8",opacity:"0.45"}),d.jsx("circle",{cx:"200",cy:"110",r:"8",fill:"currentColor",opacity:"0.35"}),Array.from({length:12}).map((t,n)=>{const r=n/12*Math.PI*2,s=200+Math.cos(r)*118,i=110+Math.sin(r)*78;return d.jsx("rect",{x:s-1,y:i-1,width:"2",height:"2",fill:"currentColor",opacity:.15+n%3*.08,className:"animate-pulse",style:{animationDelay:`${n*.15}s`}},n)}),d.jsx("text",{x:"200",y:"205",textAnchor:"middle",className:"fill-bubble-mint/40 font-mono text-[9px] tracking-[0.35em]",children:"13.56MHZ"})]})})}function d2(){const e=Je(),{lastTag:t,applyScanPoll:n}=xs(),[r,s]=x.useState(null),[i,o]=x.useState(!0),a=()=>{$u("/api/status").then(s).catch(()=>e("Status unreachable","err"))};x.useEffect(()=>{a();const c=setInterval(a,3e3);return()=>clearInterval(c)},[e]),x.useEffect(()=>{r&&typeof r.scanning=="boolean"&&o(r.scanning)},[r]);const l=async()=>{try{await vt("/api/nfc/scan",{enable:!i}),o(!i),e(i?"Continuous scan off":"Continuous scan on")}catch(c){e(String(c),"err")}},u=async()=>{try{const c=await vt("/api/nfc/poll",{});c.present&&c.tag?(n(!0,c.tag),e(`Tag ${c.tag.uid}`)):(n(!1),e("No tag"))}catch(c){e(String(c),"err")}};return d.jsxs("div",{className:"space-y-8",children:[d.jsxs(O.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.5,ease:[.22,1,.36,1]},className:"glass relative overflow-hidden p-6 md:p-10",children:[d.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[conic-gradient(from_180deg_at_50%_120%,rgba(0,229,255,0.08),transparent_40%,rgba(255,42,109,0.06),transparent_70%)]"}),d.jsxs("div",{className:"relative grid gap-8 lg:grid-cols-[1fr_min(320px,40%)] lg:items-center",children:[d.jsxs("div",{children:[d.jsx("p",{className:"font-mono text-[10px] font-bold tracking-[0.4em] text-bubble-accent/80",children:"COMMAND_LAYER"}),d.jsxs("h1",{className:"font-display mt-2 text-3xl font-normal tracking-wide text-glow-matrix md:text-5xl",children:["NFC ",d.jsx("span",{className:"text-bubble-accent",children:"CONTROL"})]}),d.jsx("p",{className:"mt-3 max-w-xl text-sm leading-relaxed text-slate-400",children:"Full-time scan out of the box. Fat RF retries. Browser log + device session export — crank it from your phone."}),(r==null?void 0:r.session)&&(r.session.deepCapture||r.session.usedBytes>0)&&d.jsxs(O.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},className:"mt-5 flex flex-wrap items-center gap-3 rounded-xl border border-bubble-accent/40 bg-gradient-to-r from-bubble-accent/15 to-bubble-mint/10 px-4 py-3 text-sm shadow-glowCyan",children:[d.jsxs("span",{className:"font-mono text-bubble-mint",children:["RAM ",r.session.usedBytes,"/",r.session.maxBytes,r.session.full?" · LOCKED":""]}),d.jsx(sm,{to:"/capture",className:"btn-neon rounded-lg bg-bubble-mint/20 px-3 py-1 text-xs font-bold text-bubble-mint",children:"Read-all →"})]}),d.jsxs("div",{className:"mt-8 flex flex-wrap gap-3",children:[d.jsx(O.button,{type:"button",whileHover:{scale:1.04},whileTap:{scale:.98},onClick:u,className:"btn-neon rounded-xl bg-gradient-to-r from-bubble-accent via-cyan-400 to-bubble-mint px-6 py-3 text-sm font-black uppercase tracking-wider text-bubble-950 shadow-neonBtn",children:"Poll tag"}),d.jsx(O.button,{type:"button",whileHover:{scale:1.03},whileTap:{scale:.98},onClick:l,className:`rounded-xl border-2 px-6 py-3 text-sm font-bold uppercase tracking-wide transition ${i?"border-bubble-mint/70 bg-bubble-mint/15 text-glow-matrix text-bubble-mint shadow-glow":"border-white/20 bg-black/30 text-slate-400 hover:border-bubble-accent/50 hover:text-bubble-accent"}`,children:i?"Stop scan":"Start scan"})]})]}),d.jsx("div",{className:"relative flex justify-center lg:justify-end",children:d.jsx("div",{className:"relative w-full max-w-[280px] opacity-90 drop-shadow-[0_0_40px_rgba(0,229,255,0.35)]",children:d.jsx(c2,{})})})]})]}),d.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[d.jsxs(O.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.08},className:"glass p-6",children:[d.jsx("h2",{className:"font-display text-lg font-normal text-bubble-accent text-glow-cyan",children:"Device stack"}),r?d.jsxs("ul",{className:"mt-4 space-y-3 font-mono text-sm text-slate-300",children:[d.jsxs("li",{className:"flex justify-between border-b border-white/5 pb-2",children:[d.jsx("span",{className:"text-slate-500",children:"uptime"}),d.jsxs("span",{className:"text-bubble-mint",children:[(r.uptimeMs/1e3).toFixed(1),"s"]})]}),d.jsxs("li",{className:"flex justify-between border-b border-white/5 pb-2",children:[d.jsx("span",{className:"text-slate-500",children:"heap"}),d.jsx("span",{className:"text-white",children:r.freeHeap})]}),d.jsxs("li",{className:"flex justify-between",children:[d.jsx("span",{className:"text-slate-500",children:"PN532"}),d.jsx("span",{className:"text-bubble-accent",children:r.pn532?`IC${r.pn532.ic} v${r.pn532.fwHi}.${r.pn532.fwLo}`:"n/a"})]})]}):d.jsx("p",{className:"mt-4 animate-pulse font-mono text-sm text-bubble-accent/60",children:"Pulling status…"})]}),d.jsxs(O.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.14},className:"glass p-6",children:[d.jsx("h2",{className:"font-display text-lg font-normal text-bubble-rose/90 text-glow-rose",children:"Live tag"}),t?d.jsxs("div",{className:"mt-4 space-y-4 rounded-xl border border-bubble-mint/25 bg-black/35 p-4 shadow-glow",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-bubble-mint/50",children:"UID"}),d.jsx("div",{className:"font-mono text-xl font-bold tracking-[0.15em] text-glow-matrix text-bubble-mint md:text-2xl",children:Ig(t.uid)}),d.jsxs("p",{className:"mt-1 font-mono text-[11px] text-slate-500",children:["raw ",t.uid," · ",t.uidLen," byte",t.uidLen===1?"":"s"]})]}),d.jsxs("div",{className:"grid gap-3 border-t border-white/5 pt-3 font-mono text-[11px] text-slate-300 sm:grid-cols-2",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-slate-500",children:"ATQA"})," ",d.jsxs("span",{className:"text-bubble-accent",children:["0x",(t.atqaHex??t.atqa.toString(16).toUpperCase().padStart(4,"0")).slice(-4)]}),d.jsxs("span",{className:"ml-2 text-slate-500",children:["(",t.atqa,")"]})]}),d.jsxs("div",{children:[d.jsx("span",{className:"text-slate-500",children:"SAK"})," ",d.jsxs("span",{className:"text-bubble-accent",children:["0x",(t.sakHex??t.sak.toString(16).toUpperCase().padStart(2,"0")).slice(-2)]}),d.jsxs("span",{className:"ml-1 text-slate-400",children:["— ",Og(t.sak)]})]}),d.jsxs("div",{className:"sm:col-span-2",children:[d.jsx("span",{className:"text-slate-500",children:"Guess"})," ",d.jsx("span",{className:"text-bubble-mint",children:t.typeGuess??a2(t.typeHint)}),d.jsxs("span",{className:"ml-2 text-slate-600",children:["· hint ",t.typeHint]})]})]}),t.pn532GeneralStatus&&t.pn532GeneralStatus.length>0&&d.jsxs("div",{className:"rounded-lg border border-bubble-accent/20 bg-black/40 p-3",children:[d.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest text-bubble-accent/70",children:"PN532 general status"}),d.jsx("p",{className:"mt-2 break-all font-mono text-[10px] leading-relaxed text-slate-400",children:u2(t.pn532GeneralStatus)}),d.jsx("p",{className:"mt-2 text-[10px] text-slate-600",children:"Raw bytes from the chip right after this inventory (error flags, last command, tag count — see NXP PN532 user manual)."})]}),d.jsx("ul",{className:"space-y-1 border-t border-white/5 pt-3 text-[11px] leading-relaxed text-slate-500",children:l2(t).map((c,f)=>d.jsxs("li",{className:"flex gap-2",children:[d.jsx("span",{className:"text-bubble-mint/40",children:"▸"}),d.jsx("span",{children:c})]},f))})]}):d.jsx("p",{className:"mt-6 font-mono text-sm text-bubble-mint/40",children:"Listening on the field…"})]})]})]})}function f2(){const e=Je(),[t,n]=x.useState("FFFFFFFFFFFF"),[r,s]=x.useState(!1),[i,o]=x.useState(0),[a,l]=x.useState(""),[u,c]=x.useState(""),f=async()=>{try{const v=await vt("/api/mifare/read-block",{block:i,key:t,keyB:r});v.data?(l(v.data),e("Read OK")):e(v.error||"failed","err")}catch(v){e(String(v),"err")}},h=async()=>{try{const v=await vt("/api/ul/read-page",{page:i});v.data&&(l(v.data+" (UL page)"),e("UL read OK"))}catch(v){e(String(v),"err")}},g=u?o2(u):null;return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"glass p-6",children:[d.jsx("h1",{className:"font-display text-2xl font-bold",children:"Read / analyze"}),d.jsx("p",{className:"mt-2 text-sm text-slate-400",children:"Authenticate with a known key, dump a block, paste a sector trailer to decode access bits."}),d.jsxs("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[d.jsxs("label",{className:"block space-y-2 text-sm",children:["Key (12 hex)",d.jsx("input",{value:t,onChange:v=>n(v.target.value),className:"w-full rounded-2xl border border-white/10 bg-black/25 px-4 py-2 font-mono text-bubble-mint outline-none ring-bubble-accent/40 focus:ring-2"})]}),d.jsxs("label",{className:"flex items-end gap-3 text-sm",children:[d.jsx("input",{type:"checkbox",checked:r,onChange:v=>s(v.target.checked)})," Key B"]}),d.jsxs("label",{className:"block space-y-2 text-sm",children:["Block / page",d.jsx("input",{type:"number",value:i,onChange:v=>o(Number(v.target.value)),className:"w-full rounded-2xl border border-white/10 bg-black/25 px-4 py-2 outline-none ring-bubble-accent/40 focus:ring-2"})]})]}),d.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[d.jsx("button",{type:"button",onClick:f,className:"rounded-2xl bg-bubble-accent/90 px-4 py-2 font-semibold text-white",children:"MIFARE read block"}),d.jsx("button",{type:"button",onClick:h,className:"rounded-2xl border border-white/15 px-4 py-2",children:"Ultralight read page"})]}),a&&d.jsx("pre",{className:"mt-4 overflow-auto rounded-2xl border border-white/10 bg-black/30 p-4 font-mono text-sm",children:a})]}),d.jsxs("div",{className:"glass p-6",children:[d.jsx("h2",{className:"font-display text-lg font-semibold",children:"Sector trailer playground"}),d.jsxs("label",{className:"mt-4 block text-sm",children:["16-byte trailer (32 hex) — bytes 6–8 are access bytes",d.jsx("textarea",{value:u,onChange:v=>c(v.target.value),rows:3,className:"mt-2 w-full rounded-2xl border border-white/10 bg-black/25 p-3 font-mono text-xs outline-none focus:ring-2 focus:ring-bubble-accent/40"})]}),g&&d.jsxs("div",{className:"mt-4 rounded-2xl border border-bubble-mint/30 bg-bubble-mint/5 p-4 text-sm",children:["Parsed C1–C3 nibble pattern: ",g.c1," ",g.c2," ",g.c3," (see NXP MIFARE docs for truth tables)"]}),d.jsxs("p",{className:"mt-4 text-xs text-slate-500",children:["SAK hints: common values for labeling only — ",Og(24)," etc."]})]})]})}const ws="Lab-only synthetic data and well-known defaults. Edit bytes freely to validate parsers, checksums, and emulate/raw paths — never treat these as real tags.",Ef=[{id:"get-fw",title:"GetFirmwareVersion (0x02)",hex:"02",detail:"Expect PN532 firmware major/minor in response payload."},{id:"get-status",title:"GetGeneralStatus (0x04)",hex:"04",detail:"Chip + RF status snapshot; useful sanity check after a stuck session."},{id:"in-list-a",title:"InListPassiveTarget — 106 kbps, 1 target",hex:"4A0100",detail:"Poll one ISO14443-A target at 106 kbps (maxTg=1, BrTy=0)."}],jf=[{id:"tg-stub",title:"TgInitAsTarget — opcode only (shell)",hex:"8C",detail:"Minimal placeholder; real target mode needs a full parameter block per NXP UM0701. Extend with NFCID, FeliCa params, etc."},{id:"tg-type-a-sketch",title:"TgInitAsTarget — Type A sketch (synthetic NFCID3T)",hex:"8C000012DEADBEEF00000000000000000000000000000000000000000000000000",detail:"Synthetic 0x8C prefix + padded fake ID — not guaranteed to satisfy any reader; use as a byte-editing template only."}],h2="DEADBEEF2208040000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF078069FFFFFFFFFFFF",p2="04112233445566172233445566172233445566172233445566172233",m2="0310D1010C55046578616D706C652E636F6DFE",pl=[{id:"mifare-block0",title:"MIFARE Classic — block 0 (16 B, synthetic UID+BCC)",hex:"DEADBEEF220804000000000000000000",byteLength:16,sha256Hex:"6f13f064d70ec33b7ace5842011d66aff3852baa4ab7c0a85aa66d113c7189fe",detail:"Fake 4-byte UID (DE:AD:BE:EF wire order as stored), BCC = XOR(UID), rest filler. Pair with key FFFFFFFFFFFF on a writable tag only."},{id:"mifare-sector0",title:"MIFARE Classic — sector 0 dump (64 B)",hex:h2,byteLength:64,sha256Hex:"11095df4db11e4271f40234533db45de35c4ca69f04e231e3fa47f38181e0168",detail:"Four blocks: manufacturer/UID, empty, empty, default trailer (Key A/B FFFFFFFFFFFF, access FF078069). Edit block 1–2 payload and re-hash to validate your pipeline."},{id:"ntag-pages",title:"NTAG-style — pages 0–6 (28 B)",hex:p2,byteLength:28,sha256Hex:"8ffd95e646b2deb218dabd72e35c7a1938725e07332d8ed7df4f2a2656e590a0",detail:"Synthetic UID/internal/lock placeholders — not copied from a physical tag."},{id:"ndef-uri-tlv",title:"NDEF TLV — URI https://example.com/",hex:m2,byteLength:19,sha256Hex:"81197b6cd6e40a3f62f56f0c0f3f449c63a956919d04c5b5317895ad4328fa14",detail:"Type 2 TLV (0x03) + short NDEF Well-Known URI record; append to user memory after static pages in real layouts."}],g2=["FFFFFFFFFFFF","A0A1A2A3A4A5","D3F7D3F7D3F7","000000000000","B0B1B2B3B4B5","AABBCCDDEEFF","4D3A99C351DD","1A982C7E459A","714C5C886E97","587EE5F9350F","A0478CC39091","26940B21FFF5","E4410EF8ED2D"],y2=pl.map(e=>({name:`LAB // ${e.title}`,hex:e.hex,note:e.detail}));function fo({mode:e,onApplyHex:t,onPickBinary:n,className:r=""}){const[s,i]=x.useState(0),o=()=>i(a=>a+1);return e==="raw"?d.jsx("div",{className:`flex flex-wrap items-center gap-2 ${r}`,children:d.jsxs("select",{defaultValue:"","aria-label":"Load PN532 lab command",className:"max-w-full rounded-xl border border-bubble-mint/25 bg-black/40 px-3 py-2 font-mono text-xs text-bubble-mint/90",onChange:a=>{const l=a.target.value;if(!l)return;const u=Ef.find(c=>c.id===l);u&&t(u.hex),o()},children:[d.jsx("option",{value:"",children:"Lab: PN532 command bytes…"}),Ef.map(a=>d.jsx("option",{value:a.id,children:a.title},a.id))]},s)}):e==="emulate"?d.jsx("div",{className:`flex flex-wrap items-center gap-2 ${r}`,children:d.jsxs("select",{defaultValue:"","aria-label":"Load emulate lab frame",className:"max-w-full rounded-xl border border-bubble-mint/25 bg-black/40 px-3 py-2 font-mono text-xs text-bubble-mint/90",onChange:a=>{const l=a.target.value;if(!l)return;const u=jf.find(c=>c.id===l);u&&t(u.hex),o()},children:[d.jsx("option",{value:"",children:"Lab: emulate / TgInit…"}),jf.map(a=>d.jsx("option",{value:a.id,children:a.title},a.id))]},s)}):d.jsx("div",{className:`space-y-2 ${r}`,children:d.jsxs("select",{defaultValue:"","aria-label":"Load synthetic card blob",className:"w-full max-w-full rounded-xl border border-bubble-mint/25 bg-black/40 px-3 py-2 font-mono text-xs text-bubble-mint/90",onChange:a=>{const l=a.target.value;if(!l)return;const u=pl.find(c=>c.id===l);u&&(t(u.hex),n==null||n(u)),o()},children:[d.jsx("option",{value:"",children:"Lab: synthetic card / NDEF blob…"}),pl.map(a=>d.jsxs("option",{value:a.id,children:[a.title," (",a.byteLength," B)"]},a.id))]},s)})}function v2(){const e=Je(),{lastTag:t}=xs(),[n,r]=x.useState("FFFFFFFFFFFF"),[s,i]=x.useState(!1),[o,a]=x.useState(4),[l,u]=x.useState("00000000000000000000000000000000"),[c,f]=x.useState(null),[h,g]=x.useState(4),[v,w]=x.useState("00000000"),S=async()=>{if(confirm("Write will modify tag memory. Continue?"))try{await vt("/api/mifare/write-block",{block:o,key:n,keyB:s,data:l}),e("Write OK")}catch(p){e(String(p),"err")}},m=async()=>{if(confirm("Ultralight page write — can brick OTP/lock bytes if misused. Continue?"))try{await vt("/api/ul/write-page",{page:h,data:v.replace(/\s/g,"")}),e("UL page write OK")}catch(p){e(String(p),"err")}};return d.jsxs("div",{className:"glass space-y-6 p-6",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"font-display text-2xl font-bold",children:"Write / clone helpers"}),d.jsx("p",{className:"mt-2 text-sm text-slate-400",children:"Block editor for MIFARE Classic. Read blocks on the Read tab, adjust hex here, then write with a key that unlocks the sector."}),t&&d.jsxs("p",{className:"mt-2 rounded-lg border border-bubble-mint/20 bg-bubble-mint/5 px-3 py-2 font-mono text-xs text-bubble-mint",children:["Field: ",d.jsx("span",{className:"text-white",children:Ig(t.uid)})," ·"," ",t.typeGuess??`hint ${t.typeHint}`]}),d.jsx("p",{className:"mt-2 text-[11px] leading-relaxed text-slate-500",children:ws}),d.jsx(fo,{mode:"binary",className:"mt-3",onApplyHex:p=>{const y=p.replace(/\s/g,"");y.length<=32?u(y):(u(y.slice(0,32)),e("First 16 bytes of lab blob loaded into block editor","info"))},onPickBinary:f}),c&&d.jsxs("p",{className:"mt-2 font-mono text-[10px] text-bubble-accent/90",children:["Canonical SHA-256 (",c.byteLength," B): ",c.sha256Hex," — changes after any edit"]})]}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[d.jsxs("label",{className:"text-sm",children:["Key (12 hex)",d.jsx("input",{value:n,onChange:p=>r(p.target.value),className:"mt-1 w-full rounded-2xl border border-white/10 bg-black/25 px-4 py-2 font-mono"})]}),d.jsxs("label",{className:"flex items-end gap-2 text-sm",children:[d.jsx("input",{type:"checkbox",checked:s,onChange:p=>i(p.target.checked)})," Key B"]}),d.jsxs("label",{className:"text-sm",children:["Block",d.jsx("input",{type:"number",value:o,onChange:p=>a(Number(p.target.value)),className:"mt-1 w-full rounded-2xl border border-white/10 bg-black/25 px-4 py-2"})]})]}),d.jsxs("label",{className:"block text-sm",children:["16 bytes (32 hex)",d.jsx("textarea",{value:l,onChange:p=>u(p.target.value),rows:4,className:"mt-1 w-full rounded-2xl border border-white/10 bg-black/25 p-3 font-mono text-sm"})]}),d.jsx("button",{type:"button",onClick:S,className:"rounded-2xl bg-gradient-to-r from-bubble-rose to-orange-400 px-6 py-3 font-bold text-white shadow-glow",children:"Write block"}),d.jsxs("div",{className:"border-t border-white/10 pt-8",children:[d.jsx("h2",{className:"font-display text-lg font-bold text-bubble-accent",children:"Ultralight / NTAG page write"}),d.jsx("p",{className:"mt-2 text-sm text-slate-400",children:"4 bytes per page (8 hex). Keep tag on the coil. Avoid lock / config pages unless you mean it."}),d.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:[d.jsxs("label",{className:"text-sm",children:["Page",d.jsx("input",{type:"number",value:h,onChange:p=>g(Number(p.target.value)),className:"mt-1 w-full rounded-2xl border border-white/10 bg-black/25 px-4 py-2"})]}),d.jsxs("label",{className:"text-sm",children:["Data (8 hex)",d.jsx("input",{value:v,onChange:p=>w(p.target.value),className:"mt-1 w-full rounded-2xl border border-white/10 bg-black/25 px-4 py-2 font-mono"})]})]}),d.jsx("button",{type:"button",onClick:m,className:"mt-4 rounded-2xl border border-bubble-accent/50 bg-bubble-accent/20 px-6 py-3 font-bold text-bubble-accent",children:"Write UL page"})]})]})}const Nf="pn532_saved_tags_v1";function x2(){const e=Je(),[t,n]=x.useState([]),[r,s]=x.useState("My tag"),[i,o]=x.useState(""),[a,l]=x.useState(null);x.useEffect(()=>{try{const g=localStorage.getItem(Nf);n(g?JSON.parse(g):[])}catch{n([])}},[]);const u=g=>{localStorage.setItem(Nf,JSON.stringify(g)),n(g)},c=()=>{if(!i.trim()){e("Paste hex first","err");return}const v={id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,name:r,hex:i.replace(/\s/g,""),ts:Date.now()};u([v,...t]),e("Saved")},f=g=>u(t.filter(v=>v.id!==g)),h=()=>{const g=new Set(t.map(S=>S.name)),v=Date.now(),w=y2.filter(S=>!g.has(S.name)).map((S,m)=>({id:`lab-seed-${v}-${m}`,name:S.name,hex:S.hex,ts:v}));if(!w.length){e("Lab catalog already in library","info");return}u([...w,...t]),e(`Seeded ${w.length} lab record(s)`)};return d.jsxs("div",{className:"glass space-y-6 p-6",children:[d.jsx("h1",{className:"font-display text-2xl font-bold",children:"Saved tag library"}),d.jsx("p",{className:"text-sm text-slate-400",children:"Local browser storage — export by copy/paste."}),d.jsx("p",{className:"text-[11px] leading-relaxed text-slate-500",children:ws}),d.jsx("div",{className:"flex flex-wrap gap-2",children:d.jsx("button",{type:"button",onClick:h,className:"rounded-2xl border border-bubble-mint/30 bg-bubble-mint/10 px-4 py-2 font-mono text-xs font-semibold text-bubble-mint",children:"Seed all lab samples"})}),d.jsx(fo,{mode:"binary",onApplyHex:g=>o(g.replace(/\s/g,"")),onPickBinary:l}),a&&d.jsxs("div",{className:"rounded-xl border border-bubble-accent/25 bg-black/30 p-3 font-mono text-[10px] text-bubble-accent/90",children:[d.jsx("div",{className:"text-bubble-mint/70",children:"Expected SHA-256 (canonical blob, pre-edit)"}),d.jsx("div",{className:"break-all",children:a.sha256Hex})]}),d.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[d.jsx("input",{value:r,onChange:g=>s(g.target.value),placeholder:"Label",className:"rounded-2xl border border-white/10 bg-black/25 px-4 py-2"}),d.jsx("button",{type:"button",onClick:c,className:"rounded-2xl bg-bubble-accent px-4 py-2 font-semibold",children:"Save current hex"})]}),d.jsx("textarea",{value:i,onChange:g=>o(g.target.value),placeholder:"Hex dump",rows:5,className:"w-full rounded-2xl border border-white/10 bg-black/25 p-3 font-mono text-xs"}),d.jsx("ul",{className:"space-y-3",children:t.map(g=>d.jsxs("li",{className:"rounded-2xl border border-white/10 bg-black/20 p-4",children:[d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[d.jsxs("div",{children:[d.jsx("div",{className:"font-display font-semibold",children:g.name}),d.jsx("div",{className:"text-xs text-slate-500",children:new Date(g.ts).toLocaleString()})]}),d.jsx("button",{type:"button",onClick:()=>f(g.id),className:"text-rose-300",children:"Remove"})]}),d.jsx("pre",{className:"mt-2 max-h-32 overflow-auto text-xs text-bubble-mint/90",children:g.hex}),d.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(g.hex),e("Copied")},className:"mt-2 text-sm text-slate-300 underline",children:"Copy hex"})]},g.id))})]})}const w2=["FFFFFFFFFFFF","A0A1A2A3A4A5","D3F7D3F7D3F7","000000000000"],Af="pn532_key_dict_v1";function S2(){const e=Je(),[t,n]=x.useState([]),[r,s]=x.useState("");x.useEffect(()=>{const u=localStorage.getItem(Af);n(u?JSON.parse(u):[...w2])},[]);const i=u=>{localStorage.setItem(Af,JSON.stringify(u)),n(u)},o=()=>{const u=[...t];let c=0;for(const f of g2)u.includes(f)||(u.push(f),c++);if(!c){e("Lab key corpus already merged","info");return}i(u),e(`Added ${c} public lab key(s)`)},a=()=>{const u=sessionStorage.getItem("pn532_keylab_import");if(!(u!=null&&u.trim())){e("Key Lab has nothing staged","info");return}const c=u.split(/\r?\n/).map(g=>g.replace(/\s/g,"").toUpperCase()).filter(g=>g.length===12);if(!c.length){e("No valid 12-hex keys in stash","err");return}const f=[...t];let h=0;for(const g of c)f.includes(g)||(f.push(g),h++);i(f),sessionStorage.removeItem("pn532_keylab_import"),e(h?`Merged ${h} key(s) from Key Lab`:"Keys already in list")},l=()=>{const u=r.replace(/\s/g,"").toUpperCase();if(u.length!==12){e("12 hex chars required","err");return}t.includes(u)?e("Already in dictionary"):(i([u,...t]),e("Key added")),s("")};return d.jsxs("div",{className:"glass space-y-6 p-6",children:[d.jsx("h1",{className:"font-display text-2xl font-bold",children:"Key manager"}),d.jsx("p",{className:"text-sm text-slate-400",children:"Dictionary for manual trials (not a cloud rainbow table). Keys stay in your browser."}),d.jsx("p",{className:"text-[11px] leading-relaxed text-slate-500",children:ws}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.jsx("button",{type:"button",onClick:o,className:"btn-neon rounded-xl border border-bubble-mint/40 bg-bubble-mint/10 px-4 py-2 font-mono text-xs font-bold text-bubble-mint",children:"Merge lab corpus"}),d.jsx("button",{type:"button",onClick:a,className:"rounded-xl border border-bubble-accent/45 bg-bubble-accent/10 px-4 py-2 font-mono text-xs font-bold text-bubble-accent",children:"Import Key Lab stash"})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{value:r,onChange:u=>s(u.target.value),placeholder:"New key",className:"flex-1 rounded-2xl border border-white/10 bg-black/25 px-4 py-2 font-mono"}),d.jsx("button",{type:"button",className:"rounded-2xl bg-bubble-accent px-4 py-2 font-semibold",onClick:l,children:"Add"})]}),d.jsx("ul",{className:"space-y-2",children:t.map(u=>d.jsxs("li",{className:"flex items-center justify-between rounded-2xl border border-white/10 bg-black/20 px-4 py-2 font-mono text-sm",children:[u,d.jsx("button",{type:"button",className:"text-rose-300",onClick:()=>i(t.filter(c=>c!==u)),children:"×"})]},u))})]})}function b2(){const e=Je(),[t,n]=x.useState("4A0100"),[r,s]=x.useState([]),[i,o]=x.useState(""),a=c=>s(f=>[new Date().toLocaleTimeString()+" "+c,...f].slice(0,80)),l=async()=>{try{const c=await vt("/api/raw/pn532",{frame:t});a(`TX ${t}`),a(`RX ${c.response||c.error||"?"}`),c.response&&e("Frame OK")}catch(c){a(`ERR ${String(c)}`),e(String(c),"err")}},u=async()=>{try{const c=await $u("/api/pn532/general-status");o(JSON.stringify(c.raw??c,null,2)),e("Fetched PN532 status")}catch(c){e(String(c),"err")}};return d.jsxs("div",{className:"glass space-y-6 p-6",children:[d.jsx("h1",{className:"font-display text-2xl font-bold",children:"Advanced / raw PN532"}),d.jsxs("p",{className:"text-sm text-slate-400",children:["Send command bytes (without PN532 frame wrapper). Example: ",d.jsx("code",{children:"4A0100"})," lists one Type A passive target at 106 kbps."]}),d.jsx("p",{className:"text-[11px] leading-relaxed text-slate-500",children:ws}),d.jsx(fo,{mode:"raw",onApplyHex:c=>n(c)}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.jsx("input",{value:t,onChange:c=>n(c.target.value),className:"min-w-[16rem] flex-1 rounded-2xl border border-white/10 bg-black/25 px-4 py-2 font-mono text-sm"}),d.jsx("button",{type:"button",onClick:l,className:"rounded-2xl bg-bubble-accent px-4 py-2 font-semibold",children:"Send"}),d.jsx("button",{type:"button",onClick:u,className:"rounded-2xl border border-white/15 px-4 py-2",children:"General status"})]}),d.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-sm font-semibold text-slate-300",children:"Log"}),d.jsx("pre",{className:"mt-2 max-h-80 overflow-auto rounded-2xl border border-white/10 bg-black/30 p-3 text-xs",children:r.join(` +`)})]}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-sm font-semibold text-slate-300",children:"PN532 status snapshot"}),d.jsx("pre",{className:"mt-2 max-h-80 overflow-auto rounded-2xl border border-white/10 bg-black/30 p-3 text-xs",children:i||"—"})]})]})]})}function k2(){const e=Je(),[t,n]=x.useState(""),[r,s]=x.useState(!1);x.useEffect(()=>{n(localStorage.getItem("apiBase")||""),s(document.documentElement.classList.contains("light"))},[]);const i=()=>{localStorage.setItem("apiBase",t),e("Saved API base — reload for WS")},o=()=>{const a=!r;s(a),document.documentElement.classList.toggle("light",a),document.documentElement.classList.toggle("dark",!a),localStorage.setItem("theme",a?"light":"dark"),e(a?"Light":"Dark")};return d.jsxs("div",{className:"glass max-w-xl space-y-6 p-6",children:[d.jsx("h1",{className:"font-display text-2xl font-bold",children:"Settings"}),d.jsxs("label",{className:"block text-sm",children:["API base (empty = same host)",d.jsx("input",{value:t,onChange:a=>n(a.target.value),className:"mt-1 w-full rounded-2xl border border-white/10 bg-black/25 px-4 py-2",placeholder:"http://192.168.4.1"})]}),d.jsx("button",{type:"button",onClick:i,className:"rounded-2xl bg-bubble-accent px-4 py-2 font-semibold",children:"Save"}),d.jsxs("div",{className:"flex items-center justify-between rounded-2xl border border-white/10 bg-black/20 px-4 py-3",children:[d.jsx("span",{className:"text-sm",children:"Theme"}),d.jsx("button",{type:"button",onClick:o,className:"rounded-full border border-white/15 px-4 py-1 text-sm",children:r?"Switch to dark":"Switch to light"})]}),d.jsxs("p",{className:"text-xs text-slate-500",children:["Firmware opens a ",d.jsx("strong",{children:"password-free"})," SoftAP named ",d.jsx("strong",{children:"PN532-Toolkit"})," (lab default). mDNS: ",d.jsx("code",{children:"pn532tool.local"})]})]})}function C2(){const e=Je(),{log:t}=xs(),[n,r]=x.useState(null),s=x.useCallback(()=>{$u("/api/status").then(r).catch(()=>{})},[]);x.useEffect(()=>{s();const f=setInterval(s,2e3);return()=>clearInterval(f)},[s]),x.useEffect(()=>{s()},[t.length,s]);const i=(()=>{const f=[...t].reverse().find(h=>h.channel==="capture");return f?typeof f.payload=="object"?JSON.stringify(f.payload):String(f.payload):""})(),o=n==null?void 0:n.session,a=o?Math.min(100,o.usedBytes/Math.max(1,o.maxBytes)*100):0,l=async f=>{try{await vt("/api/session/deep",{enable:f}),e(f?"Passive read-all on (live scan on by default at boot)":"Passive read-all off"),s()}catch(h){e(String(h),"err")}},u=async()=>{try{await vt("/api/session/clear",{}),e("Buffer cleared — scanning can resume"),s()}catch(f){e(String(f),"err")}},c=async()=>{try{const f=await fetch(vs("/api/session/export"));if(!f.ok)throw new Error(await f.text());const h=await f.blob(),g=URL.createObjectURL(h),v=document.createElement("a");v.href=g,v.download=`pn532-deep-capture-${Date.now()}.ndjson`,v.click(),URL.revokeObjectURL(g),e("Download started — check your Downloads folder")}catch(f){e(String(f),"err")}};return d.jsxs("div",{className:"space-y-6",children:[d.jsxs(O.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"glass relative overflow-hidden p-8",children:[d.jsx("div",{className:"pointer-events-none absolute -left-20 top-0 h-48 w-48 rounded-full bg-bubble-mint/20 blur-3xl"}),d.jsx("h1",{className:"font-display text-3xl font-bold md:text-4xl",children:"Passive read-all mode"}),d.jsx("p",{className:"mt-1 text-sm font-medium text-bubble-mint/90",children:"Same feature as “deep capture” — fully controlled from this screen."}),d.jsxs("p",{className:"mt-3 max-w-2xl text-slate-300",children:["Turn it on below and keep ",d.jsx("strong",{children:"live scan"})," running (on by default at boot). Each"," ",d.jsx("strong",{children:"new tag"})," in the field is read ",d.jsx("strong",{children:"passively"}),": no per-block clicks — the firmware pulls ",d.jsx("strong",{children:"all data it can"})," (PN532 status + Classic sector/block dump with default keys, or Ultralight/NTAG page sweep). Results queue in ",d.jsx("strong",{children:"device RAM"}),"; when full, polling pauses until you ",d.jsx("strong",{children:"download"})," and ",d.jsx("strong",{children:"clear"}),"."]})]}),d.jsxs("div",{className:"glass p-6",children:[d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"font-display text-lg font-semibold",children:"Read-all session buffer"}),d.jsxs("p",{className:"text-sm text-slate-400",children:[(o==null?void 0:o.lines)??0," full dumps · ",(o==null?void 0:o.usedBytes)??0," / ",(o==null?void 0:o.maxBytes)??"—"," bytes RAM"]})]}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.jsx("button",{type:"button",onClick:()=>l(!((o==null?void 0:o.deepCapture)??!1)),className:`rounded-2xl px-4 py-2 font-semibold ${o!=null&&o.deepCapture?"bg-bubble-mint/20 text-bubble-mint ring-2 ring-bubble-mint/40":"border border-white/15 bg-white/5"}`,children:o!=null&&o.deepCapture?"Passive read-all ON":"Enable passive read-all"}),d.jsx("button",{type:"button",onClick:c,className:"rounded-2xl bg-gradient-to-r from-bubble-accent to-indigo-400 px-4 py-2 font-bold text-white shadow-glow",children:"Download NDJSON"}),d.jsx("button",{type:"button",onClick:u,className:"rounded-2xl border border-white/20 px-4 py-2",children:"Clear buffer"})]})]}),d.jsx("div",{className:"mt-6 h-4 overflow-hidden rounded-full bg-black/40",children:d.jsx(O.div,{className:"h-full rounded-full bg-gradient-to-r from-bubble-accent to-bubble-mint",initial:!1,animate:{width:`${a}%`},transition:{type:"spring",stiffness:120,damping:20}})}),(o==null?void 0:o.full)&&d.jsxs("div",{className:"mt-6 rounded-2xl border-2 border-bubble-rose/50 bg-bubble-rose/10 p-4 text-center",children:[d.jsx("p",{className:"font-display text-lg font-bold text-bubble-rose",children:"Buffer full — reader paused"}),d.jsxs("p",{className:"mt-1 text-sm text-slate-300",children:["Tap ",d.jsx("strong",{children:"Download NDJSON"})," to pull every card profile to your phone, then"," ",d.jsx("strong",{children:"Clear buffer"})," to resume field scans."]})]}),(o==null?void 0:o.deepCapture)&&n&&!n.scanning&&d.jsxs("p",{className:"mt-4 rounded-2xl border border-amber-500/30 bg-amber-500/10 p-3 text-sm text-amber-100",children:["Firmware normally has ",d.jsx("strong",{children:"Live scan"})," on at boot. If you turned it off, enable it on the Dashboard."]}),i&&d.jsxs("pre",{className:"mt-4 max-h-40 overflow-auto rounded-2xl border border-white/10 bg-black/30 p-3 text-xs text-slate-300",children:["Last capture event: ",i]})]})]})}function P2(){const e=Je(),[t,n]=x.useState("classic1k"),[r,s]=x.useState(!0),[i,o]=x.useState(`FFFFFFFFFFFF +A0A1A2A3A4A5 +D3F7D3F7D3F7`),[a,l]=x.useState(!1),[u,c]=x.useState(""),f=async()=>{l(!0),c("");try{const h=i.split(/\r?\n/).map(S=>S.replace(/\s/g,"").toUpperCase()).filter(S=>S.length===12),g={readerType:t,variations:r,keysHex:h},v=await fetch(vs("/api/mifare/dictionary-attack"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),w=await v.text();if(!v.ok)throw new Error(w);try{const S=JSON.parse(w);c(JSON.stringify(S,null,2))}catch{c(w)}e("Dictionary pass finished")}catch(h){e(String(h),"err")}finally{l(!1)}};return d.jsxs("div",{className:"glass space-y-6 p-6",children:[d.jsx("h1",{className:"font-display text-2xl font-bold",children:"Dictionary attack"}),d.jsxs("p",{className:"text-sm text-slate-400",children:["Select card family, optionally enable ",d.jsx("strong",{children:"bounded variations"})," (XOR / low-nibble tweaks per key). Firmware tries a ",d.jsx("strong",{children:"built-in community list"})," (Proxmark3 / MCT-style defaults) plus your lines below. This is ",d.jsx("strong",{children:"not"})," a full 2⁴⁸ exhaustive search — only keys you and the community already know. Hold a ",d.jsx("strong",{children:"MIFARE Classic"})," on the coil."," ",d.jsx("a",{className:"text-bubble-mint underline",href:"https://github.com/RfidResearchGroup/proxmark3/blob/master/client/dictionaries/mfc_default_keys.dic",target:"_blank",rel:"noreferrer",children:"More keys online"}),"."]}),d.jsxs("label",{className:"block text-sm",children:["Reader / map",d.jsxs("select",{value:t,onChange:h=>n(h.target.value),className:"mt-1 w-full rounded-2xl border border-white/10 bg-black/25 px-4 py-2",children:[d.jsx("option",{value:"classic1k",children:"MIFARE Classic 1K (sectors 0–15)"}),d.jsx("option",{value:"classic4k",children:"MIFARE Classic 4K (sectors 0–39, proper 4/16-block geometry)"})]})]}),d.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[d.jsx("input",{type:"checkbox",checked:r,onChange:h=>s(h.target.checked)}),"Variations (extra tries per key — slower, wider net)"]}),d.jsxs("label",{className:"block text-sm",children:["Extra keys (one 12-hex key per line, merged after built-in list)",d.jsx("textarea",{value:i,onChange:h=>o(h.target.value),rows:6,className:"mt-1 w-full rounded-2xl border border-white/10 bg-black/25 p-3 font-mono text-xs"})]}),d.jsx("button",{type:"button",disabled:a,onClick:f,className:"rounded-2xl bg-gradient-to-r from-bubble-rose to-orange-500 px-6 py-3 font-bold text-white disabled:opacity-50",children:a?"Running…":"Run dictionary attack"}),u&&d.jsx("pre",{className:"max-h-96 overflow-auto rounded-2xl border border-white/10 bg-black/40 p-4 text-xs text-bubble-mint",children:u})]})}function T2(){const e=Je(),[t,n]=x.useState("8C"),[r,s]=x.useState(""),[i,o]=x.useState(!1),a=async()=>{o(!0),s("");try{const l=await fetch(vs("/api/nfc/emulate-raw"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hex:t.replace(/\s/g,"")})}),u=await l.text();if(!l.ok)throw new Error(u);try{s(JSON.stringify(JSON.parse(u),null,2))}catch{s(u)}e("PN532 emulation command sent")}catch(l){e(String(l),"err")}finally{o(!1)}};return d.jsxs("div",{className:"glass space-y-6 p-6",children:[d.jsx("h1",{className:"font-display text-2xl font-bold",children:"Card emulation (PN532 target mode)"}),d.jsxs("p",{className:"text-sm text-slate-400",children:["Sends ",d.jsx("code",{className:"text-bubble-mint",children:"TgInitAsTarget"})," (0x8C) and following bytes as one PN532 payload. Real card emulation depends on UID length, timing, and reader behavior — this is an"," ",d.jsx("strong",{children:"expert / experimental"})," path. Build the byte sequence from NXP UM0701 or community examples. Wrong frames can leave the RF stack busy; power-cycle if the field acts stuck."]}),d.jsx("p",{className:"text-[11px] leading-relaxed text-slate-500",children:ws}),d.jsx(fo,{mode:"emulate",onApplyHex:l=>n(l)}),d.jsxs("label",{className:"block text-sm",children:["Command + parameters (hex, no spaces required)",d.jsx("textarea",{value:t,onChange:l=>n(l.target.value),rows:4,className:"mt-1 w-full rounded-2xl border border-white/10 bg-black/25 p-3 font-mono text-xs"})]}),d.jsx("button",{type:"button",disabled:i,onClick:a,className:"rounded-2xl bg-bubble-accent px-6 py-2 font-semibold text-white disabled:opacity-50",children:i?"Sending…":"Send emulate frame"}),r&&d.jsx("pre",{className:"max-h-80 overflow-auto rounded-2xl border border-white/10 bg-black/40 p-4 text-xs text-slate-200",children:r})]})}function Rf({title:e,badge:t,children:n,className:r=""}){return d.jsxs(O.div,{initial:{opacity:0,y:12},whileInView:{opacity:1,y:0},viewport:{once:!0,margin:"-40px"},transition:{duration:.4,ease:[.22,1,.36,1]},className:`glass panel-edge relative overflow-hidden p-6 ${r}`.trim(),children:[d.jsx("div",{className:"pointer-events-none absolute -right-20 -top-20 h-40 w-40 rounded-full bg-bubble-accent/10 blur-3xl"}),d.jsx("div",{className:"pointer-events-none absolute -bottom-16 -left-16 h-36 w-36 rounded-full bg-bubble-rose/10 blur-3xl"}),d.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-bubble-accent/[0.06] via-transparent to-bubble-mint/[0.07]"}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[d.jsx("h2",{className:"font-display text-lg font-normal tracking-wide text-bubble-mint text-glow-matrix",children:e}),t?d.jsx(O.span,{animate:{boxShadow:["0 0 12px rgba(0,229,255,0.3)","0 0 22px rgba(0,255,157,0.45)","0 0 12px rgba(0,229,255,0.3)"]},transition:{duration:2.2,repeat:1/0},className:"rounded-full border border-bubble-accent/50 bg-bubble-accent/15 px-2.5 py-0.5 font-mono text-[10px] uppercase tracking-widest text-bubble-accent",children:t}):null]}),n]})]})}function ea(e){const t=e.replace(/\s/g,"");if(t.length!==12)return null;const n=[];for(let r=0;r<12;r+=2){const s=parseInt(t.slice(r,r+2),16);if(Number.isNaN(s))return null;n.push(s)}return n}function kr(e){return e.map(t=>t.toString(16).toUpperCase().padStart(2,"0")).join("")}function E2(e){const t=e.length,n=new Set,r=[];for(let s=0;s<1<{const S=ea(t),m=ea(r),p=ea(i);return!S||!m?null:a&&p?[S,m,p]:[S,m]},[t,r,i,a]),h=x.useMemo(()=>f?E2(f):[],[f]),g=x.useMemo(()=>j2(u),[u]),v=()=>{const S=h.map(m=>kr(m)).join(` +`);navigator.clipboard.writeText(S),e("Copied XOR span keys")},w=()=>{const S=h.map(m=>kr(m)).join(` +`);sessionStorage.setItem("pn532_keylab_import",S),e("Stored for Keys page — open Keys and tap “Import Key Lab”")};return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"glass relative overflow-hidden p-8",children:[d.jsx("div",{className:"pointer-events-none absolute -right-24 top-0 h-72 w-72 rounded-full bg-bubble-accent/15 blur-3xl"}),d.jsx("h1",{className:"font-display text-3xl font-bold text-glow-matrix md:text-4xl",children:"Key Lab"}),d.jsxs("p",{className:"mt-3 max-w-3xl text-sm leading-relaxed text-slate-400",children:["XOR your base keys together in every combination → more candidates to paste into ",d.jsx("strong",{children:"Brute"})," or"," ",d.jsx("strong",{children:"Keys"}),". Entropy readout is just for fun on random hex blobs."]})]}),d.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[d.jsxs(Rf,{title:"XOR span generator",badge:"mix",children:[d.jsx("p",{className:"mb-4 text-xs leading-relaxed text-slate-500",children:"All XOR combinations of your base keys (2 bases → up to 4 keys; 3 bases → up to 8). Each result is a valid 6-byte Classic key candidate."}),d.jsxs("label",{className:"block text-xs text-slate-400",children:["Base A",d.jsx("input",{value:t,onChange:S=>n(S.target.value.toUpperCase()),className:"mt-1 w-full rounded-xl border border-white/10 bg-black/30 px-3 py-2 font-mono text-sm"})]}),d.jsxs("label",{className:"mt-3 block text-xs text-slate-400",children:["Base B",d.jsx("input",{value:r,onChange:S=>s(S.target.value.toUpperCase()),className:"mt-1 w-full rounded-xl border border-white/10 bg-black/30 px-3 py-2 font-mono text-sm"})]}),d.jsxs("label",{className:"mt-3 flex items-center gap-2 text-xs text-slate-400",children:[d.jsx("input",{type:"checkbox",checked:a,onChange:S=>l(S.target.checked)}),"Use third base"]}),a?d.jsxs("label",{className:"mt-2 block text-xs text-slate-400",children:["Base C",d.jsx("input",{value:i,onChange:S=>o(S.target.value.toUpperCase()),className:"mt-1 w-full rounded-xl border border-white/10 bg-black/30 px-3 py-2 font-mono text-sm"})]}):null,f?d.jsxs(d.Fragment,{children:[d.jsx("ul",{className:"mt-4 max-h-48 space-y-1 overflow-auto rounded-xl border border-bubble-mint/15 bg-black/35 p-3 font-mono text-xs text-bubble-mint",children:h.map(S=>d.jsx("li",{children:kr(S)},kr(S)))}),d.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[d.jsx("button",{type:"button",onClick:v,className:"rounded-xl bg-bubble-accent px-4 py-2 text-sm font-semibold text-bubble-950",children:"Copy all"}),d.jsx("button",{type:"button",onClick:w,className:"rounded-xl border border-bubble-mint/40 px-4 py-2 text-sm text-bubble-mint",children:"Stage for Keys"})]})]}):d.jsx("p",{className:"mt-4 text-sm text-bubble-rose",children:"Enter valid 12-hex keys."})]}),d.jsxs(Rf,{title:"Blob entropy",badge:"analysis",children:[d.jsx("p",{className:"mb-4 text-xs text-slate-500",children:"Shannon entropy per byte of your hex blob (0–8). Random uniform bytes → ~8; sparse UID-like → lower."}),d.jsx("textarea",{value:u,onChange:S=>c(S.target.value),rows:5,className:"w-full rounded-xl border border-white/10 bg-black/30 p-3 font-mono text-xs"}),d.jsx("div",{className:"mt-4 rounded-xl border border-bubble-accent/25 bg-bubble-accent/5 p-4 font-mono text-sm text-bubble-accent",children:g==null?"Invalid hex (even length, 0-9A-F)":`${g.toFixed(3)} bits / byte`})]})]})]})}const A2=[["/","Dash"],["/capture","Read-all"],["/read","Read"],["/write","Write"],["/brute","Brute"],["/emulate","Emu"],["/keylab","KeyLab"],["/library","Lib"],["/keys","Keys"],["/raw","Raw"],["/settings","Set"]];function R2(){return d.jsx(i2,{children:d.jsx(qb,{children:d.jsxs("div",{className:"hack-scanlines hack-grid relative min-h-screen pb-20",children:[d.jsx(t2,{}),d.jsx(s2,{}),d.jsx(e2,{}),d.jsxs("header",{className:"relative z-40 border-b border-bubble-accent/20 bg-bubble-950/80 backdrop-blur-xl",children:[d.jsx("div",{className:"absolute inset-x-0 bottom-0 h-px bg-gradient-to-r from-transparent via-bubble-mint/60 to-transparent"}),d.jsx("div",{className:"absolute inset-x-0 top-0 h-px bg-gradient-to-r from-bubble-rose/30 via-bubble-accent/40 to-bubble-mint/30 opacity-80"}),d.jsxs("div",{className:"relative mx-auto flex max-w-6xl flex-wrap items-center justify-between gap-3 px-4 py-4",children:[d.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-4",children:[d.jsxs(O.div,{className:"font-display text-lg font-normal tracking-[0.12em] sm:text-xl md:text-2xl",initial:{opacity:0,x:-12},animate:{opacity:1,x:0},transition:{type:"spring",stiffness:120,damping:18},children:[d.jsx(O.span,{className:"bg-gradient-to-r from-bubble-mint via-bubble-accent to-bubble-rose bg-clip-text text-transparent text-glow-matrix",animate:{backgroundPosition:["0% 50%","100% 50%","0% 50%"]},transition:{duration:8,repeat:1/0,ease:"linear"},style:{WebkitBackgroundClip:"text",backgroundClip:"text",backgroundImage:"linear-gradient(90deg, #00ff9d, #00e5ff, #ff2a6d, #d4ff00, #00ff9d, #00ff9d)",backgroundSize:"250% 100%"},children:"PN532"}),d.jsx("span",{className:"ml-2 text-[9px] font-mono font-normal tracking-[0.35em] text-bubble-accent/60 sm:text-[10px]",children:"MAXIMAL"})]}),d.jsxs("span",{className:"hidden font-mono text-[9px] text-bubble-mint/40 md:inline lg:text-[10px]",children:[d.jsx("span",{className:"text-bubble-accent/90",children:"●"})," RF_STACK"," ",d.jsx("span",{className:"text-bubble-rose/80",children:"LIVE"}),d.jsx("span",{className:"mx-1.5 text-bubble-mint/25",children:"│"}),d.jsx("span",{className:"text-bubble-mint/50",children:"ws://stream"})]})]}),d.jsx("nav",{className:"flex max-w-full flex-wrap justify-end gap-1 text-[10px] font-mono sm:gap-1.5 sm:text-[11px]",children:A2.map(([e,t])=>d.jsx(gx,{to:e,children:({isActive:n})=>d.jsxs(O.span,{className:`inline-block rounded-md border px-1.5 py-1 sm:px-2 sm:py-1.5 ${n?"nav-hack-active":"border-transparent text-slate-500 hover:border-bubble-accent/35 hover:text-bubble-accent hover:shadow-[0_0_18px_rgba(0,229,255,0.25)]"}`,whileHover:{scale:1.06,y:-1},whileTap:{scale:.97},transition:{type:"spring",stiffness:400,damping:22},children:[d.jsx("span",{className:"text-bubble-mint/35",children:"⟨"}),t,d.jsx("span",{className:"text-bubble-mint/35",children:"⟩"})]})},e))})]})]}),d.jsx("main",{className:"relative z-10 mx-auto max-w-6xl px-4 py-8",children:d.jsx(O.div,{initial:{opacity:0,y:14},animate:{opacity:1,y:0},transition:{duration:.45,ease:[.22,1,.36,1]},children:d.jsxs(ix,{children:[d.jsx(_e,{path:"/",element:d.jsx(d2,{})}),d.jsx(_e,{path:"/capture",element:d.jsx(C2,{})}),d.jsx(_e,{path:"/read",element:d.jsx(f2,{})}),d.jsx(_e,{path:"/write",element:d.jsx(v2,{})}),d.jsx(_e,{path:"/brute",element:d.jsx(P2,{})}),d.jsx(_e,{path:"/emulate",element:d.jsx(T2,{})}),d.jsx(_e,{path:"/keylab",element:d.jsx(N2,{})}),d.jsx(_e,{path:"/library",element:d.jsx(x2,{})}),d.jsx(_e,{path:"/keys",element:d.jsx(S2,{})}),d.jsx(_e,{path:"/raw",element:d.jsx(b2,{})}),d.jsx(_e,{path:"/settings",element:d.jsx(k2,{})})]})})})]})})})}const L2=localStorage.getItem("theme");L2==="light"&&(document.documentElement.classList.add("light"),document.documentElement.classList.remove("dark"));const Lf=document.getElementById("root");Lf&&ta.createRoot(Lf).render(d.jsx($f.StrictMode,{children:d.jsx(hx,{children:d.jsx(R2,{})})})); diff --git a/firmware/data/assets/index-hoMg1Qkq.css b/firmware/data/assets/index-hoMg1Qkq.css new file mode 100644 index 0000000..d38024a --- /dev/null +++ b/firmware/data/assets/index-hoMg1Qkq.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:JetBrains Mono,ui-monospace,monospace;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,ui-monospace,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.inset-y-2{top:.5rem;bottom:.5rem}.-bottom-16{bottom:-4rem}.-left-16{left:-4rem}.-left-20{left:-5rem}.-left-8{left:-2rem}.-left-\[20\%\]{left:-20%}.-right-20{right:-5rem}.-right-24{right:-6rem}.-right-\[15\%\]{right:-15%}.-top-20{top:-5rem}.-top-8{top:-2rem}.bottom-0{bottom:0}.bottom-5{bottom:1.25rem}.bottom-\[5\%\]{bottom:5%}.left-0{left:0}.left-2{left:.5rem}.left-8{left:2rem}.left-\[35\%\]{left:35%}.right-5{right:1.25rem}.top-0{top:0}.top-8{top:2rem}.top-9{top:2.25rem}.top-\[10\%\]{top:10%}.top-\[4\.25rem\]{top:4.25rem}.top-\[40\%\]{top:40%}.z-10{z-index:10}.z-40{z-index:40}.z-\[1\]{z-index:1}.z-\[2\]{z-index:2}.z-\[55\]{z-index:55}.z-\[60\]{z-index:60}.mx-1\.5{margin-left:.375rem;margin-right:.375rem}.mx-auto{margin-left:auto;margin-right:auto}.-mt-0\.5{margin-top:-.125rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-2{height:.5rem}.h-36{height:9rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-72{height:18rem}.h-\[4\.75rem\]{height:4.75rem}.h-\[72\%\]{height:72%}.h-\[min\(45vh\,360px\)\]{height:min(45vh,360px)}.h-\[min\(55vh\,440px\)\]{height:min(55vh,440px)}.h-\[min\(70vh\,520px\)\]{height:min(70vh,520px)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-32{max-height:8rem}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-80{max-height:20rem}.max-h-96{max-height:24rem}.min-h-screen{min-height:100vh}.w-1\/3{width:33.333333%}.w-2{width:.5rem}.w-2\/5{width:40%}.w-36{width:9rem}.w-40{width:10rem}.w-48{width:12rem}.w-72{width:18rem}.w-\[4\.75rem\]{width:4.75rem}.w-\[72\%\]{width:72%}.w-\[min\(45vh\,360px\)\]{width:min(45vh,360px)}.w-\[min\(55vh\,440px\)\]{width:min(55vh,440px)}.w-\[min\(70vh\,520px\)\]{width:min(70vh,520px)}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[16rem\]{min-width:16rem}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-6xl{max-width:72rem}.max-w-\[12rem\]{max-width:12rem}.max-w-\[280px\]{max-width:280px}.max-w-full{max-width:100%}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.origin-center{transform-origin:center}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.skew-x-\[-18deg\]{--tw-skew-x: -18deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[spin_32s_linear_infinite\]{animation:spin 32s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-\[spin_6s_linear_infinite\]{animation:spin 6s linear infinite}@keyframes floatSlow{0%,to{transform:translate(0) rotate(0)}33%{transform:translate(12px,-18px) rotate(2deg)}66%{transform:translate(-8px,10px) rotate(-1deg)}}.animate-floatSlow{animation:floatSlow 18s ease-in-out infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes pulseGlow{0%,to{opacity:.35;transform:scale(1)}50%{opacity:.65;transform:scale(1.08)}}.animate-pulseGlow{animation:pulseGlow 5s ease-in-out infinite}@keyframes shimmerLine{0%{transform:translate(-100%) skew(-12deg);opacity:0}20%{opacity:.9}to{transform:translate(200%) skew(-12deg);opacity:0}}.animate-shimmerLine{animation:shimmerLine 2.8s ease-in-out infinite}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-y-1{row-gap:.25rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-all{word-break:break-all}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-amber-500\/30{border-color:#f59e0b4d}.border-bubble-accent\/15{border-color:#00e5ff26}.border-bubble-accent\/20{border-color:#00e5ff33}.border-bubble-accent\/25{border-color:#00e5ff40}.border-bubble-accent\/40{border-color:#00e5ff66}.border-bubble-accent\/45{border-color:#00e5ff73}.border-bubble-accent\/50{border-color:#00e5ff80}.border-bubble-mint{--tw-border-opacity: 1;border-color:rgb(0 255 157 / var(--tw-border-opacity, 1))}.border-bubble-mint\/15{border-color:#00ff9d26}.border-bubble-mint\/20{border-color:#00ff9d33}.border-bubble-mint\/25{border-color:#00ff9d40}.border-bubble-mint\/30{border-color:#00ff9d4d}.border-bubble-mint\/40{border-color:#00ff9d66}.border-bubble-mint\/70{border-color:#00ff9db3}.border-bubble-rose{--tw-border-opacity: 1;border-color:rgb(255 42 109 / var(--tw-border-opacity, 1))}.border-bubble-rose\/40{border-color:#ff2a6d66}.border-bubble-rose\/50{border-color:#ff2a6d80}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-white\/15{border-color:#ffffff26}.border-white\/20{border-color:#fff3}.border-white\/5{border-color:#ffffff0d}.border-yellow-200\/90{border-color:#fef08ae6}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-black\/20{background-color:#0003}.bg-black\/25{background-color:#00000040}.bg-black\/30{background-color:#0000004d}.bg-black\/35{background-color:#00000059}.bg-black\/40{background-color:#0006}.bg-bubble-900\/95{background-color:#051210f2}.bg-bubble-950{--tw-bg-opacity: 1;background-color:rgb(2 4 8 / var(--tw-bg-opacity, 1))}.bg-bubble-950\/80{background-color:#020408cc}.bg-bubble-950\/95{background-color:#020408f2}.bg-bubble-accent{--tw-bg-opacity: 1;background-color:rgb(0 229 255 / var(--tw-bg-opacity, 1))}.bg-bubble-accent\/10{background-color:#00e5ff1a}.bg-bubble-accent\/15{background-color:#00e5ff26}.bg-bubble-accent\/20{background-color:#00e5ff33}.bg-bubble-accent\/5{background-color:#00e5ff0d}.bg-bubble-accent\/90{background-color:#00e5ffe6}.bg-bubble-mint\/10{background-color:#00ff9d1a}.bg-bubble-mint\/15{background-color:#00ff9d26}.bg-bubble-mint\/20{background-color:#00ff9d33}.bg-bubble-mint\/5{background-color:#00ff9d0d}.bg-bubble-rose\/10{background-color:#ff2a6d1a}.bg-cyan-400\/20{background-color:#22d3ee33}.bg-emerald-400\/15{background-color:#34d39926}.bg-fuchsia-600\/25{background-color:#c026d340}.bg-white\/5{background-color:#ffffff0d}.bg-\[conic-gradient\(from_180deg_at_50\%_120\%\,rgba\(0\,229\,255\,0\.08\)\,transparent_40\%\,rgba\(255\,42\,109\,0\.06\)\,transparent_70\%\)\]{background-image:conic-gradient(from 180deg at 50% 120%,rgba(0,229,255,.08),transparent 40%,rgba(255,42,109,.06),transparent 70%)}.bg-\[radial-gradient\(ellipse_at_center\,transparent_0\%\,rgba\(2\,4\,8\,0\.75\)_100\%\)\]{background-image:radial-gradient(ellipse at center,transparent 0%,rgba(2,4,8,.75) 100%)}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-400\/45{--tw-gradient-from: rgb(251 191 36 / .45) var(--tw-gradient-from-position);--tw-gradient-to: rgb(251 191 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-bubble-accent{--tw-gradient-from: #00e5ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 229 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-bubble-accent\/10{--tw-gradient-from: rgb(0 229 255 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 229 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-bubble-accent\/15{--tw-gradient-from: rgb(0 229 255 / .15) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 229 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-bubble-accent\/20{--tw-gradient-from: rgb(0 229 255 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 229 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-bubble-accent\/25{--tw-gradient-from: rgb(0 229 255 / .25) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 229 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-bubble-accent\/\[0\.06\]{--tw-gradient-from: rgb(0 229 255 / .06) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 229 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-bubble-mint{--tw-gradient-from: #00ff9d var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 255 157 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-bubble-rose{--tw-gradient-from: #ff2a6d var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 42 109 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-bubble-rose\/20{--tw-gradient-from: rgb(255 42 109 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 42 109 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-bubble-rose\/30{--tw-gradient-from: rgb(255 42 109 / .3) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 42 109 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-yellow-100{--tw-gradient-from: #fef9c3 var(--tw-gradient-from-position);--tw-gradient-to: rgb(254 249 195 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-bubble-accent{--tw-gradient-to: rgb(0 229 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #00e5ff var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-bubble-accent\/40{--tw-gradient-to: rgb(0 229 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(0 229 255 / .4) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-bubble-mint\/60{--tw-gradient-to: rgb(0 255 157 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(0 255 157 / .6) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-cyan-400{--tw-gradient-to: rgb(34 211 238 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #22d3ee var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-transparent{--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), transparent var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/60{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .6) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-yellow-200\/30{--tw-gradient-to: rgb(254 240 138 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(254 240 138 / .3) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-amber-500{--tw-gradient-to: #f59e0b var(--tw-gradient-to-position)}.to-bubble-mint{--tw-gradient-to: #00ff9d var(--tw-gradient-to-position)}.to-bubble-mint\/10{--tw-gradient-to: rgb(0 255 157 / .1) var(--tw-gradient-to-position)}.to-bubble-mint\/15{--tw-gradient-to: rgb(0 255 157 / .15) var(--tw-gradient-to-position)}.to-bubble-mint\/30{--tw-gradient-to: rgb(0 255 157 / .3) var(--tw-gradient-to-position)}.to-bubble-mint\/35{--tw-gradient-to: rgb(0 255 157 / .35) var(--tw-gradient-to-position)}.to-bubble-mint\/\[0\.07\]{--tw-gradient-to: rgb(0 255 157 / .07) var(--tw-gradient-to-position)}.to-bubble-rose{--tw-gradient-to: #ff2a6d var(--tw-gradient-to-position)}.to-indigo-400{--tw-gradient-to: #818cf8 var(--tw-gradient-to-position)}.to-orange-400{--tw-gradient-to: #fb923c var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-bubble-mint\/40{fill:#00ff9d66}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-20{padding-bottom:5rem}.pl-0\.5{padding-left:.125rem}.pt-3{padding-top:.75rem}.pt-8{padding-top:2rem}.text-center{text-align:center}.font-display{font-family:Audiowide,Orbitron,ui-sans-serif,system-ui,sans-serif}.font-mono{font-family:JetBrains Mono,ui-monospace,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-relaxed{line-height:1.625}.tracking-\[0\.12em\]{letter-spacing:.12em}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.35em\]{letter-spacing:.35em}.tracking-\[0\.42em\]{letter-spacing:.42em}.tracking-\[0\.4em\]{letter-spacing:.4em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-amber-100{--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.text-bubble-950{--tw-text-opacity: 1;color:rgb(2 4 8 / var(--tw-text-opacity, 1))}.text-bubble-accent{--tw-text-opacity: 1;color:rgb(0 229 255 / var(--tw-text-opacity, 1))}.text-bubble-accent\/60{color:#00e5ff99}.text-bubble-accent\/70{color:#00e5ffb3}.text-bubble-accent\/80{color:#00e5ffcc}.text-bubble-accent\/90{color:#00e5ffe6}.text-bubble-mint{--tw-text-opacity: 1;color:rgb(0 255 157 / var(--tw-text-opacity, 1))}.text-bubble-mint\/20{color:#00ff9d33}.text-bubble-mint\/25{color:#00ff9d40}.text-bubble-mint\/35{color:#00ff9d59}.text-bubble-mint\/40{color:#00ff9d66}.text-bubble-mint\/50{color:#00ff9d80}.text-bubble-mint\/70{color:#00ff9db3}.text-bubble-mint\/80{color:#00ff9dcc}.text-bubble-mint\/90{color:#00ff9de6}.text-bubble-rose{--tw-text-opacity: 1;color:rgb(255 42 109 / var(--tw-text-opacity, 1))}.text-bubble-rose\/80{color:#ff2a6dcc}.text-bubble-rose\/90{color:#ff2a6de6}.text-bubble-volt{--tw-text-opacity: 1;color:rgb(212 255 0 / var(--tw-text-opacity, 1))}.text-rose-300{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-100{--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-30{opacity:.3}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-\[0_0_12px_rgba\(250\,204\,21\,1\)\]{--tw-shadow: 0 0 12px rgba(250,204,21,1);--tw-shadow-colored: 0 0 12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-glow{--tw-shadow: 0 0 50px -10px rgba(0,255,157,.55), 0 0 100px -40px rgba(0,229,255,.35), 0 0 30px -5px rgba(255,42,109,.2);--tw-shadow-colored: 0 0 50px -10px var(--tw-shadow-color), 0 0 100px -40px var(--tw-shadow-color), 0 0 30px -5px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-glowCyan{--tw-shadow: 0 0 40px -5px rgba(0,229,255,.65);--tw-shadow-colored: 0 0 40px -5px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-glowRose{--tw-shadow: 0 0 35px -5px rgba(255,42,109,.5);--tw-shadow-colored: 0 0 35px -5px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-neonBtn{--tw-shadow: 0 0 25px rgba(0,229,255,.45), 0 0 50px rgba(0,255,157,.2), inset 0 0 20px rgba(0,229,255,.15);--tw-shadow-colored: 0 0 25px var(--tw-shadow-color), 0 0 50px var(--tw-shadow-color), inset 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-bubble-accent\/40{--tw-ring-color: rgb(0 229 255 / .4)}.ring-bubble-mint\/40{--tw-ring-color: rgb(0 255 157 / .4)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-2xl{--tw-blur: blur(40px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-\[100px\]{--tw-blur: blur(100px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-\[80px\]{--tw-blur: blur(80px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-\[90px\]{--tw-blur: blur(90px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_14px_rgba\(250\,204\,21\,0\.9\)\]{--tw-drop-shadow: drop-shadow(0 0 14px rgba(250,204,21,.9));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_40px_rgba\(0\,229\,255\,0\.35\)\]{--tw-drop-shadow: drop-shadow(0 0 40px rgba(0,229,255,.35));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{color-scheme:dark;--hack-matrix: #00ff9d;--hack-cyan: #00e5ff;--hack-void: #020408;--hack-rose: #ff2a6d}.light{color-scheme:light}.hack-grid{background-color:var(--hack-void);background-image:linear-gradient(rgba(0,255,157,.055) 1px,transparent 1px),linear-gradient(90deg,rgba(0,229,255,.05) 1px,transparent 1px),radial-gradient(ellipse 100% 60% at 50% -30%,rgba(0,229,255,.18),transparent 55%),radial-gradient(ellipse 70% 50% at 110% 80%,rgba(255,42,109,.12),transparent 50%),radial-gradient(ellipse 50% 40% at -10% 60%,rgba(0,255,157,.1),transparent 45%);background-size:20px 20px,20px 20px,100% 100%,100% 100%,100% 100%}.hack-scanlines:before{content:"";pointer-events:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:35;background:repeating-linear-gradient(0deg,transparent,transparent 2px,rgba(0,0,0,.18) 2px,rgba(0,0,0,.18) 4px);opacity:.45;box-shadow:inset 0 0 120px #00000080}.light.hack-root .hack-scanlines:before{opacity:.06}.glass{position:relative;border-radius:1rem;border-width:1px;border-color:#00ff9d40;background-color:#051210bf;--tw-shadow: inset 0 1px 0 0 rgba(0,255,157,.12);--tw-shadow-colored: inset 0 1px 0 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-backdrop-blur: blur(16px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);box-shadow:0 0 0 1px #00e5ff1f,0 0 40px -12px #00ff9d40,0 12px 40px -12px #000000bf,inset 0 1px #00ff9d1a;transition:box-shadow .35s ease,border-color .35s ease}.glass:hover{box-shadow:0 0 0 1px #00e5ff38,0 0 55px -10px #00ff9d66,0 16px 48px -12px #000c,inset 0 1px #00e5ff1f;border-color:#00e5ff59}.light .glass{border-color:#cbd5e1cc;background-color:#ffffffe6;--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);box-shadow:0 4px 24px -4px #0000001f}.light .glass:hover{box-shadow:0 8px 32px -4px #00000026}.text-glow-matrix{text-shadow:0 0 12px rgba(0,255,157,.8),0 0 28px rgba(0,255,157,.45),0 0 60px rgba(0,229,255,.25)}.text-glow-cyan{text-shadow:0 0 14px rgba(0,229,255,.75),0 0 36px rgba(0,229,255,.35)}.text-glow-rose{text-shadow:0 0 16px rgba(255,42,109,.65)}.nav-hack-active{border-width:1px;border-color:#00ff9db3;background-image:linear-gradient(to bottom right,var(--tw-gradient-stops));--tw-gradient-from: rgb(0 255 157 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 255 157 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);--tw-gradient-to: rgb(0 229 255 / .1) var(--tw-gradient-to-position);--tw-text-opacity: 1;color:rgb(0 255 157 / var(--tw-text-opacity, 1));box-shadow:0 0 28px -4px #00ff9d8c,0 0 40px -8px #00e5ff59,inset 0 0 20px -8px #00e5ff33;animation:borderPulse 2s ease-in-out infinite}.btn-neon{position:relative;overflow:hidden;font-weight:700;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s;box-shadow:0 0 20px #00e5ff59,inset 0 1px #ffffff26}.btn-neon:hover{transform:translateY(-1px) scale(1.02);box-shadow:0 0 35px #00ff9d73,0 0 50px #00e5ff40}.btn-neon:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(105deg,transparent 40%,rgba(255,255,255,.2) 50%,transparent 60%);transform:translate(-100%);animation:shimmerLine 3s ease-in-out infinite}.flash-log-bar{background:linear-gradient(90deg,#000000d9,#051210eb,#000000d9);box-shadow:0 4px 24px #00ff9d14,inset 0 1px #00e5ff26}.flash-log-bar:after{content:"";position:absolute;bottom:0;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent,rgba(0,255,157,.5),rgba(0,229,255,.6),transparent)}.selection\:bg-bubble-accent\/40 *::-moz-selection{background-color:#00e5ff66}.selection\:bg-bubble-accent\/40 *::selection{background-color:#00e5ff66}.selection\:text-bubble-950 *::-moz-selection{--tw-text-opacity: 1;color:rgb(2 4 8 / var(--tw-text-opacity, 1))}.selection\:text-bubble-950 *::selection{--tw-text-opacity: 1;color:rgb(2 4 8 / var(--tw-text-opacity, 1))}.selection\:bg-bubble-accent\/40::-moz-selection{background-color:#00e5ff66}.selection\:bg-bubble-accent\/40::selection{background-color:#00e5ff66}.selection\:text-bubble-950::-moz-selection{--tw-text-opacity: 1;color:rgb(2 4 8 / var(--tw-text-opacity, 1))}.selection\:text-bubble-950::selection{--tw-text-opacity: 1;color:rgb(2 4 8 / var(--tw-text-opacity, 1))}.hover\:border-bubble-accent\/35:hover{border-color:#00e5ff59}.hover\:border-bubble-accent\/50:hover{border-color:#00e5ff80}.hover\:border-bubble-rose:hover{--tw-border-opacity: 1;border-color:rgb(255 42 109 / var(--tw-border-opacity, 1))}.hover\:bg-bubble-rose\/20:hover{background-color:#ff2a6d33}.hover\:text-bubble-accent:hover{--tw-text-opacity: 1;color:rgb(0 229 255 / var(--tw-text-opacity, 1))}.hover\:shadow-\[0_0_18px_rgba\(0\,229\,255\,0\.25\)\]:hover{--tw-shadow: 0 0 18px rgba(0,229,255,.25);--tw-shadow-colored: 0 0 18px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-bubble-accent\/40:focus{--tw-ring-color: rgb(0 229 255 / .4)}.disabled\:opacity-50:disabled{opacity:.5}@media (min-width: 640px){.sm\:left-4{left:1rem}.sm\:top-\[4\.5rem\]{top:4.5rem}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:inline{display:inline}.sm\:h-\[5\.5rem\]{height:5.5rem}.sm\:w-\[5\.5rem\]{width:5.5rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:gap-1\.5{gap:.375rem}.sm\:gap-4{gap:1rem}.sm\:px-2{padding-left:.5rem;padding-right:.5rem}.sm\:py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-\[10px\]{font-size:10px}.sm\:text-\[11px\]{font-size:11px}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media (min-width: 768px){.md\:top-\[5\.25rem\]{top:5.25rem}.md\:inline{display:inline}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:p-10{padding:2.5rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-5xl{font-size:3rem;line-height:1}}@media (min-width: 1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-\[1fr_min\(320px\,40\%\)\]{grid-template-columns:1fr min(320px,40%)}.lg\:items-center{align-items:center}.lg\:justify-end{justify-content:flex-end}.lg\:text-\[10px\]{font-size:10px}} diff --git a/firmware/data/index.html b/firmware/data/index.html new file mode 100644 index 0000000..187f12f --- /dev/null +++ b/firmware/data/index.html @@ -0,0 +1,20 @@ + + + + + + + PN532 // MAXIMAL_FIELD + + + + + + + +
+ + diff --git a/firmware/flash.sh b/firmware/flash.sh new file mode 100755 index 0000000..c3ffc71 --- /dev/null +++ b/firmware/flash.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Flash PN532 toolkit. Requires ESP-IDF 5.x in PATH (run export.sh first). +set -euo pipefail +ROOT="$(cd "$(dirname "$0")" && pwd)" +PORT="${ESPPORT:-${1:-/dev/cu.usbserial-A5069RR4}}" +cd "$ROOT" +if ! command -v idf.py >/dev/null 2>&1; then + echo "idf.py not found. Source your ESP-IDF export.sh, then re-run:" >&2 + echo " ESPPORT=$PORT $0" >&2 + exit 1 +fi +idf.py -p "$PORT" flash diff --git a/firmware/main/CMakeLists.txt b/firmware/main/CMakeLists.txt new file mode 100644 index 0000000..bafea94 --- /dev/null +++ b/firmware/main/CMakeLists.txt @@ -0,0 +1,3 @@ +idf_component_register(SRCS "main.c" "board_rgb_off.c" INCLUDE_DIRS "." REQUIRES net_service nfc_engine led_strip) + +spiffs_create_partition_image(storage ../data FLASH_IN_PROJECT) diff --git a/firmware/main/Kconfig.projbuild b/firmware/main/Kconfig.projbuild new file mode 100644 index 0000000..aa8e511 --- /dev/null +++ b/firmware/main/Kconfig.projbuild @@ -0,0 +1,18 @@ +menu "Board indicators" + +config BOARD_RGB_LED_ENABLE + bool "Turn off onboard addressable RGB at boot (WS2812/SK6812)" + default y + help + ESP32-S3-DevKitC-1 v1.x typically uses one SK6812/WS2812 on GPIO 48. + Disable if your board has no addressable LED or uses a different data pin. + +config BOARD_RGB_LED_GPIO + int "Addressable LED data GPIO" + default 48 + range 0 48 + depends on BOARD_RGB_LED_ENABLE + help + Official DevKitC-1 v1.1: GPIO 48. Older notes sometimes cite GPIO 38 — set in menuconfig if needed. + +endmenu diff --git a/firmware/main/board_rgb_off.c b/firmware/main/board_rgb_off.c new file mode 100644 index 0000000..8d90c7a --- /dev/null +++ b/firmware/main/board_rgb_off.c @@ -0,0 +1,37 @@ +#include "sdkconfig.h" +#include "board_rgb_off.h" +#include "esp_log.h" + +#if CONFIG_BOARD_RGB_LED_ENABLE +#include "esp_err.h" +#include "led_strip.h" +#endif + +void board_rgb_led_quiet(void) +{ +#if CONFIG_BOARD_RGB_LED_ENABLE + led_strip_handle_t strip = NULL; + const led_strip_config_t strip_config = { + .strip_gpio_num = CONFIG_BOARD_RGB_LED_GPIO, + .max_leds = 1, + .led_pixel_format = LED_PIXEL_FORMAT_GRB, + .led_model = LED_MODEL_WS2812, + .flags = {.invert_out = false}, + }; + const led_strip_rmt_config_t rmt_config = { + .clk_src = RMT_CLK_SRC_DEFAULT, + .resolution_hz = 10 * 1000 * 1000, + .flags = {.with_dma = false}, + }; + esp_err_t err = led_strip_new_rmt_device(&strip_config, &rmt_config, &strip); + if (err != ESP_OK) { + ESP_LOGW("board_rgb", "RGB init failed (%s), leaving LED as-is", esp_err_to_name(err)); + return; + } + err = led_strip_clear(strip); + if (err != ESP_OK) { + ESP_LOGW("board_rgb", "RGB clear failed (%s)", esp_err_to_name(err)); + } + led_strip_del(strip); +#endif +} diff --git a/firmware/main/board_rgb_off.h b/firmware/main/board_rgb_off.h new file mode 100644 index 0000000..6f2fdf1 --- /dev/null +++ b/firmware/main/board_rgb_off.h @@ -0,0 +1,4 @@ +#pragma once + +/** One-shot: drive onboard WS2812/SK6812 to black, then release RMT. */ +void board_rgb_led_quiet(void); diff --git a/firmware/main/idf_component.yml b/firmware/main/idf_component.yml new file mode 100644 index 0000000..4917680 --- /dev/null +++ b/firmware/main/idf_component.yml @@ -0,0 +1,3 @@ +## IDF Component Manager — addressable RGB (DevKitC-1) +dependencies: + espressif/led_strip: "^2.5.5" diff --git a/firmware/main/main.c b/firmware/main/main.c new file mode 100644 index 0000000..5361c31 --- /dev/null +++ b/firmware/main/main.c @@ -0,0 +1,17 @@ +#include "esp_log.h" +#include "board_rgb_off.h" +#include "nfc_engine/nfc_engine.h" +#include "nfc_engine/session_capture.h" +#include "net_service/app_net.h" + +static const char *TAG = "main"; + +void app_main(void) +{ + board_rgb_led_quiet(); + ESP_LOGI(TAG, "PN532 NFC Toolkit starting"); + ESP_ERROR_CHECK(nfc_engine_init()); + session_capture_init(); + ESP_ERROR_CHECK(app_net_init()); + ESP_LOGI(TAG, "Open AP SSID PN532-Toolkit — http://192.168.4.1"); +} diff --git a/firmware/partitions.csv b/firmware/partitions.csv new file mode 100644 index 0000000..63a7bf2 --- /dev/null +++ b/firmware/partitions.csv @@ -0,0 +1,9 @@ +# 8MB flash layout (ESP32-S3-DevKitC-1 N8). For 16MB, increase storage size. +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x6000, +otadata, data, ota, 0xf000, 0x2000, +phy_init, data, phy, 0x11000, 0x1000, +factory, app, factory, 0x20000, 0x180000, +ota_0, app, ota_0, 0x1A0000,0x180000, +ota_1, app, ota_1, 0x320000,0x180000, +storage, data, spiffs, 0x4A0000,0x350000, diff --git a/firmware/sdkconfig.defaults b/firmware/sdkconfig.defaults new file mode 100644 index 0000000..237ab76 --- /dev/null +++ b/firmware/sdkconfig.defaults @@ -0,0 +1,34 @@ +CONFIG_IDF_TARGET_ESP32S3=y +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y +CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y + +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +# Enable if module has PSRAM (e.g. N8R8) +# CONFIG_SPIRAM=y +# CONFIG_SPIRAM_MODE_OCT=y +# CONFIG_SPIRAM_SPEED_80M=y + +CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y +CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 +CONFIG_FREERTOS_HZ=1000 + +CONFIG_HTTPD_WS_SUPPORT=y +CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 +CONFIG_HTTPD_MAX_URI_LEN=512 +CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y + +CONFIG_LWIP_LOCAL_IP4_TTL=64 +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=10 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 + +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_OFFSET=0x8000 + +CONFIG_LOG_DEFAULT_LEVEL_INFO=y +CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE=y + +# mDNS +CONFIG_MDNS_MAX_SERVICES=10 diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..a062b85 --- /dev/null +++ b/web/index.html @@ -0,0 +1,19 @@ + + + + + + + PN532 // MAXIMAL_FIELD + + + + + +
+ + + diff --git a/web/package-lock.json b/web/package-lock.json new file mode 100644 index 0000000..1be2ae1 --- /dev/null +++ b/web/package-lock.json @@ -0,0 +1,2757 @@ +{ + "name": "pn532-toolkit-web", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "pn532-toolkit-web", + "version": "1.0.0", + "dependencies": { + "framer-motion": "^11.11.17", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-router-dom": "^6.28.0" + }, + "devDependencies": { + "@types/react": "^18.3.12", + "@types/react-dom": "^18.3.1", + "@vitejs/plugin-react": "^4.3.3", + "autoprefixer": "^10.4.20", + "postcss": "^8.4.49", + "tailwindcss": "^3.4.15", + "typescript": "^5.6.3", + "vite": "^5.4.10" + } + }, + "node_modules/@alloc/quick-lru": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", + "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", + "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.28.5", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz", + "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", + "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.0", + "@babel/generator": "^7.29.0", + "@babel/helper-compilation-targets": "^7.28.6", + "@babel/helper-module-transforms": "^7.28.6", + "@babel/helpers": "^7.28.6", + "@babel/parser": "^7.29.0", + "@babel/template": "^7.28.6", + "@babel/traverse": "^7.29.0", + "@babel/types": "^7.29.0", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.1", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", + "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.0", + "@babel/types": "^7.29.0", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", + "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.28.6", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", + "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", + "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.28.6", + "@babel/helper-validator-identifier": "^7.28.5", + "@babel/traverse": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", + "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz", + "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.28.6", + "@babel/types": "^7.29.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.2.tgz", + "integrity": "sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.0" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", + "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", + "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", + "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.28.6", + "@babel/parser": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", + "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.0", + "@babel/generator": "^7.29.0", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.29.0", + "@babel/template": "^7.28.6", + "@babel/types": "^7.29.0", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", + "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "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.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "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/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@remix-run/router": { + "version": "1.23.2", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.2.tgz", + "integrity": "sha512-Ic6m2U/rMjTkhERIa/0ZtXJP17QUi2CbWE7cqx4J58M8aA3QTfW+2UlQ4psvTX9IO1RfNVhK3pcpdjej7L+t2w==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.27", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", + "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.0.tgz", + "integrity": "sha512-WOhNW9K8bR3kf4zLxbfg6Pxu2ybOUbB2AjMDHSQx86LIF4rH4Ft7vmMwNt0loO0eonglSNy4cpD3MKXXKQu0/A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.0.tgz", + "integrity": "sha512-u6JHLll5QKRvjciE78bQXDmqRqNs5M/3GVqZeMwvmjaNODJih/WIrJlFVEihvV0MiYFmd+ZyPr9wxOVbPAG2Iw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.0.tgz", + "integrity": "sha512-qEF7CsKKzSRc20Ciu2Zw1wRrBz4g56F7r/vRwY430UPp/nt1x21Q/fpJ9N5l47WWvJlkNCPJz3QRVw008fi7yA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.0.tgz", + "integrity": "sha512-WADYozJ4QCnXCH4wPB+3FuGmDPoFseVCUrANmA5LWwGmC6FL14BWC7pcq+FstOZv3baGX65tZ378uT6WG8ynTw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.0.tgz", + "integrity": "sha512-6b8wGHJlDrGeSE3aH5mGNHBjA0TTkxdoNHik5EkvPHCt351XnigA4pS7Wsj/Eo9Y8RBU6f35cjN9SYmCFBtzxw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.0.tgz", + "integrity": "sha512-h25Ga0t4jaylMB8M/JKAyrvvfxGRjnPQIR8lnCayyzEjEOx2EJIlIiMbhpWxDRKGKF8jbNH01NnN663dH638mA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.0.tgz", + "integrity": "sha512-RzeBwv0B3qtVBWtcuABtSuCzToo2IEAIQrcyB/b2zMvBWVbjo8bZDjACUpnaafaxhTw2W+imQbP2BD1usasK4g==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.0.tgz", + "integrity": "sha512-Sf7zusNI2CIU1HLzuu9Tc5YGAHEZs5Lu7N1ssJG4Tkw6e0MEsN7NdjUDDfGNHy2IU+ENyWT+L2obgWiguWibWQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.0.tgz", + "integrity": "sha512-DX2x7CMcrJzsE91q7/O02IJQ5/aLkVtYFryqCjduJhUfGKG6yJV8hxaw8pZa93lLEpPTP/ohdN4wFz7yp/ry9A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.0.tgz", + "integrity": "sha512-09EL+yFVbJZlhcQfShpswwRZ0Rg+z/CsSELFCnPt3iK+iqwGsI4zht3secj5vLEs957QvFFXnzAT0FFPIxSrkQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.0.tgz", + "integrity": "sha512-i9IcCMPr3EXm8EQg5jnja0Zyc1iFxJjZWlb4wr7U2Wx/GrddOuEafxRdMPRYVaXjgbhvqalp6np07hN1w9kAKw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.0.tgz", + "integrity": "sha512-DGzdJK9kyJ+B78MCkWeGnpXJ91tK/iKA6HwHxF4TAlPIY7GXEvMe8hBFRgdrR9Ly4qebR/7gfUs9y2IoaVEyog==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.0.tgz", + "integrity": "sha512-RwpnLsqC8qbS8z1H1AxBA1H6qknR4YpPR9w2XX0vo2Sz10miu57PkNcnHVaZkbqyw/kUWfKMI73jhmfi9BRMUQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.0.tgz", + "integrity": "sha512-Z8pPf54Ly3aqtdWC3G4rFigZgNvd+qJlOE52fmko3KST9SoGfAdSRCwyoyG05q1HrrAblLbk1/PSIV+80/pxLg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.0.tgz", + "integrity": "sha512-3a3qQustp3COCGvnP4SvrMHnPQ9d1vzCakQVRTliaz8cIp/wULGjiGpbcqrkv0WrHTEp8bQD/B3HBjzujVWLOA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.0.tgz", + "integrity": "sha512-pjZDsVH/1VsghMJ2/kAaxt6dL0psT6ZexQVrijczOf+PeP2BUqTHYejk3l6TlPRydggINOeNRhvpLa0AYpCWSQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.0.tgz", + "integrity": "sha512-3ObQs0BhvPgiUVZrN7gqCSvmFuMWvWvsjG5ayJ3Lraqv+2KhOsp+pUbigqbeWqueGIsnn+09HBw27rJ+gYK4VQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.0.tgz", + "integrity": "sha512-EtylprDtQPdS5rXvAayrNDYoJhIz1/vzN2fEubo3yLE7tfAw+948dO0g4M0vkTVFhKojnF+n6C8bDNe+gDRdTg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.0.tgz", + "integrity": "sha512-k09oiRCi/bHU9UVFqD17r3eJR9bn03TyKraCrlz5ULFJGdJGi7VOmm9jl44vOJvRJ6P7WuBi/s2A97LxxHGIdw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.0.tgz", + "integrity": "sha512-1o/0/pIhozoSaDJoDcec+IVLbnRtQmHwPV730+AOD29lHEEo4F5BEUB24H0OBdhbBBDwIOSuf7vgg0Ywxdfiiw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.0.tgz", + "integrity": "sha512-pESDkos/PDzYwtyzB5p/UoNU/8fJo68vcXM9ZW2V0kjYayj1KaaUfi1NmTUTUpMn4UhU4gTuK8gIaFO4UGuMbA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.0.tgz", + "integrity": "sha512-hj1wFStD7B1YBeYmvY+lWXZ7ey73YGPcViMShYikqKT1GtstIKQAtfUI6yrzPjAy/O7pO0VLXGmUVWXQMaYgTQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.0.tgz", + "integrity": "sha512-SyaIPFoxmUPlNDq5EHkTbiKzmSEmq/gOYFI/3HHJ8iS/v1mbugVa7dXUzcJGQfoytp9DJFLhHH4U3/eTy2Bq4w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.0.tgz", + "integrity": "sha512-RdcryEfzZr+lAr5kRm2ucN9aVlCCa2QNq4hXelZxb8GG0NJSazq44Z3PCCc8wISRuCVnGs0lQJVX5Vp6fKA+IA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.0.tgz", + "integrity": "sha512-PrsWNQ8BuE00O3Xsx3ALh2Df8fAj9+cvvX9AIA6o4KpATR98c9mud4XtDWVvsEuyia5U4tVSTKygawyJkjm60w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/prop-types": { + "version": "15.7.15", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", + "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "18.3.28", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.28.tgz", + "integrity": "sha512-z9VXpC7MWrhfWipitjNdgCauoMLRdIILQsAEV+ZesIzBq/oUlxk0m3ApZuMFCXdnS4U7KrI+l3WRUEGQ8K1QKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "18.3.7", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", + "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^18.0.0" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", + "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.0", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.27", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.17.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "dev": true, + "license": "MIT" + }, + "node_modules/autoprefixer": { + "version": "10.4.27", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.27.tgz", + "integrity": "sha512-NP9APE+tO+LuJGn7/9+cohklunJsXWiaWEfV3si4Gi/XHDwVNgkwr1J3RQYFIvPy76GmJ9/bW8vyoU1LcxwKHA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "browserslist": "^4.28.1", + "caniuse-lite": "^1.0.30001774", + "fraction.js": "^5.3.4", + "picocolors": "^1.1.1", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.10.10", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.10.tgz", + "integrity": "sha512-sUoJ3IMxx4AyRqO4MLeHlnGDkyXRoUG0/AI9fjK+vS72ekpV0yWVY7O0BVjmBcRtkNcsAO2QDZ4tdKKGoI6YaQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", + "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.9.0", + "caniuse-lite": "^1.0.30001759", + "electron-to-chromium": "^1.5.263", + "node-releases": "^2.0.27", + "update-browserslist-db": "^1.2.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001781", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001781.tgz", + "integrity": "sha512-RdwNCyMsNBftLjW6w01z8bKEvT6e/5tpPVEgtn22TiLGlstHOVecsX2KHFkD5e/vRnIE4EGzpuIODb3mtswtkw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "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==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true, + "license": "MIT" + }, + "node_modules/electron-to-chromium": { + "version": "1.5.325", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.325.tgz", + "integrity": "sha512-PwfIw7WQSt3xX7yOf5OE/unLzsK9CaN2f/FvV3WjPR1Knoc1T9vePRVV4W1EM301JzzysK51K7FNKcusCr0zYA==", + "dev": true, + "license": "ISC" + }, + "node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fastq": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fraction.js": { + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", + "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/framer-motion": { + "version": "11.18.2", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.18.2.tgz", + "integrity": "sha512-5F5Och7wrvtLVElIpclDT0CBzMVg3dL22B64aZwHtsIY8RB4mXICLrkajK4G9R+ieSAGcgrLeae2SeUTg2pr6w==", + "license": "MIT", + "dependencies": { + "motion-dom": "^11.18.1", + "motion-utils": "^11.18.1", + "tslib": "^2.4.0" + }, + "peerDependencies": { + "@emotion/is-prop-valid": "*", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@emotion/is-prop-valid": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "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/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/jiti": { + "version": "1.21.7", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", + "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", + "dev": true, + "license": "MIT", + "bin": { + "jiti": "bin/jiti.js" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/motion-dom": { + "version": "11.18.1", + "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-11.18.1.tgz", + "integrity": "sha512-g76KvA001z+atjfxczdRtw/RXOM3OMSdd1f4DL77qCTF/+avrRJiawSG4yDibEQ215sr9kpinSlX2pCTJ9zbhw==", + "license": "MIT", + "dependencies": { + "motion-utils": "^11.18.1" + } + }, + "node_modules/motion-utils": { + "version": "11.18.1", + "resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-11.18.1.tgz", + "integrity": "sha512-49Kt+HKjtbJKLtgO/LKj9Ld+6vw9BjH5d9sc40R/kVyH8GLAXgT42M2NnuPcJNuA3s9ZfZBUcwIgpmZWGEE+hA==", + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "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/node-releases": { + "version": "2.0.36", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.36.tgz", + "integrity": "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "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": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/postcss": { + "version": "8.5.8", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", + "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "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.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-import": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", + "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.0.0", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-js": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz", + "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "peerDependencies": { + "postcss": "^8.4.21" + } + }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/postcss-nested": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz", + "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "postcss-selector-parser": "^6.1.1" + }, + "engines": { + "node": ">=12.0" + }, + "peerDependencies": { + "postcss": "^8.2.14" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", + "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-router": { + "version": "6.30.3", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.3.tgz", + "integrity": "sha512-XRnlbKMTmktBkjCLE8/XcZFlnHvr2Ltdr1eJX4idL55/9BbORzyZEaIkBFDhFGCEWBBItsVrDxwx3gnisMitdw==", + "license": "MIT", + "dependencies": { + "@remix-run/router": "1.23.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.30.3", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.3.tgz", + "integrity": "sha512-pxPcv1AczD4vso7G4Z3TKcvlxK7g7TNt3/FNGMhfqyntocvYKj+GCatfigGDjbLozC4baguJ0ReCigoDJXb0ag==", + "license": "MIT", + "dependencies": { + "@remix-run/router": "1.23.2", + "react-router": "6.30.3" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, + "node_modules/read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pify": "^2.3.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.60.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.0.tgz", + "integrity": "sha512-yqjxruMGBQJ2gG4HtjZtAfXArHomazDHoFwFFmZZl0r7Pdo7qCIXKqKHZc8yeoMgzJJ+pO6pEEHa+V7uzWlrAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.60.0", + "@rollup/rollup-android-arm64": "4.60.0", + "@rollup/rollup-darwin-arm64": "4.60.0", + "@rollup/rollup-darwin-x64": "4.60.0", + "@rollup/rollup-freebsd-arm64": "4.60.0", + "@rollup/rollup-freebsd-x64": "4.60.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.60.0", + "@rollup/rollup-linux-arm-musleabihf": "4.60.0", + "@rollup/rollup-linux-arm64-gnu": "4.60.0", + "@rollup/rollup-linux-arm64-musl": "4.60.0", + "@rollup/rollup-linux-loong64-gnu": "4.60.0", + "@rollup/rollup-linux-loong64-musl": "4.60.0", + "@rollup/rollup-linux-ppc64-gnu": "4.60.0", + "@rollup/rollup-linux-ppc64-musl": "4.60.0", + "@rollup/rollup-linux-riscv64-gnu": "4.60.0", + "@rollup/rollup-linux-riscv64-musl": "4.60.0", + "@rollup/rollup-linux-s390x-gnu": "4.60.0", + "@rollup/rollup-linux-x64-gnu": "4.60.0", + "@rollup/rollup-linux-x64-musl": "4.60.0", + "@rollup/rollup-openbsd-x64": "4.60.0", + "@rollup/rollup-openharmony-arm64": "4.60.0", + "@rollup/rollup-win32-arm64-msvc": "4.60.0", + "@rollup/rollup-win32-ia32-msvc": "4.60.0", + "@rollup/rollup-win32-x64-gnu": "4.60.0", + "@rollup/rollup-win32-x64-msvc": "4.60.0", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sucrase": { + "version": "3.35.1", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", + "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "tinyglobby": "^0.2.11", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tailwindcss": { + "version": "3.4.19", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz", + "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@alloc/quick-lru": "^5.2.0", + "arg": "^5.0.2", + "chokidar": "^3.6.0", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.3.2", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "jiti": "^1.21.7", + "lilconfig": "^3.1.3", + "micromatch": "^4.0.8", + "normalize-path": "^3.0.0", + "object-hash": "^3.0.0", + "picocolors": "^1.1.1", + "postcss": "^8.4.47", + "postcss-import": "^15.1.0", + "postcss-js": "^4.0.1", + "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0", + "postcss-nested": "^6.2.0", + "postcss-selector-parser": "^6.1.2", + "resolve": "^1.22.8", + "sucrase": "^3.35.0" + }, + "bin": { + "tailwind": "lib/cli.js", + "tailwindcss": "lib/cli.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/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/tinyglobby/node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "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/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/vite": { + "version": "5.4.21", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz", + "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + } + } +} diff --git a/web/package.json b/web/package.json new file mode 100644 index 0000000..2fbf9a9 --- /dev/null +++ b/web/package.json @@ -0,0 +1,28 @@ +{ + "name": "pn532-toolkit-web", + "private": true, + "version": "1.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "build:fw": "vite build && node scripts/sync-fw-data.mjs", + "preview": "vite preview" + }, + "dependencies": { + "framer-motion": "^11.11.17", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-router-dom": "^6.28.0" + }, + "devDependencies": { + "@types/react": "^18.3.12", + "@types/react-dom": "^18.3.1", + "@vitejs/plugin-react": "^4.3.3", + "autoprefixer": "^10.4.20", + "postcss": "^8.4.49", + "tailwindcss": "^3.4.15", + "typescript": "^5.6.3", + "vite": "^5.4.10" + } +} diff --git a/web/postcss.config.js b/web/postcss.config.js new file mode 100644 index 0000000..2aa7205 --- /dev/null +++ b/web/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/web/scripts/sync-fw-data.mjs b/web/scripts/sync-fw-data.mjs new file mode 100644 index 0000000..a33dc31 --- /dev/null +++ b/web/scripts/sync-fw-data.mjs @@ -0,0 +1,15 @@ +import { cp, readdir, rm, mkdir } from "node:fs/promises"; +import { join, dirname } from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const root = join(__dirname, ".."); +const dist = join(root, "dist"); +const target = join(root, "../firmware/data"); + +await rm(target, { recursive: true, force: true }); +await mkdir(target, { recursive: true }); +for (const name of await readdir(dist)) { + await cp(join(dist, name), join(target, name), { recursive: true }); +} +console.log("Synced web build → firmware/data"); diff --git a/web/src/App.tsx b/web/src/App.tsx new file mode 100644 index 0000000..d53ab98 --- /dev/null +++ b/web/src/App.tsx @@ -0,0 +1,129 @@ +import { motion } from "framer-motion"; +import { NavLink, Route, Routes } from "react-router-dom"; +import BrowserLogBar from "./BrowserLogBar"; +import FlashBackdrop from "./FlashBackdrop"; +import ScanCashFlourish from "./ScanCashFlourish"; +import { NfcWsProvider } from "./NfcWsContext"; +import { ToastHost } from "./toast"; +import Dashboard from "./pages/Dashboard"; +import ReadAnalyze from "./pages/ReadAnalyze"; +import WriteClone from "./pages/WriteClone"; +import Library from "./pages/Library"; +import Keys from "./pages/Keys"; +import RawConsole from "./pages/RawConsole"; +import Settings from "./pages/Settings"; +import Capture from "./pages/Capture"; +import Brute from "./pages/Brute"; +import Emulate from "./pages/Emulate"; +import KeyLab from "./pages/KeyLab"; + +const nav = [ + ["/", "Dash"], + ["/capture", "Read-all"], + ["/read", "Read"], + ["/write", "Write"], + ["/brute", "Brute"], + ["/emulate", "Emu"], + ["/keylab", "KeyLab"], + ["/library", "Lib"], + ["/keys", "Keys"], + ["/raw", "Raw"], + ["/settings", "Set"], +] as const; + +export default function App() { + return ( + + +
+ + + +
+
+
+
+
+ + + PN532 + + + MAXIMAL + + + + RF_STACK{" "} + LIVE + + ws://stream + +
+ +
+
+
+ + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + +
+
+
+
+ ); +} diff --git a/web/src/BrowserLogBar.tsx b/web/src/BrowserLogBar.tsx new file mode 100644 index 0000000..bb1f61b --- /dev/null +++ b/web/src/BrowserLogBar.tsx @@ -0,0 +1,49 @@ +import { useNfcWs } from "./NfcWsContext"; + +export default function BrowserLogBar() { + const { log, exportBrowserLog, clearBrowserLog, wsOk } = useNfcWs(); + return ( +
+
+
+
+
+ + + BUF{" "} + {log.length} + _evt + + + + WS{" "} + + {wsOk ? "SYNC" : "WAIT"} + + +
+
+ + +
+
+ ); +} diff --git a/web/src/FlashBackdrop.tsx b/web/src/FlashBackdrop.tsx new file mode 100644 index 0000000..8922f02 --- /dev/null +++ b/web/src/FlashBackdrop.tsx @@ -0,0 +1,19 @@ +/** Ambient neon soup — pointer-events none, stays under UI */ +export default function FlashBackdrop() { + return ( +
+
+
+
+
+
+ ); +} diff --git a/web/src/LabFixtureLoad.tsx b/web/src/LabFixtureLoad.tsx new file mode 100644 index 0000000..c7ade59 --- /dev/null +++ b/web/src/LabFixtureLoad.tsx @@ -0,0 +1,99 @@ +import { useState } from "react"; +import { BINARY_CARD_FIXTURES, EMULATE_LAB, RAW_PN532_LAB, type BinaryCardFixture } from "./validationFixtures"; + +type Mode = "raw" | "emulate" | "binary"; + +type Props = { + mode: Mode; + onApplyHex: (hex: string) => void; + onPickBinary?: (f: BinaryCardFixture) => void; + className?: string; +}; + +export default function LabFixtureLoad({ mode, onApplyHex, onPickBinary, className = "" }: Props) { + const [resetKey, setResetKey] = useState(0); + + const bump = () => setResetKey((k) => k + 1); + + if (mode === "raw") { + return ( +
+ +
+ ); + } + + if (mode === "emulate") { + return ( +
+ +
+ ); + } + + return ( +
+ +
+ ); +} diff --git a/web/src/NfcWsContext.tsx b/web/src/NfcWsContext.tsx new file mode 100644 index 0000000..7b60841 --- /dev/null +++ b/web/src/NfcWsContext.tsx @@ -0,0 +1,189 @@ +import React, { createContext, useCallback, useContext, useMemo, useRef, useState } from "react"; +import type { Tag } from "./api"; +import { useToolkitWs } from "./useWebSocket"; + +export type BrowserLogEntry = { + t: number; + channel: string; + payload: unknown; +}; + +export type CashVariant = "tag" | "vault"; + +type NfcCtx = { + wsOk: boolean; + lastTag: Tag | null; + tagPresent: boolean; + log: BrowserLogEntry[]; + /** Increments on each “cha-ching” moment (new tag scan or capture line). */ + cashWave: number; + cashVariant: CashVariant; + clearBrowserLog: () => void; + exportBrowserLog: () => void; + applyScanPoll: (present: boolean, tag?: Tag) => void; +}; + +const Ctx = createContext(null); + +const MAX_LOG = 5000; +const LS_KEY = "pn532_browser_log_v1"; + +function loadPersisted(): BrowserLogEntry[] { + try { + const s = sessionStorage.getItem(LS_KEY); + if (!s) { + return []; + } + const j = JSON.parse(s) as BrowserLogEntry[]; + return Array.isArray(j) ? j.slice(-MAX_LOG) : []; + } catch { + return []; + } +} + +function persistLog(entries: BrowserLogEntry[]) { + try { + sessionStorage.setItem(LS_KEY, JSON.stringify(entries.slice(-MAX_LOG))); + } catch { + /* quota */ + } +} + +function handleScanPayload( + payload: unknown, + setLastTag: (t: Tag | null) => void, + setTagPresent: (v: boolean) => void, +) { + if (typeof payload === "object" && payload && "present" in (payload as object)) { + const p = payload as { present?: boolean }; + if (p.present === false) { + setLastTag(null); + setTagPresent(false); + return; + } + } + setTagPresent(true); + if (typeof payload === "object" && payload && "uid" in (payload as object)) { + setLastTag(payload as Tag); + } +} + +function isTagPayload(payload: unknown): payload is Record & { uid: string } { + if (!payload || typeof payload !== "object") { + return false; + } + const p = payload as Record; + if (p.present === false) { + return false; + } + return typeof p.uid === "string" && p.uid.length > 0; +} + +function isCaptureRecorded(payload: unknown): boolean { + if (!payload || typeof payload !== "object") { + return false; + } + return (payload as { event?: string }).event === "recorded"; +} + +export function NfcWsProvider({ children }: { children: React.ReactNode }) { + const [lastTag, setLastTag] = useState(null); + const [tagPresent, setTagPresent] = useState(false); + const [log, setLog] = useState(() => loadPersisted()); + const [cashWave, setCashWave] = useState(0); + const [cashVariant, setCashVariant] = useState("tag"); + const bumpLock = useRef(0); + + const bump = useCallback((variant: CashVariant) => { + const now = Date.now(); + if (variant === "tag" && now - bumpLock.current < 280) { + return; + } + bumpLock.current = now; + setCashVariant(variant); + setCashWave((w) => w + 1); + }, []); + + const onMsg = useCallback( + (msg: string) => { + try { + const o = JSON.parse(msg) as { channel?: string; payload?: unknown }; + const ch = o.channel || "unknown"; + setLog((prev) => { + const next = [...prev, { t: Date.now(), channel: ch, payload: o.payload }].slice(-MAX_LOG); + persistLog(next); + return next; + }); + if (ch === "scan") { + handleScanPayload(o.payload, setLastTag, setTagPresent); + if (isTagPayload(o.payload)) { + bump("tag"); + } + } else if (ch === "capture" && isCaptureRecorded(o.payload)) { + bump("vault"); + } + } catch { + /* ignore */ + } + }, + [bump], + ); + + const wsOk = useToolkitWs(onMsg); + + const applyScanPoll = useCallback( + (present: boolean, tag?: Tag) => { + if (!present) { + setLastTag(null); + setTagPresent(false); + return; + } + if (tag) { + setLastTag(tag); + setTagPresent(true); + bump("tag"); + } + }, + [bump], + ); + + const clearBrowserLog = useCallback(() => { + setLog([]); + sessionStorage.removeItem(LS_KEY); + }, []); + + const exportBrowserLog = useCallback(() => { + const blob = new Blob([JSON.stringify(log, null, 2)], { type: "application/json" }); + const url = URL.createObjectURL(blob); + const a = document.createElement("a"); + a.href = url; + a.download = `pn532-browser-log-${Date.now()}.json`; + a.click(); + URL.revokeObjectURL(url); + }, [log]); + + const v = useMemo( + () => ({ + wsOk, + lastTag, + tagPresent, + log, + cashWave, + cashVariant, + clearBrowserLog, + exportBrowserLog, + applyScanPoll, + }), + [wsOk, lastTag, tagPresent, log, cashWave, cashVariant, clearBrowserLog, exportBrowserLog, applyScanPoll], + ); + + return {children}; +} + +export function useNfcWs() { + const x = useContext(Ctx); + if (!x) { + throw new Error("useNfcWs outside NfcWsProvider"); + } + return x; +} diff --git a/web/src/ScanCashFlourish.tsx b/web/src/ScanCashFlourish.tsx new file mode 100644 index 0000000..8bc7851 --- /dev/null +++ b/web/src/ScanCashFlourish.tsx @@ -0,0 +1,234 @@ +import { AnimatePresence, motion } from "framer-motion"; +import { useEffect, useState } from "react"; +import { useNfcWs } from "./NfcWsContext"; + +const SPARKS = 16; +const COINS = 7; + +function playChaChing() { + try { + const Ctx = window.AudioContext || (window as unknown as { webkitAudioContext: typeof AudioContext }).webkitAudioContext; + if (!Ctx) { + return; + } + const ctx = new Ctx(); + const master = ctx.createGain(); + master.gain.value = 0.11; + master.connect(ctx.destination); + + const ding = (freq: number, t0: number, dur: number) => { + const o = ctx.createOscillator(); + const g = ctx.createGain(); + o.type = "sine"; + o.frequency.setValueAtTime(freq, t0); + g.gain.setValueAtTime(0, t0); + g.gain.linearRampToValueAtTime(1, t0 + 0.02); + g.gain.exponentialRampToValueAtTime(0.01, t0 + dur); + o.connect(g); + g.connect(master); + o.start(t0); + o.stop(t0 + dur + 0.05); + }; + + const now = ctx.currentTime; + ding(523.25, now, 0.11); + ding(659.25, now + 0.055, 0.13); + ding(783.99, now + 0.1, 0.16); + ding(1046.5, now + 0.14, 0.2); + + const noise = ctx.createBufferSource(); + const buf = ctx.createBuffer(1, ctx.sampleRate * 0.07, ctx.sampleRate); + const data = buf.getChannelData(0); + for (let i = 0; i < data.length; i++) { + data[i] = (Math.random() * 2 - 1) * Math.exp(-i / (data.length * 0.32)); + } + noise.buffer = buf; + const ng = ctx.createGain(); + ng.gain.setValueAtTime(0.055, now + 0.04); + ng.gain.exponentialRampToValueAtTime(0.001, now + 0.12); + noise.connect(ng); + ng.connect(master); + noise.start(now + 0.04); + noise.stop(now + 0.18); + + void ctx.resume?.(); + setTimeout(() => void ctx.close(), 700); + } catch { + /* autoplay / policy */ + } +} + +export default function ScanCashFlourish() { + const { cashWave, cashVariant, lastTag } = useNfcWs(); + const [visible, setVisible] = useState(false); + const [burstKey, setBurstKey] = useState(0); + + useEffect(() => { + if (cashWave === 0) { + return; + } + setBurstKey(cashWave); + setVisible(true); + playChaChing(); + const t = window.setTimeout(() => setVisible(false), 1650); + return () => window.clearTimeout(t); + }, [cashWave]); + + return ( +
+ + {visible ? ( + + + + {Array.from({ length: SPARKS }).map((_, i) => { + const a = (i / SPARKS) * Math.PI * 2; + const dist = 56 + (i % 4) * 10; + return ( + + ); + })} + + {Array.from({ length: COINS }).map((_, i) => ( + + 🪙 + + ))} + + + + + + + + + + + + + + + + + + + + + + $ + + + + + + + + + + {cashVariant === "vault" ? "VAULT · LOCKED" : "CHA-CHING · HIT"} + + {lastTag?.uid ? ( + + {lastTag.uid} + + ) : null} + + + ) : null} + +
+ ); +} diff --git a/web/src/api.ts b/web/src/api.ts new file mode 100644 index 0000000..0b6dd20 --- /dev/null +++ b/web/src/api.ts @@ -0,0 +1,62 @@ +/** Stored API origin; trailing slashes stripped so paths join cleanly. */ +export function apiBaseUrl(): string { + return (localStorage.getItem("apiBase") || "").replace(/\/+$/, ""); +} + +export function apiUrl(path: string): string { + const b = apiBaseUrl(); + const p = path.startsWith("/") ? path : `/${path}`; + return b ? `${b}${p}` : p; +} + +export async function apiGet(path: string): Promise { + const r = await fetch(apiUrl(path)); + if (!r.ok) { + throw new Error(await r.text()); + } + return r.json() as Promise; +} + +export async function apiPost(path: string, body: unknown): Promise { + const r = await fetch(apiUrl(path), { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(body), + }); + if (!r.ok) { + throw new Error(await r.text()); + } + return r.json() as Promise; +} + +export type SessionInfo = { + usedBytes: number; + maxBytes: number; + lines: number; + full: boolean; + deepCapture: boolean; +}; + +export type Status = { + app: string; + uptimeMs: number; + freeHeap: number; + wifiMode: number; + pn532?: { ic: number; fwHi: number; fwLo: number }; + scanning: boolean; + session?: SessionInfo; +}; + +export type Tag = { + uid: string; + uidLen: number; + atqa: number; + sak: number; + typeHint: number; + /** ATQA as 4 hex digits (MSB first, same as firmware). */ + atqaHex?: string; + sakHex?: string; + typeGuess?: string; + /** PN532 `GetGeneralStatus` payload bytes (chip-dependent length). */ + pn532GeneralStatus?: number[]; +}; diff --git a/web/src/index.css b/web/src/index.css new file mode 100644 index 0000000..70af655 --- /dev/null +++ b/web/src/index.css @@ -0,0 +1,127 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +:root { + color-scheme: dark; + --hack-matrix: #00ff9d; + --hack-cyan: #00e5ff; + --hack-void: #020408; + --hack-rose: #ff2a6d; +} + +.light { + color-scheme: light; +} + +/* Deep void + animated grid + aurora blobs */ +.hack-grid { + background-color: var(--hack-void); + background-image: linear-gradient(rgba(0, 255, 157, 0.055) 1px, transparent 1px), + linear-gradient(90deg, rgba(0, 229, 255, 0.05) 1px, transparent 1px), + radial-gradient(ellipse 100% 60% at 50% -30%, rgba(0, 229, 255, 0.18), transparent 55%), + radial-gradient(ellipse 70% 50% at 110% 80%, rgba(255, 42, 109, 0.12), transparent 50%), + radial-gradient(ellipse 50% 40% at -10% 60%, rgba(0, 255, 157, 0.1), transparent 45%); + background-size: 20px 20px, 20px 20px, 100% 100%, 100% 100%, 100% 100%; +} + +/* CRT + vignette */ +.hack-scanlines::before { + content: ""; + pointer-events: none; + position: fixed; + inset: 0; + z-index: 35; + background: repeating-linear-gradient( + 0deg, + transparent, + transparent 2px, + rgba(0, 0, 0, 0.18) 2px, + rgba(0, 0, 0, 0.18) 4px + ); + opacity: 0.45; + box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.5); +} + +.light.hack-root .hack-scanlines::before { + opacity: 0.06; +} + +/* Neon chassis panels */ +.glass { + @apply relative rounded-2xl border border-bubble-mint/25 bg-bubble-900/75 shadow-insetTerminal backdrop-blur-lg; + box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.12), 0 0 40px -12px rgba(0, 255, 157, 0.25), + 0 12px 40px -12px rgba(0, 0, 0, 0.75), inset 0 1px 0 0 rgba(0, 255, 157, 0.1); + transition: box-shadow 0.35s ease, border-color 0.35s ease; +} + +.glass:hover { + box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.22), 0 0 55px -10px rgba(0, 255, 157, 0.4), + 0 16px 48px -12px rgba(0, 0, 0, 0.8), inset 0 1px 0 0 rgba(0, 229, 255, 0.12); + border-color: rgba(0, 229, 255, 0.35); +} + +.light .glass { + @apply border-slate-300/80 bg-white/90 shadow-xl; + box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.12); +} + +.light .glass:hover { + box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.15); +} + +.text-glow-matrix { + text-shadow: 0 0 12px rgba(0, 255, 157, 0.8), 0 0 28px rgba(0, 255, 157, 0.45), 0 0 60px rgba(0, 229, 255, 0.25); +} + +.text-glow-cyan { + text-shadow: 0 0 14px rgba(0, 229, 255, 0.75), 0 0 36px rgba(0, 229, 255, 0.35); +} + +.text-glow-rose { + text-shadow: 0 0 16px rgba(255, 42, 109, 0.65); +} + +/* Nav active — laser bracket */ +.nav-hack-active { + @apply border border-bubble-mint/70 bg-gradient-to-br from-bubble-mint/20 to-bubble-accent/10 text-bubble-mint; + box-shadow: 0 0 28px -4px rgba(0, 255, 157, 0.55), 0 0 40px -8px rgba(0, 229, 255, 0.35), + inset 0 0 20px -8px rgba(0, 229, 255, 0.2); + animation: borderPulse 2s ease-in-out infinite; +} + +/* Primary flashy buttons (use alongside existing classes) */ +.btn-neon { + @apply relative overflow-hidden font-bold transition-all duration-300; + box-shadow: 0 0 20px rgba(0, 229, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15); +} + +.btn-neon:hover { + transform: translateY(-1px) scale(1.02); + box-shadow: 0 0 35px rgba(0, 255, 157, 0.45), 0 0 50px rgba(0, 229, 255, 0.25); +} + +.btn-neon::after { + content: ""; + position: absolute; + inset: 0; + background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.2) 50%, transparent 60%); + transform: translateX(-100%); + animation: shimmerLine 3s ease-in-out infinite; +} + +/* Top status bar chrome */ +.flash-log-bar { + background: linear-gradient(90deg, rgba(0, 0, 0, 0.85), rgba(5, 18, 16, 0.92), rgba(0, 0, 0, 0.85)); + box-shadow: 0 4px 24px rgba(0, 255, 157, 0.08), inset 0 1px 0 rgba(0, 229, 255, 0.15); +} + +.flash-log-bar::after { + content: ""; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 1px; + background: linear-gradient(90deg, transparent, rgba(0, 255, 157, 0.5), rgba(0, 229, 255, 0.6), transparent); +} diff --git a/web/src/main.tsx b/web/src/main.tsx new file mode 100644 index 0000000..5490ea9 --- /dev/null +++ b/web/src/main.tsx @@ -0,0 +1,22 @@ +import React from "react"; +import ReactDOM from "react-dom/client"; +import { HashRouter } from "react-router-dom"; +import App from "./App"; +import "./index.css"; + +const th = localStorage.getItem("theme"); +if (th === "light") { + document.documentElement.classList.add("light"); + document.documentElement.classList.remove("dark"); +} + +const root = document.getElementById("root"); +if (root) { + ReactDOM.createRoot(root).render( + + + + + , + ); +} diff --git a/web/src/nfcUtils.ts b/web/src/nfcUtils.ts new file mode 100644 index 0000000..d7c8993 --- /dev/null +++ b/web/src/nfcUtils.ts @@ -0,0 +1,85 @@ +/** MIFARE Classic sector trailer access bits (C1 C2 C3) decode — informational only */ + +export type AccessBits = { + c1: number; + c2: number; + c3: number; +}; + +export function parseTrailerAccess(hex16: string): AccessBits | null { + const h = hex16.replace(/\s/g, ""); + if (h.length !== 32) { + return null; + } + const b = new Uint8Array(16); + for (let i = 0; i < 16; i++) { + b[i] = parseInt(h.slice(i * 2, i * 2 + 2), 16); + } + const ab0 = b[6]; + const ab1 = b[7]; + const ab2 = b[8]; + const c1 = ((ab0 >> 4) & 1) | ((ab1 >> 0) & 2) | ((ab2 >> 0) & 4); + const c2 = ((ab0 >> 5) & 1) | ((ab1 >> 1) & 2) | ((ab2 >> 1) & 4); + const c3 = ((ab0 >> 6) & 1) | ((ab1 >> 2) & 2) | ((ab2 >> 2) & 4); + return { c1, c2, c3 }; +} + +export function sakLabel(sak: number): string { + switch (sak) { + case 0x08: + return "Ultralight family"; + case 0x09: + return "Mini / Classic"; + case 0x18: + return "Classic 1K"; + case 0x19: + return "Classic 4K"; + default: + return `SAK 0x${sak.toString(16).toUpperCase()}`; + } +} + +export function uidWithSeparators(uid: string): string { + const clean = uid.replace(/\s/g, ""); + if (clean.length % 2 !== 0) { + return uid; + } + return clean.match(/.{2}/g)?.join(":") ?? clean; +} + +export function typeHintLabel(hint: number): string { + switch (hint) { + case 1: + return "Classic-style (MIFARE)"; + case 2: + return "Type 2 / Ultralight-style"; + default: + return "Unknown (check SAK/ATQA)"; + } +} + +/** Short cheat-sheet lines for the live scan panel (not a full ISO parser). */ +export function scanCheatLines(tag: { uidLen: number; atqa: number; sak: number }): string[] { + const lines: string[] = []; + if (tag.uidLen === 4) { + lines.push("4-byte UID — single cascade level (CL1)."); + } else if (tag.uidLen === 7) { + lines.push("7-byte UID — double cascade (CL1 + CL2) typical for 7B tags."); + } else if (tag.uidLen === 10) { + lines.push("10-byte UID — triple cascade path."); + } + if (tag.sak === 0x08) { + lines.push("SAK 0x08 — often Ultralight / Type 2; use page read/write for user memory."); + } + if (tag.sak === 0x18 || tag.sak === 0x19) { + lines.push("MIFARE Classic — authenticate per sector trailer, then block read/write."); + } + if (tag.atqa === 0x0044 || tag.atqa === 0x4400) { + lines.push("ATQA 0x4400 pattern — very common Type A inventory response."); + } + return lines; +} + +export function generalStatusHexLine(bytes: number[]): string { + return bytes.map((b) => (Number(b) & 0xff).toString(16).toUpperCase().padStart(2, "0")).join(" "); +} diff --git a/web/src/pages/Brute.tsx b/web/src/pages/Brute.tsx new file mode 100644 index 0000000..e6711ea --- /dev/null +++ b/web/src/pages/Brute.tsx @@ -0,0 +1,113 @@ +import { useState } from "react"; +import { apiUrl } from "../api"; +import { useToast } from "../toast"; + +export default function Brute() { + const toast = useToast(); + const [reader, setReader] = useState<"classic1k" | "classic4k">("classic1k"); + const [variations, setVariations] = useState(true); + const [extraKeys, setExtraKeys] = useState( + "FFFFFFFFFFFF\nA0A1A2A3A4A5\nD3F7D3F7D3F7", + ); + const [busy, setBusy] = useState(false); + const [result, setResult] = useState(""); + + const run = async () => { + setBusy(true); + setResult(""); + try { + const keysHex = extraKeys + .split(/\r?\n/) + .map((l) => l.replace(/\s/g, "").toUpperCase()) + .filter((l) => l.length === 12); + const body = { + readerType: reader, + variations, + keysHex, + }; + const r = await fetch(apiUrl("/api/mifare/dictionary-attack"), { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(body), + }); + const text = await r.text(); + if (!r.ok) { + throw new Error(text); + } + try { + const j = JSON.parse(text) as object; + setResult(JSON.stringify(j, null, 2)); + } catch { + setResult(text); + } + toast("Dictionary pass finished"); + } catch (e) { + toast(String(e), "err"); + } finally { + setBusy(false); + } + }; + + return ( +
+

Dictionary attack

+

+ Select card family, optionally enable bounded variations (XOR / low-nibble tweaks per + key). Firmware tries a built-in community list (Proxmark3 / MCT-style defaults) plus + your lines below. This is not a full 2⁴⁸ exhaustive search — only keys you and the + community already know. Hold a MIFARE Classic on the coil.{" "} + + More keys online + + . +

+ + + + + +