mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-10-23 01:41:15 +00:00
Move to server side preference and read indicator management
This commit is contained in:
1 parent
43b7e94b0a
commit
9c071dbc53
24 files changed
+1339
-703
No files matched your search
+24
-3
@@ -47,12 +47,18 @@ app/
|
||||
All database operations go through repository classes in `repository.py`:
|
||||
|
||||
```python
|
||||
from app.repository import ContactRepository, ChannelRepository, MessageRepository, RawPacketRepository
|
||||
from app.repository import ContactRepository, ChannelRepository, MessageRepository, RawPacketRepository, AppSettingsRepository
|
||||
|
||||
# Examples
|
||||
contact = await ContactRepository.get_by_key_prefix("abc123")
|
||||
await MessageRepository.create(msg_type="PRIV", text="Hello", received_at=timestamp)
|
||||
await RawPacketRepository.mark_decrypted(packet_id, message_id)
|
||||
|
||||
# App settings (single-row pattern)
|
||||
settings = await AppSettingsRepository.get()
|
||||
await AppSettingsRepository.update(auto_decrypt_dm_on_advert=True)
|
||||
await AppSettingsRepository.add_favorite("contact", public_key)
|
||||
await AppSettingsRepository.update_last_message_time("channel-KEY", timestamp)
|
||||
```
|
||||
|
||||
### Radio Connection
|
||||
@@ -206,6 +212,16 @@ raw_packets (
|
||||
last_attempt INTEGER,
|
||||
FOREIGN KEY (message_id) REFERENCES messages(id)
|
||||
)
|
||||
|
||||
app_settings (
|
||||
id INTEGER PRIMARY KEY CHECK (id = 1), -- Single-row pattern
|
||||
max_radio_contacts INTEGER DEFAULT 200,
|
||||
favorites TEXT DEFAULT '[]', -- JSON array of {type, id}
|
||||
auto_decrypt_dm_on_advert INTEGER DEFAULT 0,
|
||||
sidebar_sort_order TEXT DEFAULT 'recent', -- 'recent' or 'alpha'
|
||||
last_message_times TEXT DEFAULT '{}', -- JSON object of state_key -> timestamp
|
||||
preferences_migrated INTEGER DEFAULT 0 -- One-time migration flag
|
||||
)
|
||||
```
|
||||
|
||||
## Database Migrations (`migrations.py`)
|
||||
@@ -453,8 +469,13 @@ All endpoints are prefixed with `/api`.
|
||||
- `POST /api/packets/decrypt/historical` - Try decrypting old packets with new key
|
||||
|
||||
### Settings
|
||||
- `GET /api/settings` - Get app settings (max_radio_contacts)
|
||||
- `PATCH /api/settings` - Update app settings
|
||||
- `GET /api/settings` - Get all app settings
|
||||
- `PATCH /api/settings` - Update settings (max_radio_contacts, auto_decrypt_dm_on_advert, sidebar_sort_order)
|
||||
- `POST /api/settings/favorites` - Add a favorite
|
||||
- `DELETE /api/settings/favorites` - Remove a favorite
|
||||
- `POST /api/settings/favorites/toggle` - Toggle favorite status
|
||||
- `POST /api/settings/last-message-time` - Update last message time for a conversation
|
||||
- `POST /api/settings/migrate` - One-time migration from frontend localStorage
|
||||
|
||||
### WebSocket
|
||||
- `WS /api/ws` - Real-time updates (health, contacts, channels, messages, raw packets)
|
||||
|
||||
@@ -93,6 +93,13 @@ async def run_migrations(conn: aiosqlite.Connection) -> int:
|
||||
await set_version(conn, 8)
|
||||
applied += 1
|
||||
|
||||
# Migration 9: Create app_settings table for persistent preferences
|
||||
if version < 9:
|
||||
logger.info("Applying migration 9: create app_settings table")
|
||||
await _migrate_009_create_app_settings_table(conn)
|
||||
await set_version(conn, 9)
|
||||
applied += 1
|
||||
|
||||
if applied > 0:
|
||||
logger.info(
|
||||
"Applied %d migration(s), schema now at version %d", applied, await get_version(conn)
|
||||
@@ -582,3 +589,43 @@ async def _migrate_008_convert_path_to_paths_array(conn: aiosqlite.Connection) -
|
||||
raise
|
||||
|
||||
await conn.commit()
|
||||
|
||||
|
||||
async def _migrate_009_create_app_settings_table(conn: aiosqlite.Connection) -> None:
|
||||
"""
|
||||
Create app_settings table for persistent application preferences.
|
||||
|
||||
This table stores:
|
||||
- max_radio_contacts: Max non-repeater contacts to keep on radio for DM ACKs
|
||||
- favorites: JSON array of favorite conversations [{type, id}, ...]
|
||||
- auto_decrypt_dm_on_advert: Whether to attempt historical DM decryption on new contact
|
||||
- sidebar_sort_order: 'recent' or 'alpha' for sidebar sorting
|
||||
- last_message_times: JSON object mapping conversation keys to timestamps
|
||||
- preferences_migrated: Flag to track if localStorage has been migrated
|
||||
|
||||
The table uses a single-row pattern (id=1) for simplicity.
|
||||
"""
|
||||
await conn.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS app_settings (
|
||||
id INTEGER PRIMARY KEY CHECK (id = 1),
|
||||
max_radio_contacts INTEGER DEFAULT 200,
|
||||
favorites TEXT DEFAULT '[]',
|
||||
auto_decrypt_dm_on_advert INTEGER DEFAULT 0,
|
||||
sidebar_sort_order TEXT DEFAULT 'recent',
|
||||
last_message_times TEXT DEFAULT '{}',
|
||||
preferences_migrated INTEGER DEFAULT 0
|
||||
)
|
||||
"""
|
||||
)
|
||||
|
||||
# Initialize with default row
|
||||
await conn.execute(
|
||||
"""
|
||||
INSERT OR IGNORE INTO app_settings (id, max_radio_contacts, favorites, auto_decrypt_dm_on_advert, sidebar_sort_order, last_message_times, preferences_migrated)
|
||||
VALUES (1, 200, '[]', 0, 'recent', '{}', 0)
|
||||
"""
|
||||
)
|
||||
|
||||
await conn.commit()
|
||||
logger.debug("Created app_settings table with default values")
|
||||
@@ -1,3 +1,5 @@
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
@@ -218,3 +220,38 @@ class CommandResponse(BaseModel):
|
||||
sender_timestamp: int | None = Field(
|
||||
default=None, description="Timestamp from the repeater's response"
|
||||
)
|
||||
|
||||
|
||||
class Favorite(BaseModel):
|
||||
"""A favorite conversation."""
|
||||
|
||||
type: Literal["channel", "contact"] = Field(description="'channel' or 'contact'")
|
||||
id: str = Field(description="Channel key or contact public key")
|
||||
|
||||
|
||||
class AppSettings(BaseModel):
|
||||
"""Application settings stored in the database."""
|
||||
|
||||
max_radio_contacts: int = Field(
|
||||
default=200,
|
||||
description="Maximum non-repeater contacts to keep on radio for DM ACKs",
|
||||
)
|
||||
favorites: list[Favorite] = Field(
|
||||
default_factory=list, description="List of favorited conversations"
|
||||
)
|
||||
auto_decrypt_dm_on_advert: bool = Field(
|
||||
default=False,
|
||||
description="Whether to attempt historical DM decryption on new contact advertisement",
|
||||
)
|
||||
sidebar_sort_order: Literal["recent", "alpha"] = Field(
|
||||
default="recent",
|
||||
description="Sidebar sort order: 'recent' or 'alpha'",
|
||||
)
|
||||
last_message_times: dict[str, int] = Field(
|
||||
default_factory=dict,
|
||||
description="Map of conversation state keys to last message timestamps",
|
||||
)
|
||||
preferences_migrated: bool = Field(
|
||||
default=False,
|
||||
description="Whether preferences have been migrated from localStorage",
|
||||
)
|
||||
@@ -659,9 +659,14 @@ async def _process_advertisement(
|
||||
},
|
||||
)
|
||||
|
||||
# For new contacts, attempt to decrypt any historical DMs we may have stored
|
||||
# For new contacts, optionally attempt to decrypt any historical DMs we may have stored
|
||||
# This is controlled by the auto_decrypt_dm_on_advert setting
|
||||
if existing is None:
|
||||
await start_historical_dm_decryption(None, advert.public_key, advert.name)
|
||||
from app.repository import AppSettingsRepository
|
||||
|
||||
settings = await AppSettingsRepository.get()
|
||||
if settings.auto_decrypt_dm_on_advert:
|
||||
await start_historical_dm_decryption(None, advert.public_key, advert.name)
|
||||
|
||||
# If this is not a repeater, trigger recent contacts sync to radio
|
||||
# This ensures we can auto-ACK DMs from recent contacts
|
||||
|
||||
+191
-2
@@ -3,11 +3,11 @@ import logging
|
||||
import sqlite3
|
||||
import time
|
||||
from hashlib import sha256
|
||||
from typing import Any
|
||||
from typing import Any, Literal
|
||||
|
||||
from app.database import db
|
||||
from app.decoder import PayloadType, extract_payload, get_packet_payload_type
|
||||
from app.models import Channel, Contact, Message, MessagePath, RawPacket
|
||||
from app.models import AppSettings, Channel, Contact, Favorite, Message, MessagePath, RawPacket
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -703,3 +703,192 @@ class RawPacketRepository:
|
||||
result.append((row["id"], data, row["timestamp"]))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
class AppSettingsRepository:
|
||||
"""Repository for app_settings table (single-row pattern)."""
|
||||
|
||||
@staticmethod
|
||||
async def get() -> AppSettings:
|
||||
"""Get the current app settings.
|
||||
|
||||
Always returns settings - creates default row if needed (migration handles initial row).
|
||||
"""
|
||||
cursor = await db.conn.execute(
|
||||
"""
|
||||
SELECT max_radio_contacts, favorites, auto_decrypt_dm_on_advert,
|
||||
sidebar_sort_order, last_message_times, preferences_migrated
|
||||
FROM app_settings WHERE id = 1
|
||||
"""
|
||||
)
|
||||
row = await cursor.fetchone()
|
||||
|
||||
if not row:
|
||||
# Should not happen after migration, but handle gracefully
|
||||
return AppSettings()
|
||||
|
||||
# Parse favorites JSON
|
||||
favorites = []
|
||||
if row["favorites"]:
|
||||
try:
|
||||
favorites_data = json.loads(row["favorites"])
|
||||
favorites = [Favorite(**f) for f in favorites_data]
|
||||
except (json.JSONDecodeError, TypeError, KeyError) as e:
|
||||
logger.warning(
|
||||
"Failed to parse favorites JSON, using empty list: %s (data=%r)",
|
||||
e,
|
||||
row["favorites"][:100] if row["favorites"] else None,
|
||||
)
|
||||
favorites = []
|
||||
|
||||
# Parse last_message_times JSON
|
||||
last_message_times: dict[str, int] = {}
|
||||
if row["last_message_times"]:
|
||||
try:
|
||||
last_message_times = json.loads(row["last_message_times"])
|
||||
except (json.JSONDecodeError, TypeError) as e:
|
||||
logger.warning(
|
||||
"Failed to parse last_message_times JSON, using empty dict: %s",
|
||||
e,
|
||||
)
|
||||
last_message_times = {}
|
||||
|
||||
# Validate sidebar_sort_order (fallback to "recent" if invalid)
|
||||
sort_order = row["sidebar_sort_order"]
|
||||
if sort_order not in ("recent", "alpha"):
|
||||
sort_order = "recent"
|
||||
|
||||
return AppSettings(
|
||||
max_radio_contacts=row["max_radio_contacts"],
|
||||
favorites=favorites,
|
||||
auto_decrypt_dm_on_advert=bool(row["auto_decrypt_dm_on_advert"]),
|
||||
sidebar_sort_order=sort_order,
|
||||
last_message_times=last_message_times,
|
||||
preferences_migrated=bool(row["preferences_migrated"]),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
async def update(
|
||||
max_radio_contacts: int | None = None,
|
||||
favorites: list[Favorite] | None = None,
|
||||
auto_decrypt_dm_on_advert: bool | None = None,
|
||||
sidebar_sort_order: str | None = None,
|
||||
last_message_times: dict[str, int] | None = None,
|
||||
preferences_migrated: bool | None = None,
|
||||
) -> AppSettings:
|
||||
"""Update app settings. Only provided fields are updated."""
|
||||
updates = []
|
||||
params: list[Any] = []
|
||||
|
||||
if max_radio_contacts is not None:
|
||||
updates.append("max_radio_contacts = ?")
|
||||
params.append(max_radio_contacts)
|
||||
|
||||
if favorites is not None:
|
||||
updates.append("favorites = ?")
|
||||
favorites_json = json.dumps([f.model_dump() for f in favorites])
|
||||
params.append(favorites_json)
|
||||
|
||||
if auto_decrypt_dm_on_advert is not None:
|
||||
updates.append("auto_decrypt_dm_on_advert = ?")
|
||||
params.append(1 if auto_decrypt_dm_on_advert else 0)
|
||||
|
||||
if sidebar_sort_order is not None:
|
||||
updates.append("sidebar_sort_order = ?")
|
||||
params.append(sidebar_sort_order)
|
||||
|
||||
if last_message_times is not None:
|
||||
updates.append("last_message_times = ?")
|
||||
params.append(json.dumps(last_message_times))
|
||||
|
||||
if preferences_migrated is not None:
|
||||
updates.append("preferences_migrated = ?")
|
||||
params.append(1 if preferences_migrated else 0)
|
||||
|
||||
if updates:
|
||||
query = f"UPDATE app_settings SET {', '.join(updates)} WHERE id = 1"
|
||||
await db.conn.execute(query, params)
|
||||
await db.conn.commit()
|
||||
|
||||
return await AppSettingsRepository.get()
|
||||
|
||||
@staticmethod
|
||||
async def add_favorite(fav_type: Literal["channel", "contact"], fav_id: str) -> AppSettings:
|
||||
"""Add a favorite, avoiding duplicates."""
|
||||
settings = await AppSettingsRepository.get()
|
||||
|
||||
# Check if already favorited
|
||||
if any(f.type == fav_type and f.id == fav_id for f in settings.favorites):
|
||||
return settings
|
||||
|
||||
new_favorites = settings.favorites + [Favorite(type=fav_type, id=fav_id)]
|
||||
return await AppSettingsRepository.update(favorites=new_favorites)
|
||||
|
||||
@staticmethod
|
||||
async def remove_favorite(fav_type: Literal["channel", "contact"], fav_id: str) -> AppSettings:
|
||||
"""Remove a favorite."""
|
||||
settings = await AppSettingsRepository.get()
|
||||
new_favorites = [
|
||||
f for f in settings.favorites if not (f.type == fav_type and f.id == fav_id)
|
||||
]
|
||||
return await AppSettingsRepository.update(favorites=new_favorites)
|
||||
|
||||
@staticmethod
|
||||
async def update_last_message_time(state_key: str, timestamp: int) -> None:
|
||||
"""Update the last message time for a conversation atomically.
|
||||
|
||||
Only updates if the new timestamp is greater than the existing one.
|
||||
Uses SQLite's json_set for atomic update to avoid race conditions.
|
||||
"""
|
||||
# Use COALESCE to handle NULL or missing keys, json_set for atomic update
|
||||
# Only update if new timestamp > existing (or key doesn't exist)
|
||||
await db.conn.execute(
|
||||
"""
|
||||
UPDATE app_settings
|
||||
SET last_message_times = json_set(
|
||||
COALESCE(last_message_times, '{}'),
|
||||
'$.' || ?,
|
||||
?
|
||||
)
|
||||
WHERE id = 1
|
||||
AND (
|
||||
json_extract(last_message_times, '$.' || ?) IS NULL
|
||||
OR json_extract(last_message_times, '$.' || ?) < ?
|
||||
)
|
||||
""",
|
||||
(state_key, timestamp, state_key, state_key, timestamp),
|
||||
)
|
||||
await db.conn.commit()
|
||||
|
||||
@staticmethod
|
||||
async def migrate_preferences_from_frontend(
|
||||
favorites: list[dict],
|
||||
sort_order: str,
|
||||
last_message_times: dict[str, int],
|
||||
) -> tuple[AppSettings, bool]:
|
||||
"""Migrate all preferences from frontend localStorage.
|
||||
|
||||
This is a one-time migration. If already migrated, returns current settings
|
||||
without overwriting. Returns (settings, did_migrate) tuple.
|
||||
"""
|
||||
settings = await AppSettingsRepository.get()
|
||||
|
||||
if settings.preferences_migrated:
|
||||
# Already migrated, don't overwrite
|
||||
return settings, False
|
||||
|
||||
# Convert frontend favorites format to Favorite objects
|
||||
new_favorites = []
|
||||
for f in favorites:
|
||||
if f.get("type") in ("channel", "contact") and f.get("id"):
|
||||
new_favorites.append(Favorite(type=f["type"], id=f["id"]))
|
||||
|
||||
# Update with migrated preferences and mark as migrated
|
||||
settings = await AppSettingsRepository.update(
|
||||
favorites=new_favorites,
|
||||
sidebar_sort_order=sort_order if sort_order in ("recent", "alpha") else "recent",
|
||||
last_message_times=last_message_times,
|
||||
preferences_migrated=True,
|
||||
)
|
||||
|
||||
return settings, True
|
||||
+144
-27
@@ -1,20 +1,16 @@
|
||||
import logging
|
||||
from typing import Literal
|
||||
|
||||
from fastapi import APIRouter
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from app.config import settings
|
||||
from app.models import AppSettings
|
||||
from app.repository import AppSettingsRepository
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
router = APIRouter(prefix="/settings", tags=["settings"])
|
||||
|
||||
|
||||
class AppSettingsResponse(BaseModel):
|
||||
max_radio_contacts: int = Field(
|
||||
description="Maximum non-repeater contacts to keep on radio for DM ACKs"
|
||||
)
|
||||
|
||||
|
||||
class AppSettingsUpdate(BaseModel):
|
||||
max_radio_contacts: int | None = Field(
|
||||
default=None,
|
||||
@@ -22,32 +18,153 @@ class AppSettingsUpdate(BaseModel):
|
||||
le=1000,
|
||||
description="Maximum non-repeater contacts to keep on radio (1-1000)",
|
||||
)
|
||||
|
||||
|
||||
@router.get("", response_model=AppSettingsResponse)
|
||||
async def get_settings() -> AppSettingsResponse:
|
||||
"""Get current application settings."""
|
||||
return AppSettingsResponse(
|
||||
max_radio_contacts=settings.max_radio_contacts,
|
||||
auto_decrypt_dm_on_advert: bool | None = Field(
|
||||
default=None,
|
||||
description="Whether to attempt historical DM decryption on new contact advertisement",
|
||||
)
|
||||
sidebar_sort_order: Literal["recent", "alpha"] | None = Field(
|
||||
default=None,
|
||||
description="Sidebar sort order: 'recent' or 'alpha'",
|
||||
)
|
||||
|
||||
|
||||
@router.patch("", response_model=AppSettingsResponse)
|
||||
async def update_settings(update: AppSettingsUpdate) -> AppSettingsResponse:
|
||||
class FavoriteRequest(BaseModel):
|
||||
type: Literal["channel", "contact"] = Field(description="'channel' or 'contact'")
|
||||
id: str = Field(description="Channel key or contact public key")
|
||||
|
||||
|
||||
class LastMessageTimeUpdate(BaseModel):
|
||||
state_key: str = Field(
|
||||
description="Conversation state key (e.g., 'channel-KEY' or 'contact-PREFIX')"
|
||||
)
|
||||
timestamp: int = Field(description="Unix timestamp of the last message")
|
||||
|
||||
|
||||
class MigratePreferencesRequest(BaseModel):
|
||||
favorites: list[FavoriteRequest] = Field(
|
||||
default_factory=list,
|
||||
description="List of favorites from localStorage",
|
||||
)
|
||||
sort_order: str = Field(
|
||||
default="recent",
|
||||
description="Sort order preference from localStorage",
|
||||
)
|
||||
last_message_times: dict[str, int] = Field(
|
||||
default_factory=dict,
|
||||
description="Map of conversation state keys to timestamps from localStorage",
|
||||
)
|
||||
|
||||
|
||||
class MigratePreferencesResponse(BaseModel):
|
||||
migrated: bool = Field(description="Whether migration occurred (false if already migrated)")
|
||||
settings: AppSettings = Field(description="Current settings after migration attempt")
|
||||
|
||||
|
||||
@router.get("", response_model=AppSettings)
|
||||
async def get_settings() -> AppSettings:
|
||||
"""Get current application settings."""
|
||||
return await AppSettingsRepository.get()
|
||||
|
||||
|
||||
@router.patch("", response_model=AppSettings)
|
||||
async def update_settings(update: AppSettingsUpdate) -> AppSettings:
|
||||
"""Update application settings.
|
||||
|
||||
Note: Changes are applied immediately but not persisted across restarts.
|
||||
Set MESHCORE_MAX_RADIO_CONTACTS environment variable for persistent changes.
|
||||
Settings are persisted to the database and survive restarts.
|
||||
"""
|
||||
kwargs = {}
|
||||
if update.max_radio_contacts is not None:
|
||||
logger.info(
|
||||
"Updating max_radio_contacts from %d to %d",
|
||||
settings.max_radio_contacts,
|
||||
update.max_radio_contacts,
|
||||
)
|
||||
# Pydantic settings are mutable, we can update them directly
|
||||
object.__setattr__(settings, "max_radio_contacts", update.max_radio_contacts)
|
||||
logger.info("Updating max_radio_contacts to %d", update.max_radio_contacts)
|
||||
kwargs["max_radio_contacts"] = update.max_radio_contacts
|
||||
|
||||
return AppSettingsResponse(
|
||||
max_radio_contacts=settings.max_radio_contacts,
|
||||
if update.auto_decrypt_dm_on_advert is not None:
|
||||
logger.info("Updating auto_decrypt_dm_on_advert to %s", update.auto_decrypt_dm_on_advert)
|
||||
kwargs["auto_decrypt_dm_on_advert"] = update.auto_decrypt_dm_on_advert
|
||||
|
||||
if update.sidebar_sort_order is not None:
|
||||
logger.info("Updating sidebar_sort_order to %s", update.sidebar_sort_order)
|
||||
kwargs["sidebar_sort_order"] = update.sidebar_sort_order
|
||||
|
||||
if kwargs:
|
||||
return await AppSettingsRepository.update(**kwargs)
|
||||
|
||||
return await AppSettingsRepository.get()
|
||||
|
||||
|
||||
@router.post("/favorites", response_model=AppSettings)
|
||||
async def add_favorite(request: FavoriteRequest) -> AppSettings:
|
||||
"""Add a conversation to favorites."""
|
||||
logger.info("Adding favorite: %s %s", request.type, request.id[:12])
|
||||
return await AppSettingsRepository.add_favorite(request.type, request.id)
|
||||
|
||||
|
||||
@router.delete("/favorites", response_model=AppSettings)
|
||||
async def remove_favorite(request: FavoriteRequest) -> AppSettings:
|
||||
"""Remove a conversation from favorites."""
|
||||
logger.info("Removing favorite: %s %s", request.type, request.id[:12])
|
||||
return await AppSettingsRepository.remove_favorite(request.type, request.id)
|
||||
|
||||
|
||||
@router.post("/favorites/toggle", response_model=AppSettings)
|
||||
async def toggle_favorite(request: FavoriteRequest) -> AppSettings:
|
||||
"""Toggle a conversation's favorite status."""
|
||||
settings = await AppSettingsRepository.get()
|
||||
is_favorited = any(f.type == request.type and f.id == request.id for f in settings.favorites)
|
||||
|
||||
if is_favorited:
|
||||
logger.info("Removing favorite: %s %s", request.type, request.id[:12])
|
||||
return await AppSettingsRepository.remove_favorite(request.type, request.id)
|
||||
else:
|
||||
logger.info("Adding favorite: %s %s", request.type, request.id[:12])
|
||||
return await AppSettingsRepository.add_favorite(request.type, request.id)
|
||||
|
||||
|
||||
@router.post("/last-message-time")
|
||||
async def update_last_message_time(request: LastMessageTimeUpdate) -> dict:
|
||||
"""Update the last message time for a conversation.
|
||||
|
||||
Used to track when conversations last received messages for sidebar sorting.
|
||||
Only updates if the new timestamp is greater than the existing one.
|
||||
"""
|
||||
await AppSettingsRepository.update_last_message_time(request.state_key, request.timestamp)
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@router.post("/migrate", response_model=MigratePreferencesResponse)
|
||||
async def migrate_preferences(request: MigratePreferencesRequest) -> MigratePreferencesResponse:
|
||||
"""Migrate all preferences from frontend localStorage to database.
|
||||
|
||||
This is a one-time migration. If preferences have already been migrated,
|
||||
this endpoint will not overwrite them and will return migrated=false.
|
||||
|
||||
Call this on frontend startup to ensure preferences are moved to the database.
|
||||
After successful migration, the frontend should clear localStorage preferences.
|
||||
|
||||
Migrates:
|
||||
- favorites (remoteterm-favorites)
|
||||
- sort_order (remoteterm-sortOrder)
|
||||
- last_message_times (remoteterm-lastMessageTime)
|
||||
"""
|
||||
# Convert to dict format for the repository method
|
||||
frontend_favorites = [{"type": f.type, "id": f.id} for f in request.favorites]
|
||||
|
||||
settings, did_migrate = await AppSettingsRepository.migrate_preferences_from_frontend(
|
||||
favorites=frontend_favorites,
|
||||
sort_order=request.sort_order,
|
||||
last_message_times=request.last_message_times,
|
||||
)
|
||||
|
||||
if did_migrate:
|
||||
logger.info(
|
||||
"Migrated preferences from frontend: %d favorites, sort_order=%s, %d message times",
|
||||
len(frontend_favorites),
|
||||
request.sort_order,
|
||||
len(request.last_message_times),
|
||||
)
|
||||
else:
|
||||
logger.debug("Preferences already migrated, skipping")
|
||||
|
||||
return MigratePreferencesResponse(
|
||||
migrated=did_migrate,
|
||||
settings=settings,
|
||||
)
|
||||
@@ -68,6 +68,7 @@ All application state lives in `App.tsx` using React hooks. No external state li
|
||||
```typescript
|
||||
const [health, setHealth] = useState<HealthStatus | null>(null);
|
||||
const [config, setConfig] = useState<RadioConfig | null>(null);
|
||||
const [appSettings, setAppSettings] = useState<AppSettings | null>(null);
|
||||
const [contacts, setContacts] = useState<Contact[]>([]);
|
||||
const [channels, setChannels] = useState<Channel[]>([]);
|
||||
const [messages, setMessages] = useState<Message[]>([]);
|
||||
@@ -76,6 +77,17 @@ const [activeConversation, setActiveConversation] = useState<Conversation | null
|
||||
const [unreadCounts, setUnreadCounts] = useState<Record<string, number>>({});
|
||||
```
|
||||
|
||||
### App Settings
|
||||
|
||||
App settings are stored server-side and include:
|
||||
- `favorites` - List of favorited conversations (channels/contacts)
|
||||
- `sidebar_sort_order` - 'recent' or 'alpha'
|
||||
- `auto_decrypt_dm_on_advert` - Auto-decrypt historical DMs on new contact
|
||||
- `last_message_times` - Map of conversation keys to last message timestamps
|
||||
|
||||
**Migration**: On first load, localStorage preferences are migrated to the server.
|
||||
The `preferences_migrated` flag prevents duplicate migrations.
|
||||
|
||||
### State Flow
|
||||
|
||||
1. **WebSocket** pushes real-time updates (health, contacts, channels, messages)
|
||||
@@ -222,8 +234,18 @@ interface Conversation {
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface Favorite {
|
||||
type: 'channel' | 'contact';
|
||||
id: string; // Channel key or contact public key
|
||||
}
|
||||
|
||||
interface AppSettings {
|
||||
max_radio_contacts: number;
|
||||
favorites: Favorite[];
|
||||
auto_decrypt_dm_on_advert: boolean;
|
||||
sidebar_sort_order: 'recent' | 'alpha';
|
||||
last_message_times: Record<string, number>;
|
||||
preferences_migrated: boolean;
|
||||
}
|
||||
|
||||
// Repeater telemetry types
|
||||
|
||||
+542
@@ -0,0 +1,542 @@
|
||||
var Fv=Object.defineProperty;var Nv=(r,a,o)=>a in r?Fv(r,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[a]=o;var Oo=(r,a,o)=>Nv(r,typeof a!="symbol"?a+"":a,o);function Lv(r,a){for(var o=0;o<a.length;o++){const l=a[o];if(typeof l!="string"&&!Array.isArray(l)){for(const d in l)if(d!=="default"&&!(d in r)){const f=Object.getOwnPropertyDescriptor(l,d);f&&Object.defineProperty(r,d,f.get?f:{enumerable:!0,get:()=>l[d]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))l(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&l(p)}).observe(document,{childList:!0,subtree:!0});function o(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function l(d){if(d.ep)return;d.ep=!0;const f=o(d);fetch(d.href,f)}})();var Tf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Og(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var a=r.default;if(typeof a=="function"){var o=function l(){return this instanceof l?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};o.prototype=a.prototype}else o={};return Object.defineProperty(o,"__esModule",{value:!0}),Object.keys(r).forEach(function(l){var d=Object.getOwnPropertyDescriptor(r,l);Object.defineProperty(o,l,d.get?d:{enumerable:!0,get:function(){return r[l]}})}),o}var Df={exports:{}},Wa={},Rf={exports:{}},dt={};/**
|
||||
* @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 Ep;function Mv(){if(Ep)return dt;Ep=1;var r=Symbol.for("react.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),p=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.iterator;function w(B){return B===null||typeof B!="object"?null:(B=y&&B[y]||B["@@iterator"],typeof B=="function"?B:null)}var P={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,C={};function k(B,V,K){this.props=B,this.context=V,this.refs=C,this.updater=K||P}k.prototype.isReactComponent={},k.prototype.setState=function(B,V){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,V,"setState")},k.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function R(){}R.prototype=k.prototype;function T(B,V,K){this.props=B,this.context=V,this.refs=C,this.updater=K||P}var S=T.prototype=new R;S.constructor=T,D(S,k.prototype),S.isPureReactComponent=!0;var N=Array.isArray,I=Object.prototype.hasOwnProperty,H={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function j(B,V,K){var $,ce={},de=null,Se=null;if(V!=null)for($ in V.ref!==void 0&&(Se=V.ref),V.key!==void 0&&(de=""+V.key),V)I.call(V,$)&&!z.hasOwnProperty($)&&(ce[$]=V[$]);var Ae=arguments.length-2;if(Ae===1)ce.children=K;else if(1<Ae){for(var Ue=Array(Ae),$e=0;$e<Ae;$e++)Ue[$e]=arguments[$e+2];ce.children=Ue}if(B&&B.defaultProps)for($ in Ae=B.defaultProps,Ae)ce[$]===void 0&&(ce[$]=Ae[$]);return{$$typeof:r,type:B,key:de,ref:Se,props:ce,_owner:H.current}}function J(B,V){return{$$typeof:r,type:B.type,key:V,ref:B.ref,props:B.props,_owner:B._owner}}function W(B){return typeof B=="object"&&B!==null&&B.$$typeof===r}function U(B){var V={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(K){return V[K]})}var te=/\/+/g;function X(B,V){return typeof B=="object"&&B!==null&&B.key!=null?U(""+B.key):V.toString(36)}function re(B,V,K,$,ce){var de=typeof B;(de==="undefined"||de==="boolean")&&(B=null);var Se=!1;if(B===null)Se=!0;else switch(de){case"string":case"number":Se=!0;break;case"object":switch(B.$$typeof){case r:case a:Se=!0}}if(Se)return Se=B,ce=ce(Se),B=$===""?"."+X(Se,0):$,N(ce)?(K="",B!=null&&(K=B.replace(te,"$&/")+"/"),re(ce,V,K,"",function($e){return $e})):ce!=null&&(W(ce)&&(ce=J(ce,K+(!ce.key||Se&&Se.key===ce.key?"":(""+ce.key).replace(te,"$&/")+"/")+B)),V.push(ce)),1;if(Se=0,$=$===""?".":$+":",N(B))for(var Ae=0;Ae<B.length;Ae++){de=B[Ae];var Ue=$+X(de,Ae);Se+=re(de,V,K,Ue,ce)}else if(Ue=w(B),typeof Ue=="function")for(B=Ue.call(B),Ae=0;!(de=B.next()).done;)de=de.value,Ue=$+X(de,Ae++),Se+=re(de,V,K,Ue,ce);else if(de==="object")throw V=String(B),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return Se}function fe(B,V,K){if(B==null)return B;var $=[],ce=0;return re(B,$,"","",function(de){return V.call(K,de,ce++)}),$}function ae(B){if(B._status===-1){var V=B._result;V=V(),V.then(function(K){(B._status===0||B._status===-1)&&(B._status=1,B._result=K)},function(K){(B._status===0||B._status===-1)&&(B._status=2,B._result=K)}),B._status===-1&&(B._status=0,B._result=V)}if(B._status===1)return B._result.default;throw B._result}var he={current:null},G={transition:null},pe={ReactCurrentDispatcher:he,ReactCurrentBatchConfig:G,ReactCurrentOwner:H};function Z(){throw Error("act(...) is not supported in production builds of React.")}return dt.Children={map:fe,forEach:function(B,V,K){fe(B,function(){V.apply(this,arguments)},K)},count:function(B){var V=0;return fe(B,function(){V++}),V},toArray:function(B){return fe(B,function(V){return V})||[]},only:function(B){if(!W(B))throw Error("React.Children.only expected to receive a single React element child.");return B}},dt.Component=k,dt.Fragment=o,dt.Profiler=d,dt.PureComponent=T,dt.StrictMode=l,dt.Suspense=g,dt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=pe,dt.act=Z,dt.cloneElement=function(B,V,K){if(B==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+B+".");var $=D({},B.props),ce=B.key,de=B.ref,Se=B._owner;if(V!=null){if(V.ref!==void 0&&(de=V.ref,Se=H.current),V.key!==void 0&&(ce=""+V.key),B.type&&B.type.defaultProps)var Ae=B.type.defaultProps;for(Ue in V)I.call(V,Ue)&&!z.hasOwnProperty(Ue)&&($[Ue]=V[Ue]===void 0&&Ae!==void 0?Ae[Ue]:V[Ue])}var Ue=arguments.length-2;if(Ue===1)$.children=K;else if(1<Ue){Ae=Array(Ue);for(var $e=0;$e<Ue;$e++)Ae[$e]=arguments[$e+2];$.children=Ae}return{$$typeof:r,type:B.type,key:ce,ref:de,props:$,_owner:Se}},dt.creLine truncated
|
||||
* @license React
|
||||
* react-jsx-runtime.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 Sp;function Iv(){if(Sp)return Wa;Sp=1;var r=m0(),a=Symbol.for("react.element"),o=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,d=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function p(h,g,m){var v,y={},w=null,P=null;m!==void 0&&(w=""+m),g.key!==void 0&&(w=""+g.key),g.ref!==void 0&&(P=g.ref);for(v in g)l.call(g,v)&&!f.hasOwnProperty(v)&&(y[v]=g[v]);if(h&&h.defaultProps)for(v in g=h.defaultProps,g)y[v]===void 0&&(y[v]=g[v]);return{$$typeof:a,type:h,key:w,ref:P,props:y,_owner:d.current}}return Wa.Fragment=o,Wa.jsx=p,Wa.jsxs=p,Wa}var Bp;function Ov(){return Bp||(Bp=1,Df.exports=Iv()),Df.exports}var b=Ov(),F=m0();const Ee=Xs(F),g0=Lv({__proto__:null,default:Ee},[F]);var Pu={},Ff={exports:{}},Zn={},Nf={exports:{}},Lf={};/**
|
||||
* @license React
|
||||
* scheduler.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 Pp;function jv(){return Pp||(Pp=1,(function(r){function a(G,pe){var Z=G.length;G.push(pe);e:for(;0<Z;){var B=Z-1>>>1,V=G[B];if(0<d(V,pe))G[B]=pe,G[Z]=V,Z=B;else break e}}function o(G){return G.length===0?null:G[0]}function l(G){if(G.length===0)return null;var pe=G[0],Z=G.pop();if(Z!==pe){G[0]=Z;e:for(var B=0,V=G.length,K=V>>>1;B<K;){var $=2*(B+1)-1,ce=G[$],de=$+1,Se=G[de];if(0>d(ce,Z))de<V&&0>d(Se,ce)?(G[B]=Se,G[de]=Z,B=de):(G[B]=ce,G[$]=Z,B=$);else if(de<V&&0>d(Se,Z))G[B]=Se,G[de]=Z,B=de;else break e}}return pe}function d(G,pe){var Z=G.sortIndex-pe.sortIndex;return Z!==0?Z:G.id-pe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var p=Date,h=p.now();r.unstable_now=function(){return p.now()-h}}var g=[],m=[],v=1,y=null,w=3,P=!1,D=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(G){for(var pe=o(m);pe!==null;){if(pe.callback===null)l(m);else if(pe.startTime<=G)l(m),pe.sortIndex=pe.expirationTime,a(g,pe);else break;pe=o(m)}}function N(G){if(C=!1,S(G),!D)if(o(g)!==null)D=!0,ae(I);else{var pe=o(m);pe!==null&&he(N,pe.startTime-G)}}function I(G,pe){D=!1,C&&(C=!1,R(j),j=-1),P=!0;var Z=w;try{for(S(pe),y=o(g);y!==null&&(!(y.expirationTime>pe)||G&&!U());){var B=y.callback;if(typeof B=="function"){y.callback=null,w=y.priorityLevel;var V=B(y.expirationTime<=pe);pe=r.unstable_now(),typeof V=="function"?y.callback=V:y===o(g)&&l(g),S(pe)}else l(g);y=o(g)}if(y!==null)var K=!0;else{var $=o(m);$!==null&&he(N,$.startTime-pe),K=!1}return K}finally{y=null,w=Z,P=!1}}var H=!1,z=null,j=-1,J=5,W=-1;function U(){return!(r.unstable_now()-W<J)}function te(){if(z!==null){var G=r.unstable_now();W=G;var pe=!0;try{pe=z(!0,G)}finally{pe?X():(H=!1,z=null)}}else H=!1}var X;if(typeof T=="function")X=function(){T(te)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,fe=re.port2;re.port1.onmessage=te,X=function(){fe.postMessage(null)}}else X=function(){k(te,0)};function ae(G){z=G,H||(H=!0,X())}function he(G,pe){j=k(function(){G(r.unstable_now())},pe)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(G){G.callback=null},r.unstable_continueExecution=function(){D||P||(D=!0,ae(I))},r.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<G?Math.floor(1e3/G):5},r.unstable_getCurrentPriorityLevel=function(){return w},r.unstable_getFirstCallbackNode=function(){return o(g)},r.unstable_next=function(G){switch(w){case 1:case 2:case 3:var pe=3;break;default:pe=w}var Z=w;w=pe;try{return G()}finally{w=Z}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(G,pe){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var Z=w;w=G;try{return pe()}finally{w=Z}},r.unstable_scheduleCallback=function(G,pe,Z){var B=r.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?B+Z:B):Z=B,G){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=Z+V,G={id:v++,callback:pe,priorityLevel:G,startTime:Z,expirationTime:V,sortIndex:-1},Z>B?(G.sortIndex=Z,a(m,G),o(g)===null&&G===o(m)&&(C?(R(j),j=-1):C=!0,he(N,Z-B))):(G.sortIndex=V,a(g,G),D||P||(D=!0,ae(I))),G},r.unstable_shouldYield=U,r.unstable_wrapCallback=function(G){var pe=w;return function(){var Z=w;w=pe;try{return G.apply(this,arguments)}finally{w=Z}}}})(Lf)),Lf}var Tp;function zv(){return Tp||(Tp=1,Nf.exports=jv()),Nf.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 Dp;function Hv(){if(Dp)return Zn;Dp=1;var r=m0(),a=zv();function o(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s<arguments.length;s++)n+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,d={};function f(e,n){p(e,n),p(e+"Capture",n)}function p(e,n){for(d[e]=n,e=0;e<n.length;e++)l.add(n[e])}var h=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),g=Object.prototype.hasOwnProperty,m=/^[: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]*$/,v={},y={};function w(e){return g.call(y,e)?!0:g.call(v,e)?!1:m.test(e)?y[e]=!0:(v[e]=!0,!1)}function P(e,n,s,c){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return c?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function D(e,n,s,c){if(n===null||typeof n>"u"||P(e,n,s,c))return!0;if(c)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function C(e,n,s,c,x,_,M){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=c,this.attributeNamespace=x,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=_,this.removeEmptyString=M}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){k[e]=new C(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];k[n]=new C(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){k[e]=new C(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){k[e]=new C(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){k[e]=new C(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){k[e]=new C(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){k[e]=new C(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){k[e]=new C(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){k[e]=new C(e,5,!1,e.toLowerCase(),null,!1,!1)});var R=/[\-:]([a-z])/g;function T(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 n=e.replace(R,T);k[n]=new C(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(R,T);k[n]=new C(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(R,T);k[n]=new C(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){k[e]=new C(e,1,!1,e.toLowerCase(),null,!1,!1)}),k.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){k[e]=new C(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,n,s,c){var x=k.hasOwnProperty(n)?k[n]:null;(x!==null?x.type!==0:c||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=
Line truncated
|
||||
`+B+e}var K=!1;function $(e,n){if(!e||K)return"";K=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(ue){var c=ue}Reflect.construct(e,[],n)}else{try{n.call()}catch(ue){c=ue}e.call(n.prototype)}else{try{throw Error()}catch(ue){c=ue}e()}}catch(ue){if(ue&&c&&typeof ue.stack=="string"){for(var x=ue.stack.split(`
|
||||
`),_=c.stack.split(`
|
||||
`),M=x.length-1,q=_.length-1;1<=M&&0<=q&&x[M]!==_[q];)q--;for(;1<=M&&0<=q;M--,q--)if(x[M]!==_[q]){if(M!==1||q!==1)do if(M--,q--,0>q||x[M]!==_[q]){var Y=`
|
||||
`+x[M].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=M&&0<=q);break}}}finally{K=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?V(e):""}function ce(e){switch(e.tag){case 5:return V(e.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return e=$(e.type,!1),e;case 11:return e=$(e.type.render,!1),e;case 1:return e=$(e.type,!0),e;default:return""}}function de(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 z:return"Fragment";case H:return"Portal";case J:return"Profiler";case j:return"StrictMode";case X:return"Suspense";case re:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case U:return(e.displayName||"Context")+".Consumer";case W:return(e._context.displayName||"Context")+".Provider";case te:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case fe:return n=e.displayName||null,n!==null?n:de(e.type)||"Memo";case ae:n=e._payload,e=e._init;try{return de(e(n))}catch{}}return null}function Se(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return de(n);case 8:return n===j?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function Ae(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ue(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function $e(e){var n=Ue(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),c=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var x=s.get,_=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return x.call(this)},set:function(M){c=""+M,_.call(this,M)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return c},setValue:function(M){c=""+M},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function bt(e){e._valueTracker||(e._valueTracker=$e(e))}function ut(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),c="";return e&&(c=Ue(e)?e.checked?"true":"false":e.value),e=c,e!==s?(n.setValue(e),!0):!1}function Be(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 Ze(e,n){var s=n.checked;return Z({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function ct(e,n){var s=n.defaultValue==null?"":n.defaultValue,c=n.checked!=null?n.checked:n.defaultChecked;s=Ae(n.value!=null?n.value:s),e._wrapperState={initialChecked:c,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Mt(e,n){n=n.checked,n!=null&&S(e,"checked",n,!1)}function st(e,n){Mt(e,n);var s=Ae(n.value),c=n.type;if(s!=null)c==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(c==="submit"||c==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?qe(e,n.type,s):n.hasOwnProperty("defaultValue")&&qe(e,n.type,Ae(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function gt(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var c=n.type;if(!(c!=="submit"&&c!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function qe(e,n,s){(n!=="number"||Be(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var et=Array.isArray;function tt(e,n,s,c){if(e=e.options,n){n={};for(var x=0;x<s.length;x++)n["$"+s[x]]=!0;for(s=0;s<e.length;s++)x=n.hasOwnProperty("$"+e[s].value),e[s].selected!==x&&(e[s].selected=x),x&&c&&(e[s].defaultSelected=!0)}else{for(s=""+Ae(s),n=null,x=0;x<e.length;x++){if(e[x].value===s){e[x].selected=!0,c&&(e[x].defaultSelected=!0);return}n!==null||e[x].disabled||(n=e[x])}n!==null&&(n.selected=!0)}}function He(e,n){if(n.dangerouslySetInnerHTM
Line truncated
|
||||
`).replace(Q,"")}function le(e,n,s){if(n=ie(n),ie(e)!==n&&s)throw Error(o(425))}function xe(){}var Pe=null,We=null;function rt(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var sn=typeof setTimeout=="function"?setTimeout:void 0,nn=typeof clearTimeout=="function"?clearTimeout:void 0,Fn=typeof Promise=="function"?Promise:void 0,bn=typeof queueMicrotask=="function"?queueMicrotask:typeof Fn<"u"?function(e){return Fn.resolve(null).then(e).catch(qi)}:sn;function qi(e){setTimeout(function(){throw e})}function Ta(e,n){var s=n,c=0;do{var x=s.nextSibling;if(e.removeChild(s),x&&x.nodeType===8)if(s=x.data,s==="/$"){if(c===0){e.removeChild(x),Yn(n);return}c--}else s!=="$"&&s!=="$?"&&s!=="$!"||c++;s=x}while(s);Yn(n)}function Zr(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return e}function Zl(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"){if(n===0)return e;n--}else s==="/$"&&n++}e=e.previousSibling}return null}var ci=Math.random().toString(36).slice(2),fr="__reactFiber$"+ci,Gi="__reactProps$"+ci,kt="__reactContainer$"+ci,Ki="__reactEvents$"+ci,Cd="__reactListeners$"+ci,Ed="__reactHandles$"+ci;function di(e){var n=e[fr];if(n)return n;for(var s=e.parentNode;s;){if(n=s[kt]||s[fr]){if(s=n.alternate,n.child!==null||s!==null&&s.child!==null)for(e=Zl(e);e!==null;){if(s=e[fr])return s;e=Zl(e)}return n}e=s,s=e.parentNode}return null}function fi(e){return e=e[fr]||e[kt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function hi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(o(33))}function Cs(e){return e[Gi]||null}var kd=[],Es=-1;function Qi(e){return{current:e}}function Ot(e){0>Es||(e.current=kd[Es],kd[Es]=null,Es--)}function Lt(e,n){Es++,kd[Es]=e.current,e.current=n}var $i={},Cn=Qi($i),jn=Qi(!1),So=$i;function ks(e,n){var s=e.type.contextTypes;if(!s)return $i;var c=e.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===n)return c.__reactInternalMemoizedMaskedChildContext;var x={},_;for(_ in s)x[_]=n[_];return c&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=x),x}function zn(e){return e=e.childContextTypes,e!=null}function Wl(){Ot(jn),Ot(Cn)}function G0(e,n,s){if(Cn.current!==$i)throw Error(o(168));Lt(Cn,n),Lt(jn,s)}function K0(e,n,s){var c=e.stateNode;if(n=n.childContextTypes,typeof c.getChildContext!="function")return s;c=c.getChildContext();for(var x in c)if(!(x in n))throw Error(o(108,Se(e)||"Unknown",x));return Z({},s,c)}function ql(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$i,So=Cn.current,Lt(Cn,e),Lt(jn,jn.current),!0}function Q0(e,n,s){var c=e.stateNode;if(!c)throw Error(o(169));s?(e=K0(e,n,So),c.__reactInternalMemoizedMergedChildContext=e,Ot(jn),Ot(Cn),Lt(Cn,e)):Ot(jn),Lt(jn,s)}var pi=null,Gl=!1,Sd=!1;function $0(e){pi===null?pi=[e]:pi.push(e)}function Xx(e){Gl=!0,$0(e)}function Yi(){if(!Sd&&pi!==null){Sd=!0;var e=0,n=At;try{var s=pi;for(At=1;e<s.length;e++){var c=s[e];do c=c(!0);while(c!==null)}pi=null,Gl=!1}catch(x){throw pi!==null&&(pi=pi.slice(e+1)),yl(oa,Yi),x}finally{At=n,Sd=!1}}return null}var Ss=[],Bs=0,Kl=null,Ql=0,hr=[],pr=0,Bo=null,mi=1,gi="";function Po(e,n){Ss[Bs++]=Ql,Ss[Bs++]=Kl,Kl=e,Ql=n}function Y0(e,n,s){hr[pr++]=mi,hr[pr++]=gi,hr[pr++]=Bo,Bo=e;var c=mi;e=gi;var x=32-nt(c)-1;c&=~(1<<x),s+=1;var _=32-nt(n)+x;if(30<_){var M=x-x%5;_=(c&(1<<M)-1).toString(32),c>>=M,x-=M,mi=1<<32-nt(n)+x|s<<x|c,gi=_+e}else mi=1<<_|s<<x|c,gi=e}function Bd(e){e.return!==null&&(Po(e,1),Y0(e,1,0))}function Pd(e){for(;e===Kl;)Kl=Ss[--Bs],Ss[Bs]=null,Ql=Ss[--Bs],Ss[Bs]=null;for(;e===Bo;)Bo=hr[--pr],hr[pr]=null,gi=hr[--pr],hr[pr]=null,mi=hr[--pr],hr[pr]=null}var nr=null,rr=null,Vt=!1,kr=null;function X0(e,n){var s=xr(5,null,null,0);s.elementType="DELETED",s.stateNode=n,s.return=e,n=e.deletions,n===null?(e.deletions=[s],e.flags|=16):n.push(s)}function J0(e,n){switch(e.tag){case 5:var s=e.type;return n=n.nodeType!==1||s.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(e.stateNode=n,nr=e,rr=Zr(n.firstChild),!0):!1;case 6:return n=e.pendingProps===""||n.nodeType!==3?null:n,n!==null?(e.stateNode=n,nr=e,rr=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(s=Bo!==null?{id:mi,overflow:gi}:null,e.memoizedState={dehydrated:n,treeContext:s,retryLane:1073741824},s=xr(18,null,null,0),s.stateNode=n,s.return=e,e.child=s,nr=e,rr=null,!0):!1;default:return!1}}function Td(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Dd(e){if(Vt){var n=rr;if(n){var s=n;if(!J0(e,n)){if(Td(e))throw Error(o(418));n=Zr(s.nextSibling);var c=nr;n&&J0(e,n)?X0(c,s):(e.flags=e.flags&-4097|2,Vt=!1,nr=e)}}else{if(Td(e))throw Error(o(418));e.flags=e.flags&-4097|2,Vt=!1,nr=e}}}function eh(e){for(e=e.r
Line truncated
|
||||
Error generating stack: `+_.message+`
|
||||
`+_.stack}return{value:e,source:n,stack:x,digest:null}}function Jd(e,n,s){return{value:e,source:null,stack:s??null,digest:n??null}}function ef(e,n){try{console.error(n.value)}catch(s){setTimeout(function(){throw s})}}var av=typeof WeakMap=="function"?WeakMap:Map;function Nh(e,n,s){s=xi(-1,s),s.tag=3,s.payload={element:null};var c=n.value;return s.callback=function(){mu||(mu=!0,gf=c),ef(e,n)},s}function Lh(e,n,s){s=xi(-1,s),s.tag=3;var c=e.type.getDerivedStateFromError;if(typeof c=="function"){var x=n.value;s.payload=function(){return c(x)},s.callback=function(){ef(e,n)}}var _=e.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(s.callback=function(){ef(e,n),typeof c!="function"&&(to===null?to=new Set([this]):to.add(this));var M=n.stack;this.componentDidCatch(n.value,{componentStack:M!==null?M:""})}),s}function Mh(e,n,s){var c=e.pingCache;if(c===null){c=e.pingCache=new av;var x=new Set;c.set(n,x)}else x=c.get(n),x===void 0&&(x=new Set,c.set(n,x));x.has(s)||(x.add(s),e=_v.bind(null,e,n,s),n.then(e,e))}function Ih(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function Oh(e,n,s,c,x){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(n=xi(-1,1),n.tag=2,Ji(s,n,1))),s.lanes|=1),e):(e.flags|=65536,e.lanes=x,e)}var lv=N.ReactCurrentOwner,Hn=!1;function Nn(e,n,s,c){n.child=e===null?ih(n,null,s,c):Ts(n,e.child,s,c)}function jh(e,n,s,c,x){s=s.render;var _=n.ref;return Rs(n,x),c=Wd(e,n,s,c,_,x),s=qd(),e!==null&&!Hn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~x,vi(e,n,x)):(Vt&&s&&Bd(n),n.flags|=1,Nn(e,n,c,x),n.child)}function zh(e,n,s,c,x){if(e===null){var _=s.type;return typeof _=="function"&&!bf(_)&&_.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(n.tag=15,n.type=_,Hh(e,n,_,c,x)):(e=_u(s.type,null,c,n,n.mode,x),e.ref=n.ref,e.return=n,n.child=e)}if(_=e.child,(e.lanes&x)===0){var M=_.memoizedProps;if(s=s.compare,s=s!==null?s:Hr,s(M,c)&&e.ref===n.ref)return vi(e,n,x)}return n.flags|=1,e=oo(_,c),e.ref=n.ref,e.return=n,n.child=e}function Hh(e,n,s,c,x){if(e!==null){var _=e.memoizedProps;if(Hr(_,c)&&e.ref===n.ref)if(Hn=!1,n.pendingProps=c=_,(e.lanes&x)!==0)(e.flags&131072)!==0&&(Hn=!0);else return n.lanes=e.lanes,vi(e,n,x)}return tf(e,n,s,c,x)}function Vh(e,n,s){var c=n.pendingProps,x=c.children,_=e!==null?e.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},Lt(Ms,ir),ir|=s;else{if((s&1073741824)===0)return e=_!==null?_.baseLanes|s:s,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,Lt(Ms,ir),ir|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=_!==null?_.baseLanes:s,Lt(Ms,ir),ir|=c}else _!==null?(c=_.baseLanes|s,n.memoizedState=null):c=s,Lt(Ms,ir),ir|=c;return Nn(e,n,x,s),n.child}function Uh(e,n){var s=n.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(n.flags|=512,n.flags|=2097152)}function tf(e,n,s,c,x){var _=zn(s)?So:Cn.current;return _=ks(n,_),Rs(n,x),s=Wd(e,n,s,c,_,x),c=qd(),e!==null&&!Hn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~x,vi(e,n,x)):(Vt&&c&&Bd(n),n.flags|=1,Nn(e,n,s,x),n.child)}function Zh(e,n,s,c,x){if(zn(s)){var _=!0;ql(n)}else _=!1;if(Rs(n,x),n.stateNode===null)cu(e,n),Rh(n,s,c),Xd(n,s,c,x),c=!0;else if(e===null){var M=n.stateNode,q=n.memoizedProps;M.props=q;var Y=M.context,ue=s.contextType;typeof ue=="object"&&ue!==null?ue=mr(ue):(ue=zn(s)?So:Cn.current,ue=ks(n,ue));var ye=s.getDerivedStateFromProps,we=typeof ye=="function"||typeof M.getSnapshotBeforeUpdate=="function";we||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(q!==c||Y!==ue)&&Fh(n,M,c,ue),Xi=!1;var ve=n.memoizedState;M.state=ve,tu(n,c,M,x),Y=n.memoizedState,q!==c||ve!==Y||jn.current||Xi?(typeof ye=="function"&&(Yd(n,s,ye,c),Y=n.memoizedState),(q=Xi||Dh(n,s,q,c,ve,Y,ue))?(we||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(n.flags|=4194308)):(typeof M.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=Y),M.props=c,M.state=Y,M.context=ue,c=q):(typeof M.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{M=n.stateNode,sh(e,n),q=n.memoizedProps,ue=n.type===n.elementType?q:Sr(n.type,q),M.props=ue,we=n.pendingProps,ve=M.context,Y=s.contextType,typeof Y=="object"&&Y!==null?Y=mr(Y):(Y=zn(s)?So:Cn.current,Y=ks(n,Y));var Re=s.getDerivedStateFromProps;(ye=typeof Re=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(q!==we||ve!==Y)&&Fh(n,M,c,Y),Xi=!1,ve=n.m
Line truncated
|
||||
`)}function js(r,a,o){const l=Math.floor(Date.now()/1e3);return{id:-Date.now(),type:"PRIV",conversation_key:r,text:a,sender_timestamp:l,received_at:l,paths:null,txt_type:0,signature:null,outgoing:o,acked:1}}function Qv(r){const a=F.useRef(null),o=F.useRef(null),l=F.useCallback(()=>{o.current!==null&&(clearInterval(o.current),o.current=null),a.current=null},[]),d=F.useCallback(async()=>{const p=a.current;if(!p)return;let h=null,g=null;for(let m=0;m<2;m++)try{h=await Je.requestTelemetry(p.conversationId,"");break}catch(v){g=v instanceof Error?v:new Error("Unknown error"),m===0&&await new Promise(y=>setTimeout(y,2e3))}if(h){const m=js(p.conversationId,Kv(p,h),!1);r(v=>[...v,m])}else{const m=js(p.conversationId,`Duty cycle poll failed after retry: ${(g==null?void 0:g.message)??"Unknown error"}`,!1);r(v=>[...v,m])}},[r]),f=F.useCallback(async(p,h)=>{const g=p.trim().toLowerCase();if(g==="dutycycle_start"){l();let m=null,v=null;for(let P=0;P<2;P++)try{m=await Je.requestTelemetry(h,"");break}catch(D){v=D instanceof Error?D:new Error("Unknown error"),P===0&&await new Promise(C=>setTimeout(C,2e3))}if(!m){const P=js(h,`Failed to start duty cycle tracking after retry: ${(v==null?void 0:v.message)??"Unknown error"}`,!1);return r(D=>[...D,P]),!0}const y=Math.floor(Date.now()/1e3);a.current={startTime:y,uptime:m.uptime_seconds,txAirtime:m.airtime_seconds,rxAirtime:m.rx_airtime_seconds,sentFlood:m.sent_flood,sentDirect:m.sent_direct,recvFlood:m.recv_flood,recvDirect:m.recv_direct,conversationId:h};const w=js(h,`Airtime/duty cycle statistics gathering begins at ${y}. Logs will follow every 5 minutes. To stop, run dutycycle_stop or navigate away from this conversation.`,!1);return r(P=>[...P,w]),o.current=window.setInterval(d,qv),!0}if(g==="dutycycle_stop"){if(a.current&&a.current.conversationId===h){await d(),l();const m=js(h,"Airtime/duty cycle statistics gathering stopped.",!1);r(v=>[...v,m])}else{const m=js(h,"Duty cycle tracking is not active.",!1);r(v=>[...v,m])}return!0}return!1},[r,l,d]);return F.useEffect(()=>()=>{o.current!==null&&clearInterval(o.current)},[]),{handleAirtimeCommand:f,stopTracking:l}}function Hu(r){if(r<60)return`${r}s`;const a=Math.floor(r/86400),o=Math.floor(r%86400/3600),l=Math.floor(r%3600/60);return a>0?o>0&&l>0?`${a}d${o}h${l}m`:o>0?`${a}d${o}h`:l>0?`${a}d${l}m`:`${a}d`:o>0?l>0?`${o}h${l}m`:`${o}h`:`${l}m`}function $v(r){return["Telemetry",`Battery Voltage: ${r.battery_volts.toFixed(3)}V`,`Uptime: ${Hu(r.uptime_seconds)}`,`TX Airtime: ${Hu(r.airtime_seconds)}`,`RX Airtime: ${Hu(r.rx_airtime_seconds)}`,"",`Noise Floor: ${r.noise_floor_dbm} dBm`,`Last RSSI: ${r.last_rssi_dbm} dBm`,`Last SNR: ${r.last_snr_db.toFixed(1)} dB`,"",`Packets: ${r.packets_received.toLocaleString()} rx / ${r.packets_sent.toLocaleString()} tx`,`Flood: ${r.recv_flood.toLocaleString()} rx / ${r.sent_flood.toLocaleString()} tx`,`Direct: ${r.recv_direct.toLocaleString()} rx / ${r.sent_direct.toLocaleString()} tx`,`Duplicates: ${r.flood_dups.toLocaleString()} flood / ${r.direct_dups.toLocaleString()} direct`,"",`TX Queue: ${r.tx_queue_len}`,`Debug Flags: ${r.full_events}`].join(`
|
||||
`)}function Yv(r){if(r.length===0)return`Neighbors
|
||||
No neighbors reported`;const a=[...r].sort((l,d)=>d.snr-l.snr),o=[`Neighbors (${a.length})`];for(const l of a){const d=l.name||l.pubkey_prefix,f=l.snr>=0?`+${l.snr.toFixed(1)}`:l.snr.toFixed(1);o.push(`${d}, ${f} dB [${Hu(l.last_heard_seconds)} ago]`)}return o.join(`
|
||||
`)}function Xv(r){if(r.length===0)return`ACL
|
||||
No ACL entries`;const a=[`ACL (${r.length})`];for(const o of r){const l=o.name||o.pubkey_prefix;a.push(`${l}: ${o.permission_name}`)}return a.join(`
|
||||
`)}function jo(r,a,o,l=0){const d=Math.floor(Date.now()/1e3);return{id:-Date.now()-l,type:"PRIV",conversation_key:r,text:a,sender_timestamp:d,received_at:d,paths:null,txt_type:0,signature:null,outgoing:o,acked:1}}function Jv(r,a,o){const[l,d]=F.useState(!1),{handleAirtimeCommand:f,stopTracking:p}=Qv(o);F.useEffect(()=>{d(!1),p()},[r==null?void 0:r.id,p]);const h=F.useMemo(()=>{if(!r||r.type!=="contact")return!1;const v=a.find(y=>y.public_key===r.id);return(v==null?void 0:v.type)===jc},[r,a]),g=F.useCallback(async v=>{if(!(!r||r.type!=="contact")&&h)try{const y=await Je.requestTelemetry(r.id,v),w=jo(r.id,$v(y),!1,0),P=jo(r.id,Yv(y.neighbors),!1,1),D=jo(r.id,Xv(y.acl),!1,2);o(C=>[...C,w,P,D]),d(!0)}catch(y){const w=jo(r.id,`Telemetry request failed: ${y instanceof Error?y.message:"Unknown error"}`,!1,0);o(P=>[...P,w])}},[r,h,o]),m=F.useCallback(async v=>{if(!r||r.type!=="contact"||!h||!l||await f(v,r.id))return;const w=jo(r.id,`> ${v}`,!0,0);o(P=>[...P,w]);try{const P=await Je.sendRepeaterCommand(r.id,v),D=jo(r.id,P.response,!1,1);P.sender_timestamp&&(D.sender_timestamp=P.sender_timestamp),o(C=>[...C,D])}catch(P){const D=jo(r.id,`Command failed: ${P instanceof Error?P.message:"Unknown error"}`,!1,1);o(C=>[...C,D])}},[r,h,l,o,f]);return{repeaterLoggedIn:l,activeContactIsRepeater:h,handleTelemetryRequest:g,handleRepeaterCommand:m}}const ey=12;function Ks(r){return r.slice(0,ey)}function zc(r,a){return!r||!a?!1:Ks(r)===Ks(a)}function Ei(r,a){return r||Ks(a)}const zg="remoteterm-lastMessageTime",Hg="remoteterm-sortOrder";let Dc={};function Lp(r){Dc={...r}}function Mp(){return{...Dc}}function Mf(r,a){return Dc[r]=a,{...Dc}}function Rr(r,a){return r==="channel"?`channel-${a}`:`contact-${Ks(a)}`}function ty(){try{const r=localStorage.getItem(zg);return r?JSON.parse(r):{}}catch{return{}}}function ny(){try{return localStorage.getItem(Hg)==="alpha"?"alpha":"recent"}catch{return"recent"}}function Ip(){try{localStorage.removeItem(zg),localStorage.removeItem(Hg)}catch{}}function Op(r,a){if(!a)return!1;const o=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`@\\[${o}\\]`,"i").test(r)}function ry(r,a,o,l=null){const[d,f]=F.useState({}),[p,h]=F.useState({}),[g,m]=F.useState(Mp),v=F.useRef(l);F.useEffect(()=>{v.current=l},[l]);const y=F.useRef(new Set),w=F.useRef(new Set);F.useEffect(()=>{const R=r.filter(N=>!y.current.has(N.key)),T=a.filter(N=>N.public_key&&!w.current.has(N.public_key));if(R.length===0&&T.length===0)return;R.forEach(N=>y.current.add(N.key)),T.forEach(N=>w.current.add(N.public_key)),(async()=>{const N=[...R.map(I=>({type:"CHAN",conversation_key:I.key})),...T.map(I=>({type:"PRIV",conversation_key:I.public_key}))];if(N.length!==0)try{const I=await Je.getMessagesBulk(N,A0),H={},z={},j={};for(const J of R){const W=I[`CHAN:${J.key}`]||[];if(W.length>0){const U=Rr("channel",J.key),te=J.last_read_at||0,X=W.filter(fe=>!fe.outgoing&&fe.received_at>te);X.length>0&&(H[U]=X.length,X.some(fe=>Op(fe.text,v.current))&&(z[U]=!0));const re=Math.max(...W.map(fe=>fe.received_at));j[U]=re,Mf(U,re)}}for(const J of T){const W=I[`PRIV:${J.public_key}`]||[];if(W.length>0){const U=Rr("contact",J.public_key),te=J.last_read_at||0,X=W.filter(fe=>!fe.outgoing&&fe.received_at>te);X.length>0&&(H[U]=X.length,X.some(fe=>Op(fe.text,v.current))&&(z[U]=!0));const re=Math.max(...W.map(fe=>fe.received_at));j[U]=re,Mf(U,re)}}Object.keys(H).length>0&&f(J=>({...J,...H})),Object.keys(z).length>0&&h(J=>({...J,...z})),m(Mp())}catch(I){console.error("Failed to fetch messages bulk:",I)}})()},[r,a]),F.useEffect(()=>{if(o&&o.type!=="raw"&&o.type!=="map"){const R=Rr(o.type,o.id);f(T=>{if(T[R]){const S={...T};return delete S[R],S}return T}),h(T=>{if(T[R]){const S={...T};return delete S[R],S}return T}),o.type==="channel"?Je.markChannelRead(o.id).catch(T=>{console.error("Failed to mark channel as read on server:",T)}):o.type==="contact"&&Je.markContactRead(o.id).catch(T=>{console.error("Failed to mark contact as read on server:",T)})}},[o]);const P=F.useCallback((R,T)=>{f(S=>({...S,[R]:(S[R]||0)+1})),T&&h(S=>({...S,[R]:!0}))},[]),D=F.useCallback(()=>{f({}),h({}),Je.markAllRead().catch(R=>{console.error("Failed to mark all as read on server:",R)})},[]),C=F.useCallback(R=>{if(R.type==="raw"||R.type==="map")return;const T=Rr(R.type,R.id);f(S=>{if(S[T]){const N={...S};return delete N[T],N}return S}),h(S=>{if(S[T]){const N={...S};return delete N[T],N}return S}),R.type==="channel"?Je.markChannelRead(R.id).catch(S=>{console.error("Failed to mark channel as read on server:",S)}):R.type==="contact"&&Je.markContactRead(R.id).catch(S=>{console.error("Failed to mark contact as read on server:",S)})},[]),k=F.useCallback(R=>{let T=null;if(R.type==="CHAN"&&R.conversation_key?T=Rr("channel",R.conversation_key):R.type==="PRIV"&&R.conversation_key&&(T=Rr("contact",R.conversation_key)),T){const S=R.received_at||Math.floor(Date.now()/1e3),N=Mf(T,S);m(N)}},[]);return{unreadCounts:d,mentions:p,lastMessageTimes:g,incrementUnread:P,markAllRead:D,markConversationRead:C,trac
Line truncated
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Fy=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ny=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,o,l)=>l?l.toUpperCase():o.toLowerCase()),Hp=r=>{const a=Ny(r);return a.charAt(0).toUpperCase()+a.slice(1)},Ug=(...r)=>r.filter((a,o,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===o).join(" ").trim(),Ly=r=>{for(const a in r)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/var My={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Iy=F.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:d="",children:f,iconNode:p,...h},g)=>F.createElement("svg",{ref:g,...My,width:a,height:a,stroke:r,strokeWidth:l?Number(o)*24/Number(a):o,className:Ug("lucide",d),...!f&&!Ly(h)&&{"aria-hidden":"true"},...h},[...p.map(([m,v])=>F.createElement(m,v)),...Array.isArray(f)?f:[f]]));/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const v0=(r,a)=>{const o=F.forwardRef(({className:l,...d},f)=>F.createElement(Iy,{ref:f,iconNode:a,className:Ug(`lucide-${Fy(Hp(r))}`,`lucide-${r}`,l),...d}));return o.displayName=Hp(r),o};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Oy=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],jy=v0("check",Oy);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const zy=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Hy=v0("menu",zy);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Vy=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Zg=v0("x",Vy);function Uy({health:r,config:a,onSettingsClick:o,onMenuClick:l}){const d=(r==null?void 0:r.radio_connected)??!1,[f,p]=F.useState(!1),h=async()=>{p(!0);try{const g=await Je.reconnectRadio();g.connected&&xt.success("Reconnected",{description:g.message})}catch(g){xt.error("Reconnection failed",{description:g instanceof Error?g.message:"Check radio connection and power"})}finally{p(!1)}};return b.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[#252525] border-b border-[#333] text-xs",children:[l&&b.jsx("button",{onClick:l,className:"md:hidden p-1 bg-transparent border-none text-[#e0e0e0] cursor-pointer","aria-label":"Open menu",children:b.jsx(Hy,{className:"h-5 w-5"})}),b.jsx("h1",{className:"text-base font-semibold mr-auto",children:"RemoteTerm"}),b.jsxs("div",{className:"flex items-center gap-1 text-[#888]",children:[b.jsx("div",{className:`w-2 h-2 rounded-full ${d?"bg-[#4caf50]":"bg-[#666]"}`}),b.jsx("span",{className:"hidden lg:inline text-[#e0e0e0]",children:d?"Connected":"Disconnected"})]}),a&&b.jsxs("div",{className:"hidden lg:flex items-center gap-2 text-[#888]",children:[b.jsx("span",{className:"text-[#e0e0e0]",children:a.name||"Unnamed"}),b.jsx("span",{className:"font-mono text-[#888] cursor-pointer hover:text-[#4a9eff]",onClick:()=>{navigator.clipboard.writeText(a.public_key),xt.success("Public key copied!")},title:"Click to copy public key",children:a.public_key.toLowerCase()})]}),!d&&b.jsx("button",{onClick:h,disabled:f,className:"px-3 py-1 bg-[#4a3000] border border-[#6b4500] text-[#ffa500] rounded text-xs cursor-pointer hover:bg-[#5a3a00] disabled:opacity-50 disabled:cursor-not-allowed",children:f?"Reconnecting...":"Reconnect"}),b.jsxs("button",{onClick:o,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",children:[b.jsx("span",{role:"img","aria-label":"Settings",children:"🔧"})," ","Radio & Config"]})]})}const e0=2,Zy={text:"🛜",background:"#444444",textColor:"#ffffff"};function Wy(r){let a=0;for(let o=0;o<r.length;o++){const l=r.charCodeAt(o);a=(a<<5)-a+l,a=a&a}return Math.abs(a)}const qy=/[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{1F600}-\u{1F64F}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]/u;function Gy(r,a){if(!r)return a.slice(0,2).toUpperCase();const o=r.match(qy);if(o)return o[0];const l=r.match(/[a-zA-Z]/g);if(!l||l.length===0)return a.slice(0,2).toUpperCase();const d=r.indexOf(" ");if(d!==-1){const f=l[0],p=r.slice(d+1).match(/[a-zA-Z]/);if(p)return(f+p[0]).toUpperCase()}return l[0].toUpperCase()}function Ky(r){const a=Wy(r),o=a%360,l=50+(a>>8)%30,d=35+(a>>16)%20,f=`hsl(${o}, ${l}%, ${d}%)`,p=d<45?"#ffffff":"#000000";return{background:f,text:p}}function Qy(r,a,o){if(o===e0)return Zy;const l=Gy(r,a),d=Ky(a);return{text:l,background:d.background,textColor:d.text}}function t0({name:r,publicKey:a,size:o=28,contactType:l}){const d=Qy(r,a,l);return b.jsx("div",{className:"flex items-center justify-center rounded-full font-semibold flex-shrink-0 select-none",style:{backgroundColor:d.background,color:d.textColor,width:o,height:o,fontSize:o*.45},children:d.text})}const Wg="remoteterm-favorites";function Zs(r,a,o){return r.some(l=>l.type!==a?!1:a==="contact"?zc(l.id,o):l.id===o)}function $y(){try{const r=localStorage.getItem(Wg);return r?JSON.parse(r):[]}catch{return[]}}function Vp(){try{localStorage.removeItem(Wg)}catch{}}function qg(r){var a,o,l="";if(typeof r=="string"||typeof r=="number")l+=r;else if(typeof r=="object")if(Array.isArray(r)){var d=r.length;for(a=0;a<d;a++)r[a]&&(o=qg(r[a]))&&(l&&(l+=" "),l+=o)}else for(o in r)r[o]&&(l&&(l+=" "),l+=o);return l}function Gg(){for(var r,a,o=0,l="",d=arguments.length;o<d;o++)(r=arguments[o])&&(a=qg(r))&&(l&&(l+=" "),l+=a);return l}const Yy=(r,a)=>{const o=new Array(r.length+a.length);for(let l=0;l<r.length;l++)o[l]=r[l];for(let l=0;l<a.length;l++)o[r.length+l]=a[l];return o},Xy=(r,a)=>({classGroupId:r,validator:a}),Kg=(r=new Map,a=null,o)=>({nextPart:r,validators:a,classGroupId:o}),Rc="-",Up=[],Jy="arbitrary..",e_=r=>{const a=n_(r),{conflictingClassGroups:o,conflictingClassGroupModifiers:l}=r;return{getClassGroupId:p=>{if(p.startsWith("[")&&p.endsWith("]"))return t_(p);const h=p.split(Rc),g=h[0]===""&&h.length>1?1:0;return Qg(h,g,a)},getConflictingClassGroupIds:(p,h)=>{if(h){const g=l[p],m=o[p];return g?m?Yy(m,g):g:m||Up}return o[p]||Up}}},Qg=(r,a,o)=>{if(r.length-a===0)return o.classGroupId;const d=r[a],f=o.nextPart.get(d);if(f){const m=Qg(r,a+1,f);if(m)return m}const p=o.validators;if(p===null)return;const h=a===0?r.join(Rc):r.slice(a).join(Rc),g=p.length;for(let m=0;m<g;m++){const v=p[m];if(v.validator(h))return v.classGroupId}},t_=r=>r.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=r.slice(1,-1),o=a.indexOf(":"),l=a.slice(0,o);return l?Jy+l:void 0})(),n_=r=>{const{theme:a,classGroups:o}=r;return r_(o,a)},r_=(r,a)=>{const o=Kg();for(cLine truncated
|
||||
.`.concat(O1,` {
|
||||
overflow: hidden `).concat(l,`;
|
||||
padding-right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
body[`).concat(qs,`] {
|
||||
overflow: hidden `).concat(l,`;
|
||||
overscroll-behavior: contain;
|
||||
`).concat([a&&"position: relative ".concat(l,";"),o==="margin"&&`
|
||||
padding-left: `.concat(d,`px;
|
||||
padding-top: `).concat(f,`px;
|
||||
padding-right: `).concat(p,`px;
|
||||
margin-left:0;
|
||||
margin-top:0;
|
||||
margin-right: `).concat(h,"px ").concat(l,`;
|
||||
`),o==="padding"&&"padding-right: ".concat(h,"px ").concat(l,";")].filter(Boolean).join(""),`
|
||||
}
|
||||
|
||||
.`).concat(Uu,` {
|
||||
right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Zu,` {
|
||||
margin-right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Uu," .").concat(Uu,` {
|
||||
right: 0 `).concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Zu," .").concat(Zu,` {
|
||||
margin-right: 0 `).concat(l,`;
|
||||
}
|
||||
|
||||
body[`).concat(qs,`] {
|
||||
`).concat(j1,": ").concat(h,`px;
|
||||
}
|
||||
`)},sm=function(){var r=parseInt(document.body.getAttribute(qs)||"0",10);return isFinite(r)?r:0},iw=function(){F.useEffect(function(){return document.body.setAttribute(qs,(sm()+1).toString()),function(){var r=sm()-1;r<=0?document.body.removeAttribute(qs):document.body.setAttribute(qs,r.toString())}},[])},ow=function(r){var a=r.noRelative,o=r.noImportant,l=r.gapMode,d=l===void 0?"margin":l;iw();var f=F.useMemo(function(){return tw(d)},[d]);return F.createElement(nw,{styles:rw(f,!a,d,o?"":"!important")})},i0=!1;if(typeof window<"u")try{var Iu=Object.defineProperty({},"passive",{get:function(){return i0=!0,!0}});window.addEventListener("test",Iu,Iu),window.removeEventListener("test",Iu,Iu)}catch{i0=!1}var Hs=i0?{passive:!1}:!1,sw=function(r){return r.tagName==="TEXTAREA"},AA=function(r,a){if(!(r instanceof Element))return!1;var o=window.getComputedStyle(r);return o[a]!=="hidden"&&!(o.overflowY===o.overflowX&&!sw(r)&&o[a]==="visible")},aw=function(r){return AA(r,"overflowY")},lw=function(r){return AA(r,"overflowX")},am=function(r,a){var o=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var d=xA(r,l);if(d){var f=vA(r,l),p=f[1],h=f[2];if(p>h)return!0}l=l.parentNode}while(l&&l!==o.body);return!1},uw=function(r){var a=r.scrollTop,o=r.scrollHeight,l=r.clientHeight;return[a,o,l]},cw=function(r){var a=r.scrollLeft,o=r.scrollWidth,l=r.clientWidth;return[a,o,l]},xA=function(r,a){return r==="v"?aw(a):lw(a)},vA=function(r,a){return r==="v"?uw(a):cw(a)},dw=function(r,a){return r==="h"&&a==="rtl"?-1:1},fw=function(r,a,o,l,d){var f=dw(r,window.getComputedStyle(a).direction),p=f*l,h=o.target,g=a.contains(h),m=!1,v=p>0,y=0,w=0;do{if(!h)break;var P=vA(r,h),D=P[0],C=P[1],k=P[2],R=C-k-f*D;(D||R)&&xA(r,h)&&(y+=R,w+=D);var T=h.parentNode;h=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!g&&h!==document.body||g&&(a.contains(h)||a===h));return(v&&Math.abs(y)<1||!v&&Math.abs(w)<1)&&(m=!0),m},Ou=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},lm=function(r){return[r.deltaX,r.deltaY]},um=function(r){return r&&"current"in r?r.current:r},hw=function(r,a){return r[0]===a[0]&&r[1]===a[1]},pw=function(r){return`
|
||||
.block-interactivity-`.concat(r,` {pointer-events: none;}
|
||||
.allow-interactivity-`).concat(r,` {pointer-events: all;}
|
||||
`)},mw=0,Vs=[];function gw(r){var a=F.useRef([]),o=F.useRef([0,0]),l=F.useRef(),d=F.useState(mw++)[0],f=F.useState(gA)[0],p=F.useRef(r);F.useEffect(function(){p.current=r},[r]),F.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(d));var C=I1([r.lockRef.current],(r.shards||[]).map(um),!0).filter(Boolean);return C.forEach(function(k){return k.classList.add("allow-interactivity-".concat(d))}),function(){document.body.classList.remove("block-interactivity-".concat(d)),C.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(d))})}}},[r.inert,r.lockRef.current,r.shards]);var h=F.useCallback(function(C,k){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!p.current.allowPinchZoom;var R=Ou(C),T=o.current,S="deltaX"in C?C.deltaX:T[0]-R[0],N="deltaY"in C?C.deltaY:T[1]-R[1],I,H=C.target,z=Math.abs(S)>Math.abs(N)?"h":"v";if("touches"in C&&z==="h"&&H.type==="range")return!1;var j=window.getSelection(),J=j&&j.anchorNode,W=J?J===H||J.contains(H):!1;if(W)return!1;var U=am(z,H);if(!U)return!0;if(U?I=z:(I=z==="v"?"h":"v",U=am(z,H)),!U)return!1;if(!l.current&&"changedTouches"in C&&(S||N)&&(l.current=I),!I)return!0;var te=l.current||I;return fw(te,k,C,te==="h"?S:N)},[]),g=F.useCallback(function(C){var k=C;if(!(!Vs.length||Vs[Vs.length-1]!==f)){var R="deltaY"in k?lm(k):Ou(k),T=a.current.filter(function(I){return I.name===k.type&&(I.target===k.target||k.target===I.shadowParent)&&hw(I.delta,R)})[0];if(T&&T.should){k.cancelable&&k.preventDefault();return}if(!T){var S=(p.current.shards||[]).map(um).filter(Boolean).filter(function(I){return I.contains(k.target)}),N=S.length>0?h(k,S[0]):!p.current.noIsolation;N&&k.cancelable&&k.preventDefault()}}},[]),m=F.useCallback(function(C,k,R,T){var S={name:C,delta:k,target:R,should:T,shadowParent:Aw(R)};a.current.push(S),setTimeout(function(){a.current=a.current.filter(function(N){return N!==S})},1)},[]),v=F.useCallback(function(C){o.current=Ou(C),l.current=void 0},[]),y=F.useCallback(function(C){m(C.type,lm(C),C.target,h(C,r.lockRef.current))},[]),w=F.useCallback(function(C){m(C.type,Ou(C),C.target,h(C,r.lockRef.current))},[]);F.useEffect(function(){return Vs.push(f),r.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:w}),document.addEventListener("wheel",g,Hs),document.addEventListener("touchmove",g,Hs),document.addEventListener("touchstart",v,Hs),function(){Vs=Vs.filter(function(C){return C!==f}),document.removeEventListener("wheel",g,Hs),document.removeEventListener("touchmove",g,Hs),document.removeEventListener("touchstart",v,Hs)}},[]);var P=r.removeScrollBar,D=r.inert;return F.createElement(F.Fragment,null,D?F.createElement(f,{styles:pw(d)}):null,P?F.createElement(ow,{noRelative:r.noRelative,gapMode:r.gapMode}):null)}function Aw(r){for(var a=null;r!==null;)r instanceof ShadowRoot&&(a=r.host,r=r.host),r=r.parentNode;return a}const xw=q1(mA,gw);var yA=F.forwardRef(function(r,a){return F.createElement(Vc,Yr({},r,{ref:a,sideCar:xw}))});yA.classNames=Vc.classNames;var vw=function(r){if(typeof document>"u")return null;var a=Array.isArray(r)?r[0]:r;return a.ownerDocument.body},Us=new WeakMap,ju=new WeakMap,zu={},Wf=0,_A=function(r){return r&&(r.host||_A(r.parentNode))},yw=function(r,a){return a.map(function(o){if(r.contains(o))return o;var l=_A(o);return l&&r.contains(l)?l:(console.error("aria-hidden",o,"in not contained inside",r,". Doing nothing"),null)}).filter(function(o){return!!o})},_w=function(r,a,o,l){var d=yw(a,Array.isArray(r)?r:[r]);zu[o]||(zu[o]=new WeakMap);var f=zu[o],p=[],h=new Set,g=new Set(d),m=function(y){!y||h.has(y)||(h.add(y),m(y.parentNode))};d.forEach(m);var v=function(y){!y||g.has(y)||Array.prototype.forEach.call(y.children,function(w){if(h.has(w))v(w);else try{var P=w.getAttribute(l),D=P!==null&&P!=="false",C=(Us.get(w)||0)+1,k=(f.get(w)||0)+1;Us.set(w,C),f.set(w,k),p.push(w),C===1&&D&&ju.set(w,!0),k===1&&w.setAttribute(o,"true"),D||w.setAttribute(l,"true")}catch(R){console.error("aria-hidden: cannot operate on ",w,R)}})};return v(a),h.clear(),Wf++,function(){p.forEach(function(y){var w=Us.get(y)-1,P=f.get(y)-1;Us.set(y,w),f.set(y,P),w||(ju.has(y)||y.removeAttribute(l),ju.delete(y)),P||y.removeAttribute(o)}),Wf--,Wf||(Us=new WeakMap,Us=new WeakMap,ju=new WeakMap,zu={})}},ww=function(r,a,o){o===void 0&&(o="data-aria-hidden");var l=Array.from(Array.isArray(r)?r:[r]),d=vw(r);return d?(l.push.apply(l,Array.from(d.querySelectorAll("[aria-live], script"))),_w(l,d,o,"aria-hidden")):function(){return null}};function bw(r){const a=Cw(r),o=F.forwardRef((l,d)=>{const{children:f,...p}=l,h=F.Children.toArray(f),g=h.find(kw);if(g){const m=g.props.children,v=h.map(y=>y===g?F.Children.count(m)>1?F.Children.only(null):F.isValidElement(m)?m.props.children:null:y);return b.jsx(a,{...p,ref:d,children:F.isValidElement(m)?F.cloneElement(m,void 0,v):null})}return b.jsx(a,{...p,ref:d,children:f})});return o.displayName=`${r}.Slot`,o}function Cw(r){const a=F.forwardRef((o,l)=>{const{childre
Line truncated
|
||||
|
||||
If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||||
|
||||
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return F.useEffect(()=>{r&&(document.getElementById(r)||console.error(o))},[o,r]),null},Iw="DialogDescriptionWarning",Ow=({contentRef:r,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${MA(Iw).contentName}}.`;return F.useEffect(()=>{var f;const d=(f=r.current)==null?void 0:f.getAttribute("aria-describedby");a&&d&&(document.getElementById(a)||console.warn(l))},[l,r,a]),null},IA=bA,OA=kA,Zc=SA,Wc=BA,qc=TA,Gc=RA,jA=NA;const k0=IA,jw=OA,zA=F.forwardRef(({className:r,...a},o)=>b.jsx(Zc,{ref:o,className:lt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...a}));zA.displayName=Zc.displayName;const Kc=F.forwardRef(({className:r,children:a,...o},l)=>b.jsxs(jw,{children:[b.jsx(zA,{}),b.jsxs(Wc,{ref:l,className:lt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...o,children:[a,b.jsxs(jA,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[b.jsx(Zg,{className:"h-4 w-4"}),b.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Kc.displayName=Wc.displayName;const Qc=({className:r,...a})=>b.jsx("div",{className:lt("flex flex-col space-y-1.5 text-center sm:text-left",r),...a});Qc.displayName="DialogHeader";const S0=({className:r,...a})=>b.jsx("div",{className:lt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",r),...a});S0.displayName="DialogFooter";const $c=F.forwardRef(({className:r,...a},o)=>b.jsx(qc,{ref:o,className:lt("text-lg font-semibold leading-none tracking-tight",r),...a}));$c.displayName=qc.displayName;const Yc=F.forwardRef(({className:r,...a},o)=>b.jsx(Gc,{ref:o,className:lt("text-sm text-muted-foreground",r),...a}));Yc.displayName=Gc.displayName;function zw(){const r=window.location.hash.slice(1);if(!r)return null;if(r==="raw")return{type:"raw",name:"raw"};if(r==="map")return{type:"map",name:"map"};if(r.startsWith("map/focus/")){const d=r.slice(10);return d?{type:"map",name:"map",mapFocusKey:decodeURIComponent(d)}:{type:"map",name:"map"}}const a=r.indexOf("/");if(a===-1)return null;const o=r.slice(0,a),l=decodeURIComponent(r.slice(a+1));return(o==="channel"||o==="contact")&&l?{type:o,name:l}:null}function HA(r){return`#map/focus/${encodeURIComponent(r)}`}function Hw(r){if(!r)return"";if(r.type==="raw")return"#raw";if(r.type==="map")return"#map";const a=r.type==="channel"&&r.name.startsWith("#")?r.name.slice(1):r.name;return`#${r.type}/${encodeURIComponent(a)}`}function Vw(r){const a=Hw(r);a!==window.location.hash&&window.history.replaceState(null,"",a||window.location.pathname)}function Uw({open:r,onClose:a,paths:o,senderInfo:l,contacts:d,config:f}){const p=o.map(g=>({...g,resolved:e1(g.path,l,d,f)})),h=o.length===1;return b.jsx(k0,{open:r,onOpenChange:g=>!g&&a(),children:b.jsxs(Kc,{className:"max-w-md max-h-[80vh] flex flex-col",children:[b.jsxs(Qc,{children:[b.jsxs($c,{children:["Message Path",!h&&`s (${o.length})`]}),b.jsx(Yc,{children:h?b.jsxs(b.Fragment,{children:["This shows ",b.jsx("em",{children:"one route"})," that this message traveled through the mesh network. Routers may be incorrectly identified due to prefix collisions between heard and non-heard router advertisements."]}):b.jsxs(b.Fragment,{children:["This message was received via ",b.jsxs("strong",{children:[o.length," different routes"]}),". Routers may be incorrectly identified due to prefix collisions."]})})]}),b.jsxs("div",{className:"flex-1 overflow-y-auto py-2 space-y-4",children:[p.map((g,m)=>b.jsxs("div",{children:[!h&&b.jsxs("div",{className:"text-xs text-muted-foreground font-medium mb-2 pb-1 border-b border-border",children:["Path ",m+1," — received ",Qs(g.received_at)]}),b.jsx(Zw,{resolved:g.resolved,senderInfo:l,hideStraightLine:!h})]},m)),!h&&p.length>0&&(()=>{const g=p[0].resolved;return St(g.sender.lat,g.sender.lon)&&St(g.receiver.lat,g.receiver.lon)?b.jsxs("div",{className:"pt-3 mt-1 border-t border-border",children:[b.jsx("span",{className:"text-sm text-muted-foreground",children:"Straight-line distance: "}),b.jsx("span",{className:"text-sm font-medium",children:Ko(Fr(g.sender.lat,g.sender.lon,g.receiver.lat,g.receiver.lon))})]}):null})()]}),b.jsx(S0,{children:b
Line truncated
|
||||
`).map(($,ce,de)=>b.jsxs("span",{children:[Gw($,h),ce<de.length-1&&b.jsx("br",{})]},ce)),!pe&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:Qs(j.sender_timestamp||j.received_at)}),!j.outgoing&&j.paths&&j.paths.length>0&&b.jsx(dm,{paths:j.paths,variant:"inline",onClick:()=>C({paths:j.paths,senderInfo:I(j,W,te)})})]}),j.outgoing&&(j.acked>0?` ✓${j.acked>1?j.acked:""}`:" ?")]})]})]},j.id)})]}),w&&b.jsx("button",{onClick:T,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:b.jsx("polyline",{points:"6 9 12 15 18 9"})})}),D&&b.jsx(Uw,{open:!0,onClose:()=>C(null),paths:D.paths,senderInfo:D.senderInfo,contacts:a,config:g??null})]})}const fm=156,Qw=140,$w=156,Yw=120,Xw=8,Jw=F.forwardRef(function({onSend:a,disabled:o,placeholder:l,isRepeaterMode:d,conversationType:f,senderName:p},h){const[g,m]=F.useState(""),[v,y]=F.useState(!1),w=F.useRef(null);F.useImperativeHandle(h,()=>({appendText:I=>{var H;m(z=>z+I),(H=w.current)==null||H.focus()}}));const P=F.useMemo(()=>{if(f==="contact")return{warningAt:Qw,dangerAt:fm,hardLimit:fm};if(f==="channel"){const I=(p==null?void 0:p.length)??10,H=Math.max(1,$w-I-2);return{warningAt:Yw,dangerAt:Math.max(1,H-Xw),hardLimit:H}}return null},[f,p]),{limitState:D,warningMessage:C}=F.useMemo(()=>{if(!P)return{limitState:"normal",warningMessage:null};const I=g.length;return I>=P.hardLimit?{limitState:"error",warningMessage:"likely truncated by radio"}:I>=P.dangerAt?{limitState:"danger",warningMessage:"may impact multi-repeater hop delivery"}:I>=P.warningAt?{limitState:"warning",warningMessage:"may impact multi-repeater hop delivery"}:{limitState:"normal",warningMessage:null}},[g.length,P]),k=P?P.hardLimit-g.length:0,R=F.useCallback(async I=>{I.preventDefault();const H=g.trim();if(d){if(v||o)return;y(!0);try{await a(H),m("")}catch(z){console.error("Failed to request telemetry:",z),xt.error("Failed to request telemetry",{description:z instanceof Error?z.message:"Check radio connection"});return}finally{y(!1)}setTimeout(()=>{var z;return(z=w.current)==null?void 0:z.focus()},0)}else{if(!H||v||o)return;y(!0);try{await a(H),m("")}catch(z){console.error("Failed to send message:",z),xt.error("Failed to send message",{description:z instanceof Error?z.message:"Check radio connection"});return}finally{y(!1)}setTimeout(()=>{var z;return(z=w.current)==null?void 0:z.focus()},0)}},[g,v,o,a,d]),T=F.useCallback(I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),R(I))},[R]),S=d?!0:g.trim().length>0,N=!d&&P!==null;return b.jsxs("form",{className:"px-4 py-3 border-t border-border flex flex-col gap-1",onSubmit:R,children:[b.jsxs("div",{className:"flex gap-2",children:[b.jsx(tn,{ref:w,type:d?"password":"text",autoComplete:d?"off":void 0,value:g,onChange:I=>m(I.target.value),onKeyDown:T,placeholder:l||(d?"Enter password for admin login...":"Type a message..."),disabled:o||v,className:"flex-1 min-w-0"}),b.jsx(Pn,{type:"submit",disabled:o||v||!S,className:"flex-shrink-0",children:v?d?"Logging in...":"Sending...":d?g.trim()?"Log in with password":"Log in as guest/use repeater ACLs":"Send"})]}),N&&b.jsxs("div",{className:"flex items-center justify-end gap-2 text-xs",children:[b.jsxs("span",{className:lt("tabular-nums",D==="error"||D==="danger"?"text-red-500 font-medium":D==="warning"?"text-yellow-500":"text-muted-foreground"),children:[g.length,"/",P.hardLimit,k<0&&` (${k})`]}),C&&b.jsxs("span",{className:lt(D==="error"?"text-red-500":"text-yellow-500"),children:["— ",C]})]})]})});function hm(r){const a=e2(r),o=F.forwardRef((l,d)=>{const{children:f,...p}=l,h=F.Children.toArray(f),g=h.find(n2);if(g){const m=g.props.children,v=h.map(y=>y===g?F.Children.count(m)>1?F.Children.only(null):F.isValidElement(m)?m.props.children:null:y);return b.jsx(a,{...p,ref:d,children:F.isValidElement(m)?F.cloneElement(m,void 0,v):null})}return b.jsx(a,{...p,ref:d,children:f})});return o.displayName=`${r}.Slot`,o}function e2(r){const a=F.forwardRef((o,l)=>{const{children:d,...f}=o;if(F.isValidElement(d)){const p=i2(d),h=r2(f,d.props);return d.type!==F.Fragment&&(h.ref=l?fl(l,p):p),F.cloneElement(d,h)}return F.Children.count(d)>1?F.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var t2=Symbol("radix.slottable");function n2(r){return F.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===t2}function r2(r,a){const o={...a};for(const l in a){const d=r[l],f=a[l];/^on[A-Z]/.test(l)?d&&f?o[l]=(...h)=>{const g=f(...h);return d(...h),g}:d&&(o[l]=d):l==="style"?o[l]={...d,...f}:l==="className"&&(o[l]=[d,f].filter(Boolean).join(" "))}return{...r,...o}}functio
Line truncated
|
||||
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
|
||||
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
||||
*/var Y2=sl.exports,gm;function X2(){return gm||(gm=1,(function(r,a){(function(o,l){l(a)})(Y2,(function(o){var l="1.9.4";function d(t){var i,u,A,E;for(u=1,A=arguments.length;u<A;u++){E=arguments[u];for(i in E)t[i]=E[i]}return t}var f=Object.create||(function(){function t(){}return function(i){return t.prototype=i,new t}})();function p(t,i){var u=Array.prototype.slice;if(t.bind)return t.bind.apply(t,u.call(arguments,1));var A=u.call(arguments,2);return function(){return t.apply(i,A.length?A.concat(u.call(arguments)):arguments)}}var h=0;function g(t){return"_leaflet_id"in t||(t._leaflet_id=++h),t._leaflet_id}function m(t,i,u){var A,E,O,Q;return Q=function(){A=!1,E&&(O.apply(u,E),E=!1)},O=function(){A?E=arguments:(t.apply(u,arguments),setTimeout(Q,i),A=!0)},O}function v(t,i,u){var A=i[1],E=i[0],O=A-E;return t===A&&u?t:((t-E)%O+O)%O+E}function y(){return!1}function w(t,i){if(i===!1)return t;var u=Math.pow(10,i===void 0?6:i);return Math.round(t*u)/u}function P(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function D(t){return P(t).split(/\s+/)}function C(t,i){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?f(t.options):{});for(var u in i)t.options[u]=i[u];return t.options}function k(t,i,u){var A=[];for(var E in t)A.push(encodeURIComponent(u?E.toUpperCase():E)+"="+encodeURIComponent(t[E]));return(!i||i.indexOf("?")===-1?"?":"&")+A.join("&")}var R=/\{ *([\w_ -]+) *\}/g;function T(t,i){return t.replace(R,function(u,A){var E=i[A];if(E===void 0)throw new Error("No value provided for variable "+u);return typeof E=="function"&&(E=E(i)),E})}var S=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function N(t,i){for(var u=0;u<t.length;u++)if(t[u]===i)return u;return-1}var I="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function H(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var z=0;function j(t){var i=+new Date,u=Math.max(0,16-(i-z));return z=i+u,window.setTimeout(t,u)}var J=window.requestAnimationFrame||H("RequestAnimationFrame")||j,W=window.cancelAnimationFrame||H("CancelAnimationFrame")||H("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function U(t,i,u){if(u&&J===j)t.call(i);else return J.call(window,p(t,i))}function te(t){t&&W.call(window,t)}var X={__proto__:null,extend:d,create:f,bind:p,get lastId(){return h},stamp:g,throttle:m,wrapNum:v,falseFn:y,formatNum:w,trim:P,splitWords:D,setOptions:C,getParamString:k,template:T,isArray:S,indexOf:N,emptyImageUrl:I,requestFn:J,cancelFn:W,requestAnimFrame:U,cancelAnimFrame:te};function re(){}re.extend=function(t){var i=function(){C(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},u=i.__super__=this.prototype,A=f(u);A.constructor=i,i.prototype=A;for(var E in this)Object.prototype.hasOwnProperty.call(this,E)&&E!=="prototype"&&E!=="__super__"&&(i[E]=this[E]);return t.statics&&d(i,t.statics),t.includes&&(fe(t.includes),d.apply(null,[A].concat(t.includes))),d(A,t),delete A.statics,delete A.includes,A.options&&(A.options=u.options?f(u.options):{},d(A.options,t.options)),A._initHooks=[],A.callInitHooks=function(){if(!this._initHooksCalled){u.callInitHooks&&u.callInitHooks.call(this),this._initHooksCalled=!0;for(var O=0,Q=A._initHooks.length;O<Q;O++)A._initHooks[O].call(this)}},i},re.include=function(t){var i=this.prototype.options;return d(this.prototype,t),t.options&&(this.prototype.options=i,this.mergeOptions(t.options)),this},re.mergeOptions=function(t){return d(this.prototype.options,t),this},re.addInitHook=function(t){var i=Array.prototype.slice.call(arguments,1),u=typeof t=="function"?t:function(){this[t].apply(this,i)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(u),this};function fe(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=S(t)?t:[t];for(var i=0;i<t.length;i++)t[i]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var ae={on:function(t,i,u){if(typeof t=="object")for(var A in t)this._on(A,t[A],i);else{t=D(t);for(var E=0,O=t.length;E<O;E++)this._on(t[E],i,u)}return this},off:function(t,i,u){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var A in t)this._off(A,t[A],i);else{t=D(t);for(var E=arguments.length===1,O=0,Q=t.length;O<Q;O++)E?this._off(t[O]):this._off(t[O],i,u)}return this},_on:function(t,i,u,A){if(typeof i!="function"){console.warn("wrong listener type: "+typeof i);return}if(this._listens(t,i,u)===!1){u===this&&(u=void 0);var E={fn:i,ctx:u};A&&(E.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(E)}},_off:function(t,i,u){var A,E,O;if(this._events&&(A=this._events[t],!!A)){if(arguments.length===1){if(this._firingCount)for(E=0,O=A.length;E<O;E++)A[E].fn=y;delete this._events[t];return}if(typeof i!="function"){console.warn("wrong listener type: "+typeof i);return}var Q=this.Line truncated
|
||||
(c) 2012 by Cédric Mesnil. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/return(function(l){var d=o,f=d.lib,p=f.WordArray,h=f.Hasher,g=d.algo,m=p.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),v=p.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),y=p.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),w=p.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),P=p.create([0,1518500249,1859775393,2400959708,2840853838]),D=p.create([1352829926,1548603684,1836072691,2053994217,0]),C=g.RIPEMD160=h.extend({_doReset:function(){this._hash=p.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(H,z){for(var j=0;j<16;j++){var J=z+j,W=H[J];H[J]=(W<<8|W>>>24)&16711935|(W<<24|W>>>8)&4278255360}var U=this._hash.words,te=P.words,X=D.words,re=m.words,fe=v.words,ae=y.words,he=w.words,G,pe,Z,B,V,K,$,ce,de,Se;K=G=U[0],$=pe=U[1],ce=Z=U[2],de=B=U[3],Se=V=U[4];for(var Ae,j=0;j<80;j+=1)Ae=G+H[z+re[j]]|0,j<16?Ae+=k(pe,Z,B)+te[0]:j<32?Ae+=R(pe,Z,B)+te[1]:j<48?Ae+=T(pe,Z,B)+te[2]:j<64?Ae+=S(pe,Z,B)+te[3]:Ae+=N(pe,Z,B)+te[4],Ae=Ae|0,Ae=I(Ae,ae[j]),Ae=Ae+V|0,G=V,V=B,B=I(Z,10),Z=pe,pe=Ae,Ae=K+H[z+fe[j]]|0,j<16?Ae+=N($,ce,de)+X[0]:j<32?Ae+=S($,ce,de)+X[1]:j<48?Ae+=T($,ce,de)+X[2]:j<64?Ae+=R($,ce,de)+X[3]:Ae+=k($,ce,de)+X[4],Ae=Ae|0,Ae=I(Ae,he[j]),Ae=Ae+Se|0,K=Se,Se=de,de=I(ce,10),ce=$,$=Ae;Ae=U[1]+Z+de|0,U[1]=U[2]+B+Se|0,U[2]=U[3]+V+K|0,U[3]=U[4]+G+$|0,U[4]=U[0]+pe+ce|0,U[0]=Ae},_doFinalize:function(){var H=this._data,z=H.words,j=this._nDataBytes*8,J=H.sigBytes*8;z[J>>>5]|=128<<24-J%32,z[(J+64>>>9<<4)+14]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360,H.sigBytes=(z.length+1)*4,this._process();for(var W=this._hash,U=W.words,te=0;te<5;te++){var X=U[te];U[te]=(X<<8|X>>>24)&16711935|(X<<24|X>>>8)&4278255360}return W},clone:function(){var H=h.clone.call(this);return H._hash=this._hash.clone(),H}});function k(H,z,j){return H^z^j}function R(H,z,j){return H&z|~H&j}function T(H,z,j){return(H|~z)^j}function S(H,z,j){return H&j|z&~j}function N(H,z,j){return H^(z|~j)}function I(H,z){return H<<z|H>>>32-z}d.RIPEMD160=h._createHelper(C),d.HmacRIPEMD160=h._createHmacHelper(C)})(),o.RIPEMD160})})(oc)),oc.exports}var sc={exports:{}},Hb=sc.exports,Lm;function id(){return Lm||(Lm=1,(function(r,a){(function(o,l){r.exports=l(mt())})(Hb,function(o){(function(){var l=o,d=l.lib,f=d.Base,p=l.enc,h=p.Utf8,g=l.algo;g.HMAC=f.extend({init:function(m,v){m=this._hasher=new m.init,typeof v=="string"&&(v=h.parse(v));var y=m.blockSize,w=y*4;v.sigBytes>w&&(v=m.finalize(v)),v.clamp();for(var P=this._oKey=v.clone(),D=this._iKey=v.clone(),C=P.words,k=D.words,R=0;R<y;R++)C[R]^=1549556828,k[R]^=909522486;P.sigBytes=D.sigBytes=w,this.reset()},reset:function(){var m=this._hasher;m.reset(),m.update(this._iKey)},update:function(m){return this._hasher.update(m),this},finalize:function(m){var v=this._hasher,y=v.finalize(m);v.reset();var w=v.finalize(this._oKey.clone().concat(y));return w}})})()})})(sc)),sc.exports}var ac={exports:{}},Vb=ac.exports,Mm;function Ub(){return Mm||(Mm=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),ml(),id())})(Vb,function(o){return(function(){var l=o,d=l.lib,f=d.Base,p=d.WordArray,h=l.algo,g=h.SHA256,m=h.HMAC,v=h.PBKDF2=f.extend({cfg:f.extend({keySize:128/32,hasher:g,iterations:25e4}),init:function(y){this.cfg=this.cfg.extend(y)},compute:function(y,w){for(var P=this.cfg,D=m.create(P.hasher,y),C=p.create(),k=p.create([1]),R=C.words,T=k.words,S=P.keySize,N=P.iterations;R.length<S;){var I=D.update(w).finalize(k);D.reset();for(var H=I.words,z=H.length,j=I,J=1;J<N;J++){j=D.finalize(j),D.reset();for(var W=j.words,U=0;U<z;U++)H[U]^=W[U]}C.concat(I),T[0]++}return C.sigBytes=S*4,C}});l.PBKDF2=function(y,w,P){return v.create(P).compute(y,w)}})(),o.PBKDF2})})(ac)),ac.exports}var lc={exports:{}},Zb=lc.exports,Im;function fo(){return Im||(Im=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),Ex(),id())})(Zb,function(o){return(function(){var l=o,d=l.lib,f=d.Base,p=d.WordArray,h=l.algo,g=h.MD5,m=h.EvpKDF=f.extend({cfg:f.extend({keySize:128/32,hasher:g,iterations:1}),init:function(v){this.cfg=this.cfg.extend(v)},compute:function(v,y){for(var w,P=this.cfg,D=P.hasher.create(),C=p.create(),k=C.words,R=P.keySize,T=P.iterations;k.length<R;){w&&D.update(w),w=D.update(v).finalize(y),D.reset();for(var S=1;S<T;S++)w=D.finalize(w),D.reset();C.concat(w)}return C.sigBytes=R*4,C}});l.EvpKDF=function(v,y,w){return m.create(w).compute(v,y)}})(),o.EvpKDF})})(lc)),lc.exports}var uc={exports:{}},Wb=uc.exports,Line truncated
|
||||
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||||
* derived from CryptoJS.mode.CTR
|
||||
* Jan Hruby jhruby.web@gmail.com
|
||||
*/return o.mode.CTRGladman=(function(){var l=o.lib.BlockCipherMode.extend();function d(h){if((h>>24&255)===255){var g=h>>16&255,m=h>>8&255,v=h&255;g===255?(g=0,m===255?(m=0,v===255?v=0:++v):++m):++g,h=0,h+=g<<16,h+=m<<8,h+=v}else h+=1<<24;return h}function f(h){return(h[0]=d(h[0]))===0&&(h[1]=d(h[1])),h}var p=l.Encryptor=l.extend({processBlock:function(h,g){var m=this._cipher,v=m.blockSize,y=this._iv,w=this._counter;y&&(w=this._counter=y.slice(0),this._iv=void 0),f(w);var P=w.slice(0);m.encryptBlock(P,0);for(var D=0;D<v;D++)h[g+D]^=P[D]}});return l.Decryptor=p,l})(),o.mode.CTRGladman})})(fc)),fc.exports}var hc={exports:{}},Xb=hc.exports,Vm;function Jb(){return Vm||(Vm=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),mn())})(Xb,function(o){return o.mode.OFB=(function(){var l=o.lib.BlockCipherMode.extend(),d=l.Encryptor=l.extend({processBlock:function(f,p){var h=this._cipher,g=h.blockSize,m=this._iv,v=this._keystream;m&&(v=this._keystream=m.slice(0),this._iv=void 0),h.encryptBlock(v,0);for(var y=0;y<g;y++)f[p+y]^=v[y]}});return l.Decryptor=d,l})(),o.mode.OFB})})(hc)),hc.exports}var pc={exports:{}},eC=pc.exports,Um;function tC(){return Um||(Um=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),mn())})(eC,function(o){return o.mode.ECB=(function(){var l=o.lib.BlockCipherMode.extend();return l.Encryptor=l.extend({processBlock:function(d,f){this._cipher.encryptBlock(d,f)}}),l.Decryptor=l.extend({processBlock:function(d,f){this._cipher.decryptBlock(d,f)}}),l})(),o.mode.ECB})})(pc)),pc.exports}var mc={exports:{}},nC=mc.exports,Zm;function rC(){return Zm||(Zm=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),mn())})(nC,function(o){return o.pad.AnsiX923={pad:function(l,d){var f=l.sigBytes,p=d*4,h=p-f%p,g=f+h-1;l.clamp(),l.words[g>>>2]|=h<<24-g%4*8,l.sigBytes+=h},unpad:function(l){var d=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=d}},o.pad.Ansix923})})(mc)),mc.exports}var gc={exports:{}},iC=gc.exports,Wm;function oC(){return Wm||(Wm=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),mn())})(iC,function(o){return o.pad.Iso10126={pad:function(l,d){var f=d*4,p=f-l.sigBytes%f;l.concat(o.lib.WordArray.random(p-1)).concat(o.lib.WordArray.create([p<<24],1))},unpad:function(l){var d=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=d}},o.pad.Iso10126})})(gc)),gc.exports}var Ac={exports:{}},sC=Ac.exports,qm;function aC(){return qm||(qm=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),mn())})(sC,function(o){return o.pad.Iso97971={pad:function(l,d){l.concat(o.lib.WordArray.create([2147483648],1)),o.pad.ZeroPadding.pad(l,d)},unpad:function(l){o.pad.ZeroPadding.unpad(l),l.sigBytes--}},o.pad.Iso97971})})(Ac)),Ac.exports}var xc={exports:{}},lC=xc.exports,Gm;function uC(){return Gm||(Gm=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),mn())})(lC,function(o){return o.pad.ZeroPadding={pad:function(l,d){var f=d*4;l.clamp(),l.sigBytes+=f-(l.sigBytes%f||f)},unpad:function(l){for(var d=l.words,f=l.sigBytes-1,f=l.sigBytes-1;f>=0;f--)if(d[f>>>2]>>>24-f%4*8&255){l.sigBytes=f+1;break}}},o.pad.ZeroPadding})})(xc)),xc.exports}var vc={exports:{}},cC=vc.exports,Km;function dC(){return Km||(Km=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),mn())})(cC,function(o){return o.pad.NoPadding={pad:function(){},unpad:function(){}},o.pad.NoPadding})})(vc)),vc.exports}var yc={exports:{}},fC=yc.exports,Qm;function hC(){return Qm||(Qm=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),mn())})(fC,function(o){return(function(l){var d=o,f=d.lib,p=f.CipherParams,h=d.enc,g=h.Hex,m=d.format;m.Hex={stringify:function(v){return v.ciphertext.toString(g)},parse:function(v){var y=g.parse(v);return p.create({ciphertext:y})}}})(),o.format.Hex})})(yc)),yc.exports}var _c={exports:{}},pC=_c.exports,$m;function mC(){return $m||($m=1,(function(r,a){(function(o,l,d){r.exports=l(mt(),Yo(),Xo(),fo(),mn())})(pC,function(o){return(function(){var l=o,d=l.lib,f=d.BlockCipher,p=l.algo,h=[],g=[],m=[],v=[],y=[],w=[],P=[],D=[],C=[],k=[];(function(){for(var S=[],N=0;N<256;N++)N<128?S[N]=N<<1:S[N]=N<<1^283;for(var I=0,H=0,N=0;N<256;N++){var z=H^H<<1^H<<2^H<<3^H<<4;z=z>>>8^z&255^99,h[I]=z,g[z]=I;var j=S[I],J=S[j],W=S[J],U=S[z]*257^z*16843008;m[I]=U<<24|U>>>8,v[I]=U<<16|U>>>16,y[I]=U<<8|U>>>24,w[I]=U;var U=W*16843009^J*65537^j*257^I*16843008;P[z]=U<<24|U>>>8,D[z]=U<<16|U>>>16,C[z]=U<<8|U>>>24,k[z]=U,I?(I=j^S[S[S[W^j]]],H^=S[S[H]]):I=H=1}})();var R=[0,1,2,4,8,16,32,64,128,27,54],T=p.AES=f.extend({_doReset:function(){var S;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var N=this._keyPriorReset=this._key,I=N.words,H=N.sigBytes/4,z=this._nRounds=H+6,j=(z+1)*4,J=this._keySchedule=[],W=0;W<j;W++)W<H?J[W]=I[W]:(S=J[W-1],W%H?H>6&&W%H==4&&(S=h[S>>>24]<<24|h[S>>>16&255]<<16|h[S>>>8&255]<<8|h[S&255]):(S=S<<8|S>>>24,S=h[S>>>24]<<24|h[S>>>16&255]<<16|h[S>>>8&255]<<8|h[S&255],S^=R[W/H|0]<<24),J[W]=J[W-H]^S);for(var U=this._invKeySchedule=[],te=0;te<j;te++){var W=j-te;if(te%4)var S=J[W];else var S=J[W-4];te<4||W<=4?U[te]=S:U[te]=P[h[S>>>24]]^D[h[S>>>16&255]]^C[h[S>>>8&255]]^k[h[S&255]]}}},encryLine truncated
|
||||
• Timestamp (4 bytes) - send time as unix timestamp
|
||||
• Request Type (1 byte) - type of request (GetStats, GetTelemetryData, etc.)
|
||||
• Request Data (remaining bytes) - additional request-specific data`,startByte:h+g,endByte:h+d.length-1,value:w});const P={type:r.PayloadType.Request,version:r.PayloadVersion.Version1,isValid:!0,timestamp:0,requestType:r.RequestType.GetStats,requestData:"",destinationHash:m,sourceHash:v,cipherMac:y,ciphertext:w};return f!=null&&f.includeSegments&&(P.segments=p),P}catch(p){return{type:r.PayloadType.Request,version:r.PayloadVersion.Version1,isValid:!1,errors:[p instanceof Error?p.message:"Failed to decode request payload"],timestamp:0,requestType:r.RequestType.GetStats,requestData:"",destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:""}}}}return Ja.RequestPayloadDecoder=o,Ja}var el={},vg;function YC(){if(vg)return el;vg=1,Object.defineProperty(el,"__esModule",{value:!0}),el.ResponsePayloadDecoder=void 0;const r=sr(),a=vn();class o{static decode(d,f){try{if(d.length<4){const D={type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!1,errors:["Response payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return f!=null&&f.includeSegments&&(D.segments=[{name:"Invalid Response Data",description:"Response payload too short (minimum 4 bytes required)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),D}const p=[],h=(f==null?void 0:f.segmentOffset)||0;let g=0;const m=(0,a.byteToHex)(d[g]);f!=null&&f.includeSegments&&p.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:h+g,endByte:h+g,value:m}),g+=1;const v=(0,a.byteToHex)(d[g]);f!=null&&f.includeSegments&&p.push({name:"Source Hash",description:"First byte of source node public key",startByte:h+g,endByte:h+g,value:v}),g+=1;const y=(0,a.bytesToHex)(d.subarray(g,g+2));f!=null&&f.includeSegments&&p.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:h+g,endByte:h+g+1,value:y}),g+=2;const w=(0,a.bytesToHex)(d.subarray(g));f!=null&&f.includeSegments&&d.length>g&&p.push({name:"Ciphertext",description:"Encrypted response data (tag + content)",startByte:h+g,endByte:h+d.length-1,value:w});const P={type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:m,sourceHash:v,cipherMac:y,ciphertext:w,ciphertextLength:d.length-4};return f!=null&&f.includeSegments&&(P.segments=p),P}catch(p){return{type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!1,errors:[p instanceof Error?p.message:"Failed to decode response payload"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return el.ResponsePayloadDecoder=o,el}var tl={},yg;function XC(){if(yg)return tl;yg=1,Object.defineProperty(tl,"__esModule",{value:!0}),tl.AnonRequestPayloadDecoder=void 0;const r=sr(),a=vn();class o{static decode(d,f){try{if(d.length<35){const D={type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!1,errors:["AnonRequest payload too short (minimum 35 bytes: dest + public key + MAC)"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return f!=null&&f.includeSegments&&(D.segments=[{name:"Invalid AnonRequest Data",description:"AnonRequest payload too short (minimum 35 bytes required: 1 for dest hash + 32 for public key + 2 for MAC)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),D}const p=[],h=(f==null?void 0:f.segmentOffset)||0;let g=0;const m=(0,a.byteToHex)(d[0]);f!=null&&f.includeSegments&&p.push({name:"Destination Hash",description:`First byte of destination node public key: 0x${m}`,startByte:h+g,endByte:h+g,value:m}),g+=1;const v=(0,a.bytesToHex)(d.subarray(1,33));f!=null&&f.includeSegments&&p.push({name:"Sender Public Key",description:"Ed25519 public key of the sender (32 bytes)",startByte:h+g,endByte:h+g+31,value:v}),g+=32;const y=(0,a.bytesToHex)(d.subarray(33,35));f!=null&&f.includeSegments&&p.push({name:"Cipher MAC",description:"MAC for encrypted data verification (2 bytes)",startByte:h+g,endByte:h+g+1,value:y}),g+=2;const w=(0,a.bytesToHex)(d.subarray(35));f!=null&&f.includeSegments&&d.length>35&&p.push({name:"Ciphertext",description:`Encrypted message data (${d.length-35} bytes). Contains encrypted plaintext with this structure:
|
||||
• Timestamp (4 bytes) - send time as unix timestamp
|
||||
• Sync Timestamp (4 bytes) - room server only, sender's "sync messages SINCE x" timestamp
|
||||
• Password (remaining bytes) - password for repeater/room`,startByte:h+g,endByte:h+d.length-1,value:w});const P={type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:m,senderPublicKey:v,cipherMac:y,ciphertext:w,ciphertextLength:d.length-35};return f!=null&&f.includeSegments&&(P.segments=p),P}catch(p){return{type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!1,errors:[p instanceof Error?p.message:"Failed to decode AnonRequest payload"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return tl.AnonRequestPayloadDecoder=o,tl}var nl={},_g;function JC(){if(_g)return nl;_g=1,Object.defineProperty(nl,"__esModule",{value:!0}),nl.AckPayloadDecoder=void 0;const r=sr(),a=vn();class o{static decode(d,f){try{if(d.length<4){const v={type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!1,errors:["Ack payload too short (minimum 4 bytes for checksum)"],checksum:""};return f!=null&&f.includeSegments&&(v.segments=[{name:"Invalid Ack Data",description:"Ack payload too short (minimum 4 bytes required for checksum)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),v}const p=[],h=(f==null?void 0:f.segmentOffset)||0,g=(0,a.bytesToHex)(d.subarray(0,4));f!=null&&f.includeSegments&&p.push({name:"Checksum",description:`CRC checksum of message timestamp, text, and sender pubkey: 0x${g}`,startByte:h,endByte:h+3,value:g}),f!=null&&f.includeSegments&&d.length>4&&p.push({name:"Additional Data",description:"Extra data in Ack payload",startByte:h+4,endByte:h+d.length-1,value:(0,a.bytesToHex)(d.subarray(4))});const m={type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!0,checksum:g};return f!=null&&f.includeSegments&&(m.segments=p),m}catch(p){return{type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!1,errors:[p instanceof Error?p.message:"Failed to decode Ack payload"],checksum:""}}}}return nl.AckPayloadDecoder=o,nl}var rl={},wg;function eE(){if(wg)return rl;wg=1,Object.defineProperty(rl,"__esModule",{value:!0}),rl.PathPayloadDecoder=void 0;const r=sr(),a=vn();class o{static decode(d){try{if(d.length<2)return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:["Path payload too short (minimum 2 bytes: path length + extra type)"],pathLength:0,pathHashes:[],extraType:0,extraData:""};const f=d[0];if(d.length<1+f+1)return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:[`Path payload too short (need ${1+f+1} bytes for path length + path + extra type)`],pathLength:f,pathHashes:[],extraType:0,extraData:""};const p=[];for(let m=0;m<f;m++)p.push((0,a.byteToHex)(d[1+m]));const h=d[1+f];let g="";return d.length>1+f+1&&(g=(0,a.bytesToHex)(d.subarray(1+f+1))),{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!0,pathLength:f,pathHashes:p,extraType:h,extraData:g}}catch(f){return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:[f instanceof Error?f.message:"Failed to decode Path payload"],pathLength:0,pathHashes:[],extraType:0,extraData:""}}}}return rl.PathPayloadDecoder=o,rl}var il={},bg;function tE(){if(bg)return il;bg=1,Object.defineProperty(il,"__esModule",{value:!0}),il.TextMessagePayloadDecoder=void 0;const r=sr(),a=vn();class o{static decode(d,f){try{if(d.length<4){const D={type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,isValid:!1,errors:["TextMessage payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return f!=null&&f.includeSegments&&(D.segments=[{name:"Invalid TextMessage Data",description:"TextMessage payload too short (minimum 4 bytes required)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),D}const p=[],h=(f==null?void 0:f.segmentOffset)||0;let g=0;const m=(0,a.byteToHex)(d[g]);f!=null&&f.includeSegments&&p.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:h+g,endByte:h+g,value:m}),g+=1;const v=(0,a.byteToHex)(d[g]);f!=null&&f.includeSegments&&p.push({name:"Source Hash",description:"First byte of source node public key",startByte:h+g,endByte:h+g,value:v}),g+=1;const y=(0,a.bytesToHex)(d.subarray(g,g+2));f!=null&&f.includeSegments&&p.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:h+g,endByte:h+g+1,value:y}),g+=2;const w=(0,a.bytesToHex)(d.subarray(g));f!=null&&f.includeSegments&&d.length>g&&p.push({name:"Ciphertext",description:"Encrypted message data (timestamp + message text)",startByte:h+g,endByte:h+d.length-1,value:w});const P={type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:m,sourceHash:v,cipherMac:y,ciphertext:w,ciphertextLength:d.length-4};return f!=null&&f.includeSegments&&(P.segments=p),P}catch(p){return{type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,i
Line truncated
|
||||
// SHA256 round constants
|
||||
const K: array<u32, 64> = array<u32, 64>(
|
||||
0x428a2f98u, 0x71374491u, 0xb5c0fbcfu, 0xe9b5dba5u, 0x3956c25bu, 0x59f111f1u, 0x923f82a4u, 0xab1c5ed5u,
|
||||
0xd807aa98u, 0x12835b01u, 0x243185beu, 0x550c7dc3u, 0x72be5d74u, 0x80deb1feu, 0x9bdc06a7u, 0xc19bf174u,
|
||||
0xe49b69c1u, 0xefbe4786u, 0x0fc19dc6u, 0x240ca1ccu, 0x2de92c6fu, 0x4a7484aau, 0x5cb0a9dcu, 0x76f988dau,
|
||||
0x983e5152u, 0xa831c66du, 0xb00327c8u, 0xbf597fc7u, 0xc6e00bf3u, 0xd5a79147u, 0x06ca6351u, 0x14292967u,
|
||||
0x27b70a85u, 0x2e1b2138u, 0x4d2c6dfcu, 0x53380d13u, 0x650a7354u, 0x766a0abbu, 0x81c2c92eu, 0x92722c85u,
|
||||
0xa2bfe8a1u, 0xa81a664bu, 0xc24b8b70u, 0xc76c51a3u, 0xd192e819u, 0xd6990624u, 0xf40e3585u, 0x106aa070u,
|
||||
0x19a4c116u, 0x1e376c08u, 0x2748774cu, 0x34b0bcb5u, 0x391c0cb3u, 0x4ed8aa4au, 0x5b9cca4fu, 0x682e6ff3u,
|
||||
0x748f82eeu, 0x78a5636fu, 0x84c87814u, 0x8cc70208u, 0x90befffau, 0xa4506cebu, 0xbef9a3f7u, 0xc67178f2u
|
||||
);
|
||||
|
||||
// Character lookup table (a-z = 0-25, 0-9 = 26-35, dash = 36)
|
||||
const CHARS: array<u32, 37> = array<u32, 37>(
|
||||
0x61u, 0x62u, 0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6au, // a-j
|
||||
0x6bu, 0x6cu, 0x6du, 0x6eu, 0x6fu, 0x70u, 0x71u, 0x72u, 0x73u, 0x74u, // k-t
|
||||
0x75u, 0x76u, 0x77u, 0x78u, 0x79u, 0x7au, // u-z
|
||||
0x30u, 0x31u, 0x32u, 0x33u, 0x34u, 0x35u, 0x36u, 0x37u, 0x38u, 0x39u, // 0-9
|
||||
0x2du // dash
|
||||
);
|
||||
|
||||
struct Params {
|
||||
target_channel_hash: u32,
|
||||
batch_offset: u32,
|
||||
name_length: u32,
|
||||
batch_size: u32,
|
||||
target_mac: u32, // First 2 bytes of target MAC (in high 16 bits)
|
||||
ciphertext_words: u32, // Number of 32-bit words in ciphertext
|
||||
ciphertext_len_bits: u32, // Length of ciphertext in bits
|
||||
verify_mac: u32, // 1 to verify MAC, 0 to skip
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> params: Params;
|
||||
@group(0) @binding(1) var<storage, read_write> match_count: atomic<u32>;
|
||||
@group(0) @binding(2) var<storage, read_write> match_indices: array<u32>;
|
||||
@group(0) @binding(3) var<storage, read> ciphertext: array<u32>; // Ciphertext data
|
||||
|
||||
fn rotr(x: u32, n: u32) -> u32 {
|
||||
return (x >> n) | (x << (32u - n));
|
||||
}
|
||||
|
||||
fn ch(x: u32, y: u32, z: u32) -> u32 {
|
||||
return (x & y) ^ (~x & z);
|
||||
}
|
||||
|
||||
fn maj(x: u32, y: u32, z: u32) -> u32 {
|
||||
return (x & y) ^ (x & z) ^ (y & z);
|
||||
}
|
||||
|
||||
fn sigma0(x: u32) -> u32 {
|
||||
return rotr(x, 2u) ^ rotr(x, 13u) ^ rotr(x, 22u);
|
||||
}
|
||||
|
||||
fn sigma1(x: u32) -> u32 {
|
||||
return rotr(x, 6u) ^ rotr(x, 11u) ^ rotr(x, 25u);
|
||||
}
|
||||
|
||||
fn gamma0(x: u32) -> u32 {
|
||||
return rotr(x, 7u) ^ rotr(x, 18u) ^ (x >> 3u);
|
||||
}
|
||||
|
||||
fn gamma1(x: u32) -> u32 {
|
||||
return rotr(x, 17u) ^ rotr(x, 19u) ^ (x >> 10u);
|
||||
}
|
||||
|
||||
// Convert index to room name bytes, returns the hash as a u32 for the first byte check
|
||||
fn index_to_room_name(idx: u32, length: u32, msg: ptr<function, array<u32, 16>>) -> bool {
|
||||
// Message starts with '#' (0x23)
|
||||
var byte_pos = 0u;
|
||||
var word_idx = 0u;
|
||||
var current_word = 0x23000000u; // '#' in big-endian position 0
|
||||
byte_pos = 1u;
|
||||
|
||||
var remaining = idx;
|
||||
var prev_was_dash = false;
|
||||
|
||||
// Generate room name from index
|
||||
for (var i = 0u; i < length; i++) {
|
||||
let char_count = select(37u, 36u, i == 0u || i == length - 1u); // no dash at start/end
|
||||
var char_idx = remaining % char_count;
|
||||
remaining = remaining / char_count;
|
||||
|
||||
// Check for consecutive dashes (invalid)
|
||||
let is_dash = char_idx == 36u && i > 0u && i < length - 1u;
|
||||
if (is_dash && prev_was_dash) {
|
||||
return false; // Invalid: consecutive dashes
|
||||
}
|
||||
prev_was_dash = is_dash;
|
||||
|
||||
// Map char index to actual character
|
||||
let c = CHARS[char_idx];
|
||||
|
||||
// Pack byte into current word (big-endian)
|
||||
let shift = (3u - byte_pos % 4u) * 8u;
|
||||
if (byte_pos % 4u == 0u && byte_pos > 0u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
current_word = 0u;
|
||||
}
|
||||
current_word = current_word | (c << shift);
|
||||
byte_pos = byte_pos + 1u;
|
||||
}
|
||||
|
||||
// Add padding: 0x80 followed by zeros, then length in bits
|
||||
let msg_len_bits = (length + 1u) * 8u; // +1 for '#'
|
||||
|
||||
// Add 0x80 padding byte
|
||||
let shift = (3u - byte_pos % 4u) * 8u;
|
||||
if (byte_pos % 4u == 0u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
current_word = 0x80000000u;
|
||||
} else {
|
||||
current_word = current_word | (0x80u << shift);
|
||||
}
|
||||
byte_pos = byte_pos + 1u;
|
||||
|
||||
// Store current word
|
||||
if (byte_pos % 4u == 0u || word_idx < 14u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
}
|
||||
|
||||
// Zero-fill until word 14
|
||||
for (var i = word_idx; i < 14u; i++) {
|
||||
(*msg)[i] = 0u;
|
||||
}
|
||||
|
||||
// Length in bits (64-bit, but we only use lower 32 bits for short messages)
|
||||
(*msg)[14u] = 0u;
|
||||
(*msg)[15u] = msg_len_bits;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
fn sha256_block(msg: ptr<function, array<u32, 16>>) -> array<u32, 8> {
|
||||
// Initialize hash values
|
||||
var h: array<u32, 8> = array<u32, 8>(
|
||||
0x6a09e667u, 0xbb67ae85u, 0x3c6ef372u, 0xa54ff53au,
|
||||
0x510e527fu, 0x9b05688cu, 0x1f83d9abu, 0x5be0cd19u
|
||||
);
|
||||
|
||||
// Message schedule
|
||||
var w: array<u32, 64>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
w[i] = (*msg)[i];
|
||||
}
|
||||
for (var i = 16u; i < 64u; i++) {
|
||||
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
|
||||
}
|
||||
|
||||
// Compression
|
||||
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
|
||||
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
|
||||
|
||||
for (var i = 0u; i < 64u; i++) {
|
||||
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
|
||||
let t2 = sigma0(a) + maj(a, b, c);
|
||||
hh = g; g = f; f = e; e = d + t1;
|
||||
d = c; c = b; b = a; a = t1 + t2;
|
||||
}
|
||||
|
||||
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
|
||||
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
// Compute SHA256 of the key (16 bytes) to get channel hash
|
||||
fn sha256_key(key: array<u32, 4>) -> u32 {
|
||||
var msg: array<u32, 16>;
|
||||
|
||||
// Key bytes (16 bytes = 4 words)
|
||||
msg[0] = key[0];
|
||||
msg[1] = key[1];
|
||||
msg[2] = key[2];
|
||||
msg[3] = key[3];
|
||||
|
||||
// Padding: 0x80 followed by zeros
|
||||
msg[4] = 0x80000000u;
|
||||
for (var i = 5u; i < 14u; i++) {
|
||||
msg[i] = 0u;
|
||||
}
|
||||
|
||||
// Length: 128 bits
|
||||
msg[14] = 0u;
|
||||
msg[15] = 128u;
|
||||
|
||||
let hash = sha256_block(&msg);
|
||||
|
||||
// Return first byte of hash (big-endian)
|
||||
return hash[0] >> 24u;
|
||||
}
|
||||
|
||||
// HMAC-SHA256 for MAC verification
|
||||
// Key is 16 bytes (4 words), padded to 32 bytes with zeros for MeshCore
|
||||
// Returns first 2 bytes of HMAC (as u32 in high 16 bits)
|
||||
fn hmac_sha256_mac(key: array<u32, 4>, ciphertext_len: u32) -> u32 {
|
||||
// HMAC: H((K' ^ opad) || H((K' ^ ipad) || message))
|
||||
// K' is 64 bytes (32 bytes key + 32 bytes zero padding for MeshCore, then padded to 64)
|
||||
// ipad = 0x36 repeated, opad = 0x5c repeated
|
||||
|
||||
// Build padded key (64 bytes = 16 words)
|
||||
// MeshCore uses 32-byte secret: 16-byte key + 16 zero bytes
|
||||
var k_pad: array<u32, 16>;
|
||||
k_pad[0] = key[0];
|
||||
k_pad[1] = key[1];
|
||||
k_pad[2] = key[2];
|
||||
k_pad[3] = key[3];
|
||||
for (var i = 4u; i < 16u; i++) {
|
||||
k_pad[i] = 0u;
|
||||
}
|
||||
|
||||
// Inner hash: SHA256((K' ^ ipad) || message)
|
||||
// First block: K' ^ ipad (64 bytes)
|
||||
var inner_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
inner_block[i] = k_pad[i] ^ 0x36363636u;
|
||||
}
|
||||
|
||||
// Initialize hash state with first block
|
||||
var h: array<u32, 8> = sha256_block(&inner_block);
|
||||
|
||||
// Process ciphertext blocks (continuing from h state)
|
||||
let ciphertext_words = params.ciphertext_words;
|
||||
var word_idx = 0u;
|
||||
|
||||
// Process full 64-byte blocks of ciphertext
|
||||
while (word_idx + 16u <= ciphertext_words) {
|
||||
var block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
block[i] = ciphertext[word_idx + i];
|
||||
}
|
||||
h = sha256_block_continue(&block, h);
|
||||
word_idx = word_idx + 16u;
|
||||
}
|
||||
|
||||
// Final block with remaining ciphertext + padding
|
||||
var final_block: array<u32, 16>;
|
||||
var remaining = ciphertext_words - word_idx;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
if (i < remaining) {
|
||||
final_block[i] = ciphertext[word_idx + i];
|
||||
} else if (i == remaining) {
|
||||
// Add 0x80 padding
|
||||
final_block[i] = 0x80000000u;
|
||||
} else {
|
||||
final_block[i] = 0u;
|
||||
}
|
||||
}
|
||||
|
||||
// Add length (64 bytes of ipad + ciphertext length)
|
||||
let total_bits = 512u + params.ciphertext_len_bits;
|
||||
if (remaining < 14u) {
|
||||
final_block[14] = 0u;
|
||||
final_block[15] = total_bits;
|
||||
h = sha256_block_continue(&final_block, h);
|
||||
} else {
|
||||
// Need extra block for length
|
||||
h = sha256_block_continue(&final_block, h);
|
||||
var len_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 14u; i++) {
|
||||
len_block[i] = 0u;
|
||||
}
|
||||
len_block[14] = 0u;
|
||||
len_block[15] = total_bits;
|
||||
h = sha256_block_continue(&len_block, h);
|
||||
}
|
||||
|
||||
let inner_hash = h;
|
||||
|
||||
// Outer hash: SHA256((K' ^ opad) || inner_hash)
|
||||
var outer_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
outer_block[i] = k_pad[i] ^ 0x5c5c5c5cu;
|
||||
}
|
||||
h = sha256_block(&outer_block);
|
||||
|
||||
// Second block: inner_hash (32 bytes) + padding
|
||||
var hash_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 8u; i++) {
|
||||
hash_block[i] = inner_hash[i];
|
||||
}
|
||||
hash_block[8] = 0x80000000u;
|
||||
for (var i = 9u; i < 14u; i++) {
|
||||
hash_block[i] = 0u;
|
||||
}
|
||||
hash_block[14] = 0u;
|
||||
hash_block[15] = 512u + 256u; // 64 bytes opad + 32 bytes inner hash
|
||||
|
||||
h = sha256_block_continue(&hash_block, h);
|
||||
|
||||
// Return first 2 bytes (high 16 bits of first word)
|
||||
return h[0] & 0xFFFF0000u;
|
||||
}
|
||||
|
||||
// SHA256 block computation continuing from existing state
|
||||
fn sha256_block_continue(msg: ptr<function, array<u32, 16>>, h_in: array<u32, 8>) -> array<u32, 8> {
|
||||
var h = h_in;
|
||||
|
||||
// Message schedule
|
||||
var w: array<u32, 64>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
w[i] = (*msg)[i];
|
||||
}
|
||||
for (var i = 16u; i < 64u; i++) {
|
||||
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
|
||||
}
|
||||
|
||||
// Compression
|
||||
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
|
||||
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
|
||||
|
||||
for (var i = 0u; i < 64u; i++) {
|
||||
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
|
||||
let t2 = sigma0(a) + maj(a, b, c);
|
||||
hh = g; g = f; f = e; e = d + t1;
|
||||
d = c; c = b; b = a; a = t1 + t2;
|
||||
}
|
||||
|
||||
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
|
||||
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
// Process a single candidate and record match if found
|
||||
fn process_candidate(name_idx: u32) {
|
||||
// Generate message for this room name
|
||||
var msg: array<u32, 16>;
|
||||
let valid = index_to_room_name(name_idx, params.name_length, &msg);
|
||||
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute SHA256("#roomname") - this gives us the key
|
||||
let key_hash = sha256_block(&msg);
|
||||
|
||||
// Take first 16 bytes (4 words) as the key
|
||||
var key: array<u32, 4>;
|
||||
key[0] = key_hash[0];
|
||||
key[1] = key_hash[1];
|
||||
key[2] = key_hash[2];
|
||||
key[3] = key_hash[3];
|
||||
|
||||
// Compute SHA256(key) to get channel hash
|
||||
let channel_hash = sha256_key(key);
|
||||
|
||||
// Check if channel hash matches target
|
||||
if (channel_hash != params.target_channel_hash) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Channel hash matches - verify MAC if enabled
|
||||
if (params.verify_mac == 1u) {
|
||||
let computed_mac = hmac_sha256_mac(key, params.ciphertext_len_bits);
|
||||
if (computed_mac != params.target_mac) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Found a match - record the index
|
||||
let match_idx = atomicAdd(&match_count, 1u);
|
||||
if (match_idx < 1024u) { // Limit stored matches
|
||||
match_indices[match_idx] = name_idx;
|
||||
}
|
||||
}
|
||||
|
||||
// Each thread processes 32 candidates to amortize thread overhead
|
||||
const CANDIDATES_PER_THREAD: u32 = 32u;
|
||||
|
||||
@compute @workgroup_size(256)
|
||||
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
||||
let base_idx = global_id.x * CANDIDATES_PER_THREAD;
|
||||
|
||||
for (var i = 0u; i < CANDIDATES_PER_THREAD; i++) {
|
||||
let idx = base_idx + i;
|
||||
if (idx >= params.batch_size) {
|
||||
return;
|
||||
}
|
||||
let name_idx = params.batch_offset + idx;
|
||||
process_candidate(name_idx);
|
||||
}
|
||||
}
|
||||
`}async init(){if(!navigator.gpu)return console.warn("WebGPU not supported"),!1;try{const a=await navigator.gpu.requestAdapter();if(!a)return console.warn("No GPU adapter found"),!1;this.device=await a.requestDevice(),this.bindGroupLayout=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]}),this.paramsBuffer=this.device.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.matchCountBuffer=this.device.createBuffer({size:4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}),this.matchIndicesBuffer=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC});for(let d=0;d<2;d++)this.matchCountReadBuffers[d]=this.device.createBuffer({size:4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.matchIndicesReadBuffers[d]=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});const o=this.device.createShaderModule({code:this.shaderCode}),l=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]});return this.pipeline=this.device.createComputePipeline({layout:l,compute:{module:o,entryPoint:"main"}}),!0}catch(a){return console.error("WebGPU initialization failed:",a),!1}}isAvailable(){return this.device!==null&&this.pipeline!==null}indexToRoomName(a,o){return Go(o,a)}countNamesForLength(a){return al(a)}async runBatch(a,o,l,d,f,p){if(!this.device||!this.pipeline||!this.bindGroupLayout||!this.paramsBuffer||!this.matchCountBuffer||!this.matchIndicesBuffer||!this.matchCountReadBuffers[0]||!this.matchCountReadBuffers[1]||!this.matchIndicesReadBuffers[0]||!this.matchIndicesReadBuffers[1])throw new Error("GPU not initialized");const h=this.currentReadBufferIndex;this.currentReadBufferIndex=1-this.currentReadBufferIndex;const g=this.matchCountReadBuffers[h],m=this.matchIndicesReadBuffers[h],v=f&&p?1:0;let y,w=0,P=0;if(v){const I=new Uint8Array(f.length/2);for(let W=0;W<I.length;W++)I[W]=parseInt(f.substr(W*2,2),16);w=I.length*8;const H=Math.ceil(I.length/4)*4,z=new Uint8Array(H);z.set(I),y=new Uint32Array(H/4);for(let W=0;W<y.length;W++)y[W]=z[W*4]<<24|z[W*4+1]<<16|z[W*4+2]<<8|z[W*4+3];const j=parseInt(p.substr(0,2),16),J=parseInt(p.substr(2,2),16);P=j<<24|J<<16}else y=new Uint32Array([0]);const D=Math.max(y.length*4,4);(!this.ciphertextBuffer||this.ciphertextBufferSize<D)&&(this.ciphertextBuffer&&this.ciphertextBuffer.destroy(),this.ciphertextBuffer=this.device.createBuffer({size:D,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.ciphertextBufferSize=D,this.bindGroupDirty=!0);const C=new Uint32Array([a,l,o,d,P,y.length,w,v]);this.device.queue.writeBuffer(this.paramsBuffer,0,C),this.device.queue.writeBuffer(this.ciphertextBuffer,0,y),this.device.queue.writeBuffer(this.matchCountBuffer,0,sd.ZERO_DATA),(this.bindGroupDirty||!this.bindGroup)&&(this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:[{binding:0,resource:{buffer:this.paramsBuffer}},{binding:1,resource:{buffer:this.matchCountBuffer}},{binding:2,resource:{buffer:this.matchIndicesBuffer}},{binding:3,resource:{buffer:this.ciphertextBuffer}}]}),this.bindGroupDirty=!1);const k=this.device.createCommandEncoder(),R=k.beginComputePass();R.setPipeline(this.pipeline),R.setBindGroup(0,this.bindGroup),R.dispatchWorkgroups(Math.ceil(d/(256*32))),R.end(),k.copyBufferToBuffer(this.matchCountBuffer,0,g,0,4),k.copyBufferToBuffer(this.matchIndicesBuffer,0,m,0,1024*4),this.device.queue.submit([k.finish()]),await g.mapAsync(GPUMapMode.READ);const S=new Uint32Array(g.getMappedRange())[0];g.unmap();const N=[];if(S>0){await m.mapAsync(GPUMapMode.READ);const I=new Uint32Array(m.getMappedRange());for(let H=0;H<Math.min(S,1024);H++)N.push(I[H]);m.unmap()}return N}destroy(){var a,o,l,d,f,p,h,g;(a=this.paramsBuffer)==null||a.destroy(),(o=this.matchCountBuffer)==null||o.destroy(),(l=this.matchIndicesBuffer)==null||l.destroy(),(d=this.ciphertextBuffer)==null||d.destroy(),(f=this.matchCountReadBuffers[0])==null||f.destroy(),(p=this.matchCountReadBuffers[1])==null||p.destroy(),(h=this.matchIndicesReadBuffers[0])==null||h.destroy(),(g=this.matchIndicesReadBuffers[1])==null||g.destroy(),this.paramsBuffer=null,this.matchCountBuffer=null,this.matchIndicesBuffer=null,this.ciphertextBuffer=null,this.ciphertextBufferSize=0,this.matchCountReadBuffers=[null,null],this.matchIndicesReadBuffers=[null,null],this.currentReadBufferIndex=0,this.bindGroup=null,this.bindGroupDirty=!0,this.device&&(this.device.destroy(),this.device=null),this.pipeline=null,this.bindGroupLayout=null}}sd.ZERO_DATA=new Uint32Array([0]);function mE(){return typeof navigator<"u"&&"gpu"in navigator}class Fg{runBatch(a,o,l,d,f,p){const h=[],g=a.toString(16).padStart(2,"0")
Line truncated
|
||||
`).map(f=>f.trim().toLowerCase()).filter(f=>f.length>0);this.wordlist=d.filter(Ng)}setWordlist(a){this.wordlist=a.map(o=>o.trim().toLowerCase()).filter(Ng)}abort(){this.abortFlag=!0}isGpuAvailable(){return mE()}async decodePacket(a){var l;const o=a.trim().replace(/\s+/g,"").replace(/^0x/i,"");if(!o||!/^[0-9a-fA-F]+$/.test(o))return null;try{const f=(l=(await Tg.MeshCorePacketDecoder.decodeWithVerification(o,{})).payload)==null?void 0:l.decoded;return!(f!=null&&f.channelHash)||!(f!=null&&f.ciphertext)||!(f!=null&&f.cipherMac)?null:{channelHash:f.channelHash,ciphertext:f.ciphertext,cipherMac:f.cipherMac,isGroupText:!0}}catch{return null}}async crack(a,o,l){this.abortFlag=!1,this.useTimestampFilter=(o==null?void 0:o.useTimestampFilter)??!0,this.useUtf8Filter=(o==null?void 0:o.useUtf8Filter)??!0,this.useSenderFilter=(o==null?void 0:o.useSenderFilter)??!0,this.validSeconds=(o==null?void 0:o.validSeconds)??f0,this.useCpu=(o==null?void 0:o.forceCpu)??!1;const d=(o==null?void 0:o.maxLength)??8,f=(o==null?void 0:o.startingLength)??1,p=(o==null?void 0:o.useDictionary)??!0,h=(o==null?void 0:o.startFromType)??"bruteforce",g=a.toLowerCase(),m=await this.decodePacket(g);if(!m)return{found:!1,error:"Invalid packet or not a GroupText packet"};const{channelHash:v,ciphertext:y,cipherMac:w}=m,P=parseInt(v,16);this.useCpu?this.cpuInstance||(this.cpuInstance=new Fg):this.gpuInstance||(this.gpuInstance=new sd,await this.gpuInstance.init()||(this.useCpu=!0,this.cpuInstance=new Fg));const D=performance.now();let C=0,k=performance.now(),R=f,T=0,S=0,N=!1;if(o!=null&&o.startFrom){const X=o.startFrom.toLowerCase();if(h==="dictionary"){const re=this.wordlist.indexOf(X);re>=0&&(S=re+1)}else{N=!0;const re=fE(X);re&&(R=Math.max(f,re.length),T=re.index+1,T>=al(R)&&(R++,T=0))}}let I=0;p&&!N&&this.wordlist.length>0&&(I+=this.wordlist.length-S);for(let X=R;X<=d;X++)I+=al(X);I-=T;const H=(X,re,fe)=>{if(!l)return;const he=(performance.now()-D)/1e3,G=he>0?Math.round(C/he):0,pe=I-C,Z=G>0?pe/G:0;l({checked:C,total:I,percent:I>0?Math.min(100,C/I*100):0,rateKeysPerSec:G,etaSeconds:Z,elapsedSeconds:he,currentLength:re,currentPosition:fe,phase:X})},z=X=>{if(!Gx(y,w,X))return{valid:!1};const re=Tg.ChannelCrypto.decryptGroupTextMessage(y,w,X);return!re.success||!re.data?{valid:!1}:this.useTimestampFilter&&!hE(re.data.timestamp,this.validSeconds)?{valid:!1}:this.useUtf8Filter&&!pE(re.data.message)?{valid:!1}:this.useSenderFilter&&!re.data.sender?{valid:!1}:{valid:!0,message:re.data.sender?`${re.data.sender}: ${re.data.message}`:re.data.message}};if(!N&&S===0&&R===f&&T===0){H("public-key",0,d0);const X=p0(Tc);if(v===X){const re=z(Tc);if(re.valid)return{found:!0,roomName:d0,key:Tc,decryptedMessage:re.message}}}if(p&&!N&&this.wordlist.length>0)for(let X=S;X<this.wordlist.length;X++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:this.wordlist[X],resumeType:"dictionary"};const re=this.wordlist[X],fe=h0("#"+re),ae=p0(fe);if(parseInt(ae,16)===P){const G=z(fe);if(G.valid)return{found:!0,roomName:re,key:fe,decryptedMessage:G.message,resumeFrom:re,resumeType:"dictionary"}}C++;const he=performance.now();he-k>=200&&(H("wordlist",re.length,re),k=he,await new Promise(G=>setTimeout(G,0)))}const j=this.useCpu?1024:32768,J=(o==null?void 0:o.gpuDispatchMs)??1e3;let W=j,U=!1;for(let X=R;X<=d;X++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Go(X,0)||void 0,resumeType:"bruteforce"};const re=al(X);let fe=X===R?T:0;for(;fe<re;){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Go(X,fe)||void 0,resumeType:"bruteforce"};const ae=Math.min(W,re-fe),he=performance.now();let G;this.useCpu?G=this.cpuInstance.runBatch(P,X,fe,ae,y,w):G=await this.gpuInstance.runBatch(P,X,fe,ae,y,w);const pe=performance.now()-he;if(C+=ae,!this.useCpu&&!U&&ae>=j&&pe>0){const B=J/pe,V=Math.round(ae*B),K=Math.pow(2,Math.round(Math.log2(Math.max(j,V))));W=Math.max(j,K),U=!0}for(const B of G){const V=Go(X,B);if(!V)continue;const K=h0("#"+V),$=z(K);if($.valid)return{found:!0,roomName:V,key:K,decryptedMessage:$.message,resumeFrom:V,resumeType:"bruteforce"}}fe+=ae;const Z=performance.now();if(Z-k>=200){const B=Go(X,Math.min(fe,re-1))||"";H("bruteforce",X,B),k=Z,await new Promise(V=>setTimeout(V,0))}}}return{found:!1,resumeFrom:Go(d,al(d)-1)||void 0,resumeType:"bruteforce"}}destroy(){this.gpuInstance&&(this.gpuInstance.destroy(),this.gpuInstance=null),this.cpuInstance&&(this.cpuInstance.destroy(),this.cpuInstance=null)}}var Yf,Lg;function yE(){return Lg||(Lg=1,Yf={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAA
Line truncated
|
||||
NoSleep enabled for older iOS devices. This can interrupt
|
||||
active or long-running network requests from completing successfully.
|
||||
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
|
||||
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(h=>(this.enabled=!0,h)).catch(h=>{throw this.enabled=!1,h})}disable(){l()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):o()?this.noSleepTimer&&(console.warn(`
|
||||
NoSleep now disabled for older iOS devices.
|
||||
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return Xf=d,Xf}var wE=_E();const bE=Xs(wE);function CE(r){if(r.length<4)return null;try{const o=parseInt(r.slice(0,2),16)&3;let l=2;if(o===0||o===3){if(r.length<l+8)return null;l+=8}if(r.length<l+2)return null;const d=parseInt(r.slice(l,l+2),16);l+=2;const f=d*2;return r.length<l+f?null:(l+=f,r.slice(l))}catch{return null}}function EE({packets:r,channels:a,onChannelCreate:o,onRunningChange:l,visible:d=!1}){const[f,p]=F.useState(!1),[h,g]=F.useState(6),[m,v]=F.useState(!1),[y,w]=F.useState(!0),[P,D]=F.useState(!1),[C,k]=F.useState(null),[R,T]=F.useState(new Map),[S,N]=F.useState([]),[I,H]=F.useState(!1),[z,j]=F.useState(null),[J,W]=F.useState(null),[U,te]=F.useState(0),X=F.useRef(null),re=F.useRef(null),fe=F.useRef(!1),ae=F.useRef(!1),he=F.useRef(!1),G=F.useRef(new Map),pe=F.useRef(!1),Z=F.useRef(6),B=F.useRef(!0),V=F.useRef(!1),K=F.useRef(new Set),$=F.useRef(new Set);F.useEffect(()=>{const Be=new vE;X.current=Be,j(Be.isGpuAvailable());const Ze=new bE;return re.current=Ze,()=>{Be.destroy(),X.current=null,Ze.disable(),re.current=null}},[]),F.useEffect(()=>{!d||I||Ab(async()=>{const{ENGLISH_WORDLIST:Be}=await import("./wordlist-BtmChKSf.js");return{ENGLISH_WORDLIST:Be}},[]).then(({ENGLISH_WORDLIST:Be})=>{X.current&&(X.current.setWordlist(Be),H(!0))}).catch(Be=>{console.error("Failed to load wordlist:",Be),xt.error("Failed to load wordlist",{description:"Cracking will not be available"})})},[d,I]),F.useEffect(()=>{const Be=()=>{Je.getUndecryptedPacketCount().then(({count:ct})=>W(ct)).catch(()=>W(null))};Be();const Ze=setInterval(Be,3e4);return()=>clearInterval(Ze)},[]);const ce=F.useMemo(()=>new Set(a.map(Be=>Be.key.toUpperCase())),[a]),de=r.filter(Be=>Be.payload_type==="GROUP_TEXT"&&!Be.decrypted);F.useEffect(()=>{let Be=0;T(Ze=>{const ct=new Map(Ze);let Mt=!1;for(const st of de)if(!ct.has(st.id)){const gt=CE(st.data);if(gt&&$.current.has(gt)){Be++;continue}gt&&$.current.add(gt),ct.set(st.id,{packet:st,attempts:0,lastAttemptLength:0,status:"pending"}),Mt=!0}return Mt?(G.current=ct,ct):Ze}),Be>0&&te(Ze=>Ze+Be)},[de.length]),F.useEffect(()=>{G.current=R},[R]),F.useEffect(()=>{pe.current=m},[m]),F.useEffect(()=>{Z.current=h},[h]),F.useEffect(()=>{B.current=y},[y]),F.useEffect(()=>{V.current=P},[P]),F.useEffect(()=>{K.current=new Set(de.map(Be=>Be.id))},[de]),F.useEffect(()=>{l==null||l(f)},[f,l]);const Se=Array.from(R.values()).filter(Be=>Be.status==="pending").length,Ae=Array.from(R.values()).filter(Be=>Be.status==="cracked").length,Ue=Array.from(R.values()).filter(Be=>Be.status==="failed").length,$e=F.useCallback(async()=>{if(he.current||!X.current||!fe.current)return;const Be=G.current;let Ze=null,ct=null;for(const[qe,et]of Be.entries())if(et.status==="pending"){Ze=et,ct=qe;break}if(!Ze&&pe.current){const qe=Array.from(Be.entries()).filter(([,et])=>et.status==="failed"&&et.lastAttemptLength<10);qe.length>0&&(qe.sort((et,tt)=>et[1].lastAttemptLength-tt[1].lastAttemptLength),[ct,Ze]=qe[0])}if(!Ze||ct===null){fe.current&&setTimeout(()=>$e(),1e3);return}if(!K.current.has(ct)){T(qe=>{const et=new Map(qe);return et.delete(ct),et}),fe.current&&setTimeout(()=>$e(),10);return}he.current=!0;const Mt=Z.current,st=Ze.lastAttemptLength>0,gt=st?Ze.lastAttemptLength+1:Mt;try{const qe=await X.current.crack(Ze.packet.data,{maxLength:gt,useSenderFilter:!0,useTimestampFilter:!0,useUtf8Filter:!0,...V.current&&{gpuDispatchMs:1e4},...st&&{useDictionary:!1,startingLength:gt}},et=>{k(et)});if(ae.current){ae.current=!1,he.current=!1,k(null);return}if(qe.found&&qe.roomName&&qe.key){T(He=>{const Ct=new Map(He),Ce=Ct.get(ct);return Ce&&Ct.set(ct,{...Ce,status:"cracked",attempts:Ce.attempts+1,lastAttemptLength:gt}),Ct});const et={roomName:qe.roomName,key:qe.key,packetId:ct,message:qe.decryptedMessage||"",crackedAt:Date.now()};N(He=>[...He,et]);const tt=qe.key.toUpperCase();if(!ce.has(tt))try{const He="#"+qe.roomName;await o(He,qe.key),B.current&&await Je.decryptHistoricalPackets({key_type:"channel",channel_name:He})}catch(He){console.error("Failed to create channel or decrypt historical:",He),xt.error("Failed to save cracked channel",{description:He instanceof Error?He.message:"Channel discovered but could not be saved"})}}else T(et=>{const tt=new Map(et),He=tt.get(ct);return He&&tt.set(ct,{...He,status:"failed",attempts:He.attempts+1,lastAttemptLength:gt}),tt})}catch(qe){console.error("Cracking error:",qe),T(et=>{const tt=new Map(et),He=tt.get(ct);return He&&tt.set(ct,{...He,status:"failed",attempts:He.attempts+1,lastAttemptLength:gt}),tt})}he.current=!1,k(null),fe.current&&setTimeout(()=>$e(),100)},[ce,o]),bt=()=>{var Be;if(!z){xt.error("WebGPU not available",{description:"Cracking requires Chrome 113+ or Edge 113+ with WebGPU support."});return}p(!0),fe.current=!0,ae.current=!1,(Be=re.current)==null||Be.enable(),$e()},ut=()=>{var Be,Ze;p(!1),fe.current=!1,ae.current=!0,(Be=X.current)==null||Be.abort(),(Ze=re.current)==
Line truncated
|
||||
//# sourceMappingURL=index-BVIx9g0k.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"mappings":";;;;;;;;6CASa,IAAIA,EAAE,OAAO,IAAI,eAAe,EAAEC,EAAE,OAAO,IAAI,cAAc,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,mBAAmB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,eAAe,EAAEC,EAAE,OAAO,IAAI,mBAAmB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,YAAY,EAAEC,EAAE,OAAO,IAAI,YAAY,EAAEC,EAAE,OAAO,SAAS,SAASC,EAAEC,EAAE,CAAC,OAAUA,IAAP,MAAqB,OAAOA,GAAlB,SAA2B,MAAKA,EAAEF,GAAGE,EAAEF,CAAC,GAAGE,EAAE,YAAY,EAAqB,OAAOA,GAApB,WAAsBA,EAAE,KAAI,CAC1e,IAAIC,EAAE,CAAC,UAAU,UAAU,CAAC,MAAM,EAAE,EAAE,mBAAmB,UAAU,GAAG,oBAAoB,UAAU,GAAG,gBAAgB,UAAU,EAAE,EAAEC,EAAE,OAAO,OAAOC,EAAE,GAAG,SAASC,EAAEJ,EAAEK,EAAEC,EAAE,CAAC,KAAK,MAAMN,EAAE,KAAK,QAAQK,EAAE,KAAK,KAAKF,EAAE,KAAK,QAAQG,GAAGL,CAAC,CAACG,EAAE,UAAU,iBAAiB,GACnQA,EAAE,UAAU,SAAS,SAASJ,EAAEK,EAAE,CAAC,GAAc,OAAOL,GAAlB,UAAkC,OAAOA,GAApB,YAA6BA,GAAN,KAAQ,MAAM,MAAM,uHAAuH,EAAE,KAAK,QAAQ,gBAAgB,KAAKA,EAAEK,EAAE,UAAU,CAAC,EAAED,EAAE,UAAU,YAAY,SAASJ,EAAE,CAAC,KAAK,QAAQ,mBAAmB,KAAKA,EAAE,aAAa,CAAC,EAAE,SAASO,GAAG,EAAEA,EAAE,UAAUH,EAAE,UAAU,SAASI,EAAER,EAAEK,EAAEC,EAAE,CAAC,KAAK,MAAMN,EAAE,KAAK,QAAQK,EAAE,KAAK,KAAKF,EAAE,KAAK,QAAQG,GAAGL,CAAC,CAAC,IAAIQ,EAAED,EAAE,UAAU,IAAID,EACrfE,EAAE,YAAYD,EAAEN,EAAEO,EAAEL,EAAE,SAAS,EAAEK,EAAE,qBAAqB,GAAG,IAAIC,EAAE,MAAM,QAAQC,EAAE,OAAO,UAAU,eAAeC,EAAE,CAAC,QAAQ,IAAI,EAAEC,EAAE,CAAC,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,SAAS,EAAE,EACxK,SAASC,EAAEd,EAAEK,EAAEC,EAAE,CAAC,IAAIS,EAAEC,GAAE,GAAGC,GAAE,KAAKC,GAAE,KAAK,GAASb,GAAN,KAAQ,IAAIU,KAAcV,EAAE,MAAX,SAAiBa,GAAEb,EAAE,KAAcA,EAAE,MAAX,SAAiBY,GAAE,GAAGZ,EAAE,KAAKA,EAAEM,EAAE,KAAKN,EAAEU,CAAC,GAAG,CAACF,EAAE,eAAeE,CAAC,IAAIC,GAAED,CAAC,EAAEV,EAAEU,CAAC,GAAG,IAAII,GAAE,UAAU,OAAO,EAAE,GAAOA,KAAJ,EAAMH,GAAE,SAASV,UAAU,EAAEa,GAAE,CAAC,QAAQC,GAAE,MAAMD,EAAC,EAAEE,GAAE,EAAEA,GAAEF,GAAEE,KAAID,GAAEC,EAAC,EAAE,UAAUA,GAAE,CAAC,EAAEL,GAAE,SAASI,EAAC,CAAC,GAAGpB,GAAGA,EAAE,aAAa,IAAIe,KAAKI,GAAEnB,EAAE,aAAamB,GAAWH,GAAED,CAAC,IAAZ,SAAgBC,GAAED,CAAC,EAAEI,GAAEJ,CAAC,GAAG,MAAM,CAAC,SAAS5B,EAAE,KAAKa,EAAE,IAAIiB,GAAE,IAAIC,GAAE,MAAMF,GAAE,OAAOJ,EAAE,OAAO,CAAC,CAC7a,SAASU,EAAEtB,EAAEK,EAAE,CAAC,MAAM,CAAC,SAASlB,EAAE,KAAKa,EAAE,KAAK,IAAIK,EAAE,IAAIL,EAAE,IAAI,MAAMA,EAAE,MAAM,OAAOA,EAAE,MAAM,CAAC,CAAC,SAASuB,EAAEvB,EAAE,CAAC,OAAiB,OAAOA,GAAlB,UAA4BA,IAAP,MAAUA,EAAE,WAAWb,CAAC,CAAC,SAASqC,EAAOxB,EAAE,CAAC,IAAIK,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE,MAAM,IAAIL,EAAE,QAAQ,QAAQ,SAASA,EAAE,CAAC,OAAOK,EAAEL,CAAC,CAAC,CAAC,CAAC,CAAC,IAAIyB,GAAE,OAAO,SAASC,EAAE1B,EAAEK,EAAE,CAAC,OAAiB,OAAOL,GAAlB,UAA4BA,IAAP,MAAgBA,EAAE,KAAR,KAAYwB,EAAO,GAAGxB,EAAE,GAAG,EAAEK,EAAE,SAAS,EAAE,CAAC,CAC/W,SAASsB,GAAE3B,EAAEK,EAAEC,EAAES,EAAEC,GAAE,CAAC,IAAIC,GAAE,OAAOjB,GAAmBiB,KAAd,aAA6BA,KAAZ,aAAcjB,EAAE,MAAK,IAAIkB,GAAE,GAAG,GAAUlB,IAAP,KAASkB,GAAE,OAAQ,QAAOD,GAAC,CAAE,IAAK,SAAS,IAAK,SAASC,GAAE,GAAG,MAAM,IAAK,SAAS,OAAOlB,EAAE,SAAQ,CAAE,KAAKb,EAAE,KAAKC,EAAE8B,GAAE,EAAE,CAAC,CAAC,GAAGA,GAAE,OAAOA,GAAElB,EAAEgB,GAAEA,GAAEE,EAAC,EAAElB,EAAOe,IAAL,GAAO,IAAIW,EAAER,GAAE,CAAC,EAAEH,EAAEL,EAAEM,EAAC,GAAGV,EAAE,GAASN,GAAN,OAAUM,EAAEN,EAAE,QAAQyB,GAAE,KAAK,EAAE,KAAKE,GAAEX,GAAEX,EAAEC,EAAE,GAAG,SAASN,GAAE,CAAC,OAAOA,EAAC,CAAC,GAASgB,IAAN,OAAUO,EAAEP,EAAC,IAAIA,GAAEM,EAAEN,GAAEV,GAAG,CAACU,GAAE,KAAKE,IAAGA,GAAE,MAAMF,GAAE,IAAI,IAAI,GAAGA,GAAE,KAAK,QAAQS,GAAE,KAAK,EAAE,KAAKzB,CAAC,GAAGK,EAAE,KAAKW,EAAC,GAAG,EAAyB,GAAvBE,GAAE,EAAEH,EAAOA,IAAL,GAAO,IAAIA,EAAE,IAAOL,EAAEV,CAAC,EAAE,QAAQmB,GAAE,EAAEA,GAAEnB,EAAE,OAAOmB,KAAI,CAACF,GACrfjB,EAAEmB,EAAC,EAAE,IAAIC,GAAEL,EAAEW,EAAET,GAAEE,EAAC,EAAED,IAAGS,GAAEV,GAAEZ,EAAEC,EAAEc,GAAEJ,EAAC,CAAC,SAASI,GAAErB,EAAEC,CAAC,EAAe,OAAOoB,IAApB,WAAsB,IAAIpB,EAAEoB,GAAE,KAAKpB,CAAC,EAAEmB,GAAE,EAAE,EAAEF,GAAEjB,EAAE,KAAI,GAAI,MAAMiB,GAAEA,GAAE,MAAMG,GAAEL,EAAEW,EAAET,GAAEE,IAAG,EAAED,IAAGS,GAAEV,GAAEZ,EAAEC,EAAEc,GAAEJ,EAAC,UAAqBC,KAAX,SAAa,MAAMZ,EAAE,OAAOL,CAAC,EAAE,MAAM,mDAAuEK,IAApB,kBAAsB,qBAAqB,OAAO,KAAKL,CAAC,EAAE,KAAK,IAAI,EAAE,IAAIK,GAAG,2EAA2E,EAAE,OAAOa,EAAC,CACzZ,SAASU,GAAE5B,EAAEK,EAAEC,EAAE,CAAC,GAASN,GAAN,KAAQ,OAAOA,EAAE,IAAIe,EAAE,GAAGC,GAAE,EAAE,OAAAW,GAAE3B,EAAEe,EAAE,GAAG,GAAG,SAASf,GAAE,CAAC,OAAOK,EAAE,KAAKC,EAAEN,GAAEgB,IAAG,CAAC,CAAC,EAASD,CAAC,CAAC,SAASc,GAAE7B,EAAE,CAAC,GAAQA,EAAE,UAAP,GAAe,CAAC,IAAIK,EAAEL,EAAE,QAAQK,EAAEA,EAAC,EAAGA,EAAE,KAAK,SAASA,EAAE,EAAQL,EAAE,UAAN,GAAoBA,EAAE,UAAP,MAAeA,EAAE,QAAQ,EAAEA,EAAE,QAAQK,EAAC,EAAE,SAASA,EAAE,EAAQL,EAAE,UAAN,GAAoBA,EAAE,UAAP,MAAeA,EAAE,QAAQ,EAAEA,EAAE,QAAQK,EAAC,CAAC,EAAOL,EAAE,UAAP,KAAiBA,EAAE,QAAQ,EAAEA,EAAE,QAAQK,EAAE,CAAC,GAAOL,EAAE,UAAN,EAAc,OAAOA,EAAE,QAAQ,QAAQ,MAAMA,EAAE,OAAQ,CAC5Z,IAAI8B,GAAE,CAAC,QAAQ,IAAI,EAAEC,EAAE,CAAC,WAAW,IAAI,EAAEC,GAAE,CAAC,uBAAuBF,GAAE,wBAAwBC,EAAE,kBAAkBnB,CAAC,EAAE,SAASqB,GAAG,CAAC,MAAM,MAAM,0DAA0D,CAAE,CACzM,OAAAC,GAAA,SAAiB,CAAC,IAAIN,GAAE,QAAQ,SAAS5B,EAAEK,EAAEC,EAAE,CAACsB,GAAE5B,EAAE,UAAU,CAACK,EAAE,MAAM,KAAK,SAAS,CAAC,EAAEC,CAAC,CAAC,EAAE,MAAM,SAASN,EAAE,CAAC,IAAIK,EAAE,EAAE,OAAAuB,GAAE5B,EAAE,UAAU,CAACK,GAAG,CAAC,EAASA,CAAC,EAAE,QAAQ,SAASL,EAAE,CAAC,OAAO4B,GAAE5B,EAAE,SAASA,EAAE,CAAC,OAAOA,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,SAASA,EAAE,CAAC,GAAG,CAACuB,EAAEvB,CAAC,EAAE,Line truncated
|
||||
-1
@@ -1 +0,0 @@
|
||||
.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::-moz-selection{background:transparent}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottLine truncated
|
||||
-542
@@ -1,542 +0,0 @@
|
||||
var Dv=Object.defineProperty;var Rv=(r,a,o)=>a in r?Dv(r,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[a]=o;var Oo=(r,a,o)=>Rv(r,typeof a!="symbol"?a+"":a,o);function Fv(r,a){for(var o=0;o<a.length;o++){const l=a[o];if(typeof l!="string"&&!Array.isArray(l)){for(const d in l)if(d!=="default"&&!(d in r)){const f=Object.getOwnPropertyDescriptor(l,d);f&&Object.defineProperty(r,d,f.get?f:{enumerable:!0,get:()=>l[d]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))l(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&l(p)}).observe(document,{childList:!0,subtree:!0});function o(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function l(d){if(d.ep)return;d.ep=!0;const f=o(d);fetch(d.href,f)}})();var Pf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Mg(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var a=r.default;if(typeof a=="function"){var o=function l(){return this instanceof l?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};o.prototype=a.prototype}else o={};return Object.defineProperty(o,"__esModule",{value:!0}),Object.keys(r).forEach(function(l){var d=Object.getOwnPropertyDescriptor(r,l);Object.defineProperty(o,l,d.get?d:{enumerable:!0,get:function(){return r[l]}})}),o}var Tf={exports:{}},Wa={},Df={exports:{}},ut={};/**
|
||||
* @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 kp;function Nv(){if(kp)return ut;kp=1;var r=Symbol.for("react.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),p=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.iterator;function w(R){return R===null||typeof R!="object"?null:(R=y&&R[y]||R["@@iterator"],typeof R=="function"?R:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,C={};function k(R,U,K){this.props=R,this.context=U,this.refs=C,this.updater=K||S}k.prototype.isReactComponent={},k.prototype.setState=function(R,U){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,U,"setState")},k.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function D(){}D.prototype=k.prototype;function P(R,U,K){this.props=R,this.context=U,this.refs=C,this.updater=K||S}var B=P.prototype=new D;B.constructor=P,T(B,k.prototype),B.isPureReactComponent=!0;var N=Array.isArray,I=Object.prototype.hasOwnProperty,z={current:null},H={key:!0,ref:!0,__self:!0,__source:!0};function j(R,U,K){var $,de={},fe=null,ke=null;if(U!=null)for($ in U.ref!==void 0&&(ke=U.ref),U.key!==void 0&&(fe=""+U.key),U)I.call(U,$)&&!H.hasOwnProperty($)&&(de[$]=U[$]);var Ae=arguments.length-2;if(Ae===1)de.children=K;else if(1<Ae){for(var We=Array(Ae),$e=0;$e<Ae;$e++)We[$e]=arguments[$e+2];de.children=We}if(R&&R.defaultProps)for($ in Ae=R.defaultProps,Ae)de[$]===void 0&&(de[$]=Ae[$]);return{$$typeof:r,type:R,key:fe,ref:ke,props:de,_owner:z.current}}function ee(R,U){return{$$typeof:r,type:R.type,key:U,ref:R.ref,props:R.props,_owner:R._owner}}function Z(R){return typeof R=="object"&&R!==null&&R.$$typeof===r}function V(R){var U={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(K){return U[K]})}var ne=/\/+/g;function J(R,U){return typeof R=="object"&&R!==null&&R.key!=null?V(""+R.key):U.toString(36)}function ie(R,U,K,$,de){var fe=typeof R;(fe==="undefined"||fe==="boolean")&&(R=null);var ke=!1;if(R===null)ke=!0;else switch(fe){case"string":case"number":ke=!0;break;case"object":switch(R.$$typeof){case r:case a:ke=!0}}if(ke)return ke=R,de=de(ke),R=$===""?"."+J(ke,0):$,N(de)?(K="",R!=null&&(K=R.replace(ne,"$&/")+"/"),ie(de,U,K,"",function($e){return $e})):de!=null&&(Z(de)&&(de=ee(de,K+(!de.key||ke&&ke.key===de.key?"":(""+de.key).replace(ne,"$&/")+"/")+R)),U.push(de)),1;if(ke=0,$=$===""?".":$+":",N(R))for(var Ae=0;Ae<R.length;Ae++){fe=R[Ae];var We=$+J(fe,Ae);ke+=ie(fe,U,K,We,de)}else if(We=w(R),typeof We=="function")for(R=We.call(R),Ae=0;!(fe=R.next()).done;)fe=fe.value,We=$+J(fe,Ae++),ke+=ie(fe,U,K,We,de);else if(fe==="object")throw U=String(R),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.");return ke}function he(R,U,K){if(R==null)return R;var $=[],de=0;return ie(R,$,"","",function(fe){return U.call(K,fe,de++)}),$}function ae(R){if(R._status===-1){var U=R._result;U=U(),U.then(function(K){(R._status===0||R._status===-1)&&(R._status=1,R._result=K)},function(K){(R._status===0||R._status===-1)&&(R._status=2,R._result=K)}),R._status===-1&&(R._status=0,R._result=U)}if(R._status===1)return R._result.default;throw R._result}var pe={current:null},G={transition:null},Y={ReactCurrentDispatcher:pe,ReactCurrentBatchConfig:G,ReactCurrentOwner:z};function q(){throw Error("act(...) is not supported in production builds of React.")}return ut.Children={map:he,forEach:function(R,U,K){he(R,function(){U.apply(this,arguments)},K)},count:function(R){var U=0;return he(R,function(){U++}),U},toArray:function(R){return he(R,function(U){return U})||[]},only:function(R){if(!Z(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},ut.Component=k,ut.Fragment=o,ut.Profiler=d,ut.PureComponent=P,ut.StrictMode=l,ut.Suspense=g,ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Y,ut.act=q,ut.cloneElement=function(R,U,K){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var $=T({},R.props),de=R.key,fe=R.ref,ke=R._owner;if(U!=null){if(U.ref!==void 0&&(fe=U.ref,ke=z.current),U.key!==void 0&&(de=""+U.key),R.type&&R.type.defaultProps)var Ae=R.type.defaultProps;for(We in U)I.call(U,We)&&!H.hasOwnProperty(We)&&($[We]=U[We]===void 0&&Ae!==void 0?Ae[We]:U[We])}var We=arguments.length-2;if(We===1)$.children=K;else if(1<We){Ae=Array(We);for(var $e=0;$e<We;$e++)Ae[$e]=arguments[$e+2];$.children=Ae}return{$$typeof:r,type:R.type,key:de,ref:fe,props:$,_owner:ke}},ut.creLine truncated
|
||||
* @license React
|
||||
* react-jsx-runtime.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 Bp;function Lv(){if(Bp)return Wa;Bp=1;var r=m0(),a=Symbol.for("react.element"),o=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,d=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function p(h,g,m){var v,y={},w=null,S=null;m!==void 0&&(w=""+m),g.key!==void 0&&(w=""+g.key),g.ref!==void 0&&(S=g.ref);for(v in g)l.call(g,v)&&!f.hasOwnProperty(v)&&(y[v]=g[v]);if(h&&h.defaultProps)for(v in g=h.defaultProps,g)y[v]===void 0&&(y[v]=g[v]);return{$$typeof:a,type:h,key:w,ref:S,props:y,_owner:d.current}}return Wa.Fragment=o,Wa.jsx=p,Wa.jsxs=p,Wa}var Pp;function Mv(){return Pp||(Pp=1,Tf.exports=Lv()),Tf.exports}var b=Mv(),F=m0();const Ce=Xs(F),g0=Fv({__proto__:null,default:Ce},[F]);var Pu={},Rf={exports:{}},Zn={},Ff={exports:{}},Nf={};/**
|
||||
* @license React
|
||||
* scheduler.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 Tp;function Iv(){return Tp||(Tp=1,(function(r){function a(G,Y){var q=G.length;G.push(Y);e:for(;0<q;){var R=q-1>>>1,U=G[R];if(0<d(U,Y))G[R]=Y,G[q]=U,q=R;else break e}}function o(G){return G.length===0?null:G[0]}function l(G){if(G.length===0)return null;var Y=G[0],q=G.pop();if(q!==Y){G[0]=q;e:for(var R=0,U=G.length,K=U>>>1;R<K;){var $=2*(R+1)-1,de=G[$],fe=$+1,ke=G[fe];if(0>d(de,q))fe<U&&0>d(ke,de)?(G[R]=ke,G[fe]=q,R=fe):(G[R]=de,G[$]=q,R=$);else if(fe<U&&0>d(ke,q))G[R]=ke,G[fe]=q,R=fe;else break e}}return Y}function d(G,Y){var q=G.sortIndex-Y.sortIndex;return q!==0?q:G.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var p=Date,h=p.now();r.unstable_now=function(){return p.now()-h}}var g=[],m=[],v=1,y=null,w=3,S=!1,T=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,D=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 B(G){for(var Y=o(m);Y!==null;){if(Y.callback===null)l(m);else if(Y.startTime<=G)l(m),Y.sortIndex=Y.expirationTime,a(g,Y);else break;Y=o(m)}}function N(G){if(C=!1,B(G),!T)if(o(g)!==null)T=!0,ae(I);else{var Y=o(m);Y!==null&&pe(N,Y.startTime-G)}}function I(G,Y){T=!1,C&&(C=!1,D(j),j=-1),S=!0;var q=w;try{for(B(Y),y=o(g);y!==null&&(!(y.expirationTime>Y)||G&&!V());){var R=y.callback;if(typeof R=="function"){y.callback=null,w=y.priorityLevel;var U=R(y.expirationTime<=Y);Y=r.unstable_now(),typeof U=="function"?y.callback=U:y===o(g)&&l(g),B(Y)}else l(g);y=o(g)}if(y!==null)var K=!0;else{var $=o(m);$!==null&&pe(N,$.startTime-Y),K=!1}return K}finally{y=null,w=q,S=!1}}var z=!1,H=null,j=-1,ee=5,Z=-1;function V(){return!(r.unstable_now()-Z<ee)}function ne(){if(H!==null){var G=r.unstable_now();Z=G;var Y=!0;try{Y=H(!0,G)}finally{Y?J():(z=!1,H=null)}}else z=!1}var J;if(typeof P=="function")J=function(){P(ne)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,he=ie.port2;ie.port1.onmessage=ne,J=function(){he.postMessage(null)}}else J=function(){k(ne,0)};function ae(G){H=G,z||(z=!0,J())}function pe(G,Y){j=k(function(){G(r.unstable_now())},Y)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(G){G.callback=null},r.unstable_continueExecution=function(){T||S||(T=!0,ae(I))},r.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ee=0<G?Math.floor(1e3/G):5},r.unstable_getCurrentPriorityLevel=function(){return w},r.unstable_getFirstCallbackNode=function(){return o(g)},r.unstable_next=function(G){switch(w){case 1:case 2:case 3:var Y=3;break;default:Y=w}var q=w;w=Y;try{return G()}finally{w=q}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(G,Y){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var q=w;w=G;try{return Y()}finally{w=q}},r.unstable_scheduleCallback=function(G,Y,q){var R=r.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?R+q:R):q=R,G){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=q+U,G={id:v++,callback:Y,priorityLevel:G,startTime:q,expirationTime:U,sortIndex:-1},q>R?(G.sortIndex=q,a(m,G),o(g)===null&&G===o(m)&&(C?(D(j),j=-1):C=!0,pe(N,q-R))):(G.sortIndex=U,a(g,G),T||S||(T=!0,ae(I))),G},r.unstable_shouldYield=V,r.unstable_wrapCallback=function(G){var Y=w;return function(){var q=w;w=Y;try{return G.apply(this,arguments)}finally{w=q}}}})(Nf)),Nf}var Dp;function Ov(){return Dp||(Dp=1,Ff.exports=Iv()),Ff.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 Rp;function jv(){if(Rp)return Zn;Rp=1;var r=m0(),a=Ov();function o(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s<arguments.length;s++)n+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,d={};function f(e,n){p(e,n),p(e+"Capture",n)}function p(e,n){for(d[e]=n,e=0;e<n.length;e++)l.add(n[e])}var h=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),g=Object.prototype.hasOwnProperty,m=/^[: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]*$/,v={},y={};function w(e){return g.call(y,e)?!0:g.call(v,e)?!1:m.test(e)?y[e]=!0:(v[e]=!0,!1)}function S(e,n,s,c){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return c?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function T(e,n,s,c){if(n===null||typeof n>"u"||S(e,n,s,c))return!0;if(c)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function C(e,n,s,c,x,_,M){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=c,this.attributeNamespace=x,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=_,this.removeEmptyString=M}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){k[e]=new C(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];k[n]=new C(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){k[e]=new C(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){k[e]=new C(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){k[e]=new C(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){k[e]=new C(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){k[e]=new C(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){k[e]=new C(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){k[e]=new C(e,5,!1,e.toLowerCase(),null,!1,!1)});var D=/[\-:]([a-z])/g;function P(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 n=e.replace(D,P);k[n]=new C(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(D,P);k[n]=new C(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(D,P);k[n]=new C(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){k[e]=new C(e,1,!1,e.toLowerCase(),null,!1,!1)}),k.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){k[e]=new C(e,1,!1,e.toLowerCase(),null,!0,!0)});function B(e,n,s,c){var x=k.hasOwnProperty(n)?k[n]:null;(x!==null?x.type!==0:c||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=
Line truncated
|
||||
`+R+e}var K=!1;function $(e,n){if(!e||K)return"";K=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(ce){var c=ce}Reflect.construct(e,[],n)}else{try{n.call()}catch(ce){c=ce}e.call(n.prototype)}else{try{throw Error()}catch(ce){c=ce}e()}}catch(ce){if(ce&&c&&typeof ce.stack=="string"){for(var x=ce.stack.split(`
|
||||
`),_=c.stack.split(`
|
||||
`),M=x.length-1,W=_.length-1;1<=M&&0<=W&&x[M]!==_[W];)W--;for(;1<=M&&0<=W;M--,W--)if(x[M]!==_[W]){if(M!==1||W!==1)do if(M--,W--,0>W||x[M]!==_[W]){var X=`
|
||||
`+x[M].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=M&&0<=W);break}}}finally{K=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?U(e):""}function de(e){switch(e.tag){case 5:return U(e.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return e=$(e.type,!1),e;case 11:return e=$(e.type.render,!1),e;case 1:return e=$(e.type,!0),e;default:return""}}function fe(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 H:return"Fragment";case z:return"Portal";case ee:return"Profiler";case j:return"StrictMode";case J:return"Suspense";case ie:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case V:return(e.displayName||"Context")+".Consumer";case Z:return(e._context.displayName||"Context")+".Provider";case ne:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case he:return n=e.displayName||null,n!==null?n:fe(e.type)||"Memo";case ae:n=e._payload,e=e._init;try{return fe(e(n))}catch{}}return null}function ke(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fe(n);case 8:return n===j?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function Ae(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function We(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function $e(e){var n=We(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),c=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var x=s.get,_=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return x.call(this)},set:function(M){c=""+M,_.call(this,M)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return c},setValue:function(M){c=""+M},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function bt(e){e._valueTracker||(e._valueTracker=$e(e))}function ft(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),c="";return e&&(c=We(e)?e.checked?"true":"false":e.value),e=c,e!==s?(n.setValue(e),!0):!1}function Be(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 Ze(e,n){var s=n.checked;return q({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function lt(e,n){var s=n.defaultValue==null?"":n.defaultValue,c=n.checked!=null?n.checked:n.defaultChecked;s=Ae(n.value!=null?n.value:s),e._wrapperState={initialChecked:c,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Rt(e,n){n=n.checked,n!=null&&B(e,"checked",n,!1)}function vt(e,n){Rt(e,n);var s=Ae(n.value),c=n.type;if(s!=null)c==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(c==="submit"||c==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?Qe(e,n.type,s):n.hasOwnProperty("defaultValue")&&Qe(e,n.type,Ae(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function ot(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var c=n.type;if(!(c!=="submit"&&c!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Qe(e,n,s){(n!=="number"||Be(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Xe=Array.isArray;function xe(e,n,s,c){if(e=e.options,n){n={};for(var x=0;x<s.length;x++)n["$"+s[x]]=!0;for(s=0;s<e.length;s++)x=n.hasOwnProperty("$"+e[s].value),e[s].selected!==x&&(e[s].selected=x),x&&c&&(e[s].defaultSelected=!0)}else{for(s=""+Ae(s),n=null,x=0;x<e.length;x++){if(e[x].value===s){e[x].selected=!0,c&&(e[x].defaultSelected=!0);return}n!==null||e[x].disabled||(n=e[x])}n!==null&&(n.selected=!0)}}function Te(e,n){if(n.dangerouslySetInnerHT
Line truncated
|
||||
`).replace(Q,"")}function ue(e,n,s){if(n=oe(n),oe(e)!==n&&s)throw Error(o(425))}function ve(){}var Pe=null,qe=null;function nt(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var on=typeof setTimeout=="function"?setTimeout:void 0,Jt=typeof clearTimeout=="function"?clearTimeout:void 0,Fn=typeof Promise=="function"?Promise:void 0,bn=typeof queueMicrotask=="function"?queueMicrotask:typeof Fn<"u"?function(e){return Fn.resolve(null).then(e).catch(qi)}:on;function qi(e){setTimeout(function(){throw e})}function Ta(e,n){var s=n,c=0;do{var x=s.nextSibling;if(e.removeChild(s),x&&x.nodeType===8)if(s=x.data,s==="/$"){if(c===0){e.removeChild(x),Yn(n);return}c--}else s!=="$"&&s!=="$?"&&s!=="$!"||c++;s=x}while(s);Yn(n)}function Zr(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return e}function Zl(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"){if(n===0)return e;n--}else s==="/$"&&n++}e=e.previousSibling}return null}var ci=Math.random().toString(36).slice(2),fr="__reactFiber$"+ci,Gi="__reactProps$"+ci,wt="__reactContainer$"+ci,Ki="__reactEvents$"+ci,bd="__reactListeners$"+ci,Cd="__reactHandles$"+ci;function di(e){var n=e[fr];if(n)return n;for(var s=e.parentNode;s;){if(n=s[wt]||s[fr]){if(s=n.alternate,n.child!==null||s!==null&&s.child!==null)for(e=Zl(e);e!==null;){if(s=e[fr])return s;e=Zl(e)}return n}e=s,s=e.parentNode}return null}function fi(e){return e=e[fr]||e[wt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function hi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(o(33))}function bs(e){return e[Gi]||null}var Ed=[],Cs=-1;function Qi(e){return{current:e}}function Nt(e){0>Cs||(e.current=Ed[Cs],Ed[Cs]=null,Cs--)}function Dt(e,n){Cs++,Ed[Cs]=e.current,e.current=n}var $i={},Cn=Qi($i),jn=Qi(!1),So=$i;function Es(e,n){var s=e.type.contextTypes;if(!s)return $i;var c=e.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===n)return c.__reactInternalMemoizedMaskedChildContext;var x={},_;for(_ in s)x[_]=n[_];return c&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=x),x}function zn(e){return e=e.childContextTypes,e!=null}function Wl(){Nt(jn),Nt(Cn)}function K0(e,n,s){if(Cn.current!==$i)throw Error(o(168));Dt(Cn,n),Dt(jn,s)}function Q0(e,n,s){var c=e.stateNode;if(n=n.childContextTypes,typeof c.getChildContext!="function")return s;c=c.getChildContext();for(var x in c)if(!(x in n))throw Error(o(108,ke(e)||"Unknown",x));return q({},s,c)}function ql(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$i,So=Cn.current,Dt(Cn,e),Dt(jn,jn.current),!0}function $0(e,n,s){var c=e.stateNode;if(!c)throw Error(o(169));s?(e=Q0(e,n,So),c.__reactInternalMemoizedMergedChildContext=e,Nt(jn),Nt(Cn),Dt(Cn,e)):Nt(jn),Dt(jn,s)}var pi=null,Gl=!1,kd=!1;function Y0(e){pi===null?pi=[e]:pi.push(e)}function $x(e){Gl=!0,Y0(e)}function Yi(){if(!kd&&pi!==null){kd=!0;var e=0,n=ht;try{var s=pi;for(ht=1;e<s.length;e++){var c=s[e];do c=c(!0);while(c!==null)}pi=null,Gl=!1}catch(x){throw pi!==null&&(pi=pi.slice(e+1)),yl(oa,Yi),x}finally{ht=n,kd=!1}}return null}var ks=[],Ss=0,Kl=null,Ql=0,hr=[],pr=0,Bo=null,mi=1,gi="";function Po(e,n){ks[Ss++]=Ql,ks[Ss++]=Kl,Kl=e,Ql=n}function X0(e,n,s){hr[pr++]=mi,hr[pr++]=gi,hr[pr++]=Bo,Bo=e;var c=mi;e=gi;var x=32-tt(c)-1;c&=~(1<<x),s+=1;var _=32-tt(n)+x;if(30<_){var M=x-x%5;_=(c&(1<<M)-1).toString(32),c>>=M,x-=M,mi=1<<32-tt(n)+x|s<<x|c,gi=_+e}else mi=1<<_|s<<x|c,gi=e}function Sd(e){e.return!==null&&(Po(e,1),X0(e,1,0))}function Bd(e){for(;e===Kl;)Kl=ks[--Ss],ks[Ss]=null,Ql=ks[--Ss],ks[Ss]=null;for(;e===Bo;)Bo=hr[--pr],hr[pr]=null,gi=hr[--pr],hr[pr]=null,mi=hr[--pr],hr[pr]=null}var nr=null,rr=null,It=!1,kr=null;function J0(e,n){var s=xr(5,null,null,0);s.elementType="DELETED",s.stateNode=n,s.return=e,n=e.deletions,n===null?(e.deletions=[s],e.flags|=16):n.push(s)}function eh(e,n){switch(e.tag){case 5:var s=e.type;return n=n.nodeType!==1||s.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(e.stateNode=n,nr=e,rr=Zr(n.firstChild),!0):!1;case 6:return n=e.pendingProps===""||n.nodeType!==3?null:n,n!==null?(e.stateNode=n,nr=e,rr=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(s=Bo!==null?{id:mi,overflow:gi}:null,e.memoizedState={dehydrated:n,treeContext:s,retryLane:1073741824},s=xr(18,null,null,0),s.stateNode=n,s.return=e,e.child=s,nr=e,rr=null,!0):!1;default:return!1}}function Pd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Td(e){if(It){var n=rr;if(n){var s=n;if(!eh(e,n)){if(Pd(e))throw Error(o(418));n=Zr(s.nextSibling);var c=nr;n&&eh(e,n)?J0(c,s):(e.flags=e.flags&-4097|2,It=!1,nr=e)}}else{if(Pd(e))throw Error(o(418));e.flags=e.flags&-4097|2,It=!1,nr=e}}}function th(e){for(e=e.r
Line truncated
|
||||
Error generating stack: `+_.message+`
|
||||
`+_.stack}return{value:e,source:n,stack:x,digest:null}}function Xd(e,n,s){return{value:e,source:null,stack:s??null,digest:n??null}}function Jd(e,n){try{console.error(n.value)}catch(s){setTimeout(function(){throw s})}}var ov=typeof WeakMap=="function"?WeakMap:Map;function Lh(e,n,s){s=xi(-1,s),s.tag=3,s.payload={element:null};var c=n.value;return s.callback=function(){mu||(mu=!0,mf=c),Jd(e,n)},s}function Mh(e,n,s){s=xi(-1,s),s.tag=3;var c=e.type.getDerivedStateFromError;if(typeof c=="function"){var x=n.value;s.payload=function(){return c(x)},s.callback=function(){Jd(e,n)}}var _=e.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(s.callback=function(){Jd(e,n),typeof c!="function"&&(to===null?to=new Set([this]):to.add(this));var M=n.stack;this.componentDidCatch(n.value,{componentStack:M!==null?M:""})}),s}function Ih(e,n,s){var c=e.pingCache;if(c===null){c=e.pingCache=new ov;var x=new Set;c.set(n,x)}else x=c.get(n),x===void 0&&(x=new Set,c.set(n,x));x.has(s)||(x.add(s),e=vv.bind(null,e,n,s),n.then(e,e))}function Oh(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function jh(e,n,s,c,x){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(n=xi(-1,1),n.tag=2,Ji(s,n,1))),s.lanes|=1),e):(e.flags|=65536,e.lanes=x,e)}var sv=N.ReactCurrentOwner,Hn=!1;function Nn(e,n,s,c){n.child=e===null?oh(n,null,s,c):Ps(n,e.child,s,c)}function zh(e,n,s,c,x){s=s.render;var _=n.ref;return Ds(n,x),c=Zd(e,n,s,c,_,x),s=Wd(),e!==null&&!Hn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~x,vi(e,n,x)):(It&&s&&Sd(n),n.flags|=1,Nn(e,n,c,x),n.child)}function Hh(e,n,s,c,x){if(e===null){var _=s.type;return typeof _=="function"&&!wf(_)&&_.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(n.tag=15,n.type=_,Vh(e,n,_,c,x)):(e=_u(s.type,null,c,n,n.mode,x),e.ref=n.ref,e.return=n,n.child=e)}if(_=e.child,(e.lanes&x)===0){var M=_.memoizedProps;if(s=s.compare,s=s!==null?s:Hr,s(M,c)&&e.ref===n.ref)return vi(e,n,x)}return n.flags|=1,e=oo(_,c),e.ref=n.ref,e.return=n,n.child=e}function Vh(e,n,s,c,x){if(e!==null){var _=e.memoizedProps;if(Hr(_,c)&&e.ref===n.ref)if(Hn=!1,n.pendingProps=c=_,(e.lanes&x)!==0)(e.flags&131072)!==0&&(Hn=!0);else return n.lanes=e.lanes,vi(e,n,x)}return ef(e,n,s,c,x)}function Uh(e,n,s){var c=n.pendingProps,x=c.children,_=e!==null?e.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},Dt(Ls,ir),ir|=s;else{if((s&1073741824)===0)return e=_!==null?_.baseLanes|s:s,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,Dt(Ls,ir),ir|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=_!==null?_.baseLanes:s,Dt(Ls,ir),ir|=c}else _!==null?(c=_.baseLanes|s,n.memoizedState=null):c=s,Dt(Ls,ir),ir|=c;return Nn(e,n,x,s),n.child}function Zh(e,n){var s=n.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(n.flags|=512,n.flags|=2097152)}function ef(e,n,s,c,x){var _=zn(s)?So:Cn.current;return _=Es(n,_),Ds(n,x),s=Zd(e,n,s,c,_,x),c=Wd(),e!==null&&!Hn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~x,vi(e,n,x)):(It&&c&&Sd(n),n.flags|=1,Nn(e,n,s,x),n.child)}function Wh(e,n,s,c,x){if(zn(s)){var _=!0;ql(n)}else _=!1;if(Ds(n,x),n.stateNode===null)cu(e,n),Fh(n,s,c),Yd(n,s,c,x),c=!0;else if(e===null){var M=n.stateNode,W=n.memoizedProps;M.props=W;var X=M.context,ce=s.contextType;typeof ce=="object"&&ce!==null?ce=mr(ce):(ce=zn(s)?So:Cn.current,ce=Es(n,ce));var _e=s.getDerivedStateFromProps,we=typeof _e=="function"||typeof M.getSnapshotBeforeUpdate=="function";we||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(W!==c||X!==ce)&&Nh(n,M,c,ce),Xi=!1;var ye=n.memoizedState;M.state=ye,tu(n,c,M,x),X=n.memoizedState,W!==c||ye!==X||jn.current||Xi?(typeof _e=="function"&&($d(n,s,_e,c),X=n.memoizedState),(W=Xi||Rh(n,s,W,c,ye,X,ce))?(we||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(n.flags|=4194308)):(typeof M.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=X),M.props=c,M.state=X,M.context=ce,c=W):(typeof M.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{M=n.stateNode,ah(e,n),W=n.memoizedProps,ce=n.type===n.elementType?W:Sr(n.type,W),M.props=ce,we=n.pendingProps,ye=M.context,X=s.contextType,typeof X=="object"&&X!==null?X=mr(X):(X=zn(s)?So:Cn.current,X=Es(n,X));var Fe=s.getDerivedStateFromProps;(_e=typeof Fe=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(W!==we||ye!==X)&&Nh(n,M,c,X),Xi=!1,ye=n.m
Line truncated
|
||||
`)}function Os(r,a,o){const l=Math.floor(Date.now()/1e3);return{id:-Date.now(),type:"PRIV",conversation_key:r,text:a,sender_timestamp:l,received_at:l,paths:null,txt_type:0,signature:null,outgoing:o,acked:1}}function Gv(r){const a=F.useRef(null),o=F.useRef(null),l=F.useCallback(()=>{o.current!==null&&(clearInterval(o.current),o.current=null),a.current=null},[]),d=F.useCallback(async()=>{const p=a.current;if(!p)return;let h=null,g=null;for(let m=0;m<2;m++)try{h=await rt.requestTelemetry(p.conversationId,"");break}catch(v){g=v instanceof Error?v:new Error("Unknown error"),m===0&&await new Promise(y=>setTimeout(y,2e3))}if(h){const m=Os(p.conversationId,qv(p,h),!1);r(v=>[...v,m])}else{const m=Os(p.conversationId,`Duty cycle poll failed after retry: ${(g==null?void 0:g.message)??"Unknown error"}`,!1);r(v=>[...v,m])}},[r]),f=F.useCallback(async(p,h)=>{const g=p.trim().toLowerCase();if(g==="dutycycle_start"){l();let m=null,v=null;for(let S=0;S<2;S++)try{m=await rt.requestTelemetry(h,"");break}catch(T){v=T instanceof Error?T:new Error("Unknown error"),S===0&&await new Promise(C=>setTimeout(C,2e3))}if(!m){const S=Os(h,`Failed to start duty cycle tracking after retry: ${(v==null?void 0:v.message)??"Unknown error"}`,!1);return r(T=>[...T,S]),!0}const y=Math.floor(Date.now()/1e3);a.current={startTime:y,uptime:m.uptime_seconds,txAirtime:m.airtime_seconds,rxAirtime:m.rx_airtime_seconds,sentFlood:m.sent_flood,sentDirect:m.sent_direct,recvFlood:m.recv_flood,recvDirect:m.recv_direct,conversationId:h};const w=Os(h,`Airtime/duty cycle statistics gathering begins at ${y}. Logs will follow every 5 minutes. To stop, run dutycycle_stop or navigate away from this conversation.`,!1);return r(S=>[...S,w]),o.current=window.setInterval(d,Zv),!0}if(g==="dutycycle_stop"){if(a.current&&a.current.conversationId===h){await d(),l();const m=Os(h,"Airtime/duty cycle statistics gathering stopped.",!1);r(v=>[...v,m])}else{const m=Os(h,"Duty cycle tracking is not active.",!1);r(v=>[...v,m])}return!0}return!1},[r,l,d]);return F.useEffect(()=>()=>{o.current!==null&&clearInterval(o.current)},[]),{handleAirtimeCommand:f,stopTracking:l}}function Hu(r){if(r<60)return`${r}s`;const a=Math.floor(r/86400),o=Math.floor(r%86400/3600),l=Math.floor(r%3600/60);return a>0?o>0&&l>0?`${a}d${o}h${l}m`:o>0?`${a}d${o}h`:l>0?`${a}d${l}m`:`${a}d`:o>0?l>0?`${o}h${l}m`:`${o}h`:`${l}m`}function Kv(r){return["Telemetry",`Battery Voltage: ${r.battery_volts.toFixed(3)}V`,`Uptime: ${Hu(r.uptime_seconds)}`,`TX Airtime: ${Hu(r.airtime_seconds)}`,`RX Airtime: ${Hu(r.rx_airtime_seconds)}`,"",`Noise Floor: ${r.noise_floor_dbm} dBm`,`Last RSSI: ${r.last_rssi_dbm} dBm`,`Last SNR: ${r.last_snr_db.toFixed(1)} dB`,"",`Packets: ${r.packets_received.toLocaleString()} rx / ${r.packets_sent.toLocaleString()} tx`,`Flood: ${r.recv_flood.toLocaleString()} rx / ${r.sent_flood.toLocaleString()} tx`,`Direct: ${r.recv_direct.toLocaleString()} rx / ${r.sent_direct.toLocaleString()} tx`,`Duplicates: ${r.flood_dups.toLocaleString()} flood / ${r.direct_dups.toLocaleString()} direct`,"",`TX Queue: ${r.tx_queue_len}`,`Debug Flags: ${r.full_events}`].join(`
|
||||
`)}function Qv(r){if(r.length===0)return`Neighbors
|
||||
No neighbors reported`;const a=[...r].sort((l,d)=>d.snr-l.snr),o=[`Neighbors (${a.length})`];for(const l of a){const d=l.name||l.pubkey_prefix,f=l.snr>=0?`+${l.snr.toFixed(1)}`:l.snr.toFixed(1);o.push(`${d}, ${f} dB [${Hu(l.last_heard_seconds)} ago]`)}return o.join(`
|
||||
`)}function $v(r){if(r.length===0)return`ACL
|
||||
No ACL entries`;const a=[`ACL (${r.length})`];for(const o of r){const l=o.name||o.pubkey_prefix;a.push(`${l}: ${o.permission_name}`)}return a.join(`
|
||||
`)}function jo(r,a,o,l=0){const d=Math.floor(Date.now()/1e3);return{id:-Date.now()-l,type:"PRIV",conversation_key:r,text:a,sender_timestamp:d,received_at:d,paths:null,txt_type:0,signature:null,outgoing:o,acked:1}}function Yv(r,a,o){const[l,d]=F.useState(!1),{handleAirtimeCommand:f,stopTracking:p}=Gv(o);F.useEffect(()=>{d(!1),p()},[r==null?void 0:r.id,p]);const h=F.useMemo(()=>{if(!r||r.type!=="contact")return!1;const v=a.find(y=>y.public_key===r.id);return(v==null?void 0:v.type)===Oc},[r,a]),g=F.useCallback(async v=>{if(!(!r||r.type!=="contact")&&h)try{const y=await rt.requestTelemetry(r.id,v),w=jo(r.id,Kv(y),!1,0),S=jo(r.id,Qv(y.neighbors),!1,1),T=jo(r.id,$v(y.acl),!1,2);o(C=>[...C,w,S,T]),d(!0)}catch(y){const w=jo(r.id,`Telemetry request failed: ${y instanceof Error?y.message:"Unknown error"}`,!1,0);o(S=>[...S,w])}},[r,h,o]),m=F.useCallback(async v=>{if(!r||r.type!=="contact"||!h||!l||await f(v,r.id))return;const w=jo(r.id,`> ${v}`,!0,0);o(S=>[...S,w]);try{const S=await rt.sendRepeaterCommand(r.id,v),T=jo(r.id,S.response,!1,1);S.sender_timestamp&&(T.sender_timestamp=S.sender_timestamp),o(C=>[...C,T])}catch(S){const T=jo(r.id,`Command failed: ${S instanceof Error?S.message:"Unknown error"}`,!1,1);o(C=>[...C,T])}},[r,h,l,o,f]);return{repeaterLoggedIn:l,activeContactIsRepeater:h,handleTelemetryRequest:g,handleRepeaterCommand:m}}const Xv=12;function Ks(r){return r.slice(0,Xv)}function x0(r,a){return!r||!a?!1:Ks(r)===Ks(a)}function Ei(r,a){return r||Ks(a)}const Xf="remoteterm-lastMessageTime";function Og(r){try{const a=localStorage.getItem(r);return a?JSON.parse(a):{}}catch{return{}}}function Jv(r,a){try{localStorage.setItem(r,JSON.stringify(a))}catch{}}function Mp(){return Og(Xf)}function Lf(r,a){const o=Og(Xf);return(!o[r]||a>o[r])&&(o[r]=a,Jv(Xf,o)),o}function Rr(r,a){return r==="channel"?`channel-${a}`:`contact-${Ks(a)}`}function Ip(r,a){if(!a)return!1;const o=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`@\\[${o}\\]`,"i").test(r)}function ey(r,a,o,l=null){const[d,f]=F.useState({}),[p,h]=F.useState({}),[g,m]=F.useState(Mp),v=F.useRef(l);F.useEffect(()=>{v.current=l},[l]);const y=F.useRef(new Set),w=F.useRef(new Set);F.useEffect(()=>{const D=r.filter(N=>!y.current.has(N.key)),P=a.filter(N=>N.public_key&&!w.current.has(N.public_key));if(D.length===0&&P.length===0)return;D.forEach(N=>y.current.add(N.key)),P.forEach(N=>w.current.add(N.public_key)),(async()=>{const N=[...D.map(I=>({type:"CHAN",conversation_key:I.key})),...P.map(I=>({type:"PRIV",conversation_key:I.public_key}))];if(N.length!==0)try{const I=await rt.getMessagesBulk(N,A0),z={},H={},j={};for(const ee of D){const Z=I[`CHAN:${ee.key}`]||[];if(Z.length>0){const V=Rr("channel",ee.key),ne=ee.last_read_at||0,J=Z.filter(he=>!he.outgoing&&he.received_at>ne);J.length>0&&(z[V]=J.length,J.some(he=>Ip(he.text,v.current))&&(H[V]=!0));const ie=Math.max(...Z.map(he=>he.received_at));j[V]=ie,Lf(V,ie)}}for(const ee of P){const Z=I[`PRIV:${ee.public_key}`]||[];if(Z.length>0){const V=Rr("contact",ee.public_key),ne=ee.last_read_at||0,J=Z.filter(he=>!he.outgoing&&he.received_at>ne);J.length>0&&(z[V]=J.length,J.some(he=>Ip(he.text,v.current))&&(H[V]=!0));const ie=Math.max(...Z.map(he=>he.received_at));j[V]=ie,Lf(V,ie)}}Object.keys(z).length>0&&f(ee=>({...ee,...z})),Object.keys(H).length>0&&h(ee=>({...ee,...H})),m(Mp())}catch(I){console.error("Failed to fetch messages bulk:",I)}})()},[r,a]),F.useEffect(()=>{if(o&&o.type!=="raw"&&o.type!=="map"){const D=Rr(o.type,o.id);f(P=>{if(P[D]){const B={...P};return delete B[D],B}return P}),h(P=>{if(P[D]){const B={...P};return delete B[D],B}return P}),o.type==="channel"?rt.markChannelRead(o.id).catch(P=>{console.error("Failed to mark channel as read on server:",P)}):o.type==="contact"&&rt.markContactRead(o.id).catch(P=>{console.error("Failed to mark contact as read on server:",P)})}},[o]);const S=F.useCallback((D,P)=>{f(B=>({...B,[D]:(B[D]||0)+1})),P&&h(B=>({...B,[D]:!0}))},[]),T=F.useCallback(()=>{f({}),h({}),rt.markAllRead().catch(D=>{console.error("Failed to mark all as read on server:",D)})},[]),C=F.useCallback(D=>{if(D.type==="raw"||D.type==="map")return;const P=Rr(D.type,D.id);f(B=>{if(B[P]){const N={...B};return delete N[P],N}return B}),h(B=>{if(B[P]){const N={...B};return delete N[P],N}return B}),D.type==="channel"?rt.markChannelRead(D.id).catch(B=>{console.error("Failed to mark channel as read on server:",B)}):D.type==="contact"&&rt.markContactRead(D.id).catch(B=>{console.error("Failed to mark contact as read on server:",B)})},[]),k=F.useCallback(D=>{let P=null;if(D.type==="CHAN"&&D.conversation_key?P=Rr("channel",D.conversation_key):D.type==="PRIV"&&D.conversation_key&&(P=Rr("contact",D.conversation_key)),P){const B=D.received_at||Math.floor(Date.now()/1e3),N=Lf(P,B);m(N)}},[]);return{unreadCounts:d,mentions:p,lastMessageTimes:g,incrementUnread:S,markAllRead:T,markConversationRead:C,trackNewMessage:k}}var v0=Ig();const jg=Xs(v0);function ty(r){if(typeof document>"u")return;let a=document.head||document.getEle
Line truncated
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Ty=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Dy=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,o,l)=>l?l.toUpperCase():o.toLowerCase()),zp=r=>{const a=Dy(r);return a.charAt(0).toUpperCase()+a.slice(1)},zg=(...r)=>r.filter((a,o,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===o).join(" ").trim(),Ry=r=>{for(const a in r)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/var Fy={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Ny=F.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:d="",children:f,iconNode:p,...h},g)=>F.createElement("svg",{ref:g,...Fy,width:a,height:a,stroke:r,strokeWidth:l?Number(o)*24/Number(a):o,className:zg("lucide",d),...!f&&!Ry(h)&&{"aria-hidden":"true"},...h},[...p.map(([m,v])=>F.createElement(m,v)),...Array.isArray(f)?f:[f]]));/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const y0=(r,a)=>{const o=F.forwardRef(({className:l,...d},f)=>F.createElement(Ny,{ref:f,iconNode:a,className:zg(`lucide-${Ty(zp(r))}`,`lucide-${r}`,l),...d}));return o.displayName=zp(r),o};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Ly=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],My=y0("check",Ly);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Iy=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Oy=y0("menu",Iy);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const jy=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Hg=y0("x",jy);function zy({health:r,config:a,onSettingsClick:o,onMenuClick:l}){const d=(r==null?void 0:r.radio_connected)??!1,[f,p]=F.useState(!1),h=async()=>{p(!0);try{const g=await rt.reconnectRadio();g.connected&&_t.success("Reconnected",{description:g.message})}catch(g){_t.error("Reconnection failed",{description:g instanceof Error?g.message:"Check radio connection and power"})}finally{p(!1)}};return b.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[#252525] border-b border-[#333] text-xs",children:[l&&b.jsx("button",{onClick:l,className:"md:hidden p-1 bg-transparent border-none text-[#e0e0e0] cursor-pointer","aria-label":"Open menu",children:b.jsx(Oy,{className:"h-5 w-5"})}),b.jsx("h1",{className:"text-base font-semibold mr-auto",children:"RemoteTerm"}),b.jsxs("div",{className:"flex items-center gap-1 text-[#888]",children:[b.jsx("div",{className:`w-2 h-2 rounded-full ${d?"bg-[#4caf50]":"bg-[#666]"}`}),b.jsx("span",{className:"hidden lg:inline text-[#e0e0e0]",children:d?"Connected":"Disconnected"})]}),a&&b.jsxs("div",{className:"hidden lg:flex items-center gap-2 text-[#888]",children:[b.jsx("span",{className:"text-[#e0e0e0]",children:a.name||"Unnamed"}),b.jsx("span",{className:"font-mono text-[#888] cursor-pointer hover:text-[#4a9eff]",onClick:()=>{navigator.clipboard.writeText(a.public_key),_t.success("Public key copied!")},title:"Click to copy public key",children:a.public_key.toLowerCase()})]}),!d&&b.jsx("button",{onClick:h,disabled:f,className:"px-3 py-1 bg-[#4a3000] border border-[#6b4500] text-[#ffa500] rounded text-xs cursor-pointer hover:bg-[#5a3a00] disabled:opacity-50 disabled:cursor-not-allowed",children:f?"Reconnecting...":"Reconnect"}),b.jsxs("button",{onClick:o,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",children:[b.jsx("span",{role:"img","aria-label":"Settings",children:"🔧"})," ","Radio & Config"]})]})}const e0=2,Hy={text:"🛜",background:"#444444",textColor:"#ffffff"};function Vy(r){let a=0;for(let o=0;o<r.length;o++){const l=r.charCodeAt(o);a=(a<<5)-a+l,a=a&a}return Math.abs(a)}const Uy=/[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{1F600}-\u{1F64F}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]/u;function Zy(r,a){if(!r)return a.slice(0,2).toUpperCase();const o=r.match(Uy);if(o)return o[0];const l=r.match(/[a-zA-Z]/g);if(!l||l.length===0)return a.slice(0,2).toUpperCase();const d=r.indexOf(" ");if(d!==-1){const f=l[0],p=r.slice(d+1).match(/[a-zA-Z]/);if(p)return(f+p[0]).toUpperCase()}return l[0].toUpperCase()}function Wy(r){const a=Vy(r),o=a%360,l=50+(a>>8)%30,d=35+(a>>16)%20,f=`hsl(${o}, ${l}%, ${d}%)`,p=d<45?"#ffffff":"#000000";return{background:f,text:p}}function qy(r,a,o){if(o===e0)return Hy;const l=Zy(r,a),d=Wy(a);return{text:l,background:d.background,textColor:d.text}}function t0({name:r,publicKey:a,size:o=28,contactType:l}){const d=qy(r,a,l);return b.jsx("div",{className:"flex items-center justify-center rounded-full font-semibold flex-shrink-0 select-none",style:{backgroundColor:d.background,color:d.textColor,width:o,height:o,fontSize:o*.45},children:d.text})}const Vg="remoteterm-favorites";function jc(){try{const r=localStorage.getItem(Vg);return r?JSON.parse(r):[]}catch{return[]}}function Ug(r){try{localStorage.setItem(Vg,JSON.stringify(r))}catch{}}function Gy(r,a){const o=jc();if(o.some(d=>d.type===r&&d.id===a))return o;const l=[...o,{type:r,id:a}];return Ug(l),l}function Ky(r,a){const l=jc().filter(d=>!(d.type===r&&d.id===a));return Ug(l),l}function Zs(r,a,o){return r.some(l=>l.type===a&&l.id===o)}function Qy(r,a){return jc().some(l=>l.type===r&&l.id===a)?Ky(r,a):Gy(r,a)}function Zg(r){var a,o,l="";if(typeof r=="string"||typeof r=="number")l+=r;else if(typeof r=="object")if(Array.isArray(r)){var d=r.length;for(a=0;a<d;a++)r[a]&&(o=Zg(r[a]))&&(l&&(l+=" "),l+=o)}else for(o in r)r[o]&&(l&&(l+=" "),l+=o);return l}function Wg(){for(var r,a,o=0,l="",d=arguments.length;o<d;o++)(r=arguments[o])&&(a=Zg(r))&&(l&&(l+=" "),l+=a);return l}const $y=(r,a)=>{const o=new Array(r.length+a.length);for(let l=0;l<r.length;l++)o[l]=r[l];for(let l=0;l<a.length;l++)o[r.length+l]=a[l];return o},Yy=(r,a)=>({classGroupId:r,validator:a}),qg=(r=new Map,a=null,o)=>({nextPart:r,validators:a,classGroupId:o}),Dc="-",Hp=[],Xy="arbitrary..",Jy=r=>{const a=t_(r),{conflictingClassGroups:o,conflictingClassGroupModifiers:l}=r;return{getClassGroupId:p=>{if(p.startsWith("[")&&p.endsWith("]"))return e_(p);const h=p.split(Dc),g=h[0]===""&&h.length>1?1:0;return Gg(h,g,a)},getConflictingClassGroupIds:(p,h)=>{if(h){const g=l[p],m=o[p];return g?m?$y(m,g):g:m||Hp}return o[p]||Hp}}},Gg=(r,a,o)=>{if(r.length-a===0)return o.classGroupId;const d=r[a],f=o.nextPart.get(d);if(f){const m=Gg(r,a+1,f);if(m)return m}const p=o.validators;if(p===null)return;const h=a===0?r.join(Dc):r.slice(a).join(Dc),g=p.length;for(let m=0;m<g;m++){const
Line truncated
|
||||
.`.concat(j1,` {
|
||||
overflow: hidden `).concat(l,`;
|
||||
padding-right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
body[`).concat(qs,`] {
|
||||
overflow: hidden `).concat(l,`;
|
||||
overscroll-behavior: contain;
|
||||
`).concat([a&&"position: relative ".concat(l,";"),o==="margin"&&`
|
||||
padding-left: `.concat(d,`px;
|
||||
padding-top: `).concat(f,`px;
|
||||
padding-right: `).concat(p,`px;
|
||||
margin-left:0;
|
||||
margin-top:0;
|
||||
margin-right: `).concat(h,"px ").concat(l,`;
|
||||
`),o==="padding"&&"padding-right: ".concat(h,"px ").concat(l,";")].filter(Boolean).join(""),`
|
||||
}
|
||||
|
||||
.`).concat(Uu,` {
|
||||
right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Zu,` {
|
||||
margin-right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Uu," .").concat(Uu,` {
|
||||
right: 0 `).concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Zu," .").concat(Zu,` {
|
||||
margin-right: 0 `).concat(l,`;
|
||||
}
|
||||
|
||||
body[`).concat(qs,`] {
|
||||
`).concat(z1,": ").concat(h,`px;
|
||||
}
|
||||
`)},im=function(){var r=parseInt(document.body.getAttribute(qs)||"0",10);return isFinite(r)?r:0},ow=function(){F.useEffect(function(){return document.body.setAttribute(qs,(im()+1).toString()),function(){var r=im()-1;r<=0?document.body.removeAttribute(qs):document.body.setAttribute(qs,r.toString())}},[])},sw=function(r){var a=r.noRelative,o=r.noImportant,l=r.gapMode,d=l===void 0?"margin":l;ow();var f=F.useMemo(function(){return nw(d)},[d]);return F.createElement(rw,{styles:iw(f,!a,d,o?"":"!important")})},i0=!1;if(typeof window<"u")try{var Iu=Object.defineProperty({},"passive",{get:function(){return i0=!0,!0}});window.addEventListener("test",Iu,Iu),window.removeEventListener("test",Iu,Iu)}catch{i0=!1}var zs=i0?{passive:!1}:!1,aw=function(r){return r.tagName==="TEXTAREA"},mA=function(r,a){if(!(r instanceof Element))return!1;var o=window.getComputedStyle(r);return o[a]!=="hidden"&&!(o.overflowY===o.overflowX&&!aw(r)&&o[a]==="visible")},lw=function(r){return mA(r,"overflowY")},uw=function(r){return mA(r,"overflowX")},om=function(r,a){var o=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var d=gA(r,l);if(d){var f=AA(r,l),p=f[1],h=f[2];if(p>h)return!0}l=l.parentNode}while(l&&l!==o.body);return!1},cw=function(r){var a=r.scrollTop,o=r.scrollHeight,l=r.clientHeight;return[a,o,l]},dw=function(r){var a=r.scrollLeft,o=r.scrollWidth,l=r.clientWidth;return[a,o,l]},gA=function(r,a){return r==="v"?lw(a):uw(a)},AA=function(r,a){return r==="v"?cw(a):dw(a)},fw=function(r,a){return r==="h"&&a==="rtl"?-1:1},hw=function(r,a,o,l,d){var f=fw(r,window.getComputedStyle(a).direction),p=f*l,h=o.target,g=a.contains(h),m=!1,v=p>0,y=0,w=0;do{if(!h)break;var S=AA(r,h),T=S[0],C=S[1],k=S[2],D=C-k-f*T;(T||D)&&gA(r,h)&&(y+=D,w+=T);var P=h.parentNode;h=P&&P.nodeType===Node.DOCUMENT_FRAGMENT_NODE?P.host:P}while(!g&&h!==document.body||g&&(a.contains(h)||a===h));return(v&&Math.abs(y)<1||!v&&Math.abs(w)<1)&&(m=!0),m},Ou=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},sm=function(r){return[r.deltaX,r.deltaY]},am=function(r){return r&&"current"in r?r.current:r},pw=function(r,a){return r[0]===a[0]&&r[1]===a[1]},mw=function(r){return`
|
||||
.block-interactivity-`.concat(r,` {pointer-events: none;}
|
||||
.allow-interactivity-`).concat(r,` {pointer-events: all;}
|
||||
`)},gw=0,Hs=[];function Aw(r){var a=F.useRef([]),o=F.useRef([0,0]),l=F.useRef(),d=F.useState(gw++)[0],f=F.useState(pA)[0],p=F.useRef(r);F.useEffect(function(){p.current=r},[r]),F.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(d));var C=O1([r.lockRef.current],(r.shards||[]).map(am),!0).filter(Boolean);return C.forEach(function(k){return k.classList.add("allow-interactivity-".concat(d))}),function(){document.body.classList.remove("block-interactivity-".concat(d)),C.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(d))})}}},[r.inert,r.lockRef.current,r.shards]);var h=F.useCallback(function(C,k){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!p.current.allowPinchZoom;var D=Ou(C),P=o.current,B="deltaX"in C?C.deltaX:P[0]-D[0],N="deltaY"in C?C.deltaY:P[1]-D[1],I,z=C.target,H=Math.abs(B)>Math.abs(N)?"h":"v";if("touches"in C&&H==="h"&&z.type==="range")return!1;var j=window.getSelection(),ee=j&&j.anchorNode,Z=ee?ee===z||ee.contains(z):!1;if(Z)return!1;var V=om(H,z);if(!V)return!0;if(V?I=H:(I=H==="v"?"h":"v",V=om(H,z)),!V)return!1;if(!l.current&&"changedTouches"in C&&(B||N)&&(l.current=I),!I)return!0;var ne=l.current||I;return hw(ne,k,C,ne==="h"?B:N)},[]),g=F.useCallback(function(C){var k=C;if(!(!Hs.length||Hs[Hs.length-1]!==f)){var D="deltaY"in k?sm(k):Ou(k),P=a.current.filter(function(I){return I.name===k.type&&(I.target===k.target||k.target===I.shadowParent)&&pw(I.delta,D)})[0];if(P&&P.should){k.cancelable&&k.preventDefault();return}if(!P){var B=(p.current.shards||[]).map(am).filter(Boolean).filter(function(I){return I.contains(k.target)}),N=B.length>0?h(k,B[0]):!p.current.noIsolation;N&&k.cancelable&&k.preventDefault()}}},[]),m=F.useCallback(function(C,k,D,P){var B={name:C,delta:k,target:D,should:P,shadowParent:xw(D)};a.current.push(B),setTimeout(function(){a.current=a.current.filter(function(N){return N!==B})},1)},[]),v=F.useCallback(function(C){o.current=Ou(C),l.current=void 0},[]),y=F.useCallback(function(C){m(C.type,sm(C),C.target,h(C,r.lockRef.current))},[]),w=F.useCallback(function(C){m(C.type,Ou(C),C.target,h(C,r.lockRef.current))},[]);F.useEffect(function(){return Hs.push(f),r.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:w}),document.addEventListener("wheel",g,zs),document.addEventListener("touchmove",g,zs),document.addEventListener("touchstart",v,zs),function(){Hs=Hs.filter(function(C){return C!==f}),document.removeEventListener("wheel",g,zs),document.removeEventListener("touchmove",g,zs),document.removeEventListener("touchstart",v,zs)}},[]);var S=r.removeScrollBar,T=r.inert;return F.createElement(F.Fragment,null,T?F.createElement(f,{styles:mw(d)}):null,S?F.createElement(sw,{noRelative:r.noRelative,gapMode:r.gapMode}):null)}function xw(r){for(var a=null;r!==null;)r instanceof ShadowRoot&&(a=r.host,r=r.host),r=r.parentNode;return a}const vw=G1(hA,Aw);var xA=F.forwardRef(function(r,a){return F.createElement(Hc,Yr({},r,{ref:a,sideCar:vw}))});xA.classNames=Hc.classNames;var yw=function(r){if(typeof document>"u")return null;var a=Array.isArray(r)?r[0]:r;return a.ownerDocument.body},Vs=new WeakMap,ju=new WeakMap,zu={},Zf=0,vA=function(r){return r&&(r.host||vA(r.parentNode))},_w=function(r,a){return a.map(function(o){if(r.contains(o))return o;var l=vA(o);return l&&r.contains(l)?l:(console.error("aria-hidden",o,"in not contained inside",r,". Doing nothing"),null)}).filter(function(o){return!!o})},ww=function(r,a,o,l){var d=_w(a,Array.isArray(r)?r:[r]);zu[o]||(zu[o]=new WeakMap);var f=zu[o],p=[],h=new Set,g=new Set(d),m=function(y){!y||h.has(y)||(h.add(y),m(y.parentNode))};d.forEach(m);var v=function(y){!y||g.has(y)||Array.prototype.forEach.call(y.children,function(w){if(h.has(w))v(w);else try{var S=w.getAttribute(l),T=S!==null&&S!=="false",C=(Vs.get(w)||0)+1,k=(f.get(w)||0)+1;Vs.set(w,C),f.set(w,k),p.push(w),C===1&&T&&ju.set(w,!0),k===1&&w.setAttribute(o,"true"),T||w.setAttribute(l,"true")}catch(D){console.error("aria-hidden: cannot operate on ",w,D)}})};return v(a),h.clear(),Zf++,function(){p.forEach(function(y){var w=Vs.get(y)-1,S=f.get(y)-1;Vs.set(y,w),f.set(y,S),w||(ju.has(y)||y.removeAttribute(l),ju.delete(y)),S||y.removeAttribute(o)}),Zf--,Zf||(Vs=new WeakMap,Vs=new WeakMap,ju=new WeakMap,zu={})}},bw=function(r,a,o){o===void 0&&(o="data-aria-hidden");var l=Array.from(Array.isArray(r)?r:[r]),d=yw(r);return d?(l.push.apply(l,Array.from(d.querySelectorAll("[aria-live], script"))),ww(l,d,o,"aria-hidden")):function(){return null}};function Cw(r){const a=Ew(r),o=F.forwardRef((l,d)=>{const{children:f,...p}=l,h=F.Children.toArray(f),g=h.find(Sw);if(g){const m=g.props.children,v=h.map(y=>y===g?F.Children.count(m)>1?F.Children.only(null):F.isValidElement(m)?m.props.children:null:y);return b.jsx(a,{...p,ref:d,children:F.isValidElement(m)?F.cloneElement(m,void 0,v):null})}return b.jsx(a,{...p,ref:d,children:f})});return o.displayName=`${r}.Slot`,o}function Ew(r){const a=F.forwardRef((o,l)=>{const{chi
Line truncated
|
||||
|
||||
If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||||
|
||||
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return F.useEffect(()=>{r&&(document.getElementById(r)||console.error(o))},[o,r]),null},Ow="DialogDescriptionWarning",jw=({contentRef:r,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${NA(Ow).contentName}}.`;return F.useEffect(()=>{var f;const d=(f=r.current)==null?void 0:f.getAttribute("aria-describedby");a&&d&&(document.getElementById(a)||console.warn(l))},[l,r,a]),null},LA=_A,MA=CA,Uc=EA,Zc=kA,Wc=BA,qc=TA,IA=RA;const S0=LA,zw=MA,OA=F.forwardRef(({className:r,...a},o)=>b.jsx(Uc,{ref:o,className:at("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...a}));OA.displayName=Uc.displayName;const Gc=F.forwardRef(({className:r,children:a,...o},l)=>b.jsxs(zw,{children:[b.jsx(OA,{}),b.jsxs(Zc,{ref:l,className:at("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...o,children:[a,b.jsxs(IA,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[b.jsx(Hg,{className:"h-4 w-4"}),b.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Gc.displayName=Zc.displayName;const Kc=({className:r,...a})=>b.jsx("div",{className:at("flex flex-col space-y-1.5 text-center sm:text-left",r),...a});Kc.displayName="DialogHeader";const B0=({className:r,...a})=>b.jsx("div",{className:at("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",r),...a});B0.displayName="DialogFooter";const Qc=F.forwardRef(({className:r,...a},o)=>b.jsx(Wc,{ref:o,className:at("text-lg font-semibold leading-none tracking-tight",r),...a}));Qc.displayName=Wc.displayName;const $c=F.forwardRef(({className:r,...a},o)=>b.jsx(qc,{ref:o,className:at("text-sm text-muted-foreground",r),...a}));$c.displayName=qc.displayName;function Hw(){const r=window.location.hash.slice(1);if(!r)return null;if(r==="raw")return{type:"raw",name:"raw"};if(r==="map")return{type:"map",name:"map"};if(r.startsWith("map/focus/")){const d=r.slice(10);return d?{type:"map",name:"map",mapFocusKey:decodeURIComponent(d)}:{type:"map",name:"map"}}const a=r.indexOf("/");if(a===-1)return null;const o=r.slice(0,a),l=decodeURIComponent(r.slice(a+1));return(o==="channel"||o==="contact")&&l?{type:o,name:l}:null}function jA(r){return`#map/focus/${encodeURIComponent(r)}`}function Vw(r){if(!r)return"";if(r.type==="raw")return"#raw";if(r.type==="map")return"#map";const a=r.type==="channel"&&r.name.startsWith("#")?r.name.slice(1):r.name;return`#${r.type}/${encodeURIComponent(a)}`}function Uw(r){const a=Vw(r);a!==window.location.hash&&window.history.replaceState(null,"",a||window.location.pathname)}function Zw({open:r,onClose:a,paths:o,senderInfo:l,contacts:d,config:f}){const p=o.map(g=>({...g,resolved:t1(g.path,l,d,f)})),h=o.length===1;return b.jsx(S0,{open:r,onOpenChange:g=>!g&&a(),children:b.jsxs(Gc,{className:"max-w-md max-h-[80vh] flex flex-col",children:[b.jsxs(Kc,{children:[b.jsxs(Qc,{children:["Message Path",!h&&`s (${o.length})`]}),b.jsx($c,{children:h?b.jsxs(b.Fragment,{children:["This shows ",b.jsx("em",{children:"one route"})," that this message traveled through the mesh network. Routers may be incorrectly identified due to prefix collisions between heard and non-heard router advertisements."]}):b.jsxs(b.Fragment,{children:["This message was received via ",b.jsxs("strong",{children:[o.length," different routes"]}),". Routers may be incorrectly identified due to prefix collisions."]})})]}),b.jsxs("div",{className:"flex-1 overflow-y-auto py-2 space-y-4",children:[p.map((g,m)=>b.jsxs("div",{children:[!h&&b.jsxs("div",{className:"text-xs text-muted-foreground font-medium mb-2 pb-1 border-b border-border",children:["Path ",m+1," — received ",Qs(g.received_at)]}),b.jsx(Ww,{resolved:g.resolved,senderInfo:l,hideStraightLine:!h})]},m)),!h&&p.length>0&&(()=>{const g=p[0].resolved;return Ct(g.sender.lat,g.sender.lon)&&Ct(g.receiver.lat,g.receiver.lon)?b.jsxs("div",{className:"pt-3 mt-1 border-t border-border",children:[b.jsx("span",{className:"text-sm text-muted-foreground",children:"Straight-line distance: "}),b.jsx("span",{className:"text-sm font-medium",children:Go(Fr(g.sender.lat,g.sender.lon,g.receiver.lat,g.receiver.lon))})]}):null})()]}),b.jsx(B0,{children:b
Line truncated
|
||||
`).map(($,de,fe)=>b.jsxs("span",{children:[Kw($,h),de<fe.length-1&&b.jsx("br",{})]},de)),!Y&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:Qs(j.sender_timestamp||j.received_at)}),!j.outgoing&&j.paths&&j.paths.length>0&&b.jsx(um,{paths:j.paths,variant:"inline",onClick:()=>C({paths:j.paths,senderInfo:I(j,Z,ne)})})]}),j.outgoing&&(j.acked>0?` ✓${j.acked>1?j.acked:""}`:" ?")]})]})]},j.id)})]}),w&&b.jsx("button",{onClick:P,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:b.jsx("polyline",{points:"6 9 12 15 18 9"})})}),T&&b.jsx(Zw,{open:!0,onClose:()=>C(null),paths:T.paths,senderInfo:T.senderInfo,contacts:a,config:g??null})]})}const cm=156,$w=140,Yw=156,Xw=120,Jw=8,e2=F.forwardRef(function({onSend:a,disabled:o,placeholder:l,isRepeaterMode:d,conversationType:f,senderName:p},h){const[g,m]=F.useState(""),[v,y]=F.useState(!1),w=F.useRef(null);F.useImperativeHandle(h,()=>({appendText:I=>{var z;m(H=>H+I),(z=w.current)==null||z.focus()}}));const S=F.useMemo(()=>{if(f==="contact")return{warningAt:$w,dangerAt:cm,hardLimit:cm};if(f==="channel"){const I=(p==null?void 0:p.length)??10,z=Math.max(1,Yw-I-2);return{warningAt:Xw,dangerAt:Math.max(1,z-Jw),hardLimit:z}}return null},[f,p]),{limitState:T,warningMessage:C}=F.useMemo(()=>{if(!S)return{limitState:"normal",warningMessage:null};const I=g.length;return I>=S.hardLimit?{limitState:"error",warningMessage:"likely truncated by radio"}:I>=S.dangerAt?{limitState:"danger",warningMessage:"may impact multi-repeater hop delivery"}:I>=S.warningAt?{limitState:"warning",warningMessage:"may impact multi-repeater hop delivery"}:{limitState:"normal",warningMessage:null}},[g.length,S]),k=S?S.hardLimit-g.length:0,D=F.useCallback(async I=>{I.preventDefault();const z=g.trim();if(d){if(v||o)return;y(!0);try{await a(z),m("")}catch(H){console.error("Failed to request telemetry:",H),_t.error("Failed to request telemetry",{description:H instanceof Error?H.message:"Check radio connection"});return}finally{y(!1)}setTimeout(()=>{var H;return(H=w.current)==null?void 0:H.focus()},0)}else{if(!z||v||o)return;y(!0);try{await a(z),m("")}catch(H){console.error("Failed to send message:",H),_t.error("Failed to send message",{description:H instanceof Error?H.message:"Check radio connection"});return}finally{y(!1)}setTimeout(()=>{var H;return(H=w.current)==null?void 0:H.focus()},0)}},[g,v,o,a,d]),P=F.useCallback(I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),D(I))},[D]),B=d?!0:g.trim().length>0,N=!d&&S!==null;return b.jsxs("form",{className:"px-4 py-3 border-t border-border flex flex-col gap-1",onSubmit:D,children:[b.jsxs("div",{className:"flex gap-2",children:[b.jsx(Xt,{ref:w,type:d?"password":"text",autoComplete:d?"off":void 0,value:g,onChange:I=>m(I.target.value),onKeyDown:P,placeholder:l||(d?"Enter password for admin login...":"Type a message..."),disabled:o||v,className:"flex-1 min-w-0"}),b.jsx(Pn,{type:"submit",disabled:o||v||!B,className:"flex-shrink-0",children:v?d?"Logging in...":"Sending...":d?g.trim()?"Log in with password":"Log in as guest/use repeater ACLs":"Send"})]}),N&&b.jsxs("div",{className:"flex items-center justify-end gap-2 text-xs",children:[b.jsxs("span",{className:at("tabular-nums",T==="error"||T==="danger"?"text-red-500 font-medium":T==="warning"?"text-yellow-500":"text-muted-foreground"),children:[g.length,"/",S.hardLimit,k<0&&` (${k})`]}),C&&b.jsxs("span",{className:at(T==="error"?"text-red-500":"text-yellow-500"),children:["— ",C]})]})]})});function dm(r){const a=t2(r),o=F.forwardRef((l,d)=>{const{children:f,...p}=l,h=F.Children.toArray(f),g=h.find(r2);if(g){const m=g.props.children,v=h.map(y=>y===g?F.Children.count(m)>1?F.Children.only(null):F.isValidElement(m)?m.props.children:null:y);return b.jsx(a,{...p,ref:d,children:F.isValidElement(m)?F.cloneElement(m,void 0,v):null})}return b.jsx(a,{...p,ref:d,children:f})});return o.displayName=`${r}.Slot`,o}function t2(r){const a=F.forwardRef((o,l)=>{const{children:d,...f}=o;if(F.isValidElement(d)){const p=o2(d),h=i2(f,d.props);return d.type!==F.Fragment&&(h.ref=l?fl(l,p):p),F.cloneElement(d,h)}return F.Children.count(d)>1?F.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var n2=Symbol("radix.slottable");function r2(r){return F.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===n2}function i2(r,a){const o={...a};for(const l in a){const d=r[l],f=a[l];/^on[A-Z]/.test(l)?d&&f?o[l]=(...h)=>{const g=f(...h);return d(...h),g}:d&&(o[l]=d):l==="style"?o[l]={...d,...f}:l==="className"&&(o[l]=[d,f].filter(Boolean).join(" "))}return{...r,...o}}function
Line truncated
|
||||
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
|
||||
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
||||
*/var X2=sl.exports,pm;function J2(){return pm||(pm=1,(function(r,a){(function(o,l){l(a)})(X2,(function(o){var l="1.9.4";function d(t){var i,u,A,E;for(u=1,A=arguments.length;u<A;u++){E=arguments[u];for(i in E)t[i]=E[i]}return t}var f=Object.create||(function(){function t(){}return function(i){return t.prototype=i,new t}})();function p(t,i){var u=Array.prototype.slice;if(t.bind)return t.bind.apply(t,u.call(arguments,1));var A=u.call(arguments,2);return function(){return t.apply(i,A.length?A.concat(u.call(arguments)):arguments)}}var h=0;function g(t){return"_leaflet_id"in t||(t._leaflet_id=++h),t._leaflet_id}function m(t,i,u){var A,E,O,Q;return Q=function(){A=!1,E&&(O.apply(u,E),E=!1)},O=function(){A?E=arguments:(t.apply(u,arguments),setTimeout(Q,i),A=!0)},O}function v(t,i,u){var A=i[1],E=i[0],O=A-E;return t===A&&u?t:((t-E)%O+O)%O+E}function y(){return!1}function w(t,i){if(i===!1)return t;var u=Math.pow(10,i===void 0?6:i);return Math.round(t*u)/u}function S(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function T(t){return S(t).split(/\s+/)}function C(t,i){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?f(t.options):{});for(var u in i)t.options[u]=i[u];return t.options}function k(t,i,u){var A=[];for(var E in t)A.push(encodeURIComponent(u?E.toUpperCase():E)+"="+encodeURIComponent(t[E]));return(!i||i.indexOf("?")===-1?"?":"&")+A.join("&")}var D=/\{ *([\w_ -]+) *\}/g;function P(t,i){return t.replace(D,function(u,A){var E=i[A];if(E===void 0)throw new Error("No value provided for variable "+u);return typeof E=="function"&&(E=E(i)),E})}var B=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function N(t,i){for(var u=0;u<t.length;u++)if(t[u]===i)return u;return-1}var I="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function z(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var H=0;function j(t){var i=+new Date,u=Math.max(0,16-(i-H));return H=i+u,window.setTimeout(t,u)}var ee=window.requestAnimationFrame||z("RequestAnimationFrame")||j,Z=window.cancelAnimationFrame||z("CancelAnimationFrame")||z("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function V(t,i,u){if(u&&ee===j)t.call(i);else return ee.call(window,p(t,i))}function ne(t){t&&Z.call(window,t)}var J={__proto__:null,extend:d,create:f,bind:p,get lastId(){return h},stamp:g,throttle:m,wrapNum:v,falseFn:y,formatNum:w,trim:S,splitWords:T,setOptions:C,getParamString:k,template:P,isArray:B,indexOf:N,emptyImageUrl:I,requestFn:ee,cancelFn:Z,requestAnimFrame:V,cancelAnimFrame:ne};function ie(){}ie.extend=function(t){var i=function(){C(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},u=i.__super__=this.prototype,A=f(u);A.constructor=i,i.prototype=A;for(var E in this)Object.prototype.hasOwnProperty.call(this,E)&&E!=="prototype"&&E!=="__super__"&&(i[E]=this[E]);return t.statics&&d(i,t.statics),t.includes&&(he(t.includes),d.apply(null,[A].concat(t.includes))),d(A,t),delete A.statics,delete A.includes,A.options&&(A.options=u.options?f(u.options):{},d(A.options,t.options)),A._initHooks=[],A.callInitHooks=function(){if(!this._initHooksCalled){u.callInitHooks&&u.callInitHooks.call(this),this._initHooksCalled=!0;for(var O=0,Q=A._initHooks.length;O<Q;O++)A._initHooks[O].call(this)}},i},ie.include=function(t){var i=this.prototype.options;return d(this.prototype,t),t.options&&(this.prototype.options=i,this.mergeOptions(t.options)),this},ie.mergeOptions=function(t){return d(this.prototype.options,t),this},ie.addInitHook=function(t){var i=Array.prototype.slice.call(arguments,1),u=typeof t=="function"?t:function(){this[t].apply(this,i)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(u),this};function he(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=B(t)?t:[t];for(var i=0;i<t.length;i++)t[i]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var ae={on:function(t,i,u){if(typeof t=="object")for(var A in t)this._on(A,t[A],i);else{t=T(t);for(var E=0,O=t.length;E<O;E++)this._on(t[E],i,u)}return this},off:function(t,i,u){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var A in t)this._off(A,t[A],i);else{t=T(t);for(var E=arguments.length===1,O=0,Q=t.length;O<Q;O++)E?this._off(t[O]):this._off(t[O],i,u)}return this},_on:function(t,i,u,A){if(typeof i!="function"){console.warn("wrong listener type: "+typeof i);return}if(this._listens(t,i,u)===!1){u===this&&(u=void 0);var E={fn:i,ctx:u};A&&(E.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(E)}},_off:function(t,i,u){var A,E,O;if(this._events&&(A=this._events[t],!!A)){if(arguments.length===1){if(this._firingCount)for(E=0,O=A.length;E<O;E++)A[E].fn=y;delete this._events[t];return}if(typeof i!="function"){console.warn("wrong listener type: "+typeof i);return}var Q=tLine truncated
|
||||
(c) 2012 by Cédric Mesnil. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/return(function(l){var d=o,f=d.lib,p=f.WordArray,h=f.Hasher,g=d.algo,m=p.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),v=p.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),y=p.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),w=p.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),S=p.create([0,1518500249,1859775393,2400959708,2840853838]),T=p.create([1352829926,1548603684,1836072691,2053994217,0]),C=g.RIPEMD160=h.extend({_doReset:function(){this._hash=p.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(z,H){for(var j=0;j<16;j++){var ee=H+j,Z=z[ee];z[ee]=(Z<<8|Z>>>24)&16711935|(Z<<24|Z>>>8)&4278255360}var V=this._hash.words,ne=S.words,J=T.words,ie=m.words,he=v.words,ae=y.words,pe=w.words,G,Y,q,R,U,K,$,de,fe,ke;K=G=V[0],$=Y=V[1],de=q=V[2],fe=R=V[3],ke=U=V[4];for(var Ae,j=0;j<80;j+=1)Ae=G+z[H+ie[j]]|0,j<16?Ae+=k(Y,q,R)+ne[0]:j<32?Ae+=D(Y,q,R)+ne[1]:j<48?Ae+=P(Y,q,R)+ne[2]:j<64?Ae+=B(Y,q,R)+ne[3]:Ae+=N(Y,q,R)+ne[4],Ae=Ae|0,Ae=I(Ae,ae[j]),Ae=Ae+U|0,G=U,U=R,R=I(q,10),q=Y,Y=Ae,Ae=K+z[H+he[j]]|0,j<16?Ae+=N($,de,fe)+J[0]:j<32?Ae+=B($,de,fe)+J[1]:j<48?Ae+=P($,de,fe)+J[2]:j<64?Ae+=D($,de,fe)+J[3]:Ae+=k($,de,fe)+J[4],Ae=Ae|0,Ae=I(Ae,pe[j]),Ae=Ae+ke|0,K=ke,ke=fe,fe=I(de,10),de=$,$=Ae;Ae=V[1]+q+fe|0,V[1]=V[2]+R+ke|0,V[2]=V[3]+U+K|0,V[3]=V[4]+G+$|0,V[4]=V[0]+Y+de|0,V[0]=Ae},_doFinalize:function(){var z=this._data,H=z.words,j=this._nDataBytes*8,ee=z.sigBytes*8;H[ee>>>5]|=128<<24-ee%32,H[(ee+64>>>9<<4)+14]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360,z.sigBytes=(H.length+1)*4,this._process();for(var Z=this._hash,V=Z.words,ne=0;ne<5;ne++){var J=V[ne];V[ne]=(J<<8|J>>>24)&16711935|(J<<24|J>>>8)&4278255360}return Z},clone:function(){var z=h.clone.call(this);return z._hash=this._hash.clone(),z}});function k(z,H,j){return z^H^j}function D(z,H,j){return z&H|~z&j}function P(z,H,j){return(z|~H)^j}function B(z,H,j){return z&j|H&~j}function N(z,H,j){return z^(H|~j)}function I(z,H){return z<<H|z>>>32-H}d.RIPEMD160=h._createHelper(C),d.HmacRIPEMD160=h._createHmacHelper(C)})(),o.RIPEMD160})})(oc)),oc.exports}var sc={exports:{}},Vb=sc.exports,Fm;function rd(){return Fm||(Fm=1,(function(r,a){(function(o,l){r.exports=l(dt())})(Vb,function(o){(function(){var l=o,d=l.lib,f=d.Base,p=l.enc,h=p.Utf8,g=l.algo;g.HMAC=f.extend({init:function(m,v){m=this._hasher=new m.init,typeof v=="string"&&(v=h.parse(v));var y=m.blockSize,w=y*4;v.sigBytes>w&&(v=m.finalize(v)),v.clamp();for(var S=this._oKey=v.clone(),T=this._iKey=v.clone(),C=S.words,k=T.words,D=0;D<y;D++)C[D]^=1549556828,k[D]^=909522486;S.sigBytes=T.sigBytes=w,this.reset()},reset:function(){var m=this._hasher;m.reset(),m.update(this._iKey)},update:function(m){return this._hasher.update(m),this},finalize:function(m){var v=this._hasher,y=v.finalize(m);v.reset();var w=v.finalize(this._oKey.clone().concat(y));return w}})})()})})(sc)),sc.exports}var ac={exports:{}},Ub=ac.exports,Nm;function Zb(){return Nm||(Nm=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),ml(),rd())})(Ub,function(o){return(function(){var l=o,d=l.lib,f=d.Base,p=d.WordArray,h=l.algo,g=h.SHA256,m=h.HMAC,v=h.PBKDF2=f.extend({cfg:f.extend({keySize:128/32,hasher:g,iterations:25e4}),init:function(y){this.cfg=this.cfg.extend(y)},compute:function(y,w){for(var S=this.cfg,T=m.create(S.hasher,y),C=p.create(),k=p.create([1]),D=C.words,P=k.words,B=S.keySize,N=S.iterations;D.length<B;){var I=T.update(w).finalize(k);T.reset();for(var z=I.words,H=z.length,j=I,ee=1;ee<N;ee++){j=T.finalize(j),T.reset();for(var Z=j.words,V=0;V<H;V++)z[V]^=Z[V]}C.concat(I),P[0]++}return C.sigBytes=B*4,C}});l.PBKDF2=function(y,w,S){return v.create(S).compute(y,w)}})(),o.PBKDF2})})(ac)),ac.exports}var lc={exports:{}},Wb=lc.exports,Lm;function fo(){return Lm||(Lm=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),bx(),rd())})(Wb,function(o){return(function(){var l=o,d=l.lib,f=d.Base,p=d.WordArray,h=l.algo,g=h.MD5,m=h.EvpKDF=f.extend({cfg:f.extend({keySize:128/32,hasher:g,iterations:1}),init:function(v){this.cfg=this.cfg.extend(v)},compute:function(v,y){for(var w,S=this.cfg,T=S.hasher.create(),C=p.create(),k=C.words,D=S.keySize,P=S.iterations;k.length<D;){w&&T.update(w),w=T.update(v).finalize(y),T.reset();for(var B=1;B<P;B++)w=T.finalize(w),T.reset();C.concat(w)}return C.sigBytes=D*4,C}});l.EvpKDF=function(v,y,w){return m.create(w).compute(v,y)}})(),o.EvpKDF})})(lc)),lc.exports}var uc={exports:{}},qb=uc.exports,Line truncated
|
||||
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||||
* derived from CryptoJS.mode.CTR
|
||||
* Jan Hruby jhruby.web@gmail.com
|
||||
*/return o.mode.CTRGladman=(function(){var l=o.lib.BlockCipherMode.extend();function d(h){if((h>>24&255)===255){var g=h>>16&255,m=h>>8&255,v=h&255;g===255?(g=0,m===255?(m=0,v===255?v=0:++v):++m):++g,h=0,h+=g<<16,h+=m<<8,h+=v}else h+=1<<24;return h}function f(h){return(h[0]=d(h[0]))===0&&(h[1]=d(h[1])),h}var p=l.Encryptor=l.extend({processBlock:function(h,g){var m=this._cipher,v=m.blockSize,y=this._iv,w=this._counter;y&&(w=this._counter=y.slice(0),this._iv=void 0),f(w);var S=w.slice(0);m.encryptBlock(S,0);for(var T=0;T<v;T++)h[g+T]^=S[T]}});return l.Decryptor=p,l})(),o.mode.CTRGladman})})(fc)),fc.exports}var hc={exports:{}},Jb=hc.exports,zm;function eC(){return zm||(zm=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),pn())})(Jb,function(o){return o.mode.OFB=(function(){var l=o.lib.BlockCipherMode.extend(),d=l.Encryptor=l.extend({processBlock:function(f,p){var h=this._cipher,g=h.blockSize,m=this._iv,v=this._keystream;m&&(v=this._keystream=m.slice(0),this._iv=void 0),h.encryptBlock(v,0);for(var y=0;y<g;y++)f[p+y]^=v[y]}});return l.Decryptor=d,l})(),o.mode.OFB})})(hc)),hc.exports}var pc={exports:{}},tC=pc.exports,Hm;function nC(){return Hm||(Hm=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),pn())})(tC,function(o){return o.mode.ECB=(function(){var l=o.lib.BlockCipherMode.extend();return l.Encryptor=l.extend({processBlock:function(d,f){this._cipher.encryptBlock(d,f)}}),l.Decryptor=l.extend({processBlock:function(d,f){this._cipher.decryptBlock(d,f)}}),l})(),o.mode.ECB})})(pc)),pc.exports}var mc={exports:{}},rC=mc.exports,Vm;function iC(){return Vm||(Vm=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),pn())})(rC,function(o){return o.pad.AnsiX923={pad:function(l,d){var f=l.sigBytes,p=d*4,h=p-f%p,g=f+h-1;l.clamp(),l.words[g>>>2]|=h<<24-g%4*8,l.sigBytes+=h},unpad:function(l){var d=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=d}},o.pad.Ansix923})})(mc)),mc.exports}var gc={exports:{}},oC=gc.exports,Um;function sC(){return Um||(Um=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),pn())})(oC,function(o){return o.pad.Iso10126={pad:function(l,d){var f=d*4,p=f-l.sigBytes%f;l.concat(o.lib.WordArray.random(p-1)).concat(o.lib.WordArray.create([p<<24],1))},unpad:function(l){var d=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=d}},o.pad.Iso10126})})(gc)),gc.exports}var Ac={exports:{}},aC=Ac.exports,Zm;function lC(){return Zm||(Zm=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),pn())})(aC,function(o){return o.pad.Iso97971={pad:function(l,d){l.concat(o.lib.WordArray.create([2147483648],1)),o.pad.ZeroPadding.pad(l,d)},unpad:function(l){o.pad.ZeroPadding.unpad(l),l.sigBytes--}},o.pad.Iso97971})})(Ac)),Ac.exports}var xc={exports:{}},uC=xc.exports,Wm;function cC(){return Wm||(Wm=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),pn())})(uC,function(o){return o.pad.ZeroPadding={pad:function(l,d){var f=d*4;l.clamp(),l.sigBytes+=f-(l.sigBytes%f||f)},unpad:function(l){for(var d=l.words,f=l.sigBytes-1,f=l.sigBytes-1;f>=0;f--)if(d[f>>>2]>>>24-f%4*8&255){l.sigBytes=f+1;break}}},o.pad.ZeroPadding})})(xc)),xc.exports}var vc={exports:{}},dC=vc.exports,qm;function fC(){return qm||(qm=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),pn())})(dC,function(o){return o.pad.NoPadding={pad:function(){},unpad:function(){}},o.pad.NoPadding})})(vc)),vc.exports}var yc={exports:{}},hC=yc.exports,Gm;function pC(){return Gm||(Gm=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),pn())})(hC,function(o){return(function(l){var d=o,f=d.lib,p=f.CipherParams,h=d.enc,g=h.Hex,m=d.format;m.Hex={stringify:function(v){return v.ciphertext.toString(g)},parse:function(v){var y=g.parse(v);return p.create({ciphertext:y})}}})(),o.format.Hex})})(yc)),yc.exports}var _c={exports:{}},mC=_c.exports,Km;function gC(){return Km||(Km=1,(function(r,a){(function(o,l,d){r.exports=l(dt(),$o(),Yo(),fo(),pn())})(mC,function(o){return(function(){var l=o,d=l.lib,f=d.BlockCipher,p=l.algo,h=[],g=[],m=[],v=[],y=[],w=[],S=[],T=[],C=[],k=[];(function(){for(var B=[],N=0;N<256;N++)N<128?B[N]=N<<1:B[N]=N<<1^283;for(var I=0,z=0,N=0;N<256;N++){var H=z^z<<1^z<<2^z<<3^z<<4;H=H>>>8^H&255^99,h[I]=H,g[H]=I;var j=B[I],ee=B[j],Z=B[ee],V=B[H]*257^H*16843008;m[I]=V<<24|V>>>8,v[I]=V<<16|V>>>16,y[I]=V<<8|V>>>24,w[I]=V;var V=Z*16843009^ee*65537^j*257^I*16843008;S[H]=V<<24|V>>>8,T[H]=V<<16|V>>>16,C[H]=V<<8|V>>>24,k[H]=V,I?(I=j^B[B[B[Z^j]]],z^=B[B[z]]):I=z=1}})();var D=[0,1,2,4,8,16,32,64,128,27,54],P=p.AES=f.extend({_doReset:function(){var B;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var N=this._keyPriorReset=this._key,I=N.words,z=N.sigBytes/4,H=this._nRounds=z+6,j=(H+1)*4,ee=this._keySchedule=[],Z=0;Z<j;Z++)Z<z?ee[Z]=I[Z]:(B=ee[Z-1],Z%z?z>6&&Z%z==4&&(B=h[B>>>24]<<24|h[B>>>16&255]<<16|h[B>>>8&255]<<8|h[B&255]):(B=B<<8|B>>>24,B=h[B>>>24]<<24|h[B>>>16&255]<<16|h[B>>>8&255]<<8|h[B&255],B^=D[Z/z|0]<<24),ee[Z]=ee[Z-z]^B);for(var V=this._invKeySchedule=[],ne=0;ne<j;ne++){var Z=j-ne;if(ne%4)var B=ee[Z];else var B=ee[Z-4];ne<4||Z<=4?V[ne]=B:V[ne]=S[h[B>>>24]]^T[h[B>>>16&255]]^C[h[B>>>8&255]]^k[h[B&255]Line truncated
|
||||
• Timestamp (4 bytes) - send time as unix timestamp
|
||||
• Request Type (1 byte) - type of request (GetStats, GetTelemetryData, etc.)
|
||||
• Request Data (remaining bytes) - additional request-specific data`,startByte:h+g,endByte:h+d.length-1,value:w});const S={type:r.PayloadType.Request,version:r.PayloadVersion.Version1,isValid:!0,timestamp:0,requestType:r.RequestType.GetStats,requestData:"",destinationHash:m,sourceHash:v,cipherMac:y,ciphertext:w};return f!=null&&f.includeSegments&&(S.segments=p),S}catch(p){return{type:r.PayloadType.Request,version:r.PayloadVersion.Version1,isValid:!1,errors:[p instanceof Error?p.message:"Failed to decode request payload"],timestamp:0,requestType:r.RequestType.GetStats,requestData:"",destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:""}}}}return Ja.RequestPayloadDecoder=o,Ja}var el={},Ag;function XC(){if(Ag)return el;Ag=1,Object.defineProperty(el,"__esModule",{value:!0}),el.ResponsePayloadDecoder=void 0;const r=sr(),a=vn();class o{static decode(d,f){try{if(d.length<4){const T={type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!1,errors:["Response payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return f!=null&&f.includeSegments&&(T.segments=[{name:"Invalid Response Data",description:"Response payload too short (minimum 4 bytes required)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),T}const p=[],h=(f==null?void 0:f.segmentOffset)||0;let g=0;const m=(0,a.byteToHex)(d[g]);f!=null&&f.includeSegments&&p.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:h+g,endByte:h+g,value:m}),g+=1;const v=(0,a.byteToHex)(d[g]);f!=null&&f.includeSegments&&p.push({name:"Source Hash",description:"First byte of source node public key",startByte:h+g,endByte:h+g,value:v}),g+=1;const y=(0,a.bytesToHex)(d.subarray(g,g+2));f!=null&&f.includeSegments&&p.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:h+g,endByte:h+g+1,value:y}),g+=2;const w=(0,a.bytesToHex)(d.subarray(g));f!=null&&f.includeSegments&&d.length>g&&p.push({name:"Ciphertext",description:"Encrypted response data (tag + content)",startByte:h+g,endByte:h+d.length-1,value:w});const S={type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:m,sourceHash:v,cipherMac:y,ciphertext:w,ciphertextLength:d.length-4};return f!=null&&f.includeSegments&&(S.segments=p),S}catch(p){return{type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!1,errors:[p instanceof Error?p.message:"Failed to decode response payload"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return el.ResponsePayloadDecoder=o,el}var tl={},xg;function JC(){if(xg)return tl;xg=1,Object.defineProperty(tl,"__esModule",{value:!0}),tl.AnonRequestPayloadDecoder=void 0;const r=sr(),a=vn();class o{static decode(d,f){try{if(d.length<35){const T={type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!1,errors:["AnonRequest payload too short (minimum 35 bytes: dest + public key + MAC)"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return f!=null&&f.includeSegments&&(T.segments=[{name:"Invalid AnonRequest Data",description:"AnonRequest payload too short (minimum 35 bytes required: 1 for dest hash + 32 for public key + 2 for MAC)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),T}const p=[],h=(f==null?void 0:f.segmentOffset)||0;let g=0;const m=(0,a.byteToHex)(d[0]);f!=null&&f.includeSegments&&p.push({name:"Destination Hash",description:`First byte of destination node public key: 0x${m}`,startByte:h+g,endByte:h+g,value:m}),g+=1;const v=(0,a.bytesToHex)(d.subarray(1,33));f!=null&&f.includeSegments&&p.push({name:"Sender Public Key",description:"Ed25519 public key of the sender (32 bytes)",startByte:h+g,endByte:h+g+31,value:v}),g+=32;const y=(0,a.bytesToHex)(d.subarray(33,35));f!=null&&f.includeSegments&&p.push({name:"Cipher MAC",description:"MAC for encrypted data verification (2 bytes)",startByte:h+g,endByte:h+g+1,value:y}),g+=2;const w=(0,a.bytesToHex)(d.subarray(35));f!=null&&f.includeSegments&&d.length>35&&p.push({name:"Ciphertext",description:`Encrypted message data (${d.length-35} bytes). Contains encrypted plaintext with this structure:
|
||||
• Timestamp (4 bytes) - send time as unix timestamp
|
||||
• Sync Timestamp (4 bytes) - room server only, sender's "sync messages SINCE x" timestamp
|
||||
• Password (remaining bytes) - password for repeater/room`,startByte:h+g,endByte:h+d.length-1,value:w});const S={type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:m,senderPublicKey:v,cipherMac:y,ciphertext:w,ciphertextLength:d.length-35};return f!=null&&f.includeSegments&&(S.segments=p),S}catch(p){return{type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!1,errors:[p instanceof Error?p.message:"Failed to decode AnonRequest payload"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return tl.AnonRequestPayloadDecoder=o,tl}var nl={},vg;function eE(){if(vg)return nl;vg=1,Object.defineProperty(nl,"__esModule",{value:!0}),nl.AckPayloadDecoder=void 0;const r=sr(),a=vn();class o{static decode(d,f){try{if(d.length<4){const v={type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!1,errors:["Ack payload too short (minimum 4 bytes for checksum)"],checksum:""};return f!=null&&f.includeSegments&&(v.segments=[{name:"Invalid Ack Data",description:"Ack payload too short (minimum 4 bytes required for checksum)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),v}const p=[],h=(f==null?void 0:f.segmentOffset)||0,g=(0,a.bytesToHex)(d.subarray(0,4));f!=null&&f.includeSegments&&p.push({name:"Checksum",description:`CRC checksum of message timestamp, text, and sender pubkey: 0x${g}`,startByte:h,endByte:h+3,value:g}),f!=null&&f.includeSegments&&d.length>4&&p.push({name:"Additional Data",description:"Extra data in Ack payload",startByte:h+4,endByte:h+d.length-1,value:(0,a.bytesToHex)(d.subarray(4))});const m={type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!0,checksum:g};return f!=null&&f.includeSegments&&(m.segments=p),m}catch(p){return{type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!1,errors:[p instanceof Error?p.message:"Failed to decode Ack payload"],checksum:""}}}}return nl.AckPayloadDecoder=o,nl}var rl={},yg;function tE(){if(yg)return rl;yg=1,Object.defineProperty(rl,"__esModule",{value:!0}),rl.PathPayloadDecoder=void 0;const r=sr(),a=vn();class o{static decode(d){try{if(d.length<2)return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:["Path payload too short (minimum 2 bytes: path length + extra type)"],pathLength:0,pathHashes:[],extraType:0,extraData:""};const f=d[0];if(d.length<1+f+1)return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:[`Path payload too short (need ${1+f+1} bytes for path length + path + extra type)`],pathLength:f,pathHashes:[],extraType:0,extraData:""};const p=[];for(let m=0;m<f;m++)p.push((0,a.byteToHex)(d[1+m]));const h=d[1+f];let g="";return d.length>1+f+1&&(g=(0,a.bytesToHex)(d.subarray(1+f+1))),{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!0,pathLength:f,pathHashes:p,extraType:h,extraData:g}}catch(f){return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:[f instanceof Error?f.message:"Failed to decode Path payload"],pathLength:0,pathHashes:[],extraType:0,extraData:""}}}}return rl.PathPayloadDecoder=o,rl}var il={},_g;function nE(){if(_g)return il;_g=1,Object.defineProperty(il,"__esModule",{value:!0}),il.TextMessagePayloadDecoder=void 0;const r=sr(),a=vn();class o{static decode(d,f){try{if(d.length<4){const T={type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,isValid:!1,errors:["TextMessage payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return f!=null&&f.includeSegments&&(T.segments=[{name:"Invalid TextMessage Data",description:"TextMessage payload too short (minimum 4 bytes required)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),T}const p=[],h=(f==null?void 0:f.segmentOffset)||0;let g=0;const m=(0,a.byteToHex)(d[g]);f!=null&&f.includeSegments&&p.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:h+g,endByte:h+g,value:m}),g+=1;const v=(0,a.byteToHex)(d[g]);f!=null&&f.includeSegments&&p.push({name:"Source Hash",description:"First byte of source node public key",startByte:h+g,endByte:h+g,value:v}),g+=1;const y=(0,a.bytesToHex)(d.subarray(g,g+2));f!=null&&f.includeSegments&&p.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:h+g,endByte:h+g+1,value:y}),g+=2;const w=(0,a.bytesToHex)(d.subarray(g));f!=null&&f.includeSegments&&d.length>g&&p.push({name:"Ciphertext",description:"Encrypted message data (timestamp + message text)",startByte:h+g,endByte:h+d.length-1,value:w});const S={type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:m,sourceHash:v,cipherMac:y,ciphertext:w,ciphertextLength:d.length-4};return f!=null&&f.includeSegments&&(S.segments=p),S}catch(p){return{type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,i
Line truncated
|
||||
// SHA256 round constants
|
||||
const K: array<u32, 64> = array<u32, 64>(
|
||||
0x428a2f98u, 0x71374491u, 0xb5c0fbcfu, 0xe9b5dba5u, 0x3956c25bu, 0x59f111f1u, 0x923f82a4u, 0xab1c5ed5u,
|
||||
0xd807aa98u, 0x12835b01u, 0x243185beu, 0x550c7dc3u, 0x72be5d74u, 0x80deb1feu, 0x9bdc06a7u, 0xc19bf174u,
|
||||
0xe49b69c1u, 0xefbe4786u, 0x0fc19dc6u, 0x240ca1ccu, 0x2de92c6fu, 0x4a7484aau, 0x5cb0a9dcu, 0x76f988dau,
|
||||
0x983e5152u, 0xa831c66du, 0xb00327c8u, 0xbf597fc7u, 0xc6e00bf3u, 0xd5a79147u, 0x06ca6351u, 0x14292967u,
|
||||
0x27b70a85u, 0x2e1b2138u, 0x4d2c6dfcu, 0x53380d13u, 0x650a7354u, 0x766a0abbu, 0x81c2c92eu, 0x92722c85u,
|
||||
0xa2bfe8a1u, 0xa81a664bu, 0xc24b8b70u, 0xc76c51a3u, 0xd192e819u, 0xd6990624u, 0xf40e3585u, 0x106aa070u,
|
||||
0x19a4c116u, 0x1e376c08u, 0x2748774cu, 0x34b0bcb5u, 0x391c0cb3u, 0x4ed8aa4au, 0x5b9cca4fu, 0x682e6ff3u,
|
||||
0x748f82eeu, 0x78a5636fu, 0x84c87814u, 0x8cc70208u, 0x90befffau, 0xa4506cebu, 0xbef9a3f7u, 0xc67178f2u
|
||||
);
|
||||
|
||||
// Character lookup table (a-z = 0-25, 0-9 = 26-35, dash = 36)
|
||||
const CHARS: array<u32, 37> = array<u32, 37>(
|
||||
0x61u, 0x62u, 0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6au, // a-j
|
||||
0x6bu, 0x6cu, 0x6du, 0x6eu, 0x6fu, 0x70u, 0x71u, 0x72u, 0x73u, 0x74u, // k-t
|
||||
0x75u, 0x76u, 0x77u, 0x78u, 0x79u, 0x7au, // u-z
|
||||
0x30u, 0x31u, 0x32u, 0x33u, 0x34u, 0x35u, 0x36u, 0x37u, 0x38u, 0x39u, // 0-9
|
||||
0x2du // dash
|
||||
);
|
||||
|
||||
struct Params {
|
||||
target_channel_hash: u32,
|
||||
batch_offset: u32,
|
||||
name_length: u32,
|
||||
batch_size: u32,
|
||||
target_mac: u32, // First 2 bytes of target MAC (in high 16 bits)
|
||||
ciphertext_words: u32, // Number of 32-bit words in ciphertext
|
||||
ciphertext_len_bits: u32, // Length of ciphertext in bits
|
||||
verify_mac: u32, // 1 to verify MAC, 0 to skip
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> params: Params;
|
||||
@group(0) @binding(1) var<storage, read_write> match_count: atomic<u32>;
|
||||
@group(0) @binding(2) var<storage, read_write> match_indices: array<u32>;
|
||||
@group(0) @binding(3) var<storage, read> ciphertext: array<u32>; // Ciphertext data
|
||||
|
||||
fn rotr(x: u32, n: u32) -> u32 {
|
||||
return (x >> n) | (x << (32u - n));
|
||||
}
|
||||
|
||||
fn ch(x: u32, y: u32, z: u32) -> u32 {
|
||||
return (x & y) ^ (~x & z);
|
||||
}
|
||||
|
||||
fn maj(x: u32, y: u32, z: u32) -> u32 {
|
||||
return (x & y) ^ (x & z) ^ (y & z);
|
||||
}
|
||||
|
||||
fn sigma0(x: u32) -> u32 {
|
||||
return rotr(x, 2u) ^ rotr(x, 13u) ^ rotr(x, 22u);
|
||||
}
|
||||
|
||||
fn sigma1(x: u32) -> u32 {
|
||||
return rotr(x, 6u) ^ rotr(x, 11u) ^ rotr(x, 25u);
|
||||
}
|
||||
|
||||
fn gamma0(x: u32) -> u32 {
|
||||
return rotr(x, 7u) ^ rotr(x, 18u) ^ (x >> 3u);
|
||||
}
|
||||
|
||||
fn gamma1(x: u32) -> u32 {
|
||||
return rotr(x, 17u) ^ rotr(x, 19u) ^ (x >> 10u);
|
||||
}
|
||||
|
||||
// Convert index to room name bytes, returns the hash as a u32 for the first byte check
|
||||
fn index_to_room_name(idx: u32, length: u32, msg: ptr<function, array<u32, 16>>) -> bool {
|
||||
// Message starts with '#' (0x23)
|
||||
var byte_pos = 0u;
|
||||
var word_idx = 0u;
|
||||
var current_word = 0x23000000u; // '#' in big-endian position 0
|
||||
byte_pos = 1u;
|
||||
|
||||
var remaining = idx;
|
||||
var prev_was_dash = false;
|
||||
|
||||
// Generate room name from index
|
||||
for (var i = 0u; i < length; i++) {
|
||||
let char_count = select(37u, 36u, i == 0u || i == length - 1u); // no dash at start/end
|
||||
var char_idx = remaining % char_count;
|
||||
remaining = remaining / char_count;
|
||||
|
||||
// Check for consecutive dashes (invalid)
|
||||
let is_dash = char_idx == 36u && i > 0u && i < length - 1u;
|
||||
if (is_dash && prev_was_dash) {
|
||||
return false; // Invalid: consecutive dashes
|
||||
}
|
||||
prev_was_dash = is_dash;
|
||||
|
||||
// Map char index to actual character
|
||||
let c = CHARS[char_idx];
|
||||
|
||||
// Pack byte into current word (big-endian)
|
||||
let shift = (3u - byte_pos % 4u) * 8u;
|
||||
if (byte_pos % 4u == 0u && byte_pos > 0u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
current_word = 0u;
|
||||
}
|
||||
current_word = current_word | (c << shift);
|
||||
byte_pos = byte_pos + 1u;
|
||||
}
|
||||
|
||||
// Add padding: 0x80 followed by zeros, then length in bits
|
||||
let msg_len_bits = (length + 1u) * 8u; // +1 for '#'
|
||||
|
||||
// Add 0x80 padding byte
|
||||
let shift = (3u - byte_pos % 4u) * 8u;
|
||||
if (byte_pos % 4u == 0u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
current_word = 0x80000000u;
|
||||
} else {
|
||||
current_word = current_word | (0x80u << shift);
|
||||
}
|
||||
byte_pos = byte_pos + 1u;
|
||||
|
||||
// Store current word
|
||||
if (byte_pos % 4u == 0u || word_idx < 14u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
}
|
||||
|
||||
// Zero-fill until word 14
|
||||
for (var i = word_idx; i < 14u; i++) {
|
||||
(*msg)[i] = 0u;
|
||||
}
|
||||
|
||||
// Length in bits (64-bit, but we only use lower 32 bits for short messages)
|
||||
(*msg)[14u] = 0u;
|
||||
(*msg)[15u] = msg_len_bits;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
fn sha256_block(msg: ptr<function, array<u32, 16>>) -> array<u32, 8> {
|
||||
// Initialize hash values
|
||||
var h: array<u32, 8> = array<u32, 8>(
|
||||
0x6a09e667u, 0xbb67ae85u, 0x3c6ef372u, 0xa54ff53au,
|
||||
0x510e527fu, 0x9b05688cu, 0x1f83d9abu, 0x5be0cd19u
|
||||
);
|
||||
|
||||
// Message schedule
|
||||
var w: array<u32, 64>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
w[i] = (*msg)[i];
|
||||
}
|
||||
for (var i = 16u; i < 64u; i++) {
|
||||
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
|
||||
}
|
||||
|
||||
// Compression
|
||||
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
|
||||
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
|
||||
|
||||
for (var i = 0u; i < 64u; i++) {
|
||||
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
|
||||
let t2 = sigma0(a) + maj(a, b, c);
|
||||
hh = g; g = f; f = e; e = d + t1;
|
||||
d = c; c = b; b = a; a = t1 + t2;
|
||||
}
|
||||
|
||||
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
|
||||
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
// Compute SHA256 of the key (16 bytes) to get channel hash
|
||||
fn sha256_key(key: array<u32, 4>) -> u32 {
|
||||
var msg: array<u32, 16>;
|
||||
|
||||
// Key bytes (16 bytes = 4 words)
|
||||
msg[0] = key[0];
|
||||
msg[1] = key[1];
|
||||
msg[2] = key[2];
|
||||
msg[3] = key[3];
|
||||
|
||||
// Padding: 0x80 followed by zeros
|
||||
msg[4] = 0x80000000u;
|
||||
for (var i = 5u; i < 14u; i++) {
|
||||
msg[i] = 0u;
|
||||
}
|
||||
|
||||
// Length: 128 bits
|
||||
msg[14] = 0u;
|
||||
msg[15] = 128u;
|
||||
|
||||
let hash = sha256_block(&msg);
|
||||
|
||||
// Return first byte of hash (big-endian)
|
||||
return hash[0] >> 24u;
|
||||
}
|
||||
|
||||
// HMAC-SHA256 for MAC verification
|
||||
// Key is 16 bytes (4 words), padded to 32 bytes with zeros for MeshCore
|
||||
// Returns first 2 bytes of HMAC (as u32 in high 16 bits)
|
||||
fn hmac_sha256_mac(key: array<u32, 4>, ciphertext_len: u32) -> u32 {
|
||||
// HMAC: H((K' ^ opad) || H((K' ^ ipad) || message))
|
||||
// K' is 64 bytes (32 bytes key + 32 bytes zero padding for MeshCore, then padded to 64)
|
||||
// ipad = 0x36 repeated, opad = 0x5c repeated
|
||||
|
||||
// Build padded key (64 bytes = 16 words)
|
||||
// MeshCore uses 32-byte secret: 16-byte key + 16 zero bytes
|
||||
var k_pad: array<u32, 16>;
|
||||
k_pad[0] = key[0];
|
||||
k_pad[1] = key[1];
|
||||
k_pad[2] = key[2];
|
||||
k_pad[3] = key[3];
|
||||
for (var i = 4u; i < 16u; i++) {
|
||||
k_pad[i] = 0u;
|
||||
}
|
||||
|
||||
// Inner hash: SHA256((K' ^ ipad) || message)
|
||||
// First block: K' ^ ipad (64 bytes)
|
||||
var inner_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
inner_block[i] = k_pad[i] ^ 0x36363636u;
|
||||
}
|
||||
|
||||
// Initialize hash state with first block
|
||||
var h: array<u32, 8> = sha256_block(&inner_block);
|
||||
|
||||
// Process ciphertext blocks (continuing from h state)
|
||||
let ciphertext_words = params.ciphertext_words;
|
||||
var word_idx = 0u;
|
||||
|
||||
// Process full 64-byte blocks of ciphertext
|
||||
while (word_idx + 16u <= ciphertext_words) {
|
||||
var block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
block[i] = ciphertext[word_idx + i];
|
||||
}
|
||||
h = sha256_block_continue(&block, h);
|
||||
word_idx = word_idx + 16u;
|
||||
}
|
||||
|
||||
// Final block with remaining ciphertext + padding
|
||||
var final_block: array<u32, 16>;
|
||||
var remaining = ciphertext_words - word_idx;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
if (i < remaining) {
|
||||
final_block[i] = ciphertext[word_idx + i];
|
||||
} else if (i == remaining) {
|
||||
// Add 0x80 padding
|
||||
final_block[i] = 0x80000000u;
|
||||
} else {
|
||||
final_block[i] = 0u;
|
||||
}
|
||||
}
|
||||
|
||||
// Add length (64 bytes of ipad + ciphertext length)
|
||||
let total_bits = 512u + params.ciphertext_len_bits;
|
||||
if (remaining < 14u) {
|
||||
final_block[14] = 0u;
|
||||
final_block[15] = total_bits;
|
||||
h = sha256_block_continue(&final_block, h);
|
||||
} else {
|
||||
// Need extra block for length
|
||||
h = sha256_block_continue(&final_block, h);
|
||||
var len_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 14u; i++) {
|
||||
len_block[i] = 0u;
|
||||
}
|
||||
len_block[14] = 0u;
|
||||
len_block[15] = total_bits;
|
||||
h = sha256_block_continue(&len_block, h);
|
||||
}
|
||||
|
||||
let inner_hash = h;
|
||||
|
||||
// Outer hash: SHA256((K' ^ opad) || inner_hash)
|
||||
var outer_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
outer_block[i] = k_pad[i] ^ 0x5c5c5c5cu;
|
||||
}
|
||||
h = sha256_block(&outer_block);
|
||||
|
||||
// Second block: inner_hash (32 bytes) + padding
|
||||
var hash_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 8u; i++) {
|
||||
hash_block[i] = inner_hash[i];
|
||||
}
|
||||
hash_block[8] = 0x80000000u;
|
||||
for (var i = 9u; i < 14u; i++) {
|
||||
hash_block[i] = 0u;
|
||||
}
|
||||
hash_block[14] = 0u;
|
||||
hash_block[15] = 512u + 256u; // 64 bytes opad + 32 bytes inner hash
|
||||
|
||||
h = sha256_block_continue(&hash_block, h);
|
||||
|
||||
// Return first 2 bytes (high 16 bits of first word)
|
||||
return h[0] & 0xFFFF0000u;
|
||||
}
|
||||
|
||||
// SHA256 block computation continuing from existing state
|
||||
fn sha256_block_continue(msg: ptr<function, array<u32, 16>>, h_in: array<u32, 8>) -> array<u32, 8> {
|
||||
var h = h_in;
|
||||
|
||||
// Message schedule
|
||||
var w: array<u32, 64>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
w[i] = (*msg)[i];
|
||||
}
|
||||
for (var i = 16u; i < 64u; i++) {
|
||||
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
|
||||
}
|
||||
|
||||
// Compression
|
||||
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
|
||||
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
|
||||
|
||||
for (var i = 0u; i < 64u; i++) {
|
||||
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
|
||||
let t2 = sigma0(a) + maj(a, b, c);
|
||||
hh = g; g = f; f = e; e = d + t1;
|
||||
d = c; c = b; b = a; a = t1 + t2;
|
||||
}
|
||||
|
||||
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
|
||||
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
// Process a single candidate and record match if found
|
||||
fn process_candidate(name_idx: u32) {
|
||||
// Generate message for this room name
|
||||
var msg: array<u32, 16>;
|
||||
let valid = index_to_room_name(name_idx, params.name_length, &msg);
|
||||
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute SHA256("#roomname") - this gives us the key
|
||||
let key_hash = sha256_block(&msg);
|
||||
|
||||
// Take first 16 bytes (4 words) as the key
|
||||
var key: array<u32, 4>;
|
||||
key[0] = key_hash[0];
|
||||
key[1] = key_hash[1];
|
||||
key[2] = key_hash[2];
|
||||
key[3] = key_hash[3];
|
||||
|
||||
// Compute SHA256(key) to get channel hash
|
||||
let channel_hash = sha256_key(key);
|
||||
|
||||
// Check if channel hash matches target
|
||||
if (channel_hash != params.target_channel_hash) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Channel hash matches - verify MAC if enabled
|
||||
if (params.verify_mac == 1u) {
|
||||
let computed_mac = hmac_sha256_mac(key, params.ciphertext_len_bits);
|
||||
if (computed_mac != params.target_mac) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Found a match - record the index
|
||||
let match_idx = atomicAdd(&match_count, 1u);
|
||||
if (match_idx < 1024u) { // Limit stored matches
|
||||
match_indices[match_idx] = name_idx;
|
||||
}
|
||||
}
|
||||
|
||||
// Each thread processes 32 candidates to amortize thread overhead
|
||||
const CANDIDATES_PER_THREAD: u32 = 32u;
|
||||
|
||||
@compute @workgroup_size(256)
|
||||
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
||||
let base_idx = global_id.x * CANDIDATES_PER_THREAD;
|
||||
|
||||
for (var i = 0u; i < CANDIDATES_PER_THREAD; i++) {
|
||||
let idx = base_idx + i;
|
||||
if (idx >= params.batch_size) {
|
||||
return;
|
||||
}
|
||||
let name_idx = params.batch_offset + idx;
|
||||
process_candidate(name_idx);
|
||||
}
|
||||
}
|
||||
`}async init(){if(!navigator.gpu)return console.warn("WebGPU not supported"),!1;try{const a=await navigator.gpu.requestAdapter();if(!a)return console.warn("No GPU adapter found"),!1;this.device=await a.requestDevice(),this.bindGroupLayout=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]}),this.paramsBuffer=this.device.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.matchCountBuffer=this.device.createBuffer({size:4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}),this.matchIndicesBuffer=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC});for(let d=0;d<2;d++)this.matchCountReadBuffers[d]=this.device.createBuffer({size:4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.matchIndicesReadBuffers[d]=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});const o=this.device.createShaderModule({code:this.shaderCode}),l=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]});return this.pipeline=this.device.createComputePipeline({layout:l,compute:{module:o,entryPoint:"main"}}),!0}catch(a){return console.error("WebGPU initialization failed:",a),!1}}isAvailable(){return this.device!==null&&this.pipeline!==null}indexToRoomName(a,o){return qo(o,a)}countNamesForLength(a){return al(a)}async runBatch(a,o,l,d,f,p){if(!this.device||!this.pipeline||!this.bindGroupLayout||!this.paramsBuffer||!this.matchCountBuffer||!this.matchIndicesBuffer||!this.matchCountReadBuffers[0]||!this.matchCountReadBuffers[1]||!this.matchIndicesReadBuffers[0]||!this.matchIndicesReadBuffers[1])throw new Error("GPU not initialized");const h=this.currentReadBufferIndex;this.currentReadBufferIndex=1-this.currentReadBufferIndex;const g=this.matchCountReadBuffers[h],m=this.matchIndicesReadBuffers[h],v=f&&p?1:0;let y,w=0,S=0;if(v){const I=new Uint8Array(f.length/2);for(let Z=0;Z<I.length;Z++)I[Z]=parseInt(f.substr(Z*2,2),16);w=I.length*8;const z=Math.ceil(I.length/4)*4,H=new Uint8Array(z);H.set(I),y=new Uint32Array(z/4);for(let Z=0;Z<y.length;Z++)y[Z]=H[Z*4]<<24|H[Z*4+1]<<16|H[Z*4+2]<<8|H[Z*4+3];const j=parseInt(p.substr(0,2),16),ee=parseInt(p.substr(2,2),16);S=j<<24|ee<<16}else y=new Uint32Array([0]);const T=Math.max(y.length*4,4);(!this.ciphertextBuffer||this.ciphertextBufferSize<T)&&(this.ciphertextBuffer&&this.ciphertextBuffer.destroy(),this.ciphertextBuffer=this.device.createBuffer({size:T,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.ciphertextBufferSize=T,this.bindGroupDirty=!0);const C=new Uint32Array([a,l,o,d,S,y.length,w,v]);this.device.queue.writeBuffer(this.paramsBuffer,0,C),this.device.queue.writeBuffer(this.ciphertextBuffer,0,y),this.device.queue.writeBuffer(this.matchCountBuffer,0,od.ZERO_DATA),(this.bindGroupDirty||!this.bindGroup)&&(this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:[{binding:0,resource:{buffer:this.paramsBuffer}},{binding:1,resource:{buffer:this.matchCountBuffer}},{binding:2,resource:{buffer:this.matchIndicesBuffer}},{binding:3,resource:{buffer:this.ciphertextBuffer}}]}),this.bindGroupDirty=!1);const k=this.device.createCommandEncoder(),D=k.beginComputePass();D.setPipeline(this.pipeline),D.setBindGroup(0,this.bindGroup),D.dispatchWorkgroups(Math.ceil(d/(256*32))),D.end(),k.copyBufferToBuffer(this.matchCountBuffer,0,g,0,4),k.copyBufferToBuffer(this.matchIndicesBuffer,0,m,0,1024*4),this.device.queue.submit([k.finish()]),await g.mapAsync(GPUMapMode.READ);const B=new Uint32Array(g.getMappedRange())[0];g.unmap();const N=[];if(B>0){await m.mapAsync(GPUMapMode.READ);const I=new Uint32Array(m.getMappedRange());for(let z=0;z<Math.min(B,1024);z++)N.push(I[z]);m.unmap()}return N}destroy(){var a,o,l,d,f,p,h,g;(a=this.paramsBuffer)==null||a.destroy(),(o=this.matchCountBuffer)==null||o.destroy(),(l=this.matchIndicesBuffer)==null||l.destroy(),(d=this.ciphertextBuffer)==null||d.destroy(),(f=this.matchCountReadBuffers[0])==null||f.destroy(),(p=this.matchCountReadBuffers[1])==null||p.destroy(),(h=this.matchIndicesReadBuffers[0])==null||h.destroy(),(g=this.matchIndicesReadBuffers[1])==null||g.destroy(),this.paramsBuffer=null,this.matchCountBuffer=null,this.matchIndicesBuffer=null,this.ciphertextBuffer=null,this.ciphertextBufferSize=0,this.matchCountReadBuffers=[null,null],this.matchIndicesReadBuffers=[null,null],this.currentReadBufferIndex=0,this.bindGroup=null,this.bindGroupDirty=!0,this.device&&(this.device.destroy(),this.device=null),this.pipeline=null,this.bindGroupLayout=null}}od.ZERO_DATA=new Uint32Array([0]);function gE(){return typeof navigator<"u"&&"gpu"in navigator}class Dg{runBatch(a,o,l,d,f,p){const h=[],g=a.toString(16).padStart(2,"0
Line truncated
|
||||
`).map(f=>f.trim().toLowerCase()).filter(f=>f.length>0);this.wordlist=d.filter(Rg)}setWordlist(a){this.wordlist=a.map(o=>o.trim().toLowerCase()).filter(Rg)}abort(){this.abortFlag=!0}isGpuAvailable(){return gE()}async decodePacket(a){var l;const o=a.trim().replace(/\s+/g,"").replace(/^0x/i,"");if(!o||!/^[0-9a-fA-F]+$/.test(o))return null;try{const f=(l=(await Bg.MeshCorePacketDecoder.decodeWithVerification(o,{})).payload)==null?void 0:l.decoded;return!(f!=null&&f.channelHash)||!(f!=null&&f.ciphertext)||!(f!=null&&f.cipherMac)?null:{channelHash:f.channelHash,ciphertext:f.ciphertext,cipherMac:f.cipherMac,isGroupText:!0}}catch{return null}}async crack(a,o,l){this.abortFlag=!1,this.useTimestampFilter=(o==null?void 0:o.useTimestampFilter)??!0,this.useUtf8Filter=(o==null?void 0:o.useUtf8Filter)??!0,this.useSenderFilter=(o==null?void 0:o.useSenderFilter)??!0,this.validSeconds=(o==null?void 0:o.validSeconds)??f0,this.useCpu=(o==null?void 0:o.forceCpu)??!1;const d=(o==null?void 0:o.maxLength)??8,f=(o==null?void 0:o.startingLength)??1,p=(o==null?void 0:o.useDictionary)??!0,h=(o==null?void 0:o.startFromType)??"bruteforce",g=a.toLowerCase(),m=await this.decodePacket(g);if(!m)return{found:!1,error:"Invalid packet or not a GroupText packet"};const{channelHash:v,ciphertext:y,cipherMac:w}=m,S=parseInt(v,16);this.useCpu?this.cpuInstance||(this.cpuInstance=new Dg):this.gpuInstance||(this.gpuInstance=new od,await this.gpuInstance.init()||(this.useCpu=!0,this.cpuInstance=new Dg));const T=performance.now();let C=0,k=performance.now(),D=f,P=0,B=0,N=!1;if(o!=null&&o.startFrom){const J=o.startFrom.toLowerCase();if(h==="dictionary"){const ie=this.wordlist.indexOf(J);ie>=0&&(B=ie+1)}else{N=!0;const ie=hE(J);ie&&(D=Math.max(f,ie.length),P=ie.index+1,P>=al(D)&&(D++,P=0))}}let I=0;p&&!N&&this.wordlist.length>0&&(I+=this.wordlist.length-B);for(let J=D;J<=d;J++)I+=al(J);I-=P;const z=(J,ie,he)=>{if(!l)return;const pe=(performance.now()-T)/1e3,G=pe>0?Math.round(C/pe):0,Y=I-C,q=G>0?Y/G:0;l({checked:C,total:I,percent:I>0?Math.min(100,C/I*100):0,rateKeysPerSec:G,etaSeconds:q,elapsedSeconds:pe,currentLength:ie,currentPosition:he,phase:J})},H=J=>{if(!Wx(y,w,J))return{valid:!1};const ie=Bg.ChannelCrypto.decryptGroupTextMessage(y,w,J);return!ie.success||!ie.data?{valid:!1}:this.useTimestampFilter&&!pE(ie.data.timestamp,this.validSeconds)?{valid:!1}:this.useUtf8Filter&&!mE(ie.data.message)?{valid:!1}:this.useSenderFilter&&!ie.data.sender?{valid:!1}:{valid:!0,message:ie.data.sender?`${ie.data.sender}: ${ie.data.message}`:ie.data.message}};if(!N&&B===0&&D===f&&P===0){z("public-key",0,d0);const J=p0(Tc);if(v===J){const ie=H(Tc);if(ie.valid)return{found:!0,roomName:d0,key:Tc,decryptedMessage:ie.message}}}if(p&&!N&&this.wordlist.length>0)for(let J=B;J<this.wordlist.length;J++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:this.wordlist[J],resumeType:"dictionary"};const ie=this.wordlist[J],he=h0("#"+ie),ae=p0(he);if(parseInt(ae,16)===S){const G=H(he);if(G.valid)return{found:!0,roomName:ie,key:he,decryptedMessage:G.message,resumeFrom:ie,resumeType:"dictionary"}}C++;const pe=performance.now();pe-k>=200&&(z("wordlist",ie.length,ie),k=pe,await new Promise(G=>setTimeout(G,0)))}const j=this.useCpu?1024:32768,ee=(o==null?void 0:o.gpuDispatchMs)??1e3;let Z=j,V=!1;for(let J=D;J<=d;J++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:qo(J,0)||void 0,resumeType:"bruteforce"};const ie=al(J);let he=J===D?P:0;for(;he<ie;){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:qo(J,he)||void 0,resumeType:"bruteforce"};const ae=Math.min(Z,ie-he),pe=performance.now();let G;this.useCpu?G=this.cpuInstance.runBatch(S,J,he,ae,y,w):G=await this.gpuInstance.runBatch(S,J,he,ae,y,w);const Y=performance.now()-pe;if(C+=ae,!this.useCpu&&!V&&ae>=j&&Y>0){const R=ee/Y,U=Math.round(ae*R),K=Math.pow(2,Math.round(Math.log2(Math.max(j,U))));Z=Math.max(j,K),V=!0}for(const R of G){const U=qo(J,R);if(!U)continue;const K=h0("#"+U),$=H(K);if($.valid)return{found:!0,roomName:U,key:K,decryptedMessage:$.message,resumeFrom:U,resumeType:"bruteforce"}}he+=ae;const q=performance.now();if(q-k>=200){const R=qo(J,Math.min(he,ie-1))||"";z("bruteforce",J,R),k=q,await new Promise(U=>setTimeout(U,0))}}}return{found:!1,resumeFrom:qo(d,al(d)-1)||void 0,resumeType:"bruteforce"}}destroy(){this.gpuInstance&&(this.gpuInstance.destroy(),this.gpuInstance=null),this.cpuInstance&&(this.cpuInstance.destroy(),this.cpuInstance=null)}}var $f,Fg;function _E(){return Fg||(Fg=1,$f={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAA
Line truncated
|
||||
NoSleep enabled for older iOS devices. This can interrupt
|
||||
active or long-running network requests from completing successfully.
|
||||
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
|
||||
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(h=>(this.enabled=!0,h)).catch(h=>{throw this.enabled=!1,h})}disable(){l()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):o()?this.noSleepTimer&&(console.warn(`
|
||||
NoSleep now disabled for older iOS devices.
|
||||
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return Yf=d,Yf}var bE=wE();const CE=Xs(bE);function EE(r){if(r.length<4)return null;try{const o=parseInt(r.slice(0,2),16)&3;let l=2;if(o===0||o===3){if(r.length<l+8)return null;l+=8}if(r.length<l+2)return null;const d=parseInt(r.slice(l,l+2),16);l+=2;const f=d*2;return r.length<l+f?null:(l+=f,r.slice(l))}catch{return null}}function kE({packets:r,channels:a,onChannelCreate:o,onRunningChange:l,visible:d=!1}){const[f,p]=F.useState(!1),[h,g]=F.useState(6),[m,v]=F.useState(!1),[y,w]=F.useState(!0),[S,T]=F.useState(!1),[C,k]=F.useState(null),[D,P]=F.useState(new Map),[B,N]=F.useState([]),[I,z]=F.useState(!1),[H,j]=F.useState(null),[ee,Z]=F.useState(null),[V,ne]=F.useState(0),J=F.useRef(null),ie=F.useRef(null),he=F.useRef(!1),ae=F.useRef(!1),pe=F.useRef(!1),G=F.useRef(new Map),Y=F.useRef(!1),q=F.useRef(6),R=F.useRef(!0),U=F.useRef(!1),K=F.useRef(new Set),$=F.useRef(new Set);F.useEffect(()=>{const Be=new yE;J.current=Be,j(Be.isGpuAvailable());const Ze=new CE;return ie.current=Ze,()=>{Be.destroy(),J.current=null,Ze.disable(),ie.current=null}},[]),F.useEffect(()=>{!d||I||xb(async()=>{const{ENGLISH_WORDLIST:Be}=await import("./wordlist-BtmChKSf.js");return{ENGLISH_WORDLIST:Be}},[]).then(({ENGLISH_WORDLIST:Be})=>{J.current&&(J.current.setWordlist(Be),z(!0))}).catch(Be=>{console.error("Failed to load wordlist:",Be),_t.error("Failed to load wordlist",{description:"Cracking will not be available"})})},[d,I]),F.useEffect(()=>{const Be=()=>{rt.getUndecryptedPacketCount().then(({count:lt})=>Z(lt)).catch(()=>Z(null))};Be();const Ze=setInterval(Be,3e4);return()=>clearInterval(Ze)},[]);const de=F.useMemo(()=>new Set(a.map(Be=>Be.key.toUpperCase())),[a]),fe=r.filter(Be=>Be.payload_type==="GROUP_TEXT"&&!Be.decrypted);F.useEffect(()=>{let Be=0;P(Ze=>{const lt=new Map(Ze);let Rt=!1;for(const vt of fe)if(!lt.has(vt.id)){const ot=EE(vt.data);if(ot&&$.current.has(ot)){Be++;continue}ot&&$.current.add(ot),lt.set(vt.id,{packet:vt,attempts:0,lastAttemptLength:0,status:"pending"}),Rt=!0}return Rt?(G.current=lt,lt):Ze}),Be>0&&ne(Ze=>Ze+Be)},[fe.length]),F.useEffect(()=>{G.current=D},[D]),F.useEffect(()=>{Y.current=m},[m]),F.useEffect(()=>{q.current=h},[h]),F.useEffect(()=>{R.current=y},[y]),F.useEffect(()=>{U.current=S},[S]),F.useEffect(()=>{K.current=new Set(fe.map(Be=>Be.id))},[fe]),F.useEffect(()=>{l==null||l(f)},[f,l]);const ke=Array.from(D.values()).filter(Be=>Be.status==="pending").length,Ae=Array.from(D.values()).filter(Be=>Be.status==="cracked").length,We=Array.from(D.values()).filter(Be=>Be.status==="failed").length,$e=F.useCallback(async()=>{if(pe.current||!J.current||!he.current)return;const Be=G.current;let Ze=null,lt=null;for(const[Qe,Xe]of Be.entries())if(Xe.status==="pending"){Ze=Xe,lt=Qe;break}if(!Ze&&Y.current){const Qe=Array.from(Be.entries()).filter(([,Xe])=>Xe.status==="failed"&&Xe.lastAttemptLength<10);Qe.length>0&&(Qe.sort((Xe,xe)=>Xe[1].lastAttemptLength-xe[1].lastAttemptLength),[lt,Ze]=Qe[0])}if(!Ze||lt===null){he.current&&setTimeout(()=>$e(),1e3);return}if(!K.current.has(lt)){P(Qe=>{const Xe=new Map(Qe);return Xe.delete(lt),Xe}),he.current&&setTimeout(()=>$e(),10);return}pe.current=!0;const Rt=q.current,vt=Ze.lastAttemptLength>0,ot=vt?Ze.lastAttemptLength+1:Rt;try{const Qe=await J.current.crack(Ze.packet.data,{maxLength:ot,useSenderFilter:!0,useTimestampFilter:!0,useUtf8Filter:!0,...U.current&&{gpuDispatchMs:1e4},...vt&&{useDictionary:!1,startingLength:ot}},Xe=>{k(Xe)});if(ae.current){ae.current=!1,pe.current=!1,k(null);return}if(Qe.found&&Qe.roomName&&Qe.key){P(Te=>{const pt=new Map(Te),Zt=pt.get(lt);return Zt&&pt.set(lt,{...Zt,status:"cracked",attempts:Zt.attempts+1,lastAttemptLength:ot}),pt});const Xe={roomName:Qe.roomName,key:Qe.key,packetId:lt,message:Qe.decryptedMessage||"",crackedAt:Date.now()};N(Te=>[...Te,Xe]);const xe=Qe.key.toUpperCase();if(!de.has(xe))try{const Te="#"+Qe.roomName;await o(Te,Qe.key),R.current&&await rt.decryptHistoricalPackets({key_type:"channel",channel_name:Te})}catch(Te){console.error("Failed to create channel or decrypt historical:",Te),_t.error("Failed to save cracked channel",{description:Te instanceof Error?Te.message:"Channel discovered but could not be saved"})}}else P(Xe=>{const xe=new Map(Xe),Te=xe.get(lt);return Te&&xe.set(lt,{...Te,status:"failed",attempts:Te.attempts+1,lastAttemptLength:ot}),xe})}catch(Qe){console.error("Cracking error:",Qe),P(Xe=>{const xe=new Map(Xe),Te=xe.get(lt);return Te&&xe.set(lt,{...Te,status:"failed",attempts:Te.attempts+1,lastAttemptLength:ot}),xe})}pe.current=!1,k(null),he.current&&setTimeout(()=>$e(),100)},[de,o]),bt=()=>{var Be;if(!H){_t.error("WebGPU not available",{description:"Cracking requires Chrome 113+ or Edge 113+ with WebGPU support."});return}p(!0),he.current=!0,ae.current=!1,(Be=ie.current)==null||Be.enable(),$e()},ft=()=>{var Be,Ze;p(!1),he.current=!1,ae.current=!0,(Be=J.current)==null||Be.abort(),(Ze=ie.current)==nu
Line truncated
|
||||
//# sourceMappingURL=index-Cjj7DnBW.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"mappings":";;;;;;;;6CASa,IAAIA,EAAE,OAAO,IAAI,eAAe,EAAEC,EAAE,OAAO,IAAI,cAAc,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,mBAAmB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,eAAe,EAAEC,EAAE,OAAO,IAAI,mBAAmB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,YAAY,EAAEC,EAAE,OAAO,IAAI,YAAY,EAAEC,EAAE,OAAO,SAAS,SAASC,EAAEC,EAAE,CAAC,OAAUA,IAAP,MAAqB,OAAOA,GAAlB,SAA2B,MAAKA,EAAEF,GAAGE,EAAEF,CAAC,GAAGE,EAAE,YAAY,EAAqB,OAAOA,GAApB,WAAsBA,EAAE,KAAI,CAC1e,IAAIC,EAAE,CAAC,UAAU,UAAU,CAAC,MAAM,EAAE,EAAE,mBAAmB,UAAU,GAAG,oBAAoB,UAAU,GAAG,gBAAgB,UAAU,EAAE,EAAEC,EAAE,OAAO,OAAOC,EAAE,GAAG,SAASC,EAAEJ,EAAEK,EAAEC,EAAE,CAAC,KAAK,MAAMN,EAAE,KAAK,QAAQK,EAAE,KAAK,KAAKF,EAAE,KAAK,QAAQG,GAAGL,CAAC,CAACG,EAAE,UAAU,iBAAiB,GACnQA,EAAE,UAAU,SAAS,SAASJ,EAAEK,EAAE,CAAC,GAAc,OAAOL,GAAlB,UAAkC,OAAOA,GAApB,YAA6BA,GAAN,KAAQ,MAAM,MAAM,uHAAuH,EAAE,KAAK,QAAQ,gBAAgB,KAAKA,EAAEK,EAAE,UAAU,CAAC,EAAED,EAAE,UAAU,YAAY,SAASJ,EAAE,CAAC,KAAK,QAAQ,mBAAmB,KAAKA,EAAE,aAAa,CAAC,EAAE,SAASO,GAAG,EAAEA,EAAE,UAAUH,EAAE,UAAU,SAASI,EAAER,EAAEK,EAAEC,EAAE,CAAC,KAAK,MAAMN,EAAE,KAAK,QAAQK,EAAE,KAAK,KAAKF,EAAE,KAAK,QAAQG,GAAGL,CAAC,CAAC,IAAIQ,EAAED,EAAE,UAAU,IAAID,EACrfE,EAAE,YAAYD,EAAEN,EAAEO,EAAEL,EAAE,SAAS,EAAEK,EAAE,qBAAqB,GAAG,IAAIC,EAAE,MAAM,QAAQC,EAAE,OAAO,UAAU,eAAeC,EAAE,CAAC,QAAQ,IAAI,EAAEC,EAAE,CAAC,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,SAAS,EAAE,EACxK,SAASC,EAAEd,EAAEK,EAAEC,EAAE,CAAC,IAAIS,EAAEC,GAAE,GAAGC,GAAE,KAAKC,GAAE,KAAK,GAASb,GAAN,KAAQ,IAAIU,KAAcV,EAAE,MAAX,SAAiBa,GAAEb,EAAE,KAAcA,EAAE,MAAX,SAAiBY,GAAE,GAAGZ,EAAE,KAAKA,EAAEM,EAAE,KAAKN,EAAEU,CAAC,GAAG,CAACF,EAAE,eAAeE,CAAC,IAAIC,GAAED,CAAC,EAAEV,EAAEU,CAAC,GAAG,IAAII,GAAE,UAAU,OAAO,EAAE,GAAOA,KAAJ,EAAMH,GAAE,SAASV,UAAU,EAAEa,GAAE,CAAC,QAAQC,GAAE,MAAMD,EAAC,EAAEE,GAAE,EAAEA,GAAEF,GAAEE,KAAID,GAAEC,EAAC,EAAE,UAAUA,GAAE,CAAC,EAAEL,GAAE,SAASI,EAAC,CAAC,GAAGpB,GAAGA,EAAE,aAAa,IAAIe,KAAKI,GAAEnB,EAAE,aAAamB,GAAWH,GAAED,CAAC,IAAZ,SAAgBC,GAAED,CAAC,EAAEI,GAAEJ,CAAC,GAAG,MAAM,CAAC,SAAS5B,EAAE,KAAKa,EAAE,IAAIiB,GAAE,IAAIC,GAAE,MAAMF,GAAE,OAAOJ,EAAE,OAAO,CAAC,CAC7a,SAASU,GAAEtB,EAAEK,EAAE,CAAC,MAAM,CAAC,SAASlB,EAAE,KAAKa,EAAE,KAAK,IAAIK,EAAE,IAAIL,EAAE,IAAI,MAAMA,EAAE,MAAM,OAAOA,EAAE,MAAM,CAAC,CAAC,SAASuB,EAAEvB,EAAE,CAAC,OAAiB,OAAOA,GAAlB,UAA4BA,IAAP,MAAUA,EAAE,WAAWb,CAAC,CAAC,SAASqC,EAAOxB,EAAE,CAAC,IAAIK,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE,MAAM,IAAIL,EAAE,QAAQ,QAAQ,SAASA,EAAE,CAAC,OAAOK,EAAEL,CAAC,CAAC,CAAC,CAAC,CAAC,IAAIyB,GAAE,OAAO,SAASC,EAAE1B,EAAEK,EAAE,CAAC,OAAiB,OAAOL,GAAlB,UAA4BA,IAAP,MAAgBA,EAAE,KAAR,KAAYwB,EAAO,GAAGxB,EAAE,GAAG,EAAEK,EAAE,SAAS,EAAE,CAAC,CAC/W,SAASsB,GAAE3B,EAAEK,EAAEC,EAAES,EAAEC,GAAE,CAAC,IAAIC,GAAE,OAAOjB,GAAmBiB,KAAd,aAA6BA,KAAZ,aAAcjB,EAAE,MAAK,IAAIkB,GAAE,GAAG,GAAUlB,IAAP,KAASkB,GAAE,OAAQ,QAAOD,GAAC,CAAE,IAAK,SAAS,IAAK,SAASC,GAAE,GAAG,MAAM,IAAK,SAAS,OAAOlB,EAAE,SAAQ,CAAE,KAAKb,EAAE,KAAKC,EAAE8B,GAAE,EAAE,CAAC,CAAC,GAAGA,GAAE,OAAOA,GAAElB,EAAEgB,GAAEA,GAAEE,EAAC,EAAElB,EAAOe,IAAL,GAAO,IAAIW,EAAER,GAAE,CAAC,EAAEH,EAAEL,EAAEM,EAAC,GAAGV,EAAE,GAASN,GAAN,OAAUM,EAAEN,EAAE,QAAQyB,GAAE,KAAK,EAAE,KAAKE,GAAEX,GAAEX,EAAEC,EAAE,GAAG,SAASN,GAAE,CAAC,OAAOA,EAAC,CAAC,GAASgB,IAAN,OAAUO,EAAEP,EAAC,IAAIA,GAAEM,GAAEN,GAAEV,GAAG,CAACU,GAAE,KAAKE,IAAGA,GAAE,MAAMF,GAAE,IAAI,IAAI,GAAGA,GAAE,KAAK,QAAQS,GAAE,KAAK,EAAE,KAAKzB,CAAC,GAAGK,EAAE,KAAKW,EAAC,GAAG,EAAyB,GAAvBE,GAAE,EAAEH,EAAOA,IAAL,GAAO,IAAIA,EAAE,IAAOL,EAAEV,CAAC,EAAE,QAAQmB,GAAE,EAAEA,GAAEnB,EAAE,OAAOmB,KAAI,CAACF,GACrfjB,EAAEmB,EAAC,EAAE,IAAIC,GAAEL,EAAEW,EAAET,GAAEE,EAAC,EAAED,IAAGS,GAAEV,GAAEZ,EAAEC,EAAEc,GAAEJ,EAAC,CAAC,SAASI,GAAErB,EAAEC,CAAC,EAAe,OAAOoB,IAApB,WAAsB,IAAIpB,EAAEoB,GAAE,KAAKpB,CAAC,EAAEmB,GAAE,EAAE,EAAEF,GAAEjB,EAAE,KAAI,GAAI,MAAMiB,GAAEA,GAAE,MAAMG,GAAEL,EAAEW,EAAET,GAAEE,IAAG,EAAED,IAAGS,GAAEV,GAAEZ,EAAEC,EAAEc,GAAEJ,EAAC,UAAqBC,KAAX,SAAa,MAAMZ,EAAE,OAAOL,CAAC,EAAE,MAAM,mDAAuEK,IAApB,kBAAsB,qBAAqB,OAAO,KAAKL,CAAC,EAAE,KAAK,IAAI,EAAE,IAAIK,GAAG,2EAA2E,EAAE,OAAOa,EAAC,CACzZ,SAASU,GAAE5B,EAAEK,EAAEC,EAAE,CAAC,GAASN,GAAN,KAAQ,OAAOA,EAAE,IAAIe,EAAE,GAAGC,GAAE,EAAE,OAAAW,GAAE3B,EAAEe,EAAE,GAAG,GAAG,SAASf,GAAE,CAAC,OAAOK,EAAE,KAAKC,EAAEN,GAAEgB,IAAG,CAAC,CAAC,EAASD,CAAC,CAAC,SAASc,GAAE7B,EAAE,CAAC,GAAQA,EAAE,UAAP,GAAe,CAAC,IAAIK,EAAEL,EAAE,QAAQK,EAAEA,EAAC,EAAGA,EAAE,KAAK,SAASA,EAAE,EAAQL,EAAE,UAAN,GAAoBA,EAAE,UAAP,MAAeA,EAAE,QAAQ,EAAEA,EAAE,QAAQK,EAAC,EAAE,SAASA,EAAE,EAAQL,EAAE,UAAN,GAAoBA,EAAE,UAAP,MAAeA,EAAE,QAAQ,EAAEA,EAAE,QAAQK,EAAC,CAAC,EAAOL,EAAE,UAAP,KAAiBA,EAAE,QAAQ,EAAEA,EAAE,QAAQK,EAAE,CAAC,GAAOL,EAAE,UAAN,EAAc,OAAOA,EAAE,QAAQ,QAAQ,MAAMA,EAAE,OAAQ,CAC5Z,IAAI8B,GAAE,CAAC,QAAQ,IAAI,EAAEC,EAAE,CAAC,WAAW,IAAI,EAAEC,EAAE,CAAC,uBAAuBF,GAAE,wBAAwBC,EAAE,kBAAkBnB,CAAC,EAAE,SAASqB,GAAG,CAAC,MAAM,MAAM,0DAA0D,CAAE,CACzM,OAAAC,GAAA,SAAiB,CAAC,IAAIN,GAAE,QAAQ,SAAS5B,EAAEK,EAAEC,EAAE,CAACsB,GAAE5B,EAAE,UAAU,CAACK,EAAE,MAAM,KAAK,SAAS,CAAC,EAAEC,CAAC,CAAC,EAAE,MAAM,SAASN,EAAE,CAAC,IAAIK,EAAE,EAAE,OAAAuB,GAAE5B,EAAE,UAAU,CAACK,GAAG,CAAC,EAASA,CAAC,EAAE,QAAQ,SAASL,EAAE,CAAC,OAAO4B,GAAE5B,EAAE,SAASA,EAAE,CAAC,OAAOA,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,SAASA,EAAE,CAAC,GAAG,CAACuB,EAAEvB,CAAC,EAAE,Line truncated
|
||||
+1
@@ -0,0 +1 @@
|
||||
.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::-moz-selection{background:transparent}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottLine truncated
|
||||
Vendored
+2
-2
@@ -13,8 +13,8 @@
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<script type="module" crossorigin src="/assets/index-Cjj7DnBW.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-C-fUaa04.css">
|
||||
<script type="module" crossorigin src="/assets/index-BVIx9g0k.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CnRBRJ10.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
+105
-6
@@ -18,12 +18,22 @@ import { MapView } from './components/MapView';
|
||||
import { CrackerPanel } from './components/CrackerPanel';
|
||||
import { Sheet, SheetContent, SheetHeader, SheetTitle } from './components/ui/sheet';
|
||||
import { Toaster, toast } from './components/ui/sonner';
|
||||
import { getStateKey } from './utils/conversationState';
|
||||
import {
|
||||
getStateKey,
|
||||
initLastMessageTimes,
|
||||
loadLocalStorageLastMessageTimes,
|
||||
loadLocalStorageSortOrder,
|
||||
clearLocalStorageConversationState,
|
||||
} from './utils/conversationState';
|
||||
import { formatTime } from './utils/messageParser';
|
||||
import { pubkeysMatch, getContactDisplayName } from './utils/pubkey';
|
||||
import { parseHashConversation, updateUrlHash, getMapFocusHash } from './utils/urlHash';
|
||||
import { isValidLocation, calculateDistance, formatDistance } from './utils/pathUtils';
|
||||
import { loadFavorites, toggleFavorite, isFavorite, type Favorite } from './utils/favorites';
|
||||
import {
|
||||
isFavorite,
|
||||
loadLocalStorageFavorites,
|
||||
clearLocalStorageFavorites,
|
||||
} from './utils/favorites';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type {
|
||||
AppSettings,
|
||||
@@ -31,6 +41,7 @@ import type {
|
||||
Contact,
|
||||
Channel,
|
||||
Conversation,
|
||||
Favorite,
|
||||
HealthStatus,
|
||||
Message,
|
||||
MessagePath,
|
||||
@@ -60,7 +71,9 @@ export function App() {
|
||||
const [undecryptedCount, setUndecryptedCount] = useState(0);
|
||||
const [showCracker, setShowCracker] = useState(false);
|
||||
const [crackerRunning, setCrackerRunning] = useState(false);
|
||||
const [favorites, setFavorites] = useState<Favorite[]>(loadFavorites);
|
||||
|
||||
// Favorites are now stored server-side in appSettings
|
||||
const favorites: Favorite[] = appSettings?.favorites ?? [];
|
||||
|
||||
// Track previous health status to detect changes
|
||||
const prevHealthRef = useRef<HealthStatus | null>(null);
|
||||
@@ -251,6 +264,8 @@ export function App() {
|
||||
try {
|
||||
const data = await api.getSettings();
|
||||
setAppSettings(data);
|
||||
// Initialize in-memory cache with server data
|
||||
initLastMessageTimes(data.last_message_times ?? {});
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch app settings:', err);
|
||||
}
|
||||
@@ -273,6 +288,72 @@ export function App() {
|
||||
fetchUndecryptedCount();
|
||||
}, [fetchConfig, fetchAppSettings, fetchUndecryptedCount]);
|
||||
|
||||
// One-time migration of localStorage preferences to server
|
||||
const hasMigratedRef = useRef(false);
|
||||
useEffect(() => {
|
||||
// Only run once we have appSettings loaded
|
||||
if (!appSettings || hasMigratedRef.current) return;
|
||||
|
||||
// Skip if already migrated on server
|
||||
if (appSettings.preferences_migrated) {
|
||||
// Just clear any leftover localStorage
|
||||
clearLocalStorageFavorites();
|
||||
clearLocalStorageConversationState();
|
||||
hasMigratedRef.current = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if we have any localStorage data to migrate
|
||||
const localFavorites = loadLocalStorageFavorites();
|
||||
const localSortOrder = loadLocalStorageSortOrder();
|
||||
const localLastMessageTimes = loadLocalStorageLastMessageTimes();
|
||||
|
||||
const hasLocalData =
|
||||
localFavorites.length > 0 ||
|
||||
localSortOrder !== 'recent' ||
|
||||
Object.keys(localLastMessageTimes).length > 0;
|
||||
|
||||
if (!hasLocalData) {
|
||||
// No local data to migrate, just mark as done
|
||||
hasMigratedRef.current = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark as migrating immediately to prevent duplicate calls
|
||||
hasMigratedRef.current = true;
|
||||
|
||||
// Migrate localStorage to server
|
||||
const migratePreferences = async () => {
|
||||
try {
|
||||
const result = await api.migratePreferences({
|
||||
favorites: localFavorites,
|
||||
sort_order: localSortOrder,
|
||||
last_message_times: localLastMessageTimes,
|
||||
});
|
||||
|
||||
if (result.migrated) {
|
||||
toast.success('Preferences migrated', {
|
||||
description: `Migrated ${localFavorites.length} favorites to server`,
|
||||
});
|
||||
}
|
||||
|
||||
// Update local state with migrated settings
|
||||
setAppSettings(result.settings);
|
||||
// Reinitialize cache with migrated data
|
||||
initLastMessageTimes(result.settings.last_message_times ?? {});
|
||||
|
||||
// Clear localStorage after successful migration
|
||||
clearLocalStorageFavorites();
|
||||
clearLocalStorageConversationState();
|
||||
} catch (err) {
|
||||
console.error('Failed to migrate preferences:', err);
|
||||
// Don't block the app on migration failure
|
||||
}
|
||||
};
|
||||
|
||||
migratePreferences();
|
||||
}, [appSettings]);
|
||||
|
||||
// Resolve URL hash to a conversation
|
||||
const resolveHashToConversation = useCallback((): Conversation | null => {
|
||||
const hashConv = parseHashConversation();
|
||||
@@ -432,9 +513,15 @@ export function App() {
|
||||
setSidebarOpen(false);
|
||||
}, []);
|
||||
|
||||
// Toggle favorite status for a conversation
|
||||
const handleToggleFavorite = useCallback((type: 'channel' | 'contact', id: string) => {
|
||||
setFavorites(toggleFavorite(type, id));
|
||||
// Toggle favorite status for a conversation (via API)
|
||||
const handleToggleFavorite = useCallback(async (type: 'channel' | 'contact', id: string) => {
|
||||
try {
|
||||
const updatedSettings = await api.toggleFavorite(type, id);
|
||||
setAppSettings(updatedSettings);
|
||||
} catch (err) {
|
||||
console.error('Failed to toggle favorite:', err);
|
||||
toast.error('Failed to update favorite');
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Delete channel handler
|
||||
@@ -535,6 +622,16 @@ export function App() {
|
||||
[fetchUndecryptedCount]
|
||||
);
|
||||
|
||||
// Handle sort order change via API
|
||||
const handleSortOrderChange = useCallback(async (order: 'recent' | 'alpha') => {
|
||||
try {
|
||||
const updatedSettings = await api.updateSettings({ sidebar_sort_order: order });
|
||||
setAppSettings(updatedSettings);
|
||||
} catch (err) {
|
||||
console.error('Failed to update sort order:', err);
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Sidebar content (shared between desktop and mobile)
|
||||
const sidebarContent = (
|
||||
<Sidebar
|
||||
@@ -554,6 +651,8 @@ export function App() {
|
||||
onToggleCracker={() => setShowCracker((prev) => !prev)}
|
||||
onMarkAllRead={markAllRead}
|
||||
favorites={favorites}
|
||||
sortOrder={appSettings?.sidebar_sort_order ?? 'recent'}
|
||||
onSortOrderChange={handleSortOrderChange}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
@@ -4,9 +4,12 @@ import type {
|
||||
Channel,
|
||||
CommandResponse,
|
||||
Contact,
|
||||
Favorite,
|
||||
HealthStatus,
|
||||
MaintenanceResult,
|
||||
Message,
|
||||
MigratePreferencesRequest,
|
||||
MigratePreferencesResponse,
|
||||
RadioConfig,
|
||||
RadioConfigUpdate,
|
||||
TelemetryResponse,
|
||||
@@ -197,4 +200,35 @@ export const api = {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(settings),
|
||||
}),
|
||||
|
||||
// Favorites
|
||||
addFavorite: (type: Favorite['type'], id: string) =>
|
||||
fetchJson<AppSettings>('/settings/favorites', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ type, id }),
|
||||
}),
|
||||
removeFavorite: (type: Favorite['type'], id: string) =>
|
||||
fetchJson<AppSettings>('/settings/favorites', {
|
||||
method: 'DELETE',
|
||||
body: JSON.stringify({ type, id }),
|
||||
}),
|
||||
toggleFavorite: (type: Favorite['type'], id: string) =>
|
||||
fetchJson<AppSettings>('/settings/favorites/toggle', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ type, id }),
|
||||
}),
|
||||
|
||||
// Last message time tracking
|
||||
updateLastMessageTime: (stateKey: string, timestamp: number) =>
|
||||
fetchJson<{ status: string }>('/settings/last-message-time', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ state_key: stateKey, timestamp }),
|
||||
}),
|
||||
|
||||
// Preferences migration (one-time, from localStorage to database)
|
||||
migratePreferences: (request: MigratePreferencesRequest) =>
|
||||
fetchJson<MigratePreferencesResponse>('/settings/migrate', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(request),
|
||||
}),
|
||||
};
|
||||
@@ -96,6 +96,7 @@ export function SettingsModal({
|
||||
// Database maintenance state
|
||||
const [retentionDays, setRetentionDays] = useState('14');
|
||||
const [cleaning, setCleaning] = useState(false);
|
||||
const [autoDecryptOnAdvert, setAutoDecryptOnAdvert] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (config) {
|
||||
@@ -113,6 +114,7 @@ export function SettingsModal({
|
||||
useEffect(() => {
|
||||
if (appSettings) {
|
||||
setMaxRadioContacts(String(appSettings.max_radio_contacts));
|
||||
setAutoDecryptOnAdvert(appSettings.auto_decrypt_dm_on_advert);
|
||||
}
|
||||
}, [appSettings]);
|
||||
|
||||
@@ -314,6 +316,19 @@ export function SettingsModal({
|
||||
}
|
||||
};
|
||||
|
||||
const handleToggleAutoDecrypt = async () => {
|
||||
const newValue = !autoDecryptOnAdvert;
|
||||
setAutoDecryptOnAdvert(newValue); // Optimistic update
|
||||
|
||||
try {
|
||||
await onSaveAppSettings({ auto_decrypt_dm_on_advert: newValue });
|
||||
} catch (err) {
|
||||
console.error('Failed to save auto-decrypt setting:', err);
|
||||
setAutoDecryptOnAdvert(!newValue); // Revert on error
|
||||
toast.error('Failed to save setting');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className="sm:max-w-[500px] max-h-[90vh] overflow-y-auto">
|
||||
@@ -638,6 +653,31 @@ export function SettingsModal({
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
||||
<div className="space-y-3">
|
||||
<Label>DM Decryption</Label>
|
||||
<div
|
||||
className="flex items-center gap-3 cursor-pointer"
|
||||
onClick={handleToggleAutoDecrypt}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={autoDecryptOnAdvert}
|
||||
readOnly
|
||||
className="w-4 h-4 rounded border-input accent-primary pointer-events-none"
|
||||
/>
|
||||
<span className="text-sm">
|
||||
Auto-decrypt historical DMs when new contact advertises
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
When enabled, the server will automatically try to decrypt stored DM packets when
|
||||
a new contact sends an advertisement. This may cause brief delays on large packet
|
||||
backlogs.
|
||||
</p>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
{/* Advertise Tab */}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { useState } from 'react';
|
||||
import type { Contact, Channel, Conversation } from '../types';
|
||||
import type { Contact, Channel, Conversation, Favorite } from '../types';
|
||||
import { getStateKey, type ConversationTimes } from '../utils/conversationState';
|
||||
import { getPubkeyPrefix, getContactDisplayName } from '../utils/pubkey';
|
||||
import { ContactAvatar } from './ContactAvatar';
|
||||
import { CONTACT_TYPE_REPEATER } from '../utils/contactAvatar';
|
||||
import { isFavorite, type Favorite } from '../utils/favorites';
|
||||
import { isFavorite } from '../utils/favorites';
|
||||
import { UNREAD_FETCH_LIMIT } from '../api';
|
||||
import { Input } from './ui/input';
|
||||
import { Button } from './ui/button';
|
||||
@@ -27,6 +27,10 @@ interface SidebarProps {
|
||||
onToggleCracker: () => void;
|
||||
onMarkAllRead: () => void;
|
||||
favorites: Favorite[];
|
||||
/** Sort order from server settings */
|
||||
sortOrder?: SortOrder;
|
||||
/** Callback when sort order changes */
|
||||
onSortOrderChange?: (order: SortOrder) => void;
|
||||
}
|
||||
|
||||
/** Format unread count, showing "X+" if at the fetch limit (indicating there may be more) */
|
||||
@@ -34,25 +38,6 @@ function formatUnreadCount(count: number): string {
|
||||
return count >= UNREAD_FETCH_LIMIT ? `${count}+` : `${count}`;
|
||||
}
|
||||
|
||||
// Load sort preference from localStorage (default to 'recent')
|
||||
function loadSortOrder(): SortOrder {
|
||||
try {
|
||||
const stored = localStorage.getItem('remoteterm-sortOrder');
|
||||
return stored === 'alpha' ? 'alpha' : 'recent';
|
||||
} catch {
|
||||
return 'recent';
|
||||
}
|
||||
}
|
||||
|
||||
// Save sort preference to localStorage
|
||||
function saveSortOrder(order: SortOrder): void {
|
||||
try {
|
||||
localStorage.setItem('remoteterm-sortOrder', order);
|
||||
} catch {
|
||||
// localStorage might be full or disabled
|
||||
}
|
||||
}
|
||||
|
||||
export function Sidebar({
|
||||
contacts,
|
||||
channels,
|
||||
@@ -67,14 +52,15 @@ export function Sidebar({
|
||||
onToggleCracker,
|
||||
onMarkAllRead,
|
||||
favorites,
|
||||
sortOrder: sortOrderProp = 'recent',
|
||||
onSortOrderChange,
|
||||
}: SidebarProps) {
|
||||
const [sortOrder, setSortOrder] = useState<SortOrder>(loadSortOrder);
|
||||
const sortOrder = sortOrderProp;
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
|
||||
const handleSortToggle = () => {
|
||||
const newOrder = sortOrder === 'alpha' ? 'recent' : 'alpha';
|
||||
setSortOrder(newOrder);
|
||||
saveSortOrder(newOrder);
|
||||
onSortOrderChange?.(newOrder);
|
||||
};
|
||||
|
||||
const handleSelectConversation = (conversation: Conversation) => {
|
||||
|
||||
@@ -124,12 +124,35 @@ export interface RawPacket {
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface Favorite {
|
||||
type: 'channel' | 'contact';
|
||||
id: string; // channel key or contact public key
|
||||
}
|
||||
|
||||
export interface AppSettings {
|
||||
max_radio_contacts: number;
|
||||
favorites: Favorite[];
|
||||
auto_decrypt_dm_on_advert: boolean;
|
||||
sidebar_sort_order: 'recent' | 'alpha';
|
||||
last_message_times: Record<string, number>;
|
||||
preferences_migrated: boolean;
|
||||
}
|
||||
|
||||
export interface AppSettingsUpdate {
|
||||
max_radio_contacts?: number;
|
||||
auto_decrypt_dm_on_advert?: boolean;
|
||||
sidebar_sort_order?: 'recent' | 'alpha';
|
||||
}
|
||||
|
||||
export interface MigratePreferencesRequest {
|
||||
favorites: Favorite[];
|
||||
sort_order: string;
|
||||
last_message_times: Record<string, number>;
|
||||
}
|
||||
|
||||
export interface MigratePreferencesResponse {
|
||||
migrated: boolean;
|
||||
settings: AppSettings;
|
||||
}
|
||||
|
||||
/** Contact type constants */
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
* localStorage utilities for tracking conversation message times.
|
||||
* Conversation state utilities.
|
||||
*
|
||||
* Stores when each conversation last received a message, used for
|
||||
* sorting conversations by recency in the sidebar.
|
||||
* Last message times are tracked in-memory and persisted server-side.
|
||||
* This file provides helper functions for generating state keys
|
||||
* and managing conversation times.
|
||||
*
|
||||
* Read state (last_read_at) is tracked server-side for consistency
|
||||
* across devices - see useUnreadCounts hook.
|
||||
@@ -11,45 +12,42 @@
|
||||
import { getPubkeyPrefix } from './pubkey';
|
||||
|
||||
const LAST_MESSAGE_KEY = 'remoteterm-lastMessageTime';
|
||||
const SORT_ORDER_KEY = 'remoteterm-sortOrder';
|
||||
|
||||
export type ConversationTimes = Record<string, number>;
|
||||
export type SortOrder = 'recent' | 'alpha';
|
||||
|
||||
function loadTimes(key: string): ConversationTimes {
|
||||
try {
|
||||
const stored = localStorage.getItem(key);
|
||||
return stored ? JSON.parse(stored) : {};
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
function saveTimes(key: string, times: ConversationTimes): void {
|
||||
try {
|
||||
localStorage.setItem(key, JSON.stringify(times));
|
||||
} catch {
|
||||
// localStorage might be full or disabled
|
||||
}
|
||||
// In-memory cache of last message times (loaded from server on init)
|
||||
let lastMessageTimesCache: ConversationTimes = {};
|
||||
|
||||
/**
|
||||
* Initialize the last message times cache from server data
|
||||
*/
|
||||
export function initLastMessageTimes(times: ConversationTimes): void {
|
||||
lastMessageTimesCache = { ...times };
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all last message times from the cache
|
||||
*/
|
||||
export function getLastMessageTimes(): ConversationTimes {
|
||||
return loadTimes(LAST_MESSAGE_KEY);
|
||||
return { ...lastMessageTimesCache };
|
||||
}
|
||||
|
||||
export function setLastMessageTime(stateKey: string, timestamp: number): ConversationTimes {
|
||||
const times = loadTimes(LAST_MESSAGE_KEY);
|
||||
// Only update if this is a newer message
|
||||
if (!times[stateKey] || timestamp > times[stateKey]) {
|
||||
times[stateKey] = timestamp;
|
||||
saveTimes(LAST_MESSAGE_KEY, times);
|
||||
}
|
||||
return times;
|
||||
/**
|
||||
* Update a single message time in the cache and return the updated cache.
|
||||
* Note: This does NOT persist to server - caller should sync if needed.
|
||||
*/
|
||||
export function setLastMessageTime(key: string, timestamp: number): ConversationTimes {
|
||||
lastMessageTimesCache[key] = timestamp;
|
||||
return { ...lastMessageTimesCache };
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a state tracking key for message times.
|
||||
*
|
||||
* This is NOT the same as Message.conversation_key (the database field).
|
||||
* This creates prefixed keys for localStorage/state tracking:
|
||||
* This creates prefixed keys for state tracking:
|
||||
* - Channels: "channel-{channelKey}"
|
||||
* - Contacts: "contact-{12-char-pubkey-prefix}"
|
||||
*
|
||||
@@ -63,3 +61,39 @@ export function getStateKey(type: 'channel' | 'contact', id: string): string {
|
||||
// For contacts, use 12-char prefix for consistent matching
|
||||
return `contact-${getPubkeyPrefix(id)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load last message times from localStorage (for migration only)
|
||||
*/
|
||||
export function loadLocalStorageLastMessageTimes(): ConversationTimes {
|
||||
try {
|
||||
const stored = localStorage.getItem(LAST_MESSAGE_KEY);
|
||||
return stored ? JSON.parse(stored) : {};
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load sort order from localStorage (for migration only)
|
||||
*/
|
||||
export function loadLocalStorageSortOrder(): SortOrder {
|
||||
try {
|
||||
const stored = localStorage.getItem(SORT_ORDER_KEY);
|
||||
return stored === 'alpha' ? 'alpha' : 'recent';
|
||||
} catch {
|
||||
return 'recent';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear conversation state from localStorage (after migration)
|
||||
*/
|
||||
export function clearLocalStorageConversationState(): void {
|
||||
try {
|
||||
localStorage.removeItem(LAST_MESSAGE_KEY);
|
||||
localStorage.removeItem(SORT_ORDER_KEY);
|
||||
} catch {
|
||||
// localStorage might be disabled
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,39 @@
|
||||
/**
|
||||
* localStorage utilities for managing favorite conversations.
|
||||
* Favorites utilities.
|
||||
*
|
||||
* Favorites are stored client-side and displayed in a dedicated section
|
||||
* above channels in the sidebar, always sorted by most recent message.
|
||||
* Favorites are now stored server-side in the database.
|
||||
* This file provides helper functions for checking favorites
|
||||
* and loading legacy localStorage data for migration.
|
||||
*/
|
||||
|
||||
import type { Favorite } from '../types';
|
||||
import { pubkeysMatch } from './pubkey';
|
||||
|
||||
const FAVORITES_KEY = 'remoteterm-favorites';
|
||||
|
||||
export interface Favorite {
|
||||
type: 'channel' | 'contact';
|
||||
id: string; // channel key or contact public key
|
||||
/**
|
||||
* Check if a conversation is favorited (from provided favorites array)
|
||||
*
|
||||
* For contacts, uses prefix matching to handle full pubkeys vs 12-char prefixes.
|
||||
*/
|
||||
export function isFavorite(
|
||||
favorites: Favorite[],
|
||||
type: 'channel' | 'contact',
|
||||
id: string
|
||||
): boolean {
|
||||
return favorites.some((f) => {
|
||||
if (f.type !== type) return false;
|
||||
// For contacts, use prefix matching (handles full keys vs prefixes)
|
||||
if (type === 'contact') return pubkeysMatch(f.id, id);
|
||||
// For channels, exact match
|
||||
return f.id === id;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load favorites from localStorage
|
||||
* Load favorites from localStorage (for migration only)
|
||||
*/
|
||||
export function loadFavorites(): Favorite[] {
|
||||
export function loadLocalStorageFavorites(): Favorite[] {
|
||||
try {
|
||||
const stored = localStorage.getItem(FAVORITES_KEY);
|
||||
return stored ? JSON.parse(stored) : [];
|
||||
@@ -25,58 +43,15 @@ export function loadFavorites(): Favorite[] {
|
||||
}
|
||||
|
||||
/**
|
||||
* Save favorites to localStorage
|
||||
* Clear favorites from localStorage (after migration)
|
||||
*/
|
||||
function saveFavorites(favorites: Favorite[]): void {
|
||||
export function clearLocalStorageFavorites(): void {
|
||||
try {
|
||||
localStorage.setItem(FAVORITES_KEY, JSON.stringify(favorites));
|
||||
localStorage.removeItem(FAVORITES_KEY);
|
||||
} catch {
|
||||
// localStorage might be full or disabled
|
||||
// localStorage might be disabled
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a conversation to favorites
|
||||
*/
|
||||
export function addFavorite(type: 'channel' | 'contact', id: string): Favorite[] {
|
||||
const favorites = loadFavorites();
|
||||
// Check if already favorited
|
||||
if (favorites.some((f) => f.type === type && f.id === id)) {
|
||||
return favorites;
|
||||
}
|
||||
const updated = [...favorites, { type, id }];
|
||||
saveFavorites(updated);
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a conversation from favorites
|
||||
*/
|
||||
export function removeFavorite(type: 'channel' | 'contact', id: string): Favorite[] {
|
||||
const favorites = loadFavorites();
|
||||
const updated = favorites.filter((f) => !(f.type === type && f.id === id));
|
||||
saveFavorites(updated);
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a conversation is favorited
|
||||
*/
|
||||
export function isFavorite(
|
||||
favorites: Favorite[],
|
||||
type: 'channel' | 'contact',
|
||||
id: string
|
||||
): boolean {
|
||||
return favorites.some((f) => f.type === type && f.id === id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle a conversation's favorite status
|
||||
*/
|
||||
export function toggleFavorite(type: 'channel' | 'contact', id: string): Favorite[] {
|
||||
const favorites = loadFavorites();
|
||||
if (favorites.some((f) => f.type === type && f.id === id)) {
|
||||
return removeFavorite(type, id);
|
||||
}
|
||||
return addFavorite(type, id);
|
||||
}
|
||||
// Re-export the Favorite type for convenience
|
||||
export type { Favorite };
|
||||
@@ -12,6 +12,9 @@ echo
|
||||
|
||||
# Run backend linting and type checking
|
||||
echo -e "${YELLOW}Running backend lint (Ruff)...${NC}"
|
||||
uv run ruff check app/ tests/ --fix
|
||||
uv run ruff format app/ tests/
|
||||
# validate
|
||||
uv run ruff check app/ tests/
|
||||
uv run ruff format --check app/ tests/
|
||||
echo -e "${GREEN}Backend lint passed!${NC}"
|
||||
|
||||
@@ -100,8 +100,8 @@ class TestMigration001:
|
||||
# Run migrations
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 8 # All 8 migrations run
|
||||
assert await get_version(conn) == 8
|
||||
assert applied == 9 # All 9 migrations run
|
||||
assert await get_version(conn) == 9
|
||||
|
||||
# Verify columns exist by inserting and selecting
|
||||
await conn.execute(
|
||||
@@ -183,9 +183,9 @@ class TestMigration001:
|
||||
applied1 = await run_migrations(conn)
|
||||
applied2 = await run_migrations(conn)
|
||||
|
||||
assert applied1 == 8 # All 8 migrations run
|
||||
assert applied1 == 9 # All 9 migrations run
|
||||
assert applied2 == 0 # No migrations on second run
|
||||
assert await get_version(conn) == 8
|
||||
assert await get_version(conn) == 9
|
||||
finally:
|
||||
await conn.close()
|
||||
|
||||
@@ -245,9 +245,9 @@ class TestMigration001:
|
||||
# Run migrations - should not fail
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
# All 8 migrations applied (version incremented) but no error
|
||||
assert applied == 8
|
||||
assert await get_version(conn) == 8
|
||||
# All 9 migrations applied (version incremented) but no error
|
||||
assert applied == 9
|
||||
assert await get_version(conn) == 9
|
||||
finally:
|
||||
await conn.close()
|
||||
|
||||
|
||||
@@ -260,8 +260,12 @@ class TestAdvertisementPipeline:
|
||||
async def test_advertisement_triggers_historical_decrypt_for_new_contact(
|
||||
self, test_db, captured_broadcasts
|
||||
):
|
||||
"""New contact via advertisement starts historical DM decryption."""
|
||||
"""New contact via advertisement starts historical DM decryption when setting enabled."""
|
||||
from app.packet_processor import process_raw_packet
|
||||
from app.repository import AppSettingsRepository
|
||||
|
||||
# Enable auto-decrypt setting
|
||||
await AppSettingsRepository.update(auto_decrypt_dm_on_advert=True)
|
||||
|
||||
fixture = FIXTURES["advertisement_with_gps"]
|
||||
packet_bytes = bytes.fromhex(fixture["raw_packet_hex"])
|
||||
|
||||
Reference in new issue
Block a user