mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-11-10 00:42:22 +01:00
Add multibot functionality
This commit is contained in:
1 parent
c46128e2cd
commit
530179fde1
18 files changed
+1599
-816
No files matched your search
+45
-44
@@ -21,10 +21,10 @@ from fastapi import HTTPException
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Limit concurrent bot executions to prevent resource exhaustion
|
||||
_bot_semaphore = asyncio.Semaphore(3)
|
||||
_bot_semaphore = asyncio.Semaphore(100)
|
||||
|
||||
# Dedicated thread pool for bot execution (separate from default executor)
|
||||
_bot_executor = ThreadPoolExecutor(max_workers=3, thread_name_prefix="bot_")
|
||||
_bot_executor = ThreadPoolExecutor(max_workers=100, thread_name_prefix="bot_")
|
||||
|
||||
# Timeout for bot code execution (seconds)
|
||||
BOT_EXECUTION_TIMEOUT = 10
|
||||
@@ -225,10 +225,11 @@ async def run_bot_for_message(
|
||||
is_outgoing: bool = False,
|
||||
) -> None:
|
||||
"""
|
||||
Run the bot for an incoming message if enabled.
|
||||
Run all enabled bots for an incoming message.
|
||||
|
||||
This is the main entry point called by message handlers after
|
||||
a message is successfully decrypted and stored.
|
||||
a message is successfully decrypted and stored. Bots run serially,
|
||||
and errors in one bot don't prevent others from running.
|
||||
|
||||
Args:
|
||||
sender_name: Display name of the sender
|
||||
@@ -245,23 +246,18 @@ async def run_bot_for_message(
|
||||
if is_outgoing:
|
||||
return
|
||||
|
||||
# Early check if bot is enabled (will re-check after sleep)
|
||||
# Early check if any bots are enabled (will re-check after sleep)
|
||||
from app.repository import AppSettingsRepository
|
||||
|
||||
settings = await AppSettingsRepository.get()
|
||||
if not settings.bot_enabled or not settings.bot_code:
|
||||
return
|
||||
|
||||
# Try to acquire semaphore (limit concurrent bot executions)
|
||||
if not _bot_semaphore.locked():
|
||||
pass # Semaphore available
|
||||
else:
|
||||
logger.debug("Bot execution queue full, skipping message")
|
||||
enabled_bots = [b for b in settings.bots if b.enabled and b.code.strip()]
|
||||
if not enabled_bots:
|
||||
return
|
||||
|
||||
async with _bot_semaphore:
|
||||
logger.debug(
|
||||
"Running bot for message from %s (is_dm=%s)",
|
||||
"Running %d bot(s) for message from %s (is_dm=%s)",
|
||||
len(enabled_bots),
|
||||
sender_name or (sender_key[:12] if sender_key else "unknown"),
|
||||
is_dm,
|
||||
)
|
||||
@@ -269,38 +265,43 @@ async def run_bot_for_message(
|
||||
# Wait for the initiating message's retransmissions to propagate through the mesh
|
||||
await asyncio.sleep(2)
|
||||
|
||||
# Re-check settings after sleep (user may have disabled bot)
|
||||
# Re-check settings after sleep (user may have changed bot config)
|
||||
settings = await AppSettingsRepository.get()
|
||||
if not settings.bot_enabled or not settings.bot_code:
|
||||
logger.debug("Bot disabled during wait, skipping")
|
||||
enabled_bots = [b for b in settings.bots if b.enabled and b.code.strip()]
|
||||
if not enabled_bots:
|
||||
logger.debug("All bots disabled during wait, skipping")
|
||||
return
|
||||
|
||||
# Execute bot code in a dedicated thread pool with timeout
|
||||
# Run each enabled bot serially
|
||||
loop = asyncio.get_event_loop()
|
||||
try:
|
||||
response = await asyncio.wait_for(
|
||||
loop.run_in_executor(
|
||||
_bot_executor,
|
||||
execute_bot_code,
|
||||
settings.bot_code,
|
||||
sender_name,
|
||||
sender_key,
|
||||
message_text,
|
||||
is_dm,
|
||||
channel_key,
|
||||
channel_name,
|
||||
sender_timestamp,
|
||||
path,
|
||||
),
|
||||
timeout=BOT_EXECUTION_TIMEOUT,
|
||||
)
|
||||
except asyncio.TimeoutError:
|
||||
logger.warning("Bot execution timed out after %ds", BOT_EXECUTION_TIMEOUT)
|
||||
return
|
||||
except Exception as e:
|
||||
logger.warning("Bot execution error: %s", e)
|
||||
return
|
||||
for bot in enabled_bots:
|
||||
logger.debug("Executing bot '%s'", bot.name)
|
||||
try:
|
||||
response = await asyncio.wait_for(
|
||||
loop.run_in_executor(
|
||||
_bot_executor,
|
||||
execute_bot_code,
|
||||
bot.code,
|
||||
sender_name,
|
||||
sender_key,
|
||||
message_text,
|
||||
is_dm,
|
||||
channel_key,
|
||||
channel_name,
|
||||
sender_timestamp,
|
||||
path,
|
||||
),
|
||||
timeout=BOT_EXECUTION_TIMEOUT,
|
||||
)
|
||||
except asyncio.TimeoutError:
|
||||
logger.warning(
|
||||
"Bot '%s' execution timed out after %ds", bot.name, BOT_EXECUTION_TIMEOUT
|
||||
)
|
||||
continue # Continue to next bot
|
||||
except Exception as e:
|
||||
logger.warning("Bot '%s' execution error: %s", bot.name, e)
|
||||
continue # Continue to next bot
|
||||
|
||||
# Send response if any
|
||||
if response:
|
||||
await process_bot_response(response, is_dm, sender_key or "", channel_key)
|
||||
# Send response if any
|
||||
if response:
|
||||
await process_bot_response(response, is_dm, sender_key or "", channel_key)
|
||||
@@ -121,6 +121,13 @@ async def run_migrations(conn: aiosqlite.Connection) -> int:
|
||||
await set_version(conn, 12)
|
||||
applied += 1
|
||||
|
||||
# Migration 13: Convert bot_enabled/bot_code to bots JSON array
|
||||
if version < 13:
|
||||
logger.info("Applying migration 13: convert to multi-bot format")
|
||||
await _migrate_013_convert_to_multi_bot(conn)
|
||||
await set_version(conn, 13)
|
||||
applied += 1
|
||||
|
||||
if applied > 0:
|
||||
logger.info(
|
||||
"Applied %d migration(s), schema now at version %d", applied, await get_version(conn)
|
||||
@@ -715,3 +722,74 @@ async def _migrate_012_add_bot_settings(conn: aiosqlite.Connection) -> None:
|
||||
raise
|
||||
|
||||
await conn.commit()
|
||||
|
||||
|
||||
async def _migrate_013_convert_to_multi_bot(conn: aiosqlite.Connection) -> None:
|
||||
"""
|
||||
Convert single bot_enabled/bot_code to multi-bot format.
|
||||
|
||||
Adds a 'bots' TEXT column storing a JSON array of bot configs:
|
||||
[{"id": "uuid", "name": "Bot 1", "enabled": true, "code": "..."}]
|
||||
|
||||
If existing bot_code is non-empty OR bot_enabled is true, migrates
|
||||
to a single bot named "Bot 1". Otherwise, creates empty array.
|
||||
|
||||
Attempts to drop the old bot_enabled and bot_code columns.
|
||||
"""
|
||||
import json
|
||||
import uuid
|
||||
|
||||
# Add new bots column
|
||||
try:
|
||||
await conn.execute("ALTER TABLE app_settings ADD COLUMN bots TEXT DEFAULT '[]'")
|
||||
logger.debug("Added bots column to app_settings")
|
||||
except aiosqlite.OperationalError as e:
|
||||
if "duplicate column" in str(e).lower():
|
||||
logger.debug("bots column already exists, skipping")
|
||||
else:
|
||||
raise
|
||||
|
||||
# Migrate existing bot data
|
||||
cursor = await conn.execute("SELECT bot_enabled, bot_code FROM app_settings WHERE id = 1")
|
||||
row = await cursor.fetchone()
|
||||
|
||||
if row:
|
||||
bot_enabled = bool(row[0]) if row[0] is not None else False
|
||||
bot_code = row[1] or ""
|
||||
|
||||
# If there's existing bot data, migrate it
|
||||
if bot_code.strip() or bot_enabled:
|
||||
bots = [
|
||||
{
|
||||
"id": str(uuid.uuid4()),
|
||||
"name": "Bot 1",
|
||||
"enabled": bot_enabled,
|
||||
"code": bot_code,
|
||||
}
|
||||
]
|
||||
bots_json = json.dumps(bots)
|
||||
logger.info("Migrating existing bot to multi-bot format: enabled=%s", bot_enabled)
|
||||
else:
|
||||
bots_json = "[]"
|
||||
|
||||
await conn.execute(
|
||||
"UPDATE app_settings SET bots = ? WHERE id = 1",
|
||||
(bots_json,),
|
||||
)
|
||||
|
||||
# Try to drop old columns (SQLite 3.35.0+ only)
|
||||
for column in ["bot_enabled", "bot_code"]:
|
||||
try:
|
||||
await conn.execute(f"ALTER TABLE app_settings DROP COLUMN {column}")
|
||||
logger.debug("Dropped %s column from app_settings", column)
|
||||
except aiosqlite.OperationalError as e:
|
||||
error_msg = str(e).lower()
|
||||
if "no such column" in error_msg:
|
||||
logger.debug("app_settings.%s already dropped, skipping", column)
|
||||
elif "syntax error" in error_msg or "drop column" in error_msg:
|
||||
# SQLite version doesn't support DROP COLUMN - harmless, column stays
|
||||
logger.debug("SQLite doesn't support DROP COLUMN, %s column will remain", column)
|
||||
else:
|
||||
raise
|
||||
|
||||
await conn.commit()
|
||||
+12
-7
@@ -232,6 +232,15 @@ class Favorite(BaseModel):
|
||||
id: str = Field(description="Channel key or contact public key")
|
||||
|
||||
|
||||
class BotConfig(BaseModel):
|
||||
"""Configuration for a single bot."""
|
||||
|
||||
id: str = Field(description="UUID for stable identity across renames/reorders")
|
||||
name: str = Field(description="User-editable name")
|
||||
enabled: bool = Field(default=False, description="Whether this bot is enabled")
|
||||
code: str = Field(default="", description="Python code for this bot")
|
||||
|
||||
|
||||
class AppSettings(BaseModel):
|
||||
"""Application settings stored in the database."""
|
||||
|
||||
@@ -266,11 +275,7 @@ class AppSettings(BaseModel):
|
||||
default=0,
|
||||
description="Unix timestamp of last advertisement sent (0 = never)",
|
||||
)
|
||||
bot_enabled: bool = Field(
|
||||
default=False,
|
||||
description="Whether the message bot is enabled",
|
||||
)
|
||||
bot_code: str = Field(
|
||||
default="",
|
||||
description="Python code for the message bot function",
|
||||
bots: list[BotConfig] = Field(
|
||||
default_factory=list,
|
||||
description="List of bot configurations",
|
||||
)
|
||||
+31
-13
@@ -7,7 +7,16 @@ 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 AppSettings, Channel, Contact, Favorite, Message, MessagePath, RawPacket
|
||||
from app.models import (
|
||||
AppSettings,
|
||||
BotConfig,
|
||||
Channel,
|
||||
Contact,
|
||||
Favorite,
|
||||
Message,
|
||||
MessagePath,
|
||||
RawPacket,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -682,7 +691,7 @@ class AppSettingsRepository:
|
||||
"""
|
||||
SELECT max_radio_contacts, favorites, auto_decrypt_dm_on_advert,
|
||||
sidebar_sort_order, last_message_times, preferences_migrated,
|
||||
advert_interval, last_advert_time, bot_enabled, bot_code
|
||||
advert_interval, last_advert_time, bots
|
||||
FROM app_settings WHERE id = 1
|
||||
"""
|
||||
)
|
||||
@@ -718,6 +727,20 @@ class AppSettingsRepository:
|
||||
)
|
||||
last_message_times = {}
|
||||
|
||||
# Parse bots JSON
|
||||
bots: list[BotConfig] = []
|
||||
if row["bots"]:
|
||||
try:
|
||||
bots_data = json.loads(row["bots"])
|
||||
bots = [BotConfig(**b) for b in bots_data]
|
||||
except (json.JSONDecodeError, TypeError, KeyError) as e:
|
||||
logger.warning(
|
||||
"Failed to parse bots JSON, using empty list: %s (data=%r)",
|
||||
e,
|
||||
row["bots"][:100] if row["bots"] else None,
|
||||
)
|
||||
bots = []
|
||||
|
||||
# Validate sidebar_sort_order (fallback to "recent" if invalid)
|
||||
sort_order = row["sidebar_sort_order"]
|
||||
if sort_order not in ("recent", "alpha"):
|
||||
@@ -732,8 +755,7 @@ class AppSettingsRepository:
|
||||
preferences_migrated=bool(row["preferences_migrated"]),
|
||||
advert_interval=row["advert_interval"] or 0,
|
||||
last_advert_time=row["last_advert_time"] or 0,
|
||||
bot_enabled=bool(row["bot_enabled"]),
|
||||
bot_code=row["bot_code"] or "",
|
||||
bots=bots,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
@@ -746,8 +768,7 @@ class AppSettingsRepository:
|
||||
preferences_migrated: bool | None = None,
|
||||
advert_interval: int | None = None,
|
||||
last_advert_time: int | None = None,
|
||||
bot_enabled: bool | None = None,
|
||||
bot_code: str | None = None,
|
||||
bots: list[BotConfig] | None = None,
|
||||
) -> AppSettings:
|
||||
"""Update app settings. Only provided fields are updated."""
|
||||
updates = []
|
||||
@@ -786,13 +807,10 @@ class AppSettingsRepository:
|
||||
updates.append("last_advert_time = ?")
|
||||
params.append(last_advert_time)
|
||||
|
||||
if bot_enabled is not None:
|
||||
updates.append("bot_enabled = ?")
|
||||
params.append(1 if bot_enabled else 0)
|
||||
|
||||
if bot_code is not None:
|
||||
updates.append("bot_code = ?")
|
||||
params.append(bot_code)
|
||||
if bots is not None:
|
||||
updates.append("bots = ?")
|
||||
bots_json = json.dumps([b.model_dump() for b in bots])
|
||||
params.append(bots_json)
|
||||
|
||||
if updates:
|
||||
query = f"UPDATE app_settings SET {', '.join(updates)} WHERE id = 1"
|
||||
|
||||
+16
-17
@@ -4,14 +4,14 @@ from typing import Literal
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from app.models import AppSettings
|
||||
from app.models import AppSettings, BotConfig
|
||||
from app.repository import AppSettingsRepository
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
router = APIRouter(prefix="/settings", tags=["settings"])
|
||||
|
||||
|
||||
def validate_bot_code(code: str) -> None:
|
||||
def validate_bot_code(code: str, bot_name: str | None = None) -> None:
|
||||
"""Validate bot code syntax. Raises HTTPException on error."""
|
||||
if not code or not code.strip():
|
||||
return # Empty code is valid (disables bot)
|
||||
@@ -19,12 +19,19 @@ def validate_bot_code(code: str) -> None:
|
||||
try:
|
||||
compile(code, "<bot_code>", "exec")
|
||||
except SyntaxError as e:
|
||||
name_part = f"'{bot_name}' " if bot_name else ""
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail=f"Bot code syntax error at line {e.lineno}: {e.msg}",
|
||||
detail=f"Bot {name_part}has syntax error at line {e.lineno}: {e.msg}",
|
||||
) from None
|
||||
|
||||
|
||||
def validate_all_bots(bots: list[BotConfig]) -> None:
|
||||
"""Validate all bots' code syntax. Raises HTTPException on first error."""
|
||||
for bot in bots:
|
||||
validate_bot_code(bot.code, bot.name)
|
||||
|
||||
|
||||
class AppSettingsUpdate(BaseModel):
|
||||
max_radio_contacts: int | None = Field(
|
||||
default=None,
|
||||
@@ -45,13 +52,9 @@ class AppSettingsUpdate(BaseModel):
|
||||
ge=0,
|
||||
description="Periodic advertisement interval in seconds (0 = disabled)",
|
||||
)
|
||||
bot_enabled: bool | None = Field(
|
||||
bots: list[BotConfig] | None = Field(
|
||||
default=None,
|
||||
description="Whether the message bot is enabled",
|
||||
)
|
||||
bot_code: str | None = Field(
|
||||
default=None,
|
||||
description="Python code for the message bot function",
|
||||
description="List of bot configurations",
|
||||
)
|
||||
|
||||
|
||||
@@ -116,14 +119,10 @@ async def update_settings(update: AppSettingsUpdate) -> AppSettings:
|
||||
logger.info("Updating advert_interval to %d", update.advert_interval)
|
||||
kwargs["advert_interval"] = update.advert_interval
|
||||
|
||||
if update.bot_enabled is not None:
|
||||
logger.info("Updating bot_enabled to %s", update.bot_enabled)
|
||||
kwargs["bot_enabled"] = update.bot_enabled
|
||||
|
||||
if update.bot_code is not None:
|
||||
validate_bot_code(update.bot_code)
|
||||
logger.info("Updating bot_code (length=%d)", len(update.bot_code))
|
||||
kwargs["bot_code"] = update.bot_code
|
||||
if update.bots is not None:
|
||||
validate_all_bots(update.bots)
|
||||
logger.info("Updating bots (count=%d)", len(update.bots))
|
||||
kwargs["bots"] = update.bots
|
||||
|
||||
if kwargs:
|
||||
return await AppSettingsRepository.update(**kwargs)
|
||||
|
||||
-612
@@ -1,612 +0,0 @@
|
||||
var Ey=Object.defineProperty;var ky=(n,s,i)=>s in n?Ey(n,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[s]=i;var $o=(n,s,i)=>ky(n,typeof s!="symbol"?s+"":s,i);function Sy(n,s){for(var i=0;i<s.length;i++){const l=s[i];if(typeof l!="string"&&!Array.isArray(l)){for(const u in l)if(u!=="default"&&!(u in n)){const c=Object.getOwnPropertyDescriptor(l,u);c&&Object.defineProperty(n,u,c.get?c:{enumerable:!0,get:()=>l[u]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))l(u);new MutationObserver(u=>{for(const c of u)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&l(h)}).observe(document,{childList:!0,subtree:!0});function i(u){const c={};return u.integrity&&(c.integrity=u.integrity),u.referrerPolicy&&(c.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?c.credentials="include":u.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function l(u){if(u.ep)return;u.ep=!0;const c=i(u);fetch(u.href,c)}})();var _l=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ls(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Cx(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var s=n.default;if(typeof s=="function"){var i=function l(){return this instanceof l?Reflect.construct(s,arguments,this.constructor):s.apply(this,arguments)};i.prototype=s.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(n).forEach(function(l){var u=Object.getOwnPropertyDescriptor(n,l);Object.defineProperty(i,l,u.get?u:{enumerable:!0,get:function(){return n[l]}})}),i}var Jf={exports:{}},tl={},e0={exports:{}},vt={};/**
|
||||
* @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 Yp;function By(){if(Yp)return vt;Yp=1;var n=Symbol.for("react.element"),s=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),h=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),v=Symbol.iterator;function C(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var P={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,k={};function w(D,H,q){this.props=D,this.context=H,this.refs=k,this.updater=q||P}w.prototype.isReactComponent={},w.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,H,"setState")},w.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function B(){}B.prototype=w.prototype;function b(D,H,q){this.props=D,this.context=H,this.refs=k,this.updater=q||P}var E=b.prototype=new B;E.constructor=b,M(E,w.prototype),E.isPureReactComponent=!0;var T=Array.isArray,F=Object.prototype.hasOwnProperty,I={current:null},j={key:!0,ref:!0,__self:!0,__source:!0};function O(D,H,q){var Q,ae={},ce=null,Ae=null;if(H!=null)for(Q in H.ref!==void 0&&(Ae=H.ref),H.key!==void 0&&(ce=""+H.key),H)F.call(H,Q)&&!j.hasOwnProperty(Q)&&(ae[Q]=H[Q]);var pe=arguments.length-2;if(pe===1)ae.children=q;else if(1<pe){for(var xe=Array(pe),Be=0;Be<pe;Be++)xe[Be]=arguments[Be+2];ae.children=xe}if(D&&D.defaultProps)for(Q in pe=D.defaultProps,pe)ae[Q]===void 0&&(ae[Q]=pe[Q]);return{$$typeof:n,type:D,key:ce,ref:Ae,props:ae,_owner:I.current}}function G(D,H){return{$$typeof:n,type:D.type,key:H,ref:D.ref,props:D.props,_owner:D._owner}}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===n}function K(D){var H={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(q){return H[q]})}var J=/\/+/g;function Y(D,H){return typeof D=="object"&&D!==null&&D.key!=null?K(""+D.key):H.toString(36)}function ie(D,H,q,Q,ae){var ce=typeof D;(ce==="undefined"||ce==="boolean")&&(D=null);var Ae=!1;if(D===null)Ae=!0;else switch(ce){case"string":case"number":Ae=!0;break;case"object":switch(D.$$typeof){case n:case s:Ae=!0}}if(Ae)return Ae=D,ae=ae(Ae),D=Q===""?"."+Y(Ae,0):Q,T(ae)?(q="",D!=null&&(q=D.replace(J,"$&/")+"/"),ie(ae,H,q,"",function(Be){return Be})):ae!=null&&(U(ae)&&(ae=G(ae,q+(!ae.key||Ae&&Ae.key===ae.key?"":(""+ae.key).replace(J,"$&/")+"/")+D)),H.push(ae)),1;if(Ae=0,Q=Q===""?".":Q+":",T(D))for(var pe=0;pe<D.length;pe++){ce=D[pe];var xe=Q+Y(ce,pe);Ae+=ie(ce,H,q,xe,ae)}else if(xe=C(D),typeof xe=="function")for(D=xe.call(D),pe=0;!(ce=D.next()).done;)ce=ce.value,xe=Q+Y(ce,pe++),Ae+=ie(ce,H,q,xe,ae);else if(ce==="object")throw H=String(D),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.");return Ae}function ge(D,H,q){if(D==null)return D;var Q=[],ae=0;return ie(D,Q,"","",function(ce){return H.call(q,ce,ae++)}),Q}function $(D){if(D._status===-1){var H=D._result;H=H(),H.then(function(q){(D._status===0||D._status===-1)&&(D._status=1,D._result=q)},function(q){(D._status===0||D._status===-1)&&(D._status=2,D._result=q)}),D._status===-1&&(D._status=0,D._result=H)}if(D._status===1)return D._result.default;throw D._result}var se={current:null},W={transition:null},te={ReactCurrentDispatcher:se,ReactCurrentBatchConfig:W,ReactCurrentOwner:I};function Z(){throw Error("act(...) is not supported in production builds of React.")}return vt.Children={map:ge,forEach:function(D,H,q){ge(D,function(){H.apply(this,arguments)},q)},count:function(D){var H=0;return ge(D,function(){H++}),H},toArray:function(D){return ge(D,function(H){return H})||[]},only:function(D){if(!U(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},vt.Component=w,vt.Fragment=i,vt.Profiler=u,vt.PureComponent=b,vt.StrictMode=l,vt.Suspense=g,vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=te,vt.act=Z,vt.cloneElement=function(D,H,q){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var Q=M({},D.props),ae=D.key,ce=D.ref,Ae=D._owner;if(H!=null){if(H.ref!==void 0&&(ce=H.ref,Ae=I.current),H.key!==void 0&&(ae=""+H.key),D.type&&D.type.defaultProps)var pe=D.type.defaultProps;for(xe in H)F.call(H,xe)&&!j.hasOwnProperty(xe)&&(Q[xe]=H[xe]===void 0&&pe!==void 0?pe[xe]:H[xe])}var xe=arguments.length-2;if(xe===1)Q.children=q;else if(1<xe){pe=Array(xe);for(var Be=0;Be<xe;Be++)pe[Be]=arguments[Be+2];Q.children=pe}return{$$typeof:n,type:D.type,key:ae,ref:ce,props:Q,_owner:Ae}},vt.createCLine 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 Jp;function Py(){if(Jp)return tl;Jp=1;var n=sd(),s=Symbol.for("react.element"),i=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,u=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function h(d,g,m){var x,v={},C=null,P=null;m!==void 0&&(C=""+m),g.key!==void 0&&(C=""+g.key),g.ref!==void 0&&(P=g.ref);for(x in g)l.call(g,x)&&!c.hasOwnProperty(x)&&(v[x]=g[x]);if(d&&d.defaultProps)for(x in g=d.defaultProps,g)v[x]===void 0&&(v[x]=g[x]);return{$$typeof:s,type:d,key:C,ref:P,props:v,_owner:u.current}}return tl.Fragment=i,tl.jsx=h,tl.jsxs=h,tl}var em;function Ty(){return em||(em=1,Jf.exports=Py()),Jf.exports}var _=Ty(),N=sd();const De=ls(N),z0=Sy({__proto__:null,default:De},[N]);var Zu={},t0={exports:{}},Yn={},n0={exports:{}},r0={};/**
|
||||
* @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 tm;function Dy(){return tm||(tm=1,(function(n){function s(W,te){var Z=W.length;W.push(te);e:for(;0<Z;){var D=Z-1>>>1,H=W[D];if(0<u(H,te))W[D]=te,W[Z]=H,Z=D;else break e}}function i(W){return W.length===0?null:W[0]}function l(W){if(W.length===0)return null;var te=W[0],Z=W.pop();if(Z!==te){W[0]=Z;e:for(var D=0,H=W.length,q=H>>>1;D<q;){var Q=2*(D+1)-1,ae=W[Q],ce=Q+1,Ae=W[ce];if(0>u(ae,Z))ce<H&&0>u(Ae,ae)?(W[D]=Ae,W[ce]=Z,D=ce):(W[D]=ae,W[Q]=Z,D=Q);else if(ce<H&&0>u(Ae,Z))W[D]=Ae,W[ce]=Z,D=ce;else break e}}return te}function u(W,te){var Z=W.sortIndex-te.sortIndex;return Z!==0?Z:W.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var h=Date,d=h.now();n.unstable_now=function(){return h.now()-d}}var g=[],m=[],x=1,v=null,C=3,P=!1,M=!1,k=!1,w=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(W){for(var te=i(m);te!==null;){if(te.callback===null)l(m);else if(te.startTime<=W)l(m),te.sortIndex=te.expirationTime,s(g,te);else break;te=i(m)}}function T(W){if(k=!1,E(W),!M)if(i(g)!==null)M=!0,$(F);else{var te=i(m);te!==null&&se(T,te.startTime-W)}}function F(W,te){M=!1,k&&(k=!1,B(O),O=-1),P=!0;var Z=C;try{for(E(te),v=i(g);v!==null&&(!(v.expirationTime>te)||W&&!K());){var D=v.callback;if(typeof D=="function"){v.callback=null,C=v.priorityLevel;var H=D(v.expirationTime<=te);te=n.unstable_now(),typeof H=="function"?v.callback=H:v===i(g)&&l(g),E(te)}else l(g);v=i(g)}if(v!==null)var q=!0;else{var Q=i(m);Q!==null&&se(T,Q.startTime-te),q=!1}return q}finally{v=null,C=Z,P=!1}}var I=!1,j=null,O=-1,G=5,U=-1;function K(){return!(n.unstable_now()-U<G)}function J(){if(j!==null){var W=n.unstable_now();U=W;var te=!0;try{te=j(!0,W)}finally{te?Y():(I=!1,j=null)}}else I=!1}var Y;if(typeof b=="function")Y=function(){b(J)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,ge=ie.port2;ie.port1.onmessage=J,Y=function(){ge.postMessage(null)}}else Y=function(){w(J,0)};function $(W){j=W,I||(I=!0,Y())}function se(W,te){O=w(function(){W(n.unstable_now())},te)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(W){W.callback=null},n.unstable_continueExecution=function(){M||P||(M=!0,$(F))},n.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<W?Math.floor(1e3/W):5},n.unstable_getCurrentPriorityLevel=function(){return C},n.unstable_getFirstCallbackNode=function(){return i(g)},n.unstable_next=function(W){switch(C){case 1:case 2:case 3:var te=3;break;default:te=C}var Z=C;C=te;try{return W()}finally{C=Z}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(W,te){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var Z=C;C=W;try{return te()}finally{C=Z}},n.unstable_scheduleCallback=function(W,te,Z){var D=n.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?D+Z:D):Z=D,W){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=Z+H,W={id:x++,callback:te,priorityLevel:W,startTime:Z,expirationTime:H,sortIndex:-1},Z>D?(W.sortIndex=Z,s(m,W),i(g)===null&&W===i(m)&&(k?(B(O),O=-1):k=!0,se(T,Z-D))):(W.sortIndex=H,s(g,W),M||P||(M=!0,$(F))),W},n.unstable_shouldYield=K,n.unstable_wrapCallback=function(W){var te=C;return function(){var Z=C;C=te;try{return W.apply(this,arguments)}finally{C=Z}}}})(r0)),r0}var nm;function Ry(){return nm||(nm=1,n0.exports=Dy()),n0.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 rm;function Fy(){if(rm)return Yn;rm=1;var n=sd(),s=Ry();function i(e){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+e,a=1;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+e+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,u={};function c(e,r){h(e,r),h(e+"Capture",r)}function h(e,r){for(u[e]=r,e=0;e<r.length;e++)l.add(r[e])}var d=!(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]*$/,x={},v={};function C(e){return g.call(v,e)?!0:g.call(x,e)?!1:m.test(e)?v[e]=!0:(x[e]=!0,!1)}function P(e,r,a,p){if(a!==null&&a.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return p?!1:a!==null?!a.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function M(e,r,a,p){if(r===null||typeof r>"u"||P(e,r,a,p))return!0;if(p)return!1;if(a!==null)switch(a.type){case 3:return!r;case 4:return r===!1;case 5:return isNaN(r);case 6:return isNaN(r)||1>r}return!1}function k(e,r,a,p,y,S,z){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=p,this.attributeNamespace=y,this.mustUseProperty=a,this.propertyName=e,this.type=r,this.sanitizeURL=S,this.removeEmptyString=z}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){w[e]=new k(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var r=e[0];w[r]=new k(r,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){w[e]=new k(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){w[e]=new k(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){w[e]=new k(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){w[e]=new k(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){w[e]=new k(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){w[e]=new k(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){w[e]=new k(e,5,!1,e.toLowerCase(),null,!1,!1)});var B=/[\-:]([a-z])/g;function b(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 r=e.replace(B,b);w[r]=new k(r,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var r=e.replace(B,b);w[r]=new k(r,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var r=e.replace(B,b);w[r]=new k(r,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){w[e]=new k(e,1,!1,e.toLowerCase(),null,!1,!1)}),w.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){w[e]=new k(e,1,!1,e.toLowerCase(),null,!0,!0)});function E(e,r,a,p){var y=w.hasOwnProperty(r)?w[r]:null;(y!==null?y.type!==0:p||!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=
Line truncated
|
||||
`+D+e}var q=!1;function Q(e,r){if(!e||q)return"";q=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(r)if(r=function(){throw Error()},Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(r,[])}catch(me){var p=me}Reflect.construct(e,[],r)}else{try{r.call()}catch(me){p=me}e.call(r.prototype)}else{try{throw Error()}catch(me){p=me}e()}}catch(me){if(me&&p&&typeof me.stack=="string"){for(var y=me.stack.split(`
|
||||
`),S=p.stack.split(`
|
||||
`),z=y.length-1,X=S.length-1;1<=z&&0<=X&&y[z]!==S[X];)X--;for(;1<=z&&0<=X;z--,X--)if(y[z]!==S[X]){if(z!==1||X!==1)do if(z--,X--,0>X||y[z]!==S[X]){var ne=`
|
||||
`+y[z].replace(" at new "," at ");return e.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",e.displayName)),ne}while(1<=z&&0<=X);break}}}finally{q=!1,Error.prepareStackTrace=a}return(e=e?e.displayName||e.name:"")?H(e):""}function ae(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=Q(e.type,!1),e;case 11:return e=Q(e.type.render,!1),e;case 1:return e=Q(e.type,!0),e;default:return""}}function ce(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 j:return"Fragment";case I:return"Portal";case G:return"Profiler";case O:return"StrictMode";case Y:return"Suspense";case ie:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case K:return(e.displayName||"Context")+".Consumer";case U:return(e._context.displayName||"Context")+".Provider";case J:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ge:return r=e.displayName||null,r!==null?r:ce(e.type)||"Memo";case $:r=e._payload,e=e._init;try{return ce(e(r))}catch{}}return null}function Ae(e){var r=e.type;switch(e.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=r.render,e=e.displayName||e.name||"",r.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ce(r);case 8:return r===O?"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 r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function pe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function xe(e){var r=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Be(e){var r=xe(e)?"checked":"value",a=Object.getOwnPropertyDescriptor(e.constructor.prototype,r),p=""+e[r];if(!e.hasOwnProperty(r)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var y=a.get,S=a.set;return Object.defineProperty(e,r,{configurable:!0,get:function(){return y.call(this)},set:function(z){p=""+z,S.call(this,z)}}),Object.defineProperty(e,r,{enumerable:a.enumerable}),{getValue:function(){return p},setValue:function(z){p=""+z},stopTracking:function(){e._valueTracker=null,delete e[r]}}}}function Oe(e){e._valueTracker||(e._valueTracker=Be(e))}function Xe(e){if(!e)return!1;var r=e._valueTracker;if(!r)return!0;var a=r.getValue(),p="";return e&&(p=xe(e)?e.checked?"true":"false":e.value),e=p,e!==a?(r.setValue(e),!0):!1}function Ee(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 je(e,r){var a=r.checked;return Z({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??e._wrapperState.initialChecked})}function at(e,r){var a=r.defaultValue==null?"":r.defaultValue,p=r.checked!=null?r.checked:r.defaultChecked;a=pe(r.value!=null?r.value:a),e._wrapperState={initialChecked:p,initialValue:a,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function mt(e,r){r=r.checked,r!=null&&E(e,"checked",r,!1)}function ot(e,r){mt(e,r);var a=pe(r.value),p=r.type;if(a!=null)p==="number"?(a===0&&e.value===""||e.value!=a)&&(e.value=""+a):e.value!==""+a&&(e.value=""+a);else if(p==="submit"||p==="reset"){e.removeAttribute("value");return}r.hasOwnProperty("value")?Ke(e,r.type,a):r.hasOwnProperty("defaultValue")&&Ke(e,r.type,pe(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(e.defaultChecked=!!r.defaultChecked)}function qe(e,r,a){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var p=r.type;if(!(p!=="submit"&&p!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+e._wrapperState.initialValue,a||r===e.value||(e.value=r),e.defaultValue=r}a=e.name,a!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,a!==""&&(e.name=a)}function Ke(e,r,a){(r!=="number"||Ee(e.ownerDocument)!==e)&&(a==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+a&&(e.defaultValue=""+a))}var Qe=Array.isArray;function rt(e,r,a,p){if(e=e.options,r){r={};for(var y=0;y<a.length;y++)r["$"+a[y]]=!0;for(a=0;a<e.length;a++)y=r.hasOwnProperty("$"+e[a].value),e[a].selected!==y&&(e[a].selected=y),y&&p&&(e[a].defaultSelected=!0)}else{for(a=""+pe(a),r=null,y=0;y<e.length;y++){if(e[y].value===a){e[y].selected=!0,p&&(e[y].defaultSelected=!0);return}r!==null||e[y].disabled||(r=e[y])}r!==null&&(r.selected=!0)}}function He(e,r){if(r.dangerouslySetInnerH
Line truncated
|
||||
`).replace(ee,"")}function he(e,r,a){if(r=le(r),le(e)!==r&&a)throw Error(i(425))}function be(){}var Me=null,et=null;function ht(e,r){return e==="textarea"||e==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var dn=typeof setTimeout=="function"?setTimeout:void 0,ln=typeof clearTimeout=="function"?clearTimeout:void 0,On=typeof Promise=="function"?Promise:void 0,Tn=typeof queueMicrotask=="function"?queueMicrotask:typeof On<"u"?function(e){return On.resolve(null).then(e).catch(eo)}:dn;function eo(e){setTimeout(function(){throw e})}function za(e,r){var a=r,p=0;do{var y=a.nextSibling;if(e.removeChild(a),y&&y.nodeType===8)if(a=y.data,a==="/$"){if(p===0){e.removeChild(y),rr(r);return}p--}else a!=="$"&&a!=="$?"&&a!=="$!"||p++;a=y}while(a);rr(r)}function Jr(e){for(;e!=null;e=e.nextSibling){var r=e.nodeType;if(r===1||r===3)break;if(r===8){if(r=e.data,r==="$"||r==="$!"||r==="$?")break;if(r==="/$")return null}}return e}function ou(e){e=e.previousSibling;for(var r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"){if(r===0)return e;r--}else a==="/$"&&r++}e=e.previousSibling}return null}var vi=Math.random().toString(36).slice(2),yr="__reactFiber$"+vi,to="__reactProps$"+vi,Ft="__reactContainer$"+vi,no="__reactEvents$"+vi,Gd="__reactListeners$"+vi,$d="__reactHandles$"+vi;function Ai(e){var r=e[yr];if(r)return r;for(var a=e.parentNode;a;){if(r=a[Ft]||a[yr]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(e=ou(e);e!==null;){if(a=e[yr])return a;e=ou(e)}return r}e=a,a=e.parentNode}return null}function yi(e){return e=e[yr]||e[Ft],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function _i(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(i(33))}function Ls(e){return e[to]||null}var Kd=[],Ms=-1;function ro(e){return{current:e}}function qt(e){0>Ms||(e.current=Kd[Ms],Kd[Ms]=null,Ms--)}function Zt(e,r){Ms++,Kd[Ms]=e.current,e.current=r}var io={},Dn=ro(io),qn=ro(!1),Io=io;function Is(e,r){var a=e.type.contextTypes;if(!a)return io;var p=e.stateNode;if(p&&p.__reactInternalMemoizedUnmaskedChildContext===r)return p.__reactInternalMemoizedMaskedChildContext;var y={},S;for(S in a)y[S]=r[S];return p&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=y),y}function Gn(e){return e=e.childContextTypes,e!=null}function su(){qt(qn),qt(Dn)}function Ah(e,r,a){if(Dn.current!==io)throw Error(i(168));Zt(Dn,r),Zt(qn,a)}function yh(e,r,a){var p=e.stateNode;if(r=r.childContextTypes,typeof p.getChildContext!="function")return a;p=p.getChildContext();for(var y in p)if(!(y in r))throw Error(i(108,Ae(e)||"Unknown",y));return Z({},a,p)}function au(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||io,Io=Dn.current,Zt(Dn,e),Zt(qn,qn.current),!0}function _h(e,r,a){var p=e.stateNode;if(!p)throw Error(i(169));a?(e=yh(e,r,Io),p.__reactInternalMemoizedMergedChildContext=e,qt(qn),qt(Dn),Zt(Dn,e)):qt(qn),Zt(qn,a)}var wi=null,lu=!1,Qd=!1;function wh(e){wi===null?wi=[e]:wi.push(e)}function ZA(e){lu=!0,wh(e)}function oo(){if(!Qd&&wi!==null){Qd=!0;var e=0,r=Ct;try{var a=wi;for(Ct=1;e<a.length;e++){var p=a[e];do p=p(!0);while(p!==null)}wi=null,lu=!1}catch(y){throw wi!==null&&(wi=wi.slice(e+1)),Ll(ma,oo),y}finally{Ct=r,Qd=!1}}return null}var Os=[],js=0,uu=null,cu=0,_r=[],wr=0,Oo=null,bi=1,Ci="";function jo(e,r){Os[js++]=cu,Os[js++]=uu,uu=e,cu=r}function bh(e,r,a){_r[wr++]=bi,_r[wr++]=Ci,_r[wr++]=Oo,Oo=e;var p=bi;e=Ci;var y=32-ct(p)-1;p&=~(1<<y),a+=1;var S=32-ct(r)+y;if(30<S){var z=y-y%5;S=(p&(1<<z)-1).toString(32),p>>=z,y-=z,bi=1<<32-ct(r)+y|a<<y|p,Ci=S+e}else bi=1<<S|a<<y|p,Ci=e}function Yd(e){e.return!==null&&(jo(e,1),bh(e,1,0))}function Xd(e){for(;e===uu;)uu=Os[--js],Os[js]=null,cu=Os[--js],Os[js]=null;for(;e===Oo;)Oo=_r[--wr],_r[wr]=null,Ci=_r[--wr],_r[wr]=null,bi=_r[--wr],_r[wr]=null}var lr=null,ur=null,Kt=!1,Lr=null;function Ch(e,r){var a=kr(5,null,null,0);a.elementType="DELETED",a.stateNode=r,a.return=e,r=e.deletions,r===null?(e.deletions=[a],e.flags|=16):r.push(a)}function Eh(e,r){switch(e.tag){case 5:var a=e.type;return r=r.nodeType!==1||a.toLowerCase()!==r.nodeName.toLowerCase()?null:r,r!==null?(e.stateNode=r,lr=e,ur=Jr(r.firstChild),!0):!1;case 6:return r=e.pendingProps===""||r.nodeType!==3?null:r,r!==null?(e.stateNode=r,lr=e,ur=null,!0):!1;case 13:return r=r.nodeType!==8?null:r,r!==null?(a=Oo!==null?{id:bi,overflow:Ci}:null,e.memoizedState={dehydrated:r,treeContext:a,retryLane:1073741824},a=kr(18,null,null,0),a.stateNode=r,a.return=e,e.child=a,lr=e,ur=null,!0):!1;default:return!1}}function Jd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ef(e){if(Kt){var r=ur;if(r){var a=r;if(!Eh(e,r)){if(Jd(e))throw Error(i(418));r=Jr(a.nextSibling);var p=lr;r&&Eh(e,r)?Ch(p,a):(e.flags=e.flags&-4097|2,Kt=!1,lr=e)}}else{if(Jd(e))throw Error(i(418));e.flags=e.flags&-4097|2,Kt=!1,lr=e}}}function kh(e){for(e=e.
Line truncated
|
||||
Error generating stack: `+S.message+`
|
||||
`+S.stack}return{value:e,source:r,stack:y,digest:null}}function bf(e,r,a){return{value:e,source:null,stack:a??null,digest:r??null}}function Cf(e,r){try{console.error(r.value)}catch(a){setTimeout(function(){throw a})}}var JA=typeof WeakMap=="function"?WeakMap:Map;function sp(e,r,a){a=ki(-1,a),a.tag=3,a.payload={element:null};var p=r.value;return a.callback=function(){Tu||(Tu=!0,jf=p),Cf(e,r)},a}function ap(e,r,a){a=ki(-1,a),a.tag=3;var p=e.type.getDerivedStateFromError;if(typeof p=="function"){var y=r.value;a.payload=function(){return p(y)},a.callback=function(){Cf(e,r)}}var S=e.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(a.callback=function(){Cf(e,r),typeof p!="function"&&(uo===null?uo=new Set([this]):uo.add(this));var z=r.stack;this.componentDidCatch(r.value,{componentStack:z!==null?z:""})}),a}function lp(e,r,a){var p=e.pingCache;if(p===null){p=e.pingCache=new JA;var y=new Set;p.set(r,y)}else y=p.get(r),y===void 0&&(y=new Set,p.set(r,y));y.has(a)||(y.add(a),e=hy.bind(null,e,r,a),r.then(e,e))}function up(e){do{var r;if((r=e.tag===13)&&(r=e.memoizedState,r=r!==null?r.dehydrated!==null:!0),r)return e;e=e.return}while(e!==null);return null}function cp(e,r,a,p,y){return(e.mode&1)===0?(e===r?e.flags|=65536:(e.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(r=ki(-1,1),r.tag=2,ao(a,r,1))),a.lanes|=1),e):(e.flags|=65536,e.lanes=y,e)}var ey=T.ReactCurrentOwner,$n=!1;function jn(e,r,a,p){r.child=e===null?Th(r,null,a,p):Hs(r,e.child,a,p)}function dp(e,r,a,p,y){a=a.render;var S=r.ref;return Us(r,y),p=mf(e,r,a,p,S,y),a=gf(),e!==null&&!$n?(r.updateQueue=e.updateQueue,r.flags&=-2053,e.lanes&=~y,Si(e,r,y)):(Kt&&a&&Yd(r),r.flags|=1,jn(e,r,p,y),r.child)}function fp(e,r,a,p,y){if(e===null){var S=a.type;return typeof S=="function"&&!qf(S)&&S.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(r.tag=15,r.type=S,hp(e,r,S,p,y)):(e=Mu(a.type,null,p,r,r.mode,y),e.ref=r.ref,e.return=r,r.child=e)}if(S=e.child,(e.lanes&y)===0){var z=S.memoizedProps;if(a=a.compare,a=a!==null?a:Qr,a(z,p)&&e.ref===r.ref)return Si(e,r,y)}return r.flags|=1,e=po(S,p),e.ref=r.ref,e.return=r,r.child=e}function hp(e,r,a,p,y){if(e!==null){var S=e.memoizedProps;if(Qr(S,p)&&e.ref===r.ref)if($n=!1,r.pendingProps=p=S,(e.lanes&y)!==0)(e.flags&131072)!==0&&($n=!0);else return r.lanes=e.lanes,Si(e,r,y)}return Ef(e,r,a,p,y)}function pp(e,r,a){var p=r.pendingProps,y=p.children,S=e!==null?e.memoizedState:null;if(p.mode==="hidden")if((r.mode&1)===0)r.memoizedState={baseLanes:0,cachePool:null,transitions:null},Zt(Gs,cr),cr|=a;else{if((a&1073741824)===0)return e=S!==null?S.baseLanes|a:a,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:e,cachePool:null,transitions:null},r.updateQueue=null,Zt(Gs,cr),cr|=e,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},p=S!==null?S.baseLanes:a,Zt(Gs,cr),cr|=p}else S!==null?(p=S.baseLanes|a,r.memoizedState=null):p=a,Zt(Gs,cr),cr|=p;return jn(e,r,y,a),r.child}function mp(e,r){var a=r.ref;(e===null&&a!==null||e!==null&&e.ref!==a)&&(r.flags|=512,r.flags|=2097152)}function Ef(e,r,a,p,y){var S=Gn(a)?Io:Dn.current;return S=Is(r,S),Us(r,y),a=mf(e,r,a,p,S,y),p=gf(),e!==null&&!$n?(r.updateQueue=e.updateQueue,r.flags&=-2053,e.lanes&=~y,Si(e,r,y)):(Kt&&p&&Yd(r),r.flags|=1,jn(e,r,a,y),r.child)}function gp(e,r,a,p,y){if(Gn(a)){var S=!0;au(r)}else S=!1;if(Us(r,y),r.stateNode===null)Eu(e,r),ip(r,a,p),wf(r,a,p,y),p=!0;else if(e===null){var z=r.stateNode,X=r.memoizedProps;z.props=X;var ne=z.context,me=a.contextType;typeof me=="object"&&me!==null?me=br(me):(me=Gn(a)?Io:Dn.current,me=Is(r,me));var Se=a.getDerivedStateFromProps,Te=typeof Se=="function"||typeof z.getSnapshotBeforeUpdate=="function";Te||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(X!==p||ne!==me)&&op(r,z,p,me),so=!1;var ke=r.memoizedState;z.state=ke,gu(r,p,z,y),ne=r.memoizedState,X!==p||ke!==ne||qn.current||so?(typeof Se=="function"&&(_f(r,a,Se,p),ne=r.memoizedState),(X=so||rp(r,a,X,p,ke,ne,me))?(Te||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(r.flags|=4194308)):(typeof z.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=p,r.memoizedState=ne),z.props=p,z.state=ne,z.context=me,p=X):(typeof z.componentDidMount=="function"&&(r.flags|=4194308),p=!1)}else{z=r.stateNode,Rh(e,r),X=r.memoizedProps,me=r.type===r.elementType?X:Mr(r.type,X),z.props=me,Te=r.pendingProps,ke=z.context,ne=a.contextType,typeof ne=="object"&&ne!==null?ne=br(ne):(ne=Gn(a)?Io:Dn.current,ne=Is(r,ne));var Ie=a.getDerivedStateFromProps;(Se=typeof Ie=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(X!==Te||ke!==ne)&&op(r,z,
Line truncated
|
||||
`)}function Qs(n,s,i){const l=Math.floor(Date.now()/1e3);return{id:-Date.now(),type:"PRIV",conversation_key:n,text:s,sender_timestamp:l,received_at:l,paths:null,txt_type:0,signature:null,outgoing:i,acked:1}}function Vy(n){const s=N.useRef(null),i=N.useRef(null),l=N.useCallback(()=>{i.current!==null&&(clearInterval(i.current),i.current=null),s.current=null},[]),u=N.useCallback(async()=>{const h=s.current;if(!h)return;let d=null,g=null;for(let m=0;m<2;m++)try{d=await ut.requestTelemetry(h.conversationId,"");break}catch(x){g=x instanceof Error?x:new Error("Unknown error"),m===0&&await new Promise(v=>setTimeout(v,2e3))}if(d){const m=Qs(h.conversationId,Hy(h,d),!1);n(x=>[...x,m])}else{const m=Qs(h.conversationId,`Duty cycle poll failed after retry: ${(g==null?void 0:g.message)??"Unknown error"}`,!1);n(x=>[...x,m])}},[n]),c=N.useCallback(async(h,d)=>{const g=h.trim().toLowerCase();if(g==="dutycycle_start"){l();let m=null,x=null;for(let P=0;P<2;P++)try{m=await ut.requestTelemetry(d,"");break}catch(M){x=M instanceof Error?M:new Error("Unknown error"),P===0&&await new Promise(k=>setTimeout(k,2e3))}if(!m){const P=Qs(d,`Failed to start duty cycle tracking after retry: ${(x==null?void 0:x.message)??"Unknown error"}`,!1);return n(M=>[...M,P]),!0}const v=Math.floor(Date.now()/1e3);s.current={startTime:v,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:d};const C=Qs(d,`Airtime/duty cycle statistics gathering begins at ${v}. Logs will follow every 5 minutes. To stop, run dutycycle_stop or navigate away from this conversation.`,!1);return n(P=>[...P,C]),i.current=window.setInterval(u,jy),!0}if(g==="dutycycle_stop"){if(s.current&&s.current.conversationId===d){await u(),l();const m=Qs(d,"Airtime/duty cycle statistics gathering stopped.",!1);n(x=>[...x,m])}else{const m=Qs(d,"Duty cycle tracking is not active.",!1);n(x=>[...x,m])}return!0}return!1},[n,l,u]);return N.useEffect(()=>()=>{i.current!==null&&clearInterval(i.current)},[]),{handleAirtimeCommand:c,stopTracking:l}}function oc(n){if(n<60)return`${n}s`;const s=Math.floor(n/86400),i=Math.floor(n%86400/3600),l=Math.floor(n%3600/60);return s>0?i>0&&l>0?`${s}d${i}h${l}m`:i>0?`${s}d${i}h`:l>0?`${s}d${l}m`:`${s}d`:i>0?l>0?`${i}h${l}m`:`${i}h`:`${l}m`}function Uy(n){return["Telemetry",`Battery Voltage: ${n.battery_volts.toFixed(3)}V`,`Uptime: ${oc(n.uptime_seconds)}`,...n.clock_output?[`Clock: ${n.clock_output}`]:[],`TX Airtime: ${oc(n.airtime_seconds)}`,`RX Airtime: ${oc(n.rx_airtime_seconds)}`,"",`Noise Floor: ${n.noise_floor_dbm} dBm`,`Last RSSI: ${n.last_rssi_dbm} dBm`,`Last SNR: ${n.last_snr_db.toFixed(1)} dB`,"",`Packets: ${n.packets_received.toLocaleString()} rx / ${n.packets_sent.toLocaleString()} tx`,`Flood: ${n.recv_flood.toLocaleString()} rx / ${n.sent_flood.toLocaleString()} tx`,`Direct: ${n.recv_direct.toLocaleString()} rx / ${n.sent_direct.toLocaleString()} tx`,`Duplicates: ${n.flood_dups.toLocaleString()} flood / ${n.direct_dups.toLocaleString()} direct`,"",`TX Queue: ${n.tx_queue_len}`,`Debug Flags: ${n.full_events}`].join(`
|
||||
`)}function Zy(n){if(n.length===0)return`Neighbors
|
||||
No neighbors reported`;const s=[...n].sort((l,u)=>u.snr-l.snr),i=[`Neighbors (${s.length})`];for(const l of s){const u=l.name||l.pubkey_prefix,c=l.snr>=0?`+${l.snr.toFixed(1)}`:l.snr.toFixed(1);i.push(`${u}, ${c} dB [${oc(l.last_heard_seconds)} ago]`)}return i.join(`
|
||||
`)}function Wy(n){if(n.length===0)return`ACL
|
||||
No ACL entries`;const s=[`ACL (${n.length})`];for(const i of n){const l=i.name||i.pubkey_prefix;s.push(`${l}: ${i.permission_name}`)}return s.join(`
|
||||
`)}function Ko(n,s,i,l=0){const u=Math.floor(Date.now()/1e3);return{id:-Date.now()-l,type:"PRIV",conversation_key:n,text:s,sender_timestamp:u,received_at:u,paths:null,txt_type:0,signature:null,outgoing:i,acked:1}}function qy(n,s,i){const[l,u]=N.useState(!1),{handleAirtimeCommand:c,stopTracking:h}=Vy(i);N.useEffect(()=>{u(!1),h()},[n==null?void 0:n.id,h]);const d=N.useMemo(()=>{if(!n||n.type!=="contact")return!1;const x=s.find(v=>v.public_key===n.id);return(x==null?void 0:x.type)===ad},[n,s]),g=N.useCallback(async x=>{if(!(!n||n.type!=="contact")&&d)try{const v=await ut.requestTelemetry(n.id,x),C=Ko(n.id,Uy(v),!1,0),P=Ko(n.id,Zy(v.neighbors),!1,1),M=Ko(n.id,Wy(v.acl),!1,2);i(k=>[...k,C,P,M]),u(!0)}catch(v){const C=Ko(n.id,`Telemetry request failed: ${v instanceof Error?v.message:"Unknown error"}`,!1,0);i(P=>[...P,C])}},[n,d,i]),m=N.useCallback(async x=>{if(!n||n.type!=="contact"||!d||!l||await c(x,n.id))return;const C=Ko(n.id,`> ${x}`,!0,0);i(P=>[...P,C]);try{const P=await ut.sendRepeaterCommand(n.id,x),M=Ko(n.id,P.response,!1,1);P.sender_timestamp&&(M.sender_timestamp=P.sender_timestamp),i(k=>[...k,M])}catch(P){const M=Ko(n.id,`Command failed: ${P instanceof Error?P.message:"Unknown error"}`,!1,1);i(k=>[...k,M])}},[n,d,l,i,c]);return{repeaterLoggedIn:l,activeContactIsRepeater:d,handleTelemetryRequest:g,handleRepeaterCommand:m}}const kx="remoteterm-lastMessageTime",Sx="remoteterm-sortOrder";let Qc={};function am(n){Qc={...n}}function lm(){return{...Qc}}function i0(n,s){return Qc[n]=s,{...Qc}}function Hr(n,s){return`${n}-${s}`}function Gy(){try{const n=localStorage.getItem(kx);return n?JSON.parse(n):{}}catch{return{}}}function $y(){try{return localStorage.getItem(Sx)==="alpha"?"alpha":"recent"}catch{return"recent"}}function um(){try{localStorage.removeItem(kx),localStorage.removeItem(Sx)}catch{}}function cm(n,s){if(!s)return!1;const i=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`@\\[${i}\\]`,"i").test(n)}function Ky(n,s,i,l=null){const[u,c]=N.useState({}),[h,d]=N.useState({}),[g,m]=N.useState(lm),x=N.useRef(l);N.useEffect(()=>{x.current=l},[l]);const v=N.useRef(new Set),C=N.useRef(new Set);N.useEffect(()=>{const B=n.filter(T=>!v.current.has(T.key)),b=s.filter(T=>T.public_key&&!C.current.has(T.public_key));if(B.length===0&&b.length===0)return;B.forEach(T=>v.current.add(T.key)),b.forEach(T=>C.current.add(T.public_key)),(async()=>{const T=[...B.map(F=>({type:"CHAN",conversation_key:F.key})),...b.map(F=>({type:"PRIV",conversation_key:F.public_key}))];if(T.length!==0)try{const I={};for(let U=0;U<T.length;U+=200){const K=T.slice(U,U+200),J=await ut.getMessagesBulk(K,H0);Object.assign(I,J)}const j={},O={},G={};for(const U of B){const K=I[`CHAN:${U.key}`]||[];if(K.length>0){const J=Hr("channel",U.key),Y=U.last_read_at||0,ie=K.filter($=>!$.outgoing&&$.received_at>Y);ie.length>0&&(j[J]=ie.length,ie.some($=>cm($.text,x.current))&&(O[J]=!0));const ge=Math.max(...K.map($=>$.received_at));G[J]=ge,i0(J,ge)}}for(const U of b){const K=I[`PRIV:${U.public_key}`]||[];if(K.length>0){const J=Hr("contact",U.public_key),Y=U.last_read_at||0,ie=K.filter($=>!$.outgoing&&$.received_at>Y);ie.length>0&&(j[J]=ie.length,ie.some($=>cm($.text,x.current))&&(O[J]=!0));const ge=Math.max(...K.map($=>$.received_at));G[J]=ge,i0(J,ge)}}Object.keys(j).length>0&&c(U=>({...U,...j})),Object.keys(O).length>0&&d(U=>({...U,...O})),m(lm())}catch(F){console.error("Failed to fetch messages bulk:",F)}})()},[n,s]),N.useEffect(()=>{if(i&&i.type!=="raw"&&i.type!=="map"){const B=Hr(i.type,i.id);c(b=>{if(b[B]){const E={...b};return delete E[B],E}return b}),d(b=>{if(b[B]){const E={...b};return delete E[B],E}return b}),i.type==="channel"?ut.markChannelRead(i.id).catch(b=>{console.error("Failed to mark channel as read on server:",b)}):i.type==="contact"&&ut.markContactRead(i.id).catch(b=>{console.error("Failed to mark contact as read on server:",b)})}},[i]);const P=N.useCallback((B,b)=>{c(E=>({...E,[B]:(E[B]||0)+1})),b&&d(E=>({...E,[B]:!0}))},[]),M=N.useCallback(()=>{c({}),d({}),ut.markAllRead().catch(B=>{console.error("Failed to mark all as read on server:",B)})},[]),k=N.useCallback(B=>{if(B.type==="raw"||B.type==="map")return;const b=Hr(B.type,B.id);c(E=>{if(E[b]){const T={...E};return delete T[b],T}return E}),d(E=>{if(E[b]){const T={...E};return delete T[b],T}return E}),B.type==="channel"?ut.markChannelRead(B.id).catch(E=>{console.error("Failed to mark channel as read on server:",E)}):B.type==="contact"&&ut.markContactRead(B.id).catch(E=>{console.error("Failed to mark contact as read on server:",E)})},[]),w=N.useCallback(B=>{let b=null;if(B.type==="CHAN"&&B.conversation_key?b=Hr("channel",B.conversation_key):B.type==="PRIV"&&B.conversation_key&&(b=Hr("contact",B.conversation_key)),b){const E=B.received_at||Math.floor(Date.now()/1e3),T=i0(b,E);m(T)}},[]);return{unreadCounts:u,mentions:h,lastMessageTimes:g,incrementUnread:P,markAllRead:M,markConversationRead:k,trackNewMessage:w}}var V0=Ex();const Bx=ls(V0);function Qy(n){if(typeof document>"u")return;l
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 E_=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),k_=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(s,i,l)=>l?l.toUpperCase():i.toLowerCase()),hm=n=>{const s=k_(n);return s.charAt(0).toUpperCase()+s.slice(1)},Px=(...n)=>n.filter((s,i,l)=>!!s&&s.trim()!==""&&l.indexOf(s)===i).join(" ").trim(),S_=n=>{for(const s in n)if(s.startsWith("aria-")||s==="role"||s==="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 B_={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 P_=N.forwardRef(({color:n="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:u="",children:c,iconNode:h,...d},g)=>N.createElement("svg",{ref:g,...B_,width:s,height:s,stroke:n,strokeWidth:l?Number(i)*24/Number(s):i,className:Px("lucide",u),...!c&&!S_(d)&&{"aria-hidden":"true"},...d},[...h.map(([m,x])=>N.createElement(m,x)),...Array.isArray(c)?c:[c]]));/**
|
||||
* @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 U0=(n,s)=>{const i=N.forwardRef(({className:l,...u},c)=>N.createElement(P_,{ref:c,iconNode:s,className:Px(`lucide-${E_(hm(n))}`,`lucide-${n}`,l),...u}));return i.displayName=hm(n),i};/**
|
||||
* @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 T_=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],D_=U0("check",T_);/**
|
||||
* @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 R_=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],F_=U0("menu",R_);/**
|
||||
* @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 N_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Tx=U0("x",N_);function L_({health:n,config:s,onSettingsClick:i,onMenuClick:l}){const u=(n==null?void 0:n.radio_connected)??!1,[c,h]=N.useState(!1),d=async()=>{h(!0);try{const g=await ut.reconnectRadio();g.connected&&At.success("Reconnected",{description:g.message})}catch(g){At.error("Reconnection failed",{description:g instanceof Error?g.message:"Check radio connection and power"})}finally{h(!1)}};return _.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[#252525] border-b border-[#333] text-xs",children:[l&&_.jsx("button",{onClick:l,className:"md:hidden p-1 bg-transparent border-none text-[#e0e0e0] cursor-pointer","aria-label":"Open menu",children:_.jsx(F_,{className:"h-5 w-5"})}),_.jsx("h1",{className:"text-base font-semibold mr-auto",children:"RemoteTerm"}),_.jsxs("div",{className:"flex items-center gap-1 text-[#888]",children:[_.jsx("div",{className:`w-2 h-2 rounded-full ${u?"bg-[#4caf50]":"bg-[#666]"}`}),_.jsx("span",{className:"hidden lg:inline text-[#e0e0e0]",children:u?"Connected":"Disconnected"})]}),s&&_.jsxs("div",{className:"hidden lg:flex items-center gap-2 text-[#888]",children:[_.jsx("span",{className:"text-[#e0e0e0]",children:s.name||"Unnamed"}),_.jsx("span",{className:"font-mono text-[#888] cursor-pointer hover:text-[#4a9eff]",onClick:()=>{navigator.clipboard.writeText(s.public_key),At.success("Public key copied!")},title:"Click to copy public key",children:s.public_key.toLowerCase()})]}),!u&&_.jsx("button",{onClick:d,disabled:c,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:c?"Reconnecting...":"Reconnect"}),_.jsxs("button",{onClick:i,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",children:[_.jsx("span",{role:"img","aria-label":"Settings",children:"🔧"})," ","Radio & Config"]})]})}const M_=12;function I_(n){return n.slice(0,M_)}function Ni(n,s){return n||I_(s)}const ia=2,O_={text:"🛜",background:"#444444",textColor:"#ffffff"};function j_(n){let s=0;for(let i=0;i<n.length;i++){const l=n.charCodeAt(i);s=(s<<5)-s+l,s=s&s}return Math.abs(s)}const z_=/[\u{1F1E0}-\u{1F1FF}]{2}|[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{1F600}-\u{1F64F}]|[\u{1F680}-\u{1F6FF}]/u;function H_(n,s){if(!n)return s.slice(0,2).toUpperCase();const i=n.match(z_);if(i)return i[0];const l=n.match(/[a-zA-Z]/g);if(!l||l.length===0)return s.slice(0,2).toUpperCase();const u=n.indexOf(" ");if(u!==-1){const c=l[0],h=n.slice(u+1).match(/[a-zA-Z]/);if(h)return(c+h[0]).toUpperCase()}return l[0].toUpperCase()}function V_(n){const s=j_(n),i=s%360,l=50+(s>>8)%30,u=35+(s>>16)%20,c=`hsl(${i}, ${l}%, ${u}%)`,h=u<45?"#ffffff":"#000000";return{background:c,text:h}}function U_(n,s,i){if(i===ia)return O_;const l=H_(n,s),u=V_(s);return{text:l,background:u.background,textColor:u.text}}function b0({name:n,publicKey:s,size:i=28,contactType:l}){const u=U_(n,s,l);return _.jsx("div",{className:"flex items-center justify-center rounded-full font-semibold flex-shrink-0 select-none",style:{backgroundColor:u.background,color:u.textColor,width:i,height:i,fontSize:i*.45},children:u.text})}const Dx="remoteterm-favorites";function rs(n,s,i){return n.some(l=>l.type===s&&l.id===i)}function Z_(){try{const n=localStorage.getItem(Dx);return n?JSON.parse(n):[]}catch{return[]}}function pm(){try{localStorage.removeItem(Dx)}catch{}}function Rx(n){var s,i,l="";if(typeof n=="string"||typeof n=="number")l+=n;else if(typeof n=="object")if(Array.isArray(n)){var u=n.length;for(s=0;s<u;s++)n[s]&&(i=Rx(n[s]))&&(l&&(l+=" "),l+=i)}else for(i in n)n[i]&&(l&&(l+=" "),l+=i);return l}function Fx(){for(var n,s,i=0,l="",u=arguments.length;i<u;i++)(n=arguments[i])&&(s=Rx(n))&&(l&&(l+=" "),l+=s);return l}const W_=(n,s)=>{const i=new Array(n.length+s.length);for(let l=0;l<n.length;l++)i[l]=n[l];for(let l=0;l<s.length;l++)i[n.length+l]=s[l];return i},q_=(n,s)=>({classGroupId:n,validator:s}),Nx=(n=new Map,s=null,i)=>({nextPart:n,validators:s,classGroupId:i}),Yc="-",mm=[],G_="arbitrary..",$_=n=>{const s=Q_(n),{conflictingClassGroups:i,conflictingClassGroupModifiers:l}=n;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return K_(h);const d=h.split(Yc),g=d[0]===""&&d.length>1?1:0;return Lx(d,g,s)},getConflictingClassGroupIds:(h,d)=>{if(d){const g=l[h],m=i[h];return g?m?W_(m,g):g:m||mm}return i[h]||mm}}},Lx=(n,s,i)=>{if(n.length-s===0)return i.classGroupId;const u=n[s],c=i.nextPart.get(u);if(c){const m=Lx(n,s+1,c);if(m)return m}const h=i.validators;if(h===null)return;const d=s===0?n.join(Yc):n.slice(s).join(Yc),g=h.length;for(let m=0;m<g;m++){const x=h[m];if(x.validator(d))return x.classGroupId}},K_=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=n.slice(1,-1),i=s.indexOf(":"),l=s.slice(0,i);return l?G_+l:void 0})(),Q_=n=>{const{theme:s,classLine truncated
|
||||
.`.concat(Rw,` {
|
||||
overflow: hidden `).concat(l,`;
|
||||
padding-right: `).concat(d,"px ").concat(l,`;
|
||||
}
|
||||
body[`).concat(na,`] {
|
||||
overflow: hidden `).concat(l,`;
|
||||
overscroll-behavior: contain;
|
||||
`).concat([s&&"position: relative ".concat(l,";"),i==="margin"&&`
|
||||
padding-left: `.concat(u,`px;
|
||||
padding-top: `).concat(c,`px;
|
||||
padding-right: `).concat(h,`px;
|
||||
margin-left:0;
|
||||
margin-top:0;
|
||||
margin-right: `).concat(d,"px ").concat(l,`;
|
||||
`),i==="padding"&&"padding-right: ".concat(d,"px ").concat(l,";")].filter(Boolean).join(""),`
|
||||
}
|
||||
|
||||
.`).concat(ac,` {
|
||||
right: `).concat(d,"px ").concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(lc,` {
|
||||
margin-right: `).concat(d,"px ").concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(ac," .").concat(ac,` {
|
||||
right: 0 `).concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(lc," .").concat(lc,` {
|
||||
margin-right: 0 `).concat(l,`;
|
||||
}
|
||||
|
||||
body[`).concat(na,`] {
|
||||
`).concat(Fw,": ").concat(d,`px;
|
||||
}
|
||||
`)},Rm=function(){var n=parseInt(document.body.getAttribute(na)||"0",10);return isFinite(n)?n:0},Xw=function(){N.useEffect(function(){return document.body.setAttribute(na,(Rm()+1).toString()),function(){var n=Rm()-1;n<=0?document.body.removeAttribute(na):document.body.setAttribute(na,n.toString())}},[])},Jw=function(n){var s=n.noRelative,i=n.noImportant,l=n.gapMode,u=l===void 0?"margin":l;Xw();var c=N.useMemo(function(){return Kw(u)},[u]);return N.createElement(Qw,{styles:Yw(c,!s,u,i?"":"!important")})},k0=!1;if(typeof window<"u")try{var Xu=Object.defineProperty({},"passive",{get:function(){return k0=!0,!0}});window.addEventListener("test",Xu,Xu),window.removeEventListener("test",Xu,Xu)}catch{k0=!1}var Xs=k0?{passive:!1}:!1,eb=function(n){return n.tagName==="TEXTAREA"},rv=function(n,s){if(!(n instanceof Element))return!1;var i=window.getComputedStyle(n);return i[s]!=="hidden"&&!(i.overflowY===i.overflowX&&!eb(n)&&i[s]==="visible")},tb=function(n){return rv(n,"overflowY")},nb=function(n){return rv(n,"overflowX")},Fm=function(n,s){var i=s.ownerDocument,l=s;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var u=iv(n,l);if(u){var c=ov(n,l),h=c[1],d=c[2];if(h>d)return!0}l=l.parentNode}while(l&&l!==i.body);return!1},rb=function(n){var s=n.scrollTop,i=n.scrollHeight,l=n.clientHeight;return[s,i,l]},ib=function(n){var s=n.scrollLeft,i=n.scrollWidth,l=n.clientWidth;return[s,i,l]},iv=function(n,s){return n==="v"?tb(s):nb(s)},ov=function(n,s){return n==="v"?rb(s):ib(s)},ob=function(n,s){return n==="h"&&s==="rtl"?-1:1},sb=function(n,s,i,l,u){var c=ob(n,window.getComputedStyle(s).direction),h=c*l,d=i.target,g=s.contains(d),m=!1,x=h>0,v=0,C=0;do{if(!d)break;var P=ov(n,d),M=P[0],k=P[1],w=P[2],B=k-w-c*M;(M||B)&&iv(n,d)&&(v+=B,C+=M);var b=d.parentNode;d=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!g&&d!==document.body||g&&(s.contains(d)||s===d));return(x&&Math.abs(v)<1||!x&&Math.abs(C)<1)&&(m=!0),m},Ju=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},Nm=function(n){return[n.deltaX,n.deltaY]},Lm=function(n){return n&&"current"in n?n.current:n},ab=function(n,s){return n[0]===s[0]&&n[1]===s[1]},lb=function(n){return`
|
||||
.block-interactivity-`.concat(n,` {pointer-events: none;}
|
||||
.allow-interactivity-`).concat(n,` {pointer-events: all;}
|
||||
`)},ub=0,Js=[];function cb(n){var s=N.useRef([]),i=N.useRef([0,0]),l=N.useRef(),u=N.useState(ub++)[0],c=N.useState(nv)[0],h=N.useRef(n);N.useEffect(function(){h.current=n},[n]),N.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(u));var k=Dw([n.lockRef.current],(n.shards||[]).map(Lm),!0).filter(Boolean);return k.forEach(function(w){return w.classList.add("allow-interactivity-".concat(u))}),function(){document.body.classList.remove("block-interactivity-".concat(u)),k.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(u))})}}},[n.inert,n.lockRef.current,n.shards]);var d=N.useCallback(function(k,w){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!h.current.allowPinchZoom;var B=Ju(k),b=i.current,E="deltaX"in k?k.deltaX:b[0]-B[0],T="deltaY"in k?k.deltaY:b[1]-B[1],F,I=k.target,j=Math.abs(E)>Math.abs(T)?"h":"v";if("touches"in k&&j==="h"&&I.type==="range")return!1;var O=window.getSelection(),G=O&&O.anchorNode,U=G?G===I||G.contains(I):!1;if(U)return!1;var K=Fm(j,I);if(!K)return!0;if(K?F=j:(F=j==="v"?"h":"v",K=Fm(j,I)),!K)return!1;if(!l.current&&"changedTouches"in k&&(E||T)&&(l.current=F),!F)return!0;var J=l.current||F;return sb(J,w,k,J==="h"?E:T)},[]),g=N.useCallback(function(k){var w=k;if(!(!Js.length||Js[Js.length-1]!==c)){var B="deltaY"in w?Nm(w):Ju(w),b=s.current.filter(function(F){return F.name===w.type&&(F.target===w.target||w.target===F.shadowParent)&&ab(F.delta,B)})[0];if(b&&b.should){w.cancelable&&w.preventDefault();return}if(!b){var E=(h.current.shards||[]).map(Lm).filter(Boolean).filter(function(F){return F.contains(w.target)}),T=E.length>0?d(w,E[0]):!h.current.noIsolation;T&&w.cancelable&&w.preventDefault()}}},[]),m=N.useCallback(function(k,w,B,b){var E={name:k,delta:w,target:B,should:b,shadowParent:db(B)};s.current.push(E),setTimeout(function(){s.current=s.current.filter(function(T){return T!==E})},1)},[]),x=N.useCallback(function(k){i.current=Ju(k),l.current=void 0},[]),v=N.useCallback(function(k){m(k.type,Nm(k),k.target,d(k,n.lockRef.current))},[]),C=N.useCallback(function(k){m(k.type,Ju(k),k.target,d(k,n.lockRef.current))},[]);N.useEffect(function(){return Js.push(c),n.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:C}),document.addEventListener("wheel",g,Xs),document.addEventListener("touchmove",g,Xs),document.addEventListener("touchstart",x,Xs),function(){Js=Js.filter(function(k){return k!==c}),document.removeEventListener("wheel",g,Xs),document.removeEventListener("touchmove",g,Xs),document.removeEventListener("touchstart",x,Xs)}},[]);var P=n.removeScrollBar,M=n.inert;return N.createElement(N.Fragment,null,M?N.createElement(c,{styles:lb(u)}):null,P?N.createElement(Jw,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function db(n){for(var s=null;n!==null;)n instanceof ShadowRoot&&(s=n.host,n=n.host),n=n.parentNode;return s}const fb=zw(tv,cb);var sv=N.forwardRef(function(n,s){return N.createElement(ud,si({},n,{ref:s,sideCar:fb}))});sv.classNames=ud.classNames;var hb=function(n){if(typeof document>"u")return null;var s=Array.isArray(n)?n[0]:n;return s.ownerDocument.body},ea=new WeakMap,ec=new WeakMap,tc={},h0=0,av=function(n){return n&&(n.host||av(n.parentNode))},pb=function(n,s){return s.map(function(i){if(n.contains(i))return i;var l=av(i);return l&&n.contains(l)?l:(console.error("aria-hidden",i,"in not contained inside",n,". Doing nothing"),null)}).filter(function(i){return!!i})},mb=function(n,s,i,l){var u=pb(s,Array.isArray(n)?n:[n]);tc[i]||(tc[i]=new WeakMap);var c=tc[i],h=[],d=new Set,g=new Set(u),m=function(v){!v||d.has(v)||(d.add(v),m(v.parentNode))};u.forEach(m);var x=function(v){!v||g.has(v)||Array.prototype.forEach.call(v.children,function(C){if(d.has(C))x(C);else try{var P=C.getAttribute(l),M=P!==null&&P!=="false",k=(ea.get(C)||0)+1,w=(c.get(C)||0)+1;ea.set(C,k),c.set(C,w),h.push(C),k===1&&M&&ec.set(C,!0),w===1&&C.setAttribute(i,"true"),M||C.setAttribute(l,"true")}catch(B){console.error("aria-hidden: cannot operate on ",C,B)}})};return x(s),d.clear(),h0++,function(){h.forEach(function(v){var C=ea.get(v)-1,P=c.get(v)-1;ea.set(v,C),c.set(v,P),C||(ec.has(v)||v.removeAttribute(l),ec.delete(v)),P||v.removeAttribute(i)}),h0--,h0||(ea=new WeakMap,ea=new WeakMap,ec=new WeakMap,tc={})}},gb=function(n,s,i){i===void 0&&(i="data-aria-hidden");var l=Array.from(Array.isArray(n)?n:[n]),u=hb(n);return u?(l.push.apply(l,Array.from(u.querySelectorAll("[aria-live], script"))),mb(l,u,i,"aria-hidden")):function(){return null}};function xb(n){const s=vb(n),i=N.forwardRef((l,u)=>{const{children:c,...h}=l,d=N.Children.toArray(c),g=d.find(yb);if(g){const m=g.props.children,x=d.map(v=>v===g?N.Children.count(m)>1?N.Children.only(null):N.isValidElement(m)?m.props.children:null:v);return _.jsx(s,{...h,ref:u,children:N.isValidElement(m)?N.cloneElement(m,void 0,x):null})}return _.jsx(s,{...h,ref:u,children:c})});return i.displayName=`${n}.Slot`,i}function vb(n){const s=N.forwardRef((i,l)=>{const{children:u
Line truncated
|
||||
|
||||
If you want to hide the \`${s.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||||
|
||||
For more information, see https://radix-ui.com/primitives/docs/components/${s.docsSlug}`;return N.useEffect(()=>{n&&(document.getElementById(n)||console.error(i))},[i,n]),null},Db="DialogDescriptionWarning",Rb=({contentRef:n,descriptionId:s})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wv(Db).contentName}}.`;return N.useEffect(()=>{var c;const u=(c=n.current)==null?void 0:c.getAttribute("aria-describedby");s&&u&&(document.getElementById(s)||console.warn(l))},[l,n,s]),null},bv=uv,Cv=fv,dd=hv,fd=pv,hd=gv,pd=vv,Ev=yv;const Q0=bv,Fb=Cv,kv=N.forwardRef(({className:n,...s},i)=>_.jsx(dd,{ref:i,className:pt("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",n),...s}));kv.displayName=dd.displayName;const md=N.forwardRef(({className:n,children:s,...i},l)=>_.jsxs(Fb,{children:[_.jsx(kv,{}),_.jsxs(fd,{ref:l,className:pt("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",n),...i,children:[s,_.jsxs(Ev,{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:[_.jsx(Tx,{className:"h-4 w-4"}),_.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));md.displayName=fd.displayName;const gd=({className:n,...s})=>_.jsx("div",{className:pt("flex flex-col space-y-1.5 text-center sm:text-left",n),...s});gd.displayName="DialogHeader";const Y0=({className:n,...s})=>_.jsx("div",{className:pt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...s});Y0.displayName="DialogFooter";const xd=N.forwardRef(({className:n,...s},i)=>_.jsx(hd,{ref:i,className:pt("text-lg font-semibold leading-none tracking-tight",n),...s}));xd.displayName=hd.displayName;const vd=N.forwardRef(({className:n,...s},i)=>_.jsx(pd,{ref:i,className:pt("text-sm text-muted-foreground",n),...s}));vd.displayName=pd.displayName;function Nb(){const n=window.location.hash.slice(1);if(!n)return null;if(n==="raw")return{type:"raw",name:"raw"};if(n==="map")return{type:"map",name:"map"};if(n==="visualizer")return{type:"visualizer",name:"visualizer"};if(n.startsWith("map/focus/")){const u=n.slice(10);return u?{type:"map",name:"map",mapFocusKey:decodeURIComponent(u)}:{type:"map",name:"map"}}const s=n.indexOf("/");if(s===-1)return null;const i=n.slice(0,s),l=decodeURIComponent(n.slice(s+1));return(i==="channel"||i==="contact")&&l?{type:i,name:l}:null}function Sv(n){return`#map/focus/${encodeURIComponent(n)}`}function Lb(n){if(!n)return"";if(n.type==="raw")return"#raw";if(n.type==="map")return"#map";if(n.type==="visualizer")return"#visualizer";const s=n.type==="channel"&&n.name.startsWith("#")?n.name.slice(1):n.name;return`#${n.type}/${encodeURIComponent(s)}`}function Mb(n){const s=Lb(n);s!==window.location.hash&&window.history.replaceState(null,"",s||window.location.pathname)}function Ib({open:n,onClose:s,paths:i,senderInfo:l,contacts:u,config:c}){const h=i.map(g=>({...g,resolved:$1(g.path,l,u,c)})),d=i.length===1;return _.jsx(Q0,{open:n,onOpenChange:g=>!g&&s(),children:_.jsxs(md,{className:"max-w-md max-h-[80vh] flex flex-col",children:[_.jsxs(gd,{children:[_.jsxs(xd,{children:["Message Path",!d&&`s (${i.length})`]}),_.jsx(vd,{children:d?_.jsxs(_.Fragment,{children:["This shows ",_.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."]}):_.jsxs(_.Fragment,{children:["This message was received via ",_.jsxs("strong",{children:[i.length," different routes"]}),". Routers may be incorrectly identified due to prefix collisions."]})})]}),_.jsxs("div",{className:"flex-1 overflow-y-auto py-2 space-y-4",children:[h.map((g,m)=>_.jsxs("div",{children:[!d&&_.jsxs("div",{className:"text-xs text-muted-foreground font-medium mb-2 pb-1 border-b border-border",children:["Path ",m+1," — received ",oa(g.received_at)]}),_.jsx(Ob,{resolved:g.resolved,senderInfo:l,hideStraightLine:!d})]},m)),!d&&h.length>0&&(()=>{const g=h[0].resolved;return Lt(g.sender.lat,g.sender.lon)&&Lt(g.receiver.lat,g.receiver.lon)?_.jsxs("div",{className:"pt-3 mt-1 border-t border-border",children:[_.jsx("span",{className:"text-sm text-muted-foreground",children:"Straight-line distance: "}),_.jsx("span",{className:"text-sm font-medium",c
Line truncated
|
||||
`).map((Q,ae,ce)=>_.jsxs("span",{children:[Hb(Q,d),ae<ce.length-1&&_.jsx("br",{})]},ae)),!te&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:oa(O.sender_timestamp||O.received_at)}),!O.outgoing&&O.paths&&O.paths.length>0&&_.jsx(Im,{paths:O.paths,variant:"inline",onClick:()=>k({paths:O.paths,senderInfo:F(O,U,J)})})]}),O.outgoing&&(O.acked>0?` ✓${O.acked>1?O.acked:""}`:" ?")]})]})]},O.id)})]}),C&&_.jsx("button",{onClick:b,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:_.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:_.jsx("polyline",{points:"6 9 12 15 18 9"})})}),M&&_.jsx(Ib,{open:!0,onClose:()=>k(null),paths:M.paths,senderInfo:M.senderInfo,contacts:s,config:g??null})]})}const Om=156,Ub=140,Zb=156,Wb=120,qb=8,Gb=N.forwardRef(function({onSend:s,disabled:i,placeholder:l,isRepeaterMode:u,conversationType:c,senderName:h},d){const[g,m]=N.useState(""),[x,v]=N.useState(!1),C=N.useRef(null);N.useImperativeHandle(d,()=>({appendText:F=>{var I;m(j=>j+F),(I=C.current)==null||I.focus()}}));const P=N.useMemo(()=>{if(c==="contact")return{warningAt:Ub,dangerAt:Om,hardLimit:Om};if(c==="channel"){const F=(h==null?void 0:h.length)??10,I=Math.max(1,Zb-F-2);return{warningAt:Wb,dangerAt:Math.max(1,I-qb),hardLimit:I}}return null},[c,h]),{limitState:M,warningMessage:k}=N.useMemo(()=>{if(!P)return{limitState:"normal",warningMessage:null};const F=g.length;return F>=P.hardLimit?{limitState:"error",warningMessage:"likely truncated by radio"}:F>=P.dangerAt?{limitState:"danger",warningMessage:"may impact multi-repeater hop delivery"}:F>=P.warningAt?{limitState:"warning",warningMessage:"may impact multi-repeater hop delivery"}:{limitState:"normal",warningMessage:null}},[g.length,P]),w=P?P.hardLimit-g.length:0,B=N.useCallback(async F=>{F.preventDefault();const I=g.trim();if(u){if(x||i)return;v(!0);try{await s(I),m("")}catch(j){console.error("Failed to request telemetry:",j),At.error("Failed to request telemetry",{description:j instanceof Error?j.message:"Check radio connection"});return}finally{v(!1)}setTimeout(()=>{var j;return(j=C.current)==null?void 0:j.focus()},0)}else{if(!I||x||i)return;v(!0);try{await s(I),m("")}catch(j){console.error("Failed to send message:",j),At.error("Failed to send message",{description:j instanceof Error?j.message:"Check radio connection"});return}finally{v(!1)}setTimeout(()=>{var j;return(j=C.current)==null?void 0:j.focus()},0)}},[g,x,i,s,u]),b=N.useCallback(F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),B(F))},[B]),E=u?!0:g.trim().length>0,T=!u&&P!==null;return _.jsxs("form",{className:"px-4 py-3 border-t border-border flex flex-col gap-1",onSubmit:B,children:[_.jsxs("div",{className:"flex gap-2",children:[_.jsx(on,{ref:C,type:u?"password":"text",autoComplete:u?"off":void 0,value:g,onChange:F=>m(F.target.value),onKeyDown:b,placeholder:l||(u?"Enter password for admin login...":"Type a message..."),disabled:i||x,className:"flex-1 min-w-0"}),_.jsx(mn,{type:"submit",disabled:i||x||!E,className:"flex-shrink-0",children:x?u?"Logging in...":"Sending...":u?g.trim()?"Log in with password":"Log in as guest/use repeater ACLs":"Send"})]}),T&&_.jsxs("div",{className:"flex items-center justify-end gap-2 text-xs",children:[_.jsxs("span",{className:pt("tabular-nums",M==="error"||M==="danger"?"text-red-500 font-medium":M==="warning"?"text-yellow-500":"text-muted-foreground"),children:[g.length,"/",P.hardLimit,w<0&&` (${w})`]}),k&&_.jsxs("span",{className:pt(M==="error"?"text-red-500":"text-yellow-500"),children:["— ",k]})]})]})});function jm(n){const s=$b(n),i=N.forwardRef((l,u)=>{const{children:c,...h}=l,d=N.Children.toArray(c),g=d.find(Qb);if(g){const m=g.props.children,x=d.map(v=>v===g?N.Children.count(m)>1?N.Children.only(null):N.isValidElement(m)?m.props.children:null:v);return _.jsx(s,{...h,ref:u,children:N.isValidElement(m)?N.cloneElement(m,void 0,x):null})}return _.jsx(s,{...h,ref:u,children:c})});return i.displayName=`${n}.Slot`,i}function $b(n){const s=N.forwardRef((i,l)=>{const{children:u,...c}=i;if(N.isValidElement(u)){const h=Xb(u),d=Yb(c,u.props);return u.type!==N.Fragment&&(d.ref=l?Sl(l,h):h),N.cloneElement(u,d)}return N.Children.count(u)>1?N.Children.only(null):null});return s.displayName=`${n}.SlotClone`,s}var Kb=Symbol("radix.slottable");function Qb(n){return N.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Kb}function Yb(n,s){const i={...s};for(const l in s){const u=n[l],c=s[l];/^on[A-Z]/.test(l)?u&&c?i[l]=(...d)=>{const g=c(...d);return u(...d),g}:u&&(i[l]=u):l==="style"?i[l]={...u,...c}:l==="className"&&(i[l]=[u,c].filter(Boolean).join(" "))}return{...n,...i}}function
Line truncated
|
||||
/**
|
||||
* Reset the text fill color so that placeholder is visible
|
||||
*/
|
||||
.`.concat(B,`:empty {
|
||||
-webkit-text-fill-color: inherit !important;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hack to apply on some CSS on IE10 and IE11
|
||||
*/
|
||||
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
||||
/**
|
||||
* IE doesn't support '-webkit-text-fill-color'
|
||||
* So we use 'color: transparent' to make the text transparent on IE
|
||||
* Unlike other browsers, it doesn't affect caret color in IE
|
||||
*/
|
||||
.`).concat(B,` {
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
.`).concat(B,`::selection {
|
||||
background-color: #accef7 !important;
|
||||
color: transparent !important;
|
||||
}
|
||||
}
|
||||
`),E=c.forwardRef(function(I,j){var O=I.autoFocus,G=I.disabled,U=I.form,K=I.highlight,J=I.ignoreTabKey,Y=J===void 0?!1:J,ie=I.insertSpaces,ge=ie===void 0?!0:ie,$=I.maxLength,se=I.minLength,W=I.name,te=I.onBlur,Z=I.onClick,D=I.onFocus,H=I.onKeyDown,q=I.onKeyUp,Q=I.onValueChange,ae=I.padding,ce=ae===void 0?0:ae,Ae=I.placeholder,pe=I.preClassName,xe=I.readOnly,Be=I.required,Oe=I.style,Xe=I.tabSize,Ee=Xe===void 0?2:Xe,je=I.textareaClassName,at=I.textareaId,mt=I.value,ot=u(I,["autoFocus","disabled","form","highlight","ignoreTabKey","insertSpaces","maxLength","minLength","name","onBlur","onClick","onFocus","onKeyDown","onKeyUp","onValueChange","padding","placeholder","preClassName","readOnly","required","style","tabSize","textareaClassName","textareaId","value"]),qe=c.useRef({stack:[],offset:-1}),Ke=c.useRef(null),Qe=c.useState(!0),rt=Qe[0],He=Qe[1],Et={paddingTop:typeof ce=="object"?ce.top:ce,paddingRight:typeof ce=="object"?ce.right:ce,paddingBottom:typeof ce=="object"?ce.bottom:ce,paddingLeft:typeof ce=="object"?ce.left:ce},zt=K(mt),Qt=function(_e,fe){return _e.substring(0,fe).split(`
|
||||
`)},Dt=c.useCallback(function(_e,fe){var ve,we,Ge;fe===void 0&&(fe=!1);var re=qe.current,ye=re.stack,Ce=re.offset;if(ye.length&&Ce>-1){qe.current.stack=ye.slice(0,Ce+1);var Ne=qe.current.stack.length;if(Ne>P){var Je=Ne-P;qe.current.stack=ye.slice(Je,Ne),qe.current.offset=Math.max(qe.current.offset-Je,0)}}var Fe=Date.now();if(fe){var ft=qe.current.stack[qe.current.offset];if(ft&&Fe-ft.timestamp<M){var St=/[^a-z0-9]([a-z0-9]+)$/i,xt=(ve=Qt(ft.value,ft.selectionStart).pop())===null||ve===void 0?void 0:ve.match(St),an=(we=Qt(_e.value,_e.selectionStart).pop())===null||we===void 0?void 0:we.match(St);if(xt!=null&&xt[1]&&(!((Ge=an==null?void 0:an[1])===null||Ge===void 0)&&Ge.startsWith(xt[1]))){qe.current.stack[qe.current.offset]=n(n({},_e),{timestamp:Fe});return}}}qe.current.stack.push(n(n({},_e),{timestamp:Fe})),qe.current.offset++},[]),Gt=c.useCallback(function(){var _e=Ke.current;if(_e){var fe=_e.value,ve=_e.selectionStart,we=_e.selectionEnd;Dt({value:fe,selectionStart:ve,selectionEnd:we})}},[Dt]),Yt=function(_e){var fe=Ke.current;fe&&(fe.value=_e.value,fe.selectionStart=_e.selectionStart,fe.selectionEnd=_e.selectionEnd,Q==null||Q(_e.value))},$t=function(_e){var fe=Ke.current,ve=qe.current.stack[qe.current.offset];ve&&fe&&(qe.current.stack[qe.current.offset]=n(n({},ve),{selectionStart:fe.selectionStart,selectionEnd:fe.selectionEnd})),Dt(_e),Yt(_e)},Ht=function(){var _e=qe.current,fe=_e.stack,ve=_e.offset,we=fe[ve-1];we&&(Yt(we),qe.current.offset=Math.max(ve-1,0))},Rt=function(){var _e=qe.current,fe=_e.stack,ve=_e.offset,we=fe[ve+1];we&&(Yt(we),qe.current.offset=Math.min(ve+1,fe.length-1))},Vt=function(_e){if(!(H&&(H(_e),_e.defaultPrevented))){_e.key==="Escape"&&_e.currentTarget.blur();var fe=_e.currentTarget,ve=fe.value,we=fe.selectionStart,Ge=fe.selectionEnd,re=(ge?" ":" ").repeat(Ee);if(_e.key==="Tab"&&!Y&&rt)if(_e.preventDefault(),_e.shiftKey){var ye=Qt(ve,we),Ce=ye.length-1,Ne=Qt(ve,Ge).length-1,Je=ve.split(`
|
||||
`).map(function(Mt,Le){return Le>=Ce&&Le<=Ne&&Mt.startsWith(re)?Mt.substring(re.length):Mt}).join(`
|
||||
`);if(ve!==Je){var Fe=ye[Ce];$t({value:Je,selectionStart:Fe!=null&&Fe.startsWith(re)?we-re.length:we,selectionEnd:Ge-(ve.length-Je.length)})}}else if(we!==Ge){var ye=Qt(ve,we),ft=ye.length-1,St=Qt(ve,Ge).length-1,Fe=ye[ft];$t({value:ve.split(`
|
||||
`).map(function(Br,li){return li>=ft&&li<=St?re+Br:Br}).join(`
|
||||
`),selectionStart:Fe&&/\S/.test(Fe)?we+re.length:we,selectionEnd:Ge+re.length*(St-ft+1)})}else{var xt=we+re.length;$t({value:ve.substring(0,we)+re+ve.substring(Ge),selectionStart:xt,selectionEnd:xt})}else if(_e.key==="Backspace"){var an=we!==Ge,dt=ve.substring(0,we);if(dt.endsWith(re)&&!an){_e.preventDefault();var xt=we-re.length;$t({value:ve.substring(0,we-re.length)+ve.substring(Ge),selectionStart:xt,selectionEnd:xt})}}else if(_e.key==="Enter"){if(we===Ge){var Pt=Qt(ve,we).pop(),vn=Pt==null?void 0:Pt.match(/^\s+/);if(vn!=null&&vn[0]){_e.preventDefault();var wt=`
|
||||
`+vn[0],xt=we+wt.length;$t({value:ve.substring(0,we)+wt+ve.substring(Ge),selectionStart:xt,selectionEnd:xt})}}}else if(_e.keyCode===m||_e.keyCode===x||_e.keyCode===v||_e.keyCode===C){var kt=void 0;_e.keyCode===m&&_e.shiftKey?kt=["(",")"]:_e.keyCode===x?_e.shiftKey?kt=["{","}"]:kt=["[","]"]:_e.keyCode===v?_e.shiftKey?kt=['"','"']:kt=["'","'"]:_e.keyCode===C&&!_e.shiftKey&&(kt=["`","`"]),we!==Ge&&kt&&(_e.preventDefault(),$t({value:ve.substring(0,we)+kt[0]+ve.substring(we,Ge)+kt[1]+ve.substring(Ge),selectionStart:we,selectionEnd:Ge+2}))}else(w?_e.metaKey&&_e.keyCode===d:_e.ctrlKey&&_e.keyCode===d)&&!_e.shiftKey&&!_e.altKey?(_e.preventDefault(),Ht()):(w?_e.metaKey&&_e.keyCode===d&&_e.shiftKey:k?_e.ctrlKey&&_e.keyCode===h:_e.ctrlKey&&_e.keyCode===d&&_e.shiftKey)&&!_e.altKey?(_e.preventDefault(),Rt()):_e.keyCode===g&&_e.ctrlKey&&(!w||_e.shiftKey)&&(_e.preventDefault(),He(function(Mt){return!Mt}))}},Pe=function(_e){var fe=_e.currentTarget,ve=fe.value,we=fe.selectionStart,Ge=fe.selectionEnd;Dt({value:ve,selectionStart:we,selectionEnd:Ge},!0),Q(ve)};return c.useEffect(function(){Gt()},[Gt]),c.useImperativeHandle(j,function(){return{get session(){return{history:qe.current}},set session(_e){qe.current=_e.history}}},[]),c.createElement("div",n({},ot,{style:n(n({},T.container),Oe)}),c.createElement("pre",n({className:pe,"aria-hidden":"true",style:n(n(n({},T.editor),T.highlight),Et)},typeof zt=="string"?{dangerouslySetInnerHTML:{__html:zt+"<br />"}}:{children:zt})),c.createElement("textarea",{ref:function(_e){return Ke.current=_e},style:n(n(n({},T.editor),T.textarea),Et),className:B+(je?" ".concat(je):""),id:at,value:mt,onChange:Pe,onKeyDown:Vt,onClick:Z,onKeyUp:q,onFocus:D,onBlur:te,disabled:G,form:U,maxLength:$,minLength:se,name:W,placeholder:Ae,readOnly:xe,required:Be,autoFocus:O,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-gramm":!1}),c.createElement("style",{dangerouslySetInnerHTML:{__html:b}}))}),T={container:{position:"relative",textAlign:"left",boxSizing:"border-box",padding:0,overflow:"hidden"},textarea:{position:"absolute",top:0,left:0,height:"100%",width:"100%",resize:"none",color:"inherit",overflow:"hidden",MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",WebkitTextFillColor:"transparent"},highlight:{position:"relative",pointerEvents:"none"},editor:{margin:0,border:0,background:"none",boxSizing:"inherit",display:"inherit",fontFamily:"inherit",fontSize:"inherit",fontStyle:"inherit",fontVariantLigatures:"inherit",fontWeight:"inherit",letterSpacing:"inherit",lineHeight:"inherit",tabSize:"inherit",textIndent:"inherit",textRendering:"inherit",textTransform:"inherit",whiteSpace:"pre-wrap",wordBreak:"keep-all",overflowWrap:"break-word"}};return Xn.default=E,Xn}var B2=S2();const P2=ls(B2);var m0={exports:{}},Hm;function T2(){return Hm||(Hm=1,(function(n){var s=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
||||
* Prism: Lightweight, robust, elegant syntax highlighting
|
||||
*
|
||||
* @license MIT <https://opensource.org/licenses/MIT>
|
||||
* @author Lea Verou <https://lea.verou.me>
|
||||
* @namespace
|
||||
* @public
|
||||
*/var i=(function(l){var u=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,c=0,h={},d={manual:l.Prism&&l.Prism.manual,disableWorkerMessageHandler:l.Prism&&l.Prism.disableWorkerMessageHandler,util:{encode:function b(E){return E instanceof g?new g(E.type,b(E.content),E.alias):Array.isArray(E)?E.map(b):E.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(b){return Object.prototype.toString.call(b).slice(8,-1)},objId:function(b){return b.__id||Object.defineProperty(b,"__id",{value:++c}),b.__id},clone:function b(E,T){T=T||{};var F,I;switch(d.util.type(E)){case"Object":if(I=d.util.objId(E),T[I])return T[I];F={},T[I]=F;for(var j in E)E.hasOwnProperty(j)&&(F[j]=b(E[j],T));return F;case"Array":return I=d.util.objId(E),T[I]?T[I]:(F=[],T[I]=F,E.forEach(function(O,G){F[G]=b(O,T)}),F);default:return E}},getLanguage:function(b){for(;b;){var E=u.exec(b.className);if(E)return E[1].toLowerCase();b=b.parentElement}return"none"},setLanguage:function(b,E){b.className=b.className.replace(RegExp(u,"gi"),""),b.classList.add("language-"+E)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(F){var b=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(F.stack)||[])[1];if(b){var E=document.getElementsByTagName("script");for(var T in E)if(E[T].src==b)return E[T]}return null}},isActive:function(b,E,T){for(var F="no-"+E;b;){var I=b.classList;if(I.contains(E))return!0;if(I.contains(F))return!1;b=b.parentElement}return!!T}},languages:{plain:h,plaintext:h,text:h,txt:h,extend:function(b,E){var T=d.util.clone(d.languages[b]);for(var F in E)T[F]=E[F];return T},insertBefore:function(b,E,T,F){F=F||d.languages;var I=F[b],j={};for(var O in I)if(I.hasOwnProperty(O)){if(O==E)for(var G in T)T.hasOwnProperty(G)&&(j[G]=T[G]);T.hasOwnProperty(O)||(j[O]=I[O])}var U=F[b];return F[b]=j,d.languages.DFS(d.languages,function(K,J){J===U&&K!=b&&(this[K]=j)}),j},DFS:function b(E,T,F,I){I=I||{};var j=d.util.objId;for(var O in E)if(E.hasOwnProperty(O)){T.call(E,O,E[O],F||O);var G=E[O],U=d.util.type(G);U==="Object"&&!I[j(G)]?(I[j(G)]=!0,b(G,T,null,I)):U==="Array"&&!I[j(G)]&&(I[j(G)]=!0,b(G,T,O,I))}}},plugins:{},highlightAll:function(b,E){d.highlightAllUnder(document,b,E)},highlightAllUnder:function(b,E,T){var F={callback:T,container:b,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};d.hooks.run("before-highlightall",F),F.elements=Array.prototype.slice.apply(F.container.querySelectorAll(F.selector)),d.hooks.run("before-all-elements-highlight",F);for(var I=0,j;j=F.elements[I++];)d.highlightElement(j,E===!0,F.callback)},highlightElement:function(b,E,T){var F=d.util.getLanguage(b),I=d.languages[F];d.util.setLanguage(b,F);var j=b.parentElement;j&&j.nodeName.toLowerCase()==="pre"&&d.util.setLanguage(j,F);var O=b.textContent,G={element:b,language:F,grammar:I,code:O};function U(J){G.highlightedCode=J,d.hooks.run("before-insert",G),G.element.innerHTML=G.highlightedCode,d.hooks.run("after-highlight",G),d.hooks.run("complete",G),T&&T.call(G.element)}if(d.hooks.run("before-sanity-check",G),j=G.element.parentElement,j&&j.nodeName.toLowerCase()==="pre"&&!j.hasAttribute("tabindex")&&j.setAttribute("tabindex","0"),!G.code){d.hooks.run("complete",G),T&&T.call(G.element);return}if(d.hooks.run("before-highlight",G),!G.grammar){U(d.util.encode(G.code));return}if(E&&l.Worker){var K=new Worker(d.filename);K.onmessage=function(J){U(J.data)},K.postMessage(JSON.stringify({language:G.language,code:G.code,immediateClose:!0}))}else U(d.highlight(G.code,G.grammar,G.language))},highlight:function(b,E,T){var F={code:b,grammar:E,language:T};if(d.hooks.run("before-tokenize",F),!F.grammar)throw new Error('The language "'+F.language+'" has no grammar.');return F.tokens=d.tokenize(F.code,F.grammar),d.hooks.run("after-tokenize",F),g.stringify(d.util.encode(F.tokens),F.language)},tokenize:function(b,E){var T=E.rest;if(T){for(var F in T)E[F]=T[F];delete E.rest}var I=new v;return C(I,I.head,b),x(b,I,E,I.head,0),M(I)},hooks:{all:{},add:function(b,E){var T=d.hooks.all;T[b]=T[b]||[],T[b].push(E)},run:function(b,E){var T=d.hooks.all[b];if(!(!T||!T.length))for(var F=0,I;I=T[F++];)I(E)}},Token:g};l.Prism=d;function g(b,E,T,F){this.type=b,this.content=E,this.alias=T,this.length=(F||"").length|0}g.stringify=function b(E,T){if(typeof E=="string")return E;if(Array.isArray(E)){var F="";return E.forEach(function(U){F+=b(U,T)}),F}var I={type:E.type,content:b(E.content,T),tag:"span",classes:["token",E.type],attributes:{},language:T},j=E.alias;j&&(Array.isArray(j)?Array.prototype.push.apply(I.classes,j):I.classes.push(j)),d.hooks.run("wrap",I);var O="";for(var G in I.attributes)O+=" "+G+'="'+(I.attributes[G]||"").replace(/"/g,""")+'"';return"<"+I.tag+' class="'+I.classes.join(" ")+'"'+O+">"+I.content+"</"+I.tag+">"};function m(b,E,T,F){b.lastIndex=E;var I=b.exec(T);if(I&&F&&I[1]){var j=I[1].length;I.indexLine truncated
|
||||
`),w.hasAttribute("data-start")||w.setAttribute("data-start",String(G+1))}B.textContent=I,i.highlightElement(B)},function(I){w.setAttribute(d,x),B.textContent=I})}}),i.plugins.fileHighlight={highlight:function(w){for(var B=(w||document).querySelectorAll(v),b=0,E;E=B[b++];)i.highlightElement(E)}};var M=!1;i.fileHighlight=function(){M||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),M=!0),i.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(m0)),m0.exports}var Vm=T2(),Um={},Zm;function D2(){return Zm||(Zm=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),Um}D2();var R2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],F2=R2.reduce((n,s)=>{const i=W0(`Primitive.${s}`),l=N.forwardRef((u,c)=>{const{asChild:h,...d}=u,g=h?i:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),_.jsx(g,{...d,ref:c})});return l.displayName=`Primitive.${s}`,{...n,[s]:l}},{}),N2="Separator",Wm="horizontal",L2=["horizontal","vertical"],rA=N.forwardRef((n,s)=>{const{decorative:i,orientation:l=Wm,...u}=n,c=M2(l)?l:Wm,d=i?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return _.jsx(F2.div,{"data-orientation":c,...d,...u,ref:s})});rA.displayName=N2;function M2(n){return L2.includes(n)}var iA=rA;const vo=N.forwardRef(({className:n,orientation:s="horizontal",decorative:i=!0,...l},u)=>_.jsx(iA,{ref:u,decorative:i,orientation:s,className:pt("shrink-0 bg-border",s==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...l}));vo.displayName=iA.displayName;const g0=[{name:"USA/Canada",freq:910.525,bw:62.5,sf:7,cr:5},{name:"Australia",freq:915.8,bw:250,sf:10,cr:5},{name:"Australia (narrow)",freq:916.575,bw:62.5,sf:7,cr:8},{name:"Australia SA, WA",freq:923.125,bw:62.5,sf:8,cr:8},{name:"Australia QLD",freq:923.125,bw:62.5,sf:8,cr:5},{name:"New Zealand",freq:917.375,bw:250,sf:11,cr:5},{name:"New Zealand (narrow)",freq:917.375,bw:62.5,sf:7,cr:5},{name:"EU/UK/Switzerland Long Range",freq:869.525,bw:250,sf:11,cr:5},{name:"EU/UK/Switzerland Medium Range",freq:869.525,bw:250,sf:10,cr:5},{name:"EU/UK/Switzerland Narrow",freq:869.618,bw:62.5,sf:8,cr:8},{name:"Czech Republic (Narrow)",freq:869.432,bw:62.5,sf:7,cr:5},{name:"EU 433MHz Long Range",freq:433.65,bw:250,sf:11,cr:5},{name:"Portugal 433MHz",freq:433.375,bw:62.5,sf:9,cr:6},{name:"Portugal 868MHz",freq:869.618,bw:62.5,sf:7,cr:6},{name:"Vietnam",freq:920.25,bw:250,sf:11,cr:5}];function I2({open:n,config:s,health:i,appSettings:l,onClose:u,onSave:c,onSaveAppSettings:h,onSetPrivateKey:d,onReboot:g,onAdvertise:m,onHealthRefresh:x,onRefreshAppSettings:v}){const[C,P]=N.useState("radio"),[M,k]=N.useState(""),[w,B]=N.useState(""),[b,E]=N.useState(""),[T,F]=N.useState(""),[I,j]=N.useState(""),[O,G]=N.useState(""),[U,K]=N.useState(""),[J,Y]=N.useState(""),[ie,ge]=N.useState(""),[$,se]=N.useState(""),[W,te]=N.useState(!1),[Z,D]=N.
Line truncated
|
||||
sender_name: str | None,
|
||||
sender_key: str | None,
|
||||
message_text: str,
|
||||
is_dm: bool,
|
||||
channel_key: str | None,
|
||||
channel_name: str | None,
|
||||
sender_timestamp: int | None,
|
||||
path: str | None,
|
||||
) -> str | list[str] | None:
|
||||
"""
|
||||
Process incoming messages and optionally return a reply.
|
||||
|
||||
Args:
|
||||
sender_name: Display name of sender (may be None)
|
||||
sender_key: 64-char hex public key (None for channel msgs)
|
||||
message_text: The message content
|
||||
is_dm: True for direct messages, False for channel
|
||||
channel_key: 32-char hex key for channels, None for DMs
|
||||
channel_name: Channel name with hash (e.g. "#bot"), None for DMs
|
||||
sender_timestamp: Sender's timestamp (unix seconds, may be None)
|
||||
path: Hex-encoded routing path (may be None)
|
||||
|
||||
Returns:
|
||||
None for no reply, a string for a single reply,
|
||||
or a list of strings to send multiple messages in order
|
||||
"""
|
||||
# Example: Only respond in #bot channel to "!pling" command
|
||||
if channel_name == "#bot" and "!pling" in message_text.lower():
|
||||
return "[BOT] Plong!"
|
||||
return None`,[ot,qe]=N.useState(!1),[Ke,Qe]=N.useState(mt);N.useEffect(()=>{s&&(k(s.name),B(String(s.lat)),E(String(s.lon)),F(String(s.tx_power)),j(String(s.radio.freq)),G(String(s.radio.bw)),K(String(s.radio.sf)),Y(String(s.radio.cr)))},[s]),N.useEffect(()=>{l&&(se(String(l.max_radio_contacts)),Ee(l.auto_decrypt_dm_on_advert),at(String(l.advert_interval)),qe(l.bot_enabled),l.bot_code&&Qe(l.bot_code))},[l]),N.useEffect(()=>{n&&v()},[n,v]);const rt=N.useMemo(()=>{const Pe=parseFloat(I),_e=parseFloat(O),fe=parseInt(U,10),ve=parseInt(J,10);for(const we of g0)if(we.freq===Pe&&we.bw===_e&&we.sf===fe&&we.cr===ve)return we.name;return"custom"},[I,O,U,J]),He=Pe=>{if(Pe==="custom")return;const _e=g0.find(fe=>fe.name===Pe);_e&&(j(String(_e.freq)),G(String(_e.bw)),K(String(_e.sf)),Y(String(_e.cr)))},Et=()=>{if(!navigator.geolocation){At.error("Geolocation not supported",{description:"Your browser does not support geolocation"});return}ae(!0),navigator.geolocation.getCurrentPosition(Pe=>{B(Pe.coords.latitude.toFixed(6)),E(Pe.coords.longitude.toFixed(6)),ae(!1),At.success("Location updated")},Pe=>{ae(!1),At.error("Failed to get location",{description:Pe.message})},{enableHighAccuracy:!0,timeout:1e4})},zt=async()=>{Ae(""),te(!0);try{const Pe={lat:parseFloat(w),lon:parseFloat(b),tx_power:parseInt(T,10),radio:{freq:parseFloat(I),bw:parseFloat(O),sf:parseInt(U,10),cr:parseInt(J,10)}};await c(Pe),At.success("Radio config saved, rebooting..."),te(!1),D(!0),await g(),u()}catch(Pe){Ae(Pe instanceof Error?Pe.message:"Failed to save"),te(!1)}finally{D(!1)}},Qt=async()=>{Ae(""),te(!0);try{await c({name:M});const _e=parseInt(je,10);!isNaN(_e)&&_e!==(l==null?void 0:l.advert_interval)&&await h({advert_interval:_e}),At.success("Identity settings saved")}catch(Pe){Ae(Pe instanceof Error?Pe.message:"Failed to save")}finally{te(!1)}},Dt=async()=>{Ae(""),te(!0);try{const Pe=parseInt($,10);!isNaN(Pe)&&Pe!==(l==null?void 0:l.max_radio_contacts)&&await h({max_radio_contacts:Pe}),At.success("Serial settings saved")}catch(Pe){Ae(Pe instanceof Error?Pe.message:"Failed to save")}finally{te(!1)}},Gt=async()=>{if(!ie.trim()){Ae("Private key is required");return}Ae(""),te(!0);try{await d(ie.trim()),ge(""),At.success("Private key set, rebooting..."),te(!1),D(!0),await g(),u()}catch(Pe){Ae(Pe instanceof Error?Pe.message:"Failed to set private key"),te(!1)}finally{D(!1)}},Yt=async()=>{if(confirm("Are you sure you want to reboot the radio? The connection will drop temporarily.")){Ae(""),D(!0);try{await g(),u()}catch(Pe){Ae(Pe instanceof Error?Pe.message:"Failed to reboot radio")}finally{D(!1)}}},$t=async()=>{q(!0);try{await m()}finally{q(!1)}},Ht=async()=>{const Pe=parseInt(pe,10);if(isNaN(Pe)||Pe<1){At.error("Invalid retention days",{description:"Retention days must be at least 1"});return}Oe(!0);try{const _e=await ut.runMaintenance(Pe);At.success("Database cleanup complete",{description:`Deleted ${_e.packets_deleted} old packet${_e.packets_deleted===1?"":"s"}`}),await x()}catch(_e){console.error("Failed to run maintenance:",_e),At.error("Database cleanup failed",{description:_e instanceof Error?_e.message:"Unknown error"})}finally{Oe(!1)}},Rt=async()=>{te(!0),Ae("");try{await h({auto_decrypt_dm_on_advert:Xe}),At.success("Database settings saved")}catch(Pe){console.error("Failed to save database settings:",Pe),Ae(Pe instanceof Error?Pe.message:"Failed to save"),At.error("Failed to save settings")}finally{te(!1)}},Vt=async()=>{te(!0),Ae("");try{await h({bot_enabled:ot,bot_code:Ke}),At.success("Bot settings saved")}catch(Pe){console.error("Failed to save bot settings:",Pe),Ae(Pe instanceof Error?Pe.message:"Failed to save"),At.error("Failed to save settings")}finally{te(!1)}};return _.jsx(Q0,{open:n,onOpenChange:Pe=>!Pe&&u(),children:_.jsxs(md,{className:"sm:max-w-[50vw] sm:min-w-[500px] max-h-[90vh] overflow-y-auto",children:[_.jsxs(gd,{children:[_.jsx(xd,{children:"Radio & Settings"}),_.jsxs(vd,{className:"sr-only",children:[C==="radio"&&"Configure radio frequency, power, and location settings",C==="identity"&&"Manage radio name, public key, private key, and advertising settings",C==="serial"&&"View serial port connection and configure contact sync",C==="database"&&"View database statistics and clean up old packets",C==="advertise"&&"Send a flood advertisement to announce your presence",C==="bot"&&"Configure automatic message bot with Python code"]})]}),s?_.jsxs(J0,{value:C,onValueChange:Pe=>P(Pe),className:"w-full",children:[_.jsxs(yd,{className:"grid w-full grid-cols-6",children:[_.jsx(dr,{value:"radio",children:"Radio"}),_.jsx(dr,{value:"identity",children:"Identity"}),_.jsx(dr,{value:"serial",children:"Serial"}),_.jsx(dr,{value:"database",children:"Database"}),_.jsx(dr,{value:"advertise",children:"Advertise"}),_.jsx(dr,{value:"bot",children:"Bot"})]}),_.jsxs(fr,{value:"radio",className:"space-y-4 mt-4",children:[_.jsxs("div",{className:"space-y-2",children:[_.jsx(jt,{htmlFor:"preset",children:"Preset"}),_.jsxs("select",{id:"preset",value:rt,o
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 u=i,c=u.lib,h=c.WordArray,d=c.Hasher,g=u.algo,m=h.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]),x=h.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]),v=h.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]),C=h.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=h.create([0,1518500249,1859775393,2400959708,2840853838]),M=h.create([1352829926,1548603684,1836072691,2053994217,0]),k=g.RIPEMD160=d.extend({_doReset:function(){this._hash=h.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(I,j){for(var O=0;O<16;O++){var G=j+O,U=I[G];I[G]=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360}var K=this._hash.words,J=P.words,Y=M.words,ie=m.words,ge=x.words,$=v.words,se=C.words,W,te,Z,D,H,q,Q,ae,ce,Ae;q=W=K[0],Q=te=K[1],ae=Z=K[2],ce=D=K[3],Ae=H=K[4];for(var pe,O=0;O<80;O+=1)pe=W+I[j+ie[O]]|0,O<16?pe+=w(te,Z,D)+J[0]:O<32?pe+=B(te,Z,D)+J[1]:O<48?pe+=b(te,Z,D)+J[2]:O<64?pe+=E(te,Z,D)+J[3]:pe+=T(te,Z,D)+J[4],pe=pe|0,pe=F(pe,$[O]),pe=pe+H|0,W=H,H=D,D=F(Z,10),Z=te,te=pe,pe=q+I[j+ge[O]]|0,O<16?pe+=T(Q,ae,ce)+Y[0]:O<32?pe+=E(Q,ae,ce)+Y[1]:O<48?pe+=b(Q,ae,ce)+Y[2]:O<64?pe+=B(Q,ae,ce)+Y[3]:pe+=w(Q,ae,ce)+Y[4],pe=pe|0,pe=F(pe,se[O]),pe=pe+Ae|0,q=Ae,Ae=ce,ce=F(ae,10),ae=Q,Q=pe;pe=K[1]+Z+ce|0,K[1]=K[2]+D+Ae|0,K[2]=K[3]+H+q|0,K[3]=K[4]+W+Q|0,K[4]=K[0]+te+ae|0,K[0]=pe},_doFinalize:function(){var I=this._data,j=I.words,O=this._nDataBytes*8,G=I.sigBytes*8;j[G>>>5]|=128<<24-G%32,j[(G+64>>>9<<4)+14]=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,I.sigBytes=(j.length+1)*4,this._process();for(var U=this._hash,K=U.words,J=0;J<5;J++){var Y=K[J];K[J]=(Y<<8|Y>>>24)&16711935|(Y<<24|Y>>>8)&4278255360}return U},clone:function(){var I=d.clone.call(this);return I._hash=this._hash.clone(),I}});function w(I,j,O){return I^j^O}function B(I,j,O){return I&j|~I&O}function b(I,j,O){return(I|~j)^O}function E(I,j,O){return I&O|j&~O}function T(I,j,O){return I^(j|~O)}function F(I,j){return I<<j|I>>>32-j}u.RIPEMD160=d._createHelper(k),u.HmacRIPEMD160=d._createHmacHelper(k)})(),i.RIPEMD160})})(bc)),bc.exports}var Cc={exports:{}},aC=Cc.exports,ug;function bd(){return ug||(ug=1,(function(n,s){(function(i,l){n.exports=l(_t())})(aC,function(i){(function(){var l=i,u=l.lib,c=u.Base,h=l.enc,d=h.Utf8,g=l.algo;g.HMAC=c.extend({init:function(m,x){m=this._hasher=new m.init,typeof x=="string"&&(x=d.parse(x));var v=m.blockSize,C=v*4;x.sigBytes>C&&(x=m.finalize(x)),x.clamp();for(var P=this._oKey=x.clone(),M=this._iKey=x.clone(),k=P.words,w=M.words,B=0;B<v;B++)k[B]^=1549556828,w[B]^=909522486;P.sigBytes=M.sigBytes=C,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 x=this._hasher,v=x.finalize(m);x.reset();var C=x.finalize(this._oKey.clone().concat(v));return C}})})()})})(Cc)),Cc.exports}var Ec={exports:{}},lC=Ec.exports,cg;function uC(){return cg||(cg=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),Tl(),bd())})(lC,function(i){return(function(){var l=i,u=l.lib,c=u.Base,h=u.WordArray,d=l.algo,g=d.SHA256,m=d.HMAC,x=d.PBKDF2=c.extend({cfg:c.extend({keySize:128/32,hasher:g,iterations:25e4}),init:function(v){this.cfg=this.cfg.extend(v)},compute:function(v,C){for(var P=this.cfg,M=m.create(P.hasher,v),k=h.create(),w=h.create([1]),B=k.words,b=w.words,E=P.keySize,T=P.iterations;B.length<E;){var F=M.update(C).finalize(w);M.reset();for(var I=F.words,j=I.length,O=F,G=1;G<T;G++){O=M.finalize(O),M.reset();for(var U=O.words,K=0;K<j;K++)I[K]^=U[K]}k.concat(F),b[0]++}return k.sigBytes=E*4,k}});l.PBKDF2=function(v,C,P){return x.create(P).compute(v,C)}})(),i.PBKDF2})})(Ec)),Ec.exports}var kc={exports:{}},cC=kc.exports,dg;function wo(){return dg||(dg=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),oA(),bd())})(cC,function(i){return(function(){var l=i,u=l.lib,c=u.Base,h=u.WordArray,d=l.algo,g=d.MD5,m=d.EvpKDF=c.extend({cfg:c.extend({keySize:128/32,hasher:g,iterations:1}),init:function(x){this.cfg=this.cfg.extend(x)},compute:function(x,v){for(var C,P=this.cfg,M=P.hasher.create(),k=h.create(),w=k.words,B=P.keySize,b=P.iterations;w.length<B;){C&&M.update(C),C=M.update(x).finalize(v),M.reset();for(var E=1;E<b;E++)C=M.finalize(C),M.reset();k.concat(C)}return k.sigBytes=B*4,k}});l.EvpKDF=function(x,v,C){return m.create(C).compute(x,v)}})(),i.EvpKDF})})(kc)),kc.exports}var Sc={exports:{}},dC=Sc.exports,fg;function bLine truncated
|
||||
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||||
* derived from CryptoJS.mode.CTR
|
||||
* Jan Hruby jhruby.web@gmail.com
|
||||
*/return i.mode.CTRGladman=(function(){var l=i.lib.BlockCipherMode.extend();function u(d){if((d>>24&255)===255){var g=d>>16&255,m=d>>8&255,x=d&255;g===255?(g=0,m===255?(m=0,x===255?x=0:++x):++m):++g,d=0,d+=g<<16,d+=m<<8,d+=x}else d+=1<<24;return d}function c(d){return(d[0]=u(d[0]))===0&&(d[1]=u(d[1])),d}var h=l.Encryptor=l.extend({processBlock:function(d,g){var m=this._cipher,x=m.blockSize,v=this._iv,C=this._counter;v&&(C=this._counter=v.slice(0),this._iv=void 0),c(C);var P=C.slice(0);m.encryptBlock(P,0);for(var M=0;M<x;M++)d[g+M]^=P[M]}});return l.Decryptor=h,l})(),i.mode.CTRGladman})})(Tc)),Tc.exports}var Dc={exports:{}},vC=Dc.exports,gg;function AC(){return gg||(gg=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),bn())})(vC,function(i){return i.mode.OFB=(function(){var l=i.lib.BlockCipherMode.extend(),u=l.Encryptor=l.extend({processBlock:function(c,h){var d=this._cipher,g=d.blockSize,m=this._iv,x=this._keystream;m&&(x=this._keystream=m.slice(0),this._iv=void 0),d.encryptBlock(x,0);for(var v=0;v<g;v++)c[h+v]^=x[v]}});return l.Decryptor=u,l})(),i.mode.OFB})})(Dc)),Dc.exports}var Rc={exports:{}},yC=Rc.exports,xg;function _C(){return xg||(xg=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),bn())})(yC,function(i){return i.mode.ECB=(function(){var l=i.lib.BlockCipherMode.extend();return l.Encryptor=l.extend({processBlock:function(u,c){this._cipher.encryptBlock(u,c)}}),l.Decryptor=l.extend({processBlock:function(u,c){this._cipher.decryptBlock(u,c)}}),l})(),i.mode.ECB})})(Rc)),Rc.exports}var Fc={exports:{}},wC=Fc.exports,vg;function bC(){return vg||(vg=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),bn())})(wC,function(i){return i.pad.AnsiX923={pad:function(l,u){var c=l.sigBytes,h=u*4,d=h-c%h,g=c+d-1;l.clamp(),l.words[g>>>2]|=d<<24-g%4*8,l.sigBytes+=d},unpad:function(l){var u=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=u}},i.pad.Ansix923})})(Fc)),Fc.exports}var Nc={exports:{}},CC=Nc.exports,Ag;function EC(){return Ag||(Ag=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),bn())})(CC,function(i){return i.pad.Iso10126={pad:function(l,u){var c=u*4,h=c-l.sigBytes%c;l.concat(i.lib.WordArray.random(h-1)).concat(i.lib.WordArray.create([h<<24],1))},unpad:function(l){var u=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=u}},i.pad.Iso10126})})(Nc)),Nc.exports}var Lc={exports:{}},kC=Lc.exports,yg;function SC(){return yg||(yg=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),bn())})(kC,function(i){return i.pad.Iso97971={pad:function(l,u){l.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(l,u)},unpad:function(l){i.pad.ZeroPadding.unpad(l),l.sigBytes--}},i.pad.Iso97971})})(Lc)),Lc.exports}var Mc={exports:{}},BC=Mc.exports,_g;function PC(){return _g||(_g=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),bn())})(BC,function(i){return i.pad.ZeroPadding={pad:function(l,u){var c=u*4;l.clamp(),l.sigBytes+=c-(l.sigBytes%c||c)},unpad:function(l){for(var u=l.words,c=l.sigBytes-1,c=l.sigBytes-1;c>=0;c--)if(u[c>>>2]>>>24-c%4*8&255){l.sigBytes=c+1;break}}},i.pad.ZeroPadding})})(Mc)),Mc.exports}var Ic={exports:{}},TC=Ic.exports,wg;function DC(){return wg||(wg=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),bn())})(TC,function(i){return i.pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding})})(Ic)),Ic.exports}var Oc={exports:{}},RC=Oc.exports,bg;function FC(){return bg||(bg=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),bn())})(RC,function(i){return(function(l){var u=i,c=u.lib,h=c.CipherParams,d=u.enc,g=d.Hex,m=u.format;m.Hex={stringify:function(x){return x.ciphertext.toString(g)},parse:function(x){var v=g.parse(x);return h.create({ciphertext:v})}}})(),i.format.Hex})})(Oc)),Oc.exports}var jc={exports:{}},NC=jc.exports,Cg;function LC(){return Cg||(Cg=1,(function(n,s){(function(i,l,u){n.exports=l(_t(),us(),cs(),wo(),bn())})(NC,function(i){return(function(){var l=i,u=l.lib,c=u.BlockCipher,h=l.algo,d=[],g=[],m=[],x=[],v=[],C=[],P=[],M=[],k=[],w=[];(function(){for(var E=[],T=0;T<256;T++)T<128?E[T]=T<<1:E[T]=T<<1^283;for(var F=0,I=0,T=0;T<256;T++){var j=I^I<<1^I<<2^I<<3^I<<4;j=j>>>8^j&255^99,d[F]=j,g[j]=F;var O=E[F],G=E[O],U=E[G],K=E[j]*257^j*16843008;m[F]=K<<24|K>>>8,x[F]=K<<16|K>>>16,v[F]=K<<8|K>>>24,C[F]=K;var K=U*16843009^G*65537^O*257^F*16843008;P[j]=K<<24|K>>>8,M[j]=K<<16|K>>>16,k[j]=K<<8|K>>>24,w[j]=K,F?(F=O^E[E[E[U^O]]],I^=E[E[I]]):F=I=1}})();var B=[0,1,2,4,8,16,32,64,128,27,54],b=h.AES=c.extend({_doReset:function(){var E;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var T=this._keyPriorReset=this._key,F=T.words,I=T.sigBytes/4,j=this._nRounds=I+6,O=(j+1)*4,G=this._keySchedule=[],U=0;U<O;U++)U<I?G[U]=F[U]:(E=G[U-1],U%I?I>6&&U%I==4&&(E=d[E>>>24]<<24|d[E>>>16&255]<<16|d[E>>>8&255]<<8|d[E&255]):(E=E<<8|E>>>24,E=d[E>>>24]<<24|d[E>>>16&255]<<16|d[E>>>8&255]<<8|d[E&255],E^=B[U/I|0]<<24),G[U]=G[U-I]^E);for(var K=this._invKeySchedule=[],J=0;J<O;J++){var U=O-J;if(J%4)var E=G[U];else var E=G[U-4];J<4||U<=4?K[J]=E:K[J]=P[d[E>>>24]]^M[d[E>>>16&255]]^k[d[E>>>8&255]]^w[d[E&255]]}}},encryptBlock: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:d+g,endByte:d+u.length-1,value:C});const P={type:n.PayloadType.Request,version:n.PayloadVersion.Version1,isValid:!0,timestamp:0,requestType:n.RequestType.GetStats,requestData:"",destinationHash:m,sourceHash:x,cipherMac:v,ciphertext:C};return c!=null&&c.includeSegments&&(P.segments=h),P}catch(h){return{type:n.PayloadType.Request,version:n.PayloadVersion.Version1,isValid:!1,errors:[h instanceof Error?h.message:"Failed to decode request payload"],timestamp:0,requestType:n.RequestType.GetStats,requestData:"",destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:""}}}}return ul.RequestPayloadDecoder=i,ul}var cl={},Gg;function xE(){if(Gg)return cl;Gg=1,Object.defineProperty(cl,"__esModule",{value:!0}),cl.ResponsePayloadDecoder=void 0;const n=pr(),s=Sn();class i{static decode(u,c){try{if(u.length<4){const M={type:n.PayloadType.Response,version:n.PayloadVersion.Version1,isValid:!1,errors:["Response payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return c!=null&&c.includeSegments&&(M.segments=[{name:"Invalid Response Data",description:"Response payload too short (minimum 4 bytes required)",startByte:c.segmentOffset||0,endByte:(c.segmentOffset||0)+u.length-1,value:(0,s.bytesToHex)(u)}]),M}const h=[],d=(c==null?void 0:c.segmentOffset)||0;let g=0;const m=(0,s.byteToHex)(u[g]);c!=null&&c.includeSegments&&h.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:d+g,endByte:d+g,value:m}),g+=1;const x=(0,s.byteToHex)(u[g]);c!=null&&c.includeSegments&&h.push({name:"Source Hash",description:"First byte of source node public key",startByte:d+g,endByte:d+g,value:x}),g+=1;const v=(0,s.bytesToHex)(u.subarray(g,g+2));c!=null&&c.includeSegments&&h.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:d+g,endByte:d+g+1,value:v}),g+=2;const C=(0,s.bytesToHex)(u.subarray(g));c!=null&&c.includeSegments&&u.length>g&&h.push({name:"Ciphertext",description:"Encrypted response data (tag + content)",startByte:d+g,endByte:d+u.length-1,value:C});const P={type:n.PayloadType.Response,version:n.PayloadVersion.Version1,isValid:!0,destinationHash:m,sourceHash:x,cipherMac:v,ciphertext:C,ciphertextLength:u.length-4};return c!=null&&c.includeSegments&&(P.segments=h),P}catch(h){return{type:n.PayloadType.Response,version:n.PayloadVersion.Version1,isValid:!1,errors:[h instanceof Error?h.message:"Failed to decode response payload"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return cl.ResponsePayloadDecoder=i,cl}var dl={},$g;function vE(){if($g)return dl;$g=1,Object.defineProperty(dl,"__esModule",{value:!0}),dl.AnonRequestPayloadDecoder=void 0;const n=pr(),s=Sn();class i{static decode(u,c){try{if(u.length<35){const M={type:n.PayloadType.AnonRequest,version:n.PayloadVersion.Version1,isValid:!1,errors:["AnonRequest payload too short (minimum 35 bytes: dest + public key + MAC)"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return c!=null&&c.includeSegments&&(M.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:c.segmentOffset||0,endByte:(c.segmentOffset||0)+u.length-1,value:(0,s.bytesToHex)(u)}]),M}const h=[],d=(c==null?void 0:c.segmentOffset)||0;let g=0;const m=(0,s.byteToHex)(u[0]);c!=null&&c.includeSegments&&h.push({name:"Destination Hash",description:`First byte of destination node public key: 0x${m}`,startByte:d+g,endByte:d+g,value:m}),g+=1;const x=(0,s.bytesToHex)(u.subarray(1,33));c!=null&&c.includeSegments&&h.push({name:"Sender Public Key",description:"Ed25519 public key of the sender (32 bytes)",startByte:d+g,endByte:d+g+31,value:x}),g+=32;const v=(0,s.bytesToHex)(u.subarray(33,35));c!=null&&c.includeSegments&&h.push({name:"Cipher MAC",description:"MAC for encrypted data verification (2 bytes)",startByte:d+g,endByte:d+g+1,value:v}),g+=2;const C=(0,s.bytesToHex)(u.subarray(35));c!=null&&c.includeSegments&&u.length>35&&h.push({name:"Ciphertext",description:`Encrypted message data (${u.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:d+g,endByte:d+u.length-1,value:C});const P={type:n.PayloadType.AnonRequest,version:n.PayloadVersion.Version1,isValid:!0,destinationHash:m,senderPublicKey:x,cipherMac:v,ciphertext:C,ciphertextLength:u.length-35};return c!=null&&c.includeSegments&&(P.segments=h),P}catch(h){return{type:n.PayloadType.AnonRequest,version:n.PayloadVersion.Version1,isValid:!1,errors:[h instanceof Error?h.message:"Failed to decode AnonRequest payload"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return dl.AnonRequestPayloadDecoder=i,dl}var fl={},Kg;function AE(){if(Kg)return fl;Kg=1,Object.defineProperty(fl,"__esModule",{value:!0}),fl.AckPayloadDecoder=void 0;const n=pr(),s=Sn();class i{static decode(u,c){try{if(u.length<4){const x={type:n.PayloadType.Ack,version:n.PayloadVersion.Version1,isValid:!1,errors:["Ack payload too short (minimum 4 bytes for checksum)"],checksum:""};return c!=null&&c.includeSegments&&(x.segments=[{name:"Invalid Ack Data",description:"Ack payload too short (minimum 4 bytes required for checksum)",startByte:c.segmentOffset||0,endByte:(c.segmentOffset||0)+u.length-1,value:(0,s.bytesToHex)(u)}]),x}const h=[],d=(c==null?void 0:c.segmentOffset)||0,g=(0,s.bytesToHex)(u.subarray(0,4));c!=null&&c.includeSegments&&h.push({name:"Checksum",description:`CRC checksum of message timestamp, text, and sender pubkey: 0x${g}`,startByte:d,endByte:d+3,value:g}),c!=null&&c.includeSegments&&u.length>4&&h.push({name:"Additional Data",description:"Extra data in Ack payload",startByte:d+4,endByte:d+u.length-1,value:(0,s.bytesToHex)(u.subarray(4))});const m={type:n.PayloadType.Ack,version:n.PayloadVersion.Version1,isValid:!0,checksum:g};return c!=null&&c.includeSegments&&(m.segments=h),m}catch(h){return{type:n.PayloadType.Ack,version:n.PayloadVersion.Version1,isValid:!1,errors:[h instanceof Error?h.message:"Failed to decode Ack payload"],checksum:""}}}}return fl.AckPayloadDecoder=i,fl}var hl={},Qg;function yE(){if(Qg)return hl;Qg=1,Object.defineProperty(hl,"__esModule",{value:!0}),hl.PathPayloadDecoder=void 0;const n=pr(),s=Sn();class i{static decode(u){try{if(u.length<2)return{type:n.PayloadType.Path,version:n.PayloadVersion.Version1,isValid:!1,errors:["Path payload too short (minimum 2 bytes: path length + extra type)"],pathLength:0,pathHashes:[],extraType:0,extraData:""};const c=u[0];if(u.length<1+c+1)return{type:n.PayloadType.Path,version:n.PayloadVersion.Version1,isValid:!1,errors:[`Path payload too short (need ${1+c+1} bytes for path length + path + extra type)`],pathLength:c,pathHashes:[],extraType:0,extraData:""};const h=[];for(let m=0;m<c;m++)h.push((0,s.byteToHex)(u[1+m]));const d=u[1+c];let g="";return u.length>1+c+1&&(g=(0,s.bytesToHex)(u.subarray(1+c+1))),{type:n.PayloadType.Path,version:n.PayloadVersion.Version1,isValid:!0,pathLength:c,pathHashes:h,extraType:d,extraData:g}}catch(c){return{type:n.PayloadType.Path,version:n.PayloadVersion.Version1,isValid:!1,errors:[c instanceof Error?c.message:"Failed to decode Path payload"],pathLength:0,pathHashes:[],extraType:0,extraData:""}}}}return hl.PathPayloadDecoder=i,hl}var pl={},Yg;function _E(){if(Yg)return pl;Yg=1,Object.defineProperty(pl,"__esModule",{value:!0}),pl.TextMessagePayloadDecoder=void 0;const n=pr(),s=Sn();class i{static decode(u,c){try{if(u.length<4){const M={type:n.PayloadType.TextMessage,version:n.PayloadVersion.Version1,isValid:!1,errors:["TextMessage payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return c!=null&&c.includeSegments&&(M.segments=[{name:"Invalid TextMessage Data",description:"TextMessage payload too short (minimum 4 bytes required)",startByte:c.segmentOffset||0,endByte:(c.segmentOffset||0)+u.length-1,value:(0,s.bytesToHex)(u)}]),M}const h=[],d=(c==null?void 0:c.segmentOffset)||0;let g=0;const m=(0,s.byteToHex)(u[g]);c!=null&&c.includeSegments&&h.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:d+g,endByte:d+g,value:m}),g+=1;const x=(0,s.byteToHex)(u[g]);c!=null&&c.includeSegments&&h.push({name:"Source Hash",description:"First byte of source node public key",startByte:d+g,endByte:d+g,value:x}),g+=1;const v=(0,s.bytesToHex)(u.subarray(g,g+2));c!=null&&c.includeSegments&&h.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:d+g,endByte:d+g+1,value:v}),g+=2;const C=(0,s.bytesToHex)(u.subarray(g));c!=null&&c.includeSegments&&u.length>g&&h.push({name:"Ciphertext",description:"Encrypted message data (timestamp + message text)",startByte:d+g,endByte:d+u.length-1,value:C});const P={type:n.PayloadType.TextMessage,version:n.PayloadVersion.Version1,isValid:!0,destinationHash:m,sourceHash:x,cipherMac:v,ciphertext:C,ciphertextLength:u.length-4};return c!=null&&c.includeSegments&&(P.segments=h),P}catch(h){return{type:n.PayloadType.TextMessage,version:n.PayloadVersion.Version1,i
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 IE=xl.exports,ix;function OE(){return ix||(ix=1,(function(n,s){(function(i,l){l(s)})(IE,(function(i){var l="1.9.4";function u(t){var o,f,A,R;for(f=1,A=arguments.length;f<A;f++){R=arguments[f];for(o in R)t[o]=R[o]}return t}var c=Object.create||(function(){function t(){}return function(o){return t.prototype=o,new t}})();function h(t,o){var f=Array.prototype.slice;if(t.bind)return t.bind.apply(t,f.call(arguments,1));var A=f.call(arguments,2);return function(){return t.apply(o,A.length?A.concat(f.call(arguments)):arguments)}}var d=0;function g(t){return"_leaflet_id"in t||(t._leaflet_id=++d),t._leaflet_id}function m(t,o,f){var A,R,V,ee;return ee=function(){A=!1,R&&(V.apply(f,R),R=!1)},V=function(){A?R=arguments:(t.apply(f,arguments),setTimeout(ee,o),A=!0)},V}function x(t,o,f){var A=o[1],R=o[0],V=A-R;return t===A&&f?t:((t-R)%V+V)%V+R}function v(){return!1}function C(t,o){if(o===!1)return t;var f=Math.pow(10,o===void 0?6:o);return Math.round(t*f)/f}function P(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function M(t){return P(t).split(/\s+/)}function k(t,o){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?c(t.options):{});for(var f in o)t.options[f]=o[f];return t.options}function w(t,o,f){var A=[];for(var R in t)A.push(encodeURIComponent(f?R.toUpperCase():R)+"="+encodeURIComponent(t[R]));return(!o||o.indexOf("?")===-1?"?":"&")+A.join("&")}var B=/\{ *([\w_ -]+) *\}/g;function b(t,o){return t.replace(B,function(f,A){var R=o[A];if(R===void 0)throw new Error("No value provided for variable "+f);return typeof R=="function"&&(R=R(o)),R})}var E=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function T(t,o){for(var f=0;f<t.length;f++)if(t[f]===o)return f;return-1}var F="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function I(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var j=0;function O(t){var o=+new Date,f=Math.max(0,16-(o-j));return j=o+f,window.setTimeout(t,f)}var G=window.requestAnimationFrame||I("RequestAnimationFrame")||O,U=window.cancelAnimationFrame||I("CancelAnimationFrame")||I("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function K(t,o,f){if(f&&G===O)t.call(o);else return G.call(window,h(t,o))}function J(t){t&&U.call(window,t)}var Y={__proto__:null,extend:u,create:c,bind:h,get lastId(){return d},stamp:g,throttle:m,wrapNum:x,falseFn:v,formatNum:C,trim:P,splitWords:M,setOptions:k,getParamString:w,template:b,isArray:E,indexOf:T,emptyImageUrl:F,requestFn:G,cancelFn:U,requestAnimFrame:K,cancelAnimFrame:J};function ie(){}ie.extend=function(t){var o=function(){k(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},f=o.__super__=this.prototype,A=c(f);A.constructor=o,o.prototype=A;for(var R in this)Object.prototype.hasOwnProperty.call(this,R)&&R!=="prototype"&&R!=="__super__"&&(o[R]=this[R]);return t.statics&&u(o,t.statics),t.includes&&(ge(t.includes),u.apply(null,[A].concat(t.includes))),u(A,t),delete A.statics,delete A.includes,A.options&&(A.options=f.options?c(f.options):{},u(A.options,t.options)),A._initHooks=[],A.callInitHooks=function(){if(!this._initHooksCalled){f.callInitHooks&&f.callInitHooks.call(this),this._initHooksCalled=!0;for(var V=0,ee=A._initHooks.length;V<ee;V++)A._initHooks[V].call(this)}},o},ie.include=function(t){var o=this.prototype.options;return u(this.prototype,t),t.options&&(this.prototype.options=o,this.mergeOptions(t.options)),this},ie.mergeOptions=function(t){return u(this.prototype.options,t),this},ie.addInitHook=function(t){var o=Array.prototype.slice.call(arguments,1),f=typeof t=="function"?t:function(){this[t].apply(this,o)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(f),this};function ge(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=E(t)?t:[t];for(var o=0;o<t.length;o++)t[o]===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 $={on:function(t,o,f){if(typeof t=="object")for(var A in t)this._on(A,t[A],o);else{t=M(t);for(var R=0,V=t.length;R<V;R++)this._on(t[R],o,f)}return this},off:function(t,o,f){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var A in t)this._off(A,t[A],o);else{t=M(t);for(var R=arguments.length===1,V=0,ee=t.length;V<ee;V++)R?this._off(t[V]):this._off(t[V],o,f)}return this},_on:function(t,o,f,A){if(typeof o!="function"){console.warn("wrong listener type: "+typeof o);return}if(this._listens(t,o,f)===!1){f===this&&(f=void 0);var R={fn:o,ctx:f};A&&(R.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(R)}},_off:function(t,o,f){var A,R,V;if(this._events&&(A=this._events[t],!!A)){if(arguments.length===1){if(this._firingCount)for(R=0,V=A.length;R<V;R++)A[R].fn=v;delete this._events[t];return}if(typeof o!="function"){console.warn("wrong listener type: "+typeof o);return}var ee=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 s=await navigator.gpu.requestAdapter();if(!s)return console.warn("No GPU adapter found"),!1;this.device=await s.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 u=0;u<2;u++)this.matchCountReadBuffers[u]=this.device.createBuffer({size:4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.matchIndicesReadBuffers[u]=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});const i=this.device.createShaderModule({code:this.shaderCode}),l=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]});return this.pipeline=this.device.createComputePipeline({layout:l,compute:{module:i,entryPoint:"main"}}),!0}catch(s){return console.error("WebGPU initialization failed:",s),!1}}isAvailable(){return this.device!==null&&this.pipeline!==null}indexToRoomName(s,i){return ns(i,s)}countNamesForLength(s){return yl(s)}async runBatch(s,i,l,u,c,h){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 d=this.currentReadBufferIndex;this.currentReadBufferIndex=1-this.currentReadBufferIndex;const g=this.matchCountReadBuffers[d],m=this.matchIndicesReadBuffers[d],x=c&&h?1:0;let v,C=0,P=0;if(x){const F=new Uint8Array(c.length/2);for(let U=0;U<F.length;U++)F[U]=parseInt(c.substr(U*2,2),16);C=F.length*8;const I=Math.ceil(F.length/4)*4,j=new Uint8Array(I);j.set(F),v=new Uint32Array(I/4);for(let U=0;U<v.length;U++)v[U]=j[U*4]<<24|j[U*4+1]<<16|j[U*4+2]<<8|j[U*4+3];const O=parseInt(h.substr(0,2),16),G=parseInt(h.substr(2,2),16);P=O<<24|G<<16}else v=new Uint32Array([0]);const M=Math.max(v.length*4,4);(!this.ciphertextBuffer||this.ciphertextBufferSize<M)&&(this.ciphertextBuffer&&this.ciphertextBuffer.destroy(),this.ciphertextBuffer=this.device.createBuffer({size:M,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.ciphertextBufferSize=M,this.bindGroupDirty=!0);const k=new Uint32Array([s,l,i,u,P,v.length,C,x]);this.device.queue.writeBuffer(this.paramsBuffer,0,k),this.device.queue.writeBuffer(this.ciphertextBuffer,0,v),this.device.queue.writeBuffer(this.matchCountBuffer,0,Pd.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 w=this.device.createCommandEncoder(),B=w.beginComputePass();B.setPipeline(this.pipeline),B.setBindGroup(0,this.bindGroup),B.dispatchWorkgroups(Math.ceil(u/(256*32))),B.end(),w.copyBufferToBuffer(this.matchCountBuffer,0,g,0,4),w.copyBufferToBuffer(this.matchIndicesBuffer,0,m,0,1024*4),this.device.queue.submit([w.finish()]),await g.mapAsync(GPUMapMode.READ);const E=new Uint32Array(g.getMappedRange())[0];g.unmap();const T=[];if(E>0){await m.mapAsync(GPUMapMode.READ);const F=new Uint32Array(m.getMappedRange());for(let I=0;I<Math.min(E,1024);I++)T.push(F[I]);m.unmap()}return T}destroy(){var s,i,l,u,c,h,d,g;(s=this.paramsBuffer)==null||s.destroy(),(i=this.matchCountBuffer)==null||i.destroy(),(l=this.matchIndicesBuffer)==null||l.destroy(),(u=this.ciphertextBuffer)==null||u.destroy(),(c=this.matchCountReadBuffers[0])==null||c.destroy(),(h=this.matchCountReadBuffers[1])==null||h.destroy(),(d=this.matchIndicesReadBuffers[0])==null||d.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}}Pd.ZERO_DATA=new Uint32Array([0]);function xS(){return typeof navigator<"u"&&"gpu"in navigator}class Ax{runBatch(s,i,l,u,c,h){const d=[],g=s.toString(16).padStart(2,"0")
Line truncated
|
||||
`).map(c=>c.trim().toLowerCase()).filter(c=>c.length>0);this.wordlist=u.filter(yx)}setWordlist(s){this.wordlist=s.map(i=>i.trim().toLowerCase()).filter(yx)}abort(){this.abortFlag=!0}isGpuAvailable(){return xS()}async decodePacket(s){var l;const i=s.trim().replace(/\s+/g,"").replace(/^0x/i,"");if(!i||!/^[0-9a-fA-F]+$/.test(i))return null;try{const c=(l=(await bt.MeshCorePacketDecoder.decodeWithVerification(i,{})).payload)==null?void 0:l.decoded;return!(c!=null&&c.channelHash)||!(c!=null&&c.ciphertext)||!(c!=null&&c.cipherMac)?null:{channelHash:c.channelHash,ciphertext:c.ciphertext,cipherMac:c.cipherMac,isGroupText:!0}}catch{return null}}async crack(s,i,l){this.abortFlag=!1,this.useTimestampFilter=(i==null?void 0:i.useTimestampFilter)??!0,this.useUtf8Filter=(i==null?void 0:i.useUtf8Filter)??!0,this.useSenderFilter=(i==null?void 0:i.useSenderFilter)??!0,this.validSeconds=(i==null?void 0:i.validSeconds)??I0,this.useCpu=(i==null?void 0:i.forceCpu)??!1;const u=(i==null?void 0:i.maxLength)??8,c=(i==null?void 0:i.startingLength)??1,h=(i==null?void 0:i.useDictionary)??!0,d=(i==null?void 0:i.startFromType)??"bruteforce",g=s.toLowerCase(),m=await this.decodePacket(g);if(!m)return{found:!1,error:"Invalid packet or not a GroupText packet"};const{channelHash:x,ciphertext:v,cipherMac:C}=m,P=parseInt(x,16);this.useCpu?this.cpuInstance||(this.cpuInstance=new Ax):this.gpuInstance||(this.gpuInstance=new Pd,await this.gpuInstance.init()||(this.useCpu=!0,this.cpuInstance=new Ax));const M=performance.now();let k=0,w=performance.now(),B=c,b=0,E=0,T=!1;if(i!=null&&i.startFrom){const Y=i.startFrom.toLowerCase();if(d==="dictionary"){const ie=this.wordlist.indexOf(Y);ie>=0&&(E=ie+1)}else{T=!0;const ie=pS(Y);ie&&(B=Math.max(c,ie.length),b=ie.index+1,b>=yl(B)&&(B++,b=0))}}let F=0;h&&!T&&this.wordlist.length>0&&(F+=this.wordlist.length-E);for(let Y=B;Y<=u;Y++)F+=yl(Y);F-=b;const I=(Y,ie,ge)=>{if(!l)return;const se=(performance.now()-M)/1e3,W=se>0?Math.round(k/se):0,te=F-k,Z=W>0?te/W:0;l({checked:k,total:F,percent:F>0?Math.min(100,k/F*100):0,rateKeysPerSec:W,etaSeconds:Z,elapsedSeconds:se,currentLength:ie,currentPosition:ge,phase:Y})},j=Y=>{if(!jA(v,C,Y))return{valid:!1};const ie=bt.ChannelCrypto.decryptGroupTextMessage(v,C,Y);return!ie.success||!ie.data?{valid:!1}:this.useTimestampFilter&&!mS(ie.data.timestamp,this.validSeconds)?{valid:!1}:this.useUtf8Filter&&!gS(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(!T&&E===0&&B===c&&b===0){I("public-key",0,M0);const Y=j0(Kc);if(x===Y){const ie=j(Kc);if(ie.valid)return{found:!0,roomName:M0,key:Kc,decryptedMessage:ie.message}}}if(h&&!T&&this.wordlist.length>0)for(let Y=E;Y<this.wordlist.length;Y++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:this.wordlist[Y],resumeType:"dictionary"};const ie=this.wordlist[Y],ge=O0("#"+ie),$=j0(ge);if(parseInt($,16)===P){const W=j(ge);if(W.valid)return{found:!0,roomName:ie,key:ge,decryptedMessage:W.message,resumeFrom:ie,resumeType:"dictionary"}}k++;const se=performance.now();se-w>=200&&(I("wordlist",ie.length,ie),w=se,await new Promise(W=>setTimeout(W,0)))}const O=this.useCpu?1024:32768,G=(i==null?void 0:i.gpuDispatchMs)??1e3;let U=O,K=!1;for(let Y=B;Y<=u;Y++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:ns(Y,0)||void 0,resumeType:"bruteforce"};const ie=yl(Y);let ge=Y===B?b:0;for(;ge<ie;){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:ns(Y,ge)||void 0,resumeType:"bruteforce"};const $=Math.min(U,ie-ge),se=performance.now();let W;this.useCpu?W=this.cpuInstance.runBatch(P,Y,ge,$,v,C):W=await this.gpuInstance.runBatch(P,Y,ge,$,v,C);const te=performance.now()-se;if(k+=$,!this.useCpu&&!K&&$>=O&&te>0){const D=G/te,H=Math.round($*D),q=Math.pow(2,Math.round(Math.log2(Math.max(O,H))));U=Math.max(O,q),K=!0}for(const D of W){const H=ns(Y,D);if(!H)continue;const q=O0("#"+H),Q=j(q);if(Q.valid)return{found:!0,roomName:H,key:q,decryptedMessage:Q.message,resumeFrom:H,resumeType:"bruteforce"}}ge+=$;const Z=performance.now();if(Z-w>=200){const D=ns(Y,Math.min(ge,ie-1))||"";I("bruteforce",Y,D),w=Z,await new Promise(H=>setTimeout(H,0))}}}return{found:!1,resumeFrom:ns(u,yl(u)-1)||void 0,resumeType:"bruteforce"}}destroy(){this.gpuInstance&&(this.gpuInstance.destroy(),this.gpuInstance=null),this.cpuInstance&&(this.cpuInstance.destroy(),this.cpuInstance=null)}}var y0,_x;function wS(){return _x||(_x=1,y0={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXg
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(d=>(this.enabled=!0,d)).catch(d=>{throw this.enabled=!1,d})}disable(){l()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):i()?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 _0=u,_0}var CS=bS();const ES=ls(CS);function kS(n){if(n.length<4)return null;try{const i=parseInt(n.slice(0,2),16)&3;let l=2;if(i===0||i===3){if(n.length<l+8)return null;l+=8}if(n.length<l+2)return null;const u=parseInt(n.slice(l,l+2),16);l+=2;const c=u*2;return n.length<l+c?null:(l+=c,n.slice(l))}catch{return null}}function SS({packets:n,channels:s,onChannelCreate:i,onRunningChange:l,visible:u=!1}){const[c,h]=N.useState(!1),[d,g]=N.useState(6),[m,x]=N.useState(!1),[v,C]=N.useState(!0),[P,M]=N.useState(!1),[k,w]=N.useState(null),[B,b]=N.useState(new Map),[E,T]=N.useState([]),[F,I]=N.useState(!1),[j,O]=N.useState(null),[G,U]=N.useState(null),[K,J]=N.useState(0),Y=N.useRef(null),ie=N.useRef(null),ge=N.useRef(!1),$=N.useRef(!1),se=N.useRef(!1),W=N.useRef(new Map),te=N.useRef(!1),Z=N.useRef(6),D=N.useRef(!0),H=N.useRef(!1),q=N.useRef(new Set),Q=N.useRef(new Set);N.useEffect(()=>{const Ee=new _S;Y.current=Ee,O(Ee.isGpuAvailable());const je=new ES;return ie.current=je,()=>{Ee.destroy(),Y.current=null,je.disable(),ie.current=null}},[]),N.useEffect(()=>{!u||F||oS(async()=>{const{ENGLISH_WORDLIST:Ee}=await import("./wordlist-BtmChKSf.js");return{ENGLISH_WORDLIST:Ee}},[]).then(({ENGLISH_WORDLIST:Ee})=>{Y.current&&(Y.current.setWordlist(Ee),I(!0))}).catch(Ee=>{console.error("Failed to load wordlist:",Ee),At.error("Failed to load wordlist",{description:"Cracking will not be available"})})},[u,F]),N.useEffect(()=>{const Ee=()=>{ut.getUndecryptedPacketCount().then(({count:at})=>U(at)).catch(()=>U(null))};Ee();const je=setInterval(Ee,36e5);return()=>clearInterval(je)},[]);const ae=N.useMemo(()=>new Set(s.map(Ee=>Ee.key.toUpperCase())),[s]),ce=n.filter(Ee=>Ee.payload_type==="GROUP_TEXT"&&!Ee.decrypted);N.useEffect(()=>{let Ee=0;b(je=>{const at=new Map(je);let mt=!1;for(const ot of ce)if(!at.has(ot.id)){const qe=kS(ot.data);if(qe&&Q.current.has(qe)){Ee++;continue}qe&&Q.current.add(qe),at.set(ot.id,{packet:ot,attempts:0,lastAttemptLength:0,status:"pending"}),mt=!0}return mt?(W.current=at,at):je}),Ee>0&&J(je=>je+Ee)},[ce.length]),N.useEffect(()=>{W.current=B},[B]),N.useEffect(()=>{te.current=m},[m]),N.useEffect(()=>{Z.current=d},[d]),N.useEffect(()=>{D.current=v},[v]),N.useEffect(()=>{H.current=P},[P]),N.useEffect(()=>{q.current=new Set(ce.map(Ee=>Ee.id))},[ce]),N.useEffect(()=>{l==null||l(c)},[c,l]);const Ae=Array.from(B.values()).filter(Ee=>Ee.status==="pending").length,pe=Array.from(B.values()).filter(Ee=>Ee.status==="cracked").length,xe=Array.from(B.values()).filter(Ee=>Ee.status==="failed").length,Be=N.useCallback(async()=>{if(se.current||!Y.current||!ge.current)return;const Ee=W.current;let je=null,at=null;for(const[Ke,Qe]of Ee.entries())if(Qe.status==="pending"){je=Qe,at=Ke;break}if(!je&&te.current){const Ke=Array.from(Ee.entries()).filter(([,Qe])=>Qe.status==="failed"&&Qe.lastAttemptLength<10);Ke.length>0&&(Ke.sort((Qe,rt)=>Qe[1].lastAttemptLength-rt[1].lastAttemptLength),[at,je]=Ke[0])}if(!je||at===null){ge.current&&setTimeout(()=>Be(),1e3);return}if(!q.current.has(at)){b(Ke=>{const Qe=new Map(Ke);return Qe.delete(at),Qe}),ge.current&&setTimeout(()=>Be(),10);return}se.current=!0;const mt=Z.current,ot=je.lastAttemptLength>0,qe=ot?je.lastAttemptLength+1:mt;try{const Ke=await Y.current.crack(je.packet.data,{maxLength:qe,useSenderFilter:!0,useTimestampFilter:!0,useUtf8Filter:!0,...H.current&&{gpuDispatchMs:1e4},...ot&&{useDictionary:!1,startingLength:qe}},Qe=>{w(Qe)});if($.current){$.current=!1,se.current=!1,w(null);return}if(Ke.found&&Ke.roomName&&Ke.key){b(He=>{const Et=new Map(He),zt=Et.get(at);return zt&&Et.set(at,{...zt,status:"cracked",attempts:zt.attempts+1,lastAttemptLength:qe}),Et});const Qe={roomName:Ke.roomName,key:Ke.key,packetId:at,message:Ke.decryptedMessage||"",crackedAt:Date.now()};T(He=>[...He,Qe]);const rt=Ke.key.toUpperCase();if(!ae.has(rt))try{const He="#"+Ke.roomName;await i(He,Ke.key),D.current&&await ut.decryptHistoricalPackets({key_type:"channel",channel_name:He})}catch(He){console.error("Failed to create channel or decrypt historical:",He),At.error("Failed to save cracked channel",{description:He instanceof Error?He.message:"Channel discovered but could not be saved"})}}else b(Qe=>{const rt=new Map(Qe),He=rt.get(at);return He&&rt.set(at,{...He,status:"failed",attempts:He.attempts+1,lastAttemptLength:qe}),rt})}catch(Ke){console.error("Cracking error:",Ke),b(Qe=>{const rt=new Map(Qe),He=rt.get(at);return He&&rt.set(at,{...He,status:"failed",attempts:He.attempts+1,lastAttemptLength:qe}),rt})}se.current=!1,w(null),ge.current&&setTimeout(()=>Be(),100)},[ae,i]),Oe=()=>{var Ee;if(!j){At.error("WebGPU not available",{description:"Cracking requires Chrome 113+ or Edge 113+ with WebGPU support."});return}h(!0),ge.current=!0,$.current=!1,(Ee=ie.current)==null||Ee.enable(),Be()},Xe=()=>{var Ee,je;h(!1),ge.current=!1,$.current=!0,(Ee=Y.current)==null||Ee.abort(),(je=ie.current)==null||
Line truncated
|
||||
//# sourceMappingURL=index-B3-iYEDN.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,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,EAAE,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,EAAE,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,EAAE,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,EAAE7B,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
@@ -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
|
||||
+585
@@ -0,0 +1,585 @@
|
||||
var ZP=Object.defineProperty;var GP=(n,e,t)=>e in n?ZP(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var La=(n,e,t)=>GP(n,typeof e!="symbol"?e+"":e,t);function XP(n,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in n)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var Wg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Lk(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var qg={exports:{}},Eu={},Vg={exports:{}},Ot={};/**
|
||||
* @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 ub;function KP(){if(ub)return Ot;ub=1;var n=Symbol.for("react.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function x(B){return B===null||typeof B!="object"?null:(B=g&&B[g]||B["@@iterator"],typeof B=="function"?B:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,b={};function w(B,Q,G){this.props=B,this.context=Q,this.refs=b,this.updater=G||A}w.prototype.isReactComponent={},w.prototype.setState=function(B,Q){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,Q,"setState")},w.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function C(){}C.prototype=w.prototype;function T(B,Q,G){this.props=B,this.context=Q,this.refs=b,this.updater=G||A}var E=T.prototype=new C;E.constructor=T,_(E,w.prototype),E.isPureReactComponent=!0;var D=Array.isArray,N=Object.prototype.hasOwnProperty,F={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function I(B,Q,G){var Y,ue={},pe=null,ve=null;if(Q!=null)for(Y in Q.ref!==void 0&&(ve=Q.ref),Q.key!==void 0&&(pe=""+Q.key),Q)N.call(Q,Y)&&!z.hasOwnProperty(Y)&&(ue[Y]=Q[Y]);var xe=arguments.length-2;if(xe===1)ue.children=G;else if(1<xe){for(var ye=Array(xe),Pe=0;Pe<xe;Pe++)ye[Pe]=arguments[Pe+2];ue.children=ye}if(B&&B.defaultProps)for(Y in xe=B.defaultProps,xe)ue[Y]===void 0&&(ue[Y]=xe[Y]);return{$$typeof:n,type:B,key:pe,ref:ve,props:ue,_owner:F.current}}function K(B,Q){return{$$typeof:n,type:B.type,key:Q,ref:B.ref,props:B.props,_owner:B._owner}}function W(B){return typeof B=="object"&&B!==null&&B.$$typeof===n}function U(B){var Q={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(G){return Q[G]})}var X=/\/+/g;function $(B,Q){return typeof B=="object"&&B!==null&&B.key!=null?U(""+B.key):Q.toString(36)}function ee(B,Q,G,Y,ue){var pe=typeof B;(pe==="undefined"||pe==="boolean")&&(B=null);var ve=!1;if(B===null)ve=!0;else switch(pe){case"string":case"number":ve=!0;break;case"object":switch(B.$$typeof){case n:case e:ve=!0}}if(ve)return ve=B,ue=ue(ve),B=Y===""?"."+$(ve,0):Y,D(ue)?(G="",B!=null&&(G=B.replace(X,"$&/")+"/"),ee(ue,Q,G,"",function(Pe){return Pe})):ue!=null&&(W(ue)&&(ue=K(ue,G+(!ue.key||ve&&ve.key===ue.key?"":(""+ue.key).replace(X,"$&/")+"/")+B)),Q.push(ue)),1;if(ve=0,Y=Y===""?".":Y+":",D(B))for(var xe=0;xe<B.length;xe++){pe=B[xe];var ye=Y+$(pe,xe);ve+=ee(pe,Q,G,ye,ue)}else if(ye=x(B),typeof ye=="function")for(B=ye.call(B),xe=0;!(pe=B.next()).done;)pe=pe.value,ye=Y+$(pe,xe++),ve+=ee(pe,Q,G,ye,ue);else if(pe==="object")throw Q=String(B),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.");return ve}function le(B,Q,G){if(B==null)return B;var Y=[],ue=0;return ee(B,Y,"","",function(pe){return Q.call(G,pe,ue++)}),Y}function Z(B){if(B._status===-1){var Q=B._result;Q=Q(),Q.then(function(G){(B._status===0||B._status===-1)&&(B._status=1,B._result=G)},function(G){(B._status===0||B._status===-1)&&(B._status=2,B._result=G)}),B._status===-1&&(B._status=0,B._result=Q)}if(B._status===1)return B._result.default;throw B._result}var ie={current:null},V={transition:null},ne={ReactCurrentDispatcher:ie,ReactCurrentBatchConfig:V,ReactCurrentOwner:F};function q(){throw Error("act(...) is not supported in production builds of React.")}return Ot.Children={map:le,forEach:function(B,Q,G){le(B,function(){Q.apply(this,arguments)},G)},count:function(B){var Q=0;return le(B,function(){Q++}),Q},toArray:function(B){return le(B,function(Q){return Q})||[]},only:function(B){if(!W(B))throw Error("React.Children.only expected to receive a single React element child.");return B}},Ot.Component=w,Ot.Fragment=t,Ot.Profiler=i,Ot.PureComponent=T,Ot.StrictMode=r,Ot.Suspense=u,Ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,Ot.act=q,Ot.cloneElement=function(B,Q,G){if(B==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+B+".");var Y=_({},B.props),ue=B.key,pe=B.ref,ve=B._owner;if(Q!=null){if(Q.ref!==void 0&&(pe=Q.ref,ve=F.current),Q.key!==void 0&&(ue=""+Q.key),B.type&&B.type.defaultProps)var xe=B.type.defaultProps;for(ye in Q)N.call(Q,ye)&&!z.hasOwnProperty(ye)&&(Y[ye]=Q[ye]===void 0&&xe!==void 0?xe[ye]:Q[ye])}var ye=arguments.length-2;if(ye===1)Y.children=G;else if(1<ye){xe=Array(ye);for(var Pe=0;Pe<ye;Pe++)xe[Pe]=arguments[Pe+2];Y.children=xe}return{$$typeof:n,type:B.type,key:ue,ref:pe,props:Y,_owner:ve}},Ot.createCLine 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 fb;function YP(){if(fb)return Eu;fb=1;var n=uv(),e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,u,f){var p,g={},x=null,A=null;f!==void 0&&(x=""+f),u.key!==void 0&&(x=""+u.key),u.ref!==void 0&&(A=u.ref);for(p in u)r.call(u,p)&&!s.hasOwnProperty(p)&&(g[p]=u[p]);if(a&&a.defaultProps)for(p in u=a.defaultProps,u)g[p]===void 0&&(g[p]=u[p]);return{$$typeof:e,type:a,key:x,ref:A,props:g,_owner:i.current}}return Eu.Fragment=t,Eu.jsx=o,Eu.jsxs=o,Eu}var db;function JP(){return db||(db=1,qg.exports=YP()),qg.exports}var S=JP(),R=uv();const Be=Rc(R),hv=XP({__proto__:null,default:Be},[R]);var ud={},$g={exports:{}},Rr={},Ug={exports:{}},Zg={};/**
|
||||
* @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 pb;function eB(){return pb||(pb=1,(function(n){function e(V,ne){var q=V.length;V.push(ne);e:for(;0<q;){var B=q-1>>>1,Q=V[B];if(0<i(Q,ne))V[B]=ne,V[q]=Q,q=B;else break e}}function t(V){return V.length===0?null:V[0]}function r(V){if(V.length===0)return null;var ne=V[0],q=V.pop();if(q!==ne){V[0]=q;e:for(var B=0,Q=V.length,G=Q>>>1;B<G;){var Y=2*(B+1)-1,ue=V[Y],pe=Y+1,ve=V[pe];if(0>i(ue,q))pe<Q&&0>i(ve,ue)?(V[B]=ve,V[pe]=q,B=pe):(V[B]=ue,V[Y]=q,B=Y);else if(pe<Q&&0>i(ve,q))V[B]=ve,V[pe]=q,B=pe;else break e}}return ne}function i(V,ne){var q=V.sortIndex-ne.sortIndex;return q!==0?q:V.id-ne.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var u=[],f=[],p=1,g=null,x=3,A=!1,_=!1,b=!1,w=typeof setTimeout=="function"?setTimeout:null,C=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 E(V){for(var ne=t(f);ne!==null;){if(ne.callback===null)r(f);else if(ne.startTime<=V)r(f),ne.sortIndex=ne.expirationTime,e(u,ne);else break;ne=t(f)}}function D(V){if(b=!1,E(V),!_)if(t(u)!==null)_=!0,Z(N);else{var ne=t(f);ne!==null&&ie(D,ne.startTime-V)}}function N(V,ne){_=!1,b&&(b=!1,C(I),I=-1),A=!0;var q=x;try{for(E(ne),g=t(u);g!==null&&(!(g.expirationTime>ne)||V&&!U());){var B=g.callback;if(typeof B=="function"){g.callback=null,x=g.priorityLevel;var Q=B(g.expirationTime<=ne);ne=n.unstable_now(),typeof Q=="function"?g.callback=Q:g===t(u)&&r(u),E(ne)}else r(u);g=t(u)}if(g!==null)var G=!0;else{var Y=t(f);Y!==null&&ie(D,Y.startTime-ne),G=!1}return G}finally{g=null,x=q,A=!1}}var F=!1,z=null,I=-1,K=5,W=-1;function U(){return!(n.unstable_now()-W<K)}function X(){if(z!==null){var V=n.unstable_now();W=V;var ne=!0;try{ne=z(!0,V)}finally{ne?$():(F=!1,z=null)}}else F=!1}var $;if(typeof T=="function")$=function(){T(X)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,le=ee.port2;ee.port1.onmessage=X,$=function(){le.postMessage(null)}}else $=function(){w(X,0)};function Z(V){z=V,F||(F=!0,$())}function ie(V,ne){I=w(function(){V(n.unstable_now())},ne)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(V){V.callback=null},n.unstable_continueExecution=function(){_||A||(_=!0,Z(N))},n.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<V?Math.floor(1e3/V):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_getFirstCallbackNode=function(){return t(u)},n.unstable_next=function(V){switch(x){case 1:case 2:case 3:var ne=3;break;default:ne=x}var q=x;x=ne;try{return V()}finally{x=q}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(V,ne){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var q=x;x=V;try{return ne()}finally{x=q}},n.unstable_scheduleCallback=function(V,ne,q){var B=n.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?B+q:B):q=B,V){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=q+Q,V={id:p++,callback:ne,priorityLevel:V,startTime:q,expirationTime:Q,sortIndex:-1},q>B?(V.sortIndex=q,e(f,V),t(u)===null&&V===t(f)&&(b?(C(I),I=-1):b=!0,ie(D,q-B))):(V.sortIndex=Q,e(u,V),_||A||(_=!0,Z(N))),V},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(V){var ne=x;return function(){var q=x;x=ne;try{return V.apply(this,arguments)}finally{x=q}}}})(Zg)),Zg}var mb;function tB(){return mb||(mb=1,Ug.exports=eB()),Ug.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 gb;function nB(){if(gb)return Rr;gb=1;var n=uv(),e=tB();function t(l){for(var h="https://reactjs.org/docs/error-decoder.html?invariant="+l,m=1;m<arguments.length;m++)h+="&args[]="+encodeURIComponent(arguments[m]);return"Minified React error #"+l+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,i={};function s(l,h){o(l,h),o(l+"Capture",h)}function o(l,h){for(i[l]=h,l=0;l<h.length;l++)r.add(h[l])}var a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,f=/^[: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]*$/,p={},g={};function x(l){return u.call(g,l)?!0:u.call(p,l)?!1:f.test(l)?g[l]=!0:(p[l]=!0,!1)}function A(l,h,m,v){if(m!==null&&m.type===0)return!1;switch(typeof h){case"function":case"symbol":return!0;case"boolean":return v?!1:m!==null?!m.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function _(l,h,m,v){if(h===null||typeof h>"u"||A(l,h,m,v))return!0;if(v)return!1;if(m!==null)switch(m.type){case 3:return!h;case 4:return h===!1;case 5:return isNaN(h);case 6:return isNaN(h)||1>h}return!1}function b(l,h,m,v,k,P,j){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=v,this.attributeNamespace=k,this.mustUseProperty=m,this.propertyName=l,this.type=h,this.sanitizeURL=P,this.removeEmptyString=j}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new b(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var h=l[0];w[h]=new b(h,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new b(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new b(l,2,!1,l,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(l){w[l]=new b(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new b(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new b(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new b(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new b(l,5,!1,l.toLowerCase(),null,!1,!1)});var C=/[\-:]([a-z])/g;function T(l){return l[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(l){var h=l.replace(C,T);w[h]=new b(h,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var h=l.replace(C,T);w[h]=new b(h,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var h=l.replace(C,T);w[h]=new b(h,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new b(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new b(l,1,!1,l.toLowerCase(),null,!0,!0)});function E(l,h,m,v){var k=w.hasOwnProperty(h)?w[h]:null;(k!==null?k.type!==0:v||!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=
Line truncated
|
||||
`+B+l}var G=!1;function Y(l,h){if(!l||G)return"";G=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(h)if(h=function(){throw Error()},Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(ge){var v=ge}Reflect.construct(l,[],h)}else{try{h.call()}catch(ge){v=ge}l.call(h.prototype)}else{try{throw Error()}catch(ge){v=ge}l()}}catch(ge){if(ge&&v&&typeof ge.stack=="string"){for(var k=ge.stack.split(`
|
||||
`),P=v.stack.split(`
|
||||
`),j=k.length-1,J=P.length-1;1<=j&&0<=J&&k[j]!==P[J];)J--;for(;1<=j&&0<=J;j--,J--)if(k[j]!==P[J]){if(j!==1||J!==1)do if(j--,J--,0>J||k[j]!==P[J]){var re=`
|
||||
`+k[j].replace(" at new "," at ");return l.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",l.displayName)),re}while(1<=j&&0<=J);break}}}finally{G=!1,Error.prepareStackTrace=m}return(l=l?l.displayName||l.name:"")?Q(l):""}function ue(l){switch(l.tag){case 5:return Q(l.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return l=Y(l.type,!1),l;case 11:return l=Y(l.type.render,!1),l;case 1:return l=Y(l.type,!0),l;default:return""}}function pe(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case z:return"Fragment";case F:return"Portal";case K:return"Profiler";case I:return"StrictMode";case $:return"Suspense";case ee:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case U:return(l.displayName||"Context")+".Consumer";case W:return(l._context.displayName||"Context")+".Provider";case X:var h=l.render;return l=l.displayName,l||(l=h.displayName||h.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case le:return h=l.displayName||null,h!==null?h:pe(l.type)||"Memo";case Z:h=l._payload,l=l._init;try{return pe(l(h))}catch{}}return null}function ve(l){var h=l.type;switch(l.tag){case 24:return"Cache";case 9:return(h.displayName||"Context")+".Consumer";case 10:return(h._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=h.render,l=l.displayName||l.name||"",h.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return h;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return pe(h);case 8:return h===I?"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 h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function xe(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ye(l){var h=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function Pe(l){var h=ye(l)?"checked":"value",m=Object.getOwnPropertyDescriptor(l.constructor.prototype,h),v=""+l[h];if(!l.hasOwnProperty(h)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var k=m.get,P=m.set;return Object.defineProperty(l,h,{configurable:!0,get:function(){return k.call(this)},set:function(j){v=""+j,P.call(this,j)}}),Object.defineProperty(l,h,{enumerable:m.enumerable}),{getValue:function(){return v},setValue:function(j){v=""+j},stopTracking:function(){l._valueTracker=null,delete l[h]}}}}function Ke(l){l._valueTracker||(l._valueTracker=Pe(l))}function nt(l){if(!l)return!1;var h=l._valueTracker;if(!h)return!0;var m=h.getValue(),v="";return l&&(v=ye(l)?l.checked?"true":"false":l.value),l=v,l!==m?(h.setValue(l),!0):!1}function Ce(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Ge(l,h){var m=h.checked;return q({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??l._wrapperState.initialChecked})}function pt(l,h){var m=h.defaultValue==null?"":h.defaultValue,v=h.checked!=null?h.checked:h.defaultChecked;m=xe(h.value!=null?h.value:m),l._wrapperState={initialChecked:v,initialValue:m,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function bt(l,h){h=h.checked,h!=null&&E(l,"checked",h,!1)}function ot(l,h){bt(l,h);var m=xe(h.value),v=h.type;if(m!=null)v==="number"?(m===0&&l.value===""||l.value!=m)&&(l.value=""+m):l.value!==""+m&&(l.value=""+m);else if(v==="submit"||v==="reset"){l.removeAttribute("value");return}h.hasOwnProperty("value")?et(l,h.type,m):h.hasOwnProperty("defaultValue")&&et(l,h.type,xe(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(l.defaultChecked=!!h.defaultChecked)}function mt(l,h,m){if(h.hasOwnProperty("value")||h.hasOwnProperty("defaultValue")){var v=h.type;if(!(v!=="submit"&&v!=="reset"||h.value!==void 0&&h.value!==null))return;h=""+l._wrapperState.initialValue,m||h===l.value||(l.value=h),l.defaultValue=h}m=l.name,m!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,m!==""&&(l.name=m)}function et(l,h,m){(h!=="number"||Ce(l.ownerDocument)!==l)&&(m==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+m&&(l.defaultValue=""+m))}var tt=Array.isArray;function at(l,h,m,v){if(l=l.options,h){h={};for(var k=0;k<m.length;k++)h["$"+m[k]]=!0;for(m=0;m<l.length;m++)k=h.hasOwnProperty("$"+l[m].value),l[m].selected!==k&&(l[m].selected=k),k&&v&&(l[m].defaultSelected=!0)}else{for(m=""+xe(m),h=null,k=0;k<l.length;k++){if(l[k].value===m){l[k].selected=!0,v&&(l[k].defaultSelected=!0);return}h!==null||l[k].disabled||(h=l[k])}h!==null&&(h.selected=!0)}}function qe(l,h){if(h.dangerouslySetInnerH
Line truncated
|
||||
`).replace(te,"")}function me(l,h,m){if(h=ce(h),ce(l)!==h&&m)throw Error(t(425))}function _e(){}var Fe=null,rt=null;function yt(l,h){return l==="textarea"||l==="noscript"||typeof h.children=="string"||typeof h.children=="number"||typeof h.dangerouslySetInnerHTML=="object"&&h.dangerouslySetInnerHTML!==null&&h.dangerouslySetInnerHTML.__html!=null}var Bn=typeof setTimeout=="function"?setTimeout:void 0,kn=typeof clearTimeout=="function"?clearTimeout:void 0,xr=typeof Promise=="function"?Promise:void 0,sr=typeof queueMicrotask=="function"?queueMicrotask:typeof xr<"u"?function(l){return xr.resolve(null).then(l).catch(Eo)}:Bn;function Eo(l){setTimeout(function(){throw l})}function pu(l,h){var m=h,v=0;do{var k=m.nextSibling;if(l.removeChild(m),k&&k.nodeType===8)if(m=k.data,m==="/$"){if(v===0){l.removeChild(k),Vr(h);return}v--}else m!=="$"&&m!=="$?"&&m!=="$!"||v++;m=k}while(m);Vr(h)}function rs(l){for(;l!=null;l=l.nextSibling){var h=l.nodeType;if(h===1||h===3)break;if(h===8){if(h=l.data,h==="$"||h==="$!"||h==="$?")break;if(h==="/$")return null}}return l}function kf(l){l=l.previousSibling;for(var h=0;l;){if(l.nodeType===8){var m=l.data;if(m==="$"||m==="$!"||m==="$?"){if(h===0)return l;h--}else m==="/$"&&h++}l=l.previousSibling}return null}var Ms=Math.random().toString(36).slice(2),fi="__reactFiber$"+Ms,Po="__reactProps$"+Ms,It="__reactContainer$"+Ms,Bo="__reactEvents$"+Ms,Im="__reactListeners$"+Ms,zm="__reactHandles$"+Ms;function Ns(l){var h=l[fi];if(h)return h;for(var m=l.parentNode;m;){if(h=m[It]||m[fi]){if(m=h.alternate,h.child!==null||m!==null&&m.child!==null)for(l=kf(l);l!==null;){if(m=l[fi])return m;l=kf(l)}return h}l=m,m=l.parentNode}return null}function Ls(l){return l=l[fi]||l[It],!l||l.tag!==5&&l.tag!==6&&l.tag!==13&&l.tag!==3?null:l}function Fs(l){if(l.tag===5||l.tag===6)return l.stateNode;throw Error(t(33))}function Fl(l){return l[Po]||null}var jm=[],Il=-1;function Ro(l){return{current:l}}function nn(l){0>Il||(l.current=jm[Il],jm[Il]=null,Il--)}function Kt(l,h){Il++,jm[Il]=l.current,l.current=h}var Do={},or=Ro(Do),Cr=Ro(!1),ka=Do;function zl(l,h){var m=l.type.contextTypes;if(!m)return Do;var v=l.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===h)return v.__reactInternalMemoizedMaskedChildContext;var k={},P;for(P in m)k[P]=h[P];return v&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=h,l.__reactInternalMemoizedMaskedChildContext=k),k}function Tr(l){return l=l.childContextTypes,l!=null}function Sf(){nn(Cr),nn(or)}function RA(l,h,m){if(or.current!==Do)throw Error(t(168));Kt(or,h),Kt(Cr,m)}function DA(l,h,m){var v=l.stateNode;if(h=h.childContextTypes,typeof v.getChildContext!="function")return m;v=v.getChildContext();for(var k in v)if(!(k in h))throw Error(t(108,ve(l)||"Unknown",k));return q({},m,v)}function Cf(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Do,ka=or.current,Kt(or,l),Kt(Cr,Cr.current),!0}function MA(l,h,m){var v=l.stateNode;if(!v)throw Error(t(169));m?(l=DA(l,h,ka),v.__reactInternalMemoizedMergedChildContext=l,nn(Cr),nn(or),Kt(or,l)):nn(Cr),Kt(Cr,m)}var Is=null,Tf=!1,Qm=!1;function NA(l){Is===null?Is=[l]:Is.push(l)}function dP(l){Tf=!0,NA(l)}function Mo(){if(!Qm&&Is!==null){Qm=!0;var l=0,h=Bt;try{var m=Is;for(Bt=1;l<m.length;l++){var v=m[l];do v=v(!0);while(v!==null)}Is=null,Tf=!1}catch(k){throw Is!==null&&(Is=Is.slice(l+1)),ef(Wc,Mo),k}finally{Bt=h,Qm=!1}}return null}var jl=[],Ql=0,Ef=null,Pf=0,di=[],pi=0,Sa=null,zs=1,js="";function Ca(l,h){jl[Ql++]=Pf,jl[Ql++]=Ef,Ef=l,Pf=h}function LA(l,h,m){di[pi++]=zs,di[pi++]=js,di[pi++]=Sa,Sa=l;var v=zs;l=js;var k=32-gt(v)-1;v&=~(1<<k),m+=1;var P=32-gt(h)+k;if(30<P){var j=k-k%5;P=(v&(1<<j)-1).toString(32),v>>=j,k-=j,zs=1<<32-gt(h)+k|m<<k|v,js=P+l}else zs=1<<P|m<<k|v,js=l}function Hm(l){l.return!==null&&(Ca(l,1),LA(l,1,0))}function Wm(l){for(;l===Ef;)Ef=jl[--Ql],jl[Ql]=null,Pf=jl[--Ql],jl[Ql]=null;for(;l===Sa;)Sa=di[--pi],di[pi]=null,js=di[--pi],di[pi]=null,zs=di[--pi],di[pi]=null}var Xr=null,Kr=null,an=!1,Ri=null;function FA(l,h){var m=yi(5,null,null,0);m.elementType="DELETED",m.stateNode=h,m.return=l,h=l.deletions,h===null?(l.deletions=[m],l.flags|=16):h.push(m)}function IA(l,h){switch(l.tag){case 5:var m=l.type;return h=h.nodeType!==1||m.toLowerCase()!==h.nodeName.toLowerCase()?null:h,h!==null?(l.stateNode=h,Xr=l,Kr=rs(h.firstChild),!0):!1;case 6:return h=l.pendingProps===""||h.nodeType!==3?null:h,h!==null?(l.stateNode=h,Xr=l,Kr=null,!0):!1;case 13:return h=h.nodeType!==8?null:h,h!==null?(m=Sa!==null?{id:zs,overflow:js}:null,l.memoizedState={dehydrated:h,treeContext:m,retryLane:1073741824},m=yi(18,null,null,0),m.stateNode=h,m.return=l,l.child=m,Xr=l,Kr=null,!0):!1;default:return!1}}function qm(l){return(l.mode&1)!==0&&(l.flags&128)===0}function Vm(l){if(an){var h=Kr;if(h){var m=h;if(!IA(l,h)){if(qm(l))throw Error(t(418));h=rs(m.nextSibling);var v=Xr;h&&IA(l,h)?FA(v,m):(l.flags=l.flags&-4097|2,an=!1,Xr=l)}}else{if(qm(l))throw Error(t(418));l.flags=l.flags&-4097|2,an=!1,Xr=l}}}function zA(l){for(l=l.
Line truncated
|
||||
Error generating stack: `+P.message+`
|
||||
`+P.stack}return{value:l,source:h,stack:k,digest:null}}function dg(l,h,m){return{value:l,source:null,stack:m??null,digest:h??null}}function pg(l,h){try{console.error(h.value)}catch(m){setTimeout(function(){throw m})}}var wP=typeof WeakMap=="function"?WeakMap:Map;function v1(l,h,m){m=Hs(-1,m),m.tag=3,m.payload={element:null};var v=h.value;return m.callback=function(){Xf||(Xf=!0,Eg=v),pg(l,h)},m}function A1(l,h,m){m=Hs(-1,m),m.tag=3;var v=l.type.getDerivedStateFromError;if(typeof v=="function"){var k=h.value;m.payload=function(){return v(k)},m.callback=function(){pg(l,h)}}var P=l.stateNode;return P!==null&&typeof P.componentDidCatch=="function"&&(m.callback=function(){pg(l,h),typeof v!="function"&&(Io===null?Io=new Set([this]):Io.add(this));var j=h.stack;this.componentDidCatch(h.value,{componentStack:j!==null?j:""})}),m}function b1(l,h,m){var v=l.pingCache;if(v===null){v=l.pingCache=new wP;var k=new Set;v.set(h,k)}else k=v.get(h),k===void 0&&(k=new Set,v.set(h,k));k.has(m)||(k.add(m),l=LP.bind(null,l,h,m),h.then(l,l))}function w1(l){do{var h;if((h=l.tag===13)&&(h=l.memoizedState,h=h!==null?h.dehydrated!==null:!0),h)return l;l=l.return}while(l!==null);return null}function _1(l,h,m,v,k){return(l.mode&1)===0?(l===h?l.flags|=65536:(l.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(h=Hs(-1,1),h.tag=2,Lo(m,h,1))),m.lanes|=1),l):(l.flags|=65536,l.lanes=k,l)}var _P=D.ReactCurrentOwner,Er=!1;function yr(l,h,m,v){h.child=l===null?WA(h,null,m,v):Wl(h,l.child,m,v)}function O1(l,h,m,v,k){m=m.render;var P=h.ref;return Vl(h,k),v=sg(l,h,m,v,P,k),m=og(),l!==null&&!Er?(h.updateQueue=l.updateQueue,h.flags&=-2053,l.lanes&=~k,Ws(l,h,k)):(an&&m&&Hm(h),h.flags|=1,yr(l,h,v,k),h.child)}function k1(l,h,m,v,k){if(l===null){var P=m.type;return typeof P=="function"&&!Lg(P)&&P.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(h.tag=15,h.type=P,S1(l,h,P,v,k)):(l=nd(m.type,null,v,h,h.mode,k),l.ref=h.ref,l.return=h,h.child=l)}if(P=l.child,(l.lanes&k)===0){var j=P.memoizedProps;if(m=m.compare,m=m!==null?m:es,m(j,v)&&l.ref===h.ref)return Ws(l,h,k)}return h.flags|=1,l=Ho(P,v),l.ref=h.ref,l.return=h,h.child=l}function S1(l,h,m,v,k){if(l!==null){var P=l.memoizedProps;if(es(P,v)&&l.ref===h.ref)if(Er=!1,h.pendingProps=v=P,(l.lanes&k)!==0)(l.flags&131072)!==0&&(Er=!0);else return h.lanes=l.lanes,Ws(l,h,k)}return mg(l,h,m,v,k)}function C1(l,h,m){var v=h.pendingProps,k=v.children,P=l!==null?l.memoizedState:null;if(v.mode==="hidden")if((h.mode&1)===0)h.memoizedState={baseLanes:0,cachePool:null,transitions:null},Kt(Gl,Yr),Yr|=m;else{if((m&1073741824)===0)return l=P!==null?P.baseLanes|m:m,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:l,cachePool:null,transitions:null},h.updateQueue=null,Kt(Gl,Yr),Yr|=l,null;h.memoizedState={baseLanes:0,cachePool:null,transitions:null},v=P!==null?P.baseLanes:m,Kt(Gl,Yr),Yr|=v}else P!==null?(v=P.baseLanes|m,h.memoizedState=null):v=m,Kt(Gl,Yr),Yr|=v;return yr(l,h,k,m),h.child}function T1(l,h){var m=h.ref;(l===null&&m!==null||l!==null&&l.ref!==m)&&(h.flags|=512,h.flags|=2097152)}function mg(l,h,m,v,k){var P=Tr(m)?ka:or.current;return P=zl(h,P),Vl(h,k),m=sg(l,h,m,v,P,k),v=og(),l!==null&&!Er?(h.updateQueue=l.updateQueue,h.flags&=-2053,l.lanes&=~k,Ws(l,h,k)):(an&&v&&Hm(h),h.flags|=1,yr(l,h,m,k),h.child)}function E1(l,h,m,v,k){if(Tr(m)){var P=!0;Cf(h)}else P=!1;if(Vl(h,k),h.stateNode===null)Vf(l,h),x1(h,m,v),fg(h,m,v,k),v=!0;else if(l===null){var j=h.stateNode,J=h.memoizedProps;j.props=J;var re=j.context,ge=m.contextType;typeof ge=="object"&&ge!==null?ge=mi(ge):(ge=Tr(m)?ka:or.current,ge=zl(h,ge));var Se=m.getDerivedStateFromProps,Ee=typeof Se=="function"||typeof j.getSnapshotBeforeUpdate=="function";Ee||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(J!==v||re!==ge)&&y1(h,j,v,ge),No=!1;var ke=h.memoizedState;j.state=ke,Lf(h,v,j,k),re=h.memoizedState,J!==v||ke!==re||Cr.current||No?(typeof Se=="function"&&(hg(h,m,Se,v),re=h.memoizedState),(J=No||g1(h,m,J,v,ke,re,ge))?(Ee||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(h.flags|=4194308)):(typeof j.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=v,h.memoizedState=re),j.props=v,j.state=re,j.context=ge,v=J):(typeof j.componentDidMount=="function"&&(h.flags|=4194308),v=!1)}else{j=h.stateNode,VA(l,h),J=h.memoizedProps,ge=h.type===h.elementType?J:Di(h.type,J),j.props=ge,Ee=h.pendingProps,ke=j.context,re=m.contextType,typeof re=="object"&&re!==null?re=mi(re):(re=Tr(m)?ka:or.current,re=zl(h,re));var Qe=m.getDerivedStateFromProps;(Se=typeof Qe=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(J!==Ee||ke!==re)&&y1(h,j,
Line truncated
|
||||
`)}function Yl(n,e,t){const r=Math.floor(Date.now()/1e3);return{id:-Date.now(),type:"PRIV",conversation_key:n,text:e,sender_timestamp:r,received_at:r,paths:null,txt_type:0,signature:null,outgoing:t,acked:1}}function hB(n){const e=R.useRef(null),t=R.useRef(null),r=R.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null),e.current=null},[]),i=R.useCallback(async()=>{const o=e.current;if(!o)return;let a=null,u=null;for(let f=0;f<2;f++)try{a=await dt.requestTelemetry(o.conversationId,"");break}catch(p){u=p instanceof Error?p:new Error("Unknown error"),f===0&&await new Promise(g=>setTimeout(g,2e3))}if(a){const f=Yl(o.conversationId,uB(o,a),!1);n(p=>[...p,f])}else{const f=Yl(o.conversationId,`Duty cycle poll failed after retry: ${(u==null?void 0:u.message)??"Unknown error"}`,!1);n(p=>[...p,f])}},[n]),s=R.useCallback(async(o,a)=>{const u=o.trim().toLowerCase();if(u==="dutycycle_start"){r();let f=null,p=null;for(let A=0;A<2;A++)try{f=await dt.requestTelemetry(a,"");break}catch(_){p=_ instanceof Error?_:new Error("Unknown error"),A===0&&await new Promise(b=>setTimeout(b,2e3))}if(!f){const A=Yl(a,`Failed to start duty cycle tracking after retry: ${(p==null?void 0:p.message)??"Unknown error"}`,!1);return n(_=>[..._,A]),!0}const g=Math.floor(Date.now()/1e3);e.current={startTime:g,uptime:f.uptime_seconds,txAirtime:f.airtime_seconds,rxAirtime:f.rx_airtime_seconds,sentFlood:f.sent_flood,sentDirect:f.sent_direct,recvFlood:f.recv_flood,recvDirect:f.recv_direct,conversationId:a};const x=Yl(a,`Airtime/duty cycle statistics gathering begins at ${g}. Logs will follow every 5 minutes. To stop, run dutycycle_stop or navigate away from this conversation.`,!1);return n(A=>[...A,x]),t.current=window.setInterval(i,lB),!0}if(u==="dutycycle_stop"){if(e.current&&e.current.conversationId===a){await i(),r();const f=Yl(a,"Airtime/duty cycle statistics gathering stopped.",!1);n(p=>[...p,f])}else{const f=Yl(a,"Duty cycle tracking is not active.",!1);n(p=>[...p,f])}return!0}return!1},[n,r,i]);return R.useEffect(()=>()=>{t.current!==null&&clearInterval(t.current)},[]),{handleAirtimeCommand:s,stopTracking:r}}function Xd(n){if(n<60)return`${n}s`;const e=Math.floor(n/86400),t=Math.floor(n%86400/3600),r=Math.floor(n%3600/60);return e>0?t>0&&r>0?`${e}d${t}h${r}m`:t>0?`${e}d${t}h`:r>0?`${e}d${r}m`:`${e}d`:t>0?r>0?`${t}h${r}m`:`${t}h`:`${r}m`}function fB(n){return["Telemetry",`Battery Voltage: ${n.battery_volts.toFixed(3)}V`,`Uptime: ${Xd(n.uptime_seconds)}`,...n.clock_output?[`Clock: ${n.clock_output}`]:[],`TX Airtime: ${Xd(n.airtime_seconds)}`,`RX Airtime: ${Xd(n.rx_airtime_seconds)}`,"",`Noise Floor: ${n.noise_floor_dbm} dBm`,`Last RSSI: ${n.last_rssi_dbm} dBm`,`Last SNR: ${n.last_snr_db.toFixed(1)} dB`,"",`Packets: ${n.packets_received.toLocaleString()} rx / ${n.packets_sent.toLocaleString()} tx`,`Flood: ${n.recv_flood.toLocaleString()} rx / ${n.sent_flood.toLocaleString()} tx`,`Direct: ${n.recv_direct.toLocaleString()} rx / ${n.sent_direct.toLocaleString()} tx`,`Duplicates: ${n.flood_dups.toLocaleString()} flood / ${n.direct_dups.toLocaleString()} direct`,"",`TX Queue: ${n.tx_queue_len}`,`Debug Flags: ${n.full_events}`].join(`
|
||||
`)}function dB(n){if(n.length===0)return`Neighbors
|
||||
No neighbors reported`;const e=[...n].sort((r,i)=>i.snr-r.snr),t=[`Neighbors (${e.length})`];for(const r of e){const i=r.name||r.pubkey_prefix,s=r.snr>=0?`+${r.snr.toFixed(1)}`:r.snr.toFixed(1);t.push(`${i}, ${s} dB [${Xd(r.last_heard_seconds)} ago]`)}return t.join(`
|
||||
`)}function pB(n){if(n.length===0)return`ACL
|
||||
No ACL entries`;const e=[`ACL (${n.length})`];for(const t of n){const r=t.name||t.pubkey_prefix;e.push(`${r}: ${t.permission_name}`)}return e.join(`
|
||||
`)}function Fa(n,e,t,r=0){const i=Math.floor(Date.now()/1e3);return{id:-Date.now()-r,type:"PRIV",conversation_key:n,text:e,sender_timestamp:i,received_at:i,paths:null,txt_type:0,signature:null,outgoing:t,acked:1}}function mB(n,e,t){const[r,i]=R.useState(!1),{handleAirtimeCommand:s,stopTracking:o}=hB(t);R.useEffect(()=>{i(!1),o()},[n==null?void 0:n.id,o]);const a=R.useMemo(()=>{if(!n||n.type!=="contact")return!1;const p=e.find(g=>g.public_key===n.id);return(p==null?void 0:p.type)===Lp},[n,e]),u=R.useCallback(async p=>{if(!(!n||n.type!=="contact")&&a)try{const g=await dt.requestTelemetry(n.id,p),x=Fa(n.id,fB(g),!1,0),A=Fa(n.id,dB(g.neighbors),!1,1),_=Fa(n.id,pB(g.acl),!1,2);t(b=>[...b,x,A,_]),i(!0)}catch(g){const x=Fa(n.id,`Telemetry request failed: ${g instanceof Error?g.message:"Unknown error"}`,!1,0);t(A=>[...A,x])}},[n,a,t]),f=R.useCallback(async p=>{if(!n||n.type!=="contact"||!a||!r||await s(p,n.id))return;const x=Fa(n.id,`> ${p}`,!0,0);t(A=>[...A,x]);try{const A=await dt.sendRepeaterCommand(n.id,p),_=Fa(n.id,A.response,!1,1);A.sender_timestamp&&(_.sender_timestamp=A.sender_timestamp),t(b=>[...b,_])}catch(A){const _=Fa(n.id,`Command failed: ${A instanceof Error?A.message:"Unknown error"}`,!1,1);t(b=>[...b,_])}},[n,a,r,t,s]);return{repeaterLoggedIn:r,activeContactIsRepeater:a,handleTelemetryRequest:u,handleRepeaterCommand:f}}const Ik="remoteterm-lastMessageTime",zk="remoteterm-sortOrder";let Y0={};function Ab(n){Y0={...n}}function bb(){return{...Y0}}function Gg(n,e){return Y0[n]=e,{...Y0}}function Ii(n,e){return`${n}-${e}`}function gB(){try{const n=localStorage.getItem(Ik);return n?JSON.parse(n):{}}catch{return{}}}function xB(){try{return localStorage.getItem(zk)==="alpha"?"alpha":"recent"}catch{return"recent"}}function wb(){try{localStorage.removeItem(Ik),localStorage.removeItem(zk)}catch{}}function _b(n,e){if(!e)return!1;const t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`@\\[${t}\\]`,"i").test(n)}function yB(n,e,t,r=null){const[i,s]=R.useState({}),[o,a]=R.useState({}),[u,f]=R.useState(bb),p=R.useRef(r);R.useEffect(()=>{p.current=r},[r]);const g=R.useRef(new Set),x=R.useRef(new Set);R.useEffect(()=>{const C=n.filter(D=>!g.current.has(D.key)),T=e.filter(D=>D.public_key&&!x.current.has(D.public_key));if(C.length===0&&T.length===0)return;C.forEach(D=>g.current.add(D.key)),T.forEach(D=>x.current.add(D.public_key)),(async()=>{const D=[...C.map(N=>({type:"CHAN",conversation_key:N.key})),...T.map(N=>({type:"PRIV",conversation_key:N.public_key}))];if(D.length!==0)try{const F={};for(let W=0;W<D.length;W+=200){const U=D.slice(W,W+200),X=await dt.getMessagesBulk(U,fv);Object.assign(F,X)}const z={},I={},K={};for(const W of C){const U=F[`CHAN:${W.key}`]||[];if(U.length>0){const X=Ii("channel",W.key),$=W.last_read_at||0,ee=U.filter(Z=>!Z.outgoing&&Z.received_at>$);ee.length>0&&(z[X]=ee.length,ee.some(Z=>_b(Z.text,p.current))&&(I[X]=!0));const le=Math.max(...U.map(Z=>Z.received_at));K[X]=le,Gg(X,le)}}for(const W of T){const U=F[`PRIV:${W.public_key}`]||[];if(U.length>0){const X=Ii("contact",W.public_key),$=W.last_read_at||0,ee=U.filter(Z=>!Z.outgoing&&Z.received_at>$);ee.length>0&&(z[X]=ee.length,ee.some(Z=>_b(Z.text,p.current))&&(I[X]=!0));const le=Math.max(...U.map(Z=>Z.received_at));K[X]=le,Gg(X,le)}}Object.keys(z).length>0&&s(W=>({...W,...z})),Object.keys(I).length>0&&a(W=>({...W,...I})),f(bb())}catch(N){console.error("Failed to fetch messages bulk:",N)}})()},[n,e]),R.useEffect(()=>{if(t&&t.type!=="raw"&&t.type!=="map"){const C=Ii(t.type,t.id);s(T=>{if(T[C]){const E={...T};return delete E[C],E}return T}),a(T=>{if(T[C]){const E={...T};return delete E[C],E}return T}),t.type==="channel"?dt.markChannelRead(t.id).catch(T=>{console.error("Failed to mark channel as read on server:",T)}):t.type==="contact"&&dt.markContactRead(t.id).catch(T=>{console.error("Failed to mark contact as read on server:",T)})}},[t]);const A=R.useCallback((C,T)=>{s(E=>({...E,[C]:(E[C]||0)+1})),T&&a(E=>({...E,[C]:!0}))},[]),_=R.useCallback(()=>{s({}),a({}),dt.markAllRead().catch(C=>{console.error("Failed to mark all as read on server:",C)})},[]),b=R.useCallback(C=>{if(C.type==="raw"||C.type==="map")return;const T=Ii(C.type,C.id);s(E=>{if(E[T]){const D={...E};return delete D[T],D}return E}),a(E=>{if(E[T]){const D={...E};return delete D[T],D}return E}),C.type==="channel"?dt.markChannelRead(C.id).catch(E=>{console.error("Failed to mark channel as read on server:",E)}):C.type==="contact"&&dt.markContactRead(C.id).catch(E=>{console.error("Failed to mark contact as read on server:",E)})},[]),w=R.useCallback(C=>{let T=null;if(C.type==="CHAN"&&C.conversation_key?T=Ii("channel",C.conversation_key):C.type==="PRIV"&&C.conversation_key&&(T=Ii("contact",C.conversation_key)),T){const E=C.received_at||Math.floor(Date.now()/1e3),D=Gg(T,E);f(D)}},[]);return{unreadCounts:i,mentions:o,lastMessageTimes:u,incrementUnread:A,markAllRead:_,markConversationRead:b,trackNewMessage:w}}var dv=Fk();const jk=Rc(dv);function vB(n){if(typeof document>"u")return;l
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 ZB=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),GB=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),Sb=n=>{const e=GB(n);return e.charAt(0).toUpperCase()+e.slice(1)},Qk=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim(),XB=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="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 KB={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 YB=R.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},u)=>R.createElement("svg",{ref:u,...KB,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:Qk("lucide",i),...!s&&!XB(a)&&{"aria-hidden":"true"},...a},[...o.map(([f,p])=>R.createElement(f,p)),...Array.isArray(s)?s:[s]]));/**
|
||||
* @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 pv=(n,e)=>{const t=R.forwardRef(({className:r,...i},s)=>R.createElement(YB,{ref:s,iconNode:e,className:Qk(`lucide-${ZB(Sb(n))}`,`lucide-${n}`,r),...i}));return t.displayName=Sb(n),t};/**
|
||||
* @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 JB=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],e4=pv("check",JB);/**
|
||||
* @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 t4=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],n4=pv("menu",t4);/**
|
||||
* @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 r4=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Hk=pv("x",r4);function i4({health:n,config:e,onSettingsClick:t,onMenuClick:r}){const i=(n==null?void 0:n.radio_connected)??!1,[s,o]=R.useState(!1),a=async()=>{o(!0);try{const u=await dt.reconnectRadio();u.connected&&kt.success("Reconnected",{description:u.message})}catch(u){kt.error("Reconnection failed",{description:u instanceof Error?u.message:"Check radio connection and power"})}finally{o(!1)}};return S.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[#252525] border-b border-[#333] text-xs",children:[r&&S.jsx("button",{onClick:r,className:"md:hidden p-1 bg-transparent border-none text-[#e0e0e0] cursor-pointer","aria-label":"Open menu",children:S.jsx(n4,{className:"h-5 w-5"})}),S.jsx("h1",{className:"text-base font-semibold mr-auto",children:"RemoteTerm"}),S.jsxs("div",{className:"flex items-center gap-1 text-[#888]",children:[S.jsx("div",{className:`w-2 h-2 rounded-full ${i?"bg-[#4caf50]":"bg-[#666]"}`}),S.jsx("span",{className:"hidden lg:inline text-[#e0e0e0]",children:i?"Connected":"Disconnected"})]}),e&&S.jsxs("div",{className:"hidden lg:flex items-center gap-2 text-[#888]",children:[S.jsx("span",{className:"text-[#e0e0e0]",children:e.name||"Unnamed"}),S.jsx("span",{className:"font-mono text-[#888] cursor-pointer hover:text-[#4a9eff]",onClick:()=>{navigator.clipboard.writeText(e.public_key),kt.success("Public key copied!")},title:"Click to copy public key",children:e.public_key.toLowerCase()})]}),!i&&S.jsx("button",{onClick:a,disabled:s,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:s?"Reconnecting...":"Reconnect"}),S.jsxs("button",{onClick:t,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",children:[S.jsx("span",{role:"img","aria-label":"Settings",children:"🔧"})," ","Radio & Config"]})]})}const s4=12;function o4(n){return n.slice(0,s4)}function ro(n,e){return n||o4(e)}const vc=2,a4={text:"🛜",background:"#444444",textColor:"#ffffff"};function l4(n){let e=0;for(let t=0;t<n.length;t++){const r=n.charCodeAt(t);e=(e<<5)-e+r,e=e&e}return Math.abs(e)}const c4=/[\u{1F1E0}-\u{1F1FF}]{2}|[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{1F600}-\u{1F64F}]|[\u{1F680}-\u{1F6FF}]/u;function u4(n,e){if(!n)return e.slice(0,2).toUpperCase();const t=n.match(c4);if(t)return t[0];const r=n.match(/[a-zA-Z]/g);if(!r||r.length===0)return e.slice(0,2).toUpperCase();const i=n.indexOf(" ");if(i!==-1){const s=r[0],o=n.slice(i+1).match(/[a-zA-Z]/);if(o)return(s+o[0]).toUpperCase()}return r[0].toUpperCase()}function h4(n){const e=l4(n),t=e%360,r=50+(e>>8)%30,i=35+(e>>16)%20,s=`hsl(${t}, ${r}%, ${i}%)`,o=i<45?"#ffffff":"#000000";return{background:s,text:o}}function f4(n,e,t){if(t===vc)return a4;const r=u4(n,e),i=h4(e);return{text:r,background:i.background,textColor:i.text}}function Yx({name:n,publicKey:e,size:t=28,contactType:r}){const i=f4(n,e,r);return S.jsx("div",{className:"flex items-center justify-center rounded-full font-semibold flex-shrink-0 select-none",style:{backgroundColor:i.background,color:i.textColor,width:t,height:t,fontSize:t*.45},children:i.text})}const Wk="remoteterm-favorites";function Ga(n,e,t){return n.some(r=>r.type===e&&r.id===t)}function d4(){try{const n=localStorage.getItem(Wk);return n?JSON.parse(n):[]}catch{return[]}}function Cb(){try{localStorage.removeItem(Wk)}catch{}}function qk(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=qk(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Vk(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=qk(n))&&(r&&(r+=" "),r+=e);return r}const p4=(n,e)=>{const t=new Array(n.length+e.length);for(let r=0;r<n.length;r++)t[r]=n[r];for(let r=0;r<e.length;r++)t[n.length+r]=e[r];return t},m4=(n,e)=>({classGroupId:n,validator:e}),$k=(n=new Map,e=null,t)=>({nextPart:n,validators:e,classGroupId:t}),J0="-",Tb=[],g4="arbitrary..",x4=n=>{const e=v4(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return y4(o);const a=o.split(J0),u=a[0]===""&&a.length>1?1:0;return Uk(a,u,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const u=r[o],f=t[o];return u?f?p4(f,u):u:f||Tb}return t[o]||Tb}}},Uk=(n,e,t)=>{if(n.length-e===0)return t.classGroupId;const i=n[e],s=t.nextPart.get(i);if(s){const f=Uk(n,e+1,s);if(f)return f}const o=t.validators;if(o===null)return;const a=e===0?n.join(J0):n.slice(e).join(J0),u=o.length;for(let f=0;f<u;f++){const p=o[f];if(p.validator(a))return p.classGroupId}},y4=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=n.slice(1,-1),t=e.indexOf(":"),r=e.slice(0,t);return r?g4+r:void 0})(),v4=n=>{const{theme:e,classLine truncated
|
||||
.`.concat(tD,` {
|
||||
overflow: hidden `).concat(r,`;
|
||||
padding-right: `).concat(a,"px ").concat(r,`;
|
||||
}
|
||||
body[`).concat(uc,`] {
|
||||
overflow: hidden `).concat(r,`;
|
||||
overscroll-behavior: contain;
|
||||
`).concat([e&&"position: relative ".concat(r,";"),t==="margin"&&`
|
||||
padding-left: `.concat(i,`px;
|
||||
padding-top: `).concat(s,`px;
|
||||
padding-right: `).concat(o,`px;
|
||||
margin-left:0;
|
||||
margin-top:0;
|
||||
margin-right: `).concat(a,"px ").concat(r,`;
|
||||
`),t==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
||||
}
|
||||
|
||||
.`).concat(Yd,` {
|
||||
right: `).concat(a,"px ").concat(r,`;
|
||||
}
|
||||
|
||||
.`).concat(Jd,` {
|
||||
margin-right: `).concat(a,"px ").concat(r,`;
|
||||
}
|
||||
|
||||
.`).concat(Yd," .").concat(Yd,` {
|
||||
right: 0 `).concat(r,`;
|
||||
}
|
||||
|
||||
.`).concat(Jd," .").concat(Jd,` {
|
||||
margin-right: 0 `).concat(r,`;
|
||||
}
|
||||
|
||||
body[`).concat(uc,`] {
|
||||
`).concat(nD,": ").concat(a,`px;
|
||||
}
|
||||
`)},Vb=function(){var n=parseInt(document.body.getAttribute(uc)||"0",10);return isFinite(n)?n:0},bD=function(){R.useEffect(function(){return document.body.setAttribute(uc,(Vb()+1).toString()),function(){var n=Vb()-1;n<=0?document.body.removeAttribute(uc):document.body.setAttribute(uc,n.toString())}},[])},wD=function(n){var e=n.noRelative,t=n.noImportant,r=n.gapMode,i=r===void 0?"margin":r;bD();var s=R.useMemo(function(){return yD(i)},[i]);return R.createElement(vD,{styles:AD(s,!e,i,t?"":"!important")})},ty=!1;if(typeof window<"u")try{var yd=Object.defineProperty({},"passive",{get:function(){return ty=!0,!0}});window.addEventListener("test",yd,yd),window.removeEventListener("test",yd,yd)}catch{ty=!1}var ec=ty?{passive:!1}:!1,_D=function(n){return n.tagName==="TEXTAREA"},mS=function(n,e){if(!(n instanceof Element))return!1;var t=window.getComputedStyle(n);return t[e]!=="hidden"&&!(t.overflowY===t.overflowX&&!_D(n)&&t[e]==="visible")},OD=function(n){return mS(n,"overflowY")},kD=function(n){return mS(n,"overflowX")},$b=function(n,e){var t=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=gS(n,r);if(i){var s=xS(n,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==t.body);return!1},SD=function(n){var e=n.scrollTop,t=n.scrollHeight,r=n.clientHeight;return[e,t,r]},CD=function(n){var e=n.scrollLeft,t=n.scrollWidth,r=n.clientWidth;return[e,t,r]},gS=function(n,e){return n==="v"?OD(e):kD(e)},xS=function(n,e){return n==="v"?SD(e):CD(e)},TD=function(n,e){return n==="h"&&e==="rtl"?-1:1},ED=function(n,e,t,r,i){var s=TD(n,window.getComputedStyle(e).direction),o=s*r,a=t.target,u=e.contains(a),f=!1,p=o>0,g=0,x=0;do{if(!a)break;var A=xS(n,a),_=A[0],b=A[1],w=A[2],C=b-w-s*_;(_||C)&&gS(n,a)&&(g+=C,x+=_);var T=a.parentNode;a=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&a!==document.body||u&&(e.contains(a)||e===a));return(p&&Math.abs(g)<1||!p&&Math.abs(x)<1)&&(f=!0),f},vd=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},Ub=function(n){return[n.deltaX,n.deltaY]},Zb=function(n){return n&&"current"in n?n.current:n},PD=function(n,e){return n[0]===e[0]&&n[1]===e[1]},BD=function(n){return`
|
||||
.block-interactivity-`.concat(n,` {pointer-events: none;}
|
||||
.allow-interactivity-`).concat(n,` {pointer-events: all;}
|
||||
`)},RD=0,tc=[];function DD(n){var e=R.useRef([]),t=R.useRef([0,0]),r=R.useRef(),i=R.useState(RD++)[0],s=R.useState(pS)[0],o=R.useRef(n);R.useEffect(function(){o.current=n},[n]),R.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(i));var b=eD([n.lockRef.current],(n.shards||[]).map(Zb),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[n.inert,n.lockRef.current,n.shards]);var a=R.useCallback(function(b,w){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var C=vd(b),T=t.current,E="deltaX"in b?b.deltaX:T[0]-C[0],D="deltaY"in b?b.deltaY:T[1]-C[1],N,F=b.target,z=Math.abs(E)>Math.abs(D)?"h":"v";if("touches"in b&&z==="h"&&F.type==="range")return!1;var I=window.getSelection(),K=I&&I.anchorNode,W=K?K===F||K.contains(F):!1;if(W)return!1;var U=$b(z,F);if(!U)return!0;if(U?N=z:(N=z==="v"?"h":"v",U=$b(z,F)),!U)return!1;if(!r.current&&"changedTouches"in b&&(E||D)&&(r.current=N),!N)return!0;var X=r.current||N;return ED(X,w,b,X==="h"?E:D)},[]),u=R.useCallback(function(b){var w=b;if(!(!tc.length||tc[tc.length-1]!==s)){var C="deltaY"in w?Ub(w):vd(w),T=e.current.filter(function(N){return N.name===w.type&&(N.target===w.target||w.target===N.shadowParent)&&PD(N.delta,C)})[0];if(T&&T.should){w.cancelable&&w.preventDefault();return}if(!T){var E=(o.current.shards||[]).map(Zb).filter(Boolean).filter(function(N){return N.contains(w.target)}),D=E.length>0?a(w,E[0]):!o.current.noIsolation;D&&w.cancelable&&w.preventDefault()}}},[]),f=R.useCallback(function(b,w,C,T){var E={name:b,delta:w,target:C,should:T,shadowParent:MD(C)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(D){return D!==E})},1)},[]),p=R.useCallback(function(b){t.current=vd(b),r.current=void 0},[]),g=R.useCallback(function(b){f(b.type,Ub(b),b.target,a(b,n.lockRef.current))},[]),x=R.useCallback(function(b){f(b.type,vd(b),b.target,a(b,n.lockRef.current))},[]);R.useEffect(function(){return tc.push(s),n.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:x}),document.addEventListener("wheel",u,ec),document.addEventListener("touchmove",u,ec),document.addEventListener("touchstart",p,ec),function(){tc=tc.filter(function(b){return b!==s}),document.removeEventListener("wheel",u,ec),document.removeEventListener("touchmove",u,ec),document.removeEventListener("touchstart",p,ec)}},[]);var A=n.removeScrollBar,_=n.inert;return R.createElement(R.Fragment,null,_?R.createElement(s,{styles:BD(i)}):null,A?R.createElement(wD,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function MD(n){for(var e=null;n!==null;)n instanceof ShadowRoot&&(e=n.host,n=n.host),n=n.parentNode;return e}const ND=cD(dS,DD);var yS=R.forwardRef(function(n,e){return R.createElement(Ip,ps({},n,{ref:e,sideCar:ND}))});yS.classNames=Ip.classNames;var LD=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},nc=new WeakMap,Ad=new WeakMap,bd={},ix=0,vS=function(n){return n&&(n.host||vS(n.parentNode))},FD=function(n,e){return e.map(function(t){if(n.contains(t))return t;var r=vS(t);return r&&n.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",n,". Doing nothing"),null)}).filter(function(t){return!!t})},ID=function(n,e,t,r){var i=FD(e,Array.isArray(n)?n:[n]);bd[t]||(bd[t]=new WeakMap);var s=bd[t],o=[],a=new Set,u=new Set(i),f=function(g){!g||a.has(g)||(a.add(g),f(g.parentNode))};i.forEach(f);var p=function(g){!g||u.has(g)||Array.prototype.forEach.call(g.children,function(x){if(a.has(x))p(x);else try{var A=x.getAttribute(r),_=A!==null&&A!=="false",b=(nc.get(x)||0)+1,w=(s.get(x)||0)+1;nc.set(x,b),s.set(x,w),o.push(x),b===1&&_&&Ad.set(x,!0),w===1&&x.setAttribute(t,"true"),_||x.setAttribute(r,"true")}catch(C){console.error("aria-hidden: cannot operate on ",x,C)}})};return p(e),a.clear(),ix++,function(){o.forEach(function(g){var x=nc.get(g)-1,A=s.get(g)-1;nc.set(g,x),s.set(g,A),x||(Ad.has(g)||g.removeAttribute(r),Ad.delete(g)),A||g.removeAttribute(t)}),ix--,ix||(nc=new WeakMap,nc=new WeakMap,Ad=new WeakMap,bd={})}},zD=function(n,e,t){t===void 0&&(t="data-aria-hidden");var r=Array.from(Array.isArray(n)?n:[n]),i=LD(n);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),ID(r,i,t,"aria-hidden")):function(){return null}};function jD(n){const e=QD(n),t=R.forwardRef((r,i)=>{const{children:s,...o}=r,a=R.Children.toArray(s),u=a.find(WD);if(u){const f=u.props.children,p=a.map(g=>g===u?R.Children.count(f)>1?R.Children.only(null):R.isValidElement(f)?f.props.children:null:g);return S.jsx(e,{...o,ref:i,children:R.isValidElement(f)?R.cloneElement(f,void 0,p):null})}return S.jsx(e,{...o,ref:i,children:s})});return t.displayName=`${n}.Slot`,t}function QD(n){const e=R.forwardRef((t,r)=>{const{children:i
Line truncated
|
||||
|
||||
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||||
|
||||
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return R.useEffect(()=>{n&&(document.getElementById(n)||console.error(t))},[t,n]),null},e5="DialogDescriptionWarning",t5=({contentRef:n,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${MS(e5).contentName}}.`;return R.useEffect(()=>{var s;const i=(s=n.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,n,e]),null},NS=bS,LS=OS,jp=kS,Qp=SS,Hp=TS,Wp=PS,FS=RS;const bv=NS,n5=LS,IS=R.forwardRef(({className:n,...e},t)=>S.jsx(jp,{ref:t,className:vt("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",n),...e}));IS.displayName=jp.displayName;const qp=R.forwardRef(({className:n,children:e,...t},r)=>S.jsxs(n5,{children:[S.jsx(IS,{}),S.jsxs(Qp,{ref:r,className:vt("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",n),...t,children:[e,S.jsxs(FS,{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:[S.jsx(Hk,{className:"h-4 w-4"}),S.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));qp.displayName=Qp.displayName;const Vp=({className:n,...e})=>S.jsx("div",{className:vt("flex flex-col space-y-1.5 text-center sm:text-left",n),...e});Vp.displayName="DialogHeader";const wv=({className:n,...e})=>S.jsx("div",{className:vt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e});wv.displayName="DialogFooter";const $p=R.forwardRef(({className:n,...e},t)=>S.jsx(Hp,{ref:t,className:vt("text-lg font-semibold leading-none tracking-tight",n),...e}));$p.displayName=Hp.displayName;const Up=R.forwardRef(({className:n,...e},t)=>S.jsx(Wp,{ref:t,className:vt("text-sm text-muted-foreground",n),...e}));Up.displayName=Wp.displayName;function r5(){const n=window.location.hash.slice(1);if(!n)return null;if(n==="raw")return{type:"raw",name:"raw"};if(n==="map")return{type:"map",name:"map"};if(n==="visualizer")return{type:"visualizer",name:"visualizer"};if(n.startsWith("map/focus/")){const i=n.slice(10);return i?{type:"map",name:"map",mapFocusKey:decodeURIComponent(i)}:{type:"map",name:"map"}}const e=n.indexOf("/");if(e===-1)return null;const t=n.slice(0,e),r=decodeURIComponent(n.slice(e+1));return(t==="channel"||t==="contact")&&r?{type:t,name:r}:null}function zS(n){return`#map/focus/${encodeURIComponent(n)}`}function i5(n){if(!n)return"";if(n.type==="raw")return"#raw";if(n.type==="map")return"#map";if(n.type==="visualizer")return"#visualizer";const e=n.type==="channel"&&n.name.startsWith("#")?n.name.slice(1):n.name;return`#${n.type}/${encodeURIComponent(e)}`}function s5(n){const e=i5(n);e!==window.location.hash&&window.history.replaceState(null,"",e||window.location.pathname)}function o5({open:n,onClose:e,paths:t,senderInfo:r,contacts:i,config:s}){const o=t.map(u=>({...u,resolved:xR(u.path,r,i,s)})),a=t.length===1;return S.jsx(bv,{open:n,onOpenChange:u=>!u&&e(),children:S.jsxs(qp,{className:"max-w-md max-h-[80vh] flex flex-col",children:[S.jsxs(Vp,{children:[S.jsxs($p,{children:["Message Path",!a&&`s (${t.length})`]}),S.jsx(Up,{children:a?S.jsxs(S.Fragment,{children:["This shows ",S.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."]}):S.jsxs(S.Fragment,{children:["This message was received via ",S.jsxs("strong",{children:[t.length," different routes"]}),". Routers may be incorrectly identified due to prefix collisions."]})})]}),S.jsxs("div",{className:"flex-1 overflow-y-auto py-2 space-y-4",children:[o.map((u,f)=>S.jsxs("div",{children:[!a&&S.jsxs("div",{className:"text-xs text-muted-foreground font-medium mb-2 pb-1 border-b border-border",children:["Path ",f+1," — received ",Ac(u.received_at)]}),S.jsx(a5,{resolved:u.resolved,senderInfo:r,hideStraightLine:!a})]},f)),!a&&o.length>0&&(()=>{const u=o[0].resolved;return jt(u.sender.lat,u.sender.lon)&&jt(u.receiver.lat,u.receiver.lon)?S.jsxs("div",{className:"pt-3 mt-1 border-t border-border",children:[S.jsx("span",{className:"text-sm text-muted-foreground",children:"Straight-line distance: "}),S.jsx("span",{className:"text-sm font-medium",c
Line truncated
|
||||
`).map((Y,ue,pe)=>S.jsxs("span",{children:[u5(Y,a),ue<pe.length-1&&S.jsx("br",{})]},ue)),!ne&&S.jsxs(S.Fragment,{children:[S.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:Ac(I.sender_timestamp||I.received_at)}),!I.outgoing&&I.paths&&I.paths.length>0&&S.jsx(Xb,{paths:I.paths,variant:"inline",onClick:()=>b({paths:I.paths,senderInfo:N(I,W,X)})})]}),I.outgoing&&(I.acked>0?` ✓${I.acked>1?I.acked:""}`:" ?")]})]})]},I.id)})]}),x&&S.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:S.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:S.jsx("polyline",{points:"6 9 12 15 18 9"})})}),_&&S.jsx(o5,{open:!0,onClose:()=>b(null),paths:_.paths,senderInfo:_.senderInfo,contacts:e,config:u??null})]})}const Kb=156,f5=140,d5=156,p5=120,m5=8,g5=R.forwardRef(function({onSend:e,disabled:t,placeholder:r,isRepeaterMode:i,conversationType:s,senderName:o},a){const[u,f]=R.useState(""),[p,g]=R.useState(!1),x=R.useRef(null);R.useImperativeHandle(a,()=>({appendText:N=>{var F;f(z=>z+N),(F=x.current)==null||F.focus()}}));const A=R.useMemo(()=>{if(s==="contact")return{warningAt:f5,dangerAt:Kb,hardLimit:Kb};if(s==="channel"){const N=(o==null?void 0:o.length)??10,F=Math.max(1,d5-N-2);return{warningAt:p5,dangerAt:Math.max(1,F-m5),hardLimit:F}}return null},[s,o]),{limitState:_,warningMessage:b}=R.useMemo(()=>{if(!A)return{limitState:"normal",warningMessage:null};const N=u.length;return N>=A.hardLimit?{limitState:"error",warningMessage:"likely truncated by radio"}:N>=A.dangerAt?{limitState:"danger",warningMessage:"may impact multi-repeater hop delivery"}:N>=A.warningAt?{limitState:"warning",warningMessage:"may impact multi-repeater hop delivery"}:{limitState:"normal",warningMessage:null}},[u.length,A]),w=A?A.hardLimit-u.length:0,C=R.useCallback(async N=>{N.preventDefault();const F=u.trim();if(i){if(p||t)return;g(!0);try{await e(F),f("")}catch(z){console.error("Failed to request telemetry:",z),kt.error("Failed to request telemetry",{description:z instanceof Error?z.message:"Check radio connection"});return}finally{g(!1)}setTimeout(()=>{var z;return(z=x.current)==null?void 0:z.focus()},0)}else{if(!F||p||t)return;g(!0);try{await e(F),f("")}catch(z){console.error("Failed to send message:",z),kt.error("Failed to send message",{description:z instanceof Error?z.message:"Check radio connection"});return}finally{g(!1)}setTimeout(()=>{var z;return(z=x.current)==null?void 0:z.focus()},0)}},[u,p,t,e,i]),T=R.useCallback(N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),C(N))},[C]),E=i?!0:u.trim().length>0,D=!i&&A!==null;return S.jsxs("form",{className:"px-4 py-3 border-t border-border flex flex-col gap-1",onSubmit:C,children:[S.jsxs("div",{className:"flex gap-2",children:[S.jsx(xn,{ref:x,type:i?"password":"text",autoComplete:i?"off":void 0,value:u,onChange:N=>f(N.target.value),onKeyDown:T,placeholder:r||(i?"Enter password for admin login...":"Type a message..."),disabled:t||p,className:"flex-1 min-w-0"}),S.jsx(yn,{type:"submit",disabled:t||p||!E,className:"flex-shrink-0",children:p?i?"Logging in...":"Sending...":i?u.trim()?"Log in with password":"Log in as guest/use repeater ACLs":"Send"})]}),D&&S.jsxs("div",{className:"flex items-center justify-end gap-2 text-xs",children:[S.jsxs("span",{className:vt("tabular-nums",_==="error"||_==="danger"?"text-red-500 font-medium":_==="warning"?"text-yellow-500":"text-muted-foreground"),children:[u.length,"/",A.hardLimit,w<0&&` (${w})`]}),b&&S.jsxs("span",{className:vt(_==="error"?"text-red-500":"text-yellow-500"),children:["— ",b]})]})]})});function Yb(n){const e=x5(n),t=R.forwardRef((r,i)=>{const{children:s,...o}=r,a=R.Children.toArray(s),u=a.find(v5);if(u){const f=u.props.children,p=a.map(g=>g===u?R.Children.count(f)>1?R.Children.only(null):R.isValidElement(f)?f.props.children:null:g);return S.jsx(e,{...o,ref:i,children:R.isValidElement(f)?R.cloneElement(f,void 0,p):null})}return S.jsx(e,{...o,ref:i,children:s})});return t.displayName=`${n}.Slot`,t}function x5(n){const e=R.forwardRef((t,r)=>{const{children:i,...s}=t;if(R.isValidElement(i)){const o=b5(i),a=A5(s,i.props);return i.type!==R.Fragment&&(a.ref=r?Nh(r,o):o),R.cloneElement(i,a)}return R.Children.count(i)>1?R.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var y5=Symbol("radix.slottable");function v5(n){return R.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===y5}function A5(n,e){const t={...e};for(const r in e){const i=n[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?t[r]=(...a)=>{const u=s(...a);return i(...a),u}:i&&(t[r]=i):r==="style"?t[r]={...i,...s}:r==="className"&&(t[r]=[i,s].filter(Boolean).join(" "))}return{...n,...t}}function
Line truncated
|
||||
`){[e,t]=_c(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],u=s+a.length;s>e&&o&&(i+=r),e<u&&t>s&&(i+=a.slice(Math.max(0,e-s),t-s)),s=u+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(t.push(new bn(r,i)),r=[],i=-1);return i>-1&&t.push(new bn(r,i)),t}}class ms extends Lt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,u=r+o.lines-1;if((t?u:a)>=e)return o.lineInner(e,t,r,i);i=a+1,r=u+1}}decompose(e,t,r,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],u=o+a.length;if(e<=u&&t>=o){let f=i&((o<=e?1:0)|(u>=t?2:0));o>=e&&u<=t&&!f?r.push(a):a.decompose(e-o,t-o,r,f)}o=u+1}}replace(e,t,r){if([e,t]=_c(this,e,t),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&t<=a){let u=o.replace(e-s,t-s,r),f=this.lines-o.lines+u.lines;if(u.lines<f>>4&&u.lines>f>>6){let p=this.children.slice();return p[i]=u,new ms(p,this.length-(t-e)+r.length)}return super.replace(s,a,u)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
|
||||
`){[e,t]=_c(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],u=o+a.length;o>e&&s&&(i+=r),e<u&&t>o&&(i+=a.sliceString(e-o,t-o,r)),o=u+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ms))return 0;let r=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return r;let u=this.children[i],f=e.children[s];if(u!=f)return r+u.scanIdentical(f,t);r+=u.length+1}}static from(e,t=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let A of e)r+=A.lines;if(r<32){let A=[];for(let _ of e)_.flatten(A);return new bn(A,t)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],u=0,f=-1,p=[];function g(A){let _;if(A.lines>s&&A instanceof ms)for(let b of A.children)g(b);else A.lines>o&&(u>o||!u)?(x(),a.push(A)):A instanceof bn&&u&&(_=p[p.length-1])instanceof bn&&A.lines+_.lines<=32?(u+=A.lines,f+=A.length+1,p[p.length-1]=new bn(_.text.concat(A.text),_.length+1+A.length)):(u+A.lines>i&&x(),u+=A.lines,f+=A.length+1,p.push(A))}function x(){u!=0&&(a.push(p.length==1?p[0]:ms.from(p,f)),f=-1,u=p.length=0)}for(let A of e)g(A);return x(),a.length==1?a[0]:new ms(a,t)}}Lt.empty=new bn([""],0);function e3(n){let e=-1;for(let t of n)e+=t.length+1;return e}function e0(n,e,t=0,r=1e9){for(let i=0,s=0,o=!0;s<n.length&&i<=r;s++){let a=n[s],u=i+a.length;u>=t&&(u>r&&(a=a.slice(0,r-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=u+1}return e}function nw(n,e,t){return e0(n,[""],e,t)}class sh{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof bn?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof bn?i.text.length:i.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;e--}else if(i instanceof bn){let u=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,u.length>Math.max(0,e))return this.value=e==0?u:t>0?u.slice(e):u.slice(0,u.length-e),this;e-=u.length}else{let u=i.children[o+(t<0?-1:0)];e>u.length?(e-=u.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(u),this.offsets.push(t>0?1:(u instanceof bn?u.text.length:u.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class v2{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new sh(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=r?i:t<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class A2{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Lt.prototype[Symbol.iterator]=function(){return this.iter()},sh.prototype[Symbol.iterator]=v2.prototype[Symbol.iterator]=A2.prototype[Symbol.iterator]=function(){return this});class t3{constructor(e,t,r,i){this.from=e,this.to=t,this.number=r,this.text=i}get length(){return this.to-this.from}}function _c(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Fn(n,e,t=!0,r=!0){return Y5(n,e,t,r)}function n3(n){return n>=56320&&n<57344}function r3(n){return n>=55296&&n<56320}function Mr(n,e){let t=n.charCodeAt(e);if(!r3(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return n3(r)?(t-55296<<10)+(r-56320)+65536:t}function Cv(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function gs(n){return n<65536?1:2}const oy=/\r\n?|\n/;var er=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(er||(er={}));class bs{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,t=!1){ay(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?e.push(r,i):e.push(i,r)}return new bs(e)}composeDesc(e){return this.empty?e:e.empty?this:b2(this,e)}mapDesc(e,t=!1){return e.empty?this:ly(this,e,t)}mapPos(e,t=-1,r=er.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],u=this.sections[o++],f=i+a;if(u<0){if(f>e)return s+(e-i);s+=a}else{if(r!=er.Simple&&f>=e&&(r==er.TrackDel&&i<e&&f>e||r==er.TrackBefore&&i<e||r==er.TrackAfter&&f>e))return null;if(f>e||f==e&&t<0&&!a)return e==i||t<0?s:s+u;s+=u}i=f}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,i=0;r<this.sections.length&&i<=t;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new bs(e)}static create(e){return new bs(e)}}class Ln extends bs{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return ay(this,(t,r,i,s,o)=>e=e.replace(i,i+(r-t),o),!1),e}mapDesc(e,t=!1){return ly(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let u=i>>1;for(;r.length<u;)r.push(Lt.empty);r.push(o?e.slice(s,s+o):Lt.empty)}s+=o}return new Ln(t,r)}compose(e){return this.empty?e:e.empty?this:b2(this,e,!0)}map(e,t=!1){return e.empty?this:ly(this,e,t,!0)}iterChanges(e,t=!1){ay(this,e,t)}get desc(){return bs
Line truncated
|
||||
`}get readOnly(){return this.facet(E2)}phrase(e,...t){for(let r of this.facet(Rt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let i=[];for(let s of this.facet(O2))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return p3(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let u=Fn(t,o,!1);if(s(t.slice(u,o))!=ln.Word)break;o=u}for(;a<i;){let u=Fn(t,a);if(s(t.slice(a,u))!=ln.Word)break;a=u}return o==a?null:we.range(o+r,a+r)}}Rt.allowMultipleSelections=hy;Rt.tabSize=je.define({combine:n=>n.length?n[0]:4});Rt.lineSeparator=k2;Rt.readOnly=E2;Rt.phrases=je.define({compare(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length==r.length&&t.every(i=>n[i]==e[i])}});Rt.languageData=O2;Rt.changeFilter=S2;Rt.transactionFilter=C2;Rt.transactionExtender=T2;Kp.reconfigure=ft.define();function Os(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class na{eq(e){return this==e}range(e,t=e){return py.create(e,t,this)}}na.prototype.startSide=na.prototype.endSide=0;na.prototype.point=!1;na.prototype.mapMode=er.TrackDel;function Pv(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let py=class R2{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new R2(e,t,r)}};function my(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Bv{constructor(e,t,r,i){this.from=e,this.to=t,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let u=o+a>>1,f=s[u]-e||(r?this.value[u].endSide:this.value[u].startSide)-t;if(u==o)return f>=0?o:a;f>=0?a=u:o=u+1}}between(e,t,r,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],i=[],s=[],o=-1,a=-1;for(let u=0;u<this.value.length;u++){let f=this.value[u],p=this.from[u]+e,g=this.to[u]+e,x,A;if(p==g){let _=t.mapPos(p,f.startSide,f.mapMode);if(_==null||(x=A=_,f.startSide!=f.endSide&&(A=t.mapPos(p,f.endSide),A<x)))continue}else if(x=t.mapPos(p,f.startSide),A=t.mapPos(g,f.endSide),x>A||x==A&&f.startSide>0&&f.endSide<=0)continue;(A-x||f.endSide-f.startSide)<0||(o<0&&(o=x),f.point&&(a=Math.max(a,A-x)),r.push(f),i.push(x-o),s.push(A-o))}return{mapped:r.length?new Bv(i,s,r,a):null,pos:o}}}class Tt{constructor(e,t,r,i){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=i}static create(e,t,r,i){return new Tt(e,t,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(my)),this.isEmpty)return t.length?Tt.of(t):this;let a=new D2(this,null,-1).goto(0),u=0,f=[],p=new so;for(;a.value||u<t.length;)if(u<t.length&&(a.from-t[u].from||a.startSide-t[u].value.startSide)>=0){let g=t[u++];p.addInner(g.from,g.to,g.value)||f.push(g)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(u==t.length||this.chunkEnd(a.chunkIndex)<t[u].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&p.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(p.addInner(a.from,a.to,a.value)||f.push(py.create(a.from,a.to,a.value))),a.next());return p.finishInner(this.nextLayer.isEmpty&&!f.length?Tt.empty:this.nextLayer.update({add:f,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],u=this.chunk[o],f=e.touchesRange(a,a+u.length);if(f===!1)i=Math.max(i,u.maxPoint),t.push(u),r.push(e.mapPos(a));else if(f===!0){let{mapped:p,pos:g}=u.map(a,e);p&&(i=Math.max(i,p.maxPoint),t.push(p),r.push(g))}}let s=this.nextLayer.map(e);return t.length==0?s:new Tt(r,t,s||Tt.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return ph.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return ph.from(e).goto(t)}static compare(e,t,r,i,s=-1){let o=e.filter(g=>g.maxPoint>0||!g.isEmpty
Line truncated
|
||||
`)}static newName(){let e=lw[aw]||1;return lw[aw]=e+1,yy+e.toString(36)}static mount(e,t,r){let i=e[vy],s=r&&r.nonce;i?s&&i.setNonce(s):i=new g3(e,s),i.mount(Array.isArray(t)?t:[t],e)}}let cw=new Map;class g3{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=cw.get(r);if(s)return e[vy]=s;this.sheet=new i.CSSStyleSheet,cw.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[vy]=this}mount(e,t){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],u=this.modules.indexOf(a);if(u<s&&u>-1&&(this.modules.splice(u,1),s--,u=-1),u==-1){if(this.modules.splice(s++,0,a),r)for(let f=0;f<a.rules.length;f++)r.insertRule(a.rules[f],i++)}else{for(;s<u;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let u=0;u<this.modules.length;u++)o+=this.modules[u].getRules()+`
|
||||
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var ia={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},mh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},x3=typeof navigator<"u"&&/Mac/.test(navigator.platform),y3=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Jn=0;Jn<10;Jn++)ia[48+Jn]=ia[96+Jn]=String(Jn);for(var Jn=1;Jn<=24;Jn++)ia[Jn+111]="F"+Jn;for(var Jn=65;Jn<=90;Jn++)ia[Jn]=String.fromCharCode(Jn+32),mh[Jn]=String.fromCharCode(Jn);for(var lx in ia)mh.hasOwnProperty(lx)||(mh[lx]=ia[lx]);function v3(n){var e=x3&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||y3&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?mh:ia)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Vt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];typeof i=="string"?n.setAttribute(r,i):i!=null&&(n[r]=i)}e++}for(;e<arguments.length;e++)M2(n,arguments[e]);return n}function M2(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)M2(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let Ar=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Ay=typeof document<"u"?document:{documentElement:{style:{}}};const by=/Edge\/(\d+)/.exec(Ar.userAgent),N2=/MSIE \d/.test(Ar.userAgent),wy=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ar.userAgent),Yp=!!(N2||wy||by),uw=!Yp&&/gecko\/(\d+)/i.test(Ar.userAgent),cx=!Yp&&/Chrome\/(\d+)/.exec(Ar.userAgent),A3="webkitFontSmoothing"in Ay.documentElement.style,_y=!Yp&&/Apple Computer/.test(Ar.vendor),hw=_y&&(/Mobile\/\w+/.test(Ar.userAgent)||Ar.maxTouchPoints>2);var He={mac:hw||/Mac/.test(Ar.platform),windows:/Win/.test(Ar.platform),linux:/Linux|X11/.test(Ar.platform),ie:Yp,ie_version:N2?Ay.documentMode||6:wy?+wy[1]:by?+by[1]:0,gecko:uw,gecko_version:uw?+(/Firefox\/(\d+)/.exec(Ar.userAgent)||[0,0])[1]:0,chrome:!!cx,chrome_version:cx?+cx[1]:0,ios:hw,android:/Android\b/.test(Ar.userAgent),webkit_version:A3?+(/\bAppleWebKit\/(\d+)/.exec(Ar.userAgent)||[0,0])[1]:0,safari:_y,safari_version:_y?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Ar.userAgent)||[0,0])[1]:0,tabSize:Ay.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Rv(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const ip=Object.create(null);function Dv(n,e,t){if(n==e)return!0;n||(n=ip),e||(e=ip);let r=Object.keys(n),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=t&&(i.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function b3(n,e){for(let t=n.attributes.length-1;t>=0;t--){let r=n.attributes[t].name;e[r]==null&&n.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?n.style.cssText=r:n.getAttribute(t)!=r&&n.setAttribute(t,r)}}function fw(n,e,t){let r=!1;if(e)for(let i in e)t&&i in t||(r=!0,i=="style"?n.style.cssText="":n.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(r=!0,i=="style"?n.style.cssText=t[i]:n.setAttribute(i,t[i]));return r}function w3(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];e[r.name]=r.value}return e}class $i{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var tr=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(tr||(tr={}));class Je extends na{constructor(e,t,r,i){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Ih(e)}Line truncated
|
||||
`,i=n.state.doc.line(i.number+(t?1:-1)),s=n.bidiSpans(i),f=n.visualLineSide(i,!t)}if(u){if(!u(p))return a}else{if(!r)return f;u=r(p)}a=f}}function u8(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let o=r(s);return i==ln.Space&&(i=o),i==o}}function h8(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return we.cursor(i,e.assoc);let o=e.goalColumn,a,u=n.contentDOM.getBoundingClientRect(),f=n.coordsAtPos(i,e.assoc||-1),p=n.documentTop;if(f)o==null&&(o=f.left-u.left),a=s<0?f.top:f.bottom;else{let _=n.viewState.lineBlockAt(i);o==null&&(o=Math.min(u.right-u.left,n.defaultCharacterWidth*(i-_.from))),a=(s<0?_.top:_.bottom)+p}let g=u.left+o,x=r??n.viewState.heightOracle.textHeight>>1,A=By(n,{x:g,y:a+x*s},!1,s);return we.cursor(A.pos,A.assoc,void 0,o)}function uh(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let u=r||t||(e-s<o-e?-1:1);e=u<0?s:o,r=u}});if(!r)return e}}function cC(n,e){let t=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=uh(n,i.from,0);o!=i.from&&(s=we.cursor(o,-1))}else{let o=uh(n,i.from,-1),a=uh(n,i.to,1);(o!=i.from||a!=i.to)&&(s=we.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?we.create(t,e.mainIndex):e}function px(n,e,t){let r=uh(n.state.facet(jh).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:we.cursor(r,r<t.from?1:-1)}class xs{constructor(e,t){this.pos=e,this.assoc=t}}function By(n,e,t,r){let i=n.contentDOM.getBoundingClientRect(),s=i.top+n.viewState.paddingTop,{x:o,y:a}=e,u=a-s,f;for(;;){if(u<0)return new xs(0,1);if(u>n.viewState.docHeight)return new xs(n.state.doc.length,-1);if(f=n.elementAtHeight(u),r==null)break;if(f.type==tr.Text){let x=n.docView.coordsAt(r<0?f.from:f.to,r);if(x&&(r<0?x.top<=u+s:x.bottom>=u+s))break}let g=n.viewState.heightOracle.textHeight/2;u=r>0?f.bottom+g:f.top-g}if(n.viewport.from>=f.to||n.viewport.to<=f.from){if(t)return null;if(f.type==tr.Text){let g=l8(n,i,f,o,a);return new xs(g,g==f.from?1:-1)}}if(f.type!=tr.Text)return u<(f.top+f.bottom)/2?new xs(f.from,1):new xs(f.to,-1);let p=n.docView.lineAt(f.from,2);return(!p||p.length!=f.length)&&(p=n.docView.lineAt(f.from,-2)),uC(n,p,f.from,o,a)}function uC(n,e,t,r,i){let s=-1,o=null,a=1e9,u=1e9,f=i,p=i,g=(x,A)=>{for(let _=0;_<x.length;_++){let b=x[_];if(b.top==b.bottom)continue;let w=b.left>r?b.left-r:b.right<r?r-b.right:0,C=b.top>i?b.top-i:b.bottom<i?i-b.bottom:0;b.top<=p&&b.bottom>=f&&(f=Math.min(b.top,f),p=Math.max(b.bottom,p),C=0),(s<0||(C-u||w-a)<0)&&(s>=0&&u&&a<w&&o.top<=p-2&&o.bottom>=f+2?u=0:(s=A,a=w,u=C,o=b))}};if(e.isText()){for(let A=0;A<e.length;){let _=Fn(e.text,A);if(g(yh(e.dom,A,_).getClientRects(),A),!a&&!u)break;A=_}return r>(o.left+o.right)/2==(Aw(n,s+t)==Zt.LTR)?new xs(t+Fn(e.text,s),-1):new xs(t+s,1)}else{if(!e.length)return new xs(t,1);for(let b=0;b<e.children.length;b++){let w=e.children[b];if(w.flags&48)continue;let C=(w.dom.nodeType==1?w.dom:yh(w.dom,0,w.length)).getClientRects();if(g(C,b),!a&&!u)break}let x=e.children[s],A=e.posBefore(x,t);return x.isComposite()||x.isText()?uC(n,x,A,Math.max(o.left,Math.min(o.right,r)),i):r>(o.left+o.right)/2==(Aw(n,s+t)==Zt.LTR)?new xs(A+x.length,-1):new xs(A,1)}}function Aw(n,e){let t=n.state.doc.lineAt(e);return n.bidiSpans(t)[io.find(n.bidiSpans(t),e-t.from,-1,1)].dir}const Ku="";class f8{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(Rt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ku}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=Tn.get(i),a=i.nextSibling;if(a==t){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let u=Tn.get(a);(o&&u?o.breakAfter:(o?o.breakAfter:sp(i))||sp(a)&&(i.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!p8(a,t)&&this.lineBreak(),i=a}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(r,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let u of this.points)u.node==e&&u.pos>this.text.length&&(u.pos-=o-1);r=s+o}}readNode(e){let t=Tn.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(d8(e,r.node,r.offset)?t:0))}}fun
Line truncated
|
||||
`&&n.lineWrapping&&(r&&(r=we.single(r.main.anchor-1,r.main.head-1)),t={from:i.from,to:i.to,insert:Lt.of([" "])}),t)return jv(n,t,r,s);if(r&&!cp(r,i)){let o=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=cC(n.state.facet(jh).map(u=>u(n)),r))),n.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function jv(n,e,t,r=-1){if(He.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(He.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&n.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&dc(n.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&dc(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&dc(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,a=()=>o||(o=g8(n,e,t));return n.state.facet(K2).some(u=>u(n,e.from,e.to,s,a))||n.dispatch(a()),!0}function g8(n,e,t){let r,i=n.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let u=e.from<s.from?-1:1,f=u<0?s.from:s.to,p=uh(i.facet(jh).map(g=>g(n)),f,u);e.from==p&&(o=p)}if(o>-1)r={changes:e,selection:we.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let u=s.from<e.from?i.sliceDoc(s.from,e.from):"",f=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(n.state.toText(u+e.insert.sliceString(0,void 0,n.state.lineBreak)+f))}else{let u=i.changes(e),f=t&&t.main.to<=u.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let p=n.state.sliceDoc(e.from,e.to),g,x=t&&lC(n,t.main.head);if(x){let _=e.insert.length-(e.to-e.from);g={from:x.from,to:x.to-_}}else g=n.state.doc.lineAt(s.head);let A=s.to-e.to;r=i.changeByRange(_=>{if(_.from==s.from&&_.to==s.to)return{changes:u,range:f||_.map(u)};let b=_.to-A,w=b-p.length;if(n.state.sliceDoc(w,b)!=p||b>=g.from&&w<=g.to)return{range:_};let C=i.changes({from:w,to:b,insert:e.insert}),T=_.to-s.to;return{changes:C,range:f?we.range(Math.max(0,f.anchor+T),Math.max(0,f.head+T)):_.map(C)}})}else r={changes:u,selection:f&&i.selection.replaceRange(f)}}let a="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,a+=".compose",n.inputState.compositionFirstChange&&(a+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function dC(n,e,t,r){let i=Math.min(n.length,e.length),s=0;for(;s<i&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&n.length==e.length)return null;let o=n.length,a=e.length;for(;o>0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let u=Math.max(0,s-Math.min(o,a));t-=o+u-s}if(o<s&&n.length<e.length){let u=t<=s&&t>=o?s-t:0;s-=u,a=s+(a-o),o=s}else if(a<s){let u=t<=s&&t>=a?s-t:0;s-=u,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function x8(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new bw(t,r)),(i!=t||s!=r)&&e.push(new bw(i,s))),e}function y8(n,e){if(n.length==0)return null;let t=n[0].pos,r=n.length==2?n[1].pos:t;return t>-1&&r>-1?we.single(t+e,r+e):null}function cp(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class v8{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,He.safari&&e.contentDOM.addEventListener("input",()=>null),He.gecko&&M8(e.contentDOM.ownerDocument)}handleEvent(e){!C8(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,t);for(let i of r.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=A8(e),r=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].
Line truncated
|
||||
`))};if((He.mac||He.android)&&g.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(g={from:a,to:u,insert:Lt.of([r.text.replace("."," ")])}),this.pendingContextChange=g,!e.state.readOnly){let x=this.to-this.from+(g.to-g.from+g.insert.length);jv(e,g,we.single(this.toEditorPos(r.selectionStart,x),this.toEditorPos(r.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),g.from<g.to&&!g.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let u=e.coordsForChar(o);s=u&&new DOMRect(u.left,u.top,u.right-u.left,u.bottom-u.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let u=this.toEditorPos(s.rangeStart),f=this.toEditorPos(s.rangeEnd);if(u<f){let p=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(Je.mark({attributes:{style:p}}).range(u,f))}}}e.dispatch({effects:nC.of(Je.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=Oc(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,u,f)=>{if(r)return;let p=f.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(f)){i=this.pendingContextChange=null,t+=p,this.to+=p;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=p,this.to+=p;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+f.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),f.toString()),this.to+=p}t+=p}),i&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ne{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measu
Line truncated
|
||||
--\u2028\u2029\uFEFF-]`,Fy),yM={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let xx=null;function vM(){var n;if(xx==null&&typeof document<"u"&&document.body){let e=document.body.style;xx=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return xx||!1}const i0=je.define({combine(n){let e=Os(n,{render:null,specialChars:xM,addSpecialChars:null});return(e.replaceTabs=!vM())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Fy)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Fy)),e}});function AM(n={}){return[i0.of(n),bM()]}let Ww=null;function bM(){return Ww||(Ww=_n.fromClass(class{constructor(n){this.view=n,this.decorations=Je.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(i0)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new gM({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=Mr(e[0],0);if(s==9){let o=i.lineAt(r),a=t.state.tabSize,u=Lc(o.text,a,r-o.from);return Je.replace({widget:new kM((a-u%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Je.replace({widget:new OM(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(i0);n.startState.facet(i0)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const wM="•";function _M(n){return n>=32?wM:n==10?"":String.fromCharCode(9216+n)}class OM extends $i{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=_M(this.code),r=e.state.phrase("Control character")+" "+(yM[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class kM extends $i{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function SM(){return TM}const CM=Je.line({class:"cm-activeLine"}),TM=_n.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let r of n.state.selection.ranges){let i=n.lineBlockAt(r.head);i.from>e&&(t.push(CM.range(i.from)),e=i.from)}return Je.set(t)}},{decorations:n=>n.decorations});class EM extends $i{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?lh(e.firstChild):[];if(!t.length)return null;let r=window.getComputedStyle(e.parentNode),i=xh(t[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function PM(n){let e=_n.fromClass(class{constructor(t){this.view=t,this.placeholder=n?Je.set([Je.widget({widget:new EM(n),side:1}).range(0)]):Je.none}get decorations(){return this.view.state.doc.length?Je.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,Ne.contentAttributes.of({"aria-placeholder":n})]:e}const Iy=2e3;function BM(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>Iy||t.off>Iy||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let u=r;u<=i;u++){let f=n.doc.line(u);f.length<=a&&s.push(we.range(f.from+o,f.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let u=r;u<=i;u++){let f=n.doc.line(u),p=xy(f.text,o,n.tabSize,!0);if(p<0)s.push(we.cursor(f.to));else{let g=xy(f.text,a,n.tabSize);s.push(we.range(f.from+p,f.from+g))}}}return s}function RM(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function qw(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),r=n.state.doc.lineAt(t),i=t-r.from,s=i>Iy?-1:i==r.length?RM(n,e.clientX):Lc(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function DM(n,e){let t
Line truncated
|
||||
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new $L(this):new WL(this)}getCursor(e,t=0,r){let i=e.doc?e:Rt.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?ic(this,i,t,r):rc(this,i,t,r)}}class UT{constructor(e){this.spec=e}}function QL(n,e,t){return(r,i,s,o)=>{if(t&&!t(r,i,s,o))return!1;let a=r>=o&&i<=o+s.length?s.slice(r-o,i-o):e.doc.sliceString(r,i);return n(a,e,r,i)}}function rc(n,e,t,r){let i;return n.wholeWord&&(i=HL(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(i=QL(n.test,e,i)),new Ec(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:s=>s.toLowerCase(),i)}function HL(n,e){return(t,r,i,s)=>((s>t||s+i.length<r)&&(s=Math.max(0,t-2),i=n.sliceString(s,Math.min(n.length,r+2))),(e(bp(i,t-s))!=ln.Word||e(wp(i,t-s))!=ln.Word)&&(e(wp(i,r-s))!=ln.Word||e(bp(i,r-s))!=ln.Word))}class WL extends UT{constructor(e){super(e)}nextMatch(e,t,r){let i=rc(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=rc(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=rc(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=rc(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=rc(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function qL(n,e,t){return(r,i,s)=>(!t||t(r,i,s))&&n(s[0],e,r,i)}function ic(n,e,t,r){let i;return n.wholeWord&&(i=VL(e.charCategorizer(e.selection.main.head))),n.test&&(i=qL(n.test,e,i)),new qT(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:i},t,r)}function bp(n,e){return n.slice(Fn(n,e,!1),e)}function wp(n,e){return n.slice(e,Fn(n,e))}function VL(n){return(e,t,r)=>!r[0].length||(n(bp(r.input,r.index))!=ln.Word||n(wp(r.input,r.index))!=ln.Word)&&(n(wp(r.input,r.index+r[0].length))!=ln.Word||n(bp(r.input,r.index+r[0].length))!=ln.Word)}class $L extends UT{nextMatch(e,t,r){let i=ic(this.spec,e,r,e.doc.length).next();return i.done&&(i=ic(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let s=Math.max(t,r-i*1e4),o=ic(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return t})}matchAll(e,t){let r=ic(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=ic(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Oh=ft.define(),nA=ft.define(),ea=$n.define({create(n){return new Rx(Xy(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Oh)?n=new Rx(t.value.create(),n.panel):t.is(nA)&&(n=new Rx(n.query,t.value?rA:null));return n},provide:n=>Ah.from(n,e=>e.panel)});class Rx{constructor(e,t){this.query=e,this.panel=t}}const UL=Je.mark({class:"cm-searchMatch"}),ZL=Je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),GL=_n.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(ea))}update(n){let e=n.state.field(ea);(e!=n.startState.field(ea)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Je.none;let{view:t}=this,r=new so;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:u}=s[i];for(;i<o-1&&u>s[i+1].from-500;)u=s[++i].to;n.highlight(t.state,a,u,(f,p)=>{let g=t.state.selection.ranges.some(x=>x.from==f&&x.to==p);r.add(f,p,g?ZL:UL)})}return r.finish()}},{decorations:n=>n.decorations});function Uh(n){return e=>{let t=e.state.field(ea,!1);return t&&t.query.spec.valid?n(e,t):XT(e)}}const _p=Uh((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=we.single(r.from,r.to),s=n.state.facet(Ic);return n.dispatch({selection:i,effects:[iA(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),GT(n),!0}),Op=Uh((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i
Line truncated
|
||||
|
||||
`,{label:"if",detail:"block",type:"keyword"}),$s("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),$s("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),$s("import ${module}",{label:"import",detail:"statement",type:"keyword"}),$s("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],n9=iF(kE,JT(e9.concat(t9)));function Hx(n){let{node:e,pos:t}=n,r=n.lineIndent(t,-1),i=null;for(;;){let s=e.childBefore(t);if(s)if(s.name=="Comment")t=s.from;else if(s.name=="Body"||s.name=="MatchBody")n.baseIndentFor(s)+n.unit<=r&&(i=s),e=s;else if(s.name=="MatchClause")e=s;else if(s.type.is("Statement"))e=s;else break;else break}return i}function Wx(n,e){let t=n.baseIndentFor(e),r=n.lineAt(n.pos,-1),i=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&n.node.to<i+100&&!/\S/.test(n.state.sliceDoc(i,n.node.to))&&n.lineIndent(n.pos,-1)<=t||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(n.textAfter)&&n.lineIndent(n.pos,-1)>t?null:t+n.unit}const qx=pp.define({name:"python",parser:Kz.configure({props:[ZC.add({Body:n=>{var e;let t=/^\s*(#|$)/.test(n.textAfter)&&Hx(n)||n.node;return(e=Wx(n,t))!==null&&e!==void 0?e:n.continue()},MatchBody:n=>{var e;let t=Hx(n);return(e=Wx(n,t||n.node))!==null&&e!==void 0?e:n.continue()},IfStatement:n=>/^\s*(else:|elif )/.test(n.textAfter)?n.baseIndent:n.continue(),"ForStatement WhileStatement":n=>/^\s*else:/.test(n.textAfter)?n.baseIndent:n.continue(),TryStatement:n=>/^\s*(except[ :]|finally:|else:)/.test(n.textAfter)?n.baseIndent:n.continue(),MatchStatement:n=>/^\s*case /.test(n.textAfter)?n.baseIndent+n.unit:n.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Sx({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Sx({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Sx({closing:"]"}),MemberExpression:n=>n.baseIndent+n.unit,"String FormatString":()=>null,Script:n=>{var e;let t=Hx(n);return(e=t&&Wx(n,t))!==null&&e!==void 0?e:n.continue()}}),KC.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":zN,Body:(n,e)=>({from:n.from+1,to:n.to-(n.to==e.doc.length?0:1)}),"String FormatString":(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function r9(){return new TN(qx,[qx.data.of({autocomplete:Jz}),qx.data.of({autocomplete:n9})])}var i9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],s9=i9.reduce((n,e)=>{const t=gv(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:o,...a}=i,u=o?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),S.jsx(u,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...n,[e]:r}},{}),o9="Separator",rO="horizontal",a9=["horizontal","vertical"],SE=R.forwardRef((n,e)=>{const{decorative:t,orientation:r=rO,...i}=n,s=l9(r)?r:rO,a=t?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return S.jsx(s9.div,{"data-orientation":s,...a,...i,ref:e})});SE.displayName=o9;function l9(n){return a9.includes(n)}var CE=SE;const $o=R.forwardRef(({className:n,orientation:e="horizontal",decorative:t=!0,...r},i)=>S.jsx(CE,{ref:i,decorative:t,orientation:e,className:vt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...r}));$o.displayName=CE.displayName;const Vx=[{name:"USA/Canada",freq:910.525,bw:62.5,sf:7,cr:5},{name:"Australia",freq:915.8,bw:250,sf:10,cr:5},{name:"Australia (narrow)",freq:916.575,bw:62.5,sf:7,cr:8},{name:"Australia SA, WA",freq:923.125,bw:62.5,sf:8,cr:8},{name:"Australia QLD",freq:923.125,bw:62.5,sf:8,cr:5},{name:"New Zealand",freq:917.375,bw:250,sf:11,cr:5},{name:"New Zealand (narrow)",freq:917.375,bw:62.5,sf:7,cr:5},{name:"EU/UK/Switzerland Long Range",freq:869.525,bw:250,sf:11,cr:5},{name:"EU/UK/Switzerland Medium Range",freq:869.525,bw:250,sf:10,cr:5},{name:"EU/UK/Switzerland Narrow",freq:869.618,bw:62.5,sf:8,cr:8},{name:"Czech Republic (Narrow)",freq:869.432,bw:62.5,sf:7,cr:5},{name:"EU 433MHz Long Range",freq:433.65,bw:250,sf:11,cr:5},{name:"Portugal 433MHz",freq:433.375,bw:62.5,sf:9,cr:6},{name:"Portugal 868MHz",freq:869.618,bw:62.5,sf:7,cr:6},{name:"Vietnam",freq:920.25,bw:250,sf:11,cr:5}];function c9({open:n,config:e,health:t,appSettings:r,onClose:i,onSave:s,onSaveAppSettings:o,onSetPrivateKey:a,onReboot:u,onAdvertise:f,onHealthRefresh:p,onRefreshAppSettings:g}){const[x,A]=R.useState("radio"),[_,b]=R.useState(""),[w,C]=R.useState(""),[T,E]=R.useState(""),[D,N]=R.useState(""),[F,z]=R.useState(""),[I,K]=R.useState(""),[W,U]=R.useState(""),[X,$]=R.useState(""),[ee,le]=R.useState(""),[Z,ie]=R.useState(""),[V,ne]=R.useState(!1),[q,B]=R.
Line truncated
|
||||
sender_name: str | None,
|
||||
sender_key: str | None,
|
||||
message_text: str,
|
||||
is_dm: bool,
|
||||
channel_key: str | None,
|
||||
channel_name: str | None,
|
||||
sender_timestamp: int | None,
|
||||
path: str | None,
|
||||
) -> str | list[str] | None:
|
||||
"""
|
||||
Process incoming messages and optionally return a reply.
|
||||
|
||||
Args:
|
||||
sender_name: Display name of sender (may be None)
|
||||
sender_key: 64-char hex public key (None for channel msgs)
|
||||
message_text: The message content
|
||||
is_dm: True for direct messages, False for channel
|
||||
channel_key: 32-char hex key for channels, None for DMs
|
||||
channel_name: Channel name with hash (e.g. "#bot"), None for DMs
|
||||
sender_timestamp: Sender's timestamp (unix seconds, may be None)
|
||||
path: Hex-encoded routing path (may be None)
|
||||
|
||||
Returns:
|
||||
None for no reply, a string for a single reply,
|
||||
or a list of strings to send multiple messages in order
|
||||
"""
|
||||
# Example: Only respond in #bot channel to "!pling" command
|
||||
if channel_name == "#bot" and "!pling" in message_text.lower():
|
||||
return "[BOT] Plong!"
|
||||
return None`,[ot,mt]=R.useState([]),[et,tt]=R.useState(null),[at,qe]=R.useState(null),[Dt,Jt]=R.useState("");R.useEffect(()=>{e&&(b(e.name),C(String(e.lat)),E(String(e.lon)),N(String(e.tx_power)),z(String(e.radio.freq)),K(String(e.radio.bw)),U(String(e.radio.sf)),$(String(e.radio.cr)))},[e]),R.useEffect(()=>{r&&(ie(String(r.max_radio_contacts)),Ce(r.auto_decrypt_dm_on_advert),pt(String(r.advert_interval)),mt(r.bots||[]))},[r]),R.useEffect(()=>{n&&g()},[n,g]);const dr=R.useMemo(()=>{const ae=parseFloat(F),De=parseFloat(I),wt=parseInt(W,10),Gt=parseInt(X,10);for(const On of Vx)if(On.freq===ae&&On.bw===De&&On.sf===wt&&On.cr===Gt)return On.name;return"custom"},[F,I,W,X]),en=ae=>{if(ae==="custom")return;const De=Vx.find(wt=>wt.name===ae);De&&(z(String(De.freq)),K(String(De.bw)),U(String(De.sf)),$(String(De.cr)))},vn=()=>{if(!navigator.geolocation){kt.error("Geolocation not supported",{description:"Your browser does not support geolocation"});return}ue(!0),navigator.geolocation.getCurrentPosition(ae=>{C(ae.coords.latitude.toFixed(6)),E(ae.coords.longitude.toFixed(6)),ue(!1),kt.success("Location updated")},ae=>{ue(!1),kt.error("Failed to get location",{description:ae.message})},{enableHighAccuracy:!0,timeout:1e4})},En=async()=>{ve(""),ne(!0);try{const ae={lat:parseFloat(w),lon:parseFloat(T),tx_power:parseInt(D,10),radio:{freq:parseFloat(F),bw:parseFloat(I),sf:parseInt(W,10),cr:parseInt(X,10)}};await s(ae),kt.success("Radio config saved, rebooting..."),ne(!1),B(!0),await u(),i()}catch(ae){ve(ae instanceof Error?ae.message:"Failed to save"),ne(!1)}finally{B(!1)}},Zn=async()=>{ve(""),ne(!0);try{await s({name:_});const De=parseInt(Ge,10);!isNaN(De)&&De!==(r==null?void 0:r.advert_interval)&&await o({advert_interval:De}),kt.success("Identity settings saved")}catch(ae){ve(ae instanceof Error?ae.message:"Failed to save")}finally{ne(!1)}},rn=async()=>{ve(""),ne(!0);try{const ae=parseInt(Z,10);!isNaN(ae)&&ae!==(r==null?void 0:r.max_radio_contacts)&&await o({max_radio_contacts:ae}),kt.success("Serial settings saved")}catch(ae){ve(ae instanceof Error?ae.message:"Failed to save")}finally{ne(!1)}},Qt=async()=>{if(!ee.trim()){ve("Private key is required");return}ve(""),ne(!0);try{await a(ee.trim()),le(""),kt.success("Private key set, rebooting..."),ne(!1),B(!0),await u(),i()}catch(ae){ve(ae instanceof Error?ae.message:"Failed to set private key"),ne(!1)}finally{B(!1)}},sn=async()=>{if(confirm("Are you sure you want to reboot the radio? The connection will drop temporarily.")){ve(""),B(!0);try{await u(),i()}catch(ae){ve(ae instanceof Error?ae.message:"Failed to reboot radio")}finally{B(!1)}}},pr=async()=>{G(!0);try{await f()}finally{G(!1)}},zn=async()=>{const ae=parseInt(xe,10);if(isNaN(ae)||ae<1){kt.error("Invalid retention days",{description:"Retention days must be at least 1"});return}Ke(!0);try{const De=await dt.runMaintenance(ae);kt.success("Database cleanup complete",{description:`Deleted ${De.packets_deleted} old packet${De.packets_deleted===1?"":"s"}`}),await p()}catch(De){console.error("Failed to run maintenance:",De),kt.error("Database cleanup failed",{description:De instanceof Error?De.message:"Unknown error"})}finally{Ke(!1)}},Ae=async()=>{ne(!0),ve("");try{await o({auto_decrypt_dm_on_advert:nt}),kt.success("Database settings saved")}catch(ae){console.error("Failed to save database settings:",ae),ve(ae instanceof Error?ae.message:"Failed to save"),kt.error("Failed to save settings")}finally{ne(!1)}},Te=async()=>{ne(!0),ve("");try{await o({bots:ot}),kt.success("Bot settings saved")}catch(ae){console.error("Failed to save bot settings:",ae);const De=ae instanceof Error?ae.message:"Failed to save";ve(De),kt.error(De)}finally{ne(!1)}},Ie=()=>{const ae={id:crypto.randomUUID(),name:`Bot ${ot.length+1}`,enabled:!1,code:bt};mt([...ot,ae]),tt(ae.id)},xt=ae=>{const De=ot.find(wt=>wt.id===ae);De&&De.code.trim()&&De.code!==bt&&!confirm(`Delete "${De.name}"? This will remove all its code.`)||(mt(ot.filter(wt=>wt.id!==ae)),et===ae&&tt(null))},se=ae=>{mt(ot.map(De=>De.id===ae?{...De,enabled:!De.enabled}:De))},be=(ae,De)=>{mt(ot.map(wt=>wt.id===ae?{...wt,code:De}:wt))},Oe=ae=>{qe(ae.id),Jt(ae.name)},Le=()=>{at&&Dt.trim()&&mt(ot.map(ae=>ae.id===at?{...ae,name:Dt.trim()}:ae)),qe(null),Jt("")},lt=ae=>{mt(ot.map(De=>De.id===ae?{...De,code:bt}:De))};return S.jsx(bv,{open:n,onOpenChange:ae=>!ae&&i(),children:S.jsxs(qp,{className:"sm:max-w-[50vw] sm:min-w-[500px] max-h-[90vh] overflow-y-auto",children:[S.jsxs(Vp,{children:[S.jsx($p,{children:"Radio & Settings"}),S.jsxs(Up,{className:"sr-only",children:[x==="radio"&&"Configure radio frequency, power, and location settings",x==="identity"&&"Manage radio name, public key, private key, and advertising settings",x==="serial"&&"View serial port connection and configure contact sync",x==="database"&&"View database statistics and clean up old packets",x==="advertise"&&"Send a flood advertisement to announce your presence",x==="bot"&&"Configure automatic message bot with Python code"]})]}),e?S.
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(r){var i=t,s=i.lib,o=s.WordArray,a=s.Hasher,u=i.algo,f=o.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]),p=o.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]),g=o.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]),x=o.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]),A=o.create([0,1518500249,1859775393,2400959708,2840853838]),_=o.create([1352829926,1548603684,1836072691,2053994217,0]),b=u.RIPEMD160=a.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(F,z){for(var I=0;I<16;I++){var K=z+I,W=F[K];F[K]=(W<<8|W>>>24)&16711935|(W<<24|W>>>8)&4278255360}var U=this._hash.words,X=A.words,$=_.words,ee=f.words,le=p.words,Z=g.words,ie=x.words,V,ne,q,B,Q,G,Y,ue,pe,ve;G=V=U[0],Y=ne=U[1],ue=q=U[2],pe=B=U[3],ve=Q=U[4];for(var xe,I=0;I<80;I+=1)xe=V+F[z+ee[I]]|0,I<16?xe+=w(ne,q,B)+X[0]:I<32?xe+=C(ne,q,B)+X[1]:I<48?xe+=T(ne,q,B)+X[2]:I<64?xe+=E(ne,q,B)+X[3]:xe+=D(ne,q,B)+X[4],xe=xe|0,xe=N(xe,Z[I]),xe=xe+Q|0,V=Q,Q=B,B=N(q,10),q=ne,ne=xe,xe=G+F[z+le[I]]|0,I<16?xe+=D(Y,ue,pe)+$[0]:I<32?xe+=E(Y,ue,pe)+$[1]:I<48?xe+=T(Y,ue,pe)+$[2]:I<64?xe+=C(Y,ue,pe)+$[3]:xe+=w(Y,ue,pe)+$[4],xe=xe|0,xe=N(xe,ie[I]),xe=xe+ve|0,G=ve,ve=pe,pe=N(ue,10),ue=Y,Y=xe;xe=U[1]+q+pe|0,U[1]=U[2]+B+ve|0,U[2]=U[3]+Q+G|0,U[3]=U[4]+V+Y|0,U[4]=U[0]+ne+ue|0,U[0]=xe},_doFinalize:function(){var F=this._data,z=F.words,I=this._nDataBytes*8,K=F.sigBytes*8;z[K>>>5]|=128<<24-K%32,z[(K+64>>>9<<4)+14]=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,F.sigBytes=(z.length+1)*4,this._process();for(var W=this._hash,U=W.words,X=0;X<5;X++){var $=U[X];U[X]=($<<8|$>>>24)&16711935|($<<24|$>>>8)&4278255360}return W},clone:function(){var F=a.clone.call(this);return F._hash=this._hash.clone(),F}});function w(F,z,I){return F^z^I}function C(F,z,I){return F&z|~F&I}function T(F,z,I){return(F|~z)^I}function E(F,z,I){return F&I|z&~I}function D(F,z,I){return F^(z|~I)}function N(F,z){return F<<z|F>>>32-z}i.RIPEMD160=a._createHelper(b),i.HmacRIPEMD160=a._createHmacHelper(b)})(),t.RIPEMD160})})(k0)),k0.exports}var S0={exports:{}},D9=S0.exports,bO;function pm(){return bO||(bO=1,(function(n,e){(function(t,r){n.exports=r(Et())})(D9,function(t){(function(){var r=t,i=r.lib,s=i.Base,o=r.enc,a=o.Utf8,u=r.algo;u.HMAC=s.extend({init:function(f,p){f=this._hasher=new f.init,typeof p=="string"&&(p=a.parse(p));var g=f.blockSize,x=g*4;p.sigBytes>x&&(p=f.finalize(p)),p.clamp();for(var A=this._oKey=p.clone(),_=this._iKey=p.clone(),b=A.words,w=_.words,C=0;C<g;C++)b[C]^=1549556828,w[C]^=909522486;A.sigBytes=_.sigBytes=x,this.reset()},reset:function(){var f=this._hasher;f.reset(),f.update(this._iKey)},update:function(f){return this._hasher.update(f),this},finalize:function(f){var p=this._hasher,g=p.finalize(f);p.reset();var x=p.finalize(this._oKey.clone().concat(g));return x}})})()})})(S0)),S0.exports}var C0={exports:{}},M9=C0.exports,wO;function N9(){return wO||(wO=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),Gh(),pm())})(M9,function(t){return(function(){var r=t,i=r.lib,s=i.Base,o=i.WordArray,a=r.algo,u=a.SHA256,f=a.HMAC,p=a.PBKDF2=s.extend({cfg:s.extend({keySize:128/32,hasher:u,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,x){for(var A=this.cfg,_=f.create(A.hasher,g),b=o.create(),w=o.create([1]),C=b.words,T=w.words,E=A.keySize,D=A.iterations;C.length<E;){var N=_.update(x).finalize(w);_.reset();for(var F=N.words,z=F.length,I=N,K=1;K<D;K++){I=_.finalize(I),_.reset();for(var W=I.words,U=0;U<z;U++)F[U]^=W[U]}b.concat(N),T[0]++}return b.sigBytes=E*4,b}});r.PBKDF2=function(g,x,A){return p.create(A).compute(g,x)}})(),t.PBKDF2})})(C0)),C0.exports}var T0={exports:{}},L9=T0.exports,_O;function ua(){return _O||(_O=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),TE(),pm())})(L9,function(t){return(function(){var r=t,i=r.lib,s=i.Base,o=i.WordArray,a=r.algo,u=a.MD5,f=a.EvpKDF=s.extend({cfg:s.extend({keySize:128/32,hasher:u,iterations:1}),init:function(p){this.cfg=this.cfg.extend(p)},compute:function(p,g){for(var x,A=this.cfg,_=A.hasher.create(),b=o.create(),w=b.words,C=A.keySize,T=A.iterations;w.length<C;){x&&_.update(x),x=_.update(p).finalize(g),_.reset();for(var E=1;E<T;E++)x=_.finalize(x),_.reset();b.concat(x)}return b.sigBytes=C*4,b}});r.EvpKDF=function(p,g,x){return f.create(x).compute(p,g)}})(),t.EvpKDF})})(T0)),T0.exports}var E0={exports:{}},F9=E0.exports,OO;function ULine truncated
|
||||
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||||
* derived from CryptoJS.mode.CTR
|
||||
* Jan Hruby jhruby.web@gmail.com
|
||||
*/return t.mode.CTRGladman=(function(){var r=t.lib.BlockCipherMode.extend();function i(a){if((a>>24&255)===255){var u=a>>16&255,f=a>>8&255,p=a&255;u===255?(u=0,f===255?(f=0,p===255?p=0:++p):++f):++u,a=0,a+=u<<16,a+=f<<8,a+=p}else a+=1<<24;return a}function s(a){return(a[0]=i(a[0]))===0&&(a[1]=i(a[1])),a}var o=r.Encryptor=r.extend({processBlock:function(a,u){var f=this._cipher,p=f.blockSize,g=this._iv,x=this._counter;g&&(x=this._counter=g.slice(0),this._iv=void 0),s(x);var A=x.slice(0);f.encryptBlock(A,0);for(var _=0;_<p;_++)a[u+_]^=A[_]}});return r.Decryptor=o,r})(),t.mode.CTRGladman})})(R0)),R0.exports}var D0={exports:{}},q9=D0.exports,TO;function V9(){return TO||(TO=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),Un())})(q9,function(t){return t.mode.OFB=(function(){var r=t.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(s,o){var a=this._cipher,u=a.blockSize,f=this._iv,p=this._keystream;f&&(p=this._keystream=f.slice(0),this._iv=void 0),a.encryptBlock(p,0);for(var g=0;g<u;g++)s[o+g]^=p[g]}});return r.Decryptor=i,r})(),t.mode.OFB})})(D0)),D0.exports}var M0={exports:{}},$9=M0.exports,EO;function U9(){return EO||(EO=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),Un())})($9,function(t){return t.mode.ECB=(function(){var r=t.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(i,s){this._cipher.encryptBlock(i,s)}}),r.Decryptor=r.extend({processBlock:function(i,s){this._cipher.decryptBlock(i,s)}}),r})(),t.mode.ECB})})(M0)),M0.exports}var N0={exports:{}},Z9=N0.exports,PO;function G9(){return PO||(PO=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),Un())})(Z9,function(t){return t.pad.AnsiX923={pad:function(r,i){var s=r.sigBytes,o=i*4,a=o-s%o,u=s+a-1;r.clamp(),r.words[u>>>2]|=a<<24-u%4*8,r.sigBytes+=a},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},t.pad.Ansix923})})(N0)),N0.exports}var L0={exports:{}},X9=L0.exports,BO;function K9(){return BO||(BO=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),Un())})(X9,function(t){return t.pad.Iso10126={pad:function(r,i){var s=i*4,o=s-r.sigBytes%s;r.concat(t.lib.WordArray.random(o-1)).concat(t.lib.WordArray.create([o<<24],1))},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},t.pad.Iso10126})})(L0)),L0.exports}var F0={exports:{}},Y9=F0.exports,RO;function J9(){return RO||(RO=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),Un())})(Y9,function(t){return t.pad.Iso97971={pad:function(r,i){r.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(r,i)},unpad:function(r){t.pad.ZeroPadding.unpad(r),r.sigBytes--}},t.pad.Iso97971})})(F0)),F0.exports}var I0={exports:{}},ej=I0.exports,DO;function tj(){return DO||(DO=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),Un())})(ej,function(t){return t.pad.ZeroPadding={pad:function(r,i){var s=i*4;r.clamp(),r.sigBytes+=s-(r.sigBytes%s||s)},unpad:function(r){for(var i=r.words,s=r.sigBytes-1,s=r.sigBytes-1;s>=0;s--)if(i[s>>>2]>>>24-s%4*8&255){r.sigBytes=s+1;break}}},t.pad.ZeroPadding})})(I0)),I0.exports}var z0={exports:{}},nj=z0.exports,MO;function rj(){return MO||(MO=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),Un())})(nj,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})})(z0)),z0.exports}var j0={exports:{}},ij=j0.exports,NO;function sj(){return NO||(NO=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),Un())})(ij,function(t){return(function(r){var i=t,s=i.lib,o=s.CipherParams,a=i.enc,u=a.Hex,f=i.format;f.Hex={stringify:function(p){return p.ciphertext.toString(u)},parse:function(p){var g=u.parse(p);return o.create({ciphertext:g})}}})(),t.format.Hex})})(j0)),j0.exports}var Q0={exports:{}},oj=Q0.exports,LO;function aj(){return LO||(LO=1,(function(n,e){(function(t,r,i){n.exports=r(Et(),ul(),hl(),ua(),Un())})(oj,function(t){return(function(){var r=t,i=r.lib,s=i.BlockCipher,o=r.algo,a=[],u=[],f=[],p=[],g=[],x=[],A=[],_=[],b=[],w=[];(function(){for(var E=[],D=0;D<256;D++)D<128?E[D]=D<<1:E[D]=D<<1^283;for(var N=0,F=0,D=0;D<256;D++){var z=F^F<<1^F<<2^F<<3^F<<4;z=z>>>8^z&255^99,a[N]=z,u[z]=N;var I=E[N],K=E[I],W=E[K],U=E[z]*257^z*16843008;f[N]=U<<24|U>>>8,p[N]=U<<16|U>>>16,g[N]=U<<8|U>>>24,x[N]=U;var U=W*16843009^K*65537^I*257^N*16843008;A[z]=U<<24|U>>>8,_[z]=U<<16|U>>>16,b[z]=U<<8|U>>>24,w[z]=U,N?(N=I^E[E[E[W^I]]],F^=E[E[F]]):N=F=1}})();var C=[0,1,2,4,8,16,32,64,128,27,54],T=o.AES=s.extend({_doReset:function(){var E;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var D=this._keyPriorReset=this._key,N=D.words,F=D.sigBytes/4,z=this._nRounds=F+6,I=(z+1)*4,K=this._keySchedule=[],W=0;W<I;W++)W<F?K[W]=N[W]:(E=K[W-1],W%F?F>6&&W%F==4&&(E=a[E>>>24]<<24|a[E>>>16&255]<<16|a[E>>>8&255]<<8|a[E&255]):(E=E<<8|E>>>24,E=a[E>>>24]<<24|a[E>>>16&255]<<16|a[E>>>8&255]<<8|a[E&255],E^=C[W/F|0]<<24),K[W]=K[W-F]^E);for(var U=this._invKeySchedule=[],X=0;X<I;X++){var W=I-X;if(X%4)var E=K[W];else var E=K[W-4];X<4||W<=4?U[X]=E:U[X]=A[a[E>>>24]]^_[a[E>>>16&255]]^b[a[E>>>8&255]]^w[a[E&255]]}}},encryptBlock: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:a+u,endByte:a+i.length-1,value:x});const A={type:n.PayloadType.Request,version:n.PayloadVersion.Version1,isValid:!0,timestamp:0,requestType:n.RequestType.GetStats,requestData:"",destinationHash:f,sourceHash:p,cipherMac:g,ciphertext:x};return s!=null&&s.includeSegments&&(A.segments=o),A}catch(o){return{type:n.PayloadType.Request,version:n.PayloadVersion.Version1,isValid:!1,errors:[o instanceof Error?o.message:"Failed to decode request payload"],timestamp:0,requestType:n.RequestType.GetStats,requestData:"",destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:""}}}}return Hu.RequestPayloadDecoder=t,Hu}var Wu={},sk;function Wj(){if(sk)return Wu;sk=1,Object.defineProperty(Wu,"__esModule",{value:!0}),Wu.ResponsePayloadDecoder=void 0;const n=oi(),e=nr();class t{static decode(i,s){try{if(i.length<4){const _={type:n.PayloadType.Response,version:n.PayloadVersion.Version1,isValid:!1,errors:["Response payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return s!=null&&s.includeSegments&&(_.segments=[{name:"Invalid Response Data",description:"Response payload too short (minimum 4 bytes required)",startByte:s.segmentOffset||0,endByte:(s.segmentOffset||0)+i.length-1,value:(0,e.bytesToHex)(i)}]),_}const o=[],a=(s==null?void 0:s.segmentOffset)||0;let u=0;const f=(0,e.byteToHex)(i[u]);s!=null&&s.includeSegments&&o.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:a+u,endByte:a+u,value:f}),u+=1;const p=(0,e.byteToHex)(i[u]);s!=null&&s.includeSegments&&o.push({name:"Source Hash",description:"First byte of source node public key",startByte:a+u,endByte:a+u,value:p}),u+=1;const g=(0,e.bytesToHex)(i.subarray(u,u+2));s!=null&&s.includeSegments&&o.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:a+u,endByte:a+u+1,value:g}),u+=2;const x=(0,e.bytesToHex)(i.subarray(u));s!=null&&s.includeSegments&&i.length>u&&o.push({name:"Ciphertext",description:"Encrypted response data (tag + content)",startByte:a+u,endByte:a+i.length-1,value:x});const A={type:n.PayloadType.Response,version:n.PayloadVersion.Version1,isValid:!0,destinationHash:f,sourceHash:p,cipherMac:g,ciphertext:x,ciphertextLength:i.length-4};return s!=null&&s.includeSegments&&(A.segments=o),A}catch(o){return{type:n.PayloadType.Response,version:n.PayloadVersion.Version1,isValid:!1,errors:[o instanceof Error?o.message:"Failed to decode response payload"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return Wu.ResponsePayloadDecoder=t,Wu}var qu={},ok;function qj(){if(ok)return qu;ok=1,Object.defineProperty(qu,"__esModule",{value:!0}),qu.AnonRequestPayloadDecoder=void 0;const n=oi(),e=nr();class t{static decode(i,s){try{if(i.length<35){const _={type:n.PayloadType.AnonRequest,version:n.PayloadVersion.Version1,isValid:!1,errors:["AnonRequest payload too short (minimum 35 bytes: dest + public key + MAC)"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return s!=null&&s.includeSegments&&(_.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:s.segmentOffset||0,endByte:(s.segmentOffset||0)+i.length-1,value:(0,e.bytesToHex)(i)}]),_}const o=[],a=(s==null?void 0:s.segmentOffset)||0;let u=0;const f=(0,e.byteToHex)(i[0]);s!=null&&s.includeSegments&&o.push({name:"Destination Hash",description:`First byte of destination node public key: 0x${f}`,startByte:a+u,endByte:a+u,value:f}),u+=1;const p=(0,e.bytesToHex)(i.subarray(1,33));s!=null&&s.includeSegments&&o.push({name:"Sender Public Key",description:"Ed25519 public key of the sender (32 bytes)",startByte:a+u,endByte:a+u+31,value:p}),u+=32;const g=(0,e.bytesToHex)(i.subarray(33,35));s!=null&&s.includeSegments&&o.push({name:"Cipher MAC",description:"MAC for encrypted data verification (2 bytes)",startByte:a+u,endByte:a+u+1,value:g}),u+=2;const x=(0,e.bytesToHex)(i.subarray(35));s!=null&&s.includeSegments&&i.length>35&&o.push({name:"Ciphertext",description:`Encrypted message data (${i.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:a+u,endByte:a+i.length-1,value:x});const A={type:n.PayloadType.AnonRequest,version:n.PayloadVersion.Version1,isValid:!0,destinationHash:f,senderPublicKey:p,cipherMac:g,ciphertext:x,ciphertextLength:i.length-35};return s!=null&&s.includeSegments&&(A.segments=o),A}catch(o){return{type:n.PayloadType.AnonRequest,version:n.PayloadVersion.Version1,isValid:!1,errors:[o instanceof Error?o.message:"Failed to decode AnonRequest payload"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return qu.AnonRequestPayloadDecoder=t,qu}var Vu={},ak;function Vj(){if(ak)return Vu;ak=1,Object.defineProperty(Vu,"__esModule",{value:!0}),Vu.AckPayloadDecoder=void 0;const n=oi(),e=nr();class t{static decode(i,s){try{if(i.length<4){const p={type:n.PayloadType.Ack,version:n.PayloadVersion.Version1,isValid:!1,errors:["Ack payload too short (minimum 4 bytes for checksum)"],checksum:""};return s!=null&&s.includeSegments&&(p.segments=[{name:"Invalid Ack Data",description:"Ack payload too short (minimum 4 bytes required for checksum)",startByte:s.segmentOffset||0,endByte:(s.segmentOffset||0)+i.length-1,value:(0,e.bytesToHex)(i)}]),p}const o=[],a=(s==null?void 0:s.segmentOffset)||0,u=(0,e.bytesToHex)(i.subarray(0,4));s!=null&&s.includeSegments&&o.push({name:"Checksum",description:`CRC checksum of message timestamp, text, and sender pubkey: 0x${u}`,startByte:a,endByte:a+3,value:u}),s!=null&&s.includeSegments&&i.length>4&&o.push({name:"Additional Data",description:"Extra data in Ack payload",startByte:a+4,endByte:a+i.length-1,value:(0,e.bytesToHex)(i.subarray(4))});const f={type:n.PayloadType.Ack,version:n.PayloadVersion.Version1,isValid:!0,checksum:u};return s!=null&&s.includeSegments&&(f.segments=o),f}catch(o){return{type:n.PayloadType.Ack,version:n.PayloadVersion.Version1,isValid:!1,errors:[o instanceof Error?o.message:"Failed to decode Ack payload"],checksum:""}}}}return Vu.AckPayloadDecoder=t,Vu}var $u={},lk;function $j(){if(lk)return $u;lk=1,Object.defineProperty($u,"__esModule",{value:!0}),$u.PathPayloadDecoder=void 0;const n=oi(),e=nr();class t{static decode(i){try{if(i.length<2)return{type:n.PayloadType.Path,version:n.PayloadVersion.Version1,isValid:!1,errors:["Path payload too short (minimum 2 bytes: path length + extra type)"],pathLength:0,pathHashes:[],extraType:0,extraData:""};const s=i[0];if(i.length<1+s+1)return{type:n.PayloadType.Path,version:n.PayloadVersion.Version1,isValid:!1,errors:[`Path payload too short (need ${1+s+1} bytes for path length + path + extra type)`],pathLength:s,pathHashes:[],extraType:0,extraData:""};const o=[];for(let f=0;f<s;f++)o.push((0,e.byteToHex)(i[1+f]));const a=i[1+s];let u="";return i.length>1+s+1&&(u=(0,e.bytesToHex)(i.subarray(1+s+1))),{type:n.PayloadType.Path,version:n.PayloadVersion.Version1,isValid:!0,pathLength:s,pathHashes:o,extraType:a,extraData:u}}catch(s){return{type:n.PayloadType.Path,version:n.PayloadVersion.Version1,isValid:!1,errors:[s instanceof Error?s.message:"Failed to decode Path payload"],pathLength:0,pathHashes:[],extraType:0,extraData:""}}}}return $u.PathPayloadDecoder=t,$u}var Uu={},ck;function Uj(){if(ck)return Uu;ck=1,Object.defineProperty(Uu,"__esModule",{value:!0}),Uu.TextMessagePayloadDecoder=void 0;const n=oi(),e=nr();class t{static decode(i,s){try{if(i.length<4){const _={type:n.PayloadType.TextMessage,version:n.PayloadVersion.Version1,isValid:!1,errors:["TextMessage payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return s!=null&&s.includeSegments&&(_.segments=[{name:"Invalid TextMessage Data",description:"TextMessage payload too short (minimum 4 bytes required)",startByte:s.segmentOffset||0,endByte:(s.segmentOffset||0)+i.length-1,value:(0,e.bytesToHex)(i)}]),_}const o=[],a=(s==null?void 0:s.segmentOffset)||0;let u=0;const f=(0,e.byteToHex)(i[u]);s!=null&&s.includeSegments&&o.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:a+u,endByte:a+u,value:f}),u+=1;const p=(0,e.byteToHex)(i[u]);s!=null&&s.includeSegments&&o.push({name:"Source Hash",description:"First byte of source node public key",startByte:a+u,endByte:a+u,value:p}),u+=1;const g=(0,e.bytesToHex)(i.subarray(u,u+2));s!=null&&s.includeSegments&&o.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:a+u,endByte:a+u+1,value:g}),u+=2;const x=(0,e.bytesToHex)(i.subarray(u));s!=null&&s.includeSegments&&i.length>u&&o.push({name:"Ciphertext",description:"Encrypted message data (timestamp + message text)",startByte:a+u,endByte:a+i.length-1,value:x});const A={type:n.PayloadType.TextMessage,version:n.PayloadVersion.Version1,isValid:!0,destinationHash:f,sourceHash:p,cipherMac:g,ciphertext:x,ciphertextLength:i.length-4};return s!=null&&s.includeSegments&&(A.segments=o),A}catch(o){return{type:n.PayloadType.TextMessage,version:n.PayloadVersion.Version1,i
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 cQ=eh.exports,gk;function uQ(){return gk||(gk=1,(function(n,e){(function(t,r){r(e)})(cQ,(function(t){var r="1.9.4";function i(c){var d,y,O,M;for(y=1,O=arguments.length;y<O;y++){M=arguments[y];for(d in M)c[d]=M[d]}return c}var s=Object.create||(function(){function c(){}return function(d){return c.prototype=d,new c}})();function o(c,d){var y=Array.prototype.slice;if(c.bind)return c.bind.apply(c,y.call(arguments,1));var O=y.call(arguments,2);return function(){return c.apply(d,O.length?O.concat(y.call(arguments)):arguments)}}var a=0;function u(c){return"_leaflet_id"in c||(c._leaflet_id=++a),c._leaflet_id}function f(c,d,y){var O,M,H,te;return te=function(){O=!1,M&&(H.apply(y,M),M=!1)},H=function(){O?M=arguments:(c.apply(y,arguments),setTimeout(te,d),O=!0)},H}function p(c,d,y){var O=d[1],M=d[0],H=O-M;return c===O&&y?c:((c-M)%H+H)%H+M}function g(){return!1}function x(c,d){if(d===!1)return c;var y=Math.pow(10,d===void 0?6:d);return Math.round(c*y)/y}function A(c){return c.trim?c.trim():c.replace(/^\s+|\s+$/g,"")}function _(c){return A(c).split(/\s+/)}function b(c,d){Object.prototype.hasOwnProperty.call(c,"options")||(c.options=c.options?s(c.options):{});for(var y in d)c.options[y]=d[y];return c.options}function w(c,d,y){var O=[];for(var M in c)O.push(encodeURIComponent(y?M.toUpperCase():M)+"="+encodeURIComponent(c[M]));return(!d||d.indexOf("?")===-1?"?":"&")+O.join("&")}var C=/\{ *([\w_ -]+) *\}/g;function T(c,d){return c.replace(C,function(y,O){var M=d[O];if(M===void 0)throw new Error("No value provided for variable "+y);return typeof M=="function"&&(M=M(d)),M})}var E=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"};function D(c,d){for(var y=0;y<c.length;y++)if(c[y]===d)return y;return-1}var N="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function F(c){return window["webkit"+c]||window["moz"+c]||window["ms"+c]}var z=0;function I(c){var d=+new Date,y=Math.max(0,16-(d-z));return z=d+y,window.setTimeout(c,y)}var K=window.requestAnimationFrame||F("RequestAnimationFrame")||I,W=window.cancelAnimationFrame||F("CancelAnimationFrame")||F("CancelRequestAnimationFrame")||function(c){window.clearTimeout(c)};function U(c,d,y){if(y&&K===I)c.call(d);else return K.call(window,o(c,d))}function X(c){c&&W.call(window,c)}var $={__proto__:null,extend:i,create:s,bind:o,get lastId(){return a},stamp:u,throttle:f,wrapNum:p,falseFn:g,formatNum:x,trim:A,splitWords:_,setOptions:b,getParamString:w,template:T,isArray:E,indexOf:D,emptyImageUrl:N,requestFn:K,cancelFn:W,requestAnimFrame:U,cancelAnimFrame:X};function ee(){}ee.extend=function(c){var d=function(){b(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},y=d.__super__=this.prototype,O=s(y);O.constructor=d,d.prototype=O;for(var M in this)Object.prototype.hasOwnProperty.call(this,M)&&M!=="prototype"&&M!=="__super__"&&(d[M]=this[M]);return c.statics&&i(d,c.statics),c.includes&&(le(c.includes),i.apply(null,[O].concat(c.includes))),i(O,c),delete O.statics,delete O.includes,O.options&&(O.options=y.options?s(y.options):{},i(O.options,c.options)),O._initHooks=[],O.callInitHooks=function(){if(!this._initHooksCalled){y.callInitHooks&&y.callInitHooks.call(this),this._initHooksCalled=!0;for(var H=0,te=O._initHooks.length;H<te;H++)O._initHooks[H].call(this)}},d},ee.include=function(c){var d=this.prototype.options;return i(this.prototype,c),c.options&&(this.prototype.options=d,this.mergeOptions(c.options)),this},ee.mergeOptions=function(c){return i(this.prototype.options,c),this},ee.addInitHook=function(c){var d=Array.prototype.slice.call(arguments,1),y=typeof c=="function"?c:function(){this[c].apply(this,d)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(y),this};function le(c){if(!(typeof L>"u"||!L||!L.Mixin)){c=E(c)?c:[c];for(var d=0;d<c.length;d++)c[d]===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 Z={on:function(c,d,y){if(typeof c=="object")for(var O in c)this._on(O,c[O],d);else{c=_(c);for(var M=0,H=c.length;M<H;M++)this._on(c[M],d,y)}return this},off:function(c,d,y){if(!arguments.length)delete this._events;else if(typeof c=="object")for(var O in c)this._off(O,c[O],d);else{c=_(c);for(var M=arguments.length===1,H=0,te=c.length;H<te;H++)M?this._off(c[H]):this._off(c[H],d,y)}return this},_on:function(c,d,y,O){if(typeof d!="function"){console.warn("wrong listener type: "+typeof d);return}if(this._listens(c,d,y)===!1){y===this&&(y=void 0);var M={fn:d,ctx:y};O&&(M.once=!0),this._events=this._events||{},this._events[c]=this._events[c]||[],this._events[c].push(M)}},_off:function(c,d,y){var O,M,H;if(this._events&&(O=this._events[c],!!O)){if(arguments.length===1){if(this._firingCount)for(M=0,H=O.length;M<H;M++)O[M].fn=g;delete this._events[c];return}if(typeof d!="function"){console.warn("wrong listener type: "+typeof d);return}var te=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 e=await navigator.gpu.requestAdapter();if(!e)return console.warn("No GPU adapter found"),!1;this.device=await e.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 i=0;i<2;i++)this.matchCountReadBuffers[i]=this.device.createBuffer({size:4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.matchIndicesReadBuffers[i]=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});const t=this.device.createShaderModule({code:this.shaderCode}),r=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]});return this.pipeline=this.device.createComputePipeline({layout:r,compute:{module:t,entryPoint:"main"}}),!0}catch(e){return console.error("WebGPU initialization failed:",e),!1}}isAvailable(){return this.device!==null&&this.pipeline!==null}indexToRoomName(e,t){return Za(t,e)}countNamesForLength(e){return rh(e)}async runBatch(e,t,r,i,s,o){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 a=this.currentReadBufferIndex;this.currentReadBufferIndex=1-this.currentReadBufferIndex;const u=this.matchCountReadBuffers[a],f=this.matchIndicesReadBuffers[a],p=s&&o?1:0;let g,x=0,A=0;if(p){const N=new Uint8Array(s.length/2);for(let W=0;W<N.length;W++)N[W]=parseInt(s.substr(W*2,2),16);x=N.length*8;const F=Math.ceil(N.length/4)*4,z=new Uint8Array(F);z.set(N),g=new Uint32Array(F/4);for(let W=0;W<g.length;W++)g[W]=z[W*4]<<24|z[W*4+1]<<16|z[W*4+2]<<8|z[W*4+3];const I=parseInt(o.substr(0,2),16),K=parseInt(o.substr(2,2),16);A=I<<24|K<<16}else g=new Uint32Array([0]);const _=Math.max(g.length*4,4);(!this.ciphertextBuffer||this.ciphertextBufferSize<_)&&(this.ciphertextBuffer&&this.ciphertextBuffer.destroy(),this.ciphertextBuffer=this.device.createBuffer({size:_,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.ciphertextBufferSize=_,this.bindGroupDirty=!0);const b=new Uint32Array([e,r,t,i,A,g.length,x,p]);this.device.queue.writeBuffer(this.paramsBuffer,0,b),this.device.queue.writeBuffer(this.ciphertextBuffer,0,g),this.device.queue.writeBuffer(this.matchCountBuffer,0,Am.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 w=this.device.createCommandEncoder(),C=w.beginComputePass();C.setPipeline(this.pipeline),C.setBindGroup(0,this.bindGroup),C.dispatchWorkgroups(Math.ceil(i/(256*32))),C.end(),w.copyBufferToBuffer(this.matchCountBuffer,0,u,0,4),w.copyBufferToBuffer(this.matchIndicesBuffer,0,f,0,1024*4),this.device.queue.submit([w.finish()]),await u.mapAsync(GPUMapMode.READ);const E=new Uint32Array(u.getMappedRange())[0];u.unmap();const D=[];if(E>0){await f.mapAsync(GPUMapMode.READ);const N=new Uint32Array(f.getMappedRange());for(let F=0;F<Math.min(E,1024);F++)D.push(N[F]);f.unmap()}return D}destroy(){var e,t,r,i,s,o,a,u;(e=this.paramsBuffer)==null||e.destroy(),(t=this.matchCountBuffer)==null||t.destroy(),(r=this.matchIndicesBuffer)==null||r.destroy(),(i=this.ciphertextBuffer)==null||i.destroy(),(s=this.matchCountReadBuffers[0])==null||s.destroy(),(o=this.matchCountReadBuffers[1])==null||o.destroy(),(a=this.matchIndicesReadBuffers[0])==null||a.destroy(),(u=this.matchIndicesReadBuffers[1])==null||u.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}}Am.ZERO_DATA=new Uint32Array([0]);function W7(){return typeof navigator<"u"&&"gpu"in navigator}class Bk{runBatch(e,t,r,i,s,o){const a=[],u=e.toString(16).padStart(2,"0")
Line truncated
|
||||
`).map(s=>s.trim().toLowerCase()).filter(s=>s.length>0);this.wordlist=i.filter(Rk)}setWordlist(e){this.wordlist=e.map(t=>t.trim().toLowerCase()).filter(Rk)}abort(){this.abortFlag=!0}isGpuAvailable(){return W7()}async decodePacket(e){var r;const t=e.trim().replace(/\s+/g,"").replace(/^0x/i,"");if(!t||!/^[0-9a-fA-F]+$/.test(t))return null;try{const s=(r=(await Pt.MeshCorePacketDecoder.decodeWithVerification(t,{})).payload)==null?void 0:r.decoded;return!(s!=null&&s.channelHash)||!(s!=null&&s.ciphertext)||!(s!=null&&s.cipherMac)?null:{channelHash:s.channelHash,ciphertext:s.ciphertext,cipherMac:s.cipherMac,isGroupText:!0}}catch{return null}}async crack(e,t,r){this.abortFlag=!1,this.useTimestampFilter=(t==null?void 0:t.useTimestampFilter)??!0,this.useUtf8Filter=(t==null?void 0:t.useUtf8Filter)??!0,this.useSenderFilter=(t==null?void 0:t.useSenderFilter)??!0,this.validSeconds=(t==null?void 0:t.validSeconds)??av,this.useCpu=(t==null?void 0:t.forceCpu)??!1;const i=(t==null?void 0:t.maxLength)??8,s=(t==null?void 0:t.startingLength)??1,o=(t==null?void 0:t.useDictionary)??!0,a=(t==null?void 0:t.startFromType)??"bruteforce",u=e.toLowerCase(),f=await this.decodePacket(u);if(!f)return{found:!1,error:"Invalid packet or not a GroupText packet"};const{channelHash:p,ciphertext:g,cipherMac:x}=f,A=parseInt(p,16);this.useCpu?this.cpuInstance||(this.cpuInstance=new Bk):this.gpuInstance||(this.gpuInstance=new Am,await this.gpuInstance.init()||(this.useCpu=!0,this.cpuInstance=new Bk));const _=performance.now();let b=0,w=performance.now(),C=s,T=0,E=0,D=!1;if(t!=null&&t.startFrom){const $=t.startFrom.toLowerCase();if(a==="dictionary"){const ee=this.wordlist.indexOf($);ee>=0&&(E=ee+1)}else{D=!0;const ee=j7($);ee&&(C=Math.max(s,ee.length),T=ee.index+1,T>=rh(C)&&(C++,T=0))}}let N=0;o&&!D&&this.wordlist.length>0&&(N+=this.wordlist.length-E);for(let $=C;$<=i;$++)N+=rh($);N-=T;const F=($,ee,le)=>{if(!r)return;const ie=(performance.now()-_)/1e3,V=ie>0?Math.round(b/ie):0,ne=N-b,q=V>0?ne/V:0;r({checked:b,total:N,percent:N>0?Math.min(100,b/N*100):0,rateKeysPerSec:V,etaSeconds:q,elapsedSeconds:ie,currentLength:ee,currentPosition:le,phase:$})},z=$=>{if(!lP(g,x,$))return{valid:!1};const ee=Pt.ChannelCrypto.decryptGroupTextMessage(g,x,$);return!ee.success||!ee.data?{valid:!1}:this.useTimestampFilter&&!Q7(ee.data.timestamp,this.validSeconds)?{valid:!1}:this.useUtf8Filter&&!H7(ee.data.message)?{valid:!1}:this.useSenderFilter&&!ee.data.sender?{valid:!1}:{valid:!0,message:ee.data.sender?`${ee.data.sender}: ${ee.data.message}`:ee.data.message}};if(!D&&E===0&&C===s&&T===0){F("public-key",0,ov);const $=cv(K0);if(p===$){const ee=z(K0);if(ee.valid)return{found:!0,roomName:ov,key:K0,decryptedMessage:ee.message}}}if(o&&!D&&this.wordlist.length>0)for(let $=E;$<this.wordlist.length;$++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:this.wordlist[$],resumeType:"dictionary"};const ee=this.wordlist[$],le=lv("#"+ee),Z=cv(le);if(parseInt(Z,16)===A){const V=z(le);if(V.valid)return{found:!0,roomName:ee,key:le,decryptedMessage:V.message,resumeFrom:ee,resumeType:"dictionary"}}b++;const ie=performance.now();ie-w>=200&&(F("wordlist",ee.length,ee),w=ie,await new Promise(V=>setTimeout(V,0)))}const I=this.useCpu?1024:32768,K=(t==null?void 0:t.gpuDispatchMs)??1e3;let W=I,U=!1;for(let $=C;$<=i;$++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Za($,0)||void 0,resumeType:"bruteforce"};const ee=rh($);let le=$===C?T:0;for(;le<ee;){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Za($,le)||void 0,resumeType:"bruteforce"};const Z=Math.min(W,ee-le),ie=performance.now();let V;this.useCpu?V=this.cpuInstance.runBatch(A,$,le,Z,g,x):V=await this.gpuInstance.runBatch(A,$,le,Z,g,x);const ne=performance.now()-ie;if(b+=Z,!this.useCpu&&!U&&Z>=I&&ne>0){const B=K/ne,Q=Math.round(Z*B),G=Math.pow(2,Math.round(Math.log2(Math.max(I,Q))));W=Math.max(I,G),U=!0}for(const B of V){const Q=Za($,B);if(!Q)continue;const G=lv("#"+Q),Y=z(G);if(Y.valid)return{found:!0,roomName:Q,key:G,decryptedMessage:Y.message,resumeFrom:Q,resumeType:"bruteforce"}}le+=Z;const q=performance.now();if(q-w>=200){const B=Za($,Math.min(le,ee-1))||"";F("bruteforce",$,B),w=q,await new Promise(Q=>setTimeout(Q,0))}}}return{found:!1,resumeFrom:Za(i,rh(i)-1)||void 0,resumeType:"bruteforce"}}destroy(){this.gpuInstance&&(this.gpuInstance.destroy(),this.gpuInstance=null),this.cpuInstance&&(this.cpuInstance.destroy(),this.cpuInstance=null)}}var Gx,Dk;function Z7(){return Dk||(Dk=1,Gx={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXg
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(a=>(this.enabled=!0,a)).catch(a=>{throw this.enabled=!1,a})}disable(){r()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):t()?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 Xx=i,Xx}var X7=G7();const K7=Rc(X7);function Y7(n){if(n.length<4)return null;try{const t=parseInt(n.slice(0,2),16)&3;let r=2;if(t===0||t===3){if(n.length<r+8)return null;r+=8}if(n.length<r+2)return null;const i=parseInt(n.slice(r,r+2),16);r+=2;const s=i*2;return n.length<r+s?null:(r+=s,n.slice(r))}catch{return null}}function J7({packets:n,channels:e,onChannelCreate:t,onRunningChange:r,visible:i=!1}){const[s,o]=R.useState(!1),[a,u]=R.useState(6),[f,p]=R.useState(!1),[g,x]=R.useState(!0),[A,_]=R.useState(!1),[b,w]=R.useState(null),[C,T]=R.useState(new Map),[E,D]=R.useState([]),[N,F]=R.useState(!1),[z,I]=R.useState(null),[K,W]=R.useState(null),[U,X]=R.useState(0),$=R.useRef(null),ee=R.useRef(null),le=R.useRef(!1),Z=R.useRef(!1),ie=R.useRef(!1),V=R.useRef(new Map),ne=R.useRef(!1),q=R.useRef(6),B=R.useRef(!0),Q=R.useRef(!1),G=R.useRef(new Set),Y=R.useRef(new Set);R.useEffect(()=>{const Ce=new U7;$.current=Ce,I(Ce.isGpuAvailable());const Ge=new K7;return ee.current=Ge,()=>{Ce.destroy(),$.current=null,Ge.disable(),ee.current=null}},[]),R.useEffect(()=>{!i||N||B7(async()=>{const{ENGLISH_WORDLIST:Ce}=await import("./wordlist-BtmChKSf.js");return{ENGLISH_WORDLIST:Ce}},[]).then(({ENGLISH_WORDLIST:Ce})=>{$.current&&($.current.setWordlist(Ce),F(!0))}).catch(Ce=>{console.error("Failed to load wordlist:",Ce),kt.error("Failed to load wordlist",{description:"Cracking will not be available"})})},[i,N]),R.useEffect(()=>{const Ce=()=>{dt.getUndecryptedPacketCount().then(({count:pt})=>W(pt)).catch(()=>W(null))};Ce();const Ge=setInterval(Ce,36e5);return()=>clearInterval(Ge)},[]);const ue=R.useMemo(()=>new Set(e.map(Ce=>Ce.key.toUpperCase())),[e]),pe=n.filter(Ce=>Ce.payload_type==="GROUP_TEXT"&&!Ce.decrypted);R.useEffect(()=>{let Ce=0;T(Ge=>{const pt=new Map(Ge);let bt=!1;for(const ot of pe)if(!pt.has(ot.id)){const mt=Y7(ot.data);if(mt&&Y.current.has(mt)){Ce++;continue}mt&&Y.current.add(mt),pt.set(ot.id,{packet:ot,attempts:0,lastAttemptLength:0,status:"pending"}),bt=!0}return bt?(V.current=pt,pt):Ge}),Ce>0&&X(Ge=>Ge+Ce)},[pe.length]),R.useEffect(()=>{V.current=C},[C]),R.useEffect(()=>{ne.current=f},[f]),R.useEffect(()=>{q.current=a},[a]),R.useEffect(()=>{B.current=g},[g]),R.useEffect(()=>{Q.current=A},[A]),R.useEffect(()=>{G.current=new Set(pe.map(Ce=>Ce.id))},[pe]),R.useEffect(()=>{r==null||r(s)},[s,r]);const ve=Array.from(C.values()).filter(Ce=>Ce.status==="pending").length,xe=Array.from(C.values()).filter(Ce=>Ce.status==="cracked").length,ye=Array.from(C.values()).filter(Ce=>Ce.status==="failed").length,Pe=R.useCallback(async()=>{if(ie.current||!$.current||!le.current)return;const Ce=V.current;let Ge=null,pt=null;for(const[et,tt]of Ce.entries())if(tt.status==="pending"){Ge=tt,pt=et;break}if(!Ge&&ne.current){const et=Array.from(Ce.entries()).filter(([,tt])=>tt.status==="failed"&&tt.lastAttemptLength<10);et.length>0&&(et.sort((tt,at)=>tt[1].lastAttemptLength-at[1].lastAttemptLength),[pt,Ge]=et[0])}if(!Ge||pt===null){le.current&&setTimeout(()=>Pe(),1e3);return}if(!G.current.has(pt)){T(et=>{const tt=new Map(et);return tt.delete(pt),tt}),le.current&&setTimeout(()=>Pe(),10);return}ie.current=!0;const bt=q.current,ot=Ge.lastAttemptLength>0,mt=ot?Ge.lastAttemptLength+1:bt;try{const et=await $.current.crack(Ge.packet.data,{maxLength:mt,useSenderFilter:!0,useTimestampFilter:!0,useUtf8Filter:!0,...Q.current&&{gpuDispatchMs:1e4},...ot&&{useDictionary:!1,startingLength:mt}},tt=>{w(tt)});if(Z.current){Z.current=!1,ie.current=!1,w(null);return}if(et.found&&et.roomName&&et.key){T(qe=>{const Dt=new Map(qe),Jt=Dt.get(pt);return Jt&&Dt.set(pt,{...Jt,status:"cracked",attempts:Jt.attempts+1,lastAttemptLength:mt}),Dt});const tt={roomName:et.roomName,key:et.key,packetId:pt,message:et.decryptedMessage||"",crackedAt:Date.now()};D(qe=>[...qe,tt]);const at=et.key.toUpperCase();if(!ue.has(at))try{const qe="#"+et.roomName;await t(qe,et.key),B.current&&await dt.decryptHistoricalPackets({key_type:"channel",channel_name:qe})}catch(qe){console.error("Failed to create channel or decrypt historical:",qe),kt.error("Failed to save cracked channel",{description:qe instanceof Error?qe.message:"Channel discovered but could not be saved"})}}else T(tt=>{const at=new Map(tt),qe=at.get(pt);return qe&&at.set(pt,{...qe,status:"failed",attempts:qe.attempts+1,lastAttemptLength:mt}),at})}catch(et){console.error("Cracking error:",et),T(tt=>{const at=new Map(tt),qe=at.get(pt);return qe&&at.set(pt,{...qe,status:"failed",attempts:qe.attempts+1,lastAttemptLength:mt}),at})}ie.current=!1,w(null),le.current&&setTimeout(()=>Pe(),100)},[ue,t]),Ke=()=>{var Ce;if(!z){kt.error("WebGPU not available",{description:"Cracking requires Chrome 113+ or Edge 113+ with WebGPU support."});return}o(!0),le.current=!0,Z.current=!1,(Ce=ee.current)==null||Ce.enable(),Pe()},nt=()=>{var Ce,Ge;o(!1),le.current=!1,Z.current=!0,(Ce=$.current)==null||Ce.abort(),(Ge=ee.current)==null||
Line truncated
|
||||
//# sourceMappingURL=index-DEJuRmNA.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,EAAE,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,EAAE,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,EAAE,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,EAAE7B,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,EAAE,EAAE,CAAC,WAAW,IAAI,EAAEC,GAAE,CAAC,uBAAuBD,GAAE,wBAAwB,EAAE,kBAAkBlB,CAAC,EAAE,SAASoB,GAAG,CAAC,MAAM,MAAM,0DAA0D,CAAE,CACzM,OAAAC,GAAA,SAAiB,CAAC,IAAIL,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,MALine truncated
|
||||
-1
@@ -1 +0,0 @@
|
||||
code[class*=language-],pre[class*=language-]{color:#ccc;background:none;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.comment,.token.block-comment,.token.prolog,.token.doctype,.token.cdata{color:#999}.token.punctuation{color:#ccc}.token.tag,.token.attr-name,.token.namespace,.token.deleted{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.number,.token.function{color:#f08d49}.token.property,.token.class-name,.token.constant,.token.symbol{color:#f8c555}.token.selector,.token.important,.token.atrule,.token.keyword,.token.builtin{color:#cc99cd}.token.string,.token.char,.token.attr-value,.token.regex,.token.variable{color:#7ec699}.token.operator,.token.entity,.token.url{color:#67cdcc}.token.important,.token.bold{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}.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,sLine 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-B3-iYEDN.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-H2C92sGV.css">
|
||||
<script type="module" crossorigin src="/assets/index-DEJuRmNA.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CgLxtL22.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
Generated
+238
-31
@@ -1,13 +1,15 @@
|
||||
{
|
||||
"name": "remoteterm-meshcore-frontend",
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "remoteterm-meshcore-frontend",
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.0",
|
||||
"dependencies": {
|
||||
"@codemirror/lang-python": "^6.2.1",
|
||||
"@codemirror/theme-one-dark": "^6.1.3",
|
||||
"@michaelhart/meshcore-decoder": "^0.2.7",
|
||||
"@radix-ui/react-checkbox": "^1.3.3",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
@@ -15,7 +17,7 @@
|
||||
"@radix-ui/react-separator": "^1.1.8",
|
||||
"@radix-ui/react-slot": "^1.2.4",
|
||||
"@radix-ui/react-tabs": "^1.1.13",
|
||||
"@types/prismjs": "^1.26.5",
|
||||
"@uiw/react-codemirror": "^4.25.4",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"d3-force": "^3.0.0",
|
||||
@@ -23,11 +25,9 @@
|
||||
"lucide-react": "^0.562.0",
|
||||
"meshcore-hashtag-cracker": "^1.6.0",
|
||||
"nosleep.js": "^0.12.0",
|
||||
"prismjs": "^1.30.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-leaflet": "^4.2.1",
|
||||
"react-simple-code-editor": "^0.14.1",
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
@@ -291,7 +291,6 @@
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.28.4",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -339,6 +338,112 @@
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/autocomplete": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.20.0.tgz",
|
||||
"integrity": "sha512-bOwvTOIJcG5FVo5gUUupiwYh8MioPLQ4UcqbcRf7UQ98X90tCa9E1kZ3Z7tqwpZxYyOvh1YTYbmZE9RTfTp5hg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.17.0",
|
||||
"@lezer/common": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/commands": {
|
||||
"version": "6.10.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.10.1.tgz",
|
||||
"integrity": "sha512-uWDWFypNdQmz2y1LaNJzK7fL7TYKLeUAU0npEC685OKTF3KcQ2Vu3klIM78D7I6wGhktme0lh3CuQLv0ZCrD9Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@codemirror/state": "^6.4.0",
|
||||
"@codemirror/view": "^6.27.0",
|
||||
"@lezer/common": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-python": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-python/-/lang-python-6.2.1.tgz",
|
||||
"integrity": "sha512-IRjC8RUBhn9mGR9ywecNhB51yePWCGgvHfY1lWN/Mrp3cKuHr0isDKia+9HnvhiWNnMpbGhWrkhuWOc09exRyw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.3.2",
|
||||
"@codemirror/language": "^6.8.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@lezer/common": "^1.2.1",
|
||||
"@lezer/python": "^1.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/language": {
|
||||
"version": "6.12.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.12.1.tgz",
|
||||
"integrity": "sha512-Fa6xkSiuGKc8XC8Cn96T+TQHYj4ZZ7RdFmXA3i9xe/3hLHfwPZdM+dqfX0Cp0zQklBKhVD8Yzc8LS45rkqcwpQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.23.0",
|
||||
"@lezer/common": "^1.5.0",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0",
|
||||
"style-mod": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lint": {
|
||||
"version": "6.9.3",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.9.3.tgz",
|
||||
"integrity": "sha512-y3YkYhdnhjDBAe0VIA0c4wVoFOvnp8CnAvfLqi0TqotIv92wIlAAP7HELOpLBsKwjAX6W92rSflA6an/2zBvXw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.35.0",
|
||||
"crelt": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/search": {
|
||||
"version": "6.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.6.0.tgz",
|
||||
"integrity": "sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.37.0",
|
||||
"crelt": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/state": {
|
||||
"version": "6.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.4.tgz",
|
||||
"integrity": "sha512-8y7xqG/hpB53l25CIoit9/ngxdfoG+fx+V3SHBrinnhOtLvKHRyAJJuHzkWrR4YXXLX8eXBsejgAAxHUOdW1yw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@marijn/find-cluster-break": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/theme-one-dark": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/theme-one-dark/-/theme-one-dark-6.1.3.tgz",
|
||||
"integrity": "sha512-NzBdIvEJmx6fjeremiGp3t/okrLPYT0d9orIc7AFun8oZcRk58aejkqhv6spnz4MLAevrKNPMQYXEWMg4s+sKA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.0.0",
|
||||
"@lezer/highlight": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/view": {
|
||||
"version": "6.39.11",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.39.11.tgz",
|
||||
"integrity": "sha512-bWdeR8gWM87l4DB/kYSF9A+dVackzDb/V56Tq7QVrQ7rn86W0rgZFtlL3g3pem6AeGcb9NQNoy3ao4WpW4h5tQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/state": "^6.5.0",
|
||||
"crelt": "^1.0.6",
|
||||
"style-mod": "^4.1.0",
|
||||
"w3c-keyname": "^2.2.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@csstools/color-helpers": {
|
||||
"version": "5.1.0",
|
||||
"dev": true,
|
||||
@@ -691,6 +796,47 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/common": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.5.0.tgz",
|
||||
"integrity": "sha512-PNGcolp9hr4PJdXR4ix7XtixDrClScvtSCYW3rQG106oVMOOI+jFb+0+J3mbeL/53g1Zd6s0kJzaw6Ri68GmAA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@lezer/highlight": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.3.tgz",
|
||||
"integrity": "sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@lezer/common": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/lr": {
|
||||
"version": "1.4.8",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.8.tgz",
|
||||
"integrity": "sha512-bPWa0Pgx69ylNlMlPvBPryqeLYQjyJjqPx+Aupm5zydLIF3NE+6MMLT8Yi23Bd9cif9VS00aUebn+6fDIGBcDA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@lezer/common": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/python": {
|
||||
"version": "1.1.18",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/python/-/python-1.1.18.tgz",
|
||||
"integrity": "sha512-31FiUrU7z9+d/ElGQLJFXl+dKOdx0jALlP3KEOsGTex8mvj+SoE1FgItcHWK/axkxCHGUSpqIHt6JAWfWu9Rhg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@lezer/common": "^1.2.0",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@marijn/find-cluster-break": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz",
|
||||
"integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@michaelhart/meshcore-decoder": {
|
||||
"version": "0.2.7",
|
||||
"resolved": "https://registry.npmjs.org/@michaelhart/meshcore-decoder/-/meshcore-decoder-0.2.7.tgz",
|
||||
@@ -1524,12 +1670,6 @@
|
||||
"undici-types": "~7.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/prismjs": {
|
||||
"version": "1.26.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.5.tgz",
|
||||
"integrity": "sha512-AUZTa7hQ2KY5L7AmtSiqxlhWxb4ina0yd8hNbl4TWuqnv/pFP0nDMb3YrfSBf4hJVGLh2YEIBfKaBW/9UEl6IQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/prop-types": {
|
||||
"version": "15.7.15",
|
||||
"devOptional": true,
|
||||
@@ -1821,6 +1961,59 @@
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@uiw/codemirror-extensions-basic-setup": {
|
||||
"version": "4.25.4",
|
||||
"resolved": "https://registry.npmjs.org/@uiw/codemirror-extensions-basic-setup/-/codemirror-extensions-basic-setup-4.25.4.tgz",
|
||||
"integrity": "sha512-YzNwkm0AbPv1EXhCHYR5v0nqfemG2jEB0Z3Att4rBYqKrlG7AA9Rhjc3IyBaOzsBu18wtrp9/+uhTyu7TXSRng==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.0.0",
|
||||
"@codemirror/commands": "^6.0.0",
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@codemirror/lint": "^6.0.0",
|
||||
"@codemirror/search": "^6.0.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://jaywcjlove.github.io/#/sponsor"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@codemirror/autocomplete": ">=6.0.0",
|
||||
"@codemirror/commands": ">=6.0.0",
|
||||
"@codemirror/language": ">=6.0.0",
|
||||
"@codemirror/lint": ">=6.0.0",
|
||||
"@codemirror/search": ">=6.0.0",
|
||||
"@codemirror/state": ">=6.0.0",
|
||||
"@codemirror/view": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@uiw/react-codemirror": {
|
||||
"version": "4.25.4",
|
||||
"resolved": "https://registry.npmjs.org/@uiw/react-codemirror/-/react-codemirror-4.25.4.tgz",
|
||||
"integrity": "sha512-ipO067oyfUw+DVaXhQCxkB0ZD9b7RnY+ByrprSYSKCHaULvJ3sqWYC/Zen6zVQ8/XC4o5EPBfatGiX20kC7XGA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.18.6",
|
||||
"@codemirror/commands": "^6.1.0",
|
||||
"@codemirror/state": "^6.1.1",
|
||||
"@codemirror/theme-one-dark": "^6.0.0",
|
||||
"@uiw/codemirror-extensions-basic-setup": "4.25.4",
|
||||
"codemirror": "^6.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://jaywcjlove.github.io/#/sponsor"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/runtime": ">=7.11.0",
|
||||
"@codemirror/state": ">=6.0.0",
|
||||
"@codemirror/theme-one-dark": ">=6.0.0",
|
||||
"@codemirror/view": ">=6.0.0",
|
||||
"codemirror": ">=6.0.0",
|
||||
"react": ">=17.0.0",
|
||||
"react-dom": ">=17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vitejs/plugin-react": {
|
||||
"version": "4.7.0",
|
||||
"dev": true,
|
||||
@@ -2308,6 +2501,21 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/codemirror": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.2.tgz",
|
||||
"integrity": "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.0.0",
|
||||
"@codemirror/commands": "^6.0.0",
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@codemirror/lint": "^6.0.0",
|
||||
"@codemirror/search": "^6.0.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"license": "MIT",
|
||||
@@ -2352,6 +2560,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/crelt": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz",
|
||||
"integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
@@ -3962,15 +4176,6 @@
|
||||
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prismjs": {
|
||||
"version": "1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz",
|
||||
"integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.3.1",
|
||||
"dev": true,
|
||||
@@ -4089,16 +4294,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/react-simple-code-editor": {
|
||||
"version": "0.14.1",
|
||||
"resolved": "https://registry.npmjs.org/react-simple-code-editor/-/react-simple-code-editor-0.14.1.tgz",
|
||||
"integrity": "sha512-BR5DtNRy+AswWJECyA17qhUDvrrCZ6zXOCfkQY5zSmb96BVUbpVAv03WpcjcwtCwiLbIANx3gebHOcXYn1EHow==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-style-singleton": {
|
||||
"version": "2.2.3",
|
||||
"license": "MIT",
|
||||
@@ -4361,6 +4556,12 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/style-mod": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.3.tgz",
|
||||
"integrity": "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/sucrase": {
|
||||
"version": "3.35.1",
|
||||
"license": "MIT",
|
||||
@@ -5181,6 +5382,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/w3c-keyname": {
|
||||
"version": "2.2.8",
|
||||
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz",
|
||||
"integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/w3c-xmlserializer": {
|
||||
"version": "5.0.0",
|
||||
"dev": true,
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
"format:check": "prettier --check src/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@codemirror/lang-python": "^6.2.1",
|
||||
"@codemirror/theme-one-dark": "^6.1.3",
|
||||
"@michaelhart/meshcore-decoder": "^0.2.7",
|
||||
"@radix-ui/react-checkbox": "^1.3.3",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
@@ -22,7 +24,7 @@
|
||||
"@radix-ui/react-separator": "^1.1.8",
|
||||
"@radix-ui/react-slot": "^1.2.4",
|
||||
"@radix-ui/react-tabs": "^1.1.13",
|
||||
"@types/prismjs": "^1.26.5",
|
||||
"@uiw/react-codemirror": "^4.25.4",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"d3-force": "^3.0.0",
|
||||
@@ -30,11 +32,9 @@
|
||||
"lucide-react": "^0.562.0",
|
||||
"meshcore-hashtag-cracker": "^1.6.0",
|
||||
"nosleep.js": "^0.12.0",
|
||||
"prismjs": "^1.30.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-leaflet": "^4.2.1",
|
||||
"react-simple-code-editor": "^0.14.1",
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useState, useEffect, useMemo } from 'react';
|
||||
import Editor from 'react-simple-code-editor';
|
||||
import { highlight, languages } from 'prismjs';
|
||||
import 'prismjs/components/prism-python';
|
||||
import 'prismjs/themes/prism-tomorrow.css';
|
||||
import CodeMirror from '@uiw/react-codemirror';
|
||||
import { python } from '@codemirror/lang-python';
|
||||
import { oneDark } from '@codemirror/theme-one-dark';
|
||||
import type {
|
||||
AppSettings,
|
||||
AppSettingsUpdate,
|
||||
BotConfig,
|
||||
HealthStatus,
|
||||
RadioConfig,
|
||||
RadioConfigUpdate,
|
||||
@@ -139,8 +139,10 @@ export function SettingsModal({
|
||||
if channel_name == "#bot" and "!pling" in message_text.lower():
|
||||
return "[BOT] Plong!"
|
||||
return None`;
|
||||
const [botEnabled, setBotEnabled] = useState(false);
|
||||
const [botCode, setBotCode] = useState(DEFAULT_BOT_CODE);
|
||||
const [bots, setBots] = useState<BotConfig[]>([]);
|
||||
const [expandedBotId, setExpandedBotId] = useState<string | null>(null);
|
||||
const [editingNameId, setEditingNameId] = useState<string | null>(null);
|
||||
const [editingNameValue, setEditingNameValue] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
if (config) {
|
||||
@@ -160,11 +162,7 @@ export function SettingsModal({
|
||||
setMaxRadioContacts(String(appSettings.max_radio_contacts));
|
||||
setAutoDecryptOnAdvert(appSettings.auto_decrypt_dm_on_advert);
|
||||
setAdvertInterval(String(appSettings.advert_interval));
|
||||
setBotEnabled(appSettings.bot_enabled);
|
||||
// Only overwrite bot code if user has saved custom code
|
||||
if (appSettings.bot_code) {
|
||||
setBotCode(appSettings.bot_code);
|
||||
}
|
||||
setBots(appSettings.bots || []);
|
||||
}
|
||||
}, [appSettings]);
|
||||
|
||||
@@ -403,17 +401,69 @@ export function SettingsModal({
|
||||
setError('');
|
||||
|
||||
try {
|
||||
await onSaveAppSettings({ bot_enabled: botEnabled, bot_code: botCode });
|
||||
await onSaveAppSettings({ bots });
|
||||
toast.success('Bot settings saved');
|
||||
} catch (err) {
|
||||
console.error('Failed to save bot settings:', err);
|
||||
setError(err instanceof Error ? err.message : 'Failed to save');
|
||||
toast.error('Failed to save settings');
|
||||
const errorMsg = err instanceof Error ? err.message : 'Failed to save';
|
||||
setError(errorMsg);
|
||||
toast.error(errorMsg);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleAddBot = () => {
|
||||
const newBot: BotConfig = {
|
||||
id: crypto.randomUUID(),
|
||||
name: `Bot ${bots.length + 1}`,
|
||||
enabled: false,
|
||||
code: DEFAULT_BOT_CODE,
|
||||
};
|
||||
setBots([...bots, newBot]);
|
||||
setExpandedBotId(newBot.id);
|
||||
};
|
||||
|
||||
const handleDeleteBot = (botId: string) => {
|
||||
const bot = bots.find((b) => b.id === botId);
|
||||
if (bot && bot.code.trim() && bot.code !== DEFAULT_BOT_CODE) {
|
||||
if (!confirm(`Delete "${bot.name}"? This will remove all its code.`)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
setBots(bots.filter((b) => b.id !== botId));
|
||||
if (expandedBotId === botId) {
|
||||
setExpandedBotId(null);
|
||||
}
|
||||
};
|
||||
|
||||
const handleToggleBotEnabled = (botId: string) => {
|
||||
setBots(bots.map((b) => (b.id === botId ? { ...b, enabled: !b.enabled } : b)));
|
||||
};
|
||||
|
||||
const handleBotCodeChange = (botId: string, code: string) => {
|
||||
setBots(bots.map((b) => (b.id === botId ? { ...b, code } : b)));
|
||||
};
|
||||
|
||||
const handleStartEditingName = (bot: BotConfig) => {
|
||||
setEditingNameId(bot.id);
|
||||
setEditingNameValue(bot.name);
|
||||
};
|
||||
|
||||
const handleFinishEditingName = () => {
|
||||
if (editingNameId && editingNameValue.trim()) {
|
||||
setBots(
|
||||
bots.map((b) => (b.id === editingNameId ? { ...b, name: editingNameValue.trim() } : b))
|
||||
);
|
||||
}
|
||||
setEditingNameId(null);
|
||||
setEditingNameValue('');
|
||||
};
|
||||
|
||||
const handleResetBotCode = (botId: string) => {
|
||||
setBots(bots.map((b) => (b.id === botId ? { ...b, code: DEFAULT_BOT_CODE } : b)));
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className="sm:max-w-[50vw] sm:min-w-[500px] max-h-[90vh] overflow-y-auto">
|
||||
@@ -645,6 +695,25 @@ export function SettingsModal({
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Send Advertisement</Label>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Send a flood advertisement to announce your presence on the mesh network.
|
||||
</p>
|
||||
<Button
|
||||
onClick={handleAdvertise}
|
||||
disabled={advertising || !health?.radio_connected}
|
||||
className="w-full bg-yellow-600 hover:bg-yellow-700 text-white"
|
||||
>
|
||||
{advertising ? 'Sending...' : 'Send Advertisement'}
|
||||
</Button>
|
||||
{!health?.radio_connected && (
|
||||
<p className="text-sm text-destructive">Radio not connected</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{error && <div className="text-sm text-destructive">{error}</div>}
|
||||
</TabsContent>
|
||||
|
||||
@@ -827,56 +896,136 @@ export function SettingsModal({
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
<label className="flex items-center gap-3 cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={botEnabled}
|
||||
onChange={(e) => setBotEnabled(e.target.checked)}
|
||||
className="w-4 h-4 rounded border-input accent-primary"
|
||||
/>
|
||||
<span className="text-sm font-medium">Enable Message Bot</span>
|
||||
</label>
|
||||
<div className="flex justify-between items-center">
|
||||
<Label>Bots</Label>
|
||||
<Button type="button" variant="outline" size="sm" onClick={handleAddBot}>
|
||||
+ New Bot
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label htmlFor="bot-code">Bot Code (Python)</Label>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setBotCode(DEFAULT_BOT_CODE)}
|
||||
disabled={!botEnabled}
|
||||
>
|
||||
Reset to Example
|
||||
{bots.length === 0 ? (
|
||||
<div className="text-center py-8 border border-dashed border-input rounded-md">
|
||||
<p className="text-muted-foreground mb-4">No bots configured</p>
|
||||
<Button type="button" variant="outline" onClick={handleAddBot}>
|
||||
Create your first bot
|
||||
</Button>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Define a <code className="bg-muted px-1 rounded">bot()</code> function that
|
||||
receives message data and optionally returns a reply string.
|
||||
</p>
|
||||
<div
|
||||
className={`rounded-md border border-input bg-[#2d2d2d] overflow-auto h-64 ${!botEnabled ? 'opacity-50 pointer-events-none' : ''}`}
|
||||
>
|
||||
<Editor
|
||||
value={botCode}
|
||||
onValueChange={setBotCode}
|
||||
highlight={(code) => highlight(code, languages.python, 'python')}
|
||||
padding={12}
|
||||
style={{
|
||||
fontFamily:
|
||||
'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',
|
||||
fontSize: 13,
|
||||
minHeight: '100%',
|
||||
}}
|
||||
textareaId="bot-code"
|
||||
disabled={!botEnabled}
|
||||
/>
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
{bots.map((bot) => (
|
||||
<div key={bot.id} className="border border-input rounded-md overflow-hidden">
|
||||
{/* Bot header row */}
|
||||
<div
|
||||
className="flex items-center gap-2 px-3 py-2 bg-muted/50 cursor-pointer hover:bg-muted/80"
|
||||
onClick={(e) => {
|
||||
// Don't toggle if clicking on interactive elements
|
||||
if ((e.target as HTMLElement).closest('input, button')) return;
|
||||
setExpandedBotId(expandedBotId === bot.id ? null : bot.id);
|
||||
}}
|
||||
>
|
||||
<span className="text-muted-foreground">
|
||||
{expandedBotId === bot.id ? '▼' : '▶'}
|
||||
</span>
|
||||
|
||||
{/* Bot name (click to edit) */}
|
||||
{editingNameId === bot.id ? (
|
||||
<input
|
||||
type="text"
|
||||
value={editingNameValue}
|
||||
onChange={(e) => setEditingNameValue(e.target.value)}
|
||||
onBlur={handleFinishEditingName}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') handleFinishEditingName();
|
||||
if (e.key === 'Escape') {
|
||||
setEditingNameId(null);
|
||||
setEditingNameValue('');
|
||||
}
|
||||
}}
|
||||
autoFocus
|
||||
className="px-2 py-0.5 text-sm bg-background border border-input rounded flex-1 max-w-[200px]"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
/>
|
||||
) : (
|
||||
<span
|
||||
className="text-sm font-medium flex-1 hover:text-primary cursor-text"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleStartEditingName(bot);
|
||||
}}
|
||||
title="Click to rename"
|
||||
>
|
||||
{bot.name}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{/* Enabled checkbox */}
|
||||
<label
|
||||
className="flex items-center gap-1.5 cursor-pointer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={bot.enabled}
|
||||
onChange={() => handleToggleBotEnabled(bot.id)}
|
||||
className="w-4 h-4 rounded border-input accent-primary"
|
||||
/>
|
||||
<span className="text-xs text-muted-foreground">Enabled</span>
|
||||
</label>
|
||||
|
||||
{/* Delete button */}
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-6 w-6 p-0 text-muted-foreground hover:text-destructive"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleDeleteBot(bot.id);
|
||||
}}
|
||||
title="Delete bot"
|
||||
>
|
||||
🗑
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Bot expanded content */}
|
||||
{expandedBotId === bot.id && (
|
||||
<div className="p-3 space-y-3 border-t border-input">
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Define a <code className="bg-muted px-1 rounded">bot()</code> function
|
||||
that receives message data and optionally returns a reply.
|
||||
</p>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => handleResetBotCode(bot.id)}
|
||||
>
|
||||
Reset to Example
|
||||
</Button>
|
||||
</div>
|
||||
<CodeMirror
|
||||
value={bot.code}
|
||||
onChange={(code) => handleBotCodeChange(bot.id, code)}
|
||||
extensions={[python()]}
|
||||
theme={oneDark}
|
||||
height="256px"
|
||||
basicSetup={{
|
||||
lineNumbers: true,
|
||||
foldGutter: false,
|
||||
highlightActiveLine: true,
|
||||
}}
|
||||
className="rounded-md border border-input overflow-hidden text-sm"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Separator />
|
||||
|
||||
<div className="text-xs text-muted-foreground space-y-1">
|
||||
<p>
|
||||
@@ -884,11 +1033,12 @@ export function SettingsModal({
|
||||
the server environment.
|
||||
</p>
|
||||
<p>
|
||||
<strong>Limits:</strong> 10 second timeout, max 3 concurrent executions.
|
||||
<strong>Limits:</strong> 10 second timeout per bot.
|
||||
</p>
|
||||
<p>
|
||||
<strong>Note:</strong> Bot only responds to incoming messages, not your own. For
|
||||
channel messages, <code>sender_key</code> is <code>None</code>.
|
||||
<strong>Note:</strong> Bots only respond to incoming messages, not your own. For
|
||||
channel messages, <code>sender_key</code> is <code>None</code>. Multiple enabled
|
||||
bots run serially.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -126,6 +126,13 @@ export interface Favorite {
|
||||
id: string; // channel key or contact public key
|
||||
}
|
||||
|
||||
export interface BotConfig {
|
||||
id: string; // UUID for stable identity across renames/reorders
|
||||
name: string; // User-editable name
|
||||
enabled: boolean; // Whether this bot is enabled
|
||||
code: string; // Python code for this bot
|
||||
}
|
||||
|
||||
export interface AppSettings {
|
||||
max_radio_contacts: number;
|
||||
favorites: Favorite[];
|
||||
@@ -134,8 +141,7 @@ export interface AppSettings {
|
||||
last_message_times: Record<string, number>;
|
||||
preferences_migrated: boolean;
|
||||
advert_interval: number;
|
||||
bot_enabled: boolean;
|
||||
bot_code: string;
|
||||
bots: BotConfig[];
|
||||
}
|
||||
|
||||
export interface AppSettingsUpdate {
|
||||
@@ -143,8 +149,7 @@ export interface AppSettingsUpdate {
|
||||
auto_decrypt_dm_on_advert?: boolean;
|
||||
sidebar_sort_order?: 'recent' | 'alpha';
|
||||
advert_interval?: number;
|
||||
bot_enabled?: boolean;
|
||||
bot_code?: string;
|
||||
bots?: BotConfig[];
|
||||
}
|
||||
|
||||
export interface MigratePreferencesRequest {
|
||||
|
||||
+265
-12
@@ -13,6 +13,7 @@ from app.bot import (
|
||||
process_bot_response,
|
||||
run_bot_for_message,
|
||||
)
|
||||
from app.models import BotConfig
|
||||
|
||||
|
||||
class TestExecuteBotCode:
|
||||
@@ -359,12 +360,13 @@ class TestRunBotForMessage:
|
||||
mock_repo.get.assert_not_called()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_skips_when_bot_disabled(self):
|
||||
"""Bot is not triggered when disabled in settings."""
|
||||
async def test_skips_when_no_enabled_bots(self):
|
||||
"""Bot is not triggered when no bots are enabled."""
|
||||
with patch("app.repository.AppSettingsRepository") as mock_repo:
|
||||
mock_settings = MagicMock()
|
||||
mock_settings.bot_enabled = False
|
||||
mock_settings.bot_code = "def bot(): pass"
|
||||
mock_settings.bots = [
|
||||
BotConfig(id="1", name="Bot 1", enabled=False, code="def bot(): pass")
|
||||
]
|
||||
mock_repo.get = AsyncMock(return_value=mock_settings)
|
||||
|
||||
with patch("app.bot.execute_bot_code") as mock_exec:
|
||||
@@ -379,12 +381,33 @@ class TestRunBotForMessage:
|
||||
mock_exec.assert_not_called()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_skips_when_bot_code_empty(self):
|
||||
"""Bot is not triggered when code is empty."""
|
||||
async def test_skips_when_bots_array_empty(self):
|
||||
"""Bot is not triggered when bots array is empty."""
|
||||
with patch("app.repository.AppSettingsRepository") as mock_repo:
|
||||
mock_settings = MagicMock()
|
||||
mock_settings.bot_enabled = True
|
||||
mock_settings.bot_code = ""
|
||||
mock_settings.bots = []
|
||||
mock_repo.get = AsyncMock(return_value=mock_settings)
|
||||
|
||||
with patch("app.bot.execute_bot_code") as mock_exec:
|
||||
await run_bot_for_message(
|
||||
sender_name="Alice",
|
||||
sender_key="abc123",
|
||||
message_text="Hello",
|
||||
is_dm=True,
|
||||
channel_key=None,
|
||||
)
|
||||
|
||||
mock_exec.assert_not_called()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_skips_bot_with_empty_code(self):
|
||||
"""Bot with empty code is skipped even if enabled."""
|
||||
with patch("app.repository.AppSettingsRepository") as mock_repo:
|
||||
mock_settings = MagicMock()
|
||||
mock_settings.bots = [
|
||||
BotConfig(id="1", name="Empty Bot", enabled=True, code=""),
|
||||
BotConfig(id="2", name="Whitespace Bot", enabled=True, code=" "),
|
||||
]
|
||||
mock_repo.get = AsyncMock(return_value=mock_settings)
|
||||
|
||||
with patch("app.bot.execute_bot_code") as mock_exec:
|
||||
@@ -405,12 +428,14 @@ class TestRunBotForMessage:
|
||||
# First call: bot enabled
|
||||
# Second call (after sleep): bot disabled
|
||||
mock_settings_enabled = MagicMock()
|
||||
mock_settings_enabled.bot_enabled = True
|
||||
mock_settings_enabled.bot_code = "def bot(): return 'hi'"
|
||||
mock_settings_enabled.bots = [
|
||||
BotConfig(id="1", name="Bot 1", enabled=True, code="def bot(): return 'hi'")
|
||||
]
|
||||
|
||||
mock_settings_disabled = MagicMock()
|
||||
mock_settings_disabled.bot_enabled = False
|
||||
mock_settings_disabled.bot_code = "def bot(): return 'hi'"
|
||||
mock_settings_disabled.bots = [
|
||||
BotConfig(id="1", name="Bot 1", enabled=False, code="def bot(): return 'hi'")
|
||||
]
|
||||
|
||||
mock_repo.get = AsyncMock(side_effect=[mock_settings_enabled, mock_settings_disabled])
|
||||
|
||||
@@ -433,6 +458,199 @@ class TestRunBotForMessage:
|
||||
mock_exec.assert_not_called()
|
||||
|
||||
|
||||
class TestMultipleBots:
|
||||
"""Test multiple bots functionality."""
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def reset_semaphore(self):
|
||||
"""Reset semaphore state between tests."""
|
||||
while _bot_semaphore.locked():
|
||||
_bot_semaphore.release()
|
||||
yield
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def reset_rate_limit_state(self):
|
||||
"""Reset rate limiting state between tests."""
|
||||
bot_module._last_bot_send_time = 0.0
|
||||
yield
|
||||
bot_module._last_bot_send_time = 0.0
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_multiple_bots_execute_serially(self):
|
||||
"""Multiple enabled bots execute serially in order."""
|
||||
executed_bots = []
|
||||
|
||||
def mock_execute(code, *args, **kwargs):
|
||||
# Extract bot identifier from the code
|
||||
if "Bot 1" in code:
|
||||
executed_bots.append("Bot 1")
|
||||
return "Response 1"
|
||||
elif "Bot 2" in code:
|
||||
executed_bots.append("Bot 2")
|
||||
return "Response 2"
|
||||
return None
|
||||
|
||||
with patch("app.repository.AppSettingsRepository") as mock_repo:
|
||||
mock_settings = MagicMock()
|
||||
mock_settings.bots = [
|
||||
BotConfig(id="1", name="Bot 1", enabled=True, code="# Bot 1\ndef bot(): pass"),
|
||||
BotConfig(id="2", name="Bot 2", enabled=True, code="# Bot 2\ndef bot(): pass"),
|
||||
]
|
||||
mock_repo.get = AsyncMock(return_value=mock_settings)
|
||||
|
||||
with (
|
||||
patch("app.bot.asyncio.sleep", new_callable=AsyncMock),
|
||||
patch("app.bot.execute_bot_code", side_effect=mock_execute),
|
||||
patch("app.bot.process_bot_response", new_callable=AsyncMock),
|
||||
):
|
||||
await run_bot_for_message(
|
||||
sender_name="Alice",
|
||||
sender_key="abc123" + "0" * 58,
|
||||
message_text="Hello",
|
||||
is_dm=True,
|
||||
channel_key=None,
|
||||
)
|
||||
|
||||
# Both bots should have executed in order
|
||||
assert executed_bots == ["Bot 1", "Bot 2"]
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_disabled_bots_are_skipped(self):
|
||||
"""Disabled bots in the array are skipped."""
|
||||
executed_bots = []
|
||||
|
||||
def mock_execute(code, *args, **kwargs):
|
||||
if "Bot 1" in code:
|
||||
executed_bots.append("Bot 1")
|
||||
elif "Bot 2" in code:
|
||||
executed_bots.append("Bot 2")
|
||||
elif "Bot 3" in code:
|
||||
executed_bots.append("Bot 3")
|
||||
return None
|
||||
|
||||
with patch("app.repository.AppSettingsRepository") as mock_repo:
|
||||
mock_settings = MagicMock()
|
||||
mock_settings.bots = [
|
||||
BotConfig(id="1", name="Bot 1", enabled=True, code="# Bot 1\ndef bot(): pass"),
|
||||
BotConfig(id="2", name="Bot 2", enabled=False, code="# Bot 2\ndef bot(): pass"),
|
||||
BotConfig(id="3", name="Bot 3", enabled=True, code="# Bot 3\ndef bot(): pass"),
|
||||
]
|
||||
mock_repo.get = AsyncMock(return_value=mock_settings)
|
||||
|
||||
with (
|
||||
patch("app.bot.asyncio.sleep", new_callable=AsyncMock),
|
||||
patch("app.bot.execute_bot_code", side_effect=mock_execute),
|
||||
):
|
||||
await run_bot_for_message(
|
||||
sender_name="Alice",
|
||||
sender_key="abc123" + "0" * 58,
|
||||
message_text="Hello",
|
||||
is_dm=True,
|
||||
channel_key=None,
|
||||
)
|
||||
|
||||
# Only enabled bots should have executed
|
||||
assert executed_bots == ["Bot 1", "Bot 3"]
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_error_in_one_bot_doesnt_stop_others(self):
|
||||
"""Error in one bot doesn't prevent other bots from running."""
|
||||
executed_bots = []
|
||||
|
||||
def mock_execute(code, *args, **kwargs):
|
||||
if "Bot 1" in code:
|
||||
executed_bots.append("Bot 1")
|
||||
raise ValueError("Bot 1 crashed!")
|
||||
elif "Bot 2" in code:
|
||||
executed_bots.append("Bot 2")
|
||||
return "Response 2"
|
||||
elif "Bot 3" in code:
|
||||
executed_bots.append("Bot 3")
|
||||
return "Response 3"
|
||||
return None
|
||||
|
||||
with patch("app.repository.AppSettingsRepository") as mock_repo:
|
||||
mock_settings = MagicMock()
|
||||
mock_settings.bots = [
|
||||
BotConfig(id="1", name="Bot 1", enabled=True, code="# Bot 1\ndef bot(): pass"),
|
||||
BotConfig(id="2", name="Bot 2", enabled=True, code="# Bot 2\ndef bot(): pass"),
|
||||
BotConfig(id="3", name="Bot 3", enabled=True, code="# Bot 3\ndef bot(): pass"),
|
||||
]
|
||||
mock_repo.get = AsyncMock(return_value=mock_settings)
|
||||
|
||||
with (
|
||||
patch("app.bot.asyncio.sleep", new_callable=AsyncMock),
|
||||
patch("app.bot.execute_bot_code", side_effect=mock_execute),
|
||||
patch("app.bot.process_bot_response", new_callable=AsyncMock) as mock_respond,
|
||||
):
|
||||
await run_bot_for_message(
|
||||
sender_name="Alice",
|
||||
sender_key="abc123" + "0" * 58,
|
||||
message_text="Hello",
|
||||
is_dm=True,
|
||||
channel_key=None,
|
||||
)
|
||||
|
||||
# All bots should have been attempted
|
||||
assert executed_bots == ["Bot 1", "Bot 2", "Bot 3"]
|
||||
|
||||
# Responses from successful bots should have been sent
|
||||
assert mock_respond.call_count == 2
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_timeout_in_one_bot_doesnt_stop_others(self):
|
||||
"""Timeout in one bot doesn't prevent other bots from running."""
|
||||
executed_bots = []
|
||||
|
||||
async def mock_wait_for(coro, timeout):
|
||||
result = await coro
|
||||
# Simulate timeout for Bot 2
|
||||
if len(executed_bots) == 2 and executed_bots[-1] == "Bot 2":
|
||||
raise asyncio.TimeoutError()
|
||||
return result
|
||||
|
||||
def mock_execute(code, *args, **kwargs):
|
||||
if "Bot 1" in code:
|
||||
executed_bots.append("Bot 1")
|
||||
return "Response 1"
|
||||
elif "Bot 2" in code:
|
||||
executed_bots.append("Bot 2")
|
||||
return "Response 2" # This will be "timed out"
|
||||
elif "Bot 3" in code:
|
||||
executed_bots.append("Bot 3")
|
||||
return "Response 3"
|
||||
return None
|
||||
|
||||
with patch("app.repository.AppSettingsRepository") as mock_repo:
|
||||
mock_settings = MagicMock()
|
||||
mock_settings.bots = [
|
||||
BotConfig(id="1", name="Bot 1", enabled=True, code="# Bot 1\ndef bot(): pass"),
|
||||
BotConfig(id="2", name="Bot 2", enabled=True, code="# Bot 2\ndef bot(): pass"),
|
||||
BotConfig(id="3", name="Bot 3", enabled=True, code="# Bot 3\ndef bot(): pass"),
|
||||
]
|
||||
mock_repo.get = AsyncMock(return_value=mock_settings)
|
||||
|
||||
with (
|
||||
patch("app.bot.asyncio.sleep", new_callable=AsyncMock),
|
||||
patch("app.bot.execute_bot_code", side_effect=mock_execute),
|
||||
patch("app.bot.asyncio.wait_for", side_effect=mock_wait_for),
|
||||
patch("app.bot.process_bot_response", new_callable=AsyncMock) as mock_respond,
|
||||
):
|
||||
await run_bot_for_message(
|
||||
sender_name="Alice",
|
||||
sender_key="abc123" + "0" * 58,
|
||||
message_text="Hello",
|
||||
is_dm=True,
|
||||
channel_key=None,
|
||||
)
|
||||
|
||||
# All bots should have been attempted
|
||||
assert executed_bots == ["Bot 1", "Bot 2", "Bot 3"]
|
||||
|
||||
# Only responses from non-timed-out bots (Bot 1 and Bot 3)
|
||||
assert mock_respond.call_count == 2
|
||||
|
||||
|
||||
class TestBotCodeValidation:
|
||||
"""Test bot code syntax validation on save."""
|
||||
|
||||
@@ -455,6 +673,18 @@ class TestBotCodeValidation:
|
||||
assert exc_info.value.status_code == 400
|
||||
assert "syntax error" in exc_info.value.detail.lower()
|
||||
|
||||
def test_syntax_error_includes_bot_name(self):
|
||||
"""Syntax error message includes bot name when provided."""
|
||||
from fastapi import HTTPException
|
||||
|
||||
from app.routers.settings import validate_bot_code
|
||||
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
validate_bot_code("def bot(:\n return 'broken'", bot_name="My Test Bot")
|
||||
|
||||
assert exc_info.value.status_code == 400
|
||||
assert "My Test Bot" in exc_info.value.detail
|
||||
|
||||
def test_empty_code_passes(self):
|
||||
"""Empty code passes validation (disables bot)."""
|
||||
from app.routers.settings import validate_bot_code
|
||||
@@ -463,6 +693,29 @@ class TestBotCodeValidation:
|
||||
validate_bot_code("")
|
||||
validate_bot_code(" ")
|
||||
|
||||
def test_validate_all_bots(self):
|
||||
"""validate_all_bots validates all bots' code."""
|
||||
from fastapi import HTTPException
|
||||
|
||||
from app.routers.settings import validate_all_bots
|
||||
|
||||
# Valid bots should pass
|
||||
valid_bots = [
|
||||
BotConfig(id="1", name="Bot 1", enabled=True, code="def bot(): return 'hi'"),
|
||||
BotConfig(id="2", name="Bot 2", enabled=False, code="def bot(): return 'hello'"),
|
||||
]
|
||||
validate_all_bots(valid_bots) # Should not raise
|
||||
|
||||
# Invalid code should raise with bot name
|
||||
invalid_bots = [
|
||||
BotConfig(id="1", name="Good Bot", enabled=True, code="def bot(): return 'hi'"),
|
||||
BotConfig(id="2", name="Bad Bot", enabled=True, code="def bot(:"),
|
||||
]
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
validate_all_bots(invalid_bots)
|
||||
|
||||
assert "Bad Bot" in exc_info.value.detail
|
||||
|
||||
|
||||
class TestBotMessageRateLimiting:
|
||||
"""Test bot message rate limiting for repeater compatibility."""
|
||||
|
||||
+101
-7
@@ -100,8 +100,8 @@ class TestMigration001:
|
||||
# Run migrations
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 12 # All 11 migrations run
|
||||
assert await get_version(conn) == 12
|
||||
assert applied == 13 # All 13 migrations run
|
||||
assert await get_version(conn) == 13
|
||||
|
||||
# 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 == 12 # All 11 migrations run
|
||||
assert applied1 == 13 # All 13 migrations run
|
||||
assert applied2 == 0 # No migrations on second run
|
||||
assert await get_version(conn) == 12
|
||||
assert await get_version(conn) == 13
|
||||
finally:
|
||||
await conn.close()
|
||||
|
||||
@@ -245,9 +245,9 @@ class TestMigration001:
|
||||
# Run migrations - should not fail
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
# All 11 migrations applied (version incremented) but no error
|
||||
assert applied == 12
|
||||
assert await get_version(conn) == 12
|
||||
# All 13 migrations applied (version incremented) but no error
|
||||
assert applied == 13
|
||||
assert await get_version(conn) == 13
|
||||
finally:
|
||||
await conn.close()
|
||||
|
||||
@@ -337,3 +337,97 @@ class TestMigration001:
|
||||
assert row["last_read_at"] is None
|
||||
finally:
|
||||
await conn.close()
|
||||
|
||||
|
||||
class TestMigration013:
|
||||
"""Test migration 013: convert bot_enabled/bot_code to multi-bot format."""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_migration_converts_existing_bot_to_array(self):
|
||||
"""Migration converts existing bot_enabled/bot_code to bots array."""
|
||||
import json
|
||||
|
||||
conn = await aiosqlite.connect(":memory:")
|
||||
conn.row_factory = aiosqlite.Row
|
||||
try:
|
||||
# Set version to 12 (just before migration 13)
|
||||
await set_version(conn, 12)
|
||||
|
||||
# Create app_settings with old bot columns
|
||||
await conn.execute("""
|
||||
CREATE TABLE app_settings (
|
||||
id INTEGER PRIMARY KEY,
|
||||
max_radio_contacts INTEGER DEFAULT 50,
|
||||
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,
|
||||
advert_interval INTEGER DEFAULT 0,
|
||||
last_advert_time INTEGER DEFAULT 0,
|
||||
bot_enabled INTEGER DEFAULT 0,
|
||||
bot_code TEXT DEFAULT ''
|
||||
)
|
||||
""")
|
||||
await conn.execute(
|
||||
"INSERT INTO app_settings (id, bot_enabled, bot_code) VALUES (1, 1, 'def bot(): return \"hello\"')"
|
||||
)
|
||||
await conn.commit()
|
||||
|
||||
# Run migration 13
|
||||
applied = await run_migrations(conn)
|
||||
assert applied == 1
|
||||
assert await get_version(conn) == 13
|
||||
|
||||
# Verify bots array was created with migrated data
|
||||
cursor = await conn.execute("SELECT bots FROM app_settings WHERE id = 1")
|
||||
row = await cursor.fetchone()
|
||||
bots = json.loads(row["bots"])
|
||||
|
||||
assert len(bots) == 1
|
||||
assert bots[0]["name"] == "Bot 1"
|
||||
assert bots[0]["enabled"] is True
|
||||
assert bots[0]["code"] == 'def bot(): return "hello"'
|
||||
assert "id" in bots[0] # Should have a UUID
|
||||
finally:
|
||||
await conn.close()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_migration_creates_empty_array_when_no_bot(self):
|
||||
"""Migration creates empty bots array when no existing bot data."""
|
||||
import json
|
||||
|
||||
conn = await aiosqlite.connect(":memory:")
|
||||
conn.row_factory = aiosqlite.Row
|
||||
try:
|
||||
await set_version(conn, 12)
|
||||
|
||||
await conn.execute("""
|
||||
CREATE TABLE app_settings (
|
||||
id INTEGER PRIMARY KEY,
|
||||
max_radio_contacts INTEGER DEFAULT 50,
|
||||
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,
|
||||
advert_interval INTEGER DEFAULT 0,
|
||||
last_advert_time INTEGER DEFAULT 0,
|
||||
bot_enabled INTEGER DEFAULT 0,
|
||||
bot_code TEXT DEFAULT ''
|
||||
)
|
||||
""")
|
||||
await conn.execute(
|
||||
"INSERT INTO app_settings (id, bot_enabled, bot_code) VALUES (1, 0, '')"
|
||||
)
|
||||
await conn.commit()
|
||||
|
||||
await run_migrations(conn)
|
||||
|
||||
cursor = await conn.execute("SELECT bots FROM app_settings WHERE id = 1")
|
||||
row = await cursor.fetchone()
|
||||
bots = json.loads(row["bots"])
|
||||
|
||||
assert bots == []
|
||||
finally:
|
||||
await conn.close()
|
||||
Reference in new issue
Block a user