diff --git a/work/dashboard-frontend/src/lib/api.ts b/work/dashboard-frontend/src/lib/api.ts index 8323e42..b24d85e 100644 --- a/work/dashboard-frontend/src/lib/api.ts +++ b/work/dashboard-frontend/src/lib/api.ts @@ -699,15 +699,25 @@ export interface MeshcoreContact { export interface MeshcoreContacts { active: boolean contacts: MeshcoreContact[] + last_synced_at?: number | null // epoch seconds the roster was pulled from the companion } export interface MeshcoreSelf { name?: string | null pubkey?: string | null connected: boolean - host?: string - port?: number + // Connection reporting: only the fields for the live `conn_type` are set; + // the rest are null. A serial companion has no host/port — showing a config + // leftover there would name a device meshai is not actually talking to. + conn_type?: 'tcp' | 'serial' | 'ble' | string + target?: string // human-readable: "serial:/dev/x@115200" | "host:port" | "ble:addr" + host?: string | null + port?: number | null + serial_port?: string | null + baud?: number | null + ble_address?: string | null channel_count?: number last_advert_sent?: number | null // epoch seconds; null/absent = never advertised + contacts_synced_at?: number | null } export async function fetchMeshcoreContacts(): Promise { @@ -717,6 +727,109 @@ export async function fetchMeshcoreSelf(): Promise { return fetchJson('/api/meshcore/self') } +// Result of a full roster resync: what the reconcile actually changed. +export interface MeshcoreRefreshStats { + before: number + after: number + added: number + removed: number + updated: number + added_keys: string[] + removed_keys: string[] +} +// Channels are also a connect-time snapshot, so a resync re-reads them too. +export interface MeshcoreChannelStats { + before: number + after: number + added: string[] + removed: string[] +} +export interface MeshcoreRefreshResult { + active: boolean + stats: MeshcoreRefreshStats + channel_stats: MeshcoreChannelStats + contacts: MeshcoreContact[] + channels: string[] + last_synced_at: number | null +} + +// Re-read the companion's device view: FULL contact refetch + reconcile (drops +// contacts the companion no longer has) AND channel re-enumeration. Throws with +// the backend's `detail` when MeshCore is not connected or the fetch fails. +export async function refreshMeshcoreContacts(): Promise { + const response = await fetch('/api/meshcore/contacts/refresh', { method: 'POST' }) + if (!response.ok) { + const body = await response.json().catch(() => null) + throw new Error(body?.detail || `API error: ${response.status} ${response.statusText}`) + } + return response.json() +} + +// Write contact records onto the companion (upsert; nothing is removed, and no +// mesh traffic is generated). Used both for a manual single add — e.g. after a +// room server is rebuilt with a new keypair — and for restoring an exported +// roster onto a replacement companion. +export interface MeshcoreImportResult { + active: boolean + imported: number + failed: number + errors: { pubkey: string | null; detail: string }[] +} +export async function importMeshcoreContacts( + contacts: Record[], +): Promise { + const response = await fetch('/api/meshcore/contacts/import', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ contacts }), + }) + if (!response.ok) { + const body = await response.json().catch(() => null) + throw new Error(body?.detail || `API error: ${response.status} ${response.statusText}`) + } + return response.json() +} + +// Remove a contact from the companion. Requires the FULL 64-hex pubkey. +export async function removeMeshcoreContact(pubkey: string): Promise { + const response = await fetch(`/api/meshcore/contacts/${encodeURIComponent(pubkey)}`, { + method: 'DELETE', + }) + if (!response.ok) { + const body = await response.json().catch(() => null) + throw new Error(body?.detail || `API error: ${response.status} ${response.statusText}`) + } + return response.json() +} + +// A routing cell whose MeshCore target does not resolve on the companion. +export interface MeshcoreDanglingRoute { + family: string + region: string + target: string + kind: 'room' | 'channel' | string + reason: 'room_not_found' | 'channel_not_found' | 'not_a_room' | string + enabled: boolean +} +// Roster entries sharing a name but not a keypair — indistinguishable by name. +export interface MeshcoreNameCollision { + name: string + count: number + contacts: { pubkey: string; type: number | null }[] +} +export interface MeshcoreRouteHealth { + active: boolean + dangling: MeshcoreDanglingRoute[] + dangling_enabled: number + collisions: MeshcoreNameCollision[] + checked: number + mc_enabled: boolean +} + +export async function fetchMeshcoreRouteHealth(): Promise { + return fetchJson('/api/meshcore/route-health') +} + export async function sendMeshcoreAdvert(): Promise { const response = await fetch('/api/meshcore/advert', { method: 'POST', diff --git a/work/dashboard-frontend/src/pages/MeshCoreCompanion.tsx b/work/dashboard-frontend/src/pages/MeshCoreCompanion.tsx index 38c19f9..bd9dd4d 100644 --- a/work/dashboard-frontend/src/pages/MeshCoreCompanion.tsx +++ b/work/dashboard-frontend/src/pages/MeshCoreCompanion.tsx @@ -10,6 +10,32 @@ import { type TestSendResult, } from '../lib/api' +// How meshai is attached to the companion. Distinct colours so the transport is +// readable at a glance — an operator must be able to tell WHICH device this is +// before acting on it. +const CONN_TYPE_BADGE: Record = { + serial: 'bg-emerald-500/15 text-emerald-400', + tcp: 'bg-sky-500/15 text-sky-400', + ble: 'bg-violet-500/15 text-violet-400', +} + +/** The live connection target, from whichever fields belong to this conn_type. + * + * Falls back to the per-transport fields if `target` is absent (older backend). + * Never falls back to host/port for a non-TCP link: that is exactly the + * mistake this display exists to prevent. + */ +function connectionTarget(self: MeshcoreSelf | null): string { + if (!self) return '—' + if (self.target) return self.target + if (self.conn_type === 'serial') { + return self.serial_port ? `${self.serial_port}@${self.baud ?? 115200}` : 'serial' + } + if (self.conn_type === 'ble') return self.ble_address || 'ble' + if (self.host) return `${self.host}${self.port != null ? `:${self.port}` : ''}` + return '—' +} + /** Format epoch seconds as a human-readable relative time string. */ function relativeTime(epochSec: number): string { const diffSec = Math.floor(Date.now() / 1000 - epochSec) @@ -178,10 +204,18 @@ export default function MeshCoreCompanion() {
{self?.name ?? 'unnamed'}
-
Host
-
- {self?.host ?? '—'} - {self?.port != null ? `:${self.port}` : ''} +
Connection
+
+ + {self?.conn_type ?? 'unknown'} + + + {connectionTarget(self)} +
diff --git a/work/dashboard-frontend/src/pages/MeshCoreContacts.tsx b/work/dashboard-frontend/src/pages/MeshCoreContacts.tsx index 90373b9..38916ab 100644 --- a/work/dashboard-frontend/src/pages/MeshCoreContacts.tsx +++ b/work/dashboard-frontend/src/pages/MeshCoreContacts.tsx @@ -1,13 +1,20 @@ -import { Fragment, useCallback, useEffect, useState } from 'react' -import { Users } from 'lucide-react' +import { Fragment, useCallback, useEffect, useMemo, useState } from 'react' +import { AlertTriangle, Copy, Download, Plus, RefreshCw, Trash2, Users } from 'lucide-react' import { fetchMeshcoreContacts, + fetchMeshcoreRouteHealth, fetchMeshcoreTelemetry, fetchConnectionConfig, + importMeshcoreContacts, pollMeshcoreContact, + refreshMeshcoreContacts, + removeMeshcoreContact, updateConfig, + type MeshcoreChannelStats, type MeshcoreContacts, type MeshcoreContact, + type MeshcoreRefreshStats, + type MeshcoreRouteHealth, type MeshcoreTelemetry, type MeshcoreTelemetryEntry, type MeshcoreTelemetryData, @@ -18,10 +25,32 @@ import { const TELEMETRY_POLL_MS = 15000 const MIN_INTERVAL_MINUTES = 5 -// Relative time for epoch-seconds fields (last_advert). +// A contact not heard from in this long is flagged stale. Adverts are typically +// hours apart, so days — not hours — is the honest threshold for "gone quiet". +const STALE_AFTER_DAYS = 14 +const STALE_AFTER_SECONDS = STALE_AFTER_DAYS * 86400 + +type SortKey = 'name' | 'type' | 'last_advert' +type TypeFilter = 'all' | 'rooms' | 'stale' + +function isStale(c: MeshcoreContact): boolean { + if (c.last_advert == null || c.last_advert <= 0) return false + return Math.floor(Date.now() / 1000) - c.last_advert > STALE_AFTER_SECONDS +} + +// Why a routing cell will not resolve, in operator language. +const DANGLING_REASON: Record = { + room_not_found: 'no room server with this key is on the companion', + channel_not_found: 'this channel is not on the companion', + not_a_room: 'this key belongs to a contact that is not a room server', +} + +// Relative time for epoch-seconds fields (last_advert, last_synced_at). +// Floors the DIFFERENCE, not just the clock: last_synced_at is a float, so +// flooring only Date.now() would leave a fractional "28.6851...s ago". function relativeTime(epochSeconds: number | null): string { if (epochSeconds == null) return '—' - const diff = Math.floor(Date.now() / 1000) - epochSeconds + const diff = Math.floor(Date.now() / 1000 - epochSeconds) if (diff < 0) return 'just now' if (diff < 60) return `${diff}s ago` const mins = Math.floor(diff / 60) @@ -145,6 +174,31 @@ export default function MeshCoreContacts() { const [connectionConfig, setConnectionConfig] = useState(null) const [telemetry, setTelemetry] = useState(null) + // Roster management: resync / export / delete / route health. + const [routeHealth, setRouteHealth] = useState(null) + const [resyncing, setResyncing] = useState(false) + const [resyncStats, setResyncStats] = useState(null) + const [channelStats, setChannelStats] = useState(null) + const [lastSyncedAt, setLastSyncedAt] = useState(null) + + // Manual add — the companion learns most contacts by advert, but a node that + // has been rekeyed (or is not yet heard) has to be entered by key. + const [showAdd, setShowAdd] = useState(false) + const [addName, setAddName] = useState('') + const [addPubkey, setAddPubkey] = useState('') + const [addType, setAddType] = useState(1) + const [adding, setAdding] = useState(false) + const [addError, setAddError] = useState(null) + const [confirmDelete, setConfirmDelete] = useState(null) + const [deletingId, setDeletingId] = useState(null) + const [expandedKey, setExpandedKey] = useState(null) + + // Table controls. + const [search, setSearch] = useState('') + const [typeFilter, setTypeFilter] = useState('all') + const [sortKey, setSortKey] = useState('name') + const [sortAsc, setSortAsc] = useState(true) + // Per-row transient UI state. const [savingId, setSavingId] = useState(null) const [savedId, setSavedId] = useState(null) @@ -169,7 +223,10 @@ export default function MeshCoreContacts() { setError(null) try { const result = await fetchMeshcoreContacts() - if (!cancelled) setData(result) + if (!cancelled) { + setData(result) + setLastSyncedAt(result.last_synced_at ?? null) + } } catch (err) { if (!cancelled) { setError(err instanceof Error ? err.message : 'Failed to load contacts') @@ -183,6 +240,21 @@ export default function MeshCoreContacts() { } }, []) + // Route health (once): which routing cells point at something that no longer + // exists. Non-fatal — the roster is still useful if this check fails. + const loadRouteHealth = useCallback(async () => { + try { + const health = await fetchMeshcoreRouteHealth() + setRouteHealth(health) + } catch { + // non-fatal — banner simply stays hidden + } + }, []) + + useEffect(() => { + loadRouteHealth() + }, [loadRouteHealth]) + // Connection config (once) — kept whole so PUTs send it back intact. useEffect(() => { let cancelled = false @@ -292,6 +364,150 @@ export default function MeshCoreContacts() { } }, []) + // Full resync: refetch the whole roster from the node and reconcile, so + // entries the companion no longer has are dropped rather than lingering. + const handleResync = useCallback(async () => { + setResyncing(true) + setResyncStats(null) + setChannelStats(null) + setSaveError(null) + try { + const result = await refreshMeshcoreContacts() + setData({ active: result.active, contacts: result.contacts }) + setLastSyncedAt(result.last_synced_at) + setResyncStats(result.stats) + setChannelStats(result.channel_stats) + // Roster and channels just changed — re-check the routing cells against them. + loadRouteHealth() + } catch (err) { + setSaveError(err instanceof Error ? err.message : 'Resync failed') + } finally { + setResyncing(false) + } + }, [loadRouteHealth]) + + // Add a contact by key. Minimal record: the companion fills in the rest when + // the node next adverts; out_path_len -1 means "flood until a path is known". + const handleAdd = useCallback(async () => { + const pubkey = addPubkey.trim().toLowerCase() + const name = addName.trim() + if (!/^[0-9a-f]{64}$/.test(pubkey)) { + setAddError('Pubkey must be exactly 64 hex characters (the full key, not a prefix)') + return + } + if (!name) { + setAddError('A name is required') + return + } + setAdding(true) + setAddError(null) + try { + const result = await importMeshcoreContacts([ + { pubkey, name, type: addType, flags: 0, out_path_len: -1, out_path: '', last_advert: 0 }, + ]) + if (result.failed > 0) { + setAddError(result.errors[0]?.detail || 'Add failed') + return + } + setShowAdd(false) + setAddName('') + setAddPubkey('') + // Re-read so the new contact appears with whatever the companion stored. + const refreshed = await fetchMeshcoreContacts() + setData(refreshed) + setLastSyncedAt(refreshed.last_synced_at ?? null) + loadRouteHealth() + } catch (err) { + setAddError(err instanceof Error ? err.message : 'Add failed') + } finally { + setAdding(false) + } + }, [addPubkey, addName, addType, loadRouteHealth]) + + // Export streams from the API (not from component state) so the file is the + // full importable record set, not the display projection shown in the table. + const handleExport = useCallback(() => { + window.location.href = '/api/meshcore/contacts/export' + }, []) + + const handleDelete = useCallback(async (c: MeshcoreContact) => { + setDeletingId(c.pubkey) + setSaveError(null) + try { + const result = await removeMeshcoreContact(c.pubkey) + setData((prev) => ({ active: true, contacts: result.contacts, last_synced_at: prev?.last_synced_at ?? null })) + setConfirmDelete(null) + loadRouteHealth() + } catch (err) { + setSaveError(err instanceof Error ? err.message : 'Delete failed') + } finally { + setDeletingId((d) => (d === c.pubkey ? null : d)) + } + }, [loadRouteHealth]) + + const handleCopyPubkey = useCallback(async (pubkey: string) => { + try { + await navigator.clipboard.writeText(pubkey) + } catch { + // clipboard unavailable (non-secure context) — no-op + } + }, []) + + const toggleSort = useCallback((key: SortKey) => { + setSortKey((prev) => { + if (prev === key) { + setSortAsc((asc) => !asc) + return prev + } + setSortAsc(true) + return key + }) + }, []) + + // Names collide across keypairs, so a name alone cannot identify a contact. + // Flag the ambiguous ones inline rather than leaving two identical rows. + const collidingNames = useMemo(() => { + const names = new Set() + for (const collision of routeHealth?.collisions ?? []) names.add(collision.name) + return names + }, [routeHealth]) + + const visibleContacts = useMemo(() => { + let list = data?.contacts ?? [] + const needle = search.trim().toLowerCase() + if (needle) { + list = list.filter( + (c) => + (c.name ?? '').toLowerCase().includes(needle) || + c.pubkey.toLowerCase().includes(needle) + ) + } + if (typeFilter === 'rooms') list = list.filter((c) => c.type === 3) + else if (typeFilter === 'stale') list = list.filter(isStale) + + const sorted = [...list].sort((a, b) => { + let cmp = 0 + if (sortKey === 'name') { + cmp = (a.name ?? '').localeCompare(b.name ?? '') + } else if (sortKey === 'type') { + cmp = (a.type ?? 0) - (b.type ?? 0) + } else { + cmp = (a.last_advert ?? 0) - (b.last_advert ?? 0) + } + return sortAsc ? cmp : -cmp + }) + return sorted + }, [data, search, typeFilter, sortKey, sortAsc]) + + const staleCount = useMemo( + () => (data?.contacts ?? []).filter(isStale).length, + [data] + ) + const roomCount = useMemo( + () => (data?.contacts ?? []).filter((c) => c.type === 3).length, + [data] + ) + const handleSaveInterval = useCallback(async () => { if (!connectionConfig) return const minutes = Math.max(MIN_INTERVAL_MINUTES, Math.round(intervalMinutes) || MIN_INTERVAL_MINUTES) @@ -316,9 +532,11 @@ export default function MeshCoreContacts() { }, [connectionConfig, intervalMinutes]) const rosterActive = data?.active !== false + const dangling = routeHealth?.dangling ?? [] + const collisions = routeHealth?.collisions ?? [] return ( -
+
{/* Header */}
@@ -333,6 +551,192 @@ export default function MeshCoreContacts() {
+ {/* Dangling-route warning — a cell pointing into the void fails SILENTLY + at send time, so this is the only place it becomes visible. */} + {dangling.length > 0 && ( +
+
+ +
+

+ {dangling.length} routing {dangling.length === 1 ? 'cell points' : 'cells point'} at a + destination that no longer exists +

+

+ These cells cannot be delivered — a send to a missing room or channel fails + silently. Fix the target on the Routing page, or resync if the roster is stale. +

+
    + {dangling.map((d) => ( +
  • + + {d.family} + + {d.region} + + {d.target} + + — {DANGLING_REASON[d.reason] ?? d.reason} + + {!d.enabled && ( + + disabled + + )} +
  • + ))} +
+
+
+
+ )} + + {/* Name collisions — two keypairs advertising the same name are + indistinguishable in any name-based picker. */} + {collisions.length > 0 && ( +
+
+ +
+

+ {collisions.length} duplicated {collisions.length === 1 ? 'name' : 'names'} on the roster +

+

+ These names each map to more than one public key. A name alone cannot identify + them — always confirm the key before routing to or deleting one. +

+
    + {collisions.map((c) => ( +
  • + {c.name}{' '} + ×{c.count} + + {c.contacts.map((x) => shortPubkey(x.pubkey)).join(' · ')} + +
  • + ))} +
+
+
+
+ )} + + {/* Roster toolbar: sync state + resync/export */} + {rosterActive && ( +
+
+ + + + + Last synced {lastSyncedAt != null ? relativeTime(lastSyncedAt) : 'unknown'} + + {resyncStats && ( + + +{resyncStats.added} added + {' · '} + −{resyncStats.removed} removed + {' · '} + {resyncStats.updated} updated + {' · '} + {resyncStats.after} total + {channelStats && ( + + {' · '}channels {channelStats.after} + {channelStats.added.length > 0 && ( + +{channelStats.added.length} + )} + {channelStats.removed.length > 0 && ( + −{channelStats.removed.length} + )} + + )} + + )} +
+ + {/* Add a contact by key — the companion learns most nodes by advert, + but a rekeyed or out-of-range node has to be entered manually. */} + {showAdd && ( +
+
+ setAddName(e.target.value)} + placeholder="Name" + className="w-40 px-2 py-1 text-sm bg-bg-card border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]" + /> + setAddPubkey(e.target.value)} + placeholder="Full 64-character hex public key" + className="flex-1 min-w-[280px] px-2 py-1 text-sm font-mono bg-bg-card border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]" + /> + + + +
+ {addError &&

{addError}

} +

+ Writes the contact straight to the companion — nothing is transmitted. Use this + when a node has been rebuilt with a new keypair, or is not yet in range to advert. +

+
+ )} + +

+ The roster and channel list are a snapshot cached from the companion at connect. Resync + re-reads both from the node and reconciles them — the only action that removes + entries the companion has dropped, or picks up a channel added on the radio. +

+
+ )} + {/* Auto-poll interval control */} {rosterActive && connectionConfig && (
@@ -389,13 +793,56 @@ export default function MeshCoreContacts() {

) : ( -
+
+ {/* Filter / search toolbar */} +
+ setSearch(e.target.value)} + placeholder="Search name or pubkey…" + className="flex-1 min-w-[180px] px-2 py-1 text-sm bg-[#0a0e17] border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]" + /> +
+ {([ + { key: 'all', label: `All ${data?.contacts.length ?? 0}` }, + { key: 'rooms', label: `Rooms ${roomCount}` }, + { key: 'stale', label: `Stale ${staleCount}` }, + ] as const).map(({ key, label }) => ( + + ))} +
+
+ +
- - - + + + @@ -403,7 +850,7 @@ export default function MeshCoreContacts() { - {(data?.contacts ?? []).map((c) => { + {visibleContacts.map((c) => { const id = contactId(c) const entry = entryFor(c) const selected = isSelected(c) @@ -437,14 +884,53 @@ export default function MeshCoreContacts() { return ( - + - + + {confirmDelete === c.pubkey && ( + + + + )} {hasReadout && (
NameTypeLast heard + + + + + + Position Pubkey Auto-poll
{contactName(c)} +
+ {contactName(c)} + {c.name != null && collidingNames.has(c.name) && ( + + dup name + + )} +
+
{relativeTime(c.last_advert)} +
+ {relativeTime(c.last_advert)} + {isStale(c) && ( + + stale + + )} +
+
{position(c)} - {shortPubkey(c.pubkey)} +
+ + +
- +
+ + {/* Two-step delete: removal from the companion is + permanent — the node must be rediscovered. */} + {confirmDelete === c.pubkey ? ( + <> + + + + ) : ( + + )} +
+ + Remove {contactName(c)}{' '} + {shortPubkey(c.pubkey)}{' '} + from the companion? It will only return if the node advertises again. + +
@@ -500,6 +1026,12 @@ export default function MeshCoreContacts() { })}
+ {visibleContacts.length === 0 && ( +
+ No contacts match this filter. +
+ )} +
)}
diff --git a/work/meshai/config.py b/work/meshai/config.py index 7df5a16..ea0a306 100644 --- a/work/meshai/config.py +++ b/work/meshai/config.py @@ -59,6 +59,10 @@ class ConnectionConfig: meshcore_baud: int = 115200 meshcore_ble_address: str = "" # optional; for ble meshcore_auto_add_contacts: bool = True # firmware auto-adds every node it hears an advert from (so AIDA can DM anyone) + # Refresh the cached roster whenever an advert/path-update is heard. Costs one + # incremental contact fetch to the companion per advert (local chatter, never a + # mesh send); false = lib default (connect-time snapshot + explicit resync only). + meshcore_auto_update_contacts: bool = True meshcore_ack_wait_seconds: float = 6.0 # wait for delivery ACK before falling back to path discovery meshcore_discovery_wait_seconds: float = 8.0 # path-discovery timeout on the no-ACK fallback (was hardcoded 25s) diff --git a/work/meshai/dashboard/api/mesh_send_routes.py b/work/meshai/dashboard/api/mesh_send_routes.py index 5a02a38..f5ddabf 100644 --- a/work/meshai/dashboard/api/mesh_send_routes.py +++ b/work/meshai/dashboard/api/mesh_send_routes.py @@ -1,16 +1,23 @@ """Dashboard 'send test message' API routes (meshtastic + meshcore).""" import logging -from datetime import datetime +from datetime import datetime, timezone from typing import Optional, Union from fastapi import APIRouter, HTTPException, Request +from fastapi.responses import JSONResponse from pydantic import BaseModel from meshai import secrets_store +from meshai.meshcore_roster import check_route_health, find_name_collisions logger = logging.getLogger(__name__) router = APIRouter(tags=["mesh-send"]) +# Roster export envelope: identifies the file on the way back in so an import +# can reject something that was never a meshai roster. +_ROSTER_EXPORT_FORMAT = "meshai.meshcore.roster" +_ROSTER_EXPORT_VERSION = 1 + def _find_child(connector, name: str): """Find a child transport by transport_name — handles bare transport or CompositeTransport.""" @@ -163,7 +170,12 @@ async def meshcore_rooms(request: Request): @router.get("/meshcore/contacts") async def meshcore_contacts(request: Request): - """Roster of known MeshCore contacts if a meshcore transport is connected.""" + """Roster of known MeshCore contacts if a meshcore transport is connected. + + ``last_synced_at`` (epoch seconds, or null) is when the roster was last + pulled from the companion, so the UI can present it as a snapshot with a + known age rather than implying it is live. + """ connector = getattr(request.app.state, "connector", None) mc = _find_child(connector, "meshcore") if mc is not None and getattr(mc, "connected", False): @@ -171,8 +183,253 @@ async def meshcore_contacts(request: Request): contacts = list(mc.get_contacts()) except Exception: contacts = [] - return {"active": True, "contacts": contacts} - return {"active": False, "contacts": []} + try: + last_synced_at = mc.contacts_synced_at() + except Exception: + last_synced_at = None + return {"active": True, "contacts": contacts, "last_synced_at": last_synced_at} + return {"active": False, "contacts": [], "last_synced_at": None} + + +@router.post("/meshcore/contacts/refresh") +async def meshcore_refresh_contacts(request: Request): + """Re-read the companion's device view — contacts AND channels. + + meshai builds its picture of the device at connect and never re-reads it, + so a contact removed (or a channel provisioned) on the radio afterwards is + invisible until a restart. This is the resync path. + + Unlike the passive roster read, the contact reconcile DROPS entries the + companion no longer has (the lib's own fetch only ever merges). Returns the + reconcile stats, the channel delta, and the refreshed roster + channel list. + """ + connector = getattr(request.app.state, "connector", None) + mc = _find_child(connector, "meshcore") + if mc is None or not getattr(mc, "connected", False): + raise HTTPException(status_code=409, detail="MeshCore not connected") + + try: + result = mc.resync() + except RuntimeError as exc: + raise HTTPException(status_code=502, detail=str(exc)) + except Exception as exc: + logger.error("dashboard: meshcore resync error: %s", exc) + raise HTTPException(status_code=500, detail=str(exc)) + + stats = result.get("contacts", {}) + channel_stats = result.get("channels", {}) + + try: + contacts = list(mc.get_contacts()) + except Exception: + contacts = [] + try: + channels = list(mc.known_channels()) + except Exception: + channels = [] + try: + last_synced_at = mc.contacts_synced_at() + except Exception: + last_synced_at = None + + logger.info( + "dashboard: meshcore resync — contacts +%d/-%d (now %d), channels +%d/-%d", + stats.get("added", 0), stats.get("removed", 0), stats.get("after", 0), + len(channel_stats.get("added", [])), len(channel_stats.get("removed", [])), + ) + return { + "active": True, + "stats": stats, + "channel_stats": channel_stats, + "contacts": contacts, + "channels": channels, + "last_synced_at": last_synced_at, + } + + +@router.get("/meshcore/contacts/export") +async def meshcore_export_contacts(request: Request): + """Download the roster as JSON. + + Records carry the full lib field set (not the display projection), so an + export can be re-imported onto a replacement companion. + """ + connector = getattr(request.app.state, "connector", None) + mc = _find_child(connector, "meshcore") + if mc is None or not getattr(mc, "connected", False): + raise HTTPException(status_code=409, detail="MeshCore not connected") + + try: + records = mc.export_roster() + except Exception as exc: + logger.error("dashboard: meshcore export_roster error: %s", exc) + raise HTTPException(status_code=500, detail=str(exc)) + + try: + info = mc.self_info() + except Exception: + info = {} + try: + last_synced_at = mc.contacts_synced_at() + except Exception: + last_synced_at = None + + payload = { + "format": _ROSTER_EXPORT_FORMAT, + "version": _ROSTER_EXPORT_VERSION, + "exported_at": datetime.now(timezone.utc).isoformat(), + "last_synced_at": last_synced_at, + # Which device this roster came off — a roster is only meaningful + # paired with the companion it was read from. + "device": { + "name": info.get("name"), + "pubkey": info.get("pubkey"), + "conn_type": info.get("conn_type"), + "target": info.get("target"), + }, + "count": len(records), + "contacts": records, + } + filename = f"meshcore-roster-{datetime.now(timezone.utc).strftime('%Y%m%d-%H%M%S')}.json" + return JSONResponse( + content=payload, + headers={"Content-Disposition": f'attachment; filename="{filename}"'}, + ) + + +class ImportContactsRequest(BaseModel): + contacts: list[dict] + + +@router.post("/meshcore/contacts/import") +async def meshcore_import_contacts(request: Request, body: ImportContactsRequest): + """Write exported roster records onto the companion. + + Intended for migrating a roster to a replacement companion rather than + waiting to rediscover every node by advert. Additive and idempotent: each + record is an upsert, nothing is removed, and no mesh traffic is generated. + + Per-record failures are collected rather than aborting the batch, so one bad + record cannot strand a partial import with no report of what landed. + """ + connector = getattr(request.app.state, "connector", None) + mc = _find_child(connector, "meshcore") + if mc is None or not getattr(mc, "connected", False): + raise HTTPException(status_code=409, detail="MeshCore not connected") + + records = body.contacts or [] + if not records: + raise HTTPException(status_code=400, detail="No contacts supplied") + + imported = 0 + errors: list[dict] = [] + for record in records: + try: + mc.import_contact(record) + imported += 1 + except (ValueError, RuntimeError) as exc: + errors.append({"pubkey": record.get("pubkey"), "detail": str(exc)}) + except Exception as exc: + logger.error("dashboard: meshcore import_contact error: %s", exc) + errors.append({"pubkey": record.get("pubkey"), "detail": str(exc)}) + + logger.info( + "dashboard: meshcore roster import — %d/%d written, %d failed", + imported, len(records), len(errors), + ) + return {"active": True, "imported": imported, "failed": len(errors), "errors": errors} + + +@router.delete("/meshcore/contacts/{pubkey}") +async def meshcore_remove_contact(request: Request, pubkey: str): + """Remove a contact from the companion by full pubkey. + + Requires the FULL 64-hex key — a prefix could match the wrong node, and a + wrongly-deleted contact is unrecoverable without rediscovery. + """ + connector = getattr(request.app.state, "connector", None) + mc = _find_child(connector, "meshcore") + if mc is None or not getattr(mc, "connected", False): + raise HTTPException(status_code=409, detail="MeshCore not connected") + + try: + mc.remove_contact(pubkey) + except ValueError as exc: + raise HTTPException(status_code=400, detail=str(exc)) + except RuntimeError as exc: + raise HTTPException(status_code=502, detail=str(exc)) + except Exception as exc: + logger.error("dashboard: meshcore remove_contact error: %s", exc) + raise HTTPException(status_code=500, detail=str(exc)) + + try: + contacts = list(mc.get_contacts()) + except Exception: + contacts = [] + logger.info("dashboard: meshcore contact %s removed", pubkey) + return {"active": True, "contacts": contacts} + + +@router.get("/meshcore/route-health") +async def meshcore_route_health(request: Request): + """Flag region-routing cells whose MeshCore target no longer exists. + + Preventive: a cell pointing at a room pubkey or channel the companion does + not have will fail silently at send time — the alert is simply never + delivered, with nothing surfaced to the operator. Resolving every cell + up-front turns that silence into a visible warning. Read-only; sends nothing. + + Also reports same-name/different-pubkey roster collisions, which are what + make a name-based picker ambiguous in the first place. + + Returns {active, dangling, dangling_enabled, collisions, checked, mc_enabled}. + ``active: false`` (with empty results) when MeshCore is not connected — an + unreachable companion is not evidence that a route is broken. + """ + connector = getattr(request.app.state, "connector", None) + mc = _find_child(connector, "meshcore") + if mc is None or not getattr(mc, "connected", False): + return { + "active": False, + "dangling": [], + "dangling_enabled": 0, + "collisions": [], + "checked": 0, + "mc_enabled": False, + } + + config = getattr(request.app.state, "config", None) + rr = getattr(getattr(config, "notifications", None), "region_routes", None) + cells = getattr(rr, "cells", None) or {} + mc_enabled = bool(getattr(rr, "mc_enabled", False)) + + try: + contacts = list(mc.get_contacts()) + except Exception: + contacts = [] + try: + channels = list(mc.known_channels()) + except Exception: + channels = [] + + dangling = check_route_health(cells, channels, contacts) + collisions = find_name_collisions(contacts) + checked = sum( + 1 + for regions in cells.values() + if isinstance(regions, dict) + for cell in regions.values() + if isinstance(cell, dict) and cell.get("mc") + ) + + return { + "active": True, + "dangling": dangling, + "dangling_enabled": sum(1 for d in dangling if d.get("enabled")), + "collisions": collisions, + "checked": checked, + "mc_enabled": mc_enabled, + } @router.get("/meshcore/self") diff --git a/work/meshai/dashboard/static/assets/index-BuD2nQeg.js b/work/meshai/dashboard/static/assets/index-BuD2nQeg.js deleted file mode 100644 index 6bb3865..0000000 --- a/work/meshai/dashboard/static/assets/index-BuD2nQeg.js +++ /dev/null @@ -1,455 +0,0 @@ -function SY(e,t){for(var r=0;rn[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var CY=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var XB={exports:{}},Yb={},qB={exports:{}},St={};/** - * @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 mm=Symbol.for("react.element"),TY=Symbol.for("react.portal"),MY=Symbol.for("react.fragment"),AY=Symbol.for("react.strict_mode"),NY=Symbol.for("react.profiler"),kY=Symbol.for("react.provider"),LY=Symbol.for("react.context"),IY=Symbol.for("react.forward_ref"),PY=Symbol.for("react.suspense"),DY=Symbol.for("react.memo"),EY=Symbol.for("react.lazy"),pD=Symbol.iterator;function jY(e){return e===null||typeof e!="object"?null:(e=pD&&e[pD]||e["@@iterator"],typeof e=="function"?e:null)}var KB={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},JB=Object.assign,QB={};function Ld(e,t,r){this.props=e,this.context=t,this.refs=QB,this.updater=r||KB}Ld.prototype.isReactComponent={};Ld.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ld.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function eF(){}eF.prototype=Ld.prototype;function mN(e,t,r){this.props=e,this.context=t,this.refs=QB,this.updater=r||KB}var yN=mN.prototype=new eF;yN.constructor=mN;JB(yN,Ld.prototype);yN.isPureReactComponent=!0;var gD=Array.isArray,tF=Object.prototype.hasOwnProperty,xN={current:null},rF={key:!0,ref:!0,__self:!0,__source:!0};function nF(e,t,r){var n,a={},i=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)tF.call(t,n)&&!rF.hasOwnProperty(n)&&(a[n]=t[n]);var s=arguments.length-2;if(s===1)a.children=r;else if(1>>1,q=F[W];if(0>>1;Wa(se,$))cea(Ue,se)?(F[W]=Ue,F[ce]=$,W=ce):(F[W]=se,F[Q]=$,W=Q);else if(cea(Ue,$))F[W]=Ue,F[ce]=$,W=ce;else break e}}return Z}function a(F,Z){var $=F.sortIndex-Z.sortIndex;return $!==0?$:F.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var l=[],u=[],c=1,h=null,d=3,v=!1,g=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(F){for(var Z=r(u);Z!==null;){if(Z.callback===null)n(u);else if(Z.startTime<=F)n(u),Z.sortIndex=Z.expirationTime,t(l,Z);else break;Z=r(u)}}function S(F){if(m=!1,w(F),!g)if(r(l)!==null)g=!0,V(C);else{var Z=r(u);Z!==null&&U(S,Z.startTime-F)}}function C(F,Z){g=!1,m&&(m=!1,x(I),I=-1),v=!0;var $=d;try{for(w(Z),h=r(l);h!==null&&(!(h.expirationTime>Z)||F&&!D());){var W=h.callback;if(typeof W=="function"){h.callback=null,d=h.priorityLevel;var q=W(h.expirationTime<=Z);Z=e.unstable_now(),typeof q=="function"?h.callback=q:h===r(l)&&n(l),w(Z)}else n(l);h=r(l)}if(h!==null)var re=!0;else{var Q=r(u);Q!==null&&U(S,Q.startTime-Z),re=!1}return re}finally{h=null,d=$,v=!1}}var M=!1,A=null,I=-1,k=5,P=-1;function D(){return!(e.unstable_now()-PF||125W?(F.sortIndex=$,t(u,F),r(l)===null&&F===r(u)&&(m?(x(I),I=-1):m=!0,U(S,$-W))):(F.sortIndex=q,t(l,F),g||v||(g=!0,V(C))),F},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(F){var Z=d;return function(){var $=d;d=Z;try{return F.apply(this,arguments)}finally{d=$}}}})(lF);sF.exports=lF;var $Y=sF.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 YY=O,Ta=$Y;function xe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),r2=Object.prototype.hasOwnProperty,XY=/^[: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]*$/,yD={},xD={};function qY(e){return r2.call(xD,e)?!0:r2.call(yD,e)?!1:XY.test(e)?xD[e]=!0:(yD[e]=!0,!1)}function KY(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function JY(e,t,r,n){if(t===null||typeof t>"u"||KY(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Zn(e,t,r,n,a,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var cn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){cn[e]=new Zn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];cn[t]=new Zn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){cn[e]=new Zn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){cn[e]=new Zn(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){cn[e]=new Zn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){cn[e]=new Zn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){cn[e]=new Zn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){cn[e]=new Zn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){cn[e]=new Zn(e,5,!1,e.toLowerCase(),null,!1,!1)});var bN=/[\-:]([a-z])/g;function wN(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(bN,wN);cn[t]=new Zn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(bN,wN);cn[t]=new Zn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(bN,wN);cn[t]=new Zn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){cn[e]=new Zn(e,1,!1,e.toLowerCase(),null,!1,!1)});cn.xlinkHref=new Zn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){cn[e]=new Zn(e,1,!1,e.toLowerCase(),null,!0,!0)});function SN(e,t,r,n){var a=cn.hasOwnProperty(t)?cn[t]:null;(a!==null?a.type!==0:n||!(2s||a[o]!==i[s]){var l=` -`+a[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=s);break}}}finally{Vw=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?mp(e):""}function QY(e){switch(e.tag){case 5:return mp(e.type);case 16:return mp("Lazy");case 13:return mp("Suspense");case 19:return mp("SuspenseList");case 0:case 2:case 15:return e=Gw(e.type,!1),e;case 11:return e=Gw(e.type.render,!1),e;case 1:return e=Gw(e.type,!0),e;default:return""}}function o2(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 mf:return"Fragment";case gf:return"Portal";case n2:return"Profiler";case CN:return"StrictMode";case a2:return"Suspense";case i2:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case hF:return(e.displayName||"Context")+".Consumer";case cF:return(e._context.displayName||"Context")+".Provider";case TN:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case MN:return t=e.displayName||null,t!==null?t:o2(e.type)||"Memo";case rl:t=e._payload,e=e._init;try{return o2(e(t))}catch{}}return null}function eX(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return o2(t);case 8:return t===CN?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ol(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dF(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function tX(e){var t=dF(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ky(e){e._valueTracker||(e._valueTracker=tX(e))}function vF(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=dF(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function e_(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 s2(e,t){var r=t.checked;return fr({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function bD(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Ol(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function pF(e,t){t=t.checked,t!=null&&SN(e,"checked",t,!1)}function l2(e,t){pF(e,t);var r=Ol(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?u2(e,t.type,r):t.hasOwnProperty("defaultValue")&&u2(e,t.type,Ol(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function wD(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function u2(e,t,r){(t!=="number"||e_(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var yp=Array.isArray;function jf(e,t,r,n){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Ly.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ug(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var jp={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rX=["Webkit","ms","Moz","O"];Object.keys(jp).forEach(function(e){rX.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),jp[t]=jp[e]})});function xF(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||jp.hasOwnProperty(e)&&jp[e]?(""+t).trim():t+"px"}function _F(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,a=xF(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,a):e[r]=a}}var nX=fr({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function f2(e,t){if(t){if(nX[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(xe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(xe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(xe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(xe(62))}}function d2(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var v2=null;function AN(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var p2=null,Rf=null,Of=null;function TD(e){if(e=_m(e)){if(typeof p2!="function")throw Error(xe(280));var t=e.stateNode;t&&(t=Qb(t),p2(e.stateNode,e.type,t))}}function bF(e){Rf?Of?Of.push(e):Of=[e]:Rf=e}function wF(){if(Rf){var e=Rf,t=Of;if(Of=Rf=null,TD(e),t)for(e=0;e>>=0,e===0?32:31-(vX(e)/pX|0)|0}var Iy=64,Py=4194304;function xp(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function a_(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,a=e.suspendedLanes,i=e.pingedLanes,o=r&268435455;if(o!==0){var s=o&~a;s!==0?n=xp(s):(i&=o,i!==0&&(n=xp(i)))}else o=r&~a,o!==0?n=xp(o):i!==0&&(n=xp(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&a)&&(a=n&-n,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function ym(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Si(t),e[t]=r}function xX(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=Op),ED=" ",jD=!1;function GF(e,t){switch(e){case"keyup":return $X.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function HF(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yf=!1;function XX(e,t){switch(e){case"compositionend":return HF(t);case"keypress":return t.which!==32?null:(jD=!0,ED);case"textInput":return e=t.data,e===ED&&jD?null:e;default:return null}}function qX(e,t){if(yf)return e==="compositionend"||!jN&&GF(e,t)?(e=FF(),yx=PN=ll=null,yf=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=BD(r)}}function $F(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$F(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function YF(){for(var e=window,t=e_();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=e_(e.document)}return t}function RN(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function iq(e){var t=YF(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&$F(r.ownerDocument.documentElement,r)){if(n!==null&&RN(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=r.textContent.length,i=Math.min(n.start,a);n=n.end===void 0?i:Math.min(n.end,a),!e.extend&&i>n&&(a=n,n=i,i=a),a=FD(r,i);var o=FD(r,n);a&&o&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,xf=null,b2=null,Bp=null,w2=!1;function VD(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;w2||xf==null||xf!==e_(n)||(n=xf,"selectionStart"in n&&RN(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Bp&&pg(Bp,n)||(Bp=n,n=s_(b2,"onSelect"),0wf||(e.current=N2[wf],N2[wf]=null,wf--)}function Qt(e,t){wf++,N2[wf]=e.current,e.current=t}var zl={},kn=ql(zl),ra=ql(!1),Cc=zl;function td(e,t){var r=e.type.contextTypes;if(!r)return zl;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in r)a[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function na(e){return e=e.childContextTypes,e!=null}function u_(){rr(ra),rr(kn)}function YD(e,t,r){if(kn.current!==zl)throw Error(xe(168));Qt(kn,t),Qt(ra,r)}function n6(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var a in n)if(!(a in t))throw Error(xe(108,eX(e)||"Unknown",a));return fr({},r,n)}function c_(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||zl,Cc=kn.current,Qt(kn,e),Qt(ra,ra.current),!0}function XD(e,t,r){var n=e.stateNode;if(!n)throw Error(xe(169));r?(e=n6(e,t,Cc),n.__reactInternalMemoizedMergedChildContext=e,rr(ra),rr(kn),Qt(kn,e)):rr(ra),Qt(ra,r)}var rs=null,e1=!1,rS=!1;function a6(e){rs===null?rs=[e]:rs.push(e)}function mq(e){e1=!0,a6(e)}function Kl(){if(!rS&&rs!==null){rS=!0;var e=0,t=Ht;try{var r=rs;for(Ht=1;e>=o,a-=o,as=1<<32-Si(t)+a|r<I?(k=A,A=null):k=A.sibling;var P=d(x,A,w[I],S);if(P===null){A===null&&(A=k);break}e&&A&&P.alternate===null&&t(x,A),_=i(P,_,I),M===null?C=P:M.sibling=P,M=P,A=k}if(I===w.length)return r(x,A),or&&Uu(x,I),C;if(A===null){for(;II?(k=A,A=null):k=A.sibling;var D=d(x,A,P.value,S);if(D===null){A===null&&(A=k);break}e&&A&&D.alternate===null&&t(x,A),_=i(D,_,I),M===null?C=D:M.sibling=D,M=D,A=k}if(P.done)return r(x,A),or&&Uu(x,I),C;if(A===null){for(;!P.done;I++,P=w.next())P=h(x,P.value,S),P!==null&&(_=i(P,_,I),M===null?C=P:M.sibling=P,M=P);return or&&Uu(x,I),C}for(A=n(x,A);!P.done;I++,P=w.next())P=v(A,x,I,P.value,S),P!==null&&(e&&P.alternate!==null&&A.delete(P.key===null?I:P.key),_=i(P,_,I),M===null?C=P:M.sibling=P,M=P);return e&&A.forEach(function(z){return t(x,z)}),or&&Uu(x,I),C}function y(x,_,w,S){if(typeof w=="object"&&w!==null&&w.type===mf&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Ny:e:{for(var C=w.key,M=_;M!==null;){if(M.key===C){if(C=w.type,C===mf){if(M.tag===7){r(x,M.sibling),_=a(M,w.props.children),_.return=x,x=_;break e}}else if(M.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===rl&&JD(C)===M.type){r(x,M.sibling),_=a(M,w.props),_.ref=Pv(x,M,w),_.return=x,x=_;break e}r(x,M);break}else t(x,M);M=M.sibling}w.type===mf?(_=vc(w.props.children,x.mode,S,w.key),_.return=x,x=_):(S=Ax(w.type,w.key,w.props,null,x.mode,S),S.ref=Pv(x,_,w),S.return=x,x=S)}return o(x);case gf:e:{for(M=w.key;_!==null;){if(_.key===M)if(_.tag===4&&_.stateNode.containerInfo===w.containerInfo&&_.stateNode.implementation===w.implementation){r(x,_.sibling),_=a(_,w.children||[]),_.return=x,x=_;break e}else{r(x,_);break}else t(x,_);_=_.sibling}_=cS(w,x.mode,S),_.return=x,x=_}return o(x);case rl:return M=w._init,y(x,_,M(w._payload),S)}if(yp(w))return g(x,_,w,S);if(Av(w))return m(x,_,w,S);By(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,_!==null&&_.tag===6?(r(x,_.sibling),_=a(_,w),_.return=x,x=_):(r(x,_),_=uS(w,x.mode,S),_.return=x,x=_),o(x)):r(x,_)}return y}var nd=l6(!0),u6=l6(!1),d_=ql(null),v_=null,Tf=null,FN=null;function VN(){FN=Tf=v_=null}function GN(e){var t=d_.current;rr(d_),e._currentValue=t}function I2(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Bf(e,t){v_=e,FN=Tf=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ta=!0),e.firstContext=null)}function Qa(e){var t=e._currentValue;if(FN!==e)if(e={context:e,memoizedValue:t,next:null},Tf===null){if(v_===null)throw Error(xe(308));Tf=e,v_.dependencies={lanes:0,firstContext:e}}else Tf=Tf.next=e;return t}var ac=null;function HN(e){ac===null?ac=[e]:ac.push(e)}function c6(e,t,r,n){var a=t.interleaved;return a===null?(r.next=r,HN(t)):(r.next=a.next,a.next=r),t.interleaved=r,bs(e,n)}function bs(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var nl=!1;function UN(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function h6(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function cs(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function wl(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,It&2){var a=n.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),n.pending=t,bs(e,r)}return a=n.interleaved,a===null?(t.next=t,HN(n)):(t.next=a.next,a.next=t),n.interleaved=t,bs(e,r)}function _x(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,kN(e,r)}}function QD(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var a=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?a=i=o:i=i.next=o,r=r.next}while(r!==null);i===null?a=i=t:i=i.next=t}else a=i=t;r={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function p_(e,t,r,n){var a=e.updateQueue;nl=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,s=a.shared.pending;if(s!==null){a.shared.pending=null;var l=s,u=l.next;l.next=null,o===null?i=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==o&&(s===null?c.firstBaseUpdate=u:s.next=u,c.lastBaseUpdate=l))}if(i!==null){var h=a.baseState;o=0,c=u=l=null,s=i;do{var d=s.lane,v=s.eventTime;if((n&d)===d){c!==null&&(c=c.next={eventTime:v,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var g=e,m=s;switch(d=t,v=r,m.tag){case 1:if(g=m.payload,typeof g=="function"){h=g.call(v,h,d);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,d=typeof g=="function"?g.call(v,h,d):g,d==null)break e;h=fr({},h,d);break e;case 2:nl=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,d=a.effects,d===null?a.effects=[s]:d.push(s))}else v={eventTime:v,lane:d,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(u=c=v,l=h):c=c.next=v,o|=d;if(s=s.next,s===null){if(s=a.shared.pending,s===null)break;d=s,s=d.next,d.next=null,a.lastBaseUpdate=d,a.shared.pending=null}}while(!0);if(c===null&&(l=h),a.baseState=l,a.firstBaseUpdate=u,a.lastBaseUpdate=c,t=a.shared.interleaved,t!==null){a=t;do o|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);Ac|=o,e.lanes=o,e.memoizedState=h}}function eE(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=aS.transition;aS.transition={};try{e(!1),t()}finally{Ht=r,aS.transition=n}}function N6(){return ei().memoizedState}function bq(e,t,r){var n=Cl(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},k6(e))L6(t,r);else if(r=c6(e,t,r,n),r!==null){var a=Fn();Ci(r,e,n,a),I6(r,t,n)}}function wq(e,t,r){var n=Cl(e),a={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(k6(e))L6(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,s=i(o,r);if(a.hasEagerState=!0,a.eagerState=s,Ii(s,o)){var l=t.interleaved;l===null?(a.next=a,HN(t)):(a.next=l.next,l.next=a),t.interleaved=a;return}}catch{}finally{}r=c6(e,t,a,n),r!==null&&(a=Fn(),Ci(r,e,n,a),I6(r,t,n))}}function k6(e){var t=e.alternate;return e===cr||t!==null&&t===cr}function L6(e,t){Fp=m_=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function I6(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,kN(e,r)}}var y_={readContext:Qa,useCallback:yn,useContext:yn,useEffect:yn,useImperativeHandle:yn,useInsertionEffect:yn,useLayoutEffect:yn,useMemo:yn,useReducer:yn,useRef:yn,useState:yn,useDebugValue:yn,useDeferredValue:yn,useTransition:yn,useMutableSource:yn,useSyncExternalStore:yn,useId:yn,unstable_isNewReconciler:!1},Sq={readContext:Qa,useCallback:function(e,t){return ro().memoizedState=[e,t===void 0?null:t],e},useContext:Qa,useEffect:rE,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Sx(4194308,4,S6.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Sx(4194308,4,e,t)},useInsertionEffect:function(e,t){return Sx(4,2,e,t)},useMemo:function(e,t){var r=ro();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=ro();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=bq.bind(null,cr,e),[n.memoizedState,e]},useRef:function(e){var t=ro();return e={current:e},t.memoizedState=e},useState:tE,useDebugValue:JN,useDeferredValue:function(e){return ro().memoizedState=e},useTransition:function(){var e=tE(!1),t=e[0];return e=_q.bind(null,e[1]),ro().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=cr,a=ro();if(or){if(r===void 0)throw Error(xe(407));r=r()}else{if(r=t(),Kr===null)throw Error(xe(349));Mc&30||p6(n,t,r)}a.memoizedState=r;var i={value:r,getSnapshot:t};return a.queue=i,rE(m6.bind(null,n,i,e),[e]),n.flags|=2048,Sg(9,g6.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=ro(),t=Kr.identifierPrefix;if(or){var r=is,n=as;r=(n&~(1<<32-Si(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=bg++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[ao]=t,e[yg]=n,V6(e,t,!1,!1),t.stateNode=e;e:{switch(o=d2(r,n),r){case"dialog":tr("cancel",e),tr("close",e),a=n;break;case"iframe":case"object":case"embed":tr("load",e),a=n;break;case"video":case"audio":for(a=0;a<_p.length;a++)tr(_p[a],e);a=n;break;case"source":tr("error",e),a=n;break;case"img":case"image":case"link":tr("error",e),tr("load",e),a=n;break;case"details":tr("toggle",e),a=n;break;case"input":bD(e,n),a=s2(e,n),tr("invalid",e);break;case"option":a=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},a=fr({},n,{value:void 0}),tr("invalid",e);break;case"textarea":SD(e,n),a=c2(e,n),tr("invalid",e);break;default:a=n}f2(r,a),s=a;for(i in s)if(s.hasOwnProperty(i)){var l=s[i];i==="style"?_F(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&yF(e,l)):i==="children"?typeof l=="string"?(r!=="textarea"||l!=="")&&ug(e,l):typeof l=="number"&&ug(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(lg.hasOwnProperty(i)?l!=null&&i==="onScroll"&&tr("scroll",e):l!=null&&SN(e,i,l,o))}switch(r){case"input":ky(e),wD(e,n,!1);break;case"textarea":ky(e),CD(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Ol(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?jf(e,!!n.multiple,i,!1):n.defaultValue!=null&&jf(e,!!n.multiple,n.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=l_)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return xn(t),null;case 6:if(e&&t.stateNode!=null)H6(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(xe(166));if(r=ic(_g.current),ic(vo.current),zy(t)){if(n=t.stateNode,r=t.memoizedProps,n[ao]=t,(i=n.nodeValue!==r)&&(e=Sa,e!==null))switch(e.tag){case 3:Oy(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Oy(n.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[ao]=t,t.stateNode=n}return xn(t),null;case 13:if(rr(ur),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(or&&xa!==null&&t.mode&1&&!(t.flags&128))s6(),rd(),t.flags|=98560,i=!1;else if(i=zy(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(xe(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(xe(317));i[ao]=t}else rd(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;xn(t),i=!1}else bi!==null&&($2(bi),bi=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||ur.current&1?Br===0&&(Br=3):ik())),t.updateQueue!==null&&(t.flags|=4),xn(t),null);case 4:return ad(),B2(e,t),e===null&&gg(t.stateNode.containerInfo),xn(t),null;case 10:return GN(t.type._context),xn(t),null;case 17:return na(t.type)&&u_(),xn(t),null;case 19:if(rr(ur),i=t.memoizedState,i===null)return xn(t),null;if(n=(t.flags&128)!==0,o=i.rendering,o===null)if(n)Dv(i,!1);else{if(Br!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=g_(e),o!==null){for(t.flags|=128,Dv(i,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)i=r,e=n,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Qt(ur,ur.current&1|2),t.child}e=e.sibling}i.tail!==null&&Cr()>od&&(t.flags|=128,n=!0,Dv(i,!1),t.lanes=4194304)}else{if(!n)if(e=g_(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Dv(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!or)return xn(t),null}else 2*Cr()-i.renderingStartTime>od&&r!==1073741824&&(t.flags|=128,n=!0,Dv(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(r=i.last,r!==null?r.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Cr(),t.sibling=null,r=ur.current,Qt(ur,n?r&1|2:r&1),t):(xn(t),null);case 22:case 23:return ak(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?pa&1073741824&&(xn(t),t.subtreeFlags&6&&(t.flags|=8192)):xn(t),null;case 24:return null;case 25:return null}throw Error(xe(156,t.tag))}function Iq(e,t){switch(zN(t),t.tag){case 1:return na(t.type)&&u_(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ad(),rr(ra),rr(kn),$N(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ZN(t),null;case 13:if(rr(ur),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(xe(340));rd()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return rr(ur),null;case 4:return ad(),null;case 10:return GN(t.type._context),null;case 22:case 23:return ak(),null;case 24:return null;default:return null}}var Vy=!1,Cn=!1,Pq=typeof WeakSet=="function"?WeakSet:Set,ze=null;function Mf(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){gr(e,t,n)}else r.current=null}function F2(e,t,r){try{r()}catch(n){gr(e,t,n)}}var dE=!1;function Dq(e,t){if(S2=i_,e=YF(),RN(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var a=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var o=0,s=-1,l=-1,u=0,c=0,h=e,d=null;t:for(;;){for(var v;h!==r||a!==0&&h.nodeType!==3||(s=o+a),h!==i||n!==0&&h.nodeType!==3||(l=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(v=h.firstChild)!==null;)d=h,h=v;for(;;){if(h===e)break t;if(d===r&&++u===a&&(s=o),d===i&&++c===n&&(l=o),(v=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=v}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(C2={focusedElem:e,selectionRange:r},i_=!1,ze=t;ze!==null;)if(t=ze,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ze=e;else for(;ze!==null;){t=ze;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,y=g.memoizedState,x=t.stateNode,_=x.getSnapshotBeforeUpdate(t.elementType===t.type?m:yi(t.type,m),y);x.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(xe(163))}}catch(S){gr(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,ze=e;break}ze=t.return}return g=dE,dE=!1,g}function Vp(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&F2(t,r,i)}a=a.next}while(a!==n)}}function n1(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function V2(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function U6(e){var t=e.alternate;t!==null&&(e.alternate=null,U6(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ao],delete t[yg],delete t[A2],delete t[pq],delete t[gq])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function W6(e){return e.tag===5||e.tag===3||e.tag===4}function vE(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||W6(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function G2(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=l_));else if(n!==4&&(e=e.child,e!==null))for(G2(e,t,r),e=e.sibling;e!==null;)G2(e,t,r),e=e.sibling}function H2(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(H2(e,t,r),e=e.sibling;e!==null;)H2(e,t,r),e=e.sibling}var tn=null,_i=!1;function Us(e,t,r){for(r=r.child;r!==null;)Z6(e,t,r),r=r.sibling}function Z6(e,t,r){if(fo&&typeof fo.onCommitFiberUnmount=="function")try{fo.onCommitFiberUnmount(Xb,r)}catch{}switch(r.tag){case 5:Cn||Mf(r,t);case 6:var n=tn,a=_i;tn=null,Us(e,t,r),tn=n,_i=a,tn!==null&&(_i?(e=tn,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):tn.removeChild(r.stateNode));break;case 18:tn!==null&&(_i?(e=tn,r=r.stateNode,e.nodeType===8?tS(e.parentNode,r):e.nodeType===1&&tS(e,r),dg(e)):tS(tn,r.stateNode));break;case 4:n=tn,a=_i,tn=r.stateNode.containerInfo,_i=!0,Us(e,t,r),tn=n,_i=a;break;case 0:case 11:case 14:case 15:if(!Cn&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){a=n=n.next;do{var i=a,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&F2(r,t,o),a=a.next}while(a!==n)}Us(e,t,r);break;case 1:if(!Cn&&(Mf(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){gr(r,t,s)}Us(e,t,r);break;case 21:Us(e,t,r);break;case 22:r.mode&1?(Cn=(n=Cn)||r.memoizedState!==null,Us(e,t,r),Cn=n):Us(e,t,r);break;default:Us(e,t,r)}}function pE(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Pq),t.forEach(function(n){var a=Gq.bind(null,e,n);r.has(n)||(r.add(n),n.then(a,a))})}}function vi(e,t){var r=t.deletions;if(r!==null)for(var n=0;na&&(a=o),n&=~i}if(n=a,n=Cr()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*jq(n/1960))-n,10e?16:e,ul===null)var n=!1;else{if(e=ul,ul=null,b_=0,It&6)throw Error(xe(331));var a=It;for(It|=4,ze=e.current;ze!==null;){var i=ze,o=i.child;if(ze.flags&16){var s=i.deletions;if(s!==null){for(var l=0;lCr()-rk?dc(e,0):tk|=r),aa(e,t)}function eV(e,t){t===0&&(e.mode&1?(t=Py,Py<<=1,!(Py&130023424)&&(Py=4194304)):t=1);var r=Fn();e=bs(e,t),e!==null&&(ym(e,t,r),aa(e,r))}function Vq(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),eV(e,r)}function Gq(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(xe(314))}n!==null&&n.delete(t),eV(e,r)}var tV;tV=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||ra.current)ta=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return ta=!1,kq(e,t,r);ta=!!(e.flags&131072)}else ta=!1,or&&t.flags&1048576&&i6(t,f_,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Cx(e,t),e=t.pendingProps;var a=td(t,kn.current);Bf(t,r),a=XN(null,t,n,e,a,r);var i=qN();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,na(n)?(i=!0,c_(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,UN(t),a.updater=r1,t.stateNode=a,a._reactInternals=t,D2(t,n,e,r),t=R2(null,t,n,!0,i,r)):(t.tag=0,or&&i&&ON(t),jn(null,t,a,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Cx(e,t),e=t.pendingProps,a=n._init,n=a(n._payload),t.type=n,a=t.tag=Uq(n),e=yi(n,e),a){case 0:t=j2(null,t,n,e,r);break e;case 1:t=cE(null,t,n,e,r);break e;case 11:t=lE(null,t,n,e,r);break e;case 14:t=uE(null,t,n,yi(n.type,e),r);break e}throw Error(xe(306,n,""))}return t;case 0:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:yi(n,a),j2(e,t,n,a,r);case 1:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:yi(n,a),cE(e,t,n,a,r);case 3:e:{if(z6(t),e===null)throw Error(xe(387));n=t.pendingProps,i=t.memoizedState,a=i.element,h6(e,t),p_(t,n,null,r);var o=t.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=id(Error(xe(423)),t),t=hE(e,t,n,r,a);break e}else if(n!==a){a=id(Error(xe(424)),t),t=hE(e,t,n,r,a);break e}else for(xa=bl(t.stateNode.containerInfo.firstChild),Sa=t,or=!0,bi=null,r=u6(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(rd(),n===a){t=ws(e,t,r);break e}jn(e,t,n,r)}t=t.child}return t;case 5:return f6(t),e===null&&L2(t),n=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,o=a.children,T2(n,a)?o=null:i!==null&&T2(n,i)&&(t.flags|=32),O6(e,t),jn(e,t,o,r),t.child;case 6:return e===null&&L2(t),null;case 13:return B6(e,t,r);case 4:return WN(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=nd(t,null,n,r):jn(e,t,n,r),t.child;case 11:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:yi(n,a),lE(e,t,n,a,r);case 7:return jn(e,t,t.pendingProps,r),t.child;case 8:return jn(e,t,t.pendingProps.children,r),t.child;case 12:return jn(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,a=t.pendingProps,i=t.memoizedProps,o=a.value,Qt(d_,n._currentValue),n._currentValue=o,i!==null)if(Ii(i.value,o)){if(i.children===a.children&&!ra.current){t=ws(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){o=i.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=cs(-1,r&-r),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),I2(i.return,r,t),s.lanes|=r;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(xe(341));o.lanes|=r,s=o.alternate,s!==null&&(s.lanes|=r),I2(o,r,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}jn(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,n=t.pendingProps.children,Bf(t,r),a=Qa(a),n=n(a),t.flags|=1,jn(e,t,n,r),t.child;case 14:return n=t.type,a=yi(n,t.pendingProps),a=yi(n.type,a),uE(e,t,n,a,r);case 15:return j6(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:yi(n,a),Cx(e,t),t.tag=1,na(n)?(e=!0,c_(t)):e=!1,Bf(t,r),P6(t,n,a),D2(t,n,a,r),R2(null,t,n,!0,e,r);case 19:return F6(e,t,r);case 22:return R6(e,t,r)}throw Error(xe(156,t.tag))};function rV(e,t){return kF(e,t)}function Hq(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ya(e,t,r,n){return new Hq(e,t,r,n)}function ok(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Uq(e){if(typeof e=="function")return ok(e)?1:0;if(e!=null){if(e=e.$$typeof,e===TN)return 11;if(e===MN)return 14}return 2}function Tl(e,t){var r=e.alternate;return r===null?(r=Ya(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Ax(e,t,r,n,a,i){var o=2;if(n=e,typeof e=="function")ok(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case mf:return vc(r.children,a,i,t);case CN:o=8,a|=8;break;case n2:return e=Ya(12,r,t,a|2),e.elementType=n2,e.lanes=i,e;case a2:return e=Ya(13,r,t,a),e.elementType=a2,e.lanes=i,e;case i2:return e=Ya(19,r,t,a),e.elementType=i2,e.lanes=i,e;case fF:return i1(r,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case cF:o=10;break e;case hF:o=9;break e;case TN:o=11;break e;case MN:o=14;break e;case rl:o=16,n=null;break e}throw Error(xe(130,e==null?e:typeof e,""))}return t=Ya(o,r,t,a),t.elementType=e,t.type=n,t.lanes=i,t}function vc(e,t,r,n){return e=Ya(7,e,n,t),e.lanes=r,e}function i1(e,t,r,n){return e=Ya(22,e,n,t),e.elementType=fF,e.lanes=r,e.stateNode={isHidden:!1},e}function uS(e,t,r){return e=Ya(6,e,null,t),e.lanes=r,e}function cS(e,t,r){return t=Ya(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Wq(e,t,r,n,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uw(0),this.expirationTimes=Uw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uw(0),this.identifierPrefix=n,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function sk(e,t,r,n,a,i,o,s,l){return e=new Wq(e,t,r,s,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ya(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},UN(i),e}function Zq(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(oV)}catch(e){console.error(e)}}oV(),oF.exports=Aa;var sV=oF.exports,SE=sV;t2.createRoot=SE.createRoot,t2.hydrateRoot=SE.hydrateRoot;/** - * @remix-run/router v1.23.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Tg(){return Tg=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function hk(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Jq(){return Math.random().toString(36).substr(2,8)}function TE(e,t){return{usr:e.state,key:e.key,idx:t}}function Y2(e,t,r,n){return r===void 0&&(r=null),Tg({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Dd(t):t,{state:r,key:t&&t.key||n||Jq()})}function C_(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Dd(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function Qq(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,s=cl.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(Tg({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function h(){s=cl.Pop;let y=c(),x=y==null?null:y-u;u=y,l&&l({action:s,location:m.location,delta:x})}function d(y,x){s=cl.Push;let _=Y2(m.location,y,x);u=c()+1;let w=TE(_,u),S=m.createHref(_);try{o.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(S)}i&&l&&l({action:s,location:m.location,delta:1})}function v(y,x){s=cl.Replace;let _=Y2(m.location,y,x);u=c();let w=TE(_,u),S=m.createHref(_);o.replaceState(w,"",S),i&&l&&l({action:s,location:m.location,delta:0})}function g(y){let x=a.location.origin!=="null"?a.location.origin:a.location.href,_=typeof y=="string"?y:C_(y);return _=_.replace(/ $/,"%20"),Tr(x,"No window.location.(origin|href) available to create URL for href: "+_),new URL(_,x)}let m={get action(){return s},get location(){return e(a,o)},listen(y){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(CE,h),l=y,()=>{a.removeEventListener(CE,h),l=null}},createHref(y){return t(a,y)},createURL:g,encodeLocation(y){let x=g(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:d,replace:v,go(y){return o.go(y)}};return m}var ME;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ME||(ME={}));function eK(e,t,r){return r===void 0&&(r="/"),tK(e,t,r)}function tK(e,t,r,n){let a=typeof t=="string"?Dd(t):t,i=fk(a.pathname||"/",r);if(i==null)return null;let o=lV(e);rK(o);let s=null,l=vK(i);for(let u=0;s==null&&u{let l={relativePath:s===void 0?i.path||"":s,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(Tr(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let u=Ml([n,l.relativePath]),c=r.concat(l);i.children&&i.children.length>0&&(Tr(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),lV(i.children,t,c,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:uK(u,i.index),routesMeta:c})};return e.forEach((i,o)=>{var s;if(i.path===""||!((s=i.path)!=null&&s.includes("?")))a(i,o);else for(let l of uV(i.path))a(i,o,l)}),t}function uV(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=uV(n.join("/")),s=[];return s.push(...o.map(l=>l===""?i:[i,l].join("/"))),a&&s.push(...o),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function rK(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:cK(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const nK=/^:[\w-]+$/,aK=3,iK=2,oK=1,sK=10,lK=-2,AE=e=>e==="*";function uK(e,t){let r=e.split("/"),n=r.length;return r.some(AE)&&(n+=lK),t&&(n+=iK),r.filter(a=>!AE(a)).reduce((a,i)=>a+(nK.test(i)?aK:i===""?oK:sK),n)}function cK(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function hK(e,t,r){let{routesMeta:n}=e,a={},i="/",o=[];for(let s=0;s{let{paramName:d,isOptional:v}=c;if(d==="*"){let m=s[h]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const g=s[h];return v&&!g?u[d]=void 0:u[d]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function dK(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),hk(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,s,l)=>(n.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function vK(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return hk(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function fk(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const pK=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,gK=e=>pK.test(e);function mK(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?Dd(e):e,i;if(r)if(gK(r))i=r;else{if(r.includes("//")){let o=r;r=cV(r),hk(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=NE(r.substring(1),"/"):i=NE(r,t)}else i=t;return{pathname:i,search:_K(n),hash:bK(a)}}function NE(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function hS(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function yK(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function dk(e,t){let r=yK(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function vk(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=Dd(e):(a=Tg({},e),Tr(!a.pathname||!a.pathname.includes("?"),hS("?","pathname","search",a)),Tr(!a.pathname||!a.pathname.includes("#"),hS("#","pathname","hash",a)),Tr(!a.search||!a.search.includes("#"),hS("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,s;if(o==null)s=r;else{let h=t.length-1;if(!n&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),h-=1;a.pathname=d.join("/")}s=h>=0?t[h]:"/"}let l=mK(a,s),u=o&&o!=="/"&&o.endsWith("/"),c=(i||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const cV=e=>e.replace(/\/\/+/g,"/"),Ml=e=>cV(e.join("/")),xK=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_K=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,bK=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function wK(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const hV=["post","put","patch","delete"];new Set(hV);const SK=["get",...hV];new Set(SK);/** - * React Router v6.30.4 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Mg(){return Mg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{s.current=!0}),O.useCallback(function(u,c){if(c===void 0&&(c={}),!s.current)return;if(typeof u=="number"){n.go(u);return}let h=vk(u,JSON.parse(o),i,c.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Ml([t,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[t,n,o,i,e])}function vV(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=O.useContext(Jl),{matches:a}=O.useContext(Ql),{pathname:i}=eu(),o=JSON.stringify(dk(a,n.v7_relativeSplatPath));return O.useMemo(()=>vk(e,JSON.parse(o),i,r==="path"),[e,o,i,r])}function AK(e,t){return NK(e,t)}function NK(e,t,r,n){Ed()||Tr(!1);let{navigator:a}=O.useContext(Jl),{matches:i}=O.useContext(Ql),o=i[i.length-1],s=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=eu(),c;if(t){var h;let y=typeof t=="string"?Dd(t):t;l==="/"||(h=y.pathname)!=null&&h.startsWith(l)||Tr(!1),c=y}else c=u;let d=c.pathname||"/",v=d;if(l!=="/"){let y=l.replace(/^\//,"").split("/");v="/"+d.replace(/^\//,"").split("/").slice(y.length).join("/")}let g=eK(e,{pathname:v}),m=DK(g&&g.map(y=>Object.assign({},y,{params:Object.assign({},s,y.params),pathname:Ml([l,a.encodeLocation?a.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Ml([l,a.encodeLocation?a.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,r,n);return t&&m?O.createElement(c1.Provider,{value:{location:Mg({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:cl.Pop}},m):m}function kK(){let e=OK(),t=wK(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return O.createElement(O.Fragment,null,O.createElement("h2",null,"Unexpected Application Error!"),O.createElement("h3",{style:{fontStyle:"italic"}},t),r?O.createElement("pre",{style:a},r):null,null)}const LK=O.createElement(kK,null);class IK extends O.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?O.createElement(Ql.Provider,{value:this.props.routeContext},O.createElement(fV.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function PK(e){let{routeContext:t,match:r,children:n}=e,a=O.useContext(pk);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),O.createElement(Ql.Provider,{value:t},n)}function DK(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,s=(a=r)==null?void 0:a.errors;if(s!=null){let c=o.findIndex(h=>h.route.id&&(s==null?void 0:s[h.route.id])!==void 0);c>=0||Tr(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,h,d)=>{let v,g=!1,m=null,y=null;r&&(v=s&&h.route.id?s[h.route.id]:void 0,m=h.route.errorElement||LK,l&&(u<0&&d===0?(BK("route-fallback"),g=!0,y=null):u===d&&(g=!0,y=h.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,d+1)),_=()=>{let w;return v?w=m:g?w=y:h.route.Component?w=O.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=c,O.createElement(PK,{match:h,routeContext:{outlet:c,matches:x,isDataRoute:r!=null},children:w})};return r&&(h.route.ErrorBoundary||h.route.errorElement||d===0)?O.createElement(IK,{location:r.location,revalidation:r.revalidation,component:m,error:v,children:_(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):_()},null)}var pV=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(pV||{}),gV=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(gV||{});function EK(e){let t=O.useContext(pk);return t||Tr(!1),t}function jK(e){let t=O.useContext(CK);return t||Tr(!1),t}function RK(e){let t=O.useContext(Ql);return t||Tr(!1),t}function mV(e){let t=RK(),r=t.matches[t.matches.length-1];return r.route.id||Tr(!1),r.route.id}function OK(){var e;let t=O.useContext(fV),r=jK(),n=mV();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function zK(){let{router:e}=EK(pV.UseNavigateStable),t=mV(gV.UseNavigateStable),r=O.useRef(!1);return dV(()=>{r.current=!0}),O.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Mg({fromRouteId:t},i)))},[e,t])}const kE={};function BK(e,t,r){kE[e]||(kE[e]=!0)}function FK(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function VK(e){let{to:t,replace:r,state:n,relative:a}=e;Ed()||Tr(!1);let{future:i,static:o}=O.useContext(Jl),{matches:s}=O.useContext(Ql),{pathname:l}=eu(),u=wm(),c=vk(t,dk(s,i.v7_relativeSplatPath),l,a==="path"),h=JSON.stringify(c);return O.useEffect(()=>u(JSON.parse(h),{replace:r,state:n,relative:a}),[u,h,a,r,n]),null}function Jt(e){Tr(!1)}function GK(e){let{basename:t="/",children:r=null,location:n,navigationType:a=cl.Pop,navigator:i,static:o=!1,future:s}=e;Ed()&&Tr(!1);let l=t.replace(/^\/*/,"/"),u=O.useMemo(()=>({basename:l,navigator:i,static:o,future:Mg({v7_relativeSplatPath:!1},s)}),[l,s,i,o]);typeof n=="string"&&(n=Dd(n));let{pathname:c="/",search:h="",hash:d="",state:v=null,key:g="default"}=n,m=O.useMemo(()=>{let y=fk(c,l);return y==null?null:{location:{pathname:y,search:h,hash:d,state:v,key:g},navigationType:a}},[l,c,h,d,v,g,a]);return m==null?null:O.createElement(Jl.Provider,{value:u},O.createElement(c1.Provider,{children:r,value:m}))}function HK(e){let{children:t,location:r}=e;return AK(X2(t),r)}new Promise(()=>{});function X2(e,t){t===void 0&&(t=[]);let r=[];return O.Children.forEach(e,(n,a)=>{if(!O.isValidElement(n))return;let i=[...t,a];if(n.type===O.Fragment){r.push.apply(r,X2(n.props.children,i));return}n.type!==Jt&&Tr(!1),!n.props.index||!n.props.children||Tr(!1);let o={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=X2(n.props.children,i)),r.push(o)}),r}/** - * React Router DOM v6.30.4 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function q2(){return q2=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function $K(e,t){let r=K2(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const YK=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],XK="6";try{window.__reactRouterVersion=XK}catch{}const qK="startTransition",LE=FY[qK];function KK(e){let{basename:t,children:r,future:n,window:a}=e,i=O.useRef();i.current==null&&(i.current=Kq({window:a,v5Compat:!0}));let o=i.current,[s,l]=O.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},c=O.useCallback(h=>{u&&LE?LE(()=>l(h)):l(h)},[l,u]);return O.useLayoutEffect(()=>o.listen(c),[o,c]),O.useEffect(()=>FK(n),[n]),O.createElement(GK,{basename:t,children:r,location:s.location,navigationType:s.action,navigator:o,future:n})}const JK=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",QK=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Vf=O.forwardRef(function(t,r){let{onClick:n,relative:a,reloadDocument:i,replace:o,state:s,target:l,to:u,preventScrollReset:c,viewTransition:h}=t,d=UK(t,YK),{basename:v}=O.useContext(Jl),g,m=!1;if(typeof u=="string"&&QK.test(u)&&(g=u,JK))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=fk(S.pathname,v);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:m=!0}catch{}let y=TK(u,{relative:a}),x=eJ(u,{replace:o,state:s,target:l,preventScrollReset:c,relative:a,viewTransition:h});function _(w){n&&n(w),w.defaultPrevented||x(w)}return O.createElement("a",q2({},d,{href:g||y,onClick:m||i?n:_,ref:r,target:l}))});var IE;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(IE||(IE={}));var PE;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(PE||(PE={}));function eJ(e,t){let{target:r,replace:n,state:a,preventScrollReset:i,relative:o,viewTransition:s}=t===void 0?{}:t,l=wm(),u=eu(),c=vV(e,{relative:o});return O.useCallback(h=>{if(ZK(h,r)){h.preventDefault();let d=n!==void 0?n:C_(u)===C_(c);l(e,{replace:d,state:a,preventScrollReset:i,relative:o,viewTransition:s})}},[u,l,c,n,a,r,e,i,o,s])}function tJ(e){let t=O.useRef(K2(e)),r=O.useRef(!1),n=eu(),a=O.useMemo(()=>$K(n.search,r.current?null:t.current),[n.search]),i=wm(),o=O.useCallback((s,l)=>{const u=K2(typeof s=="function"?s(a):s);r.current=!0,i("?"+u,l)},[i,a]);return[a,o]}const yV=O.createContext({dirty:!1,setDirty:()=>{}});function rJ({children:e}){const[t,r]=O.useState(!1);return O.useEffect(()=>{const n=a=>{t&&(a.preventDefault(),a.returnValue="")};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t]),f.jsx(yV.Provider,{value:{dirty:t,setDirty:r},children:e})}function Ri(){return O.useContext(yV)}/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nJ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xV=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var aJ={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.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iJ=O.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...s},l)=>O.createElement("svg",{ref:l,...aJ,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:xV("lucide",a),...s},[...o.map(([u,c])=>O.createElement(u,c)),...Array.isArray(i)?i:[i]]));/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ge=(e,t)=>{const r=O.forwardRef(({className:n,...a},i)=>O.createElement(iJ,{ref:i,iconNode:t,className:xV(`lucide-${nJ(e)}`,n),...a}));return r.displayName=`${e}`,r};/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mo=Ge("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DE=Ge("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _V=Ge("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bV=Ge("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gk=Ge("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oJ=Ge("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EE=Ge("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h1=Ge("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Jr=Ge("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sm=Ge("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nh=Ge("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sJ=Ge("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ah=Ge("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mk=Ge("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jE=Ge("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wV=Ge("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lJ=Ge("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ih=Ge("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uJ=Ge("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SV=Ge("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CV=Ge("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cJ=Ge("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TV=Ge("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const f1=Ge("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kc=Ge("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yk=Ge("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cm=Ge("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MV=Ge("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tm=Ge("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hJ=Ge("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const d1=Ge("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AV=Ge("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NV=Ge("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jd=Ge("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Rd=Ge("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kV=Ge("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xk=Ge("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sd=Ge("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fJ=Ge("MousePointer",[["path",{d:"m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z",key:"y2ucgo"}],["path",{d:"m13 13 6 6",key:"1nhxnf"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _k=Ge("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ti=Ge("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oi=Ge("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zo=Ge("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oa=Ge("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dJ=Ge("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const v1=Ge("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sa=Ge("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const p1=Ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LV=Ge("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vJ=Ge("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IV=Ge("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ag=Ge("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** - * @license lucide-react v0.383.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=Ge("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DV=Ge("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EV=Ge("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const po=Ge("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ao=Ge("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jV=Ge("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pJ=Ge("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tu=Ge("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const J2=Ge("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);async function gn(e){const t=await fetch(e);if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function gJ(){return gn("/api/serial-ports")}async function RE(){return gn("/api/status")}async function mJ(){return gn("/api/health")}async function yJ(){return gn("/api/nodes")}async function xJ(){return gn("/api/edges")}async function _J(){return gn("/api/sources")}async function go(e){const t=e?`/api/config/${e}`:"/api/config";return gn(t)}async function Mi(e,t){const r=await fetch(`/api/config/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`API error: ${r.status} ${r.statusText}`);return r.json()}async function bJ(){return gn("/api/config/generic_sources")}async function wJ(e){const t=await fetch("/api/config/generic_sources",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok)throw new Error(r.detail||`Save failed (${t.status})`);return r}async function SJ(e,t,r){return(await fetch("/api/generic-sources/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,items_path:t,headers:r})})).json()}async function CJ(){return gn("/api/alerts/active")}async function TJ(e=100,t,r){const n=new URLSearchParams;return n.set("limit",e.toString()),t&&t!=="all"&&n.set("transport",t),r&&r!=="all"&&n.set("category",r),gn(`/api/activity?${n.toString()}`)}async function RV(){return gn("/api/env/status")}async function OV(){return gn("/api/env/active")}async function MJ(){return gn("/api/env/swpc")}async function AJ(){return gn("/api/regions")}async function zV(){return gn("/api/meshcore/channels")}async function NJ(){return gn("/api/meshcore/contacts")}async function OE(){return gn("/api/meshcore/self")}async function kJ(){const e=await fetch("/api/meshcore/advert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!e.ok)throw new Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function BV(e){const t=await fetch("/api/mesh/test-send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}function FV(){const[e,t]=O.useState(!1),[r,n]=O.useState(null),[a,i]=O.useState(null),[o,s]=O.useState(null),l=O.useRef(null),u=O.useRef(null),c=O.useRef(1e3),h=O.useCallback(()=>{var g;if(((g=l.current)==null?void 0:g.readyState)===WebSocket.OPEN)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/live`;try{const m=new WebSocket(v);l.current=m,m.onopen=()=>{t(!0),c.current=1e3},m.onmessage=x=>{try{const _=JSON.parse(x.data);switch(s(_),_.type){case"health_update":n(_.data);break;case"alert_fired":i(_.data);break}}catch(_){console.error("Failed to parse WebSocket message:",_)}},m.onclose=()=>{t(!1),l.current=null;const x=Math.min(c.current,3e4);u.current=window.setTimeout(()=>{c.current=Math.min(x*2,3e4),h()},x)},m.onerror=()=>{m.close()};const y=setInterval(()=>{m.readyState===WebSocket.OPEN&&m.send("ping")},3e4);m.addEventListener("close",()=>{clearInterval(y)})}catch(m){console.error("Failed to create WebSocket:",m)}},[]);return O.useEffect(()=>(h(),()=>{u.current&&clearTimeout(u.current),l.current&&l.current.close()}),[h]),{connected:e,lastHealth:r,lastAlert:a,lastMessage:o}}const VV=O.createContext(null);function LJ(){const e=O.useContext(VV);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}function IJ(e){switch(e==null?void 0:e.toLowerCase()){case"critical":case"emergency":return{bg:"bg-red-500/10",border:"border-red-500",icon:ah,iconColor:"text-red-500"};case"warning":return{bg:"bg-amber-500/10",border:"border-amber-500",icon:Ao,iconColor:"text-amber-500"};default:return{bg:"bg-sky-400/10",border:"border-sky-400",icon:d1,iconColor:"text-sky-400"}}}function PJ({toast:e,onDismiss:t,onNavigate:r}){const n=IJ(e.alert.severity),a=n.icon;return O.useEffect(()=>{const i=setTimeout(t,8e3);return()=>clearTimeout(i)},[t]),f.jsx("div",{className:`${n.bg} border ${n.border} shadow-lg overflow-hidden animate-slide-in cursor-pointer`,onClick:r,role:"alert",children:f.jsxs("div",{className:"flex items-start gap-3 p-4",children:[f.jsx("div",{className:`w-1 self-stretch -ml-4 -my-4 ${n.border.replace("border","bg")}`}),f.jsx(a,{size:18,className:n.iconColor}),f.jsxs("div",{className:"flex-1 min-w-0 pr-2",children:[f.jsx("div",{className:"text-sm font-medium text-slate-200 mb-0.5",children:e.alert.type.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}),f.jsx("div",{className:"text-sm text-slate-300 line-clamp-2",children:e.alert.message})]}),f.jsx("button",{onClick:i=>{i.stopPropagation(),t()},className:"text-slate-400 hover:text-slate-200 transition-colors",children:f.jsx(tu,{size:16})})]})})}function DJ({children:e}){const[t,r]=O.useState([]),n=wm(),a=O.useCallback(s=>{const l=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>[...u,{id:l,alert:s}])},[]),i=O.useCallback(s=>{r(l=>l.filter(u=>u.id!==s))},[]),o=O.useCallback(()=>{n("/alerts")},[n]);return f.jsxs(VV.Provider,{value:{addToast:a},children:[e,f.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm w-full pointer-events-none",children:t.map(s=>f.jsx("div",{className:"pointer-events-auto",children:f.jsx(PJ,{toast:s,onDismiss:()=>i(s.id),onNavigate:o})},s.id))})]})}const g1="meshai.restartRequired.v1";function zE(){try{const e=localStorage.getItem(g1);if(!e)return{required:!1,changedKeys:[],ts:0};const t=JSON.parse(e);return{required:!!t.required,changedKeys:Array.isArray(t.changedKeys)?t.changedKeys:[],ts:Number(t.ts)||0}}catch{return{required:!1,changedKeys:[],ts:0}}}function ru(e){const t={required:!0,changedKeys:[...new Set(e)],ts:Date.now()};localStorage.setItem(g1,JSON.stringify(t)),window.dispatchEvent(new CustomEvent("meshai:restart-required",{detail:t}))}function BE(){localStorage.removeItem(g1),window.dispatchEvent(new CustomEvent("meshai:restart-required",{detail:{required:!1,changedKeys:[],ts:0}}))}function EJ(){const[e,t]=O.useState(()=>zE()),[r,n]=O.useState(!1),[a,i]=O.useState(null);O.useEffect(()=>{const l=c=>{const h=c.detail;t(h)},u=c=>{c.key===g1&&t(zE())};return window.addEventListener("meshai:restart-required",l),window.addEventListener("storage",u),()=>{window.removeEventListener("meshai:restart-required",l),window.removeEventListener("storage",u)}},[]);const o=O.useCallback(async()=>{n(!0),i(null);try{const l=await fetch("/api/restart",{method:"POST"});if(!l.ok&&l.status!==202){const u=await l.json().catch(()=>({}));throw new Error(u.detail||`HTTP ${l.status}`)}BE()}catch(l){i(String(l)),n(!1)}},[]),s=O.useCallback(()=>{BE()},[]);return e.required?f.jsxs("div",{className:"bg-yellow-900/40 border-b border-yellow-700 text-yellow-100 px-4 py-2 text-sm flex items-center gap-3",children:[f.jsx(Ao,{className:"w-4 h-4 flex-shrink-0 text-yellow-300"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("strong",{children:"Restart required"}),e.changedKeys.length>0&&f.jsxs("span",{className:"text-yellow-300 ml-2",children:["(",e.changedKeys.length," key",e.changedKeys.length===1?"":"s",":"," ",f.jsxs("span",{className:"font-mono text-xs",children:[e.changedKeys.slice(0,3).join(", "),e.changedKeys.length>3?", …":""]}),")"]}),f.jsxs("span",{className:"ml-2 text-yellow-300/80",children:["for these changes to take effect. Click ",f.jsx("strong",{children:"Restart now"})," — it restarts the bot process in place (a few seconds; the dashboard briefly reconnects), NOT the container. Until then the runtime keeps its boot-time configuration. Restart-required keys include transport connections and anything under Config → environmental (feed_source, central URL), the LLM backend swap, and the dispatcher cold-start grace window. Other keys take effect on the next handler call."]}),a&&f.jsx("div",{className:"text-red-400 text-xs mt-1",children:a})]}),f.jsxs("button",{onClick:o,disabled:r,className:"flex items-center gap-1 px-3 py-1 bg-yellow-700 hover:bg-yellow-600 disabled:opacity-50 rounded text-white text-xs",children:[f.jsx(dJ,{className:`w-3 h-3 ${r?"animate-spin":""}`}),r?"Restarting…":"Restart now"]}),f.jsx("button",{onClick:s,className:"text-yellow-300 hover:text-white px-1",title:"Dismiss (you can still restart later)",children:f.jsx(tu,{className:"w-4 h-4"})})]}):null}const GV=[{header:"General",items:[{path:"/",label:"Dashboard",icon:NV},{path:"/config",label:"Settings",icon:IV},{path:"/environment",label:"Data Feeds",icon:ih},{path:"/activity",label:"Activity Log",icon:Mo},{path:"/places",label:"Places",icon:Rd},{path:"/coverage",label:"Coverage",icon:kV}]},{header:"Meshtastic",items:[{path:"/meshtastic/connection",label:"Connection",icon:pJ},{path:"/notifications",label:"Routing",icon:DE},{path:"/meshtastic/scheduled",label:"Scheduled Broadcasts",icon:EE},{path:"/meshtastic/nodes",label:"Nodes & Health",icon:Mo},{path:"/meshtastic/danger-zones",label:"Danger Zones",icon:Ao}]},{header:"MeshCore",items:[{path:"/meshcore/connection",label:"Connection",icon:_k},{path:"/meshcore/routing",label:"Routing",icon:DE},{path:"/meshcore/scheduled",label:"Scheduled Broadcasts",icon:EE},{path:"/meshcore/contacts",label:"Contacts & Companion",icon:jV},{path:"/meshcore/danger-zones",label:"Danger Zones",icon:Ao}]},{header:"Documentation",items:[{path:"/reference",label:"Reference",icon:bV}]}],jJ=[{path:"/adapter-config",label:"Adapter Config",icon:Ag},{path:"/gauge-sites",label:"Gauge Sites",icon:f1},{path:"/town-anchors",label:"Town Anchors",icon:Rd},{path:"/mesh",label:"Mesh",icon:oi},{path:"/meshtastic/sources",label:"Sources",icon:AV},{path:"/meshcore/companion",label:"Companion",icon:gk}],FE=[...GV.flatMap(e=>e.items),...jJ],VE={"/places":"Places","/meshtastic/scheduled":"Scheduled Broadcasts","/meshcore/scheduled":"Scheduled Broadcasts","/meshtastic/nodes":"Nodes & Health","/meshtastic/danger-zones":"Danger Zones","/meshcore/danger-zones":"Danger Zones","/meshcore/contacts":"Contacts & Companion","/meshcore/companion":"Contacts & Companion"};function RJ(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60);return t>0?`${t}d ${r}h`:r>0?`${r}h ${n}m`:`${n}m`}function OJ(e,t,r,n){const a=e.path.includes("?")?`${t}${r}`===e.path:t===e.path,i=e.icon;return f.jsxs(Vf,{to:e.path,onClick:o=>n(e.path,o),className:`flex items-center gap-3 px-5 py-3 text-sm font-sans transition-colors relative ${a?"text-white bg-transparent":"text-[#777] hover:text-white hover:bg-bg-hover"}`,children:[a&&f.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-[2px] bg-[#f59e0b]"}),f.jsx(i,{size:16}),e.label]},e.path)}function zJ(e){const t=e.split("?")[0];if(VE[t])return VE[t];const r=FE.find(a=>a.path===e);if(r)return r.label;const n=FE.find(a=>a.path.split("?")[0]===t);return(n==null?void 0:n.label)||"Dashboard"}function BJ({children:e}){var y;const t=eu(),r=wm(),{dirty:n,setDirty:a}=Ri(),{connected:i,lastAlert:o}=FV(),{addToast:s}=LJ(),[l,u]=O.useState(null),[c,h]=O.useState(null),d=(x,_)=>{n&&(_.preventDefault(),window.confirm("You have unsaved changes. Discard them?")&&(a(!1),r(x)))};O.useEffect(()=>{if(o){const x=`${o.type}-${o.message}-${o.timestamp}`;x!==c&&(h(x),s(o))}},[o,c,s]);const[v,g]=O.useState(new Date);O.useEffect(()=>{RE().then(u).catch(console.error);const x=setInterval(()=>{RE().then(u).catch(console.error)},3e4);return()=>clearInterval(x)},[]),O.useEffect(()=>{const x=setInterval(()=>g(new Date),1e3);return()=>clearInterval(x)},[]);const m=v.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return f.jsxs("div",{className:"flex h-screen overflow-hidden bg-bg text-white",children:[f.jsxs("aside",{className:"w-[220px] flex-shrink-0 bg-bg-card border-r border-border flex flex-col overflow-y-auto",children:[f.jsxs("div",{className:"bg-[#000000] px-4 py-3 border-b border-border flex flex-col items-center",children:[f.jsx("img",{src:"/meshai-logo.png",alt:"MeshAI",className:"w-[190px] block"}),f.jsxs("div",{className:"font-mono text-[10px] text-[#555] mt-1 self-start",children:["v",(l==null?void 0:l.version)||"..."]})]}),f.jsx("nav",{className:"flex-1 py-4",children:GV.map(x=>f.jsxs("div",{className:"mt-4",children:[f.jsx("div",{className:"px-5 pt-2 pb-1 text-[10px] font-sans font-semibold uppercase tracking-wider text-[#555]",children:x.header}),x.items.map(_=>OJ(_,t.pathname,t.search,d))]},x.header))}),f.jsxs("div",{className:"p-5 border-t border-border",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[f.jsx("div",{className:`w-2 h-2 rounded-full ${l!=null&&l.connected?"bg-green-500":"bg-red-500"}`}),f.jsx("span",{className:"text-xs font-sans text-[#777]",children:l!=null&&l.connected?"Connected":"Disconnected"})]}),f.jsxs("div",{className:"text-xs font-mono text-[#666] truncate",children:[(y=l==null?void 0:l.connection_type)==null?void 0:y.toUpperCase(),": ",l==null?void 0:l.connection_target]}),f.jsxs("div",{className:"text-xs font-sans text-[#666] mt-1",children:["Uptime: ",f.jsx("span",{className:"font-mono",children:l?RJ(l.uptime_seconds):"..."})]})]})]}),f.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[f.jsxs("header",{className:"h-14 flex-shrink-0 border-b border-border bg-bg-card flex items-center justify-between px-6",children:[f.jsx("h1",{className:"text-lg font-sans font-semibold text-white",children:zJ(t.pathname+t.search)}),f.jsxs("div",{className:"flex items-center gap-6",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:`w-2 h-2 rounded-full ${i?"bg-accent animate-pulse-slow":"bg-[#333]"}`}),f.jsx("span",{className:"text-xs font-sans text-[#777]",children:i?"Live":"Offline"})]}),f.jsxs("div",{className:"text-sm font-mono text-[#666]",children:[m," MT"]})]})]}),f.jsxs("main",{className:"flex-1 overflow-y-auto p-6",children:[f.jsx(EJ,{}),e]})]})]})}function FJ({health:e}){const t=e.score,r=e.tier,n=2*Math.PI*45,a=t/100*n;return f.jsx("div",{className:"flex flex-col items-center",children:f.jsxs("svg",{width:"140",height:"140",viewBox:"0 0 100 100",children:[f.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"#1e1e1e",strokeWidth:"8"}),f.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"#f59e0b",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:n,strokeDashoffset:n-a,transform:"rotate(-90 50 50)",className:"transition-all duration-500"}),f.jsx("text",{x:"50",y:"46",textAnchor:"middle",className:"font-mono font-bold",style:{fontSize:"24px",fill:"#f59e0b"},children:t.toFixed(1)}),f.jsx("text",{x:"50",y:"62",textAnchor:"middle",className:"font-sans",style:{fontSize:"10px",fill:"#444"},children:r})]})})}function jv({label:e,value:t}){const r=n=>n>66?"bg-accent":n>33?"bg-accent-dim":"bg-red-500";return f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-24 text-xs font-sans text-[#777] truncate",children:e}),f.jsx("div",{className:"flex-1 h-2 bg-border overflow-hidden",children:f.jsx("div",{className:`h-full ${r(t)} transition-all duration-300`,style:{width:`${t}%`}})}),f.jsx("div",{className:"w-12 text-right text-xs font-mono text-[#e0e0e0]",children:t.toFixed(1)})]})}function VJ({alert:e}){const r=(a=>{switch(a.toLowerCase()){case"critical":case"emergency":case"immediate":return{bg:"bg-red-500/5",border:"border-red-500",icon:ah,iconColor:"text-red-500"};case"warning":case"priority":return{bg:"bg-accent/5",border:"border-accent",icon:Ao,iconColor:"text-accent"};case"routine":default:return{bg:"bg-[#161616]",border:"border-[#333]",icon:d1,iconColor:"text-[#777]"}}})(e.severity),n=r.icon;return f.jsxs("div",{className:`p-3 ${r.bg} border-l-2 ${r.border} flex items-start gap-3`,children:[f.jsx(n,{size:16,className:r.iconColor}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-sans font-medium text-white",children:e.message}),f.jsx("div",{className:"text-[10px] font-mono text-[#666] mt-1",children:e.timestamp||"Just now"})]})]})}function GJ({source:e}){const t=()=>e.is_loaded?e.last_error?"bg-accent":"bg-green-500":"bg-red-500";return f.jsxs("div",{className:"flex items-center gap-3 p-2 bg-bg-hover",children:[f.jsx("div",{className:`w-2 h-2 rounded-full ${t()}`}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-sans font-medium text-white truncate",children:e.name}),f.jsxs("div",{className:"text-[10px] font-sans text-[#666]",children:[e.node_count," nodes · ",e.type]})]})]})}function Uy({icon:e,label:t,value:r,subvalue:n,accent:a}){return f.jsxs("div",{className:"bg-bg-card border border-border p-3",style:a?{borderTopWidth:"2px",borderTopColor:a}:void 0,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[f.jsx(e,{size:14,style:{color:a||"#333"}}),f.jsx("span",{className:"text-[9px] font-sans uppercase tracking-widest text-[#666]",children:t})]}),f.jsx("div",{className:"font-mono text-xl",style:{color:a||"#e0e0e0"},children:r}),n&&f.jsx("div",{className:"text-[9px] font-sans mt-1 text-[#666]",children:n})]})}function HJ({bandConditions:e}){const t=i=>{switch(i){case"Good":return"bg-green-500";case"Fair":return"bg-accent";case"Poor":return"bg-red-500";default:return"bg-[#333]"}},r=i=>{switch(i){case"Good":return"text-green-500";case"Fair":return"text-accent";case"Poor":return"text-red-500";default:return"text-[#666]"}},n=i=>i?i.includes("Night")?"🌙":"☀️":"";if(!(e!=null&&e.enabled)||!(e!=null&&e.ratings))return f.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[f.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[f.jsx(J2,{size:14}),"RF Propagation"]}),f.jsx("div",{className:"flex-1 flex items-center justify-center",children:f.jsx("div",{className:"text-center py-8",children:f.jsx("div",{className:"font-sans text-[#666]",children:"No band conditions data"})})})]});const a=["80-40m","30-20m","17-15m","12-10m"];return f.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[f.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[f.jsx(J2,{size:14}),"RF Propagation"]}),f.jsxs("div",{className:"text-center mb-3",children:[f.jsx("span",{className:"text-lg",children:n(e.slot_label)}),f.jsx("span",{className:"text-sm font-sans text-[#777] ml-2",children:e.slot_label})]}),f.jsx("div",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-2 flex items-center gap-1",children:"📡 Band Conditions"}),f.jsx("div",{className:"space-y-1.5",children:a.map(i=>{var s;const o=(s=e.ratings)==null?void 0:s[i];return f.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-bg-hover",children:[f.jsx("span",{className:"text-sm font-mono text-[#777]",children:i}),f.jsxs("span",{className:"text-sm flex items-center gap-2",children:[f.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${t(o)}`}),f.jsx("span",{className:`font-sans ${r(o)}`,children:o||"—"})]})]},i)})}),f.jsxs("div",{className:"mt-auto pt-3 border-t border-border text-[10px] font-sans text-[#666]",children:[e.source&&f.jsx("span",{children:e.source==="swpc_local"?"SWPC":"HamQSL"}),e.sent_at&&f.jsx("span",{className:"font-mono ml-2",children:new Date(e.sent_at*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}const GE=[{code:"wam",label:"Western North America"},{code:"eam",label:"Eastern North America"},{code:"enp",label:"Eastern North Pacific"},{code:"esp",label:"Eastern South Pacific"},{code:"gca",label:"Gulf-Caribbean"},{code:"nsa",label:"Northern South America"},{code:"csa",label:"Central South America"},{code:"sat",label:"South Atlantic"},{code:"nat",label:"North Atlantic"},{code:"ena",label:"Eastern North Atlantic"},{code:"nwe",label:"Northwestern Europe"},{code:"eur",label:"Europe"},{code:"eeu",label:"Eastern Europe"},{code:"saf",label:"South Africa"},{code:"mde",label:"Middle East"},{code:"nca",label:"North Central Asia"},{code:"ind",label:"Indian Ocean"},{code:"sea",label:"Southeast Asia"},{code:"fea",label:"Far East"},{code:"esi",label:"Eastern Siberia"},{code:"anz",label:"Australia & New Zealand"},{code:"oce",label:"Oceania"},{code:"wnp",label:"Western North Pacific"}];function UJ(){var c;const[e,t]=O.useState("wam"),[r,n]=O.useState(!1),[a,i]=O.useState(!1);O.useEffect(()=>{fetch("/api/adapter-config/dashboard/tropo_region").then(h=>h.ok?h.json():null).then(h=>{h!=null&&h.value&&typeof h.value=="string"&&t(h.value)}).catch(()=>{})},[]);const o=h=>{t(h),n(!1),i(!0),fetch("/api/adapter-config/dashboard/tropo_region",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:h})}).catch(()=>{}).finally(()=>i(!1))},s=new Date().toISOString().slice(0,10).replace(/-/g,""),l=`https://www.dxinfocentre.com/tr_map/fcst/${e}006.png?v${s}`,u=((c=GE.find(h=>h.code===e))==null?void 0:c.label)||e;return f.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col",children:[f.jsxs("div",{className:"flex items-center justify-between mb-3",children:[f.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] flex items-center gap-2",children:[f.jsx(oi,{size:14}),"Tropo Forecast (Hepburn)"]}),f.jsxs("div",{className:"flex items-center gap-2",children:[a&&f.jsx("span",{className:"text-xs font-sans text-[#666]",children:"saving..."}),f.jsx("select",{value:e,onChange:h=>o(h.target.value),className:"text-xs font-sans bg-bg-hover border border-border px-2 py-1 min-h-[36px] text-[#e0e0e0] focus:outline-none focus:border-accent",children:GE.map(h=>f.jsx("option",{value:h.code,children:h.label},h.code))})]})]}),f.jsxs("div",{className:"text-xs font-sans text-[#666] mb-2",children:[u," — 6-day forecast"]}),r?f.jsx("div",{className:"flex items-center justify-center h-48 text-[#666] text-sm font-sans",children:"Failed to load forecast image"}):f.jsx("img",{src:l,alt:`Hepburn tropo forecast — ${u}`,className:"w-full border border-border",onError:()=>n(!0)}),f.jsxs("div",{className:"text-[10px] font-sans text-[#666] mt-2",children:["Source: ",f.jsx("a",{href:"https://www.dxinfocentre.com/tropo.html",target:"_blank",rel:"noopener noreferrer",className:"text-sky-400 hover:text-sky-300",children:"dxinfocentre.com"})]})]})}const WJ={nws:{icon:ih,color:"text-sky-400",label:"NWS"},swpc:{icon:DV,color:"text-accent",label:"SWPC"},ducting:{icon:oi,color:"text-sky-500",label:"Tropo"},nifc:{icon:Tm,color:"text-red-500",label:"NIFC"},firms:{icon:v1,color:"text-red-400",label:"FIRMS"},avalanche:{icon:sd,color:"text-[#777]",label:"Avy"},usgs:{icon:f1,color:"text-sky-400",label:"USGS"},traffic:{icon:h1,color:"text-[#777]",label:"Traffic"},roads:{icon:SV,color:"text-accent-dim",label:"511"}},HE={routine:"bg-[#1e1e1e] text-[#777] border-[#222]",priority:"bg-accent/5 text-accent border-accent/30",immediate:"bg-red-500/5 text-red-500 border-red-500/30",info:"bg-sky-400/10 text-sky-400 border-sky-400/30",advisory:"bg-sky-400/10 text-sky-400 border-sky-400/30",moderate:"bg-accent/5 text-accent-dim border-accent-dim/30",watch:"bg-accent/5 text-accent border-accent/30",warning:"bg-accent/5 text-accent border-accent/30",severe:"bg-red-500/5 text-red-500 border-red-500/30",extreme:"bg-red-500/5 text-red-500 border-red-500/30",critical:"bg-red-500/5 text-red-500 border-red-500/30",emergency:"bg-red-500/5 text-red-500 border-red-500/30"};function ZJ({event:e,isLocal:t}){var h;const r=WJ[e.source]||{icon:d1,color:"text-[#777]",label:e.source},n=r.icon,a=HE[(h=e.severity)==null?void 0:h.toLowerCase()]||HE.info,i=d=>{const v=new Date(d*1e3),m=new Date().getTime()-v.getTime(),y=Math.floor(m/6e4);return y<1?"just now":y<60?`${y}m ago`:y<1440?`${Math.floor(y/60)}h ago`:v.toLocaleDateString(void 0,{month:"short",day:"numeric"})},o=e.event_type,s=e.area_desc,l=e.description;let u=e.headline;if(o&&s){const d=s.replace(/ County/g,"").split(";")[0];u=`${o} — ${d}`}else o&&(u=o);const c=l?l.split(". ")[0]:null;return f.jsxs("div",{className:`flex items-start gap-2 py-2 border-b border-border/50 last:border-0 ${t?"border-l-2 border-l-accent pl-2 -ml-2":""}`,children:[f.jsx(n,{size:14,className:`mt-0.5 flex-shrink-0 ${r.color}`}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide border ${a}`,children:e.severity||"info"}),t&&f.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide bg-accent/5 text-accent border border-accent/30",title:"LOCAL: event coordinates fall inside the mesh's monitoring area (per the adapter's bbox config on Environment) — operators in this region are directly affected.",children:"LOCAL"}),f.jsx("span",{className:"text-[10px] font-sans text-[#666]",children:r.label}),f.jsx("span",{className:"text-[10px] font-mono text-[#666] ml-auto",children:i(e.fetched_at)})]}),f.jsx("div",{className:`text-sm font-sans font-medium truncate ${t?"text-white":"text-[#e0e0e0]"}`,children:u}),c&&f.jsx("div",{className:"text-[10px] font-sans text-[#666] truncate mt-0.5",children:c})]})]})}function $J({events:e,envStatus:t,embedded:r}){const n={immediate:0,priority:1,routine:2},a=O.useMemo(()=>{const s=new Set;return e.filter(u=>u.event_id?s.has(u.event_id)?!1:(s.add(u.event_id),!0):!0).sort((u,c)=>{var m,y;const h=u.is_local?1:0,d=c.is_local?1:0;if(h!==d)return d-h;const v=n[((m=u.severity)==null?void 0:m.toLowerCase())||"routine"]??2,g=n[((y=c.severity)==null?void 0:y.toLowerCase())||"routine"]??2;return v!==g?v-g:(c.fetched_at||0)-(u.fetched_at||0)})},[e]),i=O.useMemo(()=>{if(!(t!=null&&t.feeds))return null;const s=t.feeds.length,l=t.feeds.filter(d=>d.is_loaded&&!d.last_error).length,u=t.feeds.filter(d=>d.last_error).map(d=>d.source),c=Math.max(...t.feeds.map(d=>d.last_fetch||0)),h=c?Math.floor(Date.now()/1e3-c):null;return{total:s,active:l,errors:u,secAgo:h}},[t]),o=f.jsxs(f.Fragment,{children:[a.length>0?f.jsx("div",{className:"flex-1 overflow-y-auto max-h-80 pr-1 -mr-1",children:a.map((s,l)=>f.jsx(ZJ,{event:s,isLocal:s.is_local},s.event_id||l))}):f.jsx("div",{className:"flex-1 flex items-center justify-center",children:f.jsxs("div",{className:"text-center py-8",children:[f.jsx(mk,{size:24,className:"text-green-500 mx-auto mb-2"}),f.jsx("div",{className:"font-sans text-[#777]",children:"No active events"}),f.jsx("div",{className:"text-[10px] font-sans text-[#666]",children:"All clear"})]})}),i&&f.jsxs("div",{className:`text-[10px] font-sans mt-3 pt-3 border-t border-border ${i.errors.length>0?"text-red-500":"text-[#666]"}`,children:[f.jsx("span",{className:"font-mono",children:i.active})," of ",f.jsx("span",{className:"font-mono",children:i.total})," feeds active",i.secAgo!==null&&f.jsxs(f.Fragment,{children:[" · Last update ",f.jsxs("span",{className:"font-mono",children:[i.secAgo,"s"]})," ago"]}),i.errors.length>0&&f.jsxs("span",{className:"text-red-500",children:[" · ",i.errors.join(", "),": error"]})]})]});return r?f.jsx("div",{className:"flex flex-col h-full",children:o}):f.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[f.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[f.jsx(Mo,{size:14}),"Live Event Feed"]}),o]})}function YJ(){var S,C,M,A,I,k;const[e,t]=O.useState(null),[r,n]=O.useState([]),[a,i]=O.useState([]),[o,s]=O.useState(null),[l,u]=O.useState([]),[c,h]=O.useState(null),[d,v]=O.useState("alerts"),[g,m]=O.useState(!0),[y,x]=O.useState(null),{lastHealth:_,lastMessage:w}=FV();return O.useEffect(()=>{Promise.all([mJ(),_J(),CJ(),RV(),OV().catch(()=>[]),MJ().catch(()=>null)]).then(([P,D,z,E,B,H])=>{t(P),n(D),i(z),s(E),u(B),h(H),m(!1),document.title="Dashboard — MeshAI"}).catch(P=>{x(P.message),m(!1),document.title="Dashboard — MeshAI"})},[]),O.useEffect(()=>{_&&t(_)},[_]),O.useEffect(()=>{(w==null?void 0:w.type)==="env_update"&&w.event&&u(P=>{const D=w.event,z=P.filter(E=>E.event_id!==D.event_id);return[D,...z].slice(0,100)})},[w]),g?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"font-sans text-[#777]",children:"Loading..."})}):y?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsxs("div",{className:"font-sans text-red-500",children:["Error: ",y]})}):f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[f.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[f.jsx("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3",children:"Mesh Health"}),e&&f.jsxs(f.Fragment,{children:[f.jsx(FJ,{health:e}),f.jsxs("div",{className:"mt-4 space-y-2",children:[f.jsx(jv,{label:"Infrastructure",value:((S=e.pillars)==null?void 0:S.infrastructure)??0}),f.jsx(jv,{label:"Utilization",value:((C=e.pillars)==null?void 0:C.utilization)??0}),f.jsx(jv,{label:"Coverage",value:((M=e.pillars)==null?void 0:M.coverage)??0}),f.jsx(jv,{label:"Behavior",value:((A=e.pillars)==null?void 0:A.behavior)??0}),f.jsx(jv,{label:"Power",value:((I=e.pillars)==null?void 0:I.power)??0})]})]})]}),f.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[f.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[f.jsxs("div",{className:"flex items-center gap-4 mb-3 border-b border-border",children:[f.jsx("button",{onClick:()=>v("alerts"),className:`py-2.5 -mb-px text-[10px] font-sans uppercase tracking-widest transition-colors border-b ${d==="alerts"?"border-accent text-white":"border-transparent text-[#777]"}`,children:"Active Alerts"}),f.jsx("button",{onClick:()=>v("feed"),className:`py-2.5 -mb-px text-[10px] font-sans uppercase tracking-widest transition-colors border-b ${d==="feed"?"border-accent text-white":"border-transparent text-[#777]"}`,children:"Event Feed"})]}),d==="alerts"?f.jsx(f.Fragment,{children:a.length>0?f.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:a.map((P,D)=>f.jsx(VJ,{alert:P},D))}):(()=>{const P=l.filter(D=>D.severity==="immediate"||D.severity==="priority").sort((D,z)=>{const E={immediate:0,priority:1},B=(E[D.severity]??2)-(E[z.severity]??2);return B!==0?B:(z.fetched_at||0)-(D.fetched_at||0)}).slice(0,5);return P.length>0?f.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:P.map((D,z)=>{const E=D.severity==="immediate"?{bg:"bg-red-500/5",border:"border-red-500",icon:ah,iconColor:"text-red-500"}:{bg:"bg-accent/5",border:"border-accent",icon:Ao,iconColor:"text-accent"},B=E.icon;return f.jsxs("div",{className:`p-3 ${E.bg} border-l-2 ${E.border} flex items-start gap-3`,children:[f.jsx(B,{size:16,className:E.iconColor}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide bg-[#1e1e1e] text-[#777] border border-[#222]",children:"ENV"}),f.jsx("span",{className:"text-[10px] font-sans text-[#666]",children:D.severity})]}),f.jsx("div",{className:"text-sm font-sans font-medium text-white mt-1",children:D.headline}),f.jsxs("div",{className:"text-[10px] font-mono text-[#666] mt-1",children:[D.source," · ",new Date(D.fetched_at*1e3).toLocaleTimeString()]})]})]},D.event_id||z)})}):f.jsxs("div",{className:"flex items-center gap-2 text-[#777] py-4",children:[f.jsx(mk,{size:16,className:"text-green-500"}),f.jsx("span",{className:"font-sans",children:"No active alerts"})]})})()}):f.jsx($J,{events:l,envStatus:o,embedded:!0})]}),f.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[f.jsx(Uy,{icon:oi,label:"Nodes Online",value:(e==null?void 0:e.total_nodes)||0,accent:"#22c55e",subvalue:`${(e==null?void 0:e.unlocated_count)||0} unlocated`}),f.jsx(Uy,{icon:CV,label:"Infrastructure",value:`${(e==null?void 0:e.infra_online)||0}/${(e==null?void 0:e.infra_total)||0}`,accent:"#38bdf8",subvalue:(e==null?void 0:e.infra_online)===(e==null?void 0:e.infra_total)?"All online":"Some offline"}),f.jsx(Uy,{icon:Mo,label:"Utilization",value:`${((k=e==null?void 0:e.util_percent)==null?void 0:k.toFixed(1))||0}%`,accent:"#f59e0b",subvalue:`${(e==null?void 0:e.flagged_nodes)||0} flagged`}),f.jsx(Uy,{icon:Rd,label:"Regions",value:(e==null?void 0:e.total_regions)||0,accent:"#333333",subvalue:`${(e==null?void 0:e.battery_warnings)||0} battery warnings`})]})]})]}),f.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[f.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[f.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3",children:["Mesh Sources (",f.jsx("span",{className:"font-mono",children:r.length}),")"]}),r.length>0?f.jsx("div",{className:"space-y-1",children:r.map((P,D)=>f.jsx(GJ,{source:P},D))}):f.jsx("div",{className:"font-sans text-[#666] py-4",children:"No sources configured"})]}),f.jsx(HJ,{bandConditions:c}),f.jsx(UJ,{})]})]})}/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var Q2=function(e,t){return Q2=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},Q2(e,t)};function X(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Q2(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Up=function(){return Up=Object.assign||function(t){for(var r,n=1,a=arguments.length;n0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]"u"&&typeof self<"u"?ot.worker=!0:!ot.hasGlobalWindow||"Deno"in window||typeof navigator<"u"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Node.js")>-1?(ot.node=!0,ot.svgSupported=!0):JJ(navigator.userAgent,ot);function JJ(e,t){var r=t.browser,n=e.match(/Firefox\/([\d.]+)/),a=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),i=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);n&&(r.firefox=!0,r.version=n[1]),a&&(r.ie=!0,r.version=a[1]),i&&(r.edge=!0,r.version=i[1],r.newEdge=+i[1].split(".")[0]>18),o&&(r.weChat=!0),t.svgSupported=typeof SVGRect<"u",t.touchEventsSupported="ontouchstart"in window&&!r.ie&&!r.edge,t.pointerEventsSupported="onpointerdown"in window&&(r.edge||r.ie&&+r.version>=11);var s=t.domSupported=typeof document<"u";if(s){var l=document.documentElement.style;t.transform3dSupported=(r.ie&&"transition"in l||r.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in l)&&!("OTransition"in l),t.transformSupported=t.transform3dSupported||r.ie&&+r.version>=9}}var bk=12,HV="sans-serif",Ss=bk+"px "+HV,QJ=20,eQ=100,tQ="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function rQ(e){var t={};if(typeof JSON>"u")return t;for(var r=0;r=0)s=o*r.length;else for(var l=0;l=sQ&&(fS=0),fS++}function y1(){for(var e=[],t=0;t>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",n[l]+":0",a[u]+":0",n[1-l]+":auto",a[1-u]+":auto",""].join("!important;"),e.appendChild(o),r.push(o)}return t.clearMarkers=function(){j(r,function(c){c.parentNode&&c.parentNode.removeChild(c)})},r}function MQ(e,t,r){for(var n=r?"invTrans":"trans",a=t[n],i=t.srcCoords,o=[],s=[],l=!0,u=0;u<4;u++){var c=e[u].getBoundingClientRect(),h=2*u,d=c.left,v=c.top;o.push(d,v),l=l&&i&&d===i[h]&&v===i[h+1],s.push(e[u].offsetLeft,e[u].offsetTop)}return l&&a?a:(t.srcCoords=o,t[n]=r?$E(s,o):$E(o,s))}function eG(e){return e.nodeName.toUpperCase()==="CANVAS"}var AQ=/([&<>"'])/g,NQ={"&":"&","<":"<",">":">",'"':""","'":"'"};function Tn(e){return e==null?"":(e+"").replace(AQ,function(t,r){return NQ[r]})}var kQ=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,vS=[],LQ=ot.browser.firefox&&+ot.browser.version.split(".")[0]<39;function aM(e,t,r,n){return r=r||{},n?YE(e,t,r):LQ&&t.layerX!=null&&t.layerX!==t.offsetX?(r.zrX=t.layerX,r.zrY=t.layerY):t.offsetX!=null?(r.zrX=t.offsetX,r.zrY=t.offsetY):YE(e,t,r),r}function YE(e,t,r){if(ot.domSupported&&e.getBoundingClientRect){var n=t.clientX,a=t.clientY;if(eG(e)){var i=e.getBoundingClientRect();r.zrX=n-i.left,r.zrY=a-i.top;return}else if(nM(vS,e,n,a)){r.zrX=vS[0],r.zrY=vS[1];return}}r.zrX=r.zrY=0}function Nk(e){return e||window.event}function Fa(e,t,r){if(t=Nk(t),t.zrX!=null)return t;var n=t.type,a=n&&n.indexOf("touch")>=0;if(a){var o=n!=="touchend"?t.targetTouches[0]:t.changedTouches[0];o&&aM(e,o,t,r)}else{aM(e,t,t,r);var i=IQ(t);t.zrDelta=i?i/120:-(t.detail||0)/3}var s=t.button;return t.which==null&&s!==void 0&&kQ.test(t.type)&&(t.which=s&1?1:s&2?3:s&4?2:0),t}function IQ(e){var t=e.wheelDelta;if(t)return t;var r=e.deltaX,n=e.deltaY;if(r==null||n==null)return t;var a=Math.abs(n!==0?n:r),i=n>0?-1:n<0?1:r>0?-1:1;return 3*a*i}function iM(e,t,r,n){e.addEventListener(t,r,n)}function PQ(e,t,r,n){e.removeEventListener(t,r,n)}var Cs=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function XE(e){return e.which===2||e.which===3}var DQ=function(){function e(){this._track=[]}return e.prototype.recognize=function(t,r,n){return this._doTrack(t,r,n),this._recognize(t)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(t,r,n){var a=t.touches;if(a){for(var i={points:[],touches:[],target:r,event:t},o=0,s=a.length;o1&&n&&n.length>1){var i=qE(n)/qE(a);!isFinite(i)&&(i=1),t.pinchScale=i;var o=EQ(n);return t.pinchX=o[0],t.pinchY=o[1],{type:"pinch",target:e[0].target,event:t}}}}};function $t(){return[1,0,0,1,0,0]}function sh(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function Bl(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Ca(e,t,r){var n=t[0]*r[0]+t[2]*r[1],a=t[1]*r[0]+t[3]*r[1],i=t[0]*r[2]+t[2]*r[3],o=t[1]*r[2]+t[3]*r[3],s=t[0]*r[4]+t[2]*r[5]+t[4],l=t[1]*r[4]+t[3]*r[5]+t[5];return e[0]=n,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=l,e}function Pi(e,t,r){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4]+r[0],e[5]=t[5]+r[1],e}function js(e,t,r,n){n===void 0&&(n=[0,0]);var a=t[0],i=t[2],o=t[4],s=t[1],l=t[3],u=t[5],c=Math.sin(r),h=Math.cos(r);return e[0]=a*h+s*c,e[1]=-a*c+s*h,e[2]=i*h+l*c,e[3]=-i*c+h*l,e[4]=h*(o-n[0])+c*(u-n[1])+n[0],e[5]=h*(u-n[1])-c*(o-n[0])+n[1],e}function b1(e,t,r){var n=r[0],a=r[1];return e[0]=t[0]*n,e[1]=t[1]*a,e[2]=t[2]*n,e[3]=t[3]*a,e[4]=t[4]*n,e[5]=t[5]*a,e}function Ma(e,t){var r=t[0],n=t[2],a=t[4],i=t[1],o=t[3],s=t[5],l=r*o-i*n;return l?(l=1/l,e[0]=o*l,e[1]=-i*l,e[2]=-n*l,e[3]=r*l,e[4]=(n*s-o*a)*l,e[5]=(i*a-r*s)*l,e):null}function tG(e){var t=$t();return Bl(t,e),t}const jQ=Object.freeze(Object.defineProperty({__proto__:null,clone:tG,copy:Bl,create:$t,identity:sh,invert:Ma,mul:Ca,rotate:js,scale:b1,translate:Pi},Symbol.toStringTag,{value:"Module"}));var Pe=function(){function e(t,r){this.x=t||0,this.y=r||0}return e.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.set=function(t,r){return this.x=t,this.y=r,this},e.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},e.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.prototype.scale=function(t){this.x*=t,this.y*=t},e.prototype.scaleAndAdd=function(t,r){this.x+=t.x*r,this.y+=t.y*r},e.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},e.prototype.dot=function(t){return this.x*t.x+this.y*t.y},e.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},e.prototype.distance=function(t){var r=this.x-t.x,n=this.y-t.y;return Math.sqrt(r*r+n*n)},e.prototype.distanceSquare=function(t){var r=this.x-t.x,n=this.y-t.y;return r*r+n*n},e.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.prototype.transform=function(t){if(t){var r=this.x,n=this.y;return this.x=t[0]*r+t[2]*n+t[4],this.y=t[1]*r+t[3]*n+t[5],this}},e.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},e.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},e.set=function(t,r,n){t.x=r,t.y=n},e.copy=function(t,r){t.x=r.x,t.y=r.y},e.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},e.lenSquare=function(t){return t.x*t.x+t.y*t.y},e.dot=function(t,r){return t.x*r.x+t.y*r.y},e.add=function(t,r,n){t.x=r.x+n.x,t.y=r.y+n.y},e.sub=function(t,r,n){t.x=r.x-n.x,t.y=r.y-n.y},e.scale=function(t,r,n){t.x=r.x*n,t.y=r.y*n},e.scaleAndAdd=function(t,r,n,a){t.x=r.x+n.x*a,t.y=r.y+n.y*a},e.lerp=function(t,r,n,a){var i=1-a;t.x=i*r.x+a*n.x,t.y=i*r.y+a*n.y},e}(),oc=Math.min,Nf=Math.max,oM=Math.abs,KE=["x","y"],RQ=["width","height"],pu=new Pe,gu=new Pe,mu=new Pe,yu=new Pe,ma=aG(),bp=ma.minTv,sM=ma.maxTv,Yp=[0,0],ke=function(){function e(t,r,n,a){gS(this,t,r,n,a)}return e.set=function(t,r,n,a,i){return a<0&&(r=r+a,a=-a),i<0&&(n=n+i,i=-i),t.x=r,t.y=n,t.width=a,t.height=i,t},e.prototype.union=function(t){var r=oc(t.x,this.x),n=oc(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Nf(t.x+t.width,this.x+this.width)-r:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=Nf(t.y+t.height,this.y+this.height)-n:this.height=t.height,this.x=r,this.y=n},e.prototype.applyTransform=function(t){e.applyTransform(this,this,t)},e.prototype.calculateTransform=function(t){return rG($t(),this,t)},e.prototype.intersect=function(t,r,n){return e.intersect(this,t,r,n)},e.intersect=function(t,r,n,a){n&&Pe.set(n,0,0);var i=a&&a.outIntersectRect||null,o=a&&a.clamp;if(i&&(i.x=i.y=i.width=i.height=NaN),!t||!r)return!1;t instanceof e||(t=gS(zQ,t.x,t.y,t.width,t.height)),r instanceof e||(r=gS(BQ,r.x,r.y,r.width,r.height));var s=!!n;ma.reset(a,s);var l=ma.touchThreshold,u=t.x+l,c=t.x+t.width-l,h=t.y+l,d=t.y+t.height-l,v=r.x+l,g=r.x+r.width-l,m=r.y+l,y=r.y+r.height-l;if(u>c||h>d||v>g||m>y)return!1;var x=!(c=t.x&&r<=t.x+t.width&&n>=t.y&&n<=t.y+t.height},e.prototype.contain=function(t,r){return e.contain(this,t,r)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(t){ud(this,t)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(t,r){return t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height,t},e.applyTransform=function(t,r,n){if(!n){t!==r&&ud(t,r);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var a=n[0],i=n[3],o=n[4],s=n[5];t.x=r.x*a+o,t.y=r.y*i+s,t.width=r.width*a,t.height=r.height*i,t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height);return}pu.x=mu.x=r.x,pu.y=yu.y=r.y,gu.x=yu.x=r.x+r.width,gu.y=mu.y=r.y+r.height,pu.transform(n),yu.transform(n),gu.transform(n),mu.transform(n),t.x=oc(pu.x,gu.x,mu.x,yu.x),t.y=oc(pu.y,gu.y,mu.y,yu.y);var l=Nf(pu.x,gu.x,mu.x,yu.x),u=Nf(pu.y,gu.y,mu.y,yu.y);t.width=l-t.x,t.height=u-t.y},e.calculateTransform=function(t,r,n){var a=n.width/r.width,i=n.height/r.height;return t=sh(t||[]),Pi(t,t,hs(mS,-r.x,-r.y)),b1(t,t,hs(mS,a,i)),Pi(t,t,hs(mS,n.x,n.y)),t},e}(),w1=ke.create,gS=ke.set,ud=ke.copy,rG=ke.calculateTransform,nG=ke.applyTransform,OQ=ke.contain,zQ=new ke(0,0,0,0),BQ=new ke(0,0,0,0),mS=[];function JE(e,t,r,n,a,i,o,s){var l=oM(t-r),u=oM(n-e),c=oc(l,u),h=KE[a],d=KE[1-a],v=RQ[a];t=u||!ma.bidirectional)&&(bp[h]=-u,bp[d]=0,ma.useDir&&ma.calcDirMTV())))}function aG(){var e=0,t=new Pe,r=new Pe,n={minTv:new Pe,maxTv:new Pe,useDir:!1,dirMinTv:new Pe,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,o){n.touchThreshold=0,i&&i.touchThreshold!=null&&(n.touchThreshold=Nf(0,i.touchThreshold)),n.negativeSize=!1,o&&(n.minTv.set(1/0,1/0),n.maxTv.set(0,0),n.useDir=!1,i&&i.direction!=null&&(n.useDir=!0,n.dirMinTv.copy(n.minTv),r.copy(n.minTv),e=i.direction,n.bidirectional=i.bidirectional==null||!!i.bidirectional,n.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var i=n.minTv,o=n.dirMinTv,s=i.y*i.y+i.x*i.x,l=Math.sin(e),u=Math.cos(e),c=l*i.y+u*i.x;if(a(c)){a(i.x)&&a(i.y)&&o.set(0,0);return}if(r.x=s*u/c,r.y=s*l/c,a(r.x)&&a(r.y)){o.set(0,0);return}(n.bidirectional||t.dot(r)>0)&&r.len()=0;h--){var d=i[h];d!==a&&!d.ignore&&!d.ignoreCoarsePointer&&(!d.parent||!d.parent.ignoreCoarsePointer)&&(yS.copy(d.getBoundingRect()),d.transform&&yS.applyTransform(d.transform),yS.intersect(c)&&s.push(d))}if(s.length)for(var v=4,g=Math.PI/12,m=Math.PI*2,y=0;y4)return;this._downPoint=null}this.dispatchToElement(i,e,t)}});function UQ(e,t,r){if(e[e.rectHover?"rectContain":"contain"](t,r)){for(var n=e,a=void 0,i=!1;n;){if(n.ignoreClip&&(i=!0),!i){var o=n.getClipPath();if(o&&!o.contain(t,r))return!1}n.silent&&(a=!0);var s=n.__hostTarget;n=s?n.ignoreHostSilent?null:s:n.parent}return a?iG:!0}return!1}function QE(e,t,r,n,a){for(var i=e.length-1;i>=0;i--){var o=e[i],s=void 0;if(o!==a&&!o.ignore&&(s=UQ(o,r,n))&&(!t.topTarget&&(t.topTarget=o),s!==iG)){t.target=o;break}}}function sG(e,t,r){var n=e.painter;return t<0||t>n.getWidth()||r<0||r>n.getHeight()}var lG=32,Ov=7;function WQ(e){for(var t=0;e>=lG;)t|=e&1,e>>=1;return e+t}function ej(e,t,r,n){var a=t+1;if(a===r)return 1;if(n(e[a++],e[t])<0){for(;a=0;)a++;return a-t}function ZQ(e,t,r){for(r--;t>>1,a(i,e[l])<0?s=l:o=l+1;var u=n-o;switch(u){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;u>0;)e[o+u]=e[o+u-1],u--}e[o]=i}}function xS(e,t,r,n,a,i){var o=0,s=0,l=1;if(i(e,t[r+a])>0){for(s=n-a;l0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}else{for(s=a+1;ls&&(l=s);var u=o;o=a-l,l=a-u}for(o++;o>>1);i(e,t[r+c])>0?o=c+1:l=c}return l}function _S(e,t,r,n,a,i){var o=0,s=0,l=1;if(i(e,t[r+a])<0){for(s=a+1;ls&&(l=s);var u=o;o=a-l,l=a-u}else{for(s=n-a;l=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}for(o++;o>>1);i(e,t[r+c])<0?l=c:o=c+1}return l}function $Q(e,t){var r=Ov,n,a,i=0,o=[];n=[],a=[];function s(v,g){n[i]=v,a[i]=g,i+=1}function l(){for(;i>1;){var v=i-2;if(v>=1&&a[v-1]<=a[v]+a[v+1]||v>=2&&a[v-2]<=a[v]+a[v-1])a[v-1]a[v+1])break;c(v)}}function u(){for(;i>1;){var v=i-2;v>0&&a[v-1]=Ov||A>=Ov);if(I)break;C<0&&(C=0),C+=2}if(r=C,r<1&&(r=1),g===1){for(x=0;x=0;x--)e[M+x]=e[C+x];e[S]=o[w];return}for(var A=r;;){var I=0,k=0,P=!1;do if(t(o[w],e[_])<0){if(e[S--]=e[_--],I++,k=0,--g===0){P=!0;break}}else if(e[S--]=o[w--],k++,I=0,--y===1){P=!0;break}while((I|k)=0;x--)e[M+x]=e[C+x];if(g===0){P=!0;break}}if(e[S--]=o[w--],--y===1){P=!0;break}if(k=y-xS(e[_],o,0,y,y-1,t),k!==0){for(S-=k,w-=k,y-=k,M=S+1,C=w+1,x=0;x=Ov||k>=Ov);if(P)break;A<0&&(A=0),A+=2}if(r=A,r<1&&(r=1),y===1){for(S-=g,_-=g,M=S+1,C=_+1,x=g-1;x>=0;x--)e[M+x]=e[C+x];e[S]=o[w]}else{if(y===0)throw new Error;for(C=S-(y-1),x=0;xs&&(l=s),tj(e,r,r+l,r+i,t),i=l}o.pushRun(r,i),o.mergeRuns(),a-=i,r+=i}while(a!==0);o.forceMergeRuns()}}var Qn=1,wp=2,ff=4,rj=!1;function bS(){rj||(rj=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function nj(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var YQ=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=nj}return e.prototype.traverse=function(t,r){for(var n=0;n=0&&this._roots.splice(a,1)},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),k_;k_=ot.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};var Xp={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return .5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return e===0?0:Math.pow(1024,e-1)},exponentialOut:function(e){return e===1?1:1-Math.pow(2,-10*e)},exponentialInOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,r=.1,n=.4;return e===0?0:e===1?1:(!r||r<1?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),-(r*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/n)))},elasticOut:function(e){var t,r=.1,n=.4;return e===0?0:e===1?1:(!r||r<1?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),r*Math.pow(2,-10*e)*Math.sin((e-t)*(2*Math.PI)/n)+1)},elasticInOut:function(e){var t,r=.1,n=.4;return e===0?0:e===1?1:(!r||r<1?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),(e*=2)<1?-.5*(r*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/n)):r*Math.pow(2,-10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/n)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-Xp.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?Xp.bounceIn(e*2)*.5:Xp.bounceOut(e*2-1)*.5+.5}},Zy=Math.pow,Nl=Math.sqrt,L_=1e-8,uG=1e-4,aj=Nl(3),$y=1/3,io=nu(),Za=nu(),Hf=nu();function fl(e){return e>-L_&&eL_||e<-L_}function zr(e,t,r,n,a){var i=1-a;return i*i*(i*e+3*a*t)+a*a*(a*n+3*i*r)}function ij(e,t,r,n,a){var i=1-a;return 3*(((t-e)*i+2*(r-t)*a)*i+(n-r)*a*a)}function I_(e,t,r,n,a,i){var o=n+3*(t-r)-e,s=3*(r-t*2+e),l=3*(t-e),u=e-a,c=s*s-3*o*l,h=s*l-9*o*u,d=l*l-3*s*u,v=0;if(fl(c)&&fl(h))if(fl(s))i[0]=0;else{var g=-l/s;g>=0&&g<=1&&(i[v++]=g)}else{var m=h*h-4*c*d;if(fl(m)){var y=h/c,g=-s/o+y,x=-y/2;g>=0&&g<=1&&(i[v++]=g),x>=0&&x<=1&&(i[v++]=x)}else if(m>0){var _=Nl(m),w=c*s+1.5*o*(-h+_),S=c*s+1.5*o*(-h-_);w<0?w=-Zy(-w,$y):w=Zy(w,$y),S<0?S=-Zy(-S,$y):S=Zy(S,$y);var g=(-s-(w+S))/(3*o);g>=0&&g<=1&&(i[v++]=g)}else{var C=(2*c*s-3*o*h)/(2*Nl(c*c*c)),M=Math.acos(C)/3,A=Nl(c),I=Math.cos(M),g=(-s-2*A*I)/(3*o),x=(-s+A*(I+aj*Math.sin(M)))/(3*o),k=(-s+A*(I-aj*Math.sin(M)))/(3*o);g>=0&&g<=1&&(i[v++]=g),x>=0&&x<=1&&(i[v++]=x),k>=0&&k<=1&&(i[v++]=k)}}return v}function hG(e,t,r,n,a){var i=6*r-12*t+6*e,o=9*t+3*n-3*e-9*r,s=3*t-3*e,l=0;if(fl(o)){if(cG(i)){var u=-s/i;u>=0&&u<=1&&(a[l++]=u)}}else{var c=i*i-4*o*s;if(fl(c))a[0]=-i/(2*o);else if(c>0){var h=Nl(c),u=(-i+h)/(2*o),d=(-i-h)/(2*o);u>=0&&u<=1&&(a[l++]=u),d>=0&&d<=1&&(a[l++]=d)}}return l}function Fl(e,t,r,n,a,i){var o=(t-e)*a+e,s=(r-t)*a+t,l=(n-r)*a+r,u=(s-o)*a+o,c=(l-s)*a+s,h=(c-u)*a+u;i[0]=e,i[1]=o,i[2]=u,i[3]=h,i[4]=h,i[5]=c,i[6]=l,i[7]=n}function fG(e,t,r,n,a,i,o,s,l,u,c){var h,d=.005,v=1/0,g,m,y,x;io[0]=l,io[1]=u;for(var _=0;_<1;_+=.05)Za[0]=zr(e,r,a,o,_),Za[1]=zr(t,n,i,s,_),y=Al(io,Za),y=0&&y=0&&u<=1&&(a[l++]=u)}}else{var c=o*o-4*i*s;if(fl(c)){var u=-o/(2*i);u>=0&&u<=1&&(a[l++]=u)}else if(c>0){var h=Nl(c),u=(-o+h)/(2*i),d=(-o-h)/(2*i);u>=0&&u<=1&&(a[l++]=u),d>=0&&d<=1&&(a[l++]=d)}}return l}function dG(e,t,r){var n=e+r-2*t;return n===0?.5:(e-t)/n}function Lg(e,t,r,n,a){var i=(t-e)*n+e,o=(r-t)*n+t,s=(o-i)*n+i;a[0]=e,a[1]=i,a[2]=s,a[3]=s,a[4]=o,a[5]=r}function vG(e,t,r,n,a,i,o,s,l){var u,c=.005,h=1/0;io[0]=o,io[1]=s;for(var d=0;d<1;d+=.05){Za[0]=Xr(e,r,a,d),Za[1]=Xr(t,n,i,d);var v=Al(io,Za);v=0&&v=1?1:I_(0,n,i,1,l,s)&&zr(0,a,o,1,s[0])}}}var QQ=function(){function e(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||ar,this.ondestroy=t.ondestroy||ar,this.onrestart=t.onrestart||ar,t.easing&&this.setEasing(t.easing)}return e.prototype.step=function(t,r){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),this._paused){this._pausedTime+=r;return}var n=this._life,a=t-this._startTime-this._pausedTime,i=a/n;i<0&&(i=0),i=Math.min(i,1);var o=this.easingFunc,s=o?o(i):i;if(this.onframe(s),i===1)if(this.loop){var l=a%n;this._startTime=t-l,this._pausedTime=0,this.onrestart()}else return!0;return!1},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(t){this.easing=t,this.easingFunc=Me(t)?t:Xp[t]||kk(t)},e}(),pG=function(){function e(t){this.value=t}return e}(),eee=function(){function e(){this._len=0}return e.prototype.insert=function(t){var r=new pG(t);return this.insertEntry(r),r},e.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},e.prototype.remove=function(t){var r=t.prev,n=t.next;r?r.next=n:this.head=n,n?n.prev=r:this.tail=r,t.next=t.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),cd=function(){function e(t){this._list=new eee,this._maxSize=10,this._map={},this._maxSize=t}return e.prototype.put=function(t,r){var n=this._list,a=this._map,i=null;if(a[t]==null){var o=n.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=n.head;n.remove(l),delete a[l.key],i=l.value,this._lastRemovedEntry=l}s?s.value=r:s=new pG(r),s.key=t,n.insertEntry(s),a[t]=s}return i},e.prototype.get=function(t){var r=this._map[t],n=this._list;if(r!=null)return r!==n.tail&&(n.remove(r),n.insertEntry(r)),r.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),oj={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Ai(e){return e=Math.round(e),e<0?0:e>255?255:e}function tee(e){return e=Math.round(e),e<0?0:e>360?360:e}function Ig(e){return e<0?0:e>1?1:e}function kx(e){var t=e;return t.length&&t.charAt(t.length-1)==="%"?Ai(parseFloat(t)/100*255):Ai(parseInt(t,10))}function fs(e){var t=e;return t.length&&t.charAt(t.length-1)==="%"?Ig(parseFloat(t)/100):Ig(parseFloat(t))}function wS(e,t,r){return r<0?r+=1:r>1&&(r-=1),r*6<1?e+(t-e)*r*6:r*2<1?t:r*3<2?e+(t-e)*(2/3-r)*6:e}function dl(e,t,r){return e+(t-e)*r}function za(e,t,r,n,a){return e[0]=t,e[1]=r,e[2]=n,e[3]=a,e}function uM(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var gG=new cd(20),Yy=null;function Fh(e,t){Yy&&uM(Yy,t),Yy=gG.put(e,Yy||t.slice())}function An(e,t){if(e){t=t||[];var r=gG.get(e);if(r)return uM(t,r);e=e+"";var n=e.replace(/ /g,"").toLowerCase();if(n in oj)return uM(t,oj[n]),Fh(e,t),t;var a=n.length;if(n.charAt(0)==="#"){if(a===4||a===5){var i=parseInt(n.slice(1,4),16);if(!(i>=0&&i<=4095)){za(t,0,0,0,1);return}return za(t,(i&3840)>>4|(i&3840)>>8,i&240|(i&240)>>4,i&15|(i&15)<<4,a===5?parseInt(n.slice(4),16)/15:1),Fh(e,t),t}else if(a===7||a===9){var i=parseInt(n.slice(1,7),16);if(!(i>=0&&i<=16777215)){za(t,0,0,0,1);return}return za(t,(i&16711680)>>16,(i&65280)>>8,i&255,a===9?parseInt(n.slice(7),16)/255:1),Fh(e,t),t}return}var o=n.indexOf("("),s=n.indexOf(")");if(o!==-1&&s+1===a){var l=n.substr(0,o),u=n.substr(o+1,s-(o+1)).split(","),c=1;switch(l){case"rgba":if(u.length!==4)return u.length===3?za(t,+u[0],+u[1],+u[2],1):za(t,0,0,0,1);c=fs(u.pop());case"rgb":if(u.length>=3)return za(t,kx(u[0]),kx(u[1]),kx(u[2]),u.length===3?c:fs(u[3])),Fh(e,t),t;za(t,0,0,0,1);return;case"hsla":if(u.length!==4){za(t,0,0,0,1);return}return u[3]=fs(u[3]),cM(u,t),Fh(e,t),t;case"hsl":if(u.length!==3){za(t,0,0,0,1);return}return cM(u,t),Fh(e,t),t;default:return}}za(t,0,0,0,1)}}function cM(e,t){var r=(parseFloat(e[0])%360+360)%360/360,n=fs(e[1]),a=fs(e[2]),i=a<=.5?a*(n+1):a+n-a*n,o=a*2-i;return t=t||[],za(t,Ai(wS(o,i,r+1/3)*255),Ai(wS(o,i,r)*255),Ai(wS(o,i,r-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function ree(e){if(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,a=Math.min(t,r,n),i=Math.max(t,r,n),o=i-a,s=(i+a)/2,l,u;if(o===0)l=0,u=0;else{s<.5?u=o/(i+a):u=o/(2-i-a);var c=((i-t)/6+o/2)/o,h=((i-r)/6+o/2)/o,d=((i-n)/6+o/2)/o;t===i?l=d-h:r===i?l=1/3+c-d:n===i&&(l=2/3+h-c),l<0&&(l+=1),l>1&&(l-=1)}var v=[l*360,u,s];return e[3]!=null&&v.push(e[3]),v}}function P_(e,t){var r=An(e);if(r){for(var n=0;n<3;n++)t<0?r[n]=r[n]*(1-t)|0:r[n]=(255-r[n])*t+r[n]|0,r[n]>255?r[n]=255:r[n]<0&&(r[n]=0);return qa(r,r.length===4?"rgba":"rgb")}}function nee(e){var t=An(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)}function qp(e,t,r){if(!(!(t&&t.length)||!(e>=0&&e<=1))){r=r||[];var n=e*(t.length-1),a=Math.floor(n),i=Math.ceil(n),o=t[a],s=t[i],l=n-a;return r[0]=Ai(dl(o[0],s[0],l)),r[1]=Ai(dl(o[1],s[1],l)),r[2]=Ai(dl(o[2],s[2],l)),r[3]=Ig(dl(o[3],s[3],l)),r}}var aee=qp;function Lk(e,t,r){if(!(!(t&&t.length)||!(e>=0&&e<=1))){var n=e*(t.length-1),a=Math.floor(n),i=Math.ceil(n),o=An(t[a]),s=An(t[i]),l=n-a,u=qa([Ai(dl(o[0],s[0],l)),Ai(dl(o[1],s[1],l)),Ai(dl(o[2],s[2],l)),Ig(dl(o[3],s[3],l))],"rgba");return r?{color:u,leftIndex:a,rightIndex:i,value:n}:u}}var iee=Lk;function ds(e,t,r,n){var a=An(e);if(e)return a=ree(a),t!=null&&(a[0]=tee(Me(t)?t(a[0]):t)),r!=null&&(a[1]=fs(Me(r)?r(a[1]):r)),n!=null&&(a[2]=fs(Me(n)?n(a[2]):n)),qa(cM(a),"rgba")}function Pg(e,t){var r=An(e);if(r&&t!=null)return r[3]=Ig(t),qa(r,"rgba")}function qa(e,t){if(!(!e||!e.length)){var r=e[0]+","+e[1]+","+e[2];return(t==="rgba"||t==="hsva"||t==="hsla")&&(r+=","+e[3]),t+"("+r+")"}}function Dg(e,t){var r=An(e);return r?(.299*r[0]+.587*r[1]+.114*r[2])*r[3]/255+(1-r[3])*t:0}function oee(){return qa([Math.round(Math.random()*255),Math.round(Math.random()*255),Math.round(Math.random()*255)],"rgb")}var sj=new cd(100);function D_(e){if(ue(e)){var t=sj.get(e);return t||(t=P_(e,-.1),sj.put(e,t)),t}else if(Mm(e)){var r=te({},e);return r.colorStops=oe(e.colorStops,function(n){return{offset:n.offset,color:P_(n.color,-.1)}}),r}return e}const see=Object.freeze(Object.defineProperty({__proto__:null,fastLerp:qp,fastMapToColor:aee,lerp:Lk,lift:P_,liftColor:D_,lum:Dg,mapToColor:iee,modifyAlpha:Pg,modifyHSL:ds,parse:An,parseCssFloat:fs,parseCssInt:kx,random:oee,stringify:qa,toHex:nee},Symbol.toStringTag,{value:"Module"}));var E_=Math.round;function Eg(e){var t;if(!e||e==="transparent")e="none";else if(typeof e=="string"&&e.indexOf("rgba")>-1){var r=An(e);r&&(e="rgb("+r[0]+","+r[1]+","+r[2]+")",t=r[3])}return{color:e,opacity:t??1}}var lj=1e-4;function vl(e){return e-lj}function Xy(e){return E_(e*1e3)/1e3}function hM(e){return E_(e*1e4)/1e4}function lee(e){return"matrix("+Xy(e[0])+","+Xy(e[1])+","+Xy(e[2])+","+Xy(e[3])+","+hM(e[4])+","+hM(e[5])+")"}var uee={left:"start",right:"end",center:"middle",middle:"middle"};function cee(e,t,r){return r==="top"?e+=t/2:r==="bottom"&&(e-=t/2),e}function hee(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function fee(e){var t=e.style,r=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),r[0],r[1]].join(",")}function mG(e){return e&&!!e.image}function dee(e){return e&&!!e.svgElement}function Ik(e){return mG(e)||dee(e)}function yG(e){return e.type==="linear"}function xG(e){return e.type==="radial"}function _G(e){return e&&(e.type==="linear"||e.type==="radial")}function S1(e){return"url(#"+e+")"}function bG(e){var t=e.getGlobalScale(),r=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(r)/Math.log(10)),1)}function wG(e){var t=e.x||0,r=e.y||0,n=(e.rotation||0)*Wp,a=_e(e.scaleX,1),i=_e(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,l=[];return(t||r)&&l.push("translate("+t+"px,"+r+"px)"),n&&l.push("rotate("+n+")"),(a!==1||i!==1)&&l.push("scale("+a+","+i+")"),(o||s)&&l.push("skew("+E_(o*Wp)+"deg, "+E_(s*Wp)+"deg)"),l.join(" ")}var vee=function(){return typeof Buffer<"u"&&typeof Buffer.from=="function"?function(e){return Buffer.from(e).toString("base64")}:typeof btoa=="function"&&typeof unescape=="function"&&typeof encodeURIComponent=="function"?function(e){return btoa(unescape(encodeURIComponent(e)))}:function(e){return null}}(),fM=Array.prototype.slice;function es(e,t,r){return(t-e)*r+e}function SS(e,t,r,n){for(var a=t.length,i=0;in?t:e,i=Math.min(r,n),o=a[i-1]||{color:[0,0,0,0],offset:0},s=i;so;if(s)n.length=o;else for(var l=i;l=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(t,r,n){this._needsSort=!0;var a=this.keyframes,i=a.length,o=!1,s=cj,l=r;if(hn(r)){var u=yee(r);s=u,(u===1&&!ft(r[0])||u===2&&!ft(r[0][0]))&&(o=!0)}else if(ft(r)&&!un(r))s=Ky;else if(ue(r))if(!isNaN(+r))s=Ky;else{var c=An(r);c&&(l=c,s=Sp)}else if(Mm(r)){var h=te({},l);h.colorStops=oe(r.colorStops,function(v){return{offset:v.offset,color:An(v.color)}}),yG(r)?s=dM:xG(r)&&(s=vM),l=h}i===0?this.valType=s:(s!==this.valType||s===cj)&&(o=!0),this.discrete=this.discrete||o;var d={time:t,value:l,rawValue:r,percent:0};return n&&(d.easing=n,d.easingFunc=Me(n)?n:Xp[n]||kk(n)),a.push(d),d},e.prototype.prepare=function(t,r){var n=this.keyframes;this._needsSort&&n.sort(function(m,y){return m.time-y.time});for(var a=this.valType,i=n.length,o=n[i-1],s=this.discrete,l=Jy(a),u=hj(a),c=0;c=0&&!(o[c].percent<=r);c--);c=d(c,s-2)}else{for(c=h;cr);c++);c=d(c-1,s-2)}g=o[c+1],v=o[c]}if(v&&g){this._lastFr=c,this._lastFrP=r;var y=g.percent-v.percent,x=y===0?1:d((r-v.percent)/y,1);g.easingFunc&&(x=g.easingFunc(x));var _=n?this._additiveValue:u?zv:t[l];if((Jy(i)||u)&&!_&&(_=this._additiveValue=[]),this.discrete)t[l]=x<1?v.rawValue:g.rawValue;else if(Jy(i))i===Ix?SS(_,v[a],g[a],x):pee(_,v[a],g[a],x);else if(hj(i)){var w=v[a],S=g[a],C=i===dM;t[l]={type:C?"linear":"radial",x:es(w.x,S.x,x),y:es(w.y,S.y,x),colorStops:oe(w.colorStops,function(A,I){var k=S.colorStops[I];return{offset:es(A.offset,k.offset,x),color:Lx(SS([],A.color,k.color,x))}}),global:S.global},C?(t[l].x2=es(w.x2,S.x2,x),t[l].y2=es(w.y2,S.y2,x)):t[l].r=es(w.r,S.r,x)}else if(u)SS(_,v[a],g[a],x),n||(t[l]=Lx(_));else{var M=es(v[a],g[a],x);n?this._additiveValue=M:t[l]=M}n&&this._addToTarget(t)}}},e.prototype._addToTarget=function(t){var r=this.valType,n=this.propName,a=this._additiveValue;r===Ky?t[n]=t[n]+a:r===Sp?(An(t[n],zv),qy(zv,zv,a,1),t[n]=Lx(zv)):r===Ix?qy(t[n],t[n],a,1):r===SG&&uj(t[n],t[n],a,1)},e}(),Pk=function(){function e(t,r,n,a){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=t,this._loop=r,r&&a){y1("Can' use additive animation on looped animation.");return}this._additiveAnimators=a,this._allowDiscrete=n}return e.prototype.getMaxTime=function(){return this._maxTime},e.prototype.getDelay=function(){return this._delay},e.prototype.getLoop=function(){return this._loop},e.prototype.getTarget=function(){return this._target},e.prototype.changeTarget=function(t){this._target=t},e.prototype.when=function(t,r,n){return this.whenWithKeys(t,r,at(r),n)},e.prototype.whenWithKeys=function(t,r,n,a){for(var i=this._tracks,o=0;o0&&l.addKeyframe(0,Kp(u),a),this._trackKeys.push(s)}l.addKeyframe(t,Kp(r[s]),a)}return this._maxTime=Math.max(this._maxTime,t),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var r=t.length,n=0;n0)){this._started=1;for(var r=this,n=[],a=this._maxTime||0,i=0;i1){var s=o.pop();i.addKeyframe(s.time,t[a]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},e}();function kf(){return new Date().getTime()}var _ee=function(e){X(t,e);function t(r){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,r=r||{},n.stage=r.stage||{},n}return t.prototype.addClip=function(r){r.animation&&this.removeClip(r),this._head?(this._tail.next=r,r.prev=this._tail,r.next=null,this._tail=r):this._head=this._tail=r,r.animation=this},t.prototype.addAnimator=function(r){r.animation=this;var n=r.getClip();n&&this.addClip(n)},t.prototype.removeClip=function(r){if(r.animation){var n=r.prev,a=r.next;n?n.next=a:this._head=a,a?a.prev=n:this._tail=n,r.next=r.prev=r.animation=null}},t.prototype.removeAnimator=function(r){var n=r.getClip();n&&this.removeClip(n),r.animation=null},t.prototype.update=function(r){for(var n=kf()-this._pausedTime,a=n-this._time,i=this._head;i;){var o=i.next,s=i.step(n,a);s&&(i.ondestroy(),this.removeClip(i)),i=o}this._time=n,r||(this.trigger("frame",a),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var r=this;this._running=!0;function n(){r._running&&(k_(n),!r._paused&&r.update())}k_(n)},t.prototype.start=function(){this._running||(this._time=kf(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||(this._pauseStart=kf(),this._paused=!0)},t.prototype.resume=function(){this._paused&&(this._pausedTime+=kf()-this._pauseStart,this._paused=!1)},t.prototype.clear=function(){for(var r=this._head;r;){var n=r.next;r.prev=r.next=r.animation=null,r=n}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(r,n){n=n||{},this.start();var a=new Pk(r,n.loop);return this.addAnimator(a),a},t}(si),bee=300,CS=ot.domSupported,TS=function(){var e=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],t=["touchstart","touchend","touchmove"],r={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},n=oe(e,function(a){var i=a.replace("mouse","pointer");return r.hasOwnProperty(i)?i:a});return{mouse:e,touch:t,pointer:n}}(),fj={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},dj=!1;function pM(e){var t=e.pointerType;return t==="pen"||t==="touch"}function wee(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function MS(e){e&&(e.zrByTouch=!0)}function See(e,t){return Fa(e.dom,new Cee(e,t),!0)}function CG(e,t){for(var r=t,n=!1;r&&r.nodeType!==9&&!(n=r.domBelongToZr||r!==t&&r===e.painterRoot);)r=r.parentNode;return n}var Cee=function(){function e(t,r){this.stopPropagation=ar,this.stopImmediatePropagation=ar,this.preventDefault=ar,this.type=r.type,this.target=this.currentTarget=t.dom,this.pointerType=r.pointerType,this.clientX=r.clientX,this.clientY=r.clientY}return e}(),mi={mousedown:function(e){e=Fa(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger("mousedown",e)},mousemove:function(e){e=Fa(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",e)},mouseup:function(e){e=Fa(this.dom,e),this.__togglePointerCapture(!1),this.trigger("mouseup",e)},mouseout:function(e){e=Fa(this.dom,e);var t=e.toElement||e.relatedTarget;CG(this,t)||(this.__pointerCapturing&&(e.zrEventControl="no_globalout"),this.trigger("mouseout",e))},wheel:function(e){dj=!0,e=Fa(this.dom,e),this.trigger("mousewheel",e)},mousewheel:function(e){dj||(e=Fa(this.dom,e),this.trigger("mousewheel",e))},touchstart:function(e){e=Fa(this.dom,e),MS(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,"start"),mi.mousemove.call(this,e),mi.mousedown.call(this,e)},touchmove:function(e){e=Fa(this.dom,e),MS(e),this.handler.processGesture(e,"change"),mi.mousemove.call(this,e)},touchend:function(e){e=Fa(this.dom,e),MS(e),this.handler.processGesture(e,"end"),mi.mouseup.call(this,e),+new Date-+this.__lastTouchMomentgj||e<-gj}var _u=[],Vh=[],NS=$t(),kS=Math.abs,Bo=function(){function e(){}return e.prototype.getLocalTransform=function(t){return Vl(this,t)},e.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},e.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},e.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},e.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},e.prototype.needLocalTransform=function(){return xu(this.rotation)||xu(this.x)||xu(this.y)||xu(this.scaleX-1)||xu(this.scaleY-1)||xu(this.skewX)||xu(this.skewY)},e.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,r=this.needLocalTransform(),n=this.transform;if(!(r||t)){n&&(pj(n),this.invTransform=null);return}n=n||$t(),r?this.getLocalTransform(n):pj(n),t&&(r?Ca(n,t,n):Bl(n,t)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||$t(),Ma(this.invTransform,n)},e.prototype._resolveGlobalScaleRatio=function(t){var r=this.globalScaleRatio;if(r!=null&&r!==1){this.getGlobalScale(_u);var n=_u[0]<0?-1:1,a=_u[1]<0?-1:1,i=((_u[0]-n)*r+n)/_u[0]||0,o=((_u[1]-a)*r+a)/_u[1]||0;t[0]*=i,t[1]*=i,t[2]*=o,t[3]*=o}},e.prototype.getComputedTransform=function(){for(var t=this,r=[];t;)r.push(t),t=t.parent;for(;t=r.pop();)t.updateTransform();return this.transform},e.prototype.setLocalTransform=function(t){if(t){var r=t[0]*t[0]+t[1]*t[1],n=t[2]*t[2]+t[3]*t[3],a=Math.atan2(t[1],t[0]),i=Math.PI/2+a-Math.atan2(t[3],t[2]);n=Math.sqrt(n)*Math.cos(i),r=Math.sqrt(r),this.skewX=i,this.skewY=0,this.rotation=-a,this.x=+t[4],this.y=+t[5],this.scaleX=r,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,r=this.transform;t&&t.transform&&(t.invTransform=t.invTransform||$t(),Ca(Vh,t.invTransform,r),r=Vh);var n=this.originX,a=this.originY;(n||a)&&(NS[4]=n,NS[5]=a,Ca(Vh,r,NS),Vh[4]-=n,Vh[5]-=a,r=Vh),this.setLocalTransform(r)}},e.prototype.getGlobalScale=function(t){var r=this.transform;return t=t||[],r?(t[0]=Math.sqrt(r[0]*r[0]+r[1]*r[1]),t[1]=Math.sqrt(r[2]*r[2]+r[3]*r[3]),r[0]<0&&(t[0]=-t[0]),r[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},e.prototype.transformCoordToLocal=function(t,r){var n=[t,r],a=this.invTransform;return a&&ir(n,n,a),n},e.prototype.transformCoordToGlobal=function(t,r){var n=[t,r],a=this.transform;return a&&ir(n,n,a),n},e.prototype.getLineScale=function(){var t=this.transform;return t&&kS(t[0]-1)>1e-10&&kS(t[3]-1)>1e-10?Math.sqrt(kS(t[0]*t[3]-t[2]*t[1])):1},e.prototype.copyTransform=function(t){No(this,t)},e.getLocalTransform=function(t,r){r=r||[];var n=t.originX||0,a=t.originY||0,i=t.scaleX,o=t.scaleY,s=t.anchorX,l=t.anchorY,u=t.rotation||0,c=t.x,h=t.y,d=t.skewX?Math.tan(t.skewX):0,v=t.skewY?Math.tan(-t.skewY):0;if(n||a||s||l){var g=n+s,m=a+l;r[4]=-g*i-d*m*o,r[5]=-m*o-v*g*i}else r[4]=r[5]=0;return r[0]=i,r[3]=o,r[1]=v*i,r[2]=d*o,u&&js(r,r,u),r[4]+=n+c,r[5]+=a+h,r},e.initDefaultProps=function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0}(),e}(),Vl=Bo.getLocalTransform;function Uf(){return new Bo}var Ts=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function No(e,t){return $V(e,t,Ts)}function yo(e){Qy||(Qy=new cd(100)),e=e||Ss;var t=Qy.get(e);return t||(t={font:e,strWidthCache:new cd(500),asciiWidthMap:null,asciiWidthMapTried:!1,stWideCharWidth:Vr.measureText("国",e).width,asciiCharWidth:Vr.measureText("a",e).width},Qy.put(e,t)),t}var Qy;function kee(e){if(!(LS>=mj)){e=e||Ss;for(var t=[],r=+new Date,n=0;n<=127;n++)t[n]=Vr.measureText(String.fromCharCode(n),e).width;var a=+new Date-r;return a>16?LS=mj:a>2&&LS++,t}}var LS=0,mj=5;function MG(e,t){return e.asciiWidthMapTried||(e.asciiWidthMap=kee(e.font),e.asciiWidthMapTried=!0),0<=t&&t<=127?e.asciiWidthMap!=null?e.asciiWidthMap[t]:e.asciiCharWidth:e.stWideCharWidth}function xo(e,t){var r=e.strWidthCache,n=r.get(t);return n==null&&(n=Vr.measureText(t,e.font).width,r.put(t,n)),n}function yj(e,t,r,n){var a=xo(yo(t),e),i=km(t),o=hd(0,a,r),s=pc(0,i,n),l=new ke(o,s,a,i);return l}function C1(e,t,r,n){var a=((e||"")+"").split(` -`),i=a.length;if(i===1)return yj(a[0],t,r,n);for(var o=new ke(0,0,0,0),s=0;s=0?parseFloat(e)/100*t:parseFloat(e):e}function R_(e,t,r){var n=t.position||"inside",a=t.distance!=null?t.distance:5,i=r.height,o=r.width,s=i/2,l=r.x,u=r.y,c="left",h="top";if(n instanceof Array)l+=ko(n[0],r.width),u+=ko(n[1],r.height),c=null,h=null;else switch(n){case"left":l-=a,u+=s,c="right",h="middle";break;case"right":l+=a+o,u+=s,h="middle";break;case"top":l+=o/2,u-=a,c="center",h="bottom";break;case"bottom":l+=o/2,u+=i+a,c="center";break;case"inside":l+=o/2,u+=s,c="center",h="middle";break;case"insideLeft":l+=a,u+=s,h="middle";break;case"insideRight":l+=o-a,u+=s,c="right",h="middle";break;case"insideTop":l+=o/2,u+=a,c="center";break;case"insideBottom":l+=o/2,u+=i-a,c="center",h="bottom";break;case"insideTopLeft":l+=a,u+=a;break;case"insideTopRight":l+=o-a,u+=a,c="right";break;case"insideBottomLeft":l+=a,u+=i-a,h="bottom";break;case"insideBottomRight":l+=o-a,u+=i-a,c="right",h="bottom";break}return e=e||{},e.x=l,e.y=u,e.align=c,e.verticalAlign=h,e}var IS="__zr_normal__",PS=Ts.concat(["ignore"]),Lee=ti(Ts,function(e,t){return e[t]=!0,e},{ignore:!1}),Gh={},Iee=new ke(0,0,0,0),e0=[],Dx=0,T1=1,M1=function(){function e(t){this.id=Ck(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return e.prototype._init=function(t){this.attr(t)},e.prototype.drift=function(t,r,n){switch(this.draggable){case"horizontal":r=0;break;case"vertical":t=0;break}var a=this.transform;a||(a=this.transform=[1,0,0,1,0,0]),a[4]+=t,a[5]+=r,this.decomposeTransform(),this.markRedraw()},e.prototype.beforeUpdate=function(){},e.prototype.afterUpdate=function(){},e.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},e.prototype.updateInnerText=function(t){var r=this._textContent;if(r&&(!r.ignore||t)){this.textConfig||(this.textConfig={});var n=this.textConfig,a=n.local,i=r.innerTransformable,o=void 0,s=void 0,l=!1;i.parent=a?this:null;var u=!1;i.copyTransform(r);var c=n.position!=null,h=n.autoOverflowArea,d=void 0;if((h||c)&&(d=Iee,n.layoutRect?d.copy(n.layoutRect):d.copy(this.getBoundingRect()),a||d.applyTransform(this.transform)),c){this.calculateTextPosition?this.calculateTextPosition(Gh,n,d):R_(Gh,n,d),i.x=Gh.x,i.y=Gh.y,o=Gh.align,s=Gh.verticalAlign;var v=n.origin;if(v&&n.rotation!=null){var g=void 0,m=void 0;v==="center"?(g=d.width*.5,m=d.height*.5):(g=ko(v[0],d.width),m=ko(v[1],d.height)),u=!0,i.originX=-i.x+g+(a?0:d.x),i.originY=-i.y+m+(a?0:d.y)}}n.rotation!=null&&(i.rotation=n.rotation);var y=n.offset;y&&(i.x+=y[0],i.y+=y[1],u||(i.originX=-y[0],i.originY=-y[1]));var x=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={});if(h){var _=x.overflowRect=x.overflowRect||new ke(0,0,0,0);i.getLocalTransform(e0),Ma(e0,e0),ke.copy(_,d),_.applyTransform(e0)}else x.overflowRect=null;var w=n.inside==null?typeof n.position=="string"&&n.position.indexOf("inside")>=0:n.inside,S=void 0,C=void 0,M=void 0;w&&this.canBeInsideText()?(S=n.insideFill,C=n.insideStroke,(S==null||S==="auto")&&(S=this.getInsideTextFill()),(C==null||C==="auto")&&(C=this.getInsideTextStroke(S),M=!0)):(S=n.outsideFill,C=n.outsideStroke,(S==null||S==="auto")&&(S=this.getOutsideFill()),(C==null||C==="auto")&&(C=this.getOutsideStroke(S),M=!0)),S=S||"#000",(S!==x.fill||C!==x.stroke||M!==x.autoStroke||o!==x.align||s!==x.verticalAlign)&&(l=!0,x.fill=S,x.stroke=C,x.autoStroke=M,x.align=o,x.verticalAlign=s,r.setDefaultTextStyle(x)),r.__dirty|=Qn,l&&r.dirtyStyle(!0)}},e.prototype.canBeInsideText=function(){return!0},e.prototype.getInsideTextFill=function(){return"#fff"},e.prototype.getInsideTextStroke=function(t){return"#000"},e.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?xM:yM},e.prototype.getOutsideStroke=function(t){var r=this.__zr&&this.__zr.getBackgroundColor(),n=typeof r=="string"&&An(r);n||(n=[255,255,255,1]);for(var a=n[3],i=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*a+(i?0:255)*(1-a);return n[3]=1,qa(n,"rgba")},e.prototype.traverse=function(t,r){},e.prototype.attrKV=function(t,r){t==="textConfig"?this.setTextConfig(r):t==="textContent"?this.setTextContent(r):t==="clipPath"?this.setClipPath(r):t==="extra"?(this.extra=this.extra||{},te(this.extra,r)):this[t]=r},e.prototype.hide=function(){this.ignore=!0,this.markRedraw()},e.prototype.show=function(){this.ignore=!1,this.markRedraw()},e.prototype.attr=function(t,r){if(typeof t=="string")this.attrKV(t,r);else if(Ie(t))for(var n=t,a=at(n),i=0;i0},e.prototype.getState=function(t){return this.states[t]},e.prototype.ensureState=function(t){var r=this.states;return r[t]||(r[t]={}),r[t]},e.prototype.clearStates=function(t){this.useState(IS,!1,t)},e.prototype.useState=function(t,r,n,a){var i=t===IS,o=this.hasState();if(!(!o&&i)){var s=this.currentStates,l=this.stateTransition;if(!(Ve(s,t)>=0&&(r||s.length===1))){var u;if(this.stateProxy&&!i&&(u=this.stateProxy(t)),u||(u=this.states&&this.states[t]),!u&&!i){y1("State "+t+" not exists.");return}i||this.saveCurrentToNormalState(u);var c=this._textContent,h=xj(this,c,u,a);h&&!this.__inHover&&(this.__inHover=h),this._applyStateObj(t,u,this._normalState,r,bj(this,n,l),l);var d=this._textGuide;return c&&c.useState(t,r,n,!!h),d&&d.useState(t,r,n,!!h),i?(this.currentStates=[],this._normalState={}):r?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!h&&this.__inHover&&(this.__inHover=Dx,this.__dirty&=~Qn),u}}},e.prototype.useStates=function(t,r,n){if(!t.length)this.clearStates();else{var a=[],i=this.currentStates,o=t.length,s=o===i.length;if(s){for(var l=0;l=0){var n=this.currentStates.slice();n.splice(r,1),this.useStates(n)}},e.prototype.replaceState=function(t,r,n){var a=this.currentStates.slice(),i=Ve(a,t),o=Ve(a,r)>=0;i>=0?o?a.splice(i,1):a[i]=r:n&&!o&&a.push(r),this.useStates(a)},e.prototype.toggleState=function(t,r){r?this.useState(t,!0):this.removeState(t)},e.prototype._mergeStates=function(t){for(var r={},n,a=0;a=0&&i.splice(o,1)}),this.animators.push(t),n&&n.animation.addAnimator(t),n&&n.wakeUp()},e.prototype.updateDuringAnimation=function(t){this.markRedraw()},e.prototype.stopAnimation=function(t,r){for(var n=this.animators,a=n.length,i=[],o=0;o0&&r.during&&i[0].during(function(g,m){r.during(m)});for(var d=0;d0||a.force&&!o.length){var I=void 0,k=void 0,P=void 0;if(s){k={},d&&(I={});for(var S=0;S0}var Ne=function(e){X(t,e);function t(r){var n=e.call(this)||this;return n.isGroup=!0,n._children=[],n.attr(r),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.children=function(){return this._children.slice()},t.prototype.childAt=function(r){return this._children[r]},t.prototype.childOfName=function(r){for(var n=this._children,a=0;a=0&&(a.splice(i,0,r),this._doAdd(r))}return this},t.prototype.replace=function(r,n){var a=Ve(this._children,r);return a>=0&&this.replaceAt(n,a),this},t.prototype.replaceAt=function(r,n){var a=this._children,i=a[n];if(r&&r!==this&&r.parent!==this&&r!==i){a[n]=r,i.parent=null;var o=this.__zr;o&&i.removeSelfFromZr(o),this._doAdd(r)}return this},t.prototype._doAdd=function(r){r.parent&&r.parent.remove(r),r.parent=this;var n=this.__zr;n&&n!==r.__zr&&r.addSelfToZr(n),n&&n.refresh()},t.prototype.remove=function(r){var n=this.__zr,a=this._children,i=Ve(a,r);return i<0?this:(a.splice(i,1),r.parent=null,n&&r.removeSelfFromZr(n),n&&n.refresh(),this)},t.prototype.removeAll=function(){for(var r=this._children,n=this.__zr,a=0;a0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(t){this._disposed||(t=t||{},this.painter.resize(t.width,t.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},e.prototype.findHover=function(t,r){if(!this._disposed)return this.handler.findHover(t,r)},e.prototype.on=function(t,r,n){return this._disposed||this.handler.on(t,r,n),this},e.prototype.off=function(t,r){this._disposed||this.handler.off(t,r)},e.prototype.trigger=function(t,r){this._disposed||this.handler.trigger(t,r)},e.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),r=0;r0){if(e<=a)return o;if(e>=i)return s}else{if(e>=a)return o;if(e<=i)return s}else{if(e===a)return o;if(e===i)return s}return(e-a)/l*u+o}var fe=$ee;function $ee(e,t,r){switch(e){case"center":case"middle":e="50%";break;case"left":case"top":e="0%";break;case"right":case"bottom":e="100%";break}return B_(e,t,r)}function B_(e,t,r){return ue(e)?IG(e)?parseFloat(e)/100*t+(r||0):parseFloat(e):e==null?NaN:+e}function Yee(e){return ue(e)&&IG(e)}function IG(e){return!!Wee(e).match(/%$/)}function gt(e,t,r){return isNaN(t)?r?""+e:+e:(t=Mt(qe(0,t),O_),e=(+e).toFixed(t),r?e:+e)}function Xee(e,t,r){return t==null&&(t=10),gt(e,t,r)}function qr(e){return e.sort(function(t,r){return t-r}),e}function so(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,r=0;r<15;r++,t*=10)if(Lo(e*t)/t===e)return r}return PG(e)}function PG(e){var t=e.toString().toLowerCase(),r=t.indexOf("e"),n=r>0?+t.slice(r+1):0,a=r>0?r:t.length,i=t.indexOf("."),o=i<0?0:a-1-i;return qe(0,o-n)}function qee(e,t){var r=ri(Ic(e[1]-e[0])/jg),n=Lo(Ic(nr(t[1]-t[0]))/jg),a=Mt(qe(-r+n,0),O_);return isFinite(a)?a:O_}function Dk(e,t,r){var n=nr(e[1]-e[0]);if(!isFinite(n)||n===0)return NaN;var a=Ic(2*nr(r||1)*nr(n))/jg,i=Ic(nr(t))/jg,o=qe(0,lh(-a+i));return isFinite(o)||(o=NaN),o}function Kee(e,t,r){if(!e[t])return 0;var n=DG(e,r);return n[t]||0}function DG(e,t){var r=ti(e,function(v,g){return v+(isNaN(g)?0:g)},0);if(r===0)return[];for(var n=uh(10,t),a=oe(e,function(v){return(isNaN(v)?0:v)/r*n*100}),i=n*100,o=oe(a,function(v){return ri(v)}),s=ti(o,function(v,g){return v+g},0),l=oe(a,function(v,g){return v-o[g]});su&&(u=l[h],c=h);++o[c],l[c]=0,++s}return oe(o,function(v){return v/n})}function Zu(e,t){var r=qe(so(e),so(t)),n=e+t;return r>O_?n:gt(n,r)}var Rg=uh(2,53)-1;function Ek(e){var t=z_*2;return(e%t+t)%t}function Pc(e){return e>-wj&&e=10&&t++,t}var EG=2;function N1(e,t){var r=A1(e),n=uh(10,r),a=e/n,i;return t===EG?i=1:t?a<1.5?i=1:a<2.5?i=2:a<4?i=3:a<7?i=5:i=10:a<1?i=1:a<2?i=2:a<3?i=3:a<5?i=5:i=10,e=i*n,gt(e,-r)}function jx(e,t){var r=(e.length-1)*t+1,n=ri(r),a=+e[n-1],i=r-n;return i?a+i*(e[n]-a):a}function wM(e){e.sort(function(l,u){return s(l,u,0)?-1:1});for(var t=-1/0,r=1,n=0;n0?t.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)?(this.item=this._list[this._idx],this.key=this._idx=this._idx+this._step,!0):!1},e}();function jS(e){e.option=e.parentModel=e.ecModel=null}function sn(){return[1/0,-1/0]}function CM(e,t){Ms(t)&&(te[1]&&(e[1]=t))}function HG(e,t){Ms(t)&&te[1]&&(e[1]=t)}function mte(e,t){jc(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function Ms(e){return e!=null&&isFinite(e)}function jc(e,t){return Ms(e)&&Ms(t)&&e<=t}function yte(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function Rx(e){jc(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function Fd(){var e="__ec_once_"+xte++;return function(t,r){ge(t,e)||(t[e]=1,r())}}var xte=Ok();function k1(e,t,r){var n=pe(),a=0;j(e,function(i){var o=t(i),s=n.get(o)||0;r&&r(i,s),!s&&!r&&(e[a++]=i),n.set(o,s+1)}),r||(e.length=a)}function _te(e){return e.value+""}function bte(e){return e+""}function _o(e,t){return _e(t,!0)?e.seriesIndex+2:0}function WG(e,t,r){var n=e.getData().count();return{progressiveRender:r.progressiveEnabled&&t.incrementalPrepareRender&&n>=r.threshold,large:e.get("large")&&n>=e.get("largeThreshold"),modDataCount:e.get("progressiveChunkMode")==="mod"?e.getData().count():null}}function Er(e,t){return{seriesType:e,overallReset:t}}function Lm(e){return{overallReset:e}}var wte=".",bu="___EC__COMPONENT__CONTAINER___",ZG="___EC__EXTENDED_CLASS___";function lo(e){var t={main:"",sub:""};if(e){var r=e.split(wte);t.main=r[0]||"",t.sub=r[1]||""}return t}function Ste(e){fn(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),'componentType "'+e+'" illegal')}function Cte(e){return!!(e&&e[ZG])}function Vk(e,t){e.$constructor=e,e.extend=function(r){var n=this,a;return Tte(n)?a=function(i){X(o,i);function o(){return i.apply(this,arguments)||this}return o}(n):(a=function(){(r.$constructor||n).apply(this,arguments)},Tk(a,this)),te(a.prototype,r),a[ZG]=!0,a.extend=this.extend,a.superCall=Nte,a.superApply=kte,a.superClass=n,a}}function Tte(e){return Me(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function $G(e,t){e.extend=t.extend}var Mte=Math.round(Math.random()*10);function Ate(e){var t=["__\0is_clz",Mte++].join("_");e.prototype[t]=!0,e.isInstance=function(r){return!!(r&&r[t])}}function Nte(e,t){for(var r=[],n=2;n=0||i&&Ve(i,l)<0)){var u=n.getShallow(l,t);u!=null&&(o[e[s][0]]=u)}}return o}}var Lte=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],Ite=Rc(Lte),Pte=function(){function e(){}return e.prototype.getAreaStyle=function(t,r){return Ite(this,t,r)},e}(),TM=new cd(50);function Dte(e){if(typeof e=="string"){var t=TM.get(e);return t&&t.image}else return e}function Gk(e,t,r,n,a){if(e)if(typeof e=="string"){if(t&&t.__zrImageSrc===e||!r)return t;var i=TM.get(e),o={hostEl:r,cb:n,cbPayload:a};return i?(t=i.image,!I1(t)&&i.pending.push(o)):(t=Vr.loadImage(e,Mj,Mj),t.__zrImageSrc=e,TM.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}else return e;else return t}function Mj(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t=s;u++)l-=s;var c=xo(o,r);return c>l&&(r="",c=0),l=e-c,a.ellipsis=r,a.ellipsisWidth=c,a.contentWidth=l,a.containerWidth=e,a}function qG(e,t,r){var n=r.containerWidth,a=r.contentWidth,i=r.fontMeasureInfo;if(!n){e.textLine="",e.isTruncated=!1;return}var o=xo(i,t);if(o<=n){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=a||s>=r.maxIterations){t+=r.ellipsis;break}var l=s===0?jte(t,a,i):o>0?Math.floor(t.length*a/o):0;t=t.substr(0,l),o=xo(i,t)}t===""&&(t=r.placeholder),e.textLine=t,e.isTruncated=!0}function jte(e,t,r){for(var n=0,a=0,i=e.length;ay&&v){var w=Math.floor(y/d);g=g||x.length>w,x=x.slice(0,w),_=x.length*d}if(a&&c&&m!=null)for(var S=XG(m,u,t.ellipsis,{minChar:t.truncateMinChar,placeholder:t.placeholder}),C={},M=0;Mg&&OS(i,o.substring(g,y),t,v),OS(i,m[2],t,v,m[1]),g=RS.lastIndex}gh){var Z=i.lines.length;z>0?(k.tokens=k.tokens.slice(0,z),A(k,D,P),i.lines=i.lines.slice(0,I+1)):i.lines=i.lines.slice(0,I),i.isTruncated=i.isTruncated||i.lines.length0&&g+n.accumWidth>n.width&&(c=t.split(` -`),u=!0),n.accumWidth=g}else{var m=KG(t,l,n.width,n.breakAll,n.accumWidth);n.accumWidth=m.accumWidth+v,h=m.linesWidths,c=m.lines}}c||(c=t.split(` -`));for(var y=yo(l),x=0;x=32&&t<=591||t>=880&&t<=4351||t>=4608&&t<=5119||t>=7680&&t<=8303}var Vte=ti(",&?/;] ".split(""),function(e,t){return e[t]=!0,e},{});function Gte(e){return Fte(e)?!!Vte[e]:!0}function KG(e,t,r,n,a){for(var i=[],o=[],s="",l="",u=0,c=0,h=yo(t),d=0;dr:a+c+g>r){c?(s||l)&&(m?(s||(s=l,l="",u=0,c=u),i.push(s),o.push(c-u),l+=v,u+=g,s="",c=u):(l&&(s+=l,l="",u=0),i.push(s),o.push(c),s=v,c=g)):m?(i.push(l),o.push(u),l=v,u=g):(i.push(v),o.push(g));continue}c+=g,m?(l+=v,u+=g):(l&&(s+=l,l="",u=0),s+=v)}return l&&(s+=l),s&&(i.push(s),o.push(c)),i.length===1&&(c+=a),{accumWidth:c,lines:i,linesWidths:o}}function Nj(e,t,r,n,a,i){if(e.baseX=r,e.baseY=n,e.outerWidth=e.outerHeight=null,!!t){var o=t.width*2,s=t.height*2;ke.set(kj,hd(r,o,a),pc(n,s,i),o,s),ke.intersect(t,kj,null,Lj);var l=Lj.outIntersectRect;e.outerWidth=l.width,e.outerHeight=l.height,e.baseX=hd(l.x,l.width,a,!0),e.baseY=pc(l.y,l.height,i,!0)}}var kj=new ke(0,0,0,0),Lj={outIntersectRect:{},clamp:!0};function Hk(e){return e!=null?e+="":e=""}function Hte(e){var t=Hk(e.text),r=e.font,n=xo(yo(r),t),a=km(r);return MM(e,n,a,null)}function MM(e,t,r,n){var a=new ke(hd(e.x||0,t,e.textAlign),pc(e.y||0,r,e.textBaseline),t,r),i=n??(JG(e)?e.lineWidth:0);return i>0&&(a.x-=i/2,a.y-=i/2,a.width+=i,a.height+=i),a}function JG(e){var t=e.stroke;return t!=null&&t!=="none"&&e.lineWidth>0}var AM="__zr_style_"+Math.round(Math.random()*10),gc={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},P1={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};gc[AM]=!0;var Ij=["z","z2","invisible"],Ute=["invisible"],ai=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype._init=function(r){for(var n=at(r),a=0;a1e-4){s[0]=e-r,s[1]=t-n,l[0]=e+r,l[1]=t+n;return}if(t0[0]=VS(a)*r+e,t0[1]=FS(a)*n+t,r0[0]=VS(i)*r+e,r0[1]=FS(i)*n+t,u(s,t0,r0),c(l,t0,r0),a=a%wu,a<0&&(a=a+wu),i=i%wu,i<0&&(i=i+wu),a>i&&!o?i+=wu:aa&&(n0[0]=VS(v)*r+e,n0[1]=FS(v)*n+t,u(s,n0,s),c(l,n0,l))}var zt={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Su=[],Cu=[],$i=[],Ws=[],Yi=[],Xi=[],GS=Math.min,HS=Math.max,Tu=Math.cos,Mu=Math.sin,Yo=Math.abs,NM=Math.PI,el=NM*2,US=typeof Float32Array<"u",Bv=[];function WS(e){var t=Math.round(e/NM*1e8)/1e8;return t%2*NM}function E1(e,t){var r=WS(e[0]);r<0&&(r+=el);var n=r-e[0],a=e[1];a+=n,!t&&a-r>=el?a=r+el:t&&r-a>=el?a=r-el:!t&&r>a?a=r+(el-WS(r-a)):t&&r0&&(this._ux=Yo(n/j_/t)||0,this._uy=Yo(n/j_/r)||0)},e.prototype.setDPR=function(t){this.dpr=t},e.prototype.setContext=function(t){this._ctx=t},e.prototype.getContext=function(){return this._ctx},e.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},e.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},e.prototype.moveTo=function(t,r){return this._drawPendingPt(),this.addData(zt.M,t,r),this._ctx&&this._ctx.moveTo(t,r),this._x0=t,this._y0=r,this._xi=t,this._yi=r,this},e.prototype.lineTo=function(t,r){var n=Yo(t-this._xi),a=Yo(r-this._yi),i=n>this._ux||a>this._uy;if(this.addData(zt.L,t,r),this._ctx&&i&&this._ctx.lineTo(t,r),i)this._xi=t,this._yi=r,this._pendingPtDist=0;else{var o=n*n+a*a;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=r,this._pendingPtDist=o)}return this},e.prototype.bezierCurveTo=function(t,r,n,a,i,o){return this._drawPendingPt(),this.addData(zt.C,t,r,n,a,i,o),this._ctx&&this._ctx.bezierCurveTo(t,r,n,a,i,o),this._xi=i,this._yi=o,this},e.prototype.quadraticCurveTo=function(t,r,n,a){return this._drawPendingPt(),this.addData(zt.Q,t,r,n,a),this._ctx&&this._ctx.quadraticCurveTo(t,r,n,a),this._xi=n,this._yi=a,this},e.prototype.arc=function(t,r,n,a,i,o){this._drawPendingPt(),Bv[0]=a,Bv[1]=i,E1(Bv,o),a=Bv[0],i=Bv[1];var s=i-a;return this.addData(zt.A,t,r,n,n,a,s,0,o?0:1),this._ctx&&this._ctx.arc(t,r,n,a,i,o),this._xi=Tu(i)*n+t,this._yi=Mu(i)*n+r,this},e.prototype.arcTo=function(t,r,n,a,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(t,r,n,a,i),this},e.prototype.rect=function(t,r,n,a){return this._drawPendingPt(),this._ctx&&this._ctx.rect(t,r,n,a),this.addData(zt.R,t,r,n,a),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(zt.Z);var t=this._ctx,r=this._x0,n=this._y0;return t&&t.closePath(),this._xi=r,this._yi=n,this},e.prototype.fill=function(t){t&&t.fill(),this.toStatic()},e.prototype.stroke=function(t){t&&t.stroke(),this.toStatic()},e.prototype.len=function(){return this._len},e.prototype.setData=function(t){if(this._saveData){var r=t.length;!(this.data&&this.data.length===r)&&US&&(this.data=new Float32Array(r));for(var n=0;n0&&o))for(var s=0;sc.length&&(this._expandData(),c=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},e.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],r=0;r11&&(this.data=new Float32Array(t)))}},e.prototype.getBoundingRect=function(){$i[0]=$i[1]=Yi[0]=Yi[1]=Number.MAX_VALUE,Ws[0]=Ws[1]=Xi[0]=Xi[1]=-Number.MAX_VALUE;var t=this.data,r=0,n=0,a=0,i=0,o;for(o=0;on||Yo(w)>a||d===r-1)&&(m=Math.sqrt(_*_+w*w),i=y,o=x);break}case zt.C:{var S=t[d++],C=t[d++],y=t[d++],x=t[d++],M=t[d++],A=t[d++];m=XQ(i,o,S,C,y,x,M,A,10),i=M,o=A;break}case zt.Q:{var S=t[d++],C=t[d++],y=t[d++],x=t[d++];m=KQ(i,o,S,C,y,x,10),i=y,o=x;break}case zt.A:var I=t[d++],k=t[d++],P=t[d++],D=t[d++],z=t[d++],E=t[d++],B=E+z;d+=1,g&&(s=Tu(z)*P+I,l=Mu(z)*D+k),m=HS(P,D)*GS(el,Math.abs(E)),i=Tu(B)*P+I,o=Mu(B)*D+k;break;case zt.R:{s=i=t[d++],l=o=t[d++];var H=t[d++],V=t[d++];m=H*2+V*2;break}case zt.Z:{var _=s-i,w=l-o;m=Math.sqrt(_*_+w*w),i=s,o=l;break}}m>=0&&(u[h++]=m,c+=m)}return this._pathLen=c,c},e.prototype.rebuildPath=function(t,r){var n=this.data,a=this._ux,i=this._uy,o=this._len,s,l,u,c,h,d,v=r<1,g,m,y=0,x=0,_,w=0,S,C;if(!(v&&(this._pathSegLen||this._calculateLength(),g=this._pathSegLen,m=this._pathLen,_=r*m,!_)))e:for(var M=0;M0&&(t.lineTo(S,C),w=0),A){case zt.M:s=u=n[M++],l=c=n[M++],t.moveTo(u,c);break;case zt.L:{h=n[M++],d=n[M++];var k=Yo(h-u),P=Yo(d-c);if(k>a||P>i){if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;t.lineTo(u*(1-z)+h*z,c*(1-z)+d*z);break e}y+=D}t.lineTo(h,d),u=h,c=d,w=0}else{var E=k*k+P*P;E>w&&(S=h,C=d,w=E)}break}case zt.C:{var B=n[M++],H=n[M++],V=n[M++],U=n[M++],F=n[M++],Z=n[M++];if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;Fl(u,B,V,F,z,Su),Fl(c,H,U,Z,z,Cu),t.bezierCurveTo(Su[1],Cu[1],Su[2],Cu[2],Su[3],Cu[3]);break e}y+=D}t.bezierCurveTo(B,H,V,U,F,Z),u=F,c=Z;break}case zt.Q:{var B=n[M++],H=n[M++],V=n[M++],U=n[M++];if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;Lg(u,B,V,z,Su),Lg(c,H,U,z,Cu),t.quadraticCurveTo(Su[1],Cu[1],Su[2],Cu[2]);break e}y+=D}t.quadraticCurveTo(B,H,V,U),u=V,c=U;break}case zt.A:var $=n[M++],W=n[M++],q=n[M++],re=n[M++],Q=n[M++],se=n[M++],ce=n[M++],Ue=!n[M++],ye=q>re?q:re,me=Yo(q-re)>.001,Oe=Q+se,be=!1;if(v){var D=g[x++];y+D>_&&(Oe=Q+se*(_-y)/D,be=!0),y+=D}if(me&&t.ellipse?t.ellipse($,W,q,re,ce,Q,Oe,Ue):t.arc($,W,ye,Q,Oe,Ue),be)break e;I&&(s=Tu(Q)*q+$,l=Mu(Q)*re+W),u=Tu(Oe)*q+$,c=Mu(Oe)*re+W;break;case zt.R:s=u=n[M],l=c=n[M+1],h=n[M++],d=n[M++];var we=n[M++],yt=n[M++];if(v){var D=g[x++];if(y+D>_){var nt=_-y;t.moveTo(h,d),t.lineTo(h+GS(nt,we),d),nt-=we,nt>0&&t.lineTo(h+we,d+GS(nt,yt)),nt-=yt,nt>0&&t.lineTo(h+HS(we-nt,0),d+yt),nt-=we,nt>0&&t.lineTo(h,d+HS(yt-nt,0));break e}y+=D}t.rect(h,d,we,yt);break;case zt.Z:if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;t.lineTo(u*(1-z)+s*z,c*(1-z)+l*z);break e}y+=D}t.closePath(),u=s,c=l}}},e.prototype.clone=function(){var t=new e,r=this.data;return t.data=r.slice?r.slice():Array.prototype.slice.call(r),t._len=this._len,t},e.prototype.canSave=function(){return!!this._saveData},e.CMD=zt,e.initDefaultProps=function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0}(),e}();function al(e,t,r,n,a,i,o){if(a===0)return!1;var s=a,l=0,u=e;if(o>t+s&&o>n+s||oe+s&&i>r+s||it+h&&c>n+h&&c>i+h&&c>s+h||ce+h&&u>r+h&&u>a+h&&u>o+h||ut+u&&l>n+u&&l>i+u||le+u&&s>r+u&&s>a+u||sr||c+ua&&(a+=Fv);var d=Math.atan2(l,s);return d<0&&(d+=Fv),d>=n&&d<=a||d+Fv>=n&&d+Fv<=a}function ts(e,t,r,n,a,i){if(i>t&&i>n||ia?s:0}var Zs=Po.CMD,Au=Math.PI*2,Kte=1e-4;function Jte(e,t){return Math.abs(e-t)t&&u>n&&u>i&&u>s||u1&&Qte(),v=zr(t,n,i,s,Ga[0]),d>1&&(g=zr(t,n,i,s,Ga[1]))),d===2?yt&&s>n&&s>i||s=0&&u<=1){for(var c=0,h=Xr(t,n,i,u),d=0;dr||s<-r)return 0;var l=Math.sqrt(r*r-s*s);Rn[0]=-l,Rn[1]=l;var u=Math.abs(n-a);if(u<1e-4)return 0;if(u>=Au-1e-4){n=0,a=Au;var c=i?1:-1;return o>=Rn[0]+e&&o<=Rn[1]+e?c:0}if(n>a){var h=n;n=a,a=h}n<0&&(n+=Au,a+=Au);for(var d=0,v=0;v<2;v++){var g=Rn[v];if(g+e>o){var m=Math.atan2(s,g),c=i?1:-1;m<0&&(m=Au+m),(m>=n&&m<=a||m+Au>=n&&m+Au<=a)&&(m>Math.PI/2&&m1&&(r||(s+=ts(l,u,c,h,n,a))),y&&(l=i[g],u=i[g+1],c=l,h=u),m){case Zs.M:c=i[g++],h=i[g++],l=c,u=h;break;case Zs.L:if(r){if(al(l,u,i[g],i[g+1],t,n,a))return!0}else s+=ts(l,u,i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case Zs.C:if(r){if(Xte(l,u,i[g++],i[g++],i[g++],i[g++],i[g],i[g+1],t,n,a))return!0}else s+=ere(l,u,i[g++],i[g++],i[g++],i[g++],i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case Zs.Q:if(r){if(QG(l,u,i[g++],i[g++],i[g],i[g+1],t,n,a))return!0}else s+=tre(l,u,i[g++],i[g++],i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case Zs.A:var x=i[g++],_=i[g++],w=i[g++],S=i[g++],C=i[g++],M=i[g++];g+=1;var A=!!(1-i[g++]);d=Math.cos(C)*w+x,v=Math.sin(C)*S+_,y?(c=d,h=v):s+=ts(l,u,d,v,n,a);var I=(n-x)*S/w+x;if(r){if(qte(x,_,S,C,C+M,A,t,I,a))return!0}else s+=rre(x,_,S,C,C+M,A,I,a);l=Math.cos(C+M)*w+x,u=Math.sin(C+M)*S+_;break;case Zs.R:c=l=i[g++],h=u=i[g++];var k=i[g++],P=i[g++];if(d=c+k,v=h+P,r){if(al(c,h,d,h,t,n,a)||al(d,h,d,v,t,n,a)||al(d,v,c,v,t,n,a)||al(c,v,c,h,t,n,a))return!0}else s+=ts(d,h,d,v,n,a),s+=ts(c,v,c,h,n,a);break;case Zs.Z:if(r){if(al(l,u,c,h,t,n,a))return!0}else s+=ts(l,u,c,h,n,a);l=c,u=h;break}}return!r&&!Jte(u,h)&&(s+=ts(l,u,c,h,n,a)||0),s!==0}function nre(e,t,r){return eH(e,0,!1,t,r)}function are(e,t,r,n){return eH(e,t,!0,r,n)}var F_=Le({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},gc),ire={style:Le({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},P1.style)},ZS=Ts.concat(["invisible","culling","z","z2","zlevel","parent"]),rt=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.update=function(){var r=this;e.prototype.update.call(this);var n=this.style;if(n.decal){var a=this._decalEl=this._decalEl||new t;a.buildPath===t.prototype.buildPath&&(a.buildPath=function(l){r.buildPath(l,r.shape)}),a.silent=!0;var i=a.style;for(var o in n)i[o]!==n[o]&&(i[o]=n[o]);i.fill=n.fill?n.decal:null,i.decal=null,i.shadowColor=null,n.strokeFirst&&(i.stroke=null);for(var s=0;s.5?yM:n>.2?Nee:xM}else if(r)return xM}return yM},t.prototype.getInsideTextStroke=function(r){var n=this.style.fill;if(ue(n)){var a=this.__zr,i=!!(a&&a.isDarkMode()),o=Dg(r,0)0))},t.prototype.hasFill=function(){var r=this.style,n=r.fill;return n!=null&&n!=="none"},t.prototype.getBoundingRect=function(){var r=this._rect,n=this.style,a=!r;if(a){var i=!1;this.path||(i=!0,this.createPathProxy());var o=this.path;(i||this.__dirty&ff)&&(o.beginPath(),this.buildPath(o,this.shape,!1),this.pathUpdated()),r=o.getBoundingRect()}if(this._rect=r,this.hasStroke()&&this.path&&this.path.len()>0){var s=this._rectStroke||(this._rectStroke=r.clone());if(this.__dirty||a){s.copy(r);var l=n.strokeNoScale?this.getLineScale():1,u=n.lineWidth;if(!this.hasFill()){var c=this.strokeContainThreshold;u=Math.max(u,c??4)}l>1e-10&&(s.width+=u/l,s.height+=u/l,s.x-=u/l/2,s.y-=u/l/2)}return s}return r},t.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect(),o=this.style;if(r=a[0],n=a[1],i.contain(r,n)){var s=this.path;if(this.hasStroke()){var l=o.lineWidth,u=o.strokeNoScale?this.getLineScale():1;if(u>1e-10&&(this.hasFill()||(l=Math.max(l,this.strokeContainThreshold)),are(s,l/u,r,n)))return!0}if(this.hasFill())return nre(s,r,n)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=ff,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},t.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},t.prototype.animateShape=function(r){return this.animate("shape",r)},t.prototype.updateDuringAnimation=function(r){r==="style"?this.dirtyStyle():r==="shape"?this.dirtyShape():this.markRedraw()},t.prototype.attrKV=function(r,n){r==="shape"?this.setShape(n):e.prototype.attrKV.call(this,r,n)},t.prototype.setShape=function(r,n){var a=this.shape;return a||(a=this.shape={}),typeof r=="string"?a[r]=n:te(a,r),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(this.__dirty&ff)},t.prototype.createStyle=function(r){return Nm(F_,r)},t.prototype._innerSaveToNormal=function(r){e.prototype._innerSaveToNormal.call(this,r);var n=this._normalState;r.shape&&!n.shape&&(n.shape=te({},this.shape))},t.prototype._applyStateObj=function(r,n,a,i,o,s){if(e.prototype._applyStateObj.call(this,r,n,a,i,o,s),this.__inHover!==T1){var l=!(n&&i),u;if(n&&n.shape?o?i?u=n.shape:(u=te({},a.shape),te(u,n.shape)):(u=te({},i?this.shape:a.shape),te(u,n.shape)):l&&(u=a.shape),u)if(o){this.shape=te({},this.shape);for(var c={},h=at(u),d=0;da&&(h=s+l,s*=a/h,l*=a/h),u+c>a&&(h=u+c,u*=a/h,c*=a/h),l+u>i&&(h=l+u,l*=i/h,u*=i/h),s+c>i&&(h=s+c,s*=i/h,c*=i/h),e.moveTo(r+s,n),e.lineTo(r+a-l,n),l!==0&&e.arc(r+a-l,n+l,l,-Math.PI/2,0),e.lineTo(r+a,n+i-u),u!==0&&e.arc(r+a-u,n+i-u,u,0,Math.PI/2),e.lineTo(r+c,n+i),c!==0&&e.arc(r+c,n+i-c,c,Math.PI/2,Math.PI),e.lineTo(r,n+s),s!==0&&e.arc(r+s,n+s,s,Math.PI,Math.PI*1.5),e.closePath()}var Lf=Math.round;function j1(e,t,r){if(t){var n=t.x1,a=t.x2,i=t.y1,o=t.y2;e.x1=n,e.x2=a,e.y1=i,e.y2=o;var s=r&&r.lineWidth;return s&&(Lf(n*2)===Lf(a*2)&&(e.x1=e.x2=wa(n,s,!0)),Lf(i*2)===Lf(o*2)&&(e.y1=e.y2=wa(i,s,!0))),e}}function tH(e,t,r){if(t){var n=t.x,a=t.y,i=t.width,o=t.height;e.x=n,e.y=a,e.width=i,e.height=o;var s=r&&r.lineWidth;return s&&(e.x=wa(n,s,!0),e.y=wa(a,s,!0),e.width=Math.max(wa(n+i,s,!1)-e.x,i===0?0:1),e.height=Math.max(wa(a+o,s,!1)-e.y,o===0?0:1)),e}}function wa(e,t,r){if(!t)return e;var n=Lf(e*2);return(n+Lf(t))%2===0?n/2:(n+(r?1:-1))/2}var hre=function(){function e(){this.x=0,this.y=0,this.width=0,this.height=0}return e}(),fre={},Ke=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new hre},t.prototype.buildPath=function(r,n){var a,i,o,s;if(this.subPixelOptimize){var l=tH(fre,n,this.style);a=l.x,i=l.y,o=l.width,s=l.height,l.r=n.r,n=l}else a=n.x,i=n.y,o=n.width,s=n.height;n.r?cre(r,n):r.rect(a,i,o,s)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(rt);Ke.prototype.type="rect";var Rj={fill:"#000"},Oj=2,qi={},dre={style:Le({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},P1.style)},ht=function(e){X(t,e);function t(r){var n=e.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=Rj,n.attr(r),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.update=function(){e.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var r=0;r0,z=0;z=0&&(B=M[E],B.align==="right");)this._placeToken(B,r,I,x,z,"right",w),k-=B.width,z-=B.width,E--;for(D+=(c-(D-y)-(_-z)-k)/2;P<=E;)B=M[P],this._placeToken(B,r,I,x,D+B.width/2,"center",w),D+=B.width,P++;x+=I}},t.prototype._placeToken=function(r,n,a,i,o,s,l){var u=n.rich[r.styleName]||{};u.text=r.text;var c=r.verticalAlign,h=i+a/2;c==="top"?h=i+r.height/2:c==="bottom"&&(h=i+a-r.height/2);var d=!r.isLineHolder&&$S(u);d&&this._renderBackground(u,n,s==="right"?o-r.width:s==="center"?o-r.width/2:o,h-r.height/2,r.width,r.height);var v=!!u.backgroundColor,g=r.textPadding;g&&(o=Hj(o,s,g),h-=r.height/2-g[0]-r.innerHeight/2);var m=this._getOrCreateChild(fd),y=m.createStyle();m.useStyle(y);var x=this._defaultStyle,_=!1,w=0,S=!1,C=Gj("fill"in u?u.fill:"fill"in n?n.fill:(_=!0,x.fill)),M=Vj("stroke"in u?u.stroke:"stroke"in n?n.stroke:!v&&!l&&(!x.autoStroke||_)?(w=Oj,S=!0,x.stroke):null),A=u.textShadowBlur>0||n.textShadowBlur>0;y.text=r.text,y.x=o,y.y=h,A&&(y.shadowBlur=u.textShadowBlur||n.textShadowBlur||0,y.shadowColor=u.textShadowColor||n.textShadowColor||"transparent",y.shadowOffsetX=u.textShadowOffsetX||n.textShadowOffsetX||0,y.shadowOffsetY=u.textShadowOffsetY||n.textShadowOffsetY||0),y.textAlign=s,y.textBaseline="middle",y.font=r.font||Ss,y.opacity=ia(u.opacity,n.opacity,1),Bj(y,u),M&&(y.lineWidth=ia(u.lineWidth,n.lineWidth,w),y.lineDash=_e(u.lineDash,n.lineDash),y.lineDashOffset=n.lineDashOffset||0,y.stroke=M),C&&(y.fill=C),m.setBoundingRect(MM(y,r.contentWidth,r.contentHeight,S?0:null))},t.prototype._renderBackground=function(r,n,a,i,o,s){var l=r.backgroundColor,u=r.borderWidth,c=r.borderColor,h=l&&l.image,d=l&&!h,v=r.borderRadius,g=this,m,y;if(d||r.lineHeight||u&&c){m=this._getOrCreateChild(Ke),m.useStyle(m.createStyle()),m.style.fill=null;var x=m.shape;x.x=a,x.y=i,x.width=o,x.height=s,x.r=v,m.dirtyShape()}if(d){var _=m.style;_.fill=l||null,_.fillOpacity=_e(r.fillOpacity,1)}else if(h){y=this._getOrCreateChild(Ur),y.onload=function(){g.dirtyStyle()};var w=y.style;w.image=l.image,w.x=a,w.y=i,w.width=o,w.height=s}if(u&&c){var _=m.style;_.lineWidth=u,_.stroke=c,_.strokeOpacity=_e(r.strokeOpacity,1),_.lineDash=r.borderDash,_.lineDashOffset=r.borderDashOffset||0,m.strokeContainThreshold=0,m.hasFill()&&m.hasStroke()&&(_.strokeFirst=!0,_.lineWidth*=2)}var S=(m||y).style;S.shadowBlur=r.shadowBlur||0,S.shadowColor=r.shadowColor||"transparent",S.shadowOffsetX=r.shadowOffsetX||0,S.shadowOffsetY=r.shadowOffsetY||0,S.opacity=ia(r.opacity,n.opacity,1)},t.makeFont=function(r){var n="";return nH(r)&&(n=[r.fontStyle,r.fontWeight,rH(r.fontSize),r.fontFamily||"sans-serif"].join(" ")),n&&_a(n)||r.textFont||r.font},t}(ai),vre={left:!0,right:1,center:1},pre={top:1,bottom:1,middle:1},zj=["fontStyle","fontWeight","fontSize","fontFamily"];function rH(e){return typeof e=="string"&&(e.indexOf("px")!==-1||e.indexOf("rem")!==-1||e.indexOf("em")!==-1)?e:isNaN(+e)?bk+"px":e+"px"}function Bj(e,t){for(var r=0;r=0,i=!1;if(e instanceof rt){var o=uH(e),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(Hh(s)||Hh(l)){n=n||{};var u=n.style||{};u.fill==="inherit"?(i=!0,n=te({},n),u=te({},u),u.fill=s):!Hh(u.fill)&&Hh(s)?(i=!0,n=te({},n),u=te({},u),u.fill=D_(s)):!Hh(u.stroke)&&Hh(l)&&(i||(n=te({},n),u=te({},u)),u.stroke=D_(l)),n.style=u}}if(n&&n.z2==null){i||(n=te({},n));var c=e.z2EmphasisLift;n.z2=e.z2+(c??Gd)}return n}function Sre(e,t,r){if(r&&r.z2==null){r=te({},r);var n=e.z2SelectLift;r.z2=e.z2+(n??yre)}return r}function Cre(e,t,r){var n=Ve(e.currentStates,t)>=0,a=e.style.opacity,i=n?null:bre(e,["opacity"],t,{opacity:1});r=r||{};var o=r.style||{};return o.opacity==null&&(r=te({},r),o=te({opacity:n?a:i.opacity*.1},o),r.style=o),r}function YS(e,t){var r=this.states[e];if(this.style){if(e==="emphasis")return wre(this,e,t,r);if(e==="blur")return Cre(this,e,r);if(e==="select")return Sre(this,e,r)}return r}function Oc(e){e.stateProxy=YS;var t=e.getTextContent(),r=e.getTextGuideLine();t&&(t.stateProxy=YS),r&&(r.stateProxy=YS)}function Yj(e,t){!gH(e,t)&&!e.__highByOuter&&Rs(e,cH)}function Xj(e,t){!gH(e,t)&&!e.__highByOuter&&Rs(e,hH)}function As(e,t){e.__highByOuter|=1<<(t||0),Rs(e,cH)}function Ns(e,t){!(e.__highByOuter&=~(1<<(t||0)))&&Rs(e,hH)}function dH(e){Rs(e,$k)}function Yk(e){Rs(e,fH)}function vH(e){Rs(e,xre)}function pH(e){Rs(e,_re)}function gH(e,t){return e.__highDownSilentOnTouch&&t.zrByTouch}function mH(e){var t=e.getModel(),r=[],n=[];t.eachComponent(function(a,i){var o=Uk(i),s=lH(e,i),l=a==="series";!l&&n.push(s),o.isBlured&&(s.group.traverse(function(u){fH(u)}),l&&r.push(i)),o.isBlured=!1}),j(n,function(a){a&&a.toggleBlurSeries&&a.toggleBlurSeries(r,!1,t)})}function IM(e,t,r,n){var a=n.getModel();r=r||"coordinateSystem";function i(u,c){for(var h=0;h0){var s={dataIndex:o,seriesIndex:r.seriesIndex};i!=null&&(s.dataType=i),t.push(s)}})}),t}function Il(e,t,r){lc(e,!0),Rs(e,Oc),DM(e,t,r)}function Lre(e){lc(e,!1)}function Yt(e,t,r,n){n?Lre(e):Il(e,t,r)}function DM(e,t,r){var n=Ee(e);t!=null?(n.focus=t,n.blurScope=r):n.focus&&(n.focus=null)}var Kj=["emphasis","blur","select"],Ire={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Pr(e,t,r,n){r=r||"itemStyle";for(var a=0;a1&&(o*=XS(g),s*=XS(g));var m=(a===i?-1:1)*XS((o*o*(s*s)-o*o*(v*v)-s*s*(d*d))/(o*o*(v*v)+s*s*(d*d)))||0,y=m*o*v/s,x=m*-s*d/o,_=(e+r)/2+i0(h)*y-a0(h)*x,w=(t+n)/2+a0(h)*y+i0(h)*x,S=tR([1,0],[(d-y)/o,(v-x)/s]),C=[(d-y)/o,(v-x)/s],M=[(-1*d-y)/o,(-1*v-x)/s],A=tR(C,M);if(jM(C,M)<=-1&&(A=Vv),jM(C,M)>=1&&(A=0),A<0){var I=Math.round(A/Vv*1e6)/1e6;A=Vv*2+I%2*Vv}c.addData(u,_,w,o,s,S,A,h,i)}var Ore=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,zre=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function Bre(e){var t=new Po;if(!e)return t;var r=0,n=0,a=r,i=n,o,s=Po.CMD,l=e.match(Ore);if(!l)return t;for(var u=0;uB*B+H*H&&(I=P,k=D),{cx:I,cy:k,x0:-c,y0:-h,x1:I*(a/C-1),y1:k*(a/C-1)}}function Zre(e){var t;if(ne(e)){var r=e.length;if(!r)return e;r===1?t=[e[0],e[0],0,0]:r===2?t=[e[0],e[0],e[1],e[1]]:r===3?t=e.concat(e[2]):t=e}else t=[e,e,e,e];return t}function $re(e,t){var r,n=Cp(t.r,0),a=Cp(t.r0||0,0),i=n>0,o=a>0;if(!(!i&&!o)){if(i||(n=a,a=0),a>n){var s=n;n=a,a=s}var l=t.startAngle,u=t.endAngle;if(!(isNaN(l)||isNaN(u))){var c=t.cx,h=t.cy,d=!!t.clockwise,v=nR(u-l),g=v>qS&&v%qS;if(g>gi&&(v=g),!(n>gi))e.moveTo(c,h);else if(v>qS-gi)e.moveTo(c+n*Wh(l),h+n*Nu(l)),e.arc(c,h,n,l,u,!d),a>gi&&(e.moveTo(c+a*Wh(u),h+a*Nu(u)),e.arc(c,h,a,u,l,d));else{var m=void 0,y=void 0,x=void 0,_=void 0,w=void 0,S=void 0,C=void 0,M=void 0,A=void 0,I=void 0,k=void 0,P=void 0,D=void 0,z=void 0,E=void 0,B=void 0,H=n*Wh(l),V=n*Nu(l),U=a*Wh(u),F=a*Nu(u),Z=v>gi;if(Z){var $=t.cornerRadius;$&&(r=Zre($),m=r[0],y=r[1],x=r[2],_=r[3]);var W=nR(n-a)/2;if(w=Ki(W,x),S=Ki(W,_),C=Ki(W,m),M=Ki(W,y),k=A=Cp(w,S),P=I=Cp(C,M),(A>gi||I>gi)&&(D=n*Wh(u),z=n*Nu(u),E=a*Wh(l),B=a*Nu(l),vgi){var me=Ki(x,k),Oe=Ki(_,k),be=o0(E,B,H,V,n,me,d),we=o0(D,z,U,F,n,Oe,d);e.moveTo(c+be.cx+be.x0,h+be.cy+be.y0),k0&&e.arc(c+be.cx,h+be.cy,me,_n(be.y0,be.x0),_n(be.y1,be.x1),!d),e.arc(c,h,n,_n(be.cy+be.y1,be.cx+be.x1),_n(we.cy+we.y1,we.cx+we.x1),!d),Oe>0&&e.arc(c+we.cx,h+we.cy,Oe,_n(we.y1,we.x1),_n(we.y0,we.x0),!d))}else e.moveTo(c+H,h+V),e.arc(c,h,n,l,u,!d);if(!(a>gi)||!Z)e.lineTo(c+U,h+F);else if(P>gi){var me=Ki(m,P),Oe=Ki(y,P),be=o0(U,F,D,z,a,-Oe,d),we=o0(H,V,E,B,a,-me,d);e.lineTo(c+be.cx+be.x0,h+be.cy+be.y0),P0&&e.arc(c+be.cx,h+be.cy,Oe,_n(be.y0,be.x0),_n(be.y1,be.x1),!d),e.arc(c,h,a,_n(be.cy+be.y1,be.cx+be.x1),_n(we.cy+we.y1,we.cx+we.x1),d),me>0&&e.arc(c+we.cx,h+we.cy,me,_n(we.y1,we.x1),_n(we.y0,we.x0),!d))}else e.lineTo(c+U,h+F),e.arc(c,h,a,u,l,d)}e.closePath()}}}var Yre=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return e}(),dn=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new Yre},t.prototype.buildPath=function(r,n){$re(r,n)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(rt);dn.prototype.type="sector";var Xre=function(){function e(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return e}(),Hd=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new Xre},t.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.PI*2;r.moveTo(a+n.r,i),r.arc(a,i,n.r,0,o,!1),r.moveTo(a+n.r0,i),r.arc(a,i,n.r0,0,o,!0)},t}(rt);Hd.prototype.type="ring";function qre(e,t,r,n){var a=[],i=[],o=[],s=[],l,u,c,h;if(n){c=[1/0,1/0],h=[-1/0,-1/0];for(var d=0,v=e.length;d=2){if(n){var i=qre(a,n,r,t.smoothConstraint);e.moveTo(a[0][0],a[0][1]);for(var o=a.length,s=0;s<(r?o:o-1);s++){var l=i[s*2],u=i[s*2+1],c=a[(s+1)%o];e.bezierCurveTo(l[0],l[1],u[0],u[1],c[0],c[1])}}else{e.moveTo(a[0][0],a[0][1]);for(var s=1,h=a.length;sLu[1]){if(i=!1,$r.negativeSize||n)return i;var l=s0(Lu[0]-ku[1]),u=s0(ku[0]-Lu[1]);KS(l,u)>u0.len()&&(l=u||!$r.bidirectional)&&(Pe.scale(l0,s,-u*a),$r.useDir&&$r.calcDirMTV()))}}return i},e.prototype._getProjMinMaxOnAxis=function(t,r,n){for(var a=this._axes[t],i=this._origin,o=r[0].dot(a)+i[t],s=o,l=o,u=1;u0){var h=c.duration,d=c.delay,v=c.easing,g={duration:h,delay:d||0,easing:v,done:i,force:!!i||!!o,setToFinal:!u,scope:e,during:o};s?t.animateFrom(r,g):t.animateTo(r,g)}else t.stopAnimation(),!s&&t.attr(r),o&&o(1),i&&i()}function mt(e,t,r,n,a,i){Jk("update",e,t,r,n,a,i)}function Ut(e,t,r,n,a,i){Jk("enter",e,t,r,n,a,i)}function Zf(e){if(!e.__zr)return!0;for(var t=0;tnr(i[1])?i[0]>0?"right":"left":i[1]>0?"bottom":"top"}function oR(e){return!e.isGroup}function hne(e){return e.shape!=null}function jm(e,t,r){if(!e||!t)return;function n(o){var s={};return o.traverse(function(l){oR(l)&&l.anid&&(s[l.anid]=l)}),s}function a(o){var s={x:o.x,y:o.y,rotation:o.rotation};return hne(o)&&(s.shape=Te(o.shape)),s}var i=n(e);t.traverse(function(o){if(oR(o)&&o.anid){var s=i[o.anid];if(s){var l=a(o);o.attr(a(s)),mt(o,l,r,Ee(o).dataIndex)}}})}function tL(e,t){return oe(e,function(r){var n=r[0];n=qe(n,t.x),n=Mt(n,t.x+t.width);var a=r[1];return a=qe(a,t.y),a=Mt(a,t.y+t.height),[n,a]})}function jH(e,t){var r=qe(e.x,t.x),n=Mt(e.x+e.width,t.x+t.width),a=qe(e.y,t.y),i=Mt(e.y+e.height,t.y+t.height);if(n>=r&&i>=a)return{x:r,y:a,width:n-r,height:i-a}}function $d(e,t,r){var n=te({rectHover:!0},t),a=n.style={strokeNoScale:!0};if(r=r||{x:-1,y:-1,width:2,height:2},e)return e.indexOf("image://")===0?(a.image=e.slice(8),Le(a,r),new Ur(n)):dd(e.replace("path://",""),n,r,"center")}function Tp(e,t,r,n,a){for(var i=0,o=a[a.length-1];i1)return!1;var y=JS(v,g,c,h)/d;return!(y<0||y>1)}function JS(e,t,r,n){return e*n-r*t}function fne(e){return e<=1e-6&&e>=-1e-6}function zc(e,t,r,n,a){return t==null||(ft(t)?Kt[0]=Kt[1]=Kt[2]=Kt[3]=t:(Kt[0]=t[0],Kt[1]=t[1],Kt[2]=t[2],Kt[3]=t[3]),n&&(Kt[0]=qe(0,Kt[0]),Kt[1]=qe(0,Kt[1]),Kt[2]=qe(0,Kt[2]),Kt[3]=qe(0,Kt[3])),r&&(Kt[0]=-Kt[0],Kt[1]=-Kt[1],Kt[2]=-Kt[2],Kt[3]=-Kt[3]),sR(e,Kt,"x","width",3,1,a&&a[0]||0),sR(e,Kt,"y","height",0,2,a&&a[1]||0)),e}var Kt=[0,0,0,0];function sR(e,t,r,n,a,i,o){var s=t[i]+t[a],l=e[n];e[n]+=s,o=qe(0,Mt(o,l)),e[n]=0?-t[a]:t[i]>=0?l+t[i]:nr(s)>1e-8?(l-o)*t[a]/s:0):e[r]-=t[a]}function Os(e){var t=e.itemTooltipOption,r=e.componentModel,n=e.itemName,a=ue(t)?{formatter:t}:t,i=r.mainType,o=r.componentIndex,s={componentType:i,name:n,$vars:["name"]};s[i+"Index"]=o;var l=e.formatterParamsExtra;l&&j(at(l),function(c){ge(s,c)||(s[c]=l[c],s.$vars.push(c))});var u=Ee(e.el);u.componentMainType=i,u.componentIndex=o,u.tooltipConfig={name:n,option:Le({content:n,encodeHTMLContent:!0,formatterParams:s},a)}}function OM(e,t){var r;e.isGroup&&(r=t(e)),r||e.traverse(t)}function au(e,t){if(e)if(ne(e))for(var r=0;rt&&(t=o),ot&&(r=t=0),{min:r,max:t}}function B1(e,t,r){zH(e,t,r,-1/0)}function zH(e,t,r,n){if(e.ignoreModelZ)return n;var a=e.getTextContent(),i=e.getTextGuideLine(),o=e.isGroup;if(o)for(var s=e.childrenRef(),l=0;l=0&&s.push(l)}),s}}function iu(e,t){return We(We({},e,!0),t,!0)}const Cne={time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}},Tne={time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}};var W_="ZH",oL="EN",$f=oL,Fx={},sL={},UH=ot.domSupported?function(){var e=(document.documentElement.lang||navigator.language||navigator.browserLanguage||$f).toUpperCase();return e.indexOf(W_)>-1?W_:$f}():$f;function lL(e,t){e=e.toUpperCase(),sL[e]=new tt(t),Fx[e]=t}function Mne(e){if(ue(e)){var t=Fx[e.toUpperCase()]||{};return e===W_||e===oL?Te(t):We(Te(t),Te(Fx[$f]),!1)}else return We(Te(e),Te(Fx[$f]),!1)}function FM(e){return sL[e]}function Ane(){return sL[$f]}lL(oL,Cne);lL(W_,Tne);var VM=null;function Nne(e){VM||(VM=e)}function xr(){return VM}function WH(e,t){var r=xr(),n=t.breakOption,a=t.breakParsed;return!a&&r&&(a=r.parseAxisBreakOption(n,e)),a}function Z_(e){var t=e.brk;return t?t.breaks:[]}function $_(e){var t=e.brk;return t?t.hasBreaks():!1}var uL=1e3,cL=uL*60,eg=cL*60,$a=eg*24,fR=$a*365,kne={year:/({yyyy}|{yy})/,month:/({MMMM}|{MMM}|{MM}|{M})/,day:/({dd}|{d})/,hour:/({HH}|{H}|{hh}|{h})/,minute:/({mm}|{m})/,second:/({ss}|{s})/,millisecond:/({SSS}|{S})/},Vx={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}"},Lne="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}",h0="{yyyy}-{MM}-{dd}",dR={year:"{yyyy}",month:"{yyyy}-{MM}",day:h0,hour:h0+" "+Vx.hour,minute:h0+" "+Vx.minute,second:h0+" "+Vx.second,millisecond:Lne},ga=["year","month","day","hour","minute","second","millisecond"],Ine=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Pne(e){return!ue(e)&&!Me(e)?Dne(e):e}function Dne(e){e=e||{};var t={},r=!0;return j(ga,function(n){r&&(r=e[n]==null)}),j(ga,function(n,a){var i=e[n];t[n]={};for(var o=null,s=a;s>=0;s--){var l=ga[s],u=Ie(i)&&!ne(i)?i[l]:i,c=void 0;ne(u)?(c=u.slice(),o=c[0]||""):ue(u)?(o=u,c=[o]):(o==null?o=Vx[n]:kne[l].test(o)||(o=t[l][l][0]+" "+o),c=[o],r&&(c[1]="{primary|"+o+"}")),t[n][l]=c}}),t}function On(e,t){return e+="","0000".substr(0,t-e.length)+e}function tg(e){switch(e){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return e}}function Ene(e){return e===tg(e)}function jne(e){switch(e){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function Rm(e,t,r,n){var a=Fo(e),i=a[ZH(r)](),o=a[hL(r)]()+1,s=Math.floor((o-1)/3)+1,l=a[fL(r)](),u=a["get"+(r?"UTC":"")+"Day"](),c=a[dL(r)](),h=(c-1)%12+1,d=a[vL(r)](),v=a[pL(r)](),g=a[gL(r)](),m=c>=12?"pm":"am",y=m.toUpperCase(),x=n instanceof tt?n:FM(n||UH)||Ane(),_=x.getModel("time"),w=_.get("month"),S=_.get("monthAbbr"),C=_.get("dayOfWeek"),M=_.get("dayOfWeekAbbr");return(t||"").replace(/{a}/g,m+"").replace(/{A}/g,y+"").replace(/{yyyy}/g,i+"").replace(/{yy}/g,On(i%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,w[o-1]).replace(/{MMM}/g,S[o-1]).replace(/{MM}/g,On(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,On(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,C[u]).replace(/{ee}/g,M[u]).replace(/{e}/g,u+"").replace(/{HH}/g,On(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,On(h+"",2)).replace(/{h}/g,h+"").replace(/{mm}/g,On(d,2)).replace(/{m}/g,d+"").replace(/{ss}/g,On(v,2)).replace(/{s}/g,v+"").replace(/{SSS}/g,On(g,3)).replace(/{S}/g,g+"")}function Rne(e,t,r,n,a){var i=null;if(ue(r))i=r;else if(Me(r)){var o={time:e.time,level:e.time?e.time.level:0},s=xr();s&&s.makeAxisLabelFormatterParamBreak(o,e.break),i=r(e.value,t,o)}else{var l=e.time;if(l){var u=r[l.lowerTimeUnit][l.upperTimeUnit];i=u[Math.min(l.level,u.length-1)]||""}else{var c=Yf(e.value,a);i=r[c][c][0]}}return Rm(new Date(e.value),i,a,n)}function Yf(e,t){var r=Fo(e),n=r[hL(t)]()+1,a=r[fL(t)](),i=r[dL(t)](),o=r[vL(t)](),s=r[pL(t)](),l=r[gL(t)](),u=l===0,c=u&&s===0,h=c&&o===0,d=h&&i===0,v=d&&a===1,g=v&&n===1;return g?"year":v?"month":d?"day":h?"hour":c?"minute":u?"second":"millisecond"}function Y_(e,t,r){switch(t){case"year":e[$H(r)](0);case"month":e[YH(r)](1);case"day":e[XH(r)](0);case"hour":e[qH(r)](0);case"minute":e[KH(r)](0);case"second":e[JH(r)](0)}return e}function ZH(e){return e?"getUTCFullYear":"getFullYear"}function hL(e){return e?"getUTCMonth":"getMonth"}function fL(e){return e?"getUTCDate":"getDate"}function dL(e){return e?"getUTCHours":"getHours"}function vL(e){return e?"getUTCMinutes":"getMinutes"}function pL(e){return e?"getUTCSeconds":"getSeconds"}function gL(e){return e?"getUTCMilliseconds":"getMilliseconds"}function One(e){return e?"setUTCFullYear":"setFullYear"}function $H(e){return e?"setUTCMonth":"setMonth"}function YH(e){return e?"setUTCDate":"setDate"}function XH(e){return e?"setUTCHours":"setHours"}function qH(e){return e?"setUTCMinutes":"setMinutes"}function KH(e){return e?"setUTCSeconds":"setSeconds"}function JH(e){return e?"setUTCMilliseconds":"setMilliseconds"}function zne(e,t,r,n,a,i,o,s){var l=new ht({style:{text:e,font:t,align:r,verticalAlign:n,padding:a,rich:i,overflow:o?"truncate":null,lineHeight:s}});return l.getBoundingRect()}function mL(e){if(!Rk(e))return ue(e)?e:"-";var t=(e+"").split(".");return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function yL(e,t){return e=(e||"").toLowerCase().replace(/-(.)/g,function(r,n){return n.toUpperCase()}),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e}var Xd=Am;function GM(e,t,r){var n="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function a(c){return c&&_a(c)?c:"-"}function i(c){return ni(c)}var o=t==="time",s=e instanceof Date;if(o||s){var l=o?Fo(e):e;if(isNaN(+l)){if(s)return"-"}else return Rm(l,n,r)}if(t==="ordinal")return T_(e)?a(e):ft(e)&&i(e)?e+"":"-";var u=Io(e);return i(u)?mL(u):T_(e)?a(e):typeof e=="boolean"?e+"":"-"}var vR=["a","b","c","d","e","f","g"],tC=function(e,t){return"{"+e+(t??"")+"}"};function xL(e,t,r){ne(t)||(t=[t]);var n=t.length;if(!n)return"";for(var a=t[0].$vars||[],i=0;i':'';var o=r.markerId||"markerX";return{renderMode:i,content:"{"+o+"|} ",style:a==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:n}:{width:10,height:10,borderRadius:5,backgroundColor:n}}}function Bne(e,t,r){(e==="week"||e==="month"||e==="quarter"||e==="half-year"||e==="year")&&(e=`MM-dd -yyyy`);var n=Fo(t),a=r?"getUTC":"get",i=n[a+"FullYear"](),o=n[a+"Month"]()+1,s=n[a+"Date"](),l=n[a+"Hours"](),u=n[a+"Minutes"](),c=n[a+"Seconds"](),h=n[a+"Milliseconds"]();return e=e.replace("MM",On(o,2)).replace("M",o).replace("yyyy",i).replace("yy",On(i%100+"",2)).replace("dd",On(s,2)).replace("d",s).replace("hh",On(l,2)).replace("h",l).replace("mm",On(u,2)).replace("m",u).replace("ss",On(c,2)).replace("s",c).replace("SSS",On(h,3)),e}function Fne(e){return e&&e.charAt(0).toUpperCase()+e.substr(1)}function Fc(e,t){return t=t||"transparent",ue(e)?e:Ie(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}function X_(e,t){if(t==="_blank"||t==="blank"){var r=window.open();r.opener=null,r.location.href=e}else window.open(e,t)}var Gx={},rC={},qd=function(){function e(){this._normalMasterList=[],this._nonSeriesBoxMasterList=[]}return e.prototype.create=function(t,r){this._nonSeriesBoxMasterList=n(Gx),this._normalMasterList=n(rC);function n(a,i){var o=[];return j(a,function(s,l){var u=s.create(t,r);o=o.concat(u||[])}),o}},e.prototype.update=function(t,r){j(this._normalMasterList,function(n){n.update&&n.update(t,r)})},e.prototype.getCoordinateSystems=function(){return this._normalMasterList.concat(this._nonSeriesBoxMasterList)},e.register=function(t,r){if(t==="matrix"||t==="calendar"){Gx[t]=r;return}rC[t]=r},e.get=function(t){return rC[t]||Gx[t]},e}();function Vne(e){return!!Gx[e]}var Gne=1,t7=2;function Hne(e){r7.set(e.fullType,{getCoord2:void 0}).getCoord2=e.getCoord2}var r7=pe();function n7(e){var t=e.getShallow("coord",!0),r=Gne;if(t==null){var n=r7.get(e.type);n&&n.getCoord2&&(r=t7,t=n.getCoord2(e))}return{coord:t,from:r}}var Xf=0,Hx=1,a7=2;function i7(e,t){var r=e.getShallow("coordinateSystem"),n=e.getShallow("coordinateSystemUsage",!0),a=Xf;if(r){var i=e.mainType==="series";n==null&&(n=i?"data":"box"),n==="data"?(a=Hx,i||(a=Xf)):n==="box"&&(a=a7,!i&&!Vne(r)&&(a=Xf))}return{coordSysType:r,kind:a}}function Om(e){var t=e.targetModel,r=e.coordSysType,n=e.coordSysProvider,a=e.isDefaultDataCoordSys;e.allowNotFound;var i=i7(t),o=i.kind,s=i.coordSysType;if(a&&o!==Hx&&(o=Hx,s=r),o===Xf||s!==r)return Xf;var l=n(r,t);return l?(o===Hx?t.coordinateSystem=l:t.boxCoordinateSystem=l,o):Xf}var o7=function(e,t){var r=t.getReferringComponents(e,sr).models[0];return r&&r.coordinateSystem},Ux=j,s7=["left","right","top","bottom","width","height"],uc=[["width","left","right"],["height","top","bottom"]];function _L(e,t,r,n,a){var i=0,o=0;n==null&&(n=1/0),a==null&&(a=1/0);var s=0;t.eachChild(function(l,u){var c=l.getBoundingRect(),h=t.childAt(u+1),d=h&&h.getBoundingRect(),v,g;if(e==="horizontal"){var m=c.width+(d?-d.x+c.x:0);v=i+m,v>n||l.newline?(i=0,v=m,o+=s+r,s=c.height):s=Math.max(s,c.height)}else{var y=c.height+(d?-d.y+c.y:0);g=o+y,g>a||l.newline?(i+=s+r,o=0,g=y,s=c.width):s=Math.max(s,c.width)}l.newline||(l.x=i,l.y=o,l.markRedraw(),e==="horizontal"?i=v+r:o=g+r)})}var xc=_L;Xe(_L,"vertical");Xe(_L,"horizontal");function l7(e,t){return{left:e.getShallow("left",t),top:e.getShallow("top",t),right:e.getShallow("right",t),bottom:e.getShallow("bottom",t),width:e.getShallow("width",t),height:e.getShallow("height",t)}}function Une(e,t){var r=jr(e,t,{enableLayoutOnlyByCenter:!0}),n=e.getBoxLayoutParams(),a,i;if(r.type===Ap.point)i=r.refPoint,a=Zt(n,{width:t.getWidth(),height:t.getHeight()});else{var o=e.get("center"),s=ne(o)?o:[o,o];a=Zt(n,r.refContainer),i=r.boxCoordFrom===t7?r.refPoint:[fe(s[0],a.width)+a.x,fe(s[1],a.height)+a.y]}return{viewRect:a,center:i}}function u7(e,t){var r=Une(e,t),n=r.viewRect,a=r.center,i=e.get("radius");ne(i)||(i=[0,i]);var o=fe(n.width,t.getWidth()),s=fe(n.height,t.getHeight()),l=Math.min(o,s),u=fe(i[0],l/2),c=fe(i[1],l/2);return{cx:a[0],cy:a[1],r0:u,r:c,viewRect:n}}function Zt(e,t,r){r=Xd(r||0);var n=t.width,a=t.height,i=fe(e.left,n),o=fe(e.top,a),s=fe(e.right,n),l=fe(e.bottom,a),u=fe(e.width,n),c=fe(e.height,a),h=r[2]+r[0],d=r[1]+r[3],v=e.aspect;switch(isNaN(u)&&(u=n-s-d-i),isNaN(c)&&(c=a-l-h-o),v!=null&&(isNaN(u)&&isNaN(c)&&(v>n/a?u=n*.8:c=a*.8),isNaN(u)&&(u=v*c),isNaN(c)&&(c=u/v)),isNaN(i)&&(i=n-s-u-d),isNaN(o)&&(o=a-l-c-h),e.left||e.right){case"center":i=n/2-u/2-r[3];break;case"right":i=n-u-d;break}switch(e.top||e.bottom){case"middle":case"center":o=a/2-c/2-r[0];break;case"bottom":o=a-c-h;break}i=i||0,o=o||0,isNaN(u)&&(u=n-d-i-(s||0)),isNaN(c)&&(c=a-h-o-(l||0));var g=new ke((t.x||0)+i+r[3],(t.y||0)+o+r[0],u,c);return g.margin=r,g}function c7(e,t,r){var n=e.getShallow("preserveAspect",!0);if(!n)return t;var a=t.width/t.height;if(Math.abs(Math.atan(r)-Math.atan(a))<1e-9)return t;var i=e.getShallow("preserveAspectAlign",!0),o=e.getShallow("preserveAspectVerticalAlign",!0),s={width:t.width,height:t.height},l=n==="cover";return a>r&&!l||a=m)return h;for(var y=0;y=0;l--)s=We(s,a[l],!0);n.defaultOption=s}return n.defaultOption},t.prototype.getReferringComponents=function(r,n){var a=r+"Index",i=r+"Id";return Bd(this.ecModel,r,{index:this.get(a,!0),id:this.get(i,!0)},n)},t.prototype.getBoxLayoutParams=function(){return l7(this,!1)},t.prototype.getZLevelKey=function(){return""},t.prototype.setZLevel=function(r){this.option.zlevel=r},t.protoInitialize=function(){var r=t.prototype;r.type="component",r.id="",r.name="",r.mainType="",r.subType="",r.componentIndex=0}(),t}(tt);$G(Qe,tt);L1(Qe);wne(Qe);Sne(Qe,$ne);function $ne(e){var t=[];return j(Qe.getClassesByMainType(e),function(r){t=t.concat(r.dependencies||r.prototype.dependencies||[])}),t=oe(t,function(r){return lo(r).main}),e!=="dataset"&&Ve(t,"dataset")<=0&&t.unshift("dataset"),t}var K={color:{},darkColor:{},size:{}},pr=K.color={theme:["#5070dd","#b6d634","#505372","#ff994d","#0ca8df","#ffd10a","#fb628b","#785db0","#3fbe95"],neutral00:"#fff",neutral05:"#f4f7fd",neutral10:"#e8ebf0",neutral15:"#dbdee4",neutral20:"#cfd2d7",neutral25:"#c3c5cb",neutral30:"#b7b9be",neutral35:"#aaacb2",neutral40:"#9ea0a5",neutral45:"#929399",neutral50:"#86878c",neutral55:"#797b7f",neutral60:"#6d6e73",neutral65:"#616266",neutral70:"#54555a",neutral75:"#48494d",neutral80:"#3c3c41",neutral85:"#303034",neutral90:"#232328",neutral95:"#17171b",neutral99:"#000",accent05:"#eff1f9",accent10:"#e0e4f2",accent15:"#d0d6ec",accent20:"#c0c9e6",accent25:"#b1bbdf",accent30:"#a1aed9",accent35:"#91a0d3",accent40:"#8292cc",accent45:"#7285c6",accent50:"#6578ba",accent55:"#5c6da9",accent60:"#536298",accent65:"#4a5787",accent70:"#404c76",accent75:"#374165",accent80:"#2e3654",accent85:"#252b43",accent90:"#1b2032",accent95:"#121521",transparent:"rgba(0,0,0,0)",highlight:"rgba(255,231,130,0.8)"};te(pr,{primary:pr.neutral80,secondary:pr.neutral70,tertiary:pr.neutral60,quaternary:pr.neutral50,disabled:pr.neutral20,border:pr.neutral30,borderTint:pr.neutral20,borderShade:pr.neutral40,background:pr.neutral05,backgroundTint:"rgba(234,237,245,0.5)",backgroundTransparent:"rgba(255,255,255,0)",backgroundShade:pr.neutral10,shadow:"rgba(0,0,0,0.2)",shadowTint:"rgba(129,130,136,0.2)",axisLine:pr.neutral70,axisLineTint:pr.neutral40,axisTick:pr.neutral70,axisTickMinor:pr.neutral60,axisLabel:pr.neutral70,axisSplitLine:pr.neutral15,axisMinorSplitLine:pr.neutral05});for(var Iu in pr)if(pr.hasOwnProperty(Iu)){var pR=pr[Iu];Iu==="theme"?K.darkColor.theme=pr.theme.slice():Iu==="highlight"?K.darkColor.highlight="rgba(255,231,130,0.4)":Iu.indexOf("accent")===0?K.darkColor[Iu]=ds(pR,null,function(e){return e*.5},function(e){return Math.min(1,1.3-e)}):K.darkColor[Iu]=ds(pR,null,function(e){return e*.9},function(e){return 1-Math.pow(e,1.5)})}K.size={xxs:2,xs:5,s:10,m:15,l:20,xl:30,xxl:40,xxxl:50};var f7="";typeof navigator<"u"&&(f7=navigator.platform||"");var Zh="rgba(0, 0, 0, 0.2)",d7=K.color.theme[0],Yne=ds(d7,null,null,.9);const v7={darkMode:"auto",colorBy:"series",color:K.color.theme,gradientColor:[Yne,d7],aria:{decal:{decals:[{color:Zh,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:Zh,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:Zh,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:Zh,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:Zh,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:Zh,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:f7.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var rn={Must:1,Might:2,Not:3},p7=Ze();function Xne(e){p7(e).datasetMap=pe()}function g7(e,t,r){var n={},a=wL(t);if(!a||!e)return n;var i=[],o=[],s=t.ecModel,l=p7(s).datasetMap,u=a.uid+"_"+r.seriesLayoutBy,c,h;e=e.slice(),j(e,function(m,y){var x=Ie(m)?m:e[y]={name:m};x.type==="ordinal"&&c==null&&(c=y,h=g(x)),n[x.name]=[]});var d=l.get(u)||l.set(u,{categoryWayDim:h,valueWayDim:0});j(e,function(m,y){var x=m.name,_=g(m);if(c==null){var w=d.valueWayDim;v(n[x],w,_),v(o,w,_),d.valueWayDim+=_}else if(c===y)v(n[x],0,_),v(i,0,_);else{var w=d.categoryWayDim;v(n[x],w,_),v(o,w,_),d.categoryWayDim+=_}});function v(m,y,x){for(var _=0;_t)return e[n];return e[r-1]}function x7(e,t,r,n,a,i,o){i=i||e;var s=t(i),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(a))return u[a];var c=o==null||!n?r:eae(n,o);if(c=c||r,!(!c||!c.length)){var h=c[l];return a&&(u[a]=h),s.paletteIdx=(l+1)%c.length,h}}function tae(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}var f0,Gv,mR,yR="\0_ec_inner",rae=1,CL=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.init=function(r,n,a,i,o,s){i=i||{},this.option=null,this._theme=new tt(i),this._locale=new tt(o),this._optionManager=s},t.prototype.setOption=function(r,n,a){var i=bR(n);this._optionManager.setOption(r,a,i),this._resetOption(null,i)},t.prototype.resetOption=function(r,n){return this._resetOption(r,bR(n))},t.prototype._resetOption=function(r,n){var a=!1,i=this._optionManager;if(!r||r==="recreate"){var o=i.mountOption(r==="recreate");!this.option||r==="recreate"?mR(this,o):(this.restoreData(),this._mergeOption(o,n)),a=!0}if((r==="timeline"||r==="media")&&this.restoreData(),!r||r==="recreate"||r==="timeline"){var s=i.getTimelineOption(this);s&&(a=!0,this._mergeOption(s,n))}if(!r||r==="recreate"||r==="media"){var l=i.getMediaOption(this);l.length&&j(l,function(u){a=!0,this._mergeOption(u,n)},this)}return a},t.prototype.mergeOption=function(r){this._mergeOption(r,null)},t.prototype._mergeOption=function(r,n){var a=this.option,i=this._componentsMap,o=this._componentsCount,s=[],l=pe(),u=n&&n.replaceMergeMainTypeMap;Xne(this),j(r,function(h,d){h!=null&&(Qe.hasClass(d)?d&&(s.push(d),l.set(d,!0)):a[d]=a[d]==null?Te(h):We(a[d],h,!0))}),u&&u.each(function(h,d){Qe.hasClass(d)&&!l.get(d)&&(s.push(d),l.set(d,!0))}),Qe.topologicalTravel(s,Qe.getAllClassMainTypes(),c,this);function c(h){var d=Jne(this,h,jt(r[h])),v=i.get(h),g=v?u&&u.get(h)?"replaceMerge":"normalMerge":"replaceAll",m=BG(v,d,g);cte(m,h,Qe),a[h]=null,i.set(h,null),o.set(h,0);var y=[],x=[],_=0,w;j(m,function(S,C){var M=S.existing,A=S.newOption;if(!A)M&&(M.mergeOption({},this),M.optionUpdated({},!1));else{var I=h==="series",k=Qe.getClass(h,S.keyInfo.subType,!I);if(!k)return;if(h==="tooltip"){if(w)return;w=!0}if(M&&M.constructor===k)M.name=S.keyInfo.name,M.mergeOption(A,this),M.optionUpdated(A,!1);else{var P=te({componentIndex:C},S.keyInfo);M=new k(A,this,this,P),te(M,P),S.brandNew&&(M.__requireNewView=!0),M.init(A,this,this),M.optionUpdated(null,!0)}}M?(y.push(M.option),x.push(M),_++):(y.push(void 0),x.push(void 0))},this),a[h]=y,i.set(h,x),o.set(h,_),h==="series"&&f0(this)}this._seriesIndices||f0(this)},t.prototype.getOption=function(){var r=Te(this.option);return j(r,function(n,a){if(Qe.hasClass(a)){for(var i=jt(n),o=i.length,s=!1,l=o-1;l>=0;l--)i[l]&&!Og(i[l])?s=!0:(i[l]=null,!s&&o--);i.length=o,r[a]=i}}),delete r[yR],r},t.prototype.setTheme=function(r){this._theme=new tt(r),this._resetOption("recreate",null)},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(r){this._payload=r},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(r,n){var a=this._componentsMap.get(r);if(a){var i=a[n||0];if(i)return i;if(n==null){for(var o=0;o=t:r==="max"?e<=t:e===t}function cae(e,t){return e.join(",")===t.join(",")}var pi=j,Hg=Ie,wR=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function nC(e){var t=e&&e.itemStyle;if(t)for(var r=0,n=wR.length;r0?r[o-1].seriesModel:null)}),_ae(r)}})}function _ae(e){j(e,function(t,r){var n=[],a=[NaN,NaN],i=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,l=t.seriesModel.get("stackStrategy")||"samesign";o.modify(i,function(u,c,h){var d=o.get(t.stackedDimension,h);if(isNaN(d))return a;var v,g;s?g=o.getRawIndex(h):v=o.get(t.stackedByDimension,h);for(var m=NaN,y=r-1;y>=0;y--){var x=e[y];if(s||(g=x.data.rawIndexOf(x.stackedByDimension,v)),g>=0){var _=x.data.getByRawIndex(x.stackResultDimension,g);if(l==="all"||l==="positive"&&_>0||l==="negative"&&_<0||l==="samesign"&&d>=0&&_>0||l==="samesign"&&d<=0&&_<0){d=Zu(d,_),m=_;break}}}return n[0]=d,n[1]=m,n})})}var H1=function(){function e(t){this.data=t.data||(t.sourceFormat===Oi?{}:[]),this.sourceFormat=t.sourceFormat||iH,this.seriesLayoutBy=t.seriesLayoutBy||Ni,this.startIndex=t.startIndex||0,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.metaRawOption=t.metaRawOption;var r=this.dimensionsDefine=t.dimensionsDefine;if(r)for(var n=0;nm&&(m=w)}v[0]=g,v[1]=m}},a=function(){return this._data?this._data.length/this._dimSize:0};kR=(t={},t[Qr+"_"+Ni]={pure:!0,appendData:i},t[Qr+"_"+ch]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},t[La]={pure:!0,appendData:i},t[Oi]={pure:!0,appendData:function(o){var s=this._data;j(o,function(l,u){for(var c=s[u]||(s[u]=[]),h=0;h<(l||[]).length;h++)c.push(l[h])})}},t[ka]={appendData:i},t[Ll]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},t);function i(o){for(var s=0;s=0&&(m=o.interpolatedValue[y])}return m!=null?m+"":""})}},e.prototype.getRawValue=function(t,r){return pd(this.getData(r),t)},e.prototype.formatTooltip=function(t,r,n){},e}();function DR(e){var t,r;return Ie(e)?e.type&&(r=e):t=e,{text:t,frag:r}}function rg(e){return new Nae(e)}var Nae=function(){function e(t){t=t||{},this._reset=t.reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0}return e.prototype.perform=function(t){var r=this._upstream,n=t&&t.skip;if(this._dirty&&r){var a=this.context;a.data=a.outputData=r.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!n&&(i=this._plan(this.context));var o=c(this._modBy),s=this._modDataCount||0,l=c(t&&t.modBy),u=t&&t.modDataCount||0;(o!==l||s!==u)&&(i="reset");function c(_){return!(_>=1)&&(_=1),_}var h;(this._dirty||i==="reset")&&(this._dirty=!1,h=this._doReset(n)),this._modBy=l,this._modDataCount=u;var d=t&&t.step;if(r?this._dueEnd=r._outputDueEnd:this._dueEnd=this._count?this._count(this.context):1/0,this._progress){var v=this._dueIndex,g=Math.min(d!=null?this._dueIndex+d:1/0,this._dueEnd);if(!n&&(h||v1&&n>0?s:o}};return i;function o(){return t=e?null:lt},gte:function(e,t){return e>=t}},Lae=function(){function e(t,r){if(!ft(r)){var n="";bt(n)}this._opFn=k7[t],this._rvalFloat=Io(r)}return e.prototype.evaluate=function(t){return ft(t)?this._opFn(t,this._rvalFloat):this._opFn(Io(t),this._rvalFloat)},e}(),L7=function(){function e(t,r){var n=t==="desc";this._resultLT=n?1:-1,r==null&&(r=n?"min":"max"),this._incomparable=r==="min"?-1/0:1/0}return e.prototype.evaluate=function(t,r){var n=ft(t)?t:Io(t),a=ft(r)?r:Io(r),i=isNaN(n),o=isNaN(a);if(i&&(n=this._incomparable),o&&(a=this._incomparable),i&&o){var s=ue(t),l=ue(r);s&&(n=l?t:0),l&&(a=s?r:0)}return na?-this._resultLT:0},e}(),Iae=function(){function e(t,r){this._rval=r,this._isEQ=t,this._rvalTypeof=typeof r,this._rvalFloat=Io(r)}return e.prototype.evaluate=function(t){var r=t===this._rval;if(!r){var n=typeof t;n!==this._rvalTypeof&&(n==="number"||this._rvalTypeof==="number")&&(r=Io(t)===this._rvalFloat)}return this._isEQ?r:!r},e}();function Pae(e,t){return e==="eq"||e==="ne"?new Iae(e==="eq",t):ge(k7,e)?new Lae(e,t):null}function I7(e){var t="",r=-1/0,n=-1/0,a=1/0,i=1/0;return e&&(e.g!=null&&(t+="G"+e.g,r=e.g),e.ge!=null&&(t+="GE"+e.ge,n=e.ge),e.l!=null&&(t+="L"+e.l,a=e.l),e.le!=null&&(t+="LE"+e.le,i=e.le)),{key:t,g:r,ge:n,l:a,le:i}}function P7(e,t){return t>e.g&&t>=e.ge&&t65535?Gae:Hae}function Uae(e){var t=e.constructor;return t===Array?e.slice():new t(e)}function RR(e,t,r,n,a){var i=j7[r||"float"];if(a){var o=e[t],s=o&&o.length;if(s!==n){for(var l=new i(n),u=0;uy[1]&&(y[1]=m)}return this._rawCount=this._count=l,{start:s,end:l}},e.prototype._initDataFromProvider=function(t,r,n){for(var a=this._provider,i=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,u=oe(o,function(_){return _.property}),c=0;cx[1]&&(x[1]=y)}}!a.persistent&&a.clean&&a.clean(),this._rawCount=this._count=r,this._extent=[]},e.prototype.count=function(){return this._count},e.prototype.get=function(t,r){if(!(r>=0&&r=0&&r=this._rawCount||t<0)return-1;if(!this._indices)return t;var r=this._indices,n=r[t];if(n!=null&&nt)i=o-1;else return o}return-1},e.prototype.getIndices=function(){var t,r=this._indices;if(r){var n=r.constructor,a=this._count;if(n===Array){t=new n(a);for(var i=0;i=h&&_<=d||isNaN(_))&&(l[u++]=m),m++}g=!0}else if(i===2){for(var y=v[a[0]],w=v[a[1]],S=t[a[1]][0],C=t[a[1]][1],x=0;x=h&&_<=d||isNaN(_))&&(M>=S&&M<=C||isNaN(M))&&(l[u++]=m),m++}g=!0}}if(!g)if(i===1)for(var x=0;x=h&&_<=d||isNaN(_))&&(l[u++]=A)}else for(var x=0;xt[P][1])&&(I=!1)}I&&(l[u++]=r.getRawIndex(x))}return ux[1]&&(x[1]=y)}}}},e.prototype.lttbDownSample=function(t,r){var n=this.clone([t],!0),a=n._chunks,i=a[t],o=this.count(),s=0,l=Math.floor(1/r),u=this.getRawIndex(0),c,h,d,v=new($h(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));v[s++]=u;for(var g=1;gc&&(c=h,d=S)}D>0&&Ds&&(m=s-c);for(var y=0;yg&&(g=_,v=c+y)}var w=this.getRawIndex(h),S=this.getRawIndex(v);hc-g&&(l=c-g,s.length=l);for(var m=0;mh[1]&&(h[1]=x),d[v++]=_}return i._count=v,i._indices=d,i._updateGetRawIdx(),i},e.prototype.each=function(t,r){if(this._count)for(var n=t.length,a=this._chunks,i=0,o=this.count();iv&&(v=y))}return l[c]=[d,v]},e.prototype.getRawDataItem=function(t){var r=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(r);for(var n=[],a=this._chunks,i=0;i=0?this._indices[t]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function t(r,n,a,i){return Pl(r[i],this._dimensions[i])}oC={arrayRows:t,objectRows:function(r,n,a,i){return Pl(r[n],this._dimensions[i])},keyedColumns:t,original:function(r,n,a,i){var o=r&&(r.value==null?r:r.value);return Pl(o instanceof Array?o[i]:o,this._dimensions[i])},typedArray:function(r,n,a,i){return r[i]}}}(),e}(),R7=function(){function e(t){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t}return e.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},e.prototype._setLocalSource=function(t,r){this._sourceList=t,this._upstreamSignList=r,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},e.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},e.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},e.prototype._createSource=function(){this._setLocalSource([],[]);var t=this._sourceHost,r=this._getUpstreamSourceManagers(),n=!!r.length,a,i;if(v0(t)){var o=t,s=void 0,l=void 0,u=void 0;if(n){var c=r[0];c.prepareSource(),u=c.getSource(),s=u.data,l=u.sourceFormat,i=[c._getVersionSign()]}else s=o.get("data",!0),l=Gn(s)?Ll:ka,i=[];var h=this._getSourceMetaRawOption()||{},d=u&&u.metaRawOption||{},v=_e(h.seriesLayoutBy,d.seriesLayoutBy)||null,g=_e(h.sourceHeader,d.sourceHeader),m=_e(h.dimensions,d.dimensions),y=v!==d.seriesLayoutBy||!!g!=!!d.sourceHeader||m;a=y?[WM(s,{seriesLayoutBy:v,sourceHeader:g,dimensions:m},l)]:[]}else{var x=t;if(n){var _=this._applyTransform(r);a=_.sourceList,i=_.upstreamSignList}else{var w=x.get("source",!0);a=[WM(w,this._getSourceMetaRawOption(),null)],i=[]}}this._setLocalSource(a,i)},e.prototype._applyTransform=function(t){var r=this._sourceHost,n=r.get("transform",!0),a=r.get("fromTransformResult",!0);if(a!=null){var i="";t.length!==1&&zR(i)}var o,s=[],l=[];return j(t,function(u){u.prepareSource();var c=u.getSource(a||0),h="";a!=null&&!c&&zR(h),s.push(c),l.push(u._getVersionSign())}),n?o=Fae(n,s,{datasetIndex:r.componentIndex}):a!=null&&(o=[bae(s[0])]),{sourceList:o,upstreamSignList:l}},e.prototype._isDirty=function(){if(this._dirty)return!0;for(var t=this._getUpstreamSourceManagers(),r=0;r1||r>0&&!e.noHeader;return j(e.blocks,function(a){var i=F7(a);i>=t&&(t=i+ +(n&&(!i||$M(a)&&!a.noHeader)))}),t}return 0}function Yae(e,t,r,n){var a=t.noHeader,i=qae(F7(t)),o=[],s=t.blocks||[];fn(!s||ne(s)),s=s||[];var l=e.orderMode;if(t.sortBlocks&&l){s=s.slice();var u={valueAsc:"asc",valueDesc:"desc"};if(ge(u,l)){var c=new L7(u[l],null);s.sort(function(m,y){return c.evaluate(m.sortParam,y.sortParam)})}else l==="seriesDesc"&&s.reverse()}j(s,function(m,y){var x=t.valueFormatter,_=B7(m)(x?te(te({},e),{valueFormatter:x}):e,m,y>0?i.html:0,n);_!=null&&o.push(_)});var h=e.renderMode==="richText"?o.join(i.richText):YM(n,o.join(""),a?r:i.html);if(a)return h;var d=GM(t.header,"ordinal",e.useUTC),v=z7(n,e.renderMode).nameStyle,g=O7(n);return e.renderMode==="richText"?V7(e,d,v)+i.richText+h:YM(n,'
'+Tn(d)+"
"+h,r)}function Xae(e,t,r,n){var a=e.renderMode,i=t.noName,o=t.noValue,s=!t.markerType,l=t.name,u=e.useUTC,c=t.valueFormatter||e.valueFormatter||function(S){return S=ne(S)?S:[S],oe(S,function(C,M){return GM(C,ne(v)?v[M]:v,u)})};if(!(i&&o)){var h=s?"":e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||K.color.secondary,a),d=i?"":GM(l,"ordinal",u),v=t.valueType,g=o?[]:c(t.value,t.rawDataIndex),m=!s||!i,y=!s&&i,x=z7(n,a),_=x.nameStyle,w=x.valueStyle;return a==="richText"?(s?"":h)+(i?"":V7(e,d,_))+(o?"":Qae(e,g,m,y,w)):YM(n,(s?"":h)+(i?"":Kae(d,!s,_))+(o?"":Jae(g,m,y,w)),r)}}function BR(e,t,r,n,a,i){if(e){var o=B7(e),s={useUTC:a,renderMode:r,orderMode:n,markupStyleCreator:t,valueFormatter:e.valueFormatter};return o(s,e,0,i)}}function qae(e){return{html:Zae[e],richText:$ae[e]}}function YM(e,t,r){var n='
',a="margin: "+r+"px 0 0",i=O7(e);return'
'+t+n+"
"}function Kae(e,t,r){var n=t?"margin-left:2px":"";return''+Tn(e)+""}function Jae(e,t,r,n){var a=r?"10px":"20px",i=t?"float:right;margin-left:"+a:"";return e=ne(e)?e:[e],''+oe(e,function(o){return Tn(o)}).join("  ")+""}function V7(e,t,r){return e.markupStyleCreator.wrapRichTextStyle(t,r)}function Qae(e,t,r,n,a){var i=[a],o=n?10:20;return r&&i.push({padding:[0,0,0,o],align:"right"}),e.markupStyleCreator.wrapRichTextStyle(ne(t)?t.join(" "):t,i)}function G7(e,t){var r=e.getData().getItemVisual(t,"style"),n=r[e.visualDrawType];return Fc(n)}function H7(e,t){var r=e.get("padding");return r??(t==="richText"?[8,10]:10)}var sC=function(){function e(){this.richTextStyles={},this._nextStyleNameId=Ok()}return e.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(t,r,n){var a=n==="richText"?this._generateStyleName():null,i=e7({color:r,type:t,renderMode:n,markerId:a});return ue(i)?i:(this.richTextStyles[a]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(t,r){var n={};ne(r)?j(r,function(i){return te(n,i)}):te(n,r);var a=this._generateStyleName();return this.richTextStyles[a]=n,"{"+a+"|"+t+"}"},e}();function U7(e){var t=e.series,r=e.dataIndex,n=e.multipleSeries,a=t.getData(),i=a.mapDimensionsAll("defaultedTooltip"),o=i.length,s=t.getRawValue(r),l=ne(s),u=G7(t,r),c,h,d,v;if(o>1||l&&!o){var g=eie(s,t,r,i,u);c=g.inlineValues,h=g.inlineValueTypes,d=g.blocks,v=g.inlineValues[0]}else if(o){var m=a.getDimensionInfo(i[0]);v=c=pd(a,r,i[0]),h=m.type}else v=c=l?s[0]:s;var y=zk(t),x=y&&t.name||"",_=a.getName(r),w=n?x:_;return Mr("section",{header:x,noHeader:n||!y,sortParam:v,blocks:[Mr("nameValue",{markerType:"item",markerColor:u,name:w,noName:!_a(w),value:c,valueType:h,rawDataIndex:a.getRawIndex(r)})].concat(d||[])})}function eie(e,t,r,n,a){var i=t.getData(),o=ti(e,function(h,d,v){var g=i.getDimensionInfo(v);return h=h||g&&g.tooltip!==!1&&g.displayName!=null},!1),s=[],l=[],u=[];n.length?j(n,function(h){c(pd(i,r,h),h)}):j(e,c);function c(h,d){var v=i.getDimensionInfo(d);!v||v.otherDims.tooltip===!1||(o?u.push(Mr("nameValue",{markerType:"subItem",markerColor:a,name:v.displayName,value:h,valueType:v.type})):(s.push(h),l.push(v.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:u}}var $s=Ze();function p0(e,t){return e.getName(t)||e.getId(t)}var Wx="__universalTransitionEnabled",Pt=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r._selectedDataIndicesMap={},r}return t.prototype.init=function(r,n,a){this.seriesIndex=this.componentIndex,this.dataTask=rg({count:rie,reset:nie}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(r,a);var i=$s(this).sourceManager=new R7(this);i.prepareSource();var o=this.getInitialData(r,a);VR(o,this),this.dataTask.context.data=o,$s(this).dataBeforeProcessed=o,FR(this),this._initSelectedMapFromData(o)},t.prototype.mergeDefaultAndTheme=function(r,n){var a=Gg(this),i=a?vh(r):{},o=this.subType;Qe.hasClass(o)&&(o+="Series"),We(r,n.getTheme().get(this.subType)),We(r,this.getDefaultOption()),Dc(r,"label",["show"]),this.fillDataTextStyle(r.data),a&&Eo(r,i,a)},t.prototype.mergeOption=function(r,n){r=We(this.option,r,!0),this.fillDataTextStyle(r.data);var a=Gg(this);a&&Eo(this.option,r,a);var i=$s(this).sourceManager;i.dirty(),i.prepareSource();var o=this.getInitialData(r,n);VR(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,$s(this).dataBeforeProcessed=o,FR(this),this._initSelectedMapFromData(o)},t.prototype.fillDataTextStyle=function(r){if(r&&!Gn(r))for(var n=["show"],a=0;a=0&&d<0)&&(h=C,d=S,v=0),S===d&&(c[v++]=y))}return c.length=v,c},t.prototype.formatTooltip=function(r,n,a){return U7({series:this,dataIndex:r,multipleSeries:n})},t.prototype.isAnimationEnabled=function(){var r=this.ecModel;if(ot.node&&!(r&&r.ssr))return!1;var n=this.getShallow("animation");return n&&this.getData().count()>this.getShallow("animationThreshold")&&(n=!1),!!n},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(r,n,a){var i=this.ecModel,o=SL.prototype.getColorFromPalette.call(this,r,n,a);return o||(o=i.getColorFromPalette(r,n,a)),o},t.prototype.coordDimToDataDim=function(r){return this.getRawData().mapDimensionsAll(r)},t.prototype.getProgressive=function(){return this.get("progressive")},t.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},t.prototype.select=function(r,n){this._innerSelect(this.getData(n),r)},t.prototype.unselect=function(r,n){var a=this.option.selectedMap;if(a){var i=this.option.selectedMode,o=this.getData(n);if(i==="series"||a==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s=0&&a.push(o)}return a},t.prototype.isSelected=function(r,n){var a=this.option.selectedMap;if(!a)return!1;var i=this.getData(n);return(a==="all"||a[p0(i,r)])&&!i.getItemModel(r).get(["select","disabled"])},t.prototype.isUniversalTransitionEnabled=function(){if(this[Wx])return!0;var r=this.option.universalTransition;return r?r===!0?!0:r&&r.enabled:!1},t.prototype._innerSelect=function(r,n){var a,i,o=this.option,s=o.selectedMode,l=n.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){Ie(o.selectedMap)||(o.selectedMap={});for(var u=o.selectedMap,c=0;c0&&this._innerSelect(r,n)}},t.registerClass=function(r){return Qe.registerClass(r)},t.protoInitialize=function(){var r=t.prototype;r.type="series.__base__",r.seriesIndex=0,r.ignoreStyleOnData=!1,r.hasSymbolVisual=!1,r.defaultSymbol="circle",r.visualStyleAccessPath="itemStyle",r.visualDrawType="fill"}(),t}(Qe);br(Pt,U1);br(Pt,SL);$G(Pt,Qe);function FR(e){var t=e.name;zk(e)||(e.name=tie(e)||t)}function tie(e){var t=e.getRawData(),r=t.mapDimensionsAll("seriesName"),n=[];return j(r,function(a){var i=t.getDimensionInfo(a);i.displayName&&n.push(i.displayName)}),n.join(" ")}function rie(e){return e.model.getRawData().count()}function nie(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),aie}function aie(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function VR(e,t){j(ld(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(r){e.wrapMethod(r,Xe(iie,t))})}function iie(e,t){var r=XM(e);return r&&r.setOutputEnd((t||this).count()),t}function XM(e){var t=(e.ecModel||{}).scheduler,r=t&&t.getPipeline(e.uid);if(r){var n=r.currentTask;if(n){var a=n.agentStubMap;a&&(n=a.get(e.uid))}return n}}var Rt=function(){function e(){this.group=new Ne,this.uid=dh("viewComponent")}return e.prototype.init=function(t,r){},e.prototype.render=function(t,r,n,a){},e.prototype.dispose=function(t,r){},e.prototype.updateView=function(t,r,n,a){},e.prototype.updateLayout=function(t,r,n,a){},e.prototype.updateVisual=function(t,r,n,a){},e.prototype.toggleBlurSeries=function(t,r,n){},e.prototype.eachRendered=function(t){var r=this.group;r&&r.traverse(t)},e}();Vk(Rt);L1(Rt);function ph(){var e=Ze();return function(t){var r=e(t),n=t.pipelineContext,a=!!r.large,i=!!r.progressiveRender,o=r.large=!!(n&&n.large),s=r.progressiveRender=!!(n&&n.progressiveRender);return(a!==o||i!==s)&&"reset"}}var W7=Ze(),oie=ph(),At=function(){function e(){this.group=new Ne,this.uid=dh("viewChart"),this.renderTask=rg({plan:sie,reset:lie}),this.renderTask.context={view:this}}return e.prototype.init=function(t,r){},e.prototype.render=function(t,r,n,a){},e.prototype.highlight=function(t,r,n,a){var i=t.getData(a&&a.dataType);i&&HR(i,a,"emphasis")},e.prototype.downplay=function(t,r,n,a){var i=t.getData(a&&a.dataType);i&&HR(i,a,"normal")},e.prototype.remove=function(t,r){this.group.removeAll()},e.prototype.dispose=function(t,r){},e.prototype.updateView=function(t,r,n,a){this.render(t,r,n,a)},e.prototype.updateVisual=function(t,r,n,a){this.render(t,r,n,a)},e.prototype.eachRendered=function(t){au(this.group,t)},e.markUpdateMethod=function(t,r){W7(t).updateMethod=r},e.protoInitialize=function(){var t=e.prototype;t.type="chart"}(),e}();function GR(e,t,r){e&&Bg(e)&&(t==="emphasis"?As:Ns)(e,r)}function HR(e,t,r){var n=Ec(e,t),a=t&&t.highlightKey!=null?Dre(t.highlightKey):null;n!=null?j(jt(n),function(i){GR(e.getItemGraphicEl(i),r,a)}):e.eachItemGraphicEl(function(i){GR(i,r,a)})}Vk(At);L1(At);function sie(e){return oie(e.model)}function lie(e){var t=e.model,r=e.ecModel,n=e.api,a=e.payload,i=t.pipelineContext.progressiveRender,o=e.view,s=a&&W7(a).updateMethod,l=i?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](t,r,n,a),uie[l]}var uie={incrementalPrepareRender:{progress:function(e,t){t.view.incrementalRender(e,t.model,t.ecModel,t.api,t.payload)}},render:{forceFirstProgress:!0,progress:function(e,t){t.view.render(t.model,t.ecModel,t.api,t.payload)}}},q_="\0__throttleOriginMethod",UR="\0__throttleRate",WR="\0__throttleType";function W1(e,t,r){var n,a=0,i=0,o=null,s,l,u,c;t=t||0;function h(){i=new Date().getTime(),o=null,e.apply(l,u||[])}var d=function(){for(var v=[],g=0;g=0?h():o=setTimeout(h,-s),a=n};return d.clear=function(){o&&(clearTimeout(o),o=null)},d.debounceNextCall=function(v){c=v},d}function Kd(e,t,r,n){var a=e[t];if(a){var i=a[q_]||a,o=a[WR],s=a[UR];if(s!==r||o!==n){if(r==null||!n)return e[t]=i;a=e[t]=W1(i,r,n==="debounce"),a[q_]=i,a[WR]=n,a[UR]=r}return a}}function Ug(e,t){var r=e[t];r&&r[q_]&&(r.clear&&r.clear(),e[t]=r[q_])}var ZR=Ze(),$R={itemStyle:Rc(HH,!0),lineStyle:Rc(GH,!0)},cie={lineStyle:"stroke",itemStyle:"fill"};function Z7(e,t){var r=e.visualStyleMapper||$R[t];return r||(console.warn("Unknown style type '"+t+"'."),$R.itemStyle)}function $7(e,t){var r=e.visualDrawType||cie[t];return r||(console.warn("Unknown style type '"+t+"'."),"fill")}var hie={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var r=e.getData(),n=e.visualStyleAccessPath||"itemStyle",a=e.getModel(n),i=Z7(e,n),o=i(a),s=a.getShallow("decal");s&&(r.setVisual("decal",s),s.dirty=!0);var l=$7(e,n),u=o[l],c=Me(u)?u:null,h=o.fill==="auto"||o.stroke==="auto";if(!o[l]||c||h){var d=e.getColorFromPalette(e.name,null,t.getSeriesCount());o[l]||(o[l]=d,r.setVisual("colorFromPalette",!0)),o.fill=o.fill==="auto"||Me(o.fill)?d:o.fill,o.stroke=o.stroke==="auto"||Me(o.stroke)?d:o.stroke}if(r.setVisual("style",o),r.setVisual("drawType",l),!t.isSeriesFiltered(e)&&c)return r.setVisual("colorFromPalette",!1),{dataEach:function(v,g){var m=e.getDataParams(g),y=te({},o);y[l]=c(m),v.setItemVisual(g,"style",y)}}}},Uv=new tt,fie={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var r=e.getData(),n=e.visualStyleAccessPath||"itemStyle",a=Z7(e,n),i=r.getVisual("drawType");return{dataEach:r.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[n]){Uv.option=l[n];var u=a(Uv),c=o.ensureUniqueItemVisual(s,"style");te(c,u),Uv.option.decal&&(o.setItemVisual(s,"decal",Uv.option.decal),Uv.option.decal.dirty=!0),i in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},die={performRawSeries:!0,overallReset:function(e){var t=pe();e.eachSeries(function(r){if(!r.isColorBySeries()){var n=r.type+"-"+r.getColorBy();ZR(r).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(r){if(!r.isColorBySeries()){var n=r.getRawData(),a={},i=r.getData(),o=ZR(r).scope,s=r.visualStyleAccessPath||"itemStyle",l=$7(r,s);i.each(function(u){var c=i.getRawIndex(u);a[c]=u}),n.each(function(u){var c=a[u],h=i.getItemVisual(c,"colorFromPalette");if(h){var d=i.ensureUniqueItemVisual(c,"style"),v=n.getName(u)||u+"",g=n.count();d[l]=r.getColorFromPalette(v,o,g)}})}})}},g0=Math.PI;function vie(e,t){t=t||{},Le(t,{text:"loading",textColor:K.color.primary,fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255,255,255,0.8)",showSpinner:!0,color:K.color.theme[0],spinnerRadius:10,lineWidth:5,zlevel:0});var r=new Ne,n=new Ke({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});r.add(n);var a=new ht({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),i=new Ke({style:{fill:"none"},textContent:a,textConfig:{position:"right",distance:10},zlevel:t.zlevel,z:10001});r.add(i);var o;return t.showSpinner&&(o=new Dm({shape:{startAngle:-g0/2,endAngle:-g0/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:"round",lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:g0*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:g0*3/2}).delay(300).start("circularInOut"),r.add(o)),r.resize=function(){var s=a.getBoundingRect().width,l=t.showSpinner?t.spinnerRadius:0,u=(e.getWidth()-l*2-(t.showSpinner&&s?10:0)-s)/2-(t.showSpinner&&s?0:5+s/2)+(t.showSpinner?0:s/2)+(s?0:l),c=e.getHeight()/2;t.showSpinner&&o.setShape({cx:u,cy:c}),i.setShape({x:u-l,y:c-l,width:l*2,height:l*2}),n.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},r.resize(),r}var Y7=function(){function e(t,r,n,a){this._stageTaskMap=pe(),this.ecInstance=t,this.api=r,n=this._dataProcessorHandlers=n.slice(),a=this._visualHandlers=a.slice(),this._allHandlers=n.concat(a)}return e.prototype.restoreData=function(t,r){t.restoreData(r),this._stageTaskMap.each(function(n){var a=n.overallTask;a&&a.dirty()})},e.prototype.getPerformArgs=function(t,r){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),a=n.context,i=!r&&n.progressiveEnabled&&(!a||a.progressiveRender)&&t.__idxInPipeline>n.blockIndex,o=i?n.step:null,s=a&&a.modDataCount,l=s!=null?Math.ceil(s/o):null;return{step:o,modBy:l,modDataCount:s}}},e.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},e.prototype.updateStreamModes=function(t,r){var n=this._pipelineMap.get(t.uid),a=t.__preparePipelineContext?t.__preparePipelineContext(r,n):WG(t,r,n);t.pipelineContext=n.context=a},e.prototype.restorePipelines=function(t,r){var n=this,a=n._pipelineMap=pe();r.eachSeries(function(i){var o=t.painter.type==="canvas"&&i.getProgressive(),s=i.uid;a.set(s,{id:s,head:null,tail:null,threshold:i.getProgressiveThreshold(),progressiveEnabled:o&&!(i.preventIncremental&&i.preventIncremental()),blockIndex:-1,step:Math.round(o||700),count:0}),n._pipe(i,i.dataTask)})},e.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,r=this.api.getModel(),n=this.api;j(this._allHandlers,function(a){var i=t.get(a.uid)||t.set(a.uid,{}),o="";fn(!(a.reset&&a.overallReset),o),a.reset&&this._createSeriesStageTask(a,i,r,n),a.overallReset&&this._createOverallStageTask(a,i,r,n)},this)},e.prototype.prepareView=function(t,r,n,a){var i=t.renderTask,o=i.context;o.model=r,o.ecModel=n,o.api=a,i.__block=!t.incrementalPrepareRender,this._pipe(r,i)},e.prototype.performDataProcessorTasks=function(t,r){this._performStageTasks(this._dataProcessorHandlers,t,r,{block:!0})},e.prototype.performVisualTasks=function(t,r,n){this._performStageTasks(this._visualHandlers,t,r,n)},e.prototype._performStageTasks=function(t,r,n,a){a=a||{};var i=!1,o=this;j(t,function(l,u){if(!(a.visualType&&a.visualType!==l.visualType)){var c=o._stageTaskMap.get(l.uid),h=c.seriesTaskMap,d=c.overallTask;if(d){var v,g=d.agentStubMap;g.each(function(y){s(a,y)&&(y.dirty(),v=!0)}),v&&d.dirty(),o.updatePayload(d,n);var m=o.getPerformArgs(d,a.block);g.each(function(y){y.perform(m)}),d.perform(m)&&(i=!0)}else h&&h.each(function(y,x){s(a,y)&&y.dirty();var _=o.getPerformArgs(y,a.block);_.skip=!l.performRawSeries&&r.isSeriesFiltered(y.context.model),o.updatePayload(y,n),y.perform(_)&&(i=!0)})}});function s(l,u){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(u.__pipeline.id))}this.unfinished=i||this.unfinished},e.prototype.performSeriesTasks=function(t){var r;t.eachSeries(function(n){r=n.dataTask.perform()||r}),this.unfinished=r||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(t){var r=t.tail;do{if(r.__block){t.blockIndex=r.__idxInPipeline;break}r=r.getUpstream()}while(r)})},e.prototype.updatePayload=function(t,r){r!=="remain"&&(t.context.payload=r)},e.prototype._createSeriesStageTask=function(t,r,n,a){var i=this,o=r.seriesTaskMap,s=r.seriesTaskMap=pe(),l=t.seriesType,u=t.getTargetSeries;t.createOnAllSeries?n.eachRawSeries(c):l?n.eachRawSeriesByType(l,c):u&&u(n,a).each(c);function c(h){var d=h.uid,v=s.set(d,o&&o.get(d)||rg({plan:xie,reset:_ie,count:wie}));v.context={model:h,ecModel:n,api:a,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:i},i._pipe(h,v)}},e.prototype._createOverallStageTask=function(t,r,n,a){var i=this,o=r.overallTask=r.overallTask||rg({reset:pie});o.context={ecModel:n,api:a,overallReset:t.overallReset,scheduler:i};var s=o.agentStubMap,l=o.agentStubMap=pe(),u=t.seriesType,c=t.getTargetSeries,h=t.dirtyOnOverallProgress,d=!1,v="";fn(!t.createOnAllSeries,v),u?n.eachRawSeriesByType(u,g):c?c(n,a).each(g):j(n.getSeries(),g);function g(m){var y=m.uid,x=l.set(y,s&&s.get(y)||(d=!0,rg({reset:gie,onDirty:yie})));x.context={model:m,dirtyOnOverallProgress:h},x.agent=o,x.__block=h,i._pipe(m,x)}d&&o.dirty()},e.prototype._pipe=function(t,r){var n=t.uid,a=this._pipelineMap.get(n);!a.head&&(a.head=r),a.tail&&a.tail.pipe(r),a.tail=r,r.__idxInPipeline=a.count++,r.__pipeline=a},e.wrapStageHandler=function(t,r){return Me(t)&&(t={overallReset:t,seriesType:Sie(t)}),t.uid=dh("stageHandler"),r&&(t.visualType=r),t},e}();function pie(e){e.overallReset(e.ecModel,e.api,e.payload)}function gie(e){return e.dirtyOnOverallProgress&&mie}function mie(){this.agent.dirty(),this.getDownstream().dirty()}function yie(){this.agent&&this.agent.dirty()}function xie(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function _ie(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=jt(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?oe(t,function(r,n){return X7(n)}):bie}var bie=X7(0);function X7(e){return function(t,r){var n=r.data,a=r.resetDefines[e];if(a&&a.dataEach)for(var i=t.start;i0&&v===u.length-d.length){var g=u.slice(0,v);g!=="data"&&(r.mainType=g,r[d.toLowerCase()]=l,c=!0)}}s.hasOwnProperty(u)&&(n[u]=l,c=!0),c||(a[u]=l)})}return{cptQuery:r,dataQuery:n,otherQuery:a}},e.prototype.filter=function(t,r){var n=this.eventInfo;if(!n)return!0;var a=n.targetEl,i=n.packedEvent,o=n.model,s=n.view;if(!o||!s)return!0;var l=r.cptQuery,u=r.dataQuery;return c(l,o,"mainType")&&c(l,o,"subType")&&c(l,o,"index","componentIndex")&&c(l,o,"name")&&c(l,o,"id")&&c(u,i,"name")&&c(u,i,"dataIndex")&&c(u,i,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(t,r.otherQuery,a,i));function c(h,d,v,g){return h[v]==null||d[g||v]===h[v]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),qM=["symbol","symbolSize","symbolRotate","symbolOffset"],qR=qM.concat(["symbolKeepAspect"]),Tie={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var r=e.getData();if(e.legendIcon&&r.setVisual("legendIcon",e.legendIcon),!e.hasSymbolVisual)return;for(var n={},a={},i=!1,o=0;o=0&&hc(l)?l:.5;var u=e.createRadialGradient(o,s,0,o,s,l);return u}function KM(e,t,r){for(var n=t.type==="radial"?Uie(e,t,r):Hie(e,t,r),a=t.colorStops,i=0;i0)?null:e==="dashed"?[4*t,2*t]:e==="dotted"?[t]:ft(e)?[e]:ne(e)?e:null}function LL(e){var t=e.style,r=t.lineDash&&t.lineWidth>0&&Zie(t.lineDash,t.lineWidth),n=t.lineDashOffset;if(r){var a=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;a&&a!==1&&(r=oe(r,function(i){return i/a}),n/=a)}return[r,n]}var $ie=new Po(!0);function Q_(e){var t=e.stroke;return!(t==null||t==="none"||!(e.lineWidth>0))}function KR(e){return typeof e=="string"&&e!=="none"}function eb(e){var t=e.fill;return t!=null&&t!=="none"}function JR(e,t){if(t.fillOpacity!=null&&t.fillOpacity!==1){var r=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=r}else e.fill()}function QR(e,t){if(t.strokeOpacity!=null&&t.strokeOpacity!==1){var r=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=r}else e.stroke()}function JM(e,t,r){var n=Gk(t.image,t.__image,r);if(I1(n)){var a=e.createPattern(n,t.repeat||"repeat");if(typeof DOMMatrix=="function"&&a&&a.setTransform){var i=new DOMMatrix;i.translateSelf(t.x||0,t.y||0),i.rotateSelf(0,0,(t.rotation||0)*Wp),i.scaleSelf(t.scaleX||1,t.scaleY||1),a.setTransform(i)}return a}}function Yie(e,t,r,n,a){var i,o=Q_(r),s=eb(r),l=r.strokePercent,u=l<1,c=!t.path;(!t.silent||u)&&c&&t.createPathProxy();var h=t.path||$ie,d=t.__dirty;if(!n){var v=r.fill,g=r.stroke,m=s&&!!v.colorStops,y=o&&!!g.colorStops,x=s&&!!v.image,_=o&&!!g.image,w=void 0,S=void 0,C=void 0,M=void 0,A=void 0;(m||y)&&(A=t.getBoundingRect()),m&&(w=d?KM(e,v,A):t.__canvasFillGradient,t.__canvasFillGradient=w),y&&(S=d?KM(e,g,A):t.__canvasStrokeGradient,t.__canvasStrokeGradient=S),x&&(C=d||!t.__canvasFillPattern?JM(e,v,t):t.__canvasFillPattern,t.__canvasFillPattern=C),_&&(M=d||!t.__canvasStrokePattern?JM(e,g,t):t.__canvasStrokePattern,t.__canvasStrokePattern=M),m?e.fillStyle=w:x&&(C?e.fillStyle=C:s=!1),y?e.strokeStyle=S:_&&(M?e.strokeStyle=M:o=!1)}var I=t.getGlobalScale();h.setScale(I[0],I[1],t.segmentIgnoreThreshold);var k,P;e.setLineDash&&r.lineDash&&(i=LL(t),k=i[0],P=i[1]);var D=!0;(c||d&ff)&&(h.setDPR(e.dpr),u?h.setContext(null):(h.setContext(e),D=!1),h.reset(),t.buildPath(h,t.shape,n),h.toStatic(),t.pathUpdated()),D&&h.rebuildPath(e,u?l:1),k&&(e.setLineDash(k),e.lineDashOffset=P),n?(a.batchFill=s,a.batchStroke=o):r.strokeFirst?(o&&QR(e,r),s&&JR(e,r)):(s&&JR(e,r),o&&QR(e,r)),k&&e.setLineDash([])}function Xie(e,t,r){var n=t.__image=Gk(r.image,t.__image,t,t.onload);if(!(!n||!I1(n))){var a=r.x||0,i=r.y||0,o=t.getWidth(),s=t.getHeight(),l=n.width/n.height;if(o==null&&s!=null?o=s*l:s==null&&o!=null?s=o/l:o==null&&s==null&&(o=n.width,s=n.height),r.sWidth&&r.sHeight){var u=r.sx||0,c=r.sy||0;e.drawImage(n,u,c,r.sWidth,r.sHeight,a,i,o,s)}else if(r.sx&&r.sy){var u=r.sx,c=r.sy,h=o-u,d=s-c;e.drawImage(n,u,c,h,d,a,i,o,s)}else e.drawImage(n,a,i,o,s)}}function qie(e,t,r){var n,a=r.text;if(a!=null&&(a+=""),a){e.font=r.font||Ss,e.textAlign=r.textAlign,e.textBaseline=r.textBaseline;var i=void 0,o=void 0;e.setLineDash&&r.lineDash&&(n=LL(t),i=n[0],o=n[1]),i&&(e.setLineDash(i),e.lineDashOffset=o),r.strokeFirst?(Q_(r)&&e.strokeText(a,r.x,r.y),eb(r)&&e.fillText(a,r.x,r.y)):(eb(r)&&e.fillText(a,r.x,r.y),Q_(r)&&e.strokeText(a,r.x,r.y)),i&&e.setLineDash([])}}var eO=["shadowBlur","shadowOffsetX","shadowOffsetY"],tO=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function oU(e,t,r,n,a){var i=!1;if(!n&&(r=r||{},t===r))return!1;if(n||t.opacity!==r.opacity){Bn(e,a),i=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?gc.opacity:o}(n||t.blend!==r.blend)&&(i||(Bn(e,a),i=!0),e.globalCompositeOperation=t.blend||gc.blend);for(var s=0;s0&&r.unfinished);r.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(r,n,a){if(!this[kr]){if(this._disposed){this.id;return}var i,o,s;if(Ie(n)&&(a=n.lazyUpdate,i=n.silent,o=n.replaceMerge,s=n.transition,n=n.notMerge),this[kr]=!0,Kh(this),!this._model||n){var l=new oae(this._api),u=this._theme,c=this._model=new CL;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,u,this._locale,l)}this._model.setOption(r,{replaceMerge:o},rA);var h={seriesTransition:s,optionChanged:!0};if(a)this[Zr]={silent:i,updateParams:h},this[kr]=!1,this.getZr().wakeUp();else{try{Ru(this),qo.update.call(this,null,h)}catch(d){throw this[Zr]=null,this[kr]=!1,d}this._ssr||this._zr.flush(),this[Zr]=null,this[kr]=!1,Xh.call(this,i),qh.call(this,i)}}},t.prototype.setTheme=function(r,n){if(!this[kr]){if(this._disposed){this.id;return}var a=this._model;if(a){var i=n&&n.silent,o=null;this[Zr]&&(i==null&&(i=this[Zr].silent),o=this[Zr].updateParams,this[Zr]=null),this[kr]=!0,Kh(this);try{this._updateTheme(r),a.setTheme(this._theme),Ru(this),qo.update.call(this,{type:"setTheme"},o)}catch(s){throw this[kr]=!1,s}this[kr]=!1,Xh.call(this,i),qh.call(this,i)}}},t.prototype._updateTheme=function(r){ue(r)&&(r=bU[r]),r&&(r=Te(r),r&&b7(r,!0),this._theme=r)},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||ot.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(r){return this.renderToCanvas(r)},t.prototype.renderToCanvas=function(r){r=r||{};var n=this._zr.painter;return n.getRenderedCanvas({backgroundColor:r.backgroundColor||this._model.get("backgroundColor"),pixelRatio:r.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(r){r=r||{};var n=this._zr.painter;return n.renderToString({useViewBox:r.useViewBox})},t.prototype.getSvgDataURL=function(){var r=this._zr,n=r.storage.getDisplayList();return j(n,function(a){a.stopAnimation(null,!0)}),r.painter.toDataURL()},t.prototype.getDataURL=function(r){if(this._disposed){this.id;return}r=r||{};var n=r.excludeComponents,a=this._model,i=[],o=this;j(n,function(l){a.eachComponent({mainType:l},function(u){var c=o._componentsMap[u.__viewId];c.group.ignore||(i.push(c),c.group.ignore=!0)})});var s=this._zr.painter.getType()==="svg"?this.getSvgDataURL():this.renderToCanvas(r).toDataURL("image/"+(r&&r.type||"png"));return j(i,function(l){l.group.ignore=!1}),s},t.prototype.getConnectedDataURL=function(r){if(this._disposed){this.id;return}var n=r.type==="svg",a=this.group,i=Math.min,o=Math.max,s=1/0;if(ab[a]){var l=s,u=s,c=-s,h=-s,d=[],v=r&&r.pixelRatio||this.getDevicePixelRatio();j(_c,function(w,S){if(w.group===a){var C=n?w.getZr().painter.getSvgDom().innerHTML:w.renderToCanvas(Te(r)),M=w.getDom().getBoundingClientRect();l=i(M.left,l),u=i(M.top,u),c=o(M.right,c),h=o(M.bottom,h),d.push({dom:C,left:M.left,top:M.top})}}),l*=v,u*=v,c*=v,h*=v;var g=c-l,m=h-u,y=Vr.createCanvas(),x=_M(y,{renderer:n?"svg":"canvas"});if(x.resize({width:g,height:m}),n){var _="";return j(d,function(w){var S=w.left-l,C=w.top-u;_+=''+w.dom+""}),x.painter.getSvgRoot().innerHTML=_,r.connectedBackgroundColor&&x.painter.setBackgroundColor(r.connectedBackgroundColor),x.refreshImmediately(),x.painter.toDataURL()}else return r.connectedBackgroundColor&&x.add(new Ke({shape:{x:0,y:0,width:g,height:m},style:{fill:r.connectedBackgroundColor}})),j(d,function(w){var S=new Ur({style:{x:w.left*v-l,y:w.top*v-u,image:w.dom}});x.add(S)}),x.refreshImmediately(),y.toDataURL("image/"+(r&&r.type||"png"))}else return this.getDataURL(r)},t.prototype.convertToPixel=function(r,n,a){return _0(this,"convertToPixel",r,n,a)},t.prototype.convertToLayout=function(r,n,a){return _0(this,"convertToLayout",r,n,a)},t.prototype.convertFromPixel=function(r,n,a){return _0(this,"convertFromPixel",r,n,a)},t.prototype.containPixel=function(r,n){if(this._disposed){this.id;return}var a=this._model,i,o=Wf(a,r);return j(o,function(s,l){l.indexOf("Models")>=0&&j(s,function(u){var c=u.coordinateSystem;if(c&&c.containPoint)i=i||!!c.containPoint(n);else if(l==="seriesModels"){var h=this._chartsMap[u.__viewId];h&&h.containPoint&&(i=i||h.containPoint(n,u))}},this)},this),!!i},t.prototype.getVisual=function(r,n){var a=this._model,i=Wf(a,r,{defaultMainType:"series"}),o=i.seriesModel,s=o.getData(),l=i.hasOwnProperty("dataIndexInside")?i.dataIndexInside:i.hasOwnProperty("dataIndex")?s.indexOfRawIndex(i.dataIndex):null;return l!=null?kL(s,l,n):zm(s,n)},t.prototype.getViewOfComponentModel=function(r){return this._componentsMap[r.__viewId]},t.prototype.getViewOfSeriesModel=function(r){return this._chartsMap[r.__viewId]},t.prototype._initEvents=function(){var r=this;j(boe,function(a){var i=function(o){var s=r.getModel(),l=o.target,u,c=a==="globalout";if(c?u={}:l&&cc(l,function(m){var y=Ee(m);if(y&&y.dataIndex!=null){var x=y.dataModel||s.getSeriesByIndex(y.seriesIndex);return u=x&&x.getDataParams(y.dataIndex,y.dataType,l)||{},!0}else if(y.eventData)return u=te({},y.eventData),!0},!0),u){var h=u.componentType,d=u.componentIndex;(h==="markLine"||h==="markPoint"||h==="markArea")&&(h="series",d=u.seriesIndex);var v=h&&d!=null&&s.getComponent(h,d),g=v&&r[v.mainType==="series"?"_chartsMap":"_componentsMap"][v.__viewId];u.event=o,u.type=a,r._$eventProcessor.eventInfo={targetEl:l,packedEvent:u,model:v,view:g},r.trigger(a,u)}};i.zrEventfulCallAtLast=!0,r._zr.on(a,i,r)});var n=this._messageCenter;j(eA,function(a,i){n.on(i,function(o){r.trigger(i,o)})}),Aie(n,this,this._api)},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0;var r=this.getDom();r&&VG(this.getDom(),EL,"");var n=this,a=n._api,i=n._model;j(n._componentsViews,function(o){o.dispose(i,a)}),j(n._chartsViews,function(o){o.dispose(i,a)}),n._zr.dispose(),n._dom=n._model=n._chartsMap=n._componentsMap=n._chartsViews=n._componentsViews=n._scheduler=n._api=n._zr=n._throttledZrFlush=n._theme=n._coordSysMgr=n._messageCenter=null,delete _c[n.id]},t.prototype.resize=function(r){if(!this[kr]){if(this._disposed){this.id;return}this._zr.resize(r);var n=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!n){var a=n.resetOption("media"),i=r&&r.silent;this[Zr]&&(i==null&&(i=this[Zr].silent),a=!0,this[Zr]=null),this[kr]=!0,Kh(this);try{a&&Ru(this),qo.update.call(this,{type:"resize",animation:te({duration:0},r&&r.animation)})}catch(o){throw this[kr]=!1,o}this[kr]=!1,Xh.call(this,i),qh.call(this,i)}}},t.prototype.showLoading=function(r,n){if(this._disposed){this.id;return}if(Ie(r)&&(n=r,r=""),r=r||"default",this.hideLoading(),!!nA[r]){var a=nA[r](this._api,n),i=this._zr;this._loadingFX=a,i.add(a)}},t.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},t.prototype.makeActionFromEvent=function(r){var n=te({},r);return n.type=QM[r.type],n},t.prototype.dispatchAction=function(r,n){if(this._disposed){this.id;return}if(Ie(n)||(n={silent:!!n}),!!rb[r.type]&&this._model){if(this[kr]){this._pendingActions.push(r);return}var a=n.silent;dC.call(this,r,a);var i=n.flush;i?this._zr.flush():i!==!1&&ot.browser.weChat&&this._throttledZrFlush(),Xh.call(this,a),qh.call(this,a)}},t.prototype.updateLabelLayout=function(){Ba.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(r){if(this._disposed){this.id;return}var n=r.seriesIndex,a=this.getModel(),i=a.getSeriesByIndex(n);i.appendData(r),this._scheduler.unfinished=!0,this.getZr().wakeUp()},t.internalField=function(){Ru=function(h){Lie(h._model);var d=h._scheduler;d.restorePipelines(h._zr,h._model),d.prepareStageTasks(),hC(h,!0),hC(h,!1),d.plan()},hC=function(h,d){for(var v=h._model,g=h._scheduler,m=d?h._componentsViews:h._chartsViews,y=d?h._componentsMap:h._chartsMap,x=h._zr,_=h._api,w=0;w_e(d.get("hoverLayerThreshold"),v7.hoverLayerThreshold)&&!ot.node&&!ot.worker;(h._usingTHL||y)&&(d.eachSeries(function(x){if(!x.preventUsingHoverLayer){var _=h._chartsMap[x.__viewId];_.__alive&&_.eachRendered(function(w){var S=w.states.emphasis;S&&S.hoverLayer!==Zd&&(S.hoverLayer=y?IH:LH)})}}),h._usingTHL=y)}}function s(h,d){var v=h.get("blendMode")||null;d.eachRendered(function(g){g.isGroup||(g.style.blend=v)})}function l(h,d){if(!h.preventAutoZ){var v=Bc(h);d.eachRendered(function(g){return B1(g,v.z,v.zlevel),!0})}}function u(h,d){d.eachRendered(function(v){if(!Zf(v)){var g=v.getTextContent(),m=v.getTextGuideLine();v.stateTransition&&(v.stateTransition=null),g&&g.stateTransition&&(g.stateTransition=null),m&&m.stateTransition&&(m.stateTransition=null),v.hasState()?(v.prevStates=v.currentStates,v.clearStates()):v.prevStates&&(v.prevStates=null)}})}function c(h,d){var v=h.getModel("stateAnimation"),g=h.isAnimationEnabled(),m=v.get("duration"),y=m>0?{duration:m,delay:v.get("delay"),easing:v.get("easing")}:null;d.eachRendered(function(x){if(x.states&&x.states.emphasis){if(Zf(x))return;if(x instanceof rt&&Ere(x),x.__dirty){var _=x.prevStates;_&&x.useStates(_)}if(g){x.stateTransition=y;var w=x.getTextContent(),S=x.getTextGuideLine();w&&(w.stateTransition=y),S&&(S.stateTransition=y)}x.__dirty&&i(x)}})}pO=function(h){return new(function(d){X(v,d);function v(){return d!==null&&d.apply(this,arguments)||this}return v.prototype.getCoordinateSystems=function(){return h._coordSysMgr.getCoordinateSystems()},v.prototype.getComponentByElement=function(g){for(;g;){var m=g.__ecComponentInfo;if(m!=null)return h._model.getComponent(m.mainType,m.index);g=g.parent}},v.prototype.enterEmphasis=function(g,m){As(g,m),Ea(h)},v.prototype.leaveEmphasis=function(g,m){Ns(g,m),Ea(h)},v.prototype.enterBlur=function(g){dH(g),Ea(h)},v.prototype.leaveBlur=function(g){Yk(g),Ea(h)},v.prototype.enterSelect=function(g){vH(g),Ea(h)},v.prototype.leaveSelect=function(g){pH(g),Ea(h)},v.prototype.getModel=function(){return h.getModel()},v.prototype.getViewOfComponentModel=function(g){return h.getViewOfComponentModel(g)},v.prototype.getViewOfSeriesModel=function(g){return h.getViewOfSeriesModel(g)},v.prototype.getECUpdateCycleVersion=function(){return h[y0]},v.prototype.usingTHL=function(){return h._usingTHL},v}(sH))(h)},_U=function(h){function d(v,g){for(var m=0;m=0)){mO.push(r);var o=Y7.wrapStageHandler(r,a);o.__prio=t,o.__raw=r,e.push(o)}}function FL(e,t){nA[e]=t}function Ioe(e){UV({createCanvas:e})}function AU(e,t,r){var n=rU("registerMap");n&&n(e,t,r)}function Poe(e){var t=rU("getMap");return t&&t(e)}var NU=Bae;ou(PL,hie);ou($1,fie);ou($1,die);ou(PL,Tie);ou($1,Mie);ou(dU,aoe);OL(b7);zL(coe,yae);FL("default",vie);zi({type:mc,event:mc,update:mc},ar);zi({type:Ox,event:Ox,update:Ox},ar);zi({type:V_,event:Zk,update:V_,action:ar,refineEvent:VL,publishNonRefinedEvent:!0});zi({type:LM,event:Zk,update:LM,action:ar,refineEvent:VL,publishNonRefinedEvent:!0});zi({type:G_,event:Zk,update:G_,action:ar,refineEvent:VL,publishNonRefinedEvent:!0});function VL(e,t,r,n){return{eventContent:{selected:kre(r),isFromClick:t.isFromClick||!1}}}RL("default",{});RL("dark",J7);var Doe={},yO=[],Eoe={registerPreprocessor:OL,registerProcessor:zL,registerPostInit:SU,registerPostUpdate:CU,registerUpdateLifecycle:Y1,registerAction:zi,registerCoordinateSystem:TU,registerLayout:MU,registerVisual:ou,registerTransform:NU,registerLoading:FL,registerMap:AU,registerImpl:Nie,PRIORITY:vU,ComponentModel:Qe,ComponentView:Rt,SeriesModel:Pt,ChartView:At,registerComponentModel:function(e){Qe.registerClass(e)},registerComponentView:function(e){Rt.registerClass(e)},registerSeriesModel:function(e){Pt.registerClass(e)},registerChartView:function(e){At.registerClass(e)},registerCustomSeries:function(e,t){aU(e,t)},registerSubTypeDefaulter:function(e,t){Qe.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){NG(e,t)}};function $e(e){if(ne(e)){j(e,function(t){$e(t)});return}Ve(yO,e)>=0||(yO.push(e),Me(e)&&(e={install:e}),e.install(Eoe))}function Zv(e){return e==null?0:e.length||1}function xO(e){return e}var ks=function(){function e(t,r,n,a,i,o){this._old=t,this._new=r,this._oldKeyGetter=n||xO,this._newKeyGetter=a||xO,this.context=i,this._diffModeMultiple=o==="multiple"}return e.prototype.add=function(t){return this._add=t,this},e.prototype.update=function(t){return this._update=t,this},e.prototype.updateManyToOne=function(t){return this._updateManyToOne=t,this},e.prototype.updateOneToMany=function(t){return this._updateOneToMany=t,this},e.prototype.updateManyToMany=function(t){return this._updateManyToMany=t,this},e.prototype.remove=function(t){return this._remove=t,this},e.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},e.prototype._executeOneToOne=function(){var t=this._old,r=this._new,n={},a=new Array(t.length),i=new Array(r.length);this._initIndexMap(t,null,a,"_oldKeyGetter"),this._initIndexMap(r,n,i,"_newKeyGetter");for(var o=0;o1){var c=l.shift();l.length===1&&(n[s]=l[0]),this._update&&this._update(c,o)}else u===1?(n[s]=null,this._update&&this._update(l,o)):this._remove&&this._remove(o)}this._performRestAdd(i,n)},e.prototype._executeMultiple=function(){var t=this._old,r=this._new,n={},a={},i=[],o=[];this._initIndexMap(t,n,i,"_oldKeyGetter"),this._initIndexMap(r,a,o,"_newKeyGetter");for(var s=0;s1&&d===1)this._updateManyToOne&&this._updateManyToOne(c,u),a[l]=null;else if(h===1&&d>1)this._updateOneToMany&&this._updateOneToMany(c,u),a[l]=null;else if(h===1&&d===1)this._update&&this._update(c,u),a[l]=null;else if(h>1&&d>1)this._updateManyToMany&&this._updateManyToMany(c,u),a[l]=null;else if(h>1)for(var v=0;v1)for(var s=0;s30}var $v=Ie,Ys=oe,Foe=typeof Int32Array>"u"?Array:Int32Array,Voe="e\0\0",_O=-1,Goe=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],Hoe=["_approximateExtent"],bO,w0,Yv,Xv,gC,qv,mC,Nn=function(){function e(t,r){this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var n,a=!1;LU(t)?(n=t.dimensions,this._dimOmitted=t.isDimensionOmitted(),this._schema=t):(a=!0,n=t),n=n||["x","y"];for(var i={},o=[],s={},l=!1,u={},c=0;c=r)){var n=this._store,a=n.getProvider();this._updateOrdinalMeta();var i=this._nameList,o=this._idList,s=a.getSource().sourceFormat,l=s===ka;if(l&&!a.pure)for(var u=[],c=t;c0},e.prototype.ensureUniqueItemVisual=function(t,r){var n=this._itemVisuals,a=n[t];a||(a=n[t]={});var i=a[r];return i==null&&(i=this.getVisual(r),ne(i)?i=i.slice():$v(i)&&(i=te({},i)),a[r]=i),i},e.prototype.setItemVisual=function(t,r,n){var a=this._itemVisuals[t]||{};this._itemVisuals[t]=a,$v(r)?te(a,r):a[r]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(t,r){$v(t)?te(this._layout,t):this._layout[t]=r},e.prototype.getLayout=function(t){return this._layout[t]},e.prototype.getItemLayout=function(t){return this._itemLayouts[t]},e.prototype.setItemLayout=function(t,r,n){this._itemLayouts[t]=n?te(this._itemLayouts[t]||{},r):r},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(t,r){var n=this.hostModel&&this.hostModel.seriesIndex;kM(n,this.dataType,t,r),this._graphicEls[t]=r},e.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},e.prototype.eachItemGraphicEl=function(t,r){j(this._graphicEls,function(n,a){n&&t&&t.call(r,n,a)})},e.prototype.cloneShallow=function(t){return t||(t=new e(this._schema?this._schema:Ys(this.dimensions,this._getDimInfo,this),this.hostModel)),gC(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(t,r){var n=this[t];Me(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var a=n.apply(this,arguments);return r.apply(this,[a].concat(_1(arguments)))})},e.internalField=function(){bO=function(t){var r=t._invertedIndicesMap;j(r,function(n,a){var i=t._dimInfos[a],o=i.ordinalMeta,s=t._store;if(o){n=r[a]=new Foe(o.categories.length);for(var l=0;l1&&(l+="__ec__"+c),a[r]=l}}}(),e}();function Uoe(e,t){return ev(e,t).dimensions}function ev(e,t){TL(e)||(e=ML(e)),t=t||{};var r=t.coordDimensions||[],n=t.dimensionsDefine||e.dimensionsDefine||[],a=pe(),i=[],o=Woe(e,r,n,t.dimensionsCount),s=t.canOmitUnusedDimensions&&PU(o),l=n===e.dimensionsDefine,u=l?IU(e):GL(n),c=t.encodeDefine;!c&&t.encodeDefaulter&&(c=t.encodeDefaulter(e,o));for(var h=pe(c),d=new E7(o),v=0;v0&&(k.name=k.name+(P-1))}),new kU({source:e,dimensions:i,fullDimensionCount:o,dimensionOmitted:s})}function Woe(e,t,r,n){var a=Math.max(e.dimensionsDetectedCount||1,t.length,r.length,n||0);return j(t,function(i){var o;Ie(i)&&(o=i.dimsDef)&&(a=Math.max(a,o.length))}),a}function Zoe(e,t,r){if(r||t.hasKey(e)){for(var n=0;t.hasKey(e+n);)n++;e+=n}return t.set(e,!0),e}var $oe=function(){function e(t){this.coordSysDims=[],this.axisMap=pe(),this.categoryAxisMap=pe(),this.coordSysName=t}return e}();function Yoe(e){var t=e.get("coordinateSystem"),r=new $oe(t),n=Xoe[t];if(n)return n(e,r,r.axisMap,r.categoryAxisMap),r}var Xoe={cartesian2d:function(e,t,r,n){var a=e.getReferringComponents("xAxis",sr).models[0],i=e.getReferringComponents("yAxis",sr).models[0];t.coordSysDims=["x","y"],r.set("x",a),r.set("y",i),Jh(a)&&(n.set("x",a),t.firstCategoryDimIndex=0),Jh(i)&&(n.set("y",i),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=1))},singleAxis:function(e,t,r,n){var a=e.getReferringComponents("singleAxis",sr).models[0];t.coordSysDims=["single"],r.set("single",a),Jh(a)&&(n.set("single",a),t.firstCategoryDimIndex=0)},polar:function(e,t,r,n){var a=e.getReferringComponents("polar",sr).models[0],i=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");t.coordSysDims=["radius","angle"],r.set("radius",i),r.set("angle",o),Jh(i)&&(n.set("radius",i),t.firstCategoryDimIndex=0),Jh(o)&&(n.set("angle",o),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=1))},geo:function(e,t,r,n){t.coordSysDims=["lng","lat"]},parallel:function(e,t,r,n){var a=e.ecModel,i=a.getComponent("parallel",e.get("parallelIndex")),o=t.coordSysDims=i.dimensions.slice();j(i.parallelAxisIndex,function(s,l){var u=a.getComponent("parallelAxis",s),c=o[l];r.set(c,u),Jh(u)&&(n.set(c,u),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=l))})},matrix:function(e,t,r,n){var a=e.getReferringComponents("matrix",sr).models[0];t.coordSysDims=["x","y"];var i=a.getDimensionModel("x"),o=a.getDimensionModel("y");r.set("x",i),r.set("y",o),n.set("x",i),n.set("y",o)}};function Jh(e){return e.get("type")==="category"}function DU(e,t,r){r=r||{};var n=r.byIndex,a=r.stackedCoordDimension,i,o,s;qoe(t)?i=t:(o=t.schema,i=o.dimensions,s=t.store);var l=!!(e&&e.get("stack")),u,c,h,d,v=!0;function g(S){return S.type!=="ordinal"&&S.type!=="time"}if(j(i,function(S,C){ue(S)&&(i[C]=S={name:S}),g(S)||(v=!1)}),j(i,function(S,C){l&&!S.isExtraCoord&&(!n&&!u&&S.ordinalMeta&&(u=S),!c&&g(S)&&(!v||S.coordDim!=="x"&&S.coordDim!=="angle")&&(!a||a===S.coordDim)&&(c=S))}),c&&!n&&!u&&(n=!0),c){h="__\0ecstackresult_"+e.id,d="__\0ecstackedover_"+e.id,u&&(u.createInvertedIndices=!0);var m=c.coordDim,y=c.type,x=0;j(i,function(S){S.coordDim===m&&x++});var _={name:h,coordDim:m,coordDimIndex:x,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},w={name:d,coordDim:d,coordDimIndex:x+1,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};o?(s&&(_.storeDimIndex=s.ensureCalculationDimension(d,y),w.storeDimIndex=s.ensureCalculationDimension(h,y)),o.appendCalculationDimension(_),o.appendCalculationDimension(w)):(i.push(_),i.push(w))}return{stackedDimension:c&&c.name,stackedByDimension:u&&u.name,isStackedByIndex:n,stackedOverDimension:d,stackResultDimension:h}}function qoe(e){return!LU(e.schema)}function Ls(e,t){return!!t&&t===e.getCalculationInfo("stackedDimension")}function HL(e,t){return Ls(e,t)?e.getCalculationInfo("stackResultDimension"):t}function Koe(e,t){var r=e.get("coordinateSystem"),n=qd.get(r),a;return t&&t.coordSysDims&&(a=oe(t.coordSysDims,function(i){var o={name:i},s=t.axisMap.get(i);if(s){var l=s.get("type");o.type=ib(l)}return o})),a||(a=n&&(n.getDimensionsInfo?n.getDimensionsInfo():n.dimensions.slice())||["x","y"]),a}function Joe(e,t,r){var n,a;return r&&j(e,function(i,o){var s=i.coordDim,l=r.categoryAxisMap.get(s);l&&(n==null&&(n=o),i.ordinalMeta=l.getOrdinalMeta(),t&&(i.createInvertedIndices=!0)),i.otherDims.itemName!=null&&(a=!0)}),!a&&n!=null&&(e[n].otherDims.itemName=0),n}function Go(e,t,r){r=r||{};var n=t.getSourceManager(),a,i=!1;e?(i=!0,a=ML(e)):(a=n.getSource(),i=a.sourceFormat===ka);var o=Yoe(t),s=Koe(t,o),l=r.useEncodeDefaulter,u=Me(l)?l:l?Xe(g7,s,t):null,c={coordDimensions:s,generateCoord:r.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!i},h=ev(a,c),d=Joe(h.dimensions,r.createInvertedIndices,o),v=i?null:n.getSharedDataStore(h),g=DU(t,{schema:h,store:v}),m=new Nn(h,t);m.setCalculationInfo(g);var y=d!=null&&Qoe(a)?function(x,_,w,S){return S===d?w:this.defaultDimValueGetter(x,_,w,S)}:null;return m.hasItemOption=!1,m.initData(i?a:v,null,y),m}function Qoe(e){if(e.sourceFormat===ka){var t=ese(e.data||[]);return!ne(zd(t))}}function ese(e){for(var t=0;t=t[0]&&e<=t[1]},getExtent:function(){return this._extents[ea].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){wO(this._extents,ea,e,t)},setExtent2:function(e,t,r){var n=this._extents;n[e]||(n[e]=n[ea].slice()),wO(n,e,t,r)},freeze:function(){}};function wO(e,t,r,n){jc(r,n)&&(e[t][0]=r,e[t][1]=n)}function RU(e){return sb(e)||md(e)}function sb(e){return e.type==="interval"}function Bm(e){return e.type==="time"}function md(e){return e.type==="log"}function Ln(e){return e.type==="ordinal"}function ose(e){var t=A1(e),r=uh(10,t),n=Lo(e/r);return n?n===2?n=3:n===3?n=5:n*=2:n=1,gt(n*r,-t)}function Vc(e){return so(e)+2}function S0(e,t){return Ic(e)/Ic(t)}function yC(e,t,r){var n=r&&r.lookup;if(n){for(var a=0;a1&&i/o>2&&(a=Math.round(Math.ceil(a/o)*o)),a!==n[0]&&l(n[0],!0,!0);for(var s=a;s<=n[1];s+=o)l(s,!1,s===n[0]||s===n[1]);s-o!==n[1]&&l(n[1],!0,!0);function l(u,c,h){r({value:u,offInterval:c},h)}}var Xg=function(e){X(t,e);function t(r){var n=e.call(this)||this;n.type="ordinal",n.parse=t.parse,WL(n,t.decoratedMethods);var a=r.ordinalMeta;a||(a=new Zg({})),ne(a)&&(a=new Zg({categories:oe(a,function(o){return Ie(o)?o.value:o})})),n._ordinalMeta=a;var i=UL(null,null,r.extent||[0,a.categories.length-1]);return n._mapper=i.mapper,ZL(n),n}return t.parse=function(r){return r==null?r=NaN:ue(r)?(r=this._ordinalMeta.getOrdinal(r),r==null&&(r=NaN)):r=Lo(r),r},t.prototype.getTicks=function(){var r=[];return zU(this,0,function(n){r.push(n)}),r},t.prototype.getMinorTicks=function(r){},t.prototype.setSortInfo=function(r){if(r==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var n=r.ordinalNumbers,a=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=Mt(s,n.length);o=0&&r=0&&r=0&&ro[0]&&mo[1]||!isFinite(m)||!isFinite(o[1]))break}else{if(y>g)break;m=Mt(m,o[1]),y===g&&(m=o[1])}if(h.push({value:m}),m=gt(m+a,s),u){var x=u.calcNiceTickMultiple(m,v);x>=0&&(m=gt(m+x*a,s))}if(h.length>0&&m===h[h.length-1].value)break;if(h.length>d)return[]}var _=h.length?h[h.length-1].value:o[1];return i[1]>_&&h.push({value:r.expandToNicedExtent?gt(_+a,s):i[1]}),c&&l.pruneTicksByBreak(r.pruneByBreak,h,u.breaks,function(w){return w.value},n.interval,i),c&&r.breakTicks!=="none"&&l.addBreaksToTicks(h,u.breaks,i),h},t.prototype.getMinorTicks=function(r){return $L(this,r,Z_(this),this._cfg.interval)},t.prototype.getLabel=function(r,n){if(r==null)return"";var a=n&&n.precision;a==null?a=so(r.value)||0:a==="auto"&&(a=this._cfg.intervalPrecision);var i=gt(r.value,a,!0);return mL(i)},t.type="interval",t}(Bi);Bi.registerClass(Dl);var lse=function(e,t,r,n){for(;r>>1;e[a][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function cse(e){var t=30*$a;return e/=t,e>6?6:e>3?3:e>2?2:1}function hse(e){return e/=eg,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function SO(e,t){return e/=t?cL:uL,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function fse(e){return qe(N1(e,!0),1)}function dse(e,t,r){var n=Math.max(0,Ve(ga,t)-1);return Y_(new Date(e),ga[n],r).getTime()}function vse(e,t){var r=new Date(0);r[e](1);var n=r.getTime();r[e](1+t);var a=r.getTime()-n;return function(i,o){return Math.max(0,Math.round((o-i)/a))}}function pse(e,t,r,n,a,i){var o=3e3,s=Ine,l=0;function u(V,U,F,Z,$,W,q){for(var re=vse($,V),Q=U,se=new Date(Q);Qo));)if(se[$](se[Z]()+V),Q=se.getTime(),i){var ce=i.calcNiceTickMultiple(Q,re);ce>0&&(se[$](se[Z]()+ce*V),Q=se.getTime())}q.push({value:Q,notAdd:Q>n[1]})}function c(V,U,F){var Z=[],$=!U.length;if(!FU(tg(V),n[0],n[1],r)){$&&(U=[{value:dse(n[0],V,r)},{value:n[1]}]);for(var W=0;W=n[0]&&q<=n[1]&&u(Q,q,re,se,ce,Ue,Z),V==="year"&&F.length>1&&W===0&&F.unshift({value:F[0].value-Q})}}for(var W=0;W=n[0]&&S<=n[1]&&v++)}var C=a/t;if(v>C*1.5&&g>C/1.5||(h.push(_),v>C||e===s[m]))break}d=[]}}}for(var M=wt(oe(h,function(V){return wt(V,function(U){return U.value>=n[0]&&U.value<=n[1]&&!U.notAdd})}),function(V){return V.length>0}),A=M.length-1,I=[],m=0;mn[0])&&I.unshift({value:n[0],time:{level:0,upperTimeUnit:B,lowerTimeUnit:B},notNice:!0}),(!E||E.values&&(i=s);var l=C0.length,u=Math.min(lse(C0,i,0,l),l-1),c=C0[u][1],h=C0[Math.max(u-1,0)][0];e.setTimeInterval({approxInterval:i,interval:c,minLevelUnit:h})};Bi.registerClass(BU);var T0=0,M0=1,mse=2,VU=function(e){X(t,e);function t(r){var n=e.call(this)||this;n.type="log",n.parse=Dl.parse,n.base=r.logBase||10;var a=[],i=[],o=n._lookup={from:a,to:i};a[T0]=a[M0]=i[T0]=i[M0]=NaN,WL(n,t.mapperMethods);var s=xr(),l=r.breakOption,u={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(l,n,{noNegative:!0},mse,u),n.powStub=new Dl({breakParsed:u.original}),n.intervalStub=new Dl({breakParsed:u.transformed}),ZL(n,n.intervalStub),n}return t.prototype.getTicks=function(r){var n=this.base,a=this.powStub,i=xr(),o=this.intervalStub,s=o.getExtent(),l=a.getExtent(),u={lookup:{from:s,to:l}};return oe(o.getTicks(r||{}),function(c){var h=c.value,d=yC(h,n,u),v;if(i){var g=i.getTicksBreakOutwardTransform(this,c,Z_(a),this._lookup);g&&(v=g.vBreak,d=g.tickVal)}return{value:d,break:v}},this)},t.prototype.getMinorTicks=function(r){return $L(this,r,Z_(this.powStub),this.intervalStub.getConfig().interval)},t.prototype.getLabel=function(r,n){return this.intervalStub.getLabel(r,n)},t.type="log",t.mapperMethods={needTransform:function(){return!0},normalize:function(r){return this.intervalStub.normalize(S0(r,this.base))},scale:function(r){return yC(this.intervalStub.scale(r),this.base,null)},transformIn:function(r,n){return r=S0(r,this.base),n&&n.depth===ps?r:this.intervalStub.transformIn(r,n)},transformOut:function(r,n){var a=n?n.depth:null;return CO.depth=a,TO.lookup=this._lookup,yC(a===ps?r:this.intervalStub.transformOut(r,CO),this.base,TO)},contain:function(r){return this.powStub.contain(r)},setExtent:function(r,n){this.setExtent2(ea,r,n)},setExtent2:function(r,n,a){if(!(!jc(n,a)||n<=0||a<=0)){var i=MO,o=MO;if(r===ea){var s=this._lookup;i=s.to,o=s.from}this.powStub.setExtent2(r,i[T0]=n,i[M0]=a);var l=this.base;this.intervalStub.setExtent2(r,o[T0]=S0(n,l),o[M0]=S0(a,l))}},getFilter:function(){return{g:0}},sanitize:function(r,n){return jc(n[0],n[1])&&ni(r)&&r<=0&&(r=n[0]),r},getDefaultStartValue:function(){return 1},getExtent:function(){return this.powStub.getExtent()},getExtentUnsafe:function(r,n){return n===null?this.powStub.getExtentUnsafe(r,null):this.intervalStub.getExtentUnsafe(r,n)}},t}(Bi);Bi.registerClass(VU);var CO={},TO={},MO=[],GU={value:1,category:1,time:1,log:1},HU=Ze();function Fm(e){var t=e.get("type");return(t==null||!ge(GU,t)&&!Bi.getClass(t))&&(t="value"),t}function tv(e,t,r){var n=xr(),a;switch(n&&(a=UU(e,t,r)),t){case"category":return new Xg({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:sn()});case"time":return new BU({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC"),breakOption:a});case"log":return new VU({logBase:e.get("logBase"),breakOption:a});case"value":return new Dl({breakOption:a});default:return new(Bi.getClass(t)||Dl)({})}}function yse(e,t,r){var n=e.getExtentUnsafe(ea,null),a=n[0],i=n[1];return jc(a,i)?a===t||i===t?_se:at?xse:iA:iA}var xse=1,_se=2,iA=3;function bse(e){HU(e).noOnMyZero=!0}function wse(e){return HU(e).noOnMyZero}function Vm(e){var t=e.getLabelModel().get("formatter");if(e.type==="time"){var r=Pne(t);return function(a,i){return e.scale.getFormattedLabel(a,i,r)}}else{if(ue(t))return function(a){var i=e.scale.getLabel(a),o=t.replace("{value}",i??"");return o};if(Me(t)){if(e.type==="category")return function(a,i){return t(lb(e,a),a.value-e.scale.getExtent()[0],null)};var n=xr();return function(a,i){var o=null;return n&&(o=n.makeAxisLabelFormatterParamBreak(o,a.break)),t(lb(e,a),i,o)}}else return function(a){return e.scale.getLabel(a)}}}function lb(e,t){var r=e.scale;return Ln(r)?r.getLabel(t):t.value}function YL(e){var t=e.get("interval");return t??"auto"}function Sse(e){return e.type==="category"&&YL(e.getLabelModel())===0}function Cse(e,t){var r={};return j(e.mapDimensionsAll(t),function(n){r[HL(e,n)]=!0}),at(r)}function yd(e){return e==="middle"||e==="center"}function qg(e){return e.getShallow("show")}function UU(e,t,r){var n=e.get("breaks",!0);if(n!=null)return!xr()||!r||!Tse(t)?void 0:n}function Tse(e){return e!=="category"}function WU(e,t,r,n,a,i){var o=md(e),s=o?e.intervalStub:e;if(s.setExtent(n[0],n[1]),o){var l=e.powStub,u={depth:ps},c=e.transformOut(n[0],u),h=e.transformOut(n[1],u),d=sse(r,n);t[0]&&!d[0]&&(c=a[0]),t[1]&&!d[1]&&(h=a[1]),l.setExtent(c,h)}s.setConfig(i)}function rv(e,t){return Ln(e)?e.getRawOrdinalNumber(t.value):t.value}function Gm(e,t){return Ln(e)&&!!t.get("boundaryGap")}var nv=function(){function e(){}return e.prototype.needIncludeZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),Mse=Fd(),ub="|&",av=Ze(),ZU=-2,Ase=-1,Nse=Ze();function XL(e,t){var r=e.model,n=av(Jd(r.ecModel)).keyed,a=n&&n.get(t);return a&&a.get(r.uid)}function kse(e,t){return YU(XL(e,t))}function Lse(e,t){var r=[];return $U(e.model.ecModel,function(n){for(var a=0;a0&&h[1]>0&&!d[0]&&(h[0]=0),h[0]<0&&h[1]<0&&!d[1]&&(h[1]=0));var S=!1;h[0]>h[1]&&(h.reverse(),S=!0);var C=Kv(t,r.get("startValue",!0)),M=C!=null;!ni(C)&&a&&(C=t.getDefaultStartValue?t.getDefaultStartValue():0),ni(C)&&(M||!_||w)&&(Ch[1]&&!d[1]&&(h[1]=C,d[1]=!0));var A=this._i={scale:t,dataMM:c,noZoomEffMM:h,zoomMM:[],fixMM:d,zoomFixMM:[!1,!1],startValue:C,isBlank:x,incl0:w,tggAxInv:S,ctnShp:i};AO(A,h)}return e.prototype.makeNoZoom=function(){return this._i.noZoomEffMM.slice()},e.prototype.makeFinal=function(){var t=this._i,r=t.zoomMM,n=t.noZoomEffMM,a=t.zoomFixMM,i=t.fixMM,o={fixMM:i,zoomFixMM:a,isBlank:t.isBlank,incl0:t.incl0,tggAxInv:t.tggAxInv,ctnShp:t.ctnShp,effMM:n.slice()},s=o.effMM;return r[0]!=null&&(s[0]=r[0],i[0]=a[0]=!0),r[1]!=null&&(s[1]=r[1],i[1]=a[1]=!0),AO(t,s),o},e.prototype.makeRenderInfo=function(){return{startValue:this._i.startValue}},e.prototype.setZoomMM=function(t,r){this._i.zoomMM[t]=r},e}();function AO(e,t){var r=e.scale,n=e.dataMM;r.sanitize&&(t[0]=r.sanitize(t[0],n),t[1]=r.sanitize(t[1],n),Rx(t))}function Kv(e,t){return t==null?null:un(t)?NaN:e.parse(t)}function zse(e,t){var r;if(Ln(e))r=[0,0];else{var n=t.get("boundaryGap");typeof n=="boolean"&&(n=null),r=ne(n)?n:[n,n]}return[NO(r[0]),NO(r[1])]}function NO(e){return ko(typeof e=="boolean"?0:e,1)||0}function JU(e){var t=jse(e.scale);return t.extent||(t.extent=sn()),t}function Bse(e,t){JU(e).dimIdxInCoord=t.get(e.dim)}function Uc(e,t){var r=e.scale,n=e.model,a=e.dim;r.rawExtentInfo||Fse(r,e,a,n,t)}function Fse(e,t,r,n,a){var i=JU(t),o=i.extent,s=!1;Ise(t,function(c){if(c.boxCoordinateSystem){var h=n7(c).coord,d=i.dimIdxInCoord;if(d>=0){if(ne(h)){var v=h[d];v!=null&&!ne(v)&&CM(o,e.parse(v))}}}else if(c.coordinateSystem){var g=c.getData();if(g){var m=e.getFilter?e.getFilter():null;j(Cse(g,r),function(y){mte(o,g.getApproximateExtent(y,m))})}c.__requireStartValue&&c.__requireStartValue(t)&&(s=!0)}});var l=Gse(e,t,n),u=new KU(e,n,o,s,l);QU(e,u,a),i.extent=null}function Vse(e,t){var r=e.scale;QU(r,new KU(r,e.model,t,!1,!1),Ose)}function QU(e,t,r){e.rawExtentInfo=t,t.from=r}function J1(e,t){JL.set(e,t)}var JL=pe();function e8(e,t,r,n,a){e.rawExtentInfo||Vse({scale:e,model:t},a||sn());var i=e.rawExtentInfo.makeFinal(),o=i.effMM;return e.setExtent(o[0],o[1]),e.setBlank(i.isBlank),n&&i.tggAxInv&&r&&!r.get("legacyMinMaxDontInverseAxis")&&(n.inverse=!n.inverse),i}function Gse(e,t,r){var n=Gm(e,r),a=r.get("containShape",!0);if(a==null&&!n&&(a=!0),!a)return!1;var i=!1;return XU(t,function(o){i=!!JL.get(o)||i}),i}function Hse(e,t,r,n){if(r.ctnShp){var a;if(XU(e,function(s){var l=JL.get(s);if(l){var u=l(e,n);u&&(a=a||[0,0],HG(a,u[0]),UG(a,u[1]),bse(e))}}),!!a){var i=t.getExtent();if(Ln(t))e.onBand||t.setExtent2($g,Mt(i[0],i[0]+a[0]),qe(i[1],i[1]+a[1]));else{var o=i.slice();r.zoomFixMM[0]||(o[0]=Mt(o[0],t.transformOut(t.transformIn(o[0],null)+a[0],null))),r.zoomFixMM[1]||(o[1]=qe(o[1],t.transformOut(t.transformIn(o[1],null)+a[1],null))),(o[0]i[1])&&t.setExtent2($g,o[0],o[1])}}}}function kO(e,t){var r=md(e),n=r?e.intervalStub:e,a=t.fixMinMax||[],i=r?e.getExtent():null,o=n.getExtent(),s=OU(o,a,t.rawExtentResult);n.setExtent(s[0],s[1]),s=n.getExtent();var l=r?Wse(n,t):Use(n,t),u=l.intervalPrecision,c=l.interval,h=t.userInterval;h!=null&&(l.interval=h,l.intervalPrecision=Vc(h)),a[0]||(s[0]=gt(ri(s[0]/c)*c,u)),a[1]||(s[1]=gt(lh(s[1]/c)*c,u)),h!=null&&(l.niceExtent=s.slice()),WU(e,a,o,s,i,l)}function Use(e,t){var r=q1(t.splitNumber,5),n=X1(e),a=t.minInterval,i=t.maxInterval,o=N1(n/r,!0);a!=null&&oi&&(o=i);var s=Vc(o),l=e.getExtent(),u=[gt(lh(l[0]/o)*o,s),gt(ri(l[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:u}}function Wse(e,t){var r=q1(t.splitNumber,10),n=e.getExtent(),a=X1(e),i=qe(jk(a),1),o=r/a*i;o<=.5&&(i*=10);var s=Vc(i),l=[gt(lh(n[0]/i)*i,s),gt(ri(n[1]/i)*i,s)];return{intervalPrecision:s,interval:i,niceExtent:l}}function _d(e){var t=e.scale,r=e.model,n=r.axis,a=r.ecModel;t8(t,r,n,a,null)}function t8(e,t,r,n,a){var i=e8(e,t,n,r,a),o=sb(e)||Bm(e);r8(e,{splitNumber:t.get("splitNumber"),fixMinMax:i.fixMM,userInterval:t.get("interval"),minInterval:o?t.get("minInterval"):null,maxInterval:o?t.get("maxInterval"):null,rawExtentResult:i}),r&&n&&Hse(r,e,i,n)}function r8(e,t){Zse[e.type](e,t)}var Zse={interval:kO,log:kO,time:gse,ordinal:ar};function $se(e){return Go(null,e)}var Yse={isDimensionStacked:Ls,enableDataStack:DU,getStackedDimension:HL};function Xse(e,t){var r=t;t instanceof tt||(r=new tt(t));var n=Fm(r),a=tv(r,n,!1);return e[1]a&&(n=o,a=l)}if(n)return tle(n.exterior);var u=this.getBoundingRect();return[u.x+u.width/2,u.y+u.height/2]},t.prototype.getBoundingRect=function(r){var n=this._rect;if(n&&!r)return n;var a=[1/0,1/0],i=[-1/0,-1/0],o=this.geometries;return j(o,function(s){s.type==="polygon"?IO(s.exterior,a,i,r):j(s.points,function(l){IO(l,a,i,r)})}),isFinite(a[0])&&isFinite(a[1])&&isFinite(i[0])&&isFinite(i[1])||(a[0]=a[1]=i[0]=i[1]=0),n=new ke(a[0],a[1],i[0]-a[0],i[1]-a[1]),r||(this._rect=n),n},t.prototype.contain=function(r){var n=this.getBoundingRect(),a=this.geometries;if(!n.contain(r[0],r[1]))return!1;e:for(var i=0,o=a.length;i>1^-(s&1),l=l>>1^-(l&1),s+=a,l+=i,a=s,i=l,n.push([s/r,l/r])}return n}function lA(e,t){return e=nle(e),oe(wt(e.features,function(r){return r.geometry&&r.properties&&r.geometry.coordinates.length>0}),function(r){var n=r.properties,a=r.geometry,i=[];switch(a.type){case"Polygon":var o=a.coordinates;i.push(new PO(o[0],o.slice(1)));break;case"MultiPolygon":j(a.coordinates,function(l){l[0]&&i.push(new PO(l[0],l.slice(1)))});break;case"LineString":i.push(new DO([a.coordinates]));break;case"MultiLineString":i.push(new DO(a.coordinates))}var s=new a8(n[t||"name"],i,n.cp);return s.properties=n,s})}const ale=Object.freeze(Object.defineProperty({__proto__:null,MAX_SAFE_INTEGER:Rg,asc:qr,getPercentWithPrecision:Kee,getPixelPrecision:qee,getPrecision:so,getPrecisionSafe:PG,isNumeric:Rk,isRadianAroundZero:Pc,linearMap:xt,nice:N1,numericToNumber:Io,parseDate:Fo,parsePercent:fe,quantile:jx,quantity:jk,quantityExponent:A1,reformIntervals:wM,remRadian:Ek,round:Xee},Symbol.toStringTag,{value:"Module"})),ile=Object.freeze(Object.defineProperty({__proto__:null,format:Rm,parse:Fo,roundTime:Y_},Symbol.toStringTag,{value:"Module"})),ole=Object.freeze(Object.defineProperty({__proto__:null,Arc:Dm,BezierCurve:Ud,BoundingRect:ke,Circle:Vo,CompoundPath:Em,Ellipse:Pm,Group:Ne,Image:Ur,IncrementalDisplayable:NH,Line:yr,LinearGradient:hh,Polygon:vn,Polyline:en,RadialGradient:Kk,Rect:Ke,Ring:Hd,Sector:dn,Text:ht,clipPointsByRect:tL,clipRectByRect:jH,createIcon:$d,extendPath:DH,extendShape:PH,getShapeClass:Fg,getTransform:yc,initProps:Ut,makeImage:Qk,makePath:dd,mergePath:ya,registerShape:li,resizePath:eL,updateProps:mt},Symbol.toStringTag,{value:"Module"})),sle=Object.freeze(Object.defineProperty({__proto__:null,addCommas:mL,capitalFirst:Fne,encodeHTML:Tn,formatTime:Bne,formatTpl:xL,getTextRect:zne,getTooltipMarker:e7,normalizeCssArray:Xd,toCamelCase:yL,truncateText:Ete},Symbol.toStringTag,{value:"Module"})),lle=Object.freeze(Object.defineProperty({__proto__:null,bind:ve,clone:Te,curry:Xe,defaults:Le,each:j,extend:te,filter:wt,indexOf:Ve,inherits:Tk,isArray:ne,isFunction:Me,isObject:Ie,isString:ue,map:oe,merge:We,reduce:ti},Symbol.toStringTag,{value:"Module"}));var ule=Ze(),ng=Ze(),Di={estimate:1,determine:2};function cb(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function cle(e,t){var r=e.getLabelModel().get("customValues");if(r){var n=e.scale;return{labels:oe(o8(r,n),function(a,i){return{formattedLabel:Vm(e)(a,i),rawLabel:n.getLabel(a),tick:a}})}}return e.type==="category"?fle(e,t):vle(e)}function hle(e,t,r){var n=e.scale,a=e.getTickModel().get("customValues");return a?{ticks:o8(a,n)}:e.type==="category"?dle(e,t):{ticks:n.getTicks(r)}}function o8(e,t){var r=t.getExtent(),n=[];return j(e,function(a){a=t.parse(a),a>=r[0]&&a<=r[1]&&n.push(a)}),k1(n,bte,null),qr(n),oe(n,function(a){return{value:a}})}function fle(e,t){var r=e.getLabelModel(),n=s8(e,r,t);return!r.get("show")||e.scale.isBlank()?{labels:[]}:n}function s8(e,t,r){var n=gle(e),a=YL(t),i=r.kind===Di.estimate;if(!i){var o=u8(n,a);if(o)return o}var s,l;Me(a)?s=hb(e,a,!1):(l=a==="auto"?mle(e,r):a,s=hb(e,l,!1));var u={labels:s,labelCategoryInterval:l};return i?r.out.noPxChangeTryDetermine.push(function(){return uA(n,a,u),!0}):uA(n,a,u),u}function dle(e,t){var r=ple(e),n=YL(t),a=u8(r,n);if(a)return a;var i,o;if((!t.get("show")||e.scale.isBlank())&&(i=[]),Me(n))i=hb(e,n,!0);else if(n==="auto"){var s=s8(e,e.getLabelModel(),cb(Di.determine));o=s.labelCategoryInterval,i=oe(s.labels,function(l){return l.tick})}else o=n,i=hb(e,o,!0);return uA(r,n,{ticks:i,tickCategoryInterval:o})}function vle(e){var t=e.scale.getTicks(),r=Vm(e);return{labels:oe(t,function(n,a){return{formattedLabel:r(n,a),rawLabel:e.scale.getLabel(n),tick:n}})}}var ple=l8("axisTick"),gle=l8("axisLabel");function l8(e){return function(r){return ng(r)[e]||(ng(r)[e]={list:[]})}}function u8(e,t){for(var r=0;rc&&(u=Math.max(1,Math.floor(l/c)));for(var h=s[0],d=e.dataToCoord(h+1)-e.dataToCoord(h),v=Math.abs(d*Math.cos(i)),g=Math.abs(d*Math.sin(i)),m=0,y=0;h<=s[1];h+=u){var x=0,_=0,w=C1(a({value:h}),n.font,"center","top");x=w.width*1.3,_=w.height*1.3,m=Math.max(m,x,7),y=Math.max(y,_,7)}var S=m/v,C=y/g;isNaN(S)&&(S=1/0),isNaN(C)&&(C=1/0);var M=Math.max(0,Math.floor(Math.min(S,C)));if(r===Di.estimate)return t.out.noPxChangeTryDetermine.push(ve(xle,null,e,M,l)),M;var A=c8(e,M,l);return A??M}function xle(e,t,r){return c8(e,t,r)==null}function c8(e,t,r){var n=ule(e.model),a=e.getExtent(),i=n.lastAutoInterval,o=n.lastTickCount;if(i!=null&&o!=null&&Math.abs(i-t)<=1&&Math.abs(o-r)<=1&&i>t&&n.axisExtent0===a[0]&&n.axisExtent1===a[1])return i;n.lastTickCount=r,n.lastAutoInterval=t,n.axisExtent0=a[0],n.axisExtent1=a[1]}function _le(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get("rotate")||0,font:t.getFont()}}function hb(e,t,r){var n=Vm(e),a=e.scale,i=[],o=Me(t);return zU(a,o?0:t,function(s,l){var u=a.getLabel(s);if(o){var c=!!t(s.value,u);if(s.offInterval=!c,!c&&!l)return}i.push(r?s:{formattedLabel:n(s),rawLabel:u,tick:s})}),i}var ble=.8;function pn(e,t){t=t||{};var r={w:NaN,w2:NaN},n=e.scale,a=t.fromStat,i=t.min,o=ase(n);ni(o)||(o=NaN);var s=e.getExtent(),l=nr(s[1]-s[0]);return Ln(n)?wle(r,e,o,l):a&&Sle(r,e,o,l,a),i!=null&&(r.w=ni(r.w)?qe(i,r.w):i),r}function wle(e,t,r,n){var a=t.onBand,i=r+(a?1:0);i===0&&(i=1),e.w=n/i,!a&&r&&n&&(e.w2=e.w*r/n)}function Sle(e,t,r,n,a){var i=!1,o=-1/0;j(a.key?[kse(t,a.key)]:Lse(t,a.sers||[]),function(s){var l=s.liPosMinGap;l!=null&&(l>0?(l>o&&(o=l),i=!1):l===ZU&&(i=!0))}),ni(r)&&r>0&&ni(o)?(e.w=n/r*o,e.w2=o):i&&(e.w=n*ble,e.w2=e.w*r/n)}var EO=[0,1],ui=function(){function e(t,r,n){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=r,this._extent=n||[0,0]}return e.prototype.contain=function(t){var r=this._extent,n=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return t>=n&&t<=a},e.prototype.containData=function(t){return this.scale.contain(this.scale.parse(t))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(t,r){var n=this._extent;n[0]=t,n[1]=r},e.prototype.dataToCoord=function(t,r){var n=this.scale;return t=n.normalize(n.parse(t)),xt(t,EO,jO(this),r)},e.prototype.coordToData=function(t,r){var n=xt(t,jO(this),EO,r);return this.scale.scale(n)},e.prototype.pointToData=function(t,r){},e.prototype.getTicksCoords=function(t){t=t||{};var r=t.tickModel||this.getTickModel(),n=hle(this,r,{breakTicks:t.breakTicks,pruneByBreak:t.pruneByBreak}),a=oe(n.ticks,function(s){return{coord:this.dataToCoord(rv(this.scale,s)),tick:s}},this),i=r.get("alignWithLabel"),o=Cle(this,a,i);return oe(a,function(s){return{coord:s.coord,tickValue:s.tick.value,onBand:o}})},e.prototype.getMinorTicksCoords=function(){if(Ln(this.scale))return[];var t=this.model.getModel("minorTick"),r=t.get("splitNumber");r>0&&r<100||(r=5);var n=this.scale.getMinorTicks(r),a=oe(n,function(i){return oe(i,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return a},e.prototype.getViewLabels=function(t){return t=t||cb(Di.determine),cle(this,t).labels},e.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},e.prototype.getTickModel=function(){return this.model.getModel("axisTick")},e.prototype.getBandWidth=function(){return pn(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(t){return t=t||cb(Di.determine),yle(this,t)},e}();function jO(e){var t=e.getExtent();if(e.onBand){var r=t[1]-t[0],n=r/e.scale.count()/2;t[0]+=n,t[1]-=n}return t}function Cle(e,t,r){var n=t.length;if(!e.onBand||r||!n)return!1;var a=pn(e).w;if(!a)return!1;j(t,function(s){s.coord-=a/2});var i=e.scale.getExtent(),o=t[n-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+a,tick:{value:i[1]+1}}),!0}function Tle(e){var t=Qe.extend(e);return Qe.registerClass(t),t}function Mle(e){var t=Rt.extend(e);return Rt.registerClass(t),t}function Ale(e){var t=Pt.extend(e);return Pt.registerClass(t),t}function Nle(e){var t=At.extend(e);return At.registerClass(t),t}var Jv=Math.PI*2,Ou=Po.CMD,kle=["top","right","bottom","left"];function Lle(e,t,r,n,a){var i=r.width,o=r.height;switch(e){case"top":n.set(r.x+i/2,r.y-t),a.set(0,-1);break;case"bottom":n.set(r.x+i/2,r.y+o+t),a.set(0,1);break;case"left":n.set(r.x-t,r.y+o/2),a.set(-1,0);break;case"right":n.set(r.x+i+t,r.y+o/2),a.set(1,0);break}}function Ile(e,t,r,n,a,i,o,s,l){o-=e,s-=t;var u=Math.sqrt(o*o+s*s);o/=u,s/=u;var c=o*r+e,h=s*r+t;if(Math.abs(n-a)%Jv<1e-4)return l[0]=c,l[1]=h,u-r;if(i){var d=n;n=ba(a),a=ba(d)}else n=ba(n),a=ba(a);n>a&&(a+=Jv);var v=Math.atan2(s,o);if(v<0&&(v+=Jv),v>=n&&v<=a||v+Jv>=n&&v+Jv<=a)return l[0]=c,l[1]=h,u-r;var g=r*Math.cos(n)+e,m=r*Math.sin(n)+t,y=r*Math.cos(a)+e,x=r*Math.sin(a)+t,_=(g-o)*(g-o)+(m-s)*(m-s),w=(y-o)*(y-o)+(x-s)*(x-s);return _0){t=t/180*Math.PI,wi.fromArray(e[0]),Gt.fromArray(e[1]),mr.fromArray(e[2]),Pe.sub(uo,wi,Gt),Pe.sub(oo,mr,Gt);var r=uo.len(),n=oo.len();if(!(r<.001||n<.001)){uo.scale(1/r),oo.scale(1/n);var a=uo.dot(oo),i=Math.cos(t);if(i1&&Pe.copy(zn,mr),zn.toArray(e[1])}}}}function Ele(e,t,r){if(r<=180&&r>0){r=r/180*Math.PI,wi.fromArray(e[0]),Gt.fromArray(e[1]),mr.fromArray(e[2]),Pe.sub(uo,Gt,wi),Pe.sub(oo,mr,Gt);var n=uo.len(),a=oo.len();if(!(n<.001||a<.001)){uo.scale(1/n),oo.scale(1/a);var i=uo.dot(t),o=Math.cos(r);if(i=l)Pe.copy(zn,mr);else{zn.scaleAndAdd(oo,s/Math.tan(Math.PI/2-c));var h=mr.x!==Gt.x?(zn.x-Gt.x)/(mr.x-Gt.x):(zn.y-Gt.y)/(mr.y-Gt.y);if(isNaN(h))return;h<0?Pe.copy(zn,Gt):h>1&&Pe.copy(zn,mr)}zn.toArray(e[1])}}}}function bC(e,t,r,n){var a=r==="normal",i=a?e:e.ensureState(r);i.ignore=t;var o=n.get("smooth");o=o===!0?.3:Math.max(+o,0)||0,i.shape=i.shape||{},i.shape.smooth=o;var s=n.getModel("lineStyle").getLineStyle();a?e.useStyle(s):i.style=s}function jle(e,t){var r=t.smooth,n=t.points;if(n)if(e.moveTo(n[0][0],n[0][1]),r>0&&n.length>=3){var a=os(n[0],n[1]),i=os(n[1],n[2]);if(!a||!i){e.lineTo(n[1][0],n[1][1]),e.lineTo(n[2][0],n[2][1]);return}var o=Math.min(a,i)*r,s=$p([],n[1],n[0],o/a),l=$p([],n[1],n[2],o/i),u=$p([],s,l,.5);e.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),e.bezierCurveTo(l[0],l[1],l[0],l[1],n[2][0],n[2][1])}else for(var c=1;c0){S(P*k,0,i);var D=P+A;D<0&&C(-D*k,1)}else C(-A*k,1)}}function S(A,I,k){A!==0&&(c=!0);for(var P=I;P0)for(var D=0;D0;D--){var H=k[D-1]*B;S(-H,D,i)}}}function M(A){var I=A<0?-1:1;A=Math.abs(A);for(var k=Math.ceil(A/(i-1)),P=0;P0?S(k,0,P+1):S(-k,i-P-1,i),A-=k,A<=0)return}return c}function zle(e){for(var t=0;t=0&&n.attr(i.oldLayoutSelect),Ve(d,"emphasis")>=0&&n.attr(i.oldLayoutEmphasis)),mt(n,u,r,l)}else if(n.attr(u),!Yd(n).valueAnimation){var h=_e(n.style.opacity,1);n.style.opacity=0,Ut(n,{style:{opacity:h}},r,l)}if(i.oldLayout=u,n.states.select){var v=i.oldLayoutSelect={};A0(v,u,N0),A0(v,n.states.select,N0)}if(n.states.emphasis){var g=i.oldLayoutEmphasis={};A0(g,u,N0),A0(g,n.states.emphasis,N0)}VH(n,l,c,r,r)}if(a&&!a.ignore&&!a.invisible){var i=Vle(a),o=i.oldLayout,m={points:a.shape.points};o?(a.attr({shape:o}),mt(a,{shape:m},r)):(a.setShape(m),a.style.strokePercent=0,Ut(a,{style:{strokePercent:1}},r)),i.oldLayout=m}},e}(),CC=Ze();function Hle(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){var a=CC(r).labelManager;a||(a=CC(r).labelManager=new Gle),a.clearLabels()}),e.registerUpdateLifecycle("series:layoutlabels",function(t,r,n){var a=CC(r).labelManager;j(n.updatedSeries,function(i){a.addLabelsOfSeries(r.getViewOfSeriesModel(i))}),a.updateLayoutConfig(r),a.layout(r),a.processLabelsOverall()})}var TC=Math.sin,MC=Math.cos,m8=Math.PI,zu=Math.PI*2,Ule=180/m8,y8=function(){function e(){}return e.prototype.reset=function(t){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,t||4)},e.prototype.moveTo=function(t,r){this._add("M",t,r)},e.prototype.lineTo=function(t,r){this._add("L",t,r)},e.prototype.bezierCurveTo=function(t,r,n,a,i,o){this._add("C",t,r,n,a,i,o)},e.prototype.quadraticCurveTo=function(t,r,n,a){this._add("Q",t,r,n,a)},e.prototype.arc=function(t,r,n,a,i,o){this.ellipse(t,r,n,n,0,a,i,o)},e.prototype.ellipse=function(t,r,n,a,i,o,s,l){var u=s-o,c=!l,h=Math.abs(u),d=vl(h-zu)||(c?u>=zu:-u>=zu),v=u>0?u%zu:u%zu+zu,g=!1;d?g=!0:vl(h)?g=!1:g=v>=m8==!!c;var m=t+n*MC(o),y=r+a*TC(o);this._start&&this._add("M",m,y);var x=Math.round(i*Ule);if(d){var _=1/this._p,w=(c?1:-1)*(zu-_);this._add("A",n,a,x,1,+c,t+n*MC(o+w),r+a*TC(o+w)),_>.01&&this._add("A",n,a,x,0,+c,m,y)}else{var S=t+n*MC(s),C=r+a*TC(s);this._add("A",n,a,x,+g,+c,S,C)}},e.prototype.rect=function(t,r,n,a){this._add("M",t,r),this._add("l",n,0),this._add("l",0,a),this._add("l",-n,0),this._add("Z")},e.prototype.closePath=function(){this._d.length>0&&this._add("Z")},e.prototype._add=function(t,r,n,a,i,o,s,l,u){for(var c=[],h=this._p,d=1;d"}function Qle(e){return""}function rI(e,t){t=t||{};var r=t.newline?` -`:"";function n(a){var i=a.children,o=a.tag,s=a.attrs,l=a.text;return Jle(o,s)+(o!=="style"?Tn(l):l||"")+(i?""+r+oe(i,function(u){return n(u)}).join(r)+r:"")+Qle(o)}return n(e)}function eue(e,t,r){r=r||{};var n=r.newline?` -`:"",a=" {"+n,i=n+"}",o=oe(at(e),function(l){return l+a+oe(at(e[l]),function(u){return u+":"+e[l][u]+";"}).join(n)+i}).join(n),s=oe(at(t),function(l){return"@keyframes "+l+a+oe(at(t[l]),function(u){return u+a+oe(at(t[l][u]),function(c){var h=t[l][u][c];return c==="d"&&(h='path("'+h+'")'),c+":"+h+";"}).join(n)+i}).join(n)+i}).join(n);return!o&&!s?"":[""].join(n)}function vA(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function VO(e,t,r,n){return Fr("svg","root",{width:e,height:t,xmlns:x8,"xmlns:xlink":_8,version:"1.1",baseProfile:"full",viewBox:n?"0 0 "+e+" "+t:!1},r)}var tue=0;function w8(){return tue++}var GO={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},$u="transform-origin";function rue(e,t,r){var n=te({},e.shape);te(n,t),e.buildPath(r,n);var a=new y8;return a.reset(bG(e)),r.rebuildPath(a,1),a.generateStr(),a.getStr()}function nue(e,t){var r=t.originX,n=t.originY;(r||n)&&(e[$u]=r+"px "+n+"px")}var aue={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function S8(e,t){var r=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[r]=e,r}function iue(e,t,r){var n=e.shape.paths,a={},i,o;if(j(n,function(l){var u=vA(r.zrId);u.animation=!0,ew(l,{},u,!0);var c=u.cssAnims,h=u.cssNodes,d=at(c),v=d.length;if(v){o=d[v-1];var g=c[o];for(var m in g){var y=g[m];a[m]=a[m]||{d:""},a[m].d+=y.d||""}for(var x in h){var _=h[x].animation;_.indexOf(o)>=0&&(i=_)}}}),!!i){t.d=!1;var s=S8(a,r);return i.replace(o,s)}}function HO(e){return ue(e)?GO[e]?"cubic-bezier("+GO[e]+")":kk(e)?e:"":""}function ew(e,t,r,n){var a=e.animators,i=a.length,o=[];if(e instanceof Em){var s=iue(e,t,r);if(s)o.push(s);else if(!i)return}else if(!i)return;for(var l={},u=0;u0}).length){var Ue=S8(A,r);return Ue+" "+_[0]+" both"}}for(var y in l){var s=m(l[y]);s&&o.push(s)}if(o.length){var x=r.zrId+"-cls-"+w8();r.cssNodes["."+x]={animation:o.join(",")},t.class=x}}function oue(e,t,r){if(!e.ignore)if(e.isSilent()){var n={"pointer-events":"none"};UO(n,t,r)}else{var a=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},i=a.fill;if(!i){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,l=e.currentStates.indexOf("select")>=0&&s||o;l&&(i=D_(l))}var u=a.lineWidth;if(u){var c=!a.strokeNoScale&&e.transform?e.transform[0]:1;u=u/c}var n={cursor:"pointer"};i&&(n.fill=i),a.stroke&&(n.stroke=a.stroke),u&&(n["stroke-width"]=u),UO(n,t,r)}}function UO(e,t,r,n){var a=JSON.stringify(e),i=r.cssStyleCache[a];i||(i=r.zrId+"-cls-"+w8(),r.cssStyleCache[a]=i,r.cssNodes["."+i+":hover"]=e),t.class=t.class?t.class+" "+i:i}var Kg=Math.round;function C8(e){return e&&ue(e.src)}function T8(e){return e&&Me(e.toDataURL)}function nI(e,t,r,n){Xle(function(a,i){var o=a==="fill"||a==="stroke";o&&_G(i)?A8(t,e,a,n):o&&Ik(i)?N8(r,e,a,n):e[a]=i,o&&n.ssr&&i==="none"&&(e["pointer-events"]="visible")},t,r,!1),due(r,e,n)}function aI(e,t){var r=kG(t);r&&(r.each(function(n,a){n!=null&&(e[(FO+a).toLowerCase()]=n+"")}),t.isSilent()&&(e[FO+"silent"]="true"))}function WO(e){return vl(e[0]-1)&&vl(e[1])&&vl(e[2])&&vl(e[3]-1)}function sue(e){return vl(e[4])&&vl(e[5])}function iI(e,t,r){if(t&&!(sue(t)&&WO(t))){var n=1e4;e.transform=WO(t)?"translate("+Kg(t[4]*n)/n+" "+Kg(t[5]*n)/n+")":lee(t)}}function ZO(e,t,r){for(var n=e.points,a=[],i=0;i"u"){var y="Image width/height must been given explictly in svg-ssr renderer.";fn(d,y),fn(v,y)}else if(d==null||v==null){var x=function(P,D){if(P){var z=P.elm,E=d||D.width,B=v||D.height;P.tag==="pattern"&&(u?(B=1,E/=i.width):c&&(E=1,B/=i.height)),P.attrs.width=E,P.attrs.height=B,z&&(z.setAttribute("width",E),z.setAttribute("height",B))}},_=Gk(g,null,e,function(P){l||x(M,P),x(h,P)});_&&_.width&&_.height&&(d=d||_.width,v=v||_.height)}h=Fr("image","img",{href:g,width:d,height:v}),o.width=d,o.height=v}else a.svgElement&&(h=Te(a.svgElement),o.width=a.svgWidth,o.height=a.svgHeight);if(h){var w,S;l?w=S=1:u?(S=1,w=o.width/i.width):c?(w=1,S=o.height/i.height):o.patternUnits="userSpaceOnUse",w!=null&&!isNaN(w)&&(o.width=w),S!=null&&!isNaN(S)&&(o.height=S);var C=wG(a);C&&(o.patternTransform=C);var M=Fr("pattern","",o,[h]),A=rI(M),I=n.patternCache,k=I[A];k||(k=n.zrId+"-p"+n.patternIdx++,I[A]=k,o.id=k,M=n.defs[k]=Fr("pattern",k,o,[h])),t[r]=S1(k)}}function vue(e,t,r){var n=r.clipPathCache,a=r.defs,i=n[e.id];if(!i){i=r.zrId+"-c"+r.clipPathIdx++;var o={id:i};n[e.id]=i,a[i]=Fr("clipPath",i,o,[M8(e,r)])}t["clip-path"]=S1(i)}function XO(e){return document.createTextNode(e)}function ec(e,t,r){e.insertBefore(t,r)}function qO(e,t){e.removeChild(t)}function KO(e,t){e.appendChild(t)}function k8(e){return e.parentNode}function L8(e){return e.nextSibling}function AC(e,t){e.textContent=t}var JO=58,pue=120,gue=Fr("","");function pA(e){return e===void 0}function no(e){return e!==void 0}function mue(e,t,r){for(var n={},a=t;a<=r;++a){var i=e[a].key;i!==void 0&&(n[i]=a)}return n}function kp(e,t){var r=e.key===t.key,n=e.tag===t.tag;return n&&r}function Jg(e){var t,r=e.children,n=e.tag;if(no(n)){var a=e.elm=b8(n);if(oI(gue,e),ne(r))for(t=0;ti?(g=r[l+1]==null?null:r[l+1].elm,I8(e,g,r,a,l)):gb(e,t,n,i))}function df(e,t){var r=t.elm=e.elm,n=e.children,a=t.children;e!==t&&(oI(e,t),pA(t.text)?no(n)&&no(a)?n!==a&&yue(r,n,a):no(a)?(no(e.text)&&AC(r,""),I8(r,null,a,0,a.length-1)):no(n)?gb(r,n,0,n.length-1):no(e.text)&&AC(r,""):e.text!==t.text&&(no(n)&&gb(r,n,0,n.length-1),AC(r,t.text)))}function xue(e,t){if(kp(e,t))df(e,t);else{var r=e.elm,n=k8(r);Jg(t),n!==null&&(ec(n,t.elm,L8(r)),gb(n,[e],0,0))}return t}var _ue=0,bue=function(){function e(t,r,n){if(this.type="svg",this.configLayer=wue(),this.storage=r,this._opts=n=te({},n),this.root=t,this._id="zr"+_ue++,this._oldVNode=VO(n.width,n.height),t&&!n.ssr){var a=this._viewport=document.createElement("div");a.style.cssText="position:relative;overflow:hidden";var i=this._svgDom=this._oldVNode.elm=b8("svg");oI(null,this._oldVNode),a.appendChild(i),t.appendChild(a)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",xue(this._oldVNode,t),this._oldVNode=t}},e.prototype.renderOneToVNode=function(t){return YO(t,vA(this._id))},e.prototype.renderToVNode=function(t){t=t||{};var r=this.storage.getDisplayList(!0),n=this._width,a=this._height,i=vA(this._id);i.animation=t.animation,i.willUpdate=t.willUpdate,i.compress=t.compress,i.emphasis=t.emphasis,i.ssr=this._opts.ssr;var o=[],s=this._bgVNode=Sue(n,a,this._backgroundColor,i);s&&o.push(s);var l=t.compress?null:this._mainVNode=Fr("g","main",{},[]);this._paintList(r,i,l?l.children:o),l&&o.push(l);var u=oe(at(i.defs),function(d){return i.defs[d]});if(u.length&&o.push(Fr("defs","defs",{},u)),t.animation){var c=eue(i.cssNodes,i.cssAnims,{newline:!0});if(c){var h=Fr("style","stl",{},[],c);o.push(h)}}return VO(n,a,o,t.useViewBox)},e.prototype.renderToString=function(t){return t=t||{},rI(this.renderToVNode({animation:_e(t.cssAnimation,!0),emphasis:_e(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:_e(t.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(t){this._backgroundColor=t},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(t,r,n){for(var a=t.length,i=[],o=0,s,l,u=0,c=0;c=0&&!(d&&l&&d[m]===l[m]);m--);for(var y=g-1;y>m;y--)o--,s=i[o-1];for(var x=m+1;x=s)}}for(var h=e5(this),d=h.startIdx;d=0)&&(o=!0)}),!(!o&&!i.__dirty)){var s=n._opts.useDirtyRect&&!NC(i)?i.createRepaintRects(t,r,n._width,n._height):null,l=n._i.layerStack[0],u=!0;if(i.__dirty){u=!1,i.__dirty=!1;var c=i.zlevel===l.zl&&i.zlevel2===l.zl2?n._backgroundColor:null;i.clear(!1,c,s)}k0(i,function(h){var d=n._paintPerCursor(i,h,t,s,u);a=a&&d})}},L0),ot.wxa&&bn(this._i,function(i){i&&i.ctx&&i.ctx.draw&&i.ctx.draw()}),a},e.prototype._paintPerCursor=function(t,r,n,a,i){var o=t.ctx;if(a)if(!a.length)r.drawIdx=r.endIdx;else for(var s=this.dpr,l=0;l=r.endIdx},e.prototype._paintPerCursorInRect=function(t,r,n,a,i){for(var o={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},s=t.ctx,l=NC(t),u=l&&Vr.getTime(),c=r.drawIdx,h=r.notClearIdx,d=h>=0?Math.min(h,c):c;d15){d++;break}}}}qf(s,o),r.drawIdx=Math.max(d,c)},e.prototype.getLayer=function(t,r){return this._ensureLayer(t,0,r)},e.prototype._ensureLayer=function(t,r,n){r=r||0;var a=this._singleCanvas;a&&!this._needsManuallyCompositing&&(t=Bu,r=0);var i=IC(this._i,t)[r];return i||(i=r5("zr_"+t+"."+r,this,t,r),this._layerConfig[t]&&We(i,this._layerConfig[t],!0),(n||a&&t!==Bu)&&(i.virtual=!0),this._insertLayer(i,t,r,!1),i.initContext()),i},e.prototype.insertLayer=function(t,r){this._insertLayer(r,t,0,!1)},e.prototype._insertLayer=function(t,r,n,a){var i=this._i,o=i.layers,s=i.layerStack,l=this._domRoot,u=null;if(!(o[r]&&o[r][n])&&Mue(t)){for(var c=s.length,h=0;h0&&(u=IC(i,s[h-1].zl)[s[h-1].zl2]),s.splice(h,0,{zl:r,zl2:n}),IC(i,r)[n]=t,!a&&!t.virtual)if(u){var d=u.dom;d.nextSibling?l.insertBefore(t.dom,d.nextSibling):l.appendChild(t.dom)}else l.firstChild?l.insertBefore(t.dom,l.firstChild):l.appendChild(t.dom);t.painter||(t.painter=this)}},e.prototype.eachLayer=function(t,r){return bn(this._i,function(n,a){t.call(r,n,a)})},e.prototype.eachBuiltinLayer=function(t,r){return bn(this._i,function(n,a){t.call(r,n,a)},ag)},e.prototype.eachOtherLayer=function(t,r){return bn(this._i,function(n,a){t.call(r,n,a)},gA)},e.prototype.getLayers=function(){var t={};return bn(this._i,function(r,n,a){t[r.id]=r}),t},e.prototype._updateLayerStatus=function(t,r){var n=this;if(n._singleCanvas)for(var a=1;a=0;w--){var S=_.get(x[w]);if(!S.used)y.__dirty=!0,_.removeKey(x[w]),x.splice(w,1);else{var C=S.endIdxNew;(NC(y)?C=0;a--){var i=r[a];if(i.zl===t){var o=n[t][i.zl2];if(o.__builtin__)continue;if(r.splice(a,1),n[t][i.zl2]=void 0,!o.virtual){var s=o.dom.parentNode;s&&s.removeChild(o.dom)}}}},e.prototype.resize=function(t,r){if(this._domRoot.style){var n=this._domRoot;n.style.display="none";var a=this._opts,i=this.root;t!=null&&(a.width=t),r!=null&&(a.height=r),t=Pf(i,0,a),r=Pf(i,1,a),n.style.display="",(this._width!==t||r!==this._height)&&(n.style.width=t+"px",n.style.height=r+"px",bn(this._i,function(o){o.resize(t,r)}),this.refresh({paintAll:!0})),this._width=t,this._height=r}else{if(t==null||r==null)return;this._width=t,this._height=r,this._ensureLayer(Bu).resize(t,r)}return this},e.prototype.clearLayer=function(t){j(this._i.layers[t],function(r){r&&!r.__builtin__&&r.clear()})},e.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(t){if(t=t||{},this._singleCanvas&&!this._compositeManually)return this._i.layers[Bu][0].dom;var r=new P8("image",this,t.pixelRatio||this.dpr);r.initContext(),r.clear(!1,t.backgroundColor||this._backgroundColor);var n=r.ctx;if(t.pixelRatio<=this.dpr){this.refresh();var a=r.dom.width,i=r.dom.height;bn(this._i,function(h){h.__builtin__?n.drawImage(h.dom,0,0,a,i):h.renderToCanvas&&(n.save(),h.renderToCanvas(n),n.restore())})}else{for(var o={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},s=this.storage.getDisplayList(!0),l=0,u=s.length;l-1&&(u.style.stroke=u.style.fill,u.style.fill=K.color.neutral00,u.style.lineWidth=2),n},t.type="series.line",t.dependencies=["grid","polar"],t.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1,triggerEvent:!1},t}(Pt);function bd(e,t){var r=e.mapDimensionsAll("defaultedLabel"),n=r.length;if(n===1){var a=pd(e,t,r[0]);return a!=null?a+"":null}else if(n){for(var i=[],o=0;o=0&&n.push(t[i])}return n.join(" ")}var Hm=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this)||this;return o.updateData(r,n,a,i),o}return t.prototype._createSymbol=function(r,n,a,i,o,s){this.removeAll();var l=_r(r,-1,-1,2,2,null,s);l.attr({z2:_e(o,100),culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),l.drift=Due,this._symbolType=r,this.add(l)},t.prototype.stopSymbolAnimation=function(r){this.childAt(0).stopAnimation(null,r)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){As(this.childAt(0))},t.prototype.downplay=function(){Ns(this.childAt(0))},t.prototype.setZ=function(r,n){var a=this.childAt(0);a.zlevel=r,a.z=n},t.prototype.setDraggable=function(r,n){var a=this.childAt(0);a.draggable=r,a.cursor=!n&&r?"move":a.cursor},t.prototype.updateData=function(r,n,a,i){this.silent=!1;var o=r.getItemVisual(n,"symbol")||"circle",s=r.hostModel,l=t.getSymbolSize(r,n),u=t.getSymbolZ2(r,n),c=o!==this._symbolType,h=i&&i.disableAnimation;if(c){var d=r.getItemVisual(n,"symbolKeepAspect");this._createSymbol(o,r,n,l,u,d)}else{var v=this.childAt(0);v.silent=!1;var g={scaleX:l[0]/2,scaleY:l[1]/2};h?v.attr(g):mt(v,g,s,n),ii(v)}if(this._updateCommon(r,n,l,a,i),c){var v=this.childAt(0);if(!h){var g={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:v.style.opacity}};v.scaleX=v.scaleY=0,v.style.opacity=0,Ut(v,g,s,n)}}h&&this.childAt(0).stopAnimation("leave")},t.prototype._updateCommon=function(r,n,a,i,o){var s=this.childAt(0),l=r.hostModel,u,c,h,d,v,g,m,y,x;if(i&&(u=i.emphasisItemStyle,c=i.blurItemStyle,h=i.selectItemStyle,d=i.focus,v=i.blurScope,m=i.labelStatesModels,y=i.hoverScale,x=i.cursorStyle,g=i.emphasisDisabled),!i||r.hasItemOption){var _=i&&i.itemModel?i.itemModel:r.getItemModel(n),w=_.getModel("emphasis");u=w.getModel("itemStyle").getItemStyle(),h=_.getModel(["select","itemStyle"]).getItemStyle(),c=_.getModel(["blur","itemStyle"]).getItemStyle(),d=w.get("focus"),v=w.get("blurScope"),g=w.get("disabled"),m=Dr(_),y=w.getShallow("scale"),x=_.getShallow("cursor")}var S=r.getItemVisual(n,"symbolRotate");s.attr("rotation",(S||0)*Math.PI/180||0);var C=gh(r.getItemVisual(n,"symbolOffset"),a);C&&(s.x=C[0],s.y=C[1]),x&&s.attr("cursor",x);var M=r.getItemVisual(n,"style"),A=M.fill;if(s instanceof Ur){var I=s.style;s.useStyle(te({image:I.image,x:I.x,y:I.y,width:I.width,height:I.height},M))}else s.__isEmptyBrush?s.useStyle(te({},M)):s.useStyle(M),s.style.decal=null,s.setColor(A,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var k=r.getItemVisual(n,"liftZ"),P=this._z2;k!=null?P==null&&(this._z2=s.z2,s.z2+=k):P!=null&&(s.z2=P,this._z2=null);var D=o&&o.useNameLabel;Hr(s,m,{labelFetcher:l,labelDataIndex:n,defaultText:z,inheritColor:A,defaultOpacity:M.opacity});function z(H){return D?r.getName(H):bd(r,H)}this._sizeX=a[0]/2,this._sizeY=a[1]/2;var E=s.ensureState("emphasis");E.style=u,s.ensureState("select").style=h,s.ensureState("blur").style=c;var B=y==null||y===!0?Math.max(1.1,3/this._sizeY):isFinite(y)&&y>0?+y:1;E.scaleX=this._sizeX*B,E.scaleY=this._sizeY*B,this.setSymbolScale(1),Yt(this,d,v,g)},t.prototype.setSymbolScale=function(r){this.scaleX=this.scaleY=r},t.prototype.fadeOut=function(r,n,a){var i=this.childAt(0),o=Ee(this).dataIndex,s=a&&a.animation;if(this.silent=i.silent=!0,a&&a.fadeLabel){var l=i.getTextContent();l&&Gl(l,{style:{opacity:0}},n,{dataIndex:o,removeOpt:s,cb:function(){i.removeTextContent()}})}else i.removeTextContent();Gl(i,{style:{opacity:0},scaleX:0,scaleY:0},n,{dataIndex:o,cb:r,removeOpt:s})},t.getSymbolSize=function(r,n){return Qd(r.getItemVisual(n,"symbolSize"))},t.getSymbolZ2=function(r,n){return r.getItemVisual(n,"z2")},t}(Ne);function Due(e,t){this.parent.drift(e,t)}function I0(e,t,r,n){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(n&&n.isIgnore&&n.isIgnore(r))&&!(n&&n.clipShape&&!n.clipShape.contain(t[0],t[1]))&&e.getItemVisual(r,"symbol")!=="none"}function n5(e){return e!=null&&!Ie(e)&&(e={isIgnore:e}),e||{}}function a5(e){var t=e.hostModel,r=t.getModel("emphasis");return{emphasisItemStyle:r.getModel("itemStyle").getItemStyle(),blurItemStyle:t.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:t.getModel(["select","itemStyle"]).getItemStyle(),focus:r.get("focus"),blurScope:r.get("blurScope"),emphasisDisabled:r.get("disabled"),hoverScale:r.get("scale"),labelStatesModels:Dr(t),cursorStyle:t.get("cursor")}}function i5(e,t,r,n,a,i,o){var s=new e(t,r,n,a);return s.setPosition(i),t.setItemGraphicEl(r,s),o.add(s),s}var Um=function(){function e(t){this.group=new Ne,this._SymbolCtor=t||Hm}return e.prototype.updateData=function(t,r){this._progressiveEls=null,r=n5(r);var n=this.group,a=t.hostModel,i=this._data,o=this._SymbolCtor,s=r.disableAnimation,l=this._seriesScope=a5(t),u={disableAnimation:s},c=r.getSymbolPoint||function(h){return t.getItemLayout(h)};i||n.removeAll(),t.diff(i).add(function(h){var d=c(h);I0(t,d,h,r)&&i5(o,t,h,l,u,d,n)}).update(function(h,d){var v=i.getItemGraphicEl(d),g=c(h);if(!I0(t,g,h,r)){n.remove(v);return}var m=t.getItemVisual(h,"symbol")||"circle",y=v&&v.getSymbolType&&v.getSymbolType();if(!v||y&&y!==m)n.remove(v),v=new o(t,h,l,u),v.setPosition(g);else{v.updateData(t,h,l,u);var x={x:g[0],y:g[1]};s?v.attr(x):mt(v,x,a)}n.add(v),t.setItemGraphicEl(h,v)}).remove(function(h){var d=i.getItemGraphicEl(h);d&&d.fadeOut(function(){n.remove(d)},a)}).execute(),this._getSymbolPoint=c,this._data=t},e.prototype.updateLayout=function(t){var r=this._data;if(r)for(var n=this,a=r.getStore(),i=0,o=a.count();i0?r=n[0]:n[1]<0&&(r=n[1]),r}function O8(e,t,r,n){var a=NaN;e.stacked&&(a=r.get(r.getCalculationInfo("stackedOverDimension"),n)),isNaN(a)&&(a=e.valueStart);var i=e.baseDataOffset,o=[];return o[i]=r.get(e.baseDim,n),o[1-i]=a,t.dataToPoint(o)}function Ka(e,t){return!isFinite(e)||!isFinite(t)}var jue=typeof Float32Array!==Vd?Float32Array:void 0,Rue=typeof Float64Array!==Vd?Float64Array:void 0;function co(e){return sI({ctor:jue},e).arr}function sI(e,t){var r=e.arr,n=e.ctor;if(t>Rg&&(t=Rg),!r||e.typed&&r.length=a||m<0)break;if(Ka(x,_)){if(l){m+=i;continue}break}if(m===r)e[i>0?"moveTo":"lineTo"](x,_),h=x,d=_;else{var w=x-u,S=_-c;if(w*w+S*S<.5){m+=i;continue}if(o>0){for(var C=m+i,M=t[C*2],A=t[C*2+1];M===x&&A===_&&y=n||Ka(M,A))v=x,g=_;else{P=M-u,D=A-c;var B=x-u,H=M-x,V=_-c,U=A-_,F=void 0,Z=void 0;if(s==="x"){F=Math.abs(B),Z=Math.abs(H);var $=P>0?1:-1;v=x-$*F*o,g=_,z=x+$*Z*o,E=_}else if(s==="y"){F=Math.abs(V),Z=Math.abs(U);var W=D>0?1:-1;v=x,g=_-W*F*o,z=x,E=_+W*Z*o}else F=Math.sqrt(B*B+V*V),Z=Math.sqrt(H*H+U*U),k=Z/(Z+F),v=x-P*o*(1-k),g=_-D*o*(1-k),z=x+P*o*k,E=_+D*o*k,z=Xs(z,qs(M,x)),E=Xs(E,qs(A,_)),z=qs(z,Xs(M,x)),E=qs(E,Xs(A,_)),P=z-x,D=E-_,v=x-P*F/Z,g=_-D*F/Z,v=Xs(v,qs(u,x)),g=Xs(g,qs(c,_)),v=qs(v,Xs(u,x)),g=qs(g,Xs(c,_)),P=x-v,D=_-g,z=x+P*Z/F,E=_+D*Z/F}e.bezierCurveTo(h,d,v,g,x,_),h=z,d=E}else e.lineTo(x,_)}u=x,c=_,m+=i}return y}var z8=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),Bue=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="ec-polyline",n}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new z8},t.prototype.buildPath=function(r,n){var a=n.points,i=0,o=a.length/2;if(n.connectNulls){for(;o>0&&Ka(a[o*2-2],a[o*2-1]);o--);for(;i=0){var S=u?(g-l)*w+l:(v-s)*w+s;return u?[r,S]:[S,r]}s=v,l=g;break;case o.C:v=i[h++],g=i[h++],m=i[h++],y=i[h++],x=i[h++],_=i[h++];var C=u?I_(s,v,m,x,r,c):I_(l,g,y,_,r,c);if(C>0)for(var M=0;M=0){var S=u?zr(l,g,y,_,A):zr(s,v,m,x,A);return u?[r,S]:[S,r]}}s=x,l=_;break}}},t}(rt),Fue=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(z8),B8=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="ec-polygon",n}return t.prototype.getDefaultShape=function(){return new Fue},t.prototype.buildPath=function(r,n){var a=n.points,i=n.stackedOnPoints,o=0,s=a.length/2,l=n.smoothMonotone;if(n.connectNulls){for(;s>0&&Ka(a[s*2-2],a[s*2-1]);s--);for(;o=0,i=e.fill||K.color.neutral99;u5(n,t);var o=n.textFill==null;return a?o&&(n.textFill=r.insideFill||K.color.neutral00,!n.textStroke&&r.insideStroke&&(n.textStroke=r.insideStroke),!n.textStroke&&(n.textStroke=i),n.textStrokeWidth==null&&(n.textStrokeWidth=2)):(o&&(n.textFill=e.fill||r.outsideFill||K.color.neutral00),!n.textStroke&&r.outsideStroke&&(n.textStroke=r.outsideStroke)),n.text=t.text,n.rich=t.rich,j(t.rich,function(s){u5(s,s)}),n}function u5(e,t){t&&(ge(t,"fill")&&(e.textFill=t.fill),ge(t,"stroke")&&(e.textStroke=t.fill),ge(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),ge(t,"font")&&(e.font=t.font),ge(t,"fontStyle")&&(e.fontStyle=t.fontStyle),ge(t,"fontWeight")&&(e.fontWeight=t.fontWeight),ge(t,"fontSize")&&(e.fontSize=t.fontSize),ge(t,"fontFamily")&&(e.fontFamily=t.fontFamily),ge(t,"align")&&(e.textAlign=t.align),ge(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),ge(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),ge(t,"width")&&(e.textWidth=t.width),ge(t,"height")&&(e.textHeight=t.height),ge(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),ge(t,"padding")&&(e.textPadding=t.padding),ge(t,"borderColor")&&(e.textBorderColor=t.borderColor),ge(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),ge(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),ge(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),ge(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),ge(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),ge(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),ge(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),ge(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),ge(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),ge(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}function c5(e,t){if(e.length===t.length){for(var r=0;rt){i?r.push(o(i,l,t)):a&&r.push(o(a,l,0),o(a,l,t));break}else a&&(r.push(o(a,l,0)),a=null),r.push(l),i=l}return r}function Hue(e,t,r){var n=e.getVisual("visualMeta");if(!(!n||!n.length||!e.count())&&t.type==="cartesian2d"){for(var a,i,o=n.length-1;o>=0;o--){var s=e.getDimensionInfo(n[o].dimension);if(a=s&&s.coordDim,a==="x"||a==="y"){i=n[o];break}}if(i){var l=t.getAxis(a),u=oe(i.stops,function(w){return{coord:l.toGlobalCoord(l.dataToCoord(w.value)),color:w.color}}),c=u.length,h=i.outerColors.slice();c&&u[0].coord>u[c-1].coord&&(u.reverse(),h.reverse());var d=Gue(u,a==="x"?r.getWidth():r.getHeight()),v=d.length;if(!v&&c)return u[0].coord<0?h[1]?h[1]:u[c-1].color:h[0]?h[0]:u[0].color;var g=10,m=d[0].coord-g,y=d[v-1].coord+g,x=y-m;if(x<.001)return"transparent";j(d,function(w){w.offset=(w.coord-m)/x}),d.push({offset:v?d[v-1].offset:.5,color:h[1]||"transparent"}),d.unshift({offset:v?d[0].offset:.5,color:h[0]||"transparent"});var _=new hh(0,0,0,0,d,!0);return _[a]=m,_[a+"2"]=y,_}}}function Uue(e,t,r){var n=e.get("showAllSymbol"),a=n==="auto";if(!(n&&!a)){var i=r.getAxesByScale("ordinal")[0];if(i&&!(a&&Wue(i,t))){var o=t.mapDimension(i.dim),s={};return j(i.getViewLabels(),function(l){l.tick.offInterval||(s[rv(i.scale,l.tick)]=1)}),function(l){return!s.hasOwnProperty(t.get(o,l))}}}}function Wue(e,t){var r=e.getExtent(),n=Math.abs(r[1]-r[0])/e.scale.count();isNaN(n)&&(n=0);for(var a=t.count(),i=Math.max(1,Math.round(a/5)),o=0;on)return!1;return!0}function Zue(e){for(var t=e.length/2;t>0&&Ka(e[t*2-2],e[t*2-1]);t--);return t-1}function v5(e,t){return[e[t*2],e[t*2+1]]}function $ue(e,t,r){for(var n=e.length/2,a=r==="x"?0:1,i,o,s=0,l=-1,u=0;u=t||i>=t&&o<=t){l=u;break}s=u,i=o}return{range:[s,l],t:(t-i)/(o-i)}}function W8(e){if(e.get(["endLabel","show"]))return!0;for(var t=0;t0&&r.get(["emphasis","lineStyle","width"])==="bolder"){var Z=g.getState("emphasis").style;Z.lineWidth=+g.style.lineWidth+1}Ee(g).seriesIndex=r.seriesIndex,Yt(g,V,U,F);var $=d5(r.get("smooth")),W=r.get("smoothMonotone");if(g.setShape({smooth:$,smoothMonotone:W,connectNulls:A}),m){var q=s.getCalculationInfo("stackedOnSeries"),re=0;m.useStyle(Le(u.getAreaStyle(),{fill:z,opacity:.7,lineJoin:"bevel",decal:s.getVisual("style").decal})),q&&(re=d5(q.get("smooth"))),m.setShape({smooth:$,stackedOnSmooth:re,smoothMonotone:W,connectNulls:A}),Pr(m,r,"areaStyle"),Ee(m).seriesIndex=r.seriesIndex,Yt(m,V,U,F)}var Q=this._changePolyState;s.eachItemGraphicEl(function(me){me&&(me.onHoverStateChange=Q)}),this._polyline.onHoverStateChange=Q,this._data=s,this._coordSys=i,this._stackedOnPoints=C,this._points=c,this._step=P,this._valueOrigin=w;var se=r.get("triggerEvent"),ce=r.get("triggerLineEvent"),Ue=ce===!0||se===!0||se==="line",ye=ce===!0||se===!0||se==="area";this.packEventData(r,g,Ue),m&&this.packEventData(r,m,ye)},t.prototype.packEventData=function(r,n,a){Ee(n).eventData=a?{componentType:"series",componentSubType:"line",componentIndex:r.componentIndex,seriesIndex:r.seriesIndex,seriesName:r.name,seriesType:"line",selfType:n===this._polygon?"area":"line"}:null},t.prototype.highlight=function(r,n,a,i){var o=r.getData(),s=Ec(o,i);if(this._changePolyState("emphasis"),!(s instanceof Array)&&s!=null&&s>=0){var l=o.getLayout("points"),u=o.getItemGraphicEl(s);if(!u){var c=l[s*2],h=l[s*2+1];if(Ka(c,h)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,h))return;var d=r.get("zlevel")||0,v=r.get("z")||0;u=new Hm(o,s),u.x=c,u.y=h,u.setZ(d,v);var g=u.getSymbolPath().getTextContent();g&&(g.zlevel=d,g.z=v,g.z2=this._polyline.z2+1),u.__temp=!0,o.setItemGraphicEl(s,u),u.stopSymbolAnimation(!0),this.group.add(u)}u.highlight()}else At.prototype.highlight.call(this,r,n,a,i)},t.prototype.downplay=function(r,n,a,i){var o=r.getData(),s=Ec(o,i);if(this._changePolyState("normal"),s!=null&&s>=0){var l=o.getItemGraphicEl(s);l&&(l.__temp?(o.setItemGraphicEl(s,null),this.group.remove(l)):l.downplay())}else At.prototype.downplay.call(this,r,n,a,i)},t.prototype._changePolyState=function(r){var n=this._polygon;H_(this._polyline,r),n&&H_(n,r)},t.prototype._newPolyline=function(r){var n=this._polyline;return n&&this._lineGroup.remove(n),n=new Bue({shape:{points:r},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(n),this._polyline=n,n},t.prototype._newPolygon=function(r,n){var a=this._polygon;return a&&this._lineGroup.remove(a),a=new B8({shape:{points:r,stackedOnPoints:n},segmentIgnoreThreshold:2}),this._lineGroup.add(a),this._polygon=a,a},t.prototype._initSymbolLabelAnimation=function(r,n,a){var i,o,s=n.getBaseAxis(),l=s.inverse;n.type==="cartesian2d"?(i=s.isHorizontal(),o=!1):n.type==="polar"&&(i=s.dim==="angle",o=!0);var u=r.hostModel,c=u.get("animationDuration");Me(c)&&(c=c(null));var h=u.get("animationDelay")||0,d=Me(h)?h(null):h;r.eachItemGraphicEl(function(v,g){var m=v;if(m){var y=[v.x,v.y],x=void 0,_=void 0,w=void 0;if(a)if(o){var S=a,C=n.pointToCoord(y);i?(x=S.startAngle,_=S.endAngle,w=-C[1]/180*Math.PI):(x=S.r0,_=S.r,w=C[0])}else{var M=a;i?(x=M.x,_=M.x+M.width,w=v.x):(x=M.y+M.height,_=M.y,w=v.y)}var A=_===x?0:(w-x)/(_-x);l&&(A=1-A);var I=Me(h)?h(g):c*A+d,k=m.getSymbolPath(),P=k.getTextContent();m.attr({scaleX:0,scaleY:0}),m.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:I}),P&&P.animateFrom({style:{opacity:0}},{duration:300,delay:I}),k.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(r,n,a){var i=r.getModel("endLabel");if(W8(r)){var o=r.getData(),s=this._polyline,l=o.getLayout("points");if(!l){s.removeTextContent(),this._endLabel=null;return}var u=this._endLabel;u||(u=this._endLabel=new ht({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var c=Zue(l);c>=0&&(Hr(s,Dr(r,"endLabel"),{inheritColor:a,labelFetcher:r,labelDataIndex:c,defaultText:function(h,d,v){return v!=null?j8(o,v):bd(o,h)},enableTextSetter:!0},Yue(i,n)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},t.prototype._endLabelOnDuring=function(r,n,a,i,o,s,l){var u=this._endLabel,c=this._polyline;if(u){r<1&&i.originalX==null&&(i.originalX=u.x,i.originalY=u.y);var h=a.getLayout("points"),d=a.hostModel,v=d.get("connectNulls"),g=s.get("precision"),m=s.get("distance")||0,y=l.getBaseAxis(),x=y.isHorizontal(),_=y.inverse,w=n.shape,S=_?x?w.x:w.y+w.height:x?w.x+w.width:w.y,C=(x?m:0)*(_?-1:1),M=(x?0:-m)*(_?-1:1),A=x?"x":"y",I=$ue(h,S,A),k=I.range,P=k[1]-k[0],D=void 0;if(P>=1){if(P>1&&!v){var z=v5(h,k[0]);u.attr({x:z[0]+C,y:z[1]+M}),o&&(D=d.getRawValue(k[0]))}else{var z=c.getPointOn(S,A);z&&u.attr({x:z[0]+C,y:z[1]+M});var E=d.getRawValue(k[0]),B=d.getRawValue(k[1]);o&&(D=GG(a,g,E,B,I.t))}i.lastFrameIndex=k[0]}else{var H=r===1||i.lastFrameIndex>0?k[0]:0,z=v5(h,H);o&&(D=d.getRawValue(H)),u.attr({x:z[0]+C,y:z[1]+M})}if(o){var V=Yd(u);typeof V.setLabelText=="function"&&V.setLabelText(D)}}},t.prototype._doUpdateAnimation=function(r,n,a,i,o,s,l){var u=this._polyline,c=this._polygon,h=r.hostModel,d=zue(this._data,r,this._stackedOnPoints,n,this._coordSys,a,this._valueOrigin),v=d.current,g=d.stackedOnCurrent,m=d.next,y=d.stackedOnNext;if(o&&(g=Ks(d.stackedOnCurrent,d.current,a,o,l),v=Ks(d.current,null,a,o,l),y=Ks(d.stackedOnNext,d.next,a,o,l),m=Ks(d.next,null,a,o,l)),f5(v,m)>3e3||c&&f5(g,y)>3e3){u.stopAnimation(),u.setShape({points:m}),c&&(c.stopAnimation(),c.setShape({points:m,stackedOnPoints:y}));return}u.shape.__points=d.current,u.shape.points=v;var x={shape:{points:m}};d.current!==v&&(x.shape.__points=d.next),u.stopAnimation(),mt(u,x,h),c&&(c.setShape({points:v,stackedOnPoints:g}),c.stopAnimation(),mt(c,{shape:{stackedOnPoints:y}},h),u.shape.points!==c.shape.points&&(c.shape.points=u.shape.points));for(var _=[],w=d.status,S=0;St&&(t=e[r]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,r=0;r10&&o.type==="cartesian2d"&&i){var l=o.getBaseAxis(),u=o.getOtherAxis(l),c=l.getExtent(),h=n.getDevicePixelRatio(),d=Math.abs(c[1]-c[0])*(h||1),v=Math.round(s/d);if(isFinite(v)&&v>1){i==="lttb"?t.setData(a.lttbDownSample(a.mapDimension(u.dim),1/v)):i==="minmax"&&t.setData(a.minmaxDownSample(a.mapDimension(u.dim),1/v));var g=void 0;ue(i)?g=que[i]:Me(i)&&(g=i),g&&t.setData(a.downSample(a.mapDimension(u.dim),1/v,g,Kue))}}}}}function Jue(e){e.registerChartView(Xue),e.registerSeriesModel(Pue),e.registerLayout(Wm("line",!0)),e.registerVisual({seriesType:"line",reset:function(t){var r=t.getData(),n=t.getModel("lineStyle").getLineStyle();n&&!n.stroke&&(n.stroke=r.getVisual("style").fill),r.setVisual("legendLineStyle",n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,Z8("line"))}var $8=function(e){X(t,e);function t(r,n,a,i,o){var s=e.call(this,r,n,a)||this;return s.index=0,s.type=i||"value",s.position=o||"bottom",s}return t.prototype.isHorizontal=function(){var r=this.position;return r==="top"||r==="bottom"},t.prototype.getGlobalExtent=function(r){var n=this.getExtent();return n[0]=this.toGlobalCoord(n[0]),n[1]=this.toGlobalCoord(n[1]),r&&n[0]>n[1]&&n.reverse(),n},t.prototype.pointToData=function(r,n){return this.coordToData(this.toLocalCoord(r[this.dim==="x"?0:1]),n)},t.prototype.setCategorySortInfo=function(r){if(this.type!=="category")return!1;this.model.option.categorySortInfo=r,this.scale.setSortInfo(r)},t}(ui),yA=null;function Que(e){yA||(yA=e)}function Zm(){return yA}var tw="expandAxisBreak",Y8="collapseAxisBreak",X8="toggleAxisBreak",lI="axisbreakchanged",ece={type:tw,event:lI,update:"update",refineEvent:uI},tce={type:Y8,event:lI,update:"update",refineEvent:uI},rce={type:X8,event:lI,update:"update",refineEvent:uI};function uI(e,t,r,n){var a=[];return j(e,function(i){a=a.concat(i.eventBreaks)}),{eventContent:{breaks:a}}}function nce(e){e.registerAction(ece,t),e.registerAction(tce,t),e.registerAction(rce,t);function t(r,n){var a=[],i=Wf(n,r);function o(s,l){j(i[s],function(u){var c=u.updateAxisBreaks(r);j(c.breaks,function(h){var d;a.push(Le((d={},d[l]=u.componentIndex,d),h))})})}return o("xAxisModels","xAxisIndex"),o("yAxisModels","yAxisIndex"),o("singleAxisModels","singleAxisIndex"),{eventBreaks:a}}}var pl=Math.PI,ace=[[1,2,1,2],[5,3,5,3],[8,3,8,3]],ice=[[0,1,0,1],[0,3,0,3],[0,3,0,3]],$c=Ze(),q8=Ze(),K8=function(){function e(t){this.recordMap={},this.resolveAxisNameOverlap=t}return e.prototype.ensureRecord=function(t){var r=t.axis.dim,n=t.componentIndex,a=this.recordMap,i=a[r]||(a[r]=[]);return i[n]||(i[n]={ready:{}})},e}();function oce(e,t,r,n){var a=r.axis,i=t.ensureRecord(r),o=[],s,l=cI(e.axisName)&&yd(e.nameLocation);j(n,function(g){var m=jo(g);if(!(!m||m.label.ignore)){o.push(m);var y=i.transGroup;l&&(y.transform?Ma(Qv,y.transform):sh(Qv),m.transform&&Ca(Qv,Qv,m.transform),ke.copy(P0,m.localRect),P0.applyTransform(Qv),s?s.union(P0):ke.copy(s=new ke(0,0,0,0),P0))}});var u=Math.abs(i.dirVec.x)>.1?"x":"y",c=i.transGroup[u];if(o.sort(function(g,m){return Math.abs(g.label[u]-c)-Math.abs(m.label[u]-c)}),l&&s){var h=a.getExtent(),d=Math.min(h[0],h[1]),v=Math.max(h[0],h[1])-d;s.union(new ke(d,0,v,1))}i.stOccupiedRect=s,i.labelInfoList=o}var Qv=$t(),P0=new ke(0,0,0,0),J8=function(e,t,r,n,a,i){if(yd(e.nameLocation)){var o=i.stOccupiedRect;o&&Q8(Ole({},o,i.transGroup.transform),n,a)}else eW(i.labelInfoList,i.dirVec,n,a)};function Q8(e,t,r){var n=new Pe;Q1(e,t,n,{direction:Math.atan2(r.y,r.x),bidirectional:!1,touchThreshold:.05})&&cA(t,n)}function eW(e,t,r,n){for(var a=Pe.dot(n,t)>=0,i=0,o=e.length;i0?"top":"bottom",i="center"):Pc(a-pl)?(o=n>0?"bottom":"top",i="center"):(o="middle",a>0&&a0?"right":"left":i=n>0?"left":"right"),{rotation:a,textAlign:i,textVerticalAlign:o}},e.makeAxisEventDataBase=function(t){var r={componentType:t.mainType,componentIndex:t.componentIndex};return r[t.mainType+"Index"]=t.componentIndex,r},e.isLabelSilent=function(t){var r=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||r&&r.show)},e}(),sce=["axisLine","axisTickLabelEstimate","axisTickLabelDetermine","axisName"],lce={axisLine:function(e,t,r,n,a,i,o){var s=n.get(["axisLine","show"]);if(s==="auto"&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),!!s){var l=n.axis.getExtent(),u=i.transform,c=[l[0],0],h=[l[1],0],d=c[0]>h[0];u&&(ir(c,c,u),ir(h,h,u));var v=te({lineCap:"round"},n.getModel(["axisLine","lineStyle"]).getLineStyle()),g={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:v};if(n.get(["axisLine","breakLine"])&&$_(n.axis.scale))Zm().buildAxisBreakLine(n,a,i,g);else{var m=new yr(te({shape:{x1:c[0],y1:c[1],x2:h[0],y2:h[1]}},g));vd(m.shape,m.style.lineWidth),m.anid="line",a.add(m)}var y=n.get(["axisLine","symbol"]);if(y!=null){var x=n.get(["axisLine","symbolSize"]);ue(y)&&(y=[y,y]),(ue(x)||ft(x))&&(x=[x,x]);var _=gh(n.get(["axisLine","symbolOffset"])||0,x),w=x[0],S=x[1];j([{rotate:e.rotation+Math.PI/2,offset:_[0],r:0},{rotate:e.rotation-Math.PI/2,offset:_[1],r:Math.sqrt((c[0]-h[0])*(c[0]-h[0])+(c[1]-h[1])*(c[1]-h[1]))}],function(C,M){if(y[M]!=="none"&&y[M]!=null){var A=_r(y[M],-w/2,-S/2,w,S,v.stroke,!0),I=C.r+C.offset,k=d?h:c;A.attr({rotation:C.rotate,x:k[0]+I*Math.cos(e.rotation),y:k[1]-I*Math.sin(e.rotation),silent:!0,z2:11}),a.add(A)}})}}},axisTickLabelEstimate:function(e,t,r,n,a,i,o,s){var l=g5(t,a,s);l&&p5(e,t,r,n,a,i,o,Di.estimate)},axisTickLabelDetermine:function(e,t,r,n,a,i,o,s){var l=g5(t,a,s);l&&p5(e,t,r,n,a,i,o,Di.determine);var u=fce(e,a,i,n);hce(e,t.labelLayoutList,u),dce(e,a,i,n,e.tickDirection)},axisName:function(e,t,r,n,a,i,o,s){var l=r.ensureRecord(n);t.nameEl&&(a.remove(t.nameEl),t.nameEl=l.nameLayout=l.nameLocation=null);var u=e.axisName;if(cI(u)){var c=e.nameLocation,h=e.nameDirection,d=n.getModel("nameTextStyle"),v=n.get("nameGap")||0,g=n.axis.getExtent(),m=n.axis.inverse?-1:1,y=new Pe(0,0),x=new Pe(0,0);c==="start"?(y.x=g[0]-m*v,x.x=-m):c==="end"?(y.x=g[1]+m*v,x.x=m):(y.x=(g[0]+g[1])/2,y.y=e.labelOffset+h*v,x.y=h);var _=$t();x.transform(js(_,_,e.rotation));var w=n.get("nameRotate");w!=null&&(w=w*pl/180);var S,C;yd(c)?S=Vn.innerTextLayout(e.rotation,w??e.rotation,h):(S=uce(e.rotation,c,w||0,g),C=e.raw.axisNameAvailableWidth,C!=null&&(C=Math.abs(C/Math.sin(S.rotation)),!isFinite(C)&&(C=null)));var M=d.getFont(),A=n.get("nameTruncate",!0)||{},I=A.ellipsis,k=Mn(e.raw.nameTruncateMaxWidth,A.maxWidth,C),P=s.nameMarginLevel||0,D=new ht({x:y.x,y:y.y,rotation:S.rotation,silent:Vn.isLabelSilent(n),style:Et(d,{text:u,font:M,overflow:"truncate",width:k,ellipsis:I,fill:d.getTextColor()||n.get(["axisLine","lineStyle","color"]),align:d.get("align")||S.textAlign,verticalAlign:d.get("verticalAlign")||S.textVerticalAlign}),z2:1});if(Os({el:D,componentModel:n,itemName:u}),D.__fullText=u,D.anid="name",n.get("triggerEvent")){var z=Vn.makeAxisEventDataBase(n);z.targetType="axisName",z.name=u,Ee(D).eventData=z}i.add(D),D.updateTransform(),t.nameEl=D;var E=l.nameLayout=jo({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:yd(c)?ace[P]:ice[P]});if(l.nameLocation=c,a.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&E){var B=r.ensureRecord(n);r.resolveAxisNameOverlap(e,r,n,E,x,B)}}}};function p5(e,t,r,n,a,i,o,s){rW(t)||vce(e,t,a,s,n,o);var l=t.labelLayoutList;pce(e,n,l,i),yce(n,e.rotation,l);var u=e.optionHideOverlap;cce(n,l,u),u&&g8(wt(l,function(c){return c&&!c.label.ignore})),oce(e,r,n,l)}function uce(e,t,r,n){var a=Ek(r-e),i,o,s=n[0]>n[1],l=t==="start"&&!s||t!=="start"&&s;return Pc(a-pl/2)?(o=l?"bottom":"top",i="center"):Pc(a-pl*1.5)?(o=l?"top":"bottom",i="center"):(o="middle",apl/2?i=l?"left":"right":i=l?"right":"left"),{rotation:a,textAlign:i,textVerticalAlign:o}}function cce(e,t,r){var n=e.axis,a=e.get(["axisLabel","customValues"]);if(Sse(n))return;function i(u,c,h){var d=jo(t[c]),v=jo(t[h]),g=n.scale;if(!(!d||!v)){if(u==null){if(!r&&a)return;var m=$c(d.label).labelInfo.tick;if(Bm(g)&&m.notNice||Ln(g)&&m.offInterval){vf(d.label);return}}if(u===!1||d.suggestIgnore){vf(d.label);return}if(v.suggestIgnore){vf(v.label);return}var y=.1;if(!r){var x=[0,0,0,0];d=hA({marginForce:x},d),v=hA({marginForce:x},v)}Q1(d,v,null,{touchThreshold:y})&&vf(u?v.label:d.label)}}var o=e.get(["axisLabel","showMinLabel"]),s=e.get(["axisLabel","showMaxLabel"]),l=t.length;i(o,0,1),i(s,l-1,l-2)}function hce(e,t,r){e.showMinorTicks||j(t,function(n){if(n&&n.label.ignore)for(var a=0;a=0&&w(M,S,C.getStore())})}var v=0;if(d(function(w,S,C){n.set(S.uid,1),(!a||!a.hasKey(S.uid))&&(o=!0),v+=C.count()}),(!a||a.keys().length!==n.keys().length)&&(o=!0),!o&&i!=null){t.liPosMinGap=i;return}sI(Fu,v);var g=0;d(function(w,S,C){for(var M=0,A=C.count();M0&&_0?ZU:Ase,r.serUids=n}var Fu=sI({ctor:Rue},50);function rw(e){return function(t,r){var n=pn(t,{fromStat:{key:e}});if(ni(n.w2))return[-n.w2/2,n.w2/2]}}function bc(e){return e+ub}function mh(e,t){return e+ub+t}function hI(e){return Cce(),{liPosMinGap:!Ln(e.scale)}}var bo="bar",rm="pictorialBar";function nW(e,t,r,n){KL(e,{key:t,seriesType:r,coordSysType:n,getMetrics:hI})}function aW(e){var t=e.scale.rawExtentInfo.makeRenderInfo().startValue;return t}var iW={left:0,right:0,top:0,bottom:0},yb=["25%","25%"],Li="cartesian2d",Mce=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(r,n){var a=vh(r.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),a&&r.outerBounds&&Eo(r.outerBounds,a)},t.prototype.mergeOption=function(r,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&r.outerBounds&&Eo(this.option.outerBounds,r.outerBounds)},t.type="grid",t.dependencies=["xAxis","yAxis"],t.layoutMode="box",t.defaultOption={show:!1,z:0,left:"15%",top:65,right:"10%",bottom:80,containLabel:!1,outerBoundsMode:"auto",outerBounds:iW,outerBoundsContain:"all",outerBoundsClampWidth:yb[0],outerBoundsClampHeight:yb[1],backgroundColor:K.color.transparent,borderWidth:1,borderColor:K.color.neutral30},t}(Qe),Ace=Fd(),_A="__ec_stack_";function oW(e){return e.get("stack")||_A+e.seriesIndex}function Nce(e){if(Ln(e.axis.scale)){for(var t=pn(e.axis),r=[],n=0;nw&&(w=_),w!==c&&(y.width=w,r-=w+u*w,n--)}}),c=(r-l)/(n+(n-1)*u),c=qe(c,0);var h=0,d;j(o,function(m){var y=s[m];y.width||(y.width=c),d=y,h+=y.width*(1+u)}),d&&(h-=d.width*u);var v={},g=-h/2;return j(o,function(m){var y=s[m];v[m]=v[m]||{bandWidth:t,offset:g,width:y.width},g+=y.width*(1+u)}),v}function lW(e){return{seriesType:e,overallReset:function(t){var r=mh(e,Li);qL(t,r,function(n){var a=kce(n,e);Gc(n,r,function(i){var o=a.columnMap[oW(i)];i.getData().setLayout({bandWidth:o.bandWidth,offset:o.offset,size:o.width})})})}}}function uW(e){return{seriesType:e,plan:ph(),reset:function(t){if(xce(t)){var r=t.getData(),n=t.coordinateSystem,a=n.getBaseAxis(),i=n.getOtherAxis(a),o=r.getDimensionIndex(r.mapDimension(i.dim)),s=r.getDimensionIndex(r.mapDimension(a.dim)),l=t.get("showBackground",!0),u=r.mapDimension(i.dim),c=r.getCalculationInfo("stackResultDimension"),h=Ls(r,u)&&!!r.getCalculationInfo("stackedOnSeries"),d=i.isHorizontal(),v=i.toGlobalCoord(i.dataToCoord(aW(i))),g=cW(t),m=t.get("barMinHeight")||0,y=c&&r.getDimensionIndex(c),x=r.getLayout("size"),_=r.getLayout("offset");return{progress:function(w,S){for(var C=w.count,M=g&&co(C*3),A=g&&l&&co(C*3),I=g&&co(C),k=n.master.getRect(),P=d?k.width:k.height,D,z=S.getStore(),E=0;(D=w.next())!=null;){var B=z.get(h?y:o,D),H=z.get(s,D),V=v,U=void 0;h&&(U=+B-z.get(o,D));var F=void 0,Z=void 0,$=void 0,W=void 0;if(d){var q=n.dataToPoint([B,H]);h&&(V=n.dataToPoint([U,H])[0]),F=V,Z=q[1]+_,$=q[0]-V,W=x,nr($)y){w=(M+_)/2;break}C===1&&(S=A-g[0].tickValue)}w==null&&(_?_&&(w=g[g.length-1].coord):w=g[0].coord),s[v]=d.toGlobalCoord(w)}});else{var l=this.getData(),u=l.getLayout("offset"),c=l.getLayout("size"),h=i.getBaseAxis().isHorizontal()?0:1;s[h]+=u+c/2}return s}return[NaN,NaN]},t.prototype.__requireStartValue=function(r){return this.getBaseAxis()!==r},t.type="series.__base_bar__",t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod",defaultBarGap:"10%"},t}(Pt);Pt.registerClass(nm);var Pce=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(){return Go(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},t.prototype.getProgressive=function(){return this.get("large")?this.get("progressive"):!1},t.prototype.__preparePipelineContext=function(r,n){var a=WG(this,r,n);return a.progressiveRender&&(a.large=!0),a},t.prototype.brushSelector=function(r,n,a){return a.rect(n.getItemLayout(r))},t.type="series."+bo,t.dependencies=["grid","polar"],t.defaultOption=iu(nm.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:K.color.primary,borderWidth:2}},realtimeSort:!1}),t}(nm),Dce=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),xb=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="sausage",n}return t.prototype.getDefaultShape=function(){return new Dce},t.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.max(n.r0||0,0),s=Math.max(n.r,0),l=(s-o)*.5,u=o+l,c=n.startAngle,h=n.endAngle,d=n.clockwise,v=Math.PI*2,g=d?h-cMath.PI/2&&cs)return!0;s=h}return!1},t.prototype._isOrderDifferentInView=function(r,n){for(var a=n.scale,i=a.getExtent(),o=Math.max(0,i[0]),s=Math.min(i[1],a.getOrdinalMeta().categories.length-1);o<=s;++o)if(r.ordinalNumbers[o]!==a.getRawOrdinalNumber(o))return!0},t.prototype._updateSortWithinSameData=function(r,n,a,i){if(this._isOrderChangedWithinSameData(r,n,a)){var o=this._dataSort(r,a,n);this._isOrderDifferentInView(o,a)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:a.dim+"Axis",axisId:a.index,sortInfo:o}))}},t.prototype._dispatchInitSort=function(r,n,a){var i=n.baseAxis,o=this._dataSort(r,i,function(s){return r.get(r.mapDimension(n.otherAxis.dim),s)});a.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.index,sortInfo:o})},t.prototype.remove=function(r,n){this._clear(this._model),this._removeOnRenderedListener(n)},t.prototype.dispose=function(r,n){this._removeOnRenderedListener(n)},t.prototype._removeOnRenderedListener=function(r){this._onRendered&&(r.getZr().off("rendered",this._onRendered),this._onRendered=null)},t.prototype._clear=function(r){var n=this.group,a=this._data;r&&r.isAnimationEnabled()&&a&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],a.eachItemGraphicEl(function(i){vs(i,r,Ee(i).dataIndex)})):n.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=bo,t}(At),m5={cartesian2d:function(e,t){var r=t.width<0?-1:1,n=t.height<0?-1:1;r<0&&(t.x+=t.width,t.width=-t.width),n<0&&(t.y+=t.height,t.height=-t.height);var a=e.x+e.width,i=e.y+e.height,o=DC(t.x,e.x),s=EC(t.x+t.width,a),l=DC(t.y,e.y),u=EC(t.y+t.height,i),c=sa?s:o,t.y=h&&l>i?u:l,t.width=c?0:s-o,t.height=h?0:u-l,r<0&&(t.x+=t.width,t.width=-t.width),n<0&&(t.y+=t.height,t.height=-t.height),c||h},polar:function(e,t){var r=t.r0<=t.r?1:-1;if(r<0){var n=t.r;t.r=t.r0,t.r0=n}var a=EC(t.r,e.r),i=DC(t.r0,e.r0);t.r=a,t.r0=i;var o=a-i<0;if(r<0){var n=t.r;t.r=t.r0,t.r0=n}return o}},y5={cartesian2d:function(e,t,r,n,a,i,o,s,l){var u=new Ke({shape:te({},n),z2:1});if(u.__dataIndex=r,u.name="item",i){var c=u.shape,h=a?"height":"width";c[h]=0}return u},polar:function(e,t,r,n,a,i,o,s,l){var u=!a&&l?xb:dn,c=new u({shape:n,z2:1});c.name="item";var h=fW(a);if(c.calculateTextPosition=Ece(h,{isRoundCap:u===xb}),i){var d=c.shape,v=a?"r":"endAngle",g={};d[v]=a?n.r0:n.startAngle,g[v]=n[v],(s?mt:Ut)(c,{shape:g},i)}return c}};function Oce(e,t){var r=e.get("realtimeSort",!0),n=t.getBaseAxis();if(r&&n.type==="category"&&t.type==="cartesian2d")return{baseAxis:n,otherAxis:t.getOtherAxis(n)}}function x5(e,t,r,n,a,i,o,s){var l,u;i?(u={x:n.x,width:n.width},l={y:n.y,height:n.height}):(u={y:n.y,height:n.height},l={x:n.x,width:n.width}),s||(o?mt:Ut)(r,{shape:l},t,a,null);var c=t?e.baseAxis.model:null;(o?mt:Ut)(r,{shape:u},c,a)}function _5(e,t){for(var r=0;r0?1:-1,o=n.height>0?1:-1;return{x:n.x+i*a/2,y:n.y+o*a/2,width:n.width-i*a,height:n.height-o*a}},polar:function(e,t,r){var n=e.getItemLayout(t);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}}};function Fce(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function fW(e){return function(t){var r=t?"Arc":"Angle";return function(n){switch(n){case"start":case"insideStart":case"end":case"insideEnd":return n+r;default:return n}}}(e)}function w5(e,t,r,n,a,i,o,s){var l=t.getItemVisual(r,"style");if(s){if(!i.get("roundCap")){var c=e.shape,h=ho(n.getModel("itemStyle"),c,!0);te(c,h),e.setShape(c)}}else{var u=n.get(["itemStyle","borderRadius"])||0;e.setShape("r",u)}e.useStyle(l);var d=n.getShallow("cursor");d&&e.attr("cursor",d);var v=s?o?a.r>=a.r0?"endArc":"startArc":a.endAngle>=a.startAngle?"endAngle":"startAngle":o?Wce(a,i.coordinateSystem):Zce(a,i.coordinateSystem),g=Dr(n);Hr(e,g,{labelFetcher:i,labelDataIndex:r,defaultText:bd(i.getData(),r),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:v});var m=e.getTextContent();if(s&&m){var y=n.get(["label","position"]);e.textConfig.inside=y==="middle"?!0:null,jce(e,y==="outside"?v:y,fW(o),n.get(["label","rotate"]))}FH(m,g,i.getRawValue(r),function(_){return j8(t,_)});var x=n.getModel(["emphasis"]);Yt(e,x.get("focus"),x.get("blurScope"),x.get("disabled")),Pr(e,n),Fce(a)&&(e.style.fill="none",e.style.stroke="none",j(e.states,function(_){_.style&&(_.style.fill=_.style.stroke="none")}))}function Vce(e,t){var r=e.get(["itemStyle","borderColor"]);if(!r||r==="none")return 0;var n=e.get(["itemStyle","borderWidth"])||0,a=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),i=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(n,a,i)}var Gce=function(){function e(){}return e}(),S5=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="largeBar",n}return t.prototype.getDefaultShape=function(){return new Gce},t.prototype.buildPath=function(r,n){for(var a=n.points,i=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],u=this.barWidth,c=0;c=0?r:null},30,!1);function Hce(e,t,r){for(var n=e.baseDimIdx,a=1-n,i=e.shape.points,o=e.largeDataIndices,s=[],l=[],u=e.barWidth,c=0,h=i.length/3;c=s[0]&&t<=s[0]+l[0]&&r>=s[1]&&r<=s[1]+l[1])return o[c]}return-1}function dW(e,t,r){if(Zc(r,"cartesian2d")){var n=t,a=r.getArea();return{x:e?n.x:a.x,y:e?a.y:n.y,width:e?n.width:a.width,height:e?a.height:n.height}}else{var a=r.getArea(),i=t;return{cx:a.cx,cy:a.cy,r0:e?a.r0:i.r0,r:e?a.r:i.r,startAngle:e?i.startAngle:0,endAngle:e?i.endAngle:Math.PI*2}}}function Uce(e,t,r){var n=e.type==="polar"?dn:Ke;return new n({shape:dW(t,r,e),silent:!0,z2:0})}function Wce(e,t){if(e.height===0){var r=t.getOtherAxis(t.getBaseAxis());return r.inverse?"bottom":"top"}return e.height>0?"bottom":"top"}function Zce(e,t){if(e.width===0){var r=t.getOtherAxis(t.getBaseAxis());return r.inverse?"left":"right"}return e.width>=0?"right":"left"}function $ce(e){e.registerChartView(Rce),e.registerSeriesModel(Pce),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,lW(bo)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,uW(bo)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,Z8(bo)),e.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(t,r){var n=t.componentType||"series";r.eachComponent({mainType:n,query:t},function(a){t.sortInfo&&a.axis.setCategorySortInfo(t.sortInfo)})}),hW(e)}function $m(e){return{seriesType:e,reset:function(t,r){var n=r.findComponents({mainType:"legend"});if(!(!n||!n.length)){var a=t.getData();a.filterSelf(function(i){for(var o=a.getName(i),s=0;s=0},e.prototype.indexOfName=function(t){var r=this._getDataWithEncodedVisual();return r.indexOfName(t)},e.prototype.getItemVisual=function(t,r){var n=this._getDataWithEncodedVisual();return n.getItemVisual(t,r)},e}(),El="pie",Yce=Ze(),vW=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new ov(ve(this.getData,this),ve(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return iv(this,{coordDimensions:["value"],encodeDefaulter:Xe(bL,this)})},t.prototype.getDataParams=function(r){var n=this.getData(),a=Yce(n),i=a.seats;if(!i){var o=[];n.each(n.mapDimension("value"),function(l){o.push(l)}),i=a.seats=DG(o,n.hostModel.get("percentPrecision"))}var s=e.prototype.getDataParams.call(this,r);return s.percent=i[r]||0,s.$vars.push("percent"),s},t.prototype._defaultLabelLine=function(r){Dc(r,"labelLine",["show"]);var n=r.labelLine,a=r.emphasis.labelLine;n.show=n.show&&r.label.show,a.show=a.show&&r.emphasis.label.show},t.type="series."+El,t.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",center:["50%","50%"],radius:[0,"50%"],clockwise:!0,startAngle:90,endAngle:"auto",padAngle:0,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,coordinateSystemUsage:"box",left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:"truncate",position:"outer",alignTo:"none",edgeDistance:"25%",distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:30,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:"solid"}},itemStyle:{borderWidth:1,borderJoin:"round"},showEmptyCircle:!0,emptyCircleStyle:{color:"lightgray",opacity:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:"expansion",animationDuration:1e3,animationTypeUpdate:"transition",animationEasingUpdate:"cubicInOut",animationDurationUpdate:500,animationEasing:"cubicInOut"},t}(Pt);Hne({fullType:vW.type,getCoord2:function(e){return e.getShallow("center")}});var Xce=Math.PI/180;function M5(e,t,r,n,a,i,o,s,l,u){if(e.length<2)return;function c(m){for(var y=m.rB,x=y*y,_=0;_r?x:y,C=Math.abs(w.label.y-r);if(C>=S.maxY){var M=w.label.x-t-w.len2*a,A=n+w.len,I=Math.abs(M)e.unconstrainedWidth?null:d:null;n.setStyle("width",v)}gW(i,n)}}}function gW(e,t){A5.rect=e,p8(A5,t,Kce)}var Kce={minMarginForce:[null,0,null,0],marginDefault:[1,0,1,0]},A5={};function jC(e){return e.position==="center"}function Jce(e){var t=e.getData(),r=[],n,a,i=!1,o=(e.get("minShowLabelAngle")||0)*Xce,s=t.getLayout("viewRect"),l=t.getLayout("r"),u=s.width,c=s.x,h=s.y,d=s.height;function v(M){M.ignore=!0}function g(M){if(!M.ignore)return!0;for(var A in M.states)if(M.states[A].ignore===!1)return!0;return!1}t.each(function(M){var A=t.getItemGraphicEl(M),I=A.shape,k=A.getTextContent(),P=A.getTextGuideLine(),D=t.getItemModel(M),z=D.getModel("label"),E=z.get("position")||D.get(["emphasis","label","position"]),B=z.get("distanceToLabelLine"),H=z.get("alignTo"),V=fe(z.get("edgeDistance"),u),U=z.get("bleedMargin");U==null&&(U=Math.min(u,d)>200?10:2);var F=D.getModel("labelLine"),Z=F.get("length");Z=fe(Z,u);var $=F.get("length2");if($=fe($,u),Math.abs(I.endAngle-I.startAngle)0?"right":"left":q>0?"left":"right"}var vt=Math.PI,dt=0,Ft=z.get("rotate");if(ft(Ft))dt=Ft*(vt/180);else if(E==="center")dt=0;else if(Ft==="radial"||Ft===!0){var dr=q<0?-W+vt:-W;dt=dr}else if(Ft==="tangential"||Ft==="tangential-noflip"&&E!=="outside"&&E!=="outer"){var Rr=Math.atan2(q,re);Rr<0&&(Rr=vt*2+Rr);var Xt=re>0;Xt&&Ft!=="tangential-noflip"&&(Rr=vt+Rr),dt=Rr-vt}if(i=!!dt,k.x=Q,k.y=se,k.rotation=dt,k.setStyle({verticalAlign:"middle"}),ye){k.setStyle({align:Ue});var Fi=k.states.select;Fi&&(Fi.x+=k.x,Fi.y+=k.y)}else{var mn=new ke(0,0,0,0);gW(mn,k),r.push({label:k,labelLine:P,position:E,len:Z,len2:$,minTurnAngle:F.get("minTurnAngle"),maxSurfaceAngle:F.get("maxSurfaceAngle"),surfaceNormal:new Pe(q,re),linePoints:ce,textAlign:Ue,labelDistance:B,labelAlignTo:H,edgeDistance:V,bleedMargin:U,rect:mn,unconstrainedWidth:mn.width,labelStyleWidth:k.style.width})}A.setTextConfig({inside:ye})}}),!i&&e.get("avoidLabelOverlap")&&qce(r,n,a,l,u,d,c,h);for(var m=0;mF?($=B+A*F/2,W=$):($=B+k,W=Z-k),n.setItemLayout(U,{angle:F,startAngle:$,endAngle:W,clockwise:w,cx:o,cy:s,r0:u,r:S?xt(V,M,[u,l]):l}),B=Z}),z0){for(var c=o.getItemLayout(0),h=1;isNaN(c&&c.startAngle)&&h=i.r0}},t.type=El,t}(At);function nhe(e){return{seriesType:e,reset:function(t,r){var n=t.getData();n.filterSelf(function(a){var i=n.mapDimension("value"),o=n.get(i,a);return!(ft(o)&&!isNaN(o)&&o<0)})}}}function ahe(e){e.registerChartView(rhe),e.registerSeriesModel(vW),eU(El,e.registerAction),e.registerLayout(Qce),e.registerProcessor($m(El)),e.registerProcessor(nhe(El))}var ihe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r}return t.prototype.getInitialData=function(r,n){return Go(null,this,{useEncodeDefaulter:!0})},t.prototype.getProgressive=function(){var r=this.option.progressive;return r??(this.option.large?5e3:this.get("progressive"))},t.prototype.getProgressiveThreshold=function(){var r=this.option.progressiveThreshold;return r??(this.option.large?1e4:this.get("progressiveThreshold"))},t.prototype.brushSelector=function(r,n,a){return a.point(n.getItemLayout(r))},t.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},t.type="series.scatter",t.dependencies=["grid","polar","geo","singleAxis","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:K.color.primary}},universalTransition:{divideShape:"clone"}},t}(Pt),yW=4,ohe=function(){function e(){}return e}(),she=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.getDefaultShape=function(){return new ohe},t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.beforeBrush=function(r){r&&!r.contentRetained&&this.reset()},t.prototype.buildPath=function(r,n){var a=n.points,i=n.size,o=this.symbolProxy,s=o.shape,l=r.getContext?r.getContext():r,u=l&&i[0]=0;u--){var c=u*2,h=i[c]-s/2,d=i[c+1]-l/2;if(r>=h&&n>=d&&r<=h+s&&n<=d+l)return u}return-1},t.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();if(r=a[0],n=a[1],i.contain(r,n)){var o=this.hoverDataIdx=this.findDataIndex(r,n);return o>=0}return this.hoverDataIdx=-1,!1},t.prototype.getBoundingRect=function(){var r=this._rect;if(!r){for(var n=this.shape,a=n.points,i=n.size,o=i[0],s=i[1],l=1/0,u=1/0,c=-1/0,h=-1/0,d=0;d=0&&(u.dataIndex=h+(t.startIndex||0))})},e.prototype.remove=function(){this._clear()},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),uhe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){var i=r.getData(),o=this._updateSymbolDraw(i,r);o.updateData(i,RC(r)),this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,a){var i=r.getData(),o=this._updateSymbolDraw(i,r);o.incrementalPrepareUpdate(i),this._finished=!1},t.prototype.incrementalRender=function(r,n,a){this._symbolDraw.incrementalUpdate(r,n.getData(),_o(n),RC(n)),this._finished=r.end===n.getData().count()},t.prototype.updateTransform=function(r,n,a){var i=r.getData();if(this.group.dirty(),this._finished){var o=Wm("").reset(r,n,a);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(RC(r))}else return{update:!0}},t.prototype.eachRendered=function(r){this._symbolDraw&&this._symbolDraw.eachRendered(r)},t.prototype._updateSymbolDraw=function(r,n){var a=this._symbolDraw,i=n.pipelineContext,o=i.large;return(!a||o!==this._isLargeDraw)&&(a&&a.remove(),a=this._symbolDraw=o?new lhe:new Um,this._isLargeDraw=o,this.group.removeAll()),this.group.add(a.group),a},t.prototype.remove=function(r,n){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},t.prototype.dispose=function(){},t.type="scatter",t}(At);function RC(e){return{clipShape:G8(e)}}var bA=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",sr).models[0]},t.type="cartesian2dAxis",t}(Qe);br(bA,nv);var xW={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:"auto",onZeroAxisIndex:null,lineStyle:{color:K.color.axisLine,width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15],breakLine:!0},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12,color:K.color.axisLabel,textMargin:[0,3]},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:K.color.axisSplitLine,width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:[K.color.backgroundTint,K.color.backgroundTransparent]}},breakArea:{show:!0,itemStyle:{color:K.color.neutral00,borderColor:K.color.border,borderWidth:1,borderType:[3,3],opacity:.6},zigzagAmplitude:4,zigzagMinSpan:4,zigzagMaxSpan:20,zigzagZ:100,expandOnClick:!0},breakLabelLayout:{moveOverlap:"auto"}},che=We({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto",show:"auto"},axisLabel:{interval:"auto"}},xW),fI=We({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:K.color.axisMinorSplitLine,width:1}}},xW),hhe=We({splitNumber:6,axisLabel:{rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},fI),fhe=Le({logBase:10},fI);const _W={category:che,value:fI,time:hhe,log:fhe};function wd(e,t,r,n){j(GU,function(a,i){var o=We(We({},_W[i],!0),n,!0),s=function(l){X(u,l);function u(){var c=l!==null&&l.apply(this,arguments)||this;return c.type=t+"Axis."+i,c}return u.prototype.mergeDefaultAndTheme=function(c,h){var d=Gg(this),v=d?vh(c):{},g=h.getTheme();We(c,g.get(i+"Axis")),We(c,this.getDefaultOption()),c.type=k5(c),d&&Eo(c,v,d)},u.prototype.optionUpdated=function(){var c=this.option;c.type==="category"&&(this.__ordinalMeta=Zg.createByAxisModel(this))},u.prototype.getCategories=function(c){var h=this.option;if(h.type==="category")return c?h.data:this.__ordinalMeta.categories},u.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},u.prototype.updateAxisBreaks=function(c){var h=Zm();return h?h.updateModelAxisBreak(this,c):{breaks:[]}},u.type=t+"Axis."+i,u.defaultOption=o,u}(r);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+"Axis",k5)}function k5(e){return e.type||(e.data?"category":"value")}var dhe=function(){function e(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return e.prototype.getAxis=function(t){return this._axes[t]},e.prototype.getAxes=function(){return oe(this._dimList,function(t){return this._axes[t]},this)},e.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),wt(this.getAxes(),function(r){return r.scale.type===t})},e.prototype.addAxis=function(t){var r=t.dim;this._axes[r]=t,this._dimList.push(r)},e}(),$x=["x","y"];function L5(e){return(e.type==="interval"||e.type==="time")&&!$_(e)}var vhe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Li,r.dimensions=$x,r}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var r=this.getAxis("x").scale,n=this.getAxis("y").scale;if(!(!L5(r)||!L5(n))){var a=ob(r,null),i=ob(n,null),o=this.dataToPoint([a[0],i[0]]),s=this.dataToPoint([a[1],i[1]]),l=a[1]-a[0],u=i[1]-i[0];if(!(!l||!u)){var c=(s[0]-o[0])/l,h=(s[1]-o[1])/u,d=o[0]-a[0]*c,v=o[1]-i[0]*h,g=this._transform=[c,0,0,h,d,v];this._invTransform=Ma([],g)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},t.prototype.containPoint=function(r){var n=this.getAxis("x"),a=this.getAxis("y");return n.contain(n.toLocalCoord(r[0]))&&a.contain(a.toLocalCoord(r[1]))},t.prototype.containData=function(r){return this.getAxis("x").containData(r[0])&&this.getAxis("y").containData(r[1])},t.prototype.containZone=function(r,n){var a=this.dataToPoint(r),i=this.dataToPoint(n),o=this.getArea(),s=new ke(a[0],a[1],i[0]-a[0],i[1]-a[1]);return o.intersect(s)},t.prototype.dataToPoint=function(r,n,a){a=a||[];var i=r[0],o=r[1];if(this._transform&&i!=null&&isFinite(i)&&o!=null&&isFinite(o))return ir(a,r,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return a[0]=s.toGlobalCoord(s.dataToCoord(i,n)),a[1]=l.toGlobalCoord(l.dataToCoord(o,n)),a},t.prototype.clampData=function(r,n){var a=this.getAxis("x").scale,i=this.getAxis("y").scale,o=a.getExtent(),s=i.getExtent(),l=a.parse(r[0]),u=i.parse(r[1]);return n=n||[],n[0]=Math.min(Math.max(Math.min(o[0],o[1]),l),Math.max(o[0],o[1])),n[1]=Math.min(Math.max(Math.min(s[0],s[1]),u),Math.max(s[0],s[1])),n},t.prototype.pointToData=function(r,n,a){if(a=a||[],this._invTransform)return ir(a,r,this._invTransform);var i=this.getAxis("x"),o=this.getAxis("y");return a[0]=i.coordToData(i.toLocalCoord(r[0]),n),a[1]=o.coordToData(o.toLocalCoord(r[1]),n),a},t.prototype.getOtherAxis=function(r){return this.getAxis(r.dim==="x"?"y":"x")},t.prototype.getArea=function(r){r=r||0;var n=this.getAxis("x").getGlobalExtent(),a=this.getAxis("y").getGlobalExtent(),i=Math.min(n[0],n[1])-r,o=Math.min(a[0],a[1])-r,s=Math.max(n[0],n[1])-i+r,l=Math.max(a[0],a[1])-o+r;return new ke(i,o,s,l)},t}(dhe);function bW(e,t){var r=e.scale,n=e.model,a=e8(r,n,n.ecModel,e,null),i=md(r),o=md(t)?t.intervalStub:t,s=i?r.intervalStub:r,l=r.base,u=o.getTicks(),c=o.getTicks({expandToNicedExtent:!0}),h=u.length-1,d,v,g;if(h===1)d=v=0,g=1;else if(h===2){var m=nr(u[0].value-u[1].value),y=nr(u[1].value-u[2].value);d=v=0,m===y?g=2:(g=1,m=A[1])return!0})):S[1]?(k=A[1],B(function(){if(F(),E=gt(z-P*g,D),H(),I<=A[0])return!0})):B(function(){E=gt(lh(A[0]/P)*P,D),z=gt(ri(A[1]/P)*P,D);var q=Lo((z-E)/P);if(q<=g){var re=g-q,Q=void 0,se=a.incl0||i;if(se&&A[0]===0)Q=[0,re];else if(se&&A[1]===0)Q=[re,0];else{var ce=ri(re/2);Q=re%2===0?[ce,ce]:I+k=A[1])return!0}})}WU(r,S,M,[I,k],C,{interval:P,intervalCount:g,intervalPrecision:D,niceExtent:[E,z]})}var I5=[[3,1],[0,2]],phe=function(){function e(t,r,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=$x,this._initCartesian(t,r,n),this.model=t}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(t,r){var n=this._axesMap;j(this._axesList,function(o){Uc(o,xd);var s=o.scale;Ln(s)&&s.setSortInfo(o.model.get("categorySortInfo"))});function a(o){for(var s=at(o),l=[],u=s.length-1;u>=0;u--){var c=o[+s[u]];c.__alignTo?l.push(c):_d(c)}j(l,function(h){mhe(h,h.__alignTo)?_d(h):bW(h,h.__alignTo.scale)})}a(n.x),a(n.y);var i={};j(n.x,function(o){P5(n,"y",o,i)}),j(n.y,function(o){P5(n,"x",o,i)}),this.resize(this.model,r)},e.prototype.resize=function(t,r,n){var a=jr(t,r),i=this._rect=Zt(t.getBoxLayoutParams(),a.refContainer),o=this._axesMap,s=this._coordsList,l=t.get("containLabel");if(wA(o,i),!n){var u=_he(i,s,o,l,r),c=void 0;if(l)SA?(SA(this._axesList,i),wA(o,i)):c=R5(i.clone(),"axisLabel",null,i,o,u,a);else{var h=bhe(t,i,a),d=h.outerBoundsRect,v=h.parsedOuterBoundsContain,g=h.outerBoundsClamp;d&&(c=R5(d,v,g,i,o,u,a))}wW(i,o,Di.determine,null,c,a),j(this._coordsList,function(m){m.calcAffineTransform()})}},e.prototype.getAxis=function(t,r){var n=this._axesMap[t];if(n!=null)return n[r||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(t,r){if(t!=null&&r!=null){var n="x"+t+"y"+r;return this._coordsMap[n]}Ie(t)&&(r=t.yAxisIndex,t=t.xAxisIndex);for(var a=0,i=this._coordsList;a=0;a--){var i=e[+t[a]];RU(i.scale)&&UU(i.model,i.type,!0)==null&&(i.model.get("alignTicks")&&i.model.get("interval")==null?n.push(i):r=i)}r||(r=n.pop()),r&&j(n,function(o){o.__alignTo=r})}function mhe(e,t){return $_(e.scale)||$_(t.scale)||t.scale.getTicks().length<2}function yhe(e,t){var r=e.getExtent(),n=r[0]+r[1];e.toGlobalCoord=e.dim==="x"?function(a){return a+t}:function(a){return n-a+t},e.toLocalCoord=e.dim==="x"?function(a){return a-t}:function(a){return n-a+t}}function wA(e,t){j(e.x,function(r){return j5(r,t.x,t.width)}),j(e.y,function(r){return j5(r,t.y,t.height)})}function j5(e,t,r){var n=[0,r],a=e.inverse?1:0;e.setExtent(n[a],n[1-a]),yhe(e,t)}var SA;function xhe(e){SA=e}function R5(e,t,r,n,a,i,o){wW(n,a,Di.estimate,t,!1,o);var s=[0,0,0,0];u(0),u(1),c(n,0,NaN),c(n,1,NaN);var l=Es(s,function(d){return d>0})==null;return zc(n,s,!0,!0,r),wA(a,n),l;function u(d){j(a[Fe[d]],function(v){if(qg(v.model)){var g=i.ensureRecord(v.model),m=g.labelInfoList;if(m)for(var y=0;y0&&!un(v)&&v>1e-4&&(d/=v),d}}function _he(e,t,r,n,a){var i=new K8(whe);return j(r,function(o){return j(o,function(s){if(qg(s.model)){var l=!n;s.axisBuilder=bce(e,t,s.model,a,i,l)}})}),i}function wW(e,t,r,n,a,i){var o=r===Di.determine;j(t,function(u){return j(u,function(c){qg(c.model)&&(wce(c.axisBuilder,e,c.model),c.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:a}))})});var s={x:0,y:0};l(0),l(1);function l(u){s[Fe[1-u]]=e[hr[u]]<=i.refContainer[hr[u]]*.5?0:1-u===1?2:1}j(t,function(u,c){return j(u,function(h){qg(h.model)&&((n==="all"||o)&&h.axisBuilder.build({axisName:!0},{nameMarginLevel:s[c]}),o&&h.axisBuilder.build({axisLine:!0}))})})}function bhe(e,t,r){var n,a=e.get("outerBoundsMode",!0);a==="same"?n=t.clone():(a==null||a==="auto")&&(n=Zt(e.get("outerBounds",!0)||iW,r.refContainer));var i=e.get("outerBoundsContain",!0),o;i==null||i==="auto"||Ve(["all","axisLabel"],i)<0?o="all":o=i;var s=[B_(_e(e.get("outerBoundsClampWidth",!0),yb[0]),t.width),B_(_e(e.get("outerBoundsClampHeight",!0),yb[1]),t.height)];return{outerBoundsRect:n,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var whe=function(e,t,r,n,a,i){var o=r.axis.dim==="x"?"y":"x";J8(e,t,r,n,a,i),yd(e.nameLocation)||j(t.recordMap[o],function(s){s&&s.labelInfoList&&s.dirVec&&eW(s.labelInfoList,s.dirVec,n,a)})};function She(e,t){var r={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return Che(r,e,t),r.seriesInvolved&&Mhe(r,e),r}function Che(e,t,r){var n=t.getComponent("tooltip"),a=t.getComponent("axisPointer"),i=a.get("link",!0)||[],o=[];j(r.getCoordinateSystems(),function(s){if(!s.axisPointerEnabled)return;var l=am(s.model),u=e.coordSysAxesInfo[l]={};e.coordSysMap[l]=s;var c=s.model,h=c.getModel("tooltip",n);if(j(s.getAxes(),Xe(m,!1,null)),s.getTooltipAxes&&n&&h.get("show")){var d=h.get("trigger")==="axis",v=h.get(["axisPointer","type"])==="cross",g=s.getTooltipAxes(h.get(["axisPointer","axis"]));(d||v)&&j(g.baseAxes,Xe(m,v?"cross":!0,d)),v&&j(g.otherAxes,Xe(m,"cross",!1))}function m(y,x,_){var w=_.model.getModel("axisPointer",a),S=w.get("show");if(!(!S||S==="auto"&&!y&&!CA(w))){x==null&&(x=w.get("triggerTooltip")),w=y?The(_,h,a,t,y,x):w;var C=w.get("snap"),M=w.get("triggerEmphasis"),A=am(_.model),I=x||C||_.type==="category",k=e.axesInfo[A]={key:A,axis:_,coordSys:s,axisPointerModel:w,triggerTooltip:x,triggerEmphasis:M,involveSeries:I,snap:C,useHandle:CA(w),seriesModels:[],linkGroup:null};u[A]=k,e.seriesInvolved=e.seriesInvolved||I;var P=Ahe(i,_);if(P!=null){var D=o[P]||(o[P]={axesInfo:{}});D.axesInfo[A]=k,D.mapper=i[P].mapper,k.linkGroup=D}}}})}function The(e,t,r,n,a,i){var o=t.getModel("axisPointer"),s=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],l={};j(s,function(d){l[d]=Te(o.get(d))}),l.snap=e.type!=="category"&&!!i,o.get("type")==="cross"&&(l.type="line");var u=l.label||(l.label={});if(u.show==null&&(u.show=!1),a==="cross"){var c=o.get(["label","show"]);if(u.show=c??!0,!i){var h=l.lineStyle=o.get("crossStyle");h&&Le(u,h.textStyle)}}return e.model.getModel("axisPointer",new tt(l,r,n))}function Mhe(e,t){t.eachSeries(function(r){var n=r.coordinateSystem,a=r.get(["tooltip","trigger"],!0),i=r.get(["tooltip","show"],!0);!n||!n.model||a==="none"||a===!1||a==="item"||i===!1||r.get(["axisPointer","show"],!0)===!1||j(e.coordSysAxesInfo[am(n.model)],function(o){var s=o.axis;n.getAxis(s.dim)===s&&(o.seriesModels.push(r),o.seriesDataCount==null&&(o.seriesDataCount=0),o.seriesDataCount+=r.getData().count())})})}function Ahe(e,t){for(var r=t.model,n=t.dim,a=0;a=0||e===t}function Nhe(e){var t=dI(e);if(t){var r=t.axisPointerModel,n=t.axis.scale,a=r.option,i=r.get("status"),o=r.get("value");o!=null&&(o=n.parse(o));var s=CA(r);i==null&&(a.status=s?"show":"hide");var l=n.getExtent();(o==null||o>l[1])&&(o=l[1]),o0;return o&&s}var Rhe=Ze();function B5(e,t,r,n){if(e instanceof $8){var a=e.scale.type;if(a!=="ordinal")return r}var i=e.model,o=i.get("jitter");if(!(o>0))return r;var s=i.get("jitterOverlap"),l=i.get("jitterMargin")||0,u=Ln(e.scale)?pn(e).w:null;return s?NW(r,o,u,n):Ohe(e,t,r,n,o,l)}function NW(e,t,r,n){if(r===null)return e+(Math.random()-.5)*t;var a=r-n*2,i=Math.min(Math.max(0,t),a);return e+(Math.random()-.5)*i}function Ohe(e,t,r,n,a,i){var o=Rhe(e);o.items||(o.items=[]);var s=o.items,l=F5(s,t,r,n,a,i,1),u=F5(s,t,r,n,a,i,-1),c=Math.abs(l-r)a/2||h&&d>h/2-n?NW(r,a,h,n):(s.push({fixedCoord:t,floatCoord:c,r:n}),c)}function F5(e,t,r,n,a,i,o){for(var s=r,l=0;la/2)return Number.MAX_VALUE;if(o===1&&g>s||o===-1&&g0&&!m.min?m.min=0:m.min!=null&&m.min<0&&!m.max&&(m.max=0);var y=u;m.color!=null&&(y=Le({color:m.color},u));var x=We(Te(m),{boundaryGap:r,splitNumber:n,clockwise:a,scale:i,axisLine:o,axisTick:s,axisLabel:l,name:m.text,showName:c,nameLocation:"end",nameGap:d,nameTextStyle:y,triggerEvent:v},!1);if(ue(h)){var _=x.name;x.name=h.replace("{value}",_??"")}else Me(h)&&(x.name=h(x.name,x));var w=new tt(x,null,this.ecModel);return br(w,nv.prototype),w.mainType="radar",w.componentIndex=this.componentIndex,w.uid=dh("ec_radar"),w},this);this._indicatorModels=g},t.prototype.getIndicatorModels=function(){return this._indicatorModels},t.type=kW,t.defaultOption={z:0,center:["50%","50%"],radius:"50%",startAngle:90,clockwise:!1,axisName:{show:!0,color:K.color.axisLabel},boundaryGap:[0,0],splitNumber:LW,axisNameGap:15,scale:!1,shape:"polygon",axisLine:We({lineStyle:{color:K.color.neutral20}},ep.axisLine),axisLabel:O0(ep.axisLabel,!1),axisTick:O0(ep.axisTick,!1),splitLine:O0(ep.splitLine,!0),splitArea:O0(ep.splitArea,!0),indicator:[]},t}(Qe),Zhe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){var i=this.group;i.removeAll(),this._buildAxes(r,a),this._buildSplitLineAndArea(r)},t.prototype._buildAxes=function(r,n){var a=r.coordinateSystem,i=a.getIndicatorAxes(),o=oe(i,function(s){var l=s.model.get("showName")?s.name:"",u=new Vn(s.model,n,{axisName:l,position:[a.cx,a.cy],rotation:s.angle,labelDirection:-1,tickDirection:-1,nameDirection:1});return u});j(o,function(s){s.build(),this.group.add(s.group)},this)},t.prototype._buildSplitLineAndArea=function(r){var n=r.coordinateSystem,a=n.getIndicatorAxes();if(!a.length)return;var i=r.get("shape"),o=r.getModel("splitLine"),s=r.getModel("splitArea"),l=o.getModel("lineStyle"),u=s.getModel("areaStyle"),c=o.get("show"),h=s.get("show"),d=l.get("color"),v=u.get("color"),g=ne(d)?d:[d],m=ne(v)?v:[v],y=[],x=[];function _(H,V,U){var F=U%V.length;return H[F]=H[F]||[],F}if(i==="circle")for(var w=a[0].getTicksCoords(),S=n.cx,C=n.cy,M=0;M3?1.4:o>1?1.2:1.1,c=i>0?u:1/u;this._checkTriggerMoveZoom(this,"zoom","zoomOnMouseWheel",r,{scale:c,originX:s,originY:l,isAvailableBehavior:null})}if(a){var h=Math.abs(i),d=(i>0?1:-1)*(h>3?.4:h>1?.15:.05);this._checkTriggerMoveZoom(this,"scrollMove","moveOnMouseWheel",r,{scrollDelta:d,originX:s,originY:l,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(r){if(!(H5(this._zr,"globalPan")||tp(r))){var n=r.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,"zoom",null,r,{scale:n,originX:r.pinchX,originY:r.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(r,n,a,i,o){r._checkPointer(i,o.originX,o.originY)&&(Cs(i.event),i.__ecRoamConsumed=!0,U5(r,n,a,i,o))},t}(si);function tp(e){return e.__ecRoamConsumed}var rfe=Ze();function aw(e){var t=rfe(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function rp(e,t,r,n){for(var a=aw(e),i=a.roam,o=i[t]=i[t]||[],s=0;s=4&&(c={x:parseFloat(d[0]||0),y:parseFloat(d[1]||0),width:parseFloat(d[2]),height:parseFloat(d[3])})}if(c&&s!=null&&l!=null&&(h=EW(c,{x:0,y:0,width:s,height:l}),!r.ignoreViewBox)){var v=a;a=new Ne,a.add(v),v.scaleX=v.scaleY=h.scale,v.x=h.x,v.y=h.y}return!r.ignoreRootClip&&s!=null&&l!=null&&a.setClipPath(new Ke({shape:{x:0,y:0,width:s,height:l}})),{root:a,width:s,height:l,viewBoxRect:c,viewBoxTransform:h,named:i}},e.prototype._parseNode=function(t,r,n,a,i,o){var s=t.nodeName.toLowerCase(),l,u=a;if(s==="defs"&&(i=!0),s==="text"&&(o=!0),s==="defs"||s==="switch")l=r;else{if(!i){var c=zC[s];if(c&&ge(zC,s)){l=c.call(this,t,r);var h=t.getAttribute("name");if(h){var d={name:h,namedFrom:null,svgNodeTagLower:s,el:l};n.push(d),s==="g"&&(u=d)}else a&&n.push({name:a.name,namedFrom:a,svgNodeTagLower:s,el:l});r.add(l)}}var v=$5[s];if(v&&ge($5,s)){var g=v.call(this,t),m=t.getAttribute("id");m&&(this._defs[m]=g)}}if(l&&l.isGroup)for(var y=t.firstChild;y;)y.nodeType===1?this._parseNode(y,l,n,u,i,o):y.nodeType===3&&o&&this._parseText(y,l),y=y.nextSibling},e.prototype._parseText=function(t,r){var n=new fd({style:{text:t.textContent},silent:!0,x:this._textX||0,y:this._textY||0});ja(r,n),va(t,n,this._defsUsePending,!1,!1),ofe(n,r);var a=n.style,i=a.fontSize;i&&i<9&&(a.fontSize=9,n.scaleX*=i/9,n.scaleY*=i/9);var o=(a.fontSize||a.fontFamily)&&[a.fontStyle,a.fontWeight,(a.fontSize||12)+"px",a.fontFamily||"sans-serif"].join(" ");a.font=o;var s=n.getBoundingRect();return this._textX+=s.width,r.add(n),n},e.internalField=function(){zC={g:function(t,r){var n=new Ne;return ja(r,n),va(t,n,this._defsUsePending,!1,!1),n},rect:function(t,r){var n=new Ke;return ja(r,n),va(t,n,this._defsUsePending,!1,!1),n.setShape({x:parseFloat(t.getAttribute("x")||"0"),y:parseFloat(t.getAttribute("y")||"0"),width:parseFloat(t.getAttribute("width")||"0"),height:parseFloat(t.getAttribute("height")||"0")}),n.silent=!0,n},circle:function(t,r){var n=new Vo;return ja(r,n),va(t,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),r:parseFloat(t.getAttribute("r")||"0")}),n.silent=!0,n},line:function(t,r){var n=new yr;return ja(r,n),va(t,n,this._defsUsePending,!1,!1),n.setShape({x1:parseFloat(t.getAttribute("x1")||"0"),y1:parseFloat(t.getAttribute("y1")||"0"),x2:parseFloat(t.getAttribute("x2")||"0"),y2:parseFloat(t.getAttribute("y2")||"0")}),n.silent=!0,n},ellipse:function(t,r){var n=new Pm;return ja(r,n),va(t,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),rx:parseFloat(t.getAttribute("rx")||"0"),ry:parseFloat(t.getAttribute("ry")||"0")}),n.silent=!0,n},polygon:function(t,r){var n=t.getAttribute("points"),a;n&&(a=q5(n));var i=new vn({shape:{points:a||[]},silent:!0});return ja(r,i),va(t,i,this._defsUsePending,!1,!1),i},polyline:function(t,r){var n=t.getAttribute("points"),a;n&&(a=q5(n));var i=new en({shape:{points:a||[]},silent:!0});return ja(r,i),va(t,i,this._defsUsePending,!1,!1),i},image:function(t,r){var n=new Ur;return ja(r,n),va(t,n,this._defsUsePending,!1,!1),n.setStyle({image:t.getAttribute("xlink:href")||t.getAttribute("href"),x:+t.getAttribute("x"),y:+t.getAttribute("y"),width:+t.getAttribute("width"),height:+t.getAttribute("height")}),n.silent=!0,n},text:function(t,r){var n=t.getAttribute("x")||"0",a=t.getAttribute("y")||"0",i=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0";this._textX=parseFloat(n)+parseFloat(i),this._textY=parseFloat(a)+parseFloat(o);var s=new Ne;return ja(r,s),va(t,s,this._defsUsePending,!1,!0),s},tspan:function(t,r){var n=t.getAttribute("x"),a=t.getAttribute("y");n!=null&&(this._textX=parseFloat(n)),a!=null&&(this._textY=parseFloat(a));var i=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0",s=new Ne;return ja(r,s),va(t,s,this._defsUsePending,!1,!0),this._textX+=parseFloat(i),this._textY+=parseFloat(o),s},path:function(t,r){var n=t.getAttribute("d")||"",a=wH(n);return ja(r,a),va(t,a,this._defsUsePending,!1,!1),a.silent=!0,a}}}(),e}(),$5={lineargradient:function(e){var t=parseInt(e.getAttribute("x1")||"0",10),r=parseInt(e.getAttribute("y1")||"0",10),n=parseInt(e.getAttribute("x2")||"10",10),a=parseInt(e.getAttribute("y2")||"0",10),i=new hh(t,r,n,a);return Y5(e,i),X5(e,i),i},radialgradient:function(e){var t=parseInt(e.getAttribute("cx")||"0",10),r=parseInt(e.getAttribute("cy")||"0",10),n=parseInt(e.getAttribute("r")||"0",10),a=new Kk(t,r,n);return Y5(e,a),X5(e,a),a}};function Y5(e,t){var r=e.getAttribute("gradientUnits");r==="userSpaceOnUse"&&(t.global=!0)}function X5(e,t){for(var r=e.firstChild;r;){if(r.nodeType===1&&r.nodeName.toLocaleLowerCase()==="stop"){var n=r.getAttribute("offset"),a=void 0;n&&n.indexOf("%")>0?a=parseInt(n,10)/100:n?a=parseFloat(n):a=0;var i={};DW(r,i,i);var o=i.stopColor||r.getAttribute("stop-color")||"#000000",s=i.stopOpacity||r.getAttribute("stop-opacity");if(s){var l=An(o),u=l&&l[3];u&&(l[3]*=fs(s),o=qa(l,"rgba"))}t.colorStops.push({offset:a,color:o})}r=r.nextSibling}}function ja(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),Le(t.__inheritedStyle,e.__inheritedStyle))}function q5(e){for(var t=iw(e),r=[],n=0;n0;i-=2){var o=n[i],s=n[i-1],l=iw(o);switch(a=a||$t(),s){case"translate":Pi(a,a,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":b1(a,a,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":js(a,a,-parseFloat(l[0])*BC,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*BC);Ca(a,[1,0,u,1,0,0],a);break;case"skewY":var c=Math.tan(parseFloat(l[0])*BC);Ca(a,[1,c,0,1,0,0],a);break;case"matrix":a[0]=parseFloat(l[0]),a[1]=parseFloat(l[1]),a[2]=parseFloat(l[2]),a[3]=parseFloat(l[3]),a[4]=parseFloat(l[4]),a[5]=parseFloat(l[5]);break}}t.setLocalTransform(a)}}var J5=/([^\s:;]+)\s*:\s*([^:;]+)/g;function DW(e,t,r){var n=e.getAttribute("style");if(n){J5.lastIndex=0;for(var a;(a=J5.exec(n))!=null;){var i=a[1],o=ge(_b,i)?_b[i]:null;o&&(t[o]=a[2]);var s=ge(bb,i)?bb[i]:null;s&&(r[s]=a[2])}}}function ffe(e,t,r){for(var n=0;n1e-6;ip[0]=o?(a[0]-n.x)/i:a[0],ip[1]=o?(a[1]-n.y)/i:a[1],ir(ip,ip,e.mtRawInv);var s=Ofe(e,ip);o3(t,s,i),j(r,function(l){l!==t&&o3(l,s.slice(),i)})}var ip=[];function o3(e,t,r){var n=e.option;n.center=t,n.zoom=r}function xI(e,t){if(t){var r=t.min||0,n=t.max||1/0;e=Math.max(Math.min(n,e),r)}return e}function HW(e,t){var r=t.getShallow("nodeScaleRatio",!0)||1,n=e;return((n.zoom-1)*r+1)/(n.trans[Ro].scaleX||1)}function lw(e,t,r,n,a,i,o,s){var l=Cb(e);if(!l){r.disable();return}r.enable(_e(e.get("roam"),o),{api:t,zInfo:{component:e},triggerInfo:{roamTrigger:e.get("roamTrigger"),isInSelf:n,isInClip:function(c,h,d){return!a||a.contain(h,d)}}});function u(c){var h=e.mainType,d=aL(Le({type:WW(h,e.subType,oH)},c));s&&(d.componentType=h),d[h+"Id"]=e.id,t.dispatchAction(d)}r.off("pan").off("zoom").on("pan",function(c){i&&i("pan"),u({dx:c.dx,dy:c.dy})}).on("zoom",function(c){i&&i("zoom"),u({zoom:c.scale,originX:c.originX,originY:c.originY})})}function UW(e){return function(t,r,n){return HC.copy(e.getBoundingRect()),HC.applyTransform(e.getComputedTransform()),HC.contain(r,n)}}var HC=new ke(0,0,0,0);function _I(e,t,r){var n=WW(t,r,oH);e.registerAction({type:n,event:n,update:"none"},function(a,i,o){i.eachComponent(Fk(a,t,r),function(s){BW(a,s),FW(a,s,i,o)})})}function WW(e,t,r){return(e!==Do?e:t==="map"?"geo":t)+r}function ZW(e){return e.zoom!=null}function bI(e,t,r,n,a,i,o){var s=new ow(null,GW(e.ecModel,t));return sw(s,r,n,a,i),o?Sb(s,o.x,o.y,o.width,o.height):Sb(s,r,n,a,i),mI(s,e),s}var wI=["rect","circle","line","ellipse","polygon","polyline","path"],Bfe=pe(wI),Ffe=pe(wI.concat(["g"])),Vfe=pe(wI.concat(["g"])),$W=Ze();function V0(e){var t=e.getItemStyle(),r=e.get("areaColor");return r!=null&&(t.fill=r),t}function s3(e){var t=e.style;t&&(t.stroke=t.stroke||t.fill,t.fill=null)}var YW=function(){function e(t){var r=this.group=new Ne,n=this._transformGroup=new Ne;r.add(n),this.uid=dh("ec_map_draw"),this._controller=new xh(t.getZr()),n.add(this._regionsGroup=new Ne),n.add(this._svgGroup=new Ne)}return e.prototype.draw=function(t,r,n,a,i){var o=this,s=t.getData&&t.getData();Kf(t)&&r.eachComponent({mainType:"series",subType:"map"},function(m){!s&&m.getHostGeoModel()===t&&(s=m.getData())});var l=t.coordinateSystem,u=l.view,c=this._regionsGroup,h=this._transformGroup,d=!c.childAt(0)||i,v;l.shouldClip()?(v=pI(null,u),this.group.setClipPath(new Ke({shape:v.clone()}))):this.group.removeClipPath(),Hl(h,Xc,u,d?null:t);var g=s&&s.getVisual("visualMeta")&&s.getVisual("visualMeta").length>0;l.resourceType==="geoJSON"?this._buildGeoJSON(u,n,l,t,s,g):l.resourceType==="geoSVG"&&this._buildSVG(u,n,l,t,s,g),lw(t,n,this._controller,function(m,y,x){return t.coordinateSystem.containPoint([y,x])},v,function(){o._mouseDownFlag=!1},!1,!0),this._updateMapSelectHandler(t,c,n,a)},e.prototype.__updateOnOwnRoam=function(t){Hl(this._transformGroup,Xc,t.coordinateSystem.view,null)},e.prototype._buildGeoJSON=function(t,r,n,a,i,o){var s=this._regionsGroupByName=pe(),l=pe(),u=this._regionsGroup,c=n.projection,h=c&&c.stream,d=Vl(om(null,t,Yc));function v(y,x){return x&&(y=x(y)),y&&ir([],y,d)}function g(y){for(var x=[],_=!h&&c&&c.project,w=0;w=0)&&(c=e);var h=o?{normal:{align:"center",verticalAlign:"middle"}}:null;Hr(r,Dr(a),{labelFetcher:c,labelDataIndex:u,defaultText:n},h);var d=r.getTextContent();if(d&&($W(d).ignore=d.ignore,r.textConfig&&o)){var v=r.getBoundingRect().clone();r.textConfig.layoutRect=v,r.textConfig.position=[(o[0]-v.x)/v.width*100+"%",(o[1]-v.y)/v.height*100+"%"]}r.disableLabelAnimation=!0}else r.removeTextContent(),r.removeTextConfig(),r.disableLabelAnimation=null}function c3(e,t,r,n,a,i){t?t.setItemGraphicEl(i,r):Ee(r).eventData={componentType:"geo",componentIndex:e.componentIndex,geoIndex:e.componentIndex,name:n,region:a&&a.option||{}}}function h3(e,t,r,n,a){t||Os({el:r,componentModel:e,itemName:n,itemTooltipOption:a.get("tooltip")})}function f3(e,t,r,n){t.highDownSilentOnTouch=!!e.get("selectedMode");var a=n.getModel("emphasis"),i=a.get("focus");return Yt(t,i,a.get("blurScope"),a.get("disabled")),Kf(e)&&Pre(t,e,r),i}function d3(e,t,r){var n=[],a;function i(){a=[]}function o(){a.length&&(n.push(a),a=[])}var s=t({polygonStart:i,polygonEnd:o,lineStart:i,lineEnd:o,point:function(l,u){isFinite(l)&&isFinite(u)&&a.push([l,u])},sphere:function(){}});return!r&&s.polygonStart(),j(e,function(l){s.lineStart();for(var u=0;u-1&&(a.style.stroke=a.style.fill,a.style.fill=K.color.neutral00,a.style.lineWidth=2),a},t.prototype.__ownRoamView=function(){return Tb(this)?this.coordinateSystem.view:null},t.type="series."+qc,t.dependencies=["geo"],t.layoutMode="box",t.defaultOption={z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:null,showLegendSymbol:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,selectedMode:!0,label:{show:!1,color:K.color.tertiary},itemStyle:{borderWidth:.5,borderColor:K.color.border,areaColor:K.color.background},emphasis:{label:{show:!0,color:K.color.primary},itemStyle:{areaColor:K.color.highlight}},select:{label:{show:!0,color:K.color.primary},itemStyle:{color:K.color.highlight}},nameProperty:"name"},t}(Pt);function XW(e){return e.indexOf("i")===0}function Tb(e){return sm(e.seriesGroup)===e&&!e.getHostGeoModel()}function sm(e){return e.f[0]}function SI(e,t){var r={};return e.eachRawSeriesByType(qc,function(n){var a=n.getHostGeoModel(),i=a?"o"+a.id:"i"+n.getMapType(),o=r[i]=r[i]||{f:[],r:[]};!e.isSeriesFiltered(n)&&!t&&o.f.push(n),o.r.push(n)}),r}var Hfe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=qc,r}return t.prototype.render=function(r,n,a,i){if(!(i&&i.type==="mapToggleSelect"&&i.from===this.uid)){var o=this.group;if(o.removeAll(),!r.getHostGeoModel()){var s=this._mapDraw;s&&i&&i.type==="geoRoam"&&s.resetForLabelLayout(),i&&i.type==="geoRoam"&&i.componentType==="series"&&i.seriesId===r.id?s&&o.add(s.group):Tb(r)?(s=s||(this._mapDraw=new YW(a)),o.add(s.group),s.draw(r,n,a,this,i)):this._clearMapDraw(),r.get("showLegendSymbol")&&n.getComponent("legend")&&this._renderSymbols(r)}}},t.prototype.__updateOnOwnRoam=function(r,n,a){var i=this._mapDraw;Tb(n)&&i&&i.__updateOnOwnRoam(n)},t.prototype.remove=function(){this._clearMapDraw(),this.group.removeAll()},t.prototype.dispose=function(){this._clearMapDraw()},t.prototype._clearMapDraw=function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null},t.prototype._renderSymbols=function(r){var n=r.originalData,a=this.group;n.each(n.mapDimension("value"),function(i,o){if(!isNaN(i)){var s=n.getItemLayout(o);if(!(!s||!s.point)){var l=s.point,u=s.offset,c=new Vo({style:{fill:r.getData().getVisual("style").fill},shape:{cx:l[0]+u*9,cy:l[1],r:3},silent:!0,z2:8+(u?0:Gd+1)});if(!u){var h=sm(r.seriesGroup).getData(),d=n.getName(o),v=h.indexOfName(d),g=n.getItemModel(o),m=g.getModel("label"),y=h.getItemGraphicEl(v);Hr(c,Dr(g),{labelFetcher:{getFormattedLabel:function(x,_){return r.getFormattedLabel(v,_)}},defaultText:d}),c.disableLabelAnimation=!0,m.get("position")||c.setTextConfig({position:"bottom"}),y.onHoverStateChange=function(x){H_(c,x)}}a.add(c)}}})},t.type=qc,t}(At),Ufe={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},qW=["lng","lat"],v3=function(e){X(t,e);function t(r,n,a){var i=e.call(this)||this;i.dimensions=qW,i.type="geo",i._nameCoordMap=pe(),i.name=r;var o=a.projection,s=Is.load(n,a.nameMap,a.nameProperty),l=Is.getGeoResource(n);i.resourceType=l?l.type:null;var u=i.regions=s.regions,c=Ufe[l.type];i._clip=a.clip;var h=o?!1:c.invertLongitute;i.view=new ow(h,GW(a.ecModel,a.api),i),i.map=n,i._regionsMap=s.regionsMap,i.regions=s.regions,i.projection=o;var d;if(o)for(var v=0;v1?(S.width=w,S.height=w/y):(S.height=w,S.width=w*y),S.y=_[1]-S.height/2,S.x=_[0]-S.width/2;else{var C=e.getBoxLayoutParams();C.aspect=y,S=Zt(C,m),S=c7(e,S,y)}Sb(r,S.x,S.y,S.width,S.height),mI(r,e)}function Wfe(e,t){j(t.get("geoCoord"),function(r,n){e.addGeoCoord(n,r)})}var Zfe=function(){function e(){this.dimensions=qW}return e.prototype.create=function(t,r){var n=[];function a(i){return{nameProperty:i.get("nameProperty"),aspectScale:i.get("aspectScale"),projection:i.get("projection"),clip:i.getShallow("clip",!0)}}return t.eachComponent("geo",function(i,o){var s=i.get("map"),l=new v3(s+o,s,te({nameMap:i.get("nameMap"),api:r,ecModel:t},a(i)));n.push(l),i.coordinateSystem=l,l.model=i,l.resize=g3,l.resize(i,r)}),t.eachSeries(function(i){Om({targetModel:i,coordSysType:"geo",coordSysProvider:function(){var o=i.subType===qc?i.getHostGeoModel():i.getReferringComponents("geo",sr).models[0];return o&&o.coordinateSystem},allowNotFound:!0})}),j(SI(t,!0),function(i,o){if(XW(o)){var s=i.r[0],l=[];j(i.r,function(d){l.push(d.get("nameMap")),d.seriesGroup=null});var u=o.slice(1),c=new v3(u,u,te({nameMap:x1(l),api:r,ecModel:t},a(s))),h;j(i.r,function(d){h=_e(h,d.get("scaleLimit"))}),n.push(c),c.resize=g3,c.resize(s,r),j(i.r,function(d){d.coordinateSystem=c,Wfe(c,d)})}}),n},e.prototype.getFilledRegions=function(t,r,n,a){for(var i=(t||[]).slice(),o=pe(),s=0;s=0;o--){var s=a[o];s.hierNode={defaultAncestor:null,ancestor:s,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},r.push(s)}}function nde(e,t){var r=e.isExpand?e.children:[],n=e.parentNode.children,a=e.hierNode.i?n[e.hierNode.i-1]:null;if(r.length){ide(e);var i=(r[0].hierNode.prelim+r[r.length-1].hierNode.prelim)/2;a?(e.hierNode.prelim=a.hierNode.prelim+t(e,a),e.hierNode.modifier=e.hierNode.prelim-i):e.hierNode.prelim=i}else a&&(e.hierNode.prelim=a.hierNode.prelim+t(e,a));e.parentNode.hierNode.defaultAncestor=ode(e,a,e.parentNode.hierNode.defaultAncestor||n[0],t)}function ade(e){var t=e.hierNode.prelim+e.parentNode.hierNode.modifier;e.setLayout({x:t},!0),e.hierNode.modifier+=e.parentNode.hierNode.modifier}function m3(e){return arguments.length?e:ude}function Lp(e,t){return e-=Math.PI/2,{x:t*Math.cos(e),y:t*Math.sin(e)}}function ide(e){for(var t=e.children,r=t.length,n=0,a=0;--r>=0;){var i=t[r];i.hierNode.prelim+=n,i.hierNode.modifier+=n,a+=i.hierNode.change,n+=i.hierNode.shift+a}}function ode(e,t,r,n){if(t){for(var a=e,i=e,o=i.parentNode.children[0],s=t,l=a.hierNode.modifier,u=i.hierNode.modifier,c=o.hierNode.modifier,h=s.hierNode.modifier;s=UC(s),i=WC(i),s&&i;){a=UC(a),o=WC(o),a.hierNode.ancestor=e;var d=s.hierNode.prelim+h-i.hierNode.prelim-u+n(s,i);d>0&&(lde(sde(s,e,r),e,d),u+=d,l+=d),h+=s.hierNode.modifier,u+=i.hierNode.modifier,l+=a.hierNode.modifier,c+=o.hierNode.modifier}s&&!UC(a)&&(a.hierNode.thread=s,a.hierNode.modifier+=h-l),i&&!WC(o)&&(o.hierNode.thread=i,o.hierNode.modifier+=u-c,r=e)}return r}function UC(e){var t=e.children;return t.length&&e.isExpand?t[t.length-1]:e.hierNode.thread}function WC(e){var t=e.children;return t.length&&e.isExpand?t[0]:e.hierNode.thread}function sde(e,t,r){return e.hierNode.ancestor.parentNode===t.parentNode?e.hierNode.ancestor:r}function lde(e,t,r){var n=r/(t.hierNode.i-e.hierNode.i);t.hierNode.change-=n,t.hierNode.shift+=r,t.hierNode.modifier+=r,t.hierNode.prelim+=r,e.hierNode.change+=n}function ude(e,t){return e.parentNode===t.parentNode?1:2}var Ja=Ze();function QW(e){var t=e.mainData,r=e.datas;r||(r={main:t},e.datasAttr={main:"data"}),e.datas=e.mainData=null,e9(t,r,e),j(r,function(n){j(t.TRANSFERABLE_METHODS,function(a){n.wrapMethod(a,Xe(cde,e))})}),t.wrapMethod("cloneShallow",Xe(fde,e)),j(t.CHANGABLE_METHODS,function(n){t.wrapMethod(n,Xe(hde,e))}),fn(r[t.dataType]===t)}function cde(e,t){if(pde(this)){var r=te({},Ja(this).datas);r[this.dataType]=t,e9(t,r,e)}else CI(t,this.dataType,Ja(this).mainData,e);return t}function hde(e,t){return e.struct&&e.struct.update(),t}function fde(e,t){return j(Ja(t).datas,function(r,n){r!==t&&CI(r.cloneShallow(),n,t,e)}),t}function dde(e){var t=Ja(this).mainData;return e==null||t==null?t:Ja(t).datas[e]}function vde(){var e=Ja(this).mainData;return e==null?[{data:e}]:oe(at(Ja(e).datas),function(t){return{type:t,data:Ja(e).datas[t]}})}function pde(e){return Ja(e).mainData===e}function e9(e,t,r){Ja(e).datas={},j(t,function(n,a){CI(n,a,e,r)})}function CI(e,t,r,n){Ja(r).datas[t]=e,Ja(e).mainData=r,e.dataType=t,n.struct&&(e[n.structAttr]=n.struct,n.struct[n.datasAttr[t]]=e),e.getLinkedData=dde,e.getLinkedDataAll=vde}var gde=function(){function e(t,r){this.depth=0,this.height=0,this.dataIndex=-1,this.children=[],this.viewChildren=[],this.isExpand=!1,this.name=t||"",this.hostTree=r}return e.prototype.isRemoved=function(){return this.dataIndex<0},e.prototype.eachNode=function(t,r,n){Me(t)&&(n=r,r=t,t=null),t=t||{},ue(t)&&(t={order:t});var a=t.order||"preorder",i=this[t.attr||"children"],o;a==="preorder"&&(o=r.call(n,this));for(var s=0;!o&&sr&&(r=a.height)}this.height=r+1},e.prototype.getNodeById=function(t){if(this.getId()===t)return this;for(var r=0,n=this.children,a=n.length;r=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,r)},e.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},e.prototype.getModel=function(t){if(!(this.dataIndex<0)){var r=this.hostTree,n=r.data.getItemModel(this.dataIndex);return n.getModel(t)}},e.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},e.prototype.setVisual=function(t,r){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,r)},e.prototype.getVisual=function(t){return this.hostTree.data.getItemVisual(this.dataIndex,t)},e.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},e.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},e.prototype.getChildIndex=function(){if(this.parentNode){for(var t=this.parentNode.children,r=0;r=0){var n=r.getData().tree.root,a=e.targetNode;if(ue(a)&&(a=n.getNodeById(a)),a&&n.contains(a))return{node:a};var i=e.targetNodeId;if(i!=null&&(a=n.getNodeById(i)))return{node:a}}}function t9(e){for(var t=[];e;)e=e.parentNode,e&&t.push(e);return t.reverse()}function MI(e,t){var r=t9(e);return Ve(r,t)>=0}function uw(e,t){for(var r=[];e;){var n=e.dataIndex;r.push({name:e.name,dataIndex:n,value:t.getRawValue(n)}),e=e.parentNode}return r.reverse(),r}var Kc="tree",yde=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r.ignoreStyleOnData=!0,r}return t.prototype.getInitialData=function(r){var n={name:r.name,children:r.data},a=r.leaves||{},i=new tt(a,this,this.ecModel),o=TI.createTree(n,this,s);function s(h){h.wrapMethod("getItemModel",function(d,v){var g=o.getNodeByDataIndex(v);return g&&g.children.length&&g.isExpand||(d.parentModel=i),d})}var l=0;o.eachNode("preorder",function(h){h.depth>l&&(l=h.depth)});var u=r.expandAndCollapse,c=u&&r.initialTreeDepth>=0?r.initialTreeDepth:l;return o.root.eachNode("preorder",function(h){var d=h.hostTree.data.getRawDataItem(h.dataIndex);h.isExpand=d&&d.collapsed!=null?!d.collapsed:h.depth<=c}),o.data},t.prototype.getOrient=function(){var r=this.get("orient");return r==="horizontal"?r="LR":r==="vertical"&&(r="TB"),r},t.prototype.formatTooltip=function(r,n,a){for(var i=this.getData().tree,o=i.root.children[0],s=i.getNodeByDataIndex(r),l=s.getValue(),u=s.name;s&&s!==o;)u=s.parentNode.name+"."+u,s=s.parentNode;return Mr("nameValue",{name:u,value:l,noValue:isNaN(l)||l==null})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),a=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=uw(a,this),n.collapsed=!a.isExpand,n},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type="series."+Kc,t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,roamTrigger:"global",nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:K.color.borderTint,width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500},t}(Pt),xde=function(){function e(){this.parentPoint=[],this.childPoints=[]}return e}(),_de=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new xde},t.prototype.buildPath=function(r,n){var a=n.childPoints,i=a.length,o=n.parentPoint,s=a[0],l=a[i-1];if(i===1){r.moveTo(o[0],o[1]),r.lineTo(s[0],s[1]);return}var u=n.orient,c=u==="TB"||u==="BT"?0:1,h=1-c,d=fe(n.forkPosition,1),v=[];v[c]=o[c],v[h]=o[h]+(l[h]-o[h])*d,r.moveTo(o[0],o[1]),r.lineTo(v[0],v[1]),r.moveTo(s[0],s[1]),v[c]=s[c],r.lineTo(v[0],v[1]),v[c]=l[c],r.lineTo(v[0],v[1]),r.lineTo(l[0],l[1]);for(var g=1;g_.x,C||(S=S-Math.PI));var A=C?"left":"right",I=s.getModel("label"),k=I.get("rotate"),P=k*(Math.PI/180),D=y.getTextContent();D&&(y.setTextConfig({position:I.get("position")||A,rotation:k==null?-S:P,origin:"center"}),D.setStyle("verticalAlign","middle"))}var z=s.get(["emphasis","focus"]),E=z==="relative"?ld(o.getAncestorsIndices(),o.getDescendantIndices()):z==="ancestor"?o.getAncestorsIndices():z==="descendant"?o.getDescendantIndices():null;E&&(Ee(r).focus=E),wde(a,o,c,r,g,v,m,n),r.__edge&&(r.onHoverStateChange=function(B){if(B!=="blur"){var H=o.parentNode&&e.getItemGraphicEl(o.parentNode.dataIndex);H&&H.hoverState===Im||H_(r.__edge,B)}})}function wde(e,t,r,n,a,i,o,s){var l=t.getModel(),u=e.get("edgeShape"),c=e.get("layout"),h=e.getOrient(),d=e.get(["lineStyle","curveness"]),v=e.get("edgeForkPosition"),g=l.getModel("lineStyle").getLineStyle(),m=n.__edge;if(u==="curve")t.parentNode&&t.parentNode!==r&&(m||(m=n.__edge=new Ud({shape:NA(c,h,d,a,a)})),mt(m,{shape:NA(c,h,d,i,o)},e));else if(u==="polyline"&&c==="orthogonal"&&t!==r&&t.children&&t.children.length!==0&&t.isExpand===!0){for(var y=t.children,x=[],_=0;_=0;i--)r.push(a[i])}}function Cde(e,t){e.eachSeriesByType("tree",function(r){Tde(r,t)})}function Tde(e,t){var r=jr(e,t).refContainer,n=Zt(e.getBoxLayoutParams(),r);e.layoutInfo=n;var a=e.get("layout"),i=0,o=0,s=null;a==="radial"?(i=2*Math.PI,o=Math.min(n.height,n.width)/2,s=m3(function(S,C){return(S.parentNode===C.parentNode?1:2)/S.depth})):(i=n.width,o=n.height,s=m3());var l=e.getData().tree.root,u=l.children[0];if(u){rde(l),Sde(u,nde,s),l.hierNode.modifier=-u.hierNode.prelim,op(u,ade);var c=u,h=u,d=u;op(u,function(S){var C=S.getLayout().x;Ch.getLayout().x&&(h=S),S.depth>d.depth&&(d=S)});var v=c===h?1:s(c,h)/2,g=v-c.getLayout().x,m=0,y=0,x=0,_=0;if(a==="radial")m=i/(h.getLayout().x+v+g),y=o/(d.depth-1||1),op(u,function(S){x=(S.getLayout().x+g)*m,_=(S.depth-1)*y;var C=Lp(x,_);S.setLayout({x:C.x,y:C.y,rawX:x,rawY:_},!0)});else{var w=e.getOrient();w==="RL"||w==="LR"?(y=o/(h.getLayout().x+v+g),m=i/(d.depth-1||1),op(u,function(S){_=(S.getLayout().x+g)*y,x=w==="LR"?(S.depth-1)*m:i-(S.depth-1)*m,S.setLayout({x,y:_},!0)})):(w==="TB"||w==="BT")&&(m=i/(h.getLayout().x+v+g),y=o/(d.depth-1||1),op(u,function(S){x=(S.getLayout().x+g)*m,_=w==="TB"?(S.depth-1)*y:o-(S.depth-1)*y,S.setLayout({x,y:_},!0)}))}}}function Mde(e){e.registerAction({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(t,r){r.eachComponent({mainType:Do,subType:Kc,query:t},function(n){var a=t.dataIndex,i=n.getData().tree,o=i.getNodeByDataIndex(a);o.isExpand=!o.isExpand})}),_I(e,Do,Kc)}var Ade=Er(Kc,Nde);function Nde(e){e.eachSeriesByType(Kc,function(t){var r=t.getData(),n=r.tree;n.eachNode(function(a){var i=a.getModel(),o=i.getModel("itemStyle").getItemStyle(),s=r.ensureUniqueItemVisual(a.dataIndex,"style");te(s,o)})})}function kde(e){e.registerChartView(bde),e.registerSeriesModel(yde),e.registerLayout(Cde),e.registerVisual(Ade),Mde(e)}var w3=["treemapZoomToNode","treemapRender","treemapMove"];function Lde(e){for(var t=0;t1;)i=i.parentNode;var o=UM(e.ecModel,i.name||i.dataIndex+"",n);a.setVisual("decal",o)})}var Ide=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.preventUsingHoverLayer=!0,r}return t.prototype.getInitialData=function(r,n){var a={name:r.name,children:r.data};a9(a);var i=r.levels||[],o=this.designatedVisualItemStyle={},s=new tt({itemStyle:o},this,n);i=r.levels=Pde(i,n);var l=oe(i||[],function(h){return new tt(h,s,n)},this),u=TI.createTree(a,this,c);function c(h){h.wrapMethod("getItemModel",function(d,v){var g=u.getNodeByDataIndex(v),m=g?l[g.depth]:null;return d.parentModel=m||s,d})}return u.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.formatTooltip=function(r,n,a){var i=this.getData(),o=this.getRawValue(r),s=i.getName(r);return Mr("nameValue",{name:s,value:o})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),a=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=uw(a,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(r){this.layoutInfo=this.layoutInfo||{},te(this.layoutInfo,r)},t.prototype.mapIdToIndex=function(r){var n=this._idIndexMap;n||(n=this._idIndexMap=pe(),this._idIndexMapCount=0);var a=n.get(r);return a==null&&n.set(r,a=this._idIndexMapCount++),a},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(r){r?this._viewRoot=r:r=this._viewRoot;var n=this.getRawData().tree.root;(!r||r!==n&&!n.contains(r))&&(this._viewRoot=n)},t.prototype.enableAriaDecal=function(){n9(this)},t.type="series.treemap",t.layoutMode="box",t.defaultOption={progressive:0,coordinateSystemUsage:"box",left:K.size.l,top:K.size.xxxl,right:K.size.l,bottom:K.size.xxxl,sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.32*.32,scaleLimit:{max:5,min:.2},roam:!0,roamTrigger:"global",nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",bottom:K.size.m,emptyItemWidth:25,itemStyle:{color:K.color.backgroundShade,textStyle:{color:K.color.secondary}},emphasis:{itemStyle:{color:K.color.background}}},label:{show:!0,distance:0,padding:5,position:"inside",color:K.color.neutral00,overflow:"truncate"},upperLabel:{show:!1,position:[0,"50%"],height:20,overflow:"truncate",verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:K.color.neutral00,borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],overflow:"truncate",verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},t}(Pt);function a9(e){var t=0;j(e.children,function(n){a9(n);var a=n.value;ne(a)&&(a=a[0]),t+=a});var r=e.value;ne(r)&&(r=r[0]),(r==null||isNaN(r))&&(r=t),r<0&&(r=0),ne(e.value)?e.value[0]=r:e.value=r}function Pde(e,t){var r=jt(t.get("color")),n=jt(t.get(["aria","decal","decals"]));if(r){e=e||[];var a,i;j(e,function(s){var l=new tt(s),u=l.get("color"),c=l.get("decal");(l.get(["itemStyle","color"])||u&&u!=="none")&&(a=!0),(l.get(["itemStyle","decal"])||c&&c!=="none")&&(i=!0)});var o=e[0]||(e[0]={});return a||(o.color=r.slice()),!i&&n&&(o.decal=n.slice()),e}}var Dde=8,S3=8,ZC=5,Ede=function(){function e(t){this.group=new Ne,t.add(this.group)}return e.prototype.render=function(t,r,n,a){var i=t.getModel("breadcrumb"),o=this.group;if(o.removeAll(),!(!i.get("show")||!n)){var s=i.getModel("itemStyle"),l=i.getModel("emphasis"),u=s.getModel("textStyle"),c=l.getModel(["itemStyle","textStyle"]),h=jr(t,r).refContainer,d={left:i.get("left"),right:i.get("right"),top:i.get("top"),bottom:i.get("bottom")},v={emptyItemWidth:i.get("emptyItemWidth"),totalWidth:0,renderList:[]},g=Zt(d,h);this._prepare(n,v,u),this._renderContent(t,v,g,s,l,u,c,a),G1(o,d,h)}},e.prototype._prepare=function(t,r,n){for(var a=t;a;a=a.parentNode){var i=Ir(a.getModel().get("name"),""),o=n.getTextRect(i),s=Math.max(o.width+Dde*2,r.emptyItemWidth);r.totalWidth+=s+S3,r.renderList.push({node:a,text:i,width:s})}},e.prototype._renderContent=function(t,r,n,a,i,o,s,l){for(var u=0,c=r.emptyItemWidth,h=t.get(["breadcrumb","height"]),d=r.totalWidth,v=r.renderList,g=i.getModel("itemStyle").getItemStyle(),m=v.length-1;m>=0;m--){var y=v[m],x=y.node,_=y.width,w=y.text;d>n.width&&(d-=_-c,_=c,w=null);var S=new vn({shape:{points:jde(u,0,_,h,m===v.length-1,m===0)},style:Le(a.getItemStyle(),{lineJoin:"bevel"}),textContent:new ht({style:Et(o,{text:w})}),textConfig:{position:"inside"},z2:Gd*1e4,onclick:Xe(l,x)});S.disableLabelAnimation=!0,S.getTextContent().ensureState("emphasis").style=Et(s,{text:w}),S.ensureState("emphasis").style=g,Yt(S,i.get("focus"),i.get("blurScope"),i.get("disabled")),this.group.add(S),Rde(S,t,x),u+=_+S3}},e.prototype.remove=function(){this.group.removeAll()},e}();function jde(e,t,r,n,a,i){var o=[[a?e:e-ZC,t],[e+r,t],[e+r,t+n],[a?e:e-ZC,t+n]];return!i&&o.splice(2,0,[e+r+ZC,t+n/2]),!a&&o.push([e,t+n/2]),o}function Rde(e,t,r){Ee(e).eventData={componentType:"series",componentSubType:"treemap",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:r&&r.dataIndex,name:r&&r.name},treePathInfo:r&&uw(r,t)}}var Ode=function(){function e(){this._storage=[],this._elExistsMap={}}return e.prototype.add=function(t,r,n,a,i){return this._elExistsMap[t.id]?!1:(this._elExistsMap[t.id]=!0,this._storage.push({el:t,target:r,duration:n,delay:a,easing:i}),!0)},e.prototype.finished=function(t){return this._finishedCallback=t,this},e.prototype.start=function(){for(var t=this,r=this._storage.length,n=function(){r--,r<=0&&(t._storage.length=0,t._elExistsMap={},t._finishedCallback&&t._finishedCallback())},a=0,i=this._storage.length;a=0;l--){var u=a[n==="asc"?o-l-1:l].getValue();u/r*ts[1]&&(s[1]=u)})),{sum:n,dataExtent:s}}function $de(e,t,r){for(var n=0,a=1/0,i=0,o=void 0,s=e.length;in&&(n=o));var l=e.area*e.area,u=t*t*r;return l?um(u*n/l,l/(u*a)):1/0}function C3(e,t,r,n,a){var i=t===r.width?0:1,o=1-i,s=["x","y"],l=["width","height"],u=r[s[i]],c=t?e.area/t:0;(a||c>r[l[o]])&&(c=r[l[o]]);for(var h=0,d=e.length;hRg&&(c=Rg),a=l}cM3||Math.abs(r.dy)>M3)){var n=this.seriesModel.getData().tree.root;if(!n)return;var a=n.getLayout();if(!a)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:a.x+r.dx,y:a.y+r.dy,width:a.width,height:a.height}})}},t.prototype._onZoom=function(r){var n=r.originX,a=r.originY,i=r.scale,o=this.seriesModel;if(this._state!=="animating"){var s=o.getData().tree.root;if(!s)return;var l=s.getLayout();if(!l)return;var u=new ke(l.x,l.y,l.width,l.height),c=o.layoutInfo,h=u9(c,l),d=h*i;d=c9(d,o);var v=d/h;n-=c.x,a-=c.y;var g=$t();Pi(g,g,[-n,-a]),b1(g,g,[v,v]),Pi(g,g,[n,a]),u.applyTransform(g),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:u.x,y:u.y,width:u.width,height:u.height}})}},t.prototype._initEvents=function(r){var n=this;r.on("click",function(a){if(n._state==="ready"){var i=n.seriesModel.get("nodeClick",!0);if(i){var o=n.findTarget(a.offsetX,a.offsetY);if(o){var s=o.node;if(s.getLayout().isLeafRoot)n._rootToNode(o);else if(i==="zoomToNode")n._zoomToNode(o);else if(i==="link"){var l=s.hostTree.data.getItemModel(s.dataIndex),u=l.get("link",!0),c=l.get("target",!0)||"blank";u&&X_(u,c)}}}}},this)},t.prototype._renderBreadcrumb=function(r,n,a){var i=this;a||(a=r.get("leafDepth",!0)!=null?{node:r.getViewRoot()}:this.findTarget(n.getWidth()/2,n.getHeight()/2),a||(a={node:r.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new Ede(this.group))).render(r,n,a.node,function(o){i._state!=="animating"&&(MI(r.getViewRoot(),o)?i._rootToNode({node:o}):i._zoomToNode({node:o}))})},t.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=sp(),this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},t.prototype.dispose=function(){this._clearController()},t.prototype._zoomToNode=function(r){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:r.node})},t.prototype._rootToNode=function(r){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:r.node})},t.prototype.findTarget=function(r,n){var a,i=this.seriesModel.getViewRoot();return i.eachNode({attr:"viewChildren",order:"preorder"},function(o){var s=this._storage.background[o.getRawIndex()];if(s){var l=s.transformCoordToLocal(r,n),u=s.shape;if(u.x<=l[0]&&l[0]<=u.x+u.width&&u.y<=l[1]&&l[1]<=u.y+u.height)a={node:o,offsetX:l[0],offsetY:l[1]};else return!1}},this),a},t.type="treemap",t}(At);function sp(){return{nodeGroup:[],background:[],content:[]}}function eve(e,t,r,n,a,i,o,s,l,u){if(!o)return;var c=o.getLayout(),h=e.getData(),d=o.getModel();if(h.setItemGraphicEl(o.dataIndex,null),!c||!c.isInView)return;var v=c.width,g=c.height,m=c.borderWidth,y=c.invisible,x=o.getRawIndex(),_=s&&s.getRawIndex(),w=o.viewChildren,S=c.upperHeight,C=w&&w.length,M=d.getModel("itemStyle"),A=d.getModel(["emphasis","itemStyle"]),I=d.getModel(["blur","itemStyle"]),k=d.getModel(["select","itemStyle"]),P=M.get("borderRadius")||0,D=se("nodeGroup",kA);if(!D)return;if(l.add(D),D.x=c.x||0,D.y=c.y||0,D.markRedraw(),Ab(D).nodeWidth=v,Ab(D).nodeHeight=g,c.isAboveViewRoot)return D;var z=se("background",T3,u,Kde);z&&$(D,z,C&&c.upperLabelHeight);var E=d.getModel("emphasis"),B=E.get("focus"),H=E.get("blurScope"),V=E.get("disabled"),U=B==="ancestor"?o.getAncestorsIndices():B==="descendant"?o.getDescendantIndices():B;if(C)Bg(D)&&lc(D,!1),z&&(lc(z,!V),h.setItemGraphicEl(o.dataIndex,z),DM(z,U,H));else{var F=se("content",T3,u,Jde);F&&W(D,F),z.disableMorphing=!0,z&&Bg(z)&&lc(z,!1),lc(D,!V),h.setItemGraphicEl(o.dataIndex,D);var Z=d.getShallow("cursor");Z&&F.attr("cursor",Z),DM(D,U,H)}return D;function $(ye,me,Oe){var be=Ee(me);if(be.dataIndex=o.dataIndex,be.seriesIndex=e.seriesIndex,me.setShape({x:0,y:0,width:v,height:g,r:P}),y)q(me);else{me.invisible=!1;var we=o.getVisual("style"),yt=we.stroke,nt=k3(M);nt.fill=yt;var vt=Xu(A);vt.fill=A.get("borderColor");var dt=Xu(I);dt.fill=I.get("borderColor");var Ft=Xu(k);if(Ft.fill=k.get("borderColor"),Oe){var dr=v-2*m;re(me,yt,we.opacity,{x:m,y:0,width:dr,height:S})}else me.removeTextContent();me.setStyle(nt),me.ensureState("emphasis").style=vt,me.ensureState("blur").style=dt,me.ensureState("select").style=Ft,Oc(me)}ye.add(me)}function W(ye,me){var Oe=Ee(me);Oe.dataIndex=o.dataIndex,Oe.seriesIndex=e.seriesIndex;var be=Math.max(v-2*m,0),we=Math.max(g-2*m,0);if(me.culling=!0,me.setShape({x:m,y:m,width:be,height:we,r:P}),y)q(me);else{me.invisible=!1;var yt=o.getVisual("style"),nt=yt.fill,vt=k3(M);vt.fill=nt,vt.decal=yt.decal;var dt=Xu(A),Ft=Xu(I),dr=Xu(k);re(me,nt,yt.opacity,null),me.setStyle(vt),me.ensureState("emphasis").style=dt,me.ensureState("blur").style=Ft,me.ensureState("select").style=dr,Oc(me)}ye.add(me)}function q(ye){!ye.invisible&&i.push(ye)}function re(ye,me,Oe,be){var we=d.getModel(be?N3:A3),yt=Ir(d.get("name"),null),nt=we.getShallow("show");Hr(ye,Dr(d,be?N3:A3),{defaultText:nt?yt:null,inheritColor:me,defaultOpacity:Oe,labelFetcher:e,labelDataIndex:o.dataIndex});var vt=ye.getTextContent();if(vt){var dt=vt.style,Ft=Am(dt.padding||0);be&&(ye.setTextConfig({layoutRect:be}),vt.disableLabelLayout=!0),vt.beforeUpdate=function(){var Rr=Math.max((be?be.width:ye.shape.width)-Ft[1]-Ft[3],0),Xt=Math.max((be?be.height:ye.shape.height)-Ft[0]-Ft[2],0);(dt.width!==Rr||dt.height!==Xt)&&vt.setStyle({width:Rr,height:Xt})},dt.truncateMinChar=2,dt.lineOverflow="truncate",Q(dt,be,c);var dr=vt.getState("emphasis");Q(dr?dr.style:null,be,c)}}function Q(ye,me,Oe){var be=ye?ye.text:null;if(!me&&Oe.isLeafRoot&&be!=null){var we=e.get("drillDownIcon",!0);ye.text=we?we+" "+be:be}}function se(ye,me,Oe,be){var we=_!=null&&r[ye][_],yt=a[ye];return we?(r[ye][_]=null,ce(yt,we)):y||(we=new me,we instanceof ai&&(we.z2=tve(Oe,be)),Ue(yt,we)),t[ye][x]=we}function ce(ye,me){var Oe=ye[x]={};me instanceof kA?(Oe.oldX=me.x,Oe.oldY=me.y):Oe.oldShape=te({},me.shape)}function Ue(ye,me){var Oe=ye[x]={},be=o.parentNode,we=me instanceof Ne;if(be&&(!n||n.direction==="drillDown")){var yt=0,nt=0,vt=a.background[be.getRawIndex()];!n&&vt&&vt.oldShape&&(yt=vt.oldShape.width,nt=vt.oldShape.height),we?(Oe.oldX=0,Oe.oldY=nt):Oe.oldShape={x:yt,y:nt,width:0,height:0}}Oe.fadein=!we}}function tve(e,t){return e*qde+t}var cm=j,rve=Ie,Nb=-1,Gr=function(){function e(t){var r=t.mappingMethod,n=t.type,a=this.option=Te(t);this.type=n,this.mappingMethod=r,this._normalizeData=ive[r];var i=e.visualHandlers[n];this.applyVisual=i.applyVisual,this.getColorMapper=i.getColorMapper,this._normalizedToVisual=i._normalizedToVisual[r],r==="piecewise"?($C(a),nve(a)):r==="category"?a.categories?ave(a):$C(a,!0):(fn(r!=="linear"||a.dataExtent),$C(a))}return e.prototype.mapValueToVisual=function(t){var r=this._normalizeData(t);return this._normalizedToVisual(r,t)},e.prototype.getNormalizer=function(){return ve(this._normalizeData,this)},e.listVisualTypes=function(){return at(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(t,r,n){Ie(t)?j(t,r,n):r.call(n,t)},e.mapVisual=function(t,r,n){var a,i=ne(t)?[]:Ie(t)?{}:(a=!0,null);return e.eachVisual(t,function(o,s){var l=r.call(n,o,s);a?i=l:i[s]=l}),i},e.retrieveVisuals=function(t){var r={},n;return t&&cm(e.visualHandlers,function(a,i){t.hasOwnProperty(i)&&(r[i]=t[i],n=!0)}),n?r:null},e.prepareVisualTypes=function(t){if(ne(t))t=t.slice();else if(rve(t)){var r=[];cm(t,function(n,a){r.push(a)}),t=r}else return[];return t.sort(function(n,a){return a==="color"&&n!=="color"&&n.indexOf("color")===0?1:-1}),t},e.dependsOn=function(t,r){return r==="color"?!!(t&&t.indexOf(r)===0):t===r},e.findPieceIndex=function(t,r,n){for(var a,i=1/0,o=0,s=r.length;o=0;i--)n[i]==null&&(delete r[t[i]],t.pop())}function $C(e,t){var r=e.visual,n=[];Ie(r)?cm(r,function(i){n.push(i)}):r!=null&&n.push(r);var a={color:1,symbol:1};!t&&n.length===1&&!a.hasOwnProperty(e.type)&&(n[1]=n[0]),h9(e,n)}function G0(e){return{applyVisual:function(t,r,n){var a=this.mapValueToVisual(t);n("color",e(r("color"),a))},_normalizedToVisual:LA([0,1])}}function L3(e){var t=this.option.visual;return t[Math.round(xt(e,[0,1],[0,t.length-1],!0))]||{}}function lp(e){return function(t,r,n){n(e,this.mapValueToVisual(t))}}function Ip(e){var t=this.option.visual;return t[this.option.loop&&e!==Nb?e%t.length:e]}function qu(){return this.option.visual[0]}function LA(e){return{linear:function(t){return xt(t,e,this.option.visual,!0)},category:Ip,piecewise:function(t,r){var n=IA.call(this,r);return n==null&&(n=xt(t,e,this.option.visual,!0)),n},fixed:qu}}function IA(e){var t=this.option,r=t.pieceList;if(t.hasSpecialVisual){var n=Gr.findPieceIndex(e,r),a=r[n];if(a&&a.visual)return a.visual[this.type]}}function h9(e,t){return e.visual=t,e.type==="color"&&(e.parsedVisual=oe(t,function(r){var n=An(r);return n||[0,0,0,1]})),t}var ive={linear:function(e){return xt(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,r=Gr.findPieceIndex(e,t,!0);if(r!=null)return xt(r,[0,t.length-1],[0,1],!0)},category:function(e){var t=this.option.categories?this.option.categoryMap[e]:e;return t??Nb},fixed:ar};function H0(e,t,r){return e?t<=r:t=r.length||m===r[m.depth]){var x=hve(a,l,m,y,g,n);d9(m,x,r,n)}})}}}function lve(e,t,r){var n=te({},t),a=r.designatedVisualItemStyle;return j(["color","colorAlpha","colorSaturation"],function(i){a[i]=t[i];var o=e.get(i);a[i]=null,o!=null&&(n[i]=o)}),n}function I3(e){var t=YC(e,"color");if(t){var r=YC(e,"colorAlpha"),n=YC(e,"colorSaturation");return n&&(t=ds(t,null,null,n)),r&&(t=Pg(t,r)),t}}function uve(e,t){return t!=null?ds(t,null,null,e):null}function YC(e,t){var r=e[t];if(r!=null&&r!=="none")return r}function cve(e,t,r,n,a,i){if(!(!i||!i.length)){var o=XC(t,"color")||a.color!=null&&a.color!=="none"&&(XC(t,"colorAlpha")||XC(t,"colorSaturation"));if(o){var s=t.get("visualMin"),l=t.get("visualMax"),u=r.dataExtent.slice();s!=null&&su[1]&&(u[1]=l);var c=t.get("colorMappingBy"),h={type:o.name,dataExtent:u,visual:o.range};h.type==="color"&&(c==="index"||c==="id")?(h.mappingMethod="category",h.loop=!0):h.mappingMethod="linear";var d=new Gr(h);return f9(d).drColorMappingBy=c,d}}}function XC(e,t){var r=e.get(t);return ne(r)&&r.length?{name:t,range:r}:null}function hve(e,t,r,n,a,i){var o=te({},t);if(a){var s=a.type,l=s==="color"&&f9(a).drColorMappingBy,u=l==="index"?n:l==="id"?i.mapIdToIndex(r.getId()):r.getValue(e.get("visualDimension"));o[s]=a.mapValueToVisual(u)}return o}function fve(e){e.registerSeriesModel(Ide),e.registerChartView(Qde),e.registerVisual(sve),e.registerLayout(Gde),Lde(e)}function ef(e){return"_EC_"+e}var dve=function(){function e(t){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=t||!1}return e.prototype.isDirected=function(){return this._directed},e.prototype.addNode=function(t,r){t=t==null?""+r:""+t;var n=this._nodesMap;if(!n[ef(t)]){var a=new Ku(t,r);return a.hostGraph=this,this.nodes.push(a),n[ef(t)]=a,a}},e.prototype.getNodeByIndex=function(t){var r=this.data.getRawIndex(t);return this.nodes[r]},e.prototype.getNodeById=function(t){return this._nodesMap[ef(t)]},e.prototype.addEdge=function(t,r,n){var a=this._nodesMap,i=this._edgesMap;if(ft(t)&&(t=this.nodes[t]),ft(r)&&(r=this.nodes[r]),t instanceof Ku||(t=a[ef(t)]),r instanceof Ku||(r=a[ef(r)]),!(!t||!r)){var o=t.id+"-"+r.id,s=new v9(t,r,n);return s.hostGraph=this,this._directed&&(t.outEdges.push(s),r.inEdges.push(s)),t.edges.push(s),t!==r&&r.edges.push(s),this.edges.push(s),i[o]=s,s}},e.prototype.getEdgeByIndex=function(t){var r=this.edgeData.getRawIndex(t);return this.edges[r]},e.prototype.getEdge=function(t,r){t instanceof Ku&&(t=t.id),r instanceof Ku&&(r=r.id);var n=this._edgesMap;return this._directed?n[t+"-"+r]:n[t+"-"+r]||n[r+"-"+t]},e.prototype.eachNode=function(t,r){for(var n=this.nodes,a=n.length,i=0;i=0&&t.call(r,n[i],i)},e.prototype.eachEdge=function(t,r){for(var n=this.edges,a=n.length,i=0;i=0&&n[i].node1.dataIndex>=0&&n[i].node2.dataIndex>=0&&t.call(r,n[i],i)},e.prototype.breadthFirstTraverse=function(t,r,n,a){if(r instanceof Ku||(r=this._nodesMap[ef(r)]),!!r){for(var i=n==="out"?"outEdges":n==="in"?"inEdges":"edges",o=0;o=0&&l.node2.dataIndex>=0});for(var i=0,o=a.length;i=0&&!t.hasKey(g)&&(t.set(g,!0),o.push(v.node1))}for(l=0;l=0&&!t.hasKey(w)&&(t.set(w,!0),s.push(_.node2))}}}return{edge:t.keys(),node:r.keys()}},e}(),v9=function(){function e(t,r,n){this.dataIndex=-1,this.node1=t,this.node2=r,this.dataIndex=n??-1}return e.prototype.getModel=function(t){if(!(this.dataIndex<0)){var r=this.hostGraph,n=r.edgeData.getItemModel(this.dataIndex);return n.getModel(t)}},e.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},e.prototype.getTrajectoryDataIndices=function(){var t=pe(),r=pe();t.set(this.dataIndex,!0);for(var n=[this.node1],a=[this.node2],i=0;i=0&&!t.hasKey(h)&&(t.set(h,!0),n.push(c.node1))}for(i=0;i=0&&!t.hasKey(m)&&(t.set(m,!0),a.push(g.node2))}return{edge:t.keys(),node:r.keys()}},e}();function p9(e,t){return{getValue:function(r){var n=this[e][t];return n.getStore().get(n.getDimensionIndex(r||"value"),this.dataIndex)},setVisual:function(r,n){this.dataIndex>=0&&this[e][t].setItemVisual(this.dataIndex,r,n)},getVisual:function(r){return this[e][t].getItemVisual(this.dataIndex,r)},setLayout:function(r,n){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,r,n)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}br(Ku,p9("hostGraph","data"));br(v9,p9("hostGraph","edgeData"));function NI(e,t,r,n,a){for(var i=new dve(n),o=0;o "+d)),u++)}var v=r.get("coordinateSystem"),g;if(v==="cartesian2d"||v==="polar"||v==="matrix")g=Go(e,r);else{var m=qd.get(v),y=m?m.dimensions||[]:[];Ve(y,"value")<0&&y.concat(["value"]);var x=ev(e,{coordDimensions:y,encodeDefine:r.getEncode()}).dimensions;g=new Nn(x,r),g.initData(e)}var _=new Nn(["value"],r);return _.initData(l,s),a&&a(g,_),QW({mainData:g,struct:i,structAttr:"graph",datas:{node:g,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),i.update(),i}var PA="-->",cw=function(e){return e.get("autoCurveness")||null},g9=function(e,t){var r=cw(e),n=20,a=[];if(ft(r))n=r;else if(ne(r)){e.__curvenessList=r;return}t>n&&(n=t);var i=n%2?n+2:n+3;a=[];for(var o=0;o "),value:o.value,noValue:o.value==null})}var h=U7({series:this,dataIndex:r,multipleSeries:n});return h},t.prototype._updateCategoriesData=function(){var r=oe(this.option.categories||[],function(a){return a.value!=null?a:te({value:0},a)}),n=new Nn(["value"],this);n.initData(r),this._categoriesData=n,this._categoriesModels=n.mapArray(function(a){return n.getItemModel(a)})},t.prototype.isAnimationEnabled=function(){return e.prototype.isAnimationEnabled.call(this)&&!(this.get("layout")==="force"&&this.get(["force","layoutAnimation"]))},t.prototype.__ownRoamView=function(){var r=this.coordinateSystem;return zW(r)&&r},t.type="series."+Un,t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:K.color.neutral50,width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:K.color.primary}}},t}(Pt);function U0(e){return e instanceof Array||(e=[e,e]),e}var xve=Er(Un,_ve);function _ve(e){e.eachSeriesByType(Un,function(t){var r=t.getGraph(),n=t.getEdgeData(),a=U0(t.get("edgeSymbol")),i=U0(t.get("edgeSymbolSize"));n.setVisual("fromSymbol",a&&a[0]),n.setVisual("toSymbol",a&&a[1]),n.setVisual("fromSymbolSize",i&&i[0]),n.setVisual("toSymbolSize",i&&i[1]),n.setVisual("style",t.getModel("lineStyle").getLineStyle()),n.each(function(o){var s=n.getItemModel(o),l=r.getEdgeByIndex(o),u=U0(s.getShallow("symbol",!0)),c=U0(s.getShallow("symbolSize",!0)),h=s.getModel("lineStyle").getLineStyle(),d=n.ensureUniqueItemVisual(o,"style");switch(te(d,h),d.stroke){case"source":{var v=l.node1.getVisual("style");d.stroke=v&&v.fill;break}case"target":{var v=l.node2.getVisual("style");d.stroke=v&&v.fill;break}}u[0]&&l.setVisual("fromSymbol",u[0]),u[1]&&l.setVisual("toSymbol",u[1]),c[0]&&l.setVisual("fromSymbolSize",c[0]),c[1]&&l.setVisual("toSymbolSize",c[1])})})}function y9(e){var t=e.coordinateSystem;if(!(t&&t.type!=="view")){var r=e.getGraph();r.eachNode(function(n){var a=n.getModel();n.setLayout([+a.get("x"),+a.get("y")])}),LI(r,e)}}function LI(e,t){e.eachEdge(function(r,n){var a=ia(r.getModel().get(["lineStyle","curveness"]),-kI(r,t,n,!0),0),i=mo(r.node1.getLayout()),o=mo(r.node2.getLayout()),s=[i,o];+a&&s.push([(i[0]+o[0])/2-(i[1]-o[1])*a,(i[1]+o[1])/2-(o[0]-i[0])*a]),r.setLayout(s)})}var bve=Er(Un,wve);function wve(e,t){e.eachSeriesByType(Un,function(r){var n=r.get("layout"),a=r.coordinateSystem;if(a&&a.type!=="view"){var i=r.getData(),o=[];j(a.dimensions,function(d){o=o.concat(i.mapDimensionsAll(d))});for(var s=0;s0&&(C[0]=-C[0],C[1]=-C[1]);var A=S[0]<0?-1:1;if(i.__position!=="start"&&i.__position!=="end"){var I=-Math.atan2(S[1],S[0]);h[0].8?"left":d[0]<-.8?"right":"center",m=d[1]>.8?"top":d[1]<-.8?"bottom":"middle";break;case"start":i.x=-d[0]*x+c[0],i.y=-d[1]*_+c[1],g=d[0]>.8?"right":d[0]<-.8?"left":"center",m=d[1]>.8?"bottom":d[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":i.x=x*A+c[0],i.y=c[1]+k,g=S[0]<0?"right":"left",i.originX=-x*A,i.originY=-k;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=M[0],i.y=M[1]+k,g="center",i.originY=-k;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-x*A+h[0],i.y=h[1]+k,g=S[0]>=0?"right":"left",i.originX=x*A,i.originY=-k;break}i.scaleX=i.scaleY=o,i.setStyle({verticalAlign:i.__verticalAlign||m,align:i.__align||g})}},t}(Ne),DI=function(){function e(t){this.group=new Ne,this._LineCtor=t||PI}return e.prototype.updateData=function(t){var r=this;this._progressiveEls=null;var n=this,a=n.group,i=n._lineData;n._lineData=t,i||a.removeAll();var o=O3(t);t.diff(i).add(function(s){r._doAdd(t,s,o)}).update(function(s,l){r._doUpdate(i,t,l,s,o)}).remove(function(s){a.remove(i.getItemGraphicEl(s))}).execute()},e.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl(function(r,n){r.updateLayout(t,n)},this)},e.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=O3(t),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(t,r,n){this._progressiveEls=[];function a(l){!l.isGroup&&!Pve(l)&&(l.incremental=n,l.ensureState("emphasis").hoverLayer=Zd)}for(var i=t.start;i0}function O3(e){var t=e.hostModel,r=t.getModel("emphasis");return{lineStyle:t.getModel("lineStyle").getLineStyle(),emphasisLineStyle:r.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:t.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:t.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:r.get("disabled"),blurScope:r.get("blurScope"),focus:r.get("focus"),labelStatesModels:Dr(t)}}function z3(e){return isNaN(e[0])||isNaN(e[1])}function eT(e){return e&&!z3(e[0])&&!z3(e[1])}var tT=[],rT=[],nT=[],rf=Xr,aT=Al,B3=Math.abs;function F3(e,t,r){for(var n=e[0],a=e[1],i=e[2],o=1/0,s,l=r*r,u=.1,c=.1;c<=.9;c+=.1){tT[0]=rf(n[0],a[0],i[0],c),tT[1]=rf(n[1],a[1],i[1],c);var h=B3(aT(tT,t)-l);h=0?s=s+u:s=s-u:g>=0?s=s-u:s=s+u}return s}function iT(e,t){var r=[],n=Lg,a=[[],[],[]],i=[[],[]],o=[];t/=2,e.eachEdge(function(s,l){var u=s.getLayout(),c=s.getVisual("fromSymbol"),h=s.getVisual("toSymbol");u.__original||(u.__original=[mo(u[0]),mo(u[1])],u[2]&&u.__original.push(mo(u[2])));var d=u.__original;if(u[2]!=null){if(nn(a[0],d[0]),nn(a[1],d[2]),nn(a[2],d[1]),c&&c!=="none"){var v=Dp(s.node1),g=F3(a,d[0],v*t);n(a[0][0],a[1][0],a[2][0],g,r),a[0][0]=r[3],a[1][0]=r[4],n(a[0][1],a[1][1],a[2][1],g,r),a[0][1]=r[3],a[1][1]=r[4]}if(h&&h!=="none"){var v=Dp(s.node2),g=F3(a,d[1],v*t);n(a[0][0],a[1][0],a[2][0],g,r),a[1][0]=r[1],a[2][0]=r[2],n(a[0][1],a[1][1],a[2][1],g,r),a[1][1]=r[1],a[2][1]=r[2]}nn(u[0],a[0]),nn(u[1],a[2]),nn(u[2],a[1])}else{if(nn(i[0],d[0]),nn(i[1],d[1]),hl(o,i[1],i[0]),oh(o,o),c&&c!=="none"){var v=Dp(s.node1);M_(i[0],i[0],o,v*t)}if(h&&h!=="none"){var v=Dp(s.node2);M_(i[1],i[1],o,-v*t)}nn(u[0],i[0]),nn(u[1],i[1])}})}var w9=Ze();function Dve(e){if(e)return w9(e).bridge}function V3(e,t){e&&(w9(e).bridge=t)}var Eve=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Un,r}return t.prototype.init=function(r,n){var a=new Um,i=new DI,o=this.group,s=new Ne;this._controller=new xh(n.getZr()),s.add(a.group),s.add(i.group),o.add(s),this._symbolDraw=a,this._lineDraw=i,this._mainGroup=s,this._firstRender=!0},t.prototype.render=function(r,n,a){var i=this,o=Cb(r),s=!1;this._model=r,this._api=a,this._active=!0;var l=this._mainGroup,u=this._getThumbnailInfo();u&&u.bridge.reset(a);var c=this._symbolDraw,h=this._lineDraw;o&&Hl(l,Ro,o,this._firstRender?null:r),iT(r.getGraph(),Pp(r));var d=r.getData();c.updateData(d);var v=r.getEdgeData();h.updateData(v),this._updateNodeAndLinkScale(),o&&lw(r,a,this._controller,function(S,C,M){return r.coordinateSystem.containPoint([C,M])},null),clearTimeout(this._layoutTimeout);var g=r.forceLayout,m=r.get(["force","layoutAnimation"]);g&&(s=!0,this._startForceLayoutIteration(g,a,m));var y=r.get("layout");d.graph.eachNode(function(S){var C=S.dataIndex,M=S.getGraphicEl(),A=S.getModel();if(M){M.off("drag").off("dragend");var I=A.get("draggable");I&&M.on("drag",function(P){switch(y){case"force":g.warmUp(),!i._layouting&&i._startForceLayoutIteration(g,a,m),g.setFixed(C),d.setItemLayout(C,[M.x,M.y]);break;case"circular":d.setItemLayout(C,[M.x,M.y]),S.setLayout({fixed:!0},!0),II(r,"symbolSize",S,[P.offsetX,P.offsetY]),i.updateLayout(r);break;case"none":default:d.setItemLayout(C,[M.x,M.y]),LI(r.getGraph(),r),i.updateLayout(r);break}}).on("dragend",function(){g&&g.setUnfixed(C)}),M.setDraggable(I,!!A.get("cursor"));var k=A.get(["emphasis","focus"]);k==="adjacency"&&(Ee(M).focus=S.getAdjacentDataIndices())}}),d.graph.eachEdge(function(S){var C=S.getGraphicEl(),M=S.getModel().get(["emphasis","focus"]);C&&M==="adjacency"&&(Ee(C).focus={edge:[S.dataIndex],node:[S.node1.dataIndex,S.node2.dataIndex]})});var x=r.get("layout")==="circular"&&r.get(["circular","rotateLabel"]),_=d.getLayout("cx"),w=d.getLayout("cy");d.graph.eachNode(function(S){x9(S,x,_,w)}),this._firstRender=!1,s||this._renderThumbnail(r,a,this._symbolDraw,this._lineDraw)},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose()},t.prototype._startForceLayoutIteration=function(r,n,a){var i=this,o=!1;(function s(){r.step(function(l){i.updateLayout(i._model),(l||!o)&&(o=!0,i._renderThumbnail(i._model,n,i._symbolDraw,i._lineDraw)),(i._layouting=!l)&&(a?i._layoutTimeout=setTimeout(s,16):s())})})()},t.prototype.__updateOnOwnRoam=function(r,n,a){var i=Cb(n);!this._active||!i||(Hl(this._mainGroup,Ro,i,null),ZW(r)&&(this._updateNodeAndLinkScale(),iT(n.getGraph(),Pp(n)),this._lineDraw.updateLayout(),a.updateLabelLayout()),this._updateThumbnailWindow())},t.prototype._updateNodeAndLinkScale=function(){var r=this._model,n=r.getData(),a=Pp(r);n.eachItemGraphicEl(function(i,o){i&&i.setSymbolScale(a)})},t.prototype.updateLayout=function(r){this._active&&(iT(r.getGraph(),Pp(r)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout())},t.prototype.remove=function(){this._active=!1,clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove(),this._controller&&this._controller.disable()},t.prototype._getThumbnailInfo=function(){var r=this._model,n=r.coordinateSystem;if(n.type==="view"){var a=Dve(r);if(a)return{bridge:a,coordSys:n}}},t.prototype._updateThumbnailWindow=function(){var r=this._getThumbnailInfo();r&&r.bridge.updateWindow(wb(null,r.coordSys),this._api)},t.prototype._renderThumbnail=function(r,n,a,i){var o=this._getThumbnailInfo();if(o){var s=new Ne,l=a.group.children(),u=i.group.children(),c=new Ne,h=new Ne;s.add(h),s.add(c);for(var d=0;d "),value:i.value,noValue:i.value==null})}return Mr("nameValue",{name:i.name,value:i.value,noValue:i.value==null})},t.prototype.getDataParams=function(r,n){var a=e.prototype.getDataParams.call(this,r,n);if(n==="node"){var i=this.getData(),o=this.getGraph().getNodeByIndex(r);if(a.name==null&&(a.name=i.getName(r)),a.value==null){var s=o.getLayout().value;a.value=s}}return a},t.type="series."+fm,t.defaultOption={z:2,coordinateSystem:"none",legendHoverLink:!0,colorBy:"data",left:0,top:0,right:0,bottom:0,width:null,height:null,center:["50%","50%"],radius:["70%","80%"],clockwise:!0,startAngle:90,endAngle:"auto",minAngle:0,padAngle:3,itemStyle:{borderRadius:[0,0,5,5]},lineStyle:{width:0,color:"source",opacity:.2},label:{show:!0,position:"outside",distance:5},emphasis:{focus:"adjacency",lineStyle:{opacity:.5}}},t}(Pt),G3=function(e){X(t,e);function t(r,n,a){var i=e.call(this)||this;Ee(i).dataType="node",i.z2=2;var o=new ht;return i.setTextContent(o),i.updateData(r,n,a,!0),i}return t.prototype.updateData=function(r,n,a,i){var o=this,s=r.graph.getNodeByIndex(n),l=r.hostModel,u=s.getModel(),c=u.getModel("emphasis"),h=r.getItemLayout(n),d=te(ho(u.getModel("itemStyle"),h,!0),h),v=this;if(isNaN(d.startAngle)){v.setShape(d);return}i?v.setShape(d):mt(v,{shape:d},l,n);var g=te(ho(u.getModel("itemStyle"),h,!0),h);o.setShape(g),o.useStyle(r.getItemVisual(n,"style")),Pr(o,u),this._updateLabel(l,u,s),r.setItemGraphicEl(n,v),Pr(v,u,"itemStyle");var m=c.get("focus");Yt(this,m==="adjacency"?s.getAdjacentDataIndices():m,c.get("blurScope"),c.get("disabled"))},t.prototype._updateLabel=function(r,n,a){var i=this.getTextContent(),o=a.getLayout(),s=(o.startAngle+o.endAngle)/2,l=Math.cos(s),u=Math.sin(s),c=n.getModel("label");i.ignore=!c.get("show");var h=Dr(n),d=a.getVisual("style");Hr(i,h,{labelFetcher:{getFormattedLabel:function(_,w,S,C,M,A){return r.getFormattedLabel(_,w,"node",C,ia(M,h.normal&&h.normal.get("formatter"),n.get("name")),A)}},labelDataIndex:a.dataIndex,defaultText:a.dataIndex+"",inheritColor:d.fill,defaultOpacity:d.opacity,defaultOutsidePosition:"startArc"});var v=c.get("position")||"outside",g=c.get("distance")||0,m;v==="outside"?m=o.r+g:m=(o.r+o.r0)/2,this.textConfig={inside:v!=="outside"};var y=v!=="outside"?c.get("align")||"center":l>0?"left":"right",x=v!=="outside"?c.get("verticalAlign")||"middle":u>0?"top":"bottom";i.attr({x:l*m+o.cx,y:u*m+o.cy,rotation:0,style:{align:y,verticalAlign:x}})},t}(dn),Vve=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this)||this;return Ee(o).dataType="edge",o.updateData(r,n,a,i,!0),o}return t.prototype.buildPath=function(r,n){r.moveTo(n.s1[0],n.s1[1]);var a=.7,i=n.clockwise;r.arc(n.cx,n.cy,n.r,n.sStartAngle,n.sEndAngle,!i),r.bezierCurveTo((n.cx-n.s2[0])*a+n.s2[0],(n.cy-n.s2[1])*a+n.s2[1],(n.cx-n.t1[0])*a+n.t1[0],(n.cy-n.t1[1])*a+n.t1[1],n.t1[0],n.t1[1]),r.arc(n.cx,n.cy,n.r,n.tStartAngle,n.tEndAngle,!i),r.bezierCurveTo((n.cx-n.t2[0])*a+n.t2[0],(n.cy-n.t2[1])*a+n.t2[1],(n.cx-n.s1[0])*a+n.s1[0],(n.cy-n.s1[1])*a+n.s1[1],n.s1[0],n.s1[1]),r.closePath()},t.prototype.updateData=function(r,n,a,i,o){var s=r.hostModel,l=n.graph.getEdgeByIndex(a),u=l.getLayout(),c=l.node1.getModel(),h=n.getItemModel(l.dataIndex),d=h.getModel("lineStyle"),v=h.getModel("emphasis"),g=v.get("focus"),m=te(ho(c.getModel("itemStyle"),u,!0),u),y=this;if(isNaN(m.sStartAngle)||isNaN(m.tStartAngle)){y.setShape(m);return}o?(y.setShape(m),H3(y,l,r,d)):(ii(y),H3(y,l,r,d),mt(y,{shape:m},s,a)),Yt(this,g==="adjacency"?l.getAdjacentDataIndices():g,v.get("blurScope"),v.get("disabled")),Pr(y,h,"lineStyle"),n.setItemGraphicEl(l.dataIndex,y)},t}(rt);function H3(e,t,r,n){var a=t.node1,i=t.node2,o=e.style;e.setStyle(n.getLineStyle());var s=n.get("color");switch(s){case"source":o.fill=r.getItemVisual(a.dataIndex,"style").fill,o.decal=a.getVisual("style").decal;break;case"target":o.fill=r.getItemVisual(i.dataIndex,"style").fill,o.decal=i.getVisual("style").decal;break;case"gradient":var l=r.getItemVisual(a.dataIndex,"style").fill,u=r.getItemVisual(i.dataIndex,"style").fill;if(ue(l)&&ue(u)){var c=e.shape,h=(c.s1[0]+c.s2[0])/2,d=(c.s1[1]+c.s2[1])/2,v=(c.t1[0]+c.t2[0])/2,g=(c.t1[1]+c.t2[1])/2;o.fill=new hh(h,d,v,g,[{offset:0,color:l},{offset:1,color:u}],!0)}break}}var Gve=Math.PI/180,Hve=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=fm,r}return t.prototype.init=function(r,n){},t.prototype.render=function(r,n,a){var i=r.getData(),o=this._data,s=this.group,l=-r.get("startAngle")*Gve;if(i.diff(o).add(function(c){var h=i.getItemLayout(c);if(h){var d=new G3(i,c,l);Ee(d).dataIndex=c,s.add(d)}}).update(function(c,h){var d=o.getItemGraphicEl(h),v=i.getItemLayout(c);if(!v){d&&vs(d,r,h);return}d?d.updateData(i,c,l):d=new G3(i,c,l),s.add(d)}).remove(function(c){var h=o.getItemGraphicEl(c);h&&vs(h,r,c)}).execute(),!o){var u=r.get("center");this.group.scaleX=.01,this.group.scaleY=.01,this.group.originX=fe(u[0],a.getWidth()),this.group.originY=fe(u[1],a.getHeight()),Ut(this.group,{scaleX:1,scaleY:1},r)}this._data=i,this.renderEdges(r,l)},t.prototype.renderEdges=function(r,n){var a=r.getData(),i=r.getEdgeData(),o=this._edgeData,s=this.group;i.diff(o).add(function(l){var u=new Vve(a,i,l,n);Ee(u).dataIndex=l,s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(a,i,l,n),s.add(c)}).remove(function(l){var u=o.getItemGraphicEl(l);u&&vs(u,r,l)}).execute(),this._edgeData=i},t.prototype.dispose=function(){},t.type=fm,t}(At),oT=Math.PI/180,Uve=Er(fm,Wve);function Wve(e,t){e.eachSeriesByType(fm,function(r){Zve(r,t)})}function Zve(e,t){var r=e.getData(),n=r.graph,a=e.getEdgeData(),i=a.count();if(i){var o=u7(e,t),s=o.cx,l=o.cy,u=o.r,c=o.r0,h=Math.max((e.get("padAngle")||0)*oT,0),d=Math.max((e.get("minAngle")||0)*oT,0),v=-e.get("startAngle")*oT,g=v+Math.PI*2,m=e.get("clockwise"),y=m?1:-1,x=[v,g];E1(x,!m);var _=x[0],w=x[1],S=w-_,C=r.getSum("value")===0&&a.getSum("value")===0,M=[],A=0;n.eachEdge(function(F){var Z=C?1:F.getValue("value");C&&(Z>0||d)&&(A+=2);var $=F.node1.dataIndex,W=F.node2.dataIndex;M[$]=(M[$]||0)+Z,M[W]=(M[W]||0)+Z});var I=0;if(n.eachNode(function(F){var Z=F.getValue("value");isNaN(Z)||(M[F.dataIndex]=Math.max(Z,M[F.dataIndex]||0)),!C&&(M[F.dataIndex]>0||d)&&A++,I+=M[F.dataIndex]||0}),!(A===0||I===0)){h*A>=Math.abs(S)&&(h=Math.max(0,(Math.abs(S)-d*A)/A)),(h+d)*A>=Math.abs(S)&&(d=(Math.abs(S)-h*A)/A);var k=(S-h*A*y)/I,P=0,D=0,z=0;n.eachNode(function(F){var Z=M[F.dataIndex]||0,$=k*(I?Z:1)*y;Math.abs($)D){var B=P/D;n.eachNode(function(F){var Z=F.getLayout().angle;Math.abs(Z)>=d?F.setLayout({angle:Z*B,ratio:B},!0):F.setLayout({angle:d,ratio:d===0?1:Z/d},!0)})}else n.eachNode(function(F){if(!E){var Z=F.getLayout().angle,$=Math.min(Z/z,1),W=$*P;Z-Wd&&d>0){var $=E?1:Math.min(Z/z,1),W=Z-d,q=Math.min(W,Math.min(H,P*$));H-=q,F.setLayout({angle:Z-q,ratio:(Z-q)/Z},!0)}else d>0&&F.setLayout({angle:d,ratio:Z===0?1:d/Z},!0)}});var V=_,U=[];n.eachNode(function(F){var Z=Math.max(F.getLayout().angle,d);F.setLayout({cx:s,cy:l,r0:c,r:u,startAngle:V,endAngle:V+Z*y,clockwise:m},!0),U[F.dataIndex]=V,V+=(Z+h)*y}),n.eachEdge(function(F){var Z=C?1:F.getValue("value"),$=k*(I?Z:1)*y,W=F.node1.dataIndex,q=U[W]||0,re=Math.abs((F.node1.getLayout().ratio||1)*$),Q=q+re*y,se=[s+c*Math.cos(q),l+c*Math.sin(q)],ce=[s+c*Math.cos(Q),l+c*Math.sin(Q)],Ue=F.node2.dataIndex,ye=U[Ue]||0,me=Math.abs((F.node2.getLayout().ratio||1)*$),Oe=ye+me*y,be=[s+c*Math.cos(ye),l+c*Math.sin(ye)],we=[s+c*Math.cos(Oe),l+c*Math.sin(Oe)];F.setLayout({s1:se,s2:ce,sStartAngle:q,sEndAngle:Q,t1:be,t2:we,tStartAngle:ye,tEndAngle:Oe,cx:s,cy:l,r:c,value:Z,clockwise:m}),U[W]=Q,U[Ue]=Oe})}}}function $ve(e){e.registerChartView(Hve),e.registerSeriesModel(Fve),e.registerLayout(e.PRIORITY.VISUAL.POST_CHART_LAYOUT,Uve),e.registerProcessor($m("chord"))}var Yve=function(){function e(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return e}(),Xve=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="pointer",n}return t.prototype.getDefaultShape=function(){return new Yve},t.prototype.buildPath=function(r,n){var a=Math.cos,i=Math.sin,o=n.r,s=n.width,l=n.angle,u=n.x-a(l)*s*(s>=o/3?1:2),c=n.y-i(l)*s*(s>=o/3?1:2);l=n.angle-Math.PI/2,r.moveTo(u,c),r.lineTo(n.x+a(l)*s,n.y+i(l)*s),r.lineTo(n.x+a(n.angle)*o,n.y+i(n.angle)*o),r.lineTo(n.x-a(l)*s,n.y-i(l)*s),r.lineTo(u,c)},t}(rt);function qve(e,t){var r=e.get("center"),n=t.getWidth(),a=t.getHeight(),i=Math.min(n,a),o=fe(r[0],t.getWidth()),s=fe(r[1],t.getHeight()),l=fe(e.get("radius"),i/2);return{cx:o,cy:s,r:l}}function W0(e,t){var r=e==null?"":e+"";return t&&(ue(t)?r=t.replace("{value}",r):Me(t)&&(r=t(e))),r}var Kve=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){this.group.removeAll();var i=r.get(["axisLine","lineStyle","color"]),o=qve(r,a);this._renderMain(r,n,a,i,o),this._data=r.getData()},t.prototype.dispose=function(){},t.prototype._renderMain=function(r,n,a,i,o){var s=this.group,l=r.get("clockwise"),u=-r.get("startAngle")/180*Math.PI,c=-r.get("endAngle")/180*Math.PI,h=r.getModel("axisLine"),d=h.get("roundCap"),v=d?xb:dn,g=h.get("show"),m=h.getModel("lineStyle"),y=m.get("width"),x=[u,c];E1(x,!l),u=x[0],c=x[1];for(var _=c-u,w=u,S=[],C=0;g&&C=k&&(P===0?0:i[P-1][0])Math.PI/2&&(Q+=Math.PI)):re==="tangential"?Q=-I-Math.PI/2:ft(re)&&(Q=re*Math.PI/180),Q===0?h.add(new ht({style:Et(w,{text:Z,x:W,y:q,verticalAlign:H<-.8?"top":H>.8?"bottom":"middle",align:B<-.4?"left":B>.4?"right":"center"},{inheritColor:$}),silent:!0})):h.add(new ht({style:Et(w,{text:Z,x:W,y:q,verticalAlign:"middle",align:"center"},{inheritColor:$}),silent:!0,originX:W,originY:q,rotation:Q}))}if(_.get("show")&&V!==S){var U=_.get("distance");U=U?U+c:c;for(var se=0;se<=C;se++){B=Math.cos(I),H=Math.sin(I);var ce=new yr({shape:{x1:B*(g-U)+d,y1:H*(g-U)+v,x2:B*(g-A-U)+d,y2:H*(g-A-U)+v},silent:!0,style:z});z.stroke==="auto"&&ce.setStyle({stroke:i((V+se/C)/S)}),h.add(ce),I+=P}I-=P}else I+=k}},t.prototype._renderPointer=function(r,n,a,i,o,s,l,u,c){var h=this.group,d=this._data,v=this._progressEls,g=[],m=r.get(["pointer","show"]),y=r.getModel("progress"),x=y.get("show"),_=r.getData(),w=_.mapDimension("value"),S=+r.get("min"),C=+r.get("max"),M=[S,C],A=[s,l];function I(P,D){var z=_.getItemModel(P),E=z.getModel("pointer"),B=fe(E.get("width"),o.r),H=fe(E.get("length"),o.r),V=r.get(["pointer","icon"]),U=E.get("offsetCenter"),F=fe(U[0],o.r),Z=fe(U[1],o.r),$=E.get("keepAspect"),W;return V?W=_r(V,F-B/2,Z-H,B,H,null,$):W=new Xve({shape:{angle:-Math.PI/2,width:B,r:H,x:F,y:Z}}),W.rotation=-(D+Math.PI/2),W.x=o.cx,W.y=o.cy,W}function k(P,D){var z=y.get("roundCap"),E=z?xb:dn,B=y.get("overlap"),H=B?y.get("width"):c/_.count(),V=B?o.r-H:o.r-(P+1)*H,U=B?o.r:o.r-P*H,F=new E({shape:{startAngle:s,endAngle:D,cx:o.cx,cy:o.cy,clockwise:u,r0:V,r:U}});return B&&(F.z2=xt(_.get(w,P),[S,C],[100,0],!0)),F}(x||m)&&(_.diff(d).add(function(P){var D=_.get(w,P);if(m){var z=I(P,s);Ut(z,{rotation:-((isNaN(+D)?A[0]:xt(D,M,A,!0))+Math.PI/2)},r),h.add(z),_.setItemGraphicEl(P,z)}if(x){var E=k(P,s),B=y.get("clip");Ut(E,{shape:{endAngle:xt(D,M,A,B)}},r),h.add(E),kM(r.seriesIndex,_.dataType,P,E),g[P]=E}}).update(function(P,D){var z=_.get(w,P);if(m){var E=d.getItemGraphicEl(D),B=E?E.rotation:s,H=I(P,B);H.rotation=B,mt(H,{rotation:-((isNaN(+z)?A[0]:xt(z,M,A,!0))+Math.PI/2)},r),h.add(H),_.setItemGraphicEl(P,H)}if(x){var V=v[D],U=V?V.shape.endAngle:s,F=k(P,U),Z=y.get("clip");mt(F,{shape:{endAngle:xt(z,M,A,Z)}},r),h.add(F),kM(r.seriesIndex,_.dataType,P,F),g[P]=F}}).execute(),_.each(function(P){var D=_.getItemModel(P),z=D.getModel("emphasis"),E=z.get("focus"),B=z.get("blurScope"),H=z.get("disabled"),V=i(xt(_.get(w,P),M,[0,1],!0));if(m){var U=_.getItemGraphicEl(P),F=_.getItemVisual(P,"style"),Z=F.fill;if(U instanceof Ur){var $=U.style;U.useStyle(te({image:$.image,x:$.x,y:$.y,width:$.width,height:$.height},F))}else U.useStyle(F),U.type!=="pointer"&&U.setColor(Z);U.setStyle(D.getModel(["pointer","itemStyle"]).getItemStyle()),U.style.fill==="auto"&&U.setStyle("fill",V),U.z2EmphasisLift=0,Pr(U,D),Yt(U,E,B,H)}if(x){var W=g[P];W.useStyle(_.getItemVisual(P,"style")),W.setStyle(D.getModel(["progress","itemStyle"]).getItemStyle()),W.style.fill==="auto"&&W.setStyle("fill",V),W.z2EmphasisLift=0,Pr(W,D),Yt(W,E,B,H)}}),this._progressEls=g)},t.prototype._renderAnchor=function(r,n){var a=r.getModel("anchor"),i=a.get("show");if(i){var o=a.get("size"),s=a.get("icon"),l=a.get("offsetCenter"),u=a.get("keepAspect"),c=_r(s,n.cx-o/2+fe(l[0],n.r),n.cy-o/2+fe(l[1],n.r),o,o,null,u);c.z2=a.get("showAbove")?1:0,c.setStyle(a.getModel("itemStyle").getItemStyle()),this.group.add(c)}},t.prototype._renderTitleAndDetail=function(r,n,a,i,o){var s=this,l=r.getData(),u=l.mapDimension("value"),c=+r.get("min"),h=+r.get("max"),d=new Ne,v=[],g=[],m=r.isAnimationEnabled(),y=r.get(["pointer","showAbove"]);l.diff(this._data).add(function(x){v[x]=new ht({silent:!0}),g[x]=new ht({silent:!0})}).update(function(x,_){v[x]=s._titleEls[_],g[x]=s._detailEls[_]}).execute(),l.each(function(x){var _=l.getItemModel(x),w=l.get(u,x),S=new Ne,C=i(xt(w,[c,h],[0,1],!0)),M=_.getModel("title");if(M.get("show")){var A=M.get("offsetCenter"),I=o.cx+fe(A[0],o.r),k=o.cy+fe(A[1],o.r),P=v[x];P.attr({z2:y?0:2,style:Et(M,{x:I,y:k,text:l.getName(x),align:"center",verticalAlign:"middle"},{inheritColor:C})}),S.add(P)}var D=_.getModel("detail");if(D.get("show")){var z=D.get("offsetCenter"),E=o.cx+fe(z[0],o.r),B=o.cy+fe(z[1],o.r),H=fe(D.get("width"),o.r),V=fe(D.get("height"),o.r),U=r.get(["progress","show"])?l.getItemVisual(x,"style").fill:C,P=g[x],F=D.get("formatter");P.attr({z2:y?0:2,style:Et(D,{x:E,y:B,text:W0(w,F),width:isNaN(H)?null:H,height:isNaN(V)?null:V,align:"center",verticalAlign:"middle"},{inheritColor:U})}),FH(P,{normal:D},w,function($){return W0($,F)}),m&&VH(P,x,l,r,{getFormattedLabel:function($,W,q,re,Q,se){return W0(se?se.interpolatedValue:w,F)}}),S.add(P)}d.add(S)}),this.group.add(d),this._titleEls=v,this._detailEls=g},t.type="gauge",t}(At),Jve=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.visualStyleAccessPath="itemStyle",r}return t.prototype.getInitialData=function(r,n){return iv(this,["value"])},t.type="series.gauge",t.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,K.color.neutral10]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:K.color.axisTick,width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:K.color.axisTickMinor,width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:K.color.axisLabel,fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:K.color.neutral00,borderWidth:0,borderColor:K.color.theme[0]}},title:{show:!0,offsetCenter:[0,"20%"],color:K.color.secondary,fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:K.color.transparent,borderWidth:0,borderColor:K.color.neutral40,width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:K.color.primary,fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}},t}(Pt);function Qve(e){e.registerChartView(Kve),e.registerSeriesModel(Jve)}var Sd="funnel",epe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new ov(ve(this.getData,this),ve(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.getInitialData=function(r,n){return iv(this,{coordDimensions:["value"],encodeDefaulter:Xe(bL,this)})},t.prototype._defaultLabelLine=function(r){Dc(r,"labelLine",["show"]);var n=r.labelLine,a=r.emphasis.labelLine;n.show=n.show&&r.label.show,a.show=a.show&&r.emphasis.label.show},t.prototype.getDataParams=function(r){var n=this.getData(),a=e.prototype.getDataParams.call(this,r),i=n.mapDimension("value"),o=n.getSum(i);return a.percent=o?+(n.get(i,r)/o*100).toFixed(2):0,a.$vars.push("percent"),a},t.type="series."+Sd,t.defaultOption={coordinateSystemUsage:"box",z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:65,minSize:"0%",maxSize:"100%",sort:"descending",orient:"vertical",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:K.color.neutral00,borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:K.color.primary}}},t}(Pt),tpe=["itemStyle","opacity"],rpe=function(e){X(t,e);function t(r,n){var a=e.call(this)||this,i=a,o=new en,s=new ht;return i.setTextContent(s),a.setTextGuideLine(o),a.updateData(r,n,!0),a}return t.prototype.updateData=function(r,n,a){var i=this,o=r.hostModel,s=r.getItemModel(n),l=r.getItemLayout(n),u=s.getModel("emphasis"),c=s.get(tpe);c=c??1,a||ii(i),i.useStyle(r.getItemVisual(n,"style")),i.style.lineJoin="round",a?(i.setShape({points:l.points}),i.style.opacity=0,Ut(i,{style:{opacity:c}},o,n)):mt(i,{style:{opacity:c},shape:{points:l.points}},o,n),Pr(i,s),this._updateLabel(r,n),Yt(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r,n){var a=this,i=this.getTextGuideLine(),o=a.getTextContent(),s=r.hostModel,l=r.getItemModel(n),u=r.getItemLayout(n),c=u.label,h=r.getItemVisual(n,"style"),d=h.fill;Hr(o,Dr(l),{labelFetcher:r.hostModel,labelDataIndex:n,defaultOpacity:h.opacity,defaultText:r.getName(n)},{normal:{align:c.textAlign,verticalAlign:c.verticalAlign}});var v=l.getModel("label"),g=v.get("color"),m=g==="inherit"?d:null;a.setTextConfig({local:!0,inside:!!c.inside,insideStroke:m,outsideFill:m});var y=c.linePoints;i.setShape({points:y}),a.textGuideLineConfig={anchor:y?new Pe(y[0][0],y[0][1]):null},mt(o,{style:{x:c.x,y:c.y}},s,n),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),QL(a,eI(l),{stroke:d})},t}(vn),npe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Sd,r.ignoreLabelLineUpdate=!0,r}return t.prototype.render=function(r,n,a){var i=r.getData(),o=this._data,s=this.group;i.diff(o).add(function(l){var u=new rpe(i,l);i.setItemGraphicEl(l,u),s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(i,l),s.add(c),i.setItemGraphicEl(l,c)}).remove(function(l){var u=o.getItemGraphicEl(l);vs(u,r,l)}).execute(),this._data=i},t.prototype.remove=function(){this.group.removeAll(),this._data=null},t.prototype.dispose=function(){},t.type=Sd,t}(At);function ape(e,t){for(var r=e.mapDimension("value"),n=e.mapArray(r,function(l){return l}),a=[],i=t==="ascending",o=0,s=e.count();o-1&&(o="left"),r&&Ve(["left","right"],o)>-1&&(o="bottom")),o==="left"?(m=(u[3][0]+u[0][0])/2,y=(u[3][1]+u[0][1])/2,x=m-w,d=x-5,h="right"):o==="right"?(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,x=m+w,d=x+5,h="left"):o==="top"?(m=(u[3][0]+u[0][0])/2,y=(u[3][1]+u[0][1])/2,_=y-w,v=_-5,h="center"):o==="bottom"?(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,_=y+w,v=_+5,h="center"):o==="rightTop"?(m=r?u[3][0]:u[1][0],y=r?u[3][1]:u[1][1],r?(_=y-w,v=_-5,h="center"):(x=m+w,d=x+5,h="top")):o==="rightBottom"?(m=u[2][0],y=u[2][1],r?(_=y+w,v=_+5,h="center"):(x=m+w,d=x+5,h="bottom")):o==="leftTop"?(m=u[0][0],y=r?u[0][1]:u[1][1],r?(_=y-w,v=_-5,h="center"):(x=m-w,d=x-5,h="right")):o==="leftBottom"?(m=r?u[1][0]:u[3][0],y=r?u[1][1]:u[2][1],r?(_=y+w,v=_+5,h="center"):(x=m-w,d=x-5,h="right")):(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,r?(_=y+w,v=_+5,h="center"):(x=m+w,d=x+5,h="left")),r?(x=m,d=x):(_=y,v=_),g=[[m,y],[x,_]]}l.label={linePoints:g,x:d,y:v,verticalAlign:"middle",textAlign:h,inside:c}})}var ope=Er(Sd,spe);function spe(e,t){e.eachSeriesByType(Sd,function(r){var n=r.getData(),a=n.mapDimension("value"),i=r.get("sort"),o=jr(r,t),s=Zt(r.getBoxLayoutParams(),o.refContainer),l=S9(r),u=s.width,c=s.height,h=ape(n,i),d=s.x,v=s.y,g=l?[fe(r.get("minSize"),c),fe(r.get("maxSize"),c)]:[fe(r.get("minSize"),u),fe(r.get("maxSize"),u)],m=n.getDataExtent(a),y=r.get("min"),x=r.get("max");y==null&&(y=Math.min(m[0],0)),x==null&&(x=m[1]);var _=r.get("funnelAlign"),w=r.get("gap"),S=l?u:c,C=(S-w*(n.count()-1))/n.count(),M=function(H,V){if(l){var U=n.get(a,H)||0,F=xt(U,[y,x],g,!0),Z=void 0;switch(_){case"top":Z=v;break;case"center":Z=v+(c-F)/2;break;case"bottom":Z=v+(c-F);break}return[[V,Z],[V,Z+F]]}var $=n.get(a,H)||0,W=xt($,[y,x],g,!0),q;switch(_){case"left":q=d;break;case"center":q=d+(u-W)/2;break;case"right":q=d+u-W;break}return[[q,V],[q+W,V]]};i==="ascending"&&(C=-C,w=-w,l?d+=u:v+=c,h=h.reverse());for(var A=0;Abpe)return;var a=this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]);a.behavior!=="none"&&this._dispatchExpand({axisExpandWindow:a.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(e){if(!(this._mouseDownPoint||!lT(this,"mousemove"))){var t=this._model,r=t.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]),n=r.behavior;n==="jump"&&this._throttledDispatchExpand.debounceNextCall(t.get("axisExpandDebounce")),this._throttledDispatchExpand(n==="none"?null:{axisExpandWindow:r.axisExpandWindow,animation:n==="jump"?null:{duration:0}})}}};function lT(e,t){var r=e._model;return r.get("axisExpandable")&&r.get("axisExpandTriggerOn")===t}var kb="parallel",jA=kb,Cpe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(){e.prototype.init.apply(this,arguments),this.mergeOption({})},t.prototype.mergeOption=function(r){var n=this.option;r&&We(n,r,!0),this._initDimensions()},t.prototype.contains=function(r,n){var a=r.get("parallelIndex");return a!=null&&n.getComponent("parallel",a)===this},t.prototype.setAxisExpand=function(r){j(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],function(n){r.hasOwnProperty(n)&&(this.option[n]=r[n])},this)},t.prototype._initDimensions=function(){var r=this.dimensions=[],n=this.parallelAxisIndex=[],a=wt(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(i){return(i.get("parallelIndex")||0)===this.componentIndex},this);j(a,function(i){r.push("dim"+i.get("dim")),n.push(i.componentIndex)})},t.type=jA,t.dependencies=["parallelAxis"],t.layoutMode="box",t.defaultOption={z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null},t}(Qe),Tpe=function(e){X(t,e);function t(r,n,a,i,o){var s=e.call(this,r,n,a)||this;return s.type=i||"value",s.axisIndex=o,s}return t.prototype.isHorizontal=function(){return this.coordinateSystem.getModel().get("layout")!=="horizontal"},t}(ui);function Ul(e,t,r,n,a,i){e=e||0;var o=Zu(r[1],-r[0]);if(a!=null&&(a=nf(a,[0,o])),i!=null&&(i=Math.max(i,a??0)),n==="all"){var s=Math.abs(Zu(t[1],-t[0]));s=nf(s,[0,o]),a=i=nf(s,[a,i]),n=0}t[0]=nf(t[0],r),t[1]=nf(t[1],r);var l=uT(t,n);t[n]+=e;var u=a||0,c=r.slice();l.sign<0?c[0]=Zu(c[0],u):c[1]=Zu(c[1],-u),t[n]=nf(t[n],c);var h;return h=uT(t,n),a!=null&&(h.sign!==l.sign||h.spani&&(t[1-n]=Zu(t[n],h.sign*i)),t}function uT(e,t){var r=e[t]-e[1-t];return{span:Math.abs(r),sign:r>0?-1:r<0?1:t?-1:1}}function nf(e,t){return Math.min(t[1]!=null?t[1]:1/0,Math.max(t[0]!=null?t[0]:-1/0,e))}var Mpe=function(){function e(t,r,n){this.type=kb,this._axesMap=pe(),this._axesLayout={},this.dimensions=t.dimensions,this._model=t,this._init(t,r,n)}return e.prototype._init=function(t,r,n){var a=t.dimensions,i=t.parallelAxisIndex;j(a,function(o,s){var l=i[s],u=r.getComponent("parallelAxis",l),c=Fm(u),h=this._axesMap.set(o,new Tpe(o,tv(u,c,!1),[0,0],c,l));h.onBand=Gm(h.scale,u),h.inverse=u.get("inverse"),u.axis=h,h.model=u,h.coordinateSystem=u.coordinateSystem=this},this)},e.prototype.update=function(t,r){j(this.dimensions,function(n){var a=this._axesMap.get(n);Uc(a,xd),_d(a)},this)},e.prototype.containPoint=function(t){var r=this._makeLayoutInfo(),n=r.axisBase,a=r.layoutBase,i=r.pixelDimIndex,o=t[1-i],s=t[i];return o>=n&&o<=n+r.axisLength&&s>=a&&s<=a+r.layoutLength},e.prototype.getModel=function(){return this._model},e.prototype.resize=function(t,r){var n=jr(t,r).refContainer;this._rect=Zt(t.getBoxLayoutParams(),n),this._layoutAxes()},e.prototype.getRect=function(){return this._rect},e.prototype._makeLayoutInfo=function(){var t=this._model,r=this._rect,n=["x","y"],a=["width","height"],i=t.get("layout"),o=i==="horizontal"?0:1,s=r[a[o]],l=[0,s],u=this.dimensions.length,c=Z0(t.get("axisExpandWidth"),l),h=Z0(t.get("axisExpandCount")||0,[0,u]),d=t.get("axisExpandable")&&u>3&&u>h&&h>1&&c>0&&s>0,v=t.get("axisExpandWindow"),g;if(v)g=Z0(v[1]-v[0],l),v[1]=v[0]+g;else{g=Z0(c*(h-1),l);var m=t.get("axisExpandCenter")||ri(u/2);v=[c*m-g/2],v[1]=v[0]+g}var y=(s-g)/(u-h);y<3&&(y=0);var x=[ri(gt(v[0]/c,1))+1,lh(gt(v[1]/c,1))-1],_=y/c*v[0];return{layout:i,pixelDimIndex:o,layoutBase:r[n[o]],layoutLength:s,axisBase:r[n[1-o]],axisLength:r[a[1-o]],axisExpandable:d,axisExpandWidth:c,axisCollapseWidth:y,axisExpandWindow:v,axisCount:u,winInnerIndices:x,axisExpandWindow0Pos:_}},e.prototype._layoutAxes=function(){var t=this._rect,r=this._axesMap,n=this.dimensions,a=this._makeLayoutInfo(),i=a.layout;r.each(function(o){var s=[0,a.axisLength],l=o.inverse?1:0;o.setExtent(s[l],s[1-l])}),j(n,function(o,s){var l=(a.axisExpandable?Npe:Ape)(s,a),u={horizontal:{x:l.position,y:a.axisLength},vertical:{x:0,y:l.position}},c={horizontal:z_/2,vertical:0},h=[u[i].x+t.x,u[i].y+t.y],d=c[i],v=$t();js(v,v,d),Pi(v,v,h),this._axesLayout[o]={position:h,rotation:d,transform:v,axisNameAvailableWidth:l.axisNameAvailableWidth,axisLabelShow:l.axisLabelShow,nameTruncateMaxWidth:l.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},e.prototype.getAxis=function(t){return this._axesMap.get(t)},e.prototype.dataToPoint=function(t,r){return this.axisCoordToPoint(this._axesMap.get(r).dataToCoord(t),r)},e.prototype.eachActiveState=function(t,r,n,a){n==null&&(n=0),a==null&&(a=t.count());var i=this._axesMap,o=this.dimensions,s=[],l=[];j(o,function(y){s.push(t.mapDimension(y)),l.push(i.get(y).model)});for(var u=this.hasAxisBrushed(),c=n;ci*(1-h[0])?(u="jump",l=s-i*(1-h[2])):(l=s-i*h[1])>=0&&(l=s-i*(1-h[1]))<=0&&(l=0),l*=r.axisExpandWidth/c,l?Ul(l,a,o,"all"):u="none";else{var v=a[1]-a[0],g=o[1]*s/v;a=[qe(0,g-v/2)],a[1]=Mt(o[1],a[0]+v),a[0]=a[1]-v}return{axisExpandWindow:a,behavior:u}},e}();function Z0(e,t){return Mt(qe(e,t[0]),t[1])}function Ape(e,t){var r=t.layoutLength/(t.axisCount-1);return{position:r*e,axisNameAvailableWidth:r,axisLabelShow:!0}}function Npe(e,t){var r=t.layoutLength,n=t.axisExpandWidth,a=t.axisCount,i=t.axisCollapseWidth,o=t.winInnerIndices,s,l=i,u=!1,c;return e=0;a--)qr(n[a])},t.prototype.getActiveState=function(r){var n=this.activeIntervals;if(!n.length)return"normal";if(r==null||isNaN(+r))return"inactive";if(n.length===1){var a=n[0];if(a[0]<=r&&r<=a[1])return"active"}else for(var i=0,o=n.length;iDpe}function L9(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function I9(e,t,r,n){var a=new Ne;return a.add(new Ke({name:"main",style:zI(r),silent:!0,draggable:!0,cursor:"move",drift:Xe(Y3,e,t,a,["n","s","w","e"]),ondragend:Xe(Qc,t,{isEnd:!0})})),j(n,function(i){a.add(new Ke({name:i.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:Xe(Y3,e,t,a,i),ondragend:Xe(Qc,t,{isEnd:!0})}))}),a}function P9(e,t,r,n){var a=n.brushStyle.lineWidth||0,i=Cd(a,Epe),o=r[0][0],s=r[1][0],l=o-a/2,u=s-a/2,c=r[0][1],h=r[1][1],d=c-i+a/2,v=h-i+a/2,g=c-o,m=h-s,y=g+a,x=m+a;Jo(e,t,"main",o,s,g,m),n.transformable&&(Jo(e,t,"w",l,u,i,x),Jo(e,t,"e",d,u,i,x),Jo(e,t,"n",l,u,y,i),Jo(e,t,"s",l,v,y,i),Jo(e,t,"nw",l,u,i,i),Jo(e,t,"ne",d,u,i,i),Jo(e,t,"sw",l,v,i,i),Jo(e,t,"se",d,v,i,i))}function zA(e,t){var r=t.__brushOption,n=r.transformable,a=t.childAt(0);a.useStyle(zI(r)),a.attr({silent:!n,cursor:n?"move":"default"}),j([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(i){var o=t.childOfName(i.join("")),s=i.length===1?BA(e,i[0]):Fpe(e,i);o&&o.attr({silent:!n,invisible:!n,cursor:n?Rpe[s]+"-resize":null})})}function Jo(e,t,r,n,a,i,o){var s=t.childOfName(r);s&&s.setShape(Gpe(BI(e,t,[[n,a],[n+i,a+o]])))}function zI(e){return Le({strokeNoScale:!0},e.brushStyle)}function D9(e,t,r,n){var a=[dm(e,r),dm(t,n)],i=[Cd(e,r),Cd(t,n)];return[[a[0],i[0]],[a[1],i[1]]]}function Bpe(e){return yc(e.group)}function BA(e,t){var r={w:"left",e:"right",n:"top",s:"bottom"},n={left:"w",right:"e",top:"n",bottom:"s"},a=z1(r[t],Bpe(e));return n[a]}function Fpe(e,t){var r=[BA(e,t[0]),BA(e,t[1])];return(r[0]==="e"||r[0]==="w")&&r.reverse(),r.join("")}function Y3(e,t,r,n,a,i){var o=r.__brushOption,s=e.toRectRange(o.range),l=E9(t,a,i);j(n,function(u){var c=jpe[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=e.fromRectRange(D9(s[0][0],s[1][0],s[0][1],s[1][1])),jI(t,r),Qc(t,{isEnd:!1})}function Vpe(e,t,r,n){var a=t.__brushOption.range,i=E9(e,r,n);j(a,function(o){o[0]+=i[0],o[1]+=i[1]}),jI(e,t),Qc(e,{isEnd:!1})}function E9(e,t,r){var n=e.group,a=n.transformCoordToLocal(t,r),i=n.transformCoordToLocal(0,0);return[a[0]-i[0],a[1]-i[1]]}function BI(e,t,r){var n=k9(e,t);return n&&n!==Jc?n.clipPath(r,e._transform):Te(r)}function Gpe(e){var t=dm(e[0][0],e[1][0]),r=dm(e[0][1],e[1][1]),n=Cd(e[0][0],e[1][0]),a=Cd(e[0][1],e[1][1]);return{x:t,y:r,width:n-t,height:a-r}}function Hpe(e,t,r){if(!(!e._brushType||Wpe(e,t.offsetX,t.offsetY))){var n=e._zr,a=e._covers,i=OI(e,t,r);if(!e._dragging)for(var o=0;on.getWidth()||r<0||r>n.getHeight()}var hw={lineX:K3(0),lineY:K3(1),rect:{createCover:function(e,t){function r(n){return n}return I9({toRectRange:r,fromRectRange:r},e,t,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(e){var t=L9(e);return D9(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,r,n){P9(e,t,r,n)},updateCommon:zA,contain:VA},polygon:{createCover:function(e,t){var r=new Ne;return r.add(new en({name:"main",style:zI(t),silent:!0})),r},getCreatingRange:function(e){return e},endCreating:function(e,t){t.remove(t.childAt(0)),t.add(new vn({name:"main",draggable:!0,drift:Xe(Vpe,e,t),ondragend:Xe(Qc,e,{isEnd:!0})}))},updateCoverShape:function(e,t,r,n){t.childAt(0).setShape({points:BI(e,t,r)})},updateCommon:zA,contain:VA}};function K3(e){return{createCover:function(t,r){return I9({toRectRange:function(n){var a=[n,[0,100]];return e&&a.reverse(),a},fromRectRange:function(n){return n[e]}},t,r,[[["w"],["e"]],[["n"],["s"]]][e])},getCreatingRange:function(t){var r=L9(t),n=dm(r[0][e],r[1][e]),a=Cd(r[0][e],r[1][e]);return[n,a]},updateCoverShape:function(t,r,n,a){var i,o=k9(t,r);if(o!==Jc&&o.getLinearBrushOtherExtent)i=o.getLinearBrushOtherExtent(e);else{var s=t._zr;i=[0,[s.getWidth(),s.getHeight()][1-e]]}var l=[n,i];e&&l.reverse(),P9(t,r,l,a)},updateCommon:zA,contain:VA}}function R9(e){return e=FI(e),function(t){return tL(t,e)}}function O9(e,t){return e=FI(e),function(r){var n=t??r,a=n?e.width:e.height,i=n?e.x:e.y;return[i,i+(a||0)]}}function z9(e,t,r){var n=FI(e);return function(a,i){return n.contain(i[0],i[1])&&!IW(a,t,r)}}function FI(e){return ke.create(e)}var Zpe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){e.prototype.init.apply(this,arguments),(this._brushController=new EI(n.getZr())).on("brush",ve(this._onBrush,this))},t.prototype.render=function(r,n,a,i){if(!$pe(r,n,i)){this.axisModel=r,this.api=a,this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new Ne,this.group.add(this._axisGroup),!!r.get("show")){var s=Xpe(r,n),l=s.coordinateSystem,u=r.getAreaSelectStyle(),c=u.width,h=r.axis.dim,d=l.getAxisLayout(h),v=te({strokeContainThreshold:c},d),g=new Vn(r,a,v);g.build(),this._axisGroup.add(g.group),this._refreshBrushController(v,u,r,s,c,a),jm(o,this._axisGroup,r)}}},t.prototype._refreshBrushController=function(r,n,a,i,o,s){var l=a.axis.getExtent(),u=l[1]-l[0],c=Math.min(30,Math.abs(u)*.1),h=ke.create({x:l[0],y:-o/2,width:u,height:o});h.x-=c,h.width+=2*c,this._brushController.mount({enableGlobalPan:!0,rotation:r.rotation,x:r.position[0],y:r.position[1]}).setPanels([{panelId:"pl",clipPath:R9(h),isTargetByCursor:z9(h,s,i),getLinearBrushOtherExtent:O9(h,0)}]).enableBrush({brushType:"lineX",brushStyle:n,removeOnClick:!0}).updateCovers(Ype(a))},t.prototype._onBrush=function(r){var n=r.areas,a=this.axisModel,i=a.axis,o=oe(n,function(s){return[i.coordToData(s.range[0],!0),i.coordToData(s.range[1],!0)]});(!a.option.realtime===r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:a.id,intervals:o})},t.prototype.dispose=function(){this._brushController.dispose()},t.type="parallelAxis",t}(Rt);function $pe(e,t,r){return r&&r.type==="axisAreaSelect"&&t.findComponents({mainType:"parallelAxis",query:r})[0]===e}function Ype(e){var t=e.axis;return oe(e.activeIntervals,function(r){return{brushType:"lineX",panelId:"pl",range:[t.dataToCoord(r[0],!0),t.dataToCoord(r[1],!0)]}})}function Xpe(e,t){return t.getComponent("parallel",e.get("parallelIndex"))}var qpe={type:"axisAreaSelect",event:"axisAreaSelected"};function Kpe(e){e.registerAction(qpe,function(t,r){r.eachComponent({mainType:"parallelAxis",query:t},function(n){n.axis.model.setActiveIntervals(t.intervals)})}),e.registerAction("parallelAxisExpand",function(t,r){r.eachComponent({mainType:"parallel",query:t},function(n){n.setAxisExpand(t)})})}var Jpe={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function B9(e){e.registerComponentView(wpe),e.registerComponentModel(Cpe),e.registerCoordinateSystem("parallel",Lpe),e.registerPreprocessor(ype),e.registerComponentModel(RA),e.registerComponentView(Zpe),wd(e,"parallel",RA,Jpe),Kpe(e)}function Qpe(e){$e(B9),e.registerChartView(cpe),e.registerSeriesModel(dpe),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,mpe)}var Ps="sankey",ege=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){var a=r.edges||r.links||[],i=r.data||r.nodes||[],o=r.levels||[];this.levelModels=[];for(var s=this.levelModels,l=0;l=0&&(s[o[l].depth]=new tt(o[l],this,n));var u=NI(i,a,this,!0,c);return u.data;function c(h,d){h.wrapMethod("getItemModel",function(v,g){var m=v.parentModel,y=m.getData().getItemLayout(g);if(y){var x=y.depth,_=m.levelModels[x];_&&(v.parentModel=_)}return v}),d.wrapMethod("getItemModel",function(v,g){var m=v.parentModel,y=m.getGraph().getEdgeByIndex(g),x=y.node1.getLayout();if(x){var _=x.depth,w=m.levelModels[_];w&&(v.parentModel=w)}return v})}},t.prototype.setNodePosition=function(r,n){var a=this.option.data||this.option.nodes,i=a[r];i.localX=n[0],i.localY=n[1]},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(r,n,a){function i(v){return isNaN(v)||v==null}if(a==="edge"){var o=this.getDataParams(r,a),s=o.data,l=o.value,u=s.source+" -- "+s.target;return Mr("nameValue",{name:u,value:l,noValue:i(l)})}else{var c=this.getGraph().getNodeByIndex(r),h=c.getLayout().value,d=this.getDataParams(r,a).data.name;return Mr("nameValue",{name:d!=null?d+"":null,value:h,noValue:i(h)})}},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(r,n){var a=e.prototype.getDataParams.call(this,r,n);if(a.value==null&&n==="node"){var i=this.getGraph().getNodeByIndex(r),o=i.getLayout().value;a.value=o}return a},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type="series."+Ps,t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,roam:!1,roamTrigger:"global",center:null,zoom:1,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:K.color.neutral50,opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:K.color.primary}},animationEasing:"linear",animationDuration:1e3},t}(Pt),tge=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return e}(),rge=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new tge},t.prototype.buildPath=function(r,n){var a=n.extent;r.moveTo(n.x1,n.y1),r.bezierCurveTo(n.cpx1,n.cpy1,n.cpx2,n.cpy2,n.x2,n.y2),n.orient==="vertical"?(r.lineTo(n.x2+a,n.y2),r.bezierCurveTo(n.cpx2+a,n.cpy2,n.cpx1+a,n.cpy1,n.x1+a,n.y1)):(r.lineTo(n.x2,n.y2+a),r.bezierCurveTo(n.cpx2,n.cpy2+a,n.cpx1,n.cpy1+a,n.x1,n.y1+a)),r.closePath()},t.prototype.highlight=function(){As(this)},t.prototype.downplay=function(){Ns(this)},t}(rt),nge=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Ps,r._mainGroup=new Ne,r}return t.prototype.init=function(r,n){this._controller=new xh(n.getZr()),this.group.add(this._mainGroup),this._firstRender=!0},t.prototype.render=function(r,n,a){var i=r.getGraph(),o=this._mainGroup,s=r.layoutInfo,l=s.width,u=s.height,c=r.getData(),h=r.getData("edge"),d=r.get("orient");o.removeAll(),o.x=s.x,o.y=s.y,this._updateViewCoordSys(r,a),lw(r,a,this._controller,UW(o),null),i.eachEdge(function(v){var g=new rge,m=Ee(g);m.dataIndex=v.dataIndex,m.seriesIndex=r.seriesIndex,m.dataType="edge";var y=v.getModel(),x=y.getModel("lineStyle"),_=x.get("curveness"),w=v.node1.getLayout(),S=v.node1.getModel(),C=S.get("localX"),M=S.get("localY"),A=v.node2.getLayout(),I=v.node2.getModel(),k=I.get("localX"),P=I.get("localY"),D=v.getLayout(),z,E,B,H,V,U,F,Z;g.shape.extent=Math.max(1,D.dy),g.shape.orient=d,d==="vertical"?(z=(C!=null?C*l:w.x)+D.sy,E=(M!=null?M*u:w.y)+w.dy,B=(k!=null?k*l:A.x)+D.ty,H=P!=null?P*u:A.y,V=z,U=E*(1-_)+H*_,F=B,Z=E*_+H*(1-_)):(z=(C!=null?C*l:w.x)+w.dx,E=(M!=null?M*u:w.y)+D.sy,B=k!=null?k*l:A.x,H=(P!=null?P*u:A.y)+D.ty,V=z*(1-_)+B*_,U=E,F=z*_+B*(1-_),Z=H),g.setShape({x1:z,y1:E,x2:B,y2:H,cpx1:V,cpy1:U,cpx2:F,cpy2:Z}),g.useStyle(x.getItemStyle()),J3(g.style,d,v);var $=""+y.get("value"),W=Dr(y,"edgeLabel");Hr(g,W,{labelFetcher:{getFormattedLabel:function(Q,se,ce,Ue,ye,me){return r.getFormattedLabel(Q,se,"edge",Ue,ia(ye,W.normal&&W.normal.get("formatter"),$),me)}},labelDataIndex:v.dataIndex,defaultText:$}),g.setTextConfig({position:"inside"});var q=y.getModel("emphasis");Pr(g,y,"lineStyle",function(Q){var se=Q.getItemStyle();return J3(se,d,v),se}),o.add(g),h.setItemGraphicEl(v.dataIndex,g);var re=q.get("focus");Yt(g,re==="adjacency"?v.getAdjacentDataIndices():re==="trajectory"?v.getTrajectoryDataIndices():re,q.get("blurScope"),q.get("disabled"))}),i.eachNode(function(v){var g=v.getLayout(),m=v.getModel(),y=m.get("localX"),x=m.get("localY"),_=m.getModel("emphasis"),w=m.get(["itemStyle","borderRadius"])||0,S=new Ke({shape:{x:y!=null?y*l:g.x,y:x!=null?x*u:g.y,width:g.dx,height:g.dy,r:w},style:m.getModel("itemStyle").getItemStyle(),z2:10});Hr(S,Dr(m),{labelFetcher:{getFormattedLabel:function(M,A){return r.getFormattedLabel(M,A,"node")}},labelDataIndex:v.dataIndex,defaultText:v.id}),S.disableLabelAnimation=!0,S.setStyle("fill",v.getVisual("color")),S.setStyle("decal",v.getVisual("style").decal),Pr(S,m),o.add(S),c.setItemGraphicEl(v.dataIndex,S),Ee(S).dataType="node";var C=_.get("focus");Yt(S,C==="adjacency"?v.getAdjacentDataIndices():C==="trajectory"?v.getTrajectoryDataIndices():C,_.get("blurScope"),_.get("disabled"))}),c.eachItemGraphicEl(function(v,g){var m=c.getItemModel(g);m.get("draggable")&&(v.drift=function(y,x){this.shape.x+=y,this.shape.y+=x,this.dirty(),a.dispatchAction({type:"dragNode",seriesId:r.id,dataIndex:c.getRawIndex(g),localX:this.shape.x/l,localY:this.shape.y/u})},v.draggable=!0,v.cursor="move")}),!this._data&&r.isAnimationEnabled()&&o.setClipPath(age(o.getBoundingRect(),r,function(){o.removeClipPath()})),this._data=r.getData(),this._firstRender=!1},t.prototype.__updateOnOwnRoam=function(r,n,a){Hl(this.group,Ro,n.coordinateSystem,null)},t.prototype.dispose=function(){this._controller&&this._controller.dispose()},t.prototype._updateViewCoordSys=function(r,n){var a=r.layoutInfo,i=r.coordinateSystem=bI(r,n,a.x,a.y,a.width,a.height);Hl(this.group,Ro,i,this._firstRender?null:r)},t.type=Ps,t}(At);function J3(e,t,r){switch(e.fill){case"source":e.fill=r.node1.getVisual("color"),e.decal=r.node1.getVisual("style").decal;break;case"target":e.fill=r.node2.getVisual("color"),e.decal=r.node2.getVisual("style").decal;break;case"gradient":var n=r.node1.getVisual("color"),a=r.node2.getVisual("color");ue(n)&&ue(a)&&(e.fill=new hh(0,0,+(t==="horizontal"),+(t==="vertical"),[{color:n,offset:0},{color:a,offset:1}]))}}function age(e,t,r){var n=new Ke({shape:{x:e.x-10,y:e.y-10,width:0,height:e.height+20}});return Ut(n,{shape:{width:e.width+20}},t,r),n}var ige=Er(Ps,oge);function oge(e,t){e.eachSeriesByType(Ps,function(r){var n=r.get("nodeWidth"),a=r.get("nodeGap"),i=jr(r,t).refContainer,o=Zt(r.getBoxLayoutParams(),i);r.layoutInfo=o;var s=o.width,l=o.height,u=r.getGraph(),c=u.nodes,h=u.edges;lge(c);var d=wt(c,function(y){return y.getLayout().value===0}),v=d.length!==0?0:r.get("layoutIterations"),g=r.get("orient"),m=r.get("nodeAlign");sge(c,h,n,a,s,l,v,g,m)})}function sge(e,t,r,n,a,i,o,s,l){uge(e,t,r,a,i,s,l),dge(e,t,i,a,n,o,s),wge(e,s)}function lge(e){j(e,function(t){var r=jl(t.outEdges,Lb),n=jl(t.inEdges,Lb),a=t.getValue()||0,i=Math.max(r,n,a);t.setLayout({value:i},!0)})}function uge(e,t,r,n,a,i,o){for(var s=[],l=[],u=[],c=[],h=0,d=0;d=0;x&&y.depth>v&&(v=y.depth),m.setLayout({depth:x?y.depth:h},!0),i==="vertical"?m.setLayout({dy:r},!0):m.setLayout({dx:r},!0);for(var _=0;_h-1?v:h-1;o&&o!=="left"&&cge(e,o,i,A);var I=i==="vertical"?(a-r)/A:(n-r)/A;fge(e,I,i)}function F9(e){var t=e.hostGraph.data.getRawDataItem(e.dataIndex);return t.depth!=null&&t.depth>=0}function cge(e,t,r,n){if(t==="right"){for(var a=[],i=e,o=0;i.length;){for(var s=0;s0;i--)l*=.99,gge(s,l,o),cT(s,a,r,n,o),bge(s,l,o),cT(s,a,r,n,o)}function vge(e,t){var r=[],n=t==="vertical"?"y":"x",a=SM(e,function(i){return i.getLayout()[n]});return qr(a.keys),j(a.keys,function(i){r.push(a.buckets.get(i))}),r}function pge(e,t,r,n,a,i){var o=1/0;j(e,function(s){var l=s.length,u=0;j(s,function(h){u+=h.getLayout().value});var c=i==="vertical"?(n-(l-1)*a)/u:(r-(l-1)*a)/u;c0&&(s=l.getLayout()[i]+u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[i]+l.getLayout()[d]+t;var g=a==="vertical"?n:r;if(u=c-t-g,u>0){s=l.getLayout()[i]-u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0),c=s;for(var v=h-2;v>=0;--v)l=o[v],u=l.getLayout()[i]+l.getLayout()[d]+t-c,u>0&&(s=l.getLayout()[i]-u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[i]}})}function gge(e,t,r){j(e.slice().reverse(),function(n){j(n,function(a){if(a.outEdges.length){var i=jl(a.outEdges,mge,r)/jl(a.outEdges,Lb);if(isNaN(i)){var o=a.outEdges.length;i=o?jl(a.outEdges,yge,r)/o:0}if(r==="vertical"){var s=a.getLayout().x+(i-Wl(a,r))*t;a.setLayout({x:s},!0)}else{var l=a.getLayout().y+(i-Wl(a,r))*t;a.setLayout({y:l},!0)}}})})}function mge(e,t){return Wl(e.node2,t)*e.getValue()}function yge(e,t){return Wl(e.node2,t)}function xge(e,t){return Wl(e.node1,t)*e.getValue()}function _ge(e,t){return Wl(e.node1,t)}function Wl(e,t){return t==="vertical"?e.getLayout().x+e.getLayout().dx/2:e.getLayout().y+e.getLayout().dy/2}function Lb(e){return e.getValue()}function jl(e,t,r){for(var n=0,a=e.length,i=-1;++io&&(o=l)}),j(n,function(s){var l=new Gr({type:"color",mappingMethod:"linear",dataExtent:[i,o],visual:t.get("color")}),u=l.mapValueToVisual(s.getLayout().value),c=s.getModel().get(["itemStyle","color"]);c!=null?(s.setVisual("color",c),s.setVisual("style",{fill:c})):(s.setVisual("color",u),s.setVisual("style",{fill:u}))})}a.length&&j(a,function(s){var l=s.getModel().get("lineStyle");s.setVisual("style",l)})})}function Tge(e){e.registerChartView(nge),e.registerSeriesModel(ege),e.registerLayout(ige),e.registerVisual(Sge),e.registerAction({type:"dragNode",event:"dragnode",update:"update"},function(t,r){r.eachComponent({mainType:Do,subType:Ps,query:t},function(n){n.setNodePosition(t.dataIndex,[t.localX,t.localY])})}),_I(e,Do,Ps)}var V9=function(){function e(){}return e.prototype._hasEncodeRule=function(t){var r=this.getEncode();return r&&r.get(t)!=null},e.prototype.getInitialData=function(t,r){var n,a=r.getComponent("xAxis",this.get("xAxisIndex")),i=r.getComponent("yAxis",this.get("yAxisIndex")),o=a.get("type"),s=i.get("type"),l,u=t.layout;o==="category"?(u="horizontal",n=a.getOrdinalMeta(),l=!this._hasEncodeRule("x")):s==="category"&&(u="vertical",n=i.getOrdinalMeta(),l=!this._hasEncodeRule("y")),u||(u=s==="time"?"vertical":"horizontal"),this._layout=u;var c=["x","y"],h=u==="horizontal"?0:1,d=this._baseAxisDim=c[h],v=c[1-h],g=[a,i],m=g[h].get("type"),y=g[1-h].get("type"),x=t.data;if(x&&l){var _=[];j(x,function(C,M){var A;ne(C)?(A=C.slice(),C.unshift(M)):ne(C.value)?(A=te({},C),A.value=A.value.slice(),C.value.unshift(M)):A=C,_.push(A)}),t.data=_}var w=this.defaultValueDimensions,S=[{name:d,type:ib(m),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:v,type:ib(y),dimsDef:w.slice()}];return iv(this,{coordDimensions:S,dimensionsCount:w.length+1,encodeDefaulter:Xe(g7,S,this)})},e.prototype.getBaseAxis=function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis},e.prototype.getWhiskerBoxesLayout=function(){return this._layout},e}();function Ib(e,t){for(var r=t.ends.length,n=0,a=0;am){var S=[x,w];n.push(S)}}}return{boxData:r,outliers:n}}var Oge={type:"echarts:boxplot",transform:function(t){var r=t.upstream;if(r.sourceFormat!==Qr){var n="";bt(n)}var a=Rge(r.getRawData(),t.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:a.boxData},{data:a.outliers}]}};function zge(e){e.registerSeriesModel(G9),e.registerChartView(Mge),e.registerLayout(Ige),e.registerTransform(Oge),jge(e)}var Zl="candlestick",U9=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.defaultValueDimensions=[{name:"open",defaultTooltip:!0},{name:"close",defaultTooltip:!0},{name:"lowest",defaultTooltip:!0},{name:"highest",defaultTooltip:!0}],r}return t.prototype.getShadowDim=function(){return"open"},t.prototype.brushSelector=function(r,n,a){var i=n.getItemLayout(r);return i&&a.rect(i.brushRect)},t.type="series."+Zl,t.dependencies=["xAxis","yAxis","grid"],t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,clip:!0,itemStyle:{color:"#eb5454",color0:"#47b262",borderColor:"#eb5454",borderColor0:"#47b262",borderColorDoji:null,borderWidth:1},emphasis:{itemStyle:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,large:!0,largeThreshold:600,progressive:3e3,progressiveThreshold:1e4,progressiveChunkMode:"mod",animationEasing:"linear",animationDuration:300},t}(Pt);br(U9,V9,!0);var Bge=["itemStyle","borderColor"],Fge=["itemStyle","borderColor0"],Vge=["itemStyle","borderColorDoji"],Gge=["itemStyle","color"],Hge=["itemStyle","color0"];function VI(e,t){return t.get(e>0?Gge:Hge)}function GI(e,t){return t.get(e===0?Vge:e>0?Bge:Fge)}var Uge={seriesType:Zl,plan:ph(),performRawSeries:!0,reset:function(e,t){if(!t.isSeriesFiltered(e)){var r=e.pipelineContext.large;return!r&&{progress:function(n,a){for(var i;(i=n.next())!=null;){var o=a.getItemModel(i),s=a.getItemLayout(i).sign,l=o.getItemStyle();l.fill=VI(s,o),l.stroke=GI(s,o)||l.fill;var u=a.ensureUniqueItemVisual(i,"style");te(u,l)}}}}}},Wge=["color","borderColor"],Zge=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(r),this._isLargeDraw?this._renderLarge(r):this._renderNormal(r)},t.prototype.incrementalPrepareRender=function(r,n,a){this._clear(),this._updateDrawMode(r)},t.prototype.incrementalRender=function(r,n,a,i){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(r,n):this._incrementalRenderNormal(r,n)},t.prototype.eachRendered=function(r){au(this._progressiveEls||this.group,r)},t.prototype._updateDrawMode=function(r){var n=r.pipelineContext.large;(this._isLargeDraw==null||n!==this._isLargeDraw)&&(this._isLargeDraw=n,this._clear())},t.prototype._renderNormal=function(r){var n=r.getData(),a=this._data,i=this.group,o=n.getLayout("isSimpleBox"),s=r.get("clip",!0),l=r.coordinateSystem,u=l.getArea&&l.getArea(),c=s&&Wc(l,!1,r);this._data||i.removeAll();var h=ez(r);n.diff(a).add(function(d){if(n.hasValue(d)){var v=n.getItemLayout(d),g=s?Ib(u,v):Qg;if(g===tm)return;var m=hT(v,d,h,!0);Ut(m,{shape:{points:v.ends}},r,d),Df(g===em,m,c),fT(m,n,d,o),i.add(m),n.setItemGraphicEl(d,m)}}).update(function(d,v){var g=a.getItemGraphicEl(v);if(!n.hasValue(d)){i.remove(g);return}var m=n.getItemLayout(d),y=s?Ib(u,m):Qg;if(y===tm){i.remove(g);return}g?(mt(g,{shape:{points:m.ends}},r,d),ii(g)):g=hT(m,d,h),fT(g,n,d,o),Df(y===em,g,c),i.add(g),n.setItemGraphicEl(d,g)}).remove(function(d){var v=a.getItemGraphicEl(d);v&&i.remove(v)}).execute(),this._data=n},t.prototype._renderLarge=function(r){this._clear(),tz(r,this.group);var n=r.get("clip",!0)?Wc(r.coordinateSystem,!1,r):null;Df(!!n,this.group,n)},t.prototype._incrementalRenderNormal=function(r,n){for(var a=n.getData(),i=a.getLayout("isSimpleBox"),o=ez(n),s;(s=r.next())!=null;){var l=a.getItemLayout(s),u=hT(l,s,o);fT(u,a,s,i),u.incremental=_o(n),this.group.add(u),this._progressiveEls.push(u)}},t.prototype._incrementalRenderLarge=function(r,n){tz(n,this.group,this._progressiveEls,!0)},t.prototype.remove=function(r){this._clear()},t.prototype._clear=function(){this.group.removeAll(),Df(!1,this.group,null),this._data=null},t.type=Zl,t}(At),$ge=function(){function e(){}return e}(),Yge=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="normalCandlestickBox",n}return t.prototype.getDefaultShape=function(){return new $ge},t.prototype.buildPath=function(r,n){var a=n.points;this.__simpleBox?(r.moveTo(a[4][0],a[4][1]),r.lineTo(a[6][0],a[6][1])):(r.moveTo(a[0][0],a[0][1]),r.lineTo(a[1][0],a[1][1]),r.lineTo(a[2][0],a[2][1]),r.lineTo(a[3][0],a[3][1]),r.closePath(),r.moveTo(a[4][0],a[4][1]),r.lineTo(a[5][0],a[5][1]),r.moveTo(a[6][0],a[6][1]),r.lineTo(a[7][0],a[7][1]))},t}(rt);function hT(e,t,r,n){var a=e.ends;return new Yge({shape:{points:n?Xge(a,r,e):a},z2:100})}function fT(e,t,r,n){var a=t.getItemModel(r);e.useStyle(t.getItemVisual(r,"style")),e.style.strokeNoScale=!0;var i=a.getShallow("cursor");i&&e.attr("cursor",i),e.__simpleBox=n,Pr(e,a);var o=t.getItemLayout(r).sign;j(e.states,function(l,u){var c=a.getModel(u),h=VI(o,c),d=GI(o,c)||h,v=l.style||(l.style={});h&&(v.fill=h),d&&(v.stroke=d)});var s=a.getModel("emphasis");Yt(e,s.get("focus"),s.get("blurScope"),s.get("disabled"))}function Xge(e,t,r){return oe(e,function(n){return n=n.slice(),n[t]=r.initBaseline,n})}function ez(e){return e.getWhiskerBoxesLayout()==="horizontal"?1:0}var qge=function(){function e(){}return e}(),dT=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="largeCandlestickBox",n}return t.prototype.getDefaultShape=function(){return new qge},t.prototype.buildPath=function(r,n){for(var a=n.points,i=0;iC?D[i]:P[i],ends:B,brushRect:Z(M,A,w)})}function U(W,q){var re=[];return re[a]=q,re[i]=W,isNaN(q)||isNaN(W)?[NaN,NaN]:t.dataToPoint(re)}function F(W,q,re){var Q=q.slice(),se=q.slice();Q[a]=Bx(Q[a]+n/2,1,!1),se[a]=Bx(se[a]-n/2,1,!0),re?W.push(Q,se):W.push(se,Q)}function Z(W,q,re){var Q=U(W,re),se=U(q,re);return Q[a]-=n/2,se[a]-=n/2,{x:Q[0],y:Q[1],width:i?n:se[0]-Q[0],height:i?se[1]-Q[1]:n}}function $(W){return W[a]=Bx(W[a],1),W}}function g(m,y){for(var x=co(m.count*4),_=0,w,S=[],C=[],M,A=y.getStore(),I=!!e.get(["itemStyle","borderColorDoji"]);(M=m.next())!=null;){var k=A.get(s,M),P=A.get(u,M),D=A.get(c,M),z=A.get(h,M),E=A.get(d,M);if(isNaN(k)||isNaN(z)||isNaN(E)){x[_++]=NaN,_+=3;continue}x[_++]=rz(A,M,P,D,c,I),S[a]=k,S[i]=z,w=t.dataToPoint(S,null,C),x[_++]=w?w[0]:NaN,x[_++]=w?w[1]:NaN,S[i]=E,w=t.dataToPoint(S,null,C),x[_++]=w?w[1]:NaN}y.setLayout("largePoints",x)}}};function rz(e,t,r,n,a,i){var o;return r>n?o=-1:r0?e.get(a,t-1)<=n?1:-1:1,o}function eme(e,t){var r=e.getBaseAxis(),n=pn(r,{fromStat:{key:bc(Zl)},min:1}).w,a=fe(_e(e.get("barMaxWidth"),n),n),i=fe(_e(e.get("barMinWidth"),1),n),o=e.get("barWidth");return o!=null?fe(o,n):qe(Mt(n/2,a),i)}function tme(e){Jge(e,function(){var t=bc(Zl);KL(e,{key:t,seriesType:Zl,getMetrics:hI}),J1(t,rw(t))})}function rme(e){e.registerChartView(Zge),e.registerSeriesModel(U9),e.registerPreprocessor(Kge),e.registerVisual(Uge),e.registerLayout(Qge),tme(e)}function nz(e,t){var r=t.rippleEffectColor||t.color;e.eachChild(function(n){n.attr({z:t.z,zlevel:t.zlevel,style:{stroke:t.brushType==="stroke"?r:null,fill:t.brushType==="fill"?r:null}})})}var nme=function(e){X(t,e);function t(r,n){var a=e.call(this)||this,i=new Hm(r,n),o=new Ne;return a.add(i),a.add(o),a.updateData(r,n),a}return t.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},t.prototype.startEffectAnimation=function(r){for(var n=r.symbolType,a=r.color,i=r.rippleNumber,o=this.childAt(1),s=0;s0&&(s=this._getLineLength(i)/c*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){i.stopAnimation();var d=void 0;Me(h)?d=h(a):d=h,i.__t>0&&(d=-s*i.__t),this._animateSymbol(i,s,d,l,u)}this._period=s,this._loop=l,this._roundTrip=u}},t.prototype._animateSymbol=function(r,n,a,i,o){if(n>0){r.__t=0;var s=this,l=r.animate("",i).when(o?n*2:n,{__t:o?2:1}).delay(a).during(function(){s._updateSymbolPosition(r)});i||l.done(function(){s.remove(r)}),l.start()}},t.prototype._getLineLength=function(r){return os(r.__p1,r.__cp1)+os(r.__cp1,r.__p2)},t.prototype._updateAnimationPoints=function(r,n){r.__p1=n[0],r.__p2=n[1],r.__cp1=n[2]||[(n[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2]},t.prototype.updateData=function(r,n,a){this.childAt(0).updateData(r,n,a),this._updateEffectSymbol(r,n)},t.prototype._updateSymbolPosition=function(r){var n=r.__p1,a=r.__p2,i=r.__cp1,o=r.__t<=1?r.__t:2-r.__t,s=[r.x,r.y],l=s.slice(),u=Xr,c=lM;s[0]=u(n[0],i[0],a[0],o),s[1]=u(n[1],i[1],a[1],o);var h=r.__t<=1?c(n[0],i[0],a[0],o):c(a[0],i[0],n[0],1-o),d=r.__t<=1?c(n[1],i[1],a[1],o):c(a[1],i[1],n[1],1-o);r.rotation=-Math.atan2(d,h)-Math.PI/2,(this._symbolType==="line"||this._symbolType==="rect"||this._symbolType==="roundRect")&&(r.__lastT!==void 0&&r.__lastT=0&&!(i[l]<=n);l--);l=Math.min(l,o-2)}else{for(l=s;ln);l++);l=Math.min(l-1,o-2)}var c=(n-i[l])/(i[l+1]-i[l]),h=a[l],d=a[l+1];r.x=h[0]*(1-c)+c*d[0],r.y=h[1]*(1-c)+c*d[1];var v=r.__t<=1?d[0]-h[0]:h[0]-d[0],g=r.__t<=1?d[1]-h[1]:h[1]-d[1];r.rotation=-Math.atan2(g,v)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=n,r.ignore=!1}},t}(W9),lme=function(){function e(){this.polyline=!1,this.curveness=0,this.segs=[]}return e}(),ume=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.beforeBrush=function(r){r&&!r.contentRetained&&this.reset()},t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new lme},t.prototype.buildPath=function(r,n){var a=n.segs,i=n.curveness,o;if(n.polyline)for(o=this._off;o0){r.moveTo(a[o++],a[o++]);for(var l=1;l0){var v=(u+h)/2-(c-d)*i,g=(c+d)/2-(h-u)*i;r.quadraticCurveTo(v,g,h,d)}else r.lineTo(h,d)}this.incremental&&(this._off=o,this.notClear=!0)},t.prototype.findDataIndex=function(r,n){var a=this.shape,i=a.segs,o=a.curveness,s=this.style.lineWidth;if(a.polyline)for(var l=0,u=0;u0)for(var h=i[u++],d=i[u++],v=1;v0){var y=(h+g)/2-(d-m)*o,x=(d+m)/2-(g-h)*o;if(QG(h,d,y,x,g,m,s,r,n))return l}else if(al(h,d,g,m,s,r,n))return l;l++}return-1},t.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();if(r=a[0],n=a[1],i.contain(r,n)){var o=this.hoverDataIdx=this.findDataIndex(r,n);return o>=0}return this.hoverDataIdx=-1,!1},t.prototype.getBoundingRect=function(){var r=this._rect;if(!r){for(var n=this.shape,a=n.segs,i=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u0&&(o.dataIndex=l+t.__startIndex)})},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),$9={seriesType:"lines",plan:ph(),reset:function(e){var t=e.coordinateSystem;if(t){var r=e.get("polyline"),n=e.pipelineContext.large;return{progress:function(a,i){var o=[];if(n){var s=void 0,l=a.end-a.start;if(r){for(var u=0,c=a.start;c0&&c&&u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)}),o.updateData(i);var h=r.get("clip",!0)&&Wc(r.coordinateSystem,!1,r);h?this.group.setClipPath(h):this.group.removeClipPath(),this._lastZlevel=s,this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,a){var i=r.getData(),o=this._updateLineDraw(i,r);o.incrementalPrepareUpdate(i),this._clearLayer(a),this._finished=!1},t.prototype.incrementalRender=function(r,n,a){this._lineDraw.incrementalUpdate(r,n.getData(),_o(n)),this._finished=r.end===n.getData().count()},t.prototype.eachRendered=function(r){this._lineDraw&&this._lineDraw.eachRendered(r)},t.prototype.updateTransform=function(r,n,a){var i=r.getData(),o=this._lineDraw;if(!this._finished||!o||!o.updateLayout)return{update:!0};var s=$9.reset(r,n,a);s.progress&&s.progress({start:0,end:i.count(),count:i.count()},i),o.updateLayout(),this._clearLayer(a)},t.prototype._updateLineDraw=function(r,n){var a=this._lineDraw,i=this._showEffect(n),o=!!n.get("polyline"),s=n.pipelineContext,l=s.large;return(!a||i!==this._hasEffet||o!==this._isPolyline||l!==this._isLargeDraw)&&(a&&a.remove(),a=this._lineDraw=l?new cme:new DI(o?i?sme:Z9:i?W9:PI),this._hasEffet=i,this._isPolyline=o,this._isLargeDraw=l),this.group.add(a.group),a},t.prototype._showEffect=function(r){return!!r.get(["effect","show"])},t.prototype._clearLayer=function(r){var n=zM(r);n&&this._lastZlevel!=null&&n.getLayer(this._lastZlevel).clear(!0)},t.prototype.remove=function(r,n){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(n)},t.prototype.dispose=function(r,n){this.remove(r,n)},t.type="lines",t}(At),fme=typeof Uint32Array>"u"?Array:Uint32Array,dme=typeof Float64Array>"u"?Array:Float64Array;function iz(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=oe(t,function(r){var n=[r[0].coord,r[1].coord],a={coords:n};return r[0].name&&(a.fromName=r[0].name),r[1].name&&(a.toName=r[1].name),x1([a,r[0],r[1]])}))}var vme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.visualStyleAccessPath="lineStyle",r.visualDrawType="stroke",r}return t.prototype.init=function(r){r.data=r.data||[],iz(r);var n=this._processFlatCoordsArray(r.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(r.data=new Float32Array(n.count)),e.prototype.init.apply(this,arguments)},t.prototype.mergeOption=function(r){if(iz(r),r.data){var n=this._processFlatCoordsArray(r.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(r.data=new Float32Array(n.count))}e.prototype.mergeOption.apply(this,arguments)},t.prototype.appendData=function(r){var n=this._processFlatCoordsArray(r.data);n.flatCoords&&(this._flatCoords?(this._flatCoords=ld(this._flatCoords,n.flatCoords),this._flatCoordsOffset=ld(this._flatCoordsOffset,n.flatCoordsOffset)):(this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset),r.data=new Float32Array(n.count)),this.getRawData().appendData(r.data)},t.prototype._getCoordsFromItemModel=function(r){var n=this.getData().getItemModel(r),a=n.option instanceof Array?n.option:n.getShallow("coords");return a},t.prototype.getLineCoordsCount=function(r){return this._flatCoordsOffset?this._flatCoordsOffset[r*2+1]:this._getCoordsFromItemModel(r).length},t.prototype.getLineCoords=function(r,n){if(this._flatCoordsOffset){for(var a=this._flatCoordsOffset[r*2],i=this._flatCoordsOffset[r*2+1],o=0;o ")}return Mr("nameValue",{name:l,value:o,noValue:o==null||isNaN(o)})},t.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},t.prototype.getProgressive=function(){var r=this.option.progressive;return r??(this.option.large?1e4:this.get("progressive"))},t.prototype.getProgressiveThreshold=function(){var r=this.option.progressiveThreshold;return r??(this.option.large?2e4:this.get("progressiveThreshold"))},t.prototype.getZLevelKey=function(){var r=this.getModel("effect"),n=r.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:r.get("show")&&n>0?n+"":""},t.type="series.lines",t.dependencies=["grid","polar","geo","calendar"],t.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},t}(Pt);function $0(e){return e instanceof Array||(e=[e,e]),e}var pme={seriesType:"lines",reset:function(e){var t=$0(e.get("symbol")),r=$0(e.get("symbolSize")),n=e.getData();n.setVisual("fromSymbol",t&&t[0]),n.setVisual("toSymbol",t&&t[1]),n.setVisual("fromSymbolSize",r&&r[0]),n.setVisual("toSymbolSize",r&&r[1]);function a(i,o){var s=i.getItemModel(o),l=$0(s.getShallow("symbol",!0)),u=$0(s.getShallow("symbolSize",!0));l[0]&&i.setItemVisual(o,"fromSymbol",l[0]),l[1]&&i.setItemVisual(o,"toSymbol",l[1]),u[0]&&i.setItemVisual(o,"fromSymbolSize",u[0]),u[1]&&i.setItemVisual(o,"toSymbolSize",u[1])}return{dataEach:n.hasItemOption?a:null}}};function gme(e){e.registerChartView(hme),e.registerSeriesModel(vme),e.registerLayout($9),e.registerVisual(pme)}var mme=256,yme=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var t=Vr.createCanvas();this.canvas=t}return e.prototype.update=function(t,r,n,a,i,o){var s=this._getBrush(),l=this._getGradient(i,"inRange"),u=this._getGradient(i,"outOfRange"),c=this.pointSize+this.blurSize,h=this.canvas,d=h.getContext("2d"),v=t.length;h.width=r,h.height=n;for(var g=0;g0){var z=o(w)?l:u;w>0&&(w=w*P+I),C[M++]=z[D],C[M++]=z[D+1],C[M++]=z[D+2],C[M++]=z[D+3]*w*256}else M+=4}return d.putImageData(S,0,0),h},e.prototype._getBrush=function(){var t=this._brushCanvas||(this._brushCanvas=Vr.createCanvas()),r=this.pointSize+this.blurSize,n=r*2;t.width=n,t.height=n;var a=t.getContext("2d");return a.clearRect(0,0,n,n),a.shadowOffsetX=n,a.shadowBlur=this.blurSize,a.shadowColor=K.color.neutral99,a.beginPath(),a.arc(-r,r,this.pointSize,0,Math.PI*2,!0),a.closePath(),a.fill(),t},e.prototype._getGradient=function(t,r){for(var n=this._gradientPixels,a=n[r]||(n[r]=new Uint8ClampedArray(256*4)),i=[0,0,0,0],o=0,s=0;s<256;s++)t[r](s/255,!0,i),a[o++]=i[0],a[o++]=i[1],a[o++]=i[2],a[o++]=i[3];return a},e}();function xme(e,t,r){var n=e[1]-e[0];t=oe(t,function(o){return{interval:[(o.interval[0]-e[0])/n,(o.interval[1]-e[0])/n]}});var a=t.length,i=0;return function(o){var s;for(s=i;s=0;s--){var l=t[s].interval;if(l[0]<=o&&o<=l[1]){i=s;break}}return s>=0&&s=t[0]&&n<=t[1]}}var bme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){var i;n.eachComponent("visualMap",function(s){s.eachTargetSeries(function(l){l===r&&(i=s)})}),this._progressiveEls=null,this.group.removeAll();var o=r.coordinateSystem;o.type==="cartesian2d"||o.type==="calendar"||o.type==="matrix"?this._renderOnGridLike(r,a,0,r.getData().count()):o5(o)&&this._renderOnGeo(o,r,i,a)},t.prototype.incrementalPrepareRender=function(r,n,a){this.group.removeAll()},t.prototype.incrementalRender=function(r,n,a,i){var o=n.coordinateSystem;o&&(o5(o)?this.render(n,a,i):(this._progressiveEls=[],this._renderOnGridLike(n,i,r.start,r.end,!0)))},t.prototype.eachRendered=function(r){au(this._progressiveEls||this.group,r)},t.prototype._renderOnGridLike=function(r,n,a,i,o){var s=r.coordinateSystem,l=Zc(s,"cartesian2d"),u=Zc(s,"matrix"),c,h,d,v;if(l){var g=s.getAxis("x"),m=s.getAxis("y");c=pn(g).w+.5,h=pn(m).w+.5,d=g.scale.getExtent(),v=m.scale.getExtent()}for(var y=this.group,x=r.getData(),_=r.getModel(["emphasis","itemStyle"]).getItemStyle(),w=r.getModel(["blur","itemStyle"]).getItemStyle(),S=r.getModel(["select","itemStyle"]).getItemStyle(),C=r.get(["itemStyle","borderRadius"]),M=Dr(r),A=r.getModel("emphasis"),I=A.get("focus"),k=A.get("blurScope"),P=A.get("disabled"),D=l||u?[x.mapDimension("x"),x.mapDimension("y"),x.mapDimension("value")]:[x.mapDimension("time"),x.mapDimension("value")],z=a;zd[1]||Vv[1])continue;var U=s.dataToPoint([H,V]);E=new Ke({shape:{x:U[0]-c/2,y:U[1]-h/2,width:c,height:h},style:B})}else if(u){var F=s.dataToLayout([x.get(D[0],z),x.get(D[1],z)]).rect;if(un(F.x))continue;E=new Ke({z2:1,shape:F,style:B})}else{if(isNaN(x.get(D[1],z)))continue;var Z=s.dataToLayout([x.get(D[0],z)]),F=Z.contentRect||Z.rect;if(un(F.x)||un(F.y))continue;E=new Ke({z2:1,shape:F,style:B})}if(x.hasItemOption){var $=x.getItemModel(z),W=$.getModel("emphasis");_=W.getModel("itemStyle").getItemStyle(),w=$.getModel(["blur","itemStyle"]).getItemStyle(),S=$.getModel(["select","itemStyle"]).getItemStyle(),C=$.get(["itemStyle","borderRadius"]),I=W.get("focus"),k=W.get("blurScope"),P=W.get("disabled"),M=Dr($)}E.shape.r=C;var q=r.getRawValue(z),re="-";q&&q[2]!=null&&(re=q[2]+""),Hr(E,M,{labelFetcher:r,labelDataIndex:z,defaultOpacity:B.opacity,defaultText:re}),E.ensureState("emphasis").style=_,E.ensureState("blur").style=w,E.ensureState("select").style=S,Yt(E,I,k,P),E.incremental=_o(r,o),o&&(E.states.emphasis.hoverLayer=Zd),y.add(E),x.setItemGraphicEl(z,E),this._progressiveEls&&this._progressiveEls.push(E)}},t.prototype._renderOnGeo=function(r,n,a,i){var o=a.targetVisuals.inRange,s=a.targetVisuals.outOfRange,l=n.getData(),u=this._hmLayer||this._hmLayer||new yme;u.blurSize=n.get("blurSize"),u.pointSize=n.get("pointSize"),u.minOpacity=n.get("minOpacity"),u.maxOpacity=n.get("maxOpacity");var c=r.getViewRect().clone(),h=r.getRoamTransform();c.applyTransform(h);var d=Math.max(c.x,0),v=Math.max(c.y,0),g=Math.min(c.width+c.x,i.getWidth()),m=Math.min(c.height+c.y,i.getHeight()),y=g-d,x=m-v,_=[l.mapDimension("lng"),l.mapDimension("lat"),l.mapDimension("value")],w=l.mapArray(_,function(A,I,k){var P=r.dataToPoint([A,I]);return P[0]-=d,P[1]-=v,P.push(k),P}),S=a.getExtent(),C=a.type==="visualMap.continuous"?_me(S,a.option.range):xme(S,a.getPieceList(),a.option.selected);u.update(w,y,x,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:s.color.getColorMapper()},C);var M=new Ur({style:{width:y,height:x,x:d,y:v,image:u.canvas},silent:!0});this.group.add(M)},t.type="heatmap",t}(At),wme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){return Go(null,this,{generateCoord:"value"})},t.prototype.preventIncremental=function(){var r=qd.get(this.get("coordinateSystem"));if(r&&r.dimensions)return r.dimensions[0]==="lng"&&r.dimensions[1]==="lat"},t.type="series.heatmap",t.dependencies=["grid","geo","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:K.color.primary}}},t}(Pt);function Sme(e){e.registerChartView(bme),e.registerSeriesModel(wme)}var Cme=["itemStyle","borderWidth"],oz=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],pT=new Vo,Tme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=rm,r}return t.prototype.render=function(r,n,a){var i=this.group,o=r.getData(),s=this._data,l=r.coordinateSystem,u=l.getBaseAxis(),c=u.isHorizontal(),h=l.master.getRect(),d={ecSize:{width:a.getWidth(),height:a.getHeight()},seriesModel:r,coordSys:l,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:c,valueDim:oz[+c],categoryDim:oz[1-+c]};o.diff(s).add(function(g){if(o.hasValue(g)){var m=lz(o,g),y=sz(o,g,m,d),x=uz(o,d,y);o.setItemGraphicEl(g,x),i.add(x),hz(x,d,y)}}).update(function(g,m){var y=s.getItemGraphicEl(m);if(!o.hasValue(g)){i.remove(y);return}var x=lz(o,g),_=sz(o,g,x,d),w=Q9(o,_);y&&w!==y.__pictorialShapeStr&&(i.remove(y),o.setItemGraphicEl(g,null),y=null),y?Pme(y,d,_):y=uz(o,d,_,!0),o.setItemGraphicEl(g,y),y.__pictorialSymbolMeta=_,i.add(y),hz(y,d,_)}).remove(function(g){var m=s.getItemGraphicEl(g);m&&cz(s,g,m.__pictorialSymbolMeta.animationModel,m)}).execute();var v=r.get("clip",!0)?Wc(r.coordinateSystem,!1,r):null;return v?i.setClipPath(v):i.removeClipPath(),this._data=o,this.group},t.prototype.remove=function(r,n){var a=this.group,i=this._data;r.get("animation")?i&&i.eachItemGraphicEl(function(o){cz(i,Ee(o).dataIndex,r,o)}):a.removeAll()},t.type=rm,t}(At);function sz(e,t,r,n){var a=e.getItemLayout(t),i=r.get("symbolRepeat"),o=r.get("symbolClip"),s=r.get("symbolPosition")||"start",l=r.get("symbolRotate"),u=(l||0)*Math.PI/180||0,c=r.get("symbolPatternSize")||2,h=r.isAnimationEnabled(),d={dataIndex:t,layout:a,itemModel:r,symbolType:e.getItemVisual(t,"symbol")||"circle",style:e.getItemVisual(t,"style"),symbolClip:o,symbolRepeat:i,symbolRepeatDirection:r.get("symbolRepeatDirection"),symbolPatternSize:c,rotation:u,animationModel:h?r:null,hoverScale:h&&r.get(["emphasis","scale"]),z2:r.getShallow("z",!0)||0};Mme(r,i,a,n,d),Ame(e,t,a,i,o,d.boundingLength,d.pxSign,c,n,d),Nme(r,d.symbolScale,u,n,d);var v=d.symbolSize,g=gh(r.get("symbolOffset"),v);return kme(r,v,a,i,o,g,s,d.valueLineWidth,d.boundingLength,d.repeatCutLength,n,d),d}function Mme(e,t,r,n,a){var i=n.valueDim,o=e.get("symbolBoundingData"),s=n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()),l=s.toGlobalCoord(s.dataToCoord(0)),u=1-+(r[i.wh]<=0),c;if(ne(o)){var h=[gT(s,o[0])-l,gT(s,o[1])-l];h[1]=0?1:-1:c>0?1:-1}function gT(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function Ame(e,t,r,n,a,i,o,s,l,u){var c=l.valueDim,h=l.categoryDim,d=Math.abs(r[h.wh]),v=e.getItemVisual(t,"symbolSize"),g;ne(v)?g=v.slice():v==null?g=["100%","100%"]:g=[v,v],g[h.index]=fe(g[h.index],d),g[c.index]=fe(g[c.index],n?d:Math.abs(i)),u.symbolSize=g;var m=u.symbolScale=[g[0]/s,g[1]/s];m[c.index]*=(l.isHorizontal?-1:1)*o}function Nme(e,t,r,n,a){var i=e.get(Cme)||0;i&&(pT.attr({scaleX:t[0],scaleY:t[1],rotation:r}),pT.updateTransform(),i/=pT.getLineScale(),i*=t[n.valueDim.index]),a.valueLineWidth=i||0}function kme(e,t,r,n,a,i,o,s,l,u,c,h){var d=c.categoryDim,v=c.valueDim,g=h.pxSign,m=Math.max(t[v.index]+s,0),y=m;if(n){var x=Math.abs(l),_=Mn(e.get("symbolMargin"),"15%")+"",w=!1;_.lastIndexOf("!")===_.length-1&&(w=!0,_=_.slice(0,_.length-1));var S=fe(_,t[v.index]),C=Math.max(m+S*2,0),M=w?0:S*2,A=Rk(n),I=A?n:fz((x+M)/C),k=x-I*m;S=k/2/(w?I:Math.max(I-1,1)),C=m+S*2,M=w?0:S*2,!A&&n!=="fixed"&&(I=u?fz((Math.abs(u)+M)/C):0),y=I*C-M,h.repeatTimes=I,h.symbolMargin=S}var P=g*(y/2),D=h.pathPosition=[];D[d.index]=r[d.wh]/2,D[v.index]=o==="start"?P:o==="end"?l-P:l/2,i&&(D[0]+=i[0],D[1]+=i[1]);var z=h.bundlePosition=[];z[d.index]=r[d.xy],z[v.index]=r[v.xy];var E=h.barRectShape=te({},r);E[v.wh]=g*Math.max(Math.abs(r[v.wh]),Math.abs(D[v.index]+P)),E[d.wh]=r[d.wh];var B=h.clipShape={};B[d.xy]=-r[d.xy],B[d.wh]=c.ecSize[d.wh],B[v.xy]=0,B[v.wh]=r[v.wh]}function Y9(e){var t=e.symbolPatternSize,r=_r(e.symbolType,-t/2,-t/2,t,t);return r.attr({culling:!0}),r.type!=="image"&&r.setStyle({strokeNoScale:!0}),r}function X9(e,t,r,n){var a=e.__pictorialBundle,i=r.symbolSize,o=r.valueLineWidth,s=r.pathPosition,l=t.valueDim,u=r.repeatTimes||0,c=0,h=i[t.valueDim.index]+o+r.symbolMargin*2;for(HI(e,function(m){m.__pictorialAnimationIndex=c,m.__pictorialRepeatTimes=u,c0:x<0)&&(_=u-1-m),y[l.index]=h*(_-u/2+.5)+s[l.index],{x:y[0],y:y[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation}}}function q9(e,t,r,n){var a=e.__pictorialBundle,i=e.__pictorialMainPath;i?Jf(i,null,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation},r,n):(i=e.__pictorialMainPath=Y9(r),a.add(i),Jf(i,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:0,scaleY:0,rotation:r.rotation},{scaleX:r.symbolScale[0],scaleY:r.symbolScale[1]},r,n))}function K9(e,t,r){var n=te({},t.barRectShape),a=e.__pictorialBarRect;a?Jf(a,null,{shape:n},t,r):(a=e.__pictorialBarRect=new Ke({z2:2,shape:n,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),a.disableMorphing=!0,e.add(a))}function J9(e,t,r,n){if(r.symbolClip){var a=e.__pictorialClipPath,i=te({},r.clipShape),o=t.valueDim,s=r.animationModel,l=r.dataIndex;if(a)mt(a,{shape:i},s,l);else{i[o.wh]=0,a=new Ke({shape:i}),e.__pictorialBundle.setClipPath(a),e.__pictorialClipPath=a;var u={};u[o.wh]=r.clipShape[o.wh],fh[n?"updateProps":"initProps"](a,{shape:u},s,l)}}}function lz(e,t){var r=e.getItemModel(t);return r.getAnimationDelayParams=Lme,r.isAnimationEnabled=Ime,r}function Lme(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function Ime(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function uz(e,t,r,n){var a=new Ne,i=new Ne;return a.add(i),a.__pictorialBundle=i,i.x=r.bundlePosition[0],i.y=r.bundlePosition[1],r.symbolRepeat?X9(a,t,r):q9(a,t,r),K9(a,r,n),J9(a,t,r,n),a.__pictorialShapeStr=Q9(e,r),a.__pictorialSymbolMeta=r,a}function Pme(e,t,r){var n=r.animationModel,a=r.dataIndex,i=e.__pictorialBundle;mt(i,{x:r.bundlePosition[0],y:r.bundlePosition[1]},n,a),r.symbolRepeat?X9(e,t,r,!0):q9(e,t,r,!0),K9(e,r,!0),J9(e,t,r,!0)}function cz(e,t,r,n){var a=n.__pictorialBarRect;a&&a.removeTextContent();var i=[];HI(n,function(o){i.push(o)}),n.__pictorialMainPath&&i.push(n.__pictorialMainPath),n.__pictorialClipPath&&(r=null),j(i,function(o){Gl(o,{scaleX:0,scaleY:0},r,t,function(){n.parent&&n.parent.remove(n)})}),e.setItemGraphicEl(t,null)}function Q9(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function HI(e,t,r){j(e.__pictorialBundle.children(),function(n){n!==e.__pictorialBarRect&&t.call(r,n)})}function Jf(e,t,r,n,a,i){t&&e.attr(t),n.symbolClip&&!a?r&&e.attr(r):r&&fh[a?"updateProps":"initProps"](e,r,n.animationModel,n.dataIndex,i)}function hz(e,t,r){var n=r.dataIndex,a=r.itemModel,i=a.getModel("emphasis"),o=i.getModel("itemStyle").getItemStyle(),s=a.getModel(["blur","itemStyle"]).getItemStyle(),l=a.getModel(["select","itemStyle"]).getItemStyle(),u=a.getShallow("cursor"),c=i.get("focus"),h=i.get("blurScope"),d=i.get("scale");HI(e,function(m){if(m instanceof Ur){var y=m.style;m.useStyle(te({image:y.image,x:y.x,y:y.y,width:y.width,height:y.height},r.style))}else m.useStyle(r.style);var x=m.ensureState("emphasis");x.style=o,d&&(x.scaleX=m.scaleX*1.1,x.scaleY=m.scaleY*1.1),m.ensureState("blur").style=s,m.ensureState("select").style=l,u&&(m.cursor=u),m.z2=r.z2});var v=t.valueDim.posDesc[+(r.boundingLength>0)],g=e.__pictorialBarRect;g.ignoreClip=!0,Hr(g,Dr(a),{labelFetcher:t.seriesModel,labelDataIndex:n,defaultText:bd(t.seriesModel.getData(),n),inheritColor:r.style.fill,defaultOpacity:r.style.opacity,defaultOutsidePosition:v}),Yt(e,c,h,i.get("disabled"))}function fz(e){var t=Math.round(e);return Math.abs(e-t)<1e-4?t:Math.ceil(e)}var Dme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r.defaultSymbol="roundRect",r}return t.prototype.getInitialData=function(r){return r.stack=null,e.prototype.getInitialData.apply(this,arguments)},t.type="series."+rm,t.dependencies=["grid"],t.defaultOption=iu(nm.defaultOption,{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",clip:!1,progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:K.color.primary}}}),t}(nm);function Eme(e){e.registerChartView(Tme),e.registerSeriesModel(Dme),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,lW(rm)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,uW(rm)),hW(e)}var mT=2,Td="themeRiver",jme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new ov(ve(this.getData,this),ve(this.getRawData,this))},t.prototype.fixData=function(r){var n=r.length,a={},i=SM(r,function(d){return a.hasOwnProperty(d[0]+"")||(a[d[0]+""]=-1),d[2]}),o=[];i.buckets.each(function(d,v){o.push({name:v,dataList:d})});for(var s=o.length,l=0;li&&(i=s),n.push(s)}for(var u=0;ui&&(i=h)}return{y0:a,max:i}}function Vme(e){e.registerChartView(Rme),e.registerSeriesModel(jme),e.registerLayout(zme),e.registerProcessor($m(Td))}var Gme=2,Hme=4,vz=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this)||this;o.z2=Gme,o.textConfig={inside:!0},Ee(o).seriesIndex=n.seriesIndex;var s=new ht({z2:Hme,silent:r.getModel().get(["label","silent"])});return o.setTextContent(s),o.updateData(!0,r,n,a,i),o}return t.prototype.updateData=function(r,n,a,i,o){this.node=n,n.piece=this,a=a||this._seriesModel,i=i||this._ecModel;var s=this;Ee(s).dataIndex=n.dataIndex;var l=n.getModel(),u=l.getModel("emphasis"),c=n.getLayout(),h=te({},c);h.label=null;var d=n.getVisual("style");d.lineJoin="bevel";var v=n.getVisual("decal");v&&(d.decal=gd(v,o));var g=ho(l.getModel("itemStyle"),h,!0);te(h,g),j(Hn,function(_){var w=s.ensureState(_),S=l.getModel([_,"itemStyle"]);w.style=S.getItemStyle();var C=ho(S,h);C&&(w.shape=C)}),r?(s.setShape(h),s.shape.r=c.r0,Ut(s,{shape:{r:c.r}},a,n.dataIndex)):(mt(s,{shape:h},a),ii(s)),s.useStyle(d),this._updateLabel(a);var m=l.getShallow("cursor");m&&s.attr("cursor",m),this._seriesModel=a||this._seriesModel,this._ecModel=i||this._ecModel;var y=u.get("focus"),x=y==="relative"?ld(n.getAncestorsIndices(),n.getDescendantIndices()):y==="ancestor"?n.getAncestorsIndices():y==="descendant"?n.getDescendantIndices():y;Yt(this,x,u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r){var n=this,a=this.node.getModel(),i=a.getModel("label"),o=this.node.getLayout(),s=o.endAngle-o.startAngle,l=(o.startAngle+o.endAngle)/2,u=Math.cos(l),c=Math.sin(l),h=this,d=h.getTextContent(),v=this.node.dataIndex,g=i.get("minAngle")/180*Math.PI,m=i.get("show")&&!(g!=null&&Math.abs(s)B&&!Pc(V-B)&&V0?(o.virtualPiece?o.virtualPiece.updateData(!1,_,r,n,a):(o.virtualPiece=new vz(_,r,n,a),c.add(o.virtualPiece)),w.piece.off("click"),o.virtualPiece.on("click",function(S){o._rootToNode(w.parentNode)})):o.virtualPiece&&(c.remove(o.virtualPiece),o.virtualPiece=null)}},t.prototype._initEvents=function(){var r=this;this.group.off("click"),this.group.on("click",function(n){var a=!1,i=r.seriesModel.getViewRoot();i.eachNode(function(o){if(!a&&o.piece&&o.piece===n.target){var s=o.getModel().get("nodeClick");if(s==="rootToNode")r._rootToNode(o);else if(s==="link"){var l=o.getModel(),u=l.get("link");if(u){var c=l.get("target",!0)||"_blank";X_(u,c)}}a=!0}})})},t.prototype._rootToNode=function(r){r!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:GA,from:this.uid,seriesId:this.seriesModel.id,targetNode:r})},t.prototype.containPoint=function(r,n){var a=n.getData(),i=a.getItemLayout(0);if(i){var o=r[0]-i.cx,s=r[1]-i.cy,l=Math.sqrt(o*o+s*s);return l<=i.r&&l>=i.r0}},t.type=eh,t}(At),Yme=Er(eh,Xme);function Xme(e){var t={};function r(n,a,i){if(n.depth===0)return K.color.neutral50;for(var o=n;o&&o.depth>1;)o=o.parentNode;var s=a.getColorFromPalette(o.name||o.dataIndex+"",t);return n.depth>1&&ue(s)&&(s=P_(s,(n.depth-1)/(i-1)*.5)),s}e.eachSeriesByType(eh,function(n){var a=n.getData(),i=a.tree;i.eachNode(function(o){var s=o.getModel(),l=s.getModel("itemStyle").getItemStyle();l.fill||(l.fill=r(o,n,i.root.height));var u=a.ensureUniqueItemVisual(o.dataIndex,"style");te(u,l)})})}var gz=Math.PI/180,qme=Er(eh,Kme);function Kme(e,t){e.eachSeriesByType(eh,function(r){var n=r.get("center"),a=r.get("radius");ne(a)||(a=[0,a]),ne(n)||(n=[n,n]);var i=t.getWidth(),o=t.getHeight(),s=Math.min(i,o),l=fe(n[0],i),u=fe(n[1],o),c=fe(a[0],s/2),h=fe(a[1],s/2),d=-r.get("startAngle")*gz,v=r.get("minAngle")*gz,g=r.getData().tree.root,m=r.getViewRoot(),y=m.depth,x=r.get("sort");x!=null&&tZ(m,x);var _=0;j(m.children,function(H){!isNaN(H.getValue())&&_++});var w=m.getValue(),S=Math.PI/(w||_)*2,C=m.depth>0,M=m.height-(C?-1:1),A=(h-c)/(M||1),I=r.get("clockwise"),k=r.get("stillShowZeroSum"),P=I?1:-1,D=function(H,V){if(H){var U=V;if(H!==g){var F=H.getValue(),Z=w===0&&k?S:F*S;Zn[1]&&n.reverse(),{coordSys:{type:"polar",cx:e.cx,cy:e.cy,r:n[1],r0:n[0]},api:{coord:function(a){var i=t.dataToRadius(a[0]),o=r.dataToAngle(a[1]),s=e.coordToPoint([i,o]);return s.push(i,o*Math.PI/180),s},size:ve(lye,e)}}}function cye(e){var t=e.getRect(),r=e.getRangeInfo();return{coordSys:{type:"calendar",x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:r.start,end:r.end,weeks:r.weeks,dayCount:r.allDay}},api:{coord:function(n,a){return e.dataToPoint(n,a)},layout:function(n,a){return e.dataToLayout(n,a)}}}}function hye(e){var t=e.getRect();return{coordSys:{type:"matrix",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(r,n){return e.dataToPoint(r,n)},layout:function(r,n){return e.dataToLayout(r,n)}}}}var rZ={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},yz=at(rZ);ti(Ts,function(e,t){return e[t]=1,e},{});Ts.join(", ");var Pb=["","style","shape","extra"],Md=Ze();function UI(e,t,r,n,a){var i=e+"Animation",o=Wd(e,n,a)||{},s=Md(t).userDuring;return o.duration>0&&(o.during=s?ve(gye,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),te(o,r[i]),o}function qx(e,t,r,n){n=n||{};var a=n.dataIndex,i=n.isInit,o=n.clearStyle,s=r.isAnimationEnabled(),l=Md(e),u=t.style;l.userDuring=t.during;var c={},h={};if(yye(e,t,h),e.type==="compound")for(var d=e.shape.paths,v=t.shape.paths,g=0;g0&&e.animateFrom(y,x)}else dye(e,t,a||0,r,c);nZ(e,t),u?e.dirty():e.markRedraw()}function nZ(e,t){for(var r=Md(e).leaveToProps,n=0;n0&&e.animateFrom(a,i)}}function vye(e,t){ge(t,"silent")&&(e.silent=t.silent),ge(t,"ignore")&&(e.ignore=t.ignore),e instanceof ai&&ge(t,"invisible")&&(e.invisible=t.invisible),e instanceof rt&&ge(t,"autoBatch")&&(e.autoBatch=t.autoBatch)}var eo={},pye={setTransform:function(e,t){return eo.el[e]=t,this},getTransform:function(e){return eo.el[e]},setShape:function(e,t){var r=eo.el,n=r.shape||(r.shape={});return n[e]=t,r.dirtyShape&&r.dirtyShape(),this},getShape:function(e){var t=eo.el.shape;if(t)return t[e]},setStyle:function(e,t){var r=eo.el,n=r.style;return n&&(n[e]=t,r.dirtyStyle&&r.dirtyStyle()),this},getStyle:function(e){var t=eo.el.style;if(t)return t[e]},setExtra:function(e,t){var r=eo.el.extra||(eo.el.extra={});return r[e]=t,this},getExtra:function(e){var t=eo.el.extra;if(t)return t[e]}};function gye(){var e=this,t=e.el;if(t){var r=Md(t).userDuring,n=e.userDuring;if(r!==n){e.el=e.userDuring=null;return}eo.el=t,n(pye)}}function xz(e,t,r,n){var a=r[e];if(a){var i=t[e],o;if(i){var s=r.transition,l=a.transition;if(l)if(!o&&(o=n[e]={}),wc(l))te(o,i);else for(var u=jt(l),c=0;c=0){!o&&(o=n[e]={});for(var v=at(i),c=0;c=0)){var d=e.getAnimationStyleProps(),v=d?d.style:null;if(v){!i&&(i=n.style={});for(var g=at(r),u=0;u=0?t.getStore().get(F,V):void 0}var Z=t.get(U.name,V),$=U&&U.ordinalMeta;return $?$.categories[Z]:Z}function A(H,V){V==null&&(V=c);var U=t.getItemVisual(V,"style"),F=U&&U.fill,Z=U&&U.opacity,$=w(V,gl).getItemStyle();F!=null&&($.fill=F),Z!=null&&($.opacity=Z);var W={inheritColor:ue(F)?F:K.color.neutral99},q=S(V,gl),re=Et(q,null,W,!1,!0);re.text=q.getShallow("show")?_e(e.getFormattedLabel(V,gl),bd(t,V)):null;var Q=U_(q,W,!1);return P(H,$),$=l5($,re,Q),H&&k($,H),$.legacy=!0,$}function I(H,V){V==null&&(V=c);var U=w(V,ms).getItemStyle(),F=S(V,ms),Z=Et(F,null,null,!0,!0);Z.text=F.getShallow("show")?ia(e.getFormattedLabel(V,ms),e.getFormattedLabel(V,gl),bd(t,V)):null;var $=U_(F,null,!0);return P(H,U),U=l5(U,Z,$),H&&k(U,H),U.legacy=!0,U}function k(H,V){for(var U in V)ge(V,U)&&(H[U]=V[U])}function P(H,V){H&&(H.textFill&&(V.textFill=H.textFill),H.textPosition&&(V.textPosition=H.textPosition))}function D(H,V){if(V==null&&(V=c),ge(mz,H)){var U=t.getItemVisual(V,"style");return U?U[mz[H]]:null}if(ge(eye,H))return t.getItemVisual(V,H)}function z(H){if(o.type==="cartesian2d"){var V=o.getBaseAxis();return Nce(Le({axis:V},H))}}function E(){return r.getCurrentSeriesIndices()}function B(H){return iL(H,r)}}function kye(e){var t={};return j(e.dimensions,function(r){var n=e.getDimensionInfo(r);if(!n.isExtraCoord){var a=n.coordDim,i=t[a]=t[a]||[];i[n.coordDimIndex]=e.getDimensionIndex(r)}}),t}function bT(e,t,r,n,a,i,o){if(!n){i.remove(t);return}var s=XI(e,t,r,n,a,i);return s&&o.setItemGraphicEl(r,s),s&&Yt(s,n.focus,n.blurScope,n.emphasisDisabled),s}function XI(e,t,r,n,a,i){var o=-1,s=t;t&&sZ(t,n,a)&&(o=Ve(i.childrenRef(),t),t=null);var l=!t,u=t;u?u.clearStates():(u=$I(n),s&&Tye(s,u)),n.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),n.tooltipDisabled&&(u.tooltipDisabled=!0),Ra.normal.cfg=Ra.normal.conOpt=Ra.emphasis.cfg=Ra.emphasis.conOpt=Ra.blur.cfg=Ra.blur.conOpt=Ra.select.cfg=Ra.select.conOpt=null,Ra.isLegacy=!1,Iye(u,r,n,a,l,Ra),Lye(u,r,n,a,l),YI(e,u,r,n,Ra,a,l),ge(n,"info")&&(gs(u).info=n.info);for(var c=0;c<$l.length;c++){var h=$l[c];if(h!==gl){var d=Eb(n,h),v=qI(n,d,h);oZ(h,u,d,v,Ra)}}return Aye(u,n,a),n.type==="group"&&Pye(e,u,r,n,a),o>=0?i.replaceAt(u,o):i.add(u),u}function sZ(e,t,r){var n=gs(e),a=t.type,i=t.shape,o=t.style;return r.isUniversalTransitionEnabled()||a!=null&&a!==n.customGraphicType||a==="path"&&Rye(i)&&lZ(i)!==n.customPathData||a==="image"&&ge(o,"image")&&o.image!==n.customImagePath}function Lye(e,t,r,n,a){var i=r.clipPath;if(i===!1)e&&e.getClipPath()&&e.removeClipPath();else if(i){var o=e.getClipPath();o&&sZ(o,i,n)&&(o=null),o||(o=$I(i),e.setClipPath(o)),YI(null,o,t,i,null,n,a)}}function Iye(e,t,r,n,a,i){if(!(e.isGroup||e.type==="compoundPath")){bz(r,null,i),bz(r,ms,i);var o=i.normal.conOpt,s=i.emphasis.conOpt,l=i.blur.conOpt,u=i.select.conOpt;if(o!=null||s!=null||u!=null||l!=null){var c=e.getTextContent();if(o===!1)c&&e.removeTextContent();else{o=i.normal.conOpt=o||{type:"text"},c?c.clearStates():(c=$I(o),e.setTextContent(c)),YI(null,c,t,o,null,n,a);for(var h=o&&o.style,d=0;d<$l.length;d++){var v=$l[d];if(v!==gl){var g=i[v].conOpt;oZ(v,c,g,qI(o,g,v),null)}}h?c.dirty():c.markRedraw()}}}}function bz(e,t,r){var n=t?Eb(e,t):e,a=t?qI(e,n,ms):e.style,i=e.type,o=n?n.textConfig:null,s=e.textContent,l=s?t?Eb(s,t):s:null;if(a&&(r.isLegacy||H8(a,i,!!o,!!l))){r.isLegacy=!0;var u=U8(a,i,!t);!o&&u.textConfig&&(o=u.textConfig),!l&&u.textContent&&(l=u.textContent)}if(!t&&l){var c=l;!c.type&&(c.type="text")}var h=t?r[t]:r.normal;h.cfg=o,h.conOpt=l}function Eb(e,t){return t?e?e[t]:null:e}function qI(e,t,r){var n=t&&t.style;return n==null&&r===ms&&e&&(n=e.styleEmphasis),n}function Pye(e,t,r,n,a){var i=n.children,o=i?i.length:0,s=n.$mergeChildren,l=s==="byName"||n.diffChildrenByName,u=s===!1;if(!(!o&&!l&&!u)){if(l){Eye({api:e,oldChildren:t.children()||[],newChildren:i||[],dataIndex:r,seriesModel:a,group:t});return}u&&t.removeAll();for(var c=0;c=c;v--){var g=t.childAt(v);Dye(t,g,a)}}}function Dye(e,t,r){t&&fw(t,gs(e).option,r)}function Eye(e){new ks(e.oldChildren,e.newChildren,wz,wz,e).add(Sz).update(Sz).remove(jye).execute()}function wz(e,t){var r=e&&e.name;return r??Sye+t}function Sz(e,t){var r=this.context,n=e!=null?r.newChildren[e]:null,a=t!=null?r.oldChildren[t]:null;XI(r.api,a,r.dataIndex,n,r.seriesModel,r.group)}function jye(e){var t=this.context,r=t.oldChildren[e];r&&fw(r,gs(r).option,t.seriesModel)}function lZ(e){return e&&(e.pathData||e.d)}function Rye(e){return e&&(ge(e,"pathData")||ge(e,"d"))}function Oye(e){e.registerChartView(Mye),e.registerSeriesModel(tye)}var tc=Ze(),Cz=Te,wT=ve,KI=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(t,r,n,a){var i=r.get("value"),o=r.get("status");if(this._axisModel=t,this._axisPointerModel=r,this._api=n,!(!a&&this._lastValue===i&&this._lastStatus===o)){this._lastValue=i,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var u={};this.makeElOption(u,i,t,r,n);var c=u.graphicKey;c!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=c;var h=this._moveAnimation=this.determineAnimation(t,r);if(!s)s=this._group=new Ne,this.createPointerEl(s,u,t,r),this.createLabelEl(s,u,t,r),n.getZr().add(s);else{var d=Xe(Tz,r,h);this.updatePointerEl(s,u,d),this.updateLabelEl(s,u,d,r)}Az(s,r,!0),this._renderHandle(i)}},e.prototype.remove=function(t){this.clear(t)},e.prototype.dispose=function(t){this.clear(t)},e.prototype.determineAnimation=function(t,r){var n=r.get("animation"),a=t.axis,i=a.type==="category",o=r.get("snap");if(!o&&!i)return!1;if(n==="auto"||n==null){var s=this.animationThreshold;if(i&&pn(a).w>s)return!0;if(o){var l=dI(t).seriesDataCount,u=a.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return n===!0},e.prototype.makeElOption=function(t,r,n,a,i){},e.prototype.createPointerEl=function(t,r,n,a){var i=r.pointer;if(i){var o=tc(t).pointerEl=new fh[i.type](Cz(r.pointer));t.add(o)}},e.prototype.createLabelEl=function(t,r,n,a){if(r.label){var i=tc(t).labelEl=new ht(Cz(r.label));t.add(i),Mz(i,a)}},e.prototype.updatePointerEl=function(t,r,n){var a=tc(t).pointerEl;a&&r.pointer&&(a.setStyle(r.pointer.style),n(a,{shape:r.pointer.shape}))},e.prototype.updateLabelEl=function(t,r,n,a){var i=tc(t).labelEl;i&&(i.setStyle(r.label.style),n(i,{x:r.label.x,y:r.label.y}),Mz(i,a))},e.prototype._renderHandle=function(t){if(!(this._dragging||!this.updateHandleTransform)){var r=this._axisPointerModel,n=this._api.getZr(),a=this._handle,i=r.getModel("handle"),o=r.get("status");if(!i.get("show")||!o||o==="hide"){a&&n.remove(a),this._handle=null;return}var s;this._handle||(s=!0,a=this._handle=$d(i.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){Cs(u.event)},onmousedown:wT(this._onHandleDragMove,this,0,0),drift:wT(this._onHandleDragMove,this),ondragend:wT(this._onHandleDragEnd,this)}),n.add(a)),Az(a,r,!1),a.setStyle(i.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=i.get("size");ne(l)||(l=[l,l]),a.scaleX=l[0]/2,a.scaleY=l[1]/2,Kd(this,"_doDispatchAxisPointer",i.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,s)}},e.prototype._moveHandleToValue=function(t,r){Tz(this._axisPointerModel,!r&&this._moveAnimation,this._handle,ST(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(t,r){var n=this._handle;if(n){this._dragging=!0;var a=this.updateHandleTransform(ST(n),[t,r],this._axisModel,this._axisPointerModel);this._payloadInfo=a,n.stopAnimation(),n.attr(ST(a)),tc(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){var t=this._handle;if(t){var r=this._payloadInfo,n=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:r.cursorPoint[0],y:r.cursorPoint[1],tooltipOption:r.tooltipOption,axesInfo:[{axisDim:n.axis.dim,axisIndex:n.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){this._dragging=!1;var t=this._handle;if(t){var r=this._axisPointerModel.get("value");this._moveHandleToValue(r),this._api.dispatchAction({type:"hideTip"})}},e.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var r=t.getZr(),n=this._group,a=this._handle;r&&n&&(this._lastGraphicKey=null,n&&r.remove(n),a&&r.remove(a),this._group=null,this._handle=null,this._payloadInfo=null),Ug(this,"_doDispatchAxisPointer")},e.prototype.doClear=function(){},e.prototype.buildLabel=function(t,r,n){return n=n||0,{x:t[n],y:t[1-n],width:r[n],height:r[1-n]}},e}();function Tz(e,t,r,n){uZ(tc(r).lastProp,n)||(tc(r).lastProp=n,t?mt(r,n,e):(r.stopAnimation(),r.attr(n)))}function uZ(e,t){if(Ie(e)&&Ie(t)){var r=!0;return j(t,function(n,a){r=r&&uZ(e[a],n)}),!!r}else return e===t}function Mz(e,t){e[t.get(["label","show"])?"show":"hide"]()}function ST(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function Az(e,t,r){var n=t.get("z"),a=t.get("zlevel");e&&e.traverse(function(i){i.type!=="group"&&(n!=null&&(i.z=n),a!=null&&(i.zlevel=a),i.silent=r)})}function JI(e){var t=e.get("type"),r=e.getModel(t+"Style"),n;return t==="line"?(n=r.getLineStyle(),n.fill=null):t==="shadow"&&(n=r.getAreaStyle(),n.stroke=null),n}function cZ(e,t,r,n,a){var i=r.get("value"),o=hZ(i,t.axis,t.ecModel,r.get("seriesDataIndices"),{precision:r.get(["label","precision"]),formatter:r.get(["label","formatter"])}),s=r.getModel("label"),l=Xd(s.get("padding")||0),u=s.getFont(),c=C1(o,u),h=a.position,d=c.width+l[1]+l[3],v=c.height+l[0]+l[2],g=a.align;g==="right"&&(h[0]-=d),g==="center"&&(h[0]-=d/2);var m=a.verticalAlign;m==="bottom"&&(h[1]-=v),m==="middle"&&(h[1]-=v/2),zye(h,d,v,n);var y=s.get("backgroundColor");(!y||y==="auto")&&(y=t.get(["axisLine","lineStyle","color"])),e.label={x:h[0],y:h[1],style:Et(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:y}),z2:10}}function zye(e,t,r,n){var a=n.getWidth(),i=n.getHeight();e[0]=Math.min(e[0]+t,a)-t,e[1]=Math.min(e[1]+r,i)-r,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function hZ(e,t,r,n,a){e=t.scale.parse(e);var i=t.scale.getLabel({value:e},{precision:a.precision}),o=a.formatter;if(o){var s={value:lb(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};j(n,function(l){var u=r.getSeriesByIndex(l.seriesIndex),c=l.dataIndexInside,h=u&&u.getDataParams(c);h&&s.seriesData.push(h)}),ue(o)?i=o.replace("{value}",i):Me(o)&&(i=o(s))}return i}function QI(e,t,r){var n=$t();return js(n,n,r.rotation),Pi(n,n,r.position),ki([e.dataToCoord(t),(r.labelOffset||0)+(r.labelDirection||1)*(r.labelMargin||0)],n)}function fZ(e,t,r,n,a,i){var o=Vn.innerTextLayout(r.rotation,0,r.labelDirection);r.labelMargin=a.get(["label","margin"]),cZ(t,n,a,i,{position:QI(n.axis,e,r),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function eP(e,t,r){return r=r||0,{x1:e[r],y1:e[1-r],x2:t[r],y2:t[1-r]}}function dZ(e,t,r){return r=r||0,{x:e[r],y:e[1-r],width:t[r],height:t[1-r]}}function Nz(e,t,r,n,a,i){return{cx:e,cy:t,r0:r,r:n,startAngle:a,endAngle:i,clockwise:!0}}function tP(e,t,r){return pn(e,{fromStat:{sers:oe(t,function(n){return r.getSeriesByIndex(n.seriesIndex)})},min:1}).w}function rP(e,t,r){return[qe(Mt(t[0],t[1]),e-r/2),Mt(e+r/2,qe(t[0],t[1]))]}var Bye=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis,l=s.grid,u=i.get("type"),c=s.getGlobalExtent(),h=kz(l,s).getOtherAxis(s).getGlobalExtent(),d=s.toGlobalCoord(s.dataToCoord(n,!0));if(u&&u!=="none"){var v=JI(i),g=Fye[u](s,d,c,h,i.get("seriesDataIndices"),i.ecModel);g.style=v,r.graphicKey=g.type,r.pointer=g}var m=mb(l.getRect(),a);fZ(n,r,m,a,i,o)},t.prototype.getHandleTransform=function(r,n,a){var i=mb(n.axis.grid.getRect(),n,{labelInside:!1});i.labelMargin=a.get(["handle","margin"]);var o=QI(n.axis,r,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,a,i){var o=a.axis,s=o.grid,l=o.getGlobalExtent(!0),u=kz(s,o).getOtherAxis(o).getGlobalExtent(),c=o.dim==="x"?0:1,h=[r.x,r.y];h[c]+=n[c],h[c]=Mt(l[1],h[c]),h[c]=qe(l[0],h[c]);var d=(u[1]+u[0])/2,v=[d,d];v[c]=h[c];var g=[{verticalAlign:"middle"},{align:"center"}];return{x:h[0],y:h[1],rotation:r.rotation,cursorPoint:v,tooltipOption:g[c]}},t}(KI);function kz(e,t){var r={};return r[t.dim+"AxisIndex"]=t.index,e.getCartesian(r)}var Fye={line:function(e,t,r,n){var a=eP([t,n[0]],[t,n[1]],Lz(e));return{type:"Line",subPixelOptimize:!0,shape:a}},shadow:function(e,t,r,n,a,i){var o=tP(e,a,i),s=n[1]-n[0],l=rP(t,r,o),u=l[0],c=l[1];return{type:"Rect",shape:dZ([u,n[0]],[c-u,s],Lz(e))}}};function Lz(e){return e.dim==="x"?0:1}var Vye=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="axisPointer",t.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:K.color.border,width:1,type:"dashed"},shadowStyle:{color:K.color.shadowTint},label:{show:!0,formatter:null,precision:"auto",margin:3,color:K.color.neutral00,padding:[5,7,5,7],backgroundColor:K.color.accent60,borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:K.color.accent40,throttle:40}},t}(Qe),us=Ze(),Gye=j;function vZ(e,t,r){if(!ot.node){var n=t.getZr();us(n).records||(us(n).records={}),Hye(n,t);var a=us(n).records[e]||(us(n).records[e]={});a.handler=r}}function Hye(e,t){if(us(e).initialized)return;us(e).initialized=!0,r("click",Xe(CT,"click")),r("mousemove",Xe(CT,"mousemove")),r("mousewheel",Xe(CT,"mousewheel")),r("globalout",Wye);function r(n,a){e.on(n,function(i){var o=Zye(t);Gye(us(e).records,function(s){s&&a(s,i,o.dispatchAction)}),Uye(o.pendings,t)})}}function Uye(e,t){var r=e.showTip.length,n=e.hideTip.length,a;r?a=e.showTip[r-1]:n&&(a=e.hideTip[n-1]),a&&(a.dispatchAction=null,t.dispatchAction(a))}function Wye(e,t,r){e.handler("leave",null,r)}function CT(e,t,r,n){t.handler(e,r,n)}function Zye(e){var t={showTip:[],hideTip:[]},r=function(n){var a=t[n.type];a?a.push(n):(n.dispatchAction=r,e.dispatchAction(n))};return{dispatchAction:r,pendings:t}}function WA(e,t){if(!ot.node){var r=t.getZr(),n=(us(r).records||{})[e];n&&(us(r).records[e]=null)}}var $ye=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){var i=n.getComponent("tooltip"),o=r.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click|mousewheel";vZ("axisPointer",a,function(s,l,u){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&u({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},t.prototype.remove=function(r,n){WA("axisPointer",n)},t.prototype.dispose=function(r,n){WA("axisPointer",n)},t.type="axisPointer",t}(Rt);function pZ(e,t){var r=[],n=e.seriesIndex,a;if(n==null||!(a=t.getSeriesByIndex(n)))return{point:[]};var i=a.getData(),o=Ec(i,e);if(o==null||o<0||ne(o))return{point:[]};var s=i.getItemGraphicEl(o),l=a.coordinateSystem;if(a.getTooltipPosition)r=a.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(e.isStacked){var u=l.getBaseAxis(),c=l.getOtherAxis(u),h=c.dim,d=u.dim,v=h==="x"||h==="radius"?1:0,g=i.mapDimension(d),m=[];m[v]=i.get(g,o),m[1-v]=i.get(i.getCalculationInfo("stackResultDimension"),o),r=l.dataToPoint(m)||[]}else r=l.dataToPoint(i.getValues(oe(l.dimensions,function(x){return i.mapDimension(x)}),o))||[];else if(s){var y=s.getBoundingRect().clone();y.applyTransform(s.transform),r=[y.x+y.width/2,y.y+y.height/2]}return{point:r,el:s}}var Iz=Ze();function Yye(e,t,r){var n=e.currTrigger,a=[e.x,e.y],i=e,o=e.dispatchAction||ve(r.dispatchAction,r),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){Kx(a)&&(a=pZ({seriesIndex:i.seriesIndex,dataIndex:i.dataIndex},t).point);var l=Kx(a),u=i.axesInfo,c=s.axesInfo,h=n==="leave"||Kx(a),d={},v={},g={list:[],map:{}},m={showPointer:Xe(qye,v),showTooltip:Xe(Kye,g)};j(s.coordSysMap,function(x,_){var w=l||x.containPoint(a);j(s.coordSysAxesInfo[_],function(S,C){var M=S.axis,A=t0e(u,S);if(!h&&w&&(!u||A)){var I=A&&A.value;I==null&&!l&&(I=M.pointToData(a)),I!=null&&Pz(S,I,m,!1,d)}})});var y={};return j(c,function(x,_){var w=x.linkGroup;w&&!v[_]&&j(w.axesInfo,function(S,C){var M=v[C];if(S!==x&&M){var A=M.value;w.mapper&&(A=x.axis.scale.parse(w.mapper(A,Dz(S),Dz(x)))),y[x.key]=A}})}),j(y,function(x,_){Pz(c[_],x,m,!0,d)}),Jye(v,c,d),Qye(g,a,e,o),e0e(c,o,r),d}}function Pz(e,t,r,n,a){var i=e.axis;if(!(i.scale.isBlank()||!i.containData(t))){if(!e.involveSeries){r.showPointer(e,t);return}var o=Xye(t,e),s=o.payloadBatch,l=o.snapToValue;s[0]&&a.seriesIndex==null&&te(a,s[0]),!n&&e.snap&&i.containData(l)&&l!=null&&(t=l),r.showPointer(e,t,s),r.showTooltip(e,o,l)}}function Xye(e,t){var r=t.axis,n=r.dim,a=e,i=[],o=Number.MAX_VALUE,s=-1;return j(t.seriesModels,function(l,u){var c=l.getData().mapDimensionsAll(n),h,d;if(l.getAxisTooltipData){var v=l.getAxisTooltipData(c,e,r);d=v.dataIndices,h=v.nestestValue}else{if(d=l.indicesOfNearest(n,c[0],e,r.type==="category"?.5:null),!d.length)return;h=l.getData().get(c[0],d[0])}if(ni(h)){var g=e-h,m=Math.abs(g);m<=o&&((m=0&&s<0)&&(o=m,s=g,a=h,i.length=0),j(d,function(y){i.push({seriesIndex:l.seriesIndex,dataIndexInside:y,dataIndex:l.getData().getRawIndex(y)})}))}}),{payloadBatch:i,snapToValue:a}}function qye(e,t,r,n){e[t.key]={value:r,payloadBatch:n}}function Kye(e,t,r,n){var a=r.payloadBatch,i=t.axis,o=i.model,s=t.axisPointerModel;if(!(!t.triggerTooltip||!a.length)){var l=t.coordSys.model,u=am(l),c=e.map[u];c||(c=e.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},e.list.push(c)),c.dataByAxis.push({axisDim:i.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:n,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:a.slice()})}}function Jye(e,t,r){var n=r.axesInfo=[];j(t,function(a,i){var o=a.axisPointerModel.option,s=e[i];s?(!a.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!a.useHandle&&(o.status="hide"),o.status==="show"&&n.push({axisDim:a.axis.dim,axisIndex:a.axis.model.componentIndex,value:o.value})})}function Qye(e,t,r,n){if(Kx(t)||!e.list.length){n({type:"hideTip"});return}var a=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:t[0],y:t[1],tooltipOption:r.tooltipOption,position:r.position,dataIndexInside:a.dataIndexInside,dataIndex:a.dataIndex,seriesIndex:a.seriesIndex,dataByCoordSys:e.list})}function e0e(e,t,r){var n=r.getZr(),a="axisPointerLastHighlights",i=Iz(n)[a]||{},o=Iz(n)[a]={};j(e,function(c,h){var d=c.axisPointerModel.option;d.status==="show"&&c.triggerEmphasis&&j(d.seriesDataIndices,function(v){o[v.seriesIndex+"|"+v.dataIndex]=v})});var s=[],l=[];function u(c){return{seriesIndex:c.seriesIndex,dataIndex:c.dataIndex}}j(i,function(c,h){!o[h]&&l.push(u(c))}),j(o,function(c,h){!i[h]&&s.push(u(c))}),l.length&&r.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&r.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function t0e(e,t){for(var r=0;r<(e||[]).length;r++){var n=e[r];if(t.axis.dim===n.axisDim&&t.axis.model.componentIndex===n.axisIndex)return n}}function Dz(e){var t=e.axis.model,r={},n=r.axisDim=e.axis.dim;return r.axisIndex=r[n+"AxisIndex"]=t.componentIndex,r.axisName=r[n+"AxisName"]=t.name,r.axisId=r[n+"AxisId"]=t.id,r}function Kx(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function Ym(e){yh.registerAxisPointerClass("CartesianAxisPointer",Bye),e.registerComponentModel(Vye),e.registerComponentView($ye),e.registerPreprocessor(function(t){if(t){(!t.axisPointer||t.axisPointer.length===0)&&(t.axisPointer={});var r=t.axisPointer.link;r&&!ne(r)&&(t.axisPointer.link=[r])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(t,r){t.getComponent("axisPointer").coordSysAxesInfo=She(t,r)}}),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},Yye)}function r0e(e){$e(AW),$e(Ym)}var n0e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis;s.dim==="angle"&&(this.animationThreshold=Math.PI/18);var l=s.polar,u=s.getExtent(),c=l.getOtherAxis(s).getExtent(),h=s.dataToCoord(n),d=i.get("type");if(d&&d!=="none"){var v=JI(i),g=i0e[d](s,l,h,u,c,i.get("seriesDataIndices"),i.ecModel);g.style=v,r.graphicKey=g.type,r.pointer=g}var m=i.get(["label","margin"]),y=a0e(n,a,i,l,m);cZ(r,a,i,o,y)},t}(KI);function a0e(e,t,r,n,a){var i=t.axis,o=i.dataToCoord(e),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l=n.getRadiusAxis().getExtent(),u,c,h;if(i.dim==="radius"){var d=$t();js(d,d,s),Pi(d,d,[n.cx,n.cy]),u=ki([o,-a],d);var v=t.getModel("axisLabel").get("rotate")||0,g=Vn.innerTextLayout(s,v*Math.PI/180,-1);c=g.textAlign,h=g.textVerticalAlign}else{var m=l[1];u=n.coordToPoint([m+a,o]);var y=n.cx,x=n.cy;c=Math.abs(u[0]-y)/m<.3?"center":u[0]>y?"left":"right",h=Math.abs(u[1]-x)/m<.3?"middle":u[1]>x?"top":"bottom"}return{position:u,align:c,verticalAlign:h}}var i0e={line:function(e,t,r,n,a){return e.dim==="angle"?{type:"Line",shape:eP(t.coordToPoint([a[0],r]),t.coordToPoint([a[1],r]))}:{type:"Circle",shape:{cx:t.cx,cy:t.cy,r}}},shadow:function(e,t,r,n,a,i,o){var s=Math.PI/180,l=tP(e,i,o),u;if(e.dim==="angle")u=Nz(t.cx,t.cy,a[0],a[1],(-r-l/2)*s,(-r+l/2)*s);else{var c=rP(r,n,l),h=c[0],d=c[1];u=Nz(t.cx,t.cy,h,d,0,Math.PI*2)}return{type:"Sector",shape:u}}},So="polar",Ez=So,o0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.findAxisModel=function(r){var n,a=this.ecModel;return a.eachComponent(r,function(i){i.getCoordSysModel()===this&&(n=i)},this),n},t.type=So,t.dependencies=["radiusAxis","angleAxis"],t.defaultOption={z:0,center:["50%","50%"],radius:"80%"},t}(Qe),nP=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",sr).models[0]},t.type="polarAxis",t}(Qe);br(nP,nv);var s0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="angleAxis",t}(nP),l0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="radiusAxis",t}(nP),aP=function(e){X(t,e);function t(r,n){return e.call(this,"radius",r,n)||this}return t.prototype.pointToData=function(r,n){return this.polar.pointToData(r,n)[this.dim==="radius"?0:1]},t}(ui);aP.prototype.dataToRadius=ui.prototype.dataToCoord;aP.prototype.radiusToData=ui.prototype.coordToData;var u0e=Ze(),iP=function(e){X(t,e);function t(r,n){return e.call(this,"angle",r,n||[0,360])||this}return t.prototype.pointToData=function(r,n){return this.polar.pointToData(r,n)[this.dim==="radius"?0:1]},t.prototype.calculateCategoryInterval=function(){var r=this,n=r.getLabelModel(),a=r.scale,i=a.getExtent(),o=a.count();if(i[1]-i[0]<1)return 0;var s=i[0],l=r.dataToCoord(s+1)-r.dataToCoord(s),u=Math.abs(l),c=C1(s==null?"":s+"",n.getFont(),"center","top"),h=Math.max(c.height,7),d=h/u;isNaN(d)&&(d=1/0);var v=Math.max(0,Math.floor(d)),g=u0e(r.model),m=g.lastAutoInterval,y=g.lastTickCount;return m!=null&&y!=null&&Math.abs(m-v)<=1&&Math.abs(y-o)<=1&&m>v?v=m:(g.lastTickCount=o,g.lastAutoInterval=v),v},t}(ui);iP.prototype.dataToAngle=ui.prototype.dataToCoord;iP.prototype.angleToData=ui.prototype.coordToData;var gZ=["radius","angle"],c0e=function(){function e(t){this.dimensions=gZ,this.type=So,this.cx=0,this.cy=0,this._radiusAxis=new aP,this._angleAxis=new iP,this.axisPointerEnabled=!0,this.name=t||"",this._radiusAxis.polar=this._angleAxis.polar=this}return e.prototype.containPoint=function(t){var r=this.pointToCoord(t);return this._radiusAxis.contain(r[0])&&this._angleAxis.contain(r[1])},e.prototype.containData=function(t){return this._radiusAxis.containData(t[0])&&this._angleAxis.containData(t[1])},e.prototype.getAxis=function(t){var r="_"+t+"Axis";return this[r]},e.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},e.prototype.getAxesByScale=function(t){var r=[],n=this._angleAxis,a=this._radiusAxis;return n.scale.type===t&&r.push(n),a.scale.type===t&&r.push(a),r},e.prototype.getAngleAxis=function(){return this._angleAxis},e.prototype.getRadiusAxis=function(){return this._radiusAxis},e.prototype.getOtherAxis=function(t){var r=this._angleAxis;return t===r?this._radiusAxis:r},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},e.prototype.getTooltipAxes=function(t){var r=t!=null&&t!=="auto"?this.getAxis(t):this.getBaseAxis();return{baseAxes:[r],otherAxes:[this.getOtherAxis(r)]}},e.prototype.dataToPoint=function(t,r,n){return this.coordToPoint([this._radiusAxis.dataToRadius(t[0],r),this._angleAxis.dataToAngle(t[1],r)],n)},e.prototype.pointToData=function(t,r,n){n=n||[];var a=this.pointToCoord(t);return n[0]=this._radiusAxis.radiusToData(a[0],r),n[1]=this._angleAxis.angleToData(a[1],r),n},e.prototype.pointToCoord=function(t){var r=t[0]-this.cx,n=t[1]-this.cy,a=this.getAngleAxis(),i=a.getExtent(),o=Math.min(i[0],i[1]),s=Math.max(i[0],i[1]);a.inverse?o=s-360:s=o+360;var l=Math.sqrt(r*r+n*n);r/=l,n/=l;for(var u=Math.atan2(-n,r)/Math.PI*180,c=us;)u+=c*360;return[l,u]},e.prototype.coordToPoint=function(t,r){r=r||[];var n=t[0],a=t[1]/180*Math.PI;return r[0]=Math.cos(a)*n+this.cx,r[1]=-Math.sin(a)*n+this.cy,r},e.prototype.getArea=function(){var t=this.getAngleAxis(),r=this.getRadiusAxis(),n=r.getExtent().slice();n[0]>n[1]&&n.reverse();var a=t.getExtent(),i=Math.PI/180,o=1e-4;return{cx:this.cx,cy:this.cy,r0:n[0],r:n[1],startAngle:-a[0]*i,endAngle:-a[1]*i,clockwise:t.inverse,contain:function(s,l){var u=s-this.cx,c=l-this.cy,h=u*u+c*c,d=this.r,v=this.r0;return d!==v&&h-o<=d*d&&h+o>=v*v},x:this.cx-n[1],y:this.cy-n[1],width:n[1]*2,height:n[1]*2}},e.prototype.convertToPixel=function(t,r,n){var a=jz(r);return a===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var a=jz(r);return a===this?this.pointToData(n):null},e}();function jz(e){var t=e.seriesModel,r=e.polarModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function h0e(e,t,r){var n=t.get("center"),a=jr(t,r).refContainer;e.cx=fe(n[0],a.width)+a.x,e.cy=fe(n[1],a.height)+a.y;var i=e.getRadiusAxis(),o=Math.min(a.width,a.height)/2,s=t.get("radius");s==null?s=[0,"100%"]:ne(s)||(s=[0,s]);var l=[fe(s[0],o),fe(s[1],o)];i.inverse?i.setExtent(l[1],l[0]):i.setExtent(l[0],l[1])}function f0e(e,t){var r=this,n=r.getAngleAxis(),a=r.getRadiusAxis();if(Uc(n,xd),Uc(a,xd),_d(n),_d(a),n.type==="category"&&!n.onBand){var i=n.getExtent(),o=360/n.scale.count();n.inverse?i[1]+=o:i[1]-=o,n.setExtent(i[0],i[1])}}function d0e(e){return e.mainType==="angleAxis"}function Rz(e,t){var r;if(e.type=Fm(t),e.scale=tv(t,e.type,!1),e.onBand=Gm(e.scale,t),e.inverse=t.get("inverse"),d0e(t)){e.inverse=e.inverse!==t.get("clockwise");var n=t.get("startAngle"),a=(r=t.get("endAngle"))!==null&&r!==void 0?r:n+(e.inverse?-360:360);e.setExtent(n,a)}t.axis=e,e.model=t}var v0e={dimensions:gZ,create:function(e,t){var r=[];return e.eachComponent(Ez,function(n,a){var i=new c0e(a+"");i.update=f0e;var o=i.getRadiusAxis(),s=i.getAngleAxis(),l=n.findAxisModel("radiusAxis"),u=n.findAxisModel("angleAxis");Rz(o,l),Rz(s,u),h0e(i,n,t),r.push(i),n.coordinateSystem=i,i.model=n}),e.eachSeries(function(n){if(n.get("coordinateSystem")===So){var a=n.getReferringComponents(Ez,sr).models[0],i=n.coordinateSystem=a.coordinateSystem;i&&(Hc(i.getRadiusAxis(),n,So),Hc(i.getAngleAxis(),n,So))}}),r}},p0e=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function Y0(e,t,r){t[1]>t[0]&&(t=t.slice().reverse());var n=e.coordToPoint([t[0],r]),a=e.coordToPoint([t[1],r]);return{x1:n[0],y1:n[1],x2:a[0],y2:a[1]}}function X0(e){var t=e.getRadiusAxis();return t.inverse?0:1}function Oz(e){var t=e[0],r=e[e.length-1];t&&r&&Math.abs(Math.abs(t.coord-r.coord)-360)<1e-4&&e.pop()}var g0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.axisPointerClass="PolarAxisPointer",r}return t.prototype.render=function(r,n){if(this.group.removeAll(),!!r.get("show")){var a=r.axis,i=a.polar,o=i.getRadiusAxis().getExtent(),s=a.getTicksCoords({breakTicks:"none"}),l=a.getMinorTicksCoords(),u=[];j(a.getViewLabels(),function(c){if(!c.tick.offInterval){c=Te(c);var h=a.scale;c.coord=a.dataToCoord(rv(h,c.tick)),u.push(c)}}),Oz(u),Oz(s),j(p0e,function(c){r.get([c,"show"])&&(!a.scale.isBlank()||c==="axisLine")&&m0e[c](this.group,r,i,s,l,o,u)},this)}},t.type="angleAxis",t}(yh),m0e={axisLine:function(e,t,r,n,a,i){var o=t.getModel(["axisLine","lineStyle"]),s=r.getAngleAxis(),l=Math.PI/180,u=s.getExtent(),c=X0(r),h=c?0:1,d,v=Math.abs(u[1]-u[0])===360?"Circle":"Arc";i[h]===0?d=new fh[v]({shape:{cx:r.cx,cy:r.cy,r:i[c],startAngle:-u[0]*l,endAngle:-u[1]*l,clockwise:s.inverse},style:o.getLineStyle(),z2:1,silent:!0}):d=new Hd({shape:{cx:r.cx,cy:r.cy,r:i[c],r0:i[h]},style:o.getLineStyle(),z2:1,silent:!0}),d.style.fill=null,e.add(d)},axisTick:function(e,t,r,n,a,i){var o=t.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=i[X0(r)],u=oe(n,function(c){return new yr({shape:Y0(r,[l,l+s],c.coord)})});e.add(ya(u,{style:Le(o.getModel("lineStyle").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})}))},minorTick:function(e,t,r,n,a,i){if(a.length){for(var o=t.getModel("axisTick"),s=t.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),u=i[X0(r)],c=[],h=0;hx?"left":"right",S=Math.abs(y[1]-_)/m<.3?"middle":y[1]>_?"top":"bottom";if(s&&s[g]){var C=s[g];Ie(C)&&C.textStyle&&(v=new tt(C.textStyle,l,l.ecModel))}var M=new ht({silent:Vn.isLabelSilent(t),style:Et(v,{x:y[0],y:y[1],fill:v.getTextColor()||t.get(["axisLine","lineStyle","color"]),text:h.formattedLabel,align:w,verticalAlign:S})});if(e.add(M),Os({el:M,componentModel:t,itemName:h.formattedLabel,formatterParamsExtra:{isTruncated:function(){return M.isTruncated},value:h.rawLabel,tickIndex:d}}),c){var A=Vn.makeAxisEventDataBase(t);A.targetType="axisLabel",A.value=h.rawLabel,Ee(M).eventData=A}},this)},splitLine:function(e,t,r,n,a,i){var o=t.getModel("splitLine"),s=o.getModel("lineStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],h=0;h=0?"p":"n",k=w;x&&(n[i][A]||(n[i][A]={p:w,n:w}),k=n[i][A][I]);var P=void 0,D=void 0,z=void 0,E=void 0;if(c.dim==="radius"){var B=c.dataToCoord(M)-w,H=e.dataToCoord(A);nr(B)=E})}}function M0e(e,t){var r=mh(t,So),n=pn(e,{fromStat:{key:r},min:1}).w,a=n,i=0,o="20%",s="30%",l={};Gc(e,r,function(y){var x=mZ(y);l[x]||i++,l[x]=l[x]||{width:0,maxWidth:0};var _=fe(y.get("barWidth"),n),w=fe(y.get("barMaxWidth"),n),S=y.get("barGap"),C=y.get("barCategoryGap");_&&!l[x].width&&(_=Mt(a,_),l[x].width=_,a-=_),w&&(l[x].maxWidth=w),S!=null&&(s=S),C!=null&&(o=C)});var u={},c=fe(o,n),h=fe(s,1),d=(a-c)/(i+(i-1)*h);d=qe(d,0),j(l,function(y,x){var _=y.maxWidth;_&&_=r.y&&t[1]<=r.y+r.height:n.contain(n.toLocalCoord(t[1]))&&t[0]>=r.y&&t[0]<=r.y+r.height},e.prototype.pointToData=function(t,r,n){n=n||[];var a=this.getAxis();return n[0]=a.coordToData(a.toLocalCoord(t[a.orient==="horizontal"?0:1])),n},e.prototype.dataToPoint=function(t,r,n){var a=this.getAxis(),i=this.getRect();n=n||[];var o=a.orient==="horizontal"?0:1;return t instanceof Array&&(t=t[0]),n[o]=a.toGlobalCoord(a.dataToCoord(+t)),n[1-o]=o===0?i.y+i.height/2:i.x+i.width/2,n},e.prototype.convertToPixel=function(t,r,n){var a=zz(r);return a===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var a=zz(r);return a===this?this.pointToData(n):null},e}();function zz(e){var t=e.seriesModel,r=e.singleAxisModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function O0e(e,t){var r=[];return e.eachComponent(MA,function(n,a){var i=new R0e(n,e,t);i.name="single_"+a,i.resize(n,t),n.coordinateSystem=i,r.push(i)}),e.eachSeries(function(n){if(n.get("coordinateSystem")===Ehe){var a=n.getReferringComponents(MA,sr).models[0],i=n.coordinateSystem=a&&a.coordinateSystem;i&&Hc(i.getAxis(),n,nw)}}),r}var z0e={create:O0e,dimensions:yZ},Bz=["x","y"],B0e=["width","height"],F0e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis,l=s.coordinateSystem,u=jb(s),c=q0(l,u),h=q0(l,1-u),d=l.dataToPoint(n)[0],v=i.get("type");if(v&&v!=="none"){var g=JI(i),m=V0e[v](s,d,c,h,i.get("seriesDataIndices"),i.ecModel);m.style=g,r.graphicKey=m.type,r.pointer=m}var y=ZA(a);fZ(n,r,y,a,i,o)},t.prototype.getHandleTransform=function(r,n,a){var i=ZA(n,{labelInside:!1});i.labelMargin=a.get(["handle","margin"]);var o=QI(n.axis,r,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,a,i){var o=a.axis,s=o.coordinateSystem,l=jb(o),u=q0(s,l),c=[r.x,r.y];c[l]+=n[l],c[l]=Math.min(u[1],c[l]),c[l]=Math.max(u[0],c[l]);var h=q0(s,1-l),d=(h[1]+h[0])/2,v=[d,d];return v[l]=c[l],{x:c[0],y:c[1],rotation:r.rotation,cursorPoint:v,tooltipOption:{verticalAlign:"middle"}}},t}(KI),V0e={line:function(e,t,r,n){var a=eP([t,n[0]],[t,n[1]],jb(e));return{type:"Line",subPixelOptimize:!0,shape:a}},shadow:function(e,t,r,n,a,i){var o=tP(e,a,i),s=n[1]-n[0],l=rP(t,r,o),u=l[0],c=l[1];return{type:"Rect",shape:dZ([u,n[0]],[c-u,s],jb(e))}}};function jb(e){return e.isHorizontal()?0:1}function q0(e,t){var r=e.getRect();return[r[Bz[t]],r[Bz[t]]+r[B0e[t]]]}var G0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="single",t}(Rt);function H0e(e){$e(Ym),yh.registerAxisPointerClass("SingleAxisPointer",F0e),e.registerComponentView(G0e),e.registerComponentView(D0e),e.registerComponentModel(Yx),wd(e,"single",Yx,Yx.defaultOption),e.registerCoordinateSystem("single",z0e)}var U0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n,a){var i=vh(r);e.prototype.init.apply(this,arguments),Fz(r,i)},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),Fz(this.option,r)},t.prototype.getCellSize=function(){return this.option.cellSize},t.type="calendar",t.layoutMode="box",t.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:K.color.axisLine,width:1,type:"solid"}},itemStyle:{color:K.color.neutral00,borderWidth:1,borderColor:K.color.neutral10},dayLabel:{show:!0,firstDay:0,position:"start",margin:K.size.s,color:K.color.secondary},monthLabel:{show:!0,position:"start",margin:K.size.s,align:"center",formatter:null,color:K.color.secondary},yearLabel:{show:!0,position:null,margin:K.size.xl,formatter:null,color:K.color.quaternary,fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},t}(Qe);function Fz(e,t){var r=e.cellSize,n;ne(r)?n=r:n=e.cellSize=[r,r],n.length===1&&(n[1]=n[0]);var a=oe([0,1],function(i){return Wne(t,i)&&(n[i]="auto"),n[i]!=null&&n[i]!=="auto"});Eo(e,t,{type:"box",ignoreSize:a})}var W0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){var i=this.group;i.removeAll();var o=r.coordinateSystem,s=o.getRangeInfo(),l=o.getOrient(),u=n.getLocaleModel();this._renderDayRect(r,s,i),this._renderLines(r,s,l,i),this._renderYearText(r,s,l,i),this._renderMonthText(r,u,l,i),this._renderWeekText(r,u,s,l,i)},t.prototype._renderDayRect=function(r,n,a){for(var i=r.coordinateSystem,o=r.getModel("itemStyle").getItemStyle(),s=i.getCellWidth(),l=i.getCellHeight(),u=n.start.time;u<=n.end.time;u=i.getNextNDay(u,1).time){var c=i.dataToCalendarLayout([u],!1).tl,h=new Ke({shape:{x:c[0],y:c[1],width:s,height:l},cursor:"default",style:o});a.add(h)}},t.prototype._renderLines=function(r,n,a,i){var o=this,s=r.coordinateSystem,l=r.getModel(["splitLine","lineStyle"]).getLineStyle(),u=r.get(["splitLine","show"]),c=l.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var h=n.start,d=0;h.time<=n.end.time;d++){g(h.formatedDate),d===0&&(h=s.getDateInfo(n.start.y+"-"+n.start.m));var v=h.date;v.setMonth(v.getMonth()+1),h=s.getDateInfo(v)}g(s.getNextNDay(n.end.time,1).formatedDate);function g(m){o._firstDayOfMonth.push(s.getDateInfo(m)),o._firstDayPoints.push(s.dataToCalendarLayout([m],!1).tl);var y=o._getLinePointsOfOneWeek(r,m,a);o._tlpoints.push(y[0]),o._blpoints.push(y[y.length-1]),u&&o._drawSplitline(y,l,i)}u&&this._drawSplitline(o._getEdgesPoints(o._tlpoints,c,a),l,i),u&&this._drawSplitline(o._getEdgesPoints(o._blpoints,c,a),l,i)},t.prototype._getEdgesPoints=function(r,n,a){var i=[r[0].slice(),r[r.length-1].slice()],o=a==="horizontal"?0:1;return i[0][o]=i[0][o]-n/2,i[1][o]=i[1][o]+n/2,i},t.prototype._drawSplitline=function(r,n,a){var i=new en({z2:20,shape:{points:r},style:n});a.add(i)},t.prototype._getLinePointsOfOneWeek=function(r,n,a){for(var i=r.coordinateSystem,o=i.getDateInfo(n),s=[],l=0;l<7;l++){var u=i.getNextNDay(o.time,l),c=i.dataToCalendarLayout([u.time],!1);s[2*u.day]=c.tl,s[2*u.day+1]=c[a==="horizontal"?"bl":"tr"]}return s},t.prototype._formatterLabel=function(r,n){return ue(r)&&r?QH(r,n):Me(r)?r(n):n.nameMap},t.prototype._yearTextPositionControl=function(r,n,a,i,o){var s=n[0],l=n[1],u=["center","bottom"];i==="bottom"?(l+=o,u=["center","top"]):i==="left"?s-=o:i==="right"?(s+=o,u=["center","top"]):l-=o;var c=0;return(i==="left"||i==="right")&&(c=Math.PI/2),{rotation:c,x:s,y:l,style:{align:u[0],verticalAlign:u[1]}}},t.prototype._renderYearText=function(r,n,a,i){var o=r.getModel("yearLabel");if(o.get("show")){var s=o.get("margin"),l=o.get("position");l||(l=a!=="horizontal"?"top":"left");var u=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],c=(u[0][0]+u[1][0])/2,h=(u[0][1]+u[1][1])/2,d=a==="horizontal"?0:1,v={top:[c,u[d][1]],bottom:[c,u[1-d][1]],left:[u[1-d][0],h],right:[u[d][0],h]},g=n.start.y;+n.end.y>+n.start.y&&(g=g+"-"+n.end.y);var m=o.get("formatter"),y={start:n.start.y,end:n.end.y,nameMap:g},x=this._formatterLabel(m,y),_=new ht({z2:30,style:Et(o,{text:x}),silent:o.get("silent")});_.attr(this._yearTextPositionControl(_,v[l],a,l,s)),i.add(_)}},t.prototype._monthTextPositionControl=function(r,n,a,i,o){var s="left",l="top",u=r[0],c=r[1];return a==="horizontal"?(c=c+o,n&&(s="center"),i==="start"&&(l="bottom")):(u=u+o,n&&(l="middle"),i==="start"&&(s="right")),{x:u,y:c,align:s,verticalAlign:l}},t.prototype._renderMonthText=function(r,n,a,i){var o=r.getModel("monthLabel");if(o.get("show")){var s=o.get("nameMap"),l=o.get("margin"),u=o.get("position"),c=o.get("align"),h=[this._tlpoints,this._blpoints];(!s||ue(s))&&(s&&(n=FM(s)||n),s=n.get(["time","monthAbbr"])||[]);var d=u==="start"?0:1,v=a==="horizontal"?0:1;l=u==="start"?-l:l;for(var g=c==="center",m=o.get("silent"),y=0;y=i.start.time&&a.times.end.time&&r.reverse(),r},e.prototype._getRangeInfo=function(t){var r=[this.getDateInfo(t[0]),this.getDateInfo(t[1])],n;r[0].time>r[1].time&&(n=!0,r.reverse());var a=Math.floor(r[1].time/TT)-Math.floor(r[0].time/TT)+1,i=new Date(r[0].time),o=i.getDate(),s=r[1].date.getDate();i.setDate(o+a-1);var l=i.getDate();if(l!==s)for(var u=i.getTime()-r[1].time>0?1:-1;(l=i.getDate())!==s&&(i.getTime()-r[1].time)*u>0;)a-=u,i.setDate(l-u);var c=Math.floor((a+r[0].day+6)/7),h=n?-c+1:c-1;return n&&r.reverse(),{range:[r[0].formatedDate,r[1].formatedDate],start:r[0],end:r[1],allDay:a,weeks:c,nthWeek:h,fweek:r[0].day,lweek:r[1].day}},e.prototype._getDateByWeeksAndDay=function(t,r,n){var a=this._getRangeInfo(n);if(t>a.weeks||t===0&&ra.lweek)return null;var i=(t-1)*7-a.fweek+r,o=new Date(a.start.time);return o.setDate(+a.start.d+i),this.getDateInfo(o)},e.create=function(t,r){var n=[];return t.eachComponent("calendar",function(a){var i=new e(a,t,r);n.push(i),a.coordinateSystem=i}),t.eachComponent(function(a,i){Om({targetModel:i,coordSysType:"calendar",coordSysProvider:o7})}),n},e.dimensions=["time","value"],e}();function MT(e){var t=e.calendarModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}function $0e(e){e.registerComponentModel(U0e),e.registerComponentView(W0e),e.registerCoordinateSystem("calendar",Z0e)}var ns={level:1,leaf:2,nonLeaf:3},ys={none:0,all:1,body:2,corner:3};function $A(e,t,r){var n=t[Fe[r]].getCell(e);return!n&&ft(e)&&e<0&&(n=t[Fe[1-r]].getUnitLayoutInfo(r,Math.round(e))),n}function xZ(e){var t=e||[];return t[0]=t[0]||[],t[1]=t[1]||[],t[0][0]=t[0][1]=t[1][0]=t[1][1]=NaN,t}function _Z(e,t,r,n,a){Vz(e[0],t,a,r,n,0),Vz(e[1],t,a,r,n,1)}function Vz(e,t,r,n,a,i){e[0]=1/0,e[1]=-1/0;var o=n[i],s=ne(o)?o:[o],l=s.length,u=!!r;if(l>=1?(Gz(e,t,s,u,a,i,0),l>1&&Gz(e,t,s,u,a,i,l-1)):e[0]=e[1]=NaN,u){var c=-a[Fe[1-i]].getLocatorCount(i),h=a[Fe[i]].getLocatorCount(i)-1;r===ys.body?c=qe(0,c):r===ys.corner&&(h=Mt(-1,h)),h=t[0]&&e[0]<=t[1]}function Wz(e,t){e.id.set(t[0][0],t[1][0]),e.span.set(t[0][1]-e.id.x+1,t[1][1]-e.id.y+1)}function q0e(e,t){e[0][0]=t[0][0],e[0][1]=t[0][1],e[1][0]=t[1][0],e[1][1]=t[1][1]}function Zz(e,t,r,n){var a=$A(t[n][0],r,n),i=$A(t[n][1],r,n);e[Fe[n]]=e[hr[n]]=NaN,a&&i&&(e[Fe[n]]=a.xy,e[hr[n]]=i.xy+i.wh-a.xy)}function up(e,t,r,n){return e[Fe[t]]=r,e[Fe[1-t]]=n,e}function K0e(e){return e&&(e.type===ns.leaf||e.type===ns.nonLeaf)?e:null}function Rb(){return{x:NaN,y:NaN,width:NaN,height:NaN}}var $z=function(){function e(t,r){this._cells=[],this._levels=[],this.dim=t,this.dimIdx=t==="x"?0:1,this._model=r,this._uniqueValueGen=J0e(t);var n=r.get("data",!0),a=r.get("length",!0);if(n!=null&&!ne(n)&&(n=[]),n)this._initByDimModelData(n);else if(a!=null){n=Array(a);for(var i=0;i=1,w=r[Fe[n]],S=i.getLocatorCount(n)-1,C=new kl;for(o.resetLayoutIterator(C,n);C.next();)M(C.item);for(i.resetLayoutIterator(C,n);C.next();)M(C.item);function M(A){un(A.wh)&&(A.wh=x),A.xy=w,A.id[Fe[n]]===S&&!_&&(A.wh=r[Fe[n]]+r[hr[n]]-A.xy),w+=A.wh}}function e4(e,t){for(var r=t[Fe[e]].resetCellIterator();r.next();){var n=r.item;Ob(n.rect,e,n.id,n.span,t),Ob(n.rect,1-e,n.id,n.span,t),n.type===ns.nonLeaf&&(n.xy=n.rect[Fe[e]],n.wh=n.rect[hr[e]])}}function t4(e,t){e.travelExistingCells(function(r){var n=r.span;if(n){var a=r.spanRect,i=r.id;Ob(a,0,i,n,t),Ob(a,1,i,n,t)}})}function Ob(e,t,r,n,a){e[hr[t]]=0;var i=r[Fe[t]],o=i<0?a[Fe[1-t]]:a[Fe[t]],s=o.getUnitLayoutInfo(t,r[Fe[t]]);if(e[Fe[t]]=s.xy,e[hr[t]]=s.wh,n[Fe[t]]>1){var l=o.getUnitLayoutInfo(t,r[Fe[t]]+n[Fe[t]]-1);e[hr[t]]=l.xy+l.wh-s.xy}}function hxe(e,t,r){var n=B_(e,r[hr[t]]);return XA(n,r[hr[t]])}function XA(e,t){return Math.max(Math.min(e,_e(t,1/0)),0)}function kT(e){var t=e.matrixModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}var an={inBody:1,inCorner:2,outside:3},Ji={x:null,y:null,point:[]};function r4(e,t,r,n,a){var i=r[Fe[t]],o=r[Fe[1-t]],s=i.getUnitLayoutInfo(t,i.getLocatorCount(t)-1),l=i.getUnitLayoutInfo(t,0),u=o.getUnitLayoutInfo(t,-o.getLocatorCount(t)),c=o.shouldShow()?o.getUnitLayoutInfo(t,-1):null,h=e.point[t]=n[t];if(!l&&!c){e[Fe[t]]=an.outside;return}if(a===ys.body){l?(e[Fe[t]]=an.inBody,h=Mt(s.xy+s.wh,qe(l.xy,h)),e.point[t]=h):e[Fe[t]]=an.outside;return}else if(a===ys.corner){c?(e[Fe[t]]=an.inCorner,h=Mt(c.xy+c.wh,qe(u.xy,h)),e.point[t]=h):e[Fe[t]]=an.outside;return}var d=l?l.xy:c?c.xy+c.wh:NaN,v=u?u.xy:d,g=s?s.xy+s.wh:d;if(hg){if(!a){e[Fe[t]]=an.outside;return}h=g}e.point[t]=h,e[Fe[t]]=d<=h&&h<=g?an.inBody:v<=h&&h<=d?an.inCorner:an.outside}function n4(e,t,r,n){var a=1-r;if(e[Fe[r]]!==an.outside)for(n[Fe[r]].resetCellIterator(NT);NT.next();){var i=NT.item;if(i4(e.point[r],i.rect,r)&&i4(e.point[a],i.rect,a)){t[r]=i.ordinal,t[a]=i.id[Fe[a]];return}}}function a4(e,t,r,n){if(e[Fe[r]]!==an.outside){var a=e[Fe[r]]===an.inCorner?n[Fe[1-r]]:n[Fe[r]];for(a.resetLayoutIterator(tx,r);tx.next();)if(fxe(e.point[r],tx.item)){t[r]=tx.item.id[Fe[r]];return}}}function fxe(e,t){return t.xy<=e&&e<=t.xy+t.wh}function i4(e,t,r){return t[Fe[r]]<=e&&e<=t[Fe[r]]+t[hr[r]]}function dxe(e){e.registerComponentModel(rxe),e.registerComponentView(sxe),e.registerCoordinateSystem("matrix",cxe)}function vxe(e,t){var r=e.existing;if(t.id=e.keyInfo.id,!t.type&&r&&(t.type=r.type),t.parentId==null){var n=t.parentOption;n?t.parentId=n.id:r&&(t.parentId=r.parentId)}t.parentOption=null}function o4(e,t){var r;return j(t,function(n){e[n]!=null&&e[n]!=="auto"&&(r=!0)}),r}function pxe(e,t,r){var n=te({},r),a=e[t],i=r.$action||"merge";i==="merge"?a?(We(a,n,!0),Eo(a,n,{ignoreSize:!0}),h7(r,a),rx(r,a),rx(r,a,"shape"),rx(r,a,"style"),rx(r,a,"extra"),r.clipPath=a.clipPath):e[t]=n:i==="replace"?e[t]=n:i==="remove"&&a&&(e[t]=null)}var wZ=["transition","enterFrom","leaveTo"],gxe=wZ.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function rx(e,t,r){if(r&&(!e[r]&&t[r]&&(e[r]={}),e=e[r],t=t[r]),!(!e||!t))for(var n=r?wZ:gxe,a=0;a=0;c--){var h=a[c],d=Ir(h.id,null),v=d!=null?o.get(d):null;if(v){var g=v.parent,x=Ha(g),_=g===i?{width:s,height:l}:{width:x.width,height:x.height},w={},S=G1(v,h,_,null,{hv:h.hv,boundingMode:h.bounding},w);if(!Ha(v).isNew&&S){for(var C=h.transition,M={},A=0;A=0)?M[I]=k:v[I]=k}mt(v,M,r,0)}else v.attr(w)}}},t.prototype._clear=function(){var r=this,n=this._elMap;n.each(function(a){Jx(a,Ha(a).option,n,r._lastGraphicModel)}),this._elMap=pe()},t.prototype.dispose=function(){this._clear()},t.type="graphic",t}(Rt);function qA(e){var t=ge(s4,e)?s4[e]:Fg(e),r=new t({});return Ha(r).type=e,r}function l4(e,t,r,n){var a=qA(r);return t.add(a),n.set(e,a),Ha(a).id=e,Ha(a).isNew=!0,a}function Jx(e,t,r,n){var a=e&&e.parent;a&&(e.type==="group"&&e.traverse(function(i){Jx(i,t,r,n)}),fw(e,t,n),r.removeKey(Ha(e).id))}function u4(e,t,r,n){e.isGroup||j([["cursor",ai.prototype.cursor],["zlevel",n||0],["z",r||0],["z2",0]],function(a){var i=a[0];ge(t,i)?e[i]=_e(t[i],a[1]):e[i]==null&&(e[i]=a[1])}),j(at(t),function(a){if(a.indexOf("on")===0){var i=t[a];e[a]=Me(i)?i:null}}),ge(t,"draggable")&&(e.draggable=t.draggable),t.name!=null&&(e.name=t.name),t.id!=null&&(e.id=t.id)}function _xe(e){return e=te({},e),j(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(s7),function(t){delete e[t]}),e}function bxe(e,t,r){var n=Ee(e).eventData;!e.silent&&!e.ignore&&!n&&(n=Ee(e).eventData={componentType:"graphic",componentIndex:t.componentIndex,name:e.name}),n&&(n.info=r.info)}function wxe(e){e.registerComponentModel(yxe),e.registerComponentView(xxe),e.registerPreprocessor(function(t){var r=t.graphic;ne(r)?!r[0]||!r[0].elements?t.graphic=[{elements:r}]:t.graphic=[t.graphic[0]]:r&&!r.elements&&(t.graphic=[{elements:[r]}])})}var c4=["x","y","radius","angle","single"],Sxe=Ze(),Cxe=["cartesian2d","polar","singleAxis"];function Txe(e){var t=e.get("coordinateSystem");return Ve(Cxe,t)>=0}function ml(e){return e+"Axis"}function Mxe(e,t){var r=pe(),n=[],a=pe();e.eachComponent({mainType:"dataZoom",query:t},function(c){a.get(c.uid)||s(c)});var i;do i=!1,e.eachComponent("dataZoom",o);while(i);function o(c){!a.get(c.uid)&&l(c)&&(s(c),i=!0)}function s(c){a.set(c.uid,!0),n.push(c),u(c)}function l(c){var h=!1;return c.eachTargetAxis(function(d,v){var g=r.get(d);g&&g[v]&&(h=!0)}),h}function u(c){c.eachTargetAxis(function(h,d){(r.get(h)||r.set(h,[]))[d]=!0})}return n}function SZ(e){var t=e.ecModel,r={infoList:[],infoMap:pe()};return e.eachTargetAxis(function(n,a){var i=t.getComponent(ml(n),a);if(i){var o=i.getCoordSysModel();if(o){var s=o.uid,l=r.infoMap.get(s);l||(l={model:o,axisModels:[]},r.infoList.push(l),r.infoMap.set(s,l)),l.axisModels.push(i)}}}),r}function CZ(e){var t=Sxe(iU(e));return t.axisProxyMap||(t.axisProxyMap=pe())}function zb(e){if(e)return CZ(e.ecModel).get(e.uid)}function Axe(e,t){CZ(e.ecModel).set(e.uid,t)}function TZ(e,t){var r=t.getAxisModel().axis.__alignTo;return r&&e.getAxisProxy(r.dim,r.model.componentIndex)?zb(r.model):null}var LT=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},e}(),vm=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._autoThrottle=!0,r._noTarget=!0,r._rangePropMode=["percent","percent"],r}return t.prototype.init=function(r,n,a){var i=h4(r);this.settledOption=i,this.mergeDefaultAndTheme(r,a),this._doInit(i)},t.prototype.mergeOption=function(r){var n=h4(r);We(this.option,r,!0),We(this.settledOption,n,!0),this._doInit(n)},t.prototype._doInit=function(r){var n=this.option;this._setDefaultThrottle(r),this._updateRangeUse(r);var a=this.settledOption;j([["start","startValue"],["end","endValue"]],function(i,o){this._rangePropMode[o]==="value"&&(n[i[0]]=a[i[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var r=this.get("orient",!0),n=this._targetAxisInfoMap=pe(),a=this._fillSpecifiedTargetAxis(n);a?this._orient=r||this._makeAutoOrientByTargetAxis():(this._orient=r||"horizontal",this._fillAutoTargetAxisByOrient(n,this._orient)),this._noTarget=!0,n.each(function(i){i.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(r){var n=!1;return j(c4,function(a){var i=this.getReferringComponents(ml(a),vte);if(i.specified){n=!0;var o=new LT;j(i.models,function(s){o.add(s.componentIndex)}),r.set(a,o)}},this),n},t.prototype._fillAutoTargetAxisByOrient=function(r,n){var a=this.ecModel,i=!0;if(i){var o=n==="vertical"?"y":"x",s=a.findComponents({mainType:o+"Axis"});l(s,o)}if(i){var s=a.findComponents({mainType:"singleAxis",filter:function(c){return c.get("orient",!0)===n}});l(s,"single")}function l(u,c){var h=u[0];if(h){var d=new LT;if(d.add(h.componentIndex),r.set(c,d),i=!1,c==="x"||c==="y"){var v=h.getReferringComponents("grid",sr).models[0];v&&j(u,function(g){h.componentIndex!==g.componentIndex&&v===g.getReferringComponents("grid",sr).models[0]&&d.add(g.componentIndex)})}}}i&&j(c4,function(u){if(i){var c=a.findComponents({mainType:ml(u),filter:function(d){return d.get("type",!0)==="category"}});if(c[0]){var h=new LT;h.add(c[0].componentIndex),r.set(u,h),i=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var r;return this.eachTargetAxis(function(n){!r&&(r=n)},this),r==="y"?"vertical":"horizontal"},t.prototype._setDefaultThrottle=function(r){if(r.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var n=this.ecModel.option;this.option.throttle=n.animation&&n.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(r){var n=this._rangePropMode,a=this.get("rangeMode");j([["start","startValue"],["end","endValue"]],function(i,o){var s=r[i[0]]!=null,l=r[i[1]]!=null;s&&!l?n[o]="percent":!s&&l?n[o]="value":a?n[o]=a[o]:s&&(n[o]="percent")})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var r;return this.eachTargetAxis(function(n,a){r==null&&(r=this.ecModel.getComponent(ml(n),a))},this),r},t.prototype.eachTargetAxis=function(r,n){this._targetAxisInfoMap.each(function(a,i){j(a.indexList,function(o){r.call(n,i,o)})})},t.prototype.getAxisProxy=function(r,n){return zb(this.getAxisModel(r,n))},t.prototype.getAxisModel=function(r,n){var a=this._targetAxisInfoMap.get(r);if(a&&a.indexMap[n])return this.ecModel.getComponent(ml(r),n)},t.prototype.setRawRange=function(r){var n=this.option,a=this.settledOption;j([["start","startValue"],["end","endValue"]],function(i){(r[i[0]]!=null||r[i[1]]!=null)&&(n[i[0]]=a[i[0]]=r[i[0]],n[i[1]]=a[i[1]]=r[i[1]])},this),this._updateRangeUse(r)},t.prototype.setCalculatedRange=function(r){var n=this.option;j(["start","startValue","end","endValue"],function(a){n[a]=r[a]})},t.prototype.getPercentRange=function(){var r=this.findRepresentativeAxisProxy();if(r)return r.getWindow().percent},t.prototype.getValueRange=function(r,n){if(r==null&&n==null){var a=this.findRepresentativeAxisProxy();if(a)return a.getWindow().value}else return this.getAxisProxy(r,n).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(r){if(r)return zb(r);for(var n,a=this._targetAxisInfoMap.keys(),i=0;io[1];if(w&&!S&&!C)return!0;w&&(y=!0),S&&(g=!0),C&&(m=!0)}return y&&g&&m})}else j(c,function(v){if(i==="empty")l.setData(u=u.map(v,function(m){return s(m)?m:NaN}));else{var g={};g[v]=o,u.selectRange(g)}});j(c,function(v){u.setApproximateExtent(o,v)})}});function s(l){return l>=o[0]&&l<=o[1]}},e.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},r=this._dataZoomModel,n=this._extent;j(["min","max"],function(a){var i=r.get(a+"Span"),o=r.get(a+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?i=xt(n[0]+o,n,[0,100],!0):i!=null&&(o=xt(i,[0,100],n,!0)-n[0]),t[a+"Span"]=i,t[a+"ValueSpan"]=o},this)},e}(),Ixe={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(a){e.eachComponent("dataZoom",function(i){i.eachTargetAxis(function(o,s){var l=e.getComponent(ml(o),s);a(o,s,l,i)})})}var r=[];t(function(a,i,o,s){if(!zb(o)){var l=new Lxe(a,i,s,e);r.push(l),Axe(o,l)}});var n=pe();return j(r,function(a){j(a.getTargetSeriesModels(),function(i){n.set(i.uid,i)})}),n},overallReset:function(e,t){e.eachComponent("dataZoom",function(r){var n=[];r.eachTargetAxis(function(a,i){var o=r.getAxisProxy(a,i),s=TZ(r,o);s?n.push([o,s]):o.reset(r,null)}),j(n,function(a){a[0].reset(r,a[1].getWindow().percentInverted)}),r.eachTargetAxis(function(a,i){r.getAxisProxy(a,i).filterData(r,t)})}),e.eachComponent("dataZoom",function(r){var n=r.findRepresentativeAxisProxy();if(n){var a=n.getWindow(),i=a.percent,o=a.value;r.setCalculatedRange({start:i[0],end:i[1],startValue:o[0],endValue:o[1]})}})}};function Pxe(e){e.registerAction("dataZoom",function(t,r){var n=Mxe(r,t);j(n,function(a){a.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})})}var Dxe=Fd();function uP(e){Dxe(e,function(){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,Ixe),Pxe(e),e.registerSubTypeDefaulter("dataZoom",function(){return"slider"})})}function Exe(e){e.registerComponentModel(Nxe),e.registerComponentView(kxe),uP(e)}var Co=function(){function e(){}return e}(),MZ={};function pf(e,t){MZ[e]=t}function AZ(e){return MZ[e]}var jxe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n,a){var i=a.getTheme().get("toolbox"),o=i?i.feature:null;o&&(this._themeFeatureOption=te({},o),i.feature={}),e.prototype.init.call(this,r,n,a),o&&(i.feature=o)},t.prototype.optionUpdated=function(){j(this.option.feature,function(r,n){var a=this._themeFeatureOption,i=AZ(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(this.ecModel)),a&&a[n]&&(We(r,a[n]),a[n]=null),We(r,i.defaultOption))},this)},t.type="toolbox",t.layoutMode={type:"box",ignoreSize:!0},t.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:K.size.m,itemSize:15,itemGap:K.size.s,showTitle:!0,iconStyle:{borderColor:K.color.accent50,color:"none"},emphasis:{iconStyle:{borderColor:K.color.accent70}},tooltip:{show:!1,position:"bottom"}},t}(Qe);function NZ(e,t){var r=Xd(t.get("padding")),n=t.getItemStyle(["color","opacity"]);n.fill=t.get("backgroundColor");var a=new Ke({shape:{x:e.x-r[3],y:e.y-r[0],width:e.width+r[1]+r[3],height:e.height+r[0]+r[2],r:t.get("borderRadius")},style:n,silent:!0,z2:-1});return a}var Rxe=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a,i){var o=this.group;if(o.removeAll(),!r.get("show"))return;var s=+r.get("itemSize"),l=r.get("orient")==="vertical",u=r.get("feature")||{},c=this._features||(this._features=pe()),h=[];j(u,function(_,w){h.push(w)}),new ks(this._featureNames||[],h).add(d).update(d).remove(Xe(d,null)).execute(),this._featureNames=wt(h,function(_){return c.hasKey(_)});function d(_,w){var S=_!=null&&w==null,C=_!=null&&w!=null,M=_==null,A=S||C?h[_]:h[w],I=u[A],k=S||C?new tt(I,r,n):null,P=k&&k.get("show"),D;if(S){if(!P)return;if(Oxe(A))D={onclick:k.option.onclick,featureName:A};else{var z=AZ(A);if(!z)return;D=new z}c.set(A,D)}else D=c.get(A);if(M||!P){f4(D)&&D.dispose&&D.dispose(n,a),c.removeKey(A);return}i&&i.newTitle!=null&&i.featureName===A&&(I.title=i.newTitle),S&&(D.uid=dh("toolbox-feature")),D.model=k,D.ecModel=n,D.api=a,v(k,D,A),k.setIconStatus=function(E,B){var H=this.option,V=this.iconPaths;H.iconStatus=H.iconStatus||{},H.iconStatus[E]=B,V[E]&&(B==="emphasis"?As:Ns)(V[E])},f4(D)&&D.render&&D.render(k,n,a,i)}function v(_,w,S){var C=_.getModel("iconStyle"),M=_.getModel(["emphasis","iconStyle"]),A=w instanceof Co&&w.getIcons?w.getIcons():_.get("icon"),I=_.get("title")||{},k,P;ue(A)?(k={},k[S]=A):k=A,ue(I)?(P={},P[S]=I):P=I;var D=_.iconPaths={};j(k,function(z,E){var B=$d(z,{},{x:-s/2,y:-s/2,width:s,height:s});B.setStyle(C.getItemStyle());var H=B.ensureState("emphasis");H.style=M.getItemStyle();var V=new ht({style:{text:P[E],align:M.get("textAlign"),borderRadius:M.get("textBorderRadius"),padding:M.get("textPadding"),fill:null,font:iL({fontStyle:M.get("textFontStyle"),fontFamily:M.get("textFontFamily"),fontSize:M.get("textFontSize"),fontWeight:M.get("textFontWeight")},n)},ignore:!0});B.setTextContent(V),Os({el:B,componentModel:r,itemName:E,formatterParamsExtra:{title:P[E]}}),B.__title=P[E],B.on("mouseover",function(){var U=M.getItemStyle(),F=l?r.get("right")==null&&r.get("left")!=="right"?"right":"left":r.get("bottom")==null&&r.get("top")!=="bottom"?"bottom":"top";V.setStyle({fill:M.get("textFill")||U.fill||U.stroke||K.color.neutral99,backgroundColor:M.get("textBackgroundColor")}),B.setTextConfig({position:M.get("textPosition")||F}),V.ignore=!r.get("showTitle"),a.enterEmphasis(this)}).on("mouseout",function(){_.get(["iconStatus",E])!=="emphasis"&&a.leaveEmphasis(this),V.hide()}),(_.get(["iconStatus",E])==="emphasis"?As:Ns)(B),o.add(B),B.on("click",ve(w.onclick,w,n,a,E)),D[E]=B})}var g=jr(r,a).refContainer,m=r.getBoxLayoutParams(),y=r.get("padding"),x=Zt(m,g,y);xc(r.get("orient"),o,r.get("itemGap"),x.width,x.height),G1(o,m,g,y),o.add(NZ(o.getBoundingRect(),r)),l||o.eachChild(function(_){var w=_.__title,S=_.ensureState("emphasis"),C=S.textConfig||(S.textConfig={}),M=_.getTextContent(),A=M&&M.ensureState("emphasis");if(A&&!Me(A)&&w){var I=A.style||(A.style={}),k=C1(w,ht.makeFont(I)),P=_.x+o.x,D=_.y+o.y+s,z=!1;D+k.height>a.getHeight()&&(C.position="top",z=!0);var E=z?-5-k.height:s+10;P+k.width/2>a.getWidth()?(C.position=["100%",E],I.align="right"):P-k.width/2<0&&(C.position=[0,E],I.align="left")}})},t.prototype.updateView=function(r,n,a,i){j(this._features,function(o){o&&o instanceof Co&&o.updateView&&o.updateView(o.model,n,a,i)})},t.prototype.dispose=function(r,n){j(this._features,function(a){a&&a instanceof Co&&a.dispose&&a.dispose(r,n)})},t.type="toolbox",t}(Rt);function Oxe(e){return e.indexOf("my")===0}function f4(e){return e instanceof Co}var zxe=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){var a=this.model,i=a.get("name")||r.get("title.0.text")||"echarts",o=n.getZr().painter.getType()==="svg",s=o?"svg":a.get("type",!0)||"png",l=n.getConnectedDataURL({type:s,backgroundColor:a.get("backgroundColor",!0)||r.get("backgroundColor")||K.color.neutral00,connectedBackgroundColor:a.get("connectedBackgroundColor"),excludeComponents:a.get("excludeComponents"),pixelRatio:a.get("pixelRatio")}),u=ot.browser;if(typeof MouseEvent=="function"&&(u.newEdge||!u.ie&&!u.edge)){var c=document.createElement("a");c.download=i+"."+s,c.target="_blank",c.href=l;var h=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(h)}else if(window.navigator.msSaveOrOpenBlob||o){var d=l.split(","),v=d[0].indexOf("base64")>-1,g=o?decodeURIComponent(d[1]):d[1];v&&(g=window.atob(g));var m=i+"."+s;if(window.navigator.msSaveOrOpenBlob){for(var y=g.length,x=new Uint8Array(y);y--;)x[y]=g.charCodeAt(y);var _=new Blob([x]);window.navigator.msSaveOrOpenBlob(_,m)}else{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow,C=S.document;C.open("image/svg+xml","replace"),C.write(g),C.close(),S.focus(),C.execCommand("SaveAs",!0,m),document.body.removeChild(w)}}else{var M=a.get("lang"),A='',I=window.open();I.document.write(A),I.document.title=i}},t.getDefaultOption=function(r){var n={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:r.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:K.color.neutral00,name:"",excludeComponents:["toolbox"],lang:r.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return n},t}(Co),d4="__ec_magicType_stack__",Bxe=[["line","bar"],["stack"]],Fxe=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getIcons=function(){var r=this.model,n=r.get("icon"),a={};return j(r.get("type"),function(i){n[i]&&(a[i]=n[i])}),a},t.getDefaultOption=function(r){var n={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:r.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return n},t.prototype.onclick=function(r,n,a){var i=this.model,o=i.get(["seriesIndex",a]);if(v4[a]){var s={series:[]},l=function(h){var d=h.subType,v=h.id,g=v4[a](d,v,h,i);g&&(Le(g,h.option),s.series.push(g));var m=h.coordinateSystem;if(m&&m.type==="cartesian2d"&&(a==="line"||a==="bar")){var y=m.getAxesByScale("ordinal")[0];if(y){var x=y.dim,_=x+"Axis",w=h.getReferringComponents(_,sr).models[0],S=w.componentIndex;s[_]=s[_]||[];for(var C=0;C<=S;C++)s[_][S]=s[_][S]||{};s[_][S].boundaryGap=a==="bar"}}};j(Bxe,function(h){Ve(h,a)>=0&&j(h,function(d){i.setIconStatus(d,"normal")})}),i.setIconStatus(a,"emphasis"),r.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,c=a;a==="stack"&&(u=We({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),i.get(["iconStatus",a])!=="emphasis"&&(c="tiled")),n.dispatchAction({type:"changeMagicType",currentType:c,newOption:s,newTitle:u,featureName:"magicType"})}},t}(Co),v4={line:function(e,t,r,n){if(e==="bar")return We({id:t,type:"line",data:r.get("data"),stack:r.get("stack"),markPoint:r.get("markPoint"),markLine:r.get("markLine")},n.get(["option","line"])||{},!0)},bar:function(e,t,r,n){if(e==="line")return We({id:t,type:"bar",data:r.get("data"),stack:r.get("stack"),markPoint:r.get("markPoint"),markLine:r.get("markLine")},n.get(["option","bar"])||{},!0)},stack:function(e,t,r,n){var a=r.get("stack")===d4;if(e==="line"||e==="bar")return n.setIconStatus("stack",a?"normal":"emphasis"),We({id:t,stack:a?"":d4},n.get(["option","stack"])||{},!0)}};zi({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(e,t){t.mergeOption(e.newOption)});var dw=new Array(60).join("-"),Ad=" ";function Vxe(e){var t={},r=[],n=[];return e.eachRawSeries(function(a){var i=a.coordinateSystem;if(i&&(i.type==="cartesian2d"||i.type==="polar")){var o=i.getBaseAxis();if(o.type==="category"){var s=Sce(o);t[s]||(t[s]={categoryAxis:o,valueAxis:i.getOtherAxis(o),series:[]},n.push({axisDim:o.dim,axisIndex:o.index})),t[s].series.push(a)}else r.push(a)}else r.push(a)}),{seriesGroupByCategoryAxis:t,other:r,meta:n}}function Gxe(e){var t=[];return j(e,function(r,n){var a=r.categoryAxis,i=r.valueAxis,o=i.dim,s=[" "].concat(oe(r.series,function(v){return v.name})),l=[a.model.getCategories()];j(r.series,function(v){var g=v.getRawData();l.push(v.getRawData().mapArray(g.mapDimension(o),function(m){return m}))});for(var u=[s.join(Ad)],c=0;c=0)return!0}var KA=new RegExp("["+Ad+"]+","g");function Zxe(e){for(var t=e.split(/\n+/g),r=Bb(t.shift()).split(KA),n=[],a=oe(r,function(l){return{name:l,data:[]}}),i=0;i=0;i--){var o=r[i];if(o[a])break}if(i<0){var s=e.queryComponents({mainType:"dataZoom",subType:"select",id:a})[0];if(s){var l=s.getPercentRange();r[0][a]={dataZoomId:a,start:l[0],end:l[1]}}}}),r.push(t)}function Jxe(e){var t=cP(e),r=t[t.length-1];t.length>1&&t.pop();var n={};return kZ(r,function(a,i){for(var o=t.length-1;o>=0;o--)if(a=t[o][i],a){n[i]=a;break}}),n}function Qxe(e){LZ(e).snapshots=null}function e_e(e){return cP(e).length}function cP(e){var t=LZ(e);return t.snapshots||(t.snapshots=[{}]),t.snapshots}var t_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){Qxe(r),n.dispatchAction({type:"restore",from:this.uid})},t.getDefaultOption=function(r){var n={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:r.getLocaleModel().get(["toolbox","restore","title"])};return n},t}(Co);zi({type:"restore",event:"restore",update:"prepareAndUpdate"},function(e,t){t.resetOption("recreate")});var r_e=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],hP=function(){function e(t,r,n){var a=this;this._targetInfoList=[];var i=p4(r,t);j(n_e,function(o,s){(!n||!n.include||Ve(n.include,s)>=0)&&o(i,a._targetInfoList)})}return e.prototype.setOutputRanges=function(t,r){return this.matchOutputRanges(t,r,function(n,a,i){if((n.coordRanges||(n.coordRanges=[])).push(a),!n.coordRange){n.coordRange=a;var o=IT[n.brushType](0,i,a);n.__rangeOffset={offset:x4[n.brushType](o.values,n.range,[1,1]),xyMinMax:o.xyMinMax}}}),t},e.prototype.matchOutputRanges=function(t,r,n){j(t,function(a){var i=this.findTargetInfo(a,r);i&&i!==!0&&j(i.coordSyses,function(o){var s=IT[a.brushType](1,o,a.range,!0);n(a,s.values,o,r)})},this)},e.prototype.setInputRanges=function(t,r){j(t,function(n){var a=this.findTargetInfo(n,r);if(n.range=n.range||[],a&&a!==!0){n.panelId=a.panelId;var i=IT[n.brushType](0,a.coordSys,n.coordRange),o=n.__rangeOffset;n.range=o?x4[n.brushType](i.values,o.offset,a_e(i.xyMinMax,o.xyMinMax)):i.values}},this)},e.prototype.makePanelOpts=function(t,r){return oe(this._targetInfoList,function(n){var a=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:r?r(n):null,clipPath:R9(a),isTargetByCursor:z9(a,t,n.coordSysModel),getLinearBrushOtherExtent:O9(a)}})},e.prototype.controlSeries=function(t,r,n){var a=this.findTargetInfo(t,n);return a===!0||a&&Ve(a.coordSyses,r.coordinateSystem)>=0},e.prototype.findTargetInfo=function(t,r){for(var n=this._targetInfoList,a=p4(r,t),i=0;ie[1]&&e.reverse(),e}function p4(e,t){return Wf(e,t,{includeMainTypes:r_e})}var n_e={grid:function(e,t){var r=e.xAxisModels,n=e.yAxisModels,a=e.gridModels,i=pe(),o={},s={};!r&&!n&&!a||(j(r,function(l){var u=l.axis.grid.model;i.set(u.id,u),o[u.id]=!0}),j(n,function(l){var u=l.axis.grid.model;i.set(u.id,u),s[u.id]=!0}),j(a,function(l){i.set(l.id,l),o[l.id]=!0,s[l.id]=!0}),i.each(function(l){var u=l.coordinateSystem,c=[];j(u.getCartesians(),function(h,d){(Ve(r,h.getAxis("x").model)>=0||Ve(n,h.getAxis("y").model)>=0)&&c.push(h)}),t.push({panelId:"grid--"+l.id,gridModel:l,coordSysModel:l,coordSys:c[0],coordSyses:c,getPanelRect:m4.grid,xAxisDeclared:o[l.id],yAxisDeclared:s[l.id]})}))},geo:function(e,t){j(e.geoModels,function(r){var n=r.coordinateSystem;t.push({panelId:"geo--"+r.id,geoModel:r,coordSysModel:r,coordSys:n,coordSyses:[n],getPanelRect:m4.geo})})}},g4=[function(e,t){var r=e.xAxisModel,n=e.yAxisModel,a=e.gridModel;return!a&&r&&(a=r.axis.grid.model),!a&&n&&(a=n.axis.grid.model),a&&a===t.gridModel},function(e,t){var r=e.geoModel;return r&&r===t.geoModel}],m4={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys.view,t=jW(null,e);return nG(t,t,wb(null,e)),t}},IT={lineX:Xe(y4,0),lineY:Xe(y4,1),rect:function(e,t,r,n){var a=e?t.pointToData([r[0][0],r[1][0]],n):t.dataToPoint([r[0][0],r[1][0]],n),i=e?t.pointToData([r[0][1],r[1][1]],n):t.dataToPoint([r[0][1],r[1][1]],n),o=[JA([a[0],i[0]]),JA([a[1],i[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,r,n){var a=[sn(),sn()],i=oe(r,function(o){var s=e?t.pointToData(o,n):t.dataToPoint(o,n);return a[0][0]=Math.min(a[0][0],s[0]),a[1][0]=Math.min(a[1][0],s[1]),a[0][1]=Math.max(a[0][1],s[0]),a[1][1]=Math.max(a[1][1],s[1]),s});return{values:i,xyMinMax:a}}};function y4(e,t,r,n){var a=r.getAxis(["x","y"][e]),i=JA(oe([0,1],function(s){return t?a.coordToData(a.toLocalCoord(n[s]),!0):a.toGlobalCoord(a.dataToCoord(n[s]))})),o=[];return o[e]=i,o[1-e]=[NaN,NaN],{values:i,xyMinMax:o}}var x4={lineX:Xe(_4,0),lineY:Xe(_4,1),rect:function(e,t,r){return[[e[0][0]-r[0]*t[0][0],e[0][1]-r[0]*t[0][1]],[e[1][0]-r[1]*t[1][0],e[1][1]-r[1]*t[1][1]]]},polygon:function(e,t,r){return oe(e,function(n,a){return[n[0]-r[0]*t[a][0],n[1]-r[1]*t[a][1]]})}};function _4(e,t,r,n){return[t[0]-n[e]*r[0],t[1]-n[e]*r[1]]}function a_e(e,t){var r=b4(e),n=b4(t),a=[r[0]/n[0],r[1]/n[1]];return isNaN(a[0])&&(a[0]=1),isNaN(a[1])&&(a[1]=1),a}function b4(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var QA=j,i_e=ute("toolbox-dataZoom_"),o_e={x:"width",y:"height"},s_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a,i){this._brushController||(this._brushController=new EI(a.getZr()),this._brushController.on("brush",ve(this._onBrush,this)).mount()),c_e(r,n,this,i,a),u_e(r,n)},t.prototype.onclick=function(r,n,a){l_e[a].call(this)},t.prototype.dispose=function(r,n){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(r){var n=r.areas;if(!r.isEnd||!n.length)return;var a={},i=this.ecModel;this._brushController.updateCovers([]);var o=new hP(fP(this.model),i,{include:["grid"]});o.matchOutputRanges(n,i,function(u,c,h){if(h.type==="cartesian2d"){var d=h.master.getRect().clone(),v=u.brushType;v==="rect"?(s("x",h,d,c[0]),s("y",h,d,c[1])):s({lineX:"x",lineY:"y"}[v],h,d,c)}}),Kxe(i,a),this._dispatchZoomAction(a);function s(u,c,h,d){var v=c.getAxis(u),g=v.model,m=l(u,g,i),y=m.findRepresentativeAxisProxy(g).getMinMaxSpan(),x=v.scale.getExtent();(y.minValueSpan!=null||y.maxValueSpan!=null)&&(d=Ul(0,d.slice(),x,0,y.minValueSpan,y.maxValueSpan));var _=Dk(x,h[o_e[u]],.5);m&&(a[m.id]={dataZoomId:m.id,startValue:isFinite(_)?gt(d[0],_):d[0],endValue:isFinite(_)?gt(d[1],_):d[1]})}function l(u,c,h){var d;return h.eachComponent({mainType:"dataZoom",subType:"select"},function(v){var g=v.getAxisModel(u,c.componentIndex);g&&(d=v)}),d}},t.prototype._dispatchZoomAction=function(r){var n=[];QA(r,function(a,i){n.push(Te(a))}),n.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:n})},t.getDefaultOption=function(r){var n={show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:r.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:K.color.backgroundTint}};return n},t}(Co),l_e={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(Jxe(this.ecModel))}};function fP(e){var t={xAxisIndex:e.get("xAxisIndex",!0),yAxisIndex:e.get("yAxisIndex",!0),xAxisId:e.get("xAxisId",!0),yAxisId:e.get("yAxisId",!0)};return t.xAxisIndex==null&&t.xAxisId==null&&(t.xAxisIndex="all"),t.yAxisIndex==null&&t.yAxisId==null&&(t.yAxisIndex="all"),t}function u_e(e,t){e.setIconStatus("back",e_e(t)>1?"emphasis":"normal")}function c_e(e,t,r,n,a){var i=r._isZoomActive;n&&n.type==="takeGlobalCursor"&&(i=n.key==="dataZoomSelect"?n.dataZoomSelectActive:!1),r._isZoomActive=i,e.setIconStatus("zoom",i?"emphasis":"normal");var o=new hP(fP(e),t,{include:["grid"]}),s=o.makePanelOpts(a,function(l){return l.xAxisDeclared&&!l.yAxisDeclared?"lineX":!l.xAxisDeclared&&l.yAxisDeclared?"lineY":"rect"});r._brushController.setPanels(s).enableBrush(i&&s.length?{brushType:"auto",brushStyle:e.getModel("brushStyle").getItemStyle()}:!1)}Kne("dataZoom",function(e){var t=e.getComponent("toolbox",0),r=["feature","dataZoom"];if(!t||t.get(r)==null)return;var n=t.getModel(r),a=[],i=fP(n),o=Wf(e,i);QA(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),QA(o.yAxisModels,function(l){return s(l,"yAxis","yAxisIndex")});function s(l,u,c){var h=l.componentIndex,d={type:"select",$fromToolbox:!0,filterMode:n.get("filterMode",!0)||"filter",id:i_e+u+h};d[c]=h,a.push(d)}return a});function h_e(e){e.registerComponentModel(jxe),e.registerComponentView(Rxe),pf("saveAsImage",zxe),pf("magicType",Fxe),pf("dataView",Xxe),pf("dataZoom",s_e),pf("restore",t_e),$e(Exe)}var f_e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="tooltip",t.dependencies=["axisPointer"],t.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click|mousewheel",alwaysShowContent:!1,renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:K.color.neutral00,shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:K.color.border,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:K.color.borderShade,width:1,type:"dashed",textStyle:{}}},textStyle:{color:K.color.tertiary,fontSize:14}},t}(Qe);function IZ(e){var t=e.get("confine");return t!=null?!!t:e.get("renderMode")==="richText"}function PZ(e){if(ot.domSupported){for(var t=document.documentElement.style,r=0,n=e.length;r-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=i==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=i==="top"?225:45)+"deg)");var c=u*Math.PI/180,h=o+a,d=h*Math.abs(Math.cos(c))+h*Math.abs(Math.sin(c)),v=Math.round(((d-Math.SQRT2*a)/2+Math.SQRT2*a-(d-h)/2)*100)/100;s+=";"+i+":-"+v+"px";var g=t+" solid "+a+"px;",m=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+g,"border-right:"+g,"background-color:"+n+";"];return'
'}function x_e(e,t,r){var n="cubic-bezier(0.23,1,0.32,1)",a="",i="";return r&&(a=" "+e/2+"s "+n,i="opacity"+a+",visibility"+a),t||(a=" "+e+"s "+n,i+=(i.length?",":"")+(ot.transformSupported?""+dP+a:",left"+a+",top"+a)),p_e+":"+i}function w4(e,t,r){var n=e.toFixed(0)+"px",a=t.toFixed(0)+"px";if(!ot.transformSupported)return r?"top:"+a+";left:"+n+";":[["top",a],["left",n]];var i=ot.transform3dSupported,o="translate"+(i?"3d":"")+"("+n+","+a+(i?",0":"")+")";return r?"top:0;left:0;"+dP+":"+o+";":[["top",0],["left",0],[DZ,o]]}function __e(e){var t=[],r=e.get("fontSize"),n=e.getTextColor();n&&t.push("color:"+n),t.push("font:"+e.getFont());var a=_e(e.get("lineHeight"),Math.round(r*3/2));r&&t.push("line-height:"+a+"px");var i=e.get("textShadowColor"),o=e.get("textShadowBlur")||0,s=e.get("textShadowOffsetX")||0,l=e.get("textShadowOffsetY")||0;return i&&o&&t.push("text-shadow:"+s+"px "+l+"px "+o+"px "+i),j(["decoration","align"],function(u){var c=e.get(u);c&&t.push("text-"+u+":"+c)}),t.join(";")}function b_e(e,t,r,n){var a=[],i=e.get("transitionDuration"),o=e.get("backgroundColor"),s=e.get("shadowBlur"),l=e.get("shadowColor"),u=e.get("shadowOffsetX"),c=e.get("shadowOffsetY"),h=e.getModel("textStyle"),d=H7(e,"html"),v=u+"px "+c+"px "+s+"px "+l;return a.push("box-shadow:"+v),t&&i>0&&a.push(x_e(i,r,n)),o&&a.push("background-color:"+o),j(["width","color","radius"],function(g){var m="border-"+g,y=yL(m),x=e.get(y);x!=null&&a.push(m+":"+x+(g==="color"?"":"px"))}),a.push(__e(h)),d!=null&&a.push("padding:"+Xd(d).join("px ")+"px"),a.join(";")+";"}function S4(e,t,r,n,a){var i=t&&t.painter;if(r){var o=i&&i.getViewportRoot();o&&SQ(e,o,r,n,a)}else{e[0]=n,e[1]=a;var s=i&&i.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var w_e=function(){function e(t,r){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,ot.wxa)return null;var n=document.createElement("div");n.domBelongToZr=!0,this.el=n;var a=this._zr=t.getZr(),i=r.appendTo,o=i&&(ue(i)?document.querySelector(i):Lc(i)?i:Me(i)&&i(t.getDom()));S4(this._styleCoord,a,o,t.getWidth()/2,t.getHeight()/2),(o||t.getDom()).appendChild(n),this._api=t,this._container=o;var s=this;n.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},n.onmousemove=function(l){if(l=l||window.event,!s._enterable){var u=a.handler,c=a.painter.getViewportRoot();Fa(c,l,!0),u.dispatch("mousemove",l)}},n.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return e.prototype.update=function(t){if(!this._container){var r=this._api.getDom(),n=v_e(r,"position"),a=r.style;a.position!=="absolute"&&n!=="absolute"&&(a.position="relative")}var i=t.get("alwaysShowContent");i&&this._moveIfResized(),this._alwaysShowContent=i,this._enableDisplayTransition=t.get("displayTransition")&&t.get("transitionDuration")>0,this.el.className=t.get("className")||""},e.prototype.show=function(t,r){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,a=n.style,i=this._styleCoord;n.innerHTML?a.cssText=g_e+b_e(t,!this._firstShow,this._longHide,this._enableDisplayTransition)+w4(i[0],i[1],!0)+("border-color:"+Fc(r)+";")+(t.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):a.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(t,r,n,a,i){var o=this.el;if(t==null){o.innerHTML="";return}var s="";if(ue(i)&&n.get("trigger")==="item"&&!IZ(n)&&(s=y_e(n,a,i)),ue(t))o.innerHTML=t+s;else if(t){o.innerHTML="",ne(t)||(t=[t]);for(var l=0;l=0?this._tryShow(i,o):a==="leave"&&this._hide(o))},this))},t.prototype._keepShow=function(){var r=this._tooltipModel,n=this._ecModel,a=this._api,i=r.get("triggerOn");if(r.get("trigger")!=="axis"&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&i!=="none"&&i!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!a.isDisposed()&&o.manuallyShowTip(r,n,a,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(r,n,a,i){if(!(i.from===this.uid||ot.node||!a.getDom())){var o=M4(i,a);this._ticket="";var s=i.dataByCoordSys,l=k_e(i,n,a);if(l){var u=l.el.getBoundingRect().clone();u.applyTransform(l.el.transform),this._tryShow({offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,target:l.el,position:i.position,positionDefault:"bottom"},o)}else if(i.tooltip&&i.x!=null&&i.y!=null){var c=C_e;c.x=i.x,c.y=i.y,c.update(),Ee(c).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:c},o)}else if(s)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:s,tooltipOption:i.tooltipOption},o);else if(i.seriesIndex!=null){if(this._manuallyAxisShowTip(r,n,a,i))return;var h=pZ(i,n),d=h.point[0],v=h.point[1];d!=null&&v!=null&&this._tryShow({offsetX:d,offsetY:v,target:h.el,position:i.position,positionDefault:"bottom"},o)}else i.x!=null&&i.y!=null&&(a.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:a.getZr().findHover(i.x,i.y).target},o))}},t.prototype.manuallyHideTip=function(r,n,a,i){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,i.from!==this.uid&&this._hide(M4(i,a))},t.prototype._manuallyAxisShowTip=function(r,n,a,i){var o=i.seriesIndex,s=i.dataIndex,l=n.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var u=n.getSeriesByIndex(o);if(u){var c=u.getData(),h=hp([c.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(h.get("trigger")==="axis")return a.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:i.position}),!0}}},t.prototype._tryShow=function(r,n){var a=r.target,i=this._tooltipModel;if(i){this._lastX=r.offsetX,this._lastY=r.offsetY;var o=r.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,r);else if(a){var s=Ee(a);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null,this._cbParamsList=null;var l,u;cc(a,function(c){if(c.tooltipDisabled)return l=u=null,!0;l||u||(Ee(c).dataIndex!=null?l=c:Ee(c).tooltipConfig!=null&&(u=c))},!0),l?this._showSeriesItemTooltip(r,l,n):u?this._showComponentItemTooltip(r,u,n):this._hide(n)}else this._lastDataByCoordSys=null,this._cbParamsList=null,this._hide(n)}},t.prototype._showOrMove=function(r,n){var a=r.get("showDelay");n=ve(n,this),clearTimeout(this._showTimout),a>0?this._showTimout=setTimeout(n,a):n()},t.prototype._showAxisTooltip=function(r,n){var a=this._ecModel,i=this._tooltipModel,o=[n.offsetX,n.offsetY],s=hp([n.tooltipOption],i),l=this._renderMode,u=[],c=Mr("section",{blocks:[],noHeader:!0}),h=[],d=new sC;j(r,function(_){j(_.dataByAxis,function(w){var S=a.getComponent(w.axisDim+"Axis",w.axisIndex),C=w.value,M=S.axis,A=M.scale.parse(C);if(!(!S||C==null)){var I=hZ(C,M,a,w.seriesDataIndices,w.valueLabelOpt),k=Mr("section",{header:I,noHeader:!_a(I),sortBlocks:!0,blocks:[]});c.blocks.push(k),j(w.seriesDataIndices,function(P){var D=a.getSeriesByIndex(P.seriesIndex),z=P.dataIndexInside,E=D.getDataParams(z);if(!(E.dataIndex<0)){E.axisDim=w.axisDim,E.axisIndex=w.axisIndex,E.axisType=w.axisType,E.axisId=w.axisId,E.axisValue=lb(S.axis,{value:A}),E.axisValueLabel=I,E.marker=d.makeTooltipMarker("item",Fc(E.color),l);var B=DR(D.formatTooltip(z,!0,null)),H=B.frag;if(H){var V=hp([D],i).get("valueFormatter");k.blocks.push(V?te({valueFormatter:V},H):H)}B.text&&h.push(B.text),u.push(E)}})}})}),c.blocks.reverse(),h.reverse();var v=n.position,g=s.get("order"),m=BR(c,d,l,g,a.get("useUTC"),s.get("textStyle"));m&&h.unshift(m);var y=l==="richText"?` - -`:"
",x=h.join(y);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(r,u)?this._updatePosition(s,v,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,x,u,Math.random()+"",o[0],o[1],v,null,d)})},t.prototype._showSeriesItemTooltip=function(r,n,a){var i=this._ecModel,o=Ee(n),s=o.seriesIndex,l=i.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,h=o.dataType,d=u.getData(h),v=this._renderMode,g=r.positionDefault,m=hp([d.getItemModel(c),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,g?{position:g}:null),y=m.get("trigger");if(!(y!=null&&y!=="item")){var x=u.getDataParams(c,h),_=new sC;x.marker=_.makeTooltipMarker("item",Fc(x.color),v);var w=DR(u.formatTooltip(c,!1,h)),S=m.get("order"),C=m.get("valueFormatter"),M=w.frag,A=M?BR(C?te({valueFormatter:C},M):M,_,v,S,i.get("useUTC"),m.get("textStyle")):w.text,I="item_"+u.name+"_"+c;this._showOrMove(m,function(){this._showTooltipContent(m,A,x,I,r.offsetX,r.offsetY,r.position,r.target,_)}),a({type:"showTip",dataIndexInside:c,dataIndex:d.getRawIndex(c),seriesIndex:s,from:this.uid})}},t.prototype._showComponentItemTooltip=function(r,n,a){var i=this._renderMode==="html",o=Ee(n),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(ue(l)){var c=l;l={content:c,formatter:c},u=!0}u&&i&&l.content&&(l=Te(l),l.content=Tn(l.content));var h=[l],d=this._ecModel.getComponent(o.componentMainType,o.componentIndex);d&&h.push(d),h.push({formatter:l.content});var v=r.positionDefault,g=hp(h,this._tooltipModel,v?{position:v}:null),m=g.get("content"),y=Math.random()+"",x=new sC;this._showOrMove(g,function(){var _=Te(g.get("formatterParams")||{});this._showTooltipContent(g,m,_,y,r.offsetX,r.offsetY,r.position,n,x)}),a({type:"showTip",from:this.uid})},t.prototype._showTooltipContent=function(r,n,a,i,o,s,l,u,c){if(this._ticket="",!(!r.get("showContent")||!r.get("show"))){var h=this._tooltipContent;h.setEnterable(r.get("enterable"));var d=r.get("formatter");l=l||r.get("position");var v=n,g=this._getNearestPoint([o,s],a,r.get("trigger"),r.get("borderColor"),r.get("defaultBorderColor",!0)),m=g.color;if(d)if(ue(d)){var y=r.ecModel.get("useUTC"),x=ne(a)?a[0]:a,_=x&&x.axisType&&x.axisType.indexOf("time")>=0;v=d,_&&(v=Rm(x.axisValue,v,y)),v=xL(v,a,!0)}else if(Me(d)){var w=ve(function(S,C){S===this._ticket&&(h.setContent(C,c,r,m,l),this._updatePosition(r,l,o,s,h,a,u))},this);this._ticket=i,v=d(a,i,w)}else v=d;h.setContent(v,c,r,m,l),h.show(r,m),this._updatePosition(r,l,o,s,h,a,u)}},t.prototype._getNearestPoint=function(r,n,a,i,o){if(a==="axis"||ne(n))return{color:i||o};if(!ne(n))return{color:i||n.color||n.borderColor}},t.prototype._updatePosition=function(r,n,a,i,o,s,l){var u=this._api.getWidth(),c=this._api.getHeight();n=n||r.get("position");var h=o.getSize(),d=r.get("align"),v=r.get("verticalAlign"),g=l&&l.getBoundingRect().clone();if(l&&g.applyTransform(l.transform),Me(n)&&(n=n([a,i],s,o.el,g,{viewSize:[u,c],contentSize:h.slice()})),ne(n))a=fe(n[0],u),i=fe(n[1],c);else if(Ie(n)){var m=n;m.width=h[0],m.height=h[1];var y=Zt(m,{width:u,height:c});a=y.x,i=y.y,d=null,v=null}else if(ue(n)&&l){var x=N_e(n,g,h,r.get("borderWidth"));a=x[0],i=x[1]}else{var x=M_e(a,i,o,u,c,d?null:20,v?null:20);a=x[0],i=x[1]}if(d&&(a-=A4(d)?h[0]/2:d==="right"?h[0]:0),v&&(i-=A4(v)?h[1]/2:v==="bottom"?h[1]:0),IZ(r)){var x=A_e(a,i,o,u,c);a=x[0],i=x[1]}o.moveTo(a,i)},t.prototype._updateContentNotChangedOnAxis=function(r,n){var a=this._lastDataByCoordSys,i=this._cbParamsList,o=!!a&&a.length===r.length;return o&&j(a,function(s,l){var u=s.dataByAxis||[],c=r[l]||{},h=c.dataByAxis||[];o=o&&u.length===h.length,o&&j(u,function(d,v){var g=h[v]||{},m=d.seriesDataIndices||[],y=g.seriesDataIndices||[];o=o&&d.value===g.value&&d.axisType===g.axisType&&d.axisId===g.axisId&&m.length===y.length,o&&j(m,function(x,_){var w=y[_];o=o&&x.seriesIndex===w.seriesIndex&&x.dataIndex===w.dataIndex}),i&&j(d.seriesDataIndices,function(x){var _=x.seriesIndex,w=n[_],S=i[_];w&&S&&S.data!==w.data&&(o=!1)})})}),this._lastDataByCoordSys=r,this._cbParamsList=n,!!o},t.prototype._hide=function(r){this._lastDataByCoordSys=null,this._cbParamsList=null,r({type:"hideTip",from:this.uid})},t.prototype.dispose=function(r,n){ot.node||!n.getDom()||(Ug(this,"_updatePosition"),this._tooltipContent.dispose(),WA("itemTooltip",n),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type="tooltip",t}(Rt);function hp(e,t,r){var n=t.ecModel,a;r?(a=new tt(r,n,n),a=new tt(t.option,a,n)):a=t;for(var i=e.length-1;i>=0;i--){var o=e[i];o&&(o instanceof tt&&(o=o.get("tooltip",!0)),ue(o)&&(o={formatter:o}),o&&(a=new tt(o,a,n)))}return a}function M4(e,t){return e.dispatchAction||ve(t.dispatchAction,t)}function M_e(e,t,r,n,a,i,o){var s=r.getSize(),l=s[0],u=s[1];return i!=null&&(e+l+i+2>n?e-=l+i:e+=i),o!=null&&(t+u+o>a?t-=u+o:t+=o),[e,t]}function A_e(e,t,r,n,a){var i=r.getSize(),o=i[0],s=i[1];return e=Math.min(e+o,n)-o,t=Math.min(t+s,a)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function N_e(e,t,r,n){var a=r[0],i=r[1],o=Math.ceil(Math.SQRT2*n)+8,s=0,l=0,u=t.width,c=t.height;switch(e){case"inside":s=t.x+u/2-a/2,l=t.y+c/2-i/2;break;case"top":s=t.x+u/2-a/2,l=t.y-i-o;break;case"bottom":s=t.x+u/2-a/2,l=t.y+c+o;break;case"left":s=t.x-a-o,l=t.y+c/2-i/2;break;case"right":s=t.x+u+o,l=t.y+c/2-i/2}return[s,l]}function A4(e){return e==="center"||e==="middle"}function k_e(e,t,r){var n=Bk(e).queryOptionMap,a=n.keys()[0];if(!(!a||a==="series")){var i=Bd(t,a,n.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),o=i.models[0];if(o){var s=r.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var c=Ee(u).tooltipConfig;if(c&&c.name===e.name)return l=u,!0}),l)return{componentMainType:a,componentIndex:o.componentIndex,el:l}}}}function L_e(e){$e(Ym),e.registerComponentModel(f_e),e.registerComponentView(T_e),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},ar),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},ar)}var I_e=["rect","polygon","keep","clear"];function P_e(e,t){var r=jt(e?e.brush:[]);if(r.length){var n=[];j(r,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(n=n.concat(u))});var a=e&&e.toolbox;ne(a)&&(a=a[0]),a||(a={feature:{}},e.toolbox=[a]);var i=a.feature||(a.feature={}),o=i.brush||(i.brush={}),s=o.type||(o.type=[]);s.push.apply(s,n),k1(s,function(l){return l+""},null),t&&!s.length&&s.push.apply(s,I_e)}}var N4=j;function k4(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function eN(e,t,r){var n={};return N4(t,function(i){var o=n[i]=a();N4(e[i],function(s,l){if(Gr.isValidType(l)){var u={type:l,visual:s};r&&r(u,i),o[l]=new Gr(u),l==="opacity"&&(u=Te(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new Gr(u))}})}),n;function a(){var i=function(){};i.prototype.__hidden=i.prototype;var o=new i;return o}}function jZ(e,t,r){var n;j(r,function(a){t.hasOwnProperty(a)&&k4(t[a])&&(n=!0)}),n&&j(r,function(a){t.hasOwnProperty(a)&&k4(t[a])?e[a]=Te(t[a]):delete e[a]})}function D_e(e,t,r,n,a,i){var o={};j(e,function(h){var d=Gr.prepareVisualTypes(t[h]);o[h]=d});var s;function l(h){return kL(r,s,h)}function u(h,d){Q7(r,s,h,d)}r.each(c);function c(h,d){s=h;var v=r.getRawDataItem(s);if(!(v&&v.visualMap===!1))for(var g=n.call(a,h),m=t[g],y=o[g],x=0,_=y.length;x<_;x++){var w=y[x];m[w]&&m[w].applyVisual(h,l,u)}}}function E_e(e,t,r,n){var a={};return j(e,function(i){var o=Gr.prepareVisualTypes(t[i]);a[i]=o}),{progress:function(o,s){var l;n!=null&&(l=s.getDimensionIndex(n));function u(C){return kL(s,h,C)}function c(C,M){Q7(s,h,C,M)}for(var h,d=s.getStore();(h=o.next())!=null;){var v=s.getRawDataItem(h);if(!(v&&v.visualMap===!1))for(var g=n!=null?d.get(l,h):h,m=r(g),y=t[m],x=a[m],_=0,w=x.length;_t[0][1]&&(t[0][1]=i[0]),i[1]t[1][1]&&(t[1][1]=i[1])}return t&&E4(t)}};function E4(e){return new ke(e[0][0],e[1][0],e[0][1]-e[0][0],e[1][1]-e[1][0])}var G_e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){this.ecModel=r,this.api=n,this.model,(this._brushController=new EI(n.getZr())).on("brush",ve(this._onBrush,this)).mount()},t.prototype.render=function(r,n,a,i){this.model=r,this._updateController(r,n,a,i)},t.prototype.updateTransform=function(r,n,a,i){RZ(n),this._updateController(r,n,a,i)},t.prototype.updateVisual=function(r,n,a,i){this.updateTransform(r,n,a,i)},t.prototype.updateView=function(r,n,a,i){this._updateController(r,n,a,i)},t.prototype._updateController=function(r,n,a,i){(!i||i.$from!==r.id)&&this._brushController.setPanels(r.brushTargetManager.makePanelOpts(a)).enableBrush(r.brushOption).updateCovers(r.areas.slice())},t.prototype.dispose=function(){this._brushController.dispose()},t.prototype._onBrush=function(r){var n=this.model.id,a=this.model.brushTargetManager.setOutputRanges(r.areas,this.ecModel);(!r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:Te(a),$from:n}),r.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:n,areas:Te(a),$from:n})},t.type="brush",t}(Rt),H_e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.areas=[],r.brushOption={},r}return t.prototype.optionUpdated=function(r,n){var a=this.option;!n&&jZ(a,r,["inBrush","outOfBrush"]);var i=a.inBrush=a.inBrush||{};a.outOfBrush=a.outOfBrush||{color:this.option.defaultOutOfBrushColor},i.hasOwnProperty("liftZ")||(i.liftZ=5)},t.prototype.setAreas=function(r){r&&(this.areas=oe(r,function(n){return j4(this.option,n)},this))},t.prototype.setBrushOption=function(r){this.brushOption=j4(this.option,r),this.brushType=this.brushOption.brushType},t.type="brush",t.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],t.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:K.color.backgroundTint,borderColor:K.color.borderTint},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4,defaultOutOfBrushColor:K.color.disabled},t}(Qe);function j4(e,t){return We({brushType:e.brushType,brushMode:e.brushMode,transformable:e.transformable,brushStyle:new tt(e.brushStyle).getItemStyle(),removeOnClick:e.removeOnClick,z:e.z},t,!0)}var U_e=["rect","polygon","lineX","lineY","keep","clear"],W_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a){var i,o,s;n.eachComponent({mainType:"brush"},function(l){i=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=i,this._brushMode=o,j(r.get("type",!0),function(l){r.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===i)?"emphasis":"normal")})},t.prototype.updateView=function(r,n,a){this.render(r,n,a)},t.prototype.getIcons=function(){var r=this.model,n=r.get("icon",!0),a={};return j(r.get("type",!0),function(i){n[i]&&(a[i]=n[i])}),a},t.prototype.onclick=function(r,n,a){var i=this._brushType,o=this._brushMode;a==="clear"?(n.dispatchAction({type:"axisAreaSelect",intervals:[]}),n.dispatchAction({type:"brush",command:"clear",areas:[]})):n.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:a==="keep"?i:i===a?!1:a,brushMode:a==="keep"?o==="multiple"?"single":"multiple":o}})},t.getDefaultOption=function(r){var n={show:!0,type:U_e.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:r.getLocaleModel().get(["toolbox","brush","title"])};return n},t}(Co);function Z_e(e){e.registerComponentView(G_e),e.registerComponentModel(H_e),e.registerPreprocessor(P_e),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,R_e),e.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(t,r){r.eachComponent({mainType:"brush",query:t},function(n){n.setAreas(t.areas)})}),e.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},ar),e.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},ar),pf("brush",W_e)}var $_e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.layoutMode={type:"box",ignoreSize:!0},r}return t.type="title",t.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:"center",top:K.size.m,backgroundColor:K.color.transparent,borderColor:K.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:K.color.primary},subtextStyle:{fontSize:12,color:K.color.quaternary}},t}(Qe),Y_e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){if(this.group.removeAll(),!!r.get("show")){var i=this.group,o=r.getModel("textStyle"),s=r.getModel("subtextStyle"),l=r.get("textAlign"),u=_e(r.get("textBaseline"),r.get("textVerticalAlign")),c=new ht({style:Et(o,{text:r.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),h=c.getBoundingRect(),d=r.get("subtext"),v=new ht({style:Et(s,{text:d,fill:s.getTextColor(),y:h.height+r.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),g=r.get("link"),m=r.get("sublink"),y=r.get("triggerEvent",!0);c.silent=!g&&!y,v.silent=!m&&!y,g&&c.on("click",function(){X_(g,"_"+r.get("target"))}),m&&v.on("click",function(){X_(m,"_"+r.get("subtarget"))}),Ee(c).eventData=Ee(v).eventData=y?{componentType:"title",componentIndex:r.componentIndex}:null,i.add(c),d&&i.add(v);var x=i.getBoundingRect(),_=r.getBoxLayoutParams();_.width=x.width,_.height=x.height;var w=jr(r,a),S=Zt(_,w.refContainer,r.get("padding"));l||(l=r.get("left")||r.get("right"),l==="middle"&&(l="center"),l==="right"?S.x+=S.width:l==="center"&&(S.x+=S.width/2)),u||(u=r.get("top")||r.get("bottom"),u==="center"&&(u="middle"),u==="bottom"?S.y+=S.height:u==="middle"&&(S.y+=S.height/2),u=u||"top"),i.x=S.x,i.y=S.y,i.markRedraw();var C={align:l,verticalAlign:u};c.setStyle(C),v.setStyle(C),x=i.getBoundingRect();var M=S.margin,A=r.getItemStyle(["color","opacity"]);A.fill=r.get("backgroundColor");var I=new Ke({shape:{x:x.x-M[3],y:x.y-M[0],width:x.width+M[1]+M[3],height:x.height+M[0]+M[2],r:r.get("borderRadius")},style:A,subPixelOptimize:!0,silent:!0});i.add(I)}},t.type="title",t}(Rt);function X_e(e){e.registerComponentModel($_e),e.registerComponentView(Y_e)}var R4=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.layoutMode="box",r}return t.prototype.init=function(r,n,a){this.mergeDefaultAndTheme(r,a),this._initData()},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),this._initData()},t.prototype.setCurrentIndex=function(r){r==null&&(r=this.option.currentIndex);var n=this._data.count();this.option.loop?r=(r%n+n)%n:(r>=n&&(r=n-1),r<0&&(r=0)),this.option.currentIndex=r},t.prototype.getCurrentIndex=function(){return this.option.currentIndex},t.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},t.prototype.setPlayState=function(r){this.option.autoPlay=!!r},t.prototype.getPlayState=function(){return!!this.option.autoPlay},t.prototype._initData=function(){var r=this.option,n=r.data||[],a=r.axisType,i=this._names=[],o;a==="category"?(o=[],j(n,function(u,c){var h=Ir(zd(u),""),d;Ie(u)?(d=Te(u),d.value=c):d=c,o.push(d),i.push(h)})):o=n;var s={category:"ordinal",time:"time",value:"number"}[a]||"number",l=this._data=new Nn([{name:"value",type:s}],this);l.initData(o,i)},t.prototype.getData=function(){return this._data},t.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},t.type="timeline",t.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:K.size.m,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:K.color.secondary},data:[]},t}(Qe),OZ=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline.slider",t.defaultOption=iu(R4.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:K.color.border,borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:K.color.accent10},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:K.color.tertiary},itemStyle:{color:K.color.accent20,borderWidth:0},checkpointStyle:{symbol:"circle",symbolSize:15,color:K.color.accent50,borderColor:K.color.accent50,borderWidth:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"rgba(0, 0, 0, 0)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10.6699C11.5 9.90014 12.3333 9.41887 13 9.80371L20.5 14.1338C21.1667 14.5187 21.1667 15.4813 20.5 15.8662L13 20.1963C12.3333 20.5811 11.5 20.0999 11.5 19.3301V10.6699Z",stopIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10C12.3284 10 13 10.6716 13 11.5V18.5C13 19.3284 12.3284 20 11.5 20C10.6716 20 10 19.3284 10 18.5V11.5C10 10.6716 10.6716 10 11.5 10ZM18.5 10C19.3284 10 20 10.6716 20 11.5V18.5C20 19.3284 19.3284 20 18.5 20C17.6716 20 17 19.3284 17 18.5V11.5C17 10.6716 17.6716 10 18.5 10Z",nextIcon:"path://M0.838834 18.7383C0.253048 18.1525 0.253048 17.2028 0.838834 16.617L7.55635 9.89949L0.838834 3.18198C0.253048 2.59619 0.253048 1.64645 0.838834 1.06066C1.42462 0.474874 2.37437 0.474874 2.96015 1.06066L10.7383 8.83883L10.8412 8.95277C11.2897 9.50267 11.2897 10.2963 10.8412 10.8462L10.7383 10.9602L2.96015 18.7383C2.37437 19.3241 1.42462 19.3241 0.838834 18.7383Z",prevIcon:"path://M10.9602 1.06066C11.5459 1.64645 11.5459 2.59619 10.9602 3.18198L4.24264 9.89949L10.9602 16.617C11.5459 17.2028 11.5459 18.1525 10.9602 18.7383C10.3744 19.3241 9.42462 19.3241 8.83883 18.7383L1.06066 10.9602L0.957771 10.8462C0.509245 10.2963 0.509245 9.50267 0.957771 8.95277L1.06066 8.83883L8.83883 1.06066C9.42462 0.474874 10.3744 0.474874 10.9602 1.06066Z",prevBtnSize:18,nextBtnSize:18,color:K.color.accent50,borderColor:K.color.accent50,borderWidth:0},emphasis:{label:{show:!0,color:K.color.accent60},itemStyle:{color:K.color.accent60,borderColor:K.color.accent60},controlStyle:{color:K.color.accent70,borderColor:K.color.accent70}},progress:{lineStyle:{color:K.color.accent30},itemStyle:{color:K.color.accent40}},data:[]}),t}(R4);br(OZ,U1.prototype);var q_e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline",t}(Rt),K_e=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this,r,n,a)||this;return o.type=i||"value",o}return t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},t}(ui),DT=Math.PI,O4=Ze(),J_e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){this.api=n},t.prototype.render=function(r,n,a){if(this.model=r,this.api=a,this.ecModel=n,this.group.removeAll(),r.get("show",!0)){var i=this._layout(r,a),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(i,r);r.formatTooltip=function(u){var c=l.scale.getLabel({value:u});return Mr("nameValue",{noName:!0,value:c})},j(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](i,o,l,r)},this),this._renderAxisLabel(i,s,l,r),this._position(i,r)}this._doPlayStop(),this._updateTicksStatus()},t.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},t.prototype.dispose=function(){this._clearTimer()},t.prototype._layout=function(r,n){var a=r.get(["label","position"]),i=r.get("orient"),o=Q_e(r,n),s;a==null||a==="auto"?s=i==="horizontal"?o.y+o.height/2=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:DT/2},h=i==="vertical"?o.height:o.width,d=r.getModel("controlStyle"),v=d.get("show",!0),g=v?d.get("itemSize"):0,m=v?d.get("itemGap"):0,y=g+m,x=r.get(["label","rotate"])||0;x=x*DT/180;var _,w,S,C=d.get("position",!0),M=v&&d.get("showPlayBtn",!0),A=v&&d.get("showPrevBtn",!0),I=v&&d.get("showNextBtn",!0),k=0,P=h;C==="left"||C==="bottom"?(M&&(_=[0,0],k+=y),A&&(w=[k,0],k+=y),I&&(S=[P-g,0],P-=y)):(M&&(_=[P-g,0],P-=y),A&&(w=[0,0],k+=y),I&&(S=[P-g,0],P-=y));var D=[k,P];return r.get("inverse")&&D.reverse(),{viewRect:o,mainLength:h,orient:i,rotation:c[i],labelRotation:x,labelPosOpt:s,labelAlign:r.get(["label","align"])||l[i],labelBaseline:r.get(["label","verticalAlign"])||r.get(["label","baseline"])||u[i],playPosition:_,prevBtnPosition:w,nextBtnPosition:S,axisExtent:D,controlSize:g,controlGap:m}},t.prototype._position=function(r,n){var a=this._mainGroup,i=this._labelGroup,o=r.viewRect;if(r.orient==="vertical"){var s=$t(),l=o.x,u=o.y+o.height;Pi(s,s,[-l,-u]),js(s,s,-DT/2),Pi(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=_(o),h=_(a.getBoundingRect()),d=_(i.getBoundingRect()),v=[a.x,a.y],g=[i.x,i.y];g[0]=v[0]=c[0][0];var m=r.labelPosOpt;if(m==null||ue(m)){var y=m==="+"?0:1;w(v,h,c,1,y),w(g,d,c,1,1-y)}else{var y=m>=0?0:1;w(v,h,c,1,y),g[1]=v[1]+m}a.setPosition(v),i.setPosition(g),a.rotation=i.rotation=r.rotation,x(a),x(i);function x(S){S.originX=c[0][0]-S.x,S.originY=c[1][0]-S.y}function _(S){return[[S.x,S.x+S.width],[S.y,S.y+S.height]]}function w(S,C,M,A,I){S[A]+=M[A][I]-C[A][I]}},t.prototype._createAxis=function(r,n){var a=n.getData(),i=n.get("axisType")||n.get("type");i!=="category"&&i!=="time"&&(i="value");var o=tv(n,i,!1);o.getTicks=function(){return a.mapArray(["value"],function(u){return{value:u}})};var s=a.getDataExtent("value");o.setExtent(s[0],s[1]),r8(o,{fixMinMax:[!0,!0]});var l=new K_e("value",o,r.axisExtent,i);return l.model=n,l},t.prototype._createGroup=function(r){var n=this[r]=new Ne;return this.group.add(n),n},t.prototype._renderAxisLine=function(r,n,a,i){var o=a.getExtent();if(i.get(["lineStyle","show"])){var s=new yr({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:te({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});n.add(s);var l=this._progressLine=new yr({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:Le({lineCap:"round",lineWidth:s.style.lineWidth},i.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});n.add(l)}},t.prototype._renderAxisTick=function(r,n,a,i){var o=this,s=i.getData(),l=a.scale.getTicks();this._tickSymbols=[],j(l,function(u){var c=a.dataToCoord(u.value),h=s.getItemModel(u.value),d=h.getModel("itemStyle"),v=h.getModel(["emphasis","itemStyle"]),g=h.getModel(["progress","itemStyle"]),m={x:c,y:0,onclick:ve(o._changeTimeline,o,u.value)},y=z4(h,d,n,m);y.ensureState("emphasis").style=v.getItemStyle(),y.ensureState("progress").style=g.getItemStyle(),Il(y);var x=Ee(y);h.get("tooltip")?(x.dataIndex=u.value,x.dataModel=i):x.dataIndex=x.dataModel=null,o._tickSymbols.push(y)})},t.prototype._renderAxisLabel=function(r,n,a,i){var o=this,s=a.getLabelModel();if(s.get("show")){var l=i.getData(),u=a.getViewLabels();this._tickLabels=[],j(u,function(c){if(!c.tick.offInterval){var h=c.tick.value,d=l.getItemModel(h),v=d.getModel("label"),g=d.getModel(["emphasis","label"]),m=d.getModel(["progress","label"]),y=a.dataToCoord(h),x=new ht({x:y,y:0,rotation:r.labelRotation-r.rotation,onclick:ve(o._changeTimeline,o,h),silent:!1,style:Et(v,{text:c.formattedLabel,align:r.labelAlign,verticalAlign:r.labelBaseline})});x.ensureState("emphasis").style=Et(g),x.ensureState("progress").style=Et(m),n.add(x),Il(x),O4(x).dataIndex=h,o._tickLabels.push(x)}})}},t.prototype._renderControl=function(r,n,a,i){var o=r.controlSize,s=r.rotation,l=i.getModel("controlStyle").getItemStyle(),u=i.getModel(["emphasis","controlStyle"]).getItemStyle(),c=i.getPlayState(),h=i.get("inverse",!0);d(r.nextBtnPosition,"next",ve(this._changeTimeline,this,h?"-":"+")),d(r.prevBtnPosition,"prev",ve(this._changeTimeline,this,h?"+":"-")),d(r.playPosition,c?"stop":"play",ve(this._handlePlayClick,this,!c),!0);function d(v,g,m,y){if(v){var x=ko(_e(i.get(["controlStyle",g+"BtnSize"]),o),o),_=[0,-x/2,x,x],w=ebe(i,g+"Icon",_,{x:v[0],y:v[1],originX:o/2,originY:0,rotation:y?-s:0,rectHover:!0,style:l,onclick:m});w.ensureState("emphasis").style=u,n.add(w),Il(w)}}},t.prototype._renderCurrentPointer=function(r,n,a,i){var o=i.getData(),s=i.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,c={onCreate:function(h){h.draggable=!0,h.drift=ve(u._handlePointerDrag,u),h.ondragend=ve(u._handlePointerDragend,u),B4(h,u._progressLine,s,a,i,!0)},onUpdate:function(h){B4(h,u._progressLine,s,a,i)}};this._currentPointer=z4(l,l,this._mainGroup,{},this._currentPointer,c)},t.prototype._handlePlayClick=function(r){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:r,from:this.uid})},t.prototype._handlePointerDrag=function(r,n,a){this._clearTimer(),this._pointerChangeTimeline([a.offsetX,a.offsetY])},t.prototype._handlePointerDragend=function(r){this._pointerChangeTimeline([r.offsetX,r.offsetY],!0)},t.prototype._pointerChangeTimeline=function(r,n){var a=this._toAxisCoord(r)[0],i=this._axis,o=qr(i.getExtent().slice());a>o[1]&&(a=o[1]),a=0&&(s[o]=+s[o].toFixed(g)),[s,v]}var ox={min:Xe(ix,"min"),max:Xe(ix,"max"),average:Xe(ix,"average"),median:Xe(ix,"median")};function pm(e,t){if(t){var r=e.getData(),n=e.coordinateSystem,a=n&&n.dimensions;if(!obe(t)&&!ne(t.coord)&&ne(a)){var i=zZ(t,r,n,e);if(t=Te(t),t.type&&ox[t.type]&&i.baseAxis&&i.valueAxis){var o=Ve(a,i.baseAxis.dim),s=Ve(a,i.valueAxis.dim),l=ox[t.type](r,i.valueAxis.dim,i.baseDataDim,i.valueDataDim,o,s);t.coord=l[0],t.value=l[1]}else t.coord=[t.xAxis!=null?t.xAxis:t.radiusAxis,t.yAxis!=null?t.yAxis:t.angleAxis]}if(t.coord==null||!ne(a)){t.coord=[];var u=e.getBaseAxis();if(u&&t.type&&ox[t.type]){var c=n.getOtherAxis(u);c&&(t.value=Fb(r,r.mapDimension(c.dim),t.type))}}else for(var h=t.coord,d=0;d<2;d++)ox[h[d]]&&(h[d]=Fb(r,r.mapDimension(a[d]),h[d]));return t}}function zZ(e,t,r,n){var a={};return e.valueIndex!=null||e.valueDim!=null?(a.valueDataDim=e.valueIndex!=null?t.getDimension(e.valueIndex):e.valueDim,a.valueAxis=r.getAxis(sbe(n,a.valueDataDim)),a.baseAxis=r.getOtherAxis(a.valueAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim)):(a.baseAxis=n.getBaseAxis(),a.valueAxis=r.getOtherAxis(a.baseAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim),a.valueDataDim=t.mapDimension(a.valueAxis.dim)),a}function sbe(e,t){var r=e.getData().getDimensionInfo(t);return r&&r.coordDim}function gm(e,t){return e&&e.containData&&t.coord&&!rN(t)?e.containData(t.coord):!0}function lbe(e,t,r){return e&&e.containZone&&t.coord&&r.coord&&!rN(t)&&!rN(r)?e.containZone(t.coord,r.coord):!0}function BZ(e,t){return e?function(r,n,a,i){var o=i<2?r.coord&&r.coord[i]:r.value;return Pl(o,t[i])}:function(r,n,a,i){return Pl(r.value,t[i])}}function Fb(e,t,r){if(r==="average"){var n=0,a=0;return e.each(t,function(i,o){isNaN(i)||(n+=i,a++)}),n/a}else return r==="median"?e.getMedian(t):e.getDataExtent(t)[r==="max"?1:0]}var ET=Ze(),pP=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(){this.markerGroupMap=pe()},t.prototype.render=function(r,n,a){var i=this,o=this.markerGroupMap;o.each(function(s){ET(s).keep=!1}),n.eachSeries(function(s){var l=Oo.getMarkerModelFromSeries(s,i.type);l&&i.renderSeries(s,l,n,a)}),o.each(function(s){!ET(s).keep&&i.group.remove(s.group)}),ube(n,o,this.type)},t.prototype.markKeep=function(r){ET(r).keep=!0},t.prototype.toggleBlurSeries=function(r,n){var a=this;j(r,function(i){var o=Oo.getMarkerModelFromSeries(i,a.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(n?dH(l):Yk(l))})}})},t.type="marker",t}(Rt);function ube(e,t,r){e.eachSeries(function(n){var a=Oo.getMarkerModelFromSeries(n,r),i=t.get(n.id);if(a&&i&&i.group){var o=Bc(a),s=o.z,l=o.zlevel;B1(i.group,s,l)}})}function V4(e,t,r){var n=t.coordinateSystem,a=r.getWidth(),i=r.getHeight(),o=n&&n.getArea&&n.getArea();e.each(function(s){var l=e.getItemModel(s),u=l.get("relativeTo")==="coordinate",c=u?o?o.width:0:a,h=u?o?o.height:0:i,d=u&&o?o.x:0,v=u&&o?o.y:0,g,m=fe(l.get("x"),c)+d,y=fe(l.get("y"),h)+v;if(!isNaN(m)&&!isNaN(y))g=[m,y];else if(t.getMarkerPosition)g=t.getMarkerPosition(e.getValues(e.dimensions,s));else if(n){var x=e.get(n.dimensions[0],s),_=e.get(n.dimensions[1],s);g=n.dataToPoint([x,_])}isNaN(m)||(g[0]=m),isNaN(y)||(g[1]=y),e.setItemLayout(s,g)})}var cbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,a){n.eachSeries(function(i){var o=Oo.getMarkerModelFromSeries(i,"markPoint");o&&(V4(o.getData(),i,a),this.markerGroupMap.get(i.id).updateLayout())},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new Um),h=hbe(o,r,n);n.setData(h),V4(n.getData(),r,i),h.each(function(d){var v=h.getItemModel(d),g=v.getShallow("symbol"),m=v.getShallow("symbolSize"),y=v.getShallow("symbolRotate"),x=v.getShallow("symbolOffset"),_=v.getShallow("symbolKeepAspect");if(Me(g)||Me(m)||Me(y)||Me(x)){var w=n.getRawValue(d),S=n.getDataParams(d);Me(g)&&(g=g(w,S)),Me(m)&&(m=m(w,S)),Me(y)&&(y=y(w,S)),Me(x)&&(x=x(w,S))}var C=v.getModel("itemStyle").getItemStyle(),M=v.get("z2"),A=zm(l,"color");C.fill||(C.fill=A),h.setItemVisual(d,{z2:_e(M,0),symbol:g,symbolSize:m,symbolRotate:y,symbolOffset:x,symbolKeepAspect:_,style:C})}),c.updateData(h),this.group.add(c.group),h.eachItemGraphicEl(function(d){d.traverse(function(v){Ee(v).dataModel=n})}),this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markPoint",t}(pP);function hbe(e,t,r){var n;e?n=oe(e&&e.dimensions,function(s){var l=t.getData(),u=l.getDimensionInfo(l.mapDimension(s))||{};return te(te({},u),{name:s,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var a=new Nn(n,r),i=oe(r.get("data"),Xe(pm,t));e&&(i=wt(i,Xe(gm,e)));var o=BZ(!!e,n);return a.initData(i,null,o),a}function fbe(e){e.registerComponentModel(ibe),e.registerComponentView(cbe),e.registerPreprocessor(function(t){vP(t.series,"markPoint")&&(t.markPoint=t.markPoint||{})})}var dbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.createMarkerModelFromSeries=function(r,n,a){return new t(r,n,a)},t.type="markLine",t.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},t}(Oo),sx=Ze(),vbe=function(e,t,r,n){var a=e.getData(),i;if(ne(n))i=n;else{var o=n.type;if(o==="min"||o==="max"||o==="average"||o==="median"||n.xAxis!=null||n.yAxis!=null){var s=void 0,l=void 0;if(n.yAxis!=null||n.xAxis!=null)s=t.getAxis(n.yAxis!=null?"y":"x"),l=Mn(n.yAxis,n.xAxis);else{var u=zZ(n,a,t,e);s=u.valueAxis;var c=HL(a,u.valueDataDim);l=Fb(a,c,o)}var h=s.dim==="x"?0:1,d=1-h,v=Te(n),g={coord:[]};v.type=null,v.coord=[],v.coord[d]=-1/0,g.coord[d]=1/0;var m=r.get("precision");m>=0&&ft(l)&&(l=+l.toFixed(Math.min(m,20))),v.coord[h]=g.coord[h]=l,i=[v,g,{type:o,valueIndex:n.valueIndex,value:l}]}else i=[]}var y=[pm(e,i[0]),pm(e,i[1]),te({},i[2])];return y[2].type=y[2].type||null,We(y[2],y[0]),We(y[2],y[1]),y};function Vb(e){return!isNaN(e)&&!isFinite(e)}function G4(e,t,r,n){var a=1-e,i=n.dimensions[e];return Vb(t[a])&&Vb(r[a])&&t[e]===r[e]&&n.getAxis(i).containData(t[e])}function pbe(e,t){if(e.type==="cartesian2d"){var r=t[0].coord,n=t[1].coord;if(r&&n&&(G4(1,r,n,e)||G4(0,r,n,e)))return!0}return gm(e,t[0])&&gm(e,t[1])}function jT(e,t,r,n,a){var i=n.coordinateSystem,o=e.getItemModel(t),s,l=fe(o.get("x"),a.getWidth()),u=fe(o.get("y"),a.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition)s=n.getMarkerPosition(e.getValues(e.dimensions,t));else{var c=i.dimensions,h=e.get(c[0],t),d=e.get(c[1],t);s=i.dataToPoint([h,d])}if(Zc(i,"cartesian2d")){var v=i.getAxis("x"),g=i.getAxis("y"),c=i.dimensions;Vb(e.get(c[0],t))?s[0]=v.toGlobalCoord(v.getExtent()[r?0:1]):Vb(e.get(c[1],t))&&(s[1]=g.toGlobalCoord(g.getExtent()[r?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}e.setItemLayout(t,s)}var gbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,a){n.eachSeries(function(i){var o=Oo.getMarkerModelFromSeries(i,"markLine");if(o){var s=o.getData(),l=sx(o).from,u=sx(o).to;l.each(function(c){jT(l,c,!0,i,a),jT(u,c,!1,i,a)}),s.each(function(c){s.setItemLayout(c,[l.getItemLayout(c),u.getItemLayout(c)])}),this.markerGroupMap.get(i.id).updateLayout()}},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new DI);this.group.add(c.group);var h=mbe(o,r,n),d=h.from,v=h.to,g=h.line;sx(n).from=d,sx(n).to=v,n.setData(g);var m=n.get("symbol"),y=n.get("symbolSize"),x=n.get("symbolRotate"),_=n.get("symbolOffset");ne(m)||(m=[m,m]),ne(y)||(y=[y,y]),ne(x)||(x=[x,x]),ne(_)||(_=[_,_]),h.from.each(function(S){w(d,S,!0),w(v,S,!1)}),g.each(function(S){var C=g.getItemModel(S),M=C.getModel("lineStyle").getLineStyle();g.setItemLayout(S,[d.getItemLayout(S),v.getItemLayout(S)]);var A=C.get("z2");M.stroke==null&&(M.stroke=d.getItemVisual(S,"style").fill),g.setItemVisual(S,{z2:_e(A,0),fromSymbolKeepAspect:d.getItemVisual(S,"symbolKeepAspect"),fromSymbolOffset:d.getItemVisual(S,"symbolOffset"),fromSymbolRotate:d.getItemVisual(S,"symbolRotate"),fromSymbolSize:d.getItemVisual(S,"symbolSize"),fromSymbol:d.getItemVisual(S,"symbol"),toSymbolKeepAspect:v.getItemVisual(S,"symbolKeepAspect"),toSymbolOffset:v.getItemVisual(S,"symbolOffset"),toSymbolRotate:v.getItemVisual(S,"symbolRotate"),toSymbolSize:v.getItemVisual(S,"symbolSize"),toSymbol:v.getItemVisual(S,"symbol"),style:M})}),c.updateData(g),h.line.eachItemGraphicEl(function(S){Ee(S).dataModel=n,S.traverse(function(C){Ee(C).dataModel=n})});function w(S,C,M){var A=S.getItemModel(C);jT(S,C,M,r,i);var I=A.getModel("itemStyle").getItemStyle();I.fill==null&&(I.fill=zm(l,"color")),S.setItemVisual(C,{symbolKeepAspect:A.get("symbolKeepAspect"),symbolOffset:_e(A.get("symbolOffset",!0),_[M?0:1]),symbolRotate:_e(A.get("symbolRotate",!0),x[M?0:1]),symbolSize:_e(A.get("symbolSize"),y[M?0:1]),symbol:_e(A.get("symbol",!0),m[M?0:1]),style:I})}this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markLine",t}(pP);function mbe(e,t,r){var n;e?n=oe(e&&e.dimensions,function(u){var c=t.getData(),h=c.getDimensionInfo(c.mapDimension(u))||{};return te(te({},h),{name:u,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var a=new Nn(n,r),i=new Nn(n,r),o=new Nn([],r),s=oe(r.get("data"),Xe(vbe,t,e,r));e&&(s=wt(s,Xe(pbe,e)));var l=BZ(!!e,n);return a.initData(oe(s,function(u){return u[0]}),null,l),i.initData(oe(s,function(u){return u[1]}),null,l),o.initData(oe(s,function(u){return u[2]})),o.hasItemOption=!0,{from:a,to:i,line:o}}function ybe(e){e.registerComponentModel(dbe),e.registerComponentView(gbe),e.registerPreprocessor(function(t){vP(t.series,"markLine")&&(t.markLine=t.markLine||{})})}var xbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.createMarkerModelFromSeries=function(r,n,a){return new t(r,n,a)},t.type="markArea",t.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},t}(Oo),lx=Ze(),_be=function(e,t,r,n){var a=n[0],i=n[1];if(!(!a||!i)){var o=pm(e,a),s=pm(e,i),l=o.coord,u=s.coord;l[0]=Mn(l[0],-1/0),l[1]=Mn(l[1],-1/0),u[0]=Mn(u[0],1/0),u[1]=Mn(u[1],1/0);var c=x1([{},o,s]);return c.coord=[o.coord,s.coord],c.x0=o.x,c.y0=o.y,c.x1=s.x,c.y1=s.y,c}};function Gb(e){return!isNaN(e)&&!isFinite(e)}function H4(e,t,r,n){var a=1-e;return Gb(t[a])&&Gb(r[a])}function bbe(e,t){var r=t.coord[0],n=t.coord[1],a={coord:r,x:t.x0,y:t.y0},i={coord:n,x:t.x1,y:t.y1};return Zc(e,"cartesian2d")?r&&n&&(H4(1,r,n)||H4(0,r,n))?!0:lbe(e,a,i):gm(e,a)||gm(e,i)}function U4(e,t,r,n,a){var i=n.coordinateSystem,o=e.getItemModel(t),s,l=fe(o.get(r[0]),a.getWidth()),u=fe(o.get(r[1]),a.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition){var c=e.getValues(["x0","y0"],t),h=e.getValues(["x1","y1"],t),d=i.clampData(c),v=i.clampData(h),g=[];r[0]==="x0"?g[0]=d[0]>v[0]?h[0]:c[0]:g[0]=d[0]>v[0]?c[0]:h[0],r[1]==="y0"?g[1]=d[1]>v[1]?h[1]:c[1]:g[1]=d[1]>v[1]?c[1]:h[1],s=n.getMarkerPosition(g,r,!0)}else{var m=e.get(r[0],t),y=e.get(r[1],t),x=[m,y];i.clampData&&i.clampData(x,x),s=i.dataToPoint(x,!0)}if(Zc(i,"cartesian2d")){var _=i.getAxis("x"),w=i.getAxis("y"),m=e.get(r[0],t),y=e.get(r[1],t);Gb(m)?s[0]=_.toGlobalCoord(_.getExtent()[r[0]==="x0"?0:1]):Gb(y)&&(s[1]=w.toGlobalCoord(w.getExtent()[r[1]==="y0"?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}return s}var W4=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],wbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,a){n.eachSeries(function(i){var o=Oo.getMarkerModelFromSeries(i,"markArea");if(o){var s=o.getData();s.each(function(l){var u=oe(W4,function(h){return U4(s,l,h,i,a)});s.setItemLayout(l,u);var c=s.getItemGraphicEl(l);c.setShape("points",u)})}},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,{group:new Ne});this.group.add(c.group),this.markKeep(c);var h=Sbe(o,r,n);n.setData(h),h.each(function(d){var v=oe(W4,function(P){return U4(h,d,P,r,i)}),g=o.getAxis("x").scale,m=o.getAxis("y").scale,y=g.getExtent(),x=m.getExtent(),_=[g.parse(h.get("x0",d)),g.parse(h.get("x1",d))],w=[m.parse(h.get("y0",d)),m.parse(h.get("y1",d))];qr(_),qr(w);var S=!(y[0]>_[1]||y[1]<_[0]||x[0]>w[1]||x[1]=0},t.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},t.type="legend.plain",t.dependencies=["series"],t.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",bottom:K.size.m,align:"auto",backgroundColor:K.color.transparent,borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:K.color.disabled,inactiveBorderColor:K.color.disabled,inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:K.color.disabled,inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:K.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:K.color.tertiary,borderWidth:1,borderColor:K.color.border},emphasis:{selectorLabel:{show:!0,color:K.color.quaternary}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(Qe),of=Xe,aN=j,ux=Ne,FZ=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.newlineDisabled=!1,r}return t.prototype.init=function(){this.group.add(this._contentGroup=new ux),this.group.add(this._selectorGroup=new ux),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(r,n,a){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!r.get("show",!0)){var o=r.get("align"),s=r.get("orient");(!o||o==="auto")&&(o=r.get("left")==="right"&&s==="vertical"?"right":"left");var l=r.get("selector",!0),u=r.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,r,n,a,l,s,u);var c=jr(r,a).refContainer,h=r.getBoxLayoutParams(),d=r.get("padding"),v=Zt(h,c,d),g=this.layoutInner(r,o,v,i,l,u),m=Zt(Le({width:g.width,height:g.height},h),c,d);this.group.x=m.x-g.x,this.group.y=m.y-g.y,this.group.markRedraw(),this.group.add(this._backgroundEl=NZ(g,r))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(r,n,a,i,o,s,l){var u=this.getContentGroup(),c=pe(),h=n.get("selectedMode"),d=n.get("triggerEvent"),v=[];a.eachRawSeries(function(g){!g.get("legendHoverLink")&&v.push(g.id)}),aN(n.getData(),function(g,m){var y=this,x=g.get("name");if(!this.newlineDisabled&&(x===""||x===` -`)){var _=new ux;_.newline=!0,u.add(_);return}var w=a.getSeriesByName(x)[0];if(!c.get(x))if(w){var S=w.getData(),C=S.getVisual("legendLineStyle")||{},M=S.getVisual("legendIcon"),A=S.getVisual("style"),I=this._createItem(w,x,m,g,n,r,C,A,M,h,i);I.on("click",of(Z4,x,null,i,v)).on("mouseover",of(iN,w.name,null,i,v)).on("mouseout",of(oN,w.name,null,i,v)),a.ssr&&I.eachChild(function(k){var P=Ee(k);P.seriesIndex=w.seriesIndex,P.dataIndex=m,P.ssrType="legend"}),d&&I.eachChild(function(k){y.packEventData(k,n,w,m,x)}),c.set(x,!0)}else a.eachRawSeries(function(k){var P=this;if(!c.get(x)&&k.legendVisualProvider){var D=k.legendVisualProvider;if(!D.containName(x))return;var z=D.indexOfName(x),E=D.getItemVisual(z,"style"),B=D.getItemVisual(z,"legendIcon"),H=An(E.fill);H&&H[3]===0&&(H[3]=.2,E=te(te({},E),{fill:qa(H,"rgba")}));var V=this._createItem(k,x,m,g,n,r,{},E,B,h,i);V.on("click",of(Z4,null,x,i,v)).on("mouseover",of(iN,null,x,i,v)).on("mouseout",of(oN,null,x,i,v)),a.ssr&&V.eachChild(function(U){var F=Ee(U);F.seriesIndex=k.seriesIndex,F.dataIndex=m,F.ssrType="legend"}),d&&V.eachChild(function(U){P.packEventData(U,n,k,m,x)}),c.set(x,!0)}},this)},this),o&&this._createSelector(o,n,i,s,l)},t.prototype.packEventData=function(r,n,a,i,o){var s={componentType:"legend",componentIndex:n.componentIndex,dataIndex:i,value:o,seriesIndex:a.seriesIndex};Ee(r).eventData=s},t.prototype._createSelector=function(r,n,a,i,o){var s=this.getSelectorGroup();aN(r,function(u){var c=u.type,h=new ht({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect",legendId:n.id})}});s.add(h);var d=n.getModel("selectorLabel"),v=n.getModel(["emphasis","selectorLabel"]);Hr(h,{normal:d,emphasis:v},{defaultText:u.title}),Il(h)})},t.prototype._createItem=function(r,n,a,i,o,s,l,u,c,h,d){var v=r.visualDrawType,g=o.get("itemWidth"),m=o.get("itemHeight"),y=o.isSelected(n),x=i.get("symbolRotate"),_=i.get("symbolKeepAspect"),w=i.get("icon");c=w||c||"roundRect";var S=Mbe(c,i,l,u,v,y,d),C=new ux,M=i.getModel("textStyle");if(Me(r.getLegendIcon)&&(!w||w==="inherit"))C.add(r.getLegendIcon({itemWidth:g,itemHeight:m,icon:c,iconRotate:x,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:_}));else{var A=w==="inherit"&&r.getData().getVisual("symbol")?x==="inherit"?r.getData().getVisual("symbolRotate"):x:0;C.add(Abe({itemWidth:g,itemHeight:m,icon:c,iconRotate:A,itemStyle:S.itemStyle,symbolKeepAspect:_}))}var I=s==="left"?g+5:-5,k=s,P=o.get("formatter"),D=n;ue(P)&&P?D=P.replace("{name}",n??""):Me(P)&&(D=P(n));var z=y?M.getTextColor():i.get("inactiveColor");C.add(new ht({style:Et(M,{text:D,x:I,y:m/2,fill:z,align:k,verticalAlign:"middle"},{inheritColor:z})}));var E=new Ke({shape:C.getBoundingRect(),style:{fill:"transparent"}}),B=i.getModel("tooltip");return B.get("show")&&Os({el:E,componentModel:o,itemName:n,itemTooltipOption:B.option}),C.add(E),C.eachChild(function(H){H.silent=!0}),E.silent=!h,this.getContentGroup().add(C),Il(C),C.__legendDataIndex=a,C},t.prototype.layoutInner=function(r,n,a,i,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();xc(r.get("orient"),l,r.get("itemGap"),a.width,a.height);var c=l.getBoundingRect(),h=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){xc("horizontal",u,r.get("selectorItemGap",!0));var d=u.getBoundingRect(),v=[-d.x,-d.y],g=r.get("selectorButtonGap",!0),m=r.getOrient().index,y=m===0?"width":"height",x=m===0?"height":"width",_=m===0?"y":"x";s==="end"?v[m]+=c[y]+g:h[m]+=d[y]+g,v[1-m]+=c[x]/2-d[x]/2,u.x=v[0],u.y=v[1],l.x=h[0],l.y=h[1];var w={x:0,y:0};return w[y]=c[y]+g+d[y],w[x]=Math.max(c[x],d[x]),w[_]=Math.min(0,d[_]+v[1-m]),w}else return l.x=h[0],l.y=h[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type="legend.plain",t}(Rt);function Mbe(e,t,r,n,a,i,o){function s(y,x){y.lineWidth==="auto"&&(y.lineWidth=x.lineWidth>0?2:0),aN(y,function(_,w){y[w]==="inherit"&&(y[w]=x[w])})}var l=t.getModel("itemStyle"),u=l.getItemStyle(),c=e.lastIndexOf("empty",0)===0?"fill":"stroke",h=l.getShallow("decal");u.decal=!h||h==="inherit"?n.decal:gd(h,o),u.fill==="inherit"&&(u.fill=n[a]),u.stroke==="inherit"&&(u.stroke=n[c]),u.opacity==="inherit"&&(u.opacity=(a==="fill"?n:r).opacity),s(u,n);var d=t.getModel("lineStyle"),v=d.getLineStyle();if(s(v,r),u.fill==="auto"&&(u.fill=n.fill),u.stroke==="auto"&&(u.stroke=n.fill),v.stroke==="auto"&&(v.stroke=n.fill),!i){var g=t.get("inactiveBorderWidth"),m=u[c];u.lineWidth=g==="auto"?n.lineWidth>0&&m?2:0:u.lineWidth,u.fill=t.get("inactiveColor"),u.stroke=t.get("inactiveBorderColor"),v.stroke=d.get("inactiveColor"),v.lineWidth=d.get("inactiveWidth")}return{itemStyle:u,lineStyle:v}}function Abe(e){var t=e.icon||"roundRect",r=_r(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return r.setStyle(e.itemStyle),r.rotation=(e.iconRotate||0)*Math.PI/180,r.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf("empty")>-1&&(r.style.stroke=r.style.fill,r.style.fill=K.color.neutral00,r.style.lineWidth=2),r}function Z4(e,t,r,n){oN(e,t,r,n),r.dispatchAction({type:"legendToggleSelect",name:e??t}),iN(e,t,r,n)}function iN(e,t,r,n){r.usingTHL()||r.dispatchAction({type:"highlight",seriesName:e,name:t,excludeSeriesId:n})}function oN(e,t,r,n){r.usingTHL()||r.dispatchAction({type:"downplay",seriesName:e,name:t,excludeSeriesId:n})}function dp(e,t,r){var n=e==="allSelect"||e==="inverseSelect",a={},i=[];r.eachComponent({mainType:"legend",query:t},function(s){n?s[e]():s[e](t.name),$4(s,a),i.push(s.componentIndex)});var o={};return r.eachComponent("legend",function(s){j(a,function(l,u){s[l?"select":"unSelect"](u)}),$4(s,o)}),n?{selected:o,legendIndex:i}:{name:t.name,selected:o}}function $4(e,t){var r=t||{};return j(e.getData(),function(n){var a=n.get("name");if(!(a===` -`||a==="")){var i=e.isSelected(a);ge(r,a)?r[a]=r[a]&&i:r[a]=i}}),r}function Nbe(e){e.registerAction("legendToggleSelect","legendselectchanged",Xe(dp,"toggleSelected")),e.registerAction("legendAllSelect","legendselectall",Xe(dp,"allSelect")),e.registerAction("legendInverseSelect","legendinverseselect",Xe(dp,"inverseSelect")),e.registerAction("legendSelect","legendselected",Xe(dp,"select")),e.registerAction("legendUnSelect","legendunselected",Xe(dp,"unSelect"))}var kbe=Lm(Lbe);function Lbe(e){var t=e.findComponents({mainType:"legend"});t&&t.length&&e.filterSeries(function(r){for(var n=0;na[o],y=[-v.x,-v.y];n||(y[i]=c[u]);var x=[0,0],_=[-g.x,-g.y],w=_e(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(m){var S=r.get("pageButtonPosition",!0);S==="end"?_[i]+=a[o]-g[o]:x[i]+=g[o]+w}_[1-i]+=v[s]/2-g[s]/2,c.setPosition(y),h.setPosition(x),d.setPosition(_);var C={x:0,y:0};if(C[o]=m?a[o]:v[o],C[s]=Math.max(v[s],g[s]),C[l]=Math.min(0,g[l]+_[1-i]),h.__rectSize=a[o],m){var M={x:0,y:0};M[o]=Math.max(a[o]-g[o]-w,0),M[s]=C[s],h.setClipPath(new Ke({shape:M})),h.__rectSize=M[o]}else d.eachChild(function(I){I.attr({invisible:!0,silent:!0})});var A=this._getPageInfo(r);return A.pageIndex!=null&&mt(c,{x:A.contentPosition[0],y:A.contentPosition[1]},m?r:null),this._updatePageInfoView(r,A),C},t.prototype._pageGo=function(r,n,a){var i=this._getPageInfo(n)[r];i!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:n.id})},t.prototype._updatePageInfoView=function(r,n){var a=this._controllerGroup;j(["pagePrev","pageNext"],function(c){var h=c+"DataIndex",d=n[h]!=null,v=a.childOfName(c);v&&(v.setStyle("fill",d?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),v.cursor=d?"pointer":"default")});var i=a.childOfName("pageText"),o=r.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,u=n.pageCount;i&&o&&i.setStyle("text",ue(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},t.prototype._getPageInfo=function(r){var n=r.get("scrollDataIndex",!0),a=this.getContentGroup(),i=this._containerGroup.__rectSize,o=r.getOrient().index,s=RT[o],l=OT[o],u=this._findTargetItemIndex(n),c=a.children(),h=c[u],d=c.length,v=d?1:0,g={contentPosition:[a.x,a.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return g;var m=S(h);g.contentPosition[o]=-m.s;for(var y=u+1,x=m,_=m,w=null;y<=d;++y)w=S(c[y]),(!w&&_.e>x.s+i||w&&!C(w,x.s))&&(_.i>x.i?x=_:x=w,x&&(g.pageNextDataIndex==null&&(g.pageNextDataIndex=x.i),++g.pageCount)),_=w;for(var y=u-1,x=m,_=m,w=null;y>=-1;--y)w=S(c[y]),(!w||!C(_,w.s))&&x.i<_.i&&(_=x,g.pagePrevDataIndex==null&&(g.pagePrevDataIndex=x.i),++g.pageCount,++g.pageIndex),x=w;return g;function S(M){if(M){var A=M.getBoundingRect(),I=A[l]+M[l];return{s:I,e:I+A[s],i:M.__legendDataIndex}}}function C(M,A){return M.e>=A&&M.s<=A+i}},t.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var n,a=this.getContentGroup(),i;return a.eachChild(function(o,s){var l=o.__legendDataIndex;i==null&&l!=null&&(i=s),l===r&&(n=s)}),n??i},t.type="legend.scroll",t}(FZ);function Dbe(e){e.registerAction("legendScroll","legendscroll",function(t,r){var n=t.scrollDataIndex;n!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:t},function(a){a.setScrollDataIndex(n)})})}function Ebe(e){$e(VZ),e.registerComponentModel(Ibe),e.registerComponentView(Pbe),Dbe(e)}function jbe(e){$e(VZ),$e(Ebe)}var Rbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.inside",t.defaultOption=iu(vm.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(vm),gP=Ze();function Obe(e,t,r){gP(e).coordSysRecordMap.each(function(n){var a=n.dataZoomInfoMap.get(t.uid);a&&(a.getRange=r)})}function zbe(e,t){for(var r=gP(e).coordSysRecordMap,n=r.keys(),a=0;ai[a+n]&&(n=h),o=o&&c.get("preventDefaultMouseMove",!0),s=_e(c.get("cursorGrab",!0),s),l=_e(c.get("cursorGrabbing",!0),l)}),{controlType:n,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:r,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint},cursorGrab:s,cursorGrabbing:l}}}function Hbe(e){e.registerUpdateLifecycle("coordsys:aftercreate",function(t,r){var n=gP(r),a=n.coordSysRecordMap||(n.coordSysRecordMap=pe());a.each(function(i){i.dataZoomInfoMap=null}),t.eachComponent({mainType:"dataZoom",subType:"inside"},function(i){var o=SZ(i);j(o.infoList,function(s){var l=s.model.uid,u=a.get(l)||a.set(l,Bbe(r,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=pe());c.set(i.uid,{dzReferCoordSysInfo:s,model:i,getRange:null})})}),a.each(function(i){var o=i.controller,s,l=i.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){GZ(a,i);return}var c=Gbe(l,i,r);o.enable(c.controlType,c.opt),Kd(i,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var Ube=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type="dataZoom.inside",r}return t.prototype.render=function(r,n,a){if(e.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),Obe(a,r,{pan:ve(zT.pan,this),zoom:ve(zT.zoom,this),scrollMove:ve(zT.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){zbe(this.api,this.dataZoomModel),this.range=null},t.type="dataZoom.inside",t}(lP),zT={zoom:function(e,t,r,n){var a=this.range,i=a.slice(),o=e.axisModels[0];if(o){var s=BT[t](null,[n.originX,n.originY],o,r,e),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(i[1]-i[0])+i[0],u=Math.max(1/n.scale,0);i[0]=(i[0]-l)*u+l,i[1]=(i[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Ul(0,i,[0,100],0,c.minSpan,c.maxSpan),this.range=i,a[0]!==i[0]||a[1]!==i[1])return i}},pan:q4(function(e,t,r,n,a,i){var o=BT[n]([i.oldX,i.oldY],[i.newX,i.newY],t,a,r);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:q4(function(e,t,r,n,a,i){var o=BT[n]([0,0],[i.scrollDelta,i.scrollDelta],t,a,r);return o.signal*(e[1]-e[0])*i.scrollDelta})};function q4(e){return function(t,r,n,a){var i=this.range,o=i.slice(),s=t.axisModels[0];if(s){var l=e(o,s,t,r,n,a);if(Ul(l,o,[0,100],"all"),this.range=o,i[0]!==o[0]||i[1]!==o[1])return o}}}var BT={grid:function(e,t,r,n,a){var i=r.axis,o={},s=a.model.coordinateSystem.getRect();return e=e||[0,0],i.dim==="x"?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=i.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=i.inverse?-1:1),o},polar:function(e,t,r,n,a){var i=r.axis,o={},s=a.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),r.mainType==="radiusAxis"?(o.pixel=t[0]-e[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=i.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=i.inverse?-1:1),o},singleAxis:function(e,t,r,n,a){var i=r.axis,o=a.model.coordinateSystem.getRect(),s={};return e=e||[0,0],i.orient==="horizontal"?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=i.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=i.inverse?-1:1),s}};function HZ(e){uP(e),e.registerComponentModel(Rbe),e.registerComponentView(Ube),Hbe(e)}var Wbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=iu(vm.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:K.color.accent10,borderRadius:0,backgroundColor:K.color.transparent,dataBackground:{lineStyle:{color:K.color.accent30,width:.5},areaStyle:{color:K.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:K.color.accent40,width:.5},areaStyle:{color:K.color.accent20,opacity:.3}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:K.color.neutral00,borderColor:K.color.accent20},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:K.color.accent40,opacity:.5},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:K.color.tertiary},brushSelect:!0,brushStyle:{color:K.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:K.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(vm),vp=Ke,Zbe=1,FT=30,$be=7,pp="horizontal",K4="vertical",Ybe=5,Xbe=["line","bar","candlestick","scatter"],qbe={easing:"cubicOut",duration:100,delay:0},Kbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._displayables={},r}return t.prototype.init=function(r,n){this.api=n,this._onBrush=ve(this._onBrush,this),this._onBrushEnd=ve(this._onBrushEnd,this)},t.prototype.render=function(r,n,a,i){if(e.prototype.render.apply(this,arguments),Kd(this,"_dispatchZoomAction",r.get("throttle"),"fixRate"),this._orient=r.getOrient(),r.get("show")===!1){this.group.removeAll();return}if(r.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!=="dataZoom"||i.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Ug(this,"_dispatchZoomAction");var r=this.api.getZr();r.off("mousemove",this._onBrush),r.off("mouseup",this._onBrushEnd)},t.prototype._buildView=function(){var r=this.group;r.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var n=this._displayables.sliderGroup=new Ne;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),r.add(n),this._positionGroup()},t.prototype._resetLocation=function(){var r=this.dataZoomModel,n=this.api,a=r.get("brushSelect"),i=a?$be:0,o=jr(r,n).refContainer,s=this._findCoordRect(),l=r.get("defaultLocationEdgeGap",!0)||0,u=this._orient===pp?{right:o.width-s.x-s.width,top:o.height-FT-l-i,width:s.width,height:FT}:{right:l,top:s.y,width:FT,height:s.height},c=vh(r.option);j(["right","top","width","height"],function(d){c[d]==="ph"&&(c[d]=u[d])});var h=Zt(c,o);this._location={x:h.x,y:h.y},this._size=[h.width,h.height],this._orient===K4&&this._size.reverse()},t.prototype._positionGroup=function(){var r=this.group,n=this._location,a=this._orient,i=this.dataZoomModel.getFirstTargetAxisModel(),o=i&&i.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(a===pp&&!o?{scaleY:l?1:-1,scaleX:1}:a===pp&&o?{scaleY:l?1:-1,scaleX:-1}:a===K4&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=r.getBoundingRect([s]),c=isNaN(u.x)?0:u.x,h=isNaN(u.y)?0:u.y;r.x=n.x-c,r.y=n.y-h,r.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var r=this.dataZoomModel,n=this._size,a=this._displayables.sliderGroup,i=r.get("brushSelect");a.add(new vp({silent:!0,shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:r.get("backgroundColor")},z2:-40}));var o=new vp({shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:"transparent"},z2:0,onclick:ve(this._onClickPanel,this)}),s=this.api.getZr();i?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),a.add(o)},t.prototype._renderDataShadow=function(){var r=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!r)return;var n=this._size,a=this._shadowSize||[],i=r.series,o=i.getRawData(),s=i.getShadowDim&&i.getShadowDim(),l=s&&o.getDimensionInfo(s)?i.getShadowDim():r.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||n[0]!==a[0]||n[1]!==a[1]){var h=o.getDataExtent(r.thisDim),d=o.getDataExtent(l),v=(d[1]-d[0])*.3;d=[d[0]-v,d[1]+v];var g=[0,n[1]],m=[0,n[0]],y=[[n[0],0],[0,0]],x=[],_=m[1]/Math.max(1,o.count()-1),w=n[0]/(h[1]-h[0]),S=r.thisAxis.type==="time",C=-_,M=Math.round(o.count()/n[0]),A;o.each([r.thisDim,l],function(z,E,B){if(M>0&&B%M){S||(C+=_);return}C=S?(+z-h[0])*w:C+_;var H=E==null||isNaN(E)||E==="",V=H?0:xt(E,d,g,!0);H&&!A&&B?(y.push([y[y.length-1][0],0]),x.push([x[x.length-1][0],0])):!H&&A&&(y.push([C,0]),x.push([C,0])),H||(y.push([C,V]),x.push([C,V])),A=H}),u=this._shadowPolygonPts=y,c=this._shadowPolylinePts=x}this._shadowData=o,this._shadowDim=l,this._shadowSize=[n[0],n[1]];var I=this.dataZoomModel;function k(z){var E=I.getModel(z?"selectedDataBackground":"dataBackground"),B=new Ne,H=new vn({shape:{points:u},segmentIgnoreThreshold:1,style:E.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),V=new en({shape:{points:c},segmentIgnoreThreshold:1,style:E.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return B.add(H),B.add(V),B}for(var P=0;P<3;P++){var D=k(P===1);this._displayables.sliderGroup.add(D),this._displayables.dataShadowSegs.push(D)}},t.prototype._prepareDataShadowInfo=function(){var r=this.dataZoomModel,n=r.get("showDataShadow");if(n!==!1){var a,i=this.ecModel;return r.eachTargetAxis(function(o,s){var l=r.getAxisProxy(o,s).getTargetSeriesModels();j(l,function(u){if(!a&&!(n!==!0&&Ve(Xbe,u.get("type"))<0)){var c=i.getComponent(ml(o),s).axis,h=Jbe(o),d,v=u.coordinateSystem;h!=null&&v.getOtherAxis&&(d=v.getOtherAxis(c).inverse),h=u.getData().mapDimension(h);var g=u.getData().mapDimension(o);a={thisAxis:c,series:u,thisDim:g,otherDim:h,otherAxisInverse:d}}},this)},this),a}},t.prototype._renderHandle=function(){var r=this.group,n=this._displayables,a=n.handles=[null,null],i=n.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,c=l.get("borderRadius")||0,h=l.get("brushSelect"),d=n.filler=new vp({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(d),o.add(new vp({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:c},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:Zbe,fill:K.color.transparent}})),j([0,1],function(w){var S=l.get("handleIcon");!J_[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var C=_r(S,-1,0,2,2,null,!0);C.attr({cursor:Qbe(this._orient),draggable:!0,drift:ve(this._onDragMove,this,w),ondragend:ve(this._onDragEnd,this),onmouseover:ve(this._onOverDataInfoTriggerArea,this,!0),onmouseout:ve(this._onOverDataInfoTriggerArea,this,!1),z2:5});var M=C.getBoundingRect(),A=l.get("handleSize");this._handleHeight=fe(A,this._size[1]),this._handleWidth=M.width/M.height*this._handleHeight,C.setStyle(l.getModel("handleStyle").getItemStyle()),C.style.strokeNoScale=!0,C.rectHover=!0,C.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),Il(C);var I=l.get("handleColor");I!=null&&(C.style.fill=I),o.add(a[w]=C);var k=l.getModel("textStyle"),P=l.get("handleLabel")||{},D=P.show||!1;r.add(i[w]=new ht({silent:!0,invisible:!D,style:Et(k,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:k.getTextColor(),font:k.getFont()}),z2:10}))},this);var v=d;if(h){var g=fe(l.get("moveHandleSize"),s[1]),m=n.moveHandle=new Ke({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:g}}),y=g*.8,x=n.moveHandleIcon=_r(l.get("moveHandleIcon"),-y/2,-y/2,y,y,K.color.neutral00,!0);x.silent=!0,x.y=s[1]+g/2-.5,m.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var _=Math.min(s[1]/2,Math.max(g,10));v=n.moveZone=new Ke({invisible:!0,shape:{y:s[1]-_,height:g+_}}),v.on("mouseover",function(){u.enterEmphasis(m)}).on("mouseout",function(){u.leaveEmphasis(m)}),o.add(m),o.add(x),o.add(v)}v.attr({draggable:!0,cursor:"grab",drift:ve(this._onActualMoveZoneDrift,this),ondragstart:ve(this._onActualMoveZoneDragStart,this),ondragend:ve(this._onActualMoveZoneDragEnd,this),onmouseover:ve(this._onOverDataInfoTriggerArea,this,!0),onmouseout:ve(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var r=this._range=this.dataZoomModel.getPercentRange(),n=this._getViewExtent();this._handleEnds=[xt(r[0],[0,100],n,!0),xt(r[1],[0,100],n,!0)]},t.prototype._updateInterval=function(r,n){var a=this.dataZoomModel,i=this._handleEnds,o=this._getViewExtent(),s=a.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];Ul(n,i,o,a.get("zoomLock")?"all":r,s.minSpan!=null?xt(s.minSpan,l,o,!0):null,s.maxSpan!=null?xt(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=qr([xt(i[0],o,l,!0),xt(i[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},t.prototype._updateView=function(r){var n=this._displayables,a=this._handleEnds,i=qr(a.slice()),o=this._size;j([0,1],function(v){var g=n.handles[v],m=this._handleHeight;g.attr({scaleX:m/2,scaleY:m/2,x:a[v]+(v?-1:1),y:o[1]/2-m/2})},this),n.filler.setShape({x:i[0],y:0,width:i[1]-i[0],height:o[1]});var s={x:i[0],width:i[1]-i[0]};n.moveHandle&&(n.moveHandle.setShape(s),n.moveZone.setShape(s),n.moveZone.getBoundingRect(),n.moveHandleIcon&&n.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=n.dataShadowSegs,u=[0,i[0],i[1],o[0]],c=0;cn[0]||a[1]<0||a[1]>n[1])){var i=this._handleEnds,o=(i[0]+i[1])/2,s=this._updateInterval("all",a[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(r){var n=r.offsetX,a=r.offsetY;this._brushStart=new Pe(n,a),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(r){if(this._brushing){var n=this._displayables.brushRect;if(this._brushing=!1,!!n){n.attr("ignore",!0);var a=n.shape,i=+new Date;if(!(i-this._brushStartTime<200&&Math.abs(a.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[a.x,a.x+a.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();Ul(0,l,o,0,u.minSpan!=null?xt(u.minSpan,s,o,!0):null,u.maxSpan!=null?xt(u.maxSpan,s,o,!0):null),this._range=qr([xt(l[0],o,s,!0),xt(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(r){this._brushing&&(Cs(r.event),this._updateBrushRect(r.offsetX,r.offsetY))},t.prototype._updateBrushRect=function(r,n){var a=this._displayables,i=this.dataZoomModel,o=a.brushRect;o||(o=a.brushRect=new vp({silent:!0,style:i.getModel("brushStyle").getItemStyle()}),a.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(r,n),c=l.transformCoordToLocal(s.x,s.y),h=this._size;u[0]=Math.max(Math.min(h[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:h[1]})},t.prototype._dispatchZoomAction=function(r){var n=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:r?qbe:null,start:n[0],end:n[1]})},t.prototype._findCoordRect=function(){var r,n=SZ(this.dataZoomModel).infoList;if(!r&&n.length){var a=n[0].model.coordinateSystem;r=a.getRect&&a.getRect()}if(!r){var i=this.api.getWidth(),o=this.api.getHeight();r={x:i*.2,y:o*.2,width:i*.6,height:o*.6}}return r},t.type="dataZoom.slider",t}(lP);function J4(e,t,r,n){var a=e.get("labelFormatter"),i=e.get("labelPrecision");(i==null||i==="auto")&&(i=r.valuePrecision);var o=r.value[t],s=o==null||isNaN(o)?"":Ln(n)||Bm(n)?n.getLabel({value:Math.round(o)}):isFinite(i)?gt(o,i,!0):o+"";return Me(a)?a(o,s):ue(a)?a.replace("{value}",s):s}function Jbe(e){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[e]}function Qbe(e){return e==="vertical"?"ns-resize":"ew-resize"}function UZ(e){e.registerComponentModel(Wbe),e.registerComponentView(Kbe),uP(e)}function e1e(e){$e(HZ),$e(UZ)}var WZ={get:function(e,t,r){var n=Te((t1e[e]||{})[t]);return r&&ne(n)?n[n.length-1]:n}},t1e={color:{active:["#006edd","#e0ffff"],inactive:[K.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},Q4=Gr.mapVisual,r1e=Gr.eachVisual,n1e=ne,VT=j,a1e=qr,i1e=xt,Hb=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.stateList=["inRange","outOfRange"],r.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],r.layoutMode={type:"box",ignoreSize:!0},r.dataBound=[-1/0,1/0],r.targetVisuals={},r.controllerVisuals={},r}return t.prototype.init=function(r,n,a){this.mergeDefaultAndTheme(r,a)},t.prototype.optionUpdated=function(r,n){var a=this.option;!n&&jZ(a,r,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(r){var n=this.stateList;r=ve(r,this),this.controllerVisuals=eN(this.option.controller,n,r),this.targetVisuals=eN(this.option.target,n,r)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var r=this,n=this.option.seriesTargets;if(n){var a=[];return VT(n,function(l){if(l.seriesIndex!=null)a.push(l.seriesIndex);else if(l.seriesId!=null){var u;r.ecModel.eachSeries(function(c){c.id===l.seriesId&&(u=c)}),u&&a.push(u.componentIndex)}}),a}var i=this.option.seriesId,o=this.option.seriesIndex;o==null&&i==null&&(o="all");var s=Bd(this.ecModel,"series",{index:o,id:i},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return oe(s,function(l){return l.componentIndex})},t.prototype.eachTargetSeries=function(r,n){j(this.getTargetSeriesIndices(),function(a){var i=this.ecModel.getSeriesByIndex(a);i&&r.call(n,i)},this)},t.prototype.isTargetSeries=function(r){var n=!1;return this.eachTargetSeries(function(a){a===r&&(n=!0)}),n},t.prototype.formatValueText=function(r,n,a){var i=this.option,o=i.precision,s=this.dataBound,l=i.formatter,u;a=a||["<",">"],ne(r)&&(r=r.slice(),u=!0);var c=n?r:u?[h(r[0]),h(r[1])]:h(r);if(ue(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(Me(l))return u?l(r[0],r[1]):l(r);if(u)return r[0]===s[0]?a[0]+" "+c[1]:r[1]===s[1]?a[1]+" "+c[0]:c[0]+" - "+c[1];return c;function h(d){return d===s[0]?"min":d===s[1]?"max":(+d).toFixed(Math.min(o,20))}},t.prototype.resetExtent=function(){var r=this.option,n=a1e([r.min,r.max]);this._dataExtent=n},t.prototype.getDimension=function(r){var n=this,a=this.option.seriesTargets;if(a){var i=Es(a,function(o){return o.seriesIndex!=null&&o.seriesIndex===r||o.seriesId!=null&&o.seriesId===n.ecModel.getSeriesByIndex(r).id});if(i)return i.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(r){var n=r.hostModel.seriesIndex,a=this.getDimension(n);if(a!=null)return r.getDimensionIndex(a);for(var i=r.dimensions,o=i.length-1;o>=0;o--){var s=i[o],l=r.getDimensionInfo(s);if(!l.isCalculationCoord)return l.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var r=this.ecModel,n=this.option,a={inRange:n.inRange,outOfRange:n.outOfRange},i=n.target||(n.target={}),o=n.controller||(n.controller={});We(i,a),We(o,a);var s=this.isCategory();l.call(this,i),l.call(this,o),u.call(this,i,"inRange","outOfRange"),c.call(this,o);function l(h){n1e(n.color)&&!h.inRange&&(h.inRange={color:n.color.slice().reverse()}),h.inRange=h.inRange||{color:r.get("gradientColor")}}function u(h,d,v){var g=h[d],m=h[v];g&&!m&&(m=h[v]={},VT(g,function(y,x){if(Gr.isValidType(x)){var _=WZ.get(x,"inactive",s);_!=null&&(m[x]=_,x==="color"&&!m.hasOwnProperty("opacity")&&!m.hasOwnProperty("colorAlpha")&&(m.opacity=[0,0]))}}))}function c(h){var d=(h.inRange||{}).symbol||(h.outOfRange||{}).symbol,v=(h.inRange||{}).symbolSize||(h.outOfRange||{}).symbolSize,g=this.get("inactiveColor"),m=this.getItemSymbol(),y=m||"roundRect";VT(this.stateList,function(x){var _=this.itemSize,w=h[x];w||(w=h[x]={color:s?g:[g]}),w.symbol==null&&(w.symbol=d&&Te(d)||(s?y:[y])),w.symbolSize==null&&(w.symbolSize=v&&Te(v)||(s?_[0]:[_[0],_[0]])),w.symbol=Q4(w.symbol,function(M){return M==="none"?y:M});var S=w.symbolSize;if(S!=null){var C=-1/0;r1e(S,function(M){M>C&&(C=M)}),w.symbolSize=Q4(S,function(M){return i1e(M,[0,C],[0,_[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(r){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(r){return null},t.prototype.getVisualMeta=function(r){return null},t.type="visualMap",t.dependencies=["series"],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:K.color.transparent,borderColor:K.color.borderTint,contentColor:K.color.theme[0],inactiveColor:K.color.disabled,borderWidth:0,padding:K.size.m,textGap:10,precision:0,textStyle:{color:K.color.secondary}},t}(Qe),eB=[20,140],o1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(a){a.mappingMethod="linear",a.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var r=this.itemSize;(r[0]==null||isNaN(r[0]))&&(r[0]=eB[0]),(r[1]==null||isNaN(r[1]))&&(r[1]=eB[1])},t.prototype._resetRange=function(){var r=this.getExtent(),n=this.option.range;!n||n.auto?(r.auto=1,this.option.range=r):ne(n)&&(n[0]>n[1]&&n.reverse(),n[0]=Math.max(n[0],r[0]),n[1]=Math.min(n[1],r[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),j(this.stateList,function(r){var n=this.option.controller[r].symbolSize;n&&n[0]!==n[1]&&(n[0]=n[1]/3)},this)},t.prototype.setSelected=function(r){this.option.range=r.slice(),this._resetRange()},t.prototype.getSelected=function(){var r=this.getExtent(),n=qr((this.get("range")||[]).slice());return n[0]>r[1]&&(n[0]=r[1]),n[1]>r[1]&&(n[1]=r[1]),n[0]=a[1]||r<=n[1])?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[];return this.eachTargetSeries(function(a){var i=[],o=a.getData();o.each(this.getDataDimensionIndex(o),function(s,l){r[0]<=s&&s<=r[1]&&i.push(l)},this),n.push({seriesId:a.id,dataIndex:i})},this),n},t.prototype.getVisualMeta=function(r){var n=tB(this,"outOfRange",this.getExtent()),a=tB(this,"inRange",this.option.range.slice()),i=[];function o(v,g){i.push({value:v,color:r(v,g)})}for(var s=0,l=0,u=a.length,c=n.length;lr[1])break;i.push({color:this.getControllerVisual(l,"color",n),offset:s/a})}return i.push({color:this.getControllerVisual(r[1],"color",n),offset:1}),i},t.prototype._createBarPoints=function(r,n){var a=this.visualMapModel.itemSize;return[[a[0]-n[0],r[0]],[a[0],r[0]],[a[0],r[1]],[a[0]-n[1],r[1]]]},t.prototype._createBarGroup=function(r){var n=this._orient,a=this.visualMapModel.get("inverse");return new Ne(n==="horizontal"&&!a?{scaleX:r==="bottom"?1:-1,rotation:Math.PI/2}:n==="horizontal"&&a?{scaleX:r==="bottom"?-1:1,rotation:-Math.PI/2}:n==="vertical"&&!a?{scaleX:r==="left"?1:-1,scaleY:-1}:{scaleX:r==="left"?1:-1})},t.prototype._updateHandle=function(r,n){if(this._useHandle){var a=this._shapes,i=this.visualMapModel,o=a.handleThumbs,s=a.handleLabels,l=i.itemSize,u=i.getExtent(),c=this._applyTransform("left",a.mainGroup);s1e([0,1],function(h){var d=o[h];d.setStyle("fill",n.handlesColor[h]),d.y=r[h];var v=to(r[h],[0,l[1]],u,!0),g=this.getControllerVisual(v,"symbolSize");d.scaleX=d.scaleY=g/l[0],d.x=l[0]-g/2;var m=ki(a.handleLabelPoints[h],yc(d,this.group));if(this._orient==="horizontal"){var y=c==="left"||c==="top"?(l[0]-g)/2:(l[0]-g)/-2;m[1]+=y}s[h].setStyle({x:m[0],y:m[1],text:i.formatValueText(this._dataInterval[h]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",a.mainGroup):"center"})},this)}},t.prototype._showIndicator=function(r,n,a,i){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],c=this._shapes,h=c.indicator;if(h){h.attr("invisible",!1);var d={convertOpacityToAlpha:!0},v=this.getControllerVisual(r,"color",d),g=this.getControllerVisual(r,"symbolSize"),m=to(r,s,u,!0),y=l[0]-g/2,x={x:h.x,y:h.y};h.y=m,h.x=y;var _=ki(c.indicatorLabelPoint,yc(h,this.group)),w=c.indicatorLabel;w.attr("invisible",!1);var S=this._applyTransform("left",c.mainGroup),C=this._orient,M=C==="horizontal";w.setStyle({text:(a||"")+o.formatValueText(n),verticalAlign:M?S:"middle",align:M?"center":S});var A={x:y,y:m,style:{fill:v}},I={style:{x:_[0],y:_[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var k={duration:100,easing:"cubicInOut",additive:!0};h.x=x.x,h.y=x.y,h.animateTo(A,k),w.animateTo(I,k)}else h.attr(A),w.attr(I);this._firstShowIndicator=!1;var P=this._shapes.handleLabels;if(P)for(var D=0;Do[1]&&(h[1]=1/0),n&&(h[0]===-1/0?this._showIndicator(c,h[1],"< ",l):h[1]===1/0?this._showIndicator(c,h[0],"> ",l):this._showIndicator(c,c,"≈ ",l));var d=this._hoverLinkDataIndices,v=[];(n||iB(a))&&(v=this._hoverLinkDataIndices=a.findTargetDataIndices(h));var g=fte(d,v);this._dispatchHighDown("downplay",Qx(g[0],a)),this._dispatchHighDown("highlight",Qx(g[1],a))}},t.prototype._hoverLinkFromSeriesMouseOver=function(r){var n;if(cc(r.target,function(l){var u=Ee(l);if(u.dataIndex!=null)return n=u,!0},!0),!!n){var a=this.ecModel.getSeriesByIndex(n.seriesIndex),i=this.visualMapModel;if(i.isTargetSeries(a)){var o=a.getData(n.dataType),s=o.getStore().get(i.getDataDimensionIndex(o),n.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},t.prototype._hideIndicator=function(){var r=this._shapes;r.indicator&&r.indicator.attr("invisible",!0),r.indicatorLabel&&r.indicatorLabel.attr("invisible",!0);var n=this._shapes.handleLabels;if(n)for(var a=0;a=0&&(i.dimension=o,n.push(i))}}),e.getData().setVisual("visualMeta",n)}}];function p1e(e,t,r,n){for(var a=t.targetVisuals[n],i=Gr.prepareVisualTypes(a),o={color:zm(e.getData(),"color")},s=0,l=i.length;s0:t.splitNumber>0)||t.calculable)?"continuous":"piecewise"}),e.registerAction(f1e,d1e),j(v1e,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(g1e))}function XZ(e){e.registerComponentModel(o1e),e.registerComponentView(c1e),YZ(e)}var m1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._pieceList=[],r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var a=this._mode=this._determineMode();this._pieceList=[],y1e[this._mode].call(this,this._pieceList),this._resetSelected(r,n);var i=this.option.categories;this.resetVisual(function(o,s){a==="categories"?(o.mappingMethod="category",o.categories=Te(i)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=oe(this._pieceList,function(l){return l=Te(l),s!=="inRange"&&(l.visual=null),l}))})},t.prototype.completeVisualOption=function(){var r=this.option,n={},a=Gr.listVisualTypes(),i=this.isCategory();j(r.pieces,function(s){j(a,function(l){s.hasOwnProperty(l)&&(n[l]=1)})}),j(n,function(s,l){var u=!1;j(this.stateList,function(c){u=u||o(r,c,l)||o(r.target,c,l)},this),!u&&j(this.stateList,function(c){(r[c]||(r[c]={}))[l]=WZ.get(l,c==="inRange"?"active":"inactive",i)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(r,n){var a=this.option,i=this._pieceList,o=(n?a:r).selected||{};if(a.selected=o,j(i,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),a.selectedMode==="single"){var s=!1;j(i,function(l,u){var c=this.getSelectedMapKey(l);o[c]&&(s?o[c]=!1:s=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get("itemSymbol")},t.prototype.getSelectedMapKey=function(r){return this._mode==="categories"?r.value+"":r.index+""},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var r=this.option;return r.pieces&&r.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},t.prototype.setSelected=function(r){this.option.selected=Te(r)},t.prototype.getValueState=function(r){var n=Gr.findPieceIndex(r,this._pieceList);return n!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[n])]?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[],a=this._pieceList;return this.eachTargetSeries(function(i){var o=[],s=i.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=Gr.findPieceIndex(l,a);c===r&&o.push(u)},this),n.push({seriesId:i.id,dataIndex:o})},this),n},t.prototype.getRepresentValue=function(r){var n;if(this.isCategory())n=r.value;else if(r.value!=null)n=r.value;else{var a=r.interval||[];n=a[0]===-1/0&&a[1]===1/0?0:(a[0]+a[1])/2}return n},t.prototype.getVisualMeta=function(r){if(this.isCategory())return;var n=[],a=["",""],i=this;function o(c,h){var d=i.getRepresentValue({interval:c});h||(h=i.getValueState(d));var v=r(d,h);c[0]===-1/0?a[0]=v:c[1]===1/0?a[1]=v:n.push({value:c[0],color:v},{value:c[1],color:v})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return j(s,function(c){var h=c.interval;h&&(h[0]>u&&o([u,h[0]],"outOfRange"),o(h.slice()),u=h[1])},this),{stops:n,outerColors:a}},t.type="visualMap.piecewise",t.defaultOption=iu(Hb.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),t}(Hb),y1e={splitNumber:function(e){var t=this.option,r=Math.min(t.precision,20),n=this.getExtent(),a=t.splitNumber;a=Math.max(parseInt(a,10),1),t.splitNumber=a;for(var i=(n[1]-n[0])/a;+i.toFixed(r)!==i&&r<5;)r++;t.precision=r,i=+i.toFixed(r),t.minOpen&&e.push({interval:[-1/0,n[0]],close:[0,0]});for(var o=0,s=n[0];o","≥"][n[0]]];r.text=r.text||this.formatValueText(r.value!=null?r.value:r.interval,!1,a)},this)}};function uB(e,t){var r=e.inverse;(e.orient==="vertical"?!r:r)&&t.reverse()}var x1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.doRender=function(){var r=this.group;r.removeAll();var n=this.visualMapModel,a=n.get("textGap"),i=n.textStyleModel,o=this._getItemAlign(),s=n.itemSize,l=this._getViewData(),u=l.endsText,c=Mn(n.get("showLabel",!0),!u),h=!n.get("selectedMode");u&&this._renderEndsText(r,u[0],s,c,o),j(l.viewPieceList,function(d){var v=d.piece,g=new Ne;g.onclick=ve(this._onItemClick,this,v),this._enableHoverLink(g,d.indexInModelPieceList);var m=n.getRepresentValue(v);if(this._createItemSymbol(g,m,[0,0,s[0],s[1]],h),c){var y=this.visualMapModel.getValueState(m),x=i.get("align")||o;g.add(new ht({style:Et(i,{x:x==="right"?-a:s[0]+a,y:s[1]/2,text:v.text,verticalAlign:i.get("verticalAlign")||"middle",align:x,opacity:_e(i.get("opacity"),y==="outOfRange"?.5:1)}),silent:h}))}r.add(g)},this),u&&this._renderEndsText(r,u[1],s,c,o),xc(n.get("orient"),r,n.get("itemGap")),this.renderBackground(r),this.positionGroup(r)},t.prototype._enableHoverLink=function(r,n){var a=this;r.on("mouseover",function(){return i("highlight")}).on("mouseout",function(){return i("downplay")});var i=function(o){var s=a.visualMapModel;s.option.hoverLink&&a.api.dispatchAction({type:o,batch:Qx(s.findTargetDataIndices(n),s)})}},t.prototype._getItemAlign=function(){var r=this.visualMapModel,n=r.option;if(n.orient==="vertical")return $Z(r,this.api,r.itemSize);var a=n.align;return(!a||a==="auto")&&(a="left"),a},t.prototype._renderEndsText=function(r,n,a,i,o){if(n){var s=new Ne,l=this.visualMapModel.textStyleModel;s.add(new ht({style:Et(l,{x:i?o==="right"?a[0]:0:a[0]/2,y:a[1]/2,verticalAlign:"middle",align:i?o:"center",text:n})})),r.add(s)}},t.prototype._getViewData=function(){var r=this.visualMapModel,n=oe(r.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),a=r.get("text"),i=r.get("orient"),o=r.get("inverse");return(i==="horizontal"?o:!o)?n.reverse():a&&(a=a.slice().reverse()),{viewPieceList:n,endsText:a}},t.prototype._createItemSymbol=function(r,n,a,i){var o=_r(this.getControllerVisual(n,"symbol"),a[0],a[1],a[2],a[3],this.getControllerVisual(n,"color"));o.silent=i,r.add(o)},t.prototype._onItemClick=function(r){var n=this.visualMapModel,a=n.option,i=a.selectedMode;if(i){var o=Te(a.selected),s=n.getSelectedMapKey(r);i==="single"||i===!0?(o[s]=!0,j(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},t.type="visualMap.piecewise",t}(ZZ);function qZ(e){e.registerComponentModel(m1e),e.registerComponentView(x1e),YZ(e)}function _1e(e){$e(XZ),$e(qZ)}var b1e=function(){function e(t){this._thumbnailModel=t}return e.prototype.reset=function(t){this._renderVersion=t.getECUpdateCycleVersion()},e.prototype.renderContent=function(t){var r=t.api.getViewOfComponentModel(this._thumbnailModel);r&&(t.group.silent=!0,r.renderContent({group:t.group,targetTrans:t.targetTrans,z2Range:OH(t.group),roamType:t.roamType,viewportRect:t.viewportRect,renderVersion:this._renderVersion}))},e.prototype.updateWindow=function(t,r){var n=r.getViewOfComponentModel(this._thumbnailModel);n&&n.updateWindow({targetTrans:t,renderVersion:this._renderVersion})},e}(),w1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.preventAutoZ=!0,r}return t.prototype.optionUpdated=function(r,n){this._updateBridge()},t.prototype._updateBridge=function(){var r=this._birdge=this._birdge||new b1e(this);if(this._target=null,this.ecModel.eachSeries(function(a){V3(a,null)}),this.shouldShow()){var n=this.getTarget();V3(n.baseMapProvider,r)}},t.prototype.shouldShow=function(){return this.getShallow("show",!0)},t.prototype.getBridge=function(){return this._birdge},t.prototype.getTarget=function(){if(this._target)return this._target;var r=this.getReferringComponents("series",{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];return r?r.subType!=="graph"&&(r=null):r=this.ecModel.queryComponents({mainType:"series",subType:"graph"})[0],this._target={baseMapProvider:r},this._target},t.type="thumbnail",t.layoutMode="box",t.dependencies=["series","geo"],t.defaultOption={show:!0,right:1,bottom:1,height:"25%",width:"25%",itemStyle:{borderColor:K.color.border,borderWidth:2},windowStyle:{borderWidth:1,color:K.color.neutral30,borderColor:K.color.neutral40,opacity:.3},z:10},t}(Qe),S1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){if(this._api=a,this._model=r,this._coordSys||(this._coordSys=new ow),!this._isEnabled()){this._clear();return}this._renderVersion=a.getECUpdateCycleVersion();var i=this.group;i.removeAll();var o=r.getModel("itemStyle"),s=o.getItemStyle();s.fill==null&&(s.fill=n.get("backgroundColor")||K.color.neutral00);var l=jr(r,a).refContainer,u=Zt(l7(r,!0),l),c=s.lineWidth||0,h=this._contentRect=zc(u.clone(),c/2,!0,!0),d=new Ne;i.add(d),d.setClipPath(new Ke({shape:h.plain()}));var v=this._targetGroup=new Ne;d.add(v);var g=u.plain();g.r=o.getShallow("borderRadius",!0),i.add(this._bgRect=new Ke({style:s,shape:g,silent:!1,cursor:"grab"}));var m=r.getModel("windowStyle"),y=m.getShallow("borderRadius",!0);d.add(this._windowRect=new Ke({shape:{x:0,y:0,width:0,height:0,r:y},style:m.getItemStyle(),silent:!1,cursor:"grab"})),this._dealRenderContent(),this._dealUpdateWindow(),hB(r,this)},t.prototype.renderContent=function(r){this._bridgeRendered=r,this._isEnabled()&&(this._dealRenderContent(),this._dealUpdateWindow(),hB(this._model,this))},t.prototype._dealRenderContent=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=this._targetGroup,a=this._coordSys,i=this._contentRect;if(n.removeAll(),!!r){var o=r.group,s=o.getBoundingRect();n.add(o),this._bgRect.z2=r.z2Range.min-10,sw(a,s.x,s.y,s.width,s.height);var l=Zt({left:"center",top:"center",aspect:s.width/s.height},i);Sb(a,l.x,l.y,l.width,l.height),om(o,a,Yc),o.dirty(),this._windowRect.z2=r.z2Range.max+10,this._resetRoamController(r.roamType)}}},t.prototype.updateWindow=function(r){var n=this._bridgeRendered;n&&n.renderVersion===r.renderVersion&&(n.targetTrans=r.targetTrans),this._isEnabled()&&this._dealUpdateWindow()},t.prototype._dealUpdateWindow=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=Ma([],r.targetTrans),a=Ca([],wb(null,this._coordSys),n);this._transThisToTarget=Ma([],a);var i=r.viewportRect;i?i=i.clone():i=new ke(0,0,this._api.getWidth(),this._api.getHeight()),i.applyTransform(a);var o=this._windowRect,s=o.shape.r;o.setShape(Le({r:s},i))}},t.prototype._resetRoamController=function(r){var n=this,a=this._api,i=this._roamController;if(i||(i=this._roamController=new xh(a.getZr())),!r||!this._isEnabled()){i.disable();return}i.enable(r,{api:a,zInfo:{component:this._model},triggerInfo:{roamTrigger:null,isInSelf:function(o,s,l){return n._contentRect.contain(s,l)}}}),i.off("pan").off("zoom").on("pan",ve(this._onPan,this)).on("zoom",ve(this._onZoom,this))},t.prototype._onPan=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=ir([],[r.oldX,r.oldY],n),i=ir([],[r.oldX-r.dx,r.oldY-r.dy],n);this._api.dispatchAction(cB(this._model.getTarget().baseMapProvider,{dx:i[0]-a[0],dy:i[1]-a[1]}))}},t.prototype._onZoom=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=ir([],[r.originX,r.originY],n);this._api.dispatchAction(cB(this._model.getTarget().baseMapProvider,{zoom:1/r.scale,originX:a[0],originY:a[1]}))}},t.prototype._isEnabled=function(){var r=this._model;if(!r||!r.shouldShow())return!1;var n=r.getTarget().baseMapProvider;return!!n},t.prototype._clear=function(){this.group.removeAll(),this._bridgeRendered=null,this._roamController&&this._roamController.disable()},t.prototype.remove=function(){this._clear()},t.prototype.dispose=function(){this._clear()},t.type="thumbnail",t}(Rt);function cB(e,t){var r=e.mainType==="series"?e.subType+"Roam":e.mainType+"Roam",n={type:r};return n[e.mainType+"Id"]=e.id,te(n,t),n}function hB(e,t){var r=Bc(e);B1(t.group,r.z,r.zlevel)}function C1e(e){e.registerComponentModel(w1e),e.registerComponentView(S1e)}var T1e={label:{enabled:!0},decal:{show:!1}},fB=Ze(),dB=Ze(),M1e=Lm(A1e);function A1e(e,t){var r=e.getModel("aria");if(!r.get("enabled"))return;var n=dB(e).scope||(dB(e).scope={}),a=Te(T1e);We(a.label,e.getLocaleModel().get("aria"),!1),We(r.option,a,!1),i(),o();function i(){var c=r.getModel("decal"),h=c.get("show");if(h){var d=pe();e.eachSeries(function(v){v.isColorBySeries()||(fB(v).scope=d.get(v.type)||d.set(v.type,{}))}),e.eachSeries(function(v){if(Me(v.enableAriaDecal)){v.enableAriaDecal();return}var g=v.getData();if(v.isColorBySeries()){var w=UM(v.ecModel,v.name,n,e.getSeriesCount()),S=g.getVisual("decal");g.setVisual("decal",C(S,w))}else{var m=v.getRawData(),y={},x=fB(v).scope;g.each(function(M){var A=g.getRawIndex(M);y[A]=M});var _=m.count();m.each(function(M){var A=y[M],I=m.getName(M)||M+"",k=UM(v.ecModel,I,x,_),P=g.getItemVisual(A,"decal");g.setItemVisual(A,"decal",C(P,k))})}function C(M,A){var I=M?te(te({},A),M):A;return I.dirty=!0,I}})}}function o(){var c=t.getZr().dom;if(c){var h=e.getLocaleModel().get("aria"),d=r.getModel("label");if(d.option=Le(d.option,h),!!d.get("enabled")){if(c.setAttribute("role","img"),d.get("description")){c.setAttribute("aria-label",d.get("description"));return}var v=e.getSeriesCount(),g=d.get(["data","maxCount"])||10,m=d.get(["series","maxCount"])||10,y=Math.min(v,m),x;if(!(v<1)){var _=l();if(_){var w=d.get(["general","withTitle"]);x=s(w,{title:_})}else x=d.get(["general","withoutTitle"]);var S=[],C=v>1?d.get(["series","multiple","prefix"]):d.get(["series","single","prefix"]);x+=s(C,{seriesCount:v}),e.eachSeries(function(k,P){if(P1?d.get(["series","multiple",E]):d.get(["series","single",E]),D=s(D,{seriesId:k.seriesIndex,seriesName:k.get("name"),seriesType:u(k.subType)});var B=k.getData();if(B.count()>g){var H=d.get(["data","partialData"]);D+=s(H,{displayCnt:g})}else D+=d.get(["data","allData"]);for(var V=d.get(["data","separator","middle"]),U=d.get(["data","separator","end"]),F=d.get(["data","excludeDimensionId"]),Z=[],$=0;$":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},L1e=function(){function e(t){var r=this._condVal=ue(t)?new RegExp(t):XV(t)?t:null;if(r==null){var n="";bt(n)}}return e.prototype.evaluate=function(t){var r=typeof t;return ue(r)?this._condVal.test(t):ft(r)?this._condVal.test(t+""):!1},e}(),I1e=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),P1e=function(){function e(){}return e.prototype.evaluate=function(){for(var t=this.children,r=0;r2&&n.push(a),a=[E,B]}function c(E,B,H,V){Ef(E,H)&&Ef(B,V)||a.push(E,B,H,V,H,V)}function h(E,B,H,V,U,F){var Z=Math.abs(B-E),$=Math.tan(Z/4)*4/3,W=BI:D2&&n.push(a),n}function lN(e,t,r,n,a,i,o,s,l,u){if(Ef(e,r)&&Ef(t,n)&&Ef(a,o)&&Ef(i,s)){l.push(o,s);return}var c=2/u,h=c*c,d=o-e,v=s-t,g=Math.sqrt(d*d+v*v);d/=g,v/=g;var m=r-e,y=n-t,x=a-o,_=i-s,w=m*m+y*y,S=x*x+_*_;if(w=0&&I=0){l.push(o,s);return}var k=[],P=[];Fl(e,r,a,o,.5,k),Fl(t,n,i,s,.5,P),lN(k[0],P[0],k[1],P[1],k[2],P[2],k[3],P[3],l,u),lN(k[4],P[4],k[5],P[5],k[6],P[6],k[7],P[7],l,u)}function Z1e(e,t){var r=sN(e),n=[];t=t||1;for(var a=0;a0)for(var u=0;uMath.abs(u),h=JZ([l,u],c?0:1,t),d=(c?s:u)/h.length,v=0;va,o=JZ([n,a],i?0:1,t),s=i?"width":"height",l=i?"height":"width",u=i?"x":"y",c=i?"y":"x",h=e[s]/o.length,d=0;d1?null:new Pe(m*l+e,m*u+t)}function X1e(e,t,r){var n=new Pe;Pe.sub(n,r,t),n.normalize();var a=new Pe;Pe.sub(a,e,t);var i=a.dot(n);return i}function lf(e,t){var r=e[e.length-1];r&&r[0]===t[0]&&r[1]===t[1]||e.push(t)}function q1e(e,t,r){for(var n=e.length,a=[],i=0;io?(u.x=c.x=s+i/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+i),q1e(t,u,c)}function Ub(e,t,r,n){if(r===1)n.push(t);else{var a=Math.floor(r/2),i=e(t);Ub(e,i[0],a,n),Ub(e,i[1],r-a,n)}return n}function K1e(e,t){for(var r=[],n=0;n0;u/=2){var c=0,h=0;(e&u)>0&&(c=1),(t&u)>0&&(h=1),s+=u*u*(3*c^h),h===0&&(c===1&&(e=u-1-e,t=u-1-t),l=e,e=t,t=l)}return s}function $b(e){var t=1/0,r=1/0,n=-1/0,a=-1/0,i=oe(e,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),c=l.x+l.width/2+(u?u[4]:0),h=l.y+l.height/2+(u?u[5]:0);return t=Math.min(c,t),r=Math.min(h,r),n=Math.max(c,n),a=Math.max(h,a),[c,h]}),o=oe(i,function(s,l){return{cp:s,z:owe(s[0],s[1],t,r,n,a),path:e[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function t$(e){return ewe(e.path,e.count)}function uN(){return{fromIndividuals:[],toIndividuals:[],count:0}}function swe(e,t,r){var n=[];function a(C){for(var M=0;M=0;a--)if(!r[a].many.length){var l=r[s].many;if(l.length<=1)if(s)s=0;else return r;var i=l.length,u=Math.ceil(i/2);r[a].many=l.slice(u,i),r[s].many=l.slice(0,u),s++}return r}var uwe={clone:function(e){for(var t=[],r=1-Math.pow(1-e.path.style.opacity,1/e.count),n=0;n0))return;var s=n.getModel("universalTransition").get("delay"),l=te({setToFinal:!0},o),u,c;wB(e)&&(u=e,c=t),wB(t)&&(u=t,c=e);function h(x,_,w,S,C){var M=x.many,A=x.one;if(M.length===1&&!C){var I=_?M[0]:A,k=_?A:M[0];if(Wb(I))h({many:[I],one:k},!0,w,S,!0);else{var P=s?Le({delay:s(w,S)},l):l;yP(I,k,P),i(I,k,I,k,P)}}else for(var D=Le({dividePath:uwe[r],individualDelay:s&&function(U,F,Z,$){return s(U+w,S)}},l),z=_?swe(M,A,D):lwe(A,M,D),E=z.fromIndividuals,B=z.toIndividuals,H=E.length,V=0;Vt.length,v=u?SB(c,u):SB(d?t:e,[d?e:t]),g=0,m=0;mr$))for(var i=n.getIndices(),o=0;o0&&M.group.traverse(function(I){I instanceof rt&&!I.animators.length&&I.animateFrom({style:{opacity:0}},A)})})}function NB(e){var t=e.getModel("universalTransition").get("seriesKey");return t||e.id}function kB(e){return ne(e)?e.sort().join(","):e}function il(e){if(e.hostModel)return e.hostModel.getModel("universalTransition").get("divideShape")}function gwe(e,t){var r=pe(),n=pe(),a=pe();return j(e.oldSeries,function(i,o){var s=e.oldDataGroupIds[o],l=e.oldData[o],u=NB(i),c=kB(u);n.set(c,{dataGroupId:s,data:l}),ne(u)&&j(u,function(h){a.set(h,{key:c,dataGroupId:s,data:l})})}),j(t.updatedSeries,function(i){if(i.isUniversalTransitionEnabled()&&i.isAnimationEnabled()){var o=i.get("dataGroupId"),s=i.getData(),l=NB(i),u=kB(l),c=n.get(u);if(c)r.set(u,{oldSeries:[{dataGroupId:c.dataGroupId,divide:il(c.data),data:c.data}],newSeries:[{dataGroupId:o,divide:il(s),data:s}]});else if(ne(l)){var h=[];j(l,function(g){var m=n.get(g);m.data&&h.push({dataGroupId:m.dataGroupId,divide:il(m.data),data:m.data})}),h.length&&r.set(u,{oldSeries:h,newSeries:[{dataGroupId:o,data:s,divide:il(s)}]})}else{var d=a.get(l);if(d){var v=r.get(d.key);v||(v={oldSeries:[{dataGroupId:d.dataGroupId,data:d.data,divide:il(d.data)}],newSeries:[]},r.set(d.key,v)),v.newSeries.push({dataGroupId:o,data:s,divide:il(s)})}}}}),r}function LB(e,t){for(var r=0;r=0&&a.push({dataGroupId:t.oldDataGroupIds[s],data:t.oldData[s],divide:il(t.oldData[s]),groupIdDim:o.dimension})}),j(jt(e.to),function(o){var s=LB(r.updatedSeries,o);if(s>=0){var l=r.updatedSeries[s].getData();i.push({dataGroupId:t.oldDataGroupIds[s],data:l,divide:il(l),groupIdDim:o.dimension})}}),a.length>0&&i.length>0&&n$(a,i,n)}function ywe(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){j(jt(n.seriesTransition),function(a){j(jt(a.to),function(i){for(var o=n.updatedSeries,s=0;ss.vmin?n+=s.vmin-a+(t-s.vmin)/(s.vmax-s.vmin)*s.gapReal:n+=t-a,a=s.vmax,i=!1;break}n+=s.vmin-a+s.gapReal,a=s.vmax}return i&&(n+=t-a),n},transformOut:function(t,r){if(r&&r.depth===ps)return t;for(var n=IB,a=PB,i=!0,o=0,s=0;su?o=l.vmin+(t-u)/(c-u)*(l.vmax-l.vmin):o=a+t-n,a=l.vmax,i=!1;break}n=c,a=l.vmax}return i&&(o=a+t-n),o}},e}();function _we(e,t){return new xwe(e,t)}var IB=0,PB=0;function bwe(e,t){var r=0,n={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},a=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},i={S:{tpAbs:a(),tpPrct:a()},E:{tpAbs:a(),tpPrct:a()}};j(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(r+=l.val);var u=xP(s,t);if(u){var c=u.vmin!==s.vmin,h=u.vmax!==s.vmax,d=u.vmax-u.vmin;if(!(c&&h))if(c||h){var v=c?"S":"E";i[v][l.type].has=!0,i[v][l.type].span=d,i[v][l.type].inExtFrac=d/(s.vmax-s.vmin),i[v][l.type].val=l.val}else n[l.type].span+=d,n[l.type].val+=l.val}});var o=r*(0+(t[1]-t[0])+(n.tpAbs.val-n.tpAbs.span)+(i.S.tpAbs.has?(i.S.tpAbs.val-i.S.tpAbs.span)*i.S.tpAbs.inExtFrac:0)+(i.E.tpAbs.has?(i.E.tpAbs.val-i.E.tpAbs.span)*i.E.tpAbs.inExtFrac:0)-n.tpPrct.span-(i.S.tpPrct.has?i.S.tpPrct.span*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.span*i.E.tpPrct.inExtFrac:0))/(1-n.tpPrct.val-(i.S.tpPrct.has?i.S.tpPrct.val*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.val*i.E.tpPrct.inExtFrac:0));j(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(s.gapReal=r!==0?qe(o,0)*l.val/r:0),l.type==="tpAbs"&&(s.gapReal=l.val),s.gapReal==null&&(s.gapReal=0)})}function wwe(e,t,r,n,a,i){e!=="no"&&j(r,function(o){var s=xP(o,i);if(s)for(var l=t.length-1;l>=0;l--){var u=t[l],c=n(u),h=a*3/4;c>s.vmin-h&&ct[0]&&r=0&&o<1-1e-5}j(e,function(o){if(!(!o||o.start==null||o.end==null)&&!o.isExpanded){var s={breakOption:Te(o),vmin:t.parse(o.start),vmax:t.parse(o.end),gapParsed:{type:"tpAbs",val:0},gapReal:null};if(o.gap!=null){var l=!1;if(ue(o.gap)){var u=_a(o.gap);if(u.match(/%$/)){var c=parseFloat(u)/100;a(c)||(c=0),s.gapParsed.type="tpPrct",s.gapParsed.val=c,l=!0}}if(!l){var h=t.parse(o.gap);(!isFinite(h)||h<0)&&(h=0),s.gapParsed.type="tpAbs",s.gapParsed.val=h}}if(s.vmin===s.vmax&&(s.gapParsed.type="tpAbs",s.gapParsed.val=0),r&&r.noNegative&&j(["vmin","vmax"],function(v){s[v]<0&&(s[v]=0)}),s.vmin>s.vmax){var d=s.vmax;s.vmax=s.vmin,s.vmin=d}n.push(s)}}),n.sort(function(o,s){return o.vmin-s.vmin});var i=-1/0;return j(n,function(o,s){i>o.vmin&&(n[s]=null),i=o.vmax}),{breaks:wt(n,function(o){return!!o})}}function _P(e,t){return hN(t)===hN(e)}function hN(e){return e.start+"_\0_"+e.end}function Cwe(e,t,r){var n=[];j(e,function(i,o){var s=t(i);s&&s.type==="vmin"&&n.push([o])}),j(e,function(i,o){var s=t(i);if(s&&s.type==="vmax"){var l=Es(n,function(u){return _P(t(e[u[0]]).parsedBreak.breakOption,s.parsedBreak.breakOption)});l&&l.push(o)}});var a=[];return j(n,function(i){i.length===2&&a.push(r?i:[e[i[0]],e[i[1]]])}),a}function Twe(e,t,r,n){if(t.break){var a=t.break.parsedBreak,i=Es(r,function(c){return _P(c.breakOption,t.break.parsedBreak.breakOption)}),o={lookup:n,depth:ps},s=e.transformOut(a.vmin,o),l=e.transformOut(a.vmax,o),u={vmin:s,vmax:l,breakOption:a.breakOption,gapParsed:Te(i.gapParsed),gapReal:a.gapReal};return{tickVal:u[t.break.type],vBreak:{type:t.break.type,parsedBreak:u}}}}function Mwe(e,t,r,n,a){a.original=cN(e,t,r);var i=a.transformed=cN(e,t,r),o=a.lookup;i.breaks=oe(i.breaks,function(s,l){var u={depth:ps},c=t.transformIn(s.vmin,u),h=t.transformIn(s.vmax,u),d={type:s.gapParsed.type,val:s.gapParsed.type==="tpAbs"?t.transformIn(s.vmin+s.gapParsed.val,u)-c:s.gapParsed.val};return o.from[n+l]=c,o.to[n+l]=s.vmin,o.from[n+l+1]=h,o.to[n+l+1]=s.vmax,{vmin:c,vmax:h,gapParsed:d,gapReal:s.gapReal,breakOption:s.breakOption}})}var Awe={vmin:"start",vmax:"end"};function Nwe(e,t){return t&&(e=e||{},e.break={type:Awe[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function kwe(){Nne({createBreakScaleMapper:_we,pruneTicksByBreak:wwe,addBreaksToTicks:Swe,parseAxisBreakOption:cN,identifyAxisBreak:_P,serializeAxisBreakIdentifier:hN,retrieveAxisBreakPairs:Cwe,getTicksBreakOutwardTransform:Twe,parseAxisBreakOptionInwardTransform:Mwe,makeAxisLabelFormatterParamBreak:Nwe})}var DB=Ze();function Lwe(e,t){var r=Es(e,function(n){return xr().identifyAxisBreak(n.parsedBreak.breakOption,t.breakOption)});return r||e.push(r={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),r}function Iwe(e){j(e,function(t){return t.shouldRemove=!0})}function Pwe(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function Dwe(e,t,r,n,a){var i=r.axis;if(i.scale.isBlank()||!xr())return;var o=xr().retrieveAxisBreakPairs(i.scale.getTicks({breakTicks:"only_break"}),function(k){return k.break},!1);if(!o.length)return;var s=r.getModel("breakArea"),l=s.get("zigzagAmplitude"),u=s.get("zigzagMinSpan"),c=s.get("zigzagMaxSpan");u=Math.max(2,u||0),c=Math.max(u,c||0);var h=s.get("expandOnClick"),d=s.get("zigzagZ"),v=s.getModel("itemStyle"),g=v.getItemStyle(),m=g.stroke,y=g.lineWidth,x=g.lineDash,_=g.fill,w=new Ne({ignoreModelZ:!0}),S=i.isHorizontal(),C=DB(t).visualList||(DB(t).visualList=[]);Iwe(C);for(var M=function(k){var P=o[k][0].break.parsedBreak,D=[];D[0]=i.toGlobalCoord(i.dataToCoord(P.vmin,!0)),D[1]=i.toGlobalCoord(i.dataToCoord(P.vmax,!0)),D[1]=F;ce&&(re=F);var Ue=[],ye=[];Ue[V]=D,ye[V]=z,!se&&!ce&&(Ue[V]+=q?-l:l,ye[V]-=q?l:-l),Ue[U]=re,ye[U]=re,$.push(Ue),W.push(ye);var me=void 0;if(Q_[1]&&_.reverse(),{coordPair:_,brkId:xr().serializeAxisBreakIdentifier(x.breakOption)}});l.sort(function(y,x){return y.coordPair[0]-x.coordPair[0]});for(var u=o[0],c=null,h=0;h=0?l[0].width:l[1].width),d=(h+c.x)/2-u.x,v=Math.min(d,d-c.x),g=Math.max(d,d-c.x),m=g<0?g:v>0?v:0;s=(d-m)/c.x}var y=new Pe,x=new Pe;Pe.scale(y,n,-s),Pe.scale(x,n,1-s),cA(r[0],y),cA(r[1],x)}function Rwe(e,t){var r={breaks:[]};return j(t.breaks,function(n){if(n){var a=Es(e.get("breaks",!0),function(s){return xr().identifyAxisBreak(s,n)});if(a){var i=t.type,o={isExpanded:!!a.isExpanded};a.isExpanded=i===tw?!0:i===Y8?!1:i===X8?!a.isExpanded:a.isExpanded,r.breaks.push({start:a.start,end:a.end,isExpanded:!!a.isExpanded,old:o})}}}),r}function Owe(){Que({adjustBreakLabelPair:jwe,buildAxisBreakLine:Ewe,rectCoordBuildBreakAxis:Dwe,updateModelAxisBreak:Rwe})}function zwe(e){nce(e),kwe(),Owe()}function Bwe(){xhe(Fwe)}function Fwe(e,t){j(e,function(r){if(!r.model.get(["axisLabel","inside"])){var n=Vwe(r);if(n){var a=r.isHorizontal()?"height":"width",i=r.model.get(["axisLabel","margin"]);t[a]-=n[a]+i,r.position==="top"?t.y+=n.height+i:r.position==="left"&&(t.x+=n.width+i)}}})}function Vwe(e){var t=e.model,r=e.scale;if(!t.get(["axisLabel","show"])||r.isBlank())return;var n,a,i=r.getExtent();r instanceof Xg?a=r.count():(n=r.getTicks(),a=n.length);var o=e.getLabelModel(),s=Vm(e),l,u=1;a>40&&(u=Math.ceil(a/40));for(var c=0;c1&&arguments[1]!==void 0?arguments[1]:60,a=null;return function(){for(var i=this,o=arguments.length,s=new Array(o),l=0;l12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function aSe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function iSe(e){return e==="ROUTER"||e==="ROUTER_LATE"?30:e==="REPEATER"||e==="TRACKER"?25:e==="CLIENT_MUTE"?7:e==="CLIENT_BASE"?12:15}function oSe({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const a=O.useRef(null),[i,o]=O.useState("connected"),s=O.useMemo(()=>{const y=new Set;return t.forEach(x=>{y.add(x.from_node),y.add(x.to_node)}),y},[t]),l=O.useMemo(()=>{let y=e;return i==="connected"?y=y.filter(x=>s.has(x.node_num)):i==="infra"&&(y=y.filter(x=>RB.includes(x.role))),y},[e,i,s]),u=O.useMemo(()=>new Map(l.map(y=>[y.node_num,y])),[l]),c=O.useMemo(()=>t.filter(y=>u.has(y.from_node)&&u.has(y.to_node)),[t,u]),h=O.useMemo(()=>{const y=new Set;return r!==null&&c.forEach(x=>{x.from_node===r&&y.add(x.to_node),x.to_node===r&&y.add(x.from_node)}),y},[r,c]),d=O.useMemo(()=>{const y=l.map(_=>{const w=aSe(_.latitude),S=jB[w%jB.length],C=RB.includes(_.role),M=_.node_num===r,A=h.has(_.node_num),I=r===null||M||A;return{id:String(_.node_num),name:_.short_name,value:_.node_num,symbolSize:iSe(_.role),itemStyle:{color:C?S:"#111827",borderColor:S,borderWidth:C?0:2,opacity:I?1:.15},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace",color:I?"#94a3b8":"#94a3b820"},nodeNum:_.node_num,longName:_.long_name,role:_.role}}),x=c.map(_=>{const w=r===null||_.from_node===r||_.to_node===r;return{source:String(_.from_node),target:String(_.to_node),value:_.snr,lineStyle:{color:nSe(_.snr),width:w&&r!==null?2:1,opacity:r===null?.4:w?.6:.04}}});return{nodes:y,links:x}},[l,c,r,h]),v=O.useMemo(()=>({backgroundColor:"#111827",tooltip:{trigger:"item",backgroundColor:"#1e293b",borderColor:"#334155",textStyle:{color:"#e2e8f0",fontFamily:"JetBrains Mono, monospace",fontSize:11},formatter:y=>{if(y.data&&y.data.longName){const x=y.data;return`${x.name}
${x.longName}
Role: ${x.role}`}return""}},series:[{type:"graph",layout:"force",roam:!0,draggable:!0,animation:!1,data:d.nodes,links:d.links,force:{repulsion:200,edgeLength:[80,120],gravity:.1},emphasis:{focus:"adjacency",blurScope:"coordinateSystem",scale:1.1,lineStyle:{width:2}},blur:{itemStyle:{opacity:.15},lineStyle:{opacity:.04}},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace"},edgeLabel:{show:!1},edgeSymbol:["none","none"]}]}),[d]),g=O.useCallback(y=>{if(y.data&&"nodeNum"in y.data){const x=y.data.nodeNum;n(r===x?null:x??null)}},[r,n]),m=O.useMemo(()=>({click:g}),[g]);return O.useEffect(()=>{var x;const y=(x=a.current)==null?void 0:x.getEchartsInstance();y&&y.setOption(v,{notMerge:!1,lazyUpdate:!0})},[v]),f.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[f.jsx(rSe,{ref:a,option:v,style:{height:"540px",width:"100%"},onEvents:m,opts:{renderer:"canvas"}}),f.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2",children:[f.jsx(MV,{size:14,className:"text-slate-500"}),f.jsx("div",{className:"flex gap-1",children:[{key:"connected",label:"Connected"},{key:"infra",label:"Infra"},{key:"all",label:"All"}].map(({key:y,label:x})=>f.jsx("button",{onClick:()=>o(y),className:`px-2 py-1 text-xs rounded transition-colors ${i===y?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:x},y))}),f.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[l.length," nodes • ",c.length," edges"]})]}),f.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[f.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Edge Quality (SNR)"}),f.jsx("div",{className:"space-y-1",children:[{label:"Excellent (>12)",color:"#22c55e"},{label:"Good (8-12)",color:"#4ade80"},{label:"Fair (5-8)",color:"#f59e0b"},{label:"Marginal (3-5)",color:"#f97316"},{label:"Poor (<3)",color:"#ef4444"}].map(y=>f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:y.color}}),f.jsx("span",{className:"text-xs text-slate-500",children:y.label})]},y.label))})]}),f.jsxs("div",{className:"absolute bottom-4 right-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[f.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Node Type"}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 rounded-full bg-sky-400"}),f.jsx("span",{className:"text-xs text-slate-500",children:"Infrastructure"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-900 border-2 border-sky-400"}),f.jsx("span",{className:"text-xs text-slate-500",children:"Client"})]})]})]})]})}function o$(e,t){const r=O.useRef(t);O.useEffect(function(){t!==r.current&&e.attributionControl!=null&&(r.current!=null&&e.attributionControl.removeAttribution(r.current),t!=null&&e.attributionControl.addAttribution(t)),r.current=t},[e,t])}function sSe(e,t,r){t.center!==r.center&&e.setLatLng(t.center),t.radius!=null&&t.radius!==r.radius&&e.setRadius(t.radius)}const lSe=1;function uSe(e){return Object.freeze({__version:lSe,map:e})}function CP(e,t){return Object.freeze({...e,...t})}const s$=O.createContext(null),l$=s$.Provider;function mw(){const e=O.useContext(s$);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function cSe(e){function t(r,n){const{instance:a,context:i}=e(r).current;return O.useImperativeHandle(n,()=>a),r.children==null?null:Qf.createElement(l$,{value:i},r.children)}return O.forwardRef(t)}function hSe(e){function t(r,n){const[a,i]=O.useState(!1),{instance:o}=e(r,i).current;O.useImperativeHandle(n,()=>o),O.useEffect(function(){a&&o.update()},[o,a,r.children]);const s=o._contentNode;return s?sV.createPortal(r.children,s):null}return O.forwardRef(t)}function fSe(e){function t(r,n){const{instance:a}=e(r).current;return O.useImperativeHandle(n,()=>a),null}return O.forwardRef(t)}function TP(e,t){const r=O.useRef();O.useEffect(function(){return t!=null&&e.instance.on(t),r.current=t,function(){r.current!=null&&e.instance.off(r.current),r.current=null}},[e,t])}function yw(e,t){const r=e.pane??t.pane;return r?{...e,pane:r}:e}function dSe(e,t){return function(n,a){const i=mw(),o=e(yw(n,i),i);return o$(i.map,n.attribution),TP(o.current,n.eventHandlers),t(o.current,i,n,a),o}}var vN={exports:{}};/* @preserve - * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com - * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade - */(function(e,t){(function(r,n){n(t)})(CY,function(r){var n="1.9.4";function a(p){var b,T,N,R;for(T=1,N=arguments.length;T"u"||!L||!L.Mixin)){p=w(p)?p:[p];for(var b=0;b0?Math.floor(p):Math.ceil(p)};F.prototype={clone:function(){return new F(this.x,this.y)},add:function(p){return this.clone()._add($(p))},_add:function(p){return this.x+=p.x,this.y+=p.y,this},subtract:function(p){return this.clone()._subtract($(p))},_subtract:function(p){return this.x-=p.x,this.y-=p.y,this},divideBy:function(p){return this.clone()._divideBy(p)},_divideBy:function(p){return this.x/=p,this.y/=p,this},multiplyBy:function(p){return this.clone()._multiplyBy(p)},_multiplyBy:function(p){return this.x*=p,this.y*=p,this},scaleBy:function(p){return new F(this.x*p.x,this.y*p.y)},unscaleBy:function(p){return new F(this.x/p.x,this.y/p.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Z(this.x),this.y=Z(this.y),this},distanceTo:function(p){p=$(p);var b=p.x-this.x,T=p.y-this.y;return Math.sqrt(b*b+T*T)},equals:function(p){return p=$(p),p.x===this.x&&p.y===this.y},contains:function(p){return p=$(p),Math.abs(p.x)<=Math.abs(this.x)&&Math.abs(p.y)<=Math.abs(this.y)},toString:function(){return"Point("+d(this.x)+", "+d(this.y)+")"}};function $(p,b,T){return p instanceof F?p:w(p)?new F(p[0],p[1]):p==null?p:typeof p=="object"&&"x"in p&&"y"in p?new F(p.x,p.y):new F(p,b,T)}function W(p,b){if(p)for(var T=b?[p,b]:p,N=0,R=T.length;N=this.min.x&&T.x<=this.max.x&&b.y>=this.min.y&&T.y<=this.max.y},intersects:function(p){p=q(p);var b=this.min,T=this.max,N=p.min,R=p.max,G=R.x>=b.x&&N.x<=T.x,Y=R.y>=b.y&&N.y<=T.y;return G&&Y},overlaps:function(p){p=q(p);var b=this.min,T=this.max,N=p.min,R=p.max,G=R.x>b.x&&N.xb.y&&N.y=b.lat&&R.lat<=T.lat&&N.lng>=b.lng&&R.lng<=T.lng},intersects:function(p){p=Q(p);var b=this._southWest,T=this._northEast,N=p.getSouthWest(),R=p.getNorthEast(),G=R.lat>=b.lat&&N.lat<=T.lat,Y=R.lng>=b.lng&&N.lng<=T.lng;return G&&Y},overlaps:function(p){p=Q(p);var b=this._southWest,T=this._northEast,N=p.getSouthWest(),R=p.getNorthEast(),G=R.lat>b.lat&&N.latb.lng&&N.lng1,ny=function(){var p=!1;try{var b=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("testPassiveEventSupport",h,b),window.removeEventListener("testPassiveEventSupport",h,b)}catch{}return p}(),ay=function(){return!!document.createElement("canvas").getContext}(),bh=!!(document.createElementNS&&vt("svg").createSVGRect),iy=!!bh&&function(){var p=document.createElement("div");return p.innerHTML="",(p.firstChild&&p.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),oy=!bh&&function(){try{var p=document.createElement("div");p.innerHTML='';var b=p.firstChild;return b.style.behavior="url(#default#VML)",b&&typeof b.adj=="object"}catch{return!1}}(),sy=navigator.platform.indexOf("Mac")===0,ly=navigator.platform.indexOf("Linux")===0;function ha(p){return navigator.userAgent.toLowerCase().indexOf(p)>=0}var He={ie:dr,ielt9:Rr,edge:Xt,webkit:mn,android:Fi,android23:lv,androidStock:Ho,opera:lu,chrome:uv,gecko:Xm,safari:qm,phantom:cv,opera12:_h,win:_w,ie3d:Km,webkit3d:hv,gecko3d:Jm,any3d:ca,mobile:Vi,mobileWebkit:fv,mobileWebkit3d:Qm,msPointer:dv,pointer:vv,touch:ey,touchNative:pv,mobileOpera:ty,mobileGecko:gv,retina:ry,passiveEvents:ny,canvas:ay,svg:bh,vml:oy,inlineSvg:iy,mac:sy,linux:ly},uy=He.msPointer?"MSPointerDown":"pointerdown",Dt=He.msPointer?"MSPointerMove":"pointermove",cy=He.msPointer?"MSPointerUp":"pointerup",hy=He.msPointer?"MSPointerCancel":"pointercancel",mv={touchstart:uy,touchmove:Dt,touchend:cy,touchcancel:hy},fy={touchstart:Cw,touchmove:Sh,touchend:Sh,touchcancel:Sh},Ce={},$n=!1;function wh(p,b,T){return b==="touchstart"&&Sw(),fy[b]?(T=fy[b].bind(this,T),p.addEventListener(mv[b],T,!1),T):(console.warn("wrong event specified:",b),h)}function bw(p,b,T){if(!mv[b]){console.warn("wrong event specified:",b);return}p.removeEventListener(mv[b],T,!1)}function ww(p){Ce[p.pointerId]=p}function uu(p){Ce[p.pointerId]&&(Ce[p.pointerId]=p)}function dy(p){delete Ce[p.pointerId]}function Sw(){$n||(document.addEventListener(uy,ww,!0),document.addEventListener(Dt,uu,!0),document.addEventListener(cy,dy,!0),document.addEventListener(hy,dy,!0),$n=!0)}function Sh(p,b){if(b.pointerType!==(b.MSPOINTER_TYPE_MOUSE||"mouse")){b.touches=[];for(var T in Ce)b.touches.push(Ce[T]);b.changedTouches=[b],p(b)}}function Cw(p,b){b.MSPOINTER_TYPE_TOUCH&&b.pointerType===b.MSPOINTER_TYPE_TOUCH&&vr(b),Sh(p,b)}function Tw(p){var b={},T,N;for(N in p)T=p[N],b[N]=T&&T.bind?T.bind(p):T;return p=b,b.type="dblclick",b.detail=2,b.isTrusted=!1,b._simulated=!0,b}var zs=200;function Ar(p,b){p.addEventListener("dblclick",b);var T=0,N;function R(G){if(G.detail!==1){N=G.detail;return}if(!(G.pointerType==="mouse"||G.sourceCapabilities&&!G.sourceCapabilities.firesTouchEvents)){var Y=IP(G);if(!(Y.some(function(ae){return ae instanceof HTMLLabelElement&&ae.attributes.for})&&!Y.some(function(ae){return ae instanceof HTMLInputElement||ae instanceof HTMLSelectElement}))){var ee=Date.now();ee-T<=zs?(N++,N===2&&b(Tw(G))):N=1,T=ee}}}return p.addEventListener("click",R),{dblclick:b,simDblclick:R}}function Mw(p,b){p.removeEventListener("dblclick",b.dblclick),p.removeEventListener("click",b.simDblclick)}var Ch=je(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Bs=je(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),yv=Bs==="webkitTransition"||Bs==="OTransition"?Bs+"End":"transitionend";function xv(p){return typeof p=="string"?document.getElementById(p):p}function Fs(p,b){var T=p.style[b]||p.currentStyle&&p.currentStyle[b];if((!T||T==="auto")&&document.defaultView){var N=document.defaultView.getComputedStyle(p,null);T=N?N[b]:null}return T==="auto"?null:T}function Tt(p,b,T){var N=document.createElement(p);return N.className=b||"",T&&T.appendChild(N),N}function qt(p){var b=p.parentNode;b&&b.removeChild(p)}function cu(p){for(;p.firstChild;)p.removeChild(p.firstChild)}function ie(p){var b=p.parentNode;b&&b.lastChild!==p&&b.appendChild(p)}function Je(p){var b=p.parentNode;b&&b.firstChild!==p&&b.insertBefore(p,b.firstChild)}function kt(p,b){if(p.classList!==void 0)return p.classList.contains(b);var T=In(p);return T.length>0&&new RegExp("(^|\\s)"+b+"(\\s|$)").test(T)}function Be(p,b){if(p.classList!==void 0)for(var T=g(b),N=0,R=T.length;N0?2*window.devicePixelRatio:1;function DP(p){return He.edge?p.wheelDeltaY/2:p.deltaY&&p.deltaMode===0?-p.deltaY/L$:p.deltaY&&p.deltaMode===1?-p.deltaY*20:p.deltaY&&p.deltaMode===2?-p.deltaY*60:p.deltaX||p.deltaZ?0:p.wheelDelta?(p.wheelDeltaY||p.wheelDelta)/2:p.detail&&Math.abs(p.detail)<32765?-p.detail*20:p.detail?p.detail/-32765*60:0}function Aw(p,b){var T=b.relatedTarget;if(!T)return!0;try{for(;T&&T!==p;)T=T.parentNode}catch{return!1}return T!==p}var I$={__proto__:null,on:st,off:Vt,stopPropagation:ct,disableScrollPropagation:pt,disableClickPropagation:Hi,preventDefault:vr,stop:du,getPropagationPath:IP,getMousePosition:PP,getWheelDelta:DP,isExternalTarget:Aw,addListener:st,removeListener:Vt},EP=U.extend({run:function(p,b,T,N){this.stop(),this._el=p,this._inProgress=!0,this._duration=T||.25,this._easeOutPower=1/Math.max(N||.5,.2),this._startPos=ut(p),this._offset=b.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=D(this._animate,this),this._step()},_step:function(p){var b=+new Date-this._startTime,T=this._duration*1e3;bthis.options.maxZoom)?this.setZoom(p):this},panInsideBounds:function(p,b){this._enforcingBounds=!0;var T=this.getCenter(),N=this._limitCenter(T,this._zoom,Q(p));return T.equals(N)||this.panTo(N,b),this._enforcingBounds=!1,this},panInside:function(p,b){b=b||{};var T=$(b.paddingTopLeft||b.padding||[0,0]),N=$(b.paddingBottomRight||b.padding||[0,0]),R=this.project(this.getCenter()),G=this.project(p),Y=this.getPixelBounds(),ee=q([Y.min.add(T),Y.max.subtract(N)]),ae=ee.getSize();if(!ee.contains(G)){this._enforcingBounds=!0;var he=G.subtract(ee.getCenter()),De=ee.extend(G).getSize().subtract(ae);R.x+=he.x<0?-De.x:De.x,R.y+=he.y<0?-De.y:De.y,this.panTo(this.unproject(R),b),this._enforcingBounds=!1}return this},invalidateSize:function(p){if(!this._loaded)return this;p=a({animate:!1,pan:!0},p===!0?{animate:!0}:p);var b=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var T=this.getSize(),N=b.divideBy(2).round(),R=T.divideBy(2).round(),G=N.subtract(R);return!G.x&&!G.y?this:(p.animate&&p.pan?this.panBy(G):(p.pan&&this._rawPanBy(G),this.fire("move"),p.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:b,newSize:T}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(p){if(p=this._locateOptions=a({timeout:1e4,watch:!1},p),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var b=o(this._handleGeolocationResponse,this),T=o(this._handleGeolocationError,this);return p.watch?this._locationWatchId=navigator.geolocation.watchPosition(b,T,p):navigator.geolocation.getCurrentPosition(b,T,p),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(p){if(this._container._leaflet_id){var b=p.code,T=p.message||(b===1?"permission denied":b===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:b,message:"Geolocation error: "+T+"."})}},_handleGeolocationResponse:function(p){if(this._container._leaflet_id){var b=p.coords.latitude,T=p.coords.longitude,N=new se(b,T),R=N.toBounds(p.coords.accuracy*2),G=this._locateOptions;if(G.setView){var Y=this.getBoundsZoom(R);this.setView(N,G.maxZoom?Math.min(Y,G.maxZoom):Y)}var ee={latlng:N,bounds:R,timestamp:p.timestamp};for(var ae in p.coords)typeof p.coords[ae]=="number"&&(ee[ae]=p.coords[ae]);this.fire("locationfound",ee)}},addHandler:function(p,b){if(!b)return this;var T=this[p]=new b(this);return this._handlers.push(T),this.options[p]&&T.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),qt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(z(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var p;for(p in this._layers)this._layers[p].remove();for(p in this._panes)qt(this._panes[p]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(p,b){var T="leaflet-pane"+(p?" leaflet-"+p.replace("Pane","")+"-pane":""),N=Tt("div",T,b||this._mapPane);return p&&(this._panes[p]=N),N},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var p=this.getPixelBounds(),b=this.unproject(p.getBottomLeft()),T=this.unproject(p.getTopRight());return new re(b,T)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(p,b,T){p=Q(p),T=$(T||[0,0]);var N=this.getZoom()||0,R=this.getMinZoom(),G=this.getMaxZoom(),Y=p.getNorthWest(),ee=p.getSouthEast(),ae=this.getSize().subtract(T),he=q(this.project(ee,N),this.project(Y,N)).getSize(),De=He.any3d?this.options.zoomSnap:1,et=ae.x/he.x,_t=ae.y/he.y,Pn=b?Math.max(et,_t):Math.min(et,_t);return N=this.getScaleZoom(Pn,N),De&&(N=Math.round(N/(De/100))*(De/100),N=b?Math.ceil(N/De)*De:Math.floor(N/De)*De),Math.max(R,Math.min(G,N))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new F(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(p,b){var T=this._getTopLeftPoint(p,b);return new W(T,T.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(p){return this.options.crs.getProjectedBounds(p===void 0?this.getZoom():p)},getPane:function(p){return typeof p=="string"?this._panes[p]:p},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(p,b){var T=this.options.crs;return b=b===void 0?this._zoom:b,T.scale(p)/T.scale(b)},getScaleZoom:function(p,b){var T=this.options.crs;b=b===void 0?this._zoom:b;var N=T.zoom(p*T.scale(b));return isNaN(N)?1/0:N},project:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.latLngToPoint(ce(p),b)},unproject:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.pointToLatLng($(p),b)},layerPointToLatLng:function(p){var b=$(p).add(this.getPixelOrigin());return this.unproject(b)},latLngToLayerPoint:function(p){var b=this.project(ce(p))._round();return b._subtract(this.getPixelOrigin())},wrapLatLng:function(p){return this.options.crs.wrapLatLng(ce(p))},wrapLatLngBounds:function(p){return this.options.crs.wrapLatLngBounds(Q(p))},distance:function(p,b){return this.options.crs.distance(ce(p),ce(b))},containerPointToLayerPoint:function(p){return $(p).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(p){return $(p).add(this._getMapPanePos())},containerPointToLatLng:function(p){var b=this.containerPointToLayerPoint($(p));return this.layerPointToLatLng(b)},latLngToContainerPoint:function(p){return this.layerPointToContainerPoint(this.latLngToLayerPoint(ce(p)))},mouseEventToContainerPoint:function(p){return PP(p,this._container)},mouseEventToLayerPoint:function(p){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(p))},mouseEventToLatLng:function(p){return this.layerPointToLatLng(this.mouseEventToLayerPoint(p))},_initContainer:function(p){var b=this._container=xv(p);if(b){if(b._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");st(b,"scroll",this._onScroll,this),this._containerId=l(b)},_initLayout:function(){var p=this._container;this._fadeAnimated=this.options.fadeAnimation&&He.any3d,Be(p,"leaflet-container"+(He.touch?" leaflet-touch":"")+(He.retina?" leaflet-retina":"")+(He.ielt9?" leaflet-oldie":"")+(He.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var b=Fs(p,"position");b!=="absolute"&&b!=="relative"&&b!=="fixed"&&b!=="sticky"&&(p.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var p=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Re(this._mapPane,new F(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Be(p.markerPane,"leaflet-zoom-hide"),Be(p.shadowPane,"leaflet-zoom-hide"))},_resetView:function(p,b,T){Re(this._mapPane,new F(0,0));var N=!this._loaded;this._loaded=!0,b=this._limitZoom(b),this.fire("viewprereset");var R=this._zoom!==b;this._moveStart(R,T)._move(p,b)._moveEnd(R),this.fire("viewreset"),N&&this.fire("load")},_moveStart:function(p,b){return p&&this.fire("zoomstart"),b||this.fire("movestart"),this},_move:function(p,b,T,N){b===void 0&&(b=this._zoom);var R=this._zoom!==b;return this._zoom=b,this._lastCenter=p,this._pixelOrigin=this._getNewPixelOrigin(p),N?T&&T.pinch&&this.fire("zoom",T):((R||T&&T.pinch)&&this.fire("zoom",T),this.fire("move",T)),this},_moveEnd:function(p){return p&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return z(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(p){Re(this._mapPane,this._getMapPanePos().subtract(p))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(p){this._targets={},this._targets[l(this._container)]=this;var b=p?Vt:st;b(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&b(window,"resize",this._onResize,this),He.any3d&&this.options.transform3DLimit&&(p?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){z(this._resizeRequest),this._resizeRequest=D(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var p=this._getMapPanePos();Math.max(Math.abs(p.x),Math.abs(p.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(p,b){for(var T=[],N,R=b==="mouseout"||b==="mouseover",G=p.target||p.srcElement,Y=!1;G;){if(N=this._targets[l(G)],N&&(b==="click"||b==="preclick")&&this._draggableMoved(N)){Y=!0;break}if(N&&N.listens(b,!0)&&(R&&!Aw(G,p)||(T.push(N),R))||G===this._container)break;G=G.parentNode}return!T.length&&!Y&&!R&&this.listens(b,!0)&&(T=[this]),T},_isClickDisabled:function(p){for(;p&&p!==this._container;){if(p._leaflet_disable_click)return!0;p=p.parentNode}},_handleDOMEvent:function(p){var b=p.target||p.srcElement;if(!(!this._loaded||b._leaflet_disable_events||p.type==="click"&&this._isClickDisabled(b))){var T=p.type;T==="mousedown"&&kh(b),this._fireDOMEvent(p,T)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(p,b,T){if(p.type==="click"){var N=a({},p);N.type="preclick",this._fireDOMEvent(N,N.type,T)}var R=this._findEventTargets(p,b);if(T){for(var G=[],Y=0;Y0?Math.round(p-b)/2:Math.max(0,Math.ceil(p))-Math.max(0,Math.floor(b))},_limitZoom:function(p){var b=this.getMinZoom(),T=this.getMaxZoom(),N=He.any3d?this.options.zoomSnap:1;return N&&(p=Math.round(p/N)*N),Math.max(b,Math.min(T,p))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){lt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(p,b){var T=this._getCenterOffset(p)._trunc();return(b&&b.animate)!==!0&&!this.getSize().contains(T)?!1:(this.panBy(T,b),!0)},_createAnimProxy:function(){var p=this._proxy=Tt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(p),this.on("zoomanim",function(b){var T=Ch,N=this._proxy.style[T];Ye(this._proxy,this.project(b.center,b.zoom),this.getZoomScale(b.zoom,1)),N===this._proxy.style[T]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){qt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var p=this.getCenter(),b=this.getZoom();Ye(this._proxy,this.project(p,b),this.getZoomScale(b,1))},_catchTransitionEnd:function(p){this._animatingZoom&&p.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(p,b,T){if(this._animatingZoom)return!0;if(T=T||{},!this._zoomAnimated||T.animate===!1||this._nothingToAnimate()||Math.abs(b-this._zoom)>this.options.zoomAnimationThreshold)return!1;var N=this.getZoomScale(b),R=this._getCenterOffset(p)._divideBy(1-1/N);return T.animate!==!0&&!this.getSize().contains(R)?!1:(D(function(){this._moveStart(!0,T.noMoveStart||!1)._animateZoom(p,b,!0)},this),!0)},_animateZoom:function(p,b,T,N){this._mapPane&&(T&&(this._animatingZoom=!0,this._animateToCenter=p,this._animateToZoom=b,Be(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:p,zoom:b,noUpdate:N}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(o(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&<(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function P$(p,b){return new Nt(p,b)}var fi=B.extend({options:{position:"topright"},initialize:function(p){m(this,p)},getPosition:function(){return this.options.position},setPosition:function(p){var b=this._map;return b&&b.removeControl(this),this.options.position=p,b&&b.addControl(this),this},getContainer:function(){return this._container},addTo:function(p){this.remove(),this._map=p;var b=this._container=this.onAdd(p),T=this.getPosition(),N=p._controlCorners[T];return Be(b,"leaflet-control"),T.indexOf("bottom")!==-1?N.insertBefore(b,N.firstChild):N.appendChild(b),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(qt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(p){this._map&&p&&p.screenX>0&&p.screenY>0&&this._map.getContainer().focus()}}),bv=function(p){return new fi(p)};Nt.include({addControl:function(p){return p.addTo(this),this},removeControl:function(p){return p.remove(),this},_initControlPos:function(){var p=this._controlCorners={},b="leaflet-",T=this._controlContainer=Tt("div",b+"control-container",this._container);function N(R,G){var Y=b+R+" "+b+G;p[R+G]=Tt("div",Y,T)}N("top","left"),N("top","right"),N("bottom","left"),N("bottom","right")},_clearControlPos:function(){for(var p in this._controlCorners)qt(this._controlCorners[p]);qt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var jP=fi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(p,b,T,N){return T1,this._baseLayersList.style.display=p?"":"none"),this._separator.style.display=b&&p?"":"none",this},_onLayerChange:function(p){this._handlingClick||this._update();var b=this._getLayer(l(p.target)),T=b.overlay?p.type==="add"?"overlayadd":"overlayremove":p.type==="add"?"baselayerchange":null;T&&this._map.fire(T,b)},_createRadioElement:function(p,b){var T='",N=document.createElement("div");return N.innerHTML=T,N.firstChild},_addItem:function(p){var b=document.createElement("label"),T=this._map.hasLayer(p.layer),N;p.overlay?(N=document.createElement("input"),N.type="checkbox",N.className="leaflet-control-layers-selector",N.defaultChecked=T):N=this._createRadioElement("leaflet-base-layers_"+l(this),T),this._layerControlInputs.push(N),N.layerId=l(p.layer),st(N,"click",this._onInputClick,this);var R=document.createElement("span");R.innerHTML=" "+p.name;var G=document.createElement("span");b.appendChild(G),G.appendChild(N),G.appendChild(R);var Y=p.overlay?this._overlaysList:this._baseLayersList;return Y.appendChild(b),this._checkDisabledLayers(),b},_onInputClick:function(){if(!this._preventClick){var p=this._layerControlInputs,b,T,N=[],R=[];this._handlingClick=!0;for(var G=p.length-1;G>=0;G--)b=p[G],T=this._getLayer(b.layerId).layer,b.checked?N.push(T):b.checked||R.push(T);for(G=0;G=0;R--)b=p[R],T=this._getLayer(b.layerId).layer,b.disabled=T.options.minZoom!==void 0&&NT.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var p=this._section;this._preventClick=!0,st(p,"click",vr),this.expand();var b=this;setTimeout(function(){Vt(p,"click",vr),b._preventClick=!1})}}),D$=function(p,b,T){return new jP(p,b,T)},Nw=fi.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(p){var b="leaflet-control-zoom",T=Tt("div",b+" leaflet-bar"),N=this.options;return this._zoomInButton=this._createButton(N.zoomInText,N.zoomInTitle,b+"-in",T,this._zoomIn),this._zoomOutButton=this._createButton(N.zoomOutText,N.zoomOutTitle,b+"-out",T,this._zoomOut),this._updateDisabled(),p.on("zoomend zoomlevelschange",this._updateDisabled,this),T},onRemove:function(p){p.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(p){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(p.shiftKey?3:1))},_createButton:function(p,b,T,N,R){var G=Tt("a",T,N);return G.innerHTML=p,G.href="#",G.title=b,G.setAttribute("role","button"),G.setAttribute("aria-label",b),Hi(G),st(G,"click",du),st(G,"click",R,this),st(G,"click",this._refocusOnMap,this),G},_updateDisabled:function(){var p=this._map,b="leaflet-disabled";lt(this._zoomInButton,b),lt(this._zoomOutButton,b),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||p._zoom===p.getMinZoom())&&(Be(this._zoomOutButton,b),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||p._zoom===p.getMaxZoom())&&(Be(this._zoomInButton,b),this._zoomInButton.setAttribute("aria-disabled","true"))}});Nt.mergeOptions({zoomControl:!0}),Nt.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Nw,this.addControl(this.zoomControl))});var E$=function(p){return new Nw(p)},RP=fi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(p){var b="leaflet-control-scale",T=Tt("div",b),N=this.options;return this._addScales(N,b+"-line",T),p.on(N.updateWhenIdle?"moveend":"move",this._update,this),p.whenReady(this._update,this),T},onRemove:function(p){p.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(p,b,T){p.metric&&(this._mScale=Tt("div",b,T)),p.imperial&&(this._iScale=Tt("div",b,T))},_update:function(){var p=this._map,b=p.getSize().y/2,T=p.distance(p.containerPointToLatLng([0,b]),p.containerPointToLatLng([this.options.maxWidth,b]));this._updateScales(T)},_updateScales:function(p){this.options.metric&&p&&this._updateMetric(p),this.options.imperial&&p&&this._updateImperial(p)},_updateMetric:function(p){var b=this._getRoundNum(p),T=b<1e3?b+" m":b/1e3+" km";this._updateScale(this._mScale,T,b/p)},_updateImperial:function(p){var b=p*3.2808399,T,N,R;b>5280?(T=b/5280,N=this._getRoundNum(T),this._updateScale(this._iScale,N+" mi",N/T)):(R=this._getRoundNum(b),this._updateScale(this._iScale,R+" ft",R/b))},_updateScale:function(p,b,T){p.style.width=Math.round(this.options.maxWidth*T)+"px",p.innerHTML=b},_getRoundNum:function(p){var b=Math.pow(10,(Math.floor(p)+"").length-1),T=p/b;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:1,b*T}}),j$=function(p){return new RP(p)},R$='',kw=fi.extend({options:{position:"bottomright",prefix:''+(He.inlineSvg?R$+" ":"")+"Leaflet"},initialize:function(p){m(this,p),this._attributions={}},onAdd:function(p){p.attributionControl=this,this._container=Tt("div","leaflet-control-attribution"),Hi(this._container);for(var b in p._layers)p._layers[b].getAttribution&&this.addAttribution(p._layers[b].getAttribution());return this._update(),p.on("layeradd",this._addAttribution,this),this._container},onRemove:function(p){p.off("layeradd",this._addAttribution,this)},_addAttribution:function(p){p.layer.getAttribution&&(this.addAttribution(p.layer.getAttribution()),p.layer.once("remove",function(){this.removeAttribution(p.layer.getAttribution())},this))},setPrefix:function(p){return this.options.prefix=p,this._update(),this},addAttribution:function(p){return p?(this._attributions[p]||(this._attributions[p]=0),this._attributions[p]++,this._update(),this):this},removeAttribution:function(p){return p?(this._attributions[p]&&(this._attributions[p]--,this._update()),this):this},_update:function(){if(this._map){var p=[];for(var b in this._attributions)this._attributions[b]&&p.push(b);var T=[];this.options.prefix&&T.push(this.options.prefix),p.length&&T.push(p.join(", ")),this._container.innerHTML=T.join(' ')}}});Nt.mergeOptions({attributionControl:!0}),Nt.addInitHook(function(){this.options.attributionControl&&new kw().addTo(this)});var O$=function(p){return new kw(p)};fi.Layers=jP,fi.Zoom=Nw,fi.Scale=RP,fi.Attribution=kw,bv.layers=D$,bv.zoom=E$,bv.scale=j$,bv.attribution=O$;var Ui=B.extend({initialize:function(p){this._map=p},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Ui.addTo=function(p,b){return p.addHandler(b,this),this};var z$={Events:V},OP=He.touch?"touchstart mousedown":"mousedown",Gs=U.extend({options:{clickTolerance:3},initialize:function(p,b,T,N){m(this,N),this._element=p,this._dragStartTarget=b||p,this._preventOutline=T},enable:function(){this._enabled||(st(this._dragStartTarget,OP,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Gs._dragging===this&&this.finishDrag(!0),Vt(this._dragStartTarget,OP,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(p){if(this._enabled&&(this._moved=!1,!kt(this._element,"leaflet-zoom-anim"))){if(p.touches&&p.touches.length!==1){Gs._dragging===this&&this.finishDrag();return}if(!(Gs._dragging||p.shiftKey||p.which!==1&&p.button!==1&&!p.touches)&&(Gs._dragging=this,this._preventOutline&&kh(this._element),Mh(),fa(),!this._moving)){this.fire("down");var b=p.touches?p.touches[0]:p,T=_v(this._element);this._startPoint=new F(b.clientX,b.clientY),this._startPos=ut(this._element),this._parentScale=Lh(T);var N=p.type==="mousedown";st(document,N?"mousemove":"touchmove",this._onMove,this),st(document,N?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(p){if(this._enabled){if(p.touches&&p.touches.length>1){this._moved=!0;return}var b=p.touches&&p.touches.length===1?p.touches[0]:p,T=new F(b.clientX,b.clientY)._subtract(this._startPoint);!T.x&&!T.y||Math.abs(T.x)+Math.abs(T.y)G&&(Y=ee,G=ae);G>T&&(b[Y]=1,Iw(p,b,T,N,Y),Iw(p,b,T,Y,R))}function G$(p,b){for(var T=[p[0]],N=1,R=0,G=p.length;Nb&&(T.push(p[N]),R=N);return Rb.max.x&&(T|=2),p.yb.max.y&&(T|=8),T}function H$(p,b){var T=b.x-p.x,N=b.y-p.y;return T*T+N*N}function wv(p,b,T,N){var R=b.x,G=b.y,Y=T.x-R,ee=T.y-G,ae=Y*Y+ee*ee,he;return ae>0&&(he=((p.x-R)*Y+(p.y-G)*ee)/ae,he>1?(R=T.x,G=T.y):he>0&&(R+=Y*he,G+=ee*he)),Y=p.x-R,ee=p.y-G,N?Y*Y+ee*ee:new F(R,G)}function Pa(p){return!w(p[0])||typeof p[0][0]!="object"&&typeof p[0][0]<"u"}function UP(p){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Pa(p)}function WP(p,b){var T,N,R,G,Y,ee,ae,he;if(!p||p.length===0)throw new Error("latlngs not passed");Pa(p)||(console.warn("latlngs are not flat! Only the first ring will be used"),p=p[0]);var De=ce([0,0]),et=Q(p),_t=et.getNorthWest().distanceTo(et.getSouthWest())*et.getNorthEast().distanceTo(et.getNorthWest());_t<1700&&(De=Lw(p));var Pn=p.length,Wr=[];for(T=0;TN){ae=(G-N)/R,he=[ee.x-ae*(ee.x-Y.x),ee.y-ae*(ee.y-Y.y)];break}var Yn=b.unproject($(he));return ce([Yn.lat+De.lat,Yn.lng+De.lng])}var U$={__proto__:null,simplify:FP,pointToSegmentDistance:VP,closestPointOnSegment:F$,clipSegment:HP,_getEdgeIntersection:py,_getBitCode:vu,_sqClosestPointOnSegment:wv,isFlat:Pa,_flat:UP,polylineCenter:WP},Pw={project:function(p){return new F(p.lng,p.lat)},unproject:function(p){return new se(p.y,p.x)},bounds:new W([-180,-90],[180,90])},Dw={R:6378137,R_MINOR:6356752314245179e-9,bounds:new W([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(p){var b=Math.PI/180,T=this.R,N=p.lat*b,R=this.R_MINOR/T,G=Math.sqrt(1-R*R),Y=G*Math.sin(N),ee=Math.tan(Math.PI/4-N/2)/Math.pow((1-Y)/(1+Y),G/2);return N=-T*Math.log(Math.max(ee,1e-10)),new F(p.lng*b*T,N)},unproject:function(p){for(var b=180/Math.PI,T=this.R,N=this.R_MINOR/T,R=Math.sqrt(1-N*N),G=Math.exp(-p.y/T),Y=Math.PI/2-2*Math.atan(G),ee=0,ae=.1,he;ee<15&&Math.abs(ae)>1e-7;ee++)he=R*Math.sin(Y),he=Math.pow((1-he)/(1+he),R/2),ae=Math.PI/2-2*Math.atan(G*he)-Y,Y+=ae;return new se(Y*b,p.x*b/T)}},W$={__proto__:null,LonLat:Pw,Mercator:Dw,SphericalMercator:Oe},Z$=a({},ye,{code:"EPSG:3395",projection:Dw,transformation:function(){var p=.5/(Math.PI*Dw.R);return we(p,.5,-p,.5)}()}),ZP=a({},ye,{code:"EPSG:4326",projection:Pw,transformation:we(1/180,1,-1/180,.5)}),$$=a({},Ue,{projection:Pw,transformation:we(1,0,-1,0),scale:function(p){return Math.pow(2,p)},zoom:function(p){return Math.log(p)/Math.LN2},distance:function(p,b){var T=b.lng-p.lng,N=b.lat-p.lat;return Math.sqrt(T*T+N*N)},infinite:!0});Ue.Earth=ye,Ue.EPSG3395=Z$,Ue.EPSG3857=yt,Ue.EPSG900913=nt,Ue.EPSG4326=ZP,Ue.Simple=$$;var di=U.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(p){return p.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(p){return p&&p.removeLayer(this),this},getPane:function(p){return this._map.getPane(p?this.options[p]||p:this.options.pane)},addInteractiveTarget:function(p){return this._map._targets[l(p)]=this,this},removeInteractiveTarget:function(p){return delete this._map._targets[l(p)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(p){var b=p.target;if(b.hasLayer(this)){if(this._map=b,this._zoomAnimated=b._zoomAnimated,this.getEvents){var T=this.getEvents();b.on(T,this),this.once("remove",function(){b.off(T,this)},this)}this.onAdd(b),this.fire("add"),b.fire("layeradd",{layer:this})}}});Nt.include({addLayer:function(p){if(!p._layerAdd)throw new Error("The provided object is not a Layer.");var b=l(p);return this._layers[b]?this:(this._layers[b]=p,p._mapToAdd=this,p.beforeAdd&&p.beforeAdd(this),this.whenReady(p._layerAdd,p),this)},removeLayer:function(p){var b=l(p);return this._layers[b]?(this._loaded&&p.onRemove(this),delete this._layers[b],this._loaded&&(this.fire("layerremove",{layer:p}),p.fire("remove")),p._map=p._mapToAdd=null,this):this},hasLayer:function(p){return l(p)in this._layers},eachLayer:function(p,b){for(var T in this._layers)p.call(b,this._layers[T]);return this},_addLayers:function(p){p=p?w(p)?p:[p]:[];for(var b=0,T=p.length;bthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&b[0]instanceof se&&b[0].equals(b[T-1])&&b.pop(),b},_setLatLngs:function(p){Wo.prototype._setLatLngs.call(this,p),Pa(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Pa(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var p=this._renderer._bounds,b=this.options.weight,T=new F(b,b);if(p=new W(p.min.subtract(T),p.max.add(T)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(p))){if(this.options.noClip){this._parts=this._rings;return}for(var N=0,R=this._rings.length,G;Np.y!=R.y>p.y&&p.x<(R.x-N.x)*(p.y-N.y)/(R.y-N.y)+N.x&&(b=!b);return b||Wo.prototype._containsPoint.call(this,p,!0)}});function tY(p,b){return new Eh(p,b)}var Zo=Uo.extend({initialize:function(p,b){m(this,b),this._layers={},p&&this.addData(p)},addData:function(p){var b=w(p)?p:p.features,T,N,R;if(b){for(T=0,N=b.length;T0&&R.push(R[0].slice()),R}function jh(p,b){return p.feature?a({},p.feature,{geometry:b}):by(b)}function by(p){return p.type==="Feature"||p.type==="FeatureCollection"?p:{type:"Feature",properties:{},geometry:p}}var Ow={toGeoJSON:function(p){return jh(this,{type:"Point",coordinates:Rw(this.getLatLng(),p)})}};gy.include(Ow),Ew.include(Ow),my.include(Ow),Wo.include({toGeoJSON:function(p){var b=!Pa(this._latlngs),T=_y(this._latlngs,b?1:0,!1,p);return jh(this,{type:(b?"Multi":"")+"LineString",coordinates:T})}}),Eh.include({toGeoJSON:function(p){var b=!Pa(this._latlngs),T=b&&!Pa(this._latlngs[0]),N=_y(this._latlngs,T?2:b?1:0,!0,p);return b||(N=[N]),jh(this,{type:(T?"Multi":"")+"Polygon",coordinates:N})}}),Ph.include({toMultiPoint:function(p){var b=[];return this.eachLayer(function(T){b.push(T.toGeoJSON(p).geometry.coordinates)}),jh(this,{type:"MultiPoint",coordinates:b})},toGeoJSON:function(p){var b=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(b==="MultiPoint")return this.toMultiPoint(p);var T=b==="GeometryCollection",N=[];return this.eachLayer(function(R){if(R.toGeoJSON){var G=R.toGeoJSON(p);if(T)N.push(G.geometry);else{var Y=by(G);Y.type==="FeatureCollection"?N.push.apply(N,Y.features):N.push(Y)}}}),T?jh(this,{geometries:N,type:"GeometryCollection"}):{type:"FeatureCollection",features:N}}});function XP(p,b){return new Zo(p,b)}var rY=XP,wy=di.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(p,b,T){this._url=p,this._bounds=Q(b),m(this,T)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Be(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){qt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(p){return this.options.opacity=p,this._image&&this._updateOpacity(),this},setStyle:function(p){return p.opacity&&this.setOpacity(p.opacity),this},bringToFront:function(){return this._map&&ie(this._image),this},bringToBack:function(){return this._map&&Je(this._image),this},setUrl:function(p){return this._url=p,this._image&&(this._image.src=p),this},setBounds:function(p){return this._bounds=Q(p),this._map&&this._reset(),this},getEvents:function(){var p={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(p.zoomanim=this._animateZoom),p},setZIndex:function(p){return this.options.zIndex=p,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var p=this._url.tagName==="IMG",b=this._image=p?this._url:Tt("img");if(Be(b,"leaflet-image-layer"),this._zoomAnimated&&Be(b,"leaflet-zoom-animated"),this.options.className&&Be(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onload=o(this.fire,this,"load"),b.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),p){this._url=b.src;return}b.src=this._url,b.alt=this.options.alt},_animateZoom:function(p){var b=this._map.getZoomScale(p.zoom),T=this._map._latLngBoundsToNewLayerBounds(this._bounds,p.zoom,p.center).min;Ye(this._image,T,b)},_reset:function(){var p=this._image,b=new W(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),T=b.getSize();Re(p,b.min),p.style.width=T.x+"px",p.style.height=T.y+"px"},_updateOpacity:function(){er(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var p=this.options.errorOverlayUrl;p&&this._url!==p&&(this._url=p,this._image.src=p)},getCenter:function(){return this._bounds.getCenter()}}),nY=function(p,b,T){return new wy(p,b,T)},qP=wy.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var p=this._url.tagName==="VIDEO",b=this._image=p?this._url:Tt("video");if(Be(b,"leaflet-image-layer"),this._zoomAnimated&&Be(b,"leaflet-zoom-animated"),this.options.className&&Be(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onloadeddata=o(this.fire,this,"load"),p){for(var T=b.getElementsByTagName("source"),N=[],R=0;R0?N:[b.src];return}w(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(b.style,"objectFit")&&(b.style.objectFit="fill"),b.autoplay=!!this.options.autoplay,b.loop=!!this.options.loop,b.muted=!!this.options.muted,b.playsInline=!!this.options.playsInline;for(var G=0;GR?(b.height=R+"px",Be(p,G)):lt(p,G),this._containerWidth=this._container.offsetWidth},_animateZoom:function(p){var b=this._map._latLngToNewLayerPoint(this._latlng,p.zoom,p.center),T=this._getAnchor();Re(this._container,b.add(T))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var p=this._map,b=parseInt(Fs(this._container,"marginBottom"),10)||0,T=this._container.offsetHeight+b,N=this._containerWidth,R=new F(this._containerLeft,-T-this._containerBottom);R._add(ut(this._container));var G=p.layerPointToContainerPoint(R),Y=$(this.options.autoPanPadding),ee=$(this.options.autoPanPaddingTopLeft||Y),ae=$(this.options.autoPanPaddingBottomRight||Y),he=p.getSize(),De=0,et=0;G.x+N+ae.x>he.x&&(De=G.x+N-he.x+ae.x),G.x-De-ee.x<0&&(De=G.x-ee.x),G.y+T+ae.y>he.y&&(et=G.y+T-he.y+ae.y),G.y-et-ee.y<0&&(et=G.y-ee.y),(De||et)&&(this.options.keepInView&&(this._autopanning=!0),p.fire("autopanstart").panBy([De,et]))}},_getAnchor:function(){return $(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),oY=function(p,b){return new Sy(p,b)};Nt.mergeOptions({closePopupOnClick:!0}),Nt.include({openPopup:function(p,b,T){return this._initOverlay(Sy,p,b,T).openOn(this),this},closePopup:function(p){return p=arguments.length?p:this._popup,p&&p.close(),this}}),di.include({bindPopup:function(p,b){return this._popup=this._initOverlay(Sy,this._popup,p,b),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(p){return this._popup&&(this instanceof Uo||(this._popup._source=this),this._popup._prepareOpen(p||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(p){return this._popup&&this._popup.setContent(p),this},getPopup:function(){return this._popup},_openPopup:function(p){if(!(!this._popup||!this._map)){du(p);var b=p.layer||p.target;if(this._popup._source===b&&!(b instanceof Hs)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(p.latlng);return}this._popup._source=b,this.openPopup(p.latlng)}},_movePopup:function(p){this._popup.setLatLng(p.latlng)},_onKeyPress:function(p){p.originalEvent.keyCode===13&&this._openPopup(p)}});var Cy=Wi.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(p){Wi.prototype.onAdd.call(this,p),this.setOpacity(this.options.opacity),p.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(p){Wi.prototype.onRemove.call(this,p),p.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var p=Wi.prototype.getEvents.call(this);return this.options.permanent||(p.preclick=this.close),p},_initLayout:function(){var p="leaflet-tooltip",b=p+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=Tt("div",b),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+l(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(p){var b,T,N=this._map,R=this._container,G=N.latLngToContainerPoint(N.getCenter()),Y=N.layerPointToContainerPoint(p),ee=this.options.direction,ae=R.offsetWidth,he=R.offsetHeight,De=$(this.options.offset),et=this._getAnchor();ee==="top"?(b=ae/2,T=he):ee==="bottom"?(b=ae/2,T=0):ee==="center"?(b=ae/2,T=he/2):ee==="right"?(b=0,T=he/2):ee==="left"?(b=ae,T=he/2):Y.xthis.options.maxZoom||TN?this._retainParent(R,G,Y,N):!1)},_retainChildren:function(p,b,T,N){for(var R=2*p;R<2*p+2;R++)for(var G=2*b;G<2*b+2;G++){var Y=new F(R,G);Y.z=T+1;var ee=this._tileCoordsToKey(Y),ae=this._tiles[ee];if(ae&&ae.active){ae.retain=!0;continue}else ae&&ae.loaded&&(ae.retain=!0);T+1this.options.maxZoom||this.options.minZoom!==void 0&&R1){this._setView(p,T);return}for(var et=R.min.y;et<=R.max.y;et++)for(var _t=R.min.x;_t<=R.max.x;_t++){var Pn=new F(_t,et);if(Pn.z=this._tileZoom,!!this._isValidTile(Pn)){var Wr=this._tiles[this._tileCoordsToKey(Pn)];Wr?Wr.current=!0:Y.push(Pn)}}if(Y.sort(function(Yn,Oh){return Yn.distanceTo(G)-Oh.distanceTo(G)}),Y.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Da=document.createDocumentFragment();for(_t=0;_tT.max.x)||!b.wrapLat&&(p.yT.max.y))return!1}if(!this.options.bounds)return!0;var N=this._tileCoordsToBounds(p);return Q(this.options.bounds).overlaps(N)},_keyToBounds:function(p){return this._tileCoordsToBounds(this._keyToTileCoords(p))},_tileCoordsToNwSe:function(p){var b=this._map,T=this.getTileSize(),N=p.scaleBy(T),R=N.add(T),G=b.unproject(N,p.z),Y=b.unproject(R,p.z);return[G,Y]},_tileCoordsToBounds:function(p){var b=this._tileCoordsToNwSe(p),T=new re(b[0],b[1]);return this.options.noWrap||(T=this._map.wrapLatLngBounds(T)),T},_tileCoordsToKey:function(p){return p.x+":"+p.y+":"+p.z},_keyToTileCoords:function(p){var b=p.split(":"),T=new F(+b[0],+b[1]);return T.z=+b[2],T},_removeTile:function(p){var b=this._tiles[p];b&&(qt(b.el),delete this._tiles[p],this.fire("tileunload",{tile:b.el,coords:this._keyToTileCoords(p)}))},_initTile:function(p){Be(p,"leaflet-tile");var b=this.getTileSize();p.style.width=b.x+"px",p.style.height=b.y+"px",p.onselectstart=h,p.onmousemove=h,He.ielt9&&this.options.opacity<1&&er(p,this.options.opacity)},_addTile:function(p,b){var T=this._getTilePos(p),N=this._tileCoordsToKey(p),R=this.createTile(this._wrapCoords(p),o(this._tileReady,this,p));this._initTile(R),this.createTile.length<2&&D(o(this._tileReady,this,p,null,R)),Re(R,T),this._tiles[N]={el:R,coords:p,current:!0},b.appendChild(R),this.fire("tileloadstart",{tile:R,coords:p})},_tileReady:function(p,b,T){b&&this.fire("tileerror",{error:b,tile:T,coords:p});var N=this._tileCoordsToKey(p);T=this._tiles[N],T&&(T.loaded=+new Date,this._map._fadeAnimated?(er(T.el,0),z(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this)):(T.active=!0,this._pruneTiles()),b||(Be(T.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:T.el,coords:p})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),He.ielt9||!this._map._fadeAnimated?D(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(p){return p.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(p){var b=new F(this._wrapX?c(p.x,this._wrapX):p.x,this._wrapY?c(p.y,this._wrapY):p.y);return b.z=p.z,b},_pxBoundsToTileRange:function(p){var b=this.getTileSize();return new W(p.min.unscaleBy(b).floor(),p.max.unscaleBy(b).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var p in this._tiles)if(!this._tiles[p].loaded)return!1;return!0}});function uY(p){return new Cv(p)}var Rh=Cv.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(p,b){this._url=p,b=m(this,b),b.detectRetina&&He.retina&&b.maxZoom>0?(b.tileSize=Math.floor(b.tileSize/2),b.zoomReverse?(b.zoomOffset--,b.minZoom=Math.min(b.maxZoom,b.minZoom+1)):(b.zoomOffset++,b.maxZoom=Math.max(b.minZoom,b.maxZoom-1)),b.minZoom=Math.max(0,b.minZoom)):b.zoomReverse?b.minZoom=Math.min(b.maxZoom,b.minZoom):b.maxZoom=Math.max(b.minZoom,b.maxZoom),typeof b.subdomains=="string"&&(b.subdomains=b.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(p,b){return this._url===p&&b===void 0&&(b=!0),this._url=p,b||this.redraw(),this},createTile:function(p,b){var T=document.createElement("img");return st(T,"load",o(this._tileOnLoad,this,b,T)),st(T,"error",o(this._tileOnError,this,b,T)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(T.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(T.referrerPolicy=this.options.referrerPolicy),T.alt="",T.src=this.getTileUrl(p),T},getTileUrl:function(p){var b={r:He.retina?"@2x":"",s:this._getSubdomain(p),x:p.x,y:p.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var T=this._globalTileRange.max.y-p.y;this.options.tms&&(b.y=T),b["-y"]=T}return _(this._url,a(b,this.options))},_tileOnLoad:function(p,b){He.ielt9?setTimeout(o(p,this,null,b),0):p(null,b)},_tileOnError:function(p,b,T){var N=this.options.errorTileUrl;N&&b.getAttribute("src")!==N&&(b.src=N),p(T,b)},_onTileRemove:function(p){p.tile.onload=null},_getZoomForUrl:function(){var p=this._tileZoom,b=this.options.maxZoom,T=this.options.zoomReverse,N=this.options.zoomOffset;return T&&(p=b-p),p+N},_getSubdomain:function(p){var b=Math.abs(p.x+p.y)%this.options.subdomains.length;return this.options.subdomains[b]},_abortLoading:function(){var p,b;for(p in this._tiles)if(this._tiles[p].coords.z!==this._tileZoom&&(b=this._tiles[p].el,b.onload=h,b.onerror=h,!b.complete)){b.src=C;var T=this._tiles[p].coords;qt(b),delete this._tiles[p],this.fire("tileabort",{tile:b,coords:T})}},_removeTile:function(p){var b=this._tiles[p];if(b)return b.el.setAttribute("src",C),Cv.prototype._removeTile.call(this,p)},_tileReady:function(p,b,T){if(!(!this._map||T&&T.getAttribute("src")===C))return Cv.prototype._tileReady.call(this,p,b,T)}});function QP(p,b){return new Rh(p,b)}var eD=Rh.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(p,b){this._url=p;var T=a({},this.defaultWmsParams);for(var N in b)N in this.options||(T[N]=b[N]);b=m(this,b);var R=b.detectRetina&&He.retina?2:1,G=this.getTileSize();T.width=G.x*R,T.height=G.y*R,this.wmsParams=T},onAdd:function(p){this._crs=this.options.crs||p.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var b=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[b]=this._crs.code,Rh.prototype.onAdd.call(this,p)},getTileUrl:function(p){var b=this._tileCoordsToNwSe(p),T=this._crs,N=q(T.project(b[0]),T.project(b[1])),R=N.min,G=N.max,Y=(this._wmsVersion>=1.3&&this._crs===ZP?[R.y,R.x,G.y,G.x]:[R.x,R.y,G.x,G.y]).join(","),ee=Rh.prototype.getTileUrl.call(this,p);return ee+y(this.wmsParams,ee,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+Y},setParams:function(p,b){return a(this.wmsParams,p),b||this.redraw(),this}});function cY(p,b){return new eD(p,b)}Rh.WMS=eD,QP.wms=cY;var $o=di.extend({options:{padding:.1},initialize:function(p){m(this,p),l(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Be(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var p={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(p.zoomanim=this._onAnimZoom),p},_onAnimZoom:function(p){this._updateTransform(p.center,p.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(p,b){var T=this._map.getZoomScale(b,this._zoom),N=this._map.getSize().multiplyBy(.5+this.options.padding),R=this._map.project(this._center,b),G=N.multiplyBy(-T).add(R).subtract(this._map._getNewPixelOrigin(p,b));He.any3d?Ye(this._container,G,T):Re(this._container,G)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var p in this._layers)this._layers[p]._reset()},_onZoomEnd:function(){for(var p in this._layers)this._layers[p]._project()},_updatePaths:function(){for(var p in this._layers)this._layers[p]._update()},_update:function(){var p=this.options.padding,b=this._map.getSize(),T=this._map.containerPointToLayerPoint(b.multiplyBy(-p)).round();this._bounds=new W(T,T.add(b.multiplyBy(1+p*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),tD=$o.extend({options:{tolerance:0},getEvents:function(){var p=$o.prototype.getEvents.call(this);return p.viewprereset=this._onViewPreReset,p},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){$o.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var p=this._container=document.createElement("canvas");st(p,"mousemove",this._onMouseMove,this),st(p,"click dblclick mousedown mouseup contextmenu",this._onClick,this),st(p,"mouseout",this._handleMouseOut,this),p._leaflet_disable_events=!0,this._ctx=p.getContext("2d")},_destroyContainer:function(){z(this._redrawRequest),delete this._ctx,qt(this._container),Vt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var p;this._redrawBounds=null;for(var b in this._layers)p=this._layers[b],p._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){$o.prototype._update.call(this);var p=this._bounds,b=this._container,T=p.getSize(),N=He.retina?2:1;Re(b,p.min),b.width=N*T.x,b.height=N*T.y,b.style.width=T.x+"px",b.style.height=T.y+"px",He.retina&&this._ctx.scale(2,2),this._ctx.translate(-p.min.x,-p.min.y),this.fire("update")}},_reset:function(){$o.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(p){this._updateDashArray(p),this._layers[l(p)]=p;var b=p._order={layer:p,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=b),this._drawLast=b,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(p){this._requestRedraw(p)},_removePath:function(p){var b=p._order,T=b.next,N=b.prev;T?T.prev=N:this._drawLast=N,N?N.next=T:this._drawFirst=T,delete p._order,delete this._layers[l(p)],this._requestRedraw(p)},_updatePath:function(p){this._extendRedrawBounds(p),p._project(),p._update(),this._requestRedraw(p)},_updateStyle:function(p){this._updateDashArray(p),this._requestRedraw(p)},_updateDashArray:function(p){if(typeof p.options.dashArray=="string"){var b=p.options.dashArray.split(/[, ]+/),T=[],N,R;for(R=0;R')}}catch{}return function(p){return document.createElement("<"+p+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),hY={_initContainer:function(){this._container=Tt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||($o.prototype._update.call(this),this.fire("update"))},_initPath:function(p){var b=p._container=Tv("shape");Be(b,"leaflet-vml-shape "+(this.options.className||"")),b.coordsize="1 1",p._path=Tv("path"),b.appendChild(p._path),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){var b=p._container;this._container.appendChild(b),p.options.interactive&&p.addInteractiveTarget(b)},_removePath:function(p){var b=p._container;qt(b),p.removeInteractiveTarget(b),delete this._layers[l(p)]},_updateStyle:function(p){var b=p._stroke,T=p._fill,N=p.options,R=p._container;R.stroked=!!N.stroke,R.filled=!!N.fill,N.stroke?(b||(b=p._stroke=Tv("stroke")),R.appendChild(b),b.weight=N.weight+"px",b.color=N.color,b.opacity=N.opacity,N.dashArray?b.dashStyle=w(N.dashArray)?N.dashArray.join(" "):N.dashArray.replace(/( *, *)/g," "):b.dashStyle="",b.endcap=N.lineCap.replace("butt","flat"),b.joinstyle=N.lineJoin):b&&(R.removeChild(b),p._stroke=null),N.fill?(T||(T=p._fill=Tv("fill")),R.appendChild(T),T.color=N.fillColor||N.color,T.opacity=N.fillOpacity):T&&(R.removeChild(T),p._fill=null)},_updateCircle:function(p){var b=p._point.round(),T=Math.round(p._radius),N=Math.round(p._radiusY||T);this._setPath(p,p._empty()?"M0 0":"AL "+b.x+","+b.y+" "+T+","+N+" 0,"+65535*360)},_setPath:function(p,b){p._path.v=b},_bringToFront:function(p){ie(p._container)},_bringToBack:function(p){Je(p._container)}},Ty=He.vml?Tv:vt,Mv=$o.extend({_initContainer:function(){this._container=Ty("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Ty("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){qt(this._container),Vt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){$o.prototype._update.call(this);var p=this._bounds,b=p.getSize(),T=this._container;(!this._svgSize||!this._svgSize.equals(b))&&(this._svgSize=b,T.setAttribute("width",b.x),T.setAttribute("height",b.y)),Re(T,p.min),T.setAttribute("viewBox",[p.min.x,p.min.y,b.x,b.y].join(" ")),this.fire("update")}},_initPath:function(p){var b=p._path=Ty("path");p.options.className&&Be(b,p.options.className),p.options.interactive&&Be(b,"leaflet-interactive"),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(p._path),p.addInteractiveTarget(p._path)},_removePath:function(p){qt(p._path),p.removeInteractiveTarget(p._path),delete this._layers[l(p)]},_updatePath:function(p){p._project(),p._update()},_updateStyle:function(p){var b=p._path,T=p.options;b&&(T.stroke?(b.setAttribute("stroke",T.color),b.setAttribute("stroke-opacity",T.opacity),b.setAttribute("stroke-width",T.weight),b.setAttribute("stroke-linecap",T.lineCap),b.setAttribute("stroke-linejoin",T.lineJoin),T.dashArray?b.setAttribute("stroke-dasharray",T.dashArray):b.removeAttribute("stroke-dasharray"),T.dashOffset?b.setAttribute("stroke-dashoffset",T.dashOffset):b.removeAttribute("stroke-dashoffset")):b.setAttribute("stroke","none"),T.fill?(b.setAttribute("fill",T.fillColor||T.color),b.setAttribute("fill-opacity",T.fillOpacity),b.setAttribute("fill-rule",T.fillRule||"evenodd")):b.setAttribute("fill","none"))},_updatePoly:function(p,b){this._setPath(p,dt(p._parts,b))},_updateCircle:function(p){var b=p._point,T=Math.max(Math.round(p._radius),1),N=Math.max(Math.round(p._radiusY),1)||T,R="a"+T+","+N+" 0 1,0 ",G=p._empty()?"M0 0":"M"+(b.x-T)+","+b.y+R+T*2+",0 "+R+-T*2+",0 ";this._setPath(p,G)},_setPath:function(p,b){p._path.setAttribute("d",b)},_bringToFront:function(p){ie(p._path)},_bringToBack:function(p){Je(p._path)}});He.vml&&Mv.include(hY);function nD(p){return He.svg||He.vml?new Mv(p):null}Nt.include({getRenderer:function(p){var b=p.options.renderer||this._getPaneRenderer(p.options.pane)||this.options.renderer||this._renderer;return b||(b=this._renderer=this._createRenderer()),this.hasLayer(b)||this.addLayer(b),b},_getPaneRenderer:function(p){if(p==="overlayPane"||p===void 0)return!1;var b=this._paneRenderers[p];return b===void 0&&(b=this._createRenderer({pane:p}),this._paneRenderers[p]=b),b},_createRenderer:function(p){return this.options.preferCanvas&&rD(p)||nD(p)}});var aD=Eh.extend({initialize:function(p,b){Eh.prototype.initialize.call(this,this._boundsToLatLngs(p),b)},setBounds:function(p){return this.setLatLngs(this._boundsToLatLngs(p))},_boundsToLatLngs:function(p){return p=Q(p),[p.getSouthWest(),p.getNorthWest(),p.getNorthEast(),p.getSouthEast()]}});function fY(p,b){return new aD(p,b)}Mv.create=Ty,Mv.pointsToPath=dt,Zo.geometryToLayer=yy,Zo.coordsToLatLng=jw,Zo.coordsToLatLngs=xy,Zo.latLngToCoords=Rw,Zo.latLngsToCoords=_y,Zo.getFeature=jh,Zo.asFeature=by,Nt.mergeOptions({boxZoom:!0});var iD=Ui.extend({initialize:function(p){this._map=p,this._container=p._container,this._pane=p._panes.overlayPane,this._resetStateTimeout=0,p.on("unload",this._destroy,this)},addHooks:function(){st(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Vt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){qt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(p){if(!p.shiftKey||p.which!==1&&p.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),fa(),Mh(),this._startPoint=this._map.mouseEventToContainerPoint(p),st(document,{contextmenu:du,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(p){this._moved||(this._moved=!0,this._box=Tt("div","leaflet-zoom-box",this._container),Be(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(p);var b=new W(this._point,this._startPoint),T=b.getSize();Re(this._box,b.min),this._box.style.width=T.x+"px",this._box.style.height=T.y+"px"},_finish:function(){this._moved&&(qt(this._box),lt(this._container,"leaflet-crosshair")),hi(),Ah(),Vt(document,{contextmenu:du,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(p){if(!(p.which!==1&&p.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var b=new re(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(b).fire("boxzoomend",{boxZoomBounds:b})}},_onKeyDown:function(p){p.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Nt.addInitHook("addHandler","boxZoom",iD),Nt.mergeOptions({doubleClickZoom:!0});var oD=Ui.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(p){var b=this._map,T=b.getZoom(),N=b.options.zoomDelta,R=p.originalEvent.shiftKey?T-N:T+N;b.options.doubleClickZoom==="center"?b.setZoom(R):b.setZoomAround(p.containerPoint,R)}});Nt.addInitHook("addHandler","doubleClickZoom",oD),Nt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var sD=Ui.extend({addHooks:function(){if(!this._draggable){var p=this._map;this._draggable=new Gs(p._mapPane,p._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),p.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),p.on("zoomend",this._onZoomEnd,this),p.whenReady(this._onZoomEnd,this))}Be(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){lt(this._map._container,"leaflet-grab"),lt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var p=this._map;if(p._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var b=Q(this._map.options.maxBounds);this._offsetLimit=q(this._map.latLngToContainerPoint(b.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(b.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;p.fire("movestart").fire("dragstart"),p.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(p){if(this._map.options.inertia){var b=this._lastTime=+new Date,T=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(T),this._times.push(b),this._prunePositions(b)}this._map.fire("move",p).fire("drag",p)},_prunePositions:function(p){for(;this._positions.length>1&&p-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var p=this._map.getSize().divideBy(2),b=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=b.subtract(p).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(p,b){return p-(p-b)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var p=this._draggable._newPos.subtract(this._draggable._startPos),b=this._offsetLimit;p.xb.max.x&&(p.x=this._viscousLimit(p.x,b.max.x)),p.y>b.max.y&&(p.y=this._viscousLimit(p.y,b.max.y)),this._draggable._newPos=this._draggable._startPos.add(p)}},_onPreDragWrap:function(){var p=this._worldWidth,b=Math.round(p/2),T=this._initialWorldOffset,N=this._draggable._newPos.x,R=(N-b+T)%p+b-T,G=(N+b+T)%p-b-T,Y=Math.abs(R+T)0?G:-G))-b;this._delta=0,this._startTime=null,Y&&(p.options.scrollWheelZoom==="center"?p.setZoom(b+Y):p.setZoomAround(this._lastMousePos,b+Y))}});Nt.addInitHook("addHandler","scrollWheelZoom",uD);var dY=600;Nt.mergeOptions({tapHold:He.touchNative&&He.safari&&He.mobile,tapTolerance:15});var cD=Ui.extend({addHooks:function(){st(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Vt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(p){if(clearTimeout(this._holdTimeout),p.touches.length===1){var b=p.touches[0];this._startPos=this._newPos=new F(b.clientX,b.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(st(document,"touchend",vr),st(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",b))},this),dY),st(document,"touchend touchcancel contextmenu",this._cancel,this),st(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function p(){Vt(document,"touchend",vr),Vt(document,"touchend touchcancel",p)},_cancel:function(){clearTimeout(this._holdTimeout),Vt(document,"touchend touchcancel contextmenu",this._cancel,this),Vt(document,"touchmove",this._onMove,this)},_onMove:function(p){var b=p.touches[0];this._newPos=new F(b.clientX,b.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(p,b){var T=new MouseEvent(p,{bubbles:!0,cancelable:!0,view:window,screenX:b.screenX,screenY:b.screenY,clientX:b.clientX,clientY:b.clientY});T._simulated=!0,b.target.dispatchEvent(T)}});Nt.addInitHook("addHandler","tapHold",cD),Nt.mergeOptions({touchZoom:He.touch,bounceAtZoomLimits:!0});var hD=Ui.extend({addHooks:function(){Be(this._map._container,"leaflet-touch-zoom"),st(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){lt(this._map._container,"leaflet-touch-zoom"),Vt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(p){var b=this._map;if(!(!p.touches||p.touches.length!==2||b._animatingZoom||this._zooming)){var T=b.mouseEventToContainerPoint(p.touches[0]),N=b.mouseEventToContainerPoint(p.touches[1]);this._centerPoint=b.getSize()._divideBy(2),this._startLatLng=b.containerPointToLatLng(this._centerPoint),b.options.touchZoom!=="center"&&(this._pinchStartLatLng=b.containerPointToLatLng(T.add(N)._divideBy(2))),this._startDist=T.distanceTo(N),this._startZoom=b.getZoom(),this._moved=!1,this._zooming=!0,b._stop(),st(document,"touchmove",this._onTouchMove,this),st(document,"touchend touchcancel",this._onTouchEnd,this),vr(p)}},_onTouchMove:function(p){if(!(!p.touches||p.touches.length!==2||!this._zooming)){var b=this._map,T=b.mouseEventToContainerPoint(p.touches[0]),N=b.mouseEventToContainerPoint(p.touches[1]),R=T.distanceTo(N)/this._startDist;if(this._zoom=b.getScaleZoom(R,this._startZoom),!b.options.bounceAtZoomLimits&&(this._zoomb.getMaxZoom()&&R>1)&&(this._zoom=b._limitZoom(this._zoom)),b.options.touchZoom==="center"){if(this._center=this._startLatLng,R===1)return}else{var G=T._add(N)._divideBy(2)._subtract(this._centerPoint);if(R===1&&G.x===0&&G.y===0)return;this._center=b.unproject(b.project(this._pinchStartLatLng,this._zoom).subtract(G),this._zoom)}this._moved||(b._moveStart(!0,!1),this._moved=!0),z(this._animRequest);var Y=o(b._move,b,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=D(Y,this,!0),vr(p)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,z(this._animRequest),Vt(document,"touchmove",this._onTouchMove,this),Vt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Nt.addInitHook("addHandler","touchZoom",hD),Nt.BoxZoom=iD,Nt.DoubleClickZoom=oD,Nt.Drag=sD,Nt.Keyboard=lD,Nt.ScrollWheelZoom=uD,Nt.TapHold=cD,Nt.TouchZoom=hD,r.Bounds=W,r.Browser=He,r.CRS=Ue,r.Canvas=tD,r.Circle=Ew,r.CircleMarker=my,r.Class=B,r.Control=fi,r.DivIcon=JP,r.DivOverlay=Wi,r.DomEvent=I$,r.DomUtil=vy,r.Draggable=Gs,r.Evented=U,r.FeatureGroup=Uo,r.GeoJSON=Zo,r.GridLayer=Cv,r.Handler=Ui,r.Icon=Dh,r.ImageOverlay=wy,r.LatLng=se,r.LatLngBounds=re,r.Layer=di,r.LayerGroup=Ph,r.LineUtil=U$,r.Map=Nt,r.Marker=gy,r.Mixin=z$,r.Path=Hs,r.Point=F,r.PolyUtil=B$,r.Polygon=Eh,r.Polyline=Wo,r.Popup=Sy,r.PosAnimation=EP,r.Projection=W$,r.Rectangle=aD,r.Renderer=$o,r.SVG=Mv,r.SVGOverlay=KP,r.TileLayer=Rh,r.Tooltip=Cy,r.Transformation=be,r.Util=E,r.VideoOverlay=qP,r.bind=o,r.bounds=q,r.canvas=rD,r.circle=Q$,r.circleMarker=J$,r.control=bv,r.divIcon=lY,r.extend=a,r.featureGroup=X$,r.geoJSON=XP,r.geoJson=rY,r.gridLayer=uY,r.icon=q$,r.imageOverlay=nY,r.latLng=ce,r.latLngBounds=Q,r.layerGroup=Y$,r.map=P$,r.marker=K$,r.point=$,r.polygon=tY,r.polyline=eY,r.popup=oY,r.rectangle=fY,r.setOptions=m,r.stamp=l,r.svg=nD,r.svgOverlay=iY,r.tileLayer=QP,r.tooltip=sY,r.transformation=we,r.version=n,r.videoOverlay=aY;var vY=window.L;r.noConflict=function(){return window.L=vY,this},window.L=r})})(vN,vN.exports);var su=vN.exports;const xw=gN(su);function sv(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function MP(e,t){return t==null?function(n,a){const i=O.useRef();return i.current||(i.current=e(n,a)),i}:function(n,a){const i=O.useRef();i.current||(i.current=e(n,a));const o=O.useRef(n),{instance:s}=i.current;return O.useEffect(function(){o.current!==n&&(t(s,n,o.current),o.current=n)},[s,n,a]),i}}function u$(e,t){O.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var i;(i=t.layerContainer)==null||i.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function vSe(e){return function(r){const n=mw(),a=e(yw(r,n),n);return o$(n.map,r.attribution),TP(a.current,r.eventHandlers),u$(a.current,n),a}}function pSe(e,t){const r=O.useRef();O.useEffect(function(){if(t.pathOptions!==r.current){const a=t.pathOptions??{};e.instance.setStyle(a),r.current=a}},[e,t])}function gSe(e){return function(r){const n=mw(),a=e(yw(r,n),n);return TP(a.current,r.eventHandlers),u$(a.current,n),pSe(a.current,r),a}}function c$(e,t){const r=MP(e),n=dSe(r,t);return hSe(n)}function AP(e,t){const r=MP(e,t),n=gSe(r);return cSe(n)}function mSe(e,t){const r=MP(e,t),n=vSe(r);return fSe(n)}function ySe(e,t,r){const{opacity:n,zIndex:a}=t;n!=null&&n!==r.opacity&&e.setOpacity(n),a!=null&&a!==r.zIndex&&e.setZIndex(a)}function NP(){return mw().map}function xSe(e){const t=NP();return O.useEffect(function(){return t.on(e),function(){t.off(e)}},[t,e]),t}const h$=AP(function({center:t,children:r,...n},a){const i=new su.CircleMarker(t,n);return sv(i,CP(a,{overlayContainer:i}))},sSe);function pN(){return pN=Object.assign||function(e){for(var t=1;t(v==null?void 0:v.map)??null,[v]);const m=O.useCallback(x=>{if(x!==null&&v===null){const _=new su.Map(x,c);r!=null&&u!=null?_.setView(r,u):e!=null&&_.fitBounds(e,t),l!=null&&_.whenReady(l),g(uSe(_))}},[]);O.useEffect(()=>()=>{v==null||v.map.remove()},[v]);const y=v?Qf.createElement(l$,{value:v},n):o??null;return Qf.createElement("div",pN({},d,{ref:m}),y)}const f$=O.forwardRef(_Se),bSe=AP(function({positions:t,...r},n){const a=new su.Polyline(t,r);return sv(a,CP(n,{overlayContainer:a}))},function(t,r,n){r.positions!==n.positions&&t.setLatLngs(r.positions)}),wSe=c$(function(t,r){const n=new su.Popup(t,r.overlayContainer);return sv(n,r)},function(t,r,{position:n},a){O.useEffect(function(){const{instance:o}=t;function s(u){u.popup===o&&(o.update(),a(!0))}function l(u){u.popup===o&&a(!1)}return r.map.on({popupopen:s,popupclose:l}),r.overlayContainer==null?(n!=null&&o.setLatLng(n),o.openOn(r.map)):r.overlayContainer.bindPopup(o),function(){var c;r.map.off({popupopen:s,popupclose:l}),(c=r.overlayContainer)==null||c.unbindPopup(),r.map.removeLayer(o)}},[t,r,a,n])}),SSe=AP(function({bounds:t,...r},n){const a=new su.Rectangle(t,r);return sv(a,CP(n,{overlayContainer:a}))},function(t,r,n){r.bounds!==n.bounds&&t.setBounds(r.bounds)}),d$=mSe(function({url:t,...r},n){const a=new su.TileLayer(t,yw(r,n));return sv(a,n)},function(t,r,n){ySe(t,r,n);const{url:a}=r;a!=null&&a!==n.url&&t.setUrl(a)}),CSe=c$(function(t,r){const n=new su.Tooltip(t,r.overlayContainer);return sv(n,r)},function(t,r,{position:n},a){O.useEffect(function(){const o=r.overlayContainer;if(o==null)return;const{instance:s}=t,l=c=>{c.tooltip===s&&(n!=null&&s.setLatLng(n),s.update(),a(!0))},u=c=>{c.tooltip===s&&a(!1)};return o.on({tooltipopen:l,tooltipclose:u}),o.bindTooltip(s),function(){o.off({tooltipopen:l,tooltipclose:u}),o._map!=null&&o.unbindTooltip()}},[t,r,a,n])}),v$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",p$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",g$="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC";delete xw.Icon.Default.prototype._getIconUrl;xw.Icon.Default.mergeOptions({iconUrl:v$,iconRetinaUrl:p$,shadowUrl:g$});const OB=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],TSe=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function MSe(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function ASe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function NSe(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function kSe({bounds:e}){const t=NP();return O.useEffect(()=>{e&&t.fitBounds(e,{padding:[50,50]})},[t,e]),null}function LSe({node:e}){const t=e.latitude!==null&&e.longitude!==null,r=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`:"Unknown";return f.jsxs("div",{className:"min-w-[200px]",children:[f.jsx("div",{className:"font-semibold text-slate-800",children:e.short_name}),f.jsx("div",{className:"text-xs text-slate-600 mb-2",children:e.long_name}),f.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[f.jsx("div",{className:"text-slate-500",children:"Role"}),f.jsx("div",{className:"text-slate-700 font-medium",children:e.role}),f.jsx("div",{className:"text-slate-500",children:"Hardware"}),f.jsx("div",{className:"text-slate-700",children:e.hardware||"Unknown"}),f.jsx("div",{className:"text-slate-500",children:"Battery"}),f.jsx("div",{className:"text-slate-700",children:r}),f.jsx("div",{className:"text-slate-500",children:"Last Heard"}),f.jsx("div",{className:"text-slate-700",children:NSe(e.last_heard)})]}),t&&f.jsxs("div",{className:"mt-3 pt-2 border-t border-slate-200 flex gap-2",children:[f.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[f.jsx(kc,{size:10}),"Google Maps"]}),f.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[f.jsx(kc,{size:10}),"OSM"]})]})]})}function ISe({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const a=O.useMemo(()=>e.filter(h=>h.latitude!==null&&h.longitude!==null),[e]),i=e.length-a.length,o=O.useMemo(()=>new Map(a.map(h=>[h.node_num,h])),[a]),s=O.useMemo(()=>t.filter(h=>o.has(h.from_node)&&o.has(h.to_node)),[t,o]),l=O.useMemo(()=>{if(a.length===0)return null;const h=a.map(v=>v.latitude),d=a.map(v=>v.longitude);return[[Math.min(...h),Math.min(...d)],[Math.max(...h),Math.max(...d)]]},[a]),u=[43.6,-114.4],c=O.useMemo(()=>{const h=new Set;return r!==null&&t.forEach(d=>{d.from_node===r&&h.add(d.to_node),d.to_node===r&&h.add(d.from_node)}),h},[r,t]);return f.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[f.jsxs(f$,{center:u,zoom:7,style:{width:"100%",height:"540px"},className:"z-0",children:[f.jsx(d$,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),f.jsx(kSe,{bounds:l}),s.map((h,d)=>{const v=o.get(h.from_node),g=o.get(h.to_node),m=r===null||h.from_node===r||h.to_node===r;return f.jsx(bSe,{positions:[[v.latitude,v.longitude],[g.latitude,g.longitude]],color:MSe(h.snr),weight:m&&r!==null?2.5:1.5,opacity:r===null?.3:m?.6:.08},d)}),a.map(h=>{const d=h.node_num===r,v=c.has(h.node_num),g=r===null||d||v,m=TSe.includes(h.role),y=ASe(h.latitude),x=OB[y%OB.length];return f.jsxs(h$,{center:[h.latitude,h.longitude],radius:m?8:5,fillColor:m?x:"#111827",fillOpacity:g?.9:.2,stroke:!0,color:d?"#ffffff":x,weight:d?3:m?0:2,opacity:g?1:.3,eventHandlers:{click:()=>n(d?null:h.node_num)},children:[f.jsx(CSe,{direction:"top",offset:[0,-8],children:f.jsx("span",{className:"font-mono text-xs",children:h.short_name})}),f.jsx(wSe,{children:f.jsx(LSe,{node:h})})]},h.node_num)})]}),f.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2 text-xs text-slate-400 flex items-center gap-2",children:[f.jsx(Rd,{size:12}),f.jsxs("span",{children:["Showing ",a.length," of ",e.length," nodes",i>0&&f.jsxs("span",{className:"text-slate-500",children:[" (",i," without coordinates)"]})]})]})]})}const zB=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],PSe=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function BB(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function DSe(e){return e>12?"excellent":e>8?"good":e>5?"fair":e>3?"marginal":"poor"}function ESe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function jSe(e){return["Northern ID","Central ID","SW Idaho","SC Idaho"][e]||"Unknown"}function RSe(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function OSe(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function zSe({node:e,edges:t,nodes:r,onSelectNode:n}){const a=O.useMemo(()=>{if(!e)return[];const h=new Map(r.map(v=>[v.node_num,v])),d=[];return t.forEach(v=>{if(v.from_node===e.node_num){const g=h.get(v.to_node);g&&d.push({node:g,snr:v.snr,quality:v.quality})}else if(v.to_node===e.node_num){const g=h.get(v.from_node);g&&d.push({node:g,snr:v.snr,quality:v.quality})}}),d.sort((v,g)=>g.snr-v.snr)},[e,t,r]);if(!e)return f.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border p-4 flex flex-col items-center justify-center h-[540px]",children:[f.jsx("div",{className:"w-12 h-12 rounded-full bg-bg-hover border border-border flex items-center justify-center mb-3",children:f.jsx(oi,{size:24,className:"text-slate-500"})}),f.jsx("p",{className:"text-sm text-slate-500 text-center",children:"Click a node to inspect"})]});const i=PSe.includes(e.role),o=ESe(e.latitude),s=zB[o%zB.length],l=e.latitude!==null&&e.longitude!==null,u=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB":`${e.battery_level.toFixed(0)}%`:"—",c=e.battery_level!==null&&(e.battery_level>100||e.voltage&&e.voltage>4.1);return f.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border flex flex-col h-[540px] overflow-hidden",children:[f.jsxs("div",{className:"p-4 border-b border-border",children:[f.jsx("div",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono mb-2",style:{backgroundColor:`${s}20`,color:s},children:e.node_id_hex}),f.jsx("div",{className:"font-mono text-lg text-slate-100",children:e.short_name}),f.jsx("div",{className:"text-xs text-slate-500 truncate",children:e.long_name})]}),f.jsxs("div",{className:"p-4 border-b border-border grid grid-cols-2 gap-3",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Role"}),f.jsx("div",{className:`text-sm font-medium ${i?"text-accent":"text-slate-300"}`,children:e.role})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Region"}),f.jsx("div",{className:"text-sm text-slate-300",children:jSe(o)})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Battery"}),f.jsxs("div",{className:"text-sm text-slate-300 flex items-center gap-1",children:[c&&f.jsx(J2,{size:12,className:"text-amber-400"}),u]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Status"}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx("div",{className:`w-2 h-2 rounded-full ${OSe(e.last_heard)}`}),f.jsx("span",{className:"text-sm text-slate-300",children:RSe(e.last_heard)})]})]}),f.jsxs("div",{className:"col-span-2",children:[f.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Hardware"}),f.jsx("div",{className:"text-sm text-slate-300 font-mono truncate",children:e.hardware||"Unknown"})]})]}),l&&f.jsxs("div",{className:"px-4 py-3 border-b border-border flex gap-3",children:[f.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300",children:[f.jsx(kc,{size:10}),"Google Maps"]}),f.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300",children:[f.jsx(kc,{size:10}),"OSM"]})]}),f.jsxs("div",{className:"flex-1 overflow-y-auto",children:[f.jsxs("div",{className:"px-4 py-2 text-xs text-slate-500 font-medium sticky top-0 bg-bg-card border-b border-border",children:["Neighbors (",a.length,")"]}),a.length>0?f.jsx("div",{className:"divide-y divide-border",children:a.map(h=>f.jsxs("button",{onClick:()=>n(h.node.node_num),className:"w-full px-4 py-2 text-left hover:bg-bg-hover transition-colors flex items-center gap-2",style:{borderLeftWidth:3,borderLeftColor:BB(h.snr)},children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm text-slate-200 font-mono truncate",children:h.node.short_name}),f.jsx("div",{className:"text-xs text-slate-500 truncate",children:h.node.long_name})]}),f.jsxs("div",{className:"text-right flex-shrink-0",children:[f.jsxs("div",{className:"text-xs font-mono",style:{color:BB(h.snr)},children:[h.snr.toFixed(1)," dB"]}),f.jsx("div",{className:"text-xs text-slate-500",children:DSe(h.snr)})]})]},h.node.node_num))}):f.jsx("div",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No known neighbors"})]})]})}const FB=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function BSe(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function FSe(e){if(!e)return"—";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function VSe(e){return e.battery_level===null?"—":e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`}function VB(e){return e===null?"—":e>46?"Northern":e>44.5?"Central":e>43?"SW Idaho":"SC Idaho"}function GSe({nodes:e,selectedNodeId:t,onSelectNode:r}){const[n,a]=O.useState(""),[i,o]=O.useState("short_name"),[s,l]=O.useState("asc"),[u,c]=O.useState("all"),h=O.useMemo(()=>{let g=[...e];if(u==="infra"?g=g.filter(m=>FB.includes(m.role)):u==="online"&&(g=g.filter(m=>{if(!m.last_heard)return!1;const y=new Date(m.last_heard);return(new Date().getTime()-y.getTime())/36e5<1})),n){const m=n.toLowerCase();g=g.filter(y=>y.short_name.toLowerCase().includes(m)||y.long_name.toLowerCase().includes(m)||y.role.toLowerCase().includes(m)||VB(y.latitude).toLowerCase().includes(m))}return g.sort((m,y)=>{let x="",_="";switch(i){case"short_name":x=m.short_name.toLowerCase(),_=y.short_name.toLowerCase();break;case"role":x=m.role,_=y.role;break;case"battery_level":x=m.battery_level??-1,_=y.battery_level??-1;break;case"last_heard":x=m.last_heard?new Date(m.last_heard).getTime():0,_=y.last_heard?new Date(y.last_heard).getTime():0;break;case"hardware":x=m.hardware.toLowerCase(),_=y.hardware.toLowerCase();break}return x<_?s==="asc"?-1:1:x>_?s==="asc"?1:-1:0}),g},[e,n,i,s,u]),d=g=>{i===g?l(s==="asc"?"desc":"asc"):(o(g),l("asc"))},v=({field:g})=>i!==g?null:s==="asc"?f.jsx(sJ,{size:14,className:"inline ml-1"}):f.jsx(Sm,{size:14,className:"inline ml-1"});return f.jsxs("div",{className:"bg-bg-card border border-border overflow-hidden",children:[f.jsxs("div",{className:"p-3 border-b border-border flex items-center gap-3",children:[f.jsxs("div",{className:"relative flex-1 max-w-xs",children:[f.jsx(p1,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),f.jsx("input",{type:"text",placeholder:"Search nodes...",value:n,onChange:g=>a(g.target.value),className:"w-full pl-9 pr-3 py-1.5 bg-bg-hover border border-border rounded text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-accent"})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(MV,{size:14,className:"text-slate-500 mr-1"}),["all","infra","online"].map(g=>f.jsx("button",{onClick:()=>c(g),className:`px-2 py-1 text-xs rounded transition-colors ${u===g?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:g==="all"?"All":g==="infra"?"Infra":"Online"},g))]}),f.jsxs("div",{className:"text-xs text-slate-500 ml-auto",children:[h.length," of ",e.length," nodes"]})]}),f.jsxs("div",{className:"overflow-x-auto",children:[f.jsxs("table",{className:"w-full text-sm",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"bg-bg-hover text-slate-400 text-xs",children:[f.jsx("th",{className:"w-8 px-3 py-2"}),f.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>d("short_name"),children:["Name ",f.jsx(v,{field:"short_name"})]}),f.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>d("role"),children:["Role ",f.jsx(v,{field:"role"})]}),f.jsx("th",{className:"px-3 py-2 text-left",children:"Region"}),f.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>d("battery_level"),children:[f.jsx("span",{title:"Battery percent (4.20V = 100%, 3.60V ~ 30% warning, 3.30V ~ 3% critical). USB ⚡ = USB-powered (>100% or >4.1V); no battery management applies.",children:"Battery"})," ",f.jsx(v,{field:"battery_level"})]}),f.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>d("last_heard"),children:[f.jsx("span",{title:"Status dot: green = heard in the last hour; amber = within 24h; slate = offline (past the configured threshold). See Reference → Mesh Health for thresholds by node type.",children:"Last Heard"})," ",f.jsx(v,{field:"last_heard"})]}),f.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>d("hardware"),children:["Hardware ",f.jsx(v,{field:"hardware"})]})]})}),f.jsx("tbody",{className:"divide-y divide-border",children:h.slice(0,100).map(g=>{const m=FB.includes(g.role),y=g.node_num===t;return f.jsxs("tr",{onClick:()=>r(g.node_num),className:`cursor-pointer transition-colors ${y?"bg-accent/10":"hover:bg-bg-hover"}`,children:[f.jsx("td",{className:"px-3 py-2",children:f.jsx("div",{className:`w-2 h-2 rounded-full ${BSe(g.last_heard)}`})}),f.jsxs("td",{className:"px-3 py-2",children:[f.jsx("div",{className:"font-mono text-slate-200",children:g.short_name}),f.jsx("div",{className:"text-xs text-slate-500 truncate max-w-[200px]",children:g.long_name})]}),f.jsx("td",{className:"px-3 py-2",children:f.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded text-xs font-medium ${m?"bg-cyan-500/20 text-accent":"bg-slate-500/20 text-slate-400"}`,children:g.role})}),f.jsx("td",{className:"px-3 py-2 text-slate-400",children:VB(g.latitude)}),f.jsx("td",{className:"px-3 py-2 font-mono text-slate-300",children:VSe(g)}),f.jsx("td",{className:"px-3 py-2 text-slate-400",children:FSe(g.last_heard)}),f.jsx("td",{className:"px-3 py-2 font-mono text-xs text-slate-400 truncate max-w-[150px]",children:g.hardware||"—"})]},g.node_num)})})]}),h.length>100&&f.jsxs("div",{className:"px-3 py-2 text-xs text-slate-500 text-center border-t border-border",children:["Showing first 100 of ",h.length," nodes"]}),h.length===0&&f.jsx("div",{className:"px-3 py-8 text-sm text-slate-500 text-center",children:"No nodes match your filters"})]})]})}function m$(){const[e,t]=O.useState([]),[r,n]=O.useState([]),[a,i]=O.useState([]),[o,s]=O.useState(null),[l,u]=O.useState("topo"),[c,h]=O.useState(!0),[d,v]=O.useState(null);O.useEffect(()=>{document.title="Mesh — MeshAI",Promise.all([yJ(),xJ(),AJ()]).then(([y,x,_])=>{t(y),n(x),i(_),h(!1)}).catch(y=>{v(y.message),h(!1)})},[]);const g=O.useMemo(()=>e.find(y=>y.node_num===o)||null,[e,o]),m=O.useCallback(y=>{s(y)},[]);return c?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-slate-400",children:"Loading mesh data..."})}):d?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsxs("div",{className:"text-red-400",children:["Error: ",d]})}):f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"text-sm text-slate-400",children:[e.length," nodes • ",r.length," edges"]}),f.jsxs("div",{className:"flex items-center bg-bg-card border border-border p-1",children:[f.jsxs("button",{onClick:()=>u("topo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="topo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[f.jsx(_k,{size:14}),f.jsx("span",{title:"Force-directed graph of nodes + neighbor links. Edge weight reflects SNR; node color reflects status (green = active, amber = stale, slate = offline).",children:"Topology"})]}),f.jsxs("button",{onClick:()=>u("geo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="geo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[f.jsx(kV,{size:14}),f.jsx("span",{title:"Nodes plotted by lat/lon on a basemap. Nodes without a reported position are clustered at the top edge.",children:"Geographic"})]})]})]}),f.jsxs("div",{className:"flex gap-0",children:[f.jsx("div",{className:"flex-1 min-w-0",children:l==="topo"?f.jsx(oSe,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m}):f.jsx(ISe,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m})}),f.jsx(zSe,{node:g,edges:r,nodes:e,onSelectNode:m})]}),f.jsx(GSe,{nodes:e,selectedNodeId:o,onSelectNode:m})]})}function Ep({envVar:e,label:t="API Key",helper:r="",info:n=""}){const[a,i]=O.useState(null),[o,s]=O.useState(""),[l,u]=O.useState(!1),[c,h]=O.useState(!1),[d,v]=O.useState(""),[g,m]=O.useState(""),y=async()=>{try{const w=await fetch("/api/secrets");if(w.ok){const C=(await w.json()).find(M=>M.env_var===e);i(C?C.is_set:!1)}}catch{i(!1)}};O.useEffect(()=>{y()},[e]);const x=async()=>{if(o.trim()){h(!0),m(""),v("");try{const w=await fetch("/api/secrets/"+encodeURIComponent(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:o})});if(w.ok)s(""),u(!1),v("Saved — restart required to take effect"),await y();else{const S=await w.text();m("Save failed: "+(S||String(w.status)))}}catch{m("Save failed: network error")}finally{h(!1)}}},_=a?"env set — enter a new value to change":"not set — enter a value";return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[t,a===null?f.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-slate-800 text-slate-500",children:"Loading"}):a?f.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-green-500/10 text-green-400",children:"Set"}):f.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-slate-800 text-slate-500",children:"Not set"})]}),f.jsxs("div",{className:"flex gap-2",children:[f.jsxs("div",{className:"relative flex-1",children:[f.jsx("input",{type:l?"text":"password",value:o,onChange:w=>s(w.target.value),placeholder:_,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),f.jsx("button",{type:"button",onClick:()=>u(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:l?f.jsx(yk,{size:16}):f.jsx(Cm,{size:16})})]}),f.jsx("button",{type:"button",onClick:x,disabled:!o.trim()||c,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:c?"Saving…":"Save"})]}),r&&f.jsx("p",{className:"text-xs text-slate-600",children:r}),f.jsx("p",{className:"text-xs text-slate-600 font-mono",children:e}),d&&f.jsx("p",{className:"text-xs text-yellow-400",children:d}),g&&f.jsx("p",{className:"text-xs text-red-400",children:g})]})}function kP({label:e,value:t,onChange:r,helper:n,info:a,roleFilter:i,valueType:o="short_name"}){const[s,l]=O.useState([]),[u,c]=O.useState(!0),[h,d]=O.useState(""),[v,g]=O.useState(!1);O.useEffect(()=>{fetch("/api/nodes").then(S=>S.json()).then(S=>{l(S),c(!1)}).catch(()=>{l([]),c(!1)})},[]);const m=O.useMemo(()=>{let S=s;if(i&&(S=S.filter(C=>i==="ROUTER"||i==="infrastructure"?C.is_infrastructure||C.role==="ROUTER"||C.role==="ROUTER_CLIENT"||C.role==="REPEATER":C.role===i)),h.trim()){const C=h.toLowerCase();S=S.filter(M=>{var A,I,k,P;return((A=M.short_name)==null?void 0:A.toLowerCase().includes(C))||((I=M.long_name)==null?void 0:I.toLowerCase().includes(C))||((k=M.role)==null?void 0:k.toLowerCase().includes(C))||((P=M.node_id_hex)==null?void 0:P.toLowerCase().includes(C))})}return S.sort((C,M)=>(C.short_name||"").localeCompare(M.short_name||""))},[s,h,i]),y=S=>{switch(o){case"node_num":return String(S.node_num);case"node_id_hex":return S.node_id_hex;default:return S.short_name||String(S.node_num)}},x=S=>{const C=y(S);return t.includes(C)},_=S=>{const C=y(S);t.includes(C)?r(t.filter(M=>M!==C)):r([...t,C])},w=S=>{const C=[S.short_name];return S.long_name&&S.long_name!==S.short_name&&C.push(`— ${S.long_name}`),S.role&&C.push(`(${S.role})`),C.join(" ")};return!u&&s.length===0?f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),f.jsx("input",{type:"text",value:t.join(", "),onChange:S=>r(S.target.value.split(",").map(C=>C.trim()).filter(Boolean)),placeholder:"Enter node IDs separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),n&&f.jsx("p",{className:"text-xs text-slate-600",children:n})]}):f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),t.length>0&&f.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(S=>{const C=s.find(M=>y(M)===S);return f.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-accent/20 text-accent rounded text-sm",children:[C?C.short_name:S,f.jsx("button",{type:"button",onClick:()=>r(t.filter(M=>M!==S)),className:"hover:text-white",children:f.jsx(tu,{size:14})})]},S)})}),f.jsxs("div",{className:"relative",children:[f.jsxs("div",{className:"relative",children:[f.jsx(p1,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),f.jsx("input",{type:"text",value:h,onChange:S=>d(S.target.value),onFocus:()=>g(!0),placeholder:u?"Loading nodes...":"Search nodes...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"})]}),v&&!u&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),f.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 max-h-64 overflow-y-auto bg-[#0a0e17] border border-[#1e2a3a] shadow-xl",children:m.length===0?f.jsx("div",{className:"p-3 text-sm text-slate-500 text-center",children:"No nodes found"}):m.map(S=>f.jsxs("button",{type:"button",onClick:()=>_(S),className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[#1e2a3a] ${x(S)?"bg-accent/10":""}`,children:[f.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${x(S)?"bg-accent border-accent":"border-slate-600"}`,children:x(S)&&f.jsx(Jr,{size:12,className:"text-white"})}),f.jsx("span",{className:"text-slate-200",children:w(S)})]},S.node_num))})]})]}),n&&f.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function LP(e){const[t,r]=O.useState([]),[n,a]=O.useState(!0);O.useEffect(()=>{fetch("/api/channels").then(d=>d.json()).then(d=>{r(d),a(!1)}).catch(()=>{r([]),a(!1)})},[]);const i=d=>{const v=d.role==="PRIMARY"?"Primary":d.role==="SECONDARY"?"Secondary":"";return`${d.index}: ${d.name}${v?` (${v})`:""}`};if(!n&&t.length===0)return e.mode==="single"?f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),f.jsx("input",{type:"number",value:e.value,onChange:d=>e.onChange(Number(d.target.value)),min:e.includeDisabled?-1:0,max:7,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&f.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]}):f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),f.jsx("input",{type:"text",value:e.value.join(", "),onChange:d=>{const v=d.target.value.split(",").map(g=>parseInt(g.trim())).filter(g=>!isNaN(g));e.onChange(v)},placeholder:"Enter channel numbers separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&f.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]});if(e.mode==="single"){const{value:d,onChange:v,label:g,helper:m,includeDisabled:y}=e,x=t.filter(_=>_.enabled);return f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:g}),f.jsxs("select",{value:d,onChange:_=>v(Number(_.target.value)),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:[y&&f.jsx("option",{value:-1,children:"Disabled"}),x.map(_=>f.jsx("option",{value:_.index,children:i(_)},_.index))]}),m&&f.jsx("p",{className:"text-xs text-slate-600",children:m})]})}const{value:o,onChange:s,label:l,helper:u}=e,c=t.filter(d=>d.enabled),h=d=>{o.includes(d)?s(o.filter(v=>v!==d)):s([...o,d].sort((v,g)=>v-g))};return f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:l}),f.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[c.map(d=>f.jsxs("label",{onClick:()=>h(d.index),className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17] cursor-pointer",children:[f.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${o.includes(d.index)?"bg-accent border-accent":"border-slate-600"}`,children:o.includes(d.index)&&f.jsx(Jr,{size:12,className:"text-white"})}),f.jsx("span",{className:"text-sm text-slate-200",children:i(d)})]},d.index)),c.length===0&&f.jsx("div",{className:"text-sm text-slate-500 p-2",children:"No channels available"})]}),u&&f.jsx("p",{className:"text-xs text-slate-600",children:u})]})}function y$({value:e,onChange:t,label:r="Serial Port",helper:n="Device path for your USB radio — click Detect to auto-fill a stable by-id path"}){const[a,i]=O.useState(null),[o,s]=O.useState(""),[l,u]=O.useState(!1),[c,h]=O.useState(null),d=async()=>{u(!0),h(null);try{const v=await gJ();i(v.ports),s(v.note||"")}catch(v){h(v instanceof Error?v.message:"Failed to list serial ports"),i([])}finally{u(!1)}};return f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:r}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx("input",{type:"text",value:e,onChange:v=>t(v.target.value),placeholder:"/dev/serial/by-id/usb-... (or /dev/ttyACM0)",className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),f.jsxs("button",{type:"button",onClick:d,disabled:l,className:"flex items-center gap-2 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] hover:border-accent disabled:opacity-50 disabled:cursor-not-allowed rounded text-sm text-slate-300 whitespace-nowrap transition-colors",children:[f.jsx(zo,{size:14,className:l?"animate-spin":""}),l?"Detecting...":"Detect USB devices"]})]}),n&&f.jsx("p",{className:"text-xs text-slate-600",children:n})]}),c&&f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:c}),a!==null&&!c&&(a.length===0?f.jsx("div",{className:"text-sm text-slate-500 p-3 border border-[#1e2a3a] rounded",children:"No USB serial devices found — is the device passed through to the container?"}):f.jsx("div",{className:"border border-[#1e2a3a] rounded p-2 space-y-1",children:a.map(v=>{const g=e===v.stable_path,m=v.product||v.description||v.device;return f.jsxs("button",{type:"button",onClick:()=>t(v.stable_path),className:`w-full text-left flex items-start gap-2 p-2 rounded hover:bg-[#0a0e17] transition-colors ${g?"bg-[#0a0e17] ring-1 ring-accent":""}`,children:[f.jsx("div",{className:`mt-0.5 w-4 h-4 rounded-full border flex items-center justify-center flex-shrink-0 ${g?"bg-accent border-accent":"border-slate-600"}`,children:g&&f.jsx(Jr,{size:12,className:"text-white"})}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-sm text-slate-200 truncate",children:m}),v.likely_radio&&f.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wide bg-accent/15 text-accent border border-accent/30 flex-shrink-0",children:[f.jsx(oi,{size:10})," likely radio"]})]}),f.jsx("div",{className:"text-xs text-slate-500 font-mono truncate",children:v.stable_path}),v.manufacturer&&f.jsx("div",{className:"text-xs text-slate-600 truncate",children:v.manufacturer})]})]},v.stable_path+v.device)})})),o&&f.jsx("p",{className:"text-xs text-slate-600 italic",children:o})]})}const YT=[{key:"bot",label:"Bot",icon:gk},{key:"response",label:"Response",icon:xk},{key:"history",label:"History",icon:TV},{key:"memory",label:"Memory",icon:oJ},{key:"context",label:"Context",icon:Cm},{key:"commands",label:"Commands",icon:EV},{key:"llm",label:"LLM",icon:CV},{key:"weather",label:"Weather",icon:ih},{key:"knowledge",label:"Knowledge",icon:bV},{key:"mesh_intelligence",label:"Intelligence",icon:Mo},{key:"dashboard",label:"Dashboard",icon:NV}],la={bot:"Identity and behavior settings for the bot on the mesh network.",connection:"How MeshAI connects to your Meshtastic radio.",response:"Controls how quickly and how much the bot responds on the mesh.",history:"Conversation history storage and cleanup.",memory:"Short-term conversation memory management. Controls how the bot maintains context within a conversation.",context:"Passive channel monitoring. The bot listens to mesh channels and uses recent messages as context when responding.",commands:"Mesh commands available via the configured prefix. Toggle individual commands on or off.",llm:"AI model configuration. MeshAI uses an LLM to understand questions and generate responses.",weather:"Weather data for the !weather command. This is separate from NWS environmental alerts.",meshmonitor:"AIDA MeshMonitor integration. An additional data source for mesh network monitoring.",knowledge:"Knowledge base for answering questions from stored documents. Connects to Qdrant vector database or local SQLite.",mesh_sources:"Data sources for mesh network information. MeshAI can pull data from multiple sources simultaneously and merge them into a unified view.",mesh_intelligence:"Advanced mesh analysis: health scoring, region management, and automated alerting. The intelligence engine monitors your mesh and detects problems automatically.",dashboard:"Web dashboard settings. You're looking at it right now."},HSe=[{name:"help",description:"Show available commands and usage"},{name:"health",description:"Mesh network health overview with status dots"},{name:"status",description:"Quick mesh status summary"},{name:"region",description:"List regions or get detailed region breakdown"},{name:"neighbors",description:"Show top infrastructure neighbors with signal quality"},{name:"ping",description:"Test bot responsiveness"},{name:"clear",description:"Clear your conversation history"},{name:"reset",description:"Reset conversation context"},{name:"alerts",description:"Active NWS weather alerts for mesh area"},{name:"solar",description:"Space weather and HF propagation conditions"},{name:"hf",description:"HF radio propagation (alias for !solar)"},{name:"fire",description:"Active wildfires near the mesh"},{name:"avy",description:"Avalanche advisories for configured zones"},{name:"hotspots",description:"NASA FIRMS satellite fire detections"},{name:"streams",description:"USGS stream gauge readings"},{name:"roads",description:"Road conditions and closures"},{name:"traffic",description:"Traffic flow on monitored corridors"}],USe=[{value:"US-AL",label:"Alabama"},{value:"US-AK",label:"Alaska"},{value:"US-AZ",label:"Arizona"},{value:"US-AR",label:"Arkansas"},{value:"US-CA",label:"California"},{value:"US-CO",label:"Colorado"},{value:"US-CT",label:"Connecticut"},{value:"US-DE",label:"Delaware"},{value:"US-FL",label:"Florida"},{value:"US-GA",label:"Georgia"},{value:"US-HI",label:"Hawaii"},{value:"US-ID",label:"Idaho"},{value:"US-IL",label:"Illinois"},{value:"US-IN",label:"Indiana"},{value:"US-IA",label:"Iowa"},{value:"US-KS",label:"Kansas"},{value:"US-KY",label:"Kentucky"},{value:"US-LA",label:"Louisiana"},{value:"US-ME",label:"Maine"},{value:"US-MD",label:"Maryland"},{value:"US-MA",label:"Massachusetts"},{value:"US-MI",label:"Michigan"},{value:"US-MN",label:"Minnesota"},{value:"US-MS",label:"Mississippi"},{value:"US-MO",label:"Missouri"},{value:"US-MT",label:"Montana"},{value:"US-NE",label:"Nebraska"},{value:"US-NV",label:"Nevada"},{value:"US-NH",label:"New Hampshire"},{value:"US-NJ",label:"New Jersey"},{value:"US-NM",label:"New Mexico"},{value:"US-NY",label:"New York"},{value:"US-NC",label:"North Carolina"},{value:"US-ND",label:"North Dakota"},{value:"US-OH",label:"Ohio"},{value:"US-OK",label:"Oklahoma"},{value:"US-OR",label:"Oregon"},{value:"US-PA",label:"Pennsylvania"},{value:"US-RI",label:"Rhode Island"},{value:"US-SC",label:"South Carolina"},{value:"US-SD",label:"South Dakota"},{value:"US-TN",label:"Tennessee"},{value:"US-TX",label:"Texas"},{value:"US-UT",label:"Utah"},{value:"US-VT",label:"Vermont"},{value:"US-VA",label:"Virginia"},{value:"US-WA",label:"Washington"},{value:"US-WV",label:"West Virginia"},{value:"US-WI",label:"Wisconsin"},{value:"US-WY",label:"Wyoming"}];function Ei({info:e,link:t,linkText:r="Learn more"}){const[n,a]=O.useState(!1),i=O.useRef(null);return O.useEffect(()=>{if(!n)return;function o(l){i.current&&!i.current.contains(l.target)&&a(!1)}const s=setTimeout(()=>document.addEventListener("mousedown",o),0);return()=>{clearTimeout(s),document.removeEventListener("mousedown",o)}},[n]),f.jsxs("div",{className:"relative inline-block",ref:i,children:[f.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),a(!n)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),n&&f.jsxs("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:[f.jsx("button",{type:"button",onClick:()=>a(!1),className:"absolute top-1 right-1 w-5 h-5 rounded hover:bg-slate-700 text-slate-500 hover:text-slate-300 inline-flex items-center justify-center transition-colors","aria-label":"Close",children:f.jsx(tu,{size:12})}),f.jsx("div",{className:"pr-4",children:e}),t&&f.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 text-accent hover:underline",onClick:o=>o.stopPropagation(),children:[r," ",f.jsx(kc,{size:10})]})]})]})}function ua({text:e}){return f.jsx("p",{className:"text-sm text-slate-500 mb-6 pb-4 border-b border-[#1e2a3a]",children:e})}function it({label:e,value:t,onChange:r,type:n="text",placeholder:a="",helper:i="",info:o="",infoLink:s=""}){const[l,u]=O.useState(!1),c=n==="password";return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&f.jsx(Ei,{info:o,link:s})]}),f.jsxs("div",{className:"relative",children:[f.jsx("input",{type:c&&!l?"password":"text",value:t,onChange:h=>r(h.target.value),placeholder:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),c&&f.jsx("button",{type:"button",onClick:()=>u(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:l?f.jsx(yk,{size:16}):f.jsx(Cm,{size:16})})]}),i&&f.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function Se({label:e,value:t,onChange:r,min:n,max:a,step:i=1,helper:o="",info:s="",infoLink:l=""}){return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&f.jsx(Ei,{info:s,link:l})]}),f.jsx("input",{type:"number",value:t,onChange:u=>r(Number(u.target.value)),min:n,max:a,step:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&f.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Bt({label:e,checked:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){return f.jsxs("div",{className:"flex items-center justify-between py-2",children:[f.jsxs("div",{children:[f.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,a&&f.jsx(Ei,{info:a,link:i})]}),n&&f.jsx("p",{className:"text-xs text-slate-600",children:n})]}),f.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:f.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function on({label:e,value:t,onChange:r,options:n,helper:a="",info:i="",infoLink:o=""}){return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&f.jsx(Ei,{info:i,link:o})]}),f.jsx("select",{value:t,onChange:s=>r(s.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:n.map(s=>f.jsx("option",{value:s.value,children:s.label},s.value))}),a&&f.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function WSe({label:e,value:t,onChange:r,rows:n=4,helper:a="",info:i="",infoLink:o=""}){return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&f.jsx(Ei,{info:i,link:o})]}),f.jsx("textarea",{value:t,onChange:s=>r(s.target.value),rows:n,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent resize-y"}),a&&f.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function En({label:e,value:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){const[o,s]=O.useState(t.join(", "));O.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>c.trim()).filter(Boolean);r(u)};return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&f.jsx(Ei,{info:a,link:i})]}),f.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"item1, item2, item3",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&f.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function XT({label:e,value:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){const[o,s]=O.useState(t.join(", "));O.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>parseInt(c.trim(),10)).filter(c=>!isNaN(c));r(u)};return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&f.jsx(Ei,{info:a,link:i})]}),f.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"0, 1, 2",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&f.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function wn({label:e,description:t,checked:r,onChange:n,threshold:a,onThresholdChange:i,thresholdLabel:o,thresholdMin:s,thresholdMax:l,thresholdStep:u=1,thresholdSuffix:c=""}){return f.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex-1",children:[f.jsx("span",{className:"text-sm text-slate-300",children:e}),f.jsx("p",{className:"text-xs text-slate-600",children:t})]}),f.jsx("button",{type:"button",onClick:()=>n(!r),className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${r?"bg-accent":"bg-[#1e2a3a]"}`,children:f.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${r?"translate-x-5":""}`})})]}),r&&a!==void 0&&i&&f.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-[#1e2a3a]",children:[f.jsxs("span",{className:"text-xs text-slate-500",children:[o||"Threshold",":"]}),f.jsx("input",{type:"number",value:a,onChange:h=>i(Number(h.target.value)),min:s,max:l,step:u,className:"w-20 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono"}),c&&f.jsx("span",{className:"text-xs text-slate-500",children:c})]})]})}function ZSe({data:e,onChange:t}){return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.bot}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"Bot Name",value:e.name,onChange:r=>t({...e,name:r}),helper:"Name the bot responds to on the mesh",info:"When someone sends a message containing this name, the bot will respond. Also used as the sender name in broadcasts. Changing this requires a restart."}),f.jsx(it,{label:"Owner",value:e.owner,onChange:r=>t({...e,owner:r}),helper:"Your callsign or identifier",info:"Identifies the bot operator. Shown in !help responses and used for admin-level commands."}),f.jsx(it,{label:"Contact Email",value:e.contact_email||"",onChange:r=>t({...e,contact_email:r}),helper:"Used to synthesize the NWS User-Agent",info:"An email address identifying the operator; sent as the User-Agent when fetching NWS weather data (NWS requires a contact). Stored in local.yaml."})]}),f.jsx(Bt,{label:"Respond to DMs",checked:e.respond_to_dms,onChange:r=>t({...e,respond_to_dms:r}),helper:"Reply when someone sends a direct message",info:"When enabled, the bot responds to direct messages from any node. When disabled, the bot only responds to channel messages that mention its name."}),f.jsx(Bt,{label:"Filter BBS Protocols",checked:e.filter_bbs_protocols,onChange:r=>t({...e,filter_bbs_protocols:r}),helper:"Ignore BBS bulletin board traffic",info:"Filters out automated BBS protocol messages (advBBS, MAIL*, BOARD*) so the bot doesn't try to respond to machine-to-machine traffic."})]})}function $Se({data:e,onChange:t}){return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.connection}),f.jsx(on,{label:"Connection Type",value:e.type,onChange:r=>t({...e,type:r}),options:[{value:"serial",label:"Serial (USB)"},{value:"tcp",label:"TCP (Network)"}],helper:"Serial for USB-connected radios, TCP for network or meshtasticd",info:"Serial: direct USB connection to a Meshtastic radio. TCP: connect over the network to a radio's IP or to meshtasticd running on another machine."}),e.type==="serial"?f.jsx(y$,{label:"Serial Port",value:e.serial_port,onChange:r=>t({...e,serial_port:r}),helper:"Device path for your USB radio — Detect fills a stable by-id path"}):f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"TCP Host",value:e.tcp_host,onChange:r=>t({...e,tcp_host:r}),placeholder:"192.168.1.100",helper:"IP address or hostname of the radio/meshtasticd"}),f.jsx(Se,{label:"TCP Port",value:e.tcp_port,onChange:r=>t({...e,tcp_port:r}),min:1,max:65535,helper:"Default 4403 for meshtasticd"})]}),f.jsx("div",{className:"pt-2",children:f.jsx(Vf,{to:"/meshcore/connection",className:"inline-flex items-center gap-1 text-xs text-slate-500 hover:text-accent transition-colors",children:"→ MeshCore connection"})})]})}function YSe({data:e,onChange:t}){return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.response}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Delay Min (sec)",value:e.delay_min,onChange:r=>t({...e,delay_min:r}),min:0,step:.1,helper:"Minimum wait before responding",info:"Adds a random delay between min and max before the bot sends a response. Prevents the bot from appearing to respond instantly, which can feel unnatural on a radio network."}),f.jsx(Se,{label:"Delay Max (sec)",value:e.delay_max,onChange:r=>t({...e,delay_max:r}),min:0,step:.1,helper:"Maximum wait before responding",info:"Also prevents collisions with other traffic by staggering transmissions."})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Max Length",value:e.max_length,onChange:r=>t({...e,max_length:r}),min:50,max:500,helper:"Maximum characters per response message",info:"Meshtastic packets have limited size. This caps how long each message chunk can be. The bot will split longer responses into multiple messages up to Max Messages."}),f.jsx(Se,{label:"Max Messages",value:e.max_messages,onChange:r=>t({...e,max_messages:r}),min:1,max:10,helper:"Maximum chunks per response",info:"If a response is longer than Max Length, the bot splits it into this many chunks at most. Higher values = more complete answers but more airtime used."})]})]})}function XSe({data:e,onChange:t}){return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.history}),f.jsx(it,{label:"Database Path",value:e.database,onChange:r=>t({...e,database:r}),helper:"SQLite file for storing conversation history",info:"Path to the SQLite database file. Created automatically if it doesn't exist. Stores all conversation history for context."}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Max Messages Per User",value:e.max_messages_per_user,onChange:r=>t({...e,max_messages_per_user:r}),min:0,helper:"History limit per user (0 = unlimited)",info:"Limits how many messages are stored per user. Older messages are pruned when the limit is reached. Set to 0 for no limit."}),f.jsx(Se,{label:"Conversation Timeout (sec)",value:e.conversation_timeout,onChange:r=>t({...e,conversation_timeout:r}),min:0,helper:"Seconds before context resets",info:"If a user doesn't message for this long, their next message starts a new conversation context. The bot won't remember the previous topic."})]}),f.jsx(Bt,{label:"Auto Cleanup",checked:e.auto_cleanup,onChange:r=>t({...e,auto_cleanup:r}),helper:"Automatically prune old conversations"}),e.auto_cleanup&&f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Cleanup Interval (hours)",value:e.cleanup_interval_hours,onChange:r=>t({...e,cleanup_interval_hours:r}),min:1,helper:"Hours between cleanup runs"}),f.jsx(Se,{label:"Max Age (days)",value:e.max_age_days,onChange:r=>t({...e,max_age_days:r}),min:1,helper:"Delete conversations older than this"})]})]})}function qSe({data:e,onChange:t}){return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.memory}),f.jsx(Bt,{label:"Enable Memory",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Keep conversation context between messages"}),e.enabled&&f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Window Size",value:e.window_size,onChange:r=>t({...e,window_size:r}),min:1,helper:"Recent message pairs kept in full",info:"The bot keeps this many recent exchanges (user message + bot response pairs) as full text in context. Older messages are summarized to save token space."}),f.jsx(Se,{label:"Summarize Threshold",value:e.summarize_threshold,onChange:r=>t({...e,summarize_threshold:r}),min:1,helper:"Messages before older context is summarized",info:"When the conversation exceeds this many messages, older ones outside the window are compressed into a summary by the LLM."})]})]})}function KSe({data:e,onChange:t}){return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.context}),f.jsx(Bt,{label:"Enable Passive Context",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Listen to channel traffic for context",info:"When enabled, the bot monitors mesh channels and includes recent messages in its context. This lets the bot reference things other people said on the channel."}),e.enabled&&f.jsx(f.Fragment,{children:f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Chat context retention (days)",value:Math.round((e.max_age??1209600)/86400),onChange:r=>t({...e,max_age:r*86400}),min:1,helper:"How long the bot remembers recent channel chat for context (applies to both meshes). Default 14 days."}),f.jsx(Se,{label:"Max Context Items",value:e.max_context_items,onChange:r=>t({...e,max_context_items:r}),min:1,helper:"Maximum recent messages to include"})]})})]})}function JSe({data:e,onChange:t}){const r=new Set(e.disabled_commands.map(s=>s.toLowerCase())),[n,a]=O.useState(()=>Object.entries(e.custom_commands||{}));O.useEffect(()=>{const s={};for(const[l,u]of n)l.trim()&&(s[l.trim()]=u);JSON.stringify(s)!==JSON.stringify(e.custom_commands||{})&&a(Object.entries(e.custom_commands||{}))},[e.custom_commands]);const i=s=>{a(s);const l={};for(const[u,c]of s)u.trim()&&(l[u.trim()]=c);t({...e,custom_commands:l})},o=s=>{const l=s.toLowerCase();r.has(l)?t({...e,disabled_commands:e.disabled_commands.filter(u=>u.toLowerCase()!==l)}):t({...e,disabled_commands:[...e.disabled_commands,s]})};return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.commands}),f.jsx(Bt,{label:"Enable Commands",checked:e.enabled,onChange:s=>t({...e,enabled:s}),helper:"Allow !commands on the mesh"}),e.enabled&&f.jsxs(f.Fragment,{children:[f.jsx(it,{label:"Command Prefix",value:e.prefix,onChange:s=>t({...e,prefix:s}),helper:"Character that triggers commands (e.g. ! for !help)",info:"Users type this character followed by the command name. Only single characters recommended."}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Available Commands",f.jsx(Ei,{info:"Toggle commands on or off. Disabled commands won't respond when users invoke them."})]}),f.jsx("div",{className:"grid gap-1",children:HSe.map(s=>{const l=!r.has(s.name.toLowerCase());return f.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#0a0e17] border border-[#1e2a3a] rounded hover:border-[#2a3a4a] transition-colors",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("code",{className:"text-accent text-sm",children:["!",s.name]}),f.jsx("span",{className:"text-xs text-slate-500",children:s.description})]}),f.jsx("button",{type:"button",onClick:()=>o(s.name),className:`relative w-9 h-5 rounded-full transition-colors ${l?"bg-accent":"bg-[#1e2a3a]"}`,children:f.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${l?"translate-x-4":""}`})})]},s.name)})})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Custom Commands",f.jsx(Ei,{info:"Define your own commands. When a user types the prefix followed by the name, the bot replies with the response text verbatim."})]}),n.map(([s,l],u)=>f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx("input",{type:"text",value:s,onChange:c=>{const h=n.map((d,v)=>v===u?[c.target.value,d[1]]:d);i(h)},placeholder:"name",className:"w-40 flex-shrink-0 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),f.jsx("input",{type:"text",value:l,onChange:c=>{const h=n.map((d,v)=>v===u?[d[0],c.target.value]:d);i(h)},placeholder:"response text",className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"}),f.jsx("button",{type:"button",onClick:()=>i(n.filter((c,h)=>h!==u)),className:"p-2 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded flex-shrink-0","aria-label":"Remove custom command",children:f.jsx(po,{size:14})})]},u)),f.jsxs("button",{type:"button",onClick:()=>i([...n,["",""]]),className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[f.jsx(Ti,{size:16})," Add Custom Command"]})]})]})]})}function QSe({data:e,onChange:t}){const r={openai:"OPENAI_API_KEY",anthropic:"ANTHROPIC_API_KEY",google:"GOOGLE_API_KEY"}[(e.backend||"").toLowerCase()]||"LLM_API_KEY";return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.llm}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(on,{label:"Backend",value:e.backend,onChange:n=>t({...e,backend:n}),options:[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"google",label:"Google (Gemini)"}],helper:"LLM provider to use",info:"OpenAI: GPT models (gpt-4o, gpt-4o-mini). Anthropic: Claude models (claude-sonnet-4-20250514). Google: Gemini models. Can also point to compatible APIs like Ollama, LM Studio, or Open WebUI by changing the Base URL."}),f.jsx(it,{label:"Model",value:e.model,onChange:n=>t({...e,model:n}),placeholder:"gpt-4o-mini",helper:"Specific model name",info:"The specific model to use. Common choices: gpt-4o-mini (fast, cheap), gpt-4o (better, costs more), claude-sonnet-4-20250514 (Anthropic equivalent). For local models via Ollama, use the model name you pulled (e.g. llama3.1)."})]}),f.jsx(Ep,{envVar:r,label:"API Key",helper:"Secret stored in /data/secrets/.env; config holds the ${VAR} ref"}),f.jsx(it,{label:"Base URL",value:e.base_url,onChange:n=>t({...e,base_url:n}),placeholder:"https://api.openai.com/v1",helper:"API endpoint (change for local LLMs)",info:"Default API endpoint for the selected backend. Change this to point to a local LLM server (Ollama at http://localhost:11434/v1, Open WebUI, LM Studio, etc.) or a proxy."}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Timeout (sec)",value:e.timeout,onChange:n=>t({...e,timeout:n}),min:5,max:120,helper:"Maximum seconds to wait for response"}),f.jsx(Se,{label:"Max Response Tokens",value:e.max_response_tokens,onChange:n=>t({...e,max_response_tokens:n}),min:100,helper:"Token limit for LLM responses"})]}),f.jsx(Bt,{label:"Use System Prompt",checked:e.use_system_prompt,onChange:n=>t({...e,use_system_prompt:n}),helper:"Enable custom system instructions"}),e.use_system_prompt&&f.jsx(WSe,{label:"System Prompt",value:e.system_prompt,onChange:n=>t({...e,system_prompt:n}),rows:6,helper:"Instructions that shape the bot's personality",info:"Instructions that shape the bot's personality and behavior. The bot always follows these instructions. MeshAI adds mesh health data and environmental context automatically — you don't need to include those here."}),f.jsx(Bt,{label:"Web Search",checked:e.web_search,onChange:n=>t({...e,web_search:n}),helper:"Enable web search tool (Open WebUI feature)"}),f.jsx(Bt,{label:"Google Grounding",checked:e.google_grounding,onChange:n=>t({...e,google_grounding:n}),helper:"Ground responses in web search (Gemini only)"})]})}function eCe({data:e,onChange:t}){return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.weather}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(on,{label:"Primary Provider",value:e.primary,onChange:r=>t({...e,primary:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"}],helper:"Main weather data source"}),f.jsx(on,{label:"Fallback Provider",value:e.fallback,onChange:r=>t({...e,fallback:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"},{value:"none",label:"None"}],helper:"Backup if primary fails"})]}),f.jsx(it,{label:"Default Location",value:e.default_location,onChange:r=>t({...e,default_location:r}),placeholder:"Your city, state",helper:"Location when none specified"}),f.jsx(it,{label:"Open-Meteo base URL (advanced)",value:e.openmeteo.url,onChange:r=>t({...e,openmeteo:{...e.openmeteo,url:r}}),placeholder:"https://api.open-meteo.com/v1",helper:"Override the Open-Meteo API endpoint (leave default unless self-hosting)"}),f.jsx(it,{label:"wttr.in base URL (advanced)",value:e.wttr.url,onChange:r=>t({...e,wttr:{...e.wttr,url:r}}),placeholder:"https://wttr.in",helper:"Override the wttr.in endpoint (leave default unless self-hosting)"})]})}function tCe({data:e,onChange:t}){return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.meshmonitor}),f.jsx(Bt,{label:"Enable MeshMonitor",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Connect to AIDA MeshMonitor instance",info:"MeshMonitor by Yeraze provides node data, battery info, telemetry, and auto-responder patterns. MeshAI uses this as a data source and avoids duplicate responses."}),e.enabled&&f.jsxs(f.Fragment,{children:[f.jsx(it,{label:"URL",value:e.url,onChange:r=>t({...e,url:r}),placeholder:"http://192.168.1.100:8080",helper:"MeshMonitor API endpoint",info:"Full URL to your MeshMonitor instance. Usually runs on port 8080."}),f.jsx(Bt,{label:"Inject Into Prompt",checked:e.inject_into_prompt,onChange:r=>t({...e,inject_into_prompt:r}),helper:"Tell LLM about MeshMonitor commands",info:"Adds MeshMonitor's auto-responder patterns to the LLM context so it knows what commands MeshMonitor handles."}),f.jsx(Se,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:r=>t({...e,refresh_interval:r}),min:10,helper:"How often to fetch patterns"}),f.jsx(Bt,{label:"Polite Mode",checked:e.polite_mode,onChange:r=>t({...e,polite_mode:r}),helper:"Reduce polling frequency",info:"Reduces polling frequency for shared instances to be a good neighbor."})]})]})}function rCe({data:e,onChange:t}){return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.knowledge}),f.jsx(Bt,{label:"Enable Knowledge Base",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Answer questions from stored documents",info:"Uses RAG (Retrieval-Augmented Generation) to answer questions from a knowledge base. Supports Qdrant vector database or local SQLite with FTS5."}),e.enabled&&f.jsxs(f.Fragment,{children:[f.jsx(on,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"auto",label:"Auto (Qdrant -> SQLite)"},{value:"qdrant",label:"Qdrant"},{value:"sqlite",label:"SQLite"}],helper:"Knowledge storage backend",info:"Auto tries Qdrant first, falls back to SQLite. Qdrant provides hybrid search with dense+sparse embeddings. SQLite uses FTS5 keyword search."}),(e.backend==="qdrant"||e.backend==="auto")&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"Qdrant Host",value:e.qdrant_host,onChange:r=>t({...e,qdrant_host:r}),helper:"Qdrant server hostname",info:"IP or hostname of your Qdrant vector database server."}),f.jsx(Se,{label:"Qdrant Port",value:e.qdrant_port,onChange:r=>t({...e,qdrant_port:r}),helper:"Default 6333"})]}),f.jsx(it,{label:"Collection",value:e.qdrant_collection,onChange:r=>t({...e,qdrant_collection:r}),helper:"Qdrant collection name"}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"TEI Host",value:e.tei_host,onChange:r=>t({...e,tei_host:r}),helper:"Text Embeddings Inference host",info:"TEI service for generating dense embeddings. Uses BAAI/bge-m3 model."}),f.jsx(Se,{label:"TEI Port",value:e.tei_port,onChange:r=>t({...e,tei_port:r}),helper:"Default 8090"})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"Sparse Host",value:e.sparse_host,onChange:r=>t({...e,sparse_host:r}),placeholder:"localhost",helper:"SPLADE sparse-embedding service host",info:"Host of the SPLADE service that generates sparse (keyword-weighted) embeddings for hybrid search."}),f.jsx(Se,{label:"Sparse Port",value:e.sparse_port,onChange:r=>t({...e,sparse_port:r}),helper:"Default 8091"})]}),f.jsx(Bt,{label:"Use Sparse Embeddings",checked:e.use_sparse,onChange:r=>t({...e,use_sparse:r}),helper:"Enable hybrid search with sparse vectors",info:"Combines dense embeddings with sparse (keyword-based) embeddings using Reciprocal Rank Fusion for better search results."})]}),f.jsx(it,{label:"SQLite DB Path",value:e.db_path,onChange:r=>t({...e,db_path:r}),helper:"Local knowledge database file"}),f.jsx(Se,{label:"Top K Results",value:e.top_k,onChange:r=>t({...e,top_k:r}),min:1,max:20,helper:"Number of documents to retrieve"})]})]})}function nCe({source:e,onChange:t,onDelete:r}){const[n,a]=O.useState(!1),i={meshview:"Web-based mesh monitoring tool. Enter the full URL of a MeshView instance. No API key typically required.",meshmonitor:"AIDA MeshMonitor API. Provides node data and network statistics. Requires API token.",mqtt:"Subscribe directly to a Meshtastic MQTT broker for real-time packet data. This is push-based (instant) vs the polling approach of MeshView/MeshMonitor."};return f.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[f.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>a(!n),children:[f.jsxs("div",{className:"flex items-center gap-3",children:[n?f.jsx(Sm,{size:16}):f.jsx(nh,{size:16}),f.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`}),f.jsx("span",{className:"font-mono text-sm text-slate-200",children:e.name||"Unnamed Source"}),f.jsx("span",{className:"text-xs text-slate-500 bg-[#1e2a3a] px-2 py-0.5 rounded",children:e.type})]}),f.jsx("button",{onClick:o=>{o.stopPropagation(),r()},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:f.jsx(po,{size:14})})]}),n&&f.jsxs("div",{className:"p-4 space-y-4 border-t border-[#1e2a3a]",children:[f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"Name",value:e.name,onChange:o=>t({...e,name:o}),helper:"Friendly name for this source"}),f.jsx(on,{label:"Type",value:e.type,onChange:o=>t({...e,type:o}),options:[{value:"meshview",label:"MeshView"},{value:"meshmonitor",label:"MeshMonitor"},{value:"mqtt",label:"MQTT Broker"}],info:i[e.type]||""})]}),e.type!=="mqtt"&&f.jsx(it,{label:"URL",value:e.url,onChange:o=>t({...e,url:o}),helper:"Full URL including protocol"}),e.type==="meshmonitor"&&f.jsx(it,{label:"API Token",value:e.api_token,onChange:o=>t({...e,api_token:o}),type:"password",helper:"Bearer token for authentication"}),e.type==="mqtt"&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"Host",value:e.host||"",onChange:o=>t({...e,host:o}),helper:"MQTT broker hostname"}),f.jsx(Se,{label:"Port",value:e.port||1883,onChange:o=>t({...e,port:o}),min:1,max:65535,helper:"1883 plain, 8883 TLS"})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"Username",value:e.username||"",onChange:o=>t({...e,username:o})}),f.jsx(it,{label:"Password",value:e.password||"",onChange:o=>t({...e,password:o}),type:"password"})]}),f.jsx(it,{label:"Topic Root",value:e.topic_root||"msh/US",onChange:o=>t({...e,topic_root:o}),helper:"Base topic to subscribe to"}),f.jsx(Bt,{label:"Use TLS",checked:e.use_tls||!1,onChange:o=>t({...e,use_tls:o}),helper:"Encrypt MQTT connection"})]}),f.jsx(Se,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:o=>t({...e,refresh_interval:o}),min:10,helper:"Polling frequency"}),f.jsx(Bt,{label:"Enabled",checked:e.enabled,onChange:o=>t({...e,enabled:o})}),f.jsx(Bt,{label:"Polite Mode",checked:e.polite_mode,onChange:o=>t({...e,polite_mode:o}),helper:"Reduce polling for shared instances"})]})]})}function aCe({data:e,onChange:t}){const r=()=>{t([...e,{name:"New Source",type:"meshview",url:"",api_token:"",refresh_interval:30,polite_mode:!1,enabled:!0,host:"",port:1883,username:"",password:"",topic_root:"msh/US",use_tls:!1}])};return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.mesh_sources}),e.map((n,a)=>f.jsx(nCe,{source:n,onChange:i=>{const o=[...e];o[a]=i,t(o)},onDelete:()=>{confirm(`Delete source "${n.name}"?`)&&t(e.filter((i,o)=>o!==a))}},a)),f.jsxs("button",{onClick:r,className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[f.jsx(Ti,{size:16})," Add Source"]})]})}function x$({data:e,onChange:t}){const[r,n]=O.useState(null);return f.jsxs("div",{className:"space-y-6",children:[f.jsx(ua,{text:la.mesh_intelligence}),f.jsx(Bt,{label:"Enable Mesh Intelligence",checked:e.enabled,onChange:a=>t({...e,enabled:a}),helper:"Activate health scoring and alerting"}),e.enabled&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Locality Radius (miles)",value:e.locality_radius_miles,onChange:a=>t({...e,locality_radius_miles:a}),min:1,step:.5,helper:"Region assignment radius",info:"Nodes within this distance of a region anchor point are assigned to that region."}),f.jsx(Se,{label:"Offline Threshold (hours)",value:e.offline_threshold_hours,onChange:a=>t({...e,offline_threshold_hours:a}),min:1,helper:"Time until node marked offline",info:"A node is considered offline after not being heard for this many hours."})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Packet Threshold",value:e.packet_threshold,onChange:a=>t({...e,packet_threshold:a}),min:0,helper:"Min packets per 24h to flag",info:"Minimum packets per 24 hours. Nodes below this are flagged as low activity."}),f.jsx(Se,{label:"Battery Warning %",value:e.battery_warning_percent,onChange:a=>t({...e,battery_warning_percent:a}),min:1,max:100,helper:"Global battery warning level"})]}),f.jsx(kP,{label:"Critical Nodes",value:e.critical_nodes,onChange:a=>t({...e,critical_nodes:a}),helper:"Critical infrastructure nodes",info:"Nodes that get priority alerting when they go offline.",roleFilter:"infrastructure"}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(LP,{label:"Alert Channel",value:e.alert_channel,onChange:a=>t({...e,alert_channel:a}),helper:"Channel for broadcast alerts",info:"Meshtastic channel for broadcast alerts. Select Disabled to turn off channel broadcasting.",mode:"single",includeDisabled:!0}),f.jsx(Se,{label:"Alert Cooldown (min)",value:e.alert_cooldown_minutes,onChange:a=>t({...e,alert_cooldown_minutes:a}),min:1,helper:"Min time between repeat alerts",info:"Minimum minutes between repeated alerts for the same condition. Uses scaling cooldown (12h, 24h, 48h)."})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Regions",f.jsx(Ei,{info:"Regions group mesh nodes by geographic area. Each region has an anchor point (lat/lon) and nodes within the region radius are automatically assigned. Regions enable localized reports, alerts, and health scoring."})]}),e.regions.map((a,i)=>f.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[f.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>n(r===i?null:i),children:[f.jsxs("div",{className:"flex items-center gap-3",children:[r===i?f.jsx(Sm,{size:16}):f.jsx(nh,{size:16}),f.jsx("span",{className:"font-medium text-slate-200",children:a.name||"Unnamed Region"}),f.jsx("span",{className:"text-xs text-slate-500",children:a.local_name})]}),f.jsx("button",{onClick:o=>{if(o.stopPropagation(),confirm(`Delete region "${a.name||"Unnamed Region"}"?`)){const s=e.regions.filter((l,u)=>u!==i);t({...e,regions:s})}},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:f.jsx(po,{size:14})})]}),r===i&&f.jsxs("div",{className:"p-4 space-y-3 border-t border-[#1e2a3a]",children:[f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"Name",value:a.name,onChange:o=>{const s=[...e.regions];s[i]={...a,name:o},t({...e,regions:s})}}),f.jsx(it,{label:"Local Name",value:a.local_name,onChange:o=>{const s=[...e.regions];s[i]={...a,local_name:o},t({...e,regions:s})}})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Latitude",value:a.lat,onChange:o=>{const s=[...e.regions];s[i]={...a,lat:o},t({...e,regions:s})},step:1e-4}),f.jsx(Se,{label:"Longitude",value:a.lon,onChange:o=>{const s=[...e.regions];s[i]={...a,lon:o},t({...e,regions:s})},step:1e-4})]}),f.jsx(it,{label:"Description",value:a.description,onChange:o=>{const s=[...e.regions];s[i]={...a,description:o},t({...e,regions:s})}}),f.jsx(En,{label:"Aliases",value:a.aliases,onChange:o=>{const s=[...e.regions];s[i]={...a,aliases:o},t({...e,regions:s})}}),f.jsx(En,{label:"Cities",value:a.cities,onChange:o=>{const s=[...e.regions];s[i]={...a,cities:o},t({...e,regions:s})}})]})]},i)),f.jsxs("button",{onClick:()=>{const a={name:"",local_name:"",lat:0,lon:0,description:"",aliases:[],cities:[]};t({...e,regions:[...e.regions,a]}),n(e.regions.length)},className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[f.jsx(Ti,{size:16})," Add Region"]})]}),f.jsxs("div",{className:"space-y-3",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Rules",f.jsx(Ei,{info:"Configure which conditions trigger alerts. Each rule can have an optional threshold value."})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Infrastructure"}),f.jsx(wn,{label:"Infra Offline",description:"Alert when an infrastructure node (router/repeater) goes offline",checked:e.alert_rules.infra_offline,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_offline:a}})}),f.jsx(wn,{label:"Infra Recovery",description:"Alert when an offline infrastructure node comes back online",checked:e.alert_rules.infra_recovery,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_recovery:a}})}),f.jsx(wn,{label:"New Router",description:"Alert when a new router/repeater appears on the mesh",checked:e.alert_rules.new_router,onChange:a=>t({...e,alert_rules:{...e.alert_rules,new_router:a}})}),f.jsx(wn,{label:"Feeder Offline",description:"Alert when a data source (MeshView/MeshMonitor) stops responding",checked:e.alert_rules.feeder_offline,onChange:a=>t({...e,alert_rules:{...e.alert_rules,feeder_offline:a}})}),f.jsx(wn,{label:"Single Gateway",description:"Alert when an infrastructure node has only one connection path",checked:e.alert_rules.infra_single_gateway,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_single_gateway:a}})}),f.jsx(wn,{label:"Region Blackout",description:"Alert when all infrastructure in a region goes offline",checked:e.alert_rules.region_total_blackout,onChange:a=>t({...e,alert_rules:{...e.alert_rules,region_total_blackout:a}})})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Power"}),f.jsx(wn,{label:"Battery Warning",description:"Alert when infra node battery drops below warning threshold",checked:e.alert_rules.battery_warning,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_warning:a}}),threshold:e.alert_rules.battery_warning_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_warning_threshold:a}}),thresholdLabel:"Below",thresholdMin:10,thresholdMax:90,thresholdSuffix:"%"}),f.jsx(wn,{label:"Battery Critical",description:"Alert at critical battery level",checked:e.alert_rules.battery_critical,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_critical:a}}),threshold:e.alert_rules.battery_critical_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_critical_threshold:a}}),thresholdLabel:"Below",thresholdMin:5,thresholdMax:50,thresholdSuffix:"%"}),f.jsx(wn,{label:"Battery Emergency",description:"Alert at emergency battery level",checked:e.alert_rules.battery_emergency,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_emergency:a}}),threshold:e.alert_rules.battery_emergency_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_emergency_threshold:a}}),thresholdLabel:"Below",thresholdMin:1,thresholdMax:25,thresholdSuffix:"%"}),f.jsx(wn,{label:"Battery Trend Declining",description:"Alert when battery shows a declining trend over 7 days",checked:e.alert_rules.battery_trend_declining,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_trend_declining:a}})}),f.jsx(wn,{label:"Power Source Change",description:"Alert when a node switches between battery and USB power",checked:e.alert_rules.power_source_change,onChange:a=>t({...e,alert_rules:{...e.alert_rules,power_source_change:a}})}),f.jsx(wn,{label:"Solar Not Charging",description:"Alert when a solar-powered node isn't charging during daylight",checked:e.alert_rules.solar_not_charging,onChange:a=>t({...e,alert_rules:{...e.alert_rules,solar_not_charging:a}})})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Utilization"}),f.jsx(wn,{label:"High Utilization",description:"Alert when channel utilization stays high for extended periods",checked:e.alert_rules.sustained_high_util,onChange:a=>t({...e,alert_rules:{...e.alert_rules,sustained_high_util:a}}),threshold:e.alert_rules.high_util_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,high_util_threshold:a}}),thresholdLabel:"Above",thresholdMin:5,thresholdMax:50,thresholdSuffix:`% for ${e.alert_rules.high_util_hours}h`}),e.alert_rules.sustained_high_util&&f.jsx("div",{className:"pl-3",children:f.jsx(Se,{label:"High-Util Window (hours)",value:e.alert_rules.high_util_hours,onChange:a=>t({...e,alert_rules:{...e.alert_rules,high_util_hours:a}}),min:1,helper:"Sustained duration above the utilization threshold before alerting"})}),f.jsx(wn,{label:"Packet Flood",description:"Alert when a single node sends excessive packets",checked:e.alert_rules.packet_flood,onChange:a=>t({...e,alert_rules:{...e.alert_rules,packet_flood:a}}),threshold:e.alert_rules.packet_flood_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,packet_flood_threshold:a}}),thresholdLabel:"Over",thresholdMin:100,thresholdMax:2e3,thresholdSuffix:"pkts/24h"})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Health Scores"}),f.jsx(wn,{label:"Mesh Score Alert",description:"Alert when overall mesh health score drops below threshold",checked:e.alert_rules.mesh_score_alert,onChange:a=>t({...e,alert_rules:{...e.alert_rules,mesh_score_alert:a}}),threshold:e.alert_rules.mesh_score_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,mesh_score_threshold:a}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"}),f.jsx(wn,{label:"Region Score Alert",description:"Alert when a region's health score drops below threshold",checked:e.alert_rules.region_score_alert,onChange:a=>t({...e,alert_rules:{...e.alert_rules,region_score_alert:a}}),threshold:e.alert_rules.region_score_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,region_score_threshold:a}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"})]})]})]})]})}function iCe({data:e,onChange:t}){return f.jsxs("div",{className:"space-y-4",children:[f.jsx(ua,{text:la.dashboard}),f.jsx(Bt,{label:"Enable Dashboard",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Run the web dashboard"}),e.enabled&&f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"Host",value:e.host,onChange:r=>t({...e,host:r}),placeholder:"0.0.0.0",helper:"Network bind address",info:"0.0.0.0 = accessible from any device on the network. 127.0.0.1 = only accessible from this machine."}),f.jsx(Se,{label:"Port",value:e.port,onChange:r=>t({...e,port:r}),min:1,max:65535,helper:"Dashboard URL port",info:"Port number for the web dashboard URL. You access the dashboard at http://your-ip:port"})]})]})}function oCe({timezone:e,onSave:t}){const[r,n]=O.useState(e);return O.useEffect(()=>{n(e)},[e]),f.jsxs("div",{className:"space-y-4 mb-6 pb-6 border-b border-[#1e2a3a]",children:[f.jsx("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:"General"}),f.jsx(it,{label:"Timezone",value:r,onChange:a=>{n(a),t(a)},placeholder:"America/Boise",helper:"Global IANA timezone, e.g. America/Boise",info:"Global IANA timezone used for local time display across MeshAI. Saved immediately."})]})}function sCe(){var z;const{setDirty:e}=Ri(),[t,r]=O.useState(null),[n,a]=O.useState(null),[i,o]=O.useState("bot"),[s]=tJ();O.useEffect(()=>{const E=s.get("section");E&&YT.some(B=>B.key===E)&&o(E)},[s]);const[l,u]=O.useState(!0),[c,h]=O.useState(!1),[d,v]=O.useState(null),[g,m]=O.useState(null),[y,x]=O.useState(!1),[_,w]=O.useState(!1),S=O.useCallback(async()=>{try{const E=await fetch("/api/config");if(!E.ok)throw new Error("Failed to fetch config");const B=await E.json();r(B),a(JSON.parse(JSON.stringify(B))),w(!1),v(null)}catch(E){v(E instanceof Error?E.message:"Unknown error")}finally{u(!1)}},[]);O.useEffect(()=>{document.title="Config — MeshAI",S()},[S]),O.useEffect(()=>{t&&n&&w(JSON.stringify(t)!==JSON.stringify(n))},[t,n]),O.useEffect(()=>(e(_),()=>e(!1)),[_,e]);const C=async()=>{if(t){h(!0),v(null),m(null);try{const E=t[i],B=await fetch(`/api/config/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}),H=await B.json();if(!B.ok)throw new Error(H.detail||"Save failed");m(`${i} saved successfully`),a(JSON.parse(JSON.stringify(t))),w(!1),e(!1),H.restart_required&&(x(!0),ru(Array.isArray(H.changed_keys)?H.changed_keys:[])),setTimeout(()=>m(null),3e3)}catch(E){v(E instanceof Error?E.message:"Save failed")}finally{h(!1)}}},M=()=>{n&&(r(JSON.parse(JSON.stringify(n))),w(!1))},A=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{v("Restart failed")}},I=(E,B)=>{t&&r({...t,[E]:B})},k=async E=>{try{const B=await fetch("/api/config/timezone",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}),H=await B.json();if(!B.ok)throw new Error(H.detail||"Save failed");r(V=>V&&{...V,timezone:E}),a(V=>V&&{...V,timezone:E})}catch(B){v(B instanceof Error?B.message:"Timezone save failed")}};if(l)return f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-slate-400",children:"Loading configuration..."})});if(!t)return f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-red-400",children:"Failed to load configuration"})});const P=()=>{switch(i){case"bot":return f.jsxs(f.Fragment,{children:[f.jsx(oCe,{timezone:t.timezone,onSave:k}),f.jsx(ZSe,{data:t.bot,onChange:E=>I("bot",E)})]});case"response":return f.jsx(YSe,{data:t.response,onChange:E=>I("response",E)});case"history":return f.jsx(XSe,{data:t.history,onChange:E=>I("history",E)});case"memory":return f.jsx(qSe,{data:t.memory,onChange:E=>I("memory",E)});case"context":return f.jsx(KSe,{data:t.context,onChange:E=>I("context",E)});case"commands":return f.jsx(JSe,{data:t.commands,onChange:E=>I("commands",E)});case"llm":return f.jsx(QSe,{data:t.llm,onChange:E=>I("llm",E)});case"weather":return f.jsx(eCe,{data:t.weather,onChange:E=>I("weather",E)});case"knowledge":return f.jsx(rCe,{data:t.knowledge,onChange:E=>I("knowledge",E)});case"mesh_intelligence":return f.jsx(x$,{data:t.mesh_intelligence,onChange:E=>I("mesh_intelligence",E)});case"dashboard":return f.jsx(iCe,{data:t.dashboard,onChange:E=>I("dashboard",E)});default:return null}},D=((z=YT.find(E=>E.key===i))==null?void 0:z.label)||i;return f.jsxs("div",{className:"flex gap-6 h-[calc(100vh-8rem)]",children:[f.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:YT.map(({key:E,label:B,icon:H})=>f.jsxs("button",{onClick:()=>o(E),className:`w-full flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${i===E?"bg-accent text-white":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover"}`,children:[f.jsx(H,{size:16}),f.jsx("span",{children:B}),_&&i===E&&f.jsx("span",{className:"ml-auto w-2 h-2 bg-amber-500 rounded-full"})]},E))}),f.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[f.jsxs("div",{className:"flex items-center justify-between mb-6",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(IV,{size:20,className:"text-slate-500"}),f.jsx("h2",{className:"text-lg font-semibold text-slate-200",children:D})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[_&&f.jsxs("button",{onClick:M,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-slate-400 hover:text-slate-200 bg-bg-hover rounded transition-colors",children:[f.jsx(oa,{size:14}),"Discard"]}),f.jsxs("button",{onClick:C,disabled:c||!_,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[c?f.jsx(zo,{size:14,className:"animate-spin"}):f.jsx(sa,{size:14}),"Save"]})]})]}),y&&f.jsxs("div",{className:"flex items-center justify-between p-3 mb-4 bg-amber-500/10 border border-amber-500/30",children:[f.jsxs("div",{className:"flex items-center gap-2 text-amber-400",children:[f.jsx(Ao,{size:16}),f.jsx("span",{className:"text-sm",children:"Restart required for changes to take effect"})]}),f.jsx("button",{onClick:A,className:"px-3 py-1 text-sm bg-amber-500 text-white rounded hover:bg-amber-600 transition-colors",children:"Restart Now"})]}),d&&f.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-red-500/10 border border-red-500/30 text-red-400",children:[f.jsx(tu,{size:16}),f.jsx("span",{className:"text-sm",children:d})]}),g&&f.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-green-500/10 border border-green-500/30 text-green-400",children:[f.jsx(Jr,{size:16}),f.jsx("span",{className:"text-sm",children:g})]}),f.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:f.jsx("div",{className:"bg-bg-card border border-border p-6",children:P()})})]})]})}const lCe=["mesh_broadcast","mesh_dm"],uCe=["meshcore_broadcast","meshcore_dm"],cCe=["routine","priority","immediate"];function ji({info:e}){const[t,r]=O.useState(!1);return f.jsxs("div",{className:"relative inline-block",children:[f.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(!t)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),t&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),f.jsx("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:e})]})]})}function hCe({label:e,value:t,onChange:r,type:n="text",placeholder:a="",helper:i="",info:o=""}){const[s,l]=O.useState(!1),u=n==="password";return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&f.jsx(ji,{info:o})]}),f.jsxs("div",{className:"relative",children:[f.jsx("input",{type:u&&!s?"password":"text",value:t,onChange:c=>r(c.target.value),placeholder:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),u&&f.jsx("button",{type:"button",onClick:()=>l(!s),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:s?f.jsx(yk,{size:16}):f.jsx(Cm,{size:16})})]}),i&&f.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function Nd({label:e,value:t,onChange:r,min:n,max:a,step:i=1,helper:o="",info:s=""}){return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&f.jsx(ji,{info:s})]}),f.jsx("input",{type:"number",value:t,onChange:l=>r(Number(l.target.value)),min:n,max:a,step:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&f.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function kd({label:e,checked:t,onChange:r,helper:n="",info:a=""}){return f.jsxs("div",{className:"flex items-center justify-between py-2",children:[f.jsxs("div",{children:[f.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,a&&f.jsx(ji,{info:a})]}),n&&f.jsx("p",{className:"text-xs text-slate-600",children:n})]}),f.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:f.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function gp({label:e,value:t,onChange:r,helper:n="",info:a=""}){return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&f.jsx(ji,{info:a})]}),f.jsx("input",{type:"time",value:t,onChange:i=>r(i.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"}),n&&f.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function _$({label:e,value:t,onChange:r,placeholder:n="Add item...",helper:a="",info:i=""}){const[o,s]=O.useState(""),l=()=>{o.trim()&&!t.includes(o.trim())&&(r([...t,o.trim()]),s(""))},u=c=>{r(t.filter((h,d)=>d!==c))};return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&f.jsx(ji,{info:i})]}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx("input",{type:"text",value:o,onChange:c=>s(c.target.value),onKeyDown:c=>c.key==="Enter"&&(c.preventDefault(),l()),className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent",placeholder:n}),f.jsx("button",{type:"button",onClick:l,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm text-white transition-colors",children:f.jsx(Ti,{size:16})})]}),t.length>0&&f.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.map((c,h)=>f.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-[#1e2a3a] rounded text-sm text-slate-300",children:[c,f.jsx("button",{type:"button",onClick:()=>u(h),className:"text-slate-500 hover:text-red-400",children:f.jsx(tu,{size:14})})]},h))}),a&&f.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function b$({channels:e,severityChannels:t,onChange:r}){const n=a=>a.replace("meshcore_","mc_").replace("mesh_","").replace(/_/g," ");return f.jsxs("table",{className:"text-xs w-full",children:[f.jsx("thead",{children:f.jsxs("tr",{children:[f.jsx("th",{className:"text-left text-slate-600 font-normal w-20",children:"severity"}),e.map(a=>f.jsx("th",{className:"text-slate-500 font-normal px-1 whitespace-nowrap",children:n(a)},a))]})}),f.jsx("tbody",{children:cCe.map(a=>f.jsxs("tr",{children:[f.jsx("td",{className:"text-slate-400 pr-2 whitespace-nowrap",children:a}),e.map(i=>{const o=(t[a]||[]).includes(i);return f.jsx("td",{className:"text-center",children:f.jsx("input",{type:"checkbox",checked:o,onChange:s=>{const l={...t},u=new Set(l[a]||[]);s.target.checked?u.add(i):u.delete(i),l[a]=Array.from(u),r(l)}})},i)})]},a))})]})}const Yl=[{key:"mesh_health",label:"Mesh Health",Icon:Mo},{key:"weather",label:"Weather",Icon:ih},{key:"fire",label:"Fire",Icon:Tm},{key:"rf_propagation",label:"RF Propagation",Icon:oi},{key:"roads",label:"Roads",Icon:h1},{key:"avalanche",label:"Avalanche",Icon:PV},{key:"satpass",label:"Satellite Passes",Icon:v1},{key:"seismic",label:"Seismic",Icon:sd},{key:"tracking",label:"Tracking",Icon:Rd}];function fCe(e){const t=new Set(Yl.map(n=>n.key)),r=[];for(const n of e)!n||!n.key||t.has(n.key)||(t.add(n.key),r.push({key:n.key,label:n.label||n.key,Icon:AV}));return[...Yl,...r]}let cx=null,qT=null;function w$(){const[e,t]=O.useState(cx??Yl);return O.useEffect(()=>{let r=!1;if(cx){t(cx);return}return qT||(qT=fetch("/api/notifications/families").then(n=>n.ok?n.json():[]).then(n=>{const a=fCe(Array.isArray(n)?n:[]);return cx=a,a}).catch(()=>Yl)),qT.then(n=>{r||t(n)}),()=>{r=!0}},[]),e}function dCe(e,t,r){const n=e?{...e}:{...t,name:r};n.name=t.name||n.name||r;const a=(e==null?void 0:e.severity_channels)||{},i=t.severity_channels||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};return o.forEach(l=>{const u=(a[l]||[]).filter(h=>h.startsWith("meshcore_")),c=(i[l]||[]).filter(h=>!h.startsWith("meshcore_"));s[l]=[...u,...c]}),n.severity_channels=s,n.broadcast_channel=t.broadcast_channel,n.node_ids=t.node_ids,n}function vCe(e,t){const r=(t==null?void 0:t.enabled)??(e==null?void 0:e.enabled)??!1,n=(e==null?void 0:e.cells)||{},a=(t==null?void 0:t.cells)||{},i=new Set([...Object.keys(n),...Object.keys(a)]),o={};for(const s of i){const l=n[s]||{},u=a[s]||{},c=new Set([...Object.keys(l),...Object.keys(u)]),h={};for(const d of c){const v=l[d],g=u[d],m={mt:g!==void 0?g.mt:(v==null?void 0:v.mt)??null,mc:(v==null?void 0:v.mc)??null,min_severity:(g==null?void 0:g.min_severity)??(v==null?void 0:v.min_severity)??"routine",enabled:(g==null?void 0:g.enabled)??(v==null?void 0:v.enabled)??!0},y=m.mc;(m.mt!==null||y!==null&&y.trim()!=="")&&(h[d]=m)}Object.keys(h).length>0&&(o[s]=h)}return{enabled:r,cells:o}}function pCe({toggles:e,onChange:t,regions:r,regionRoutes:n,onRegionRoutesChange:a}){const i=w$(),o=(h,d)=>t({...e,[h]:{...e[h]||{},...d}}),[s,l]=O.useState({}),u=(h,d,v)=>{var y,x,_;const g=((x=(y=n==null?void 0:n.cells)==null?void 0:y[h])==null?void 0:x[d])??{mt:null,mc:null,min_severity:"routine",enabled:!0},m={...(n==null?void 0:n.cells)||{},[h]:{...((_=n==null?void 0:n.cells)==null?void 0:_[h])||{},[d]:{...g,mt:v}}};a({enabled:(n==null?void 0:n.enabled)??!1,cells:m})},c=h=>{var m;const d=((m=n==null?void 0:n.cells)==null?void 0:m[h])||{},v={};for(const[y,x]of Object.entries(d))v[y]={...x,mt:null};const g={...(n==null?void 0:n.cells)||{},[h]:v};a({enabled:(n==null?void 0:n.enabled)??!1,cells:g})};return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Meshtastic Delivery",f.jsx(ji,{info:"Per-family Meshtastic delivery matrix. Choose which channels fire at each severity, the broadcast channel index, and DM node IDs. Family on/off and severity threshold are configured on the Data Feeds page."})]}),f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:i.map(({key:h,label:d,Icon:v})=>{var w;const g=e[h]||{},m=((w=n==null?void 0:n.cells)==null?void 0:w[h])||{},y=r.some(S=>{var C;return((C=m[S])==null?void 0:C.mt)!=null}),x=s[h],_=x!==void 0?x:y;return f.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-3",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-200",children:[f.jsx(v,{size:15})," ",d]}),f.jsxs("div",{className:"space-y-3 p-3 bg-[#0a0e17] border border-[#1e2a3a]",children:[f.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-300",children:[f.jsx(oi,{size:13}),"Meshtastic"]}),f.jsx(b$,{channels:lCe,severityChannels:g.severity_channels||{},onChange:S=>o(h,{severity_channels:S})}),f.jsx(Nd,{label:"Broadcast channel",value:g.broadcast_channel??0,onChange:S=>o(h,{broadcast_channel:S}),min:0,helper:"Meshtastic channel index (0 = LongFast primary)",info:"The Meshtastic channel index used for mesh_broadcast delivery. 0 = primary channel."}),f.jsx(_$,{label:"DM node IDs",value:g.node_ids||[],onChange:S=>o(h,{node_ids:S}),placeholder:"!hex_id",helper:"Meshtastic DM recipients (hex node IDs)",info:"Hex node IDs for mesh_dm delivery (e.g. !a1b2c3d4). Used when mesh_dm is enabled for a severity."})]}),f.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[f.jsx(kd,{label:"Region-based routing",checked:_,onChange:S=>{l(C=>({...C,[h]:S})),S||c(h)},helper:"Route this family to different MT channels per region"}),_&&(r.length===0?f.jsxs("p",{className:"text-xs text-slate-500 italic",children:["No regions yet — add them on the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage"})," page."]}):f.jsx("div",{className:"space-y-1.5 pt-1",children:r.map(S=>{const C=m[S]??{mt:null};return f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-xs text-slate-400 flex-1 min-w-0 truncate",children:S}),f.jsx("input",{type:"number",value:C.mt!==null?C.mt:"",onChange:M=>{const A=M.target.value;u(h,S,A===""?null:parseInt(A,10))},min:0,max:7,placeholder:"ch",className:"w-16 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono focus:outline-none focus:border-accent"})]},S)})}))]})]},h)})})]})}function gCe(){const{setDirty:e}=Ri(),t=w$(),[r,n]=O.useState(null),[a,i]=O.useState(null),[o,s]=O.useState([]),[l,u]=O.useState(!0),[c,h]=O.useState(!1),[d,v]=O.useState(null),[g,m]=O.useState(null),[y,x]=O.useState(!1),_=O.useCallback(async()=>{try{const[C,M]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/regions")]);if(!C.ok)throw new Error("Failed to fetch notifications config");const A=await C.json(),I=M.ok?await M.json():[];n(A),i(JSON.parse(JSON.stringify(A))),s(Array.isArray(I)?I:[]),x(!1),v(null)}catch(C){v(C instanceof Error?C.message:"Unknown error")}finally{u(!1)}},[]);O.useEffect(()=>{document.title="Meshtastic Routing - MeshAI",_()},[_]),O.useEffect(()=>{r&&a&&x(JSON.stringify(r)!==JSON.stringify(a))},[r,a]),O.useEffect(()=>(e(y),()=>e(!1)),[y,e]);const w=async()=>{if(r){h(!0),v(null),m(null);try{const C=await fetch("/api/config/notifications");if(!C.ok)throw new Error("Failed to re-fetch notifications config");const M=await C.json(),A={...M,toggles:{...M.toggles||{}},region_routes:vCe(M.region_routes,r.region_routes)},I=r.toggles||{};for(const{key:D}of t){const z=I[D];z&&(A.toggles[D]=dCe((M.toggles||{})[D],z,D))}const k=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),P=await k.json();if(!k.ok)throw new Error(P.detail||"Save failed");n(A),i(JSON.parse(JSON.stringify(A))),x(!1),e(!1),m("Meshtastic routing saved successfully"),setTimeout(()=>m(null),3e3)}catch(C){v(C instanceof Error?C.message:"Save failed")}finally{h(!1)}}},S=()=>{a&&(n(JSON.parse(JSON.stringify(a))),x(!1))};return l?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-slate-400",children:"Loading notifications config..."})}):r?f.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{children:f.jsxs("p",{className:"text-sm text-slate-500",children:["Per-family Meshtastic delivery. Family gating (enable, severity threshold, freshness/cooldown) is on"," ",f.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"}),". MeshCore delivery is on the"," ",f.jsx("a",{href:"/meshcore/routing",className:"text-accent hover:underline",children:"MeshCore Routing"})," page."]})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:_,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:f.jsx(zo,{size:18})}),f.jsxs("button",{onClick:S,disabled:!y,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[f.jsx(oa,{size:16}),"Discard"]}),f.jsxs("button",{onClick:w,disabled:c||!y,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[f.jsx(sa,{size:16}),c?"Saving...":"Save"]})]})]}),d&&f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:d}),g&&f.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[f.jsx(Jr,{size:14,className:"inline mr-2"}),g]}),f.jsx("div",{className:"bg-bg-card border border-border p-6",children:r.toggles?f.jsx(pCe,{toggles:r.toggles,onChange:C=>n({...r,toggles:C}),regions:o,regionRoutes:r.region_routes,onRegionRoutesChange:C=>n({...r,region_routes:C})}):f.jsx("p",{className:"text-sm text-slate-500",children:"No family configuration found."})})]}):f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})})}const mCe={wfigs:["allowed_incident_types","freshness_seconds","cooldown_seconds","broadcast_on_acres","broadcast_on_contained"],fires:["digest_enabled","digest_schedule","digest_timezone"],tomtom_incidents:["min_magnitude","drop_non_present","drop_zero_magnitude"],itd_511:["min_severity","enabled_categories","enabled_sub_types"],wzdx:["broadcast","min_severity","sub_types"],nws:["broadcast_severities","duplicate_allowed_after_seconds"],avalanche:["min_danger_level"],swpc:["geomag_kp_floor","flare_class_floor","proton_pfu_floor"],satpass:["enabled","observers","min_elevation","norad_ids","max_broadcasts_per_hour","dry_run"]},yCe=1500;function S$({excludeKeys:e,hideLlmToggle:t}={}){const[r,n]=O.useState({}),[a,i]=O.useState({}),[o,s]=O.useState(!0),[l,u]=O.useState(null),[c,h]=O.useState({}),[d,v]=O.useState({}),[g,m]=O.useState({}),y=O.useCallback(async()=>{s(!0),u(null);try{const[M,A]=await Promise.all([fetch("/api/adapter-config"),fetch("/api/adapter-meta")]);if(!M.ok)throw new Error(`GET /adapter-config: ${M.status}`);if(!A.ok)throw new Error(`GET /adapter-meta: ${A.status}`);n(await M.json()),i(await A.json())}catch(M){u(String(M))}finally{s(!1)}},[]);O.useEffect(()=>{y()},[y]);const x=O.useCallback((M,A,I)=>{v(k=>({...k,[M]:A})),I&&m(k=>({...k,[M]:I})),A==="saved"&&setTimeout(()=>{v(k=>k[M]==="saved"?{...k,[M]:"idle"}:k)},yCe)},[]),_=O.useCallback(async(M,A,I)=>{const k=`${M}.${A}`;x(k,"saving");try{const P=await fetch(`/api/adapter-config/${M}/${A}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:I})});if(!P.ok){const E=(await P.json().catch(()=>({}))).detail||P.statusText;x(k,"error",String(E));return}const D=await P.json();n(z=>({...z,[M]:(z[M]||[]).map(E=>E.key===A?D:E)})),x(k,"saved")}catch(P){x(k,"error",String(P))}},[x]),w=O.useCallback(async(M,A)=>{const I=`${M}.${A}`;x(I,"saving");try{const k=await fetch(`/api/adapter-config/${M}/${A}/reset`,{method:"POST"});if(!k.ok){x(I,"error",`reset failed (${k.status})`);return}const P=await k.json();n(D=>({...D,[M]:(D[M]||[]).map(z=>z.key===A?P:z)})),x(I,"saved")}catch(k){x(I,"error",String(k))}},[x]),S=O.useCallback(async(M,A)=>{const I=`meta:${M}`;x(I,"saving");try{const k=await fetch(`/api/adapter-meta/${M}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!k.ok){const D=await k.json().catch(()=>({}));x(I,"error",String(D.detail||k.statusText));return}const P=await k.json();i(D=>({...D,[M]:P})),x(I,"saved")}catch(k){x(I,"error",String(k))}},[x]);if(o)return f.jsxs("div",{className:"p-6 flex items-center gap-2 text-[#777]",children:[f.jsx(jd,{className:"w-5 h-5 animate-spin"})," Loading adapter config…"]});if(l)return f.jsxs("div",{className:"p-6 text-red-400",children:[f.jsx(ah,{className:"w-5 h-5 inline mr-2"}),"Failed to load: ",l]});const C=Array.from(new Set([...Object.keys(a),...Object.keys(r)])).sort();return f.jsxs("div",{className:"p-6 space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-2 text-white",children:[f.jsx(Ag,{className:"w-5 h-5"}),f.jsx("h1",{className:"text-xl font-semibold",children:"Adapter Config"}),f.jsxs("span",{className:"text-xs text-[#666] ml-2",children:[Object.entries(r).reduce((M,[A,I])=>M+(e!=null&&e[A]?I.filter(k=>!e[A].includes(k.key)).length:I.length),0)," settings across ",C.length," adapters"]})]}),f.jsxs("p",{className:"text-xs text-[#777] max-w-3xl",children:["Per-adapter tunables (thresholds, freshness windows, toggles, curation lists). Changes take effect on the next handler call -- no container restart needed. Sentence templates, emoji, and translation maps live in code by design — see the CODE rule under ",f.jsx("a",{href:"/reference#adapter-config",className:"text-accent hover:underline",children:"Adapter Config & the CODE Rule"})," in Reference. The ",f.jsx("strong",{children:"LLM context"})," toggle on each card gates whether that adapter's data lands in the system prompt when you DM the bot; broadcasts are unaffected."]}),C.map(M=>{var E;const A=a[M]||{display_name:M,include_in_llm_context:!0,description:""},I=r[M]||[],k=e!=null&&e[M]?I.filter(B=>!e[M].includes(B.key)):I,P=c[M]??!1,D=`meta:${M}`,z=d[D]||"idle";return f.jsxs("div",{className:"bg-bg-card border border-border",children:[f.jsxs("div",{className:"p-4 flex items-start gap-4",children:[f.jsx("button",{onClick:()=>h(B=>({...B,[M]:!B[M]})),className:"text-[#777] hover:text-white","aria-label":"toggle expand",children:P?f.jsx(Sm,{className:"w-5 h-5"}):f.jsx(nh,{className:"w-5 h-5"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h2",{className:"text-base font-semibold text-white",children:A.display_name}),f.jsx("code",{className:"text-xs text-[#666]",children:M}),k.length>0&&f.jsxs("span",{className:"text-xs text-[#777] ml-1",children:["(",k.length," settings",(E=e==null?void 0:e[M])!=null&&E.length?`, ${e[M].length} curated`:"",")"]}),k.length===0&&f.jsx("span",{className:"text-xs text-[#666] ml-1 italic",children:I.length>0?"(all curated)":"(meta only)"})]}),A.description&&f.jsx("p",{className:"text-xs text-[#777] mt-1",children:A.description})]}),!t&&f.jsxs("label",{className:"flex items-center gap-2 text-xs text-[#e0e0e0] select-none",children:[f.jsx("input",{type:"checkbox",checked:A.include_in_llm_context,onChange:B=>S(M,{include_in_llm_context:B.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"}),"LLM context",f.jsx(C$,{status:z,error:g[D]})]})]}),P&&k.length>0&&f.jsx("div",{className:"border-t border-border divide-y divide-border",children:k.map(B=>f.jsx(xCe,{row:B,status:d[`${M}.${B.key}`]||"idle",error:g[`${M}.${B.key}`],onCommit:H=>_(M,B.key,H),onReset:()=>w(M,B.key)},B.key))})]},M)})]})}function xCe({row:e,status:t,error:r,onCommit:n,onReset:a}){const[i,o]=O.useState(KT(e));O.useEffect(()=>{o(KT(e))},[e.value,e.type]);const s=i!==KT(e),l=JSON.stringify(e.value)===JSON.stringify(e.default),u=()=>{const c=_Ce(i,e.type);c.error||c.changed(e.value)&&n(c.value)};return f.jsxs("div",{className:"px-6 py-3 flex items-start gap-4",children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("code",{className:"text-sm font-mono text-accent",children:e.key}),f.jsxs("span",{className:"text-xs text-[#666]",children:["[",e.type,"]"]}),!l&&f.jsx("span",{className:"text-xs text-accent",children:"edited"})]}),e.description&&f.jsx("p",{className:"text-xs text-[#777] mt-1",children:e.description})]}),f.jsxs("div",{className:"flex items-center gap-2 min-w-[280px] justify-end",children:[e.type==="bool"?f.jsx("input",{type:"checkbox",checked:e.value===!0,onChange:c=>n(c.target.checked),className:"w-5 h-5 accent-[#f59e0b]"}):e.type==="json"?f.jsx("textarea",{className:"w-72 h-20 bg-[#0d0d0d] border border-border px-2 py-1 text-xs font-mono text-white",value:i,onChange:c=>o(c.target.value),onBlur:u}):f.jsx("input",{type:e.type==="int"||e.type==="float"?"number":"text",step:e.type==="float"?"any":"1",className:"w-48 bg-[#0d0d0d] border border-border px-2 py-1 text-sm text-white",value:i,onChange:c=>o(c.target.value),onBlur:u,onKeyDown:c=>{c.key==="Enter"&&c.target.blur()}}),f.jsx(C$,{status:t,error:r,dirty:s}),f.jsx("button",{onClick:a,disabled:l,className:"text-[#777] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Reset to default",children:f.jsx(oa,{className:"w-4 h-4"})})]})]})}function C$({status:e,error:t,dirty:r}){return e==="saving"?f.jsx(jd,{className:"w-4 h-4 text-accent animate-spin"}):e==="saved"?f.jsx(Jr,{className:"w-4 h-4 text-green-500"}):e==="error"?f.jsx("span",{title:t,className:"text-red-400 cursor-help",children:f.jsx(ah,{className:"w-4 h-4"})}):r?f.jsx("span",{className:"w-2 h-2 bg-accent rounded-full",title:"unsaved"}):f.jsx("span",{className:"w-4 h-4"})}function KT(e){return e.type==="bool"?String(e.value===!0):e.type==="json"?JSON.stringify(e.value,null,2):e.value===null||e.value===void 0?"":String(e.value)}function _Ce(e,t){if(t==="int"){const r=Number(e);return!Number.isFinite(r)||!Number.isInteger(r)?{error:"expected integer",value:null,changed:()=>!1}:{error:null,value:r,changed:n=>n!==r}}if(t==="float"){const r=Number(e);return Number.isFinite(r)?{error:null,value:r,changed:n=>n!==r}:{error:"expected number",value:null,changed:()=>!1}}if(t==="str")return{error:null,value:e,changed:r=>r!==e};if(t==="json")try{const r=JSON.parse(e);return{error:null,value:r,changed:n=>JSON.stringify(n)!==JSON.stringify(r)}}catch{return{error:"invalid JSON",value:null,changed:()=>!1}}return{error:null,value:e,changed:()=>!0}}const bCe=["routine","priority","immediate"];function GB(e){return{name:`source_${e}`,enabled:!0,url:"",items_path:"features",id_path:"",lat_path:"",lon_path:"",geometry_path:"geometry",title_path:"",time_path:"",category:"generic_alert",poll_seconds:300,severity:"routine",field_mappings:[],summary_template:"",emoji:"",headers:{}}}function Oa({label:e,value:t,onChange:r,placeholder:n,type:a="text",mono:i=!1}){return f.jsxs("div",{className:"min-w-0",children:[f.jsx("label",{className:"text-xs text-[#777] mb-1 block",children:e}),f.jsx("input",{type:a,value:t,placeholder:n,onChange:o=>r(o.target.value),className:`w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs ${i?"font-mono":""} text-[#e0e0e0] placeholder:text-[#555]`})]})}function hx({children:e}){return f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] pt-1",children:e})}function wCe(){const[e,t]=O.useState(null),[r,n]=O.useState(""),[a,i]=O.useState(!0),[o,s]=O.useState(!1),[l,u]=O.useState(null),[c,h]=O.useState(null),{setDirty:d}=Ri(),[v,g]=O.useState({}),[m,y]=O.useState({});O.useEffect(()=>{bJ().then(U=>{const Z=(Array.isArray(U)?U:[]).map(($,W)=>({...GB(W+1),...$}));t(Z),n(JSON.stringify(Z))}).catch(U=>u(U instanceof Error?U.message:String(U))).finally(()=>i(!1))},[]);const x=e!==null&&JSON.stringify(e)!==r;O.useEffect(()=>(d(x),()=>d(!1)),[x,d]);const _=(U,F)=>{t(Z=>Z&&Z.map(($,W)=>W===U?{...$,...F}:$))},w=()=>{t(U=>[...U??[],GB(((U==null?void 0:U.length)??0)+1)])},S=U=>{t(F=>F&&F.filter((Z,$)=>$!==U)),g(F=>{const Z={...F};return delete Z[U],Z})},C=U=>{t(F=>F&&F.map((Z,$)=>$===U?{...Z,field_mappings:[...Z.field_mappings,{source_path:"",dest_key:""}]}:Z))},M=(U,F,Z)=>{t($=>$&&$.map((W,q)=>q===U?{...W,field_mappings:W.field_mappings.map((re,Q)=>Q===F?{...re,...Z}:re)}:W))},A=(U,F)=>{t(Z=>Z&&Z.map(($,W)=>W===U?{...$,field_mappings:$.field_mappings.filter((q,re)=>re!==F)}:$))},I=U=>Object.entries(U.headers??{}),k=(U,F)=>{const Z={};for(const[$,W]of F)Z[$]=W;_(U,{headers:Z})},P=U=>{e&&k(U,[...I(e[U]),["",""]])},D=(U,F,Z,$)=>{if(!e)return;const W=I(e[U]);W[F]=[Z,$],k(U,W)},z=(U,F)=>{if(!e)return;const Z=I(e[U]);Z.splice(F,1),k(U,Z)},E=async U=>{if(!e)return;const F=e[U];y(Z=>({...Z,[U]:!0}));try{const Z=await SJ(F.url,F.items_path,F.headers);g($=>({...$,[U]:Z}))}catch(Z){g($=>({...$,[U]:{ok:!1,error:Z instanceof Error?Z.message:String(Z)}}))}finally{y(Z=>({...Z,[U]:!1}))}},B=()=>{r&&(t(JSON.parse(r)),g({}))},H=async()=>{if(e){s(!0),u(null),h(null);try{const U=await wJ(e);n(JSON.stringify(e)),h("Custom sources saved"),setTimeout(()=>h(null),3e3),U.restart_required&&ru(Array.isArray(U.changed_keys)?U.changed_keys:[])}catch(U){u(U instanceof Error?U.message:"Save failed")}finally{s(!1)}}};if(a)return f.jsx("div",{className:"flex items-center justify-center h-32 text-[#777]",children:"Loading custom sources…"});if(!e)return f.jsx("div",{className:"flex items-center justify-center h-32 text-red-400",children:l||"No config"});const V=f.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[f.jsxs("button",{onClick:B,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[f.jsx(oa,{size:14})," Discard"]}),f.jsxs("button",{onClick:H,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[f.jsx(sa,{size:14})," ",o?"Saving…":"Save"]})]});return f.jsxs("div",{className:"space-y-6 max-w-4xl",children:[f.jsxs("div",{className:"flex items-start justify-between gap-4",children:[f.jsxs("p",{className:"text-sm text-[#777]",children:["Point MeshAI at any public REST or GeoJSON feed — no code. Each source polls a URL, maps its JSON fields to an event via dotted paths, and broadcasts through the normal coverage-gated pipeline. Use ",f.jsx("span",{className:"text-accent",children:"Preview"})," to fetch a URL and read its structure before filling in the paths. Once saved, a custom source becomes a routable family —"," ",f.jsx("a",{href:"/notifications",className:"text-accent hover:underline",children:"enable its family in Notifications"})," ","to route it to a channel."]}),x&&V]}),l&&f.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:l}),c&&f.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:c}),e.length===0&&f.jsx("div",{className:"border border-border p-6 text-center text-sm text-[#666]",children:"No custom sources yet. Click “Add source” to wire up a public feed."}),f.jsx("div",{className:"space-y-4",children:e.map((U,F)=>{const Z=v[F],$=m[F];return f.jsxs("div",{className:"border border-border p-4 space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("input",{type:"text",value:U.name,onChange:W=>_(F,{name:W.target.value}),placeholder:"source name (unique id)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-sm font-medium text-[#e0e0e0]"}),f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[f.jsx("span",{className:"text-xs text-[#666]",children:"Enabled"}),f.jsx("button",{type:"button",onClick:()=>_(F,{enabled:!U.enabled}),className:`relative w-9 h-4 rounded-full transition-colors ${U.enabled?"bg-accent":"bg-[#333]"}`,children:f.jsx("span",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${U.enabled?"translate-x-5":""}`})})]}),f.jsx("button",{onClick:()=>S(F),title:"Delete source",className:"flex items-center gap-1 px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:f.jsx(po,{size:12})})]}),f.jsx(hx,{children:"Basics"}),f.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[f.jsx("div",{className:"col-span-12",children:f.jsx(Oa,{label:"URL",value:U.url,onChange:W=>_(F,{url:W}),placeholder:"https://example.com/api/feed.geojson",mono:!0})}),f.jsx("div",{className:"col-span-3",children:f.jsx(Oa,{label:"Poll seconds",type:"number",value:U.poll_seconds,onChange:W=>_(F,{poll_seconds:parseInt(W,10)||0})})}),f.jsx("div",{className:"col-span-3",children:f.jsx(Oa,{label:"Category",value:U.category,onChange:W=>_(F,{category:W}),placeholder:"generic_alert"})}),f.jsxs("div",{className:"col-span-3",children:[f.jsx("label",{className:"text-xs text-[#777] mb-1 block",children:"Severity"}),f.jsx("select",{value:U.severity,onChange:W=>_(F,{severity:W.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs text-[#e0e0e0]",children:bCe.map(W=>f.jsx("option",{value:W,children:W},W))})]}),f.jsx("div",{className:"col-span-3",children:f.jsx(Oa,{label:"Emoji",value:U.emoji??"",onChange:W=>_(F,{emoji:W}),placeholder:"⚡"})})]}),f.jsx(hx,{children:"Extraction"}),f.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[f.jsx(Oa,{label:"items_path (array of items)",value:U.items_path,onChange:W=>_(F,{items_path:W}),placeholder:"features · object.outages",mono:!0}),f.jsx(Oa,{label:"id_path (unique id, for dedup)",value:U.id_path,onChange:W=>_(F,{id_path:W}),placeholder:"id · omsOutageId · properties.id",mono:!0})]}),f.jsxs("div",{className:"border border-border p-3 space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Headers (optional)"}),f.jsxs("button",{onClick:()=>P(F),className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[f.jsx(Ti,{size:12})," Add header"]})]}),f.jsxs("p",{className:"text-xs text-[#555]",children:["Custom request headers, e.g. ",f.jsx("code",{children:"User-Agent"})," or"," ",f.jsx("code",{children:"Authorization"}),". Leave empty for the default browser UA."]}),Object.entries(U.headers??{}).length>0&&f.jsx("div",{className:"space-y-2",children:Object.entries(U.headers??{}).map(([W,q],re)=>f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"text",value:W,onChange:Q=>D(F,re,Q.target.value,q),placeholder:"header name (e.g. Authorization)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),f.jsx("span",{className:"text-[#555] text-xs",children:":"}),f.jsx("input",{type:"text",value:q,onChange:Q=>D(F,re,W,Q.target.value),placeholder:"value (e.g. Bearer …)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),f.jsx("button",{onClick:()=>z(F,re),title:"Remove header",className:"flex items-center px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:f.jsx(po,{size:12})})]},re))})]}),f.jsx(hx,{children:"Location — GeoJSON geometry OR lat + lon paths"}),f.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[f.jsx(Oa,{label:"geometry_path",value:U.geometry_path??"",onChange:W=>_(F,{geometry_path:W}),placeholder:"geometry",mono:!0}),f.jsx(Oa,{label:"lat_path",value:U.lat_path??"",onChange:W=>_(F,{lat_path:W}),placeholder:"properties.lat",mono:!0}),f.jsx(Oa,{label:"lon_path",value:U.lon_path??"",onChange:W=>_(F,{lon_path:W}),placeholder:"properties.lon",mono:!0})]}),f.jsx(hx,{children:"Display"}),f.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[f.jsx(Oa,{label:"title_path",value:U.title_path??"",onChange:W=>_(F,{title_path:W}),placeholder:"properties.headline",mono:!0}),f.jsx(Oa,{label:"time_path",value:U.time_path??"",onChange:W=>_(F,{time_path:W}),placeholder:"properties.updated",mono:!0}),f.jsx("div",{className:"col-span-2",children:f.jsx(Oa,{label:"summary_template — use {dest_key} tokens from your field mappings",value:U.summary_template??"",onChange:W=>_(F,{summary_template:W}),placeholder:"⚡ Power out — {customers} affected, ETA {eta}",mono:!0})})]}),f.jsxs("div",{className:"border border-border p-3 space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Field Mappings"}),f.jsxs("button",{onClick:()=>C(F),className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[f.jsx(Ti,{size:12})," Add mapping"]})]}),U.field_mappings.length===0?f.jsxs("p",{className:"text-xs text-[#555]",children:["No mappings. Each mapping pulls a dotted ",f.jsx("code",{children:"source_path"})," from an item into a ",f.jsx("code",{children:"dest_key"})," you can reference in the summary template."]}):f.jsx("div",{className:"space-y-2",children:U.field_mappings.map((W,q)=>f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"text",value:W.source_path,onChange:re=>M(F,q,{source_path:re.target.value}),placeholder:"source_path (e.g. properties.customers)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),f.jsx("span",{className:"text-[#555] text-xs",children:"→"}),f.jsx("input",{type:"text",value:W.dest_key,onChange:re=>M(F,q,{dest_key:re.target.value}),placeholder:"dest_key (e.g. customers)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),f.jsx("button",{onClick:()=>A(F,q),title:"Remove mapping",className:"flex items-center px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:f.jsx(po,{size:12})})]},q))})]}),f.jsxs("div",{className:"border border-border p-3 space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Preview"}),f.jsxs("button",{onClick:()=>E(F),disabled:!U.url||$,className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[$?f.jsx(jd,{size:12,className:"animate-spin"}):f.jsx(Cm,{size:12}),$?"Fetching…":"Preview"]})]}),Z&&f.jsxs("div",{className:"space-y-2",children:[Z.ok?f.jsxs("div",{className:"text-xs text-green-400",children:["HTTP ",Z.status??"200",typeof Z.item_count=="number"&&f.jsxs("span",{className:"text-[#999]",children:[" ","— items_path resolved ",Z.item_count," item",Z.item_count===1?"":"s"]})]}):f.jsx("div",{className:"text-xs text-red-400 break-words",children:Z.error}),Z.items_path_note&&f.jsx("div",{className:"text-xs text-amber-400 break-words",children:Z.items_path_note}),Z.first_item&&f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] uppercase tracking-widest text-[#555] mb-1",children:"First item"}),f.jsx("pre",{className:"bg-[#0d0d0d] border border-border p-2 text-[11px] font-mono text-[#bbb] overflow-auto max-h-48 whitespace-pre",children:Z.first_item})]}),Z.sample&&f.jsxs("details",{open:!Z.first_item,children:[f.jsx("summary",{className:"text-[10px] uppercase tracking-widest text-[#555] cursor-pointer",children:"Raw response"}),f.jsx("pre",{className:"mt-1 bg-[#0d0d0d] border border-border p-2 text-[11px] font-mono text-[#bbb] overflow-auto max-h-72 whitespace-pre",children:Z.sample})]})]})]})]},F)})}),f.jsxs("div",{className:"flex items-center justify-between gap-2 pb-2",children:[f.jsxs("button",{onClick:w,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[f.jsx(Ti,{size:14})," Add source"]}),x&&V]})]})}const SCe={enabled:!1,observers:[],tle_groups:["weather","stations"],norad_ids:[],min_elevation_deg:10,window_hours:24,tle_refresh_seconds:21600,broadcast_lead_seconds:3600,feed_source:"central"};function CCe({feed:e}){const t=e.is_loaded?e.consecutive_errors>0?"bg-amber-500":"bg-green-500":"bg-red-500",r=e.is_loaded?e.consecutive_errors>0?`${e.consecutive_errors} errors`:"Healthy":"Not loaded",n=e.last_fetch?new Date(e.last_fetch*1e3).toLocaleTimeString():"Never";return f.jsxs("div",{className:"bg-bg-hover p-4",children:[f.jsxs("div",{className:"flex items-center justify-between mb-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:`w-2 h-2 rounded-full ${t}`}),f.jsx("span",{className:"text-sm font-medium text-white uppercase",children:e.source})]}),f.jsx("span",{className:"text-xs text-[#777]",children:r})]}),f.jsxs("div",{className:"text-xs font-mono text-[#666] space-y-1",children:[f.jsxs("div",{children:["Events: ",e.event_count]}),f.jsxs("div",{children:["Last fetch: ",n]}),e.last_error&&f.jsx("div",{className:"text-accent truncate",children:e.last_error})]})]})}function TCe({event:e}){const t=e.severity.toLowerCase(),r=t==="extreme"||t==="severe"||t==="immediate"?{bg:"bg-red-500/10",border:"border-red-500",Icon:ah,color:"text-red-500"}:t==="moderate"||t==="warning"||t==="priority"?{bg:"bg-accent/10",border:"border-amber-500",Icon:Ao,color:"text-accent"}:{bg:"bg-sky-400/10",border:"border-sky-400",Icon:d1,color:"text-sky-400"},n=r.Icon;return f.jsx("div",{className:`p-3 ${r.bg} border-l-2 ${r.border}`,children:f.jsxs("div",{className:"flex items-start gap-3",children:[f.jsx(n,{size:16,className:r.color}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[f.jsx("span",{className:"text-sm font-medium text-white",children:e.event_type}),f.jsx("span",{className:`text-xs px-1.5 py-0.5 ${r.bg} ${r.color}`,children:e.severity})]}),f.jsx("div",{className:"text-sm font-sans text-[#e0e0e0]",children:e.headline})]})]})})}function T$({value:e,onChange:t,disabled:r,centralDisabled:n}){const a="px-2 py-1 text-xs transition-colors";return f.jsxs("div",{className:`flex border border-border overflow-hidden ${r?"opacity-40":""}`,children:[f.jsx("button",{type:"button",disabled:r,onClick:()=>t("native"),className:`${a} ${e==="native"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"native"}),f.jsx("button",{type:"button",disabled:r||n,title:n?"Central not available for this adapter":"",onClick:()=>{n||t("central")},className:`${a} ${n?"text-[#666] cursor-not-allowed":e==="central"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"central"})]})}function MCe({title:e,subtitle:t,enabled:r,onEnabled:n,feedSource:a,onFeedSource:i,hasCentral:o,nativeOnly:s,hasKey:l,health:u,events:c,children:h,llmContext:d,onLlmContext:v}){const g=s||!o;return f.jsxs("div",{className:"border border-border p-4 space-y-3",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:e}),t&&f.jsx("p",{className:"text-xs text-[#666]",children:t})]}),f.jsxs("div",{className:"flex items-center gap-4",children:[v!==void 0&&f.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",title:"Include this adapter's data in LLM (bot) context",children:[f.jsx("input",{type:"checkbox",checked:d??!0,onChange:m=>v(m.target.checked),className:"w-3.5 h-3.5 accent-[#f59e0b]"}),f.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"LLM"})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),f.jsx(T$,{value:a,onChange:i,disabled:!r,centralDisabled:g})]}),f.jsx(Bt,{label:"",checked:r,onChange:n})]})]}),!l&&f.jsx("div",{className:"text-xs text-accent bg-accent/10 p-2",children:"API key required — set it in the field below"}),s&&f.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available for this adapter — native only"}),f.jsx("div",{className:r?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:h}),(u||c&&c.length>0)&&f.jsxs("div",{className:"pt-2 border-t border-border space-y-3",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"Live status"}),u?f.jsx(CCe,{feed:u}):f.jsx("div",{className:"text-xs text-[#666]",children:"No status reported."}),c&&c.length>0&&f.jsx("div",{className:"space-y-2",children:c.slice(0,5).map((m,y)=>f.jsx(TCe,{event:m},y))})]})]})}const Hu={nws:{label:"NWS Weather Alerts",subtitle:"National Weather Service alerts",health:"nws",hasCentral:!0,nativeOnly:!1,hasKey:!0},fires:{label:"NIFC Fire Perimeters",subtitle:"Active wildfires (National Interagency Fire Center)",health:"nifc",hasCentral:!0,nativeOnly:!1,hasKey:!0},firms:{label:"NASA FIRMS Hotspots",subtitle:"Satellite thermal-anomaly detections",health:"firms",hasCentral:!0,nativeOnly:!1,hasKey:!1},swpc:{label:"NOAA Space Weather (SWPC)",subtitle:"Solar indices, geomagnetic storms",health:"swpc",hasCentral:!0,nativeOnly:!1,hasKey:!0},ducting:{label:"Tropospheric Ducting",subtitle:"VHF/UHF extended-range conditions",health:"ducting",hasCentral:!1,nativeOnly:!0,hasKey:!0},traffic:{label:"TomTom Traffic",subtitle:"Traffic flow on monitored corridors",health:"traffic",hasCentral:!0,nativeOnly:!1,hasKey:!0},roads511:{label:"511 Road Conditions",subtitle:"State DOT road events and closures",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!1},wzdx:{label:"WZDx Work Zones",subtitle:"Planned road work and construction events from ITD",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs_quake:{label:"USGS Earthquakes",subtitle:"Seismic events from the USGS feed",health:"usgs_quake",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs:{label:"USGS Stream Gauges",subtitle:"River and stream water levels",health:"usgs",hasCentral:!0,nativeOnly:!1,hasKey:!0},avalanche:{label:"Avalanche Advisories",subtitle:"Backcountry avalanche danger ratings",health:"avalanche",hasCentral:!0,nativeOnly:!1,hasKey:!0},satpass:{label:"Satellite Passes",subtitle:"Observer pass alerts via Central",health:"satpass",hasCentral:!0,nativeOnly:!1,hasKey:!0}},ACe={firms:"FIRMS_MAP_KEY",roads511:"ROADS511_API_KEY",traffic:"TOMTOM_API_KEY"},JT=[{key:"central",label:"Central",icon:vJ,adapters:[]},{key:"weather",label:"Weather",icon:ih,adapters:["nws"]},{key:"fire",label:"Fire",icon:Tm,adapters:["fires","firms"]},{key:"rf",label:"RF Propagation",icon:oi,adapters:["swpc","ducting"]},{key:"roads",label:"Roads",icon:h1,adapters:["traffic","roads511","wzdx"]},{key:"geohazards",label:"Geohazards",icon:sd,adapters:["usgs_quake","usgs","avalanche"]},{key:"tracking",label:"Tracking",icon:v1,adapters:["satpass"]},{key:"mesh",label:"Mesh Health",icon:Mo,adapters:[]},{key:"family_settings",label:"Family Settings",icon:_V,adapters:[]}];function NCe(){var yv,xv,Fs,Tt,qt,cu;const[e,t]=O.useState(null),[r,n]=O.useState(""),[a,i]=O.useState(null),[o,s]=O.useState([]),[l,u]=O.useState(!0),[c,h]=O.useState(!1),[d,v]=O.useState(null),[g,m]=O.useState(null),[y,x]=O.useState(!1),[_,w]=O.useState("weather"),[S,C]=O.useState("nws"),[M,A]=O.useState("curated"),[I,k]=O.useState({}),[P,D]=O.useState({}),[z,E]=O.useState({allowed_incident_types:["WF"],freshness_seconds:0,cooldown_seconds:28800,broadcast_on_acres:!0,broadcast_on_contained:!0}),[B,H]=O.useState(""),[V,U]=O.useState({digest_enabled:!0,digest_schedule:["06:00","18:00"],digest_timezone:"America/Boise"}),[F,Z]=O.useState(""),[$,W]=O.useState({min_magnitude:4,drop_non_present:!0,drop_zero_magnitude:!0}),[q,re]=O.useState(""),[Q,se]=O.useState({min_severity:"None",enabled_categories:["incident","closure"],enabled_sub_types:["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]}),[ce,Ue]=O.useState(""),[ye,me]=O.useState({broadcast:!1,min_severity:"Minor",sub_types:["road_works","lane_closed","road_closed"]}),[Oe,be]=O.useState(""),[we,yt]=O.useState({broadcast_severities:["Extreme","Severe"],duplicate_allowed_after_seconds:3600}),[nt,vt]=O.useState(""),[dt,Ft]=O.useState({min_danger_level:3}),[dr,Rr]=O.useState(""),[Xt,mn]=O.useState({geomag_kp_floor:7,flare_class_floor:"X1",proton_pfu_floor:10}),[Fi,lv]=O.useState(""),[Ot,Ho]=O.useState({enabled:!1,observers:[],min_elevation:30,norad_ids:[],max_broadcasts_per_hour:4,dry_run:!0}),[lu,uv]=O.useState(""),[Xm,qm]=O.useState(null),[cv,_h]=O.useState(null),[_w,Km]=O.useState(!1),[hv,Jm]=O.useState([]),[ca,Vi]=O.useState(null),[fv,Qm]=O.useState(""),[dv,vv]=O.useState(!1),[pv,ey]=O.useState(null),[ty,gv]=O.useState(null);O.useEffect(()=>{document.title="Environment — MeshAI",(async()=>{var ie,Je,kt,Be,lt,ci,In,er,J,je,Ye,Re,ut,fa,hi,Th,Vs,Mh,Ah,hu,Nh,kh,fu,_v,Lh,vy,st,da,Vt;try{const Gi=await(await fetch("/api/config/environmental")).json();Gi.satpass={...SCe,...Gi.satpass??{}},Gi.wzdx={states:["ID"],registry_url:"",...Gi.wzdx??{}},t(Gi),n(JSON.stringify(Gi));const Ia=Ct=>{const ct={};if(Array.isArray(Ct))for(const pt of Ct)ct[pt.key]={value:pt.value};return ct};try{const Ct=await fetch("/api/adapter-config/wfigs");if(Ct.ok){const ct=Ia(await Ct.json()),pt={allowed_incident_types:((ie=ct.allowed_incident_types)==null?void 0:ie.value)??["WF"],freshness_seconds:((Je=ct.freshness_seconds)==null?void 0:Je.value)??0,cooldown_seconds:((kt=ct.cooldown_seconds)==null?void 0:kt.value)??28800,broadcast_on_acres:((Be=ct.broadcast_on_acres)==null?void 0:Be.value)??!0,broadcast_on_contained:((lt=ct.broadcast_on_contained)==null?void 0:lt.value)??!0};E(pt),H(JSON.stringify(pt))}}catch{}try{const Ct=await fetch("/api/adapter-config/fires");if(Ct.ok){const ct=Ia(await Ct.json()),pt={digest_enabled:((ci=ct.digest_enabled)==null?void 0:ci.value)??!0,digest_schedule:((In=ct.digest_schedule)==null?void 0:In.value)??["06:00","18:00"],digest_timezone:((er=ct.digest_timezone)==null?void 0:er.value)??"America/Boise"};U(pt),Z(JSON.stringify(pt))}}catch{}try{const Ct=await fetch("/api/adapter-config/tomtom_incidents");if(Ct.ok){const ct=Ia(await Ct.json()),pt={min_magnitude:((J=ct.min_magnitude)==null?void 0:J.value)??4,drop_non_present:((je=ct.drop_non_present)==null?void 0:je.value)??!0,drop_zero_magnitude:((Ye=ct.drop_zero_magnitude)==null?void 0:Ye.value)??!0};W(pt),re(JSON.stringify(pt))}}catch{}try{const Ct=await fetch("/api/adapter-config/itd_511");if(Ct.ok){const ct=Ia(await Ct.json()),pt={min_severity:((Re=ct.min_severity)==null?void 0:Re.value)??"None",enabled_categories:((ut=ct.enabled_categories)==null?void 0:ut.value)??["incident","closure"],enabled_sub_types:((fa=ct.enabled_sub_types)==null?void 0:fa.value)??["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]};se(pt),Ue(JSON.stringify(pt))}}catch{}try{const Ct=await fetch("/api/adapter-config/wzdx");if(Ct.ok){const ct=Ia(await Ct.json()),pt={broadcast:((hi=ct.broadcast)==null?void 0:hi.value)??!1,min_severity:((Th=ct.min_severity)==null?void 0:Th.value)??"Minor",sub_types:((Vs=ct.sub_types)==null?void 0:Vs.value)??["road_works","lane_closed","road_closed"]};me(pt),be(JSON.stringify(pt))}}catch{}try{const Ct=await fetch("/api/adapter-config/nws");if(Ct.ok){const ct=Ia(await Ct.json()),pt={broadcast_severities:((Mh=ct.broadcast_severities)==null?void 0:Mh.value)??["Extreme","Severe"],duplicate_allowed_after_seconds:((Ah=ct.duplicate_allowed_after_seconds)==null?void 0:Ah.value)??3600};yt(pt),vt(JSON.stringify(pt))}}catch{}try{const Ct=await fetch("/api/adapter-config/avalanche");if(Ct.ok){const pt={min_danger_level:((hu=Ia(await Ct.json()).min_danger_level)==null?void 0:hu.value)??3};Ft(pt),Rr(JSON.stringify(pt))}}catch{}try{const Ct=await fetch("/api/adapter-config/swpc");if(Ct.ok){const ct=Ia(await Ct.json()),pt={geomag_kp_floor:((Nh=ct.geomag_kp_floor)==null?void 0:Nh.value)??7,flare_class_floor:((kh=ct.flare_class_floor)==null?void 0:kh.value)??"X1",proton_pfu_floor:((fu=ct.proton_pfu_floor)==null?void 0:fu.value)??10};mn(pt),lv(JSON.stringify(pt))}}catch{}try{const Ct=await fetch("/api/adapter-meta");if(Ct.ok){const ct=await Ct.json(),pt={};for(const[Hi,vr]of Object.entries(ct))pt[Hi]=vr.include_in_llm_context??!0;k(pt)}}catch{}try{const Ct=await fetch("/api/adapter-config/satpass");if(Ct.ok){const ct=await Ct.json(),pt={};for(const vr of ct)pt[vr.key]=vr;const Hi={enabled:((_v=pt.enabled)==null?void 0:_v.value)??!1,observers:((Lh=pt.observers)==null?void 0:Lh.value)??[],min_elevation:((vy=pt.min_elevation)==null?void 0:vy.value)??30,norad_ids:((st=pt.norad_ids)==null?void 0:st.value)??[],max_broadcasts_per_hour:((da=pt.max_broadcasts_per_hour)==null?void 0:da.value)??4,dry_run:((Vt=pt.dry_run)==null?void 0:Vt.value)??!0};Ho(Hi),uv(JSON.stringify(Hi))}}catch{}}catch(Ih){v(Ih instanceof Error?Ih.message:"Failed to load config")}finally{u(!1)}})()},[]),O.useEffect(()=>{(async()=>{try{const ie=await fetch("/api/config/notifications");if(ie.ok){const Je=await ie.json();Vi(Je),Qm(JSON.stringify(Je))}}catch{}})()},[]),O.useEffect(()=>{(async()=>{try{const ie=await fetch("/api/config/coverage");if(ie.ok){const Je=await ie.json();Km(!!Je.enabled),Jm(Array.isArray(Je.excluded_adapters)?Je.excluded_adapters:[])}}catch{}})()},[]),O.useEffect(()=>{(async()=>{try{const ie=await fetch("/api/secrets");if(ie.ok){const Je=await ie.json(),kt={};for(const Be of Je)kt[Be.env_var]=Be.is_set;D(kt)}}catch{}})()},[]),O.useEffect(()=>{const ie=async()=>{try{i(await RV()),s(await OV())}catch{}};ie();const Je=setInterval(ie,3e4);return()=>clearInterval(Je)},[]);const ry=e!==null&&JSON.stringify(e)!==r,ny=JSON.stringify(z)!==B,ay=JSON.stringify(V)!==F,bh=JSON.stringify($)!==q,iy=JSON.stringify(Q)!==ce,oy=JSON.stringify(ye)!==Oe,sy=JSON.stringify(we)!==nt,ly=JSON.stringify(dt)!==dr,ha=JSON.stringify(Xt)!==Fi,He=JSON.stringify(Ot)!==lu,uy=ry||ny||ay||bh||iy||oy||sy||ly||ha||He,Dt=async(ie,Je,kt)=>{const Be=await fetch(`/api/adapter-config/${ie}/${Je}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:kt})});if(!Be.ok){const lt=await Be.json().catch(()=>({}));throw new Error(lt.detail||`Failed to save ${ie}.${Je}`)}},cy=async(ie,Je)=>{k(kt=>({...kt,[ie]:Je}));try{await fetch(`/api/adapter-meta/${ie}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({include_in_llm_context:Je})})}catch{}},hy=async()=>{if(e){h(!0),v(null),m(null);try{if(ry){const ie=await fetch("/api/config/environmental",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),Je=await ie.json();if(!ie.ok)throw new Error(Je.detail||"Save failed");n(JSON.stringify(e)),Je.restart_required&&x(!0)}if(ny){const ie=JSON.parse(B);z.freshness_seconds!==ie.freshness_seconds&&await Dt("wfigs","freshness_seconds",z.freshness_seconds),JSON.stringify(z.allowed_incident_types)!==JSON.stringify(ie.allowed_incident_types)&&await Dt("wfigs","allowed_incident_types",z.allowed_incident_types),z.cooldown_seconds!==ie.cooldown_seconds&&await Dt("wfigs","cooldown_seconds",z.cooldown_seconds),z.broadcast_on_acres!==ie.broadcast_on_acres&&await Dt("wfigs","broadcast_on_acres",z.broadcast_on_acres),z.broadcast_on_contained!==ie.broadcast_on_contained&&await Dt("wfigs","broadcast_on_contained",z.broadcast_on_contained),H(JSON.stringify(z))}if(ay){const ie=JSON.parse(F);V.digest_enabled!==ie.digest_enabled&&await Dt("fires","digest_enabled",V.digest_enabled),JSON.stringify(V.digest_schedule)!==JSON.stringify(ie.digest_schedule)&&await Dt("fires","digest_schedule",V.digest_schedule),V.digest_timezone!==ie.digest_timezone&&await Dt("fires","digest_timezone",V.digest_timezone),Z(JSON.stringify(V))}if(bh){const ie=JSON.parse(q);$.min_magnitude!==ie.min_magnitude&&await Dt("tomtom_incidents","min_magnitude",$.min_magnitude),$.drop_non_present!==ie.drop_non_present&&await Dt("tomtom_incidents","drop_non_present",$.drop_non_present),$.drop_zero_magnitude!==ie.drop_zero_magnitude&&await Dt("tomtom_incidents","drop_zero_magnitude",$.drop_zero_magnitude),re(JSON.stringify($))}if(iy){const ie=JSON.parse(ce);Q.min_severity!==ie.min_severity&&await Dt("itd_511","min_severity",Q.min_severity),JSON.stringify(Q.enabled_categories)!==JSON.stringify(ie.enabled_categories)&&await Dt("itd_511","enabled_categories",Q.enabled_categories),JSON.stringify(Q.enabled_sub_types)!==JSON.stringify(ie.enabled_sub_types)&&await Dt("itd_511","enabled_sub_types",Q.enabled_sub_types),Ue(JSON.stringify(Q))}if(oy){const ie=JSON.parse(Oe);ye.broadcast!==ie.broadcast&&await Dt("wzdx","broadcast",ye.broadcast),ye.min_severity!==ie.min_severity&&await Dt("wzdx","min_severity",ye.min_severity),JSON.stringify(ye.sub_types)!==JSON.stringify(ie.sub_types)&&await Dt("wzdx","sub_types",ye.sub_types),be(JSON.stringify(ye))}if(sy){const ie=JSON.parse(nt);JSON.stringify(we.broadcast_severities)!==JSON.stringify(ie.broadcast_severities)&&await Dt("nws","broadcast_severities",we.broadcast_severities),we.duplicate_allowed_after_seconds!==ie.duplicate_allowed_after_seconds&&await Dt("nws","duplicate_allowed_after_seconds",we.duplicate_allowed_after_seconds),vt(JSON.stringify(we))}if(ly){const ie=JSON.parse(dr);dt.min_danger_level!==ie.min_danger_level&&await Dt("avalanche","min_danger_level",dt.min_danger_level),Rr(JSON.stringify(dt))}if(ha){const ie=JSON.parse(Fi);Xt.geomag_kp_floor!==ie.geomag_kp_floor&&await Dt("swpc","geomag_kp_floor",Xt.geomag_kp_floor),Xt.flare_class_floor!==ie.flare_class_floor&&await Dt("swpc","flare_class_floor",Xt.flare_class_floor),Xt.proton_pfu_floor!==ie.proton_pfu_floor&&await Dt("swpc","proton_pfu_floor",Xt.proton_pfu_floor),lv(JSON.stringify(Xt))}if(He){const ie=JSON.parse(lu);Ot.enabled!==ie.enabled&&await Dt("satpass","enabled",Ot.enabled),JSON.stringify(Ot.observers)!==JSON.stringify(ie.observers)&&await Dt("satpass","observers",Ot.observers),Ot.min_elevation!==ie.min_elevation&&await Dt("satpass","min_elevation",Ot.min_elevation),JSON.stringify(Ot.norad_ids)!==JSON.stringify(ie.norad_ids)&&await Dt("satpass","norad_ids",Ot.norad_ids),Ot.max_broadcasts_per_hour!==ie.max_broadcasts_per_hour&&await Dt("satpass","max_broadcasts_per_hour",Ot.max_broadcasts_per_hour),Ot.dry_run!==ie.dry_run&&await Dt("satpass","dry_run",Ot.dry_run),uv(JSON.stringify(Ot))}m("Config saved"),setTimeout(()=>m(null),3e3)}catch(ie){v(ie instanceof Error?ie.message:"Save failed")}finally{h(!1)}}},mv=()=>{e&&t(JSON.parse(r)),E(JSON.parse(B||JSON.stringify(z))),U(JSON.parse(F||JSON.stringify(V))),W(JSON.parse(q||JSON.stringify($))),se(JSON.parse(ce||JSON.stringify(Q))),me(JSON.parse(Oe||JSON.stringify(ye))),yt(JSON.parse(nt||JSON.stringify(we))),Ft(JSON.parse(dr||JSON.stringify(dt))),mn(JSON.parse(Fi||JSON.stringify(Xt))),Ho(JSON.parse(lu||JSON.stringify(Ot))),qm(null),_h(null)},fy=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{v("Restart failed")}},Ce=ie=>e&&t({...e,...ie}),$n=ie=>_w&&!hv.includes(ie),wh={nws:"nws",fires:"wfigs",firms:"firms",swpc:"swpc",ducting:"ducting",traffic:"tomtom_incidents",roads511:"itd_511",wzdx:"wzdx",usgs:"usgs",usgs_quake:"usgs_quake",avalanche:"avalanche",satpass:"satpass"},bw=(ca==null?void 0:ca.toggles)||{},ww=ca!==null&&JSON.stringify(ca)!==fv,uu=(ie,Je)=>{if(!ca)return;const kt=ca.toggles||{};Vi({...ca,toggles:{...kt,[ie]:{...kt[ie]||{},name:ie,...Je}}})},dy=async()=>{if(ca){vv(!0),ey(null),gv(null);try{const ie=await fetch("/api/config/notifications");if(!ie.ok)throw new Error("Failed to re-fetch notifications config");const Je=await ie.json(),kt={...Je,toggles:{...Je.toggles||{}}},Be=ca.toggles||{};for(const{key:In}of Yl){const er=Be[In];if(!er)continue;const J=(Je.toggles||{})[In]||{};kt.toggles[In]={...J,name:J.name||In,enabled:er.enabled,min_severity:er.min_severity,freshness_seconds:er.freshness_seconds??J.freshness_seconds??600,cooldown_seconds:er.cooldown_seconds??J.cooldown_seconds??0,regions:er.regions??J.regions??[]}}const lt=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(kt)}),ci=await lt.json();if(!lt.ok)throw new Error(ci.detail||"Save failed");Vi(kt),Qm(JSON.stringify(kt)),gv("Family settings saved"),setTimeout(()=>gv(null),3e3)}catch(ie){ey(ie instanceof Error?ie.message:"Save failed")}finally{vv(!1)}}},Sw=()=>{fv&&Vi(JSON.parse(fv))};if(l)return f.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading environmental config…"});if(!e)return f.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:d||"No config"});const Sh=ie=>a==null?void 0:a.feeds.find(Je=>Je.source===Hu[ie].health),Cw=ie=>o.filter(Je=>Je.source===Hu[ie].health),Tw=ie=>{const Je=ACe[ie];if(!Je)return!0;const kt=P[Je];return kt===void 0?!0:kt},zs=JT.find(ie=>ie.key===_),Ar=zs.adapters.length===0?null:S&&zs.adapters.includes(S)?S:zs.adapters[0],Mw=ie=>{var Je,kt,Be,lt,ci,In,er;switch(ie){case"nws":return f.jsxs(f.Fragment,{children:[$n("nws")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Geographic scope (zones, areas) is set by the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),'. Enable "Use own config" for NWS on that page to edit zones here.']}):f.jsxs(f.Fragment,{children:[f.jsx(En,{label:"NWS Zones",value:e.nws_zones,onChange:J=>Ce({nws_zones:J}),helper:"Zone IDs like IDZ016, IDZ030",infoLink:"https://www.weather.gov/pimar/PubZone"}),f.jsx(En,{label:"NWS Areas",value:e.nws.areas??[],onChange:J=>Ce({nws:{...e.nws,areas:J}}),helper:"State codes NWS pulls, e.g. ID"})]}),e.nws.feed_source!=="central"&&f.jsxs(f.Fragment,{children:[f.jsx(it,{label:"User Agent",value:e.nws.user_agent,onChange:J=>Ce({nws:{...e.nws,user_agent:J}}),placeholder:"(MeshAI, you@email.com)",helper:"Format: (app_name, contact_email)"}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Tick Seconds",value:e.nws.tick_seconds,onChange:J=>Ce({nws:{...e.nws,tick_seconds:J}}),min:30}),f.jsx(on,{label:"Min Severity",value:e.nws.severity_min,onChange:J=>Ce({nws:{...e.nws,severity_min:J}}),options:[{value:"minor",label:"Minor"},{value:"moderate",label:"Moderate"},{value:"severe",label:"Severe"},{value:"extreme",label:"Extreme"}]})]})]}),e.nws.feed_source==="central"&&f.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),f.jsxs("div",{className:"mb-3",children:[f.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Severities to broadcast"}),f.jsx("div",{className:"flex gap-6",children:["Extreme","Severe","Moderate","Minor"].map(J=>f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[f.jsx("input",{type:"checkbox",checked:we.broadcast_severities.includes(J),onChange:je=>{const Ye=we.broadcast_severities;yt({...we,broadcast_severities:je.target.checked?[...Ye,J]:Ye.filter(Re=>Re!==J)})},className:"w-4 h-4 accent-[#f59e0b]"}),f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:J})]},J))})]}),f.jsx(Se,{label:"Re-broadcast Cooldown (seconds)",value:we.duplicate_allowed_after_seconds,onChange:J=>yt({...we,duplicate_allowed_after_seconds:J}),min:0,helper:"Minimum seconds before the same alert ID can be re-broadcast"})]})]});case"swpc":return f.jsx("div",{className:"space-y-6",children:f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Thresholds"}),f.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[f.jsx(on,{label:"Geomag Kp Floor",value:String(Xt.geomag_kp_floor),onChange:J=>mn({...Xt,geomag_kp_floor:Number(J)}),options:[{value:"5",label:"5 — G1 Minor"},{value:"6",label:"6 — G2 Moderate"},{value:"7",label:"7 — G3 Strong"},{value:"8",label:"8 — G4 Severe"},{value:"9",label:"9 — G5 Extreme"}],helper:"Kp at or above this triggers geomag broadcast"}),f.jsx(on,{label:"Flare Class Floor",value:Xt.flare_class_floor,onChange:J=>mn({...Xt,flare_class_floor:J}),options:[{value:"M1",label:"M1 — R1 Minor"},{value:"M5",label:"M5 — R2 Moderate"},{value:"X1",label:"X1 — R3 Strong"},{value:"X10",label:"X10 — R4 Severe"}],helper:"X-ray flare class floor for broadcast"}),f.jsx(on,{label:"Proton pfu Floor",value:String(Xt.proton_pfu_floor),onChange:J=>mn({...Xt,proton_pfu_floor:Number(J)}),options:[{value:"10",label:"10 — S1 Minor"},{value:"100",label:"100 — S2 Moderate"},{value:"1000",label:"1000 — S3 Strong"},{value:"10000",label:"10000 — S4 Severe"}],helper:"Proton flux (pfu) at ≥10 MeV for broadcast"})]})]})});case"ducting":return f.jsxs("div",{className:"space-y-3",children:[f.jsx(Se,{label:"Tick Seconds",value:e.ducting.tick_seconds,onChange:J=>Ce({ducting:{...e.ducting,tick_seconds:J}}),min:60}),$n("ducting")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Lat/lon is set by the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Latitude",value:e.ducting.latitude,onChange:J=>Ce({ducting:{...e.ducting,latitude:J}}),step:.01}),f.jsx(Se,{label:"Longitude",value:e.ducting.longitude,onChange:J=>Ce({ducting:{...e.ducting,longitude:J}}),step:.01})]})]});case"fires":return f.jsxs("div",{className:"space-y-6",children:[e.fires.feed_source!=="central"&&f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Tick Seconds",value:e.fires.tick_seconds,onChange:J=>Ce({fires:{...e.fires,tick_seconds:J}}),min:60}),$n("fires")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50 self-end",children:["State scoped by"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):f.jsx(on,{label:"State",value:e.fires.state,onChange:J=>Ce({fires:{...e.fires,state:J}}),options:USe})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Incident Types"}),f.jsx("div",{className:"flex gap-6",children:[["WF","Wildfire"],["RX","Prescribed Burn"],["OTHER","Other"]].map(([J,je])=>{var Ye;return f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[f.jsx("input",{type:"checkbox",checked:((Ye=z.allowed_incident_types)==null?void 0:Ye.includes(J))??J==="WF",onChange:Re=>{const ut=z.allowed_incident_types??["WF"];E({...z,allowed_incident_types:Re.target.checked?[...ut,J]:ut.filter(fa=>fa!==J)})},className:"w-4 h-4 accent-[#f59e0b]"}),f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:je})]},J)})})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Triggers"}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("label",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on acres increase"}),f.jsx("input",{type:"checkbox",checked:z.broadcast_on_acres,onChange:J=>E({...z,broadcast_on_acres:J.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),f.jsxs("label",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on containment increase"}),f.jsx("input",{type:"checkbox",checked:z.broadcast_on_contained,onChange:J=>E({...z,broadcast_on_contained:J.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Update Cooldown (hours)",value:Math.round(z.cooldown_seconds/3600),onChange:J=>E({...z,cooldown_seconds:J*3600}),min:0,helper:"Minimum hours between updates for the same fire"}),f.jsx(Se,{label:"Freshness Window (hours)",value:Math.round(z.freshness_seconds/3600),onChange:J=>E({...z,freshness_seconds:J*3600}),min:0,helper:"0 = always broadcast regardless of event age"})]}),f.jsxs("div",{className:"border-t border-border pt-4 mt-2",children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Fire Digest"}),f.jsxs("label",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Enable daily digest"}),f.jsx("input",{type:"checkbox",checked:V.digest_enabled,onChange:J=>U({...V,digest_enabled:J.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),V.digest_enabled&&f.jsxs("div",{className:"mt-3 space-y-3",children:[f.jsx(En,{label:"Schedule (HH:MM)",value:V.digest_schedule,onChange:J=>U({...V,digest_schedule:J}),helper:"Digest times in HH:MM format, e.g. 06:00 and 18:00"}),f.jsx(on,{label:"Timezone",value:V.digest_timezone,onChange:J=>U({...V,digest_timezone:J}),options:[{value:"America/Boise",label:"Mountain — America/Boise"},{value:"America/Los_Angeles",label:"Pacific — America/Los_Angeles"},{value:"America/Denver",label:"Mountain — America/Denver"},{value:"America/Chicago",label:"Central — America/Chicago"},{value:"America/New_York",label:"Eastern — America/New_York"},{value:"UTC",label:"UTC"}]})]})]})]});case"avalanche":return f.jsxs("div",{className:"space-y-6",children:[e.avalanche.feed_source!=="central"&&f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Tick Seconds",value:e.avalanche.tick_seconds,onChange:J=>Ce({avalanche:{...e.avalanche,tick_seconds:J}}),min:60}),f.jsx(XT,{label:"Season Months",value:e.avalanche.season_months,onChange:J=>Ce({avalanche:{...e.avalanche,season_months:J}}),helper:"e.g., 12, 1, 2, 3, 4"})]}),$n("avalanche")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Avalanche center IDs are set by the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):f.jsx(En,{label:"Center IDs",value:e.avalanche.center_ids,onChange:J=>Ce({avalanche:{...e.avalanche,center_ids:J}}),helper:"e.g., SNFAC",infoLink:"https://avalanche.org/avalanche-centers/"}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),f.jsx("div",{className:"grid grid-cols-2 gap-4",children:f.jsx(on,{label:"Min Danger Level",value:String(dt.min_danger_level),onChange:J=>Ft({...dt,min_danger_level:Number(J)}),options:[{value:"3",label:"3 — Considerable"},{value:"4",label:"4 — High"},{value:"5",label:"5 — Extreme"}],helper:"Minimum avalanche danger level to broadcast"})})]})]});case"usgs":return f.jsxs(f.Fragment,{children:[f.jsx(Se,{label:"Tick Seconds",value:e.usgs.tick_seconds,onChange:J=>Ce({usgs:{...e.usgs,tick_seconds:J}}),min:900,helper:"Minimum 15 min (900s). tick_seconds is the native-mode poll interval; ignored when this adapter is set to feed_source=central."}),$n("usgs")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Gauge site IDs are set by the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):f.jsx(En,{label:"Site IDs",value:e.usgs.sites,onChange:J=>Ce({usgs:{...e.usgs,sites:J}}),helper:"USGS gauge site numbers",infoLink:"https://waterdata.usgs.gov/nwis"}),f.jsxs("div",{children:[f.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Flood Thresholds (advanced JSON)"}),f.jsx("textarea",{value:Xm??JSON.stringify(e.usgs.flood_thresholds??{},null,2),onChange:J=>{const je=J.target.value;qm(je);try{const Ye=JSON.parse(je);_h(null),Ce({usgs:{...e.usgs,flood_thresholds:Ye}})}catch(Ye){_h(Ye instanceof Error?Ye.message:"Invalid JSON")}},rows:6,spellCheck:!1,className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm font-mono"}),cv&&f.jsxs("p",{className:"text-xs text-red-400 mt-1",children:["Invalid JSON — not saved: ",cv]}),f.jsxs("p",{className:"text-xs text-[#666] mt-1",children:["Per-site flood levels, shape ","{",'"site_id": ',"{",' "flow": X, "height": Y ',"}","}"]})]})]});case"usgs_quake":return f.jsxs("div",{className:"space-y-6",children:[e.usgs_quake.feed_source!=="central"&&f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Tick Seconds",value:e.usgs_quake.tick_seconds,onChange:J=>Ce({usgs_quake:{...e.usgs_quake,tick_seconds:J}}),min:60}),f.jsx(it,{label:"Region Tag",value:e.usgs_quake.region,onChange:J=>Ce({usgs_quake:{...e.usgs_quake,region:J}})})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Native Feed"}),f.jsxs("div",{className:"space-y-3",children:[f.jsx(it,{label:"Quake Feed URL",value:e.usgs_quake.feed_url,onChange:J=>Ce({usgs_quake:{...e.usgs_quake,feed_url:J}})}),f.jsx("div",{className:"grid grid-cols-2 gap-4",children:f.jsx(Se,{label:"Min Magnitude",value:e.usgs_quake.min_magnitude??2.5,onChange:J=>Ce({usgs_quake:{...e.usgs_quake,min_magnitude:J}}),step:.1,min:0,helper:"Native quake magnitude floor"})}),$n("usgs_quake")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):f.jsx(XT,{label:"Bounding Box [W, S, E, N]",value:e.usgs_quake.bbox??[],onChange:J=>Ce({usgs_quake:{...e.usgs_quake,bbox:J}}),helper:"Four values: west, south, east, north"})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Magnitude Thresholds"}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Se,{label:"Global Floor",value:e.usgs_quake.global_mag_floor,onChange:J=>Ce({usgs_quake:{...e.usgs_quake,global_mag_floor:J}}),step:.1,min:0,helper:"Broadcast anywhere at or above this magnitude"}),f.jsx(Se,{label:"Regional Floor",value:e.usgs_quake.regional_mag_floor,onChange:J=>Ce({usgs_quake:{...e.usgs_quake,regional_mag_floor:J}}),step:.1,min:0,helper:"Reduced floor within regional radius"}),f.jsx(Se,{label:"Regional Radius (mi)",value:e.usgs_quake.regional_radius_mi,onChange:J=>Ce({usgs_quake:{...e.usgs_quake,regional_radius_mi:J}}),min:50,helper:"Radius around region centroid for reduced floor"}),f.jsx(Se,{label:"Escalation Floor",value:e.usgs_quake.escalate_mag_floor,onChange:J=>Ce({usgs_quake:{...e.usgs_quake,escalate_mag_floor:J}}),step:.1,min:0,helper:"Magnitude at which broadcast uses warning emoji"})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"PAGER Alert Levels"}),f.jsx("div",{className:"text-xs text-[#666] mb-2",children:"Broadcast at any magnitude when USGS PAGER alert reaches these levels"}),f.jsx("div",{className:"flex gap-6",children:["green","yellow","orange","red"].map(J=>f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[f.jsx("input",{type:"checkbox",checked:(e.usgs_quake.broadcast_pager_alerts??[]).includes(J),onChange:je=>{const Ye=e.usgs_quake.broadcast_pager_alerts??[];Ce({usgs_quake:{...e.usgs_quake,broadcast_pager_alerts:je.target.checked?[...Ye,J]:Ye.filter(Re=>Re!==J)}})},className:"w-4 h-4 accent-[#f59e0b]"}),f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0] capitalize",children:J})]},J))})]})]});case"traffic":return f.jsxs(f.Fragment,{children:[f.jsx(Ep,{envVar:"TOMTOM_API_KEY",label:"API Key",helper:"developer.tomtom.com"}),f.jsx(Se,{label:"Tick Seconds",value:e.traffic.tick_seconds,onChange:J=>Ce({traffic:{...e.traffic,tick_seconds:J}}),min:60}),$n("traffic")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Traffic corridors are set by the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"text-xs text-[#666] mt-2",children:"Corridors:"}),(e.traffic.corridors||[]).map((J,je)=>f.jsxs("div",{className:"grid grid-cols-4 gap-2 items-end",children:[f.jsx(it,{label:"Name",value:J.name,onChange:Ye=>{const Re=[...e.traffic.corridors];Re[je]={...J,name:Ye},Ce({traffic:{...e.traffic,corridors:Re}})}}),f.jsx(Se,{label:"Lat",value:J.lat,onChange:Ye=>{const Re=[...e.traffic.corridors];Re[je]={...J,lat:Ye},Ce({traffic:{...e.traffic,corridors:Re}})},step:.01}),f.jsx(Se,{label:"Lon",value:J.lon,onChange:Ye=>{const Re=[...e.traffic.corridors];Re[je]={...J,lon:Ye},Ce({traffic:{...e.traffic,corridors:Re}})},step:.01}),f.jsx("button",{onClick:()=>Ce({traffic:{...e.traffic,corridors:e.traffic.corridors.filter((Ye,Re)=>Re!==je)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},je)),f.jsx("button",{onClick:()=>Ce({traffic:{...e.traffic,corridors:[...e.traffic.corridors||[],{name:"",lat:0,lon:0}]}}),className:"text-xs text-accent hover:underline",children:"+ Add Corridor"})]}),f.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),f.jsx("div",{className:"grid grid-cols-2 gap-4",children:f.jsxs("div",{children:[f.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Magnitude"}),f.jsxs("select",{value:$.min_magnitude,onChange:J=>W({...$,min_magnitude:parseInt(J.target.value)}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[f.jsx("option",{value:1,children:"1 — Minor (all)"}),f.jsx("option",{value:2,children:"2 — Moderate (yellow+)"}),f.jsx("option",{value:3,children:"3 — Major (orange+)"}),f.jsx("option",{value:4,children:"4 — Severe (red only)"})]}),f.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop TomTom incidents below this severity level"})]})}),f.jsxs("div",{className:"mt-3 space-y-2",children:[f.jsxs("label",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop non-present time validity"}),f.jsx("input",{type:"checkbox",checked:$.drop_non_present,onChange:J=>W({...$,drop_non_present:J.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),f.jsxs("label",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop zero-magnitude events"}),f.jsx("input",{type:"checkbox",checked:$.drop_zero_magnitude,onChange:J=>W({...$,drop_zero_magnitude:J.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]})]});case"roads511":return f.jsxs(f.Fragment,{children:[f.jsx(it,{label:"Base URL",value:e.roads511.base_url,onChange:J=>Ce({roads511:{...e.roads511,base_url:J}}),placeholder:"https://511.yourstate.gov/api/v2"}),f.jsx(Ep,{envVar:"ROADS511_API_KEY",label:"API Key",helper:"Leave unset if 511 needs no key"}),f.jsx(Se,{label:"Tick Seconds",value:e.roads511.tick_seconds,onChange:J=>Ce({roads511:{...e.roads511,tick_seconds:J}}),min:60}),f.jsx(En,{label:"Endpoints",value:e.roads511.endpoints,onChange:J=>Ce({roads511:{...e.roads511,endpoints:J}}),helper:"e.g., /get/event"}),$n("roads511")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):f.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((J,je)=>{var Ye;return f.jsx(Se,{label:J,value:((Ye=e.roads511.bbox)==null?void 0:Ye[je])??0,onChange:Re=>{const ut=[...e.roads511.bbox||[0,0,0,0]];ut[je]=Re,Ce({roads511:{...e.roads511,bbox:ut}})},step:.01},J)})}),f.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),f.jsx("div",{className:"grid grid-cols-2 gap-4",children:f.jsxs("div",{children:[f.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Severity"}),f.jsxs("select",{value:Q.min_severity,onChange:J=>se({...Q,min_severity:J.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[f.jsx("option",{value:"None",children:"None (all)"}),f.jsx("option",{value:"Minor",children:"Minor+"}),f.jsx("option",{value:"Major",children:"Major only"})]}),f.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop ITD 511 events below this severity"})]})}),f.jsxs("div",{className:"mt-4",children:[f.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Categories"}),f.jsx("div",{className:"flex gap-6",children:[["incident","Incident"],["closure","Closure"],["special_event","Special Event"]].map(([J,je])=>f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[f.jsx("input",{type:"checkbox",checked:Q.enabled_categories.includes(J),onChange:Ye=>{const Re=Q.enabled_categories;se({...Q,enabled_categories:Ye.target.checked?[...Re,J]:Re.filter(ut=>ut!==J)})},className:"w-4 h-4 accent-[#f59e0b]"}),f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:je})]},J))})]}),f.jsxs("div",{className:"mt-4",children:[f.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),f.jsx("div",{className:"grid grid-cols-2 gap-2",children:[["accident","Crash"],["road_closed","Road Closed"],["lane_closed","Lane Closure"],["vehicle_on_fire","Vehicle Fire"],["flooding","Flooding"],["debris","Debris"],["road_works","Road Works"],["disabled_vehicle","Disabled Vehicle"]].map(([J,je])=>f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[f.jsx("input",{type:"checkbox",checked:Q.enabled_sub_types.includes(J),onChange:Ye=>{const Re=Q.enabled_sub_types;se({...Q,enabled_sub_types:Ye.target.checked?[...Re,J]:Re.filter(ut=>ut!==J)})},className:"w-4 h-4 accent-[#f59e0b]"}),f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:je})]},J))})]})]})]});case"wzdx":return f.jsxs(f.Fragment,{children:[((Je=e.wzdx)==null?void 0:Je.feed_source)!=="central"&&f.jsxs(f.Fragment,{children:[f.jsx(it,{label:"Base URL",value:((kt=e.wzdx)==null?void 0:kt.base_url)??"",onChange:J=>Ce({wzdx:{...e.wzdx,base_url:J}}),placeholder:"https://511.yourstate.gov/api/v2"}),f.jsx(Ep,{envVar:"WZDX_API_KEY",label:"API Key",helper:"Leave unset if not required"}),f.jsx(Se,{label:"Tick Seconds",value:((Be=e.wzdx)==null?void 0:Be.tick_seconds)??300,onChange:J=>Ce({wzdx:{...e.wzdx,tick_seconds:J}}),min:60}),f.jsx(En,{label:"Endpoints",value:((lt=e.wzdx)==null?void 0:lt.endpoints)??["/get/event"],onChange:J=>Ce({wzdx:{...e.wzdx,endpoints:J}}),helper:"e.g., /get/event"}),$n("wzdx")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box and states are set by the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((J,je)=>{var Ye,Re;return f.jsx(Se,{label:J,value:((Re=(Ye=e.wzdx)==null?void 0:Ye.bbox)==null?void 0:Re[je])??0,onChange:ut=>{var hi;const fa=[...((hi=e.wzdx)==null?void 0:hi.bbox)||[0,0,0,0]];fa[je]=ut,Ce({wzdx:{...e.wzdx,bbox:fa}})},step:.01},J)})}),f.jsx("div",{className:"text-xs text-[#666]",children:"Bounding box [W,S,E,N] geographic filter"}),f.jsx(En,{label:"States",value:((ci=e.wzdx)==null?void 0:ci.states)??[],onChange:J=>Ce({wzdx:{...e.wzdx,states:J}}),helper:"2-letter state codes to include from the WZDx Feed Registry, e.g. ID, OR"})]}),f.jsx(it,{label:"Registry URL",value:((In=e.wzdx)==null?void 0:In.registry_url)??"",onChange:J=>Ce({wzdx:{...e.wzdx,registry_url:J}}),placeholder:"https://datahub.transportation.gov/resource/69qe-yiui.json?$limit=200",helper:"FHWA WZDx Feed Registry (Socrata) URL — lists every state DOT feed"}),f.jsx(Se,{label:"Registry TTL (sec)",value:((er=e.wzdx)==null?void 0:er.registry_ttl)??21600,onChange:J=>Ce({wzdx:{...e.wzdx,registry_ttl:J}}),min:0,helper:"How often to re-fetch the WZDx registry (default 21600 = 6h)"})]}),f.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),f.jsxs("label",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast work zone events"}),f.jsx("input",{type:"checkbox",checked:ye.broadcast,onChange:J=>me({...ye,broadcast:J.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),ye.broadcast?f.jsxs("div",{className:"space-y-3 mt-3",children:[f.jsxs("div",{children:[f.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Min Severity"}),f.jsxs("select",{value:ye.min_severity,onChange:J=>me({...ye,min_severity:J.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[f.jsx("option",{value:"None",children:"None (all)"}),f.jsx("option",{value:"Minor",children:"Minor+"}),f.jsx("option",{value:"Major",children:"Major only"})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),f.jsx("div",{className:"flex gap-6",children:[["road_works","Road Works"],["lane_closed","Lane Closure"],["road_closed","Road Closed"]].map(([J,je])=>f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[f.jsx("input",{type:"checkbox",checked:ye.sub_types.includes(J),onChange:Ye=>{const Re=ye.sub_types;me({...ye,sub_types:Ye.target.checked?[...Re,J]:Re.filter(ut=>ut!==J)})},className:"w-4 h-4 accent-[#f59e0b]"}),f.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:je})]},J))})]})]}):f.jsxs("p",{className:"text-xs text-[#666] mt-2",children:["Work zone events stored for LLM context only ","—"," no mesh broadcasts."]})]})]});case"firms":return f.jsxs(f.Fragment,{children:[f.jsx(Ep,{envVar:"FIRMS_MAP_KEY",label:"MAP Key",helper:"NASA FIRMS MAP_KEY"}),f.jsx(Se,{label:"Tick Seconds",value:e.firms.tick_seconds,onChange:J=>Ce({firms:{...e.firms,tick_seconds:J}}),min:300}),f.jsx(on,{label:"Satellite Source",value:e.firms.source,onChange:J=>Ce({firms:{...e.firms,source:J}}),options:[{value:"VIIRS_SNPP_NRT",label:"VIIRS SNPP (NRT)"},{value:"VIIRS_NOAA20_NRT",label:"VIIRS NOAA-20 (NRT)"},{value:"MODIS_NRT",label:"MODIS (NRT)"}]}),f.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[f.jsx(Se,{label:"Day Range",value:e.firms.day_range,onChange:J=>Ce({firms:{...e.firms,day_range:J}}),min:1,max:10}),f.jsx(on,{label:"Min Confidence",value:e.firms.confidence_min,onChange:J=>Ce({firms:{...e.firms,confidence_min:J}}),options:[{value:"low",label:"Low"},{value:"nominal",label:"Nominal"},{value:"high",label:"High"}]}),f.jsx(Se,{label:"Proximity (km)",value:e.firms.proximity_km,onChange:J=>Ce({firms:{...e.firms,proximity_km:J}}),step:.5})]}),$n("firms")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):f.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((J,je)=>{var Ye;return f.jsx(Se,{label:J,value:((Ye=e.firms.bbox)==null?void 0:Ye[je])??0,onChange:Re=>{const ut=[...e.firms.bbox||[0,0,0,0]];ut[je]=Re,Ce({firms:{...e.firms,bbox:ut}})},step:.01},J)})})]});case"satpass":{const J=e.satpass.enabled?Ot.dry_run?{label:"DRY RUN",color:"text-sky-400 bg-sky-400/10 border border-sky-400/30",desc:" — logging only, nothing transmits"}:{label:"⚠ LIVE",color:"text-amber-400 bg-amber-500/20 border-2 border-amber-500 font-bold animate-pulse",desc:" — transmitting to mesh"}:{label:"OFF",color:"text-[#777] bg-[#1a1a1a]",desc:""};return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:`px-4 py-2.5 text-sm rounded ${J.color}`,children:[f.jsx("span",{className:"font-semibold",children:J.label}),J.desc&&f.jsx("span",{className:"font-normal",children:J.desc})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Safety Controls"}),f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-sm text-[#e0e0e0]",children:"Dry run — log instead of transmit"}),f.jsx("p",{className:"text-xs text-[#666]",children:"When enabled, passes are logged but never broadcast to mesh"})]}),f.jsx("button",{onClick:()=>Ho({...Ot,dry_run:!Ot.dry_run}),className:`relative w-10 h-5 rounded-full transition-colors ${Ot.dry_run?"bg-sky-500":"bg-[#333]"}`,children:f.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${Ot.dry_run?"translate-x-5":""}`})})]}),f.jsx(Se,{label:"Max broadcasts / hour",value:Ot.max_broadcasts_per_hour,onChange:je=>Ho({...Ot,max_broadcasts_per_hour:je}),min:1,max:60,helper:"Rate cap — broadcasts exceeding this limit are dropped"})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Pass Filters"}),f.jsx("div",{className:"grid grid-cols-2 gap-4",children:f.jsx(Se,{label:"Min Elevation (deg)",value:Ot.min_elevation,onChange:je=>Ho({...Ot,min_elevation:je}),min:0,max:90,helper:"Minimum max elevation for a pass to be broadcast"})})]}),f.jsx(En,{label:"Observer Locations",value:Ot.observers,onChange:je=>Ho({...Ot,observers:je}),helper:"Observer names to include (empty = all)"}),f.jsx(En,{label:"NORAD IDs",value:Ot.norad_ids,onChange:je=>Ho({...Ot,norad_ids:je}),helper:"NORAD catalog IDs to broadcast (empty = broadcast nothing, opt-in only)"}),f.jsxs("div",{className:"border-t border-border pt-4 mt-2 space-y-6",children:[f.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Native satpass (SGP4) — no Central required"}),f.jsxs("div",{children:[f.jsx("div",{className:"text-xs text-[#777] mb-2",children:"Observers (ground stations the predictor computes passes for)"}),$n("satpass")?f.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Observer locations are set by the"," ",f.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"space-y-2",children:(e.satpass.observers||[]).map((je,Ye)=>f.jsxs("div",{className:"grid grid-cols-6 gap-2 items-end",children:[f.jsx(it,{label:"Slug",value:je.slug,onChange:Re=>{const ut=[...e.satpass.observers];ut[Ye]={...je,slug:Re},Ce({satpass:{...e.satpass,observers:ut}})},placeholder:"tvly"}),f.jsx(it,{label:"Name",value:je.name,onChange:Re=>{const ut=[...e.satpass.observers];ut[Ye]={...je,name:Re},Ce({satpass:{...e.satpass,observers:ut}})},placeholder:"Treasure Valley"}),f.jsx(Se,{label:"Lat",value:je.lat,onChange:Re=>{const ut=[...e.satpass.observers];ut[Ye]={...je,lat:Re},Ce({satpass:{...e.satpass,observers:ut}})},step:1e-4}),f.jsx(Se,{label:"Lon",value:je.lon,onChange:Re=>{const ut=[...e.satpass.observers];ut[Ye]={...je,lon:Re},Ce({satpass:{...e.satpass,observers:ut}})},step:1e-4}),f.jsx(Se,{label:"Alt (m)",value:je.alt_m,onChange:Re=>{const ut=[...e.satpass.observers];ut[Ye]={...je,alt_m:Re},Ce({satpass:{...e.satpass,observers:ut}})},step:1}),f.jsx("button",{onClick:()=>Ce({satpass:{...e.satpass,observers:e.satpass.observers.filter((Re,ut)=>ut!==Ye)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},Ye))}),f.jsx("button",{onClick:()=>Ce({satpass:{...e.satpass,observers:[...e.satpass.observers||[],{slug:"",name:"",lat:0,lon:0,alt_m:0}]}}),className:"text-xs text-accent hover:underline mt-2",children:"+ Add Observer"})]})]}),f.jsx(En,{label:"TLE Groups",value:e.satpass.tle_groups,onChange:je=>Ce({satpass:{...e.satpass,tle_groups:je}}),helper:"Celestrak GP group selectors, e.g. weather, stations, amateur",infoLink:"https://celestrak.org/NORAD/elements/"}),f.jsx(XT,{label:"NORAD IDs (native)",value:e.satpass.norad_ids,onChange:je=>Ce({satpass:{...e.satpass,norad_ids:je}}),helper:"Specific NORAD catalog IDs to also fetch/predict, e.g. 25544, 33591"}),f.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[f.jsx(Se,{label:"Min Elevation (deg)",value:e.satpass.min_elevation_deg,onChange:je=>Ce({satpass:{...e.satpass,min_elevation_deg:je}}),min:0,max:90,helper:"Native SGP4 pass filter (separate from Central min elevation above)"}),f.jsx(Se,{label:"Window (hours)",value:e.satpass.window_hours,onChange:je=>Ce({satpass:{...e.satpass,window_hours:je}}),min:1,max:168,helper:"Hours ahead to predict passes"}),f.jsx(Se,{label:"TLE Refresh (sec)",value:e.satpass.tle_refresh_seconds,onChange:je=>Ce({satpass:{...e.satpass,tle_refresh_seconds:je}}),min:3600,helper:"How often to re-fetch TLEs (default 21600 = 6h)"}),f.jsx(Se,{label:"Broadcast Lead (sec)",value:e.satpass.broadcast_lead_seconds??3600,onChange:je=>Ce({satpass:{...e.satpass,broadcast_lead_seconds:je}}),min:0,helper:"How far ahead of a pass to announce"})]})]})]})}}},Ch=e,Bs=(ie,Je)=>{const kt=e[ie]||{};Ce({[ie]:{...kt,...Je}})};return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("h1",{className:"text-xl font-semibold text-white",children:"Data Feeds"}),f.jsx("div",{className:"flex items-center gap-3",children:M==="curated"&&f.jsxs(f.Fragment,{children:[f.jsx(Bt,{label:"Feeds Enabled",checked:e.enabled,onChange:ie=>Ce({enabled:ie})}),uy&&f.jsxs(f.Fragment,{children:[f.jsxs("button",{onClick:mv,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[f.jsx(oa,{size:14})," Discard"]}),f.jsxs("button",{onClick:hy,disabled:c,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[f.jsx(sa,{size:14})," ",c?"Saving…":"Save"]})]})]})})]}),d&&f.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:d}),g&&f.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:g}),y&&f.jsxs("div",{className:"flex items-center justify-between text-sm text-accent bg-accent/10 border border-accent/30 p-3",children:[f.jsxs("span",{className:"flex items-center gap-2",children:[f.jsx(zo,{size:14})," A restart is required for some changes to take effect."]}),f.jsx("button",{onClick:fy,className:"px-3 py-1 bg-accent/20 hover:bg-amber-500/30",children:"Restart now"})]}),f.jsxs("div",{className:"flex gap-1 border-b border-border",children:[f.jsxs("button",{onClick:()=>A("curated"),className:`flex items-center gap-2 px-4 py-2 text-sm border-b-2 -mb-px transition-colors ${M==="curated"?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[f.jsx(ih,{size:15})," Data Feeds"]}),f.jsxs("button",{onClick:()=>A("advanced"),className:`flex items-center gap-2 px-4 py-2 text-sm border-b-2 -mb-px transition-colors ${M==="advanced"?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[f.jsx(Ag,{size:15})," Advanced (raw)"]})]}),M==="advanced"&&f.jsxs("div",{className:"-mx-6",children:[f.jsx("div",{className:"px-6 pb-2 text-xs text-[#777]",children:"Curated keys (owned by the Data Feeds panels above) are hidden here. Future or unknown keys from adapters will appear in this view."}),f.jsx(S$,{excludeKeys:mCe,hideLlmToggle:!0})]}),M==="curated"&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:JT.map(({key:ie,label:Je,icon:kt})=>f.jsxs("button",{onClick:()=>{w(ie);const Be=JT.find(lt=>lt.key===ie);C(Be.adapters[0]??null)},className:`flex items-center gap-2 px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${_===ie?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[f.jsx(kt,{size:15})," ",Je]},ie))}),_==="central"&&e.central&&f.jsxs("div",{className:"border border-border p-4 space-y-3",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Central Connection"}),f.jsx("p",{className:"text-xs text-[#666]",children:'NATS JetStream source for any adapter set to "central"'})]}),f.jsx(Bt,{label:"",checked:!!e.central.enabled,onChange:ie=>Ce({central:{...e.central,enabled:ie}})})]}),f.jsxs("div",{className:e.central.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[f.jsx(it,{label:"URL",value:e.central.url||"",onChange:ie=>Ce({central:{...e.central,url:ie}}),placeholder:"nats://central.echo6.mesh:4222"}),f.jsx(it,{label:"Durable",value:e.central.durable||"",onChange:ie=>Ce({central:{...e.central,durable:ie}}),placeholder:"meshai-v04"}),f.jsx(Se,{label:"Connect Timeout (sec)",value:e.central.connect_timeout??10,onChange:ie=>Ce({central:{...e.central,connect_timeout:ie}}),step:.5,min:0,helper:"NATS connect timeout for the Central consumer"}),f.jsx(it,{label:"Region",value:e.central.region||"",onChange:ie=>Ce({central:{...e.central,region:ie}}),placeholder:"us.id",helper:"Central v0.9.20 region token (dotted, e.g. 'us.id'). Empty = bare wildcards (all-US firehose). Each adapter is either Central or native, never both — see Reference → OR-not-AND Architecture for why."})]})]}),_==="mesh"&&f.jsxs("div",{className:"border border-border p-4 space-y-3",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Mesh Health"}),f.jsx("p",{className:"text-xs text-[#666]",children:"Node/infra telemetry — sourced from the mesh, not an environmental feed."})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),f.jsx(T$,{value:"native",onChange:()=>{},disabled:!1,centralDisabled:!0})]})]}),f.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available — reserved for a future migration."})]}),_==="family_settings"&&f.jsxs("div",{className:"space-y-4",children:[f.jsxs("p",{className:"text-xs text-[#777]",children:["Per-family gating: enable/disable each notification family, set its minimum severity threshold, freshness window, and cooldown. Delivery routing (which mesh channels, email, webhook) is configured on the ",f.jsx("a",{href:"/notifications",className:"text-accent hover:underline",children:"Meshtastic Routing"})," and"," ",f.jsx("a",{href:"/meshcore/routing",className:"text-accent hover:underline",children:"MeshCore Routing"})," pages."]}),pv&&f.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:pv}),ty&&f.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:ty}),ca===null?f.jsx("div",{className:"text-xs text-[#666] italic",children:"Loading family settings…"}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Yl.map(({key:ie,label:Je,Icon:kt})=>{const Be=bw[ie]||{};return f.jsxs("div",{className:"border border-border p-3 space-y-3",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#e0e0e0]",children:[f.jsx(kt,{size:15})," ",Je]}),f.jsx(Bt,{label:"",checked:!!Be.enabled,onChange:lt=>uu(ie,{enabled:lt})})]}),f.jsxs("div",{className:Be.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[f.jsx(on,{label:"Min Severity",value:Be.min_severity||"priority",onChange:lt=>uu(ie,{min_severity:lt}),options:[{value:"routine",label:"Routine — informational"},{value:"priority",label:"Priority — needs attention"},{value:"immediate",label:"Immediate — act now"}]}),f.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[f.jsx(Se,{label:"Freshness (sec)",value:Be.freshness_seconds??600,onChange:lt=>uu(ie,{freshness_seconds:lt}),min:0,helper:"Drop events older than this"}),f.jsx(Se,{label:"Cooldown (sec)",value:Be.cooldown_seconds??0,onChange:lt=>uu(ie,{cooldown_seconds:lt}),min:0,helper:"0 = no throttle"})]}),f.jsx(En,{label:"Regions",value:Be.regions??[],onChange:lt=>uu(ie,{regions:lt}),helper:"Empty = all regions; otherwise only these region names"})]})]},ie)})}),ww&&f.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[f.jsxs("button",{onClick:Sw,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[f.jsx(oa,{size:14})," Discard"]}),f.jsxs("button",{onClick:dy,disabled:dv,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[f.jsx(sa,{size:14})," ",dv?"Saving…":"Save"]})]})]})]}),zs.adapters.length>0&&Ar&&f.jsxs(f.Fragment,{children:[zs.adapters.length>1&&f.jsx("div",{className:"flex gap-1",children:zs.adapters.map(ie=>f.jsx("button",{onClick:()=>C(ie),className:`px-3 py-1.5 text-sm ${Ar===ie?"bg-bg-hover text-white":"text-[#777] hover:text-white"}`,children:Hu[ie].label},ie))}),f.jsx(MCe,{title:Hu[Ar].label,subtitle:Hu[Ar].subtitle,enabled:((yv=Ch[Ar])==null?void 0:yv.enabled)??!1,onEnabled:ie=>Bs(Ar,{enabled:ie}),feedSource:((xv=Ch[Ar])==null?void 0:xv.feed_source)??"native",onFeedSource:ie=>Bs(Ar,{feed_source:ie}),hasCentral:Hu[Ar].hasCentral,nativeOnly:Hu[Ar].nativeOnly,hasKey:Tw(Ar),health:Sh(Ar),events:Cw(Ar),llmContext:wh[Ar]!==void 0?I[wh[Ar]]??!0:void 0,onLlmContext:wh[Ar]!==void 0?ie=>cy(wh[Ar],ie):void 0,children:Mw(Ar)})]}),f.jsxs("div",{className:"pt-4 mt-2 border-t border-border space-y-4",children:[f.jsxs("div",{children:[f.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[f.jsx(Ag,{size:16})," Custom Sources"]}),f.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Point MeshAI at any public REST/GeoJSON feed; it becomes a routable family in Notifications — sitting alongside the built-in feeds above."})]}),f.jsx(wCe,{})]}),f.jsxs("details",{className:"group border border-border p-4",children:[f.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm font-medium text-[#e0e0e0] hover:text-white",children:[f.jsx(nh,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced: Geocoder"]}),f.jsx("p",{className:"mt-2 text-xs text-[#666]",children:"Configures the Photon reverse-geocoder used to resolve place names."}),f.jsxs("div",{className:"mt-4 space-y-3 pl-6 border-l border-border",children:[f.jsx(it,{label:"Geocoder URL",value:((Fs=e.geocoder)==null?void 0:Fs.url)??"https://photon.komoot.io",onChange:ie=>Ce({geocoder:{...e.geocoder,url:ie}}),placeholder:"https://photon.komoot.io",helper:"Photon geocoding endpoint"}),f.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[f.jsx(Se,{label:"Timeout (s)",value:((Tt=e.geocoder)==null?void 0:Tt.timeout_seconds)??2,onChange:ie=>Ce({geocoder:{...e.geocoder,timeout_seconds:ie}}),min:0,step:.5,helper:"HTTP timeout per geocode request"}),f.jsx(Se,{label:"Search Radius (km)",value:((qt=e.geocoder)==null?void 0:qt.radius_km)??80,onChange:ie=>Ce({geocoder:{...e.geocoder,radius_km:ie}}),min:0,helper:"Bias radius around the configured center for results"}),f.jsx(Se,{label:"Result Limit",value:((cu=e.geocoder)==null?void 0:cu.limit)??10,onChange:ie=>Ce({geocoder:{...e.geocoder,limit:ie}}),min:1,helper:"Max candidate results to consider"})]})]})]})]})]})}function kCe(e){if(e==null||e==="")return"—";let t;if(typeof e=="number")t=new Date(e<1e12?e*1e3:e);else{const r=Number(e);t=Number.isFinite(r)&&e.trim()!==""?new Date(r<1e12?r*1e3:r):new Date(e)}return isNaN(t.getTime())?"—":t.toLocaleString()}function LCe(e){switch(e){case"meshtastic":return{label:"Meshtastic",cls:"bg-blue-500/15 text-blue-400 border border-blue-500/30"};case"meshcore":return{label:"MeshCore",cls:"bg-green-500/15 text-green-400 border border-green-500/30"};default:return{label:"Legacy",cls:"bg-slate-500/15 text-slate-400 border border-slate-600/40"}}}function ICe(e){return e==null||e===""?"—":typeof e=="number"?`ch ${e}`:e.startsWith("#")?e:`#${e}`}function PCe(e){if(!e)return"broadcast";const t=e.replace(/_/g," ").trim();return t.endsWith("s")?t.slice(0,-1):t}const DCe=[{value:"all",label:"All meshes"},{value:"meshtastic",label:"Meshtastic"},{value:"meshcore",label:"MeshCore"}],ECe=[{value:"all",label:"All types"},{value:"nws_alerts",label:"Weather"},{value:"fires",label:"Fires"},{value:"fire_digest_broadcasts",label:"Fire digest"},{value:"satpass_events",label:"Satellite"},{value:"band_conditions_broadcasts",label:"Band"},{value:"traffic_events",label:"Traffic"}],fx=100;function HB(){const[e,t]=O.useState([]),[r,n]=O.useState(!0),[a,i]=O.useState(null),[o,s]=O.useState("all"),[l,u]=O.useState("all"),[c,h]=O.useState(fx);return O.useEffect(()=>{document.title="Activity Log — MeshAI"},[]),O.useEffect(()=>{let d=!0;const v=()=>{TJ(c,o,l).then(m=>{d&&(t(m),i(null),n(!1))}).catch(m=>{d&&(i(m.message),n(!1))})};v();const g=setInterval(v,5e3);return()=>{d=!1,clearInterval(g)}},[c,o,l]),r?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-slate-400",children:"Loading activity…"})}):a?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsxs("div",{className:"text-red-400",children:["Error: ",a]})}):f.jsx("div",{className:"space-y-4",children:f.jsxs("div",{className:"bg-bg-card border border-border",children:[f.jsxs("div",{className:"p-4 border-b border-border flex items-center flex-wrap gap-2",children:[f.jsx(Mo,{size:14,className:"text-[#f59e0b]"}),f.jsx("h2",{className:"text-sm font-medium text-slate-300",children:"Activity Log"}),f.jsx("select",{value:o,onChange:d=>{s(d.target.value),h(fx)},className:"text-xs bg-bg-hover text-slate-300 border border-border rounded px-2 py-1",children:DCe.map(d=>f.jsx("option",{value:d.value,children:d.label},d.value))}),f.jsx("select",{value:l,onChange:d=>{u(d.target.value),h(fx)},className:"text-xs bg-bg-hover text-slate-300 border border-border rounded px-2 py-1",children:ECe.map(d=>f.jsx("option",{value:d.value,children:d.label},d.value))}),f.jsxs("span",{className:"text-xs text-slate-500 ml-auto",children:[e.length," broadcast",e.length===1?"":"s"," · newest first"]})]}),e.length===0?f.jsxs("div",{className:"flex items-center gap-2 text-slate-500 p-8",children:[f.jsx(oi,{size:18}),f.jsx("span",{children:"No outbound broadcasts recorded yet."})]}):f.jsx("ul",{className:"divide-y divide-border",children:e.map(d=>{const v=LCe(d.transport);return f.jsx("li",{className:"p-4 hover:bg-bg-hover transition-colors",children:f.jsxs("div",{className:"flex items-start gap-3",children:[f.jsx("div",{className:"pt-0.5",children:d.success===1?f.jsx(mk,{size:16,className:"text-green-500"}):d.success===0?f.jsx(jE,{size:16,className:"text-amber-500"}):f.jsx(jE,{size:16,className:"text-slate-600"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center flex-wrap gap-2 mb-1",children:[f.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${v.cls}`,children:v.label}),f.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-bg-hover text-slate-400 border border-border",children:ICe(d.channel)}),f.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-[#f59e0b]/10 text-[#f59e0b]",children:PCe(d.source_event_table)}),d.success===1&&f.jsx("span",{className:"text-xs text-green-500",children:"Sent"}),d.success===0&&f.jsx("span",{className:"text-xs text-amber-500",children:"Skip"}),(d.success===null||d.success===void 0)&&f.jsx("span",{className:"text-xs text-slate-500",children:"—"})]}),f.jsx("div",{className:"text-sm text-slate-200 break-words whitespace-pre-wrap",children:d.text||f.jsx("span",{className:"text-slate-500 italic",children:"(no text)"})}),f.jsxs("div",{className:"flex items-center gap-1 mt-1.5 text-xs text-slate-500 font-mono",children:[f.jsx(wV,{size:12}),kCe(d.sent_at)]})]})]})},d.id)})}),e.length>=c&&f.jsx("div",{className:"p-3 border-t border-border flex justify-center",children:f.jsx("button",{onClick:()=>h(d=>d+fx),className:"text-xs px-3 py-1 rounded bg-bg-hover text-slate-300 border border-border hover:bg-bg-card transition-colors",children:"Load more"})})]})})}const UB=[{id:"stream-gauges",label:"Stream Gauges",icon:f1},{id:"wildfire",label:"Wildfire",icon:Tm},{id:"firms",label:"Satellite Fire Detection (FIRMS)",icon:v1},{id:"fire-tracker",label:"Fire Tracker (Fusion)",icon:cJ},{id:"weather-alerts",label:"Weather Alerts",icon:lJ},{id:"solar",label:"Solar & Geomagnetic",icon:DV},{id:"ducting",label:"Tropospheric Ducting",icon:oi},{id:"avalanche",label:"Avalanche Danger",icon:sd},{id:"traffic",label:"Traffic Flow",icon:h1},{id:"roads-511",label:"Road Conditions (511)",icon:SV},{id:"mesh-health",label:"Mesh Health",icon:Mo},{id:"broadcast-types",label:"Broadcast Types",icon:LV},{id:"reminders",label:"Reminder System",icon:wV},{id:"notifications",label:"Notifications",icon:_V},{id:"commands",label:"Commands",icon:EV},{id:"llm-dm",label:"LLM DM Queries",icon:xk},{id:"or-not-and",label:"OR-not-AND Architecture",icon:_k},{id:"adapter-config",label:"Adapter Config & CODE Rule",icon:Ag},{id:"curation",label:"Curation: Gauges & Towns",icon:TV},{id:"schema",label:"Schema Migrations",icon:hJ},{id:"api",label:"API Reference",icon:uJ}];function lr({color:e}){const t={green:"bg-green-500",yellow:"bg-yellow-500",orange:"bg-orange-500",red:"bg-red-500",black:"bg-slate-800 border border-slate-600"};return f.jsx("span",{className:`inline-block w-3 h-3 rounded-full ${t[e]}`})}function Lt({headers:e,rows:t}){return f.jsx("div",{className:"overflow-x-auto my-4",children:f.jsxs("table",{className:"w-full text-sm",children:[f.jsx("thead",{children:f.jsx("tr",{className:"bg-[#1a2332] border-b border-[#2a3a4a]",children:e.map((r,n)=>f.jsx("th",{className:"px-4 py-2 text-left text-slate-400 font-medium",children:r},n))})}),f.jsx("tbody",{children:t.map((r,n)=>f.jsx("tr",{className:`border-b border-[#1e2a3a] ${n%2===0?"bg-[#0d1219]":"bg-[#0a0e17]"}`,children:r.map((a,i)=>f.jsx("td",{className:"px-4 py-2 text-slate-300",children:a},i))},n))})]})})}function Wt({href:e,children:t}){return f.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:[t," ",f.jsx(kc,{size:12})]})}function de({children:e}){return f.jsx("h3",{className:"text-lg font-semibold text-slate-200 mt-6 mb-3",children:e})}function Qs({children:e}){return f.jsx("h4",{className:"text-base font-medium text-slate-300 mt-4 mb-2",children:e})}function le({children:e}){return f.jsx("code",{className:"font-mono text-accent bg-[#1a2332] px-1 rounded",children:e})}function wr({id:e,title:t,children:r}){return f.jsxs("section",{id:e,className:"mb-12 scroll-mt-6",children:[f.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-4 pb-2 border-b border-[#2a3a4a]",children:t}),f.jsx("div",{className:"text-slate-300 leading-relaxed space-y-4",children:r})]})}function jCe(){const e=eu(),[t,r]=O.useState(""),[n,a]=O.useState("stream-gauges"),i=O.useRef(null);O.useEffect(()=>{const l=e.hash.replace("#","");if(l&&UB.find(u=>u.id===l)){a(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"})}},[e.hash]);const o=UB.filter(l=>l.label.toLowerCase().includes(t.toLowerCase())),s=l=>{a(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"}),window.history.replaceState(null,"",`#${l}`)};return f.jsxs("div",{className:"flex h-full -m-6",children:[f.jsxs("aside",{className:"w-64 flex-shrink-0 bg-bg-card border-r border-border overflow-y-auto",children:[f.jsx("div",{className:"p-4 border-b border-border",children:f.jsxs("div",{className:"relative",children:[f.jsx(p1,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),f.jsx("input",{type:"text",value:t,onChange:l=>r(l.target.value),placeholder:"Search topics...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"})]})}),f.jsx("nav",{className:"py-2",children:o.map(l=>{const u=l.icon,c=n===l.id;return f.jsxs("button",{onClick:()=>s(l.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors ${c?"text-accent bg-accent/10 border-l-2 border-accent":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover border-l-2 border-transparent"}`,children:[f.jsx(u,{size:16}),l.label]},l.id)})})]}),f.jsx("div",{ref:i,className:"flex-1 overflow-y-auto p-6",children:f.jsxs("div",{className:"max-w-4xl",children:[f.jsx("p",{className:"text-slate-400 mb-8",children:"Everything you need to understand and configure MeshAI's monitoring and alerting systems."}),f.jsxs(wr,{id:"stream-gauges",title:"Stream Gauges",children:[f.jsx(de,{children:"What You're Looking At"}),f.jsx("p",{children:"MeshAI watches river and stream levels at gauges you configure. Each gauge reports two things:"}),f.jsxs("p",{children:[f.jsx("strong",{children:"Water Level (Gage Height)"}),` — how high the water is, measured in feet. Important: this is NOT the depth of the river. It's the height above a fixed measuring point that's different at every gauge. A reading of "10 feet" at one gauge means something completely different than "10 feet" at another. You can only compare readings from the SAME gauge over time.`]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Flow (Discharge)"}),` — how much water is moving past the gauge, in cubic feet per second (CFS). Think of it as the river's "throughput." For scale:`]}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsx("li",{children:"A small creek: 50-200 CFS"}),f.jsx("li",{children:"A mid-size river: 1,000-5,000 CFS"}),f.jsx("li",{children:"A big river in spring runoff: 10,000+ CFS"})]}),f.jsx(de,{children:"When Does It Flood?"}),f.jsxs("p",{children:["Flood levels are set by the ",f.jsx("strong",{children:"National Weather Service"}),', not USGS. NWS looks at each specific gauge location and decides "at what water level does the road flood? At what level do buildings get water?" Those levels are different everywhere.']}),f.jsxs("p",{children:[f.jsx("strong",{children:"Action Stage"})," — water is rising, time to start paying attention. Usually still inside the riverbanks."]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Minor Flood"})," — low-lying roads start getting water on them. NWS issues a Flood Advisory."]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Moderate Flood"})," — water in buildings near the river. Some people need to evacuate. NWS issues a Flood Warning."]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Major Flood"})," — widespread flooding. Many people evacuating. Serious property damage."]}),f.jsx("p",{children:"MeshAI automatically looks up the flood levels for your gauge from NWS when you add a site. Some remote gauges don't have flood levels assigned — for those, you set them manually if you know what water levels cause problems in your area."}),f.jsx(de,{children:"Low Water / Drought"}),f.jsx("p",{children:`There's no official "drought stage" for most gauges. If you need to monitor low water (irrigation, fish habitat), set a manual low-water threshold based on what you know about your local river.`}),f.jsx(de,{children:"Setting It Up"}),f.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:["Find your gauge at ",f.jsx(Wt,{href:"https://waterdata.usgs.gov/nwis",children:"waterdata.usgs.gov/nwis"})]}),f.jsxs("li",{children:["Copy the site number (like ",f.jsx(le,{children:"13090500"}),")"]}),f.jsx("li",{children:"Add it in Config → Environmental → USGS"}),f.jsx("li",{children:"MeshAI auto-fills the gauge name and flood levels from NWS"})]}),f.jsx("p",{children:"If NWS flood levels don't populate, your gauge may not have them. Set manual thresholds if you know your local conditions."}),f.jsx(de,{children:"Learn More"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(Wt,{href:"https://waterdata.usgs.gov/nwis",children:"USGS Water Data"})," — find gauges near you"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://water.noaa.gov",children:"NWS Water Prediction Service"})," — flood forecasts and thresholds"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://www.usgs.gov/special-topics/water-science-school/science/how-streamflow-measured",children:"Understanding Streamflow"})," — USGS explainer"]})]})]}),f.jsxs(wr,{id:"wildfire",title:"Wildfire",children:[f.jsx(de,{children:"What You're Looking At"}),f.jsx("p",{children:"MeshAI tracks active wildfire perimeters from the National Interagency Fire Center (NIFC). For each fire, you see the name, size, how much is contained, and how far it is from your mesh nodes."}),f.jsx(de,{children:"Fire Size — How Big Is It?"}),f.jsx(Lt,{headers:["Size","What That Means"],rows:[["10 acres","Small fire. Usually handled quickly by initial crews."],["100 acres","Notable fire. Active firefighting effort."],["1,000 acres","Large fire. Major resources being deployed."],["10,000+ acres","Very large fire. Multiple teams, aircraft, heavy equipment."],["100,000+ acres","Mega-fire. These make the national news."]]}),f.jsx("p",{children:"For reference, 1,000 acres is about 1.5 square miles."}),f.jsx(de,{children:"Containment — Is It Under Control?"}),f.jsx("p",{children:"Containment means the percentage of the fire's edge where firefighters have built a control line (a cleared strip to stop the fire from spreading further). It does NOT mean the fire is out inside that line."}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx("strong",{children:"0-30%"})," — Essentially uncontrolled. The fire goes where it wants."]}),f.jsxs("li",{children:[f.jsx("strong",{children:"50%"})," — Good progress, but half the edge can still grow."]}),f.jsxs("li",{children:[f.jsx("strong",{children:"80%+"})," — Well controlled. Major growth unlikely."]}),f.jsxs("li",{children:[f.jsx("strong",{children:"100%"}),' — The edge is fully controlled. But the fire may STILL be actively burning inside. "100% contained" does NOT mean "out."']})]}),f.jsx(de,{children:"How Far Away Should I Worry?"}),f.jsx(Lt,{headers:["Distance","What To Do"],rows:[[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"red"})," Under 5 km (3 miles)"]}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Immediate threat."})," This is evacuation-order range. Embers can fly this far in wind."]})],[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"orange"})," 5-15 km (3-10 miles)"]}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Prepare."})," The fire could reach you in hours under bad conditions. Have a plan."]})],[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"yellow"})," 15-30 km (10-20 miles)"]}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Watch."})," Smoke is likely. Wind shifts could change things fast."]})],[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"green"})," Over 30 km (20 miles)"]}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Awareness."})," Keep an eye on it, but no immediate threat."]})]]}),f.jsx("p",{children:"How fast can a fire travel? In grass with wind: up to 14 mph. In heavy timber: 1-6 mph. A fire 10 miles away could theoretically reach you in 1-2 hours under worst-case conditions, but typical spread is much slower."}),f.jsx(de,{children:"Which Matters More — Size or Distance?"}),f.jsxs("p",{children:[f.jsx("strong",{children:"Distance is the immediate concern."})," A small uncontained fire 10 km away is more dangerous right now than a huge fire 50 km away. But big fires have more energy and can grow fast under wind shifts — keep watching them."]}),f.jsx(de,{children:"Setting It Up"}),f.jsxs("p",{children:["Just configure your state code (like ",f.jsx(le,{children:"US-ID"})," for Idaho) in Config → Environmental → Fires. MeshAI polls NIFC every 10 minutes for active fires in that state and computes the distance to your mesh nodes automatically."]}),f.jsx(de,{children:"Learn More"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(Wt,{href:"https://inciweb.nwcg.gov",children:"InciWeb"})," — detailed incident information"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://data-nifc.opendata.arcgis.com",children:"NIFC Fire Map"})," — raw perimeter data"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://www.ready.gov/wildfires",children:"Ready.gov Wildfires"})," — preparedness guide"]})]})]}),f.jsxs(wr,{id:"firms",title:"Satellite Fire Detection (FIRMS)",children:[f.jsx(de,{children:"What You're Looking At"}),f.jsx("p",{children:`NASA's VIIRS satellites orbit the Earth and look for heat signatures on the ground. When they see something hot — a fire, a factory, a sunlit building — they flag it as a "hotspot." MeshAI checks these detections for your area.`}),f.jsxs("p",{children:[f.jsx("strong",{children:"Why this matters"}),": satellite hotspots show up ",f.jsx("strong",{children:"hours before"})," official fire perimeters are mapped. If a new fire starts near your mesh, the satellite might see it before anyone on the ground reports it."]}),f.jsx(de,{children:"Confidence — Is It Really a Fire?"}),f.jsx("p",{children:"Each detection gets a confidence rating:"}),f.jsx(Lt,{headers:["Confidence","What It Means"],rows:[["High","Almost certainly a real fire. Strong heat signature."],["Nominal","Probably a real fire. Most actual fires get this rating."],["Low","Maybe a fire, maybe not. Could be a hot roof, sun reflecting off water, a factory, or a gas flare. Lots of false alarms."]]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Recommendation"}),`: Set the filter to "Nominal + High." If you include "Low" you'll get alerts for every hot parking lot on a summer day.`]}),f.jsx(de,{children:"FRP — How Intense Is It?"}),f.jsx("p",{children:'FRP (Fire Radiative Power) measures the heat output in megawatts. Think of it as "how hot is this thing":'}),f.jsx(Lt,{headers:["FRP","What It Probably Is"],rows:[["Under 5 MW","Hot surface, small agricultural burn, gas flare, or warm ground"],["5-50 MW","An actual fire — brush fire, grass fire, typical wildfire"],["50-300 MW","Intense fire — trees fully burning, active fire front"],["Over 300 MW","Extreme fire — major wildfire in full force"]]}),f.jsx("p",{children:"Setting the minimum FRP to 5 MW filters out most industrial and agricultural false alarms."}),f.jsx(de,{children:"New Ignition Detection"}),f.jsxs("p",{children:["MeshAI cross-references satellite hotspots against known NIFC fire perimeters. If a hotspot is NOT near any known fire, it gets flagged as a ",f.jsx("strong",{children:"potential new ignition"})," — maybe a new fire just started. These get elevated priority regardless of confidence level."]}),f.jsx(de,{children:"Timing"}),f.jsxs("p",{children:["Satellite data arrives ",f.jsx("strong",{children:"1-3 hours"})," after the satellite passes overhead. Each location gets observed about ",f.jsx("strong",{children:"6 times per day"}),` across all satellites, so there are multi-hour gaps. This is not real-time — it's "pretty recent."`]}),f.jsx(de,{children:"Getting an API Key"}),f.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:["Go to ",f.jsx(Wt,{href:"https://firms.modaps.eosdis.nasa.gov/api/area/",children:"FIRMS API page"})]}),f.jsx("li",{children:'Click "Get MAP_KEY"'}),f.jsx("li",{children:"Register for a free Earthdata account"}),f.jsx("li",{children:"Your key arrives by email"}),f.jsx("li",{children:"Enter it in Config → Environmental → FIRMS"})]}),f.jsx(de,{children:"Learn More"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(Wt,{href:"https://firms.modaps.eosdis.nasa.gov",children:"FIRMS Fire Map"})," — see hotspots on a map"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://earthdata.nasa.gov/data/tools/firms/faq",children:"FIRMS FAQ"})," — how it works"]})]})]}),f.jsxs(wr,{id:"fire-tracker",title:"Fire Tracker (Fusion)",children:[f.jsx("p",{children:"FIRMS hotspots are fast but noisy; WFIGS incidents are accurate but slow. The Fire Tracker fuses both feeds and a per-pixel attribution graph so a single fire's name, declared acreage, real-time perimeter movement, and spotting events all land as separate broadcasts on the mesh."}),f.jsx(de,{children:"What you'll see on the mesh"}),f.jsx("p",{children:"Six fire-family alert categories, in order of when they fire during an incident's lifecycle:"}),f.jsx(Lt,{headers:["Category","Severity","Trigger","Example broadcast"],rows:[[f.jsx(le,{children:"unattributed_hotspot_cluster"}),"Priority","3+ FIRMS pixels within 1 mi over 60 min, no WFIGS match — possible new ignition before NIFC declares it",f.jsx("span",{className:"text-amber-300",children:"🔥 Possible new fire: 3 hotspots within 1 mi @ 42.93,-114.45 (combined 78 MW)"})],[f.jsx(le,{children:"wildfire_declared"}),"Priority","WFIGS first-sight of a new IRWIN incident — the official 'this is a fire and here is its name' record",f.jsx("span",{className:"text-amber-300",children:"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained"})],[f.jsx(le,{children:"wildfire_growth"}),"Priority","Per-pass centroid drift >= 0.5 mi (configurable) between consecutive satellite passes — the fire's footprint moved",f.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire moving NE 1.2 mi/h, ~3 mi from Almo"})],[f.jsx(le,{children:"wildfire_spotting"}),"Immediate","FIRMS pixel attributed to a tracked fire but >= 1.5 mi (configurable) outside its prior-pass convex-hull perimeter — ember spread",f.jsx("span",{className:"text-amber-300",children:"🔥 Possible spotting 2.1 mi NE of Cache Peak Fire perimeter"})],[f.jsx(le,{children:"wildfire_incident"}),"Priority","WFIGS acreage or containment increased on a fire already broadcast once (the Update path; the New path uses wildfire_declared)",f.jsx("span",{className:"text-amber-300",children:"🔥 Update: Cache Peak Fire: 1,847 ac, 23% contained"})],[f.jsx(le,{children:"wildfire_halted"}),"Routine","No FIRMS pixels attributed for 12+ hours (configurable) — fire stalled or out",f.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire no growth in 14h"})]]}),f.jsx(de,{children:"Daily LLM digest"}),f.jsxs("p",{children:["Twice a day (default 06:00 and 18:00 Mountain Time) the bot runs an LLM summary across every active fire and the last 24 h of growth + spotting events, then broadcasts one terse line to the mesh. Shape:"," ",f.jsx("span",{className:"text-amber-300",children:'"Fires today: Cache Peak 1,847 ac +200 NE; Twin Peaks 320 ac stable; possible new fire 15 mi from Cache Peak."'})," ","Configure the schedule and timezone under ",f.jsx(le,{children:"fires.digest_*"})," ","keys on the Adapter Config page."]}),f.jsx(de,{children:"How attribution works"}),f.jsxs("p",{children:["When a FIRMS hotspot lands, the bot walks every active fire (those not yet tombstoned) and matches by Haversine distance to that fire's running centroid. If the pixel is within the fire's ",f.jsx(le,{children:"spread_radius_mi"})," ","(default 5 mi, per-fire override available) the pixel is attributed and appended to that fire's growth history. The centroid then re-computes as the median of the last 24 h of attributed pixels, so single-pixel outliers don't drag the perimeter around."]}),f.jsxs("p",{children:["Pixels that match no fire feed the cluster detector instead: if at least"," ",f.jsx(le,{children:"cluster_min_pixels"})," (default 3) lie within"," ",f.jsx(le,{children:"cluster_max_radius_mi"})," (default 1.0) over"," ",f.jsx(le,{children:"cluster_time_window_minutes"})," (default 60), the bot fires a single ",f.jsx(le,{children:"unattributed_hotspot_cluster"})," broadcast and marks the member pixels so a fourth arrival doesn't re-fire the same cluster."]}),f.jsx(de,{children:"How movement is computed"}),f.jsxs("p",{children:["Each VIIRS pass groups pixels into a ",f.jsx(le,{children:"pass_id"})," (satellite + 90-min bucket). When a pixel from a different bucket arrives, the prior pass closes: its convex hull becomes the perimeter, its median centroid becomes the comparison anchor, and the bot computes drift (Haversine to the previous pass's centroid), an 8-way compass bearing, and a wall-clock mi/h speed. If drift ≥ ",f.jsx(le,{children:"growth_drift_threshold_mi"})," the"," ",f.jsx(le,{children:"wildfire_growth"})," broadcast fires."]}),f.jsx(de,{children:"How spotting is detected"}),f.jsxs("p",{children:["Once a pass closes its perimeter (a GeoJSON polygon stored on the fire), every subsequent attributed pixel runs a point-in-polygon test. Pixels outside the polygon with a vertex distance ≥"," ",f.jsx(le,{children:"spotting_distance_threshold_mi"})," (default 1.5) fire the"," ",f.jsx(le,{children:"wildfire_spotting"})," broadcast at ",f.jsx("em",{children:"immediate"})," severity — spread beyond the existing perimeter is the most actionable fire signal we emit. A per-fire cooldown (",f.jsx(le,{children:"spotting_cooldown_seconds"}),", default 1 h) prevents an ember burst in the same area from spamming the mesh."]}),f.jsx(de,{children:"Tunable knobs (Adapter Config → fires)"}),f.jsx(Lt,{headers:["Key","Default","What it does"],rows:[[f.jsx(le,{children:"spread_radius_mi_default"}),"5.0 mi","Attribution radius for FIRMS → fire matching. Per-fire override in the fires.spread_radius_mi column."],[f.jsx(le,{children:"growth_drift_threshold_mi"}),"0.5 mi","Per-pass centroid drift at or above this fires wildfire_growth."],[f.jsx(le,{children:"halt_passes_threshold"}),"2","Consecutive empty satellite passes before wildfire_halted (documented; the time gate below is the operational rule)."],[f.jsx(le,{children:"halt_minimum_seconds"}),"43,200 (12 h)","Minimum elapsed seconds since the most recent attributed pixel before wildfire_halted can fire."],[f.jsx(le,{children:"spotting_distance_threshold_mi"}),"1.5 mi","Distance from prior-pass perimeter that fires wildfire_spotting."],[f.jsx(le,{children:"spotting_cooldown_seconds"}),"3,600 (1 h)","Minimum seconds between consecutive spotting broadcasts per fire."],[f.jsx(le,{children:"digest_enabled"}),"true","Master toggle for the twice-daily digest."],[f.jsx(le,{children:"digest_schedule"}),'["06:00","18:00"]',"Local-time slots for the digest."],[f.jsx(le,{children:"digest_timezone"}),"America/Boise","IANA tz for digest_schedule."],[f.jsx(le,{children:"digest_max_chars"}),"200","Hard cap on the digest wire (the LLM is told to fit; the chunker enforces)."]]})]}),f.jsxs(wr,{id:"weather-alerts",title:"Weather Alerts",children:[f.jsx(de,{children:"What You're Looking At"}),f.jsx("p",{children:"MeshAI watches for NWS (National Weather Service) alerts affecting your area — warnings, watches, and advisories."}),f.jsx(de,{children:"Alert Severity — How Serious Is It?"}),f.jsx(Lt,{headers:["Severity","What It Means","Example"],rows:[["Extreme","Life-threatening. The most serious events.","Tornado Emergency, Hurricane Warning, Tsunami Warning"],["Severe","Dangerous. Take protective action.","Tornado Warning, Flash Flood Warning, Blizzard Warning, Red Flag Warning"],["Moderate","Be prepared. Could become dangerous.","Winter Weather Advisory, Wind Advisory, Flood Watch, Heat Advisory"],["Minor","Good to know. Probably won't hurt anyone.","Special Weather Statement, Air Quality Alert"]]}),f.jsx(de,{children:"When Should I Act? (Urgency)"}),f.jsx(Lt,{headers:["Urgency","What It Means"],rows:[["Immediate","Do something NOW"],["Expected","Do something within the hour"],["Future","Coming in the next several hours"],["Past","It's over — NWS is clearing the alert"]]}),f.jsx(de,{children:"How Sure Are They? (Certainty)"}),f.jsx(Lt,{headers:["Certainty","What It Means"],rows:[["Observed","It's happening right now. Verified."],["Likely","More than 50% chance"],["Possible","Could happen, but less than 50%"],["Unlikely","Probably won't, but mentioned for awareness"]]}),f.jsx(de,{children:"These Are Separate Scales"}),f.jsx("p",{children:'A single alert has all three. A hurricane warning for next week is "Severe + Future + Likely." A tornado spotted on the ground is "Extreme + Immediate + Observed." An air quality advisory is "Minor + Expected + Possible."'}),f.jsx(de,{children:"What Minimum Severity Should I Set?"}),f.jsx(Lt,{headers:["Setting","What You Get","What You Miss"],rows:[["Minor","Everything — high volume","Nothing"],[f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Moderate"})," ✓"]}),"Watches, Advisories, and Warnings","Special Weather Statements"],["Severe","Only Warnings — things happening NOW","Watches (which give you hours of advance warning)"],["Extreme","Only the rarest events","Most Tornado and Severe Thunderstorm Warnings"]]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Moderate is recommended."})," It catches Watches (advance warning that conditions may worsen) and Advisories (conditions exist but aren't severe) while filtering out the informational stuff."]}),f.jsx(de,{children:"Finding Your NWS Zone"}),f.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:["Go to ",f.jsx(Wt,{href:"https://www.weather.gov",children:"weather.gov"})]}),f.jsx("li",{children:"Enter your location"}),f.jsxs("li",{children:["Find your zone code at ",f.jsx(Wt,{href:"https://www.weather.gov/pimar/PubZone",children:"NWS Zone Map"})]}),f.jsxs("li",{children:["Zone codes look like: ",f.jsx(le,{children:"IDZ016"}),", ",f.jsx(le,{children:"UTZ040"}),", etc."]})]}),f.jsx(de,{children:"The User-Agent Field"}),f.jsx("p",{children:"NWS wants to know who's using their API — not for approval, just so they can contact you if something breaks. You make it up:"}),f.jsx("p",{children:f.jsx(le,{children:"(meshai, you@email.com)"})}),f.jsx("p",{children:"No registration. No waiting. Just type it in."}),f.jsx(de,{children:"Learn More"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(Wt,{href:"https://alerts.weather.gov",children:"NWS Active Alerts"})," — see current alerts"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://www.weather.gov/documentation/services-web-api",children:"NWS API Docs"})," — technical details"]})]})]}),f.jsxs(wr,{id:"solar",title:"Solar & Geomagnetic Conditions",children:[f.jsx(de,{children:"What You're Looking At"}),f.jsx("p",{children:"MeshAI tracks space weather — solar activity and its effects on Earth's magnetic field. This matters for radio operators because the sun directly controls how well HF radio works, and major solar events can affect all radio communications."}),f.jsx(de,{children:"Solar Flux Index (SFI)"}),f.jsx("p",{children:'Think of SFI as a "how active is the sun" number. Higher = better for HF radio, but also higher risk of solar flares.'}),f.jsx(Lt,{headers:["SFI","What It Means for You"],rows:[["Below 70","Quiet sun. Higher HF bands (10m, 15m) are probably dead. Stick to lower bands."],["70-90","Getting better. Some openings on 15m and above, but inconsistent."],["90-120","Good. Most HF bands work. Reliable contacts on 20m and 15m."],["120-170","Great. All HF bands open. 10m works for worldwide contacts."],["Above 170","Excellent. Best HF conditions — but watch for flares."]]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Quick rule"}),": SFI above 90 and Kp below 4 = good day for HF radio."]}),f.jsx(de,{children:"Kp Index"}),f.jsx("p",{children:"Kp measures how disturbed Earth's magnetic field is, on a 0-9 scale. Higher = more disturbance = worse for HF radio but better for aurora viewing."}),f.jsx(Lt,{headers:["Kp","What It Means for You"],rows:[["0-2","Quiet. Best HF conditions."],["3","Slightly unsettled. You probably won't notice."],["4","Active. Some noise and fading on HF, especially if you're at higher latitudes."],[f.jsx("strong",{children:"5"}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Minor storm (G1)."})," HF noticeably degraded. Aurora visible at high latitudes (~60°N)."]})],[f.jsx("strong",{children:"6"}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Moderate storm (G2)."})," HF getting rough. Aurora moving south (~55°N)."]})],[f.jsx("strong",{children:"7"}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Strong storm (G3)."})," HF unreliable for 1-2 days. Aurora at mid-latitudes."]})],[f.jsx("strong",{children:"8-9"}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Severe/Extreme storm."})," HF may black out completely. Aurora visible at very low latitudes. Power grid stress possible."]})]]}),f.jsx(de,{children:"R / S / G Scales"}),f.jsx("p",{children:"NOAA's shorthand for three types of space weather events:"}),f.jsx(Qs,{children:"R (Radio Blackouts) — from solar flares:"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsx("li",{children:"R1-R2: Brief HF disruption. You might not notice."}),f.jsx("li",{children:"R3: HF goes out for about an hour on the sunlit side of Earth."}),f.jsx("li",{children:"R4-R5: HF dead for hours. Serious."})]}),f.jsx(Qs,{children:"S (Solar Radiation Storms) — from energetic particles:"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsx("li",{children:"Mostly affects polar regions and satellites"}),f.jsx("li",{children:"S3+: Polar HF goes out entirely"})]}),f.jsx(Qs,{children:"G (Geomagnetic Storms) — from solar wind disturbances:"}),f.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:f.jsx("li",{children:"Same as the Kp scale: G1 = Kp 5, up to G5 = Kp 9"})}),f.jsx(de,{children:"Bz — The Storm Predictor"}),f.jsx("p",{children:"Bz measures the direction of the solar wind's magnetic field. When it points south (negative values), the solar wind can dump energy into Earth's magnetic field, causing storms."}),f.jsx(Lt,{headers:["Bz","What It Means"],rows:[["Positive","All good. Solar wind bouncing off."],["0 to -5","Slight coupling. Nothing dramatic."],["-5 to -10","Things starting to pick up. Storm possible."],["Below -10","Storm likely. Kp will start climbing."],["Below -20","Severe storm probable."]]}),f.jsx("p",{children:"Bz can change fast — minute to minute. What matters is whether it stays negative for hours, not brief dips."}),f.jsx(de,{children:"Learn More"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(Wt,{href:"https://www.swpc.noaa.gov",children:"SWPC Space Weather Dashboard"})," — live data"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://www.swpc.noaa.gov/noaa-scales-explanation",children:"NOAA Space Weather Scales"})," — what R/S/G mean"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://www.hamqsl.com/solar.html",children:"HamQSL Solar Page"})," — ham-friendly display"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://www.swpc.noaa.gov/products/planetary-k-index",children:"Planetary K-Index"})," — live Kp"]})]})]}),f.jsxs(wr,{id:"ducting",title:"Tropospheric Ducting",children:[f.jsx(de,{children:"What You're Looking At"}),f.jsx("p",{children:'Sometimes the atmosphere creates an invisible "pipe" that traps radio signals and carries them much farther than normal. This is called tropospheric ducting. It mostly affects VHF and UHF frequencies.'}),f.jsx("p",{children:"MeshAI watches for these conditions by analyzing weather data (temperature and humidity at different altitudes) over your mesh area."}),f.jsx(de,{children:"How Do I Know If Ducting Is Happening?"}),f.jsx("p",{children:'MeshAI reports a "condition" based on the atmospheric profile:'}),f.jsx(Lt,{headers:["Condition","What It Means"],rows:[["Normal","Standard propagation. Nothing unusual."],["Super-refraction","Slightly enhanced range. You might hear a few more distant stations than usual."],["Surface Duct","Radio signals trapped near the ground. You may hear stations hundreds of km away that you've never heard before."],["Elevated Duct",'Same effect but the "pipe" is up in the atmosphere. Affects signals passing through that altitude.']]}),f.jsx(de,{children:"What You'll Actually Notice"}),f.jsx("p",{children:"When ducting happens on your mesh:"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsx("li",{children:"Distant repeaters you've never heard suddenly come in"}),f.jsx("li",{children:"Nodes appear from far outside your normal range"}),f.jsx("li",{children:"You hear FM radio stations from other cities"}),f.jsx("li",{children:"ADS-B flight tracking range gets much longer"}),f.jsx("li",{children:"There might be interference from distant stations on your frequency"})]}),f.jsx(de,{children:"The dM/dz Number"}),f.jsx("p",{children:`The dashboard shows a "dM/dz" value in "M-units/km." You don't need to understand the math — just know:`}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx("strong",{children:"Around 118"})," = normal atmosphere"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Below 79"})," = enhanced propagation starting"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Below 0 (negative)"})," = ducting is happening"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Below -50"})," = strong ducting — classic VHF/UHF DX event"]})]}),f.jsx(de,{children:"When Does Ducting Happen?"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsx("li",{children:"Under high-pressure weather systems (clear, stable air)"}),f.jsx("li",{children:"When warm air sits on top of cool air (temperature inversion)"}),f.jsx("li",{children:"Most common in late summer and early fall"}),f.jsx("li",{children:"Strongest along coastlines and over water"}),f.jsx("li",{children:"In mountain valleys: cold air pooling in fall/winter can create surface ducts"})]}),f.jsx(de,{children:"Setting It Up"}),f.jsx("p",{children:"Just configure the latitude and longitude of the center of your mesh area in Config → Environmental → Ducting. MeshAI checks the atmospheric conditions there every 3 hours using free weather model data. No API key needed."}),f.jsx(de,{children:"Learn More"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(Wt,{href:"https://dxinfocentre.com/tropo.html",children:"Tropo Forecast Maps (Hepburn)"})," — 6-day tropo prediction"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://dxmaps.com",children:"DX Maps"})," — real-time VHF/UHF propagation reports"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://en.wikipedia.org/wiki/Tropospheric_propagation",children:"Wikipedia: Tropospheric Propagation"})," — background"]})]})]}),f.jsxs(wr,{id:"avalanche",title:"Avalanche Danger",children:[f.jsx(de,{children:"What You're Looking At"}),f.jsx("p",{children:"MeshAI pulls avalanche forecasts from your regional avalanche center during winter months. The danger scale has 5 levels and it's the same across all of North America."}),f.jsx(de,{children:"The Danger Scale"}),f.jsx(Lt,{headers:["Level","Name","Color","What To Do"],rows:[["1","Low",f.jsx(lr,{color:"green"}),"Generally safe. Normal caution in steep terrain."],["2","Moderate",f.jsx(lr,{color:"yellow"}),"Be careful on specific terrain features. Evaluate conditions."],["3","Considerable",f.jsx(lr,{color:"orange"}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"DANGEROUS."}),` This is where most people die in avalanches — they see "3 out of 5" and think it's fine. It's not. Use extreme caution.`]})],["4","High",f.jsx(lr,{color:"red"}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Very dangerous."})," Stay off anything steep."]})],["5","Extreme",f.jsx(lr,{color:"black"}),f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Don't go out."})," Avalanches are happening on their own."]})]]}),f.jsx(de,{children:"The Most Important Thing to Know"}),f.jsxs("p",{children:[f.jsx("strong",{children:"Level 3 (Considerable) kills more people than any other level."}),' People look at "3 out of 5" and think "middle of the road, probably okay." In reality, the risk roughly doubles at each step up the scale. Level 3 is where dangerous conditions overlap with people thinking they can handle it.']}),f.jsx(de,{children:"Seasonal"}),f.jsx("p",{children:'MeshAI only checks avalanche conditions during winter months (configurable, default December through April). Outside season, it shows "off season" and saves API calls.'}),f.jsx(de,{children:"Finding Your Avalanche Center"}),f.jsxs("p",{children:["Go to ",f.jsx(Wt,{href:"https://avalanche.org/avalanche-centers/",children:"avalanche.org/avalanche-centers/"})," for a map. Common center codes:"]}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(le,{children:"SNFAC"})," — Sawtooth (central Idaho)"]}),f.jsxs("li",{children:[f.jsx(le,{children:"UAC"})," — Utah"]}),f.jsxs("li",{children:[f.jsx(le,{children:"NWAC"})," — Cascades/Olympics (WA/OR)"]}),f.jsxs("li",{children:[f.jsx(le,{children:"CAIC"})," — Colorado"]}),f.jsxs("li",{children:[f.jsx(le,{children:"SAC"})," — Sierra Nevada (CA)"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GNFAC"})," — Gallatin (SW Montana)"]})]}),f.jsx(de,{children:"Learn More"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(Wt,{href:"https://avalanche.org",children:"Avalanche.org"})," — US forecasts"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://avalanche.org/avalanche-encyclopedia/human/resources/north-american-public-avalanche-danger-scale/",children:"Avalanche Danger Scale"})," — full scale explanation"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://kbyg.org",children:"Know Before You Go"})," — avalanche awareness"]})]})]}),f.jsxs(wr,{id:"traffic",title:"Traffic Flow",children:[f.jsx(de,{children:"What You're Looking At"}),f.jsx("p",{children:"MeshAI monitors traffic speed on road segments you configure, using data from TomTom (real vehicles with navigation apps reporting their speed)."}),f.jsx(de,{children:"Speed Ratio — The Key Number"}),f.jsx("p",{children:'MeshAI compares current speed to "free-flow speed" (what traffic normally does when the road is empty). The ratio tells you how congested it is:'}),f.jsx(Lt,{headers:["Ratio","What It Means"],rows:[[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"green"})," Above 85%"]}),"Normal. Traffic flowing fine."],[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"yellow"})," 65-85%"]}),"Slow. Heavier than usual but moving."],[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"orange"})," 40-65%"]}),"Congested. Significant delays."],[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"red"})," Below 40%"]}),"Gridlock. Barely moving."]]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Note"}),`: "free-flow speed" is NOT the speed limit. It's what traffic actually does on that road when nobody's in the way. Drivers often exceed speed limits on open highways.`]}),f.jsx(de,{children:"Confidence — Can You Trust the Data?"}),f.jsx("p",{children:"TomTom's confidence score tells you how much of the reading comes from real vehicles right now vs historical averages:"}),f.jsx(Lt,{headers:["Confidence","What It Means"],rows:[["Above 0.9","Very reliable — lots of real-time probe data"],["0.7-0.9","Good — mix of real-time and historical"],["Below 0.7",f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Unreliable"})," — mostly guessing from historical patterns. Don't alert on this."]})]]}),f.jsx("p",{children:"Set minimum confidence to 0.7 to avoid false congestion alerts at night or on rural roads where few probe vehicles drive."}),f.jsx(de,{children:"Setting Up Corridors"}),f.jsx("p",{children:'Each "corridor" is a point on a road you want to monitor. To add one:'}),f.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[f.jsx("li",{children:"Go to Google Maps, find the road"}),f.jsx("li",{children:`Right-click the road → "What's here?" → copy the coordinates`}),f.jsx("li",{children:"Add the corridor in Config with a name and those coordinates"}),f.jsx("li",{children:"TomTom finds the nearest road segment automatically"})]}),f.jsx(de,{children:"Getting an API Key"}),f.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:["Sign up at ",f.jsx(Wt,{href:"https://developer.tomtom.com",children:"developer.tomtom.com"})," (free)"]}),f.jsx("li",{children:"Create an app → get your API key"}),f.jsx("li",{children:"Free tier: 2,500 requests/day (plenty for 5-10 corridors)"})]}),f.jsx(de,{children:"Learn More"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(Wt,{href:"https://developer.tomtom.com",children:"TomTom Developer Portal"})," — API docs and key signup"]}),f.jsxs("li",{children:[f.jsx(Wt,{href:"https://www.tomtom.com/traffic-index/",children:"TomTom Traffic Index"})," — city congestion rankings"]})]})]}),f.jsxs(wr,{id:"roads-511",title:"Road Conditions (511)",children:[f.jsx(de,{children:"What You're Looking At"}),f.jsx("p",{children:"511 systems report road closures, construction, weather events, mountain pass conditions, and incidents. Every state runs their own 511 system — there is no national API."}),f.jsx(de,{children:"Setting It Up"}),f.jsx("p",{children:"You need to find YOUR state's 511 developer API. MeshAI does not include a default URL because every state is different. Some states have free public APIs, some require registration, and some don't have developer APIs at all."}),f.jsx("p",{children:"Configure in Config → Environmental → 511:"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx("strong",{children:"Base URL"})," — your state's API endpoint"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"API Key"})," — if required by your state"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Endpoints"})," — which data feeds to poll (varies by state)"]})]}),f.jsx(de,{children:"Learn More"}),f.jsx("p",{children:"Check your state's 511 or DOT website for developer information."})]}),f.jsxs(wr,{id:"mesh-health",title:"Mesh Health",children:[f.jsx(de,{children:"Health Score"}),f.jsx("p",{children:"MeshAI computes a 0-100 health score for your mesh network by looking at five areas, each weighted differently:"}),f.jsx(Lt,{headers:["Pillar","Weight","What It Measures"],rows:[[f.jsx("strong",{children:"Infrastructure"}),"30%","Are your routers online?"],[f.jsx("strong",{children:"Utilization"}),"25%","Is the radio channel congested?"],[f.jsx("strong",{children:"Coverage"}),"20%","Do nodes have redundant paths to gateways?"],[f.jsx("strong",{children:"Behavior"}),"15%","Are any nodes flooding the channel?"],[f.jsx("strong",{children:"Power"}),"10%","Are battery-powered nodes running low?"]]}),f.jsx("p",{children:"The overall score is the weighted sum:"}),f.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"Score = (Infrastructure × 30%) + (Utilization × 25%) + (Coverage × 20%) + (Behavior × 15%) + (Power × 10%)"}),f.jsx(de,{children:"How Each Pillar Is Calculated"}),f.jsx(Qs,{children:"Infrastructure (30%)"}),f.jsx("p",{children:"This is the simplest pillar — what percentage of your infrastructure nodes are currently online?"}),f.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"(routers online ÷ total routers) × 100"}),f.jsxs("p",{children:["Only nodes with the ",f.jsx(le,{children:"ROUTER"}),", ",f.jsx(le,{children:"ROUTER_LATE"}),", or ",f.jsx(le,{children:"ROUTER_CLIENT"})," role count as infrastructure. Regular client nodes going offline doesn't affect this score. If you have 5 routers and 3 are online, infrastructure scores 60."]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Special case:"})," If you have no routers at all (all clients), this pillar scores 100. You're not penalized for not having infrastructure — you just don't have any to track."]}),f.jsx(Qs,{children:"Utilization (25%)"}),f.jsxs("p",{children:["MeshAI reads the channel utilization that each router reports in its telemetry — this is the firmware's own measurement of how busy the radio channel is. MeshAI uses the ",f.jsx("strong",{children:"highest"})," value from any infrastructure node because the busiest router is the bottleneck for the whole mesh."]}),f.jsx("p",{children:f.jsx("strong",{children:"How it works:"})}),f.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-4",children:[f.jsxs("li",{children:["Collect ",f.jsx(le,{children:"channel_utilization"})," from all infrastructure nodes that report it"]}),f.jsx("li",{children:"If no infra nodes have telemetry, try all nodes"}),f.jsxs("li",{children:["Use the ",f.jsx("strong",{children:"maximum"})," value for scoring (busiest node = bottleneck)"]}),f.jsx("li",{children:"If no nodes report utilization (older firmware), fall back to packet count estimate"})]}),f.jsxs("p",{className:"mt-4",children:[f.jsx("strong",{children:"Fallback method"})," (when telemetry unavailable): estimates from packet counts using 200ms/packet airtime. This is less accurate — it assumes MediumFast preset and sums packets across all nodes."]}),f.jsx(Lt,{headers:["Channel Utilization","Score","What It Means"],rows:[["Under 20%","100","Channel is clear — this is the goal"],["20-25%","75-100","Slight degradation, occasional collisions"],["25-35%","50-75","Severe degradation — firmware throttling active"],["35-45%","25-50","Mesh struggling badly — reliability dropping"],["Over 45%","0-25","Mesh is effectively unusable"]]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Special case:"})," If no utilization data is available (no telemetry and no packet data), this pillar scores 100. You're not penalized for missing data."]}),f.jsx(Qs,{children:"Coverage (20%)"}),f.jsx("p",{children:'Measures gateway redundancy — how many of your data sources can "see" each node. A node reported by all 3 of your gateways has full coverage. A node only seen by 1 gateway is a single point of failure.'}),f.jsxs("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:["coverage_ratio = average_gateways_per_node ÷ total_sources",f.jsx("br",{}),"single_gw_penalty = (single_gateway_nodes ÷ total_nodes) × 40"]}),f.jsx("p",{children:"If a node is seen by 2 out of 3 sources, its coverage ratio is 0.67. Infrastructure nodes with only single-gateway coverage get an extra penalty — they're critical but have no backup path."}),f.jsx(Lt,{headers:["Coverage Ratio","Base Score","After Penalty"],rows:[["100% (all sources)","100","100 minus single-gw penalty"],["70-99%","90","Minus penalties"],["50-69%","70","Minus penalties"],["Under 50%","50 or less","Heavy penalty"]]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Special case:"})," With only 1 data source, this pillar can't score well — there's no redundancy to measure. Coverage becomes meaningful when you have 2+ sources (MeshMonitor + MQTT, multiple gateways, etc.)."]}),f.jsx(Qs,{children:"Behavior (15%)"}),f.jsx("p",{children:"Counts how many nodes are sending an unusually high number of non-text packets. This catches firmware bugs, stuck transmitters, and misconfigured nodes that are flooding the channel."}),f.jsxs("p",{children:[f.jsx("strong",{children:"What counts as flooding:"})," More than 500 non-text packets in 24 hours. Text messages don't count — the behavior pillar only flags telemetry, position, and routing packet floods."]}),f.jsx(Lt,{headers:["Flagged Nodes","Score"],rows:[["0","100"],["1","80"],["2-3","60"],["4-5","40"],["6+","20"]]}),f.jsx("p",{children:"A single misbehaving node only drops the score to 80. It takes multiple problem nodes to seriously hurt the behavior pillar."}),f.jsx(Qs,{children:"Power (10%)"}),f.jsx("p",{children:"Measures what fraction of battery-powered nodes are below the warning threshold (default 20%)."}),f.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"100 × (1 − low_battery_nodes ÷ total_battery_nodes)"}),f.jsx("p",{children:"If 2 out of 10 battery nodes are below 20%, power scores 80."}),f.jsxs("p",{children:[f.jsx("strong",{children:"Important:"})," USB-powered nodes are excluded from this calculation. Many nodes report 100% battery even when running on wall power with no battery installed. Only nodes actually running on batteries affect this pillar."]}),f.jsx(de,{children:"Health Tiers"}),f.jsx(Lt,{headers:["Score","Tier","What It Means"],rows:[["90-100",f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"green"})," Healthy"]}),"Everything's working well."],["75-89",f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"yellow"})," Slight degradation"]}),"Some issues but the mesh is functional."],["50-74",f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"orange"})," Unhealthy"]}),"Multiple problems. Reliability is affected."],["25-49",f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"red"})," Warning"]}),"Significant issues. The mesh is struggling."],["0-24",f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"black"})," Critical"]}),"Major failures. Barely functional."]]}),f.jsx(de,{children:"Channel Utilization — Is the Radio Channel Full?"}),f.jsx("p",{children:"Meshtastic radios share one LoRa channel. If too many nodes are transmitting too often, they step on each other and messages get lost."}),f.jsx(Lt,{headers:["Utilization","What's Happening"],rows:[[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"green"})," Under 25%"]}),"Healthy. The firmware itself starts throttling above 25% to protect the channel — so under 25% is the target."],[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"yellow"})," 25-40%"]}),"Getting busy. Common on larger meshes. Worth watching."],[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"orange"})," 40-50%"]}),"Congested. The firmware throttles GPS updates above 40%. Messages are colliding and retrying."],[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"red"})," Over 50%"]}),"Serious problem. More time is spent retrying than communicating. Mesh reliability drops fast."],[f.jsxs(f.Fragment,{children:[f.jsx(lr,{color:"black"})," Over 65%"]}),"Documented failure point on busy LONG_FAST meshes. The mesh becomes unusable."]]}),f.jsx(de,{children:"Packet Flooding"}),f.jsx("p",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-yellow-200",children:f.jsx("strong",{children:'⚠️ "Packet flooding" means a node sending too many RADIO PACKETS. This has nothing to do with water flooding.'})}),f.jsx("p",{children:"A normal Meshtastic node sends a packet every few minutes (announcing itself, reporting telemetry, updating position). If a node starts blasting packets every few seconds, something is wrong — firmware bug, stuck transmitter, or misconfiguration."}),f.jsx(Lt,{headers:["Packets per Minute","What It Means"],rows:[["1-5","Normal"],["5-10","Elevated — might be someone chatting a lot"],["10-20","Suspicious — worth investigating"],["Over 30","Something is broken. This node is actively hurting the mesh."]]}),f.jsx(de,{children:"Battery Levels"}),f.jsx("p",{children:"Most Meshtastic radios (T-Beam, RAK4631, Heltec V3) use a single lithium battery cell. The voltage tells you how much charge is left:"}),f.jsx(Lt,{headers:["Voltage","Charge","What To Do"],rows:[["4.20V","100%","Full"],["3.80V","~60%","Fine"],[f.jsx("strong",{children:"3.60V"}),f.jsx("strong",{children:"~30%"}),f.jsx(f.Fragment,{children:f.jsx("strong",{children:"⚠️ Warning — charge it soon"})})],[f.jsx("strong",{children:"3.50V"}),f.jsx("strong",{children:"~15%"}),f.jsx(f.Fragment,{children:f.jsx("strong",{children:"🔴 Low — charge it now"})})],[f.jsx("strong",{children:"3.40V"}),f.jsx("strong",{children:"~7%"}),f.jsx(f.Fragment,{children:f.jsx("strong",{children:"⚫ About to die"})})],["3.30V","~3%","Device shutting down"]]}),f.jsxs("p",{children:[f.jsx("strong",{children:"USB-powered nodes"})," report 100% battery even if there's no battery installed. Battery alerts only matter for nodes actually running on battery power."]}),f.jsx(de,{children:"Node Offline Detection"}),f.jsx("p",{children:`MeshAI marks a node as "offline" when it hasn't been heard for a configurable time period. Different node types need different thresholds:`}),f.jsx(Lt,{headers:["Node Type","Recommended Threshold","Why"],rows:[["Fixed infrastructure (wall power)",f.jsx("strong",{children:"2 hours"}),"These should always be transmitting. 2 hours of silence means something is wrong."],["Fixed client (wall power)","2-4 hours","Same logic, slightly more lenient."],["Mobile / vehicle","4-8 hours","They go behind mountains, into garages, out of range. Normal."],["Solar-powered","12-24 hours","May shut down at night when solar stops charging."]]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Rule of thumb"}),`: set the threshold to about 4× the node's beacon interval. Too tight and nodes will constantly flap "offline/online" from normal gaps. Too loose and real outages go unnoticed.`]})]}),f.jsxs(wr,{id:"broadcast-types",title:"Broadcast Types",children:[f.jsx("p",{children:"Every broadcast the bot sends to the mesh carries a one-word prefix that tells you what kind of update it is. Three types:"}),f.jsx(Lt,{headers:["Prefix","What it means","When you see it"],rows:[[f.jsx(le,{children:"New:"}),"The first time the bot has ever broadcast about this event","Cache Peak Fire's WFIGS first-sight; FIRMS cluster's first 3-pixel detection; first NWS warning for a CAP id"],[f.jsx(le,{children:"Update:"}),"A material change on something the bot already announced","Cache Peak Fire's acreage grew; ITD 511 work zone's lane status changed; quake event's magnitude was revised"],[f.jsx(le,{children:"Active:"}),"A clock-driven reminder that an already-announced event is still live","Cache Peak Fire is still burning 8 hours later; an SWPC G3 storm is still in progress"]]}),f.jsx("p",{children:"The bot tracks first-broadcast time and last-broadcast time separately on every event row, so a New: prefix is only emitted once even after a container restart. Update: respects per-adapter cooldowns (WFIGS is 8 h by default; ITD 511 is per-incident). Active: is the reminder system, covered in the next section."})]}),f.jsxs(wr,{id:"reminders",title:"Reminder System",children:[f.jsxs("p",{children:["Some events stay live for days. A wildfire doesn't go out because WFIGS stopped publishing updates; a geomagnetic storm doesn't end because SWPC went quiet on the wire. The reminder system fires a clock-driven"," ",f.jsx(le,{children:"Active:"}),"-prefixed re-broadcast on a human-scale cadence so an operator who came on shift after the original announcement still sees the event."]}),f.jsx(de,{children:"Cadences"}),f.jsx(Lt,{headers:["Adapter","Reminder cadence","Termination"],rows:[[f.jsxs(f.Fragment,{children:[f.jsx(le,{children:"wfigs"})," (wildfires)"]}),"Every 8 h while the fire is still active","WFIGS publishes a tombstone (incident closed) → fires.tombstoned_at is stamped → reminder loop stops"],[f.jsxs(f.Fragment,{children:[f.jsx(le,{children:"swpc"})," (space weather)"]}),"Every 8 h while a Kp >= floor / X-class flare / proton-storm event is ongoing","The next SWPC envelope shows the storm has subsided"],[f.jsx(le,{children:"itd_511_work_zone"}),"Per-zone, configurable in the rule UI","WZDx publishes the zone with end_date in the past"]]}),f.jsx(de,{children:"The tombstone"}),f.jsxs("p",{children:["When a WFIGS update declares an incident closed, the bot stamps"," ",f.jsx(le,{children:"fires.tombstoned_at"})," with the close time. The reminder scheduler treats ",f.jsx(le,{children:"tombstoned_at IS NOT NULL"}),` as "stop broadcasting Active: for this fire," and the LLM context layer treats it as "this fire is in the closed-out archive." A subsequent FIRMS pixel inside that fire's spread radius does not re-open it — closure is authoritative from NIFC.`]}),f.jsx(de,{children:"Turning reminders off"}),f.jsxs("p",{children:["Per-adapter on/off lives in ",f.jsx(le,{children:"adapter_meta.reminder_enabled"})," ","and is exposed on the Adapter Config page. The reminders themselves flow through the same dispatcher gates as everything else, so they still respect cooldowns, the cold-start grace window, and your notification rules."]})]}),f.jsxs(wr,{id:"notifications",title:"Notifications",children:[f.jsx(de,{children:"How It Works"}),f.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx("strong",{children:"Something happens"})," — a fire is detected, weather warning issued, node goes offline, etc."]}),f.jsxs("li",{children:[f.jsx("strong",{children:"MeshAI checks your rules"})," — does this event match any of your notification rules? Is it severe enough?"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"If a rule matches"})," — MeshAI sends the notification through whatever delivery method that rule is configured for."]})]}),f.jsx(de,{children:"Building Rules"}),f.jsx("p",{children:"Each rule answers three questions:"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx("strong",{children:"WHEN"})," does it trigger? (which categories, what severity)"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"WHERE"})," does it send? (mesh broadcast, email, webhook, etc.)"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"HOW OFTEN"})," at most? (cooldown period)"]})]}),f.jsx("p",{children:'Use "Add from Template" to start with a pre-built rule and customize it, or build from scratch with "Add Rule."'}),f.jsx(de,{children:"Severity Levels — What Should I Set?"}),f.jsx(Lt,{headers:["Level","When It's Used","Notification Volume"],rows:[["Info","Routine stuff (ducting detected, new router appeared)","High — lots of messages"],["Advisory","Worth knowing (weather advisory, slow traffic, battery declining)","Moderate"],["Watch","Pay attention (fire within 50km, weather watch, stream rising)","Low-moderate"],[f.jsxs(f.Fragment,{children:[f.jsx("strong",{children:"Warning"})," ✓"]}),"Take action (fire within 15km, severe weather, critical battery)","Low — recommended for most rules"],["Emergency","Life safety (extreme weather, fire at infrastructure, total blackout)","Very rare"]]}),f.jsxs("p",{children:[f.jsx("strong",{children:'"Warning" is the sweet spot for most rules.'})," You get alerted when something actually needs your attention without being overwhelmed by every minor event."]}),f.jsx(de,{children:"Webhook — The Swiss Army Knife"}),f.jsx("p",{children:"A webhook sends your alert as an HTTP POST to any URL. This one delivery method works with:"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx("strong",{children:"Discord"})," — use a Discord webhook URL"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Slack"})," — use a Slack incoming webhook URL"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"ntfy.sh"})," — POST to ",f.jsx(le,{children:"https://ntfy.sh/your-topic"})]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Pushover"})," — POST to the Pushover API"]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Home Assistant"})," — POST to an automation webhook URL"]}),f.jsx("li",{children:"Anything else that accepts HTTP POST"})]}),f.jsx("p",{children:"MeshAI doesn't need to know what's on the other end. Give it the URL and it works."})]}),f.jsxs(wr,{id:"commands",title:"Commands",children:[f.jsxs("p",{children:["All commands use the ",f.jsx(le,{children:"!"})," prefix (configurable). Send these as a direct message to MeshAI on your mesh."]}),f.jsx(de,{children:"Basic Commands"}),f.jsx(Lt,{headers:["Command","What It Does"],rows:[[f.jsx(le,{children:"!help"}),"Shows all available commands"],[f.jsx(le,{children:"!ping"}),"Tests if the bot is alive"],[f.jsx(le,{children:"!status"}),"Quick mesh summary (nodes online, health score)"],[f.jsx(le,{children:"!health"}),"Detailed health report with pillar scores"],[f.jsx(le,{children:"!weather"}),"Current weather for your area"]]}),f.jsx(de,{children:"Environmental Commands"}),f.jsx(Lt,{headers:["Command","What It Does"],rows:[[f.jsx(le,{children:"!alerts"}),"Active NWS weather alerts for your area"],[f.jsxs(f.Fragment,{children:[f.jsx(le,{children:"!solar"})," (or ",f.jsx(le,{children:"!hf"}),")"]}),"Current solar indices and RF conditions"],[f.jsx(le,{children:"!fire"}),"Active wildfires near your mesh"],[f.jsx(le,{children:"!avy"}),'Avalanche advisory (seasonal — shows "off season" in summer)'],[f.jsxs(f.Fragment,{children:[f.jsx(le,{children:"!streams"})," (or ",f.jsx(le,{children:"!gauges"}),")"]}),"Stream gauge readings"],[f.jsxs(f.Fragment,{children:[f.jsx(le,{children:"!roads"})," (or ",f.jsx(le,{children:"!traffic"}),")"]}),"Road conditions and traffic flow"],[f.jsx(le,{children:"!hotspots"}),"Satellite fire detections"]]}),f.jsx(de,{children:"Conversational"}),f.jsxs("p",{children:[`Bang commands are the short, predictable interface. For anything that doesn't map cleanly to a single command — "how's the mesh doing?", "is there any ducting?", "why didn\\'t I hear about anything today?" — you can DM the bot in plain English. The LLM DM path covers the same data the commands cover, plus the dispatcher drop audit, with honest "no data" answers when a feed is quiet. Full catalog under`," ",f.jsx("a",{href:"#llm-dm",className:"text-accent hover:underline",children:"LLM DM Queries"}),"."]})]}),f.jsxs(wr,{id:"llm-dm",title:"LLM DM (Natural-Language Queries)",children:[f.jsxs("p",{children:["Bang commands like ",f.jsx(le,{children:"!fire"})," are short and predictable — the right tool on a mesh-constrained interface. For anything else, you can DM the bot in plain English and it will answer from the same live environmental data the broadcast pipeline uses. Both paths work; pick whichever fits the question."]}),f.jsx(de,{children:"What it can answer"}),f.jsx("p",{children:"When you DM the bot a question, the env_reporter layer assembles up to seven data blocks and injects them into the LLM's system prompt. Each block maps to one adapter:"}),f.jsx(Lt,{headers:["Adapter block","Example question that hits it","What you get back"],rows:[[f.jsx(le,{children:"build_fires_detail"}),'"are there any fires near me?"',"Active WFIGS-declared fires, acreage, containment, declared_at, county/state"],[f.jsx(le,{children:"build_alerts_detail"}),'"any weather alerts?"',"Active NWS CAP alerts: type, severity, area, expiry"],[f.jsx(le,{children:"build_quakes_detail"}),'"any earthquakes nearby?"',"USGS quakes in the last 24h: magnitude, depth, place"],[f.jsx(le,{children:"build_traffic_detail"}),'"how is traffic on I-84?" / "any road closures?"',"TomTom + ITD 511 active incidents"],[f.jsx(le,{children:"build_gauges_detail"}),'"what is the snake river level?"',"USGS NWIS latest readings + flood stages"],[f.jsx(le,{children:"build_swpc_detail"}),'"what are the band conditions?" / "any space weather?"',"Recent SWPC events + band-conditions ratings"],[f.jsx(le,{children:"build_drop_audit"}),`"why didn't I hear about anything today?"`,"Event log: what envelopes the dispatcher filtered, by adapter + category"]]}),f.jsx(de,{children:"The grounding rule"}),f.jsxs("p",{children:["The bot is told to answer ",f.jsx("em",{children:"only"}),' from the blocks in the system prompt. If a block is empty (no recent quakes, no active NWS alerts), the response is honest about it: "No active weather alerts right now," not a fabricated "144 earthquakes worldwide in the past 24 hours." That clamp closes the failure mode where the LLM defaulted to its training data when local tables were quiet.']}),f.jsx(de,{children:"Excluding an adapter from LLM context"}),f.jsxs("p",{children:["The ",f.jsx(le,{children:"include_in_llm_context"})," toggle on each adapter's row in Adapter Config decides whether that adapter's ",f.jsx(le,{children:"build_*"})," ","block lands in the system prompt. Turn an adapter off here if you don't want the bot's natural-language answers to draw on it (e.g. you ingest TomTom for situational awareness but don't want it cited in DM answers). Broadcasts are unaffected — this toggle gates LLM context only."]}),f.jsx(de,{children:"What it can't answer"}),f.jsx("p",{children:`The bot has no general internet access. Questions that need data the env_reporter doesn't carry ("what's the weather forecast tomorrow", "who's the current president") fall back to whatever the configured LLM backend knows from training. The grounding clamp keeps the bot from inventing local data, but it can't keep the LLM from speculating about non-local topics.`})]}),f.jsxs(wr,{id:"or-not-and",title:"OR-not-AND Architecture",children:[f.jsx("p",{children:"Every environmental adapter pulls its data from one of two places:"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx("strong",{children:"Central"})," (canonical) — Central polls the upstream feed once on behalf of the whole fleet and re-publishes normalized envelopes over NATS JetStream. MeshAI subscribes. One Central poll, one canonical normalization, many subscribers."]}),f.jsxs("li",{children:[f.jsx("strong",{children:"Native"})," — MeshAI polls the upstream feed directly. Stays around for adapters Central doesn't carry yet (currently Tropospheric Ducting and Avalanche Center advisories) and for operators who don't run Central."]})]}),f.jsx(de,{children:"Why mutually exclusive"}),f.jsxs("p",{children:["An adapter is set to ",f.jsx("strong",{children:"either"})," Central ",f.jsx("strong",{children:"or"})," ","native, never both. Running both at the same time is what the codebase calls the ",f.jsx("em",{children:"AND-mode anti-pattern"}),": two independent poll loops on the same upstream feed, duplicate broadcasts, duplicate cursor state, no shared dedup. The Spokane-class leak (cross-state broadcasts that escaped the bbox filter in May 2026) was caused by an inadvertent AND-mode on the traffic adapter; the fix made the gate enforce mutual exclusion at boot and on every config save."]}),f.jsx(de,{children:"The per-adapter source toggle"}),f.jsxs("p",{children:["Set ",f.jsx(le,{children:"feed_source"})," on each adapter's row in Environment:"]}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(le,{children:"central"})," — disable the native poll loop, subscribe to the matching Central subject pattern."]}),f.jsxs("li",{children:[f.jsx(le,{children:"native"})," — disable the Central subscription for this adapter, run the native poller."]})]}),f.jsxs("p",{children:["On the GUI, adapters with ",f.jsx("em",{children:"no Central counterpart yet"}),` show their Central button disabled with a "native only" tooltip. That's not an AND state; the adapter is still single-source, just locked to native by upstream availability.`]}),f.jsx(de,{children:"Where this surfaces in tooltips"}),f.jsxs("p",{children:[`You'll see "AND-model anti-pattern" referenced in two places: the USGS-lookup button on Gauge Sites (disabled when the USGS adapter is on Central, because doing a one-off direct USGS poll from the GUI while the runtime is on Central is precisely the AND-mode this rule forbids) and the env_routes 404 response on`," ",f.jsxs(le,{children:["/api/env/usgs/lookup/","{site_id}"]})," in central-feed mode. Both surfaces refuse to fall back to a direct upstream call; the right answer is to enter values manually or source them from Central."]})]}),f.jsxs(wr,{id:"adapter-config",title:"Adapter Config & the CODE Rule",children:[f.jsx("p",{children:"The Adapter Config page is the single hub for ~50 GUI-editable knobs across the 13 adapters that touch the broadcast pipeline. Changes take effect on the next handler call — no container restart needed for most keys."}),f.jsx(de,{children:"The CONFIG-vs-CODE rule"}),f.jsx("p",{children:"Not everything tunable becomes a GUI row. The codebase splits along one rule:"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx("strong",{children:"CONFIG"})," (lives on this page) — where you send (channels), how often (cadences, schedules), thresholds (magnitude floors, severity gates, distance radii, cooldown durations, freshness windows), curation data (which sites, states, codes), toggles (enabled, include_in_llm_context)."]}),f.jsxs("li",{children:[f.jsx("strong",{children:"CODE"})," (stays in the handlers, not on the GUI) — sentence templates, emoji choices, mapping / translation functions (TomTom icon_map, ITD sub_type_map, Central adapter_map and category_map), rendering logic (anchor priority order, expires-buckets formatting, threshold-state labels), heuristic logic (band_conditions Kp/SFI → Good/Fair/Poor function)."]})]}),f.jsx("p",{children:"If you find yourself wanting to add a wire-string template or an emoji to the GUI, stop — that's CODE. If you want to change a threshold or a curation list, the GUI is the right place."}),f.jsx(de,{children:"Restart-required vs live"}),f.jsx("p",{children:"Most keys take effect on the next handler call (the env_store re-reads from the database). A short list requires a container restart, because they govern startup-only wiring:"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:["Anything under the ",f.jsx(le,{children:"environmental"})," section on the Config page (feed_source, central URL, etc.). The Spokane-fix gate runs at env_store boot and at CentralConsumer subscribe — both happen only at startup."]}),f.jsx("li",{children:"The LLM backend swap (Google → Anthropic → OpenAI)."}),f.jsx("li",{children:"The dispatcher cold-start grace window."})]}),f.jsx("p",{children:`When you save one of those keys via the GUI, a yellow Restart-Required banner surfaces at the top of the page with a "Restart now" button. Until you click it, the on-disk config and the running config intentionally disagree — that's the OR-not-AND gate refusing to transition mid-flight.`}),f.jsxs(de,{children:["The ",f.jsx(le,{children:"include_in_llm_context"})," toggle"]}),f.jsxs("p",{children:[`Each adapter's card on Adapter Config carries a per-adapter "LLM context" switch. When off, that adapter's `,f.jsx(le,{children:"build_*"})," ","env_reporter block is skipped during system-prompt assembly. Broadcasts are unaffected; this toggle is purely about what the LLM sees when you DM it. See the LLM DM section above for the seven adapter blocks this gates."]})]}),f.jsxs(wr,{id:"curation",title:"Curation: Gauge Sites & Town Anchors",children:[f.jsx("p",{children:"Two curation tables drive the broadcast text the bot puts on the mesh. Both are CRUD UIs with per-row enable/disable; both fall through to fallback chains when a row is missing or disabled."}),f.jsx(de,{children:"Gauge Sites"}),f.jsx("p",{children:"Stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four NWS-AHPS flood thresholds in feet: Action, Minor, Moderate, Major. The handler compares an incoming gauge reading to those thresholds and emits the right broadcast severity."}),f.jsxs("p",{children:[f.jsx("strong",{children:"USGS lookup button"})," — when you add a new row in native-feed mode, the lookup queries the USGS Site Service plus NWS NWPS to auto-populate name, coordinates, and flood stages. In central-feed mode the button is disabled with a tooltip: a one-off direct USGS poll from the GUI while the runtime is on Central is the AND-mode anti-pattern the architecture forbids. Enter values manually or pull them from Central."]}),f.jsxs("p",{children:[f.jsx("strong",{children:"Disabled rows"})," are ignored at dispatch time. The corresponding gauge still ingests into ",f.jsx(le,{children:"gauge_readings"})," ","(so historical queries still work), it just doesn't broadcast."]}),f.jsx(de,{children:"Town Anchors"}),f.jsxs("p",{children:['Lookup table for the "X mi ',"<","bearing",">"," of ","<","town",">",'" suffix in broadcast text. When a fire or NWS alert renders, the bot walks an anchor chain to figure out where to say it is:']}),f.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[f.jsx("li",{children:'Photon nearest-town lookup (the WFIGS path uses this — produces "near Long Creek Summit Home" style anchors)'}),f.jsx("li",{children:"Town Anchors table (your curated list)"}),f.jsx("li",{children:"Landclass label (county / federal-land identifier)"}),f.jsx("li",{children:"County + state fallback"}),f.jsx("li",{children:"Bare lat/lon coords"})]}),f.jsx("p",{children:'Each row carries a name (lowercased on save), state, lat/lon, and an enable flag. The "lowercased on save" rule keeps "Almo" / "ALMO" / "almo" from being three distinct rows. Disabled rows fall through to the next anchor in the chain — the broadcast text still goes out, it just uses a different anchor.'}),f.jsxs("p",{children:["Example broadcast text rendered from a Town Anchors row:"," ",f.jsx("span",{className:"text-amber-300",children:'"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained, @ 42.118,-113.643"'})]})]}),f.jsxs(wr,{id:"schema",title:"Schema Migrations",children:[f.jsxs("p",{children:["MeshAI persists state in a single SQLite database (",f.jsx(le,{children:"/data/meshai.sqlite"}),") with WAL journaling. Schema migrations live in ",f.jsx(le,{children:"meshai/persistence/migrations/v*.sql"})," ","and apply automatically on container start. The runner reads the migrations directory, sorts by version, and applies anything past the current ",f.jsx(le,{children:"schema_meta.version"})," in order. Idempotent re-runs are no-ops."]}),f.jsx(de,{children:"v0.6 + v0.7 additions"}),f.jsx(Lt,{headers:["Migration","What it added"],rows:[[f.jsx(le,{children:"v11"}),"first_broadcast_at + last_broadcast_at split + reminder_enabled per adapter (the schema basis for New / Update / Active)"],[f.jsx(le,{children:"v12"}),"fires.tombstoned_at (WFIGS closure stamp; terminates the reminder loop)"],[f.jsx(le,{children:"v13"}),"Fire Tracker Phase 1 — fire_pixels table + spread_radius_mi + current_centroid_lat/lon + last_hotspot_at; firms_pixels attributed_at + cluster_broadcast_at"],[f.jsx(le,{children:"v14"}),"Fire Tracker Phase 2 — fire_passes table (per-satellite-pass centroid + drift) + last_pass_id + halt_broadcast_at on fires"],[f.jsx(le,{children:"v15"}),"Fire Tracker Phase 3 — fire_passes.perimeter_geojson (convex hull) + fires.last_spotting_broadcast_at"],[f.jsx(le,{children:"v16"}),"Fire Tracker Phase 4 — fire_digest_broadcasts table (idempotent twice-daily LLM digest)"]]}),f.jsx(de,{children:"When migrations fail"}),f.jsxs("p",{children:["A migration failure leaves the database at the prior version and raises in the runner. Container logs surface the SQL error;"," ",f.jsx(le,{children:"schema_meta.version"})," tells you where the last successful migration stopped. Re-running the container after the underlying issue is fixed picks up from there."]})]}),f.jsxs(wr,{id:"api",title:"API Reference",children:[f.jsxs("p",{children:["MeshAI's REST API is available at ",f.jsx(le,{children:"http://your-host:8080"}),". All endpoints return JSON."]}),f.jsx(de,{children:"System"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/status"})," — version, uptime, node count"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/channels"})," — radio channel list"]}),f.jsxs("li",{children:[f.jsx(le,{children:"POST /api/restart"})," — restart the bot"]})]}),f.jsx(de,{children:"Mesh Data"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/health"})," — health score and pillars"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/nodes"})," — all nodes with positions and telemetry"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/edges"})," — neighbor links with signal quality"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/regions"})," — region summaries"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/sources"})," — data source health"]})]}),f.jsx(de,{children:"Configuration"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/config"})," — full config"]}),f.jsxs("li",{children:[f.jsxs(le,{children:["GET /api/config/","{section}"]})," — one section"]}),f.jsxs("li",{children:[f.jsxs(le,{children:["PUT /api/config/","{section}"]})," — update a section"]})]}),f.jsx(de,{children:"Environmental"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/env/status"})," — per-feed health"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/env/active"})," — all active events"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/env/swpc"})," — solar/geomagnetic data"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/env/ducting"})," — atmospheric profile"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/env/fires"})," — wildfire perimeters"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/env/hotspots"})," — satellite fire detections"]})]}),f.jsx(de,{children:"Alerts"}),f.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/alerts/active"})," — current alerts"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/alerts/history"})," — past alerts"]}),f.jsxs("li",{children:[f.jsx(le,{children:"GET /api/notifications/categories"})," — available alert categories"]})]}),f.jsx(de,{children:"Real-time"}),f.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:f.jsxs("li",{children:[f.jsx(le,{children:"ws://your-host:8080/ws/live"})," — WebSocket for live updates"]})})]})]})})]})}const QT={site_id:"",gauge_name:"",lat:0,lon:0,action_ft:null,flood_minor_ft:null,flood_moderate_ft:null,flood_major_ft:null,enabled:!0,updated_at:0};function M$(){const[e,t]=O.useState([]),[r,n]=O.useState(!0),[a,i]=O.useState(null),[o,s]=O.useState(null),[l,u]=O.useState(QT),[c,h]=O.useState(!1),[d,v]=O.useState("unknown"),g=O.useCallback(async()=>{n(!0),i(null);try{const S=await fetch("/api/gauge-sites");if(!S.ok)throw new Error(`GET: ${S.status}`);t(await S.json())}catch(S){i(String(S))}finally{n(!1)}},[]);O.useEffect(()=>{g()},[g]),O.useEffect(()=>{fetch("/api/config/environmental").then(S=>S.json()).then(S=>{var C;return v(((C=S==null?void 0:S.usgs)==null?void 0:C.feed_source)||"unknown")}).catch(()=>v("unknown"))},[]);const m=S=>{s(S.site_id),u({...S}),h(!1)},y=()=>{h(!0),s(null),u({...QT})},x=()=>{s(null),h(!1),u(QT)},_=async()=>{try{const S=c?"/api/gauge-sites":`/api/gauge-sites/${o}`,M=await fetch(S,{method:c?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!M.ok){const A=await M.json().catch(()=>({}));alert(`save failed: ${A.detail||M.statusText}`);return}x(),g()}catch(S){alert(String(S))}},w=async S=>{if(!confirm(`Delete ${S}?`))return;const C=await fetch(`/api/gauge-sites/${S}`,{method:"DELETE"});if(!C.ok){alert(`delete failed: ${C.status}`);return}g()};return r?f.jsxs("div",{className:"p-6 text-slate-400",children:[f.jsx(jd,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):a?f.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",a]}):f.jsxs("div",{className:"p-6 space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(f1,{className:"w-5 h-5 text-accent"}),f.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Gauge Sites"}),f.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," sites"]}),f.jsxs("button",{onClick:y,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:[f.jsx(Ti,{className:"w-4 h-4"})," Add site"]})]}),f.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:"NWS-AHPS stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four flood thresholds (Action / Minor / Moderate / Major, all in feet). Disabled rows still ingest into gauge_readings -- they don't broadcast. The USGS lookup button auto-populates name + coords + thresholds from USGS Site Service + NWS NWPS when this adapter is on native feed_source; Central-feed mode disables it (see Reference → OR-not-AND for why). Changes take effect on the next event."}),c&&f.jsx(WB,{draft:l,setDraft:u,onSave:_,onCancel:x,adding:!0,feedSource:d}),f.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:f.jsxs("table",{className:"w-full text-sm text-slate-200",children:[f.jsx("thead",{className:"bg-[#161616] border-b border-border",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Site ID"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat,Lon"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Action"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Minor"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Moderate"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Major"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),f.jsx("tbody",{className:"divide-y divide-border",children:e.map(S=>o===S.site_id?f.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:f.jsx("td",{colSpan:9,className:"px-3 py-2",children:f.jsx(WB,{draft:l,setDraft:u,onSave:_,onCancel:x,feedSource:d})})},S.site_id):f.jsxs("tr",{className:"hover:bg-bg-hover",children:[f.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:S.site_id}),f.jsx("td",{className:"px-3 py-2",children:S.gauge_name}),f.jsxs("td",{className:"px-3 py-2 text-right text-xs",children:[S.lat.toFixed(3),",",S.lon.toFixed(3)]}),f.jsx("td",{className:"px-3 py-2 text-right",children:S.action_ft??"-"}),f.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_minor_ft??"-"}),f.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_moderate_ft??"-"}),f.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_major_ft??"-"}),f.jsx("td",{className:"px-3 py-2 text-center",children:S.enabled?f.jsx(Jr,{className:"w-4 h-4 text-emerald-400 inline"}):f.jsx(tu,{className:"w-4 h-4 text-slate-500 inline"})}),f.jsxs("td",{className:"px-3 py-2 text-right",children:[f.jsx("button",{onClick:()=>m(S),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),f.jsx("button",{onClick:()=>w(S.site_id),className:"text-red-400 hover:text-red-300",children:f.jsx(po,{className:"w-4 h-4 inline"})})]})]},S.site_id))})]})})]})}function WB({draft:e,setDraft:t,onSave:r,onCancel:n,adding:a,feedSource:i}){const o=(g,m)=>t({...e,[g]:m}),[s,l]=O.useState(!1),[u,c]=O.useState(null),h=i!=="native"||!e.site_id.trim(),d=i!=="native"?"USGS lookup not available in central-feed mode (would be AND-model anti-pattern). Enter values manually.":e.site_id.trim()?"Auto-populate from USGS / NWS NWPS":"Enter a site_id first",v=async()=>{if(!h){l(!0),c(null);try{const g=e.site_id.replace(/^USGS-/i,""),m=await fetch(`/api/env/usgs/lookup/${encodeURIComponent(g)}`);if(m.status===404){const _=await m.json().catch(()=>({}));c(_.detail||"Lookup unavailable -- enter values manually"),l(!1);return}if(!m.ok){c(`Lookup failed (${m.status})`),l(!1);return}const y=await m.json(),x={...e};y.name&&!x.gauge_name&&(x.gauge_name=y.name),typeof y.lat=="number"&&(x.lat=y.lat),typeof y.lon=="number"&&(x.lon=y.lon),typeof y.action_ft=="number"&&(x.action_ft=y.action_ft),typeof y.flood_minor_ft=="number"&&(x.flood_minor_ft=y.flood_minor_ft),typeof y.flood_moderate_ft=="number"&&(x.flood_moderate_ft=y.flood_moderate_ft),typeof y.flood_major_ft=="number"&&(x.flood_major_ft=y.flood_major_ft),t(x)}catch(g){c(String(g))}finally{l(!1)}}};return f.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[f.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Site ID",f.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[f.jsx("input",{className:"flex-1 bg-bg border border-border px-2 py-1 text-slate-100 font-mono text-xs",value:e.site_id,onChange:g=>o("site_id",g.target.value),disabled:!a}),f.jsxs("button",{type:"button",onClick:v,disabled:h||s,title:d,className:"px-2 py-1 bg-bg-hover hover:bg-[#333] disabled:opacity-30 disabled:cursor-not-allowed text-xs text-slate-100 flex items-center gap-1",children:[s?f.jsx(jd,{className:"w-3 h-3 animate-spin"}):f.jsx(p1,{className:"w-3 h-3"}),"USGS lookup"]})]}),u&&f.jsx("span",{className:"text-amber-400 text-xs mt-1 block",children:u})]}),f.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Gauge name",f.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.gauge_name,onChange:g=>o("gauge_name",g.target.value)})]}),f.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",f.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lat,onChange:g=>o("lat",parseFloat(g.target.value))})]}),f.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",f.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lon,onChange:g=>o("lon",parseFloat(g.target.value))})]}),f.jsxs("label",{className:"text-xs text-slate-400",children:["Action ft",f.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.action_ft??"",onChange:g=>o("action_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),f.jsxs("label",{className:"text-xs text-slate-400",children:["Minor flood ft",f.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_minor_ft??"",onChange:g=>o("flood_minor_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),f.jsxs("label",{className:"text-xs text-slate-400",children:["Moderate flood ft",f.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_moderate_ft??"",onChange:g=>o("flood_moderate_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),f.jsxs("label",{className:"text-xs text-slate-400",children:["Major flood ft",f.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_major_ft??"",onChange:g=>o("flood_major_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),f.jsxs("label",{className:"text-xs text-slate-300 col-span-2 flex items-center gap-2 mt-2",children:[f.jsx("input",{type:"checkbox",checked:e.enabled,onChange:g=>o("enabled",g.target.checked),className:"accent-[#f59e0b]"}),"Enabled"]}),f.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[f.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),f.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:"Save"})]})]})}const e2={anchor_id:0,name:"",lat:0,lon:0,state:"ID",enabled:!0,updated_at:0};function A$(){const[e,t]=O.useState([]),[r,n]=O.useState(!0),[a,i]=O.useState(null),[o,s]=O.useState(null),[l,u]=O.useState(!1),[c,h]=O.useState(e2),d=O.useCallback(async()=>{n(!0),i(null);try{const _=await fetch("/api/town-anchors");if(!_.ok)throw new Error(`GET: ${_.status}`);t(await _.json())}catch(_){i(String(_))}finally{n(!1)}},[]);O.useEffect(()=>{d()},[d]);const v=_=>{s(_.anchor_id),h({..._}),u(!1)},g=()=>{u(!0),s(null),h({...e2})},m=()=>{s(null),u(!1),h(e2)},y=async()=>{const _=l?"/api/town-anchors":`/api/town-anchors/${o}`,S=await fetch(_,{method:l?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const C=await S.json().catch(()=>({}));alert(`save failed: ${C.detail||S.statusText}`);return}m(),d()},x=async _=>{if(!confirm(`Delete anchor ${_}?`))return;const w=await fetch(`/api/town-anchors/${_}`,{method:"DELETE"});if(!w.ok){alert(`delete failed: ${w.status}`);return}d()};return r?f.jsxs("div",{className:"p-6 text-slate-400",children:[f.jsx(jd,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):a?f.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",a]}):f.jsxs("div",{className:"p-6 space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Rd,{className:"w-5 h-5 text-accent"}),f.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Town Anchors"}),f.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," towns"]}),f.jsxs("button",{onClick:g,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:[f.jsx(Ti,{className:"w-4 h-4"})," Add town"]})]}),f.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:`Lookup table for the "X mi of " suffix in the bot's broadcast text. When a fire or NWS alert renders, the bot walks: Photon nearest-town → this table → landclass → county/state → bare coords. Disabled rows fall through to the next anchor in the chain; the broadcast still goes out, it just uses a different anchor. Example: "3 mi N of Almo". See Reference → Curation: Gauges & Towns for the full chain.`}),l&&f.jsx(ZB,{draft:c,setDraft:h,onSave:y,onCancel:m,adding:!0}),f.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:f.jsxs("table",{className:"w-full text-sm text-slate-200",children:[f.jsx("thead",{className:"bg-[#161616] border-b border-border",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lon"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"State"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),f.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),f.jsx("tbody",{className:"divide-y divide-border",children:e.map(_=>o===_.anchor_id?f.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:f.jsx("td",{colSpan:6,className:"px-3 py-2",children:f.jsx(ZB,{draft:c,setDraft:h,onSave:y,onCancel:m})})},_.anchor_id):f.jsxs("tr",{className:"hover:bg-bg-hover",children:[f.jsx("td",{className:"px-3 py-2 capitalize",children:_.name}),f.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lat.toFixed(4)}),f.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lon.toFixed(4)}),f.jsx("td",{className:"px-3 py-2 text-center text-xs",children:_.state||"-"}),f.jsx("td",{className:"px-3 py-2 text-center",children:_.enabled?f.jsx(Jr,{className:"w-4 h-4 text-emerald-400 inline"}):f.jsx(tu,{className:"w-4 h-4 text-slate-500 inline"})}),f.jsxs("td",{className:"px-3 py-2 text-right",children:[f.jsx("button",{onClick:()=>v(_),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),f.jsx("button",{onClick:()=>x(_.anchor_id),className:"text-red-400 hover:text-red-300",children:f.jsx(po,{className:"w-4 h-4 inline"})})]})]},_.anchor_id))})]})})]})}function ZB({draft:e,setDraft:t,onSave:r,onCancel:n,adding:a}){const i=(o,s)=>t({...e,[o]:s});return f.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[f.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Name (lowercased on save)",f.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.name,onChange:o=>i("name",o.target.value),disabled:!a})]}),f.jsxs("label",{className:"text-xs text-slate-400",children:["State",f.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.state??"",onChange:o=>i("state",o.target.value)})]}),f.jsxs("label",{className:"text-xs text-slate-400 flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:e.enabled,onChange:o=>i("enabled",o.target.checked),className:"accent-[#f59e0b] mt-4"}),"Enabled"]}),f.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",f.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lat,onChange:o=>i("lat",parseFloat(o.target.value))})]}),f.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",f.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lon,onChange:o=>i("lon",parseFloat(o.target.value))})]}),f.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[f.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),f.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:"Save"})]})]})}function RCe(e,t,r){const n=e?{...e}:{...t,name:r};n.name=n.name||r;const a=(e==null?void 0:e.severity_channels)||{},i=t.severity_channels||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};return o.forEach(l=>{const u=(a[l]||[]).filter(h=>!h.startsWith("meshcore_")),c=(i[l]||[]).filter(h=>h.startsWith("meshcore_"));s[l]=[...u,...c]}),n.severity_channels=s,n.meshcore_channel=t.meshcore_channel??null,n.meshcore_dm_contacts=t.meshcore_dm_contacts||[],n}function OCe(e,t){const r=(t==null?void 0:t.enabled)??(e==null?void 0:e.enabled)??!1,n=(e==null?void 0:e.cells)||{},a=(t==null?void 0:t.cells)||{},i=new Set([...Object.keys(n),...Object.keys(a)]),o={};for(const s of i){const l=n[s]||{},u=a[s]||{},c=new Set([...Object.keys(l),...Object.keys(u)]),h={};for(const d of c){const v=l[d],g=u[d],m=g!==void 0?g.mc||null:(v==null?void 0:v.mc)??null,y={mt:(v==null?void 0:v.mt)??null,mc:m,min_severity:(g==null?void 0:g.min_severity)??(v==null?void 0:v.min_severity)??"routine",enabled:(g==null?void 0:g.enabled)??(v==null?void 0:v.enabled)??!0},x=y.mc;(y.mt!==null||x!==null&&x.trim()!=="")&&(h[d]=y)}Object.keys(h).length>0&&(o[s]=h)}return{enabled:r,cells:o}}function zCe(){const{setDirty:e}=Ri(),[t,r]=O.useState(null),[n,a]=O.useState(null),[i,o]=O.useState([]),[s,l]=O.useState(!0),[u,c]=O.useState(!1),[h,d]=O.useState(null),[v,g]=O.useState(null),[m,y]=O.useState(!1),[x,_]=O.useState({}),w=O.useCallback(async()=>{try{const[P,D]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/regions")]);if(!P.ok)throw new Error("Failed to fetch notifications config");const z=await P.json(),E=D.ok?await D.json():[];r(z),a(JSON.parse(JSON.stringify(z))),o(Array.isArray(E)?E:[]),y(!1),d(null)}catch(P){d(P instanceof Error?P.message:"Unknown error")}finally{l(!1)}},[]);O.useEffect(()=>{document.title="MeshCore Routing - MeshAI",w()},[w]),O.useEffect(()=>{t&&n&&y(JSON.stringify(t)!==JSON.stringify(n))},[t,n]),O.useEffect(()=>(e(m),()=>e(!1)),[m,e]);const S=(P,D)=>{if(!t)return;const z=t.toggles||{};r({...t,toggles:{...z,[P]:{...z[P]||{},name:P,...D}}})},C=(P,D,z)=>{var H,V,U,F,Z,$,W;if(!t)return;const E=((U=(V=(H=t.region_routes)==null?void 0:H.cells)==null?void 0:V[P])==null?void 0:U[D])??{mt:null,mc:null,min_severity:"routine",enabled:!0},B={...((F=t.region_routes)==null?void 0:F.cells)||{},[P]:{...(($=(Z=t.region_routes)==null?void 0:Z.cells)==null?void 0:$[P])||{},[D]:{...E,mc:z}}};r({...t,region_routes:{enabled:((W=t.region_routes)==null?void 0:W.enabled)??!1,cells:B}})},M=P=>{var B,H,V,U;if(!t)return;const D=((H=(B=t.region_routes)==null?void 0:B.cells)==null?void 0:H[P])||{},z={};for(const[F,Z]of Object.entries(D))z[F]={...Z,mc:null};const E={...((V=t.region_routes)==null?void 0:V.cells)||{},[P]:z};r({...t,region_routes:{enabled:((U=t.region_routes)==null?void 0:U.enabled)??!1,cells:E}})},A=async()=>{if(t){c(!0),d(null),g(null);try{const P=await fetch("/api/config/notifications");if(!P.ok)throw new Error("Failed to re-fetch notifications config");const D=await P.json(),z={...D,toggles:{...D.toggles||{}},region_routes:OCe(D.region_routes,t.region_routes)},E=t.toggles||{};for(const{key:V}of Yl){const U=E[V];U&&(z.toggles[V]=RCe((D.toggles||{})[V],U,V))}const B=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)}),H=await B.json();if(!B.ok)throw new Error(H.detail||"Save failed");r(z),a(JSON.parse(JSON.stringify(z))),y(!1),e(!1),g("MeshCore routing saved successfully"),setTimeout(()=>g(null),3e3)}catch(P){d(P instanceof Error?P.message:"Save failed")}finally{c(!1)}}},I=()=>{n&&(r(JSON.parse(JSON.stringify(n))),y(!1))};if(s)return f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-slate-400",children:"Loading MeshCore routing..."})});if(!t)return f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})});const k=t.toggles||{};return f.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{children:f.jsx("p",{className:"text-sm text-slate-500",children:"Per-family MeshCore delivery. Choose which channels fire at each severity, the MeshCore channel name, and DM contacts."})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:w,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:f.jsx(zo,{size:18})}),f.jsxs("button",{onClick:I,disabled:!m,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[f.jsx(oa,{size:16}),"Discard"]}),f.jsxs("button",{onClick:A,disabled:u||!m,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[f.jsx(sa,{size:16}),u?"Saving...":"Save"]})]})]}),f.jsxs("div",{className:"flex items-start gap-2 p-3 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-400",children:[f.jsx(kc,{size:16,className:"text-accent mt-0.5 flex-shrink-0"}),f.jsxs("div",{children:["Family gating (enable, severity threshold, freshness/cooldown) is on"," ",f.jsx(Vf,{to:"/environment",className:"text-accent hover:underline",children:"Data Feeds"}),". Meshtastic delivery is on"," ",f.jsx(Vf,{to:"/notifications",className:"text-accent hover:underline",children:"Meshtastic Routing"}),". This page edits only the MeshCore delivery for each family."]})]}),h&&f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:h}),v&&f.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[f.jsx(Jr,{size:14,className:"inline mr-2"}),v]}),f.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[f.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["MeshCore Delivery",f.jsx(ji,{info:"For each notification family, choose which MeshCore channels fire at each severity, the MeshCore channel name to broadcast on, and the DM contacts to unicast to. Enabling a family and its severity threshold are configured on the Data Feeds page."})]}),f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Yl.map(({key:P,label:D,Icon:z})=>{var F,Z;const E=k[P]||{},B=((Z=(F=t.region_routes)==null?void 0:F.cells)==null?void 0:Z[P])||{},H=i.some($=>{var q;const W=(q=B[$])==null?void 0:q.mc;return W!=null&&W.trim()!==""}),V=x[P],U=V!==void 0?V:H;return f.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-3",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-200",children:[f.jsx(z,{size:15})," ",D]}),f.jsxs("div",{className:"space-y-3 p-3 bg-[#0a0e17] border border-[#1e2a3a]",children:[f.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-300",children:[f.jsx(xk,{size:13}),"MeshCore"]}),f.jsx(b$,{channels:uCe,severityChannels:E.severity_channels||{},onChange:$=>S(P,{severity_channels:$})}),f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"MeshCore channel name"}),f.jsx("input",{type:"text",value:E.meshcore_channel!=null?E.meshcore_channel:"",onChange:$=>S(P,{meshcore_channel:$.target.value===""?null:$.target.value}),placeholder:"AIDA",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),f.jsx("p",{className:"text-xs text-slate-600",children:"Channel name on your MeshCore companion (e.g. AIDA). Blank = not broadcast on MeshCore."})]}),f.jsx(_$,{label:"MeshCore DM contacts",value:E.meshcore_dm_contacts||[],onChange:$=>S(P,{meshcore_dm_contacts:$}),placeholder:"contact name or pubkey",helper:"MeshCore DM recipients (names or pubkeys)",info:"Contact names or pubkeys on the MeshCore companion. Used when meshcore_dm is enabled for a severity."})]}),f.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[f.jsx(kd,{label:"Region-based routing",checked:U,onChange:$=>{_(W=>({...W,[P]:$})),$||M(P)},helper:"Route this family to different MC channels per region"}),U&&(i.length===0?f.jsxs("p",{className:"text-xs text-slate-500 italic",children:["No regions yet — add them on the"," ",f.jsx(Vf,{to:"/coverage",className:"text-accent hover:underline",children:"Coverage"})," page."]}):f.jsx("div",{className:"space-y-1.5 pt-1",children:i.map($=>{const W=B[$]??{mc:null};return f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-xs text-slate-400 flex-1 min-w-0 truncate",children:$}),f.jsx("input",{type:"text",value:W.mc??"",onChange:q=>{const re=q.target.value;C(P,$,re===""?null:re)},placeholder:"channel",className:"w-28 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono focus:outline-none focus:border-accent"})]},$)})}))]})]},P)})})]})]})}function BCe(){const{setDirty:e}=Ri(),[t,r]=O.useState(null),[n,a]=O.useState(null),[i,o]=O.useState(null),[s,l]=O.useState(null),[u,c]=O.useState(!0),[h,d]=O.useState(!1),[v,g]=O.useState(null),[m,y]=O.useState(null),[x,_]=O.useState(!1),[w,S]=O.useState(!1),[C,M]=O.useState([]),[A,I]=O.useState(""),[k,P]=O.useState(""),[D,z]=O.useState(!1),[E,B]=O.useState(null),H=O.useCallback(async()=>{c(!0);try{const[W,q]=await Promise.all([go("connection"),go("meshcore_context")]);r(W),a(JSON.parse(JSON.stringify(W))),o(q),l(JSON.parse(JSON.stringify(q))),_(!1),g(null)}catch(W){g(W instanceof Error?W.message:"Unknown error")}finally{c(!1)}},[]);O.useEffect(()=>{document.title="MeshCore Connection - MeshAI",H()},[H]),O.useEffect(()=>{zV().then(W=>{S(W.active),M(W.channels),W.channels.length>0&&I(W.channels[0])}).catch(()=>{S(!1)})},[]);const V=async()=>{z(!0),B(null);try{const W=await BV({transport:"meshcore",channel:A,text:k.trim()||void 0});B(W)}catch(W){B({sent:!1,detail:W instanceof Error?W.message:"Send failed"})}finally{z(!1)}};O.useEffect(()=>{if(t&&n&&i&&s){const W=JSON.stringify(t)!==JSON.stringify(n)||JSON.stringify(i)!==JSON.stringify(s);_(W)}},[t,n,i,s]),O.useEffect(()=>(e(x),()=>e(!1)),[x,e]);const U=W=>r(q=>q&&{...q,...W}),F=async()=>{if(!(!t||!i)){d(!0),g(null),y(null);try{const W=await Promise.all([Mi("connection",t),Mi("meshcore_context",i)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),_(!1),e(!1),y("MeshCore connection saved successfully"),W.some(q=>q.restart_required)&&ru([]),setTimeout(()=>y(null),3e3)}catch(W){g(W instanceof Error?W.message:"Save failed")}finally{d(!1)}}},Z=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),_(!1)},$=W=>{o(q=>{if(!q)return q;const re=q.observe_channels??[],Q=re.includes(W)?re.filter(se=>se!==W):[...re,W];return{...q,observe_channels:Q}})};return u?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-slate-400",children:"Loading MeshCore connection..."})}):t?f.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{children:f.jsx("p",{className:"text-sm text-slate-500",children:"MeshCore node connection."})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:H,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:f.jsx(zo,{size:18})}),f.jsxs("button",{onClick:Z,disabled:!x,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[f.jsx(oa,{size:16}),"Discard"]}),f.jsxs("button",{onClick:F,disabled:h||!x,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[f.jsx(sa,{size:16}),h?"Saving...":"Save"]})]})]}),v&&f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:v}),m&&f.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[f.jsx(Jr,{size:14,className:"inline mr-2"}),m]}),f.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[f.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"MeshCore Connection"}),f.jsx("p",{className:"text-xs text-slate-500",children:"Choose how MeshAI reaches your MeshCore node. TCP talks to a companion frame server; Serial connects to a USB-attached node; BLE pairs over Bluetooth. Meshtastic is always active."}),f.jsx(on,{label:"Connection Type",value:t.meshcore_conn_type??"tcp",onChange:W=>U({meshcore_conn_type:W}),options:[{value:"tcp",label:"TCP (companion)"},{value:"serial",label:"Serial (USB)"},{value:"ble",label:"BLE"}],helper:"TCP for a companion frame server, Serial for a USB node, BLE for Bluetooth"}),(t.meshcore_conn_type??"tcp")==="tcp"&&f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(it,{label:"MeshCore Host",value:t.meshcore_host??"",onChange:W=>U({meshcore_host:W}),placeholder:"192.168.1.100",helper:"IP or hostname of the companion frame server",info:"The MeshCore companion (frame server) host. Active when non-empty in TCP mode."}),f.jsx(Se,{label:"MeshCore Port",value:t.meshcore_port??5525,onChange:W=>U({meshcore_port:W}),min:1,max:65535,helper:"MeshCore TCP port (default 5525)"})]}),(t.meshcore_conn_type??"tcp")==="serial"&&f.jsxs(f.Fragment,{children:[f.jsx(y$,{label:"MeshCore Serial Port",value:t.meshcore_serial_port??"",onChange:W=>U({meshcore_serial_port:W}),helper:"USB-attached MeshCore node — Detect fills a stable by-id path"}),f.jsx(Se,{label:"Baud Rate",value:t.meshcore_baud??115200,onChange:W=>U({meshcore_baud:W}),min:1200,helper:"Serial baud rate (default 115200)"})]}),(t.meshcore_conn_type??"tcp")==="ble"&&f.jsx(it,{label:"BLE Address",value:t.meshcore_ble_address??"",onChange:W=>U({meshcore_ble_address:W}),placeholder:"AA:BB:CC:DD:EE:FF",helper:"Leave blank to scan/pair the first available device"}),f.jsx("div",{className:"pt-2",children:f.jsx(Vf,{to:"/meshtastic/connection",className:"inline-flex items-center gap-1 text-xs text-slate-500 hover:text-accent transition-colors",children:"→ Meshtastic connection"})}),f.jsx(Bt,{label:"Auto-add contacts (AIDA adds any node it hears — required to DM anyone)",checked:t.meshcore_auto_add_contacts??!0,onChange:W=>U({meshcore_auto_add_contacts:W}),helper:"Enables firmware CMD 58 (set_autoadd_config) at connect so AIDA automatically adds every node it hears an advert from as a contact, enabling DM send/decrypt without manual contact exchange"}),f.jsxs("details",{className:"group",children:[f.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[f.jsx(nh,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced — MeshCore Reconnect"]}),f.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[f.jsx(Bt,{label:"Auto-reconnect (MeshCore)",checked:t.meshcore_auto_reconnect??!0,onChange:W=>U({meshcore_auto_reconnect:W}),helper:"Automatically reconnect to the MeshCore companion if the link drops"}),f.jsx(Se,{label:"Max Reconnect Attempts",value:t.meshcore_max_reconnect_attempts??5,onChange:W=>U({meshcore_max_reconnect_attempts:W}),min:0,helper:"Maximum reconnect attempts before giving up (0 = unlimited)"})]})]})]}),i&&f.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[f.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Bot behavior"}),f.jsx(Bt,{label:"Enable Passive Context",checked:!!i.enable_passive_context,onChange:W=>o({...i,enable_passive_context:W}),helper:"Listen to MeshCore channel traffic for context",info:"When enabled, the bot monitors MeshCore channels and includes recent messages in its context so it can reference what others said."}),f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:"Observe MeshCore Channels"}),f.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[C.map(W=>{const q=(i.observe_channels??[]).includes(W);return f.jsxs("label",{onClick:()=>$(W),className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17] cursor-pointer",children:[f.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${q?"bg-accent border-accent":"border-slate-600"}`,children:q&&f.jsx(Jr,{size:12,className:"text-white"})}),f.jsx("span",{className:"text-sm text-slate-200",children:W})]},W)}),C.length===0&&f.jsxs("div",{className:"text-sm text-slate-500 p-2",children:["No channels available",w?"":" (MeshCore not connected)"]})]}),f.jsx("p",{className:"text-xs text-slate-600",children:"Choose which MeshCore channels feed MeshAI's context. Empty = none are watched — pick channels to include their chatter in what the bot knows about the mesh. Leave busy/public channels out to keep them out of context."})]}),f.jsx(En,{label:"Ignore MeshCore Contacts",value:i.ignore_contacts??[],onChange:W=>o({...i,ignore_contacts:W}),helper:"Contact names or pubkey prefixes to exclude from context (comma-separated)",info:"Messages from these MeshCore contacts won't be included in passive context. Enter contact names or public-key prefixes."}),f.jsx(Bt,{label:"Answer direct messages",checked:!!i.respond_to_dms,onChange:W=>o({...i,respond_to_dms:W}),helper:"When on, MeshAI replies to MeshCore direct messages using the LLM. Applies to MeshCore only."})]}),f.jsxs("div",{className:`bg-bg-card border border-border p-6 space-y-4${w?"":" opacity-60"}`,children:[f.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Send Test Message"}),w?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Channel"}),f.jsx("select",{value:A,onChange:W=>I(W.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:C.map(W=>f.jsx("option",{value:W,children:W},W))})]}),f.jsx(it,{label:"Message (optional)",value:k,onChange:P,placeholder:`🧪 MeshAI test — ${new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}),f.jsx("button",{onClick:V,disabled:D,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white text-sm transition-colors",children:D?"Sending...":"Send test"}),E&&(E.sent?f.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[f.jsx(Jr,{size:14,className:"inline mr-2"}),E.detail]}):f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:E.detail}))]}):f.jsx("p",{className:"text-sm text-slate-500",children:"MeshCore not connected"})]})]}):f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-red-400",children:"Failed to load connection config"})})}function FCe(e){const t=Math.floor(Date.now()/1e3-e);if(t<5)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function N$(){const[e,t]=O.useState(null),[r,n]=O.useState(null),[a,i]=O.useState(!0),[o,s]=O.useState(null),[l,u]=O.useState(!1),[c,h]=O.useState(null),[d,v]=O.useState(3),[g,m]=O.useState(!1),[y,x]=O.useState(!1);O.useEffect(()=>{document.title="Companion & Channels - MeshAI"},[]),O.useEffect(()=>{let M=!1;return(async()=>{i(!0),s(null);try{const[A,I]=await Promise.all([OE(),zV()]);if(M)return;t(A),n(I)}catch(A){if(M)return;s(A instanceof Error?A.message:"Failed to load companion status")}finally{M||i(!1)}})(),()=>{M=!0}},[]),O.useEffect(()=>{(async()=>{try{const M=await fetch("/api/config/connection");if(M.ok){const I=(await M.json()).meshcore_advert_interval_seconds;typeof I=="number"&&v(I>0?I/3600:0)}}catch{}})()},[]);const _=O.useCallback(async()=>{u(!0),h(null);try{const M=await kJ();if(h(M),M.sent)try{const A=await OE();t(A)}catch{}}catch(M){h({sent:!1,detail:M instanceof Error?M.message:"Request failed"})}finally{u(!1)}},[]),w=O.useCallback(async()=>{m(!0),x(!1);try{const M=Math.round(d*3600);await Mi("connection",{meshcore_advert_interval_seconds:M}),x(!0),setTimeout(()=>x(!1),2e3)}catch{}finally{m(!1)}},[d]),S=(e==null?void 0:e.connected)===!0,C=r!=null&&r.active?r.channels:[];return f.jsxs("div",{className:"max-w-3xl mx-auto space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:f.jsx(gk,{size:24,className:"text-accent"})}),f.jsxs("div",{children:[f.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"Companion & Channels"}),f.jsx("p",{className:"text-sm text-[#777]",children:"Live status for the AIDA MeshCore companion and its joined channels."})]})]}),a?f.jsx("div",{className:"flex items-center justify-center h-32",children:f.jsx("div",{className:"text-slate-400",children:"Loading..."})}):o?f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:o}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"bg-bg-card border border-border p-6",children:S?f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-green-500"}),f.jsx("span",{className:"text-sm font-medium text-green-400",children:"Connected"})]}),f.jsxs("dl",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-4 text-sm",children:[f.jsxs("div",{children:[f.jsx("dt",{className:"text-[#777] mb-1",children:"Node name"}),f.jsx("dd",{className:"text-slate-100",children:(e==null?void 0:e.name)??"unnamed"})]}),f.jsxs("div",{children:[f.jsx("dt",{className:"text-[#777] mb-1",children:"Host"}),f.jsxs("dd",{className:"text-slate-100 font-mono",children:[(e==null?void 0:e.host)??"—",(e==null?void 0:e.port)!=null?`:${e.port}`:""]})]}),f.jsxs("div",{className:"sm:col-span-2",children:[f.jsx("dt",{className:"text-[#777] mb-1",children:"Public key"}),f.jsx("dd",{className:"text-slate-100 font-mono text-xs break-all",children:(e==null?void 0:e.pubkey)??"—"})]}),f.jsxs("div",{children:[f.jsx("dt",{className:"text-[#777] mb-1",children:"Channels joined"}),f.jsx("dd",{className:"text-slate-100",children:(e==null?void 0:e.channel_count)??0})]}),(e==null?void 0:e.last_advert_sent)!=null&&f.jsxs("div",{children:[f.jsx("dt",{className:"text-[#777] mb-1",children:"Last advertised"}),f.jsx("dd",{className:"text-slate-100",children:FCe(e.last_advert_sent)})]})]}),f.jsxs("div",{className:"pt-2 border-t border-border space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("button",{onClick:_,disabled:l,className:"flex items-center gap-2 px-3 py-1.5 text-sm bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[f.jsx(oi,{size:14}),l?"Sending…":"Send Advert"]}),c!=null&&f.jsx("span",{className:`text-sm ${c.sent?"text-green-400":"text-red-400"}`,children:c.sent?"Advert sent":c.detail})]}),f.jsx("p",{className:"text-xs text-[#555]",children:"Announce this node to the mesh so others can discover and DM it."})]})]}):f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-slate-600"}),f.jsx("span",{className:"text-sm font-medium text-slate-400",children:"Not connected"})]}),f.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"The MeshCore companion is offline or inactive. No node identity or channel membership is available while the companion is disconnected."})]})}),f.jsxs("div",{className:"bg-bg-card border border-border",children:[f.jsx("div",{className:"px-4 py-3 border-b border-border",children:f.jsx("h3",{className:"text-sm font-medium text-slate-200",children:"Advertising"})}),f.jsx("div",{className:"px-4 py-4 space-y-4",children:f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"text-xs font-medium text-[#777] uppercase tracking-wide",children:"Auto-advert interval"}),f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("select",{value:d,onChange:M=>v(Number(M.target.value)),className:"bg-[#0a0e17] border border-[#1e2a3a] text-slate-200 text-sm rounded px-2 py-1.5 focus:outline-none focus:border-accent",children:[f.jsx("option",{value:0,children:"Disabled"}),f.jsx("option",{value:1,children:"Every 1 hour"}),f.jsx("option",{value:3,children:"Every 3 hours (default)"}),f.jsx("option",{value:6,children:"Every 6 hours"}),f.jsx("option",{value:12,children:"Every 12 hours"}),f.jsx("option",{value:24,children:"Every 24 hours"})]}),f.jsx("button",{onClick:w,disabled:g,className:"px-3 py-1.5 text-sm bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded disabled:opacity-50 transition-colors",children:g?"Saving…":y?"Saved":"Save"})]}),f.jsxs("p",{className:"text-xs text-[#555]",children:["AIDA sends a flood advertisement at this interval so it stays discoverable. Stored in ",f.jsx("code",{className:"text-accent/80",children:"connection.meshcore_advert_interval_seconds"}),"."]})]})})]}),f.jsxs("div",{className:"bg-bg-card border border-border",children:[f.jsx("div",{className:"px-4 py-3 border-b border-border",children:f.jsx("h3",{className:"text-sm font-medium text-slate-200",children:"Channels"})}),C.length>0?f.jsx("ul",{className:"divide-y divide-border",children:C.map(M=>f.jsx("li",{className:"px-4 py-2.5 text-sm text-slate-200 font-mono",children:M},M))}):f.jsx("div",{className:"px-4 py-3 text-sm text-[#777]",children:"No channels"})]})]})]})}function VCe(){const{setDirty:e}=Ri(),[t,r]=O.useState(null),[n,a]=O.useState(null),[i,o]=O.useState(null),[s,l]=O.useState(null),[u,c]=O.useState(null),[h,d]=O.useState(null),[v,g]=O.useState(!0),[m,y]=O.useState(!1),[x,_]=O.useState(null),[w,S]=O.useState(null),[C,M]=O.useState(!1),[A,I]=O.useState(0),[k,P]=O.useState(""),[D,z]=O.useState(!1),[E,B]=O.useState(null),H=async()=>{z(!0),B(null);try{const Z=await BV({transport:"meshtastic",channel:A,text:k.trim()||void 0});B(Z)}catch(Z){B({sent:!1,detail:Z instanceof Error?Z.message:"Send failed"})}finally{z(!1)}},V=O.useCallback(async()=>{g(!0);try{const[Z,$,W]=await Promise.all([go("connection"),go("context"),go("bot")]);r(Z),a(JSON.parse(JSON.stringify(Z))),o($),l(JSON.parse(JSON.stringify($))),c(W),d(JSON.parse(JSON.stringify(W))),M(!1),_(null)}catch(Z){_(Z instanceof Error?Z.message:"Unknown error")}finally{g(!1)}},[]);O.useEffect(()=>{document.title="Meshtastic Connection - MeshAI",V()},[V]),O.useEffect(()=>{if(t&&n&&i&&s&&u&&h){const Z=JSON.stringify(t)!==JSON.stringify(n)||JSON.stringify(i)!==JSON.stringify(s)||JSON.stringify(u)!==JSON.stringify(h);M(Z)}},[t,n,i,s,u,h]),O.useEffect(()=>(e(C),()=>e(!1)),[C,e]);const U=async()=>{if(!(!t||!i||!u)){y(!0),_(null),S(null);try{const Z=await Promise.all([Mi("connection",t),Mi("context",i),Mi("bot",u)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),d(JSON.parse(JSON.stringify(u))),M(!1),e(!1),S("Meshtastic connection saved successfully"),Z.some($=>$.restart_required)&&ru([]),setTimeout(()=>S(null),3e3)}catch(Z){_(Z instanceof Error?Z.message:"Save failed")}finally{y(!1)}}},F=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),h&&c(JSON.parse(JSON.stringify(h))),M(!1)};return v?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-slate-400",children:"Loading Meshtastic connection..."})}):t?f.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{children:f.jsx("p",{className:"text-sm text-slate-500",children:"Connection to your Meshtastic radio (serial or TCP)."})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:V,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:f.jsx(zo,{size:18})}),f.jsxs("button",{onClick:F,disabled:!C,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[f.jsx(oa,{size:16}),"Discard"]}),f.jsxs("button",{onClick:U,disabled:m||!C,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[f.jsx(sa,{size:16}),m?"Saving...":"Save"]})]})]}),x&&f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:x}),w&&f.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[f.jsx(Jr,{size:14,className:"inline mr-2"}),w]}),f.jsx("div",{className:"bg-bg-card border border-border p-6",children:f.jsx($Se,{data:t,onChange:r})}),f.jsx("div",{className:"bg-bg-card border border-border p-6",children:f.jsxs("details",{className:"group",children:[f.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[f.jsx(nh,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced — Reconnect & Packet Tuning"]}),f.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[f.jsx(Bt,{label:"Auto-reconnect",checked:t.reconnect??!0,onChange:Z=>r({...t,reconnect:Z}),helper:"Automatically reconnect if the mesh link drops"}),f.jsx(Se,{label:"Reconnect Initial Delay (s)",value:t.reconnect_initial_delay??2,onChange:Z=>r({...t,reconnect_initial_delay:Z}),min:0,step:.5,helper:"Backoff delay before the first reconnect attempt"}),f.jsx(Se,{label:"Reconnect Max Delay (s)",value:t.reconnect_max_delay??60,onChange:Z=>r({...t,reconnect_max_delay:Z}),min:0,helper:"Ceiling for exponential reconnect backoff"}),f.jsx(Se,{label:"Reconnect Health Interval (s)",value:t.reconnect_health_interval??30,onChange:Z=>r({...t,reconnect_health_interval:Z}),min:1,helper:"How often the socket-probe watchdog checks link health"}),f.jsx(Se,{label:"Mesh Max Chars",value:t.mesh_max_chars??140,onChange:Z=>r({...t,mesh_max_chars:Z}),min:1,helper:"Per-packet character budget for the transport"})]})]})}),i&&u&&f.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[f.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Bot behavior"}),f.jsx(Bt,{label:"Enable Passive Context",checked:!!i.enabled,onChange:Z=>o({...i,enabled:Z}),helper:"Listen to channel traffic for context",info:"When enabled, the bot monitors mesh channels and includes recent messages in its context. This lets the bot reference things other people said on the channel."}),f.jsx(LP,{label:"Observe Channels",value:i.observe_channels??[],onChange:Z=>o({...i,observe_channels:Z}),helper:"Channels to monitor (empty = all)",info:"Meshtastic channels to listen on. Leave empty to monitor all channels.",mode:"multi"}),f.jsx(kP,{label:"Ignore Nodes",value:i.ignore_nodes??[],onChange:Z=>o({...i,ignore_nodes:Z}),helper:"Nodes to exclude from context",info:"Messages from these nodes won't be included in passive context. Useful for filtering out noisy automated nodes."}),f.jsx(Bt,{label:"Answer direct messages",checked:!!u.respond_to_dms,onChange:Z=>c({...u,respond_to_dms:Z}),helper:"When on, MeshAI replies to Meshtastic direct messages using the LLM. Applies to Meshtastic only."})]}),f.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[f.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Send Test Message"}),f.jsx(Se,{label:"Channel Index",value:A,onChange:I,min:0,max:7,helper:"Meshtastic channel number (0 = primary)"}),f.jsx(it,{label:"Message (optional)",value:k,onChange:P,placeholder:`🧪 MeshAI test — ${new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}),f.jsx("button",{onClick:H,disabled:D,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white text-sm transition-colors",children:D?"Sending...":"Send test"}),E&&(E.sent?f.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[f.jsx(Jr,{size:14,className:"inline mr-2"}),E.detail]}):f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:E.detail}))]})]}):f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-red-400",children:"Failed to load connection config"})})}function k$(){const{setDirty:e}=Ri(),[t,r]=O.useState(null),[n,a]=O.useState(null),[i,o]=O.useState(null),[s,l]=O.useState(null),[u,c]=O.useState(!0),[h,d]=O.useState(!1),[v,g]=O.useState(null),[m,y]=O.useState(null),[x,_]=O.useState(!1),w=O.useCallback(async()=>{c(!0);try{const[M,A]=await Promise.all([go("meshmonitor"),go("mesh_sources")]);r(M),a(JSON.parse(JSON.stringify(M))),o(A),l(JSON.parse(JSON.stringify(A))),_(!1),g(null)}catch(M){g(M instanceof Error?M.message:"Unknown error")}finally{c(!1)}},[]);O.useEffect(()=>{document.title="Meshtastic Sources - MeshAI",w()},[w]),O.useEffect(()=>{if(t&&n&&i&&s){const M=JSON.stringify(t)!==JSON.stringify(n),A=JSON.stringify(i)!==JSON.stringify(s);_(M||A)}},[t,n,i,s]),O.useEffect(()=>(e(x),()=>e(!1)),[x,e]);const S=async()=>{if(!(!t||!i)){d(!0),g(null),y(null);try{const[M,A]=await Promise.all([Mi("meshmonitor",t),Mi("mesh_sources",i)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),_(!1),e(!1),y("Meshtastic sources saved successfully"),(M.restart_required||A.restart_required)&&ru([]),setTimeout(()=>y(null),3e3)}catch(M){g(M instanceof Error?M.message:"Save failed")}finally{d(!1)}}},C=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),_(!1)};return u?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-slate-400",children:"Loading Meshtastic sources..."})}):!t||!i?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-red-400",children:"Failed to load sources config"})}):f.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{children:f.jsx("p",{className:"text-sm text-slate-500",children:"MeshMonitor integration and mesh awareness data sources."})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:w,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:f.jsx(zo,{size:18})}),f.jsxs("button",{onClick:C,disabled:!x,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[f.jsx(oa,{size:16}),"Discard"]}),f.jsxs("button",{onClick:S,disabled:h||!x,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[f.jsx(sa,{size:16}),h?"Saving...":"Save"]})]})]}),v&&f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:v}),m&&f.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[f.jsx(Jr,{size:14,className:"inline mr-2"}),m]}),f.jsx("div",{className:"bg-bg-card border border-border p-6",children:f.jsx(tCe,{data:t,onChange:r})}),f.jsx("div",{className:"bg-bg-card border border-border p-6",children:f.jsx(aCe,{data:i,onChange:o})})]})}const GCe=[{key:"gauge-sites",label:"Gauge Sites"},{key:"town-anchors",label:"Town Anchors"}];function HCe(){const[e,t]=O.useState("gauge-sites");return O.useEffect(()=>{document.title="Places - MeshAI"},[]),f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"flex gap-1 border-b border-border",children:GCe.map(({key:r,label:n})=>f.jsx("button",{onClick:()=>t(r),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===r?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:n},r))}),e==="gauge-sites"&&f.jsx(M$,{}),e==="town-anchors"&&f.jsx(A$,{})]})}const UCe=[{key:"nodes",label:"Nodes"},{key:"sources",label:"Sources"},{key:"health",label:"Health"}];function WCe(){const[e,t]=O.useState("nodes"),{setDirty:r}=Ri(),[n,a]=O.useState(null),[i,o]=O.useState(null),[s,l]=O.useState(!1),[u,c]=O.useState(!1),[h,d]=O.useState(null),[v,g]=O.useState(null),[m,y]=O.useState(!1);O.useEffect(()=>{document.title="Nodes & Health - MeshAI"},[]);const x=O.useCallback(async()=>{l(!0),d(null);try{const S=await go("mesh_intelligence");a(S),o(JSON.parse(JSON.stringify(S))),y(!1)}catch(S){d(S instanceof Error?S.message:"Failed to load mesh intelligence config")}finally{l(!1)}},[]);O.useEffect(()=>{e==="health"&&n===null&&!s&&x()},[e,n,s,x]),O.useEffect(()=>{n&&i&&y(JSON.stringify(n)!==JSON.stringify(i))},[n,i]),O.useEffect(()=>(r(m),()=>r(!1)),[m,r]);const _=async()=>{if(n){c(!0),d(null),g(null);try{const S=await Mi("mesh_intelligence",n);o(JSON.parse(JSON.stringify(n))),y(!1),r(!1),g("Mesh intelligence saved successfully"),S.restart_required&&ru([]),setTimeout(()=>g(null),3e3)}catch(S){d(S instanceof Error?S.message:"Save failed")}finally{c(!1)}}},w=()=>{i&&a(JSON.parse(JSON.stringify(i))),y(!1)};return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"flex gap-1 border-b border-border",children:UCe.map(({key:S,label:C})=>f.jsx("button",{onClick:()=>t(S),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===S?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:C},S))}),e==="nodes"&&f.jsx(m$,{}),e==="sources"&&f.jsx(k$,{}),e==="health"&&f.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{children:f.jsx("p",{className:"text-sm text-slate-500",children:"Mesh health scoring, region management, and automated alerting."})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:x,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:f.jsx(zo,{size:18})}),f.jsxs("button",{onClick:w,disabled:!m,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[f.jsx(oa,{size:16}),"Discard"]}),f.jsxs("button",{onClick:_,disabled:u||!m,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[f.jsx(sa,{size:16}),u?"Saving...":"Save"]})]})]}),h&&f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:h}),v&&f.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[f.jsx(Jr,{size:14,className:"inline mr-2"}),v]}),s?f.jsx("div",{className:"flex items-center justify-center h-32",children:f.jsx("div",{className:"text-slate-400",children:"Loading..."})}):n?f.jsx("div",{className:"bg-bg-card border border-border p-6",children:f.jsx(x$,{data:n,onChange:a})}):f.jsx("div",{className:"flex items-center justify-center h-32",children:f.jsx("div",{className:"text-red-400",children:"Failed to load config"})})]})]})}function ZCe(e){if(e==null)return"—";const t=Math.floor(Date.now()/1e3)-e;if(t<0)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}const $Ce={chat:{label:"Chat",className:"bg-sky-500/15 text-sky-400"},repeater:{label:"Repeater",className:"bg-amber-500/15 text-amber-400"},room:{label:"Room",className:"bg-violet-500/15 text-violet-400"},sensor:{label:"Sensor",className:"bg-emerald-500/15 text-emerald-400"}};function YCe({type:e}){const t=e&&$Ce[e]||{label:e??"unknown",className:"bg-slate-600/30 text-slate-400"};return f.jsx("span",{className:`px-2 py-0.5 text-[10px] uppercase tracking-wide rounded ${t.className}`,children:t.label})}function XCe(e){return e.name?e.name:e.pubkey?`${e.pubkey.slice(0,12)}…`:"unnamed"}function qCe(e){return e.length>12?`${e.slice(0,12)}…`:e}function KCe(e){return e.lat!=null&&e.lon!=null?`${e.lat.toFixed(4)}, ${e.lon.toFixed(4)}`:"—"}function JCe(){const[e,t]=O.useState(null),[r,n]=O.useState(!0),[a,i]=O.useState(null);return O.useEffect(()=>{document.title="MeshCore Contacts - MeshAI"},[]),O.useEffect(()=>{let o=!1;return(async()=>{n(!0),i(null);try{const s=await NJ();o||t(s)}catch(s){o||i(s instanceof Error?s.message:"Failed to load contacts")}finally{o||n(!1)}})(),()=>{o=!0}},[]),f.jsxs("div",{className:"max-w-4xl mx-auto space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:f.jsx(jV,{size:24,className:"text-accent"})}),f.jsxs("div",{children:[f.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"MeshCore Contacts"}),f.jsx("p",{className:"text-sm text-[#777]",children:"The companion's known contact roster — names, types, and last-heard times."})]})]}),r?f.jsx("div",{className:"flex items-center justify-center h-32",children:f.jsx("div",{className:"text-slate-400",children:"Loading..."})}):a?f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:a}):e&&e.active===!1?f.jsx("div",{className:"bg-bg-card border border-border p-6",children:f.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"The MeshCore companion is not connected. The contact roster is unavailable until the companion comes online."})}):e&&e.contacts.length===0?f.jsx("div",{className:"bg-bg-card border border-border p-6",children:f.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"No contacts yet. The companion is connected but has not discovered any nodes so far."})}):f.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:f.jsxs("table",{className:"w-full text-sm",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"border-b border-border text-left text-[11px] uppercase tracking-wide text-[#777]",children:[f.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Name"}),f.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Type"}),f.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Last heard"}),f.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Position"}),f.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Pubkey"})]})}),f.jsx("tbody",{className:"divide-y divide-border",children:((e==null?void 0:e.contacts)??[]).map(o=>f.jsxs("tr",{className:"hover:bg-bg-hover",children:[f.jsx("td",{className:"px-4 py-2.5 text-slate-100",children:XCe(o)}),f.jsx("td",{className:"px-4 py-2.5",children:f.jsx(YCe,{type:o.type})}),f.jsx("td",{className:"px-4 py-2.5 text-slate-300",children:ZCe(o.last_advert)}),f.jsx("td",{className:"px-4 py-2.5 text-slate-300 font-mono text-xs",children:KCe(o)}),f.jsx("td",{className:"px-4 py-2.5 text-slate-400 font-mono text-xs",children:qCe(o.pubkey)})]},o.pubkey))})]})}),f.jsx("p",{className:"text-xs text-[#777]",children:"Telemetry auto-poll is coming in the next pass."})]})}const QCe=[{key:"contacts",label:"Contacts"},{key:"companion",label:"Companion"}];function eTe(){const[e,t]=O.useState("contacts");return O.useEffect(()=>{document.title="Contacts & Companion - MeshAI"},[]),f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"flex gap-1 border-b border-border",children:QCe.map(({key:r,label:n})=>f.jsx("button",{onClick:()=>t(r),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===r?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:n},r))}),e==="contacts"&&f.jsx(JCe,{}),e==="companion"&&f.jsx(N$,{})]})}function $B({family:e="meshtastic"}){const{setDirty:t}=Ri(),[r,n]=O.useState(null),[a,i]=O.useState(null),[o,s]=O.useState({digest_enabled:!0,digest_schedule:["06:00","18:00"],digest_timezone:"America/Boise"}),[l,u]=O.useState(""),[c,h]=O.useState(!0),[d,v]=O.useState(!1),[g,m]=O.useState(null),[y,x]=O.useState(null),[_,w]=O.useState(!1),S=O.useCallback(async()=>{var k,P,D;h(!0),m(null);try{const z=await go("notifications");n(z),i(JSON.parse(JSON.stringify(z)));try{const E=await fetch("/api/adapter-config/fires");if(E.ok){const B=await E.json(),H={digest_enabled:((k=B.digest_enabled)==null?void 0:k.value)??!0,digest_schedule:((P=B.digest_schedule)==null?void 0:P.value)??["06:00","18:00"],digest_timezone:((D=B.digest_timezone)==null?void 0:D.value)??"America/Boise"};s(H),u(JSON.stringify(H))}}catch{u(JSON.stringify(o))}w(!1)}catch(z){m(z instanceof Error?z.message:"Failed to load config")}finally{h(!1)}},[]);O.useEffect(()=>{document.title="Scheduled Broadcasts - MeshAI",S()},[S]),O.useEffect(()=>{if(r&&a){const k=JSON.stringify(r)!==JSON.stringify(a),P=JSON.stringify(o)!==l;w(k||P)}},[r,a,o,l]),O.useEffect(()=>(t(_),()=>t(!1)),[_,t]);const C=async(k,P,D)=>{const z=await fetch(`/api/adapter-config/${k}/${P}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:D})});if(!z.ok){const E=await z.json().catch(()=>({}));throw new Error(E.detail||`Failed to save ${k}.${P}`)}},M=async()=>{if(r){v(!0),m(null),x(null);try{const k=await Mi("notifications",r);i(JSON.parse(JSON.stringify(r))),k.restart_required&&ru([]);const P=l?JSON.parse(l):null;(!P||o.digest_enabled!==P.digest_enabled)&&await C("fires","digest_enabled",o.digest_enabled),(!P||JSON.stringify(o.digest_schedule)!==JSON.stringify(P.digest_schedule))&&await C("fires","digest_schedule",o.digest_schedule),(!P||o.digest_timezone!==P.digest_timezone)&&await C("fires","digest_timezone",o.digest_timezone),u(JSON.stringify(o)),w(!1),t(!1),x("Scheduled broadcasts saved successfully"),setTimeout(()=>x(null),3e3)}catch(k){m(k instanceof Error?k.message:"Save failed")}finally{v(!1)}}},A=()=>{a&&n(JSON.parse(JSON.stringify(a))),l&&s(JSON.parse(l)),w(!1)},I=e==="meshcore"?"MeshCore scheduled broadcasts and band condition reports.":"Meshtastic scheduled broadcasts and band condition reports.";return c?f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-slate-400",children:"Loading scheduled broadcasts..."})}):r?f.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{children:f.jsx("p",{className:"text-sm text-slate-500",children:I})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:S,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:f.jsx(zo,{size:18})}),f.jsxs("button",{onClick:A,disabled:!_,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[f.jsx(oa,{size:16}),"Discard"]}),f.jsxs("button",{onClick:M,disabled:d||!_,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[f.jsx(sa,{size:16}),d?"Saving...":"Save"]})]})]}),g&&f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:g}),y&&f.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[f.jsx(Jr,{size:14,className:"inline mr-2"}),y]}),f.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Cold-start grace"})}),f.jsx(Nd,{label:"Grace period (seconds)",value:r.cold_start_grace_seconds??60,onChange:k=>n({...r,cold_start_grace_seconds:k}),min:0,max:600,helper:"Suppress broadcasts for this many seconds after the first event arrives",info:"When meshai starts seeing events for the first time, suppress mesh broadcasts for this many seconds to absorb any JetStream backlog. Persistence rows still get written; only broadcasts are suppressed."})]}),f.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Band Conditions (HF propagation)"})}),f.jsx(kd,{label:"Enable scheduled band-conditions broadcasts",checked:r.band_conditions_enabled??!0,onChange:k=>n({...r,band_conditions_enabled:k}),helper:"3x/day HF propagation summary (Day/Night ratings per band group). The daily fire digest (twice-daily LLM summary of active fires + the last 24h of growth/spotting) is configured separately under Adapter Config -> fires.digest_*. See Reference -> Fire Tracker (Fusion) and Reference -> Broadcast Types for the New/Update/Active prefix system.",info:"Source priority: (1) recent SWPC readings persisted locally; (2) HamQSL.com fallback; (3) silent skip if both fail. Persistence rows are written either way for an audit trail."}),(r.band_conditions_enabled??!0)&&f.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[f.jsx(gp,{label:"Slot 1",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[0]||"06:00",onChange:k=>{const P=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];P[0]=k,n({...r,band_conditions_schedule:P})},helper:"Morning (default 06:00 MT)"}),f.jsx(gp,{label:"Slot 2",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[1]||"14:00",onChange:k=>{const P=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];P[1]=k,n({...r,band_conditions_schedule:P})},helper:"Afternoon (default 14:00 MT)"}),f.jsx(gp,{label:"Slot 3",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[2]||"22:00",onChange:k=>{const P=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];P[2]=k,n({...r,band_conditions_schedule:P})},helper:"Night (default 22:00 MT)"})]}),f.jsx("p",{className:"text-xs text-slate-600",children:"All times are Mountain Time (America/Boise). DST handled automatically."})]}),f.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:["Fire Digest",f.jsx(ji,{info:"Twice-daily LLM summary of active fires + last 24h of growth/spotting events. Configured per the fires adapter."})]})}),f.jsx(kd,{label:"Enable fire digest broadcasts",checked:o.digest_enabled,onChange:k=>s({...o,digest_enabled:k}),helper:"Send a twice-daily digest of active fire conditions to the mesh"}),o.digest_enabled&&f.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[f.jsx(gp,{label:"Digest Slot 1",value:(o.digest_schedule??["06:00","18:00"])[0]||"06:00",onChange:k=>{const P=[...o.digest_schedule??["06:00","18:00"]];P[0]=k,s({...o,digest_schedule:P})},helper:"Morning digest (default 06:00 MT)"}),f.jsx(gp,{label:"Digest Slot 2",value:(o.digest_schedule??["06:00","18:00"])[1]||"18:00",onChange:k=>{const P=[...o.digest_schedule??["06:00","18:00"]];P[1]=k,s({...o,digest_schedule:P})},helper:"Evening digest (default 18:00 MT)"})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Timezone"}),f.jsx("input",{type:"text",value:o.digest_timezone,onChange:k=>s({...o,digest_timezone:k.target.value}),placeholder:"America/Boise",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"}),f.jsx("p",{className:"text-xs text-slate-600",children:"IANA timezone name (e.g. America/Boise). DST handled automatically."})]})]})]}):f.jsx("div",{className:"flex items-center justify-center h-64",children:f.jsx("div",{className:"text-red-400",children:"Failed to load config"})})}function tTe({info:e}){const[t,r]=O.useState(!1);return f.jsxs("div",{className:"relative inline-block",children:[f.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(!t)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),t&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),f.jsx("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:e})]})]})}function rTe({label:e,value:t,onChange:r,helper:n,info:a,keyPlaceholder:i="Key",valuePlaceholder:o="Value"}){const[s,l]=O.useState(()=>Object.entries(t||{}));O.useEffect(()=>{const c={};for(const[h,d]of s)h.trim()&&(c[h.trim()]=d);JSON.stringify(c)!==JSON.stringify(t||{})&&l(Object.entries(t||{}))},[t]);const u=c=>{l(c),r(Object.fromEntries(c.filter(([h])=>h.trim())))};return f.jsxs("div",{className:"space-y-2",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&f.jsx(tTe,{info:a})]}),s.map(([c,h],d)=>f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx("input",{type:"text",value:c,onChange:v=>u(s.map((g,m)=>m===d?[v.target.value,g[1]]:g)),placeholder:i,className:"w-40 flex-shrink-0 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),f.jsx("input",{type:"text",value:h,onChange:v=>u(s.map((g,m)=>m===d?[g[0],v.target.value]:g)),placeholder:o,className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"}),f.jsx("button",{type:"button",onClick:()=>u(s.filter((v,g)=>g!==d)),className:"p-2 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded flex-shrink-0","aria-label":"Remove header",children:f.jsx(po,{size:14})})]},d)),f.jsxs("button",{type:"button",onClick:()=>u([...s,["",""]]),className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[f.jsx(Ti,{size:16})," Add Header"]}),n&&f.jsx("p",{className:"text-xs text-slate-600",children:n})]})}const nTe=["CLIENT_BASE","ROUTER","ROUTER_LATE"],aTe=[{value:"mesh_dm",label:"Mesh DM (unicast to nodes)"},{value:"mesh_broadcast",label:"Mesh Broadcast (channel)"},{value:"email",label:"Email"},{value:"webhook",label:"Webhook"},{value:"none",label:"(None / log only)"}],iTe=[{key:"fire",label:"Fire",description:"Active wildfires (radius from fire perimeter).",Icon:Tm,showAcres:!0},{key:"weather",label:"Weather",description:"Severe weather warnings near a node.",Icon:ih},{key:"snow",label:"Snow (sub-gate of Weather)",description:"Snow-category weather events.",Icon:PV},{key:"flood",label:"Flood (sub-gate of Seismic)",description:"Stream/flood gauge events.",Icon:Mo},{key:"avalanche",label:"Avalanche",description:"Avalanche advisories near a node.",Icon:sd},{key:"seismic",label:"Seismic",description:"Earthquakes and seismic events near a node.",Icon:sd}];function hf(){return{enabled:!1,buffer_mi:5,min_acres:0}}function YB(){return{enabled:!1,dry_run:!0,monitor_roles:["ROUTER","ROUTER_LATE","CLIENT_BASE"],default_buffer_mi:5,cooldown_minutes:360,fire:hf(),weather:hf(),snow:hf(),flood:hf(),avalanche:hf(),seismic:hf(),delivery_type:"mesh_dm",node_ids:[],broadcast_channel:null,webhook_url:"",webhook_headers:{}}}function oTe({label:e,value:t,onChange:r,options:n,info:a=""}){return f.jsxs("div",{className:"space-y-1",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&f.jsx(ji,{info:a})]}),f.jsx("select",{value:t,onChange:i=>r(i.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:n.map(i=>f.jsx("option",{value:i.value,children:i.label},i.value))})]})}function sTe({meta:e,cfg:t,onChange:r}){const{Icon:n}=e;return f.jsxs("div",{className:`border border-[#1e2a3a] p-3 space-y-2 ${e.tabled?"opacity-50":""}`,children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-start gap-2 flex-1",children:[f.jsx(n,{size:15,className:"text-slate-400 mt-0.5 flex-shrink-0"}),f.jsxs("div",{className:"flex-1",children:[f.jsx("span",{className:"text-sm text-slate-300",children:e.label}),f.jsx("p",{className:"text-xs text-slate-600",children:e.description}),e.tabled&&f.jsx("span",{className:"inline-block mt-1 px-2 py-0.5 text-[10px] uppercase tracking-wide rounded bg-slate-700 text-slate-300",children:"Tabled — needs snowfall + elevation pipeline"})]})]}),f.jsx("button",{type:"button",disabled:e.tabled,onClick:()=>{e.tabled||r({...t,enabled:!t.enabled})},className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${t.enabled?"bg-accent":"bg-[#1e2a3a]"} ${e.tabled?"cursor-not-allowed":""}`,children:f.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t.enabled?"translate-x-5":""}`})})]}),t.enabled&&!e.tabled&&f.jsxs("div",{className:`grid gap-3 pt-2 border-t border-[#1e2a3a] ${e.showAcres?"grid-cols-2":"grid-cols-1"}`,children:[f.jsx(Nd,{label:"Buffer (mi)",value:t.buffer_mi??0,onChange:a=>r({...t,buffer_mi:a}),min:0,step:.5}),e.showAcres&&f.jsx(Nd,{label:"Min Acres",value:t.min_acres??0,onChange:a=>r({...t,min_acres:a}),min:0,step:1})]})]})}function lTe(){const[e,t]=O.useState(!1),[r,n]=O.useState(null),[a,i]=O.useState(!0),[o,s]=O.useState(!1),[l,u]=O.useState(null),[c,h]=O.useState(null),d=O.useCallback(async()=>{i(!0),u(null);try{const y=await go("danger_zones"),x=YB();n({...x,...y,fire:{...x.fire,...y.fire||{}},weather:{...x.weather,...y.weather||{}},snow:{...x.snow,...y.snow||{}},flood:{...x.flood,...y.flood||{}},avalanche:{...x.avalanche,...y.avalanche||{}},seismic:{...x.seismic,...y.seismic||{}},monitor_roles:y.monitor_roles??x.monitor_roles,node_ids:y.node_ids??x.node_ids,webhook_headers:y.webhook_headers??x.webhook_headers})}catch(y){u(y instanceof Error?y.message:"Failed to load danger zones config"),n(YB())}finally{i(!1)}},[]);O.useEffect(()=>{d()},[d]);const v=async()=>{if(r){s(!0),u(null),h(null);try{await Mi("danger_zones",r),h("Danger Zones config saved"),setTimeout(()=>h(null),3e3)}catch(y){u(y instanceof Error?y.message:"Save failed")}finally{s(!1)}}},g=y=>n(x=>x&&{...x,...y}),m=y=>{if(!r)return;const x=r.monitor_roles||[];g({monitor_roles:x.includes(y)?x.filter(_=>_!==y):[...x,y]})};return f.jsxs("div",{className:"bg-bg-card border border-border",children:[f.jsxs("button",{type:"button",onClick:()=>t(y=>!y),className:"w-full flex items-center justify-between p-4 text-left",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(Ao,{size:18,className:"text-amber-400"}),f.jsxs("div",{children:[f.jsx("div",{className:"text-sm font-medium text-slate-200",children:"Danger Zones"}),f.jsx("div",{className:"text-xs text-slate-500",children:"Alert when monitored infrastructure nodes are in/near a hazard"})]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[r&&f.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${r.enabled?r.dry_run?"bg-yellow-500/10 text-yellow-400":"bg-green-500/10 text-green-400":"bg-slate-800 text-slate-500"}`,children:r.enabled?r.dry_run?"Dry-run":"Live":"Disabled"}),e?f.jsx(Sm,{size:18,className:"text-slate-500"}):f.jsx(nh,{size:18,className:"text-slate-500"})]})]}),e&&f.jsxs("div",{className:"p-6 pt-0 space-y-6",children:[f.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-500/10 border border-amber-500/20",children:[f.jsx(ah,{size:16,className:"text-amber-400 mt-0.5 flex-shrink-0"}),f.jsxs("div",{className:"text-xs text-amber-200/90 leading-relaxed",children:["Ships disabled; when enabled, defaults to dry-run / log-only — no mesh traffic until you turn dry-run off. Requires ",f.jsx("span",{className:"font-medium",children:"Enable Notifications"})," (above) and environmental feeds to be on, since hazard events only flow when those are active."]})]}),l&&f.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:l}),c&&f.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[f.jsx(Jr,{size:14,className:"inline mr-2"}),c]}),a||!r?f.jsx("div",{className:"text-sm text-slate-500",children:"Loading danger zones config..."}):f.jsxs(f.Fragment,{children:[f.jsx(kd,{label:"Enable Danger Zones",checked:r.enabled,onChange:y=>g({enabled:y}),helper:"Master switch for the infrastructure danger-zone correlator"}),f.jsx(kd,{label:"Dry-run (log only)",checked:r.dry_run,onChange:y=>g({dry_run:y}),helper:"When on, matches are logged but nothing is sent to the mesh. Turn off only after verifying dry-run output."}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Monitored Roles",f.jsx(ji,{info:"Which Meshtastic node roles to correlate against hazards. Only nodes that have a GPS position are scanned."})]}),f.jsx("div",{className:"flex flex-wrap gap-2",children:nTe.map(y=>{const x=(r.monitor_roles||[]).includes(y);return f.jsx("button",{type:"button",onClick:()=>m(y),className:`px-3 py-1.5 rounded text-sm transition-colors ${x?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:y},y)})})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsx(Nd,{label:"Default Buffer (mi)",value:r.default_buffer_mi,onChange:y=>g({default_buffer_mi:y}),min:0,step:.5,helper:"Buffer used when a family has none set"}),f.jsx(Nd,{label:"Cooldown (min)",value:r.cooldown_minutes,onChange:y=>g({cooldown_minutes:y}),min:0,helper:"Min time between repeat alerts per node+family"})]}),f.jsxs("div",{className:"space-y-3",children:[f.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Hazard Families",f.jsx(ji,{info:"Enable each hazard family to monitor, with its own buffer distance and severity threshold. Snow is a sub-gate of Weather; Flood a sub-gate of Seismic."})]}),iTe.map(y=>f.jsx(sTe,{meta:y,cfg:r[y.key],onChange:x=>g({[y.key]:x})},y.key))]}),f.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[f.jsx(LV,{size:14}),"DELIVERY"]}),f.jsx(oTe,{label:"Delivery Method",value:r.delivery_type||"mesh_dm",onChange:y=>g({delivery_type:y}),options:aTe,info:"Where danger-zone alerts get delivered. Mesh DM unicasts to specific nodes; broadcast sends to a channel. Has no effect while dry-run is on."}),r.delivery_type==="mesh_dm"&&f.jsx(kP,{label:"Recipient Nodes",value:r.node_ids||[],onChange:y=>g({node_ids:y}),helper:"Nodes that receive direct messages",valueType:"node_id_hex"}),r.delivery_type==="mesh_broadcast"&&f.jsx(LP,{label:"Broadcast Channel",value:r.broadcast_channel??0,onChange:y=>g({broadcast_channel:y}),helper:"Select the mesh radio channel",mode:"single"}),r.delivery_type==="webhook"&&f.jsxs(f.Fragment,{children:[f.jsx(hCe,{label:"Webhook URL",value:r.webhook_url||"",onChange:y=>g({webhook_url:y}),placeholder:"https://discord.com/api/webhooks/...",helper:"POST alert as JSON"}),f.jsx(rTe,{label:"Webhook Headers",value:r.webhook_headers||{},onChange:y=>g({webhook_headers:y}),helper:"Custom HTTP headers sent with the danger-zone webhook",keyPlaceholder:"Header",valuePlaceholder:"Value"})]}),r.delivery_type==="email"&&f.jsx("p",{className:"text-xs text-slate-600",children:"Email delivery uses the SMTP settings configured for notification rules."})]}),f.jsx("div",{className:"flex justify-end",children:f.jsxs("button",{type:"button",onClick:v,disabled:o,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[f.jsx(sa,{size:16}),o?"Saving...":"Save Danger Zones"]})})]})]})]})}function uTe(){return O.useEffect(()=>{document.title="Danger Zones - MeshAI"},[]),f.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[f.jsx("p",{className:"text-sm text-slate-500",children:"Alert infrastructure nodes when they are within a configurable buffer distance of an active hazard."}),f.jsx(lTe,{})]})}function cTe(){return O.useEffect(()=>{document.title="Danger Zones - MeshAI"},[]),f.jsx("div",{className:"max-w-3xl mx-auto",children:f.jsx("div",{className:"bg-bg-card border border-border p-8",children:f.jsxs("div",{className:"flex items-start gap-4",children:[f.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:f.jsx(Ao,{size:24,className:"text-accent"})}),f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"MeshCore Danger Zones"}),f.jsx("span",{className:"px-2 py-0.5 text-[10px] uppercase tracking-wide rounded bg-slate-700 text-slate-300",children:"Coming soon"})]}),f.jsx("p",{className:"text-sm text-slate-400 leading-relaxed max-w-prose",children:"MeshCore danger zone alerting will correlate infrastructure node positions with active hazards and deliver targeted DMs via the MeshCore companion. This becomes available once the MeshCore delivery pipeline supports infrastructure-targeted messaging."})]})]})})})}delete xw.Icon.Default.prototype._getIconUrl;xw.Icon.Default.mergeOptions({iconUrl:v$,iconRetinaUrl:p$,shadowUrl:g$});const dx=e=>Math.round(e*1e6)/1e6,vx=["#f59e0b","#60a5fa","#34d399","#a78bfa","#f87171","#fb923c"],hTe=[{key:"fires",label:"NIFC Fire Perimeters"},{key:"nws",label:"NWS Weather Alerts"},{key:"wzdx",label:"WZDx Work Zones"},{key:"usgs_quake",label:"USGS Earthquakes"},{key:"firms",label:"NASA FIRMS Hotspots"},{key:"roads511",label:"511 Road Conditions"},{key:"usgs",label:"USGS Stream Gauges"},{key:"avalanche",label:"Avalanche Advisories"},{key:"traffic",label:"TomTom Traffic"},{key:"satpass",label:"Satellite Passes"},{key:"ducting",label:"Tropospheric Ducting"}];function fTe({bounds:e}){const t=NP(),r=O.useRef(!1);return O.useEffect(()=>{!r.current&&e&&(t.fitBounds(e,{padding:[40,40]}),r.current=!0)},[t,e]),null}function dTe({mode:e,firstCorner:t,onFirstClick:r,onSecondClick:n}){return xSe({click(a){const i=[a.latlng.lat,a.latlng.lng];e==="awaiting-first"?r(i):e==="awaiting-second"&&n(i)}}),t?f.jsx(h$,{center:t,radius:6,pathOptions:{color:"#f59e0b",fillColor:"#f59e0b",fillOpacity:1}}):null}function vTe(){const[e,t]=O.useState(null),[r,n]=O.useState(""),[a,i]=O.useState(!0),[o,s]=O.useState(!1),[l,u]=O.useState(null),[c,h]=O.useState(null),{setDirty:d}=Ri(),[v,g]=O.useState("idle"),[m,y]=O.useState(null);O.useEffect(()=>{document.title="Coverage — MeshAI",fetch("/api/config").then(E=>{if(!E.ok)throw new Error("Failed to fetch config");return E.json()}).then(E=>{const B=E.coverage??{bbox:[],enabled:!0,excluded_adapters:[],areas:[]};let H=Array.isArray(B.areas)?B.areas:[];if(H.length===0&&Array.isArray(B.bbox)&&B.bbox.length===4){const[U,F,Z,$]=B.bbox;H=[{name:"Area 1",west:U,south:F,east:Z,north:$}]}const V={bbox:Array.isArray(B.bbox)?B.bbox:[],enabled:B.enabled??!0,excluded_adapters:Array.isArray(B.excluded_adapters)?B.excluded_adapters:[],areas:H};t(V),n(JSON.stringify(V))}).catch(E=>u(E instanceof Error?E.message:String(E))).finally(()=>i(!1))},[]);const x=e!==null&&JSON.stringify(e)!==r;O.useEffect(()=>(d(x),()=>d(!1)),[x,d]);const _=(e==null?void 0:e.areas)??[],w=_.length>0?[[Math.min(..._.map(E=>E.south)),Math.min(..._.map(E=>E.west))],[Math.max(..._.map(E=>E.north)),Math.max(..._.map(E=>E.east))]]:null,S=[39.5,-98.35],C=O.useCallback(E=>{y(E),g("awaiting-second")},[]),M=O.useCallback(E=>{if(!m)return;const[B,H]=m,[V,U]=E;t(F=>{if(!F)return F;const Z={name:`Area ${F.areas.length+1}`,west:dx(Math.min(H,U)),south:dx(Math.min(B,V)),east:dx(Math.max(H,U)),north:dx(Math.max(B,V))};return{...F,areas:[...F.areas,Z]}}),y(null),g("idle")},[m]),A=(E,B,H)=>{t(V=>{if(!V)return V;const U=V.areas.map((F,Z)=>{if(Z!==E)return F;if(B==="name")return{...F,name:H};const $=parseFloat(H);return isNaN($)?F:{...F,[B]:$}});return{...V,areas:U}})},I=E=>{t(B=>B&&{...B,areas:B.areas.filter((H,V)=>V!==E)})},k=E=>{if(!e)return;const B=e.excluded_adapters??[];t({...e,excluded_adapters:B.includes(E)?B.filter(H=>H!==E):[...B,E]})},P=()=>{r&&(t(JSON.parse(r)),g("idle"),y(null))},D=async()=>{if(e){s(!0),u(null),h(null);try{const E=await fetch("/api/config/coverage",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({areas:e.areas,bbox:[],enabled:e.enabled,excluded_adapters:e.excluded_adapters})}),B=await E.json();if(!E.ok)throw new Error(B.detail||"Save failed");n(JSON.stringify(e)),h("Coverage saved"),setTimeout(()=>h(null),3e3),B.restart_required&&ru(Array.isArray(B.changed_keys)?B.changed_keys:[])}catch(E){u(E instanceof Error?E.message:"Save failed")}finally{s(!1)}}};if(a)return f.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading coverage config…"});if(!e)return f.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:l||"No config"});const z=v==="awaiting-first"?"Click the first corner of the new area on the map…":v==="awaiting-second"?"Click the opposite corner to complete the area…":_.length>0?`${_.length} area${_.length!==1?"s":""} defined`:"No areas defined — draw one on the map or enter coordinates below.";return f.jsxs("div",{className:"space-y-6 max-w-4xl",children:[f.jsxs("div",{className:"flex items-start justify-between gap-4",children:[f.jsxs("p",{className:"text-sm text-[#777]",children:[`Define one or more bounding boxes that scope every native adapter's geographic focus (set-union of all areas). Adapters with "Use own config" on ignore these areas and use the geographic settings on the`," ",f.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"})," ","page."]}),x&&f.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[f.jsxs("button",{onClick:P,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[f.jsx(oa,{size:14})," Discard"]}),f.jsxs("button",{onClick:D,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[f.jsx(sa,{size:14})," ",o?"Saving…":"Save"]})]})]}),l&&f.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:l}),c&&f.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:c}),f.jsxs("div",{className:"border border-border p-4 flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Use coverage areas to scope all adapters"}),f.jsx("p",{className:"text-xs text-[#666] mt-0.5",children:"When disabled, every adapter uses its own geographic config regardless of the areas below."})]}),f.jsx("button",{type:"button",onClick:()=>t({...e,enabled:!e.enabled}),className:`relative w-10 h-5 rounded-full transition-colors ${e.enabled?"bg-accent":"bg-[#333]"}`,children:f.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${e.enabled?"translate-x-5":""}`})})]}),f.jsxs("div",{className:"border border-border overflow-hidden",children:[f.jsxs("div",{className:"bg-bg-card border-b border-border px-4 py-2 flex items-center justify-between gap-4",children:[f.jsx("span",{className:"text-xs text-[#777] min-w-0 truncate font-mono",children:z}),f.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[v!=="idle"&&f.jsx("button",{onClick:()=>{g("idle"),y(null)},className:"px-2 py-1 text-xs text-[#777] hover:text-white border border-border",children:"Cancel"}),f.jsxs("button",{onClick:()=>g("awaiting-first"),disabled:v!=="idle",className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[f.jsx(fJ,{size:12}),"Add area"]})]})]}),f.jsxs(f$,{center:S,zoom:4,style:{width:"100%",height:"400px"},className:"z-0",children:[f.jsx(d$,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),f.jsx(fTe,{bounds:w}),_.map((E,B)=>{const H=vx[B%vx.length],V=[[E.south,E.west],[E.north,E.east]];return f.jsx(SSe,{bounds:V,pathOptions:{color:H,fillColor:H,fillOpacity:.08,weight:2}},B)}),f.jsx(dTe,{mode:v,firstCorner:m,onFirstClick:C,onSecondClick:M})]})]}),f.jsxs("div",{className:"border border-border p-4 space-y-4",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{className:"text-xs font-sans font-medium uppercase tracking-widest text-[#666]",children:"Coverage Areas"}),f.jsxs("button",{onClick:()=>g("awaiting-first"),disabled:v!=="idle",className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[f.jsx(Ti,{size:12})," Add area"]})]}),_.length===0?f.jsx("p",{className:"text-xs text-[#555]",children:'No areas defined. Draw one on the map or click "Add area" to start.'}):f.jsx("div",{className:"space-y-3",children:_.map((E,B)=>{const H=vx[B%vx.length];return f.jsxs("div",{className:"border border-border p-3 space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:H}}),f.jsx("input",{type:"text",value:E.name,onChange:V=>A(B,"name",V.target.value),className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1 text-sm font-medium text-[#e0e0e0]",placeholder:"Area name"}),f.jsx("button",{onClick:()=>I(B),title:"Delete area",className:"flex items-center gap-1 px-2 py-1 text-xs text-[#777] hover:text-red-400 border border-border",children:f.jsx(po,{size:12})})]}),f.jsx("div",{className:"grid grid-cols-4 gap-2",children:["west","south","east","north"].map(V=>f.jsxs("div",{children:[f.jsx("label",{className:"text-xs text-[#777] mb-1 block capitalize",children:V}),f.jsx("input",{type:"number",step:"0.000001",value:E[V],onChange:U=>A(B,V,U.target.value),className:"w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono"})]},V))})]},B)})}),f.jsx("p",{className:"text-xs text-[#666]",children:"Decimal degrees. W/E = longitude; S/N = latitude. Each area is a bounding box; the coverage filter uses the set-union of all areas. Drawn coordinates are rounded to 6 decimal places."})]}),f.jsxs("div",{className:"border border-border p-4 space-y-4",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-xs font-sans font-medium uppercase tracking-widest text-[#666] mb-1",children:"Adapter Overrides"}),f.jsxs("p",{className:"text-xs text-[#777]",children:['Toggle "Use own config" to have that adapter ignore the coverage areas. Its geographic settings (state, bbox, corridors, observers…) then become active on the'," ",f.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"})," ","page."]})]}),f.jsx("div",{className:"divide-y divide-border",children:hTe.map(({key:E,label:B})=>{var V;const H=((V=e.excluded_adapters)==null?void 0:V.includes(E))??!1;return f.jsxs("div",{className:"flex items-center justify-between py-2.5",children:[f.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[f.jsx("span",{className:"text-sm text-[#e0e0e0]",children:B}),H?f.jsx("span",{className:"text-[10px] text-accent/70 uppercase tracking-wide",children:"own config"}):f.jsx("span",{className:"text-[10px] text-[#555] uppercase tracking-wide",children:"coverage areas"})]}),f.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[H&&f.jsx("a",{href:"/environment",className:"text-xs text-accent hover:underline",children:"Configure"}),f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[f.jsx("span",{className:"text-xs text-[#666] whitespace-nowrap",children:"Use own config"}),f.jsx("button",{type:"button",onClick:()=>k(E),className:`relative w-8 h-4 rounded-full transition-colors ${H?"bg-accent":"bg-[#333]"}`,children:f.jsx("span",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${H?"translate-x-4":""}`})})]})]})]},E)})})]}),x&&f.jsxs("div",{className:"flex justify-end gap-2 pb-2",children:[f.jsxs("button",{onClick:P,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[f.jsx(oa,{size:14})," Discard"]}),f.jsxs("button",{onClick:D,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[f.jsx(sa,{size:14})," ",o?"Saving…":"Save"]})]})]})}function pTe(){return f.jsx(rJ,{children:f.jsx(DJ,{children:f.jsx(BJ,{children:f.jsxs(HK,{children:[f.jsx(Jt,{path:"/",element:f.jsx(YJ,{})}),f.jsx(Jt,{path:"/environment",element:f.jsx(NCe,{})}),f.jsx(Jt,{path:"/config",element:f.jsx(sCe,{})}),f.jsx(Jt,{path:"/alerts",element:f.jsx(HB,{})}),f.jsx(Jt,{path:"/activity",element:f.jsx(HB,{})}),f.jsx(Jt,{path:"/notifications",element:f.jsx(gCe,{})}),f.jsx(Jt,{path:"/reference",element:f.jsx(jCe,{})}),f.jsx(Jt,{path:"/adapter-config",element:f.jsx(S$,{})}),f.jsx(Jt,{path:"/places",element:f.jsx(HCe,{})}),f.jsx(Jt,{path:"/coverage",element:f.jsx(vTe,{})}),f.jsx(Jt,{path:"/data-sources",element:f.jsx(VK,{to:"/environment",replace:!0})}),f.jsx(Jt,{path:"/gauge-sites",element:f.jsx(M$,{})}),f.jsx(Jt,{path:"/town-anchors",element:f.jsx(A$,{})}),f.jsx(Jt,{path:"/mesh",element:f.jsx(m$,{})}),f.jsx(Jt,{path:"/meshtastic/connection",element:f.jsx(VCe,{})}),f.jsx(Jt,{path:"/meshtastic/sources",element:f.jsx(k$,{})}),f.jsx(Jt,{path:"/meshtastic/scheduled",element:f.jsx($B,{family:"meshtastic"})}),f.jsx(Jt,{path:"/meshtastic/nodes",element:f.jsx(WCe,{})}),f.jsx(Jt,{path:"/meshtastic/danger-zones",element:f.jsx(uTe,{})}),f.jsx(Jt,{path:"/meshcore/connection",element:f.jsx(BCe,{})}),f.jsx(Jt,{path:"/meshcore/routing",element:f.jsx(zCe,{})}),f.jsx(Jt,{path:"/meshcore/scheduled",element:f.jsx($B,{family:"meshcore"})}),f.jsx(Jt,{path:"/meshcore/contacts",element:f.jsx(eTe,{})}),f.jsx(Jt,{path:"/meshcore/companion",element:f.jsx(N$,{})}),f.jsx(Jt,{path:"/meshcore/danger-zones",element:f.jsx(cTe,{})})]})})})})}t2.createRoot(document.getElementById("root")).render(f.jsx(Qf.StrictMode,{children:f.jsx(KK,{children:f.jsx(pTe,{})})})); diff --git a/work/meshai/dashboard/static/assets/index-CTVGSJxQ.css b/work/meshai/dashboard/static/assets/index-CTVGSJxQ.css new file mode 100644 index 0000000..1f29d10 --- /dev/null +++ b/work/meshai/dashboard/static/assets/index-CTVGSJxQ.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap";@import"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap";.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-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-3{left:.75rem}.left-4{left:1rem}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-4{top:1rem}.top-6{top:1.5rem}.top-full{top:100%}.z-0{z-index:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-12{grid-column:span 12 / span 12}.col-span-2{grid-column:span 2 / span 2}.col-span-3{grid-column:span 3 / span 3}.-m-6{margin:-1.5rem}.-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.-my-4{margin-top:-1rem;margin-bottom:-1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-px{margin-bottom:-1px}.-ml-2{margin-left:-.5rem}.-ml-4{margin-left:-1rem}.-mr-1{margin-right:-.25rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-\[540px\]{height:540px}.h-\[calc\(100vh-8rem\)\]{height:calc(100vh - 8rem)}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-72{max-height:18rem}.max-h-80{max-height:20rem}.min-h-\[36px\]{min-height:36px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[190px\]{width:190px}.w-\[220px\]{width:220px}.w-\[250px\]{width:250px}.w-\[2px\]{width:2px}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-\[150px\]{max-width:150px}.max-w-\[16rem\]{max-width:16rem}.max-w-\[200px\]{max-width:200px}.max-w-prose{max-width:65ch}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-4{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-y{resize:vertical}.scroll-mt-6{scroll-margin-top:1.5rem}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-8{-moz-column-gap:2rem;column-gap:2rem}.gap-y-1{row-gap:.25rem}.gap-y-4{row-gap:1rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 30 30 / var(--tw-divide-opacity, 1))}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:0}.rounded-full{border-radius:9999px}.rounded-lg,.rounded-sm{border-radius:0}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#1e2a3a\]{--tw-border-opacity: 1;border-color:rgb(30 42 58 / var(--tw-border-opacity, 1))}.border-\[\#222\]{--tw-border-opacity: 1;border-color:rgb(34 34 34 / var(--tw-border-opacity, 1))}.border-\[\#2a3a4a\]{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.border-\[\#333\]{--tw-border-opacity: 1;border-color:rgb(51 51 51 / var(--tw-border-opacity, 1))}.border-accent{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-accent-dim\/30{border-color:#d977064d}.border-accent\/30{border-color:#f59e0b4d}.border-accent\/40{border-color:#f59e0b66}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/40{border-color:#f59e0b66}.border-blue-500\/30{border-color:#3b82f64d}.border-border{--tw-border-opacity: 1;border-color:rgb(30 30 30 / var(--tw-border-opacity, 1))}.border-border\/50{border-color:#1e1e1e80}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-red-400\/30{border-color:#f871714d}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-red-500\/40{border-color:#ef444466}.border-sky-400{--tw-border-opacity: 1;border-color:rgb(56 189 248 / var(--tw-border-opacity, 1))}.border-sky-400\/30{border-color:#38bdf84d}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-600\/40{border-color:#47556966}.border-transparent{border-color:transparent}.border-yellow-500\/30{border-color:#eab3084d}.border-yellow-700{--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity, 1))}.border-l-accent{--tw-border-opacity: 1;border-left-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.bg-\[\#000000\]{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0e17\]{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0e17\]\/40{background-color:#0a0e1766}.bg-\[\#0d0d0d\]{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1219\]{--tw-bg-opacity: 1;background-color:rgb(13 18 25 / var(--tw-bg-opacity, 1))}.bg-\[\#161616\]{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1a2332\]{--tw-bg-opacity: 1;background-color:rgb(26 35 50 / var(--tw-bg-opacity, 1))}.bg-\[\#1e1e1e\]{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.bg-\[\#333\]{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]\/10{background-color:#f59e0b1a}.bg-accent{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-accent-dim{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-accent\/10{background-color:#f59e0b1a}.bg-accent\/15{background-color:#f59e0b26}.bg-accent\/20{background-color:#f59e0b33}.bg-accent\/5{background-color:#f59e0b0d}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-bg{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity, 1))}.bg-bg-card{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.bg-bg-card\/90{background-color:#0d0d0de6}.bg-bg-hover{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-blue-500\/15{background-color:#3b82f626}.bg-border{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-cyan-500\/20{background-color:#06b6d433}.bg-emerald-500\/15{background-color:#10b98126}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/15{background-color:#22c55e26}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/15{background-color:#f9731626}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-sky-400{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-sky-400\/10{background-color:#38bdf81a}.bg-sky-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-sky-500\/15{background-color:#0ea5e926}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/15{background-color:#64748b26}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.bg-slate-600\/30{background-color:#4755694d}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-violet-500\/15{background-color:#8b5cf626}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/40{background-color:#713f1266}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-6{padding-left:1.5rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,monospace}.font-sans{font-family:Inter,system-ui,-apple-system,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#555\]{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.text-\[\#666\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}.text-\[\#777\]{--tw-text-opacity: 1;color:rgb(119 119 119 / var(--tw-text-opacity, 1))}.text-\[\#999\]{--tw-text-opacity: 1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}.text-\[\#bbb\]{--tw-text-opacity: 1;color:rgb(187 187 187 / var(--tw-text-opacity, 1))}.text-\[\#e0e0e0\]{--tw-text-opacity: 1;color:rgb(224 224 224 / var(--tw-text-opacity, 1))}.text-\[\#f59e0b\],.text-accent{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-accent-dim{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-accent\/70{color:#f59e0bb3}.text-accent\/80{color:#f59e0bcc}.text-amber-200\/90{color:#fde68ae6}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-300\/70{color:#fcd34db3}.text-amber-300\/80{color:#fcd34dcc}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-300\/70{color:#fca5a5b3}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-sky-500{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-violet-400{--tw-text-opacity: 1;color:rgb(167 139 250 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-100{--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.text-yellow-200{--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-300\/80{color:#fde047cc}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.accent-\[\#f59e0b\],.accent-accent{accent-color:#f59e0b}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-accent{--tw-ring-opacity: 1;--tw-ring-color: rgb(245 158 11 / var(--tw-ring-opacity, 1))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}body{background:#111;margin:0;font-family:Inter,system-ui,-apple-system,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#111}::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:0}::-webkit-scrollbar-thumb:hover{background:#2a2a2a}.font-mono{font-family:JetBrains Mono,monospace}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse-slow{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes slide-in{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.animate-slide-in{animation:slide-in .3s ease-out}.line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.placeholder\:text-\[\#555\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.placeholder\:text-\[\#555\]::placeholder{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.last\:border-0:last-child{border-width:0px}.hover\:border-\[\#2a3a4a\]:hover{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.hover\:border-accent:hover{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.hover\:border-accent\/40:hover{border-color:#f59e0b66}.hover\:bg-\[\#0a0e17\]:hover{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]:hover{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#333\]:hover{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#d97706\]:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-accent\/20:hover{background-color:#f59e0b33}.hover\:bg-accent\/25:hover{background-color:#f59e0b40}.hover\:bg-accent\/30:hover{background-color:#f59e0b4d}.hover\:bg-accent\/80:hover{background-color:#f59e0bcc}.hover\:bg-amber-500\/30:hover{background-color:#f59e0b4d}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-card:hover{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-hover:hover{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-accent:hover{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-sky-300:hover{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-slate-400:hover{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.focus\:border-accent:focus{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-slate-700:disabled{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 640px){.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/work/meshai/dashboard/static/assets/index-dwX3LKqm.js b/work/meshai/dashboard/static/assets/index-dwX3LKqm.js new file mode 100644 index 0000000..9f1ea4c --- /dev/null +++ b/work/meshai/dashboard/static/assets/index-dwX3LKqm.js @@ -0,0 +1,475 @@ +function DY(e,t){for(var r=0;rn[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var jY=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _N(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nF={exports:{}},$b={},aF={exports:{}},Dt={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var km=Symbol.for("react.element"),EY=Symbol.for("react.portal"),RY=Symbol.for("react.fragment"),OY=Symbol.for("react.strict_mode"),zY=Symbol.for("react.profiler"),BY=Symbol.for("react.provider"),FY=Symbol.for("react.context"),VY=Symbol.for("react.forward_ref"),GY=Symbol.for("react.suspense"),HY=Symbol.for("react.memo"),UY=Symbol.for("react.lazy"),xD=Symbol.iterator;function WY(e){return e===null||typeof e!="object"?null:(e=xD&&e[xD]||e["@@iterator"],typeof e=="function"?e:null)}var iF={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oF=Object.assign,sF={};function Kf(e,t,r){this.props=e,this.context=t,this.refs=sF,this.updater=r||iF}Kf.prototype.isReactComponent={};Kf.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Kf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function lF(){}lF.prototype=Kf.prototype;function bN(e,t,r){this.props=e,this.context=t,this.refs=sF,this.updater=r||iF}var wN=bN.prototype=new lF;wN.constructor=bN;oF(wN,Kf.prototype);wN.isPureReactComponent=!0;var _D=Array.isArray,uF=Object.prototype.hasOwnProperty,SN={current:null},cF={key:!0,ref:!0,__self:!0,__source:!0};function hF(e,t,r){var n,a={},i=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)uF.call(t,n)&&!cF.hasOwnProperty(n)&&(a[n]=t[n]);var s=arguments.length-2;if(s===1)a.children=r;else if(1>>1,J=F[Z];if(0>>1;Za(le,$))dea(He,le)?(F[Z]=He,F[de]=$,Z=de):(F[Z]=le,F[Q]=$,Z=Q);else if(dea(He,$))F[Z]=He,F[de]=$,Z=de;else break e}}return W}function a(F,W){var $=F.sortIndex-W.sortIndex;return $!==0?$:F.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var l=[],u=[],c=1,h=null,f=3,v=!1,g=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(F){for(var W=r(u);W!==null;){if(W.callback===null)n(u);else if(W.startTime<=F)n(u),W.sortIndex=W.expirationTime,t(l,W);else break;W=r(u)}}function S(F){if(m=!1,w(F),!g)if(r(l)!==null)g=!0,V(C);else{var W=r(u);W!==null&&U(S,W.startTime-F)}}function C(F,W){g=!1,m&&(m=!1,x(I),I=-1),v=!0;var $=f;try{for(w(W),h=r(l);h!==null&&(!(h.expirationTime>W)||F&&!D());){var Z=h.callback;if(typeof Z=="function"){h.callback=null,f=h.priorityLevel;var J=Z(h.expirationTime<=W);W=e.unstable_now(),typeof J=="function"?h.callback=J:h===r(l)&&n(l),w(W)}else n(l);h=r(l)}if(h!==null)var re=!0;else{var Q=r(u);Q!==null&&U(S,Q.startTime-W),re=!1}return re}finally{h=null,f=$,v=!1}}var M=!1,A=null,I=-1,k=5,P=-1;function D(){return!(e.unstable_now()-PF||125Z?(F.sortIndex=$,t(u,F),r(l)===null&&F===r(u)&&(m?(x(I),I=-1):m=!0,U(S,$-Z))):(F.sortIndex=J,t(l,F),g||v||(g=!0,V(C))),F},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(F){var W=f;return function(){var $=f;f=W;try{return F.apply(this,arguments)}finally{f=$}}}})(gF);pF.exports=gF;var nX=pF.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 aX=E,Ea=nX;function Ce(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oT=Object.prototype.hasOwnProperty,iX=/^[: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]*$/,wD={},SD={};function oX(e){return oT.call(SD,e)?!0:oT.call(wD,e)?!1:iX.test(e)?SD[e]=!0:(wD[e]=!0,!1)}function sX(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function lX(e,t,r,n){if(t===null||typeof t>"u"||sX(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function na(e,t,r,n,a,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var xn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){xn[e]=new na(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];xn[t]=new na(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){xn[e]=new na(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){xn[e]=new na(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){xn[e]=new na(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){xn[e]=new na(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){xn[e]=new na(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){xn[e]=new na(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){xn[e]=new na(e,5,!1,e.toLowerCase(),null,!1,!1)});var TN=/[\-:]([a-z])/g;function MN(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(TN,MN);xn[t]=new na(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(TN,MN);xn[t]=new na(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(TN,MN);xn[t]=new na(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){xn[e]=new na(e,1,!1,e.toLowerCase(),null,!1,!1)});xn.xlinkHref=new na("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){xn[e]=new na(e,1,!1,e.toLowerCase(),null,!0,!0)});function AN(e,t,r,n){var a=xn.hasOwnProperty(t)?xn[t]:null;(a!==null?a.type!==0:n||!(2s||a[o]!==i[s]){var l=` +`+a[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=s);break}}}finally{Vw=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?kp(e):""}function uX(e){switch(e.tag){case 5:return kp(e.type);case 16:return kp("Lazy");case 13:return kp("Suspense");case 19:return kp("SuspenseList");case 0:case 2:case 15:return e=Gw(e.type,!1),e;case 11:return e=Gw(e.type.render,!1),e;case 1:return e=Gw(e.type,!0),e;default:return""}}function cT(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 zd:return"Fragment";case Od:return"Portal";case sT:return"Profiler";case NN:return"StrictMode";case lT:return"Suspense";case uT:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case xF:return(e.displayName||"Context")+".Consumer";case yF:return(e._context.displayName||"Context")+".Provider";case kN:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case LN:return t=e.displayName||null,t!==null?t:cT(e.type)||"Memo";case bl:t=e._payload,e=e._init;try{return cT(e(t))}catch{}}return null}function cX(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return cT(t);case 8:return t===NN?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ru(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function bF(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function hX(e){var t=bF(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ay(e){e._valueTracker||(e._valueTracker=hX(e))}function wF(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=bF(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Jx(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 hT(e,t){var r=t.checked;return br({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function TD(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=ru(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function SF(e,t){t=t.checked,t!=null&&AN(e,"checked",t,!1)}function dT(e,t){SF(e,t);var r=ru(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?fT(e,t.type,r):t.hasOwnProperty("defaultValue")&&fT(e,t.type,ru(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function MD(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function fT(e,t,r){(t!=="number"||Jx(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Lp=Array.isArray;function rf(e,t,r,n){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Ny.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function bg(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Zp={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},dX=["Webkit","ms","Moz","O"];Object.keys(Zp).forEach(function(e){dX.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Zp[t]=Zp[e]})});function AF(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Zp.hasOwnProperty(e)&&Zp[e]?(""+t).trim():t+"px"}function NF(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,a=AF(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,a):e[r]=a}}var fX=br({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function gT(e,t){if(t){if(fX[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ce(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ce(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ce(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ce(62))}}function mT(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yT=null;function IN(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xT=null,nf=null,af=null;function kD(e){if(e=Pm(e)){if(typeof xT!="function")throw Error(Ce(280));var t=e.stateNode;t&&(t=Kb(t),xT(e.stateNode,e.type,t))}}function kF(e){nf?af?af.push(e):af=[e]:nf=e}function LF(){if(nf){var e=nf,t=af;if(af=nf=null,kD(e),t)for(e=0;e>>=0,e===0?32:31-(CX(e)/TX|0)|0}var ky=64,Ly=4194304;function Ip(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function r_(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,a=e.suspendedLanes,i=e.pingedLanes,o=r&268435455;if(o!==0){var s=o&~a;s!==0?n=Ip(s):(i&=o,i!==0&&(n=Ip(i)))}else o=r&~a,o!==0?n=Ip(o):i!==0&&(n=Ip(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&a)&&(a=n&-n,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function Lm(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ri(t),e[t]=r}function kX(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=Xp),zD=" ",BD=!1;function qF(e,t){switch(e){case"keyup":return nq.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function KF(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bd=!1;function iq(e,t){switch(e){case"compositionend":return KF(t);case"keypress":return t.which!==32?null:(BD=!0,zD);case"textInput":return e=t.data,e===zD&&BD?null:e;default:return null}}function oq(e,t){if(Bd)return e==="compositionend"||!BN&&qF(e,t)?(e=YF(),gx=RN=Al=null,Bd=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=HD(r)}}function t6(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?t6(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function r6(){for(var e=window,t=Jx();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Jx(e.document)}return t}function FN(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function pq(e){var t=r6(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&t6(r.ownerDocument.documentElement,r)){if(n!==null&&FN(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=r.textContent.length,i=Math.min(n.start,a);n=n.end===void 0?i:Math.min(n.end,a),!e.extend&&i>n&&(a=n,n=i,i=a),a=UD(r,i);var o=UD(r,n);a&&o&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Fd=null,TT=null,Kp=null,MT=!1;function WD(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;MT||Fd==null||Fd!==Jx(n)||(n=Fd,"selectionStart"in n&&FN(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Kp&&Ag(Kp,n)||(Kp=n,n=i_(TT,"onSelect"),0Hd||(e.current=PT[Hd],PT[Hd]=null,Hd--)}function sr(e,t){Hd++,PT[Hd]=e.current,e.current=t}var nu={},Fn=pu(nu),pa=pu(!1),Zc=nu;function Sf(e,t){var r=e.type.contextTypes;if(!r)return nu;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in r)a[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function ga(e){return e=e.childContextTypes,e!=null}function s_(){ur(pa),ur(Fn)}function JD(e,t,r){if(Fn.current!==nu)throw Error(Ce(168));sr(Fn,t),sr(pa,r)}function h6(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var a in n)if(!(a in t))throw Error(Ce(108,cX(e)||"Unknown",a));return br({},r,n)}function l_(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||nu,Zc=Fn.current,sr(Fn,e),sr(pa,pa.current),!0}function QD(e,t,r){var n=e.stateNode;if(!n)throw Error(Ce(169));r?(e=h6(e,t,Zc),n.__reactInternalMemoizedMergedChildContext=e,ur(pa),ur(Fn),sr(Fn,e)):ur(pa),sr(pa,r)}var xs=null,Jb=!1,rS=!1;function d6(e){xs===null?xs=[e]:xs.push(e)}function Aq(e){Jb=!0,d6(e)}function gu(){if(!rS&&xs!==null){rS=!0;var e=0,t=Jt;try{var r=xs;for(Jt=1;e>=o,a-=o,bs=1<<32-Ri(t)+a|r<I?(k=A,A=null):k=A.sibling;var P=f(x,A,w[I],S);if(P===null){A===null&&(A=k);break}e&&A&&P.alternate===null&&t(x,A),_=i(P,_,I),M===null?C=P:M.sibling=P,M=P,A=k}if(I===w.length)return r(x,A),vr&&fc(x,I),C;if(A===null){for(;II?(k=A,A=null):k=A.sibling;var D=f(x,A,P.value,S);if(D===null){A===null&&(A=k);break}e&&A&&D.alternate===null&&t(x,A),_=i(D,_,I),M===null?C=D:M.sibling=D,M=D,A=k}if(P.done)return r(x,A),vr&&fc(x,I),C;if(A===null){for(;!P.done;I++,P=w.next())P=h(x,P.value,S),P!==null&&(_=i(P,_,I),M===null?C=P:M.sibling=P,M=P);return vr&&fc(x,I),C}for(A=n(x,A);!P.done;I++,P=w.next())P=v(A,x,I,P.value,S),P!==null&&(e&&P.alternate!==null&&A.delete(P.key===null?I:P.key),_=i(P,_,I),M===null?C=P:M.sibling=P,M=P);return e&&A.forEach(function(z){return t(x,z)}),vr&&fc(x,I),C}function y(x,_,w,S){if(typeof w=="object"&&w!==null&&w.type===zd&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case My:e:{for(var C=w.key,M=_;M!==null;){if(M.key===C){if(C=w.type,C===zd){if(M.tag===7){r(x,M.sibling),_=a(M,w.props.children),_.return=x,x=_;break e}}else if(M.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===bl&&rj(C)===M.type){r(x,M.sibling),_=a(M,w.props),_.ref=Uv(x,M,w),_.return=x,x=_;break e}r(x,M);break}else t(x,M);M=M.sibling}w.type===zd?(_=Oc(w.props.children,x.mode,S,w.key),_.return=x,x=_):(S=Tx(w.type,w.key,w.props,null,x.mode,S),S.ref=Uv(x,_,w),S.return=x,x=S)}return o(x);case Od:e:{for(M=w.key;_!==null;){if(_.key===M)if(_.tag===4&&_.stateNode.containerInfo===w.containerInfo&&_.stateNode.implementation===w.implementation){r(x,_.sibling),_=a(_,w.children||[]),_.return=x,x=_;break e}else{r(x,_);break}else t(x,_);_=_.sibling}_=cS(w,x.mode,S),_.return=x,x=_}return o(x);case bl:return M=w._init,y(x,_,M(w._payload),S)}if(Lp(w))return g(x,_,w,S);if(Bv(w))return m(x,_,w,S);Oy(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,_!==null&&_.tag===6?(r(x,_.sibling),_=a(_,w),_.return=x,x=_):(r(x,_),_=uS(w,x.mode,S),_.return=x,x=_),o(x)):r(x,_)}return y}var Tf=g6(!0),m6=g6(!1),h_=pu(null),d_=null,$d=null,UN=null;function WN(){UN=$d=d_=null}function $N(e){var t=h_.current;ur(h_),e._currentValue=t}function ET(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function sf(e,t){d_=e,UN=$d=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(va=!0),e.firstContext=null)}function di(e){var t=e._currentValue;if(UN!==e)if(e={context:e,memoizedValue:t,next:null},$d===null){if(d_===null)throw Error(Ce(308));$d=e,d_.dependencies={lanes:0,firstContext:e}}else $d=$d.next=e;return t}var Ac=null;function ZN(e){Ac===null?Ac=[e]:Ac.push(e)}function y6(e,t,r,n){var a=t.interleaved;return a===null?(r.next=r,ZN(t)):(r.next=a.next,a.next=r),t.interleaved=r,zs(e,n)}function zs(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var wl=!1;function YN(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function x6(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function As(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Vl(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Ht&2){var a=n.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),n.pending=t,zs(e,r)}return a=n.interleaved,a===null?(t.next=t,ZN(n)):(t.next=a.next,a.next=t),n.interleaved=t,zs(e,r)}function yx(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,DN(e,r)}}function nj(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var a=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?a=i=o:i=i.next=o,r=r.next}while(r!==null);i===null?a=i=t:i=i.next=t}else a=i=t;r={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function f_(e,t,r,n){var a=e.updateQueue;wl=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,s=a.shared.pending;if(s!==null){a.shared.pending=null;var l=s,u=l.next;l.next=null,o===null?i=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==o&&(s===null?c.firstBaseUpdate=u:s.next=u,c.lastBaseUpdate=l))}if(i!==null){var h=a.baseState;o=0,c=u=l=null,s=i;do{var f=s.lane,v=s.eventTime;if((n&f)===f){c!==null&&(c=c.next={eventTime:v,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var g=e,m=s;switch(f=t,v=r,m.tag){case 1:if(g=m.payload,typeof g=="function"){h=g.call(v,h,f);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,f=typeof g=="function"?g.call(v,h,f):g,f==null)break e;h=br({},h,f);break e;case 2:wl=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=a.effects,f===null?a.effects=[s]:f.push(s))}else v={eventTime:v,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(u=c=v,l=h):c=c.next=v,o|=f;if(s=s.next,s===null){if(s=a.shared.pending,s===null)break;f=s,s=f.next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}while(!0);if(c===null&&(l=h),a.baseState=l,a.firstBaseUpdate=u,a.lastBaseUpdate=c,t=a.shared.interleaved,t!==null){a=t;do o|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);qc|=o,e.lanes=o,e.memoizedState=h}}function aj(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=aS.transition;aS.transition={};try{e(!1),t()}finally{Jt=r,aS.transition=n}}function R6(){return fi().memoizedState}function Iq(e,t,r){var n=Hl(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},O6(e))z6(t,r);else if(r=y6(e,t,r,n),r!==null){var a=Kn();Oi(r,e,n,a),B6(r,t,n)}}function Pq(e,t,r){var n=Hl(e),a={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(O6(e))z6(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,s=i(o,r);if(a.hasEagerState=!0,a.eagerState=s,Gi(s,o)){var l=t.interleaved;l===null?(a.next=a,ZN(t)):(a.next=l.next,l.next=a),t.interleaved=a;return}}catch{}finally{}r=y6(e,t,a,n),r!==null&&(a=Kn(),Oi(r,e,n,a),B6(r,t,n))}}function O6(e){var t=e.alternate;return e===xr||t!==null&&t===xr}function z6(e,t){Jp=p_=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function B6(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,DN(e,r)}}var g_={readContext:di,useCallback:Nn,useContext:Nn,useEffect:Nn,useImperativeHandle:Nn,useInsertionEffect:Nn,useLayoutEffect:Nn,useMemo:Nn,useReducer:Nn,useRef:Nn,useState:Nn,useDebugValue:Nn,useDeferredValue:Nn,useTransition:Nn,useMutableSource:Nn,useSyncExternalStore:Nn,useId:Nn,unstable_isNewReconciler:!1},Dq={readContext:di,useCallback:function(e,t){return po().memoizedState=[e,t===void 0?null:t],e},useContext:di,useEffect:oj,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,_x(4194308,4,I6.bind(null,t,e),r)},useLayoutEffect:function(e,t){return _x(4194308,4,e,t)},useInsertionEffect:function(e,t){return _x(4,2,e,t)},useMemo:function(e,t){var r=po();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=po();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=Iq.bind(null,xr,e),[n.memoizedState,e]},useRef:function(e){var t=po();return e={current:e},t.memoizedState=e},useState:ij,useDebugValue:rk,useDeferredValue:function(e){return po().memoizedState=e},useTransition:function(){var e=ij(!1),t=e[0];return e=Lq.bind(null,e[1]),po().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=xr,a=po();if(vr){if(r===void 0)throw Error(Ce(407));r=r()}else{if(r=t(),sn===null)throw Error(Ce(349));Xc&30||S6(n,t,r)}a.memoizedState=r;var i={value:r,getSnapshot:t};return a.queue=i,oj(T6.bind(null,n,i,e),[e]),n.flags|=2048,Eg(9,C6.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=po(),t=sn.identifierPrefix;if(vr){var r=ws,n=bs;r=(n&~(1<<32-Ri(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Dg++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[mo]=t,e[Lg]=n,X6(e,t,!1,!1),t.stateNode=e;e:{switch(o=mT(r,n),r){case"dialog":lr("cancel",e),lr("close",e),a=n;break;case"iframe":case"object":case"embed":lr("load",e),a=n;break;case"video":case"audio":for(a=0;aNf&&(t.flags|=128,n=!0,Wv(i,!1),t.lanes=4194304)}else{if(!n)if(e=v_(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Wv(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!vr)return kn(t),null}else 2*Dr()-i.renderingStartTime>Nf&&r!==1073741824&&(t.flags|=128,n=!0,Wv(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(r=i.last,r!==null?r.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Dr(),t.sibling=null,r=yr.current,sr(yr,n?r&1|2:r&1),t):(kn(t),null);case 22:case 23:return lk(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Ca&1073741824&&(kn(t),t.subtreeFlags&6&&(t.flags|=8192)):kn(t),null;case 24:return null;case 25:return null}throw Error(Ce(156,t.tag))}function Vq(e,t){switch(GN(t),t.tag){case 1:return ga(t.type)&&s_(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Mf(),ur(pa),ur(Fn),KN(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return qN(t),null;case 13:if(ur(yr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ce(340));Cf()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ur(yr),null;case 4:return Mf(),null;case 10:return $N(t.type._context),null;case 22:case 23:return lk(),null;case 24:return null;default:return null}}var By=!1,En=!1,Gq=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function Zd(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Sr(e,t,n)}else r.current=null}function UT(e,t,r){try{r()}catch(n){Sr(e,t,n)}}var mj=!1;function Hq(e,t){if(AT=n_,e=r6(),FN(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var a=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var o=0,s=-1,l=-1,u=0,c=0,h=e,f=null;t:for(;;){for(var v;h!==r||a!==0&&h.nodeType!==3||(s=o+a),h!==i||n!==0&&h.nodeType!==3||(l=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(v=h.firstChild)!==null;)f=h,h=v;for(;;){if(h===e)break t;if(f===r&&++u===a&&(s=o),f===i&&++c===n&&(l=o),(v=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=v}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(NT={focusedElem:e,selectionRange:r},n_=!1,Ve=t;Ve!==null;)if(t=Ve,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ve=e;else for(;Ve!==null;){t=Ve;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,y=g.memoizedState,x=t.stateNode,_=x.getSnapshotBeforeUpdate(t.elementType===t.type?m:Ii(t.type,m),y);x.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ce(163))}}catch(S){Sr(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,Ve=e;break}Ve=t.return}return g=mj,mj=!1,g}function Qp(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&UT(t,r,i)}a=a.next}while(a!==n)}}function t1(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function WT(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function J6(e){var t=e.alternate;t!==null&&(e.alternate=null,J6(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[mo],delete t[Lg],delete t[IT],delete t[Tq],delete t[Mq])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Q6(e){return e.tag===5||e.tag===3||e.tag===4}function yj(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Q6(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $T(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=o_));else if(n!==4&&(e=e.child,e!==null))for($T(e,t,r),e=e.sibling;e!==null;)$T(e,t,r),e=e.sibling}function ZT(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(ZT(e,t,r),e=e.sibling;e!==null;)ZT(e,t,r),e=e.sibling}var dn=null,Di=!1;function ul(e,t,r){for(r=r.child;r!==null;)eV(e,t,r),r=r.sibling}function eV(e,t,r){if(To&&typeof To.onCommitFiberUnmount=="function")try{To.onCommitFiberUnmount(Zb,r)}catch{}switch(r.tag){case 5:En||Zd(r,t);case 6:var n=dn,a=Di;dn=null,ul(e,t,r),dn=n,Di=a,dn!==null&&(Di?(e=dn,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):dn.removeChild(r.stateNode));break;case 18:dn!==null&&(Di?(e=dn,r=r.stateNode,e.nodeType===8?tS(e.parentNode,r):e.nodeType===1&&tS(e,r),Tg(e)):tS(dn,r.stateNode));break;case 4:n=dn,a=Di,dn=r.stateNode.containerInfo,Di=!0,ul(e,t,r),dn=n,Di=a;break;case 0:case 11:case 14:case 15:if(!En&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){a=n=n.next;do{var i=a,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&UT(r,t,o),a=a.next}while(a!==n)}ul(e,t,r);break;case 1:if(!En&&(Zd(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Sr(r,t,s)}ul(e,t,r);break;case 21:ul(e,t,r);break;case 22:r.mode&1?(En=(n=En)||r.memoizedState!==null,ul(e,t,r),En=n):ul(e,t,r);break;default:ul(e,t,r)}}function xj(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Gq),t.forEach(function(n){var a=Jq.bind(null,e,n);r.has(n)||(r.add(n),n.then(a,a))})}}function Ai(e,t){var r=t.deletions;if(r!==null)for(var n=0;na&&(a=o),n&=~i}if(n=a,n=Dr()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Wq(n/1960))-n,10e?16:e,Nl===null)var n=!1;else{if(e=Nl,Nl=null,x_=0,Ht&6)throw Error(Ce(331));var a=Ht;for(Ht|=4,Ve=e.current;Ve!==null;){var i=Ve,o=i.child;if(Ve.flags&16){var s=i.deletions;if(s!==null){for(var l=0;lDr()-ok?Rc(e,0):ik|=r),ma(e,t)}function lV(e,t){t===0&&(e.mode&1?(t=Ly,Ly<<=1,!(Ly&130023424)&&(Ly=4194304)):t=1);var r=Kn();e=zs(e,t),e!==null&&(Lm(e,t,r),ma(e,r))}function Kq(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),lV(e,r)}function Jq(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Ce(314))}n!==null&&n.delete(t),lV(e,r)}var uV;uV=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||pa.current)va=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return va=!1,Bq(e,t,r);va=!!(e.flags&131072)}else va=!1,vr&&t.flags&1048576&&f6(t,c_,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;bx(e,t),e=t.pendingProps;var a=Sf(t,Fn.current);sf(t,r),a=QN(null,t,n,e,a,r);var i=ek();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ga(n)?(i=!0,l_(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,YN(t),a.updater=e1,t.stateNode=a,a._reactInternals=t,OT(t,n,e,r),t=FT(null,t,n,!0,i,r)):(t.tag=0,vr&&i&&VN(t),$n(null,t,a,r),t=t.child),t;case 16:n=t.elementType;e:{switch(bx(e,t),e=t.pendingProps,a=n._init,n=a(n._payload),t.type=n,a=t.tag=eK(n),e=Ii(n,e),a){case 0:t=BT(null,t,n,e,r);break e;case 1:t=vj(null,t,n,e,r);break e;case 11:t=dj(null,t,n,e,r);break e;case 14:t=fj(null,t,n,Ii(n.type,e),r);break e}throw Error(Ce(306,n,""))}return t;case 0:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),BT(e,t,n,a,r);case 1:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),vj(e,t,n,a,r);case 3:e:{if($6(t),e===null)throw Error(Ce(387));n=t.pendingProps,i=t.memoizedState,a=i.element,x6(e,t),f_(t,n,null,r);var o=t.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=Af(Error(Ce(423)),t),t=pj(e,t,n,r,a);break e}else if(n!==a){a=Af(Error(Ce(424)),t),t=pj(e,t,n,r,a);break e}else for(Na=Fl(t.stateNode.containerInfo.firstChild),Pa=t,vr=!0,ji=null,r=m6(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Cf(),n===a){t=Bs(e,t,r);break e}$n(e,t,n,r)}t=t.child}return t;case 5:return _6(t),e===null&&jT(t),n=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,o=a.children,kT(n,a)?o=null:i!==null&&kT(n,i)&&(t.flags|=32),W6(e,t),$n(e,t,o,r),t.child;case 6:return e===null&&jT(t),null;case 13:return Z6(e,t,r);case 4:return XN(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Tf(t,null,n,r):$n(e,t,n,r),t.child;case 11:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),dj(e,t,n,a,r);case 7:return $n(e,t,t.pendingProps,r),t.child;case 8:return $n(e,t,t.pendingProps.children,r),t.child;case 12:return $n(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,a=t.pendingProps,i=t.memoizedProps,o=a.value,sr(h_,n._currentValue),n._currentValue=o,i!==null)if(Gi(i.value,o)){if(i.children===a.children&&!pa.current){t=Bs(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){o=i.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=As(-1,r&-r),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),ET(i.return,r,t),s.lanes|=r;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(Ce(341));o.lanes|=r,s=o.alternate,s!==null&&(s.lanes|=r),ET(o,r,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}$n(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,n=t.pendingProps.children,sf(t,r),a=di(a),n=n(a),t.flags|=1,$n(e,t,n,r),t.child;case 14:return n=t.type,a=Ii(n,t.pendingProps),a=Ii(n.type,a),fj(e,t,n,a,r);case 15:return H6(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),bx(e,t),t.tag=1,ga(n)?(e=!0,l_(t)):e=!1,sf(t,r),F6(t,n,a),OT(t,n,a,r),FT(null,t,n,!0,e,r);case 19:return Y6(e,t,r);case 22:return U6(e,t,r)}throw Error(Ce(156,t.tag))};function cV(e,t){return OF(e,t)}function Qq(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ii(e,t,r,n){return new Qq(e,t,r,n)}function ck(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eK(e){if(typeof e=="function")return ck(e)?1:0;if(e!=null){if(e=e.$$typeof,e===kN)return 11;if(e===LN)return 14}return 2}function Ul(e,t){var r=e.alternate;return r===null?(r=ii(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Tx(e,t,r,n,a,i){var o=2;if(n=e,typeof e=="function")ck(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case zd:return Oc(r.children,a,i,t);case NN:o=8,a|=8;break;case sT:return e=ii(12,r,t,a|2),e.elementType=sT,e.lanes=i,e;case lT:return e=ii(13,r,t,a),e.elementType=lT,e.lanes=i,e;case uT:return e=ii(19,r,t,a),e.elementType=uT,e.lanes=i,e;case _F:return n1(r,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case yF:o=10;break e;case xF:o=9;break e;case kN:o=11;break e;case LN:o=14;break e;case bl:o=16,n=null;break e}throw Error(Ce(130,e==null?e:typeof e,""))}return t=ii(o,r,t,a),t.elementType=e,t.type=n,t.lanes=i,t}function Oc(e,t,r,n){return e=ii(7,e,n,t),e.lanes=r,e}function n1(e,t,r,n){return e=ii(22,e,n,t),e.elementType=_F,e.lanes=r,e.stateNode={isHidden:!1},e}function uS(e,t,r){return e=ii(6,e,null,t),e.lanes=r,e}function cS(e,t,r){return t=ii(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tK(e,t,r,n,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uw(0),this.expirationTimes=Uw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uw(0),this.identifierPrefix=n,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function hk(e,t,r,n,a,i,o,s,l){return e=new tK(e,t,r,s,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ii(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},YN(i),e}function rK(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vV)}catch(e){console.error(e)}}vV(),vF.exports=Oa;var pV=vF.exports,Aj=pV;iT.createRoot=Aj.createRoot,iT.hydrateRoot=Aj.hydrateRoot;/** + * @remix-run/router v1.23.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Og(){return Og=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function pk(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function lK(){return Math.random().toString(36).substr(2,8)}function kj(e,t){return{usr:e.state,key:e.key,idx:t}}function JT(e,t,r,n){return r===void 0&&(r=null),Og({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ev(t):t,{state:r,key:t&&t.key||n||lK()})}function w_(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function ev(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function uK(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,s=kl.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(Og({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function h(){s=kl.Pop;let y=c(),x=y==null?null:y-u;u=y,l&&l({action:s,location:m.location,delta:x})}function f(y,x){s=kl.Push;let _=JT(m.location,y,x);u=c()+1;let w=kj(_,u),S=m.createHref(_);try{o.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(S)}i&&l&&l({action:s,location:m.location,delta:1})}function v(y,x){s=kl.Replace;let _=JT(m.location,y,x);u=c();let w=kj(_,u),S=m.createHref(_);o.replaceState(w,"",S),i&&l&&l({action:s,location:m.location,delta:0})}function g(y){let x=a.location.origin!=="null"?a.location.origin:a.location.href,_=typeof y=="string"?y:w_(y);return _=_.replace(/ $/,"%20"),jr(x,"No window.location.(origin|href) available to create URL for href: "+_),new URL(_,x)}let m={get action(){return s},get location(){return e(a,o)},listen(y){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(Nj,h),l=y,()=>{a.removeEventListener(Nj,h),l=null}},createHref(y){return t(a,y)},createURL:g,encodeLocation(y){let x=g(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:v,go(y){return o.go(y)}};return m}var Lj;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Lj||(Lj={}));function cK(e,t,r){return r===void 0&&(r="/"),hK(e,t,r)}function hK(e,t,r,n){let a=typeof t=="string"?ev(t):t,i=gk(a.pathname||"/",r);if(i==null)return null;let o=gV(e);dK(o);let s=null,l=CK(i);for(let u=0;s==null&&u{let l={relativePath:s===void 0?i.path||"":s,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(jr(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let u=Wl([n,l.relativePath]),c=r.concat(l);i.children&&i.children.length>0&&(jr(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),gV(i.children,t,c,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:xK(u,i.index),routesMeta:c})};return e.forEach((i,o)=>{var s;if(i.path===""||!((s=i.path)!=null&&s.includes("?")))a(i,o);else for(let l of mV(i.path))a(i,o,l)}),t}function mV(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=mV(n.join("/")),s=[];return s.push(...o.map(l=>l===""?i:[i,l].join("/"))),a&&s.push(...o),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function dK(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:_K(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const fK=/^:[\w-]+$/,vK=3,pK=2,gK=1,mK=10,yK=-2,Ij=e=>e==="*";function xK(e,t){let r=e.split("/"),n=r.length;return r.some(Ij)&&(n+=yK),t&&(n+=pK),r.filter(a=>!Ij(a)).reduce((a,i)=>a+(fK.test(i)?vK:i===""?gK:mK),n)}function _K(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function bK(e,t,r){let{routesMeta:n}=e,a={},i="/",o=[];for(let s=0;s{let{paramName:f,isOptional:v}=c;if(f==="*"){let m=s[h]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const g=s[h];return v&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function SK(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),pk(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,s,l)=>(n.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function CK(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return pk(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function gk(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const TK=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,MK=e=>TK.test(e);function AK(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?ev(e):e,i;if(r)if(MK(r))i=r;else{if(r.includes("//")){let o=r;r=yV(r),pk(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=Pj(r.substring(1),"/"):i=Pj(r,t)}else i=t;return{pathname:i,search:LK(n),hash:IK(a)}}function Pj(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function hS(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function NK(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function mk(e,t){let r=NK(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function yk(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=ev(e):(a=Og({},e),jr(!a.pathname||!a.pathname.includes("?"),hS("?","pathname","search",a)),jr(!a.pathname||!a.pathname.includes("#"),hS("#","pathname","hash",a)),jr(!a.search||!a.search.includes("#"),hS("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,s;if(o==null)s=r;else{let h=t.length-1;if(!n&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;a.pathname=f.join("/")}s=h>=0?t[h]:"/"}let l=AK(a,s),u=o&&o!=="/"&&o.endsWith("/"),c=(i||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const yV=e=>e.replace(/\/\/+/g,"/"),Wl=e=>yV(e.join("/")),kK=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),LK=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,IK=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function PK(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const xV=["post","put","patch","delete"];new Set(xV);const DK=["get",...xV];new Set(DK);/** + * React Router v6.30.4 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function zg(){return zg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{s.current=!0}),E.useCallback(function(u,c){if(c===void 0&&(c={}),!s.current)return;if(typeof u=="number"){n.go(u);return}let h=yk(u,JSON.parse(o),i,c.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Wl([t,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[t,n,o,i,e])}function wV(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=E.useContext(mu),{matches:a}=E.useContext(yu),{pathname:i}=xu(),o=JSON.stringify(mk(a,n.v7_relativeSplatPath));return E.useMemo(()=>yk(e,JSON.parse(o),i,r==="path"),[e,o,i,r])}function OK(e,t){return zK(e,t)}function zK(e,t,r,n){tv()||jr(!1);let{navigator:a}=E.useContext(mu),{matches:i}=E.useContext(yu),o=i[i.length-1],s=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=xu(),c;if(t){var h;let y=typeof t=="string"?ev(t):t;l==="/"||(h=y.pathname)!=null&&h.startsWith(l)||jr(!1),c=y}else c=u;let f=c.pathname||"/",v=f;if(l!=="/"){let y=l.replace(/^\//,"").split("/");v="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let g=cK(e,{pathname:v}),m=HK(g&&g.map(y=>Object.assign({},y,{params:Object.assign({},s,y.params),pathname:Wl([l,a.encodeLocation?a.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Wl([l,a.encodeLocation?a.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,r,n);return t&&m?E.createElement(l1.Provider,{value:{location:zg({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:kl.Pop}},m):m}function BK(){let e=ZK(),t=PK(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},t),r?E.createElement("pre",{style:a},r):null,null)}const FK=E.createElement(BK,null);class VK extends E.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?E.createElement(yu.Provider,{value:this.props.routeContext},E.createElement(_V.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function GK(e){let{routeContext:t,match:r,children:n}=e,a=E.useContext(xk);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),E.createElement(yu.Provider,{value:t},n)}function HK(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,s=(a=r)==null?void 0:a.errors;if(s!=null){let c=o.findIndex(h=>h.route.id&&(s==null?void 0:s[h.route.id])!==void 0);c>=0||jr(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,h,f)=>{let v,g=!1,m=null,y=null;r&&(v=s&&h.route.id?s[h.route.id]:void 0,m=h.route.errorElement||FK,l&&(u<0&&f===0?(XK("route-fallback"),g=!0,y=null):u===f&&(g=!0,y=h.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,f+1)),_=()=>{let w;return v?w=m:g?w=y:h.route.Component?w=E.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=c,E.createElement(GK,{match:h,routeContext:{outlet:c,matches:x,isDataRoute:r!=null},children:w})};return r&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?E.createElement(VK,{location:r.location,revalidation:r.revalidation,component:m,error:v,children:_(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):_()},null)}var SV=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(SV||{}),CV=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(CV||{});function UK(e){let t=E.useContext(xk);return t||jr(!1),t}function WK(e){let t=E.useContext(jK);return t||jr(!1),t}function $K(e){let t=E.useContext(yu);return t||jr(!1),t}function TV(e){let t=$K(),r=t.matches[t.matches.length-1];return r.route.id||jr(!1),r.route.id}function ZK(){var e;let t=E.useContext(_V),r=WK(),n=TV();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function YK(){let{router:e}=UK(SV.UseNavigateStable),t=TV(CV.UseNavigateStable),r=E.useRef(!1);return bV(()=>{r.current=!0}),E.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,zg({fromRouteId:t},i)))},[e,t])}const Dj={};function XK(e,t,r){Dj[e]||(Dj[e]=!0)}function qK(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function jj(e){let{to:t,replace:r,state:n,relative:a}=e;tv()||jr(!1);let{future:i,static:o}=E.useContext(mu),{matches:s}=E.useContext(yu),{pathname:l}=xu(),u=jm(),c=yk(t,mk(s,i.v7_relativeSplatPath),l,a==="path"),h=JSON.stringify(c);return E.useEffect(()=>u(JSON.parse(h),{replace:r,state:n,relative:a}),[u,h,a,r,n]),null}function nr(e){jr(!1)}function KK(e){let{basename:t="/",children:r=null,location:n,navigationType:a=kl.Pop,navigator:i,static:o=!1,future:s}=e;tv()&&jr(!1);let l=t.replace(/^\/*/,"/"),u=E.useMemo(()=>({basename:l,navigator:i,static:o,future:zg({v7_relativeSplatPath:!1},s)}),[l,s,i,o]);typeof n=="string"&&(n=ev(n));let{pathname:c="/",search:h="",hash:f="",state:v=null,key:g="default"}=n,m=E.useMemo(()=>{let y=gk(c,l);return y==null?null:{location:{pathname:y,search:h,hash:f,state:v,key:g},navigationType:a}},[l,c,h,f,v,g,a]);return m==null?null:E.createElement(mu.Provider,{value:u},E.createElement(l1.Provider,{children:r,value:m}))}function JK(e){let{children:t,location:r}=e;return OK(QT(t),r)}new Promise(()=>{});function QT(e,t){t===void 0&&(t=[]);let r=[];return E.Children.forEach(e,(n,a)=>{if(!E.isValidElement(n))return;let i=[...t,a];if(n.type===E.Fragment){r.push.apply(r,QT(n.props.children,i));return}n.type!==nr&&jr(!1),!n.props.index||!n.props.children||jr(!1);let o={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=QT(n.props.children,i)),r.push(o)}),r}/** + * React Router DOM v6.30.4 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function eM(){return eM=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function rJ(e,t){let r=tM(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const nJ=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],aJ="6";try{window.__reactRouterVersion=aJ}catch{}const iJ="startTransition",Ej=qY[iJ];function oJ(e){let{basename:t,children:r,future:n,window:a}=e,i=E.useRef();i.current==null&&(i.current=sK({window:a,v5Compat:!0}));let o=i.current,[s,l]=E.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},c=E.useCallback(h=>{u&&Ej?Ej(()=>l(h)):l(h)},[l,u]);return E.useLayoutEffect(()=>o.listen(c),[o,c]),E.useEffect(()=>qK(n),[n]),E.createElement(KK,{basename:t,children:r,location:s.location,navigationType:s.action,navigator:o,future:n})}const sJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",lJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,uf=E.forwardRef(function(t,r){let{onClick:n,relative:a,reloadDocument:i,replace:o,state:s,target:l,to:u,preventScrollReset:c,viewTransition:h}=t,f=QK(t,nJ),{basename:v}=E.useContext(mu),g,m=!1;if(typeof u=="string"&&lJ.test(u)&&(g=u,sJ))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=gk(S.pathname,v);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:m=!0}catch{}let y=EK(u,{relative:a}),x=uJ(u,{replace:o,state:s,target:l,preventScrollReset:c,relative:a,viewTransition:h});function _(w){n&&n(w),w.defaultPrevented||x(w)}return E.createElement("a",eM({},f,{href:g||y,onClick:m||i?n:_,ref:r,target:l}))});var Rj;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Rj||(Rj={}));var Oj;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Oj||(Oj={}));function uJ(e,t){let{target:r,replace:n,state:a,preventScrollReset:i,relative:o,viewTransition:s}=t===void 0?{}:t,l=jm(),u=xu(),c=wV(e,{relative:o});return E.useCallback(h=>{if(tJ(h,r)){h.preventDefault();let f=n!==void 0?n:w_(u)===w_(c);l(e,{replace:f,state:a,preventScrollReset:i,relative:o,viewTransition:s})}},[u,l,c,n,a,r,e,i,o,s])}function cJ(e){let t=E.useRef(tM(e)),r=E.useRef(!1),n=xu(),a=E.useMemo(()=>rJ(n.search,r.current?null:t.current),[n.search]),i=jm(),o=E.useCallback((s,l)=>{const u=tM(typeof s=="function"?s(a):s);r.current=!0,i("?"+u,l)},[i,a]);return[a,o]}const MV=E.createContext({dirty:!1,setDirty:()=>{}});function hJ({children:e}){const[t,r]=E.useState(!1);return E.useEffect(()=>{const n=a=>{t&&(a.preventDefault(),a.returnValue="")};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t]),d.jsx(MV.Provider,{value:{dirty:t,setDirty:r},children:e})}function $i(){return E.useContext(MV)}/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dJ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),AV=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var fJ={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.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vJ=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...s},l)=>E.createElement("svg",{ref:l,...fJ,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:AV("lucide",a),...s},[...o.map(([u,c])=>E.createElement(u,c)),...Array.isArray(i)?i:[i]]));/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ge=(e,t)=>{const r=E.forwardRef(({className:n,...a},i)=>E.createElement(vJ,{ref:i,iconNode:t,className:AV(`lucide-${dJ(e)}`,n),...a}));return r.displayName=`${e}`,r};/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Oo=Ge("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zj=Ge("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NV=Ge("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kV=Ge("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _k=Ge("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pJ=Ge("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bj=Ge("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const u1=Ge("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Yr=Ge("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Em=Ge("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ah=Ge("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gJ=Ge("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Nh=Ge("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bk=Ge("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fj=Ge("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LV=Ge("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mJ=Ge("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kh=Ge("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yJ=Ge("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IV=Ge("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** + * @license lucide-react v0.383.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=Ge("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DV=Ge("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xJ=Ge("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jV=Ge("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _J=Ge("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c1=Ge("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Jc=Ge("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h1=Ge("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rv=Ge("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EV=Ge("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Rm=Ge("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bJ=Ge("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wJ=Ge("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SJ=Ge("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d1=Ge("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RV=Ge("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OV=Ge("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nv=Ge("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const av=Ge("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zV=Ge("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wk=Ge("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kf=Ge("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CJ=Ge("MousePointer",[["path",{d:"m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z",key:"y2ucgo"}],["path",{d:"m13 13 6 6",key:"1nhxnf"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Sk=Ge("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const si=Ge("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _i=Ge("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Zi=Ge("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xa=Ge("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TJ=Ge("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f1=Ge("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _a=Ge("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v1=Ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BV=Ge("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MJ=Ge("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FV=Ge("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bg=Ge("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VV=Ge("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GV=Ge("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HV=Ge("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const li=Ge("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vi=Ge("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UV=Ge("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AJ=Ge("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _u=Ge("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.383.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rM=Ge("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);async function Nr(e){const t=await fetch(e);if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function NJ(){return Nr("/api/serial-ports")}async function Vj(){return Nr("/api/status")}async function kJ(){return Nr("/api/health")}async function LJ(){return Nr("/api/nodes")}async function IJ(){return Nr("/api/edges")}async function PJ(){return Nr("/api/sources")}async function Ao(e){const t=e?`/api/config/${e}`:"/api/config";return Nr(t)}async function Da(e,t){const r=await fetch(`/api/config/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`API error: ${r.status} ${r.statusText}`);return r.json()}async function DJ(){return Nr("/api/config/generic_sources")}async function jJ(e){const t=await fetch("/api/config/generic_sources",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok)throw new Error(r.detail||`Save failed (${t.status})`);return r}async function EJ(e,t,r){return(await fetch("/api/generic-sources/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,items_path:t,headers:r})})).json()}async function RJ(){return Nr("/api/alerts/active")}async function OJ(e=100,t,r){const n=new URLSearchParams;return n.set("limit",e.toString()),t&&t!=="all"&&n.set("transport",t),r&&r!=="all"&&n.set("category",r),Nr(`/api/activity?${n.toString()}`)}async function WV(){return Nr("/api/env/status")}async function $V(){return Nr("/api/env/active")}async function zJ(){return Nr("/api/env/swpc")}async function BJ(){return Nr("/api/regions")}async function FJ(){return Nr("/api/meshcore/channels")}async function ZV(){return Nr("/api/meshcore/channels/detail")}async function VJ(e,t){const r=await fetch("/api/meshcore/channels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,key:t||void 0})});if(!r.ok){const n=await r.json().catch(()=>null);throw new Error((n==null?void 0:n.detail)||`API error: ${r.status} ${r.statusText}`)}return r.json()}async function GJ(e){const t=await fetch(`/api/meshcore/channels/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.detail)||`API error: ${t.status} ${t.statusText}`)}return t.json()}async function HJ(){return Nr("/api/meshcore/rooms")}async function UJ(e,t){const r=await fetch(`/api/meshcore/room-password/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:t})});if(!r.ok)throw new Error(`API error: ${r.status} ${r.statusText}`);return r.json()}async function WJ(e){const t=await fetch(`/api/meshcore/room-password/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function Gj(){return Nr("/api/meshcore/contacts")}async function Hj(){return Nr("/api/meshcore/self")}async function $J(){const e=await fetch("/api/meshcore/contacts/refresh",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>null);throw new Error((t==null?void 0:t.detail)||`API error: ${e.status} ${e.statusText}`)}return e.json()}async function ZJ(e){const t=await fetch("/api/meshcore/contacts/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contacts:e})});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.detail)||`API error: ${t.status} ${t.statusText}`)}return t.json()}async function YJ(e){const t=await fetch(`/api/meshcore/contacts/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.detail)||`API error: ${t.status} ${t.statusText}`)}return t.json()}async function XJ(){return Nr("/api/meshcore/route-health")}async function qJ(){const e=await fetch("/api/meshcore/advert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!e.ok)throw new Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function KJ(){return Nr("/api/config/connection")}async function JJ(){return Nr("/api/meshcore/telemetry")}async function QJ(e){const t=await fetch("/api/meshcore/telemetry/poll",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contact:e})});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function YV(e){const t=await fetch("/api/mesh/test-send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}function XV(){const[e,t]=E.useState(!1),[r,n]=E.useState(null),[a,i]=E.useState(null),[o,s]=E.useState(null),l=E.useRef(null),u=E.useRef(null),c=E.useRef(1e3),h=E.useCallback(()=>{var g;if(((g=l.current)==null?void 0:g.readyState)===WebSocket.OPEN)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/live`;try{const m=new WebSocket(v);l.current=m,m.onopen=()=>{t(!0),c.current=1e3},m.onmessage=x=>{try{const _=JSON.parse(x.data);switch(s(_),_.type){case"health_update":n(_.data);break;case"alert_fired":i(_.data);break}}catch(_){console.error("Failed to parse WebSocket message:",_)}},m.onclose=()=>{t(!1),l.current=null;const x=Math.min(c.current,3e4);u.current=window.setTimeout(()=>{c.current=Math.min(x*2,3e4),h()},x)},m.onerror=()=>{m.close()};const y=setInterval(()=>{m.readyState===WebSocket.OPEN&&m.send("ping")},3e4);m.addEventListener("close",()=>{clearInterval(y)})}catch(m){console.error("Failed to create WebSocket:",m)}},[]);return E.useEffect(()=>(h(),()=>{u.current&&clearTimeout(u.current),l.current&&l.current.close()}),[h]),{connected:e,lastHealth:r,lastAlert:a,lastMessage:o}}const qV=E.createContext(null);function eQ(){const e=E.useContext(qV);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}function tQ(e){switch(e==null?void 0:e.toLowerCase()){case"critical":case"emergency":return{bg:"bg-red-500/10",border:"border-red-500",icon:Nh,iconColor:"text-red-500"};case"warning":return{bg:"bg-amber-500/10",border:"border-amber-500",icon:vi,iconColor:"text-amber-500"};default:return{bg:"bg-sky-400/10",border:"border-sky-400",icon:d1,iconColor:"text-sky-400"}}}function rQ({toast:e,onDismiss:t,onNavigate:r}){const n=tQ(e.alert.severity),a=n.icon;return E.useEffect(()=>{const i=setTimeout(t,8e3);return()=>clearTimeout(i)},[t]),d.jsx("div",{className:`${n.bg} border ${n.border} shadow-lg overflow-hidden animate-slide-in cursor-pointer`,onClick:r,role:"alert",children:d.jsxs("div",{className:"flex items-start gap-3 p-4",children:[d.jsx("div",{className:`w-1 self-stretch -ml-4 -my-4 ${n.border.replace("border","bg")}`}),d.jsx(a,{size:18,className:n.iconColor}),d.jsxs("div",{className:"flex-1 min-w-0 pr-2",children:[d.jsx("div",{className:"text-sm font-medium text-slate-200 mb-0.5",children:e.alert.type.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}),d.jsx("div",{className:"text-sm text-slate-300 line-clamp-2",children:e.alert.message})]}),d.jsx("button",{onClick:i=>{i.stopPropagation(),t()},className:"text-slate-400 hover:text-slate-200 transition-colors",children:d.jsx(_u,{size:16})})]})})}function nQ({children:e}){const[t,r]=E.useState([]),n=jm(),a=E.useCallback(s=>{const l=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>[...u,{id:l,alert:s}])},[]),i=E.useCallback(s=>{r(l=>l.filter(u=>u.id!==s))},[]),o=E.useCallback(()=>{n("/alerts")},[n]);return d.jsxs(qV.Provider,{value:{addToast:a},children:[e,d.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm w-full pointer-events-none",children:t.map(s=>d.jsx("div",{className:"pointer-events-auto",children:d.jsx(rQ,{toast:s,onDismiss:()=>i(s.id),onNavigate:o})},s.id))})]})}const p1="meshai.restartRequired.v1";function Uj(){try{const e=localStorage.getItem(p1);if(!e)return{required:!1,changedKeys:[],ts:0};const t=JSON.parse(e);return{required:!!t.required,changedKeys:Array.isArray(t.changedKeys)?t.changedKeys:[],ts:Number(t.ts)||0}}catch{return{required:!1,changedKeys:[],ts:0}}}function bu(e){const t={required:!0,changedKeys:[...new Set(e)],ts:Date.now()};localStorage.setItem(p1,JSON.stringify(t)),window.dispatchEvent(new CustomEvent("meshai:restart-required",{detail:t}))}function Wj(){localStorage.removeItem(p1),window.dispatchEvent(new CustomEvent("meshai:restart-required",{detail:{required:!1,changedKeys:[],ts:0}}))}function aQ(){const[e,t]=E.useState(()=>Uj()),[r,n]=E.useState(!1),[a,i]=E.useState(null);E.useEffect(()=>{const l=c=>{const h=c.detail;t(h)},u=c=>{c.key===p1&&t(Uj())};return window.addEventListener("meshai:restart-required",l),window.addEventListener("storage",u),()=>{window.removeEventListener("meshai:restart-required",l),window.removeEventListener("storage",u)}},[]);const o=E.useCallback(async()=>{n(!0),i(null);try{const l=await fetch("/api/restart",{method:"POST"});if(!l.ok&&l.status!==202){const u=await l.json().catch(()=>({}));throw new Error(u.detail||`HTTP ${l.status}`)}Wj()}catch(l){i(String(l)),n(!1)}},[]),s=E.useCallback(()=>{Wj()},[]);return e.required?d.jsxs("div",{className:"bg-yellow-900/40 border-b border-yellow-700 text-yellow-100 px-4 py-2 text-sm flex items-center gap-3",children:[d.jsx(vi,{className:"w-4 h-4 flex-shrink-0 text-yellow-300"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("strong",{children:"Restart required"}),e.changedKeys.length>0&&d.jsxs("span",{className:"text-yellow-300 ml-2",children:["(",e.changedKeys.length," key",e.changedKeys.length===1?"":"s",":"," ",d.jsxs("span",{className:"font-mono text-xs",children:[e.changedKeys.slice(0,3).join(", "),e.changedKeys.length>3?", …":""]}),")"]}),d.jsxs("span",{className:"ml-2 text-yellow-300/80",children:["for these changes to take effect. Click ",d.jsx("strong",{children:"Restart now"})," — it restarts the bot process in place (a few seconds; the dashboard briefly reconnects), NOT the container. Until then the runtime keeps its boot-time configuration. Restart-required keys include transport connections and anything under Config → environmental (feed_source, central URL), the LLM backend swap, and the dispatcher cold-start grace window. Other keys take effect on the next handler call."]}),a&&d.jsx("div",{className:"text-red-400 text-xs mt-1",children:a})]}),d.jsxs("button",{onClick:o,disabled:r,className:"flex items-center gap-1 px-3 py-1 bg-yellow-700 hover:bg-yellow-600 disabled:opacity-50 rounded text-white text-xs",children:[d.jsx(TJ,{className:`w-3 h-3 ${r?"animate-spin":""}`}),r?"Restarting…":"Restart now"]}),d.jsx("button",{onClick:s,className:"text-yellow-300 hover:text-white px-1",title:"Dismiss (you can still restart later)",children:d.jsx(_u,{className:"w-4 h-4"})})]}):null}const KV=[{header:"General",items:[{path:"/",label:"Dashboard",icon:OV},{path:"/config",label:"Settings",icon:FV},{path:"/environment",label:"Data Feeds",icon:kh},{path:"/activity",label:"Activity Log",icon:Oo},{path:"/places",label:"Places",icon:av},{path:"/coverage",label:"Coverage",icon:zV}]},{header:"Meshtastic",items:[{path:"/meshtastic/connection",label:"Connection",icon:AJ},{path:"/meshtastic/routing",label:"Routing",icon:zj},{path:"/meshtastic/scheduled",label:"Scheduled Broadcasts",icon:Bj},{path:"/meshtastic/nodes",label:"Nodes & Health",icon:Oo},{path:"/meshtastic/danger-zones",label:"Danger Zones",icon:vi}]},{header:"MeshCore",items:[{path:"/meshcore/connection",label:"Connection",icon:Sk},{path:"/meshcore/routing",label:"Routing",icon:zj},{path:"/meshcore/scheduled",label:"Scheduled Broadcasts",icon:Bj},{path:"/meshcore/contacts",label:"Contacts & Companion",icon:UV},{path:"/meshcore/danger-zones",label:"Danger Zones",icon:vi}]},{header:"Documentation",items:[{path:"/reference",label:"Reference",icon:kV}]}],iQ=[{path:"/adapter-config",label:"Adapter Config",icon:Bg},{path:"/gauge-sites",label:"Gauge Sites",icon:c1},{path:"/town-anchors",label:"Town Anchors",icon:av},{path:"/mesh",label:"Mesh",icon:_i},{path:"/meshtastic/sources",label:"Sources",icon:RV},{path:"/meshcore/companion",label:"Companion",icon:_k}],$j=[...KV.flatMap(e=>e.items),...iQ],Zj={"/places":"Places","/meshtastic/scheduled":"Scheduled Broadcasts","/meshcore/scheduled":"Scheduled Broadcasts","/meshtastic/nodes":"Nodes & Health","/meshtastic/danger-zones":"Danger Zones","/meshcore/danger-zones":"Danger Zones","/meshcore/contacts":"Contacts & Companion","/meshcore/companion":"Contacts & Companion"};function oQ(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60);return t>0?`${t}d ${r}h`:r>0?`${r}h ${n}m`:`${n}m`}function sQ(e,t,r,n){const a=e.path.includes("?")?`${t}${r}`===e.path:t===e.path,i=e.icon;return d.jsxs(uf,{to:e.path,onClick:o=>n(e.path,o),className:`flex items-center gap-3 px-5 py-3 text-sm font-sans transition-colors relative ${a?"text-white bg-transparent":"text-[#777] hover:text-white hover:bg-bg-hover"}`,children:[a&&d.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-[2px] bg-[#f59e0b]"}),d.jsx(i,{size:16}),e.label]},e.path)}function lQ(e){const t=e.split("?")[0];if(Zj[t])return Zj[t];const r=$j.find(a=>a.path===e);if(r)return r.label;const n=$j.find(a=>a.path.split("?")[0]===t);return(n==null?void 0:n.label)||"Dashboard"}function uQ({children:e}){var y;const t=xu(),r=jm(),{dirty:n,setDirty:a}=$i(),{connected:i,lastAlert:o}=XV(),{addToast:s}=eQ(),[l,u]=E.useState(null),[c,h]=E.useState(null),f=(x,_)=>{n&&(_.preventDefault(),window.confirm("You have unsaved changes. Discard them?")&&(a(!1),r(x)))};E.useEffect(()=>{if(o){const x=`${o.type}-${o.message}-${o.timestamp}`;x!==c&&(h(x),s(o))}},[o,c,s]);const[v,g]=E.useState(new Date);E.useEffect(()=>{Vj().then(u).catch(console.error);const x=setInterval(()=>{Vj().then(u).catch(console.error)},3e4);return()=>clearInterval(x)},[]),E.useEffect(()=>{const x=setInterval(()=>g(new Date),1e3);return()=>clearInterval(x)},[]);const m=v.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return d.jsxs("div",{className:"flex h-screen overflow-hidden bg-bg text-white",children:[d.jsxs("aside",{className:"w-[220px] flex-shrink-0 bg-bg-card border-r border-border flex flex-col overflow-y-auto",children:[d.jsxs("div",{className:"bg-[#000000] px-4 py-3 border-b border-border flex flex-col items-center",children:[d.jsx("img",{src:"/meshai-logo.png",alt:"MeshAI",className:"w-[190px] block"}),d.jsxs("div",{className:"font-mono text-[10px] text-[#555] mt-1 self-start",children:["v",(l==null?void 0:l.version)||"..."]})]}),d.jsx("nav",{className:"flex-1 py-4",children:KV.map(x=>d.jsxs("div",{className:"mt-4",children:[d.jsx("div",{className:"px-5 pt-2 pb-1 text-[10px] font-sans font-semibold uppercase tracking-wider text-[#555]",children:x.header}),x.items.map(_=>sQ(_,t.pathname,t.search,f))]},x.header))}),d.jsxs("div",{className:"p-5 border-t border-border",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${l!=null&&l.connected?"bg-green-500":"bg-red-500"}`}),d.jsx("span",{className:"text-xs font-sans text-[#777]",children:l!=null&&l.connected?"Connected":"Disconnected"})]}),d.jsxs("div",{className:"text-xs font-mono text-[#666] truncate",children:[(y=l==null?void 0:l.connection_type)==null?void 0:y.toUpperCase(),": ",l==null?void 0:l.connection_target]}),d.jsxs("div",{className:"text-xs font-sans text-[#666] mt-1",children:["Uptime: ",d.jsx("span",{className:"font-mono",children:l?oQ(l.uptime_seconds):"..."})]})]})]}),d.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[d.jsxs("header",{className:"h-14 flex-shrink-0 border-b border-border bg-bg-card flex items-center justify-between px-6",children:[d.jsx("h1",{className:"text-lg font-sans font-semibold text-white",children:lQ(t.pathname+t.search)}),d.jsxs("div",{className:"flex items-center gap-6",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${i?"bg-accent animate-pulse-slow":"bg-[#333]"}`}),d.jsx("span",{className:"text-xs font-sans text-[#777]",children:i?"Live":"Offline"})]}),d.jsxs("div",{className:"text-sm font-mono text-[#666]",children:[m," MT"]})]})]}),d.jsxs("main",{className:"flex-1 overflow-y-auto p-6",children:[d.jsx(aQ,{}),e]})]})]})}function cQ({health:e}){const t=e.score,r=e.tier,n=2*Math.PI*45,a=t/100*n;return d.jsx("div",{className:"flex flex-col items-center",children:d.jsxs("svg",{width:"140",height:"140",viewBox:"0 0 100 100",children:[d.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"#1e1e1e",strokeWidth:"8"}),d.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"#f59e0b",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:n,strokeDashoffset:n-a,transform:"rotate(-90 50 50)",className:"transition-all duration-500"}),d.jsx("text",{x:"50",y:"46",textAnchor:"middle",className:"font-mono font-bold",style:{fontSize:"24px",fill:"#f59e0b"},children:t.toFixed(1)}),d.jsx("text",{x:"50",y:"62",textAnchor:"middle",className:"font-sans",style:{fontSize:"10px",fill:"#444"},children:r})]})})}function Zv({label:e,value:t}){const r=n=>n>66?"bg-accent":n>33?"bg-accent-dim":"bg-red-500";return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-24 text-xs font-sans text-[#777] truncate",children:e}),d.jsx("div",{className:"flex-1 h-2 bg-border overflow-hidden",children:d.jsx("div",{className:`h-full ${r(t)} transition-all duration-300`,style:{width:`${t}%`}})}),d.jsx("div",{className:"w-12 text-right text-xs font-mono text-[#e0e0e0]",children:t.toFixed(1)})]})}function hQ({alert:e}){const r=(a=>{switch(a.toLowerCase()){case"critical":case"emergency":case"immediate":return{bg:"bg-red-500/5",border:"border-red-500",icon:Nh,iconColor:"text-red-500"};case"warning":case"priority":return{bg:"bg-accent/5",border:"border-accent",icon:vi,iconColor:"text-accent"};case"routine":default:return{bg:"bg-[#161616]",border:"border-[#333]",icon:d1,iconColor:"text-[#777]"}}})(e.severity),n=r.icon;return d.jsxs("div",{className:`p-3 ${r.bg} border-l-2 ${r.border} flex items-start gap-3`,children:[d.jsx(n,{size:16,className:r.iconColor}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-sans font-medium text-white",children:e.message}),d.jsx("div",{className:"text-[10px] font-mono text-[#666] mt-1",children:e.timestamp||"Just now"})]})]})}function dQ({source:e}){const t=()=>e.is_loaded?e.last_error?"bg-accent":"bg-green-500":"bg-red-500";return d.jsxs("div",{className:"flex items-center gap-3 p-2 bg-bg-hover",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${t()}`}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-sans font-medium text-white truncate",children:e.name}),d.jsxs("div",{className:"text-[10px] font-sans text-[#666]",children:[e.node_count," nodes · ",e.type]})]})]})}function Gy({icon:e,label:t,value:r,subvalue:n,accent:a}){return d.jsxs("div",{className:"bg-bg-card border border-border p-3",style:a?{borderTopWidth:"2px",borderTopColor:a}:void 0,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(e,{size:14,style:{color:a||"#333"}}),d.jsx("span",{className:"text-[9px] font-sans uppercase tracking-widest text-[#666]",children:t})]}),d.jsx("div",{className:"font-mono text-xl",style:{color:a||"#e0e0e0"},children:r}),n&&d.jsx("div",{className:"text-[9px] font-sans mt-1 text-[#666]",children:n})]})}function fQ({bandConditions:e}){const t=i=>{switch(i){case"Good":return"bg-green-500";case"Fair":return"bg-accent";case"Poor":return"bg-red-500";default:return"bg-[#333]"}},r=i=>{switch(i){case"Good":return"text-green-500";case"Fair":return"text-accent";case"Poor":return"text-red-500";default:return"text-[#666]"}},n=i=>i?i.includes("Night")?"🌙":"☀️":"";if(!(e!=null&&e.enabled)||!(e!=null&&e.ratings))return d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[d.jsx(rM,{size:14}),"RF Propagation"]}),d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsx("div",{className:"text-center py-8",children:d.jsx("div",{className:"font-sans text-[#666]",children:"No band conditions data"})})})]});const a=["80-40m","30-20m","17-15m","12-10m"];return d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[d.jsx(rM,{size:14}),"RF Propagation"]}),d.jsxs("div",{className:"text-center mb-3",children:[d.jsx("span",{className:"text-lg",children:n(e.slot_label)}),d.jsx("span",{className:"text-sm font-sans text-[#777] ml-2",children:e.slot_label})]}),d.jsx("div",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-2 flex items-center gap-1",children:"📡 Band Conditions"}),d.jsx("div",{className:"space-y-1.5",children:a.map(i=>{var s;const o=(s=e.ratings)==null?void 0:s[i];return d.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-bg-hover",children:[d.jsx("span",{className:"text-sm font-mono text-[#777]",children:i}),d.jsxs("span",{className:"text-sm flex items-center gap-2",children:[d.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${t(o)}`}),d.jsx("span",{className:`font-sans ${r(o)}`,children:o||"—"})]})]},i)})}),d.jsxs("div",{className:"mt-auto pt-3 border-t border-border text-[10px] font-sans text-[#666]",children:[e.source&&d.jsx("span",{children:e.source==="swpc_local"?"SWPC":"HamQSL"}),e.sent_at&&d.jsx("span",{className:"font-mono ml-2",children:new Date(e.sent_at*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}const Yj=[{code:"wam",label:"Western North America"},{code:"eam",label:"Eastern North America"},{code:"enp",label:"Eastern North Pacific"},{code:"esp",label:"Eastern South Pacific"},{code:"gca",label:"Gulf-Caribbean"},{code:"nsa",label:"Northern South America"},{code:"csa",label:"Central South America"},{code:"sat",label:"South Atlantic"},{code:"nat",label:"North Atlantic"},{code:"ena",label:"Eastern North Atlantic"},{code:"nwe",label:"Northwestern Europe"},{code:"eur",label:"Europe"},{code:"eeu",label:"Eastern Europe"},{code:"saf",label:"South Africa"},{code:"mde",label:"Middle East"},{code:"nca",label:"North Central Asia"},{code:"ind",label:"Indian Ocean"},{code:"sea",label:"Southeast Asia"},{code:"fea",label:"Far East"},{code:"esi",label:"Eastern Siberia"},{code:"anz",label:"Australia & New Zealand"},{code:"oce",label:"Oceania"},{code:"wnp",label:"Western North Pacific"}];function vQ(){var c;const[e,t]=E.useState("wam"),[r,n]=E.useState(!1),[a,i]=E.useState(!1);E.useEffect(()=>{fetch("/api/adapter-config/dashboard/tropo_region").then(h=>h.ok?h.json():null).then(h=>{h!=null&&h.value&&typeof h.value=="string"&&t(h.value)}).catch(()=>{})},[]);const o=h=>{t(h),n(!1),i(!0),fetch("/api/adapter-config/dashboard/tropo_region",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:h})}).catch(()=>{}).finally(()=>i(!1))},s=new Date().toISOString().slice(0,10).replace(/-/g,""),l=`https://www.dxinfocentre.com/tr_map/fcst/${e}006.png?v${s}`,u=((c=Yj.find(h=>h.code===e))==null?void 0:c.label)||e;return d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col",children:[d.jsxs("div",{className:"flex items-center justify-between mb-3",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] flex items-center gap-2",children:[d.jsx(_i,{size:14}),"Tropo Forecast (Hepburn)"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[a&&d.jsx("span",{className:"text-xs font-sans text-[#666]",children:"saving..."}),d.jsx("select",{value:e,onChange:h=>o(h.target.value),className:"text-xs font-sans bg-bg-hover border border-border px-2 py-1 min-h-[36px] text-[#e0e0e0] focus:outline-none focus:border-accent",children:Yj.map(h=>d.jsx("option",{value:h.code,children:h.label},h.code))})]})]}),d.jsxs("div",{className:"text-xs font-sans text-[#666] mb-2",children:[u," — 6-day forecast"]}),r?d.jsx("div",{className:"flex items-center justify-center h-48 text-[#666] text-sm font-sans",children:"Failed to load forecast image"}):d.jsx("img",{src:l,alt:`Hepburn tropo forecast — ${u}`,className:"w-full border border-border",onError:()=>n(!0)}),d.jsxs("div",{className:"text-[10px] font-sans text-[#666] mt-2",children:["Source: ",d.jsx("a",{href:"https://www.dxinfocentre.com/tropo.html",target:"_blank",rel:"noopener noreferrer",className:"text-sky-400 hover:text-sky-300",children:"dxinfocentre.com"})]})]})}const pQ={nws:{icon:kh,color:"text-sky-400",label:"NWS"},swpc:{icon:GV,color:"text-accent",label:"SWPC"},ducting:{icon:_i,color:"text-sky-500",label:"Tropo"},nifc:{icon:Rm,color:"text-red-500",label:"NIFC"},firms:{icon:f1,color:"text-red-400",label:"FIRMS"},avalanche:{icon:kf,color:"text-[#777]",label:"Avy"},usgs:{icon:c1,color:"text-sky-400",label:"USGS"},traffic:{icon:u1,color:"text-[#777]",label:"Traffic"},roads:{icon:IV,color:"text-accent-dim",label:"511"}},Xj={routine:"bg-[#1e1e1e] text-[#777] border-[#222]",priority:"bg-accent/5 text-accent border-accent/30",immediate:"bg-red-500/5 text-red-500 border-red-500/30",info:"bg-sky-400/10 text-sky-400 border-sky-400/30",advisory:"bg-sky-400/10 text-sky-400 border-sky-400/30",moderate:"bg-accent/5 text-accent-dim border-accent-dim/30",watch:"bg-accent/5 text-accent border-accent/30",warning:"bg-accent/5 text-accent border-accent/30",severe:"bg-red-500/5 text-red-500 border-red-500/30",extreme:"bg-red-500/5 text-red-500 border-red-500/30",critical:"bg-red-500/5 text-red-500 border-red-500/30",emergency:"bg-red-500/5 text-red-500 border-red-500/30"};function gQ({event:e,isLocal:t}){var h;const r=pQ[e.source]||{icon:d1,color:"text-[#777]",label:e.source},n=r.icon,a=Xj[(h=e.severity)==null?void 0:h.toLowerCase()]||Xj.info,i=f=>{const v=new Date(f*1e3),m=new Date().getTime()-v.getTime(),y=Math.floor(m/6e4);return y<1?"just now":y<60?`${y}m ago`:y<1440?`${Math.floor(y/60)}h ago`:v.toLocaleDateString(void 0,{month:"short",day:"numeric"})},o=e.event_type,s=e.area_desc,l=e.description;let u=e.headline;if(o&&s){const f=s.replace(/ County/g,"").split(";")[0];u=`${o} — ${f}`}else o&&(u=o);const c=l?l.split(". ")[0]:null;return d.jsxs("div",{className:`flex items-start gap-2 py-2 border-b border-border/50 last:border-0 ${t?"border-l-2 border-l-accent pl-2 -ml-2":""}`,children:[d.jsx(n,{size:14,className:`mt-0.5 flex-shrink-0 ${r.color}`}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[d.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide border ${a}`,children:e.severity||"info"}),t&&d.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide bg-accent/5 text-accent border border-accent/30",title:"LOCAL: event coordinates fall inside the mesh's monitoring area (per the adapter's bbox config on Environment) — operators in this region are directly affected.",children:"LOCAL"}),d.jsx("span",{className:"text-[10px] font-sans text-[#666]",children:r.label}),d.jsx("span",{className:"text-[10px] font-mono text-[#666] ml-auto",children:i(e.fetched_at)})]}),d.jsx("div",{className:`text-sm font-sans font-medium truncate ${t?"text-white":"text-[#e0e0e0]"}`,children:u}),c&&d.jsx("div",{className:"text-[10px] font-sans text-[#666] truncate mt-0.5",children:c})]})]})}function mQ({events:e,envStatus:t,embedded:r}){const n={immediate:0,priority:1,routine:2},a=E.useMemo(()=>{const s=new Set;return e.filter(u=>u.event_id?s.has(u.event_id)?!1:(s.add(u.event_id),!0):!0).sort((u,c)=>{var m,y;const h=u.is_local?1:0,f=c.is_local?1:0;if(h!==f)return f-h;const v=n[((m=u.severity)==null?void 0:m.toLowerCase())||"routine"]??2,g=n[((y=c.severity)==null?void 0:y.toLowerCase())||"routine"]??2;return v!==g?v-g:(c.fetched_at||0)-(u.fetched_at||0)})},[e]),i=E.useMemo(()=>{if(!(t!=null&&t.feeds))return null;const s=t.feeds.length,l=t.feeds.filter(f=>f.is_loaded&&!f.last_error).length,u=t.feeds.filter(f=>f.last_error).map(f=>f.source),c=Math.max(...t.feeds.map(f=>f.last_fetch||0)),h=c?Math.floor(Date.now()/1e3-c):null;return{total:s,active:l,errors:u,secAgo:h}},[t]),o=d.jsxs(d.Fragment,{children:[a.length>0?d.jsx("div",{className:"flex-1 overflow-y-auto max-h-80 pr-1 -mr-1",children:a.map((s,l)=>d.jsx(gQ,{event:s,isLocal:s.is_local},s.event_id||l))}):d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center py-8",children:[d.jsx(bk,{size:24,className:"text-green-500 mx-auto mb-2"}),d.jsx("div",{className:"font-sans text-[#777]",children:"No active events"}),d.jsx("div",{className:"text-[10px] font-sans text-[#666]",children:"All clear"})]})}),i&&d.jsxs("div",{className:`text-[10px] font-sans mt-3 pt-3 border-t border-border ${i.errors.length>0?"text-red-500":"text-[#666]"}`,children:[d.jsx("span",{className:"font-mono",children:i.active})," of ",d.jsx("span",{className:"font-mono",children:i.total})," feeds active",i.secAgo!==null&&d.jsxs(d.Fragment,{children:[" · Last update ",d.jsxs("span",{className:"font-mono",children:[i.secAgo,"s"]})," ago"]}),i.errors.length>0&&d.jsxs("span",{className:"text-red-500",children:[" · ",i.errors.join(", "),": error"]})]})]});return r?d.jsx("div",{className:"flex flex-col h-full",children:o}):d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[d.jsx(Oo,{size:14}),"Live Event Feed"]}),o]})}function yQ(){var S,C,M,A,I,k;const[e,t]=E.useState(null),[r,n]=E.useState([]),[a,i]=E.useState([]),[o,s]=E.useState(null),[l,u]=E.useState([]),[c,h]=E.useState(null),[f,v]=E.useState("alerts"),[g,m]=E.useState(!0),[y,x]=E.useState(null),{lastHealth:_,lastMessage:w}=XV();return E.useEffect(()=>{Promise.all([kJ(),PJ(),RJ(),WV(),$V().catch(()=>[]),zJ().catch(()=>null)]).then(([P,D,z,j,B,H])=>{t(P),n(D),i(z),s(j),u(B),h(H),m(!1),document.title="Dashboard — MeshAI"}).catch(P=>{x(P.message),m(!1),document.title="Dashboard — MeshAI"})},[]),E.useEffect(()=>{_&&t(_)},[_]),E.useEffect(()=>{(w==null?void 0:w.type)==="env_update"&&w.event&&u(P=>{const D=w.event,z=P.filter(j=>j.event_id!==D.event_id);return[D,...z].slice(0,100)})},[w]),g?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"font-sans text-[#777]",children:"Loading..."})}):y?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsxs("div",{className:"font-sans text-red-500",children:["Error: ",y]})}):d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[d.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[d.jsx("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3",children:"Mesh Health"}),e&&d.jsxs(d.Fragment,{children:[d.jsx(cQ,{health:e}),d.jsxs("div",{className:"mt-4 space-y-2",children:[d.jsx(Zv,{label:"Infrastructure",value:((S=e.pillars)==null?void 0:S.infrastructure)??0}),d.jsx(Zv,{label:"Utilization",value:((C=e.pillars)==null?void 0:C.utilization)??0}),d.jsx(Zv,{label:"Coverage",value:((M=e.pillars)==null?void 0:M.coverage)??0}),d.jsx(Zv,{label:"Behavior",value:((A=e.pillars)==null?void 0:A.behavior)??0}),d.jsx(Zv,{label:"Power",value:((I=e.pillars)==null?void 0:I.power)??0})]})]})]}),d.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[d.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[d.jsxs("div",{className:"flex items-center gap-4 mb-3 border-b border-border",children:[d.jsx("button",{onClick:()=>v("alerts"),className:`py-2.5 -mb-px text-[10px] font-sans uppercase tracking-widest transition-colors border-b ${f==="alerts"?"border-accent text-white":"border-transparent text-[#777]"}`,children:"Active Alerts"}),d.jsx("button",{onClick:()=>v("feed"),className:`py-2.5 -mb-px text-[10px] font-sans uppercase tracking-widest transition-colors border-b ${f==="feed"?"border-accent text-white":"border-transparent text-[#777]"}`,children:"Event Feed"})]}),f==="alerts"?d.jsx(d.Fragment,{children:a.length>0?d.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:a.map((P,D)=>d.jsx(hQ,{alert:P},D))}):(()=>{const P=l.filter(D=>D.severity==="immediate"||D.severity==="priority").sort((D,z)=>{const j={immediate:0,priority:1},B=(j[D.severity]??2)-(j[z.severity]??2);return B!==0?B:(z.fetched_at||0)-(D.fetched_at||0)}).slice(0,5);return P.length>0?d.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:P.map((D,z)=>{const j=D.severity==="immediate"?{bg:"bg-red-500/5",border:"border-red-500",icon:Nh,iconColor:"text-red-500"}:{bg:"bg-accent/5",border:"border-accent",icon:vi,iconColor:"text-accent"},B=j.icon;return d.jsxs("div",{className:`p-3 ${j.bg} border-l-2 ${j.border} flex items-start gap-3`,children:[d.jsx(B,{size:16,className:j.iconColor}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide bg-[#1e1e1e] text-[#777] border border-[#222]",children:"ENV"}),d.jsx("span",{className:"text-[10px] font-sans text-[#666]",children:D.severity})]}),d.jsx("div",{className:"text-sm font-sans font-medium text-white mt-1",children:D.headline}),d.jsxs("div",{className:"text-[10px] font-mono text-[#666] mt-1",children:[D.source," · ",new Date(D.fetched_at*1e3).toLocaleTimeString()]})]})]},D.event_id||z)})}):d.jsxs("div",{className:"flex items-center gap-2 text-[#777] py-4",children:[d.jsx(bk,{size:16,className:"text-green-500"}),d.jsx("span",{className:"font-sans",children:"No active alerts"})]})})()}):d.jsx(mQ,{events:l,envStatus:o,embedded:!0})]}),d.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[d.jsx(Gy,{icon:_i,label:"Nodes Online",value:(e==null?void 0:e.total_nodes)||0,accent:"#22c55e",subvalue:`${(e==null?void 0:e.unlocated_count)||0} unlocated`}),d.jsx(Gy,{icon:DV,label:"Infrastructure",value:`${(e==null?void 0:e.infra_online)||0}/${(e==null?void 0:e.infra_total)||0}`,accent:"#38bdf8",subvalue:(e==null?void 0:e.infra_online)===(e==null?void 0:e.infra_total)?"All online":"Some offline"}),d.jsx(Gy,{icon:Oo,label:"Utilization",value:`${((k=e==null?void 0:e.util_percent)==null?void 0:k.toFixed(1))||0}%`,accent:"#f59e0b",subvalue:`${(e==null?void 0:e.flagged_nodes)||0} flagged`}),d.jsx(Gy,{icon:av,label:"Regions",value:(e==null?void 0:e.total_regions)||0,accent:"#333333",subvalue:`${(e==null?void 0:e.battery_warnings)||0} battery warnings`})]})]})]}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[d.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3",children:["Mesh Sources (",d.jsx("span",{className:"font-mono",children:r.length}),")"]}),r.length>0?d.jsx("div",{className:"space-y-1",children:r.map((P,D)=>d.jsx(dQ,{source:P},D))}):d.jsx("div",{className:"font-sans text-[#666] py-4",children:"No sources configured"})]}),d.jsx(fQ,{bandConditions:c}),d.jsx(vQ,{})]})]})}/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var nM=function(e,t){return nM=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},nM(e,t)};function X(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");nM(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var rg=function(){return rg=Object.assign||function(t){for(var r,n=1,a=arguments.length;n0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]"u"&&typeof self<"u"?xt.worker=!0:!xt.hasGlobalWindow||"Deno"in window||typeof navigator<"u"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Node.js")>-1?(xt.node=!0,xt.svgSupported=!0):wQ(navigator.userAgent,xt);function wQ(e,t){var r=t.browser,n=e.match(/Firefox\/([\d.]+)/),a=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),i=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);n&&(r.firefox=!0,r.version=n[1]),a&&(r.ie=!0,r.version=a[1]),i&&(r.edge=!0,r.version=i[1],r.newEdge=+i[1].split(".")[0]>18),o&&(r.weChat=!0),t.svgSupported=typeof SVGRect<"u",t.touchEventsSupported="ontouchstart"in window&&!r.ie&&!r.edge,t.pointerEventsSupported="onpointerdown"in window&&(r.edge||r.ie&&+r.version>=11);var s=t.domSupported=typeof document<"u";if(s){var l=document.documentElement.style;t.transform3dSupported=(r.ie&&"transition"in l||r.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in l)&&!("OTransition"in l),t.transformSupported=t.transform3dSupported||r.ie&&+r.version>=9}}var Ck=12,JV="sans-serif",Fs=Ck+"px "+JV,SQ=20,CQ=100,TQ="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function MQ(e){var t={};if(typeof JSON>"u")return t;for(var r=0;r=0)s=o*r.length;else for(var l=0;l=IQ&&(dS=0),dS++}function m1(){for(var e=[],t=0;t>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",n[l]+":0",a[u]+":0",n[1-l]+":auto",a[1-u]+":auto",""].join("!important;"),e.appendChild(o),r.push(o)}return t.clearMarkers=function(){R(r,function(c){c.parentNode&&c.parentNode.removeChild(c)})},r}function qQ(e,t,r){for(var n=r?"invTrans":"trans",a=t[n],i=t.srcCoords,o=[],s=[],l=!0,u=0;u<4;u++){var c=e[u].getBoundingClientRect(),h=2*u,f=c.left,v=c.top;o.push(f,v),l=l&&i&&f===i[h]&&v===i[h+1],s.push(e[u].offsetLeft,e[u].offsetTop)}return l&&a?a:(t.srcCoords=o,t[n]=r?Qj(s,o):Qj(o,s))}function uG(e){return e.nodeName.toUpperCase()==="CANVAS"}var KQ=/([&<>"'])/g,JQ={"&":"&","<":"<",">":">",'"':""","'":"'"};function Rn(e){return e==null?"":(e+"").replace(KQ,function(t,r){return JQ[r]})}var QQ=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,vS=[],eee=xt.browser.firefox&&+xt.browser.version.split(".")[0]<39;function lM(e,t,r,n){return r=r||{},n?eE(e,t,r):eee&&t.layerX!=null&&t.layerX!==t.offsetX?(r.zrX=t.layerX,r.zrY=t.layerY):t.offsetX!=null?(r.zrX=t.offsetX,r.zrY=t.offsetY):eE(e,t,r),r}function eE(e,t,r){if(xt.domSupported&&e.getBoundingClientRect){var n=t.clientX,a=t.clientY;if(uG(e)){var i=e.getBoundingClientRect();r.zrX=n-i.left,r.zrY=a-i.top;return}else if(sM(vS,e,n,a)){r.zrX=vS[0],r.zrY=vS[1];return}}r.zrX=r.zrY=0}function Ik(e){return e||window.event}function Ka(e,t,r){if(t=Ik(t),t.zrX!=null)return t;var n=t.type,a=n&&n.indexOf("touch")>=0;if(a){var o=n!=="touchend"?t.targetTouches[0]:t.changedTouches[0];o&&lM(e,o,t,r)}else{lM(e,t,t,r);var i=tee(t);t.zrDelta=i?i/120:-(t.detail||0)/3}var s=t.button;return t.which==null&&s!==void 0&&QQ.test(t.type)&&(t.which=s&1?1:s&2?3:s&4?2:0),t}function tee(e){var t=e.wheelDelta;if(t)return t;var r=e.deltaX,n=e.deltaY;if(r==null||n==null)return t;var a=Math.abs(n!==0?n:r),i=n>0?-1:n<0?1:r>0?-1:1;return 3*a*i}function uM(e,t,r,n){e.addEventListener(t,r,n)}function ree(e,t,r,n){e.removeEventListener(t,r,n)}var Vs=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function tE(e){return e.which===2||e.which===3}var nee=function(){function e(){this._track=[]}return e.prototype.recognize=function(t,r,n){return this._doTrack(t,r,n),this._recognize(t)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(t,r,n){var a=t.touches;if(a){for(var i={points:[],touches:[],target:r,event:t},o=0,s=a.length;o1&&n&&n.length>1){var i=rE(n)/rE(a);!isFinite(i)&&(i=1),t.pinchScale=i;var o=aee(n);return t.pinchX=o[0],t.pinchY=o[1],{type:"pinch",target:e[0].target,event:t}}}}};function ar(){return[1,0,0,1,0,0]}function Ih(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function au(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function ja(e,t,r){var n=t[0]*r[0]+t[2]*r[1],a=t[1]*r[0]+t[3]*r[1],i=t[0]*r[2]+t[2]*r[3],o=t[1]*r[2]+t[3]*r[3],s=t[0]*r[4]+t[2]*r[5]+t[4],l=t[1]*r[4]+t[3]*r[5]+t[5];return e[0]=n,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=l,e}function Hi(e,t,r){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4]+r[0],e[5]=t[5]+r[1],e}function Js(e,t,r,n){n===void 0&&(n=[0,0]);var a=t[0],i=t[2],o=t[4],s=t[1],l=t[3],u=t[5],c=Math.sin(r),h=Math.cos(r);return e[0]=a*h+s*c,e[1]=-a*c+s*h,e[2]=i*h+l*c,e[3]=-i*c+h*l,e[4]=h*(o-n[0])+c*(u-n[1])+n[0],e[5]=h*(u-n[1])-c*(o-n[0])+n[1],e}function _1(e,t,r){var n=r[0],a=r[1];return e[0]=t[0]*n,e[1]=t[1]*a,e[2]=t[2]*n,e[3]=t[3]*a,e[4]=t[4]*n,e[5]=t[5]*a,e}function Ra(e,t){var r=t[0],n=t[2],a=t[4],i=t[1],o=t[3],s=t[5],l=r*o-i*n;return l?(l=1/l,e[0]=o*l,e[1]=-i*l,e[2]=-n*l,e[3]=r*l,e[4]=(n*s-o*a)*l,e[5]=(i*a-r*s)*l,e):null}function cG(e){var t=ar();return au(t,e),t}const iee=Object.freeze(Object.defineProperty({__proto__:null,clone:cG,copy:au,create:ar,identity:Ih,invert:Ra,mul:ja,rotate:Js,scale:_1,translate:Hi},Symbol.toStringTag,{value:"Module"}));var Oe=function(){function e(t,r){this.x=t||0,this.y=r||0}return e.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.set=function(t,r){return this.x=t,this.y=r,this},e.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},e.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.prototype.scale=function(t){this.x*=t,this.y*=t},e.prototype.scaleAndAdd=function(t,r){this.x+=t.x*r,this.y+=t.y*r},e.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},e.prototype.dot=function(t){return this.x*t.x+this.y*t.y},e.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},e.prototype.distance=function(t){var r=this.x-t.x,n=this.y-t.y;return Math.sqrt(r*r+n*n)},e.prototype.distanceSquare=function(t){var r=this.x-t.x,n=this.y-t.y;return r*r+n*n},e.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.prototype.transform=function(t){if(t){var r=this.x,n=this.y;return this.x=t[0]*r+t[2]*n+t[4],this.y=t[1]*r+t[3]*n+t[5],this}},e.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},e.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},e.set=function(t,r,n){t.x=r,t.y=n},e.copy=function(t,r){t.x=r.x,t.y=r.y},e.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},e.lenSquare=function(t){return t.x*t.x+t.y*t.y},e.dot=function(t,r){return t.x*r.x+t.y*r.y},e.add=function(t,r,n){t.x=r.x+n.x,t.y=r.y+n.y},e.sub=function(t,r,n){t.x=r.x-n.x,t.y=r.y-n.y},e.scale=function(t,r,n){t.x=r.x*n,t.y=r.y*n},e.scaleAndAdd=function(t,r,n,a){t.x=r.x+n.x*a,t.y=r.y+n.y*a},e.lerp=function(t,r,n,a){var i=1-a;t.x=i*r.x+a*n.x,t.y=i*r.y+a*n.y},e}(),kc=Math.min,Xd=Math.max,cM=Math.abs,nE=["x","y"],oee=["width","height"],zu=new Oe,Bu=new Oe,Fu=new Oe,Vu=new Oe,Ma=fG(),Dp=Ma.minTv,hM=Ma.maxTv,og=[0,0],je=function(){function e(t,r,n,a){gS(this,t,r,n,a)}return e.set=function(t,r,n,a,i){return a<0&&(r=r+a,a=-a),i<0&&(n=n+i,i=-i),t.x=r,t.y=n,t.width=a,t.height=i,t},e.prototype.union=function(t){var r=kc(t.x,this.x),n=kc(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Xd(t.x+t.width,this.x+this.width)-r:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=Xd(t.y+t.height,this.y+this.height)-n:this.height=t.height,this.x=r,this.y=n},e.prototype.applyTransform=function(t){e.applyTransform(this,this,t)},e.prototype.calculateTransform=function(t){return hG(ar(),this,t)},e.prototype.intersect=function(t,r,n){return e.intersect(this,t,r,n)},e.intersect=function(t,r,n,a){n&&Oe.set(n,0,0);var i=a&&a.outIntersectRect||null,o=a&&a.clamp;if(i&&(i.x=i.y=i.width=i.height=NaN),!t||!r)return!1;t instanceof e||(t=gS(lee,t.x,t.y,t.width,t.height)),r instanceof e||(r=gS(uee,r.x,r.y,r.width,r.height));var s=!!n;Ma.reset(a,s);var l=Ma.touchThreshold,u=t.x+l,c=t.x+t.width-l,h=t.y+l,f=t.y+t.height-l,v=r.x+l,g=r.x+r.width-l,m=r.y+l,y=r.y+r.height-l;if(u>c||h>f||v>g||m>y)return!1;var x=!(c=t.x&&r<=t.x+t.width&&n>=t.y&&n<=t.y+t.height},e.prototype.contain=function(t,r){return e.contain(this,t,r)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(t){If(this,t)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(t,r){return t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height,t},e.applyTransform=function(t,r,n){if(!n){t!==r&&If(t,r);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var a=n[0],i=n[3],o=n[4],s=n[5];t.x=r.x*a+o,t.y=r.y*i+s,t.width=r.width*a,t.height=r.height*i,t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height);return}zu.x=Fu.x=r.x,zu.y=Vu.y=r.y,Bu.x=Vu.x=r.x+r.width,Bu.y=Fu.y=r.y+r.height,zu.transform(n),Vu.transform(n),Bu.transform(n),Fu.transform(n),t.x=kc(zu.x,Bu.x,Fu.x,Vu.x),t.y=kc(zu.y,Bu.y,Fu.y,Vu.y);var l=Xd(zu.x,Bu.x,Fu.x,Vu.x),u=Xd(zu.y,Bu.y,Fu.y,Vu.y);t.width=l-t.x,t.height=u-t.y},e.calculateTransform=function(t,r,n){var a=n.width/r.width,i=n.height/r.height;return t=Ih(t||[]),Hi(t,t,Ns(mS,-r.x,-r.y)),_1(t,t,Ns(mS,a,i)),Hi(t,t,Ns(mS,n.x,n.y)),t},e}(),b1=je.create,gS=je.set,If=je.copy,hG=je.calculateTransform,dG=je.applyTransform,see=je.contain,lee=new je(0,0,0,0),uee=new je(0,0,0,0),mS=[];function aE(e,t,r,n,a,i,o,s){var l=cM(t-r),u=cM(n-e),c=kc(l,u),h=nE[a],f=nE[1-a],v=oee[a];t=u||!Ma.bidirectional)&&(Dp[h]=-u,Dp[f]=0,Ma.useDir&&Ma.calcDirMTV())))}function fG(){var e=0,t=new Oe,r=new Oe,n={minTv:new Oe,maxTv:new Oe,useDir:!1,dirMinTv:new Oe,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,o){n.touchThreshold=0,i&&i.touchThreshold!=null&&(n.touchThreshold=Xd(0,i.touchThreshold)),n.negativeSize=!1,o&&(n.minTv.set(1/0,1/0),n.maxTv.set(0,0),n.useDir=!1,i&&i.direction!=null&&(n.useDir=!0,n.dirMinTv.copy(n.minTv),r.copy(n.minTv),e=i.direction,n.bidirectional=i.bidirectional==null||!!i.bidirectional,n.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var i=n.minTv,o=n.dirMinTv,s=i.y*i.y+i.x*i.x,l=Math.sin(e),u=Math.cos(e),c=l*i.y+u*i.x;if(a(c)){a(i.x)&&a(i.y)&&o.set(0,0);return}if(r.x=s*u/c,r.y=s*l/c,a(r.x)&&a(r.y)){o.set(0,0);return}(n.bidirectional||t.dot(r)>0)&&r.len()=0;h--){var f=i[h];f!==a&&!f.ignore&&!f.ignoreCoarsePointer&&(!f.parent||!f.parent.ignoreCoarsePointer)&&(yS.copy(f.getBoundingRect()),f.transform&&yS.applyTransform(f.transform),yS.intersect(c)&&s.push(f))}if(s.length)for(var v=4,g=Math.PI/12,m=Math.PI*2,y=0;y4)return;this._downPoint=null}this.dispatchToElement(i,e,t)}});function vee(e,t,r){if(e[e.rectHover?"rectContain":"contain"](t,r)){for(var n=e,a=void 0,i=!1;n;){if(n.ignoreClip&&(i=!0),!i){var o=n.getClipPath();if(o&&!o.contain(t,r))return!1}n.silent&&(a=!0);var s=n.__hostTarget;n=s?n.ignoreHostSilent?null:s:n.parent}return a?vG:!0}return!1}function iE(e,t,r,n,a){for(var i=e.length-1;i>=0;i--){var o=e[i],s=void 0;if(o!==a&&!o.ignore&&(s=vee(o,r,n))&&(!t.topTarget&&(t.topTarget=o),s!==vG)){t.target=o;break}}}function gG(e,t,r){var n=e.painter;return t<0||t>n.getWidth()||r<0||r>n.getHeight()}var mG=32,Xv=7;function pee(e){for(var t=0;e>=mG;)t|=e&1,e>>=1;return e+t}function oE(e,t,r,n){var a=t+1;if(a===r)return 1;if(n(e[a++],e[t])<0){for(;a=0;)a++;return a-t}function gee(e,t,r){for(r--;t>>1,a(i,e[l])<0?s=l:o=l+1;var u=n-o;switch(u){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;u>0;)e[o+u]=e[o+u-1],u--}e[o]=i}}function xS(e,t,r,n,a,i){var o=0,s=0,l=1;if(i(e,t[r+a])>0){for(s=n-a;l0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}else{for(s=a+1;ls&&(l=s);var u=o;o=a-l,l=a-u}for(o++;o>>1);i(e,t[r+c])>0?o=c+1:l=c}return l}function _S(e,t,r,n,a,i){var o=0,s=0,l=1;if(i(e,t[r+a])<0){for(s=a+1;ls&&(l=s);var u=o;o=a-l,l=a-u}else{for(s=n-a;l=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}for(o++;o>>1);i(e,t[r+c])<0?l=c:o=c+1}return l}function mee(e,t){var r=Xv,n,a,i=0,o=[];n=[],a=[];function s(v,g){n[i]=v,a[i]=g,i+=1}function l(){for(;i>1;){var v=i-2;if(v>=1&&a[v-1]<=a[v]+a[v+1]||v>=2&&a[v-2]<=a[v]+a[v-1])a[v-1]a[v+1])break;c(v)}}function u(){for(;i>1;){var v=i-2;v>0&&a[v-1]=Xv||A>=Xv);if(I)break;C<0&&(C=0),C+=2}if(r=C,r<1&&(r=1),g===1){for(x=0;x=0;x--)e[M+x]=e[C+x];e[S]=o[w];return}for(var A=r;;){var I=0,k=0,P=!1;do if(t(o[w],e[_])<0){if(e[S--]=e[_--],I++,k=0,--g===0){P=!0;break}}else if(e[S--]=o[w--],k++,I=0,--y===1){P=!0;break}while((I|k)=0;x--)e[M+x]=e[C+x];if(g===0){P=!0;break}}if(e[S--]=o[w--],--y===1){P=!0;break}if(k=y-xS(e[_],o,0,y,y-1,t),k!==0){for(S-=k,w-=k,y-=k,M=S+1,C=w+1,x=0;x=Xv||k>=Xv);if(P)break;A<0&&(A=0),A+=2}if(r=A,r<1&&(r=1),y===1){for(S-=g,_-=g,M=S+1,C=_+1,x=g-1;x>=0;x--)e[M+x]=e[C+x];e[S]=o[w]}else{if(y===0)throw new Error;for(C=S-(y-1),x=0;xs&&(l=s),sE(e,r,r+l,r+i,t),i=l}o.pushRun(r,i),o.mergeRuns(),a-=i,r+=i}while(a!==0);o.forceMergeRuns()}}var da=1,jp=2,Dd=4,lE=!1;function bS(){lE||(lE=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function uE(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var yee=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=uE}return e.prototype.traverse=function(t,r){for(var n=0;n=0&&this._roots.splice(a,1)},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),A_;A_=xt.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};var sg={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return .5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return e===0?0:Math.pow(1024,e-1)},exponentialOut:function(e){return e===1?1:1-Math.pow(2,-10*e)},exponentialInOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,r=.1,n=.4;return e===0?0:e===1?1:(!r||r<1?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),-(r*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/n)))},elasticOut:function(e){var t,r=.1,n=.4;return e===0?0:e===1?1:(!r||r<1?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),r*Math.pow(2,-10*e)*Math.sin((e-t)*(2*Math.PI)/n)+1)},elasticInOut:function(e){var t,r=.1,n=.4;return e===0?0:e===1?1:(!r||r<1?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),(e*=2)<1?-.5*(r*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/n)):r*Math.pow(2,-10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/n)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-sg.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?sg.bounceIn(e*2)*.5:sg.bounceOut(e*2-1)*.5+.5}},Uy=Math.pow,Zl=Math.sqrt,N_=1e-8,yG=1e-4,cE=Zl(3),Wy=1/3,yo=wu(),ni=wu(),hf=wu();function Il(e){return e>-N_&&eN_||e<-N_}function $r(e,t,r,n,a){var i=1-a;return i*i*(i*e+3*a*t)+a*a*(a*n+3*i*r)}function hE(e,t,r,n,a){var i=1-a;return 3*(((t-e)*i+2*(r-t)*a)*i+(n-r)*a*a)}function k_(e,t,r,n,a,i){var o=n+3*(t-r)-e,s=3*(r-t*2+e),l=3*(t-e),u=e-a,c=s*s-3*o*l,h=s*l-9*o*u,f=l*l-3*s*u,v=0;if(Il(c)&&Il(h))if(Il(s))i[0]=0;else{var g=-l/s;g>=0&&g<=1&&(i[v++]=g)}else{var m=h*h-4*c*f;if(Il(m)){var y=h/c,g=-s/o+y,x=-y/2;g>=0&&g<=1&&(i[v++]=g),x>=0&&x<=1&&(i[v++]=x)}else if(m>0){var _=Zl(m),w=c*s+1.5*o*(-h+_),S=c*s+1.5*o*(-h-_);w<0?w=-Uy(-w,Wy):w=Uy(w,Wy),S<0?S=-Uy(-S,Wy):S=Uy(S,Wy);var g=(-s-(w+S))/(3*o);g>=0&&g<=1&&(i[v++]=g)}else{var C=(2*c*s-3*o*h)/(2*Zl(c*c*c)),M=Math.acos(C)/3,A=Zl(c),I=Math.cos(M),g=(-s-2*A*I)/(3*o),x=(-s+A*(I+cE*Math.sin(M)))/(3*o),k=(-s+A*(I-cE*Math.sin(M)))/(3*o);g>=0&&g<=1&&(i[v++]=g),x>=0&&x<=1&&(i[v++]=x),k>=0&&k<=1&&(i[v++]=k)}}return v}function _G(e,t,r,n,a){var i=6*r-12*t+6*e,o=9*t+3*n-3*e-9*r,s=3*t-3*e,l=0;if(Il(o)){if(xG(i)){var u=-s/i;u>=0&&u<=1&&(a[l++]=u)}}else{var c=i*i-4*o*s;if(Il(c))a[0]=-i/(2*o);else if(c>0){var h=Zl(c),u=(-i+h)/(2*o),f=(-i-h)/(2*o);u>=0&&u<=1&&(a[l++]=u),f>=0&&f<=1&&(a[l++]=f)}}return l}function iu(e,t,r,n,a,i){var o=(t-e)*a+e,s=(r-t)*a+t,l=(n-r)*a+r,u=(s-o)*a+o,c=(l-s)*a+s,h=(c-u)*a+u;i[0]=e,i[1]=o,i[2]=u,i[3]=h,i[4]=h,i[5]=c,i[6]=l,i[7]=n}function bG(e,t,r,n,a,i,o,s,l,u,c){var h,f=.005,v=1/0,g,m,y,x;yo[0]=l,yo[1]=u;for(var _=0;_<1;_+=.05)ni[0]=$r(e,r,a,o,_),ni[1]=$r(t,n,i,s,_),y=$l(yo,ni),y=0&&y=0&&u<=1&&(a[l++]=u)}}else{var c=o*o-4*i*s;if(Il(c)){var u=-o/(2*i);u>=0&&u<=1&&(a[l++]=u)}else if(c>0){var h=Zl(c),u=(-o+h)/(2*i),f=(-o-h)/(2*i);u>=0&&u<=1&&(a[l++]=u),f>=0&&f<=1&&(a[l++]=f)}}return l}function wG(e,t,r){var n=e+r-2*t;return n===0?.5:(e-t)/n}function Gg(e,t,r,n,a){var i=(t-e)*n+e,o=(r-t)*n+t,s=(o-i)*n+i;a[0]=e,a[1]=i,a[2]=s,a[3]=s,a[4]=o,a[5]=r}function SG(e,t,r,n,a,i,o,s,l){var u,c=.005,h=1/0;yo[0]=o,yo[1]=s;for(var f=0;f<1;f+=.05){ni[0]=an(e,r,a,f),ni[1]=an(t,n,i,f);var v=$l(yo,ni);v=0&&v=1?1:k_(0,n,i,1,l,s)&&$r(0,a,o,1,s[0])}}}var See=function(){function e(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||hr,this.ondestroy=t.ondestroy||hr,this.onrestart=t.onrestart||hr,t.easing&&this.setEasing(t.easing)}return e.prototype.step=function(t,r){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),this._paused){this._pausedTime+=r;return}var n=this._life,a=t-this._startTime-this._pausedTime,i=a/n;i<0&&(i=0),i=Math.min(i,1);var o=this.easingFunc,s=o?o(i):i;if(this.onframe(s),i===1)if(this.loop){var l=a%n;this._startTime=t-l,this._pausedTime=0,this.onrestart()}else return!0;return!1},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(t){this.easing=t,this.easingFunc=Le(t)?t:sg[t]||Pk(t)},e}(),CG=function(){function e(t){this.value=t}return e}(),Cee=function(){function e(){this._len=0}return e.prototype.insert=function(t){var r=new CG(t);return this.insertEntry(r),r},e.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},e.prototype.remove=function(t){var r=t.prev,n=t.next;r?r.next=n:this.head=n,n?n.prev=r:this.tail=r,t.next=t.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),Pf=function(){function e(t){this._list=new Cee,this._maxSize=10,this._map={},this._maxSize=t}return e.prototype.put=function(t,r){var n=this._list,a=this._map,i=null;if(a[t]==null){var o=n.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=n.head;n.remove(l),delete a[l.key],i=l.value,this._lastRemovedEntry=l}s?s.value=r:s=new CG(r),s.key=t,n.insertEntry(s),a[t]=s}return i},e.prototype.get=function(t){var r=this._map[t],n=this._list;if(r!=null)return r!==n.tail&&(n.remove(r),n.insertEntry(r)),r.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),dE={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function zi(e){return e=Math.round(e),e<0?0:e>255?255:e}function Tee(e){return e=Math.round(e),e<0?0:e>360?360:e}function Hg(e){return e<0?0:e>1?1:e}function Ax(e){var t=e;return t.length&&t.charAt(t.length-1)==="%"?zi(parseFloat(t)/100*255):zi(parseInt(t,10))}function ks(e){var t=e;return t.length&&t.charAt(t.length-1)==="%"?Hg(parseFloat(t)/100):Hg(parseFloat(t))}function wS(e,t,r){return r<0?r+=1:r>1&&(r-=1),r*6<1?e+(t-e)*r*6:r*2<1?t:r*3<2?e+(t-e)*(2/3-r)*6:e}function Pl(e,t,r){return e+(t-e)*r}function Xa(e,t,r,n,a){return e[0]=t,e[1]=r,e[2]=n,e[3]=a,e}function fM(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var TG=new Pf(20),$y=null;function ld(e,t){$y&&fM($y,t),$y=TG.put(e,$y||t.slice())}function zn(e,t){if(e){t=t||[];var r=TG.get(e);if(r)return fM(t,r);e=e+"";var n=e.replace(/ /g,"").toLowerCase();if(n in dE)return fM(t,dE[n]),ld(e,t),t;var a=n.length;if(n.charAt(0)==="#"){if(a===4||a===5){var i=parseInt(n.slice(1,4),16);if(!(i>=0&&i<=4095)){Xa(t,0,0,0,1);return}return Xa(t,(i&3840)>>4|(i&3840)>>8,i&240|(i&240)>>4,i&15|(i&15)<<4,a===5?parseInt(n.slice(4),16)/15:1),ld(e,t),t}else if(a===7||a===9){var i=parseInt(n.slice(1,7),16);if(!(i>=0&&i<=16777215)){Xa(t,0,0,0,1);return}return Xa(t,(i&16711680)>>16,(i&65280)>>8,i&255,a===9?parseInt(n.slice(7),16)/255:1),ld(e,t),t}return}var o=n.indexOf("("),s=n.indexOf(")");if(o!==-1&&s+1===a){var l=n.substr(0,o),u=n.substr(o+1,s-(o+1)).split(","),c=1;switch(l){case"rgba":if(u.length!==4)return u.length===3?Xa(t,+u[0],+u[1],+u[2],1):Xa(t,0,0,0,1);c=ks(u.pop());case"rgb":if(u.length>=3)return Xa(t,Ax(u[0]),Ax(u[1]),Ax(u[2]),u.length===3?c:ks(u[3])),ld(e,t),t;Xa(t,0,0,0,1);return;case"hsla":if(u.length!==4){Xa(t,0,0,0,1);return}return u[3]=ks(u[3]),vM(u,t),ld(e,t),t;case"hsl":if(u.length!==3){Xa(t,0,0,0,1);return}return vM(u,t),ld(e,t),t;default:return}}Xa(t,0,0,0,1)}}function vM(e,t){var r=(parseFloat(e[0])%360+360)%360/360,n=ks(e[1]),a=ks(e[2]),i=a<=.5?a*(n+1):a+n-a*n,o=a*2-i;return t=t||[],Xa(t,zi(wS(o,i,r+1/3)*255),zi(wS(o,i,r)*255),zi(wS(o,i,r-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function Mee(e){if(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,a=Math.min(t,r,n),i=Math.max(t,r,n),o=i-a,s=(i+a)/2,l,u;if(o===0)l=0,u=0;else{s<.5?u=o/(i+a):u=o/(2-i-a);var c=((i-t)/6+o/2)/o,h=((i-r)/6+o/2)/o,f=((i-n)/6+o/2)/o;t===i?l=f-h:r===i?l=1/3+c-f:n===i&&(l=2/3+h-c),l<0&&(l+=1),l>1&&(l-=1)}var v=[l*360,u,s];return e[3]!=null&&v.push(e[3]),v}}function L_(e,t){var r=zn(e);if(r){for(var n=0;n<3;n++)t<0?r[n]=r[n]*(1-t)|0:r[n]=(255-r[n])*t+r[n]|0,r[n]>255?r[n]=255:r[n]<0&&(r[n]=0);return ui(r,r.length===4?"rgba":"rgb")}}function Aee(e){var t=zn(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)}function lg(e,t,r){if(!(!(t&&t.length)||!(e>=0&&e<=1))){r=r||[];var n=e*(t.length-1),a=Math.floor(n),i=Math.ceil(n),o=t[a],s=t[i],l=n-a;return r[0]=zi(Pl(o[0],s[0],l)),r[1]=zi(Pl(o[1],s[1],l)),r[2]=zi(Pl(o[2],s[2],l)),r[3]=Hg(Pl(o[3],s[3],l)),r}}var Nee=lg;function Dk(e,t,r){if(!(!(t&&t.length)||!(e>=0&&e<=1))){var n=e*(t.length-1),a=Math.floor(n),i=Math.ceil(n),o=zn(t[a]),s=zn(t[i]),l=n-a,u=ui([zi(Pl(o[0],s[0],l)),zi(Pl(o[1],s[1],l)),zi(Pl(o[2],s[2],l)),Hg(Pl(o[3],s[3],l))],"rgba");return r?{color:u,leftIndex:a,rightIndex:i,value:n}:u}}var kee=Dk;function Ls(e,t,r,n){var a=zn(e);if(e)return a=Mee(a),t!=null&&(a[0]=Tee(Le(t)?t(a[0]):t)),r!=null&&(a[1]=ks(Le(r)?r(a[1]):r)),n!=null&&(a[2]=ks(Le(n)?n(a[2]):n)),ui(vM(a),"rgba")}function Ug(e,t){var r=zn(e);if(r&&t!=null)return r[3]=Hg(t),ui(r,"rgba")}function ui(e,t){if(!(!e||!e.length)){var r=e[0]+","+e[1]+","+e[2];return(t==="rgba"||t==="hsva"||t==="hsla")&&(r+=","+e[3]),t+"("+r+")"}}function Wg(e,t){var r=zn(e);return r?(.299*r[0]+.587*r[1]+.114*r[2])*r[3]/255+(1-r[3])*t:0}function Lee(){return ui([Math.round(Math.random()*255),Math.round(Math.random()*255),Math.round(Math.random()*255)],"rgb")}var fE=new Pf(100);function I_(e){if(ve(e)){var t=fE.get(e);return t||(t=L_(e,-.1),fE.put(e,t)),t}else if(Om(e)){var r=te({},e);return r.colorStops=oe(e.colorStops,function(n){return{offset:n.offset,color:L_(n.color,-.1)}}),r}return e}const Iee=Object.freeze(Object.defineProperty({__proto__:null,fastLerp:lg,fastMapToColor:Nee,lerp:Dk,lift:L_,liftColor:I_,lum:Wg,mapToColor:kee,modifyAlpha:Ug,modifyHSL:Ls,parse:zn,parseCssFloat:ks,parseCssInt:Ax,random:Lee,stringify:ui,toHex:Aee},Symbol.toStringTag,{value:"Module"}));var P_=Math.round;function $g(e){var t;if(!e||e==="transparent")e="none";else if(typeof e=="string"&&e.indexOf("rgba")>-1){var r=zn(e);r&&(e="rgb("+r[0]+","+r[1]+","+r[2]+")",t=r[3])}return{color:e,opacity:t??1}}var vE=1e-4;function Dl(e){return e-vE}function Zy(e){return P_(e*1e3)/1e3}function pM(e){return P_(e*1e4)/1e4}function Pee(e){return"matrix("+Zy(e[0])+","+Zy(e[1])+","+Zy(e[2])+","+Zy(e[3])+","+pM(e[4])+","+pM(e[5])+")"}var Dee={left:"start",right:"end",center:"middle",middle:"middle"};function jee(e,t,r){return r==="top"?e+=t/2:r==="bottom"&&(e-=t/2),e}function Eee(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function Ree(e){var t=e.style,r=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),r[0],r[1]].join(",")}function MG(e){return e&&!!e.image}function Oee(e){return e&&!!e.svgElement}function jk(e){return MG(e)||Oee(e)}function AG(e){return e.type==="linear"}function NG(e){return e.type==="radial"}function kG(e){return e&&(e.type==="linear"||e.type==="radial")}function w1(e){return"url(#"+e+")"}function LG(e){var t=e.getGlobalScale(),r=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(r)/Math.log(10)),1)}function IG(e){var t=e.x||0,r=e.y||0,n=(e.rotation||0)*ng,a=Te(e.scaleX,1),i=Te(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,l=[];return(t||r)&&l.push("translate("+t+"px,"+r+"px)"),n&&l.push("rotate("+n+")"),(a!==1||i!==1)&&l.push("scale("+a+","+i+")"),(o||s)&&l.push("skew("+P_(o*ng)+"deg, "+P_(s*ng)+"deg)"),l.join(" ")}var zee=function(){return typeof Buffer<"u"&&typeof Buffer.from=="function"?function(e){return Buffer.from(e).toString("base64")}:typeof btoa=="function"&&typeof unescape=="function"&&typeof encodeURIComponent=="function"?function(e){return btoa(unescape(encodeURIComponent(e)))}:function(e){return null}}(),gM=Array.prototype.slice;function ms(e,t,r){return(t-e)*r+e}function SS(e,t,r,n){for(var a=t.length,i=0;in?t:e,i=Math.min(r,n),o=a[i-1]||{color:[0,0,0,0],offset:0},s=i;so;if(s)n.length=o;else for(var l=i;l=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(t,r,n){this._needsSort=!0;var a=this.keyframes,i=a.length,o=!1,s=gE,l=r;if(_n(r)){var u=Gee(r);s=u,(u===1&&!Tt(r[0])||u===2&&!Tt(r[0][0]))&&(o=!0)}else if(Tt(r)&&!yn(r))s=Xy;else if(ve(r))if(!isNaN(+r))s=Xy;else{var c=zn(r);c&&(l=c,s=Ep)}else if(Om(r)){var h=te({},l);h.colorStops=oe(r.colorStops,function(v){return{offset:v.offset,color:zn(v.color)}}),AG(r)?s=mM:NG(r)&&(s=yM),l=h}i===0?this.valType=s:(s!==this.valType||s===gE)&&(o=!0),this.discrete=this.discrete||o;var f={time:t,value:l,rawValue:r,percent:0};return n&&(f.easing=n,f.easingFunc=Le(n)?n:sg[n]||Pk(n)),a.push(f),f},e.prototype.prepare=function(t,r){var n=this.keyframes;this._needsSort&&n.sort(function(m,y){return m.time-y.time});for(var a=this.valType,i=n.length,o=n[i-1],s=this.discrete,l=qy(a),u=mE(a),c=0;c=0&&!(o[c].percent<=r);c--);c=f(c,s-2)}else{for(c=h;cr);c++);c=f(c-1,s-2)}g=o[c+1],v=o[c]}if(v&&g){this._lastFr=c,this._lastFrP=r;var y=g.percent-v.percent,x=y===0?1:f((r-v.percent)/y,1);g.easingFunc&&(x=g.easingFunc(x));var _=n?this._additiveValue:u?qv:t[l];if((qy(i)||u)&&!_&&(_=this._additiveValue=[]),this.discrete)t[l]=x<1?v.rawValue:g.rawValue;else if(qy(i))i===kx?SS(_,v[a],g[a],x):Bee(_,v[a],g[a],x);else if(mE(i)){var w=v[a],S=g[a],C=i===mM;t[l]={type:C?"linear":"radial",x:ms(w.x,S.x,x),y:ms(w.y,S.y,x),colorStops:oe(w.colorStops,function(A,I){var k=S.colorStops[I];return{offset:ms(A.offset,k.offset,x),color:Nx(SS([],A.color,k.color,x))}}),global:S.global},C?(t[l].x2=ms(w.x2,S.x2,x),t[l].y2=ms(w.y2,S.y2,x)):t[l].r=ms(w.r,S.r,x)}else if(u)SS(_,v[a],g[a],x),n||(t[l]=Nx(_));else{var M=ms(v[a],g[a],x);n?this._additiveValue=M:t[l]=M}n&&this._addToTarget(t)}}},e.prototype._addToTarget=function(t){var r=this.valType,n=this.propName,a=this._additiveValue;r===Xy?t[n]=t[n]+a:r===Ep?(zn(t[n],qv),Yy(qv,qv,a,1),t[n]=Nx(qv)):r===kx?Yy(t[n],t[n],a,1):r===PG&&pE(t[n],t[n],a,1)},e}(),Ek=function(){function e(t,r,n,a){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=t,this._loop=r,r&&a){m1("Can' use additive animation on looped animation.");return}this._additiveAnimators=a,this._allowDiscrete=n}return e.prototype.getMaxTime=function(){return this._maxTime},e.prototype.getDelay=function(){return this._delay},e.prototype.getLoop=function(){return this._loop},e.prototype.getTarget=function(){return this._target},e.prototype.changeTarget=function(t){this._target=t},e.prototype.when=function(t,r,n){return this.whenWithKeys(t,r,gt(r),n)},e.prototype.whenWithKeys=function(t,r,n,a){for(var i=this._tracks,o=0;o0&&l.addKeyframe(0,ug(u),a),this._trackKeys.push(s)}l.addKeyframe(t,ug(r[s]),a)}return this._maxTime=Math.max(this._maxTime,t),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var r=t.length,n=0;n0)){this._started=1;for(var r=this,n=[],a=this._maxTime||0,i=0;i1){var s=o.pop();i.addKeyframe(s.time,t[a]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},e}();function qd(){return new Date().getTime()}var Uee=function(e){X(t,e);function t(r){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,r=r||{},n.stage=r.stage||{},n}return t.prototype.addClip=function(r){r.animation&&this.removeClip(r),this._head?(this._tail.next=r,r.prev=this._tail,r.next=null,this._tail=r):this._head=this._tail=r,r.animation=this},t.prototype.addAnimator=function(r){r.animation=this;var n=r.getClip();n&&this.addClip(n)},t.prototype.removeClip=function(r){if(r.animation){var n=r.prev,a=r.next;n?n.next=a:this._head=a,a?a.prev=n:this._tail=n,r.next=r.prev=r.animation=null}},t.prototype.removeAnimator=function(r){var n=r.getClip();n&&this.removeClip(n),r.animation=null},t.prototype.update=function(r){for(var n=qd()-this._pausedTime,a=n-this._time,i=this._head;i;){var o=i.next,s=i.step(n,a);s&&(i.ondestroy(),this.removeClip(i)),i=o}this._time=n,r||(this.trigger("frame",a),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var r=this;this._running=!0;function n(){r._running&&(A_(n),!r._paused&&r.update())}A_(n)},t.prototype.start=function(){this._running||(this._time=qd(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||(this._pauseStart=qd(),this._paused=!0)},t.prototype.resume=function(){this._paused&&(this._pausedTime+=qd()-this._pauseStart,this._paused=!1)},t.prototype.clear=function(){for(var r=this._head;r;){var n=r.next;r.prev=r.next=r.animation=null,r=n}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(r,n){n=n||{},this.start();var a=new Ek(r,n.loop);return this.addAnimator(a),a},t}(bi),Wee=300,CS=xt.domSupported,TS=function(){var e=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],t=["touchstart","touchend","touchmove"],r={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},n=oe(e,function(a){var i=a.replace("mouse","pointer");return r.hasOwnProperty(i)?i:a});return{mouse:e,touch:t,pointer:n}}(),yE={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},xE=!1;function xM(e){var t=e.pointerType;return t==="pen"||t==="touch"}function $ee(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function MS(e){e&&(e.zrByTouch=!0)}function Zee(e,t){return Ka(e.dom,new Yee(e,t),!0)}function DG(e,t){for(var r=t,n=!1;r&&r.nodeType!==9&&!(n=r.domBelongToZr||r!==t&&r===e.painterRoot);)r=r.parentNode;return n}var Yee=function(){function e(t,r){this.stopPropagation=hr,this.stopImmediatePropagation=hr,this.preventDefault=hr,this.type=r.type,this.target=this.currentTarget=t.dom,this.pointerType=r.pointerType,this.clientX=r.clientX,this.clientY=r.clientY}return e}(),Li={mousedown:function(e){e=Ka(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger("mousedown",e)},mousemove:function(e){e=Ka(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",e)},mouseup:function(e){e=Ka(this.dom,e),this.__togglePointerCapture(!1),this.trigger("mouseup",e)},mouseout:function(e){e=Ka(this.dom,e);var t=e.toElement||e.relatedTarget;DG(this,t)||(this.__pointerCapturing&&(e.zrEventControl="no_globalout"),this.trigger("mouseout",e))},wheel:function(e){xE=!0,e=Ka(this.dom,e),this.trigger("mousewheel",e)},mousewheel:function(e){xE||(e=Ka(this.dom,e),this.trigger("mousewheel",e))},touchstart:function(e){e=Ka(this.dom,e),MS(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,"start"),Li.mousemove.call(this,e),Li.mousedown.call(this,e)},touchmove:function(e){e=Ka(this.dom,e),MS(e),this.handler.processGesture(e,"change"),Li.mousemove.call(this,e)},touchend:function(e){e=Ka(this.dom,e),MS(e),this.handler.processGesture(e,"end"),Li.mouseup.call(this,e),+new Date-+this.__lastTouchMomentwE||e<-wE}var Hu=[],ud=[],NS=ar(),kS=Math.abs,Xo=function(){function e(){}return e.prototype.getLocalTransform=function(t){return ou(this,t)},e.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},e.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},e.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},e.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},e.prototype.needLocalTransform=function(){return Gu(this.rotation)||Gu(this.x)||Gu(this.y)||Gu(this.scaleX-1)||Gu(this.scaleY-1)||Gu(this.skewX)||Gu(this.skewY)},e.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,r=this.needLocalTransform(),n=this.transform;if(!(r||t)){n&&(bE(n),this.invTransform=null);return}n=n||ar(),r?this.getLocalTransform(n):bE(n),t&&(r?ja(n,t,n):au(n,t)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||ar(),Ra(this.invTransform,n)},e.prototype._resolveGlobalScaleRatio=function(t){var r=this.globalScaleRatio;if(r!=null&&r!==1){this.getGlobalScale(Hu);var n=Hu[0]<0?-1:1,a=Hu[1]<0?-1:1,i=((Hu[0]-n)*r+n)/Hu[0]||0,o=((Hu[1]-a)*r+a)/Hu[1]||0;t[0]*=i,t[1]*=i,t[2]*=o,t[3]*=o}},e.prototype.getComputedTransform=function(){for(var t=this,r=[];t;)r.push(t),t=t.parent;for(;t=r.pop();)t.updateTransform();return this.transform},e.prototype.setLocalTransform=function(t){if(t){var r=t[0]*t[0]+t[1]*t[1],n=t[2]*t[2]+t[3]*t[3],a=Math.atan2(t[1],t[0]),i=Math.PI/2+a-Math.atan2(t[3],t[2]);n=Math.sqrt(n)*Math.cos(i),r=Math.sqrt(r),this.skewX=i,this.skewY=0,this.rotation=-a,this.x=+t[4],this.y=+t[5],this.scaleX=r,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,r=this.transform;t&&t.transform&&(t.invTransform=t.invTransform||ar(),ja(ud,t.invTransform,r),r=ud);var n=this.originX,a=this.originY;(n||a)&&(NS[4]=n,NS[5]=a,ja(ud,r,NS),ud[4]-=n,ud[5]-=a,r=ud),this.setLocalTransform(r)}},e.prototype.getGlobalScale=function(t){var r=this.transform;return t=t||[],r?(t[0]=Math.sqrt(r[0]*r[0]+r[1]*r[1]),t[1]=Math.sqrt(r[2]*r[2]+r[3]*r[3]),r[0]<0&&(t[0]=-t[0]),r[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},e.prototype.transformCoordToLocal=function(t,r){var n=[t,r],a=this.invTransform;return a&&dr(n,n,a),n},e.prototype.transformCoordToGlobal=function(t,r){var n=[t,r],a=this.transform;return a&&dr(n,n,a),n},e.prototype.getLineScale=function(){var t=this.transform;return t&&kS(t[0]-1)>1e-10&&kS(t[3]-1)>1e-10?Math.sqrt(kS(t[0]*t[3]-t[2]*t[1])):1},e.prototype.copyTransform=function(t){zo(this,t)},e.getLocalTransform=function(t,r){r=r||[];var n=t.originX||0,a=t.originY||0,i=t.scaleX,o=t.scaleY,s=t.anchorX,l=t.anchorY,u=t.rotation||0,c=t.x,h=t.y,f=t.skewX?Math.tan(t.skewX):0,v=t.skewY?Math.tan(-t.skewY):0;if(n||a||s||l){var g=n+s,m=a+l;r[4]=-g*i-f*m*o,r[5]=-m*o-v*g*i}else r[4]=r[5]=0;return r[0]=i,r[3]=o,r[1]=v*i,r[2]=f*o,u&&Js(r,r,u),r[4]+=n+c,r[5]+=a+h,r},e.initDefaultProps=function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0}(),e}(),ou=Xo.getLocalTransform;function df(){return new Xo}var Gs=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function zo(e,t){return rG(e,t,Gs)}function ko(e){Ky||(Ky=new Pf(100)),e=e||Fs;var t=Ky.get(e);return t||(t={font:e,strWidthCache:new Pf(500),asciiWidthMap:null,asciiWidthMapTried:!1,stWideCharWidth:qr.measureText("国",e).width,asciiCharWidth:qr.measureText("a",e).width},Ky.put(e,t)),t}var Ky;function Qee(e){if(!(LS>=SE)){e=e||Fs;for(var t=[],r=+new Date,n=0;n<=127;n++)t[n]=qr.measureText(String.fromCharCode(n),e).width;var a=+new Date-r;return a>16?LS=SE:a>2&&LS++,t}}var LS=0,SE=5;function EG(e,t){return e.asciiWidthMapTried||(e.asciiWidthMap=Qee(e.font),e.asciiWidthMapTried=!0),0<=t&&t<=127?e.asciiWidthMap!=null?e.asciiWidthMap[t]:e.asciiCharWidth:e.stWideCharWidth}function Lo(e,t){var r=e.strWidthCache,n=r.get(t);return n==null&&(n=qr.measureText(t,e.font).width,r.put(t,n)),n}function CE(e,t,r,n){var a=Lo(ko(t),e),i=Fm(t),o=Df(0,a,r),s=zc(0,i,n),l=new je(o,s,a,i);return l}function S1(e,t,r,n){var a=((e||"")+"").split(` +`),i=a.length;if(i===1)return CE(a[0],t,r,n);for(var o=new je(0,0,0,0),s=0;s=0?parseFloat(e)/100*t:parseFloat(e):e}function j_(e,t,r){var n=t.position||"inside",a=t.distance!=null?t.distance:5,i=r.height,o=r.width,s=i/2,l=r.x,u=r.y,c="left",h="top";if(n instanceof Array)l+=Bo(n[0],r.width),u+=Bo(n[1],r.height),c=null,h=null;else switch(n){case"left":l-=a,u+=s,c="right",h="middle";break;case"right":l+=a+o,u+=s,h="middle";break;case"top":l+=o/2,u-=a,c="center",h="bottom";break;case"bottom":l+=o/2,u+=i+a,c="center";break;case"inside":l+=o/2,u+=s,c="center",h="middle";break;case"insideLeft":l+=a,u+=s,h="middle";break;case"insideRight":l+=o-a,u+=s,c="right",h="middle";break;case"insideTop":l+=o/2,u+=a,c="center";break;case"insideBottom":l+=o/2,u+=i-a,c="center",h="bottom";break;case"insideTopLeft":l+=a,u+=a;break;case"insideTopRight":l+=o-a,u+=a,c="right";break;case"insideBottomLeft":l+=a,u+=i-a,h="bottom";break;case"insideBottomRight":l+=o-a,u+=i-a,c="right",h="bottom";break}return e=e||{},e.x=l,e.y=u,e.align=c,e.verticalAlign=h,e}var IS="__zr_normal__",PS=Gs.concat(["ignore"]),ete=pi(Gs,function(e,t){return e[t]=!0,e},{ignore:!1}),cd={},tte=new je(0,0,0,0),Jy=[],Ix=0,C1=1,T1=function(){function e(t){this.id=Ak(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return e.prototype._init=function(t){this.attr(t)},e.prototype.drift=function(t,r,n){switch(this.draggable){case"horizontal":r=0;break;case"vertical":t=0;break}var a=this.transform;a||(a=this.transform=[1,0,0,1,0,0]),a[4]+=t,a[5]+=r,this.decomposeTransform(),this.markRedraw()},e.prototype.beforeUpdate=function(){},e.prototype.afterUpdate=function(){},e.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},e.prototype.updateInnerText=function(t){var r=this._textContent;if(r&&(!r.ignore||t)){this.textConfig||(this.textConfig={});var n=this.textConfig,a=n.local,i=r.innerTransformable,o=void 0,s=void 0,l=!1;i.parent=a?this:null;var u=!1;i.copyTransform(r);var c=n.position!=null,h=n.autoOverflowArea,f=void 0;if((h||c)&&(f=tte,n.layoutRect?f.copy(n.layoutRect):f.copy(this.getBoundingRect()),a||f.applyTransform(this.transform)),c){this.calculateTextPosition?this.calculateTextPosition(cd,n,f):j_(cd,n,f),i.x=cd.x,i.y=cd.y,o=cd.align,s=cd.verticalAlign;var v=n.origin;if(v&&n.rotation!=null){var g=void 0,m=void 0;v==="center"?(g=f.width*.5,m=f.height*.5):(g=Bo(v[0],f.width),m=Bo(v[1],f.height)),u=!0,i.originX=-i.x+g+(a?0:f.x),i.originY=-i.y+m+(a?0:f.y)}}n.rotation!=null&&(i.rotation=n.rotation);var y=n.offset;y&&(i.x+=y[0],i.y+=y[1],u||(i.originX=-y[0],i.originY=-y[1]));var x=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={});if(h){var _=x.overflowRect=x.overflowRect||new je(0,0,0,0);i.getLocalTransform(Jy),Ra(Jy,Jy),je.copy(_,f),_.applyTransform(Jy)}else x.overflowRect=null;var w=n.inside==null?typeof n.position=="string"&&n.position.indexOf("inside")>=0:n.inside,S=void 0,C=void 0,M=void 0;w&&this.canBeInsideText()?(S=n.insideFill,C=n.insideStroke,(S==null||S==="auto")&&(S=this.getInsideTextFill()),(C==null||C==="auto")&&(C=this.getInsideTextStroke(S),M=!0)):(S=n.outsideFill,C=n.outsideStroke,(S==null||S==="auto")&&(S=this.getOutsideFill()),(C==null||C==="auto")&&(C=this.getOutsideStroke(S),M=!0)),S=S||"#000",(S!==x.fill||C!==x.stroke||M!==x.autoStroke||o!==x.align||s!==x.verticalAlign)&&(l=!0,x.fill=S,x.stroke=C,x.autoStroke=M,x.align=o,x.verticalAlign=s,r.setDefaultTextStyle(x)),r.__dirty|=da,l&&r.dirtyStyle(!0)}},e.prototype.canBeInsideText=function(){return!0},e.prototype.getInsideTextFill=function(){return"#fff"},e.prototype.getInsideTextStroke=function(t){return"#000"},e.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?SM:wM},e.prototype.getOutsideStroke=function(t){var r=this.__zr&&this.__zr.getBackgroundColor(),n=typeof r=="string"&&zn(r);n||(n=[255,255,255,1]);for(var a=n[3],i=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*a+(i?0:255)*(1-a);return n[3]=1,ui(n,"rgba")},e.prototype.traverse=function(t,r){},e.prototype.attrKV=function(t,r){t==="textConfig"?this.setTextConfig(r):t==="textContent"?this.setTextContent(r):t==="clipPath"?this.setClipPath(r):t==="extra"?(this.extra=this.extra||{},te(this.extra,r)):this[t]=r},e.prototype.hide=function(){this.ignore=!0,this.markRedraw()},e.prototype.show=function(){this.ignore=!1,this.markRedraw()},e.prototype.attr=function(t,r){if(typeof t=="string")this.attrKV(t,r);else if(Re(t))for(var n=t,a=gt(n),i=0;i0},e.prototype.getState=function(t){return this.states[t]},e.prototype.ensureState=function(t){var r=this.states;return r[t]||(r[t]={}),r[t]},e.prototype.clearStates=function(t){this.useState(IS,!1,t)},e.prototype.useState=function(t,r,n,a){var i=t===IS,o=this.hasState();if(!(!o&&i)){var s=this.currentStates,l=this.stateTransition;if(!(Ye(s,t)>=0&&(r||s.length===1))){var u;if(this.stateProxy&&!i&&(u=this.stateProxy(t)),u||(u=this.states&&this.states[t]),!u&&!i){m1("State "+t+" not exists.");return}i||this.saveCurrentToNormalState(u);var c=this._textContent,h=TE(this,c,u,a);h&&!this.__inHover&&(this.__inHover=h),this._applyStateObj(t,u,this._normalState,r,AE(this,n,l),l);var f=this._textGuide;return c&&c.useState(t,r,n,!!h),f&&f.useState(t,r,n,!!h),i?(this.currentStates=[],this._normalState={}):r?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!h&&this.__inHover&&(this.__inHover=Ix,this.__dirty&=~da),u}}},e.prototype.useStates=function(t,r,n){if(!t.length)this.clearStates();else{var a=[],i=this.currentStates,o=t.length,s=o===i.length;if(s){for(var l=0;l=0){var n=this.currentStates.slice();n.splice(r,1),this.useStates(n)}},e.prototype.replaceState=function(t,r,n){var a=this.currentStates.slice(),i=Ye(a,t),o=Ye(a,r)>=0;i>=0?o?a.splice(i,1):a[i]=r:n&&!o&&a.push(r),this.useStates(a)},e.prototype.toggleState=function(t,r){r?this.useState(t,!0):this.removeState(t)},e.prototype._mergeStates=function(t){for(var r={},n,a=0;a=0&&i.splice(o,1)}),this.animators.push(t),n&&n.animation.addAnimator(t),n&&n.wakeUp()},e.prototype.updateDuringAnimation=function(t){this.markRedraw()},e.prototype.stopAnimation=function(t,r){for(var n=this.animators,a=n.length,i=[],o=0;o0&&r.during&&i[0].during(function(g,m){r.during(m)});for(var f=0;f0||a.force&&!o.length){var I=void 0,k=void 0,P=void 0;if(s){k={},f&&(I={});for(var S=0;S0}var De=function(e){X(t,e);function t(r){var n=e.call(this)||this;return n.isGroup=!0,n._children=[],n.attr(r),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.children=function(){return this._children.slice()},t.prototype.childAt=function(r){return this._children[r]},t.prototype.childOfName=function(r){for(var n=this._children,a=0;a=0&&(a.splice(i,0,r),this._doAdd(r))}return this},t.prototype.replace=function(r,n){var a=Ye(this._children,r);return a>=0&&this.replaceAt(n,a),this},t.prototype.replaceAt=function(r,n){var a=this._children,i=a[n];if(r&&r!==this&&r.parent!==this&&r!==i){a[n]=r,i.parent=null;var o=this.__zr;o&&i.removeSelfFromZr(o),this._doAdd(r)}return this},t.prototype._doAdd=function(r){r.parent&&r.parent.remove(r),r.parent=this;var n=this.__zr;n&&n!==r.__zr&&r.addSelfToZr(n),n&&n.refresh()},t.prototype.remove=function(r){var n=this.__zr,a=this._children,i=Ye(a,r);return i<0?this:(a.splice(i,1),r.parent=null,n&&r.removeSelfFromZr(n),n&&n.refresh(),this)},t.prototype.removeAll=function(){for(var r=this._children,n=this.__zr,a=0;a0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(t){this._disposed||(t=t||{},this.painter.resize(t.width,t.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},e.prototype.findHover=function(t,r){if(!this._disposed)return this.handler.findHover(t,r)},e.prototype.on=function(t,r,n){return this._disposed||this.handler.on(t,r,n),this},e.prototype.off=function(t,r){this._disposed||this.handler.off(t,r)},e.prototype.trigger=function(t,r){this._disposed||this.handler.trigger(t,r)},e.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),r=0;r0){if(e<=a)return o;if(e>=i)return s}else{if(e>=a)return o;if(e<=i)return s}else{if(e===a)return o;if(e===i)return s}return(e-a)/l*u+o}var me=mte;function mte(e,t,r){switch(e){case"center":case"middle":e="50%";break;case"left":case"top":e="0%";break;case"right":case"bottom":e="100%";break}return O_(e,t,r)}function O_(e,t,r){return ve(e)?FG(e)?parseFloat(e)/100*t+(r||0):parseFloat(e):e==null?NaN:+e}function yte(e){return ve(e)&&FG(e)}function FG(e){return!!pte(e).match(/%$/)}function Mt(e,t,r){return isNaN(t)?r?""+e:+e:(t=Et(at(0,t),E_),e=(+e).toFixed(t),r?e:+e)}function xte(e,t,r){return t==null&&(t=10),Mt(e,t,r)}function on(e){return e.sort(function(t,r){return t-r}),e}function _o(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,r=0;r<15;r++,t*=10)if(Fo(e*t)/t===e)return r}return VG(e)}function VG(e){var t=e.toString().toLowerCase(),r=t.indexOf("e"),n=r>0?+t.slice(r+1):0,a=r>0?r:t.length,i=t.indexOf("."),o=i<0?0:a-1-i;return at(0,o-n)}function _te(e,t){var r=gi(eh(e[1]-e[0])/Zg),n=Fo(eh(cr(t[1]-t[0]))/Zg),a=Et(at(-r+n,0),E_);return isFinite(a)?a:E_}function Rk(e,t,r){var n=cr(e[1]-e[0]);if(!isFinite(n)||n===0)return NaN;var a=eh(2*cr(r||1)*cr(n))/Zg,i=eh(cr(t))/Zg,o=at(0,Ph(-a+i));return isFinite(o)||(o=NaN),o}function bte(e,t,r){if(!e[t])return 0;var n=GG(e,r);return n[t]||0}function GG(e,t){var r=pi(e,function(v,g){return v+(isNaN(g)?0:g)},0);if(r===0)return[];for(var n=Dh(10,t),a=oe(e,function(v){return(isNaN(v)?0:v)/r*n*100}),i=n*100,o=oe(a,function(v){return gi(v)}),s=pi(o,function(v,g){return v+g},0),l=oe(a,function(v,g){return v-o[g]});su&&(u=l[h],c=h);++o[c],l[c]=0,++s}return oe(o,function(v){return v/n})}function pc(e,t){var r=at(_o(e),_o(t)),n=e+t;return r>E_?n:Mt(n,r)}var Yg=Dh(2,53)-1;function Ok(e){var t=R_*2;return(e%t+t)%t}function th(e){return e>-NE&&e=10&&t++,t}var HG=2;function A1(e,t){var r=M1(e),n=Dh(10,r),a=e/n,i;return t===HG?i=1:t?a<1.5?i=1:a<2.5?i=2:a<4?i=3:a<7?i=5:i=10:a<1?i=1:a<2?i=2:a<3?i=3:a<5?i=5:i=10,e=i*n,Mt(e,-r)}function Dx(e,t){var r=(e.length-1)*t+1,n=gi(r),a=+e[n-1],i=r-n;return i?a+i*(e[n]-a):a}function MM(e){e.sort(function(l,u){return s(l,u,0)?-1:1});for(var t=-1/0,r=1,n=0;n0?t.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)?(this.item=this._list[this._idx],this.key=this._idx=this._idx+this._step,!0):!1},e}();function ES(e){e.option=e.parentModel=e.ecModel=null}function gn(){return[1/0,-1/0]}function NM(e,t){Hs(t)&&(te[1]&&(e[1]=t))}function JG(e,t){Hs(t)&&te[1]&&(e[1]=t)}function Vte(e,t){ah(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function Hs(e){return e!=null&&isFinite(e)}function ah(e,t){return Hs(e)&&Hs(t)&&e<=t}function Gte(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function jx(e){ah(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function lv(){var e="__ec_once_"+Hte++;return function(t,r){Se(t,e)||(t[e]=1,r())}}var Hte=Fk();function N1(e,t,r){var n=we(),a=0;R(e,function(i){var o=t(i),s=n.get(o)||0;r&&r(i,s),!s&&!r&&(e[a++]=i),n.set(o,s+1)}),r||(e.length=a)}function Ute(e){return e.value+""}function Wte(e){return e+""}function Io(e,t){return Te(t,!0)?e.seriesIndex+2:0}function e7(e,t,r){var n=e.getData().count();return{progressiveRender:r.progressiveEnabled&&t.incrementalPrepareRender&&n>=r.threshold,large:e.get("large")&&n>=e.get("largeThreshold"),modDataCount:e.get("progressiveChunkMode")==="mod"?e.getData().count():null}}function Hr(e,t){return{seriesType:e,overallReset:t}}function Vm(e){return{overallReset:e}}var $te=".",Uu="___EC__COMPONENT__CONTAINER___",t7="___EC__EXTENDED_CLASS___";function bo(e){var t={main:"",sub:""};if(e){var r=e.split($te);t.main=r[0]||"",t.sub=r[1]||""}return t}function Zte(e){bn(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),'componentType "'+e+'" illegal')}function Yte(e){return!!(e&&e[t7])}function Uk(e,t){e.$constructor=e,e.extend=function(r){var n=this,a;return Xte(n)?a=function(i){X(o,i);function o(){return i.apply(this,arguments)||this}return o}(n):(a=function(){(r.$constructor||n).apply(this,arguments)},Nk(a,this)),te(a.prototype,r),a[t7]=!0,a.extend=this.extend,a.superCall=Jte,a.superApply=Qte,a.superClass=n,a}}function Xte(e){return Le(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function r7(e,t){e.extend=t.extend}var qte=Math.round(Math.random()*10);function Kte(e){var t=["__\0is_clz",qte++].join("_");e.prototype[t]=!0,e.isInstance=function(r){return!!(r&&r[t])}}function Jte(e,t){for(var r=[],n=2;n=0||i&&Ye(i,l)<0)){var u=n.getShallow(l,t);u!=null&&(o[e[s][0]]=u)}}return o}}var ere=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],tre=ih(ere),rre=function(){function e(){}return e.prototype.getAreaStyle=function(t,r){return tre(this,t,r)},e}(),kM=new Pf(50);function nre(e){if(typeof e=="string"){var t=kM.get(e);return t&&t.image}else return e}function Wk(e,t,r,n,a){if(e)if(typeof e=="string"){if(t&&t.__zrImageSrc===e||!r)return t;var i=kM.get(e),o={hostEl:r,cb:n,cbPayload:a};return i?(t=i.image,!L1(t)&&i.pending.push(o)):(t=qr.loadImage(e,PE,PE),t.__zrImageSrc=e,kM.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}else return e;else return t}function PE(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t=s;u++)l-=s;var c=Lo(o,r);return c>l&&(r="",c=0),l=e-c,a.ellipsis=r,a.ellipsisWidth=c,a.contentWidth=l,a.containerWidth=e,a}function i7(e,t,r){var n=r.containerWidth,a=r.contentWidth,i=r.fontMeasureInfo;if(!n){e.textLine="",e.isTruncated=!1;return}var o=Lo(i,t);if(o<=n){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=a||s>=r.maxIterations){t+=r.ellipsis;break}var l=s===0?ire(t,a,i):o>0?Math.floor(t.length*a/o):0;t=t.substr(0,l),o=Lo(i,t)}t===""&&(t=r.placeholder),e.textLine=t,e.isTruncated=!0}function ire(e,t,r){for(var n=0,a=0,i=e.length;ay&&v){var w=Math.floor(y/f);g=g||x.length>w,x=x.slice(0,w),_=x.length*f}if(a&&c&&m!=null)for(var S=a7(m,u,t.ellipsis,{minChar:t.truncateMinChar,placeholder:t.placeholder}),C={},M=0;Mg&&OS(i,o.substring(g,y),t,v),OS(i,m[2],t,v,m[1]),g=RS.lastIndex}gh){var W=i.lines.length;z>0?(k.tokens=k.tokens.slice(0,z),A(k,D,P),i.lines=i.lines.slice(0,I+1)):i.lines=i.lines.slice(0,I),i.isTruncated=i.isTruncated||i.lines.length0&&g+n.accumWidth>n.width&&(c=t.split(` +`),u=!0),n.accumWidth=g}else{var m=o7(t,l,n.width,n.breakAll,n.accumWidth);n.accumWidth=m.accumWidth+v,h=m.linesWidths,c=m.lines}}c||(c=t.split(` +`));for(var y=ko(l),x=0;x=32&&t<=591||t>=880&&t<=4351||t>=4608&&t<=5119||t>=7680&&t<=8303}var hre=pi(",&?/;] ".split(""),function(e,t){return e[t]=!0,e},{});function dre(e){return cre(e)?!!hre[e]:!0}function o7(e,t,r,n,a){for(var i=[],o=[],s="",l="",u=0,c=0,h=ko(t),f=0;fr:a+c+g>r){c?(s||l)&&(m?(s||(s=l,l="",u=0,c=u),i.push(s),o.push(c-u),l+=v,u+=g,s="",c=u):(l&&(s+=l,l="",u=0),i.push(s),o.push(c),s=v,c=g)):m?(i.push(l),o.push(u),l=v,u=g):(i.push(v),o.push(g));continue}c+=g,m?(l+=v,u+=g):(l&&(s+=l,l="",u=0),s+=v)}return l&&(s+=l),s&&(i.push(s),o.push(c)),i.length===1&&(c+=a),{accumWidth:c,lines:i,linesWidths:o}}function jE(e,t,r,n,a,i){if(e.baseX=r,e.baseY=n,e.outerWidth=e.outerHeight=null,!!t){var o=t.width*2,s=t.height*2;je.set(EE,Df(r,o,a),zc(n,s,i),o,s),je.intersect(t,EE,null,RE);var l=RE.outIntersectRect;e.outerWidth=l.width,e.outerHeight=l.height,e.baseX=Df(l.x,l.width,a,!0),e.baseY=zc(l.y,l.height,i,!0)}}var EE=new je(0,0,0,0),RE={outIntersectRect:{},clamp:!0};function $k(e){return e!=null?e+="":e=""}function fre(e){var t=$k(e.text),r=e.font,n=Lo(ko(r),t),a=Fm(r);return LM(e,n,a,null)}function LM(e,t,r,n){var a=new je(Df(e.x||0,t,e.textAlign),zc(e.y||0,r,e.textBaseline),t,r),i=n??(s7(e)?e.lineWidth:0);return i>0&&(a.x-=i/2,a.y-=i/2,a.width+=i,a.height+=i),a}function s7(e){var t=e.stroke;return t!=null&&t!=="none"&&e.lineWidth>0}var IM="__zr_style_"+Math.round(Math.random()*10),Bc={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},I1={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};Bc[IM]=!0;var OE=["z","z2","invisible"],vre=["invisible"],yi=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype._init=function(r){for(var n=gt(r),a=0;a1e-4){s[0]=e-r,s[1]=t-n,l[0]=e+r,l[1]=t+n;return}if(Qy[0]=VS(a)*r+e,Qy[1]=FS(a)*n+t,e0[0]=VS(i)*r+e,e0[1]=FS(i)*n+t,u(s,Qy,e0),c(l,Qy,e0),a=a%Wu,a<0&&(a=a+Wu),i=i%Wu,i<0&&(i=i+Wu),a>i&&!o?i+=Wu:aa&&(t0[0]=VS(v)*r+e,t0[1]=FS(v)*n+t,u(s,t0,s),c(l,t0,l))}var Xt={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},$u=[],Zu=[],io=[],cl=[],oo=[],so=[],GS=Math.min,HS=Math.max,Yu=Math.cos,Xu=Math.sin,hs=Math.abs,PM=Math.PI,xl=PM*2,US=typeof Float32Array<"u",Kv=[];function WS(e){var t=Math.round(e/PM*1e8)/1e8;return t%2*PM}function D1(e,t){var r=WS(e[0]);r<0&&(r+=xl);var n=r-e[0],a=e[1];a+=n,!t&&a-r>=xl?a=r+xl:t&&r-a>=xl?a=r-xl:!t&&r>a?a=r+(xl-WS(r-a)):t&&r0&&(this._ux=hs(n/D_/t)||0,this._uy=hs(n/D_/r)||0)},e.prototype.setDPR=function(t){this.dpr=t},e.prototype.setContext=function(t){this._ctx=t},e.prototype.getContext=function(){return this._ctx},e.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},e.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},e.prototype.moveTo=function(t,r){return this._drawPendingPt(),this.addData(Xt.M,t,r),this._ctx&&this._ctx.moveTo(t,r),this._x0=t,this._y0=r,this._xi=t,this._yi=r,this},e.prototype.lineTo=function(t,r){var n=hs(t-this._xi),a=hs(r-this._yi),i=n>this._ux||a>this._uy;if(this.addData(Xt.L,t,r),this._ctx&&i&&this._ctx.lineTo(t,r),i)this._xi=t,this._yi=r,this._pendingPtDist=0;else{var o=n*n+a*a;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=r,this._pendingPtDist=o)}return this},e.prototype.bezierCurveTo=function(t,r,n,a,i,o){return this._drawPendingPt(),this.addData(Xt.C,t,r,n,a,i,o),this._ctx&&this._ctx.bezierCurveTo(t,r,n,a,i,o),this._xi=i,this._yi=o,this},e.prototype.quadraticCurveTo=function(t,r,n,a){return this._drawPendingPt(),this.addData(Xt.Q,t,r,n,a),this._ctx&&this._ctx.quadraticCurveTo(t,r,n,a),this._xi=n,this._yi=a,this},e.prototype.arc=function(t,r,n,a,i,o){this._drawPendingPt(),Kv[0]=a,Kv[1]=i,D1(Kv,o),a=Kv[0],i=Kv[1];var s=i-a;return this.addData(Xt.A,t,r,n,n,a,s,0,o?0:1),this._ctx&&this._ctx.arc(t,r,n,a,i,o),this._xi=Yu(i)*n+t,this._yi=Xu(i)*n+r,this},e.prototype.arcTo=function(t,r,n,a,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(t,r,n,a,i),this},e.prototype.rect=function(t,r,n,a){return this._drawPendingPt(),this._ctx&&this._ctx.rect(t,r,n,a),this.addData(Xt.R,t,r,n,a),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(Xt.Z);var t=this._ctx,r=this._x0,n=this._y0;return t&&t.closePath(),this._xi=r,this._yi=n,this},e.prototype.fill=function(t){t&&t.fill(),this.toStatic()},e.prototype.stroke=function(t){t&&t.stroke(),this.toStatic()},e.prototype.len=function(){return this._len},e.prototype.setData=function(t){if(this._saveData){var r=t.length;!(this.data&&this.data.length===r)&&US&&(this.data=new Float32Array(r));for(var n=0;n0&&o))for(var s=0;sc.length&&(this._expandData(),c=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},e.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],r=0;r11&&(this.data=new Float32Array(t)))}},e.prototype.getBoundingRect=function(){io[0]=io[1]=oo[0]=oo[1]=Number.MAX_VALUE,cl[0]=cl[1]=so[0]=so[1]=-Number.MAX_VALUE;var t=this.data,r=0,n=0,a=0,i=0,o;for(o=0;on||hs(w)>a||f===r-1)&&(m=Math.sqrt(_*_+w*w),i=y,o=x);break}case Xt.C:{var S=t[f++],C=t[f++],y=t[f++],x=t[f++],M=t[f++],A=t[f++];m=xee(i,o,S,C,y,x,M,A,10),i=M,o=A;break}case Xt.Q:{var S=t[f++],C=t[f++],y=t[f++],x=t[f++];m=bee(i,o,S,C,y,x,10),i=y,o=x;break}case Xt.A:var I=t[f++],k=t[f++],P=t[f++],D=t[f++],z=t[f++],j=t[f++],B=j+z;f+=1,g&&(s=Yu(z)*P+I,l=Xu(z)*D+k),m=HS(P,D)*GS(xl,Math.abs(j)),i=Yu(B)*P+I,o=Xu(B)*D+k;break;case Xt.R:{s=i=t[f++],l=o=t[f++];var H=t[f++],V=t[f++];m=H*2+V*2;break}case Xt.Z:{var _=s-i,w=l-o;m=Math.sqrt(_*_+w*w),i=s,o=l;break}}m>=0&&(u[h++]=m,c+=m)}return this._pathLen=c,c},e.prototype.rebuildPath=function(t,r){var n=this.data,a=this._ux,i=this._uy,o=this._len,s,l,u,c,h,f,v=r<1,g,m,y=0,x=0,_,w=0,S,C;if(!(v&&(this._pathSegLen||this._calculateLength(),g=this._pathSegLen,m=this._pathLen,_=r*m,!_)))e:for(var M=0;M0&&(t.lineTo(S,C),w=0),A){case Xt.M:s=u=n[M++],l=c=n[M++],t.moveTo(u,c);break;case Xt.L:{h=n[M++],f=n[M++];var k=hs(h-u),P=hs(f-c);if(k>a||P>i){if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;t.lineTo(u*(1-z)+h*z,c*(1-z)+f*z);break e}y+=D}t.lineTo(h,f),u=h,c=f,w=0}else{var j=k*k+P*P;j>w&&(S=h,C=f,w=j)}break}case Xt.C:{var B=n[M++],H=n[M++],V=n[M++],U=n[M++],F=n[M++],W=n[M++];if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;iu(u,B,V,F,z,$u),iu(c,H,U,W,z,Zu),t.bezierCurveTo($u[1],Zu[1],$u[2],Zu[2],$u[3],Zu[3]);break e}y+=D}t.bezierCurveTo(B,H,V,U,F,W),u=F,c=W;break}case Xt.Q:{var B=n[M++],H=n[M++],V=n[M++],U=n[M++];if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;Gg(u,B,V,z,$u),Gg(c,H,U,z,Zu),t.quadraticCurveTo($u[1],Zu[1],$u[2],Zu[2]);break e}y+=D}t.quadraticCurveTo(B,H,V,U),u=V,c=U;break}case Xt.A:var $=n[M++],Z=n[M++],J=n[M++],re=n[M++],Q=n[M++],le=n[M++],de=n[M++],He=!n[M++],ye=J>re?J:re,ne=hs(J-re)>.001,xe=Q+le,he=!1;if(v){var D=g[x++];y+D>_&&(xe=Q+le*(_-y)/D,he=!0),y+=D}if(ne&&t.ellipse?t.ellipse($,Z,J,re,de,Q,xe,He):t.arc($,Z,ye,Q,xe,He),he)break e;I&&(s=Yu(Q)*J+$,l=Xu(Q)*re+Z),u=Yu(xe)*J+$,c=Xu(xe)*re+Z;break;case Xt.R:s=u=n[M],l=c=n[M+1],h=n[M++],f=n[M++];var ge=n[M++],tt=n[M++];if(v){var D=g[x++];if(y+D>_){var Ue=_-y;t.moveTo(h,f),t.lineTo(h+GS(Ue,ge),f),Ue-=ge,Ue>0&&t.lineTo(h+ge,f+GS(Ue,tt)),Ue-=tt,Ue>0&&t.lineTo(h+HS(ge-Ue,0),f+tt),Ue-=ge,Ue>0&&t.lineTo(h,f+HS(tt-Ue,0));break e}y+=D}t.rect(h,f,ge,tt);break;case Xt.Z:if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;t.lineTo(u*(1-z)+s*z,c*(1-z)+l*z);break e}y+=D}t.closePath(),u=s,c=l}}},e.prototype.clone=function(){var t=new e,r=this.data;return t.data=r.slice?r.slice():Array.prototype.slice.call(r),t._len=this._len,t},e.prototype.canSave=function(){return!!this._saveData},e.CMD=Xt,e.initDefaultProps=function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0}(),e}();function Sl(e,t,r,n,a,i,o){if(a===0)return!1;var s=a,l=0,u=e;if(o>t+s&&o>n+s||oe+s&&i>r+s||it+h&&c>n+h&&c>i+h&&c>s+h||ce+h&&u>r+h&&u>a+h&&u>o+h||ut+u&&l>n+u&&l>i+u||le+u&&s>r+u&&s>a+u||sr||c+ua&&(a+=Jv);var f=Math.atan2(l,s);return f<0&&(f+=Jv),f>=n&&f<=a||f+Jv>=n&&f+Jv<=a}function ys(e,t,r,n,a,i){if(i>t&&i>n||ia?s:0}var hl=Go.CMD,qu=Math.PI*2,bre=1e-4;function wre(e,t){return Math.abs(e-t)t&&u>n&&u>i&&u>s||u1&&Sre(),v=$r(t,n,i,s,Qa[0]),f>1&&(g=$r(t,n,i,s,Qa[1]))),f===2?yt&&s>n&&s>i||s=0&&u<=1){for(var c=0,h=an(t,n,i,u),f=0;fr||s<-r)return 0;var l=Math.sqrt(r*r-s*s);Zn[0]=-l,Zn[1]=l;var u=Math.abs(n-a);if(u<1e-4)return 0;if(u>=qu-1e-4){n=0,a=qu;var c=i?1:-1;return o>=Zn[0]+e&&o<=Zn[1]+e?c:0}if(n>a){var h=n;n=a,a=h}n<0&&(n+=qu,a+=qu);for(var f=0,v=0;v<2;v++){var g=Zn[v];if(g+e>o){var m=Math.atan2(s,g),c=i?1:-1;m<0&&(m=qu+m),(m>=n&&m<=a||m+qu>=n&&m+qu<=a)&&(m>Math.PI/2&&m1&&(r||(s+=ys(l,u,c,h,n,a))),y&&(l=i[g],u=i[g+1],c=l,h=u),m){case hl.M:c=i[g++],h=i[g++],l=c,u=h;break;case hl.L:if(r){if(Sl(l,u,i[g],i[g+1],t,n,a))return!0}else s+=ys(l,u,i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case hl.C:if(r){if(xre(l,u,i[g++],i[g++],i[g++],i[g++],i[g],i[g+1],t,n,a))return!0}else s+=Cre(l,u,i[g++],i[g++],i[g++],i[g++],i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case hl.Q:if(r){if(l7(l,u,i[g++],i[g++],i[g],i[g+1],t,n,a))return!0}else s+=Tre(l,u,i[g++],i[g++],i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case hl.A:var x=i[g++],_=i[g++],w=i[g++],S=i[g++],C=i[g++],M=i[g++];g+=1;var A=!!(1-i[g++]);f=Math.cos(C)*w+x,v=Math.sin(C)*S+_,y?(c=f,h=v):s+=ys(l,u,f,v,n,a);var I=(n-x)*S/w+x;if(r){if(_re(x,_,S,C,C+M,A,t,I,a))return!0}else s+=Mre(x,_,S,C,C+M,A,I,a);l=Math.cos(C+M)*w+x,u=Math.sin(C+M)*S+_;break;case hl.R:c=l=i[g++],h=u=i[g++];var k=i[g++],P=i[g++];if(f=c+k,v=h+P,r){if(Sl(c,h,f,h,t,n,a)||Sl(f,h,f,v,t,n,a)||Sl(f,v,c,v,t,n,a)||Sl(c,v,c,h,t,n,a))return!0}else s+=ys(f,h,f,v,n,a),s+=ys(c,v,c,h,n,a);break;case hl.Z:if(r){if(Sl(l,u,c,h,t,n,a))return!0}else s+=ys(l,u,c,h,n,a);l=c,u=h;break}}return!r&&!wre(u,h)&&(s+=ys(l,u,c,h,n,a)||0),s!==0}function Are(e,t,r){return u7(e,0,!1,t,r)}function Nre(e,t,r,n){return u7(e,t,!0,r,n)}var z_=Ee({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Bc),kre={style:Ee({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},I1.style)},$S=Gs.concat(["invisible","culling","z","z2","zlevel","parent"]),pt=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.update=function(){var r=this;e.prototype.update.call(this);var n=this.style;if(n.decal){var a=this._decalEl=this._decalEl||new t;a.buildPath===t.prototype.buildPath&&(a.buildPath=function(l){r.buildPath(l,r.shape)}),a.silent=!0;var i=a.style;for(var o in n)i[o]!==n[o]&&(i[o]=n[o]);i.fill=n.fill?n.decal:null,i.decal=null,i.shadowColor=null,n.strokeFirst&&(i.stroke=null);for(var s=0;s<$S.length;++s)a[$S[s]]=this[$S[s]];a.__dirty|=da}else this._decalEl&&(this._decalEl=null)},t.prototype.getDecalElement=function(){return this._decalEl},t.prototype._init=function(r){var n=gt(r);this.shape=this.getDefaultShape();var a=this.getDefaultStyle();a&&this.useStyle(a);for(var i=0;i.5?wM:n>.2?Jee:SM}else if(r)return SM}return wM},t.prototype.getInsideTextStroke=function(r){var n=this.style.fill;if(ve(n)){var a=this.__zr,i=!!(a&&a.isDarkMode()),o=Wg(r,0)0))},t.prototype.hasFill=function(){var r=this.style,n=r.fill;return n!=null&&n!=="none"},t.prototype.getBoundingRect=function(){var r=this._rect,n=this.style,a=!r;if(a){var i=!1;this.path||(i=!0,this.createPathProxy());var o=this.path;(i||this.__dirty&Dd)&&(o.beginPath(),this.buildPath(o,this.shape,!1),this.pathUpdated()),r=o.getBoundingRect()}if(this._rect=r,this.hasStroke()&&this.path&&this.path.len()>0){var s=this._rectStroke||(this._rectStroke=r.clone());if(this.__dirty||a){s.copy(r);var l=n.strokeNoScale?this.getLineScale():1,u=n.lineWidth;if(!this.hasFill()){var c=this.strokeContainThreshold;u=Math.max(u,c??4)}l>1e-10&&(s.width+=u/l,s.height+=u/l,s.x-=u/l/2,s.y-=u/l/2)}return s}return r},t.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect(),o=this.style;if(r=a[0],n=a[1],i.contain(r,n)){var s=this.path;if(this.hasStroke()){var l=o.lineWidth,u=o.strokeNoScale?this.getLineScale():1;if(u>1e-10&&(this.hasFill()||(l=Math.max(l,this.strokeContainThreshold)),Nre(s,l/u,r,n)))return!0}if(this.hasFill())return Are(s,r,n)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=Dd,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},t.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},t.prototype.animateShape=function(r){return this.animate("shape",r)},t.prototype.updateDuringAnimation=function(r){r==="style"?this.dirtyStyle():r==="shape"?this.dirtyShape():this.markRedraw()},t.prototype.attrKV=function(r,n){r==="shape"?this.setShape(n):e.prototype.attrKV.call(this,r,n)},t.prototype.setShape=function(r,n){var a=this.shape;return a||(a=this.shape={}),typeof r=="string"?a[r]=n:te(a,r),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(this.__dirty&Dd)},t.prototype.createStyle=function(r){return Bm(z_,r)},t.prototype._innerSaveToNormal=function(r){e.prototype._innerSaveToNormal.call(this,r);var n=this._normalState;r.shape&&!n.shape&&(n.shape=te({},this.shape))},t.prototype._applyStateObj=function(r,n,a,i,o,s){if(e.prototype._applyStateObj.call(this,r,n,a,i,o,s),this.__inHover!==C1){var l=!(n&&i),u;if(n&&n.shape?o?i?u=n.shape:(u=te({},a.shape),te(u,n.shape)):(u=te({},i?this.shape:a.shape),te(u,n.shape)):l&&(u=a.shape),u)if(o){this.shape=te({},this.shape);for(var c={},h=gt(u),f=0;fa&&(h=s+l,s*=a/h,l*=a/h),u+c>a&&(h=u+c,u*=a/h,c*=a/h),l+u>i&&(h=l+u,l*=i/h,u*=i/h),s+c>i&&(h=s+c,s*=i/h,c*=i/h),e.moveTo(r+s,n),e.lineTo(r+a-l,n),l!==0&&e.arc(r+a-l,n+l,l,-Math.PI/2,0),e.lineTo(r+a,n+i-u),u!==0&&e.arc(r+a-u,n+i-u,u,0,Math.PI/2),e.lineTo(r+c,n+i),c!==0&&e.arc(r+c,n+i-c,c,Math.PI/2,Math.PI),e.lineTo(r,n+s),s!==0&&e.arc(r+s,n+s,s,Math.PI,Math.PI*1.5),e.closePath()}var Kd=Math.round;function j1(e,t,r){if(t){var n=t.x1,a=t.x2,i=t.y1,o=t.y2;e.x1=n,e.x2=a,e.y1=i,e.y2=o;var s=r&&r.lineWidth;return s&&(Kd(n*2)===Kd(a*2)&&(e.x1=e.x2=Ia(n,s,!0)),Kd(i*2)===Kd(o*2)&&(e.y1=e.y2=Ia(i,s,!0))),e}}function c7(e,t,r){if(t){var n=t.x,a=t.y,i=t.width,o=t.height;e.x=n,e.y=a,e.width=i,e.height=o;var s=r&&r.lineWidth;return s&&(e.x=Ia(n,s,!0),e.y=Ia(a,s,!0),e.width=Math.max(Ia(n+i,s,!1)-e.x,i===0?0:1),e.height=Math.max(Ia(a+o,s,!1)-e.y,o===0?0:1)),e}}function Ia(e,t,r){if(!t)return e;var n=Kd(e*2);return(n+Kd(t))%2===0?n/2:(n+(r?1:-1))/2}var Ere=function(){function e(){this.x=0,this.y=0,this.width=0,this.height=0}return e}(),Rre={},it=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new Ere},t.prototype.buildPath=function(r,n){var a,i,o,s;if(this.subPixelOptimize){var l=c7(Rre,n,this.style);a=l.x,i=l.y,o=l.width,s=l.height,l.r=n.r,n=l}else a=n.x,i=n.y,o=n.width,s=n.height;n.r?jre(r,n):r.rect(a,i,o,s)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(pt);it.prototype.type="rect";var GE={fill:"#000"},HE=2,lo={},Ore={style:Ee({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},I1.style)},wt=function(e){X(t,e);function t(r){var n=e.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=GE,n.attr(r),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.update=function(){e.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var r=0;r0,z=0;z=0&&(B=M[j],B.align==="right");)this._placeToken(B,r,I,x,z,"right",w),k-=B.width,z-=B.width,j--;for(D+=(c-(D-y)-(_-z)-k)/2;P<=j;)B=M[P],this._placeToken(B,r,I,x,D+B.width/2,"center",w),D+=B.width,P++;x+=I}},t.prototype._placeToken=function(r,n,a,i,o,s,l){var u=n.rich[r.styleName]||{};u.text=r.text;var c=r.verticalAlign,h=i+a/2;c==="top"?h=i+r.height/2:c==="bottom"&&(h=i+a-r.height/2);var f=!r.isLineHolder&&ZS(u);f&&this._renderBackground(u,n,s==="right"?o-r.width:s==="center"?o-r.width/2:o,h-r.height/2,r.width,r.height);var v=!!u.backgroundColor,g=r.textPadding;g&&(o=XE(o,s,g),h-=r.height/2-g[0]-r.innerHeight/2);var m=this._getOrCreateChild(jf),y=m.createStyle();m.useStyle(y);var x=this._defaultStyle,_=!1,w=0,S=!1,C=YE("fill"in u?u.fill:"fill"in n?n.fill:(_=!0,x.fill)),M=ZE("stroke"in u?u.stroke:"stroke"in n?n.stroke:!v&&!l&&(!x.autoStroke||_)?(w=HE,S=!0,x.stroke):null),A=u.textShadowBlur>0||n.textShadowBlur>0;y.text=r.text,y.x=o,y.y=h,A&&(y.shadowBlur=u.textShadowBlur||n.textShadowBlur||0,y.shadowColor=u.textShadowColor||n.textShadowColor||"transparent",y.shadowOffsetX=u.textShadowOffsetX||n.textShadowOffsetX||0,y.shadowOffsetY=u.textShadowOffsetY||n.textShadowOffsetY||0),y.textAlign=s,y.textBaseline="middle",y.font=r.font||Fs,y.opacity=ya(u.opacity,n.opacity,1),WE(y,u),M&&(y.lineWidth=ya(u.lineWidth,n.lineWidth,w),y.lineDash=Te(u.lineDash,n.lineDash),y.lineDashOffset=n.lineDashOffset||0,y.stroke=M),C&&(y.fill=C),m.setBoundingRect(LM(y,r.contentWidth,r.contentHeight,S?0:null))},t.prototype._renderBackground=function(r,n,a,i,o,s){var l=r.backgroundColor,u=r.borderWidth,c=r.borderColor,h=l&&l.image,f=l&&!h,v=r.borderRadius,g=this,m,y;if(f||r.lineHeight||u&&c){m=this._getOrCreateChild(it),m.useStyle(m.createStyle()),m.style.fill=null;var x=m.shape;x.x=a,x.y=i,x.width=o,x.height=s,x.r=v,m.dirtyShape()}if(f){var _=m.style;_.fill=l||null,_.fillOpacity=Te(r.fillOpacity,1)}else if(h){y=this._getOrCreateChild(Qr),y.onload=function(){g.dirtyStyle()};var w=y.style;w.image=l.image,w.x=a,w.y=i,w.width=o,w.height=s}if(u&&c){var _=m.style;_.lineWidth=u,_.stroke=c,_.strokeOpacity=Te(r.strokeOpacity,1),_.lineDash=r.borderDash,_.lineDashOffset=r.borderDashOffset||0,m.strokeContainThreshold=0,m.hasFill()&&m.hasStroke()&&(_.strokeFirst=!0,_.lineWidth*=2)}var S=(m||y).style;S.shadowBlur=r.shadowBlur||0,S.shadowColor=r.shadowColor||"transparent",S.shadowOffsetX=r.shadowOffsetX||0,S.shadowOffsetY=r.shadowOffsetY||0,S.opacity=ya(r.opacity,n.opacity,1)},t.makeFont=function(r){var n="";return d7(r)&&(n=[r.fontStyle,r.fontWeight,h7(r.fontSize),r.fontFamily||"sans-serif"].join(" ")),n&&ka(n)||r.textFont||r.font},t}(yi),zre={left:!0,right:1,center:1},Bre={top:1,bottom:1,middle:1},UE=["fontStyle","fontWeight","fontSize","fontFamily"];function h7(e){return typeof e=="string"&&(e.indexOf("px")!==-1||e.indexOf("rem")!==-1||e.indexOf("em")!==-1)?e:isNaN(+e)?Ck+"px":e+"px"}function WE(e,t){for(var r=0;r=0,i=!1;if(e instanceof pt){var o=y7(e),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(hd(s)||hd(l)){n=n||{};var u=n.style||{};u.fill==="inherit"?(i=!0,n=te({},n),u=te({},u),u.fill=s):!hd(u.fill)&&hd(s)?(i=!0,n=te({},n),u=te({},u),u.fill=I_(s)):!hd(u.stroke)&&hd(l)&&(i||(n=te({},n),u=te({},u)),u.stroke=I_(l)),n.style=u}}if(n&&n.z2==null){i||(n=te({},n));var c=e.z2EmphasisLift;n.z2=e.z2+(c??cv)}return n}function Zre(e,t,r){if(r&&r.z2==null){r=te({},r);var n=e.z2SelectLift;r.z2=e.z2+(n??Gre)}return r}function Yre(e,t,r){var n=Ye(e.currentStates,t)>=0,a=e.style.opacity,i=n?null:Wre(e,["opacity"],t,{opacity:1});r=r||{};var o=r.style||{};return o.opacity==null&&(r=te({},r),o=te({opacity:n?a:i.opacity*.1},o),r.style=o),r}function YS(e,t){var r=this.states[e];if(this.style){if(e==="emphasis")return $re(this,e,t,r);if(e==="blur")return Yre(this,e,r);if(e==="select")return Zre(this,e,r)}return r}function oh(e){e.stateProxy=YS;var t=e.getTextContent(),r=e.getTextGuideLine();t&&(t.stateProxy=YS),r&&(r.stateProxy=YS)}function eR(e,t){!T7(e,t)&&!e.__highByOuter&&Qs(e,x7)}function tR(e,t){!T7(e,t)&&!e.__highByOuter&&Qs(e,_7)}function Us(e,t){e.__highByOuter|=1<<(t||0),Qs(e,x7)}function Ws(e,t){!(e.__highByOuter&=~(1<<(t||0)))&&Qs(e,_7)}function w7(e){Qs(e,qk)}function Kk(e){Qs(e,b7)}function S7(e){Qs(e,Hre)}function C7(e){Qs(e,Ure)}function T7(e,t){return e.__highDownSilentOnTouch&&t.zrByTouch}function M7(e){var t=e.getModel(),r=[],n=[];t.eachComponent(function(a,i){var o=Zk(i),s=m7(e,i),l=a==="series";!l&&n.push(s),o.isBlured&&(s.group.traverse(function(u){b7(u)}),l&&r.push(i)),o.isBlured=!1}),R(n,function(a){a&&a.toggleBlurSeries&&a.toggleBlurSeries(r,!1,t)})}function EM(e,t,r,n){var a=n.getModel();r=r||"coordinateSystem";function i(u,c){for(var h=0;h0){var s={dataIndex:o,seriesIndex:r.seriesIndex};i!=null&&(s.dataType=i),t.push(s)}})}),t}function ql(e,t,r){Ic(e,!0),Qs(e,oh),OM(e,t,r)}function ene(e){Ic(e,!1)}function ir(e,t,r,n){n?ene(e):ql(e,t,r)}function OM(e,t,r){var n=Be(e);t!=null?(n.focus=t,n.blurScope=r):n.focus&&(n.focus=null)}var nR=["emphasis","blur","select"],tne={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Vr(e,t,r,n){r=r||"itemStyle";for(var a=0;a1&&(o*=XS(g),s*=XS(g));var m=(a===i?-1:1)*XS((o*o*(s*s)-o*o*(v*v)-s*s*(f*f))/(o*o*(v*v)+s*s*(f*f)))||0,y=m*o*v/s,x=m*-s*f/o,_=(e+r)/2+n0(h)*y-r0(h)*x,w=(t+n)/2+r0(h)*y+n0(h)*x,S=sR([1,0],[(f-y)/o,(v-x)/s]),C=[(f-y)/o,(v-x)/s],M=[(-1*f-y)/o,(-1*v-x)/s],A=sR(C,M);if(BM(C,M)<=-1&&(A=Qv),BM(C,M)>=1&&(A=0),A<0){var I=Math.round(A/Qv*1e6)/1e6;A=Qv*2+I%2*Qv}c.addData(u,_,w,o,s,S,A,h,i)}var sne=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,lne=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function une(e){var t=new Go;if(!e)return t;var r=0,n=0,a=r,i=n,o,s=Go.CMD,l=e.match(sne);if(!l)return t;for(var u=0;uB*B+H*H&&(I=P,k=D),{cx:I,cy:k,x0:-c,y0:-h,x1:I*(a/C-1),y1:k*(a/C-1)}}function gne(e){var t;if(ae(e)){var r=e.length;if(!r)return e;r===1?t=[e[0],e[0],0,0]:r===2?t=[e[0],e[0],e[1],e[1]]:r===3?t=e.concat(e[2]):t=e}else t=[e,e,e,e];return t}function mne(e,t){var r,n=Rp(t.r,0),a=Rp(t.r0||0,0),i=n>0,o=a>0;if(!(!i&&!o)){if(i||(n=a,a=0),a>n){var s=n;n=a,a=s}var l=t.startAngle,u=t.endAngle;if(!(isNaN(l)||isNaN(u))){var c=t.cx,h=t.cy,f=!!t.clockwise,v=uR(u-l),g=v>qS&&v%qS;if(g>ki&&(v=g),!(n>ki))e.moveTo(c,h);else if(v>qS-ki)e.moveTo(c+n*fd(l),h+n*Ku(l)),e.arc(c,h,n,l,u,!f),a>ki&&(e.moveTo(c+a*fd(u),h+a*Ku(u)),e.arc(c,h,a,u,l,f));else{var m=void 0,y=void 0,x=void 0,_=void 0,w=void 0,S=void 0,C=void 0,M=void 0,A=void 0,I=void 0,k=void 0,P=void 0,D=void 0,z=void 0,j=void 0,B=void 0,H=n*fd(l),V=n*Ku(l),U=a*fd(u),F=a*Ku(u),W=v>ki;if(W){var $=t.cornerRadius;$&&(r=gne($),m=r[0],y=r[1],x=r[2],_=r[3]);var Z=uR(n-a)/2;if(w=uo(Z,x),S=uo(Z,_),C=uo(Z,m),M=uo(Z,y),k=A=Rp(w,S),P=I=Rp(C,M),(A>ki||I>ki)&&(D=n*fd(u),z=n*Ku(u),j=a*fd(l),B=a*Ku(l),vki){var ne=uo(x,k),xe=uo(_,k),he=a0(j,B,H,V,n,ne,f),ge=a0(D,z,U,F,n,xe,f);e.moveTo(c+he.cx+he.x0,h+he.cy+he.y0),k0&&e.arc(c+he.cx,h+he.cy,ne,Ln(he.y0,he.x0),Ln(he.y1,he.x1),!f),e.arc(c,h,n,Ln(he.cy+he.y1,he.cx+he.x1),Ln(ge.cy+ge.y1,ge.cx+ge.x1),!f),xe>0&&e.arc(c+ge.cx,h+ge.cy,xe,Ln(ge.y1,ge.x1),Ln(ge.y0,ge.x0),!f))}else e.moveTo(c+H,h+V),e.arc(c,h,n,l,u,!f);if(!(a>ki)||!W)e.lineTo(c+U,h+F);else if(P>ki){var ne=uo(m,P),xe=uo(y,P),he=a0(U,F,D,z,a,-xe,f),ge=a0(H,V,j,B,a,-ne,f);e.lineTo(c+he.cx+he.x0,h+he.cy+he.y0),P0&&e.arc(c+he.cx,h+he.cy,xe,Ln(he.y0,he.x0),Ln(he.y1,he.x1),!f),e.arc(c,h,a,Ln(he.cy+he.y1,he.cx+he.x1),Ln(ge.cy+ge.y1,ge.cx+ge.x1),f),ne>0&&e.arc(c+ge.cx,h+ge.cy,ne,Ln(ge.y1,ge.x1),Ln(ge.y0,ge.x0),!f))}else e.lineTo(c+U,h+F),e.arc(c,h,a,u,l,f)}e.closePath()}}}var yne=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return e}(),wn=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new yne},t.prototype.buildPath=function(r,n){mne(r,n)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(pt);wn.prototype.type="sector";var xne=function(){function e(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return e}(),hv=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new xne},t.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.PI*2;r.moveTo(a+n.r,i),r.arc(a,i,n.r,0,o,!1),r.moveTo(a+n.r0,i),r.arc(a,i,n.r0,0,o,!0)},t}(pt);hv.prototype.type="ring";function _ne(e,t,r,n){var a=[],i=[],o=[],s=[],l,u,c,h;if(n){c=[1/0,1/0],h=[-1/0,-1/0];for(var f=0,v=e.length;f=2){if(n){var i=_ne(a,n,r,t.smoothConstraint);e.moveTo(a[0][0],a[0][1]);for(var o=a.length,s=0;s<(r?o:o-1);s++){var l=i[s*2],u=i[s*2+1],c=a[(s+1)%o];e.bezierCurveTo(l[0],l[1],u[0],u[1],c[0],c[1])}}else{e.moveTo(a[0][0],a[0][1]);for(var s=1,h=a.length;sQu[1]){if(i=!1,rn.negativeSize||n)return i;var l=i0(Qu[0]-Ju[1]),u=i0(Ju[0]-Qu[1]);KS(l,u)>s0.len()&&(l=u||!rn.bidirectional)&&(Oe.scale(o0,s,-u*a),rn.useDir&&rn.calcDirMTV()))}}return i},e.prototype._getProjMinMaxOnAxis=function(t,r,n){for(var a=this._axes[t],i=this._origin,o=r[0].dot(a)+i[t],s=o,l=o,u=1;u0){var h=c.duration,f=c.delay,v=c.easing,g={duration:h,delay:f||0,easing:v,done:i,force:!!i||!!o,setToFinal:!u,scope:e,during:o};s?t.animateFrom(r,g):t.animateTo(r,g)}else t.stopAnimation(),!s&&t.attr(r),o&&o(1),i&&i()}function At(e,t,r,n,a,i){tL("update",e,t,r,n,a,i)}function Qt(e,t,r,n,a,i){tL("enter",e,t,r,n,a,i)}function vf(e){if(!e.__zr)return!0;for(var t=0;tcr(i[1])?i[0]>0?"right":"left":i[1]>0?"bottom":"top"}function dR(e){return!e.isGroup}function Ene(e){return e.shape!=null}function $m(e,t,r){if(!e||!t)return;function n(o){var s={};return o.traverse(function(l){dR(l)&&l.anid&&(s[l.anid]=l)}),s}function a(o){var s={x:o.x,y:o.y,rotation:o.rotation};return Ene(o)&&(s.shape=ke(o.shape)),s}var i=n(e);t.traverse(function(o){if(dR(o)&&o.anid){var s=i[o.anid];if(s){var l=a(o);o.attr(a(s)),At(o,l,r,Be(o).dataIndex)}}})}function aL(e,t){return oe(e,function(r){var n=r[0];n=at(n,t.x),n=Et(n,t.x+t.width);var a=r[1];return a=at(a,t.y),a=Et(a,t.y+t.height),[n,a]})}function U7(e,t){var r=at(e.x,t.x),n=Et(e.x+e.width,t.x+t.width),a=at(e.y,t.y),i=Et(e.y+e.height,t.y+t.height);if(n>=r&&i>=a)return{x:r,y:a,width:n-r,height:i-a}}function pv(e,t,r){var n=te({rectHover:!0},t),a=n.style={strokeNoScale:!0};if(r=r||{x:-1,y:-1,width:2,height:2},e)return e.indexOf("image://")===0?(a.image=e.slice(8),Ee(a,r),new Qr(n)):Ef(e.replace("path://",""),n,r,"center")}function Op(e,t,r,n,a){for(var i=0,o=a[a.length-1];i1)return!1;var y=JS(v,g,c,h)/f;return!(y<0||y>1)}function JS(e,t,r,n){return e*n-r*t}function Rne(e){return e<=1e-6&&e>=-1e-6}function sh(e,t,r,n,a){return t==null||(Tt(t)?or[0]=or[1]=or[2]=or[3]=t:(or[0]=t[0],or[1]=t[1],or[2]=t[2],or[3]=t[3]),n&&(or[0]=at(0,or[0]),or[1]=at(0,or[1]),or[2]=at(0,or[2]),or[3]=at(0,or[3])),r&&(or[0]=-or[0],or[1]=-or[1],or[2]=-or[2],or[3]=-or[3]),fR(e,or,"x","width",3,1,a&&a[0]||0),fR(e,or,"y","height",0,2,a&&a[1]||0)),e}var or=[0,0,0,0];function fR(e,t,r,n,a,i,o){var s=t[i]+t[a],l=e[n];e[n]+=s,o=at(0,Et(o,l)),e[n]=0?-t[a]:t[i]>=0?l+t[i]:cr(s)>1e-8?(l-o)*t[a]/s:0):e[r]-=t[a]}function el(e){var t=e.itemTooltipOption,r=e.componentModel,n=e.itemName,a=ve(t)?{formatter:t}:t,i=r.mainType,o=r.componentIndex,s={componentType:i,name:n,$vars:["name"]};s[i+"Index"]=o;var l=e.formatterParamsExtra;l&&R(gt(l),function(c){Se(s,c)||(s[c]=l[c],s.$vars.push(c))});var u=Be(e.el);u.componentMainType=i,u.componentIndex=o,u.tooltipConfig={name:n,option:Ee({content:n,encodeHTMLContent:!0,formatterParams:s},a)}}function VM(e,t){var r;e.isGroup&&(r=t(e)),r||e.traverse(t)}function Su(e,t){if(e)if(ae(e))for(var r=0;rt&&(t=o),ot&&(r=t=0),{min:r,max:t}}function z1(e,t,r){Z7(e,t,r,-1/0)}function Z7(e,t,r,n){if(e.ignoreModelZ)return n;var a=e.getTextContent(),i=e.getTextGuideLine(),o=e.isGroup;if(o)for(var s=e.childrenRef(),l=0;l=0&&s.push(l)}),s}}function Cu(e,t){return Je(Je({},e,!0),t,!0)}const Yne={time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}},Xne={time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}};var H_="ZH",uL="EN",pf=uL,zx={},cL={},Q7=xt.domSupported?function(){var e=(document.documentElement.lang||navigator.language||navigator.browserLanguage||pf).toUpperCase();return e.indexOf(H_)>-1?H_:pf}():pf;function hL(e,t){e=e.toUpperCase(),cL[e]=new vt(t),zx[e]=t}function qne(e){if(ve(e)){var t=zx[e.toUpperCase()]||{};return e===H_||e===uL?ke(t):Je(ke(t),ke(zx[pf]),!1)}else return Je(ke(e),ke(zx[pf]),!1)}function UM(e){return cL[e]}function Kne(){return cL[pf]}hL(uL,Yne);hL(H_,Xne);var WM=null;function Jne(e){WM||(WM=e)}function Mr(){return WM}function eH(e,t){var r=Mr(),n=t.breakOption,a=t.breakParsed;return!a&&r&&(a=r.parseAxisBreakOption(n,e)),a}function U_(e){var t=e.brk;return t?t.breaks:[]}function W_(e){var t=e.brk;return t?t.hasBreaks():!1}var dL=1e3,fL=dL*60,dg=fL*60,ai=dg*24,yR=ai*365,Qne={year:/({yyyy}|{yy})/,month:/({MMMM}|{MMM}|{MM}|{M})/,day:/({dd}|{d})/,hour:/({HH}|{H}|{hh}|{h})/,minute:/({mm}|{m})/,second:/({ss}|{s})/,millisecond:/({SSS}|{S})/},Bx={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}"},eae="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}",u0="{yyyy}-{MM}-{dd}",xR={year:"{yyyy}",month:"{yyyy}-{MM}",day:u0,hour:u0+" "+Bx.hour,minute:u0+" "+Bx.minute,second:u0+" "+Bx.second,millisecond:eae},Ta=["year","month","day","hour","minute","second","millisecond"],tae=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function rae(e){return!ve(e)&&!Le(e)?nae(e):e}function nae(e){e=e||{};var t={},r=!0;return R(Ta,function(n){r&&(r=e[n]==null)}),R(Ta,function(n,a){var i=e[n];t[n]={};for(var o=null,s=a;s>=0;s--){var l=Ta[s],u=Re(i)&&!ae(i)?i[l]:i,c=void 0;ae(u)?(c=u.slice(),o=c[0]||""):ve(u)?(o=u,c=[o]):(o==null?o=Bx[n]:Qne[l].test(o)||(o=t[l][l][0]+" "+o),c=[o],r&&(c[1]="{primary|"+o+"}")),t[n][l]=c}}),t}function Yn(e,t){return e+="","0000".substr(0,t-e.length)+e}function fg(e){switch(e){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return e}}function aae(e){return e===fg(e)}function iae(e){switch(e){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function Zm(e,t,r,n){var a=qo(e),i=a[tH(r)](),o=a[vL(r)]()+1,s=Math.floor((o-1)/3)+1,l=a[pL(r)](),u=a["get"+(r?"UTC":"")+"Day"](),c=a[gL(r)](),h=(c-1)%12+1,f=a[mL(r)](),v=a[yL(r)](),g=a[xL(r)](),m=c>=12?"pm":"am",y=m.toUpperCase(),x=n instanceof vt?n:UM(n||Q7)||Kne(),_=x.getModel("time"),w=_.get("month"),S=_.get("monthAbbr"),C=_.get("dayOfWeek"),M=_.get("dayOfWeekAbbr");return(t||"").replace(/{a}/g,m+"").replace(/{A}/g,y+"").replace(/{yyyy}/g,i+"").replace(/{yy}/g,Yn(i%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,w[o-1]).replace(/{MMM}/g,S[o-1]).replace(/{MM}/g,Yn(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,Yn(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,C[u]).replace(/{ee}/g,M[u]).replace(/{e}/g,u+"").replace(/{HH}/g,Yn(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,Yn(h+"",2)).replace(/{h}/g,h+"").replace(/{mm}/g,Yn(f,2)).replace(/{m}/g,f+"").replace(/{ss}/g,Yn(v,2)).replace(/{s}/g,v+"").replace(/{SSS}/g,Yn(g,3)).replace(/{S}/g,g+"")}function oae(e,t,r,n,a){var i=null;if(ve(r))i=r;else if(Le(r)){var o={time:e.time,level:e.time?e.time.level:0},s=Mr();s&&s.makeAxisLabelFormatterParamBreak(o,e.break),i=r(e.value,t,o)}else{var l=e.time;if(l){var u=r[l.lowerTimeUnit][l.upperTimeUnit];i=u[Math.min(l.level,u.length-1)]||""}else{var c=gf(e.value,a);i=r[c][c][0]}}return Zm(new Date(e.value),i,a,n)}function gf(e,t){var r=qo(e),n=r[vL(t)]()+1,a=r[pL(t)](),i=r[gL(t)](),o=r[mL(t)](),s=r[yL(t)](),l=r[xL(t)](),u=l===0,c=u&&s===0,h=c&&o===0,f=h&&i===0,v=f&&a===1,g=v&&n===1;return g?"year":v?"month":f?"day":h?"hour":c?"minute":u?"second":"millisecond"}function $_(e,t,r){switch(t){case"year":e[rH(r)](0);case"month":e[nH(r)](1);case"day":e[aH(r)](0);case"hour":e[iH(r)](0);case"minute":e[oH(r)](0);case"second":e[sH(r)](0)}return e}function tH(e){return e?"getUTCFullYear":"getFullYear"}function vL(e){return e?"getUTCMonth":"getMonth"}function pL(e){return e?"getUTCDate":"getDate"}function gL(e){return e?"getUTCHours":"getHours"}function mL(e){return e?"getUTCMinutes":"getMinutes"}function yL(e){return e?"getUTCSeconds":"getSeconds"}function xL(e){return e?"getUTCMilliseconds":"getMilliseconds"}function sae(e){return e?"setUTCFullYear":"setFullYear"}function rH(e){return e?"setUTCMonth":"setMonth"}function nH(e){return e?"setUTCDate":"setDate"}function aH(e){return e?"setUTCHours":"setHours"}function iH(e){return e?"setUTCMinutes":"setMinutes"}function oH(e){return e?"setUTCSeconds":"setSeconds"}function sH(e){return e?"setUTCMilliseconds":"setMilliseconds"}function lae(e,t,r,n,a,i,o,s){var l=new wt({style:{text:e,font:t,align:r,verticalAlign:n,padding:a,rich:i,overflow:o?"truncate":null,lineHeight:s}});return l.getBoundingRect()}function _L(e){if(!Bk(e))return ve(e)?e:"-";var t=(e+"").split(".");return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function bL(e,t){return e=(e||"").toLowerCase().replace(/-(.)/g,function(r,n){return n.toUpperCase()}),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e}var mv=zm;function $M(e,t,r){var n="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function a(c){return c&&ka(c)?c:"-"}function i(c){return mi(c)}var o=t==="time",s=e instanceof Date;if(o||s){var l=o?qo(e):e;if(isNaN(+l)){if(s)return"-"}else return Zm(l,n,r)}if(t==="ordinal")return S_(e)?a(e):Tt(e)&&i(e)?e+"":"-";var u=Vo(e);return i(u)?_L(u):S_(e)?a(e):typeof e=="boolean"?e+"":"-"}var _R=["a","b","c","d","e","f","g"],tC=function(e,t){return"{"+e+(t??"")+"}"};function wL(e,t,r){ae(t)||(t=[t]);var n=t.length;if(!n)return"";for(var a=t[0].$vars||[],i=0;i':'';var o=r.markerId||"markerX";return{renderMode:i,content:"{"+o+"|} ",style:a==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:n}:{width:10,height:10,borderRadius:5,backgroundColor:n}}}function uae(e,t,r){(e==="week"||e==="month"||e==="quarter"||e==="half-year"||e==="year")&&(e=`MM-dd +yyyy`);var n=qo(t),a=r?"getUTC":"get",i=n[a+"FullYear"](),o=n[a+"Month"]()+1,s=n[a+"Date"](),l=n[a+"Hours"](),u=n[a+"Minutes"](),c=n[a+"Seconds"](),h=n[a+"Milliseconds"]();return e=e.replace("MM",Yn(o,2)).replace("M",o).replace("yyyy",i).replace("yy",Yn(i%100+"",2)).replace("dd",Yn(s,2)).replace("d",s).replace("hh",Yn(l,2)).replace("h",l).replace("mm",Yn(u,2)).replace("m",u).replace("ss",Yn(c,2)).replace("s",c).replace("SSS",Yn(h,3)),e}function cae(e){return e&&e.charAt(0).toUpperCase()+e.substr(1)}function uh(e,t){return t=t||"transparent",ve(e)?e:Re(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}function Z_(e,t){if(t==="_blank"||t==="blank"){var r=window.open();r.opener=null,r.location.href=e}else window.open(e,t)}var Fx={},rC={},yv=function(){function e(){this._normalMasterList=[],this._nonSeriesBoxMasterList=[]}return e.prototype.create=function(t,r){this._nonSeriesBoxMasterList=n(Fx),this._normalMasterList=n(rC);function n(a,i){var o=[];return R(a,function(s,l){var u=s.create(t,r);o=o.concat(u||[])}),o}},e.prototype.update=function(t,r){R(this._normalMasterList,function(n){n.update&&n.update(t,r)})},e.prototype.getCoordinateSystems=function(){return this._normalMasterList.concat(this._nonSeriesBoxMasterList)},e.register=function(t,r){if(t==="matrix"||t==="calendar"){Fx[t]=r;return}rC[t]=r},e.get=function(t){return rC[t]||Fx[t]},e}();function hae(e){return!!Fx[e]}var dae=1,cH=2;function fae(e){hH.set(e.fullType,{getCoord2:void 0}).getCoord2=e.getCoord2}var hH=we();function dH(e){var t=e.getShallow("coord",!0),r=dae;if(t==null){var n=hH.get(e.type);n&&n.getCoord2&&(r=cH,t=n.getCoord2(e))}return{coord:t,from:r}}var mf=0,Vx=1,fH=2;function vH(e,t){var r=e.getShallow("coordinateSystem"),n=e.getShallow("coordinateSystemUsage",!0),a=mf;if(r){var i=e.mainType==="series";n==null&&(n=i?"data":"box"),n==="data"?(a=Vx,i||(a=mf)):n==="box"&&(a=fH,!i&&!hae(r)&&(a=mf))}return{coordSysType:r,kind:a}}function Ym(e){var t=e.targetModel,r=e.coordSysType,n=e.coordSysProvider,a=e.isDefaultDataCoordSys;e.allowNotFound;var i=vH(t),o=i.kind,s=i.coordSysType;if(a&&o!==Vx&&(o=Vx,s=r),o===mf||s!==r)return mf;var l=n(r,t);return l?(o===Vx?t.coordinateSystem=l:t.boxCoordinateSystem=l,o):mf}var pH=function(e,t){var r=t.getReferringComponents(e,pr).models[0];return r&&r.coordinateSystem},Gx=R,gH=["left","right","top","bottom","width","height"],Pc=[["width","left","right"],["height","top","bottom"]];function SL(e,t,r,n,a){var i=0,o=0;n==null&&(n=1/0),a==null&&(a=1/0);var s=0;t.eachChild(function(l,u){var c=l.getBoundingRect(),h=t.childAt(u+1),f=h&&h.getBoundingRect(),v,g;if(e==="horizontal"){var m=c.width+(f?-f.x+c.x:0);v=i+m,v>n||l.newline?(i=0,v=m,o+=s+r,s=c.height):s=Math.max(s,c.height)}else{var y=c.height+(f?-f.y+c.y:0);g=o+y,g>a||l.newline?(i+=s+r,o=0,g=y,s=c.width):s=Math.max(s,c.width)}l.newline||(l.x=i,l.y=o,l.markRedraw(),e==="horizontal"?i=v+r:o=g+r)})}var Gc=SL;nt(SL,"vertical");nt(SL,"horizontal");function mH(e,t){return{left:e.getShallow("left",t),top:e.getShallow("top",t),right:e.getShallow("right",t),bottom:e.getShallow("bottom",t),width:e.getShallow("width",t),height:e.getShallow("height",t)}}function vae(e,t){var r=Ur(e,t,{enableLayoutOnlyByCenter:!0}),n=e.getBoxLayoutParams(),a,i;if(r.type===Bp.point)i=r.refPoint,a=tr(n,{width:t.getWidth(),height:t.getHeight()});else{var o=e.get("center"),s=ae(o)?o:[o,o];a=tr(n,r.refContainer),i=r.boxCoordFrom===cH?r.refPoint:[me(s[0],a.width)+a.x,me(s[1],a.height)+a.y]}return{viewRect:a,center:i}}function yH(e,t){var r=vae(e,t),n=r.viewRect,a=r.center,i=e.get("radius");ae(i)||(i=[0,i]);var o=me(n.width,t.getWidth()),s=me(n.height,t.getHeight()),l=Math.min(o,s),u=me(i[0],l/2),c=me(i[1],l/2);return{cx:a[0],cy:a[1],r0:u,r:c,viewRect:n}}function tr(e,t,r){r=mv(r||0);var n=t.width,a=t.height,i=me(e.left,n),o=me(e.top,a),s=me(e.right,n),l=me(e.bottom,a),u=me(e.width,n),c=me(e.height,a),h=r[2]+r[0],f=r[1]+r[3],v=e.aspect;switch(isNaN(u)&&(u=n-s-f-i),isNaN(c)&&(c=a-l-h-o),v!=null&&(isNaN(u)&&isNaN(c)&&(v>n/a?u=n*.8:c=a*.8),isNaN(u)&&(u=v*c),isNaN(c)&&(c=u/v)),isNaN(i)&&(i=n-s-u-f),isNaN(o)&&(o=a-l-c-h),e.left||e.right){case"center":i=n/2-u/2-r[3];break;case"right":i=n-u-f;break}switch(e.top||e.bottom){case"middle":case"center":o=a/2-c/2-r[0];break;case"bottom":o=a-c-h;break}i=i||0,o=o||0,isNaN(u)&&(u=n-f-i-(s||0)),isNaN(c)&&(c=a-h-o-(l||0));var g=new je((t.x||0)+i+r[3],(t.y||0)+o+r[0],u,c);return g.margin=r,g}function xH(e,t,r){var n=e.getShallow("preserveAspect",!0);if(!n)return t;var a=t.width/t.height;if(Math.abs(Math.atan(r)-Math.atan(a))<1e-9)return t;var i=e.getShallow("preserveAspectAlign",!0),o=e.getShallow("preserveAspectVerticalAlign",!0),s={width:t.width,height:t.height},l=n==="cover";return a>r&&!l||a=m)return h;for(var y=0;y=0;l--)s=Je(s,a[l],!0);n.defaultOption=s}return n.defaultOption},t.prototype.getReferringComponents=function(r,n){var a=r+"Index",i=r+"Id";return sv(this.ecModel,r,{index:this.get(a,!0),id:this.get(i,!0)},n)},t.prototype.getBoxLayoutParams=function(){return mH(this,!1)},t.prototype.getZLevelKey=function(){return""},t.prototype.setZLevel=function(r){this.option.zlevel=r},t.protoInitialize=function(){var r=t.prototype;r.type="component",r.id="",r.name="",r.mainType="",r.subType="",r.componentIndex=0}(),t}(vt);r7(ht,vt);k1(ht);$ne(ht);Zne(ht,mae);function mae(e){var t=[];return R(ht.getClassesByMainType(e),function(r){t=t.concat(r.dependencies||r.prototype.dependencies||[])}),t=oe(t,function(r){return bo(r).main}),e!=="dataset"&&Ye(t,"dataset")<=0&&t.unshift("dataset"),t}var K={color:{},darkColor:{},size:{}},wr=K.color={theme:["#5070dd","#b6d634","#505372","#ff994d","#0ca8df","#ffd10a","#fb628b","#785db0","#3fbe95"],neutral00:"#fff",neutral05:"#f4f7fd",neutral10:"#e8ebf0",neutral15:"#dbdee4",neutral20:"#cfd2d7",neutral25:"#c3c5cb",neutral30:"#b7b9be",neutral35:"#aaacb2",neutral40:"#9ea0a5",neutral45:"#929399",neutral50:"#86878c",neutral55:"#797b7f",neutral60:"#6d6e73",neutral65:"#616266",neutral70:"#54555a",neutral75:"#48494d",neutral80:"#3c3c41",neutral85:"#303034",neutral90:"#232328",neutral95:"#17171b",neutral99:"#000",accent05:"#eff1f9",accent10:"#e0e4f2",accent15:"#d0d6ec",accent20:"#c0c9e6",accent25:"#b1bbdf",accent30:"#a1aed9",accent35:"#91a0d3",accent40:"#8292cc",accent45:"#7285c6",accent50:"#6578ba",accent55:"#5c6da9",accent60:"#536298",accent65:"#4a5787",accent70:"#404c76",accent75:"#374165",accent80:"#2e3654",accent85:"#252b43",accent90:"#1b2032",accent95:"#121521",transparent:"rgba(0,0,0,0)",highlight:"rgba(255,231,130,0.8)"};te(wr,{primary:wr.neutral80,secondary:wr.neutral70,tertiary:wr.neutral60,quaternary:wr.neutral50,disabled:wr.neutral20,border:wr.neutral30,borderTint:wr.neutral20,borderShade:wr.neutral40,background:wr.neutral05,backgroundTint:"rgba(234,237,245,0.5)",backgroundTransparent:"rgba(255,255,255,0)",backgroundShade:wr.neutral10,shadow:"rgba(0,0,0,0.2)",shadowTint:"rgba(129,130,136,0.2)",axisLine:wr.neutral70,axisLineTint:wr.neutral40,axisTick:wr.neutral70,axisTickMinor:wr.neutral60,axisLabel:wr.neutral70,axisSplitLine:wr.neutral15,axisMinorSplitLine:wr.neutral05});for(var ec in wr)if(wr.hasOwnProperty(ec)){var bR=wr[ec];ec==="theme"?K.darkColor.theme=wr.theme.slice():ec==="highlight"?K.darkColor.highlight="rgba(255,231,130,0.4)":ec.indexOf("accent")===0?K.darkColor[ec]=Ls(bR,null,function(e){return e*.5},function(e){return Math.min(1,1.3-e)}):K.darkColor[ec]=Ls(bR,null,function(e){return e*.9},function(e){return 1-Math.pow(e,1.5)})}K.size={xxs:2,xs:5,s:10,m:15,l:20,xl:30,xxl:40,xxxl:50};var bH="";typeof navigator<"u"&&(bH=navigator.platform||"");var vd="rgba(0, 0, 0, 0.2)",wH=K.color.theme[0],yae=Ls(wH,null,null,.9);const SH={darkMode:"auto",colorBy:"series",color:K.color.theme,gradientColor:[yae,wH],aria:{decal:{decals:[{color:vd,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:vd,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:vd,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:vd,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:vd,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:vd,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:bH.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var fn={Must:1,Might:2,Not:3},CH=Qe();function xae(e){CH(e).datasetMap=we()}function TH(e,t,r){var n={},a=TL(t);if(!a||!e)return n;var i=[],o=[],s=t.ecModel,l=CH(s).datasetMap,u=a.uid+"_"+r.seriesLayoutBy,c,h;e=e.slice(),R(e,function(m,y){var x=Re(m)?m:e[y]={name:m};x.type==="ordinal"&&c==null&&(c=y,h=g(x)),n[x.name]=[]});var f=l.get(u)||l.set(u,{categoryWayDim:h,valueWayDim:0});R(e,function(m,y){var x=m.name,_=g(m);if(c==null){var w=f.valueWayDim;v(n[x],w,_),v(o,w,_),f.valueWayDim+=_}else if(c===y)v(n[x],0,_),v(i,0,_);else{var w=f.categoryWayDim;v(n[x],w,_),v(o,w,_),f.categoryWayDim+=_}});function v(m,y,x){for(var _=0;_t)return e[n];return e[r-1]}function NH(e,t,r,n,a,i,o){i=i||e;var s=t(i),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(a))return u[a];var c=o==null||!n?r:Cae(n,o);if(c=c||r,!(!c||!c.length)){var h=c[l];return a&&(u[a]=h),s.paletteIdx=(l+1)%c.length,h}}function Tae(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}var c0,ep,SR,CR="\0_ec_inner",Mae=1,AL=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.init=function(r,n,a,i,o,s){i=i||{},this.option=null,this._theme=new vt(i),this._locale=new vt(o),this._optionManager=s},t.prototype.setOption=function(r,n,a){var i=AR(n);this._optionManager.setOption(r,a,i),this._resetOption(null,i)},t.prototype.resetOption=function(r,n){return this._resetOption(r,AR(n))},t.prototype._resetOption=function(r,n){var a=!1,i=this._optionManager;if(!r||r==="recreate"){var o=i.mountOption(r==="recreate");!this.option||r==="recreate"?SR(this,o):(this.restoreData(),this._mergeOption(o,n)),a=!0}if((r==="timeline"||r==="media")&&this.restoreData(),!r||r==="recreate"||r==="timeline"){var s=i.getTimelineOption(this);s&&(a=!0,this._mergeOption(s,n))}if(!r||r==="recreate"||r==="media"){var l=i.getMediaOption(this);l.length&&R(l,function(u){a=!0,this._mergeOption(u,n)},this)}return a},t.prototype.mergeOption=function(r){this._mergeOption(r,null)},t.prototype._mergeOption=function(r,n){var a=this.option,i=this._componentsMap,o=this._componentsCount,s=[],l=we(),u=n&&n.replaceMergeMainTypeMap;xae(this),R(r,function(h,f){h!=null&&(ht.hasClass(f)?f&&(s.push(f),l.set(f,!0)):a[f]=a[f]==null?ke(h):Je(a[f],h,!0))}),u&&u.each(function(h,f){ht.hasClass(f)&&!l.get(f)&&(s.push(f),l.set(f,!0))}),ht.topologicalTravel(s,ht.getAllClassMainTypes(),c,this);function c(h){var f=wae(this,h,Zt(r[h])),v=i.get(h),g=v?u&&u.get(h)?"replaceMerge":"normalMerge":"replaceAll",m=YG(v,f,g);jte(m,h,ht),a[h]=null,i.set(h,null),o.set(h,0);var y=[],x=[],_=0,w;R(m,function(S,C){var M=S.existing,A=S.newOption;if(!A)M&&(M.mergeOption({},this),M.optionUpdated({},!1));else{var I=h==="series",k=ht.getClass(h,S.keyInfo.subType,!I);if(!k)return;if(h==="tooltip"){if(w)return;w=!0}if(M&&M.constructor===k)M.name=S.keyInfo.name,M.mergeOption(A,this),M.optionUpdated(A,!1);else{var P=te({componentIndex:C},S.keyInfo);M=new k(A,this,this,P),te(M,P),S.brandNew&&(M.__requireNewView=!0),M.init(A,this,this),M.optionUpdated(null,!0)}}M?(y.push(M.option),x.push(M),_++):(y.push(void 0),x.push(void 0))},this),a[h]=y,i.set(h,x),o.set(h,_),h==="series"&&c0(this)}this._seriesIndices||c0(this)},t.prototype.getOption=function(){var r=ke(this.option);return R(r,function(n,a){if(ht.hasClass(a)){for(var i=Zt(n),o=i.length,s=!1,l=o-1;l>=0;l--)i[l]&&!Xg(i[l])?s=!0:(i[l]=null,!s&&o--);i.length=o,r[a]=i}}),delete r[CR],r},t.prototype.setTheme=function(r){this._theme=new vt(r),this._resetOption("recreate",null)},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(r){this._payload=r},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(r,n){var a=this._componentsMap.get(r);if(a){var i=a[n||0];if(i)return i;if(n==null){for(var o=0;o=t:r==="max"?e<=t:e===t}function jae(e,t){return e.join(",")===t.join(",")}var Ni=R,tm=Re,NR=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function nC(e){var t=e&&e.itemStyle;if(t)for(var r=0,n=NR.length;r0?r[o-1].seriesModel:null)}),Uae(r)}})}function Uae(e){R(e,function(t,r){var n=[],a=[NaN,NaN],i=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,l=t.seriesModel.get("stackStrategy")||"samesign";o.modify(i,function(u,c,h){var f=o.get(t.stackedDimension,h);if(isNaN(f))return a;var v,g;s?g=o.getRawIndex(h):v=o.get(t.stackedByDimension,h);for(var m=NaN,y=r-1;y>=0;y--){var x=e[y];if(s||(g=x.data.rawIndexOf(x.stackedByDimension,v)),g>=0){var _=x.data.getByRawIndex(x.stackResultDimension,g);if(l==="all"||l==="positive"&&_>0||l==="negative"&&_<0||l==="samesign"&&f>=0&&_>0||l==="samesign"&&f<=0&&_<0){f=pc(f,_),m=_;break}}}return n[0]=f,n[1]=m,n})})}var G1=function(){function e(t){this.data=t.data||(t.sourceFormat===Yi?{}:[]),this.sourceFormat=t.sourceFormat||v7,this.seriesLayoutBy=t.seriesLayoutBy||Bi,this.startIndex=t.startIndex||0,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.metaRawOption=t.metaRawOption;var r=this.dimensionsDefine=t.dimensionsDefine;if(r)for(var n=0;nm&&(m=w)}v[0]=g,v[1]=m}},a=function(){return this._data?this._data.length/this._dimSize:0};ER=(t={},t[ln+"_"+Bi]={pure:!0,appendData:i},t[ln+"_"+jh]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},t[Fa]={pure:!0,appendData:i},t[Yi]={pure:!0,appendData:function(o){var s=this._data;R(o,function(l,u){for(var c=s[u]||(s[u]=[]),h=0;h<(l||[]).length;h++)c.push(l[h])})}},t[Ba]={appendData:i},t[Xl]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},t);function i(o){for(var s=0;s=0&&(m=o.interpolatedValue[y])}return m!=null?m+"":""})}},e.prototype.getRawValue=function(t,r){return Of(this.getData(r),t)},e.prototype.formatTooltip=function(t,r,n){},e}();function BR(e){var t,r;return Re(e)?e.type&&(r=e):t=e,{text:t,frag:r}}function vg(e){return new Jae(e)}var Jae=function(){function e(t){t=t||{},this._reset=t.reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0}return e.prototype.perform=function(t){var r=this._upstream,n=t&&t.skip;if(this._dirty&&r){var a=this.context;a.data=a.outputData=r.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!n&&(i=this._plan(this.context));var o=c(this._modBy),s=this._modDataCount||0,l=c(t&&t.modBy),u=t&&t.modDataCount||0;(o!==l||s!==u)&&(i="reset");function c(_){return!(_>=1)&&(_=1),_}var h;(this._dirty||i==="reset")&&(this._dirty=!1,h=this._doReset(n)),this._modBy=l,this._modDataCount=u;var f=t&&t.step;if(r?this._dueEnd=r._outputDueEnd:this._dueEnd=this._count?this._count(this.context):1/0,this._progress){var v=this._dueIndex,g=Math.min(f!=null?this._dueIndex+f:1/0,this._dueEnd);if(!n&&(h||v1&&n>0?s:o}};return i;function o(){return t=e?null:lt},gte:function(e,t){return e>=t}},eie=function(){function e(t,r){if(!Tt(r)){var n="";Lt(n)}this._opFn=zH[t],this._rvalFloat=Vo(r)}return e.prototype.evaluate=function(t){return Tt(t)?this._opFn(t,this._rvalFloat):this._opFn(Vo(t),this._rvalFloat)},e}(),BH=function(){function e(t,r){var n=t==="desc";this._resultLT=n?1:-1,r==null&&(r=n?"min":"max"),this._incomparable=r==="min"?-1/0:1/0}return e.prototype.evaluate=function(t,r){var n=Tt(t)?t:Vo(t),a=Tt(r)?r:Vo(r),i=isNaN(n),o=isNaN(a);if(i&&(n=this._incomparable),o&&(a=this._incomparable),i&&o){var s=ve(t),l=ve(r);s&&(n=l?t:0),l&&(a=s?r:0)}return na?-this._resultLT:0},e}(),tie=function(){function e(t,r){this._rval=r,this._isEQ=t,this._rvalTypeof=typeof r,this._rvalFloat=Vo(r)}return e.prototype.evaluate=function(t){var r=t===this._rval;if(!r){var n=typeof t;n!==this._rvalTypeof&&(n==="number"||this._rvalTypeof==="number")&&(r=Vo(t)===this._rvalFloat)}return this._isEQ?r:!r},e}();function rie(e,t){return e==="eq"||e==="ne"?new tie(e==="eq",t):Se(zH,e)?new eie(e,t):null}function FH(e){var t="",r=-1/0,n=-1/0,a=1/0,i=1/0;return e&&(e.g!=null&&(t+="G"+e.g,r=e.g),e.ge!=null&&(t+="GE"+e.ge,n=e.ge),e.l!=null&&(t+="L"+e.l,a=e.l),e.le!=null&&(t+="LE"+e.le,i=e.le)),{key:t,g:r,ge:n,l:a,le:i}}function VH(e,t){return t>e.g&&t>=e.ge&&t65535?die:fie}function vie(e){var t=e.constructor;return t===Array?e.slice():new t(e)}function GR(e,t,r,n,a){var i=UH[r||"float"];if(a){var o=e[t],s=o&&o.length;if(s!==n){for(var l=new i(n),u=0;uy[1]&&(y[1]=m)}return this._rawCount=this._count=l,{start:s,end:l}},e.prototype._initDataFromProvider=function(t,r,n){for(var a=this._provider,i=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,u=oe(o,function(_){return _.property}),c=0;cx[1]&&(x[1]=y)}}!a.persistent&&a.clean&&a.clean(),this._rawCount=this._count=r,this._extent=[]},e.prototype.count=function(){return this._count},e.prototype.get=function(t,r){if(!(r>=0&&r=0&&r=this._rawCount||t<0)return-1;if(!this._indices)return t;var r=this._indices,n=r[t];if(n!=null&&nt)i=o-1;else return o}return-1},e.prototype.getIndices=function(){var t,r=this._indices;if(r){var n=r.constructor,a=this._count;if(n===Array){t=new n(a);for(var i=0;i=h&&_<=f||isNaN(_))&&(l[u++]=m),m++}g=!0}else if(i===2){for(var y=v[a[0]],w=v[a[1]],S=t[a[1]][0],C=t[a[1]][1],x=0;x=h&&_<=f||isNaN(_))&&(M>=S&&M<=C||isNaN(M))&&(l[u++]=m),m++}g=!0}}if(!g)if(i===1)for(var x=0;x=h&&_<=f||isNaN(_))&&(l[u++]=A)}else for(var x=0;xt[P][1])&&(I=!1)}I&&(l[u++]=r.getRawIndex(x))}return ux[1]&&(x[1]=y)}}}},e.prototype.lttbDownSample=function(t,r){var n=this.clone([t],!0),a=n._chunks,i=a[t],o=this.count(),s=0,l=Math.floor(1/r),u=this.getRawIndex(0),c,h,f,v=new(pd(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));v[s++]=u;for(var g=1;gc&&(c=h,f=S)}D>0&&Ds&&(m=s-c);for(var y=0;yg&&(g=_,v=c+y)}var w=this.getRawIndex(h),S=this.getRawIndex(v);hc-g&&(l=c-g,s.length=l);for(var m=0;mh[1]&&(h[1]=x),f[v++]=_}return i._count=v,i._indices=f,i._updateGetRawIdx(),i},e.prototype.each=function(t,r){if(this._count)for(var n=t.length,a=this._chunks,i=0,o=this.count();iv&&(v=y))}return l[c]=[f,v]},e.prototype.getRawDataItem=function(t){var r=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(r);for(var n=[],a=this._chunks,i=0;i=0?this._indices[t]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function t(r,n,a,i){return Kl(r[i],this._dimensions[i])}oC={arrayRows:t,objectRows:function(r,n,a,i){return Kl(r[n],this._dimensions[i])},keyedColumns:t,original:function(r,n,a,i){var o=r&&(r.value==null?r:r.value);return Kl(o instanceof Array?o[i]:o,this._dimensions[i])},typedArray:function(r,n,a,i){return r[i]}}}(),e}(),WH=function(){function e(t){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t}return e.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},e.prototype._setLocalSource=function(t,r){this._sourceList=t,this._upstreamSignList=r,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},e.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},e.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},e.prototype._createSource=function(){this._setLocalSource([],[]);var t=this._sourceHost,r=this._getUpstreamSourceManagers(),n=!!r.length,a,i;if(d0(t)){var o=t,s=void 0,l=void 0,u=void 0;if(n){var c=r[0];c.prepareSource(),u=c.getSource(),s=u.data,l=u.sourceFormat,i=[c._getVersionSign()]}else s=o.get("data",!0),l=Qn(s)?Xl:Ba,i=[];var h=this._getSourceMetaRawOption()||{},f=u&&u.metaRawOption||{},v=Te(h.seriesLayoutBy,f.seriesLayoutBy)||null,g=Te(h.sourceHeader,f.sourceHeader),m=Te(h.dimensions,f.dimensions),y=v!==f.seriesLayoutBy||!!g!=!!f.sourceHeader||m;a=y?[XM(s,{seriesLayoutBy:v,sourceHeader:g,dimensions:m},l)]:[]}else{var x=t;if(n){var _=this._applyTransform(r);a=_.sourceList,i=_.upstreamSignList}else{var w=x.get("source",!0);a=[XM(w,this._getSourceMetaRawOption(),null)],i=[]}}this._setLocalSource(a,i)},e.prototype._applyTransform=function(t){var r=this._sourceHost,n=r.get("transform",!0),a=r.get("fromTransformResult",!0);if(a!=null){var i="";t.length!==1&&UR(i)}var o,s=[],l=[];return R(t,function(u){u.prepareSource();var c=u.getSource(a||0),h="";a!=null&&!c&&UR(h),s.push(c),l.push(u._getVersionSign())}),n?o=cie(n,s,{datasetIndex:r.componentIndex}):a!=null&&(o=[Wae(s[0])]),{sourceList:o,upstreamSignList:l}},e.prototype._isDirty=function(){if(this._dirty)return!0;for(var t=this._getUpstreamSourceManagers(),r=0;r1||r>0&&!e.noHeader;return R(e.blocks,function(a){var i=XH(a);i>=t&&(t=i+ +(n&&(!i||KM(a)&&!a.noHeader)))}),t}return 0}function yie(e,t,r,n){var a=t.noHeader,i=_ie(XH(t)),o=[],s=t.blocks||[];bn(!s||ae(s)),s=s||[];var l=e.orderMode;if(t.sortBlocks&&l){s=s.slice();var u={valueAsc:"asc",valueDesc:"desc"};if(Se(u,l)){var c=new BH(u[l],null);s.sort(function(m,y){return c.evaluate(m.sortParam,y.sortParam)})}else l==="seriesDesc"&&s.reverse()}R(s,function(m,y){var x=t.valueFormatter,_=YH(m)(x?te(te({},e),{valueFormatter:x}):e,m,y>0?i.html:0,n);_!=null&&o.push(_)});var h=e.renderMode==="richText"?o.join(i.richText):JM(n,o.join(""),a?r:i.html);if(a)return h;var f=$M(t.header,"ordinal",e.useUTC),v=ZH(n,e.renderMode).nameStyle,g=$H(n);return e.renderMode==="richText"?qH(e,f,v)+i.richText+h:JM(n,'
'+Rn(f)+"
"+h,r)}function xie(e,t,r,n){var a=e.renderMode,i=t.noName,o=t.noValue,s=!t.markerType,l=t.name,u=e.useUTC,c=t.valueFormatter||e.valueFormatter||function(S){return S=ae(S)?S:[S],oe(S,function(C,M){return $M(C,ae(v)?v[M]:v,u)})};if(!(i&&o)){var h=s?"":e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||K.color.secondary,a),f=i?"":$M(l,"ordinal",u),v=t.valueType,g=o?[]:c(t.value,t.rawDataIndex),m=!s||!i,y=!s&&i,x=ZH(n,a),_=x.nameStyle,w=x.valueStyle;return a==="richText"?(s?"":h)+(i?"":qH(e,f,_))+(o?"":Sie(e,g,m,y,w)):JM(n,(s?"":h)+(i?"":bie(f,!s,_))+(o?"":wie(g,m,y,w)),r)}}function WR(e,t,r,n,a,i){if(e){var o=YH(e),s={useUTC:a,renderMode:r,orderMode:n,markupStyleCreator:t,valueFormatter:e.valueFormatter};return o(s,e,0,i)}}function _ie(e){return{html:gie[e],richText:mie[e]}}function JM(e,t,r){var n='
',a="margin: "+r+"px 0 0",i=$H(e);return'
'+t+n+"
"}function bie(e,t,r){var n=t?"margin-left:2px":"";return''+Rn(e)+""}function wie(e,t,r,n){var a=r?"10px":"20px",i=t?"float:right;margin-left:"+a:"";return e=ae(e)?e:[e],''+oe(e,function(o){return Rn(o)}).join("  ")+""}function qH(e,t,r){return e.markupStyleCreator.wrapRichTextStyle(t,r)}function Sie(e,t,r,n,a){var i=[a],o=n?10:20;return r&&i.push({padding:[0,0,0,o],align:"right"}),e.markupStyleCreator.wrapRichTextStyle(ae(t)?t.join(" "):t,i)}function KH(e,t){var r=e.getData().getItemVisual(t,"style"),n=r[e.visualDrawType];return uh(n)}function JH(e,t){var r=e.get("padding");return r??(t==="richText"?[8,10]:10)}var sC=function(){function e(){this.richTextStyles={},this._nextStyleNameId=Fk()}return e.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(t,r,n){var a=n==="richText"?this._generateStyleName():null,i=uH({color:r,type:t,renderMode:n,markerId:a});return ve(i)?i:(this.richTextStyles[a]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(t,r){var n={};ae(r)?R(r,function(i){return te(n,i)}):te(n,r);var a=this._generateStyleName();return this.richTextStyles[a]=n,"{"+a+"|"+t+"}"},e}();function QH(e){var t=e.series,r=e.dataIndex,n=e.multipleSeries,a=t.getData(),i=a.mapDimensionsAll("defaultedTooltip"),o=i.length,s=t.getRawValue(r),l=ae(s),u=KH(t,r),c,h,f,v;if(o>1||l&&!o){var g=Cie(s,t,r,i,u);c=g.inlineValues,h=g.inlineValueTypes,f=g.blocks,v=g.inlineValues[0]}else if(o){var m=a.getDimensionInfo(i[0]);v=c=Of(a,r,i[0]),h=m.type}else v=c=l?s[0]:s;var y=Vk(t),x=y&&t.name||"",_=a.getName(r),w=n?x:_;return Er("section",{header:x,noHeader:n||!y,sortParam:v,blocks:[Er("nameValue",{markerType:"item",markerColor:u,name:w,noName:!ka(w),value:c,valueType:h,rawDataIndex:a.getRawIndex(r)})].concat(f||[])})}function Cie(e,t,r,n,a){var i=t.getData(),o=pi(e,function(h,f,v){var g=i.getDimensionInfo(v);return h=h||g&&g.tooltip!==!1&&g.displayName!=null},!1),s=[],l=[],u=[];n.length?R(n,function(h){c(Of(i,r,h),h)}):R(e,c);function c(h,f){var v=i.getDimensionInfo(f);!v||v.otherDims.tooltip===!1||(o?u.push(Er("nameValue",{markerType:"subItem",markerColor:a,name:v.displayName,value:h,valueType:v.type})):(s.push(h),l.push(v.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:u}}var dl=Qe();function f0(e,t){return e.getName(t)||e.getId(t)}var Hx="__universalTransitionEnabled",Ut=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r._selectedDataIndicesMap={},r}return t.prototype.init=function(r,n,a){this.seriesIndex=this.componentIndex,this.dataTask=vg({count:Mie,reset:Aie}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(r,a);var i=dl(this).sourceManager=new WH(this);i.prepareSource();var o=this.getInitialData(r,a);ZR(o,this),this.dataTask.context.data=o,dl(this).dataBeforeProcessed=o,$R(this),this._initSelectedMapFromData(o)},t.prototype.mergeDefaultAndTheme=function(r,n){var a=em(this),i=a?zh(r):{},o=this.subType;ht.hasClass(o)&&(o+="Series"),Je(r,n.getTheme().get(this.subType)),Je(r,this.getDefaultOption()),rh(r,"label",["show"]),this.fillDataTextStyle(r.data),a&&Uo(r,i,a)},t.prototype.mergeOption=function(r,n){r=Je(this.option,r,!0),this.fillDataTextStyle(r.data);var a=em(this);a&&Uo(this.option,r,a);var i=dl(this).sourceManager;i.dirty(),i.prepareSource();var o=this.getInitialData(r,n);ZR(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,dl(this).dataBeforeProcessed=o,$R(this),this._initSelectedMapFromData(o)},t.prototype.fillDataTextStyle=function(r){if(r&&!Qn(r))for(var n=["show"],a=0;a=0&&f<0)&&(h=C,f=S,v=0),S===f&&(c[v++]=y))}return c.length=v,c},t.prototype.formatTooltip=function(r,n,a){return QH({series:this,dataIndex:r,multipleSeries:n})},t.prototype.isAnimationEnabled=function(){var r=this.ecModel;if(xt.node&&!(r&&r.ssr))return!1;var n=this.getShallow("animation");return n&&this.getData().count()>this.getShallow("animationThreshold")&&(n=!1),!!n},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(r,n,a){var i=this.ecModel,o=ML.prototype.getColorFromPalette.call(this,r,n,a);return o||(o=i.getColorFromPalette(r,n,a)),o},t.prototype.coordDimToDataDim=function(r){return this.getRawData().mapDimensionsAll(r)},t.prototype.getProgressive=function(){return this.get("progressive")},t.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},t.prototype.select=function(r,n){this._innerSelect(this.getData(n),r)},t.prototype.unselect=function(r,n){var a=this.option.selectedMap;if(a){var i=this.option.selectedMode,o=this.getData(n);if(i==="series"||a==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s=0&&a.push(o)}return a},t.prototype.isSelected=function(r,n){var a=this.option.selectedMap;if(!a)return!1;var i=this.getData(n);return(a==="all"||a[f0(i,r)])&&!i.getItemModel(r).get(["select","disabled"])},t.prototype.isUniversalTransitionEnabled=function(){if(this[Hx])return!0;var r=this.option.universalTransition;return r?r===!0?!0:r&&r.enabled:!1},t.prototype._innerSelect=function(r,n){var a,i,o=this.option,s=o.selectedMode,l=n.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){Re(o.selectedMap)||(o.selectedMap={});for(var u=o.selectedMap,c=0;c0&&this._innerSelect(r,n)}},t.registerClass=function(r){return ht.registerClass(r)},t.protoInitialize=function(){var r=t.prototype;r.type="series.__base__",r.seriesIndex=0,r.ignoreStyleOnData=!1,r.hasSymbolVisual=!1,r.defaultSymbol="circle",r.visualStyleAccessPath="itemStyle",r.visualDrawType="fill"}(),t}(ht);kr(Ut,H1);kr(Ut,ML);r7(Ut,ht);function $R(e){var t=e.name;Vk(e)||(e.name=Tie(e)||t)}function Tie(e){var t=e.getRawData(),r=t.mapDimensionsAll("seriesName"),n=[];return R(r,function(a){var i=t.getDimensionInfo(a);i.displayName&&n.push(i.displayName)}),n.join(" ")}function Mie(e){return e.model.getRawData().count()}function Aie(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),Nie}function Nie(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function ZR(e,t){R(Lf(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(r){e.wrapMethod(r,nt(kie,t))})}function kie(e,t){var r=QM(e);return r&&r.setOutputEnd((t||this).count()),t}function QM(e){var t=(e.ecModel||{}).scheduler,r=t&&t.getPipeline(e.uid);if(r){var n=r.currentTask;if(n){var a=n.agentStubMap;a&&(n=a.get(e.uid))}return n}}var Yt=function(){function e(){this.group=new De,this.uid=Oh("viewComponent")}return e.prototype.init=function(t,r){},e.prototype.render=function(t,r,n,a){},e.prototype.dispose=function(t,r){},e.prototype.updateView=function(t,r,n,a){},e.prototype.updateLayout=function(t,r,n,a){},e.prototype.updateVisual=function(t,r,n,a){},e.prototype.toggleBlurSeries=function(t,r,n){},e.prototype.eachRendered=function(t){var r=this.group;r&&r.traverse(t)},e}();Uk(Yt);k1(Yt);function Bh(){var e=Qe();return function(t){var r=e(t),n=t.pipelineContext,a=!!r.large,i=!!r.progressiveRender,o=r.large=!!(n&&n.large),s=r.progressiveRender=!!(n&&n.progressiveRender);return(a!==o||i!==s)&&"reset"}}var eU=Qe(),Lie=Bh(),Rt=function(){function e(){this.group=new De,this.uid=Oh("viewChart"),this.renderTask=vg({plan:Iie,reset:Pie}),this.renderTask.context={view:this}}return e.prototype.init=function(t,r){},e.prototype.render=function(t,r,n,a){},e.prototype.highlight=function(t,r,n,a){var i=t.getData(a&&a.dataType);i&&XR(i,a,"emphasis")},e.prototype.downplay=function(t,r,n,a){var i=t.getData(a&&a.dataType);i&&XR(i,a,"normal")},e.prototype.remove=function(t,r){this.group.removeAll()},e.prototype.dispose=function(t,r){},e.prototype.updateView=function(t,r,n,a){this.render(t,r,n,a)},e.prototype.updateVisual=function(t,r,n,a){this.render(t,r,n,a)},e.prototype.eachRendered=function(t){Su(this.group,t)},e.markUpdateMethod=function(t,r){eU(t).updateMethod=r},e.protoInitialize=function(){var t=e.prototype;t.type="chart"}(),e}();function YR(e,t,r){e&&Kg(e)&&(t==="emphasis"?Us:Ws)(e,r)}function XR(e,t,r){var n=nh(e,t),a=t&&t.highlightKey!=null?nne(t.highlightKey):null;n!=null?R(Zt(n),function(i){YR(e.getItemGraphicEl(i),r,a)}):e.eachItemGraphicEl(function(i){YR(i,r,a)})}Uk(Rt);k1(Rt);function Iie(e){return Lie(e.model)}function Pie(e){var t=e.model,r=e.ecModel,n=e.api,a=e.payload,i=t.pipelineContext.progressiveRender,o=e.view,s=a&&eU(a).updateMethod,l=i?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](t,r,n,a),Die[l]}var Die={incrementalPrepareRender:{progress:function(e,t){t.view.incrementalRender(e,t.model,t.ecModel,t.api,t.payload)}},render:{forceFirstProgress:!0,progress:function(e,t){t.view.render(t.model,t.ecModel,t.api,t.payload)}}},Y_="\0__throttleOriginMethod",qR="\0__throttleRate",KR="\0__throttleType";function U1(e,t,r){var n,a=0,i=0,o=null,s,l,u,c;t=t||0;function h(){i=new Date().getTime(),o=null,e.apply(l,u||[])}var f=function(){for(var v=[],g=0;g=0?h():o=setTimeout(h,-s),a=n};return f.clear=function(){o&&(clearTimeout(o),o=null)},f.debounceNextCall=function(v){c=v},f}function xv(e,t,r,n){var a=e[t];if(a){var i=a[Y_]||a,o=a[KR],s=a[qR];if(s!==r||o!==n){if(r==null||!n)return e[t]=i;a=e[t]=U1(i,r,n==="debounce"),a[Y_]=i,a[KR]=n,a[qR]=r}return a}}function rm(e,t){var r=e[t];r&&r[Y_]&&(r.clear&&r.clear(),e[t]=r[Y_])}var JR=Qe(),QR={itemStyle:ih(J7,!0),lineStyle:ih(K7,!0)},jie={lineStyle:"stroke",itemStyle:"fill"};function tU(e,t){var r=e.visualStyleMapper||QR[t];return r||(console.warn("Unknown style type '"+t+"'."),QR.itemStyle)}function rU(e,t){var r=e.visualDrawType||jie[t];return r||(console.warn("Unknown style type '"+t+"'."),"fill")}var Eie={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var r=e.getData(),n=e.visualStyleAccessPath||"itemStyle",a=e.getModel(n),i=tU(e,n),o=i(a),s=a.getShallow("decal");s&&(r.setVisual("decal",s),s.dirty=!0);var l=rU(e,n),u=o[l],c=Le(u)?u:null,h=o.fill==="auto"||o.stroke==="auto";if(!o[l]||c||h){var f=e.getColorFromPalette(e.name,null,t.getSeriesCount());o[l]||(o[l]=f,r.setVisual("colorFromPalette",!0)),o.fill=o.fill==="auto"||Le(o.fill)?f:o.fill,o.stroke=o.stroke==="auto"||Le(o.stroke)?f:o.stroke}if(r.setVisual("style",o),r.setVisual("drawType",l),!t.isSeriesFiltered(e)&&c)return r.setVisual("colorFromPalette",!1),{dataEach:function(v,g){var m=e.getDataParams(g),y=te({},o);y[l]=c(m),v.setItemVisual(g,"style",y)}}}},rp=new vt,Rie={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var r=e.getData(),n=e.visualStyleAccessPath||"itemStyle",a=tU(e,n),i=r.getVisual("drawType");return{dataEach:r.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[n]){rp.option=l[n];var u=a(rp),c=o.ensureUniqueItemVisual(s,"style");te(c,u),rp.option.decal&&(o.setItemVisual(s,"decal",rp.option.decal),rp.option.decal.dirty=!0),i in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},Oie={performRawSeries:!0,overallReset:function(e){var t=we();e.eachSeries(function(r){if(!r.isColorBySeries()){var n=r.type+"-"+r.getColorBy();JR(r).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(r){if(!r.isColorBySeries()){var n=r.getRawData(),a={},i=r.getData(),o=JR(r).scope,s=r.visualStyleAccessPath||"itemStyle",l=rU(r,s);i.each(function(u){var c=i.getRawIndex(u);a[c]=u}),n.each(function(u){var c=a[u],h=i.getItemVisual(c,"colorFromPalette");if(h){var f=i.ensureUniqueItemVisual(c,"style"),v=n.getName(u)||u+"",g=n.count();f[l]=r.getColorFromPalette(v,o,g)}})}})}},v0=Math.PI;function zie(e,t){t=t||{},Ee(t,{text:"loading",textColor:K.color.primary,fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255,255,255,0.8)",showSpinner:!0,color:K.color.theme[0],spinnerRadius:10,lineWidth:5,zlevel:0});var r=new De,n=new it({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});r.add(n);var a=new wt({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),i=new it({style:{fill:"none"},textContent:a,textConfig:{position:"right",distance:10},zlevel:t.zlevel,z:10001});r.add(i);var o;return t.showSpinner&&(o=new Um({shape:{startAngle:-v0/2,endAngle:-v0/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:"round",lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:v0*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:v0*3/2}).delay(300).start("circularInOut"),r.add(o)),r.resize=function(){var s=a.getBoundingRect().width,l=t.showSpinner?t.spinnerRadius:0,u=(e.getWidth()-l*2-(t.showSpinner&&s?10:0)-s)/2-(t.showSpinner&&s?0:5+s/2)+(t.showSpinner?0:s/2)+(s?0:l),c=e.getHeight()/2;t.showSpinner&&o.setShape({cx:u,cy:c}),i.setShape({x:u-l,y:c-l,width:l*2,height:l*2}),n.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},r.resize(),r}var nU=function(){function e(t,r,n,a){this._stageTaskMap=we(),this.ecInstance=t,this.api=r,n=this._dataProcessorHandlers=n.slice(),a=this._visualHandlers=a.slice(),this._allHandlers=n.concat(a)}return e.prototype.restoreData=function(t,r){t.restoreData(r),this._stageTaskMap.each(function(n){var a=n.overallTask;a&&a.dirty()})},e.prototype.getPerformArgs=function(t,r){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),a=n.context,i=!r&&n.progressiveEnabled&&(!a||a.progressiveRender)&&t.__idxInPipeline>n.blockIndex,o=i?n.step:null,s=a&&a.modDataCount,l=s!=null?Math.ceil(s/o):null;return{step:o,modBy:l,modDataCount:s}}},e.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},e.prototype.updateStreamModes=function(t,r){var n=this._pipelineMap.get(t.uid),a=t.__preparePipelineContext?t.__preparePipelineContext(r,n):e7(t,r,n);t.pipelineContext=n.context=a},e.prototype.restorePipelines=function(t,r){var n=this,a=n._pipelineMap=we();r.eachSeries(function(i){var o=t.painter.type==="canvas"&&i.getProgressive(),s=i.uid;a.set(s,{id:s,head:null,tail:null,threshold:i.getProgressiveThreshold(),progressiveEnabled:o&&!(i.preventIncremental&&i.preventIncremental()),blockIndex:-1,step:Math.round(o||700),count:0}),n._pipe(i,i.dataTask)})},e.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,r=this.api.getModel(),n=this.api;R(this._allHandlers,function(a){var i=t.get(a.uid)||t.set(a.uid,{}),o="";bn(!(a.reset&&a.overallReset),o),a.reset&&this._createSeriesStageTask(a,i,r,n),a.overallReset&&this._createOverallStageTask(a,i,r,n)},this)},e.prototype.prepareView=function(t,r,n,a){var i=t.renderTask,o=i.context;o.model=r,o.ecModel=n,o.api=a,i.__block=!t.incrementalPrepareRender,this._pipe(r,i)},e.prototype.performDataProcessorTasks=function(t,r){this._performStageTasks(this._dataProcessorHandlers,t,r,{block:!0})},e.prototype.performVisualTasks=function(t,r,n){this._performStageTasks(this._visualHandlers,t,r,n)},e.prototype._performStageTasks=function(t,r,n,a){a=a||{};var i=!1,o=this;R(t,function(l,u){if(!(a.visualType&&a.visualType!==l.visualType)){var c=o._stageTaskMap.get(l.uid),h=c.seriesTaskMap,f=c.overallTask;if(f){var v,g=f.agentStubMap;g.each(function(y){s(a,y)&&(y.dirty(),v=!0)}),v&&f.dirty(),o.updatePayload(f,n);var m=o.getPerformArgs(f,a.block);g.each(function(y){y.perform(m)}),f.perform(m)&&(i=!0)}else h&&h.each(function(y,x){s(a,y)&&y.dirty();var _=o.getPerformArgs(y,a.block);_.skip=!l.performRawSeries&&r.isSeriesFiltered(y.context.model),o.updatePayload(y,n),y.perform(_)&&(i=!0)})}});function s(l,u){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(u.__pipeline.id))}this.unfinished=i||this.unfinished},e.prototype.performSeriesTasks=function(t){var r;t.eachSeries(function(n){r=n.dataTask.perform()||r}),this.unfinished=r||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(t){var r=t.tail;do{if(r.__block){t.blockIndex=r.__idxInPipeline;break}r=r.getUpstream()}while(r)})},e.prototype.updatePayload=function(t,r){r!=="remain"&&(t.context.payload=r)},e.prototype._createSeriesStageTask=function(t,r,n,a){var i=this,o=r.seriesTaskMap,s=r.seriesTaskMap=we(),l=t.seriesType,u=t.getTargetSeries;t.createOnAllSeries?n.eachRawSeries(c):l?n.eachRawSeriesByType(l,c):u&&u(n,a).each(c);function c(h){var f=h.uid,v=s.set(f,o&&o.get(f)||vg({plan:Hie,reset:Uie,count:$ie}));v.context={model:h,ecModel:n,api:a,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:i},i._pipe(h,v)}},e.prototype._createOverallStageTask=function(t,r,n,a){var i=this,o=r.overallTask=r.overallTask||vg({reset:Bie});o.context={ecModel:n,api:a,overallReset:t.overallReset,scheduler:i};var s=o.agentStubMap,l=o.agentStubMap=we(),u=t.seriesType,c=t.getTargetSeries,h=t.dirtyOnOverallProgress,f=!1,v="";bn(!t.createOnAllSeries,v),u?n.eachRawSeriesByType(u,g):c?c(n,a).each(g):R(n.getSeries(),g);function g(m){var y=m.uid,x=l.set(y,s&&s.get(y)||(f=!0,vg({reset:Fie,onDirty:Gie})));x.context={model:m,dirtyOnOverallProgress:h},x.agent=o,x.__block=h,i._pipe(m,x)}f&&o.dirty()},e.prototype._pipe=function(t,r){var n=t.uid,a=this._pipelineMap.get(n);!a.head&&(a.head=r),a.tail&&a.tail.pipe(r),a.tail=r,r.__idxInPipeline=a.count++,r.__pipeline=a},e.wrapStageHandler=function(t,r){return Le(t)&&(t={overallReset:t,seriesType:Zie(t)}),t.uid=Oh("stageHandler"),r&&(t.visualType=r),t},e}();function Bie(e){e.overallReset(e.ecModel,e.api,e.payload)}function Fie(e){return e.dirtyOnOverallProgress&&Vie}function Vie(){this.agent.dirty(),this.getDownstream().dirty()}function Gie(){this.agent&&this.agent.dirty()}function Hie(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function Uie(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Zt(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?oe(t,function(r,n){return aU(n)}):Wie}var Wie=aU(0);function aU(e){return function(t,r){var n=r.data,a=r.resetDefines[e];if(a&&a.dataEach)for(var i=t.start;i0&&v===u.length-f.length){var g=u.slice(0,v);g!=="data"&&(r.mainType=g,r[f.toLowerCase()]=l,c=!0)}}s.hasOwnProperty(u)&&(n[u]=l,c=!0),c||(a[u]=l)})}return{cptQuery:r,dataQuery:n,otherQuery:a}},e.prototype.filter=function(t,r){var n=this.eventInfo;if(!n)return!0;var a=n.targetEl,i=n.packedEvent,o=n.model,s=n.view;if(!o||!s)return!0;var l=r.cptQuery,u=r.dataQuery;return c(l,o,"mainType")&&c(l,o,"subType")&&c(l,o,"index","componentIndex")&&c(l,o,"name")&&c(l,o,"id")&&c(u,i,"name")&&c(u,i,"dataIndex")&&c(u,i,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(t,r.otherQuery,a,i));function c(h,f,v,g){return h[v]==null||f[g||v]===h[v]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),eA=["symbol","symbolSize","symbolRotate","symbolOffset"],rO=eA.concat(["symbolKeepAspect"]),Xie={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var r=e.getData();if(e.legendIcon&&r.setVisual("legendIcon",e.legendIcon),!e.hasSymbolVisual)return;for(var n={},a={},i=!1,o=0;o=0&&jc(l)?l:.5;var u=e.createRadialGradient(o,s,0,o,s,l);return u}function tA(e,t,r){for(var n=t.type==="radial"?voe(e,t,r):foe(e,t,r),a=t.colorStops,i=0;i0)?null:e==="dashed"?[4*t,2*t]:e==="dotted"?[t]:Tt(e)?[e]:ae(e)?e:null}function DL(e){var t=e.style,r=t.lineDash&&t.lineWidth>0&&goe(t.lineDash,t.lineWidth),n=t.lineDashOffset;if(r){var a=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;a&&a!==1&&(r=oe(r,function(i){return i/a}),n/=a)}return[r,n]}var moe=new Go(!0);function K_(e){var t=e.stroke;return!(t==null||t==="none"||!(e.lineWidth>0))}function nO(e){return typeof e=="string"&&e!=="none"}function J_(e){var t=e.fill;return t!=null&&t!=="none"}function aO(e,t){if(t.fillOpacity!=null&&t.fillOpacity!==1){var r=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=r}else e.fill()}function iO(e,t){if(t.strokeOpacity!=null&&t.strokeOpacity!==1){var r=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=r}else e.stroke()}function rA(e,t,r){var n=Wk(t.image,t.__image,r);if(L1(n)){var a=e.createPattern(n,t.repeat||"repeat");if(typeof DOMMatrix=="function"&&a&&a.setTransform){var i=new DOMMatrix;i.translateSelf(t.x||0,t.y||0),i.rotateSelf(0,0,(t.rotation||0)*ng),i.scaleSelf(t.scaleX||1,t.scaleY||1),a.setTransform(i)}return a}}function yoe(e,t,r,n,a){var i,o=K_(r),s=J_(r),l=r.strokePercent,u=l<1,c=!t.path;(!t.silent||u)&&c&&t.createPathProxy();var h=t.path||moe,f=t.__dirty;if(!n){var v=r.fill,g=r.stroke,m=s&&!!v.colorStops,y=o&&!!g.colorStops,x=s&&!!v.image,_=o&&!!g.image,w=void 0,S=void 0,C=void 0,M=void 0,A=void 0;(m||y)&&(A=t.getBoundingRect()),m&&(w=f?tA(e,v,A):t.__canvasFillGradient,t.__canvasFillGradient=w),y&&(S=f?tA(e,g,A):t.__canvasStrokeGradient,t.__canvasStrokeGradient=S),x&&(C=f||!t.__canvasFillPattern?rA(e,v,t):t.__canvasFillPattern,t.__canvasFillPattern=C),_&&(M=f||!t.__canvasStrokePattern?rA(e,g,t):t.__canvasStrokePattern,t.__canvasStrokePattern=M),m?e.fillStyle=w:x&&(C?e.fillStyle=C:s=!1),y?e.strokeStyle=S:_&&(M?e.strokeStyle=M:o=!1)}var I=t.getGlobalScale();h.setScale(I[0],I[1],t.segmentIgnoreThreshold);var k,P;e.setLineDash&&r.lineDash&&(i=DL(t),k=i[0],P=i[1]);var D=!0;(c||f&Dd)&&(h.setDPR(e.dpr),u?h.setContext(null):(h.setContext(e),D=!1),h.reset(),t.buildPath(h,t.shape,n),h.toStatic(),t.pathUpdated()),D&&h.rebuildPath(e,u?l:1),k&&(e.setLineDash(k),e.lineDashOffset=P),n?(a.batchFill=s,a.batchStroke=o):r.strokeFirst?(o&&iO(e,r),s&&aO(e,r)):(s&&aO(e,r),o&&iO(e,r)),k&&e.setLineDash([])}function xoe(e,t,r){var n=t.__image=Wk(r.image,t.__image,t,t.onload);if(!(!n||!L1(n))){var a=r.x||0,i=r.y||0,o=t.getWidth(),s=t.getHeight(),l=n.width/n.height;if(o==null&&s!=null?o=s*l:s==null&&o!=null?s=o/l:o==null&&s==null&&(o=n.width,s=n.height),r.sWidth&&r.sHeight){var u=r.sx||0,c=r.sy||0;e.drawImage(n,u,c,r.sWidth,r.sHeight,a,i,o,s)}else if(r.sx&&r.sy){var u=r.sx,c=r.sy,h=o-u,f=s-c;e.drawImage(n,u,c,h,f,a,i,o,s)}else e.drawImage(n,a,i,o,s)}}function _oe(e,t,r){var n,a=r.text;if(a!=null&&(a+=""),a){e.font=r.font||Fs,e.textAlign=r.textAlign,e.textBaseline=r.textBaseline;var i=void 0,o=void 0;e.setLineDash&&r.lineDash&&(n=DL(t),i=n[0],o=n[1]),i&&(e.setLineDash(i),e.lineDashOffset=o),r.strokeFirst?(K_(r)&&e.strokeText(a,r.x,r.y),J_(r)&&e.fillText(a,r.x,r.y)):(J_(r)&&e.fillText(a,r.x,r.y),K_(r)&&e.strokeText(a,r.x,r.y)),i&&e.setLineDash([])}}var oO=["shadowBlur","shadowOffsetX","shadowOffsetY"],sO=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function pU(e,t,r,n,a){var i=!1;if(!n&&(r=r||{},t===r))return!1;if(n||t.opacity!==r.opacity){qn(e,a),i=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?Bc.opacity:o}(n||t.blend!==r.blend)&&(i||(qn(e,a),i=!0),e.globalCompositeOperation=t.blend||Bc.blend);for(var s=0;s0&&r.unfinished);r.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(r,n,a){if(!this[zr]){if(this._disposed){this.id;return}var i,o,s;if(Re(n)&&(a=n.lazyUpdate,i=n.silent,o=n.replaceMerge,s=n.transition,n=n.notMerge),this[zr]=!0,xd(this),!this._model||n){var l=new Lae(this._api),u=this._theme,c=this._model=new AL;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,u,this._locale,l)}this._model.setOption(r,{replaceMerge:o},oA);var h={seriesTransition:s,optionChanged:!0};if(a)this[tn]={silent:i,updateParams:h},this[zr]=!1,this.getZr().wakeUp();else{try{ic(this),fs.update.call(this,null,h)}catch(f){throw this[tn]=null,this[zr]=!1,f}this._ssr||this._zr.flush(),this[tn]=null,this[zr]=!1,md.call(this,i),yd.call(this,i)}}},t.prototype.setTheme=function(r,n){if(!this[zr]){if(this._disposed){this.id;return}var a=this._model;if(a){var i=n&&n.silent,o=null;this[tn]&&(i==null&&(i=this[tn].silent),o=this[tn].updateParams,this[tn]=null),this[zr]=!0,xd(this);try{this._updateTheme(r),a.setTheme(this._theme),ic(this),fs.update.call(this,{type:"setTheme"},o)}catch(s){throw this[zr]=!1,s}this[zr]=!1,md.call(this,i),yd.call(this,i)}}},t.prototype._updateTheme=function(r){ve(r)&&(r=LU[r]),r&&(r=ke(r),r&&LH(r,!0),this._theme=r)},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||xt.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(r){return this.renderToCanvas(r)},t.prototype.renderToCanvas=function(r){r=r||{};var n=this._zr.painter;return n.getRenderedCanvas({backgroundColor:r.backgroundColor||this._model.get("backgroundColor"),pixelRatio:r.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(r){r=r||{};var n=this._zr.painter;return n.renderToString({useViewBox:r.useViewBox})},t.prototype.getSvgDataURL=function(){var r=this._zr,n=r.storage.getDisplayList();return R(n,function(a){a.stopAnimation(null,!0)}),r.painter.toDataURL()},t.prototype.getDataURL=function(r){if(this._disposed){this.id;return}r=r||{};var n=r.excludeComponents,a=this._model,i=[],o=this;R(n,function(l){a.eachComponent({mainType:l},function(u){var c=o._componentsMap[u.__viewId];c.group.ignore||(i.push(c),c.group.ignore=!0)})});var s=this._zr.painter.getType()==="svg"?this.getSvgDataURL():this.renderToCanvas(r).toDataURL("image/"+(r&&r.type||"png"));return R(i,function(l){l.group.ignore=!1}),s},t.prototype.getConnectedDataURL=function(r){if(this._disposed){this.id;return}var n=r.type==="svg",a=this.group,i=Math.min,o=Math.max,s=1/0;if(rb[a]){var l=s,u=s,c=-s,h=-s,f=[],v=r&&r.pixelRatio||this.getDevicePixelRatio();R(Hc,function(w,S){if(w.group===a){var C=n?w.getZr().painter.getSvgDom().innerHTML:w.renderToCanvas(ke(r)),M=w.getDom().getBoundingClientRect();l=i(M.left,l),u=i(M.top,u),c=o(M.right,c),h=o(M.bottom,h),f.push({dom:C,left:M.left,top:M.top})}}),l*=v,u*=v,c*=v,h*=v;var g=c-l,m=h-u,y=qr.createCanvas(),x=CM(y,{renderer:n?"svg":"canvas"});if(x.resize({width:g,height:m}),n){var _="";return R(f,function(w){var S=w.left-l,C=w.top-u;_+=''+w.dom+""}),x.painter.getSvgRoot().innerHTML=_,r.connectedBackgroundColor&&x.painter.setBackgroundColor(r.connectedBackgroundColor),x.refreshImmediately(),x.painter.toDataURL()}else return r.connectedBackgroundColor&&x.add(new it({shape:{x:0,y:0,width:g,height:m},style:{fill:r.connectedBackgroundColor}})),R(f,function(w){var S=new Qr({style:{x:w.left*v-l,y:w.top*v-u,image:w.dom}});x.add(S)}),x.refreshImmediately(),y.toDataURL("image/"+(r&&r.type||"png"))}else return this.getDataURL(r)},t.prototype.convertToPixel=function(r,n,a){return y0(this,"convertToPixel",r,n,a)},t.prototype.convertToLayout=function(r,n,a){return y0(this,"convertToLayout",r,n,a)},t.prototype.convertFromPixel=function(r,n,a){return y0(this,"convertFromPixel",r,n,a)},t.prototype.containPixel=function(r,n){if(this._disposed){this.id;return}var a=this._model,i,o=ff(a,r);return R(o,function(s,l){l.indexOf("Models")>=0&&R(s,function(u){var c=u.coordinateSystem;if(c&&c.containPoint)i=i||!!c.containPoint(n);else if(l==="seriesModels"){var h=this._chartsMap[u.__viewId];h&&h.containPoint&&(i=i||h.containPoint(n,u))}},this)},this),!!i},t.prototype.getVisual=function(r,n){var a=this._model,i=ff(a,r,{defaultMainType:"series"}),o=i.seriesModel,s=o.getData(),l=i.hasOwnProperty("dataIndexInside")?i.dataIndexInside:i.hasOwnProperty("dataIndex")?s.indexOfRawIndex(i.dataIndex):null;return l!=null?PL(s,l,n):Xm(s,n)},t.prototype.getViewOfComponentModel=function(r){return this._componentsMap[r.__viewId]},t.prototype.getViewOfSeriesModel=function(r){return this._chartsMap[r.__viewId]},t.prototype._initEvents=function(){var r=this;R(Woe,function(a){var i=function(o){var s=r.getModel(),l=o.target,u,c=a==="globalout";if(c?u={}:l&&Dc(l,function(m){var y=Be(m);if(y&&y.dataIndex!=null){var x=y.dataModel||s.getSeriesByIndex(y.seriesIndex);return u=x&&x.getDataParams(y.dataIndex,y.dataType,l)||{},!0}else if(y.eventData)return u=te({},y.eventData),!0},!0),u){var h=u.componentType,f=u.componentIndex;(h==="markLine"||h==="markPoint"||h==="markArea")&&(h="series",f=u.seriesIndex);var v=h&&f!=null&&s.getComponent(h,f),g=v&&r[v.mainType==="series"?"_chartsMap":"_componentsMap"][v.__viewId];u.event=o,u.type=a,r._$eventProcessor.eventInfo={targetEl:l,packedEvent:u,model:v,view:g},r.trigger(a,u)}};i.zrEventfulCallAtLast=!0,r._zr.on(a,i,r)});var n=this._messageCenter;R(aA,function(a,i){n.on(i,function(o){r.trigger(i,o)})}),Kie(n,this,this._api)},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0;var r=this.getDom();r&&qG(this.getDom(),OL,"");var n=this,a=n._api,i=n._model;R(n._componentsViews,function(o){o.dispose(i,a)}),R(n._chartsViews,function(o){o.dispose(i,a)}),n._zr.dispose(),n._dom=n._model=n._chartsMap=n._componentsMap=n._chartsViews=n._componentsViews=n._scheduler=n._api=n._zr=n._throttledZrFlush=n._theme=n._coordSysMgr=n._messageCenter=null,delete Hc[n.id]},t.prototype.resize=function(r){if(!this[zr]){if(this._disposed){this.id;return}this._zr.resize(r);var n=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!n){var a=n.resetOption("media"),i=r&&r.silent;this[tn]&&(i==null&&(i=this[tn].silent),a=!0,this[tn]=null),this[zr]=!0,xd(this);try{a&&ic(this),fs.update.call(this,{type:"resize",animation:te({duration:0},r&&r.animation)})}catch(o){throw this[zr]=!1,o}this[zr]=!1,md.call(this,i),yd.call(this,i)}}},t.prototype.showLoading=function(r,n){if(this._disposed){this.id;return}if(Re(r)&&(n=r,r=""),r=r||"default",this.hideLoading(),!!sA[r]){var a=sA[r](this._api,n),i=this._zr;this._loadingFX=a,i.add(a)}},t.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},t.prototype.makeActionFromEvent=function(r){var n=te({},r);return n.type=nA[r.type],n},t.prototype.dispatchAction=function(r,n){if(this._disposed){this.id;return}if(Re(n)||(n={silent:!!n}),!!eb[r.type]&&this._model){if(this[zr]){this._pendingActions.push(r);return}var a=n.silent;fC.call(this,r,a);var i=n.flush;i?this._zr.flush():i!==!1&&xt.browser.weChat&&this._throttledZrFlush(),md.call(this,a),yd.call(this,a)}},t.prototype.updateLabelLayout=function(){qa.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(r){if(this._disposed){this.id;return}var n=r.seriesIndex,a=this.getModel(),i=a.getSeriesByIndex(n);i.appendData(r),this._scheduler.unfinished=!0,this.getZr().wakeUp()},t.internalField=function(){ic=function(h){eoe(h._model);var f=h._scheduler;f.restorePipelines(h._zr,h._model),f.prepareStageTasks(),hC(h,!0),hC(h,!1),f.plan()},hC=function(h,f){for(var v=h._model,g=h._scheduler,m=f?h._componentsViews:h._chartsViews,y=f?h._componentsMap:h._chartsMap,x=h._zr,_=h._api,w=0;wTe(f.get("hoverLayerThreshold"),SH.hoverLayerThreshold)&&!xt.node&&!xt.worker;(h._usingTHL||y)&&(f.eachSeries(function(x){if(!x.preventUsingHoverLayer){var _=h._chartsMap[x.__viewId];_.__alive&&_.eachRendered(function(w){var S=w.states.emphasis;S&&S.hoverLayer!==vv&&(S.hoverLayer=y?F7:B7)})}}),h._usingTHL=y)}}function s(h,f){var v=h.get("blendMode")||null;f.eachRendered(function(g){g.isGroup||(g.style.blend=v)})}function l(h,f){if(!h.preventAutoZ){var v=lh(h);f.eachRendered(function(g){return z1(g,v.z,v.zlevel),!0})}}function u(h,f){f.eachRendered(function(v){if(!vf(v)){var g=v.getTextContent(),m=v.getTextGuideLine();v.stateTransition&&(v.stateTransition=null),g&&g.stateTransition&&(g.stateTransition=null),m&&m.stateTransition&&(m.stateTransition=null),v.hasState()?(v.prevStates=v.currentStates,v.clearStates()):v.prevStates&&(v.prevStates=null)}})}function c(h,f){var v=h.getModel("stateAnimation"),g=h.isAnimationEnabled(),m=v.get("duration"),y=m>0?{duration:m,delay:v.get("delay"),easing:v.get("easing")}:null;f.eachRendered(function(x){if(x.states&&x.states.emphasis){if(vf(x))return;if(x instanceof pt&&ane(x),x.__dirty){var _=x.prevStates;_&&x.useStates(_)}if(g){x.stateTransition=y;var w=x.getTextContent(),S=x.getTextGuideLine();w&&(w.stateTransition=y),S&&(S.stateTransition=y)}x.__dirty&&i(x)}})}bO=function(h){return new(function(f){X(v,f);function v(){return f!==null&&f.apply(this,arguments)||this}return v.prototype.getCoordinateSystems=function(){return h._coordSysMgr.getCoordinateSystems()},v.prototype.getComponentByElement=function(g){for(;g;){var m=g.__ecComponentInfo;if(m!=null)return h._model.getComponent(m.mainType,m.index);g=g.parent}},v.prototype.enterEmphasis=function(g,m){Us(g,m),Wa(h)},v.prototype.leaveEmphasis=function(g,m){Ws(g,m),Wa(h)},v.prototype.enterBlur=function(g){w7(g),Wa(h)},v.prototype.leaveBlur=function(g){Kk(g),Wa(h)},v.prototype.enterSelect=function(g){S7(g),Wa(h)},v.prototype.leaveSelect=function(g){C7(g),Wa(h)},v.prototype.getModel=function(){return h.getModel()},v.prototype.getViewOfComponentModel=function(g){return h.getViewOfComponentModel(g)},v.prototype.getViewOfSeriesModel=function(g){return h.getViewOfSeriesModel(g)},v.prototype.getECUpdateCycleVersion=function(){return h[g0]},v.prototype.usingTHL=function(){return h._usingTHL},v}(g7))(h)},kU=function(h){function f(v,g){for(var m=0;m=0)){SO.push(r);var o=nU.wrapStageHandler(r,a);o.__prio=t,o.__raw=r,e.push(o)}}function HL(e,t){sA[e]=t}function tse(e){QV({createCanvas:e})}function RU(e,t,r){var n=hU("registerMap");n&&n(e,t,r)}function rse(e){var t=hU("getMap");return t&&t(e)}var OU=uie;Tu(EL,Eie);Tu($1,Rie);Tu($1,Oie);Tu(EL,Xie);Tu($1,qie);Tu(wU,Noe);FL(LH);VL(joe,Gae);HL("default",zie);Xi({type:Fc,event:Fc,update:Fc},hr);Xi({type:Ex,event:Ex,update:Ex},hr);Xi({type:B_,event:Xk,update:B_,action:hr,refineEvent:UL,publishNonRefinedEvent:!0});Xi({type:jM,event:Xk,update:jM,action:hr,refineEvent:UL,publishNonRefinedEvent:!0});Xi({type:F_,event:Xk,update:F_,action:hr,refineEvent:UL,publishNonRefinedEvent:!0});function UL(e,t,r,n){return{eventContent:{selected:Qre(r),isFromClick:t.isFromClick||!1}}}BL("default",{});BL("dark",sU);var nse={},CO=[],ase={registerPreprocessor:FL,registerProcessor:VL,registerPostInit:PU,registerPostUpdate:DU,registerUpdateLifecycle:Z1,registerAction:Xi,registerCoordinateSystem:jU,registerLayout:EU,registerVisual:Tu,registerTransform:OU,registerLoading:HL,registerMap:RU,registerImpl:Jie,PRIORITY:SU,ComponentModel:ht,ComponentView:Yt,SeriesModel:Ut,ChartView:Rt,registerComponentModel:function(e){ht.registerClass(e)},registerComponentView:function(e){Yt.registerClass(e)},registerSeriesModel:function(e){Ut.registerClass(e)},registerChartView:function(e){Rt.registerClass(e)},registerCustomSeries:function(e,t){fU(e,t)},registerSubTypeDefaulter:function(e,t){ht.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){OG(e,t)}};function rt(e){if(ae(e)){R(e,function(t){rt(t)});return}Ye(CO,e)>=0||(CO.push(e),Le(e)&&(e={install:e}),e.install(ase))}function ap(e){return e==null?0:e.length||1}function TO(e){return e}var $s=function(){function e(t,r,n,a,i,o){this._old=t,this._new=r,this._oldKeyGetter=n||TO,this._newKeyGetter=a||TO,this.context=i,this._diffModeMultiple=o==="multiple"}return e.prototype.add=function(t){return this._add=t,this},e.prototype.update=function(t){return this._update=t,this},e.prototype.updateManyToOne=function(t){return this._updateManyToOne=t,this},e.prototype.updateOneToMany=function(t){return this._updateOneToMany=t,this},e.prototype.updateManyToMany=function(t){return this._updateManyToMany=t,this},e.prototype.remove=function(t){return this._remove=t,this},e.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},e.prototype._executeOneToOne=function(){var t=this._old,r=this._new,n={},a=new Array(t.length),i=new Array(r.length);this._initIndexMap(t,null,a,"_oldKeyGetter"),this._initIndexMap(r,n,i,"_newKeyGetter");for(var o=0;o1){var c=l.shift();l.length===1&&(n[s]=l[0]),this._update&&this._update(c,o)}else u===1?(n[s]=null,this._update&&this._update(l,o)):this._remove&&this._remove(o)}this._performRestAdd(i,n)},e.prototype._executeMultiple=function(){var t=this._old,r=this._new,n={},a={},i=[],o=[];this._initIndexMap(t,n,i,"_oldKeyGetter"),this._initIndexMap(r,a,o,"_newKeyGetter");for(var s=0;s1&&f===1)this._updateManyToOne&&this._updateManyToOne(c,u),a[l]=null;else if(h===1&&f>1)this._updateOneToMany&&this._updateOneToMany(c,u),a[l]=null;else if(h===1&&f===1)this._update&&this._update(c,u),a[l]=null;else if(h>1&&f>1)this._updateManyToMany&&this._updateManyToMany(c,u),a[l]=null;else if(h>1)for(var v=0;v1)for(var s=0;s30}var ip=Re,fl=oe,cse=typeof Int32Array>"u"?Array:Int32Array,hse="e\0\0",MO=-1,dse=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],fse=["_approximateExtent"],AO,_0,op,sp,gC,lp,mC,Bn=function(){function e(t,r){this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var n,a=!1;BU(t)?(n=t.dimensions,this._dimOmitted=t.isDimensionOmitted(),this._schema=t):(a=!0,n=t),n=n||["x","y"];for(var i={},o=[],s={},l=!1,u={},c=0;c=r)){var n=this._store,a=n.getProvider();this._updateOrdinalMeta();var i=this._nameList,o=this._idList,s=a.getSource().sourceFormat,l=s===Ba;if(l&&!a.pure)for(var u=[],c=t;c0},e.prototype.ensureUniqueItemVisual=function(t,r){var n=this._itemVisuals,a=n[t];a||(a=n[t]={});var i=a[r];return i==null&&(i=this.getVisual(r),ae(i)?i=i.slice():ip(i)&&(i=te({},i)),a[r]=i),i},e.prototype.setItemVisual=function(t,r,n){var a=this._itemVisuals[t]||{};this._itemVisuals[t]=a,ip(r)?te(a,r):a[r]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(t,r){ip(t)?te(this._layout,t):this._layout[t]=r},e.prototype.getLayout=function(t){return this._layout[t]},e.prototype.getItemLayout=function(t){return this._itemLayouts[t]},e.prototype.setItemLayout=function(t,r,n){this._itemLayouts[t]=n?te(this._itemLayouts[t]||{},r):r},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(t,r){var n=this.hostModel&&this.hostModel.seriesIndex;DM(n,this.dataType,t,r),this._graphicEls[t]=r},e.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},e.prototype.eachItemGraphicEl=function(t,r){R(this._graphicEls,function(n,a){n&&t&&t.call(r,n,a)})},e.prototype.cloneShallow=function(t){return t||(t=new e(this._schema?this._schema:fl(this.dimensions,this._getDimInfo,this),this.hostModel)),gC(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(t,r){var n=this[t];Le(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var a=n.apply(this,arguments);return r.apply(this,[a].concat(x1(arguments)))})},e.internalField=function(){AO=function(t){var r=t._invertedIndicesMap;R(r,function(n,a){var i=t._dimInfos[a],o=i.ordinalMeta,s=t._store;if(o){n=r[a]=new cse(o.categories.length);for(var l=0;l1&&(l+="__ec__"+c),a[r]=l}}}(),e}();function vse(e,t){return wv(e,t).dimensions}function wv(e,t){NL(e)||(e=kL(e)),t=t||{};var r=t.coordDimensions||[],n=t.dimensionsDefine||e.dimensionsDefine||[],a=we(),i=[],o=pse(e,r,n,t.dimensionsCount),s=t.canOmitUnusedDimensions&&VU(o),l=n===e.dimensionsDefine,u=l?FU(e):WL(n),c=t.encodeDefine;!c&&t.encodeDefaulter&&(c=t.encodeDefaulter(e,o));for(var h=we(c),f=new HH(o),v=0;v0&&(k.name=k.name+(P-1))}),new zU({source:e,dimensions:i,fullDimensionCount:o,dimensionOmitted:s})}function pse(e,t,r,n){var a=Math.max(e.dimensionsDetectedCount||1,t.length,r.length,n||0);return R(t,function(i){var o;Re(i)&&(o=i.dimsDef)&&(a=Math.max(a,o.length))}),a}function gse(e,t,r){if(r||t.hasKey(e)){for(var n=0;t.hasKey(e+n);)n++;e+=n}return t.set(e,!0),e}var mse=function(){function e(t){this.coordSysDims=[],this.axisMap=we(),this.categoryAxisMap=we(),this.coordSysName=t}return e}();function yse(e){var t=e.get("coordinateSystem"),r=new mse(t),n=xse[t];if(n)return n(e,r,r.axisMap,r.categoryAxisMap),r}var xse={cartesian2d:function(e,t,r,n){var a=e.getReferringComponents("xAxis",pr).models[0],i=e.getReferringComponents("yAxis",pr).models[0];t.coordSysDims=["x","y"],r.set("x",a),r.set("y",i),_d(a)&&(n.set("x",a),t.firstCategoryDimIndex=0),_d(i)&&(n.set("y",i),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=1))},singleAxis:function(e,t,r,n){var a=e.getReferringComponents("singleAxis",pr).models[0];t.coordSysDims=["single"],r.set("single",a),_d(a)&&(n.set("single",a),t.firstCategoryDimIndex=0)},polar:function(e,t,r,n){var a=e.getReferringComponents("polar",pr).models[0],i=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");t.coordSysDims=["radius","angle"],r.set("radius",i),r.set("angle",o),_d(i)&&(n.set("radius",i),t.firstCategoryDimIndex=0),_d(o)&&(n.set("angle",o),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=1))},geo:function(e,t,r,n){t.coordSysDims=["lng","lat"]},parallel:function(e,t,r,n){var a=e.ecModel,i=a.getComponent("parallel",e.get("parallelIndex")),o=t.coordSysDims=i.dimensions.slice();R(i.parallelAxisIndex,function(s,l){var u=a.getComponent("parallelAxis",s),c=o[l];r.set(c,u),_d(u)&&(n.set(c,u),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=l))})},matrix:function(e,t,r,n){var a=e.getReferringComponents("matrix",pr).models[0];t.coordSysDims=["x","y"];var i=a.getDimensionModel("x"),o=a.getDimensionModel("y");r.set("x",i),r.set("y",o),n.set("x",i),n.set("y",o)}};function _d(e){return e.get("type")==="category"}function GU(e,t,r){r=r||{};var n=r.byIndex,a=r.stackedCoordDimension,i,o,s;_se(t)?i=t:(o=t.schema,i=o.dimensions,s=t.store);var l=!!(e&&e.get("stack")),u,c,h,f,v=!0;function g(S){return S.type!=="ordinal"&&S.type!=="time"}if(R(i,function(S,C){ve(S)&&(i[C]=S={name:S}),g(S)||(v=!1)}),R(i,function(S,C){l&&!S.isExtraCoord&&(!n&&!u&&S.ordinalMeta&&(u=S),!c&&g(S)&&(!v||S.coordDim!=="x"&&S.coordDim!=="angle")&&(!a||a===S.coordDim)&&(c=S))}),c&&!n&&!u&&(n=!0),c){h="__\0ecstackresult_"+e.id,f="__\0ecstackedover_"+e.id,u&&(u.createInvertedIndices=!0);var m=c.coordDim,y=c.type,x=0;R(i,function(S){S.coordDim===m&&x++});var _={name:h,coordDim:m,coordDimIndex:x,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},w={name:f,coordDim:f,coordDimIndex:x+1,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};o?(s&&(_.storeDimIndex=s.ensureCalculationDimension(f,y),w.storeDimIndex=s.ensureCalculationDimension(h,y)),o.appendCalculationDimension(_),o.appendCalculationDimension(w)):(i.push(_),i.push(w))}return{stackedDimension:c&&c.name,stackedByDimension:u&&u.name,isStackedByIndex:n,stackedOverDimension:f,stackResultDimension:h}}function _se(e){return!BU(e.schema)}function Zs(e,t){return!!t&&t===e.getCalculationInfo("stackedDimension")}function $L(e,t){return Zs(e,t)?e.getCalculationInfo("stackResultDimension"):t}function bse(e,t){var r=e.get("coordinateSystem"),n=yv.get(r),a;return t&&t.coordSysDims&&(a=oe(t.coordSysDims,function(i){var o={name:i},s=t.axisMap.get(i);if(s){var l=s.get("type");o.type=nb(l)}return o})),a||(a=n&&(n.getDimensionsInfo?n.getDimensionsInfo():n.dimensions.slice())||["x","y"]),a}function wse(e,t,r){var n,a;return r&&R(e,function(i,o){var s=i.coordDim,l=r.categoryAxisMap.get(s);l&&(n==null&&(n=o),i.ordinalMeta=l.getOrdinalMeta(),t&&(i.createInvertedIndices=!0)),i.otherDims.itemName!=null&&(a=!0)}),!a&&n!=null&&(e[n].otherDims.itemName=0),n}function Jo(e,t,r){r=r||{};var n=t.getSourceManager(),a,i=!1;e?(i=!0,a=kL(e)):(a=n.getSource(),i=a.sourceFormat===Ba);var o=yse(t),s=bse(t,o),l=r.useEncodeDefaulter,u=Le(l)?l:l?nt(TH,s,t):null,c={coordDimensions:s,generateCoord:r.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!i},h=wv(a,c),f=wse(h.dimensions,r.createInvertedIndices,o),v=i?null:n.getSharedDataStore(h),g=GU(t,{schema:h,store:v}),m=new Bn(h,t);m.setCalculationInfo(g);var y=f!=null&&Sse(a)?function(x,_,w,S){return S===f?w:this.defaultDimValueGetter(x,_,w,S)}:null;return m.hasItemOption=!1,m.initData(i?a:v,null,y),m}function Sse(e){if(e.sourceFormat===Ba){var t=Cse(e.data||[]);return!ae(ov(t))}}function Cse(e){for(var t=0;t=t[0]&&e<=t[1]},getExtent:function(){return this._extents[fa].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){NO(this._extents,fa,e,t)},setExtent2:function(e,t,r){var n=this._extents;n[e]||(n[e]=n[fa].slice()),NO(n,e,t,r)},freeze:function(){}};function NO(e,t,r,n){ah(r,n)&&(e[t][0]=r,e[t][1]=n)}function WU(e){return ib(e)||Bf(e)}function ib(e){return e.type==="interval"}function qm(e){return e.type==="time"}function Bf(e){return e.type==="log"}function Vn(e){return e.type==="ordinal"}function Lse(e){var t=M1(e),r=Dh(10,t),n=Fo(e/r);return n?n===2?n=3:n===3?n=5:n*=2:n=1,Mt(n*r,-t)}function ch(e){return _o(e)+2}function b0(e,t){return eh(e)/eh(t)}function yC(e,t,r){var n=r&&r.lookup;if(n){for(var a=0;a1&&i/o>2&&(a=Math.round(Math.ceil(a/o)*o)),a!==n[0]&&l(n[0],!0,!0);for(var s=a;s<=n[1];s+=o)l(s,!1,s===n[0]||s===n[1]);s-o!==n[1]&&l(n[1],!0,!0);function l(u,c,h){r({value:u,offInterval:c},h)}}var sm=function(e){X(t,e);function t(r){var n=e.call(this)||this;n.type="ordinal",n.parse=t.parse,YL(n,t.decoratedMethods);var a=r.ordinalMeta;a||(a=new am({})),ae(a)&&(a=new am({categories:oe(a,function(o){return Re(o)?o.value:o})})),n._ordinalMeta=a;var i=ZL(null,null,r.extent||[0,a.categories.length-1]);return n._mapper=i.mapper,XL(n),n}return t.parse=function(r){return r==null?r=NaN:ve(r)?(r=this._ordinalMeta.getOrdinal(r),r==null&&(r=NaN)):r=Fo(r),r},t.prototype.getTicks=function(){var r=[];return ZU(this,0,function(n){r.push(n)}),r},t.prototype.getMinorTicks=function(r){},t.prototype.setSortInfo=function(r){if(r==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var n=r.ordinalNumbers,a=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=Et(s,n.length);o=0&&r=0&&r=0&&ro[0]&&mo[1]||!isFinite(m)||!isFinite(o[1]))break}else{if(y>g)break;m=Et(m,o[1]),y===g&&(m=o[1])}if(h.push({value:m}),m=Mt(m+a,s),u){var x=u.calcNiceTickMultiple(m,v);x>=0&&(m=Mt(m+x*a,s))}if(h.length>0&&m===h[h.length-1].value)break;if(h.length>f)return[]}var _=h.length?h[h.length-1].value:o[1];return i[1]>_&&h.push({value:r.expandToNicedExtent?Mt(_+a,s):i[1]}),c&&l.pruneTicksByBreak(r.pruneByBreak,h,u.breaks,function(w){return w.value},n.interval,i),c&&r.breakTicks!=="none"&&l.addBreaksToTicks(h,u.breaks,i),h},t.prototype.getMinorTicks=function(r){return qL(this,r,U_(this),this._cfg.interval)},t.prototype.getLabel=function(r,n){if(r==null)return"";var a=n&&n.precision;a==null?a=_o(r.value)||0:a==="auto"&&(a=this._cfg.intervalPrecision);var i=Mt(r.value,a,!0);return _L(i)},t.type="interval",t}(qi);qi.registerClass(Jl);var Pse=function(e,t,r,n){for(;r>>1;e[a][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function jse(e){var t=30*ai;return e/=t,e>6?6:e>3?3:e>2?2:1}function Ese(e){return e/=dg,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function kO(e,t){return e/=t?fL:dL,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function Rse(e){return at(A1(e,!0),1)}function Ose(e,t,r){var n=Math.max(0,Ye(Ta,t)-1);return $_(new Date(e),Ta[n],r).getTime()}function zse(e,t){var r=new Date(0);r[e](1);var n=r.getTime();r[e](1+t);var a=r.getTime()-n;return function(i,o){return Math.max(0,Math.round((o-i)/a))}}function Bse(e,t,r,n,a,i){var o=3e3,s=tae,l=0;function u(V,U,F,W,$,Z,J){for(var re=zse($,V),Q=U,le=new Date(Q);Qo));)if(le[$](le[W]()+V),Q=le.getTime(),i){var de=i.calcNiceTickMultiple(Q,re);de>0&&(le[$](le[W]()+de*V),Q=le.getTime())}J.push({value:Q,notAdd:Q>n[1]})}function c(V,U,F){var W=[],$=!U.length;if(!XU(fg(V),n[0],n[1],r)){$&&(U=[{value:Ose(n[0],V,r)},{value:n[1]}]);for(var Z=0;Z=n[0]&&J<=n[1]&&u(Q,J,re,le,de,He,W),V==="year"&&F.length>1&&Z===0&&F.unshift({value:F[0].value-Q})}}for(var Z=0;Z=n[0]&&S<=n[1]&&v++)}var C=a/t;if(v>C*1.5&&g>C/1.5||(h.push(_),v>C||e===s[m]))break}f=[]}}}for(var M=It(oe(h,function(V){return It(V,function(U){return U.value>=n[0]&&U.value<=n[1]&&!U.notAdd})}),function(V){return V.length>0}),A=M.length-1,I=[],m=0;mn[0])&&I.unshift({value:n[0],time:{level:0,upperTimeUnit:B,lowerTimeUnit:B},notNice:!0}),(!j||j.values&&(i=s);var l=w0.length,u=Math.min(Pse(w0,i,0,l),l-1),c=w0[u][1],h=w0[Math.max(u-1,0)][0];e.setTimeInterval({approxInterval:i,interval:c,minLevelUnit:h})};qi.registerClass(YU);var S0=0,C0=1,Vse=2,qU=function(e){X(t,e);function t(r){var n=e.call(this)||this;n.type="log",n.parse=Jl.parse,n.base=r.logBase||10;var a=[],i=[],o=n._lookup={from:a,to:i};a[S0]=a[C0]=i[S0]=i[C0]=NaN,YL(n,t.mapperMethods);var s=Mr(),l=r.breakOption,u={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(l,n,{noNegative:!0},Vse,u),n.powStub=new Jl({breakParsed:u.original}),n.intervalStub=new Jl({breakParsed:u.transformed}),XL(n,n.intervalStub),n}return t.prototype.getTicks=function(r){var n=this.base,a=this.powStub,i=Mr(),o=this.intervalStub,s=o.getExtent(),l=a.getExtent(),u={lookup:{from:s,to:l}};return oe(o.getTicks(r||{}),function(c){var h=c.value,f=yC(h,n,u),v;if(i){var g=i.getTicksBreakOutwardTransform(this,c,U_(a),this._lookup);g&&(v=g.vBreak,f=g.tickVal)}return{value:f,break:v}},this)},t.prototype.getMinorTicks=function(r){return qL(this,r,U_(this.powStub),this.intervalStub.getConfig().interval)},t.prototype.getLabel=function(r,n){return this.intervalStub.getLabel(r,n)},t.type="log",t.mapperMethods={needTransform:function(){return!0},normalize:function(r){return this.intervalStub.normalize(b0(r,this.base))},scale:function(r){return yC(this.intervalStub.scale(r),this.base,null)},transformIn:function(r,n){return r=b0(r,this.base),n&&n.depth===Ps?r:this.intervalStub.transformIn(r,n)},transformOut:function(r,n){var a=n?n.depth:null;return LO.depth=a,IO.lookup=this._lookup,yC(a===Ps?r:this.intervalStub.transformOut(r,LO),this.base,IO)},contain:function(r){return this.powStub.contain(r)},setExtent:function(r,n){this.setExtent2(fa,r,n)},setExtent2:function(r,n,a){if(!(!ah(n,a)||n<=0||a<=0)){var i=PO,o=PO;if(r===fa){var s=this._lookup;i=s.to,o=s.from}this.powStub.setExtent2(r,i[S0]=n,i[C0]=a);var l=this.base;this.intervalStub.setExtent2(r,o[S0]=b0(n,l),o[C0]=b0(a,l))}},getFilter:function(){return{g:0}},sanitize:function(r,n){return ah(n[0],n[1])&&mi(r)&&r<=0&&(r=n[0]),r},getDefaultStartValue:function(){return 1},getExtent:function(){return this.powStub.getExtent()},getExtentUnsafe:function(r,n){return n===null?this.powStub.getExtentUnsafe(r,null):this.intervalStub.getExtentUnsafe(r,n)}},t}(qi);qi.registerClass(qU);var LO={},IO={},PO=[],KU={value:1,category:1,time:1,log:1},JU=Qe();function Km(e){var t=e.get("type");return(t==null||!Se(KU,t)&&!qi.getClass(t))&&(t="value"),t}function Sv(e,t,r){var n=Mr(),a;switch(n&&(a=QU(e,t,r)),t){case"category":return new sm({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:gn()});case"time":return new YU({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC"),breakOption:a});case"log":return new qU({logBase:e.get("logBase"),breakOption:a});case"value":return new Jl({breakOption:a});default:return new(qi.getClass(t)||Jl)({})}}function Gse(e,t,r){var n=e.getExtentUnsafe(fa,null),a=n[0],i=n[1];return ah(a,i)?a===t||i===t?Use:at?Hse:uA:uA}var Hse=1,Use=2,uA=3;function Wse(e){JU(e).noOnMyZero=!0}function $se(e){return JU(e).noOnMyZero}function Jm(e){var t=e.getLabelModel().get("formatter");if(e.type==="time"){var r=rae(t);return function(a,i){return e.scale.getFormattedLabel(a,i,r)}}else{if(ve(t))return function(a){var i=e.scale.getLabel(a),o=t.replace("{value}",i??"");return o};if(Le(t)){if(e.type==="category")return function(a,i){return t(ob(e,a),a.value-e.scale.getExtent()[0],null)};var n=Mr();return function(a,i){var o=null;return n&&(o=n.makeAxisLabelFormatterParamBreak(o,a.break)),t(ob(e,a),i,o)}}else return function(a){return e.scale.getLabel(a)}}}function ob(e,t){var r=e.scale;return Vn(r)?r.getLabel(t):t.value}function KL(e){var t=e.get("interval");return t??"auto"}function Zse(e){return e.type==="category"&&KL(e.getLabelModel())===0}function Yse(e,t){var r={};return R(e.mapDimensionsAll(t),function(n){r[$L(e,n)]=!0}),gt(r)}function Ff(e){return e==="middle"||e==="center"}function lm(e){return e.getShallow("show")}function QU(e,t,r){var n=e.get("breaks",!0);if(n!=null)return!Mr()||!r||!Xse(t)?void 0:n}function Xse(e){return e!=="category"}function eW(e,t,r,n,a,i){var o=Bf(e),s=o?e.intervalStub:e;if(s.setExtent(n[0],n[1]),o){var l=e.powStub,u={depth:Ps},c=e.transformOut(n[0],u),h=e.transformOut(n[1],u),f=Ise(r,n);t[0]&&!f[0]&&(c=a[0]),t[1]&&!f[1]&&(h=a[1]),l.setExtent(c,h)}s.setConfig(i)}function Cv(e,t){return Vn(e)?e.getRawOrdinalNumber(t.value):t.value}function Qm(e,t){return Vn(e)&&!!t.get("boundaryGap")}var Tv=function(){function e(){}return e.prototype.needIncludeZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),qse=lv(),sb="|&",Mv=Qe(),tW=-2,Kse=-1,Jse=Qe();function JL(e,t){var r=e.model,n=Mv(_v(r.ecModel)).keyed,a=n&&n.get(t);return a&&a.get(r.uid)}function Qse(e,t){return nW(JL(e,t))}function ele(e,t){var r=[];return rW(e.model.ecModel,function(n){for(var a=0;a0&&h[1]>0&&!f[0]&&(h[0]=0),h[0]<0&&h[1]<0&&!f[1]&&(h[1]=0));var S=!1;h[0]>h[1]&&(h.reverse(),S=!0);var C=up(t,r.get("startValue",!0)),M=C!=null;!mi(C)&&a&&(C=t.getDefaultStartValue?t.getDefaultStartValue():0),mi(C)&&(M||!_||w)&&(Ch[1]&&!f[1]&&(h[1]=C,f[1]=!0));var A=this._i={scale:t,dataMM:c,noZoomEffMM:h,zoomMM:[],fixMM:f,zoomFixMM:[!1,!1],startValue:C,isBlank:x,incl0:w,tggAxInv:S,ctnShp:i};DO(A,h)}return e.prototype.makeNoZoom=function(){return this._i.noZoomEffMM.slice()},e.prototype.makeFinal=function(){var t=this._i,r=t.zoomMM,n=t.noZoomEffMM,a=t.zoomFixMM,i=t.fixMM,o={fixMM:i,zoomFixMM:a,isBlank:t.isBlank,incl0:t.incl0,tggAxInv:t.tggAxInv,ctnShp:t.ctnShp,effMM:n.slice()},s=o.effMM;return r[0]!=null&&(s[0]=r[0],i[0]=a[0]=!0),r[1]!=null&&(s[1]=r[1],i[1]=a[1]=!0),DO(t,s),o},e.prototype.makeRenderInfo=function(){return{startValue:this._i.startValue}},e.prototype.setZoomMM=function(t,r){this._i.zoomMM[t]=r},e}();function DO(e,t){var r=e.scale,n=e.dataMM;r.sanitize&&(t[0]=r.sanitize(t[0],n),t[1]=r.sanitize(t[1],n),jx(t))}function up(e,t){return t==null?null:yn(t)?NaN:e.parse(t)}function lle(e,t){var r;if(Vn(e))r=[0,0];else{var n=t.get("boundaryGap");typeof n=="boolean"&&(n=null),r=ae(n)?n:[n,n]}return[jO(r[0]),jO(r[1])]}function jO(e){return Bo(typeof e=="boolean"?0:e,1)||0}function sW(e){var t=ile(e.scale);return t.extent||(t.extent=gn()),t}function ule(e,t){sW(e).dimIdxInCoord=t.get(e.dim)}function fh(e,t){var r=e.scale,n=e.model,a=e.dim;r.rawExtentInfo||cle(r,e,a,n,t)}function cle(e,t,r,n,a){var i=sW(t),o=i.extent,s=!1;tle(t,function(c){if(c.boxCoordinateSystem){var h=dH(c).coord,f=i.dimIdxInCoord;if(f>=0){if(ae(h)){var v=h[f];v!=null&&!ae(v)&&NM(o,e.parse(v))}}}else if(c.coordinateSystem){var g=c.getData();if(g){var m=e.getFilter?e.getFilter():null;R(Yse(g,r),function(y){Vte(o,g.getApproximateExtent(y,m))})}c.__requireStartValue&&c.__requireStartValue(t)&&(s=!0)}});var l=dle(e,t,n),u=new oW(e,n,o,s,l);lW(e,u,a),i.extent=null}function hle(e,t){var r=e.scale;lW(r,new oW(r,e.model,t,!1,!1),sle)}function lW(e,t,r){e.rawExtentInfo=t,t.from=r}function K1(e,t){tI.set(e,t)}var tI=we();function uW(e,t,r,n,a){e.rawExtentInfo||hle({scale:e,model:t},a||gn());var i=e.rawExtentInfo.makeFinal(),o=i.effMM;return e.setExtent(o[0],o[1]),e.setBlank(i.isBlank),n&&i.tggAxInv&&r&&!r.get("legacyMinMaxDontInverseAxis")&&(n.inverse=!n.inverse),i}function dle(e,t,r){var n=Qm(e,r),a=r.get("containShape",!0);if(a==null&&!n&&(a=!0),!a)return!1;var i=!1;return aW(t,function(o){i=!!tI.get(o)||i}),i}function fle(e,t,r,n){if(r.ctnShp){var a;if(aW(e,function(s){var l=tI.get(s);if(l){var u=l(e,n);u&&(a=a||[0,0],JG(a,u[0]),QG(a,u[1]),Wse(e))}}),!!a){var i=t.getExtent();if(Vn(t))e.onBand||t.setExtent2(im,Et(i[0],i[0]+a[0]),at(i[1],i[1]+a[1]));else{var o=i.slice();r.zoomFixMM[0]||(o[0]=Et(o[0],t.transformOut(t.transformIn(o[0],null)+a[0],null))),r.zoomFixMM[1]||(o[1]=at(o[1],t.transformOut(t.transformIn(o[1],null)+a[1],null))),(o[0]i[1])&&t.setExtent2(im,o[0],o[1])}}}}function EO(e,t){var r=Bf(e),n=r?e.intervalStub:e,a=t.fixMinMax||[],i=r?e.getExtent():null,o=n.getExtent(),s=$U(o,a,t.rawExtentResult);n.setExtent(s[0],s[1]),s=n.getExtent();var l=r?ple(n,t):vle(n,t),u=l.intervalPrecision,c=l.interval,h=t.userInterval;h!=null&&(l.interval=h,l.intervalPrecision=ch(h)),a[0]||(s[0]=Mt(gi(s[0]/c)*c,u)),a[1]||(s[1]=Mt(Ph(s[1]/c)*c,u)),h!=null&&(l.niceExtent=s.slice()),eW(e,a,o,s,i,l)}function vle(e,t){var r=X1(t.splitNumber,5),n=Y1(e),a=t.minInterval,i=t.maxInterval,o=A1(n/r,!0);a!=null&&oi&&(o=i);var s=ch(o),l=e.getExtent(),u=[Mt(Ph(l[0]/o)*o,s),Mt(gi(l[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:u}}function ple(e,t){var r=X1(t.splitNumber,10),n=e.getExtent(),a=Y1(e),i=at(zk(a),1),o=r/a*i;o<=.5&&(i*=10);var s=ch(i),l=[Mt(Ph(n[0]/i)*i,s),Mt(gi(n[1]/i)*i,s)];return{intervalPrecision:s,interval:i,niceExtent:l}}function Gf(e){var t=e.scale,r=e.model,n=r.axis,a=r.ecModel;cW(t,r,n,a,null)}function cW(e,t,r,n,a){var i=uW(e,t,n,r,a),o=ib(e)||qm(e);hW(e,{splitNumber:t.get("splitNumber"),fixMinMax:i.fixMM,userInterval:t.get("interval"),minInterval:o?t.get("minInterval"):null,maxInterval:o?t.get("maxInterval"):null,rawExtentResult:i}),r&&n&&fle(r,e,i,n)}function hW(e,t){gle[e.type](e,t)}var gle={interval:EO,log:EO,time:Fse,ordinal:hr};function mle(e){return Jo(null,e)}var yle={isDimensionStacked:Zs,enableDataStack:GU,getStackedDimension:$L};function xle(e,t){var r=t;t instanceof vt||(r=new vt(t));var n=Km(r),a=Sv(r,n,!1);return e[1]a&&(n=o,a=l)}if(n)return Tle(n.exterior);var u=this.getBoundingRect();return[u.x+u.width/2,u.y+u.height/2]},t.prototype.getBoundingRect=function(r){var n=this._rect;if(n&&!r)return n;var a=[1/0,1/0],i=[-1/0,-1/0],o=this.geometries;return R(o,function(s){s.type==="polygon"?OO(s.exterior,a,i,r):R(s.points,function(l){OO(l,a,i,r)})}),isFinite(a[0])&&isFinite(a[1])&&isFinite(i[0])&&isFinite(i[1])||(a[0]=a[1]=i[0]=i[1]=0),n=new je(a[0],a[1],i[0]-a[0],i[1]-a[1]),r||(this._rect=n),n},t.prototype.contain=function(r){var n=this.getBoundingRect(),a=this.geometries;if(!n.contain(r[0],r[1]))return!1;e:for(var i=0,o=a.length;i>1^-(s&1),l=l>>1^-(l&1),s+=a,l+=i,a=s,i=l,n.push([s/r,l/r])}return n}function dA(e,t){return e=Ale(e),oe(It(e.features,function(r){return r.geometry&&r.properties&&r.geometry.coordinates.length>0}),function(r){var n=r.properties,a=r.geometry,i=[];switch(a.type){case"Polygon":var o=a.coordinates;i.push(new zO(o[0],o.slice(1)));break;case"MultiPolygon":R(a.coordinates,function(l){l[0]&&i.push(new zO(l[0],l.slice(1)))});break;case"LineString":i.push(new BO([a.coordinates]));break;case"MultiLineString":i.push(new BO(a.coordinates))}var s=new fW(n[t||"name"],i,n.cp);return s.properties=n,s})}const Nle=Object.freeze(Object.defineProperty({__proto__:null,MAX_SAFE_INTEGER:Yg,asc:on,getPercentWithPrecision:bte,getPixelPrecision:_te,getPrecision:_o,getPrecisionSafe:VG,isNumeric:Bk,isRadianAroundZero:th,linearMap:Nt,nice:A1,numericToNumber:Vo,parseDate:qo,parsePercent:me,quantile:Dx,quantity:zk,quantityExponent:M1,reformIntervals:MM,remRadian:Ok,round:xte},Symbol.toStringTag,{value:"Module"})),kle=Object.freeze(Object.defineProperty({__proto__:null,format:Zm,parse:qo,roundTime:$_},Symbol.toStringTag,{value:"Module"})),Lle=Object.freeze(Object.defineProperty({__proto__:null,Arc:Um,BezierCurve:dv,BoundingRect:je,Circle:Ko,CompoundPath:Wm,Ellipse:Hm,Group:De,Image:Qr,IncrementalDisplayable:O7,Line:Tr,LinearGradient:Eh,Polygon:Sn,Polyline:un,RadialGradient:eL,Rect:it,Ring:hv,Sector:wn,Text:wt,clipPointsByRect:aL,clipRectByRect:U7,createIcon:pv,extendPath:G7,extendShape:V7,getShapeClass:Jg,getTransform:Vc,initProps:Qt,makeImage:rL,makePath:Ef,mergePath:Aa,registerShape:wi,resizePath:nL,updateProps:At},Symbol.toStringTag,{value:"Module"})),Ile=Object.freeze(Object.defineProperty({__proto__:null,addCommas:_L,capitalFirst:cae,encodeHTML:Rn,formatTime:uae,formatTpl:wL,getTextRect:lae,getTooltipMarker:uH,normalizeCssArray:mv,toCamelCase:bL,truncateText:are},Symbol.toStringTag,{value:"Module"})),Ple=Object.freeze(Object.defineProperty({__proto__:null,bind:be,clone:ke,curry:nt,defaults:Ee,each:R,extend:te,filter:It,indexOf:Ye,inherits:Nk,isArray:ae,isFunction:Le,isObject:Re,isString:ve,map:oe,merge:Je,reduce:pi},Symbol.toStringTag,{value:"Module"}));var Dle=Qe(),pg=Qe(),Ui={estimate:1,determine:2};function lb(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function jle(e,t){var r=e.getLabelModel().get("customValues");if(r){var n=e.scale;return{labels:oe(pW(r,n),function(a,i){return{formattedLabel:Jm(e)(a,i),rawLabel:n.getLabel(a),tick:a}})}}return e.type==="category"?Rle(e,t):zle(e)}function Ele(e,t,r){var n=e.scale,a=e.getTickModel().get("customValues");return a?{ticks:pW(a,n)}:e.type==="category"?Ole(e,t):{ticks:n.getTicks(r)}}function pW(e,t){var r=t.getExtent(),n=[];return R(e,function(a){a=t.parse(a),a>=r[0]&&a<=r[1]&&n.push(a)}),N1(n,Wte,null),on(n),oe(n,function(a){return{value:a}})}function Rle(e,t){var r=e.getLabelModel(),n=gW(e,r,t);return!r.get("show")||e.scale.isBlank()?{labels:[]}:n}function gW(e,t,r){var n=Fle(e),a=KL(t),i=r.kind===Ui.estimate;if(!i){var o=yW(n,a);if(o)return o}var s,l;Le(a)?s=ub(e,a,!1):(l=a==="auto"?Vle(e,r):a,s=ub(e,l,!1));var u={labels:s,labelCategoryInterval:l};return i?r.out.noPxChangeTryDetermine.push(function(){return fA(n,a,u),!0}):fA(n,a,u),u}function Ole(e,t){var r=Ble(e),n=KL(t),a=yW(r,n);if(a)return a;var i,o;if((!t.get("show")||e.scale.isBlank())&&(i=[]),Le(n))i=ub(e,n,!0);else if(n==="auto"){var s=gW(e,e.getLabelModel(),lb(Ui.determine));o=s.labelCategoryInterval,i=oe(s.labels,function(l){return l.tick})}else o=n,i=ub(e,o,!0);return fA(r,n,{ticks:i,tickCategoryInterval:o})}function zle(e){var t=e.scale.getTicks(),r=Jm(e);return{labels:oe(t,function(n,a){return{formattedLabel:r(n,a),rawLabel:e.scale.getLabel(n),tick:n}})}}var Ble=mW("axisTick"),Fle=mW("axisLabel");function mW(e){return function(r){return pg(r)[e]||(pg(r)[e]={list:[]})}}function yW(e,t){for(var r=0;rc&&(u=Math.max(1,Math.floor(l/c)));for(var h=s[0],f=e.dataToCoord(h+1)-e.dataToCoord(h),v=Math.abs(f*Math.cos(i)),g=Math.abs(f*Math.sin(i)),m=0,y=0;h<=s[1];h+=u){var x=0,_=0,w=S1(a({value:h}),n.font,"center","top");x=w.width*1.3,_=w.height*1.3,m=Math.max(m,x,7),y=Math.max(y,_,7)}var S=m/v,C=y/g;isNaN(S)&&(S=1/0),isNaN(C)&&(C=1/0);var M=Math.max(0,Math.floor(Math.min(S,C)));if(r===Ui.estimate)return t.out.noPxChangeTryDetermine.push(be(Hle,null,e,M,l)),M;var A=xW(e,M,l);return A??M}function Hle(e,t,r){return xW(e,t,r)==null}function xW(e,t,r){var n=Dle(e.model),a=e.getExtent(),i=n.lastAutoInterval,o=n.lastTickCount;if(i!=null&&o!=null&&Math.abs(i-t)<=1&&Math.abs(o-r)<=1&&i>t&&n.axisExtent0===a[0]&&n.axisExtent1===a[1])return i;n.lastTickCount=r,n.lastAutoInterval=t,n.axisExtent0=a[0],n.axisExtent1=a[1]}function Ule(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get("rotate")||0,font:t.getFont()}}function ub(e,t,r){var n=Jm(e),a=e.scale,i=[],o=Le(t);return ZU(a,o?0:t,function(s,l){var u=a.getLabel(s);if(o){var c=!!t(s.value,u);if(s.offInterval=!c,!c&&!l)return}i.push(r?s:{formattedLabel:n(s),rawLabel:u,tick:s})}),i}var Wle=.8;function Cn(e,t){t=t||{};var r={w:NaN,w2:NaN},n=e.scale,a=t.fromStat,i=t.min,o=Nse(n);mi(o)||(o=NaN);var s=e.getExtent(),l=cr(s[1]-s[0]);return Vn(n)?$le(r,e,o,l):a&&Zle(r,e,o,l,a),i!=null&&(r.w=mi(r.w)?at(i,r.w):i),r}function $le(e,t,r,n){var a=t.onBand,i=r+(a?1:0);i===0&&(i=1),e.w=n/i,!a&&r&&n&&(e.w2=e.w*r/n)}function Zle(e,t,r,n,a){var i=!1,o=-1/0;R(a.key?[Qse(t,a.key)]:ele(t,a.sers||[]),function(s){var l=s.liPosMinGap;l!=null&&(l>0?(l>o&&(o=l),i=!1):l===tW&&(i=!0))}),mi(r)&&r>0&&mi(o)?(e.w=n/r*o,e.w2=o):i&&(e.w=n*Wle,e.w2=e.w*r/n)}var FO=[0,1],Si=function(){function e(t,r,n){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=r,this._extent=n||[0,0]}return e.prototype.contain=function(t){var r=this._extent,n=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return t>=n&&t<=a},e.prototype.containData=function(t){return this.scale.contain(this.scale.parse(t))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(t,r){var n=this._extent;n[0]=t,n[1]=r},e.prototype.dataToCoord=function(t,r){var n=this.scale;return t=n.normalize(n.parse(t)),Nt(t,FO,VO(this),r)},e.prototype.coordToData=function(t,r){var n=Nt(t,VO(this),FO,r);return this.scale.scale(n)},e.prototype.pointToData=function(t,r){},e.prototype.getTicksCoords=function(t){t=t||{};var r=t.tickModel||this.getTickModel(),n=Ele(this,r,{breakTicks:t.breakTicks,pruneByBreak:t.pruneByBreak}),a=oe(n.ticks,function(s){return{coord:this.dataToCoord(Cv(this.scale,s)),tick:s}},this),i=r.get("alignWithLabel"),o=Yle(this,a,i);return oe(a,function(s){return{coord:s.coord,tickValue:s.tick.value,onBand:o}})},e.prototype.getMinorTicksCoords=function(){if(Vn(this.scale))return[];var t=this.model.getModel("minorTick"),r=t.get("splitNumber");r>0&&r<100||(r=5);var n=this.scale.getMinorTicks(r),a=oe(n,function(i){return oe(i,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return a},e.prototype.getViewLabels=function(t){return t=t||lb(Ui.determine),jle(this,t).labels},e.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},e.prototype.getTickModel=function(){return this.model.getModel("axisTick")},e.prototype.getBandWidth=function(){return Cn(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(t){return t=t||lb(Ui.determine),Gle(this,t)},e}();function VO(e){var t=e.getExtent();if(e.onBand){var r=t[1]-t[0],n=r/e.scale.count()/2;t[0]+=n,t[1]-=n}return t}function Yle(e,t,r){var n=t.length;if(!e.onBand||r||!n)return!1;var a=Cn(e).w;if(!a)return!1;R(t,function(s){s.coord-=a/2});var i=e.scale.getExtent(),o=t[n-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+a,tick:{value:i[1]+1}}),!0}function Xle(e){var t=ht.extend(e);return ht.registerClass(t),t}function qle(e){var t=Yt.extend(e);return Yt.registerClass(t),t}function Kle(e){var t=Ut.extend(e);return Ut.registerClass(t),t}function Jle(e){var t=Rt.extend(e);return Rt.registerClass(t),t}var cp=Math.PI*2,oc=Go.CMD,Qle=["top","right","bottom","left"];function eue(e,t,r,n,a){var i=r.width,o=r.height;switch(e){case"top":n.set(r.x+i/2,r.y-t),a.set(0,-1);break;case"bottom":n.set(r.x+i/2,r.y+o+t),a.set(0,1);break;case"left":n.set(r.x-t,r.y+o/2),a.set(-1,0);break;case"right":n.set(r.x+i+t,r.y+o/2),a.set(1,0);break}}function tue(e,t,r,n,a,i,o,s,l){o-=e,s-=t;var u=Math.sqrt(o*o+s*s);o/=u,s/=u;var c=o*r+e,h=s*r+t;if(Math.abs(n-a)%cp<1e-4)return l[0]=c,l[1]=h,u-r;if(i){var f=n;n=La(a),a=La(f)}else n=La(n),a=La(a);n>a&&(a+=cp);var v=Math.atan2(s,o);if(v<0&&(v+=cp),v>=n&&v<=a||v+cp>=n&&v+cp<=a)return l[0]=c,l[1]=h,u-r;var g=r*Math.cos(n)+e,m=r*Math.sin(n)+t,y=r*Math.cos(a)+e,x=r*Math.sin(a)+t,_=(g-o)*(g-o)+(m-s)*(m-s),w=(y-o)*(y-o)+(x-s)*(x-s);return _0){t=t/180*Math.PI,Ei.fromArray(e[0]),Kt.fromArray(e[1]),Cr.fromArray(e[2]),Oe.sub(wo,Ei,Kt),Oe.sub(xo,Cr,Kt);var r=wo.len(),n=xo.len();if(!(r<.001||n<.001)){wo.scale(1/r),xo.scale(1/n);var a=wo.dot(xo),i=Math.cos(t);if(i1&&Oe.copy(Xn,Cr),Xn.toArray(e[1])}}}}function aue(e,t,r){if(r<=180&&r>0){r=r/180*Math.PI,Ei.fromArray(e[0]),Kt.fromArray(e[1]),Cr.fromArray(e[2]),Oe.sub(wo,Kt,Ei),Oe.sub(xo,Cr,Kt);var n=wo.len(),a=xo.len();if(!(n<.001||a<.001)){wo.scale(1/n),xo.scale(1/a);var i=wo.dot(t),o=Math.cos(r);if(i=l)Oe.copy(Xn,Cr);else{Xn.scaleAndAdd(xo,s/Math.tan(Math.PI/2-c));var h=Cr.x!==Kt.x?(Xn.x-Kt.x)/(Cr.x-Kt.x):(Xn.y-Kt.y)/(Cr.y-Kt.y);if(isNaN(h))return;h<0?Oe.copy(Xn,Kt):h>1&&Oe.copy(Xn,Cr)}Xn.toArray(e[1])}}}}function bC(e,t,r,n){var a=r==="normal",i=a?e:e.ensureState(r);i.ignore=t;var o=n.get("smooth");o=o===!0?.3:Math.max(+o,0)||0,i.shape=i.shape||{},i.shape.smooth=o;var s=n.getModel("lineStyle").getLineStyle();a?e.useStyle(s):i.style=s}function iue(e,t){var r=t.smooth,n=t.points;if(n)if(e.moveTo(n[0][0],n[0][1]),r>0&&n.length>=3){var a=Ss(n[0],n[1]),i=Ss(n[1],n[2]);if(!a||!i){e.lineTo(n[1][0],n[1][1]),e.lineTo(n[2][0],n[2][1]);return}var o=Math.min(a,i)*r,s=ig([],n[1],n[0],o/a),l=ig([],n[1],n[2],o/i),u=ig([],s,l,.5);e.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),e.bezierCurveTo(l[0],l[1],l[0],l[1],n[2][0],n[2][1])}else for(var c=1;c0){S(P*k,0,i);var D=P+A;D<0&&C(-D*k,1)}else C(-A*k,1)}}function S(A,I,k){A!==0&&(c=!0);for(var P=I;P0)for(var D=0;D0;D--){var H=k[D-1]*B;S(-H,D,i)}}}function M(A){var I=A<0?-1:1;A=Math.abs(A);for(var k=Math.ceil(A/(i-1)),P=0;P0?S(k,0,P+1):S(-k,i-P-1,i),A-=k,A<=0)return}return c}function lue(e){for(var t=0;t=0&&n.attr(i.oldLayoutSelect),Ye(f,"emphasis")>=0&&n.attr(i.oldLayoutEmphasis)),At(n,u,r,l)}else if(n.attr(u),!gv(n).valueAnimation){var h=Te(n.style.opacity,1);n.style.opacity=0,Qt(n,{style:{opacity:h}},r,l)}if(i.oldLayout=u,n.states.select){var v=i.oldLayoutSelect={};T0(v,u,M0),T0(v,n.states.select,M0)}if(n.states.emphasis){var g=i.oldLayoutEmphasis={};T0(g,u,M0),T0(g,n.states.emphasis,M0)}q7(n,l,c,r,r)}if(a&&!a.ignore&&!a.invisible){var i=hue(a),o=i.oldLayout,m={points:a.shape.points};o?(a.attr({shape:o}),At(a,{shape:m},r)):(a.setShape(m),a.style.strokePercent=0,Qt(a,{style:{strokePercent:1}},r)),i.oldLayout=m}},e}(),CC=Qe();function fue(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){var a=CC(r).labelManager;a||(a=CC(r).labelManager=new due),a.clearLabels()}),e.registerUpdateLifecycle("series:layoutlabels",function(t,r,n){var a=CC(r).labelManager;R(n.updatedSeries,function(i){a.addLabelsOfSeries(r.getViewOfSeriesModel(i))}),a.updateLayoutConfig(r),a.layout(r),a.processLabelsOverall()})}var TC=Math.sin,MC=Math.cos,MW=Math.PI,sc=Math.PI*2,vue=180/MW,AW=function(){function e(){}return e.prototype.reset=function(t){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,t||4)},e.prototype.moveTo=function(t,r){this._add("M",t,r)},e.prototype.lineTo=function(t,r){this._add("L",t,r)},e.prototype.bezierCurveTo=function(t,r,n,a,i,o){this._add("C",t,r,n,a,i,o)},e.prototype.quadraticCurveTo=function(t,r,n,a){this._add("Q",t,r,n,a)},e.prototype.arc=function(t,r,n,a,i,o){this.ellipse(t,r,n,n,0,a,i,o)},e.prototype.ellipse=function(t,r,n,a,i,o,s,l){var u=s-o,c=!l,h=Math.abs(u),f=Dl(h-sc)||(c?u>=sc:-u>=sc),v=u>0?u%sc:u%sc+sc,g=!1;f?g=!0:Dl(h)?g=!1:g=v>=MW==!!c;var m=t+n*MC(o),y=r+a*TC(o);this._start&&this._add("M",m,y);var x=Math.round(i*vue);if(f){var _=1/this._p,w=(c?1:-1)*(sc-_);this._add("A",n,a,x,1,+c,t+n*MC(o+w),r+a*TC(o+w)),_>.01&&this._add("A",n,a,x,0,+c,m,y)}else{var S=t+n*MC(s),C=r+a*TC(s);this._add("A",n,a,x,+g,+c,S,C)}},e.prototype.rect=function(t,r,n,a){this._add("M",t,r),this._add("l",n,0),this._add("l",0,a),this._add("l",-n,0),this._add("Z")},e.prototype.closePath=function(){this._d.length>0&&this._add("Z")},e.prototype._add=function(t,r,n,a,i,o,s,l,u){for(var c=[],h=this._p,f=1;f"}function Sue(e){return""}function iI(e,t){t=t||{};var r=t.newline?` +`:"";function n(a){var i=a.children,o=a.tag,s=a.attrs,l=a.text;return wue(o,s)+(o!=="style"?Rn(l):l||"")+(i?""+r+oe(i,function(u){return n(u)}).join(r)+r:"")+Sue(o)}return n(e)}function Cue(e,t,r){r=r||{};var n=r.newline?` +`:"",a=" {"+n,i=n+"}",o=oe(gt(e),function(l){return l+a+oe(gt(e[l]),function(u){return u+":"+e[l][u]+";"}).join(n)+i}).join(n),s=oe(gt(t),function(l){return"@keyframes "+l+a+oe(gt(t[l]),function(u){return u+a+oe(gt(t[l][u]),function(c){var h=t[l][u][c];return c==="d"&&(h='path("'+h+'")'),c+":"+h+";"}).join(n)+i}).join(n)+i}).join(n);return!o&&!s?"":[""].join(n)}function yA(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function ZO(e,t,r,n){return Xr("svg","root",{width:e,height:t,xmlns:NW,"xmlns:xlink":kW,version:"1.1",baseProfile:"full",viewBox:n?"0 0 "+e+" "+t:!1},r)}var Tue=0;function IW(){return Tue++}var YO={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},gc="transform-origin";function Mue(e,t,r){var n=te({},e.shape);te(n,t),e.buildPath(r,n);var a=new AW;return a.reset(LG(e)),r.rebuildPath(a,1),a.generateStr(),a.getStr()}function Aue(e,t){var r=t.originX,n=t.originY;(r||n)&&(e[gc]=r+"px "+n+"px")}var Nue={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function PW(e,t){var r=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[r]=e,r}function kue(e,t,r){var n=e.shape.paths,a={},i,o;if(R(n,function(l){var u=yA(r.zrId);u.animation=!0,Q1(l,{},u,!0);var c=u.cssAnims,h=u.cssNodes,f=gt(c),v=f.length;if(v){o=f[v-1];var g=c[o];for(var m in g){var y=g[m];a[m]=a[m]||{d:""},a[m].d+=y.d||""}for(var x in h){var _=h[x].animation;_.indexOf(o)>=0&&(i=_)}}}),!!i){t.d=!1;var s=PW(a,r);return i.replace(o,s)}}function XO(e){return ve(e)?YO[e]?"cubic-bezier("+YO[e]+")":Pk(e)?e:"":""}function Q1(e,t,r,n){var a=e.animators,i=a.length,o=[];if(e instanceof Wm){var s=kue(e,t,r);if(s)o.push(s);else if(!i)return}else if(!i)return;for(var l={},u=0;u0}).length){var He=PW(A,r);return He+" "+_[0]+" both"}}for(var y in l){var s=m(l[y]);s&&o.push(s)}if(o.length){var x=r.zrId+"-cls-"+IW();r.cssNodes["."+x]={animation:o.join(",")},t.class=x}}function Lue(e,t,r){if(!e.ignore)if(e.isSilent()){var n={"pointer-events":"none"};qO(n,t,r)}else{var a=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},i=a.fill;if(!i){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,l=e.currentStates.indexOf("select")>=0&&s||o;l&&(i=I_(l))}var u=a.lineWidth;if(u){var c=!a.strokeNoScale&&e.transform?e.transform[0]:1;u=u/c}var n={cursor:"pointer"};i&&(n.fill=i),a.stroke&&(n.stroke=a.stroke),u&&(n["stroke-width"]=u),qO(n,t,r)}}function qO(e,t,r,n){var a=JSON.stringify(e),i=r.cssStyleCache[a];i||(i=r.zrId+"-cls-"+IW(),r.cssStyleCache[a]=i,r.cssNodes["."+i+":hover"]=e),t.class=t.class?t.class+" "+i:i}var um=Math.round;function DW(e){return e&&ve(e.src)}function jW(e){return e&&Le(e.toDataURL)}function oI(e,t,r,n){xue(function(a,i){var o=a==="fill"||a==="stroke";o&&kG(i)?RW(t,e,a,n):o&&jk(i)?OW(r,e,a,n):e[a]=i,o&&n.ssr&&i==="none"&&(e["pointer-events"]="visible")},t,r,!1),Oue(r,e,n)}function sI(e,t){var r=zG(t);r&&(r.each(function(n,a){n!=null&&(e[($O+a).toLowerCase()]=n+"")}),t.isSilent()&&(e[$O+"silent"]="true"))}function KO(e){return Dl(e[0]-1)&&Dl(e[1])&&Dl(e[2])&&Dl(e[3]-1)}function Iue(e){return Dl(e[4])&&Dl(e[5])}function lI(e,t,r){if(t&&!(Iue(t)&&KO(t))){var n=1e4;e.transform=KO(t)?"translate("+um(t[4]*n)/n+" "+um(t[5]*n)/n+")":Pee(t)}}function JO(e,t,r){for(var n=e.points,a=[],i=0;i"u"){var y="Image width/height must been given explictly in svg-ssr renderer.";bn(f,y),bn(v,y)}else if(f==null||v==null){var x=function(P,D){if(P){var z=P.elm,j=f||D.width,B=v||D.height;P.tag==="pattern"&&(u?(B=1,j/=i.width):c&&(j=1,B/=i.height)),P.attrs.width=j,P.attrs.height=B,z&&(z.setAttribute("width",j),z.setAttribute("height",B))}},_=Wk(g,null,e,function(P){l||x(M,P),x(h,P)});_&&_.width&&_.height&&(f=f||_.width,v=v||_.height)}h=Xr("image","img",{href:g,width:f,height:v}),o.width=f,o.height=v}else a.svgElement&&(h=ke(a.svgElement),o.width=a.svgWidth,o.height=a.svgHeight);if(h){var w,S;l?w=S=1:u?(S=1,w=o.width/i.width):c?(w=1,S=o.height/i.height):o.patternUnits="userSpaceOnUse",w!=null&&!isNaN(w)&&(o.width=w),S!=null&&!isNaN(S)&&(o.height=S);var C=IG(a);C&&(o.patternTransform=C);var M=Xr("pattern","",o,[h]),A=iI(M),I=n.patternCache,k=I[A];k||(k=n.zrId+"-p"+n.patternIdx++,I[A]=k,o.id=k,M=n.defs[k]=Xr("pattern",k,o,[h])),t[r]=w1(k)}}function zue(e,t,r){var n=r.clipPathCache,a=r.defs,i=n[e.id];if(!i){i=r.zrId+"-c"+r.clipPathIdx++;var o={id:i};n[e.id]=i,a[i]=Xr("clipPath",i,o,[EW(e,r)])}t["clip-path"]=w1(i)}function t5(e){return document.createTextNode(e)}function Sc(e,t,r){e.insertBefore(t,r)}function r5(e,t){e.removeChild(t)}function n5(e,t){e.appendChild(t)}function zW(e){return e.parentNode}function BW(e){return e.nextSibling}function AC(e,t){e.textContent=t}var a5=58,Bue=120,Fue=Xr("","");function xA(e){return e===void 0}function go(e){return e!==void 0}function Vue(e,t,r){for(var n={},a=t;a<=r;++a){var i=e[a].key;i!==void 0&&(n[i]=a)}return n}function Vp(e,t){var r=e.key===t.key,n=e.tag===t.tag;return n&&r}function cm(e){var t,r=e.children,n=e.tag;if(go(n)){var a=e.elm=LW(n);if(uI(Fue,e),ae(r))for(t=0;ti?(g=r[l+1]==null?null:r[l+1].elm,FW(e,g,r,a,l)):vb(e,t,n,i))}function jd(e,t){var r=t.elm=e.elm,n=e.children,a=t.children;e!==t&&(uI(e,t),xA(t.text)?go(n)&&go(a)?n!==a&&Gue(r,n,a):go(a)?(go(e.text)&&AC(r,""),FW(r,null,a,0,a.length-1)):go(n)?vb(r,n,0,n.length-1):go(e.text)&&AC(r,""):e.text!==t.text&&(go(n)&&vb(r,n,0,n.length-1),AC(r,t.text)))}function Hue(e,t){if(Vp(e,t))jd(e,t);else{var r=e.elm,n=zW(r);cm(t),n!==null&&(Sc(n,t.elm,BW(r)),vb(n,[e],0,0))}return t}var Uue=0,Wue=function(){function e(t,r,n){if(this.type="svg",this.configLayer=$ue(),this.storage=r,this._opts=n=te({},n),this.root=t,this._id="zr"+Uue++,this._oldVNode=ZO(n.width,n.height),t&&!n.ssr){var a=this._viewport=document.createElement("div");a.style.cssText="position:relative;overflow:hidden";var i=this._svgDom=this._oldVNode.elm=LW("svg");uI(null,this._oldVNode),a.appendChild(i),t.appendChild(a)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",Hue(this._oldVNode,t),this._oldVNode=t}},e.prototype.renderOneToVNode=function(t){return e5(t,yA(this._id))},e.prototype.renderToVNode=function(t){t=t||{};var r=this.storage.getDisplayList(!0),n=this._width,a=this._height,i=yA(this._id);i.animation=t.animation,i.willUpdate=t.willUpdate,i.compress=t.compress,i.emphasis=t.emphasis,i.ssr=this._opts.ssr;var o=[],s=this._bgVNode=Zue(n,a,this._backgroundColor,i);s&&o.push(s);var l=t.compress?null:this._mainVNode=Xr("g","main",{},[]);this._paintList(r,i,l?l.children:o),l&&o.push(l);var u=oe(gt(i.defs),function(f){return i.defs[f]});if(u.length&&o.push(Xr("defs","defs",{},u)),t.animation){var c=Cue(i.cssNodes,i.cssAnims,{newline:!0});if(c){var h=Xr("style","stl",{},[],c);o.push(h)}}return ZO(n,a,o,t.useViewBox)},e.prototype.renderToString=function(t){return t=t||{},iI(this.renderToVNode({animation:Te(t.cssAnimation,!0),emphasis:Te(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Te(t.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(t){this._backgroundColor=t},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(t,r,n){for(var a=t.length,i=[],o=0,s,l,u=0,c=0;c=0&&!(f&&l&&f[m]===l[m]);m--);for(var y=g-1;y>m;y--)o--,s=i[o-1];for(var x=m+1;x=s)}}for(var h=o5(this),f=h.startIdx;f=0)&&(o=!0)}),!(!o&&!i.__dirty)){var s=n._opts.useDirtyRect&&!NC(i)?i.createRepaintRects(t,r,n._width,n._height):null,l=n._i.layerStack[0],u=!0;if(i.__dirty){u=!1,i.__dirty=!1;var c=i.zlevel===l.zl&&i.zlevel2===l.zl2?n._backgroundColor:null;i.clear(!1,c,s)}A0(i,function(h){var f=n._paintPerCursor(i,h,t,s,u);a=a&&f})}},N0),xt.wxa&&In(this._i,function(i){i&&i.ctx&&i.ctx.draw&&i.ctx.draw()}),a},e.prototype._paintPerCursor=function(t,r,n,a,i){var o=t.ctx;if(a)if(!a.length)r.drawIdx=r.endIdx;else for(var s=this.dpr,l=0;l=r.endIdx},e.prototype._paintPerCursorInRect=function(t,r,n,a,i){for(var o={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},s=t.ctx,l=NC(t),u=l&&qr.getTime(),c=r.drawIdx,h=r.notClearIdx,f=h>=0?Math.min(h,c):c;f15){f++;break}}}}yf(s,o),r.drawIdx=Math.max(f,c)},e.prototype.getLayer=function(t,r){return this._ensureLayer(t,0,r)},e.prototype._ensureLayer=function(t,r,n){r=r||0;var a=this._singleCanvas;a&&!this._needsManuallyCompositing&&(t=lc,r=0);var i=IC(this._i,t)[r];return i||(i=l5("zr_"+t+"."+r,this,t,r),this._layerConfig[t]&&Je(i,this._layerConfig[t],!0),(n||a&&t!==lc)&&(i.virtual=!0),this._insertLayer(i,t,r,!1),i.initContext()),i},e.prototype.insertLayer=function(t,r){this._insertLayer(r,t,0,!1)},e.prototype._insertLayer=function(t,r,n,a){var i=this._i,o=i.layers,s=i.layerStack,l=this._domRoot,u=null;if(!(o[r]&&o[r][n])&&que(t)){for(var c=s.length,h=0;h0&&(u=IC(i,s[h-1].zl)[s[h-1].zl2]),s.splice(h,0,{zl:r,zl2:n}),IC(i,r)[n]=t,!a&&!t.virtual)if(u){var f=u.dom;f.nextSibling?l.insertBefore(t.dom,f.nextSibling):l.appendChild(t.dom)}else l.firstChild?l.insertBefore(t.dom,l.firstChild):l.appendChild(t.dom);t.painter||(t.painter=this)}},e.prototype.eachLayer=function(t,r){return In(this._i,function(n,a){t.call(r,n,a)})},e.prototype.eachBuiltinLayer=function(t,r){return In(this._i,function(n,a){t.call(r,n,a)},gg)},e.prototype.eachOtherLayer=function(t,r){return In(this._i,function(n,a){t.call(r,n,a)},_A)},e.prototype.getLayers=function(){var t={};return In(this._i,function(r,n,a){t[r.id]=r}),t},e.prototype._updateLayerStatus=function(t,r){var n=this;if(n._singleCanvas)for(var a=1;a=0;w--){var S=_.get(x[w]);if(!S.used)y.__dirty=!0,_.removeKey(x[w]),x.splice(w,1);else{var C=S.endIdxNew;(NC(y)?C=0;a--){var i=r[a];if(i.zl===t){var o=n[t][i.zl2];if(o.__builtin__)continue;if(r.splice(a,1),n[t][i.zl2]=void 0,!o.virtual){var s=o.dom.parentNode;s&&s.removeChild(o.dom)}}}},e.prototype.resize=function(t,r){if(this._domRoot.style){var n=this._domRoot;n.style.display="none";var a=this._opts,i=this.root;t!=null&&(a.width=t),r!=null&&(a.height=r),t=Qd(i,0,a),r=Qd(i,1,a),n.style.display="",(this._width!==t||r!==this._height)&&(n.style.width=t+"px",n.style.height=r+"px",In(this._i,function(o){o.resize(t,r)}),this.refresh({paintAll:!0})),this._width=t,this._height=r}else{if(t==null||r==null)return;this._width=t,this._height=r,this._ensureLayer(lc).resize(t,r)}return this},e.prototype.clearLayer=function(t){R(this._i.layers[t],function(r){r&&!r.__builtin__&&r.clear()})},e.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(t){if(t=t||{},this._singleCanvas&&!this._compositeManually)return this._i.layers[lc][0].dom;var r=new VW("image",this,t.pixelRatio||this.dpr);r.initContext(),r.clear(!1,t.backgroundColor||this._backgroundColor);var n=r.ctx;if(t.pixelRatio<=this.dpr){this.refresh();var a=r.dom.width,i=r.dom.height;In(this._i,function(h){h.__builtin__?n.drawImage(h.dom,0,0,a,i):h.renderToCanvas&&(n.save(),h.renderToCanvas(n),n.restore())})}else{for(var o={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},s=this.storage.getDisplayList(!0),l=0,u=s.length;l-1&&(u.style.stroke=u.style.fill,u.style.fill=K.color.neutral00,u.style.lineWidth=2),n},t.type="series.line",t.dependencies=["grid","polar"],t.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1,triggerEvent:!1},t}(Ut);function Hf(e,t){var r=e.mapDimensionsAll("defaultedLabel"),n=r.length;if(n===1){var a=Of(e,t,r[0]);return a!=null?a+"":null}else if(n){for(var i=[],o=0;o=0&&n.push(t[i])}return n.join(" ")}var ey=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this)||this;return o.updateData(r,n,a,i),o}return t.prototype._createSymbol=function(r,n,a,i,o,s){this.removeAll();var l=Ar(r,-1,-1,2,2,null,s);l.attr({z2:Te(o,100),culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),l.drift=nce,this._symbolType=r,this.add(l)},t.prototype.stopSymbolAnimation=function(r){this.childAt(0).stopAnimation(null,r)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){Us(this.childAt(0))},t.prototype.downplay=function(){Ws(this.childAt(0))},t.prototype.setZ=function(r,n){var a=this.childAt(0);a.zlevel=r,a.z=n},t.prototype.setDraggable=function(r,n){var a=this.childAt(0);a.draggable=r,a.cursor=!n&&r?"move":a.cursor},t.prototype.updateData=function(r,n,a,i){this.silent=!1;var o=r.getItemVisual(n,"symbol")||"circle",s=r.hostModel,l=t.getSymbolSize(r,n),u=t.getSymbolZ2(r,n),c=o!==this._symbolType,h=i&&i.disableAnimation;if(c){var f=r.getItemVisual(n,"symbolKeepAspect");this._createSymbol(o,r,n,l,u,f)}else{var v=this.childAt(0);v.silent=!1;var g={scaleX:l[0]/2,scaleY:l[1]/2};h?v.attr(g):At(v,g,s,n),xi(v)}if(this._updateCommon(r,n,l,a,i),c){var v=this.childAt(0);if(!h){var g={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:v.style.opacity}};v.scaleX=v.scaleY=0,v.style.opacity=0,Qt(v,g,s,n)}}h&&this.childAt(0).stopAnimation("leave")},t.prototype._updateCommon=function(r,n,a,i,o){var s=this.childAt(0),l=r.hostModel,u,c,h,f,v,g,m,y,x;if(i&&(u=i.emphasisItemStyle,c=i.blurItemStyle,h=i.selectItemStyle,f=i.focus,v=i.blurScope,m=i.labelStatesModels,y=i.hoverScale,x=i.cursorStyle,g=i.emphasisDisabled),!i||r.hasItemOption){var _=i&&i.itemModel?i.itemModel:r.getItemModel(n),w=_.getModel("emphasis");u=w.getModel("itemStyle").getItemStyle(),h=_.getModel(["select","itemStyle"]).getItemStyle(),c=_.getModel(["blur","itemStyle"]).getItemStyle(),f=w.get("focus"),v=w.get("blurScope"),g=w.get("disabled"),m=Gr(_),y=w.getShallow("scale"),x=_.getShallow("cursor")}var S=r.getItemVisual(n,"symbolRotate");s.attr("rotation",(S||0)*Math.PI/180||0);var C=Fh(r.getItemVisual(n,"symbolOffset"),a);C&&(s.x=C[0],s.y=C[1]),x&&s.attr("cursor",x);var M=r.getItemVisual(n,"style"),A=M.fill;if(s instanceof Qr){var I=s.style;s.useStyle(te({image:I.image,x:I.x,y:I.y,width:I.width,height:I.height},M))}else s.__isEmptyBrush?s.useStyle(te({},M)):s.useStyle(M),s.style.decal=null,s.setColor(A,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var k=r.getItemVisual(n,"liftZ"),P=this._z2;k!=null?P==null&&(this._z2=s.z2,s.z2+=k):P!=null&&(s.z2=P,this._z2=null);var D=o&&o.useNameLabel;Jr(s,m,{labelFetcher:l,labelDataIndex:n,defaultText:z,inheritColor:A,defaultOpacity:M.opacity});function z(H){return D?r.getName(H):Hf(r,H)}this._sizeX=a[0]/2,this._sizeY=a[1]/2;var j=s.ensureState("emphasis");j.style=u,s.ensureState("select").style=h,s.ensureState("blur").style=c;var B=y==null||y===!0?Math.max(1.1,3/this._sizeY):isFinite(y)&&y>0?+y:1;j.scaleX=this._sizeX*B,j.scaleY=this._sizeY*B,this.setSymbolScale(1),ir(this,f,v,g)},t.prototype.setSymbolScale=function(r){this.scaleX=this.scaleY=r},t.prototype.fadeOut=function(r,n,a){var i=this.childAt(0),o=Be(this).dataIndex,s=a&&a.animation;if(this.silent=i.silent=!0,a&&a.fadeLabel){var l=i.getTextContent();l&&su(l,{style:{opacity:0}},n,{dataIndex:o,removeOpt:s,cb:function(){i.removeTextContent()}})}else i.removeTextContent();su(i,{style:{opacity:0},scaleX:0,scaleY:0},n,{dataIndex:o,cb:r,removeOpt:s})},t.getSymbolSize=function(r,n){return bv(r.getItemVisual(n,"symbolSize"))},t.getSymbolZ2=function(r,n){return r.getItemVisual(n,"z2")},t}(De);function nce(e,t){this.parent.drift(e,t)}function k0(e,t,r,n){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(n&&n.isIgnore&&n.isIgnore(r))&&!(n&&n.clipShape&&!n.clipShape.contain(t[0],t[1]))&&e.getItemVisual(r,"symbol")!=="none"}function u5(e){return e!=null&&!Re(e)&&(e={isIgnore:e}),e||{}}function c5(e){var t=e.hostModel,r=t.getModel("emphasis");return{emphasisItemStyle:r.getModel("itemStyle").getItemStyle(),blurItemStyle:t.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:t.getModel(["select","itemStyle"]).getItemStyle(),focus:r.get("focus"),blurScope:r.get("blurScope"),emphasisDisabled:r.get("disabled"),hoverScale:r.get("scale"),labelStatesModels:Gr(t),cursorStyle:t.get("cursor")}}function h5(e,t,r,n,a,i,o){var s=new e(t,r,n,a);return s.setPosition(i),t.setItemGraphicEl(r,s),o.add(s),s}var ty=function(){function e(t){this.group=new De,this._SymbolCtor=t||ey}return e.prototype.updateData=function(t,r){this._progressiveEls=null,r=u5(r);var n=this.group,a=t.hostModel,i=this._data,o=this._SymbolCtor,s=r.disableAnimation,l=this._seriesScope=c5(t),u={disableAnimation:s},c=r.getSymbolPoint||function(h){return t.getItemLayout(h)};i||n.removeAll(),t.diff(i).add(function(h){var f=c(h);k0(t,f,h,r)&&h5(o,t,h,l,u,f,n)}).update(function(h,f){var v=i.getItemGraphicEl(f),g=c(h);if(!k0(t,g,h,r)){n.remove(v);return}var m=t.getItemVisual(h,"symbol")||"circle",y=v&&v.getSymbolType&&v.getSymbolType();if(!v||y&&y!==m)n.remove(v),v=new o(t,h,l,u),v.setPosition(g);else{v.updateData(t,h,l,u);var x={x:g[0],y:g[1]};s?v.attr(x):At(v,x,a)}n.add(v),t.setItemGraphicEl(h,v)}).remove(function(h){var f=i.getItemGraphicEl(h);f&&f.fadeOut(function(){n.remove(f)},a)}).execute(),this._getSymbolPoint=c,this._data=t},e.prototype.updateLayout=function(t){var r=this._data;if(r)for(var n=this,a=r.getStore(),i=0,o=a.count();i0?r=n[0]:n[1]<0&&(r=n[1]),r}function $W(e,t,r,n){var a=NaN;e.stacked&&(a=r.get(r.getCalculationInfo("stackedOverDimension"),n)),isNaN(a)&&(a=e.valueStart);var i=e.baseDataOffset,o=[];return o[i]=r.get(e.baseDim,n),o[1-i]=a,t.dataToPoint(o)}function ci(e,t){return!isFinite(e)||!isFinite(t)}var ice=typeof Float32Array!==uv?Float32Array:void 0,oce=typeof Float64Array!==uv?Float64Array:void 0;function So(e){return cI({ctor:ice},e).arr}function cI(e,t){var r=e.arr,n=e.ctor;if(t>Yg&&(t=Yg),!r||e.typed&&r.length=a||m<0)break;if(ci(x,_)){if(l){m+=i;continue}break}if(m===r)e[i>0?"moveTo":"lineTo"](x,_),h=x,f=_;else{var w=x-u,S=_-c;if(w*w+S*S<.5){m+=i;continue}if(o>0){for(var C=m+i,M=t[C*2],A=t[C*2+1];M===x&&A===_&&y=n||ci(M,A))v=x,g=_;else{P=M-u,D=A-c;var B=x-u,H=M-x,V=_-c,U=A-_,F=void 0,W=void 0;if(s==="x"){F=Math.abs(B),W=Math.abs(H);var $=P>0?1:-1;v=x-$*F*o,g=_,z=x+$*W*o,j=_}else if(s==="y"){F=Math.abs(V),W=Math.abs(U);var Z=D>0?1:-1;v=x,g=_-Z*F*o,z=x,j=_+Z*W*o}else F=Math.sqrt(B*B+V*V),W=Math.sqrt(H*H+U*U),k=W/(W+F),v=x-P*o*(1-k),g=_-D*o*(1-k),z=x+P*o*k,j=_+D*o*k,z=vl(z,pl(M,x)),j=vl(j,pl(A,_)),z=pl(z,vl(M,x)),j=pl(j,vl(A,_)),P=z-x,D=j-_,v=x-P*F/W,g=_-D*F/W,v=vl(v,pl(u,x)),g=vl(g,pl(c,_)),v=pl(v,vl(u,x)),g=pl(g,vl(c,_)),P=x-v,D=_-g,z=x+P*W/F,j=_+D*W/F}e.bezierCurveTo(h,f,v,g,x,_),h=z,f=j}else e.lineTo(x,_)}u=x,c=_,m+=i}return y}var ZW=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),uce=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="ec-polyline",n}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new ZW},t.prototype.buildPath=function(r,n){var a=n.points,i=0,o=a.length/2;if(n.connectNulls){for(;o>0&&ci(a[o*2-2],a[o*2-1]);o--);for(;i=0){var S=u?(g-l)*w+l:(v-s)*w+s;return u?[r,S]:[S,r]}s=v,l=g;break;case o.C:v=i[h++],g=i[h++],m=i[h++],y=i[h++],x=i[h++],_=i[h++];var C=u?k_(s,v,m,x,r,c):k_(l,g,y,_,r,c);if(C>0)for(var M=0;M=0){var S=u?$r(l,g,y,_,A):$r(s,v,m,x,A);return u?[r,S]:[S,r]}}s=x,l=_;break}}},t}(pt),cce=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(ZW),YW=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="ec-polygon",n}return t.prototype.getDefaultShape=function(){return new cce},t.prototype.buildPath=function(r,n){var a=n.points,i=n.stackedOnPoints,o=0,s=a.length/2,l=n.smoothMonotone;if(n.connectNulls){for(;s>0&&ci(a[s*2-2],a[s*2-1]);s--);for(;o=0,i=e.fill||K.color.neutral99;p5(n,t);var o=n.textFill==null;return a?o&&(n.textFill=r.insideFill||K.color.neutral00,!n.textStroke&&r.insideStroke&&(n.textStroke=r.insideStroke),!n.textStroke&&(n.textStroke=i),n.textStrokeWidth==null&&(n.textStrokeWidth=2)):(o&&(n.textFill=e.fill||r.outsideFill||K.color.neutral00),!n.textStroke&&r.outsideStroke&&(n.textStroke=r.outsideStroke)),n.text=t.text,n.rich=t.rich,R(t.rich,function(s){p5(s,s)}),n}function p5(e,t){t&&(Se(t,"fill")&&(e.textFill=t.fill),Se(t,"stroke")&&(e.textStroke=t.fill),Se(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),Se(t,"font")&&(e.font=t.font),Se(t,"fontStyle")&&(e.fontStyle=t.fontStyle),Se(t,"fontWeight")&&(e.fontWeight=t.fontWeight),Se(t,"fontSize")&&(e.fontSize=t.fontSize),Se(t,"fontFamily")&&(e.fontFamily=t.fontFamily),Se(t,"align")&&(e.textAlign=t.align),Se(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),Se(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),Se(t,"width")&&(e.textWidth=t.width),Se(t,"height")&&(e.textHeight=t.height),Se(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),Se(t,"padding")&&(e.textPadding=t.padding),Se(t,"borderColor")&&(e.textBorderColor=t.borderColor),Se(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),Se(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),Se(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),Se(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),Se(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),Se(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),Se(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),Se(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),Se(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),Se(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}function g5(e,t){if(e.length===t.length){for(var r=0;rt){i?r.push(o(i,l,t)):a&&r.push(o(a,l,0),o(a,l,t));break}else a&&(r.push(o(a,l,0)),a=null),r.push(l),i=l}return r}function fce(e,t,r){var n=e.getVisual("visualMeta");if(!(!n||!n.length||!e.count())&&t.type==="cartesian2d"){for(var a,i,o=n.length-1;o>=0;o--){var s=e.getDimensionInfo(n[o].dimension);if(a=s&&s.coordDim,a==="x"||a==="y"){i=n[o];break}}if(i){var l=t.getAxis(a),u=oe(i.stops,function(w){return{coord:l.toGlobalCoord(l.dataToCoord(w.value)),color:w.color}}),c=u.length,h=i.outerColors.slice();c&&u[0].coord>u[c-1].coord&&(u.reverse(),h.reverse());var f=dce(u,a==="x"?r.getWidth():r.getHeight()),v=f.length;if(!v&&c)return u[0].coord<0?h[1]?h[1]:u[c-1].color:h[0]?h[0]:u[0].color;var g=10,m=f[0].coord-g,y=f[v-1].coord+g,x=y-m;if(x<.001)return"transparent";R(f,function(w){w.offset=(w.coord-m)/x}),f.push({offset:v?f[v-1].offset:.5,color:h[1]||"transparent"}),f.unshift({offset:v?f[0].offset:.5,color:h[0]||"transparent"});var _=new Eh(0,0,0,0,f,!0);return _[a]=m,_[a+"2"]=y,_}}}function vce(e,t,r){var n=e.get("showAllSymbol"),a=n==="auto";if(!(n&&!a)){var i=r.getAxesByScale("ordinal")[0];if(i&&!(a&&pce(i,t))){var o=t.mapDimension(i.dim),s={};return R(i.getViewLabels(),function(l){l.tick.offInterval||(s[Cv(i.scale,l.tick)]=1)}),function(l){return!s.hasOwnProperty(t.get(o,l))}}}}function pce(e,t){var r=e.getExtent(),n=Math.abs(r[1]-r[0])/e.scale.count();isNaN(n)&&(n=0);for(var a=t.count(),i=Math.max(1,Math.round(a/5)),o=0;on)return!1;return!0}function gce(e){for(var t=e.length/2;t>0&&ci(e[t*2-2],e[t*2-1]);t--);return t-1}function _5(e,t){return[e[t*2],e[t*2+1]]}function mce(e,t,r){for(var n=e.length/2,a=r==="x"?0:1,i,o,s=0,l=-1,u=0;u=t||i>=t&&o<=t){l=u;break}s=u,i=o}return{range:[s,l],t:(t-i)/(o-i)}}function e8(e){if(e.get(["endLabel","show"]))return!0;for(var t=0;t0&&r.get(["emphasis","lineStyle","width"])==="bolder"){var W=g.getState("emphasis").style;W.lineWidth=+g.style.lineWidth+1}Be(g).seriesIndex=r.seriesIndex,ir(g,V,U,F);var $=x5(r.get("smooth")),Z=r.get("smoothMonotone");if(g.setShape({smooth:$,smoothMonotone:Z,connectNulls:A}),m){var J=s.getCalculationInfo("stackedOnSeries"),re=0;m.useStyle(Ee(u.getAreaStyle(),{fill:z,opacity:.7,lineJoin:"bevel",decal:s.getVisual("style").decal})),J&&(re=x5(J.get("smooth"))),m.setShape({smooth:$,stackedOnSmooth:re,smoothMonotone:Z,connectNulls:A}),Vr(m,r,"areaStyle"),Be(m).seriesIndex=r.seriesIndex,ir(m,V,U,F)}var Q=this._changePolyState;s.eachItemGraphicEl(function(ne){ne&&(ne.onHoverStateChange=Q)}),this._polyline.onHoverStateChange=Q,this._data=s,this._coordSys=i,this._stackedOnPoints=C,this._points=c,this._step=P,this._valueOrigin=w;var le=r.get("triggerEvent"),de=r.get("triggerLineEvent"),He=de===!0||le===!0||le==="line",ye=de===!0||le===!0||le==="area";this.packEventData(r,g,He),m&&this.packEventData(r,m,ye)},t.prototype.packEventData=function(r,n,a){Be(n).eventData=a?{componentType:"series",componentSubType:"line",componentIndex:r.componentIndex,seriesIndex:r.seriesIndex,seriesName:r.name,seriesType:"line",selfType:n===this._polygon?"area":"line"}:null},t.prototype.highlight=function(r,n,a,i){var o=r.getData(),s=nh(o,i);if(this._changePolyState("emphasis"),!(s instanceof Array)&&s!=null&&s>=0){var l=o.getLayout("points"),u=o.getItemGraphicEl(s);if(!u){var c=l[s*2],h=l[s*2+1];if(ci(c,h)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,h))return;var f=r.get("zlevel")||0,v=r.get("z")||0;u=new ey(o,s),u.x=c,u.y=h,u.setZ(f,v);var g=u.getSymbolPath().getTextContent();g&&(g.zlevel=f,g.z=v,g.z2=this._polyline.z2+1),u.__temp=!0,o.setItemGraphicEl(s,u),u.stopSymbolAnimation(!0),this.group.add(u)}u.highlight()}else Rt.prototype.highlight.call(this,r,n,a,i)},t.prototype.downplay=function(r,n,a,i){var o=r.getData(),s=nh(o,i);if(this._changePolyState("normal"),s!=null&&s>=0){var l=o.getItemGraphicEl(s);l&&(l.__temp?(o.setItemGraphicEl(s,null),this.group.remove(l)):l.downplay())}else Rt.prototype.downplay.call(this,r,n,a,i)},t.prototype._changePolyState=function(r){var n=this._polygon;V_(this._polyline,r),n&&V_(n,r)},t.prototype._newPolyline=function(r){var n=this._polyline;return n&&this._lineGroup.remove(n),n=new uce({shape:{points:r},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(n),this._polyline=n,n},t.prototype._newPolygon=function(r,n){var a=this._polygon;return a&&this._lineGroup.remove(a),a=new YW({shape:{points:r,stackedOnPoints:n},segmentIgnoreThreshold:2}),this._lineGroup.add(a),this._polygon=a,a},t.prototype._initSymbolLabelAnimation=function(r,n,a){var i,o,s=n.getBaseAxis(),l=s.inverse;n.type==="cartesian2d"?(i=s.isHorizontal(),o=!1):n.type==="polar"&&(i=s.dim==="angle",o=!0);var u=r.hostModel,c=u.get("animationDuration");Le(c)&&(c=c(null));var h=u.get("animationDelay")||0,f=Le(h)?h(null):h;r.eachItemGraphicEl(function(v,g){var m=v;if(m){var y=[v.x,v.y],x=void 0,_=void 0,w=void 0;if(a)if(o){var S=a,C=n.pointToCoord(y);i?(x=S.startAngle,_=S.endAngle,w=-C[1]/180*Math.PI):(x=S.r0,_=S.r,w=C[0])}else{var M=a;i?(x=M.x,_=M.x+M.width,w=v.x):(x=M.y+M.height,_=M.y,w=v.y)}var A=_===x?0:(w-x)/(_-x);l&&(A=1-A);var I=Le(h)?h(g):c*A+f,k=m.getSymbolPath(),P=k.getTextContent();m.attr({scaleX:0,scaleY:0}),m.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:I}),P&&P.animateFrom({style:{opacity:0}},{duration:300,delay:I}),k.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(r,n,a){var i=r.getModel("endLabel");if(e8(r)){var o=r.getData(),s=this._polyline,l=o.getLayout("points");if(!l){s.removeTextContent(),this._endLabel=null;return}var u=this._endLabel;u||(u=this._endLabel=new wt({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var c=gce(l);c>=0&&(Jr(s,Gr(r,"endLabel"),{inheritColor:a,labelFetcher:r,labelDataIndex:c,defaultText:function(h,f,v){return v!=null?UW(o,v):Hf(o,h)},enableTextSetter:!0},yce(i,n)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},t.prototype._endLabelOnDuring=function(r,n,a,i,o,s,l){var u=this._endLabel,c=this._polyline;if(u){r<1&&i.originalX==null&&(i.originalX=u.x,i.originalY=u.y);var h=a.getLayout("points"),f=a.hostModel,v=f.get("connectNulls"),g=s.get("precision"),m=s.get("distance")||0,y=l.getBaseAxis(),x=y.isHorizontal(),_=y.inverse,w=n.shape,S=_?x?w.x:w.y+w.height:x?w.x+w.width:w.y,C=(x?m:0)*(_?-1:1),M=(x?0:-m)*(_?-1:1),A=x?"x":"y",I=mce(h,S,A),k=I.range,P=k[1]-k[0],D=void 0;if(P>=1){if(P>1&&!v){var z=_5(h,k[0]);u.attr({x:z[0]+C,y:z[1]+M}),o&&(D=f.getRawValue(k[0]))}else{var z=c.getPointOn(S,A);z&&u.attr({x:z[0]+C,y:z[1]+M});var j=f.getRawValue(k[0]),B=f.getRawValue(k[1]);o&&(D=KG(a,g,j,B,I.t))}i.lastFrameIndex=k[0]}else{var H=r===1||i.lastFrameIndex>0?k[0]:0,z=_5(h,H);o&&(D=f.getRawValue(H)),u.attr({x:z[0]+C,y:z[1]+M})}if(o){var V=gv(u);typeof V.setLabelText=="function"&&V.setLabelText(D)}}},t.prototype._doUpdateAnimation=function(r,n,a,i,o,s,l){var u=this._polyline,c=this._polygon,h=r.hostModel,f=lce(this._data,r,this._stackedOnPoints,n,this._coordSys,a,this._valueOrigin),v=f.current,g=f.stackedOnCurrent,m=f.next,y=f.stackedOnNext;if(o&&(g=gl(f.stackedOnCurrent,f.current,a,o,l),v=gl(f.current,null,a,o,l),y=gl(f.stackedOnNext,f.next,a,o,l),m=gl(f.next,null,a,o,l)),y5(v,m)>3e3||c&&y5(g,y)>3e3){u.stopAnimation(),u.setShape({points:m}),c&&(c.stopAnimation(),c.setShape({points:m,stackedOnPoints:y}));return}u.shape.__points=f.current,u.shape.points=v;var x={shape:{points:m}};f.current!==v&&(x.shape.__points=f.next),u.stopAnimation(),At(u,x,h),c&&(c.setShape({points:v,stackedOnPoints:g}),c.stopAnimation(),At(c,{shape:{stackedOnPoints:y}},h),u.shape.points!==c.shape.points&&(c.shape.points=u.shape.points));for(var _=[],w=f.status,S=0;St&&(t=e[r]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,r=0;r10&&o.type==="cartesian2d"&&i){var l=o.getBaseAxis(),u=o.getOtherAxis(l),c=l.getExtent(),h=n.getDevicePixelRatio(),f=Math.abs(c[1]-c[0])*(h||1),v=Math.round(s/f);if(isFinite(v)&&v>1){i==="lttb"?t.setData(a.lttbDownSample(a.mapDimension(u.dim),1/v)):i==="minmax"&&t.setData(a.minmaxDownSample(a.mapDimension(u.dim),1/v));var g=void 0;ve(i)?g=_ce[i]:Le(i)&&(g=i),g&&t.setData(a.downSample(a.mapDimension(u.dim),1/v,g,bce))}}}}}function wce(e){e.registerChartView(xce),e.registerSeriesModel(rce),e.registerLayout(ry("line",!0)),e.registerVisual({seriesType:"line",reset:function(t){var r=t.getData(),n=t.getModel("lineStyle").getLineStyle();n&&!n.stroke&&(n.stroke=r.getVisual("style").fill),r.setVisual("legendLineStyle",n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,t8("line"))}var r8=function(e){X(t,e);function t(r,n,a,i,o){var s=e.call(this,r,n,a)||this;return s.index=0,s.type=i||"value",s.position=o||"bottom",s}return t.prototype.isHorizontal=function(){var r=this.position;return r==="top"||r==="bottom"},t.prototype.getGlobalExtent=function(r){var n=this.getExtent();return n[0]=this.toGlobalCoord(n[0]),n[1]=this.toGlobalCoord(n[1]),r&&n[0]>n[1]&&n.reverse(),n},t.prototype.pointToData=function(r,n){return this.coordToData(this.toLocalCoord(r[this.dim==="x"?0:1]),n)},t.prototype.setCategorySortInfo=function(r){if(this.type!=="category")return!1;this.model.option.categorySortInfo=r,this.scale.setSortInfo(r)},t}(Si),wA=null;function Sce(e){wA||(wA=e)}function ny(){return wA}var ew="expandAxisBreak",n8="collapseAxisBreak",a8="toggleAxisBreak",hI="axisbreakchanged",Cce={type:ew,event:hI,update:"update",refineEvent:dI},Tce={type:n8,event:hI,update:"update",refineEvent:dI},Mce={type:a8,event:hI,update:"update",refineEvent:dI};function dI(e,t,r,n){var a=[];return R(e,function(i){a=a.concat(i.eventBreaks)}),{eventContent:{breaks:a}}}function Ace(e){e.registerAction(Cce,t),e.registerAction(Tce,t),e.registerAction(Mce,t);function t(r,n){var a=[],i=ff(n,r);function o(s,l){R(i[s],function(u){var c=u.updateAxisBreaks(r);R(c.breaks,function(h){var f;a.push(Ee((f={},f[l]=u.componentIndex,f),h))})})}return o("xAxisModels","xAxisIndex"),o("yAxisModels","yAxisIndex"),o("singleAxisModels","singleAxisIndex"),{eventBreaks:a}}}var jl=Math.PI,Nce=[[1,2,1,2],[5,3,5,3],[8,3,8,3]],kce=[[0,1,0,1],[0,3,0,3],[0,3,0,3]],gh=Qe(),i8=Qe(),o8=function(){function e(t){this.recordMap={},this.resolveAxisNameOverlap=t}return e.prototype.ensureRecord=function(t){var r=t.axis.dim,n=t.componentIndex,a=this.recordMap,i=a[r]||(a[r]=[]);return i[n]||(i[n]={ready:{}})},e}();function Lce(e,t,r,n){var a=r.axis,i=t.ensureRecord(r),o=[],s,l=fI(e.axisName)&&Ff(e.nameLocation);R(n,function(g){var m=Wo(g);if(!(!m||m.label.ignore)){o.push(m);var y=i.transGroup;l&&(y.transform?Ra(hp,y.transform):Ih(hp),m.transform&&ja(hp,hp,m.transform),je.copy(L0,m.localRect),L0.applyTransform(hp),s?s.union(L0):je.copy(s=new je(0,0,0,0),L0))}});var u=Math.abs(i.dirVec.x)>.1?"x":"y",c=i.transGroup[u];if(o.sort(function(g,m){return Math.abs(g.label[u]-c)-Math.abs(m.label[u]-c)}),l&&s){var h=a.getExtent(),f=Math.min(h[0],h[1]),v=Math.max(h[0],h[1])-f;s.union(new je(f,0,v,1))}i.stOccupiedRect=s,i.labelInfoList=o}var hp=ar(),L0=new je(0,0,0,0),s8=function(e,t,r,n,a,i){if(Ff(e.nameLocation)){var o=i.stOccupiedRect;o&&l8(sue({},o,i.transGroup.transform),n,a)}else u8(i.labelInfoList,i.dirVec,n,a)};function l8(e,t,r){var n=new Oe;J1(e,t,n,{direction:Math.atan2(r.y,r.x),bidirectional:!1,touchThreshold:.05})&&vA(t,n)}function u8(e,t,r,n){for(var a=Oe.dot(n,t)>=0,i=0,o=e.length;i0?"top":"bottom",i="center"):th(a-jl)?(o=n>0?"bottom":"top",i="center"):(o="middle",a>0&&a0?"right":"left":i=n>0?"left":"right"),{rotation:a,textAlign:i,textVerticalAlign:o}},e.makeAxisEventDataBase=function(t){var r={componentType:t.mainType,componentIndex:t.componentIndex};return r[t.mainType+"Index"]=t.componentIndex,r},e.isLabelSilent=function(t){var r=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||r&&r.show)},e}(),Ice=["axisLine","axisTickLabelEstimate","axisTickLabelDetermine","axisName"],Pce={axisLine:function(e,t,r,n,a,i,o){var s=n.get(["axisLine","show"]);if(s==="auto"&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),!!s){var l=n.axis.getExtent(),u=i.transform,c=[l[0],0],h=[l[1],0],f=c[0]>h[0];u&&(dr(c,c,u),dr(h,h,u));var v=te({lineCap:"round"},n.getModel(["axisLine","lineStyle"]).getLineStyle()),g={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:v};if(n.get(["axisLine","breakLine"])&&W_(n.axis.scale))ny().buildAxisBreakLine(n,a,i,g);else{var m=new Tr(te({shape:{x1:c[0],y1:c[1],x2:h[0],y2:h[1]}},g));Rf(m.shape,m.style.lineWidth),m.anid="line",a.add(m)}var y=n.get(["axisLine","symbol"]);if(y!=null){var x=n.get(["axisLine","symbolSize"]);ve(y)&&(y=[y,y]),(ve(x)||Tt(x))&&(x=[x,x]);var _=Fh(n.get(["axisLine","symbolOffset"])||0,x),w=x[0],S=x[1];R([{rotate:e.rotation+Math.PI/2,offset:_[0],r:0},{rotate:e.rotation-Math.PI/2,offset:_[1],r:Math.sqrt((c[0]-h[0])*(c[0]-h[0])+(c[1]-h[1])*(c[1]-h[1]))}],function(C,M){if(y[M]!=="none"&&y[M]!=null){var A=Ar(y[M],-w/2,-S/2,w,S,v.stroke,!0),I=C.r+C.offset,k=f?h:c;A.attr({rotation:C.rotate,x:k[0]+I*Math.cos(e.rotation),y:k[1]-I*Math.sin(e.rotation),silent:!0,z2:11}),a.add(A)}})}}},axisTickLabelEstimate:function(e,t,r,n,a,i,o,s){var l=w5(t,a,s);l&&b5(e,t,r,n,a,i,o,Ui.estimate)},axisTickLabelDetermine:function(e,t,r,n,a,i,o,s){var l=w5(t,a,s);l&&b5(e,t,r,n,a,i,o,Ui.determine);var u=Rce(e,a,i,n);Ece(e,t.labelLayoutList,u),Oce(e,a,i,n,e.tickDirection)},axisName:function(e,t,r,n,a,i,o,s){var l=r.ensureRecord(n);t.nameEl&&(a.remove(t.nameEl),t.nameEl=l.nameLayout=l.nameLocation=null);var u=e.axisName;if(fI(u)){var c=e.nameLocation,h=e.nameDirection,f=n.getModel("nameTextStyle"),v=n.get("nameGap")||0,g=n.axis.getExtent(),m=n.axis.inverse?-1:1,y=new Oe(0,0),x=new Oe(0,0);c==="start"?(y.x=g[0]-m*v,x.x=-m):c==="end"?(y.x=g[1]+m*v,x.x=m):(y.x=(g[0]+g[1])/2,y.y=e.labelOffset+h*v,x.y=h);var _=ar();x.transform(Js(_,_,e.rotation));var w=n.get("nameRotate");w!=null&&(w=w*jl/180);var S,C;Ff(c)?S=Jn.innerTextLayout(e.rotation,w??e.rotation,h):(S=Dce(e.rotation,c,w||0,g),C=e.raw.axisNameAvailableWidth,C!=null&&(C=Math.abs(C/Math.sin(S.rotation)),!isFinite(C)&&(C=null)));var M=f.getFont(),A=n.get("nameTruncate",!0)||{},I=A.ellipsis,k=On(e.raw.nameTruncateMaxWidth,A.maxWidth,C),P=s.nameMarginLevel||0,D=new wt({x:y.x,y:y.y,rotation:S.rotation,silent:Jn.isLabelSilent(n),style:$t(f,{text:u,font:M,overflow:"truncate",width:k,ellipsis:I,fill:f.getTextColor()||n.get(["axisLine","lineStyle","color"]),align:f.get("align")||S.textAlign,verticalAlign:f.get("verticalAlign")||S.textVerticalAlign}),z2:1});if(el({el:D,componentModel:n,itemName:u}),D.__fullText=u,D.anid="name",n.get("triggerEvent")){var z=Jn.makeAxisEventDataBase(n);z.targetType="axisName",z.name=u,Be(D).eventData=z}i.add(D),D.updateTransform(),t.nameEl=D;var j=l.nameLayout=Wo({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:Ff(c)?Nce[P]:kce[P]});if(l.nameLocation=c,a.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&j){var B=r.ensureRecord(n);r.resolveAxisNameOverlap(e,r,n,j,x,B)}}}};function b5(e,t,r,n,a,i,o,s){h8(t)||zce(e,t,a,s,n,o);var l=t.labelLayoutList;Bce(e,n,l,i),Gce(n,e.rotation,l);var u=e.optionHideOverlap;jce(n,l,u),u&&TW(It(l,function(c){return c&&!c.label.ignore})),Lce(e,r,n,l)}function Dce(e,t,r,n){var a=Ok(r-e),i,o,s=n[0]>n[1],l=t==="start"&&!s||t!=="start"&&s;return th(a-jl/2)?(o=l?"bottom":"top",i="center"):th(a-jl*1.5)?(o=l?"top":"bottom",i="center"):(o="middle",ajl/2?i=l?"left":"right":i=l?"right":"left"),{rotation:a,textAlign:i,textVerticalAlign:o}}function jce(e,t,r){var n=e.axis,a=e.get(["axisLabel","customValues"]);if(Zse(n))return;function i(u,c,h){var f=Wo(t[c]),v=Wo(t[h]),g=n.scale;if(!(!f||!v)){if(u==null){if(!r&&a)return;var m=gh(f.label).labelInfo.tick;if(qm(g)&&m.notNice||Vn(g)&&m.offInterval){Ed(f.label);return}}if(u===!1||f.suggestIgnore){Ed(f.label);return}if(v.suggestIgnore){Ed(v.label);return}var y=.1;if(!r){var x=[0,0,0,0];f=pA({marginForce:x},f),v=pA({marginForce:x},v)}J1(f,v,null,{touchThreshold:y})&&Ed(u?v.label:f.label)}}var o=e.get(["axisLabel","showMinLabel"]),s=e.get(["axisLabel","showMaxLabel"]),l=t.length;i(o,0,1),i(s,l-1,l-2)}function Ece(e,t,r){e.showMinorTicks||R(t,function(n){if(n&&n.label.ignore)for(var a=0;a=0&&w(M,S,C.getStore())})}var v=0;if(f(function(w,S,C){n.set(S.uid,1),(!a||!a.hasKey(S.uid))&&(o=!0),v+=C.count()}),(!a||a.keys().length!==n.keys().length)&&(o=!0),!o&&i!=null){t.liPosMinGap=i;return}cI(uc,v);var g=0;f(function(w,S,C){for(var M=0,A=C.count();M0&&_0?tW:Kse,r.serUids=n}var uc=cI({ctor:oce},50);function tw(e){return function(t,r){var n=Cn(t,{fromStat:{key:e}});if(mi(n.w2))return[-n.w2/2,n.w2/2]}}function Uc(e){return e+sb}function Vh(e,t){return e+sb+t}function vI(e){return Yce(),{liPosMinGap:!Vn(e.scale)}}var Po="bar",vm="pictorialBar";function d8(e,t,r,n){eI(e,{key:t,seriesType:r,coordSysType:n,getMetrics:vI})}function f8(e){var t=e.scale.rawExtentInfo.makeRenderInfo().startValue;return t}var v8={left:0,right:0,top:0,bottom:0},gb=["25%","25%"],Vi="cartesian2d",qce=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(r,n){var a=zh(r.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),a&&r.outerBounds&&Uo(r.outerBounds,a)},t.prototype.mergeOption=function(r,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&r.outerBounds&&Uo(this.option.outerBounds,r.outerBounds)},t.type="grid",t.dependencies=["xAxis","yAxis"],t.layoutMode="box",t.defaultOption={show:!1,z:0,left:"15%",top:65,right:"10%",bottom:80,containLabel:!1,outerBoundsMode:"auto",outerBounds:v8,outerBoundsContain:"all",outerBoundsClampWidth:gb[0],outerBoundsClampHeight:gb[1],backgroundColor:K.color.transparent,borderWidth:1,borderColor:K.color.neutral30},t}(ht),Kce=lv(),CA="__ec_stack_";function p8(e){return e.get("stack")||CA+e.seriesIndex}function Jce(e){if(Vn(e.axis.scale)){for(var t=Cn(e.axis),r=[],n=0;nw&&(w=_),w!==c&&(y.width=w,r-=w+u*w,n--)}}),c=(r-l)/(n+(n-1)*u),c=at(c,0);var h=0,f;R(o,function(m){var y=s[m];y.width||(y.width=c),f=y,h+=y.width*(1+u)}),f&&(h-=f.width*u);var v={},g=-h/2;return R(o,function(m){var y=s[m];v[m]=v[m]||{bandWidth:t,offset:g,width:y.width},g+=y.width*(1+u)}),v}function m8(e){return{seriesType:e,overallReset:function(t){var r=Vh(e,Vi);QL(t,r,function(n){var a=Qce(n,e);hh(n,r,function(i){var o=a.columnMap[p8(i)];i.getData().setLayout({bandWidth:o.bandWidth,offset:o.offset,size:o.width})})})}}}function y8(e){return{seriesType:e,plan:Bh(),reset:function(t){if(Hce(t)){var r=t.getData(),n=t.coordinateSystem,a=n.getBaseAxis(),i=n.getOtherAxis(a),o=r.getDimensionIndex(r.mapDimension(i.dim)),s=r.getDimensionIndex(r.mapDimension(a.dim)),l=t.get("showBackground",!0),u=r.mapDimension(i.dim),c=r.getCalculationInfo("stackResultDimension"),h=Zs(r,u)&&!!r.getCalculationInfo("stackedOnSeries"),f=i.isHorizontal(),v=i.toGlobalCoord(i.dataToCoord(f8(i))),g=x8(t),m=t.get("barMinHeight")||0,y=c&&r.getDimensionIndex(c),x=r.getLayout("size"),_=r.getLayout("offset");return{progress:function(w,S){for(var C=w.count,M=g&&So(C*3),A=g&&l&&So(C*3),I=g&&So(C),k=n.master.getRect(),P=f?k.width:k.height,D,z=S.getStore(),j=0;(D=w.next())!=null;){var B=z.get(h?y:o,D),H=z.get(s,D),V=v,U=void 0;h&&(U=+B-z.get(o,D));var F=void 0,W=void 0,$=void 0,Z=void 0;if(f){var J=n.dataToPoint([B,H]);h&&(V=n.dataToPoint([U,H])[0]),F=V,W=J[1]+_,$=J[0]-V,Z=x,cr($)y){w=(M+_)/2;break}C===1&&(S=A-g[0].tickValue)}w==null&&(_?_&&(w=g[g.length-1].coord):w=g[0].coord),s[v]=f.toGlobalCoord(w)}});else{var l=this.getData(),u=l.getLayout("offset"),c=l.getLayout("size"),h=i.getBaseAxis().isHorizontal()?0:1;s[h]+=u+c/2}return s}return[NaN,NaN]},t.prototype.__requireStartValue=function(r){return this.getBaseAxis()!==r},t.type="series.__base_bar__",t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod",defaultBarGap:"10%"},t}(Ut);Ut.registerClass(pm);var rhe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(){return Jo(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},t.prototype.getProgressive=function(){return this.get("large")?this.get("progressive"):!1},t.prototype.__preparePipelineContext=function(r,n){var a=e7(this,r,n);return a.progressiveRender&&(a.large=!0),a},t.prototype.brushSelector=function(r,n,a){return a.rect(n.getItemLayout(r))},t.type="series."+Po,t.dependencies=["grid","polar"],t.defaultOption=Cu(pm.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:K.color.primary,borderWidth:2}},realtimeSort:!1}),t}(pm),nhe=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),mb=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="sausage",n}return t.prototype.getDefaultShape=function(){return new nhe},t.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.max(n.r0||0,0),s=Math.max(n.r,0),l=(s-o)*.5,u=o+l,c=n.startAngle,h=n.endAngle,f=n.clockwise,v=Math.PI*2,g=f?h-cMath.PI/2&&cs)return!0;s=h}return!1},t.prototype._isOrderDifferentInView=function(r,n){for(var a=n.scale,i=a.getExtent(),o=Math.max(0,i[0]),s=Math.min(i[1],a.getOrdinalMeta().categories.length-1);o<=s;++o)if(r.ordinalNumbers[o]!==a.getRawOrdinalNumber(o))return!0},t.prototype._updateSortWithinSameData=function(r,n,a,i){if(this._isOrderChangedWithinSameData(r,n,a)){var o=this._dataSort(r,a,n);this._isOrderDifferentInView(o,a)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:a.dim+"Axis",axisId:a.index,sortInfo:o}))}},t.prototype._dispatchInitSort=function(r,n,a){var i=n.baseAxis,o=this._dataSort(r,i,function(s){return r.get(r.mapDimension(n.otherAxis.dim),s)});a.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.index,sortInfo:o})},t.prototype.remove=function(r,n){this._clear(this._model),this._removeOnRenderedListener(n)},t.prototype.dispose=function(r,n){this._removeOnRenderedListener(n)},t.prototype._removeOnRenderedListener=function(r){this._onRendered&&(r.getZr().off("rendered",this._onRendered),this._onRendered=null)},t.prototype._clear=function(r){var n=this.group,a=this._data;r&&r.isAnimationEnabled()&&a&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],a.eachItemGraphicEl(function(i){Is(i,r,Be(i).dataIndex)})):n.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=Po,t}(Rt),S5={cartesian2d:function(e,t){var r=t.width<0?-1:1,n=t.height<0?-1:1;r<0&&(t.x+=t.width,t.width=-t.width),n<0&&(t.y+=t.height,t.height=-t.height);var a=e.x+e.width,i=e.y+e.height,o=DC(t.x,e.x),s=jC(t.x+t.width,a),l=DC(t.y,e.y),u=jC(t.y+t.height,i),c=sa?s:o,t.y=h&&l>i?u:l,t.width=c?0:s-o,t.height=h?0:u-l,r<0&&(t.x+=t.width,t.width=-t.width),n<0&&(t.y+=t.height,t.height=-t.height),c||h},polar:function(e,t){var r=t.r0<=t.r?1:-1;if(r<0){var n=t.r;t.r=t.r0,t.r0=n}var a=jC(t.r,e.r),i=DC(t.r0,e.r0);t.r=a,t.r0=i;var o=a-i<0;if(r<0){var n=t.r;t.r=t.r0,t.r0=n}return o}},C5={cartesian2d:function(e,t,r,n,a,i,o,s,l){var u=new it({shape:te({},n),z2:1});if(u.__dataIndex=r,u.name="item",i){var c=u.shape,h=a?"height":"width";c[h]=0}return u},polar:function(e,t,r,n,a,i,o,s,l){var u=!a&&l?mb:wn,c=new u({shape:n,z2:1});c.name="item";var h=b8(a);if(c.calculateTextPosition=ahe(h,{isRoundCap:u===mb}),i){var f=c.shape,v=a?"r":"endAngle",g={};f[v]=a?n.r0:n.startAngle,g[v]=n[v],(s?At:Qt)(c,{shape:g},i)}return c}};function she(e,t){var r=e.get("realtimeSort",!0),n=t.getBaseAxis();if(r&&n.type==="category"&&t.type==="cartesian2d")return{baseAxis:n,otherAxis:t.getOtherAxis(n)}}function T5(e,t,r,n,a,i,o,s){var l,u;i?(u={x:n.x,width:n.width},l={y:n.y,height:n.height}):(u={y:n.y,height:n.height},l={x:n.x,width:n.width}),s||(o?At:Qt)(r,{shape:l},t,a,null);var c=t?e.baseAxis.model:null;(o?At:Qt)(r,{shape:u},c,a)}function M5(e,t){for(var r=0;r0?1:-1,o=n.height>0?1:-1;return{x:n.x+i*a/2,y:n.y+o*a/2,width:n.width-i*a,height:n.height-o*a}},polar:function(e,t,r){var n=e.getItemLayout(t);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}}};function che(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function b8(e){return function(t){var r=t?"Arc":"Angle";return function(n){switch(n){case"start":case"insideStart":case"end":case"insideEnd":return n+r;default:return n}}}(e)}function N5(e,t,r,n,a,i,o,s){var l=t.getItemVisual(r,"style");if(s){if(!i.get("roundCap")){var c=e.shape,h=Co(n.getModel("itemStyle"),c,!0);te(c,h),e.setShape(c)}}else{var u=n.get(["itemStyle","borderRadius"])||0;e.setShape("r",u)}e.useStyle(l);var f=n.getShallow("cursor");f&&e.attr("cursor",f);var v=s?o?a.r>=a.r0?"endArc":"startArc":a.endAngle>=a.startAngle?"endAngle":"startAngle":o?phe(a,i.coordinateSystem):ghe(a,i.coordinateSystem),g=Gr(n);Jr(e,g,{labelFetcher:i,labelDataIndex:r,defaultText:Hf(i.getData(),r),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:v});var m=e.getTextContent();if(s&&m){var y=n.get(["label","position"]);e.textConfig.inside=y==="middle"?!0:null,ihe(e,y==="outside"?v:y,b8(o),n.get(["label","rotate"]))}X7(m,g,i.getRawValue(r),function(_){return UW(t,_)});var x=n.getModel(["emphasis"]);ir(e,x.get("focus"),x.get("blurScope"),x.get("disabled")),Vr(e,n),che(a)&&(e.style.fill="none",e.style.stroke="none",R(e.states,function(_){_.style&&(_.style.fill=_.style.stroke="none")}))}function hhe(e,t){var r=e.get(["itemStyle","borderColor"]);if(!r||r==="none")return 0;var n=e.get(["itemStyle","borderWidth"])||0,a=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),i=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(n,a,i)}var dhe=function(){function e(){}return e}(),k5=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="largeBar",n}return t.prototype.getDefaultShape=function(){return new dhe},t.prototype.buildPath=function(r,n){for(var a=n.points,i=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],u=this.barWidth,c=0;c=0?r:null},30,!1);function fhe(e,t,r){for(var n=e.baseDimIdx,a=1-n,i=e.shape.points,o=e.largeDataIndices,s=[],l=[],u=e.barWidth,c=0,h=i.length/3;c=s[0]&&t<=s[0]+l[0]&&r>=s[1]&&r<=s[1]+l[1])return o[c]}return-1}function w8(e,t,r){if(ph(r,"cartesian2d")){var n=t,a=r.getArea();return{x:e?n.x:a.x,y:e?a.y:n.y,width:e?n.width:a.width,height:e?a.height:n.height}}else{var a=r.getArea(),i=t;return{cx:a.cx,cy:a.cy,r0:e?a.r0:i.r0,r:e?a.r:i.r,startAngle:e?i.startAngle:0,endAngle:e?i.endAngle:Math.PI*2}}}function vhe(e,t,r){var n=e.type==="polar"?wn:it;return new n({shape:w8(t,r,e),silent:!0,z2:0})}function phe(e,t){if(e.height===0){var r=t.getOtherAxis(t.getBaseAxis());return r.inverse?"bottom":"top"}return e.height>0?"bottom":"top"}function ghe(e,t){if(e.width===0){var r=t.getOtherAxis(t.getBaseAxis());return r.inverse?"left":"right"}return e.width>=0?"right":"left"}function mhe(e){e.registerChartView(ohe),e.registerSeriesModel(rhe),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,m8(Po)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,y8(Po)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,t8(Po)),e.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(t,r){var n=t.componentType||"series";r.eachComponent({mainType:n,query:t},function(a){t.sortInfo&&a.axis.setCategorySortInfo(t.sortInfo)})}),_8(e)}function ay(e){return{seriesType:e,reset:function(t,r){var n=r.findComponents({mainType:"legend"});if(!(!n||!n.length)){var a=t.getData();a.filterSelf(function(i){for(var o=a.getName(i),s=0;s=0},e.prototype.indexOfName=function(t){var r=this._getDataWithEncodedVisual();return r.indexOfName(t)},e.prototype.getItemVisual=function(t,r){var n=this._getDataWithEncodedVisual();return n.getItemVisual(t,r)},e}(),Ql="pie",yhe=Qe(),S8=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new Nv(be(this.getData,this),be(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return Av(this,{coordDimensions:["value"],encodeDefaulter:nt(CL,this)})},t.prototype.getDataParams=function(r){var n=this.getData(),a=yhe(n),i=a.seats;if(!i){var o=[];n.each(n.mapDimension("value"),function(l){o.push(l)}),i=a.seats=GG(o,n.hostModel.get("percentPrecision"))}var s=e.prototype.getDataParams.call(this,r);return s.percent=i[r]||0,s.$vars.push("percent"),s},t.prototype._defaultLabelLine=function(r){rh(r,"labelLine",["show"]);var n=r.labelLine,a=r.emphasis.labelLine;n.show=n.show&&r.label.show,a.show=a.show&&r.emphasis.label.show},t.type="series."+Ql,t.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",center:["50%","50%"],radius:[0,"50%"],clockwise:!0,startAngle:90,endAngle:"auto",padAngle:0,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,coordinateSystemUsage:"box",left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:"truncate",position:"outer",alignTo:"none",edgeDistance:"25%",distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:30,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:"solid"}},itemStyle:{borderWidth:1,borderJoin:"round"},showEmptyCircle:!0,emptyCircleStyle:{color:"lightgray",opacity:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:"expansion",animationDuration:1e3,animationTypeUpdate:"transition",animationEasingUpdate:"cubicInOut",animationDurationUpdate:500,animationEasing:"cubicInOut"},t}(Ut);fae({fullType:S8.type,getCoord2:function(e){return e.getShallow("center")}});var xhe=Math.PI/180;function P5(e,t,r,n,a,i,o,s,l,u){if(e.length<2)return;function c(m){for(var y=m.rB,x=y*y,_=0;_r?x:y,C=Math.abs(w.label.y-r);if(C>=S.maxY){var M=w.label.x-t-w.len2*a,A=n+w.len,I=Math.abs(M)e.unconstrainedWidth?null:f:null;n.setStyle("width",v)}T8(i,n)}}}function T8(e,t){D5.rect=e,CW(D5,t,bhe)}var bhe={minMarginForce:[null,0,null,0],marginDefault:[1,0,1,0]},D5={};function EC(e){return e.position==="center"}function whe(e){var t=e.getData(),r=[],n,a,i=!1,o=(e.get("minShowLabelAngle")||0)*xhe,s=t.getLayout("viewRect"),l=t.getLayout("r"),u=s.width,c=s.x,h=s.y,f=s.height;function v(M){M.ignore=!0}function g(M){if(!M.ignore)return!0;for(var A in M.states)if(M.states[A].ignore===!1)return!0;return!1}t.each(function(M){var A=t.getItemGraphicEl(M),I=A.shape,k=A.getTextContent(),P=A.getTextGuideLine(),D=t.getItemModel(M),z=D.getModel("label"),j=z.get("position")||D.get(["emphasis","label","position"]),B=z.get("distanceToLabelLine"),H=z.get("alignTo"),V=me(z.get("edgeDistance"),u),U=z.get("bleedMargin");U==null&&(U=Math.min(u,f)>200?10:2);var F=D.getModel("labelLine"),W=F.get("length");W=me(W,u);var $=F.get("length2");if($=me($,u),Math.abs(I.endAngle-I.startAngle)0?"right":"left":J>0?"left":"right"}var qe=Math.PI,Fe=0,_t=z.get("rotate");if(Tt(_t))Fe=_t*(qe/180);else if(j==="center")Fe=0;else if(_t==="radial"||_t===!0){var bt=J<0?-Z+qe:-Z;Fe=bt}else if(_t==="tangential"||_t==="tangential-noflip"&&j!=="outside"&&j!=="outer"){var et=Math.atan2(J,re);et<0&&(et=qe*2+et);var Ke=re>0;Ke&&_t!=="tangential-noflip"&&(et=qe+et),Fe=et-qe}if(i=!!Fe,k.x=Q,k.y=le,k.rotation=Fe,k.setStyle({verticalAlign:"middle"}),ye){k.setStyle({align:He});var ce=k.states.select;ce&&(ce.x+=k.x,ce.y+=k.y)}else{var St=new je(0,0,0,0);T8(St,k),r.push({label:k,labelLine:P,position:j,len:W,len2:$,minTurnAngle:F.get("minTurnAngle"),maxSurfaceAngle:F.get("maxSurfaceAngle"),surfaceNormal:new Oe(J,re),linePoints:de,textAlign:He,labelDistance:B,labelAlignTo:H,edgeDistance:V,bleedMargin:U,rect:St,unconstrainedWidth:St.width,labelStyleWidth:k.style.width})}A.setTextConfig({inside:ye})}}),!i&&e.get("avoidLabelOverlap")&&_he(r,n,a,l,u,f,c,h);for(var m=0;mF?($=B+A*F/2,Z=$):($=B+k,Z=W-k),n.setItemLayout(U,{angle:F,startAngle:$,endAngle:Z,clockwise:w,cx:o,cy:s,r0:u,r:S?Nt(V,M,[u,l]):l}),B=W}),z0){for(var c=o.getItemLayout(0),h=1;isNaN(c&&c.startAngle)&&h=i.r0}},t.type=Ql,t}(Rt);function Ahe(e){return{seriesType:e,reset:function(t,r){var n=t.getData();n.filterSelf(function(a){var i=n.mapDimension("value"),o=n.get(i,a);return!(Tt(o)&&!isNaN(o)&&o<0)})}}}function Nhe(e){e.registerChartView(Mhe),e.registerSeriesModel(S8),uU(Ql,e.registerAction),e.registerLayout(She),e.registerProcessor(ay(Ql)),e.registerProcessor(Ahe(Ql))}var khe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r}return t.prototype.getInitialData=function(r,n){return Jo(null,this,{useEncodeDefaulter:!0})},t.prototype.getProgressive=function(){var r=this.option.progressive;return r??(this.option.large?5e3:this.get("progressive"))},t.prototype.getProgressiveThreshold=function(){var r=this.option.progressiveThreshold;return r??(this.option.large?1e4:this.get("progressiveThreshold"))},t.prototype.brushSelector=function(r,n,a){return a.point(n.getItemLayout(r))},t.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},t.type="series.scatter",t.dependencies=["grid","polar","geo","singleAxis","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:K.color.primary}},universalTransition:{divideShape:"clone"}},t}(Ut),A8=4,Lhe=function(){function e(){}return e}(),Ihe=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.getDefaultShape=function(){return new Lhe},t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.beforeBrush=function(r){r&&!r.contentRetained&&this.reset()},t.prototype.buildPath=function(r,n){var a=n.points,i=n.size,o=this.symbolProxy,s=o.shape,l=r.getContext?r.getContext():r,u=l&&i[0]=0;u--){var c=u*2,h=i[c]-s/2,f=i[c+1]-l/2;if(r>=h&&n>=f&&r<=h+s&&n<=f+l)return u}return-1},t.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();if(r=a[0],n=a[1],i.contain(r,n)){var o=this.hoverDataIdx=this.findDataIndex(r,n);return o>=0}return this.hoverDataIdx=-1,!1},t.prototype.getBoundingRect=function(){var r=this._rect;if(!r){for(var n=this.shape,a=n.points,i=n.size,o=i[0],s=i[1],l=1/0,u=1/0,c=-1/0,h=-1/0,f=0;f=0&&(u.dataIndex=h+(t.startIndex||0))})},e.prototype.remove=function(){this._clear()},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),Dhe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){var i=r.getData(),o=this._updateSymbolDraw(i,r);o.updateData(i,RC(r)),this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,a){var i=r.getData(),o=this._updateSymbolDraw(i,r);o.incrementalPrepareUpdate(i),this._finished=!1},t.prototype.incrementalRender=function(r,n,a){this._symbolDraw.incrementalUpdate(r,n.getData(),Io(n),RC(n)),this._finished=r.end===n.getData().count()},t.prototype.updateTransform=function(r,n,a){var i=r.getData();if(this.group.dirty(),this._finished){var o=ry("").reset(r,n,a);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(RC(r))}else return{update:!0}},t.prototype.eachRendered=function(r){this._symbolDraw&&this._symbolDraw.eachRendered(r)},t.prototype._updateSymbolDraw=function(r,n){var a=this._symbolDraw,i=n.pipelineContext,o=i.large;return(!a||o!==this._isLargeDraw)&&(a&&a.remove(),a=this._symbolDraw=o?new Phe:new ty,this._isLargeDraw=o,this.group.removeAll()),this.group.add(a.group),a},t.prototype.remove=function(r,n){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},t.prototype.dispose=function(){},t.type="scatter",t}(Rt);function RC(e){return{clipShape:KW(e)}}var TA=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",pr).models[0]},t.type="cartesian2dAxis",t}(ht);kr(TA,Tv);var N8={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:"auto",onZeroAxisIndex:null,lineStyle:{color:K.color.axisLine,width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15],breakLine:!0},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12,color:K.color.axisLabel,textMargin:[0,3]},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:K.color.axisSplitLine,width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:[K.color.backgroundTint,K.color.backgroundTransparent]}},breakArea:{show:!0,itemStyle:{color:K.color.neutral00,borderColor:K.color.border,borderWidth:1,borderType:[3,3],opacity:.6},zigzagAmplitude:4,zigzagMinSpan:4,zigzagMaxSpan:20,zigzagZ:100,expandOnClick:!0},breakLabelLayout:{moveOverlap:"auto"}},jhe=Je({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto",show:"auto"},axisLabel:{interval:"auto"}},N8),pI=Je({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:K.color.axisMinorSplitLine,width:1}}},N8),Ehe=Je({splitNumber:6,axisLabel:{rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},pI),Rhe=Ee({logBase:10},pI);const k8={category:jhe,value:pI,time:Ehe,log:Rhe};function Uf(e,t,r,n){R(KU,function(a,i){var o=Je(Je({},k8[i],!0),n,!0),s=function(l){X(u,l);function u(){var c=l!==null&&l.apply(this,arguments)||this;return c.type=t+"Axis."+i,c}return u.prototype.mergeDefaultAndTheme=function(c,h){var f=em(this),v=f?zh(c):{},g=h.getTheme();Je(c,g.get(i+"Axis")),Je(c,this.getDefaultOption()),c.type=E5(c),f&&Uo(c,v,f)},u.prototype.optionUpdated=function(){var c=this.option;c.type==="category"&&(this.__ordinalMeta=am.createByAxisModel(this))},u.prototype.getCategories=function(c){var h=this.option;if(h.type==="category")return c?h.data:this.__ordinalMeta.categories},u.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},u.prototype.updateAxisBreaks=function(c){var h=ny();return h?h.updateModelAxisBreak(this,c):{breaks:[]}},u.type=t+"Axis."+i,u.defaultOption=o,u}(r);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+"Axis",E5)}function E5(e){return e.type||(e.data?"category":"value")}var Ohe=function(){function e(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return e.prototype.getAxis=function(t){return this._axes[t]},e.prototype.getAxes=function(){return oe(this._dimList,function(t){return this._axes[t]},this)},e.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),It(this.getAxes(),function(r){return r.scale.type===t})},e.prototype.addAxis=function(t){var r=t.dim;this._axes[r]=t,this._dimList.push(r)},e}(),Wx=["x","y"];function R5(e){return(e.type==="interval"||e.type==="time")&&!W_(e)}var zhe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Vi,r.dimensions=Wx,r}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var r=this.getAxis("x").scale,n=this.getAxis("y").scale;if(!(!R5(r)||!R5(n))){var a=ab(r,null),i=ab(n,null),o=this.dataToPoint([a[0],i[0]]),s=this.dataToPoint([a[1],i[1]]),l=a[1]-a[0],u=i[1]-i[0];if(!(!l||!u)){var c=(s[0]-o[0])/l,h=(s[1]-o[1])/u,f=o[0]-a[0]*c,v=o[1]-i[0]*h,g=this._transform=[c,0,0,h,f,v];this._invTransform=Ra([],g)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},t.prototype.containPoint=function(r){var n=this.getAxis("x"),a=this.getAxis("y");return n.contain(n.toLocalCoord(r[0]))&&a.contain(a.toLocalCoord(r[1]))},t.prototype.containData=function(r){return this.getAxis("x").containData(r[0])&&this.getAxis("y").containData(r[1])},t.prototype.containZone=function(r,n){var a=this.dataToPoint(r),i=this.dataToPoint(n),o=this.getArea(),s=new je(a[0],a[1],i[0]-a[0],i[1]-a[1]);return o.intersect(s)},t.prototype.dataToPoint=function(r,n,a){a=a||[];var i=r[0],o=r[1];if(this._transform&&i!=null&&isFinite(i)&&o!=null&&isFinite(o))return dr(a,r,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return a[0]=s.toGlobalCoord(s.dataToCoord(i,n)),a[1]=l.toGlobalCoord(l.dataToCoord(o,n)),a},t.prototype.clampData=function(r,n){var a=this.getAxis("x").scale,i=this.getAxis("y").scale,o=a.getExtent(),s=i.getExtent(),l=a.parse(r[0]),u=i.parse(r[1]);return n=n||[],n[0]=Math.min(Math.max(Math.min(o[0],o[1]),l),Math.max(o[0],o[1])),n[1]=Math.min(Math.max(Math.min(s[0],s[1]),u),Math.max(s[0],s[1])),n},t.prototype.pointToData=function(r,n,a){if(a=a||[],this._invTransform)return dr(a,r,this._invTransform);var i=this.getAxis("x"),o=this.getAxis("y");return a[0]=i.coordToData(i.toLocalCoord(r[0]),n),a[1]=o.coordToData(o.toLocalCoord(r[1]),n),a},t.prototype.getOtherAxis=function(r){return this.getAxis(r.dim==="x"?"y":"x")},t.prototype.getArea=function(r){r=r||0;var n=this.getAxis("x").getGlobalExtent(),a=this.getAxis("y").getGlobalExtent(),i=Math.min(n[0],n[1])-r,o=Math.min(a[0],a[1])-r,s=Math.max(n[0],n[1])-i+r,l=Math.max(a[0],a[1])-o+r;return new je(i,o,s,l)},t}(Ohe);function L8(e,t){var r=e.scale,n=e.model,a=uW(r,n,n.ecModel,e,null),i=Bf(r),o=Bf(t)?t.intervalStub:t,s=i?r.intervalStub:r,l=r.base,u=o.getTicks(),c=o.getTicks({expandToNicedExtent:!0}),h=u.length-1,f,v,g;if(h===1)f=v=0,g=1;else if(h===2){var m=cr(u[0].value-u[1].value),y=cr(u[1].value-u[2].value);f=v=0,m===y?g=2:(g=1,m=A[1])return!0})):S[1]?(k=A[1],B(function(){if(F(),j=Mt(z-P*g,D),H(),I<=A[0])return!0})):B(function(){j=Mt(Ph(A[0]/P)*P,D),z=Mt(gi(A[1]/P)*P,D);var J=Fo((z-j)/P);if(J<=g){var re=g-J,Q=void 0,le=a.incl0||i;if(le&&A[0]===0)Q=[0,re];else if(le&&A[1]===0)Q=[re,0];else{var de=gi(re/2);Q=re%2===0?[de,de]:I+k=A[1])return!0}})}eW(r,S,M,[I,k],C,{interval:P,intervalCount:g,intervalPrecision:D,niceExtent:[j,z]})}var O5=[[3,1],[0,2]],Bhe=function(){function e(t,r,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=Wx,this._initCartesian(t,r,n),this.model=t}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(t,r){var n=this._axesMap;R(this._axesList,function(o){fh(o,Vf);var s=o.scale;Vn(s)&&s.setSortInfo(o.model.get("categorySortInfo"))});function a(o){for(var s=gt(o),l=[],u=s.length-1;u>=0;u--){var c=o[+s[u]];c.__alignTo?l.push(c):Gf(c)}R(l,function(h){Vhe(h,h.__alignTo)?Gf(h):L8(h,h.__alignTo.scale)})}a(n.x),a(n.y);var i={};R(n.x,function(o){z5(n,"y",o,i)}),R(n.y,function(o){z5(n,"x",o,i)}),this.resize(this.model,r)},e.prototype.resize=function(t,r,n){var a=Ur(t,r),i=this._rect=tr(t.getBoxLayoutParams(),a.refContainer),o=this._axesMap,s=this._coordsList,l=t.get("containLabel");if(MA(o,i),!n){var u=Uhe(i,s,o,l,r),c=void 0;if(l)AA?(AA(this._axesList,i),MA(o,i)):c=G5(i.clone(),"axisLabel",null,i,o,u,a);else{var h=Whe(t,i,a),f=h.outerBoundsRect,v=h.parsedOuterBoundsContain,g=h.outerBoundsClamp;f&&(c=G5(f,v,g,i,o,u,a))}I8(i,o,Ui.determine,null,c,a),R(this._coordsList,function(m){m.calcAffineTransform()})}},e.prototype.getAxis=function(t,r){var n=this._axesMap[t];if(n!=null)return n[r||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(t,r){if(t!=null&&r!=null){var n="x"+t+"y"+r;return this._coordsMap[n]}Re(t)&&(r=t.yAxisIndex,t=t.xAxisIndex);for(var a=0,i=this._coordsList;a=0;a--){var i=e[+t[a]];WU(i.scale)&&QU(i.model,i.type,!0)==null&&(i.model.get("alignTicks")&&i.model.get("interval")==null?n.push(i):r=i)}r||(r=n.pop()),r&&R(n,function(o){o.__alignTo=r})}function Vhe(e,t){return W_(e.scale)||W_(t.scale)||t.scale.getTicks().length<2}function Ghe(e,t){var r=e.getExtent(),n=r[0]+r[1];e.toGlobalCoord=e.dim==="x"?function(a){return a+t}:function(a){return n-a+t},e.toLocalCoord=e.dim==="x"?function(a){return a-t}:function(a){return n-a+t}}function MA(e,t){R(e.x,function(r){return V5(r,t.x,t.width)}),R(e.y,function(r){return V5(r,t.y,t.height)})}function V5(e,t,r){var n=[0,r],a=e.inverse?1:0;e.setExtent(n[a],n[1-a]),Ghe(e,t)}var AA;function Hhe(e){AA=e}function G5(e,t,r,n,a,i,o){I8(n,a,Ui.estimate,t,!1,o);var s=[0,0,0,0];u(0),u(1),c(n,0,NaN),c(n,1,NaN);var l=Ks(s,function(f){return f>0})==null;return sh(n,s,!0,!0,r),MA(a,n),l;function u(f){R(a[We[f]],function(v){if(lm(v.model)){var g=i.ensureRecord(v.model),m=g.labelInfoList;if(m)for(var y=0;y0&&!yn(v)&&v>1e-4&&(f/=v),f}}function Uhe(e,t,r,n,a){var i=new o8($he);return R(r,function(o){return R(o,function(s){if(lm(s.model)){var l=!n;s.axisBuilder=Wce(e,t,s.model,a,i,l)}})}),i}function I8(e,t,r,n,a,i){var o=r===Ui.determine;R(t,function(u){return R(u,function(c){lm(c.model)&&($ce(c.axisBuilder,e,c.model),c.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:a}))})});var s={x:0,y:0};l(0),l(1);function l(u){s[We[1-u]]=e[_r[u]]<=i.refContainer[_r[u]]*.5?0:1-u===1?2:1}R(t,function(u,c){return R(u,function(h){lm(h.model)&&((n==="all"||o)&&h.axisBuilder.build({axisName:!0},{nameMarginLevel:s[c]}),o&&h.axisBuilder.build({axisLine:!0}))})})}function Whe(e,t,r){var n,a=e.get("outerBoundsMode",!0);a==="same"?n=t.clone():(a==null||a==="auto")&&(n=tr(e.get("outerBounds",!0)||v8,r.refContainer));var i=e.get("outerBoundsContain",!0),o;i==null||i==="auto"||Ye(["all","axisLabel"],i)<0?o="all":o=i;var s=[O_(Te(e.get("outerBoundsClampWidth",!0),gb[0]),t.width),O_(Te(e.get("outerBoundsClampHeight",!0),gb[1]),t.height)];return{outerBoundsRect:n,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var $he=function(e,t,r,n,a,i){var o=r.axis.dim==="x"?"y":"x";s8(e,t,r,n,a,i),Ff(e.nameLocation)||R(t.recordMap[o],function(s){s&&s.labelInfoList&&s.dirVec&&u8(s.labelInfoList,s.dirVec,n,a)})};function Zhe(e,t){var r={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return Yhe(r,e,t),r.seriesInvolved&&qhe(r,e),r}function Yhe(e,t,r){var n=t.getComponent("tooltip"),a=t.getComponent("axisPointer"),i=a.get("link",!0)||[],o=[];R(r.getCoordinateSystems(),function(s){if(!s.axisPointerEnabled)return;var l=gm(s.model),u=e.coordSysAxesInfo[l]={};e.coordSysMap[l]=s;var c=s.model,h=c.getModel("tooltip",n);if(R(s.getAxes(),nt(m,!1,null)),s.getTooltipAxes&&n&&h.get("show")){var f=h.get("trigger")==="axis",v=h.get(["axisPointer","type"])==="cross",g=s.getTooltipAxes(h.get(["axisPointer","axis"]));(f||v)&&R(g.baseAxes,nt(m,v?"cross":!0,f)),v&&R(g.otherAxes,nt(m,"cross",!1))}function m(y,x,_){var w=_.model.getModel("axisPointer",a),S=w.get("show");if(!(!S||S==="auto"&&!y&&!NA(w))){x==null&&(x=w.get("triggerTooltip")),w=y?Xhe(_,h,a,t,y,x):w;var C=w.get("snap"),M=w.get("triggerEmphasis"),A=gm(_.model),I=x||C||_.type==="category",k=e.axesInfo[A]={key:A,axis:_,coordSys:s,axisPointerModel:w,triggerTooltip:x,triggerEmphasis:M,involveSeries:I,snap:C,useHandle:NA(w),seriesModels:[],linkGroup:null};u[A]=k,e.seriesInvolved=e.seriesInvolved||I;var P=Khe(i,_);if(P!=null){var D=o[P]||(o[P]={axesInfo:{}});D.axesInfo[A]=k,D.mapper=i[P].mapper,k.linkGroup=D}}}})}function Xhe(e,t,r,n,a,i){var o=t.getModel("axisPointer"),s=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],l={};R(s,function(f){l[f]=ke(o.get(f))}),l.snap=e.type!=="category"&&!!i,o.get("type")==="cross"&&(l.type="line");var u=l.label||(l.label={});if(u.show==null&&(u.show=!1),a==="cross"){var c=o.get(["label","show"]);if(u.show=c??!0,!i){var h=l.lineStyle=o.get("crossStyle");h&&Ee(u,h.textStyle)}}return e.model.getModel("axisPointer",new vt(l,r,n))}function qhe(e,t){t.eachSeries(function(r){var n=r.coordinateSystem,a=r.get(["tooltip","trigger"],!0),i=r.get(["tooltip","show"],!0);!n||!n.model||a==="none"||a===!1||a==="item"||i===!1||r.get(["axisPointer","show"],!0)===!1||R(e.coordSysAxesInfo[gm(n.model)],function(o){var s=o.axis;n.getAxis(s.dim)===s&&(o.seriesModels.push(r),o.seriesDataCount==null&&(o.seriesDataCount=0),o.seriesDataCount+=r.getData().count())})})}function Khe(e,t){for(var r=t.model,n=t.dim,a=0;a=0||e===t}function Jhe(e){var t=gI(e);if(t){var r=t.axisPointerModel,n=t.axis.scale,a=r.option,i=r.get("status"),o=r.get("value");o!=null&&(o=n.parse(o));var s=NA(r);i==null&&(a.status=s?"show":"hide");var l=n.getExtent();(o==null||o>l[1])&&(o=l[1]),o0;return o&&s}var ode=Qe();function W5(e,t,r,n){if(e instanceof r8){var a=e.scale.type;if(a!=="ordinal")return r}var i=e.model,o=i.get("jitter");if(!(o>0))return r;var s=i.get("jitterOverlap"),l=i.get("jitterMargin")||0,u=Vn(e.scale)?Cn(e).w:null;return s?O8(r,o,u,n):sde(e,t,r,n,o,l)}function O8(e,t,r,n){if(r===null)return e+(Math.random()-.5)*t;var a=r-n*2,i=Math.min(Math.max(0,t),a);return e+(Math.random()-.5)*i}function sde(e,t,r,n,a,i){var o=ode(e);o.items||(o.items=[]);var s=o.items,l=$5(s,t,r,n,a,i,1),u=$5(s,t,r,n,a,i,-1),c=Math.abs(l-r)a/2||h&&f>h/2-n?O8(r,a,h,n):(s.push({fixedCoord:t,floatCoord:c,r:n}),c)}function $5(e,t,r,n,a,i,o){for(var s=r,l=0;la/2)return Number.MAX_VALUE;if(o===1&&g>s||o===-1&&g0&&!m.min?m.min=0:m.min!=null&&m.min<0&&!m.max&&(m.max=0);var y=u;m.color!=null&&(y=Ee({color:m.color},u));var x=Je(ke(m),{boundaryGap:r,splitNumber:n,clockwise:a,scale:i,axisLine:o,axisTick:s,axisLabel:l,name:m.text,showName:c,nameLocation:"end",nameGap:f,nameTextStyle:y,triggerEvent:v},!1);if(ve(h)){var _=x.name;x.name=h.replace("{value}",_??"")}else Le(h)&&(x.name=h(x.name,x));var w=new vt(x,null,this.ecModel);return kr(w,Tv.prototype),w.mainType="radar",w.componentIndex=this.componentIndex,w.uid=Oh("ec_radar"),w},this);this._indicatorModels=g},t.prototype.getIndicatorModels=function(){return this._indicatorModels},t.type=z8,t.defaultOption={z:0,center:["50%","50%"],radius:"50%",startAngle:90,clockwise:!1,axisName:{show:!0,color:K.color.axisLabel},boundaryGap:[0,0],splitNumber:B8,axisNameGap:15,scale:!1,shape:"polygon",axisLine:Je({lineStyle:{color:K.color.neutral20}},dp.axisLine),axisLabel:E0(dp.axisLabel,!1),axisTick:E0(dp.axisTick,!1),splitLine:E0(dp.splitLine,!0),splitArea:E0(dp.splitArea,!0),indicator:[]},t}(ht),gde=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){var i=this.group;i.removeAll(),this._buildAxes(r,a),this._buildSplitLineAndArea(r)},t.prototype._buildAxes=function(r,n){var a=r.coordinateSystem,i=a.getIndicatorAxes(),o=oe(i,function(s){var l=s.model.get("showName")?s.name:"",u=new Jn(s.model,n,{axisName:l,position:[a.cx,a.cy],rotation:s.angle,labelDirection:-1,tickDirection:-1,nameDirection:1});return u});R(o,function(s){s.build(),this.group.add(s.group)},this)},t.prototype._buildSplitLineAndArea=function(r){var n=r.coordinateSystem,a=n.getIndicatorAxes();if(!a.length)return;var i=r.get("shape"),o=r.getModel("splitLine"),s=r.getModel("splitArea"),l=o.getModel("lineStyle"),u=s.getModel("areaStyle"),c=o.get("show"),h=s.get("show"),f=l.get("color"),v=u.get("color"),g=ae(f)?f:[f],m=ae(v)?v:[v],y=[],x=[];function _(H,V,U){var F=U%V.length;return H[F]=H[F]||[],F}if(i==="circle")for(var w=a[0].getTicksCoords(),S=n.cx,C=n.cy,M=0;M3?1.4:o>1?1.2:1.1,c=i>0?u:1/u;this._checkTriggerMoveZoom(this,"zoom","zoomOnMouseWheel",r,{scale:c,originX:s,originY:l,isAvailableBehavior:null})}if(a){var h=Math.abs(i),f=(i>0?1:-1)*(h>3?.4:h>1?.15:.05);this._checkTriggerMoveZoom(this,"scrollMove","moveOnMouseWheel",r,{scrollDelta:f,originX:s,originY:l,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(r){if(!(X5(this._zr,"globalPan")||fp(r))){var n=r.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,"zoom",null,r,{scale:n,originX:r.pinchX,originY:r.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(r,n,a,i,o){r._checkPointer(i,o.originX,o.originY)&&(Vs(i.event),i.__ecRoamConsumed=!0,q5(r,n,a,i,o))},t}(bi);function fp(e){return e.__ecRoamConsumed}var Mde=Qe();function nw(e){var t=Mde(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function vp(e,t,r,n){for(var a=nw(e),i=a.roam,o=i[t]=i[t]||[],s=0;s=4&&(c={x:parseFloat(f[0]||0),y:parseFloat(f[1]||0),width:parseFloat(f[2]),height:parseFloat(f[3])})}if(c&&s!=null&&l!=null&&(h=H8(c,{x:0,y:0,width:s,height:l}),!r.ignoreViewBox)){var v=a;a=new De,a.add(v),v.scaleX=v.scaleY=h.scale,v.x=h.x,v.y=h.y}return!r.ignoreRootClip&&s!=null&&l!=null&&a.setClipPath(new it({shape:{x:0,y:0,width:s,height:l}})),{root:a,width:s,height:l,viewBoxRect:c,viewBoxTransform:h,named:i}},e.prototype._parseNode=function(t,r,n,a,i,o){var s=t.nodeName.toLowerCase(),l,u=a;if(s==="defs"&&(i=!0),s==="text"&&(o=!0),s==="defs"||s==="switch")l=r;else{if(!i){var c=zC[s];if(c&&Se(zC,s)){l=c.call(this,t,r);var h=t.getAttribute("name");if(h){var f={name:h,namedFrom:null,svgNodeTagLower:s,el:l};n.push(f),s==="g"&&(u=f)}else a&&n.push({name:a.name,namedFrom:a,svgNodeTagLower:s,el:l});r.add(l)}}var v=Q5[s];if(v&&Se(Q5,s)){var g=v.call(this,t),m=t.getAttribute("id");m&&(this._defs[m]=g)}}if(l&&l.isGroup)for(var y=t.firstChild;y;)y.nodeType===1?this._parseNode(y,l,n,u,i,o):y.nodeType===3&&o&&this._parseText(y,l),y=y.nextSibling},e.prototype._parseText=function(t,r){var n=new jf({style:{text:t.textContent},silent:!0,x:this._textX||0,y:this._textY||0});$a(r,n),Sa(t,n,this._defsUsePending,!1,!1),Lde(n,r);var a=n.style,i=a.fontSize;i&&i<9&&(a.fontSize=9,n.scaleX*=i/9,n.scaleY*=i/9);var o=(a.fontSize||a.fontFamily)&&[a.fontStyle,a.fontWeight,(a.fontSize||12)+"px",a.fontFamily||"sans-serif"].join(" ");a.font=o;var s=n.getBoundingRect();return this._textX+=s.width,r.add(n),n},e.internalField=function(){zC={g:function(t,r){var n=new De;return $a(r,n),Sa(t,n,this._defsUsePending,!1,!1),n},rect:function(t,r){var n=new it;return $a(r,n),Sa(t,n,this._defsUsePending,!1,!1),n.setShape({x:parseFloat(t.getAttribute("x")||"0"),y:parseFloat(t.getAttribute("y")||"0"),width:parseFloat(t.getAttribute("width")||"0"),height:parseFloat(t.getAttribute("height")||"0")}),n.silent=!0,n},circle:function(t,r){var n=new Ko;return $a(r,n),Sa(t,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),r:parseFloat(t.getAttribute("r")||"0")}),n.silent=!0,n},line:function(t,r){var n=new Tr;return $a(r,n),Sa(t,n,this._defsUsePending,!1,!1),n.setShape({x1:parseFloat(t.getAttribute("x1")||"0"),y1:parseFloat(t.getAttribute("y1")||"0"),x2:parseFloat(t.getAttribute("x2")||"0"),y2:parseFloat(t.getAttribute("y2")||"0")}),n.silent=!0,n},ellipse:function(t,r){var n=new Hm;return $a(r,n),Sa(t,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),rx:parseFloat(t.getAttribute("rx")||"0"),ry:parseFloat(t.getAttribute("ry")||"0")}),n.silent=!0,n},polygon:function(t,r){var n=t.getAttribute("points"),a;n&&(a=r3(n));var i=new Sn({shape:{points:a||[]},silent:!0});return $a(r,i),Sa(t,i,this._defsUsePending,!1,!1),i},polyline:function(t,r){var n=t.getAttribute("points"),a;n&&(a=r3(n));var i=new un({shape:{points:a||[]},silent:!0});return $a(r,i),Sa(t,i,this._defsUsePending,!1,!1),i},image:function(t,r){var n=new Qr;return $a(r,n),Sa(t,n,this._defsUsePending,!1,!1),n.setStyle({image:t.getAttribute("xlink:href")||t.getAttribute("href"),x:+t.getAttribute("x"),y:+t.getAttribute("y"),width:+t.getAttribute("width"),height:+t.getAttribute("height")}),n.silent=!0,n},text:function(t,r){var n=t.getAttribute("x")||"0",a=t.getAttribute("y")||"0",i=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0";this._textX=parseFloat(n)+parseFloat(i),this._textY=parseFloat(a)+parseFloat(o);var s=new De;return $a(r,s),Sa(t,s,this._defsUsePending,!1,!0),s},tspan:function(t,r){var n=t.getAttribute("x"),a=t.getAttribute("y");n!=null&&(this._textX=parseFloat(n)),a!=null&&(this._textY=parseFloat(a));var i=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0",s=new De;return $a(r,s),Sa(t,s,this._defsUsePending,!1,!0),this._textX+=parseFloat(i),this._textY+=parseFloat(o),s},path:function(t,r){var n=t.getAttribute("d")||"",a=I7(n);return $a(r,a),Sa(t,a,this._defsUsePending,!1,!1),a.silent=!0,a}}}(),e}(),Q5={lineargradient:function(e){var t=parseInt(e.getAttribute("x1")||"0",10),r=parseInt(e.getAttribute("y1")||"0",10),n=parseInt(e.getAttribute("x2")||"10",10),a=parseInt(e.getAttribute("y2")||"0",10),i=new Eh(t,r,n,a);return e3(e,i),t3(e,i),i},radialgradient:function(e){var t=parseInt(e.getAttribute("cx")||"0",10),r=parseInt(e.getAttribute("cy")||"0",10),n=parseInt(e.getAttribute("r")||"0",10),a=new eL(t,r,n);return e3(e,a),t3(e,a),a}};function e3(e,t){var r=e.getAttribute("gradientUnits");r==="userSpaceOnUse"&&(t.global=!0)}function t3(e,t){for(var r=e.firstChild;r;){if(r.nodeType===1&&r.nodeName.toLocaleLowerCase()==="stop"){var n=r.getAttribute("offset"),a=void 0;n&&n.indexOf("%")>0?a=parseInt(n,10)/100:n?a=parseFloat(n):a=0;var i={};G8(r,i,i);var o=i.stopColor||r.getAttribute("stop-color")||"#000000",s=i.stopOpacity||r.getAttribute("stop-opacity");if(s){var l=zn(o),u=l&&l[3];u&&(l[3]*=ks(s),o=ui(l,"rgba"))}t.colorStops.push({offset:a,color:o})}r=r.nextSibling}}function $a(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),Ee(t.__inheritedStyle,e.__inheritedStyle))}function r3(e){for(var t=aw(e),r=[],n=0;n0;i-=2){var o=n[i],s=n[i-1],l=aw(o);switch(a=a||ar(),s){case"translate":Hi(a,a,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":_1(a,a,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Js(a,a,-parseFloat(l[0])*BC,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*BC);ja(a,[1,0,u,1,0,0],a);break;case"skewY":var c=Math.tan(parseFloat(l[0])*BC);ja(a,[1,c,0,1,0,0],a);break;case"matrix":a[0]=parseFloat(l[0]),a[1]=parseFloat(l[1]),a[2]=parseFloat(l[2]),a[3]=parseFloat(l[3]),a[4]=parseFloat(l[4]),a[5]=parseFloat(l[5]);break}}t.setLocalTransform(a)}}var a3=/([^\s:;]+)\s*:\s*([^:;]+)/g;function G8(e,t,r){var n=e.getAttribute("style");if(n){a3.lastIndex=0;for(var a;(a=a3.exec(n))!=null;){var i=a[1],o=Se(yb,i)?yb[i]:null;o&&(t[o]=a[2]);var s=Se(xb,i)?xb[i]:null;s&&(r[s]=a[2])}}}function Rde(e,t,r){for(var n=0;n1e-6;mp[0]=o?(a[0]-n.x)/i:a[0],mp[1]=o?(a[1]-n.y)/i:a[1],dr(mp,mp,e.mtRawInv);var s=sfe(e,mp);d3(t,s,i),R(r,function(l){l!==t&&d3(l,s.slice(),i)})}var mp=[];function d3(e,t,r){var n=e.option;n.center=t,n.zoom=r}function wI(e,t){if(t){var r=t.min||0,n=t.max||1/0;e=Math.max(Math.min(n,e),r)}return e}function J8(e,t){var r=t.getShallow("nodeScaleRatio",!0)||1,n=e;return((n.zoom-1)*r+1)/(n.trans[$o].scaleX||1)}function sw(e,t,r,n,a,i,o,s){var l=wb(e);if(!l){r.disable();return}r.enable(Te(e.get("roam"),o),{api:t,zInfo:{component:e},triggerInfo:{roamTrigger:e.get("roamTrigger"),isInSelf:n,isInClip:function(c,h,f){return!a||a.contain(h,f)}}});function u(c){var h=e.mainType,f=sL(Ee({type:e9(h,e.subType,p7)},c));s&&(f.componentType=h),f[h+"Id"]=e.id,t.dispatchAction(f)}r.off("pan").off("zoom").on("pan",function(c){i&&i("pan"),u({dx:c.dx,dy:c.dy})}).on("zoom",function(c){i&&i("zoom"),u({zoom:c.scale,originX:c.originX,originY:c.originY})})}function Q8(e){return function(t,r,n){return HC.copy(e.getBoundingRect()),HC.applyTransform(e.getComputedTransform()),HC.contain(r,n)}}var HC=new je(0,0,0,0);function SI(e,t,r){var n=e9(t,r,p7);e.registerAction({type:n,event:n,update:"none"},function(a,i,o){i.eachComponent(Hk(a,t,r),function(s){Y8(a,s),X8(a,s,i,o)})})}function e9(e,t,r){return(e!==Ho?e:t==="map"?"geo":t)+r}function t9(e){return e.zoom!=null}function CI(e,t,r,n,a,i,o){var s=new iw(null,K8(e.ecModel,t));return ow(s,r,n,a,i),o?bb(s,o.x,o.y,o.width,o.height):bb(s,r,n,a,i),_I(s,e),s}var TI=["rect","circle","line","ellipse","polygon","polyline","path"],ufe=we(TI),cfe=we(TI.concat(["g"])),hfe=we(TI.concat(["g"])),r9=Qe();function B0(e){var t=e.getItemStyle(),r=e.get("areaColor");return r!=null&&(t.fill=r),t}function f3(e){var t=e.style;t&&(t.stroke=t.stroke||t.fill,t.fill=null)}var n9=function(){function e(t){var r=this.group=new De,n=this._transformGroup=new De;r.add(n),this.uid=Oh("ec_map_draw"),this._controller=new Hh(t.getZr()),n.add(this._regionsGroup=new De),n.add(this._svgGroup=new De)}return e.prototype.draw=function(t,r,n,a,i){var o=this,s=t.getData&&t.getData();xf(t)&&r.eachComponent({mainType:"series",subType:"map"},function(m){!s&&m.getHostGeoModel()===t&&(s=m.getData())});var l=t.coordinateSystem,u=l.view,c=this._regionsGroup,h=this._transformGroup,f=!c.childAt(0)||i,v;l.shouldClip()?(v=yI(null,u),this.group.setClipPath(new it({shape:v.clone()}))):this.group.removeClipPath(),lu(h,yh,u,f?null:t);var g=s&&s.getVisual("visualMeta")&&s.getVisual("visualMeta").length>0;l.resourceType==="geoJSON"?this._buildGeoJSON(u,n,l,t,s,g):l.resourceType==="geoSVG"&&this._buildSVG(u,n,l,t,s,g),sw(t,n,this._controller,function(m,y,x){return t.coordinateSystem.containPoint([y,x])},v,function(){o._mouseDownFlag=!1},!1,!0),this._updateMapSelectHandler(t,c,n,a)},e.prototype.__updateOnOwnRoam=function(t){lu(this._transformGroup,yh,t.coordinateSystem.view,null)},e.prototype._buildGeoJSON=function(t,r,n,a,i,o){var s=this._regionsGroupByName=we(),l=we(),u=this._regionsGroup,c=n.projection,h=c&&c.stream,f=ou(ym(null,t,mh));function v(y,x){return x&&(y=x(y)),y&&dr([],y,f)}function g(y){for(var x=[],_=!h&&c&&c.project,w=0;w=0)&&(c=e);var h=o?{normal:{align:"center",verticalAlign:"middle"}}:null;Jr(r,Gr(a),{labelFetcher:c,labelDataIndex:u,defaultText:n},h);var f=r.getTextContent();if(f&&(r9(f).ignore=f.ignore,r.textConfig&&o)){var v=r.getBoundingRect().clone();r.textConfig.layoutRect=v,r.textConfig.position=[(o[0]-v.x)/v.width*100+"%",(o[1]-v.y)/v.height*100+"%"]}r.disableLabelAnimation=!0}else r.removeTextContent(),r.removeTextConfig(),r.disableLabelAnimation=null}function g3(e,t,r,n,a,i){t?t.setItemGraphicEl(i,r):Be(r).eventData={componentType:"geo",componentIndex:e.componentIndex,geoIndex:e.componentIndex,name:n,region:a&&a.option||{}}}function m3(e,t,r,n,a){t||el({el:r,componentModel:e,itemName:n,itemTooltipOption:a.get("tooltip")})}function y3(e,t,r,n){t.highDownSilentOnTouch=!!e.get("selectedMode");var a=n.getModel("emphasis"),i=a.get("focus");return ir(t,i,a.get("blurScope"),a.get("disabled")),xf(e)&&rne(t,e,r),i}function x3(e,t,r){var n=[],a;function i(){a=[]}function o(){a.length&&(n.push(a),a=[])}var s=t({polygonStart:i,polygonEnd:o,lineStart:i,lineEnd:o,point:function(l,u){isFinite(l)&&isFinite(u)&&a.push([l,u])},sphere:function(){}});return!r&&s.polygonStart(),R(e,function(l){s.lineStart();for(var u=0;u-1&&(a.style.stroke=a.style.fill,a.style.fill=K.color.neutral00,a.style.lineWidth=2),a},t.prototype.__ownRoamView=function(){return Sb(this)?this.coordinateSystem.view:null},t.type="series."+xh,t.dependencies=["geo"],t.layoutMode="box",t.defaultOption={z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:null,showLegendSymbol:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,selectedMode:!0,label:{show:!1,color:K.color.tertiary},itemStyle:{borderWidth:.5,borderColor:K.color.border,areaColor:K.color.background},emphasis:{label:{show:!0,color:K.color.primary},itemStyle:{areaColor:K.color.highlight}},select:{label:{show:!0,color:K.color.primary},itemStyle:{color:K.color.highlight}},nameProperty:"name"},t}(Ut);function a9(e){return e.indexOf("i")===0}function Sb(e){return xm(e.seriesGroup)===e&&!e.getHostGeoModel()}function xm(e){return e.f[0]}function MI(e,t){var r={};return e.eachRawSeriesByType(xh,function(n){var a=n.getHostGeoModel(),i=a?"o"+a.id:"i"+n.getMapType(),o=r[i]=r[i]||{f:[],r:[]};!e.isSeriesFiltered(n)&&!t&&o.f.push(n),o.r.push(n)}),r}var ffe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=xh,r}return t.prototype.render=function(r,n,a,i){if(!(i&&i.type==="mapToggleSelect"&&i.from===this.uid)){var o=this.group;if(o.removeAll(),!r.getHostGeoModel()){var s=this._mapDraw;s&&i&&i.type==="geoRoam"&&s.resetForLabelLayout(),i&&i.type==="geoRoam"&&i.componentType==="series"&&i.seriesId===r.id?s&&o.add(s.group):Sb(r)?(s=s||(this._mapDraw=new n9(a)),o.add(s.group),s.draw(r,n,a,this,i)):this._clearMapDraw(),r.get("showLegendSymbol")&&n.getComponent("legend")&&this._renderSymbols(r)}}},t.prototype.__updateOnOwnRoam=function(r,n,a){var i=this._mapDraw;Sb(n)&&i&&i.__updateOnOwnRoam(n)},t.prototype.remove=function(){this._clearMapDraw(),this.group.removeAll()},t.prototype.dispose=function(){this._clearMapDraw()},t.prototype._clearMapDraw=function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null},t.prototype._renderSymbols=function(r){var n=r.originalData,a=this.group;n.each(n.mapDimension("value"),function(i,o){if(!isNaN(i)){var s=n.getItemLayout(o);if(!(!s||!s.point)){var l=s.point,u=s.offset,c=new Ko({style:{fill:r.getData().getVisual("style").fill},shape:{cx:l[0]+u*9,cy:l[1],r:3},silent:!0,z2:8+(u?0:cv+1)});if(!u){var h=xm(r.seriesGroup).getData(),f=n.getName(o),v=h.indexOfName(f),g=n.getItemModel(o),m=g.getModel("label"),y=h.getItemGraphicEl(v);Jr(c,Gr(g),{labelFetcher:{getFormattedLabel:function(x,_){return r.getFormattedLabel(v,_)}},defaultText:f}),c.disableLabelAnimation=!0,m.get("position")||c.setTextConfig({position:"bottom"}),y.onHoverStateChange=function(x){V_(c,x)}}a.add(c)}}})},t.type=xh,t}(Rt),vfe={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},i9=["lng","lat"],_3=function(e){X(t,e);function t(r,n,a){var i=e.call(this)||this;i.dimensions=i9,i.type="geo",i._nameCoordMap=we(),i.name=r;var o=a.projection,s=Ys.load(n,a.nameMap,a.nameProperty),l=Ys.getGeoResource(n);i.resourceType=l?l.type:null;var u=i.regions=s.regions,c=vfe[l.type];i._clip=a.clip;var h=o?!1:c.invertLongitute;i.view=new iw(h,K8(a.ecModel,a.api),i),i.map=n,i._regionsMap=s.regionsMap,i.regions=s.regions,i.projection=o;var f;if(o)for(var v=0;v1?(S.width=w,S.height=w/y):(S.height=w,S.width=w*y),S.y=_[1]-S.height/2,S.x=_[0]-S.width/2;else{var C=e.getBoxLayoutParams();C.aspect=y,S=tr(C,m),S=xH(e,S,y)}bb(r,S.x,S.y,S.width,S.height),_I(r,e)}function pfe(e,t){R(t.get("geoCoord"),function(r,n){e.addGeoCoord(n,r)})}var gfe=function(){function e(){this.dimensions=i9}return e.prototype.create=function(t,r){var n=[];function a(i){return{nameProperty:i.get("nameProperty"),aspectScale:i.get("aspectScale"),projection:i.get("projection"),clip:i.getShallow("clip",!0)}}return t.eachComponent("geo",function(i,o){var s=i.get("map"),l=new _3(s+o,s,te({nameMap:i.get("nameMap"),api:r,ecModel:t},a(i)));n.push(l),i.coordinateSystem=l,l.model=i,l.resize=w3,l.resize(i,r)}),t.eachSeries(function(i){Ym({targetModel:i,coordSysType:"geo",coordSysProvider:function(){var o=i.subType===xh?i.getHostGeoModel():i.getReferringComponents("geo",pr).models[0];return o&&o.coordinateSystem},allowNotFound:!0})}),R(MI(t,!0),function(i,o){if(a9(o)){var s=i.r[0],l=[];R(i.r,function(f){l.push(f.get("nameMap")),f.seriesGroup=null});var u=o.slice(1),c=new _3(u,u,te({nameMap:y1(l),api:r,ecModel:t},a(s))),h;R(i.r,function(f){h=Te(h,f.get("scaleLimit"))}),n.push(c),c.resize=w3,c.resize(s,r),R(i.r,function(f){f.coordinateSystem=c,pfe(c,f)})}}),n},e.prototype.getFilledRegions=function(t,r,n,a){for(var i=(t||[]).slice(),o=we(),s=0;s=0;o--){var s=a[o];s.hierNode={defaultAncestor:null,ancestor:s,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},r.push(s)}}function Afe(e,t){var r=e.isExpand?e.children:[],n=e.parentNode.children,a=e.hierNode.i?n[e.hierNode.i-1]:null;if(r.length){kfe(e);var i=(r[0].hierNode.prelim+r[r.length-1].hierNode.prelim)/2;a?(e.hierNode.prelim=a.hierNode.prelim+t(e,a),e.hierNode.modifier=e.hierNode.prelim-i):e.hierNode.prelim=i}else a&&(e.hierNode.prelim=a.hierNode.prelim+t(e,a));e.parentNode.hierNode.defaultAncestor=Lfe(e,a,e.parentNode.hierNode.defaultAncestor||n[0],t)}function Nfe(e){var t=e.hierNode.prelim+e.parentNode.hierNode.modifier;e.setLayout({x:t},!0),e.hierNode.modifier+=e.parentNode.hierNode.modifier}function S3(e){return arguments.length?e:Dfe}function Gp(e,t){return e-=Math.PI/2,{x:t*Math.cos(e),y:t*Math.sin(e)}}function kfe(e){for(var t=e.children,r=t.length,n=0,a=0;--r>=0;){var i=t[r];i.hierNode.prelim+=n,i.hierNode.modifier+=n,a+=i.hierNode.change,n+=i.hierNode.shift+a}}function Lfe(e,t,r,n){if(t){for(var a=e,i=e,o=i.parentNode.children[0],s=t,l=a.hierNode.modifier,u=i.hierNode.modifier,c=o.hierNode.modifier,h=s.hierNode.modifier;s=UC(s),i=WC(i),s&&i;){a=UC(a),o=WC(o),a.hierNode.ancestor=e;var f=s.hierNode.prelim+h-i.hierNode.prelim-u+n(s,i);f>0&&(Pfe(Ife(s,e,r),e,f),u+=f,l+=f),h+=s.hierNode.modifier,u+=i.hierNode.modifier,l+=a.hierNode.modifier,c+=o.hierNode.modifier}s&&!UC(a)&&(a.hierNode.thread=s,a.hierNode.modifier+=h-l),i&&!WC(o)&&(o.hierNode.thread=i,o.hierNode.modifier+=u-c,r=e)}return r}function UC(e){var t=e.children;return t.length&&e.isExpand?t[t.length-1]:e.hierNode.thread}function WC(e){var t=e.children;return t.length&&e.isExpand?t[0]:e.hierNode.thread}function Ife(e,t,r){return e.hierNode.ancestor.parentNode===t.parentNode?e.hierNode.ancestor:r}function Pfe(e,t,r){var n=r/(t.hierNode.i-e.hierNode.i);t.hierNode.change-=n,t.hierNode.shift+=r,t.hierNode.modifier+=r,t.hierNode.prelim+=r,e.hierNode.change+=n}function Dfe(e,t){return e.parentNode===t.parentNode?1:2}var hi=Qe();function l9(e){var t=e.mainData,r=e.datas;r||(r={main:t},e.datasAttr={main:"data"}),e.datas=e.mainData=null,u9(t,r,e),R(r,function(n){R(t.TRANSFERABLE_METHODS,function(a){n.wrapMethod(a,nt(jfe,e))})}),t.wrapMethod("cloneShallow",nt(Rfe,e)),R(t.CHANGABLE_METHODS,function(n){t.wrapMethod(n,nt(Efe,e))}),bn(r[t.dataType]===t)}function jfe(e,t){if(Bfe(this)){var r=te({},hi(this).datas);r[this.dataType]=t,u9(t,r,e)}else AI(t,this.dataType,hi(this).mainData,e);return t}function Efe(e,t){return e.struct&&e.struct.update(),t}function Rfe(e,t){return R(hi(t).datas,function(r,n){r!==t&&AI(r.cloneShallow(),n,t,e)}),t}function Ofe(e){var t=hi(this).mainData;return e==null||t==null?t:hi(t).datas[e]}function zfe(){var e=hi(this).mainData;return e==null?[{data:e}]:oe(gt(hi(e).datas),function(t){return{type:t,data:hi(e).datas[t]}})}function Bfe(e){return hi(e).mainData===e}function u9(e,t,r){hi(e).datas={},R(t,function(n,a){AI(n,a,e,r)})}function AI(e,t,r,n){hi(r).datas[t]=e,hi(e).mainData=r,e.dataType=t,n.struct&&(e[n.structAttr]=n.struct,n.struct[n.datasAttr[t]]=e),e.getLinkedData=Ofe,e.getLinkedDataAll=zfe}var Ffe=function(){function e(t,r){this.depth=0,this.height=0,this.dataIndex=-1,this.children=[],this.viewChildren=[],this.isExpand=!1,this.name=t||"",this.hostTree=r}return e.prototype.isRemoved=function(){return this.dataIndex<0},e.prototype.eachNode=function(t,r,n){Le(t)&&(n=r,r=t,t=null),t=t||{},ve(t)&&(t={order:t});var a=t.order||"preorder",i=this[t.attr||"children"],o;a==="preorder"&&(o=r.call(n,this));for(var s=0;!o&&sr&&(r=a.height)}this.height=r+1},e.prototype.getNodeById=function(t){if(this.getId()===t)return this;for(var r=0,n=this.children,a=n.length;r=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,r)},e.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},e.prototype.getModel=function(t){if(!(this.dataIndex<0)){var r=this.hostTree,n=r.data.getItemModel(this.dataIndex);return n.getModel(t)}},e.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},e.prototype.setVisual=function(t,r){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,r)},e.prototype.getVisual=function(t){return this.hostTree.data.getItemVisual(this.dataIndex,t)},e.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},e.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},e.prototype.getChildIndex=function(){if(this.parentNode){for(var t=this.parentNode.children,r=0;r=0){var n=r.getData().tree.root,a=e.targetNode;if(ve(a)&&(a=n.getNodeById(a)),a&&n.contains(a))return{node:a};var i=e.targetNodeId;if(i!=null&&(a=n.getNodeById(i)))return{node:a}}}function c9(e){for(var t=[];e;)e=e.parentNode,e&&t.push(e);return t.reverse()}function kI(e,t){var r=c9(e);return Ye(r,t)>=0}function lw(e,t){for(var r=[];e;){var n=e.dataIndex;r.push({name:e.name,dataIndex:n,value:t.getRawValue(n)}),e=e.parentNode}return r.reverse(),r}var _h="tree",Gfe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r.ignoreStyleOnData=!0,r}return t.prototype.getInitialData=function(r){var n={name:r.name,children:r.data},a=r.leaves||{},i=new vt(a,this,this.ecModel),o=NI.createTree(n,this,s);function s(h){h.wrapMethod("getItemModel",function(f,v){var g=o.getNodeByDataIndex(v);return g&&g.children.length&&g.isExpand||(f.parentModel=i),f})}var l=0;o.eachNode("preorder",function(h){h.depth>l&&(l=h.depth)});var u=r.expandAndCollapse,c=u&&r.initialTreeDepth>=0?r.initialTreeDepth:l;return o.root.eachNode("preorder",function(h){var f=h.hostTree.data.getRawDataItem(h.dataIndex);h.isExpand=f&&f.collapsed!=null?!f.collapsed:h.depth<=c}),o.data},t.prototype.getOrient=function(){var r=this.get("orient");return r==="horizontal"?r="LR":r==="vertical"&&(r="TB"),r},t.prototype.formatTooltip=function(r,n,a){for(var i=this.getData().tree,o=i.root.children[0],s=i.getNodeByDataIndex(r),l=s.getValue(),u=s.name;s&&s!==o;)u=s.parentNode.name+"."+u,s=s.parentNode;return Er("nameValue",{name:u,value:l,noValue:isNaN(l)||l==null})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),a=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=lw(a,this),n.collapsed=!a.isExpand,n},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type="series."+_h,t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,roamTrigger:"global",nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:K.color.borderTint,width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500},t}(Ut),Hfe=function(){function e(){this.parentPoint=[],this.childPoints=[]}return e}(),Ufe=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new Hfe},t.prototype.buildPath=function(r,n){var a=n.childPoints,i=a.length,o=n.parentPoint,s=a[0],l=a[i-1];if(i===1){r.moveTo(o[0],o[1]),r.lineTo(s[0],s[1]);return}var u=n.orient,c=u==="TB"||u==="BT"?0:1,h=1-c,f=me(n.forkPosition,1),v=[];v[c]=o[c],v[h]=o[h]+(l[h]-o[h])*f,r.moveTo(o[0],o[1]),r.lineTo(v[0],v[1]),r.moveTo(s[0],s[1]),v[c]=s[c],r.lineTo(v[0],v[1]),v[c]=l[c],r.lineTo(v[0],v[1]),r.lineTo(l[0],l[1]);for(var g=1;g_.x,C||(S=S-Math.PI));var A=C?"left":"right",I=s.getModel("label"),k=I.get("rotate"),P=k*(Math.PI/180),D=y.getTextContent();D&&(y.setTextConfig({position:I.get("position")||A,rotation:k==null?-S:P,origin:"center"}),D.setStyle("verticalAlign","middle"))}var z=s.get(["emphasis","focus"]),j=z==="relative"?Lf(o.getAncestorsIndices(),o.getDescendantIndices()):z==="ancestor"?o.getAncestorsIndices():z==="descendant"?o.getDescendantIndices():null;j&&(Be(r).focus=j),$fe(a,o,c,r,g,v,m,n),r.__edge&&(r.onHoverStateChange=function(B){if(B!=="blur"){var H=o.parentNode&&e.getItemGraphicEl(o.parentNode.dataIndex);H&&H.hoverState===Gm||V_(r.__edge,B)}})}function $fe(e,t,r,n,a,i,o,s){var l=t.getModel(),u=e.get("edgeShape"),c=e.get("layout"),h=e.getOrient(),f=e.get(["lineStyle","curveness"]),v=e.get("edgeForkPosition"),g=l.getModel("lineStyle").getLineStyle(),m=n.__edge;if(u==="curve")t.parentNode&&t.parentNode!==r&&(m||(m=n.__edge=new dv({shape:PA(c,h,f,a,a)})),At(m,{shape:PA(c,h,f,i,o)},e));else if(u==="polyline"&&c==="orthogonal"&&t!==r&&t.children&&t.children.length!==0&&t.isExpand===!0){for(var y=t.children,x=[],_=0;_=0;i--)r.push(a[i])}}function Yfe(e,t){e.eachSeriesByType("tree",function(r){Xfe(r,t)})}function Xfe(e,t){var r=Ur(e,t).refContainer,n=tr(e.getBoxLayoutParams(),r);e.layoutInfo=n;var a=e.get("layout"),i=0,o=0,s=null;a==="radial"?(i=2*Math.PI,o=Math.min(n.height,n.width)/2,s=S3(function(S,C){return(S.parentNode===C.parentNode?1:2)/S.depth})):(i=n.width,o=n.height,s=S3());var l=e.getData().tree.root,u=l.children[0];if(u){Mfe(l),Zfe(u,Afe,s),l.hierNode.modifier=-u.hierNode.prelim,yp(u,Nfe);var c=u,h=u,f=u;yp(u,function(S){var C=S.getLayout().x;Ch.getLayout().x&&(h=S),S.depth>f.depth&&(f=S)});var v=c===h?1:s(c,h)/2,g=v-c.getLayout().x,m=0,y=0,x=0,_=0;if(a==="radial")m=i/(h.getLayout().x+v+g),y=o/(f.depth-1||1),yp(u,function(S){x=(S.getLayout().x+g)*m,_=(S.depth-1)*y;var C=Gp(x,_);S.setLayout({x:C.x,y:C.y,rawX:x,rawY:_},!0)});else{var w=e.getOrient();w==="RL"||w==="LR"?(y=o/(h.getLayout().x+v+g),m=i/(f.depth-1||1),yp(u,function(S){_=(S.getLayout().x+g)*y,x=w==="LR"?(S.depth-1)*m:i-(S.depth-1)*m,S.setLayout({x,y:_},!0)})):(w==="TB"||w==="BT")&&(m=i/(h.getLayout().x+v+g),y=o/(f.depth-1||1),yp(u,function(S){x=(S.getLayout().x+g)*m,_=w==="TB"?(S.depth-1)*y:o-(S.depth-1)*y,S.setLayout({x,y:_},!0)}))}}}function qfe(e){e.registerAction({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(t,r){r.eachComponent({mainType:Ho,subType:_h,query:t},function(n){var a=t.dataIndex,i=n.getData().tree,o=i.getNodeByDataIndex(a);o.isExpand=!o.isExpand})}),SI(e,Ho,_h)}var Kfe=Hr(_h,Jfe);function Jfe(e){e.eachSeriesByType(_h,function(t){var r=t.getData(),n=r.tree;n.eachNode(function(a){var i=a.getModel(),o=i.getModel("itemStyle").getItemStyle(),s=r.ensureUniqueItemVisual(a.dataIndex,"style");te(s,o)})})}function Qfe(e){e.registerChartView(Wfe),e.registerSeriesModel(Gfe),e.registerLayout(Yfe),e.registerVisual(Kfe),qfe(e)}var N3=["treemapZoomToNode","treemapRender","treemapMove"];function eve(e){for(var t=0;t1;)i=i.parentNode;var o=YM(e.ecModel,i.name||i.dataIndex+"",n);a.setVisual("decal",o)})}var tve=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.preventUsingHoverLayer=!0,r}return t.prototype.getInitialData=function(r,n){var a={name:r.name,children:r.data};f9(a);var i=r.levels||[],o=this.designatedVisualItemStyle={},s=new vt({itemStyle:o},this,n);i=r.levels=rve(i,n);var l=oe(i||[],function(h){return new vt(h,s,n)},this),u=NI.createTree(a,this,c);function c(h){h.wrapMethod("getItemModel",function(f,v){var g=u.getNodeByDataIndex(v),m=g?l[g.depth]:null;return f.parentModel=m||s,f})}return u.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.formatTooltip=function(r,n,a){var i=this.getData(),o=this.getRawValue(r),s=i.getName(r);return Er("nameValue",{name:s,value:o})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),a=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=lw(a,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(r){this.layoutInfo=this.layoutInfo||{},te(this.layoutInfo,r)},t.prototype.mapIdToIndex=function(r){var n=this._idIndexMap;n||(n=this._idIndexMap=we(),this._idIndexMapCount=0);var a=n.get(r);return a==null&&n.set(r,a=this._idIndexMapCount++),a},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(r){r?this._viewRoot=r:r=this._viewRoot;var n=this.getRawData().tree.root;(!r||r!==n&&!n.contains(r))&&(this._viewRoot=n)},t.prototype.enableAriaDecal=function(){d9(this)},t.type="series.treemap",t.layoutMode="box",t.defaultOption={progressive:0,coordinateSystemUsage:"box",left:K.size.l,top:K.size.xxxl,right:K.size.l,bottom:K.size.xxxl,sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.32*.32,scaleLimit:{max:5,min:.2},roam:!0,roamTrigger:"global",nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",bottom:K.size.m,emptyItemWidth:25,itemStyle:{color:K.color.backgroundShade,textStyle:{color:K.color.secondary}},emphasis:{itemStyle:{color:K.color.background}}},label:{show:!0,distance:0,padding:5,position:"inside",color:K.color.neutral00,overflow:"truncate"},upperLabel:{show:!1,position:[0,"50%"],height:20,overflow:"truncate",verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:K.color.neutral00,borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],overflow:"truncate",verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},t}(Ut);function f9(e){var t=0;R(e.children,function(n){f9(n);var a=n.value;ae(a)&&(a=a[0]),t+=a});var r=e.value;ae(r)&&(r=r[0]),(r==null||isNaN(r))&&(r=t),r<0&&(r=0),ae(e.value)?e.value[0]=r:e.value=r}function rve(e,t){var r=Zt(t.get("color")),n=Zt(t.get(["aria","decal","decals"]));if(r){e=e||[];var a,i;R(e,function(s){var l=new vt(s),u=l.get("color"),c=l.get("decal");(l.get(["itemStyle","color"])||u&&u!=="none")&&(a=!0),(l.get(["itemStyle","decal"])||c&&c!=="none")&&(i=!0)});var o=e[0]||(e[0]={});return a||(o.color=r.slice()),!i&&n&&(o.decal=n.slice()),e}}var nve=8,k3=8,$C=5,ave=function(){function e(t){this.group=new De,t.add(this.group)}return e.prototype.render=function(t,r,n,a){var i=t.getModel("breadcrumb"),o=this.group;if(o.removeAll(),!(!i.get("show")||!n)){var s=i.getModel("itemStyle"),l=i.getModel("emphasis"),u=s.getModel("textStyle"),c=l.getModel(["itemStyle","textStyle"]),h=Ur(t,r).refContainer,f={left:i.get("left"),right:i.get("right"),top:i.get("top"),bottom:i.get("bottom")},v={emptyItemWidth:i.get("emptyItemWidth"),totalWidth:0,renderList:[]},g=tr(f,h);this._prepare(n,v,u),this._renderContent(t,v,g,s,l,u,c,a),V1(o,f,h)}},e.prototype._prepare=function(t,r,n){for(var a=t;a;a=a.parentNode){var i=Fr(a.getModel().get("name"),""),o=n.getTextRect(i),s=Math.max(o.width+nve*2,r.emptyItemWidth);r.totalWidth+=s+k3,r.renderList.push({node:a,text:i,width:s})}},e.prototype._renderContent=function(t,r,n,a,i,o,s,l){for(var u=0,c=r.emptyItemWidth,h=t.get(["breadcrumb","height"]),f=r.totalWidth,v=r.renderList,g=i.getModel("itemStyle").getItemStyle(),m=v.length-1;m>=0;m--){var y=v[m],x=y.node,_=y.width,w=y.text;f>n.width&&(f-=_-c,_=c,w=null);var S=new Sn({shape:{points:ive(u,0,_,h,m===v.length-1,m===0)},style:Ee(a.getItemStyle(),{lineJoin:"bevel"}),textContent:new wt({style:$t(o,{text:w})}),textConfig:{position:"inside"},z2:cv*1e4,onclick:nt(l,x)});S.disableLabelAnimation=!0,S.getTextContent().ensureState("emphasis").style=$t(s,{text:w}),S.ensureState("emphasis").style=g,ir(S,i.get("focus"),i.get("blurScope"),i.get("disabled")),this.group.add(S),ove(S,t,x),u+=_+k3}},e.prototype.remove=function(){this.group.removeAll()},e}();function ive(e,t,r,n,a,i){var o=[[a?e:e-$C,t],[e+r,t],[e+r,t+n],[a?e:e-$C,t+n]];return!i&&o.splice(2,0,[e+r+$C,t+n/2]),!a&&o.push([e,t+n/2]),o}function ove(e,t,r){Be(e).eventData={componentType:"series",componentSubType:"treemap",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:r&&r.dataIndex,name:r&&r.name},treePathInfo:r&&lw(r,t)}}var sve=function(){function e(){this._storage=[],this._elExistsMap={}}return e.prototype.add=function(t,r,n,a,i){return this._elExistsMap[t.id]?!1:(this._elExistsMap[t.id]=!0,this._storage.push({el:t,target:r,duration:n,delay:a,easing:i}),!0)},e.prototype.finished=function(t){return this._finishedCallback=t,this},e.prototype.start=function(){for(var t=this,r=this._storage.length,n=function(){r--,r<=0&&(t._storage.length=0,t._elExistsMap={},t._finishedCallback&&t._finishedCallback())},a=0,i=this._storage.length;a=0;l--){var u=a[n==="asc"?o-l-1:l].getValue();u/r*ts[1]&&(s[1]=u)})),{sum:n,dataExtent:s}}function mve(e,t,r){for(var n=0,a=1/0,i=0,o=void 0,s=e.length;in&&(n=o));var l=e.area*e.area,u=t*t*r;return l?bm(u*n/l,l/(u*a)):1/0}function L3(e,t,r,n,a){var i=t===r.width?0:1,o=1-i,s=["x","y"],l=["width","height"],u=r[s[i]],c=t?e.area/t:0;(a||c>r[l[o]])&&(c=r[l[o]]);for(var h=0,f=e.length;hYg&&(c=Yg),a=l}cP3||Math.abs(r.dy)>P3)){var n=this.seriesModel.getData().tree.root;if(!n)return;var a=n.getLayout();if(!a)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:a.x+r.dx,y:a.y+r.dy,width:a.width,height:a.height}})}},t.prototype._onZoom=function(r){var n=r.originX,a=r.originY,i=r.scale,o=this.seriesModel;if(this._state!=="animating"){var s=o.getData().tree.root;if(!s)return;var l=s.getLayout();if(!l)return;var u=new je(l.x,l.y,l.width,l.height),c=o.layoutInfo,h=y9(c,l),f=h*i;f=x9(f,o);var v=f/h;n-=c.x,a-=c.y;var g=ar();Hi(g,g,[-n,-a]),_1(g,g,[v,v]),Hi(g,g,[n,a]),u.applyTransform(g),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:u.x,y:u.y,width:u.width,height:u.height}})}},t.prototype._initEvents=function(r){var n=this;r.on("click",function(a){if(n._state==="ready"){var i=n.seriesModel.get("nodeClick",!0);if(i){var o=n.findTarget(a.offsetX,a.offsetY);if(o){var s=o.node;if(s.getLayout().isLeafRoot)n._rootToNode(o);else if(i==="zoomToNode")n._zoomToNode(o);else if(i==="link"){var l=s.hostTree.data.getItemModel(s.dataIndex),u=l.get("link",!0),c=l.get("target",!0)||"blank";u&&Z_(u,c)}}}}},this)},t.prototype._renderBreadcrumb=function(r,n,a){var i=this;a||(a=r.get("leafDepth",!0)!=null?{node:r.getViewRoot()}:this.findTarget(n.getWidth()/2,n.getHeight()/2),a||(a={node:r.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new ave(this.group))).render(r,n,a.node,function(o){i._state!=="animating"&&(kI(r.getViewRoot(),o)?i._rootToNode({node:o}):i._zoomToNode({node:o}))})},t.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=xp(),this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},t.prototype.dispose=function(){this._clearController()},t.prototype._zoomToNode=function(r){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:r.node})},t.prototype._rootToNode=function(r){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:r.node})},t.prototype.findTarget=function(r,n){var a,i=this.seriesModel.getViewRoot();return i.eachNode({attr:"viewChildren",order:"preorder"},function(o){var s=this._storage.background[o.getRawIndex()];if(s){var l=s.transformCoordToLocal(r,n),u=s.shape;if(u.x<=l[0]&&l[0]<=u.x+u.width&&u.y<=l[1]&&l[1]<=u.y+u.height)a={node:o,offsetX:l[0],offsetY:l[1]};else return!1}},this),a},t.type="treemap",t}(Rt);function xp(){return{nodeGroup:[],background:[],content:[]}}function Cve(e,t,r,n,a,i,o,s,l,u){if(!o)return;var c=o.getLayout(),h=e.getData(),f=o.getModel();if(h.setItemGraphicEl(o.dataIndex,null),!c||!c.isInView)return;var v=c.width,g=c.height,m=c.borderWidth,y=c.invisible,x=o.getRawIndex(),_=s&&s.getRawIndex(),w=o.viewChildren,S=c.upperHeight,C=w&&w.length,M=f.getModel("itemStyle"),A=f.getModel(["emphasis","itemStyle"]),I=f.getModel(["blur","itemStyle"]),k=f.getModel(["select","itemStyle"]),P=M.get("borderRadius")||0,D=le("nodeGroup",DA);if(!D)return;if(l.add(D),D.x=c.x||0,D.y=c.y||0,D.markRedraw(),Tb(D).nodeWidth=v,Tb(D).nodeHeight=g,c.isAboveViewRoot)return D;var z=le("background",I3,u,bve);z&&$(D,z,C&&c.upperLabelHeight);var j=f.getModel("emphasis"),B=j.get("focus"),H=j.get("blurScope"),V=j.get("disabled"),U=B==="ancestor"?o.getAncestorsIndices():B==="descendant"?o.getDescendantIndices():B;if(C)Kg(D)&&Ic(D,!1),z&&(Ic(z,!V),h.setItemGraphicEl(o.dataIndex,z),OM(z,U,H));else{var F=le("content",I3,u,wve);F&&Z(D,F),z.disableMorphing=!0,z&&Kg(z)&&Ic(z,!1),Ic(D,!V),h.setItemGraphicEl(o.dataIndex,D);var W=f.getShallow("cursor");W&&F.attr("cursor",W),OM(D,U,H)}return D;function $(ye,ne,xe){var he=Be(ne);if(he.dataIndex=o.dataIndex,he.seriesIndex=e.seriesIndex,ne.setShape({x:0,y:0,width:v,height:g,r:P}),y)J(ne);else{ne.invisible=!1;var ge=o.getVisual("style"),tt=ge.stroke,Ue=E3(M);Ue.fill=tt;var qe=yc(A);qe.fill=A.get("borderColor");var Fe=yc(I);Fe.fill=I.get("borderColor");var _t=yc(k);if(_t.fill=k.get("borderColor"),xe){var bt=v-2*m;re(ne,tt,ge.opacity,{x:m,y:0,width:bt,height:S})}else ne.removeTextContent();ne.setStyle(Ue),ne.ensureState("emphasis").style=qe,ne.ensureState("blur").style=Fe,ne.ensureState("select").style=_t,oh(ne)}ye.add(ne)}function Z(ye,ne){var xe=Be(ne);xe.dataIndex=o.dataIndex,xe.seriesIndex=e.seriesIndex;var he=Math.max(v-2*m,0),ge=Math.max(g-2*m,0);if(ne.culling=!0,ne.setShape({x:m,y:m,width:he,height:ge,r:P}),y)J(ne);else{ne.invisible=!1;var tt=o.getVisual("style"),Ue=tt.fill,qe=E3(M);qe.fill=Ue,qe.decal=tt.decal;var Fe=yc(A),_t=yc(I),bt=yc(k);re(ne,Ue,tt.opacity,null),ne.setStyle(qe),ne.ensureState("emphasis").style=Fe,ne.ensureState("blur").style=_t,ne.ensureState("select").style=bt,oh(ne)}ye.add(ne)}function J(ye){!ye.invisible&&i.push(ye)}function re(ye,ne,xe,he){var ge=f.getModel(he?j3:D3),tt=Fr(f.get("name"),null),Ue=ge.getShallow("show");Jr(ye,Gr(f,he?j3:D3),{defaultText:Ue?tt:null,inheritColor:ne,defaultOpacity:xe,labelFetcher:e,labelDataIndex:o.dataIndex});var qe=ye.getTextContent();if(qe){var Fe=qe.style,_t=zm(Fe.padding||0);he&&(ye.setTextConfig({layoutRect:he}),qe.disableLabelLayout=!0),qe.beforeUpdate=function(){var et=Math.max((he?he.width:ye.shape.width)-_t[1]-_t[3],0),Ke=Math.max((he?he.height:ye.shape.height)-_t[0]-_t[2],0);(Fe.width!==et||Fe.height!==Ke)&&qe.setStyle({width:et,height:Ke})},Fe.truncateMinChar=2,Fe.lineOverflow="truncate",Q(Fe,he,c);var bt=qe.getState("emphasis");Q(bt?bt.style:null,he,c)}}function Q(ye,ne,xe){var he=ye?ye.text:null;if(!ne&&xe.isLeafRoot&&he!=null){var ge=e.get("drillDownIcon",!0);ye.text=ge?ge+" "+he:he}}function le(ye,ne,xe,he){var ge=_!=null&&r[ye][_],tt=a[ye];return ge?(r[ye][_]=null,de(tt,ge)):y||(ge=new ne,ge instanceof yi&&(ge.z2=Tve(xe,he)),He(tt,ge)),t[ye][x]=ge}function de(ye,ne){var xe=ye[x]={};ne instanceof DA?(xe.oldX=ne.x,xe.oldY=ne.y):xe.oldShape=te({},ne.shape)}function He(ye,ne){var xe=ye[x]={},he=o.parentNode,ge=ne instanceof De;if(he&&(!n||n.direction==="drillDown")){var tt=0,Ue=0,qe=a.background[he.getRawIndex()];!n&&qe&&qe.oldShape&&(tt=qe.oldShape.width,Ue=qe.oldShape.height),ge?(xe.oldX=0,xe.oldY=Ue):xe.oldShape={x:tt,y:Ue,width:0,height:0}}xe.fadein=!ge}}function Tve(e,t){return e*_ve+t}var wm=R,Mve=Re,Mb=-1,Kr=function(){function e(t){var r=t.mappingMethod,n=t.type,a=this.option=ke(t);this.type=n,this.mappingMethod=r,this._normalizeData=kve[r];var i=e.visualHandlers[n];this.applyVisual=i.applyVisual,this.getColorMapper=i.getColorMapper,this._normalizedToVisual=i._normalizedToVisual[r],r==="piecewise"?(ZC(a),Ave(a)):r==="category"?a.categories?Nve(a):ZC(a,!0):(bn(r!=="linear"||a.dataExtent),ZC(a))}return e.prototype.mapValueToVisual=function(t){var r=this._normalizeData(t);return this._normalizedToVisual(r,t)},e.prototype.getNormalizer=function(){return be(this._normalizeData,this)},e.listVisualTypes=function(){return gt(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(t,r,n){Re(t)?R(t,r,n):r.call(n,t)},e.mapVisual=function(t,r,n){var a,i=ae(t)?[]:Re(t)?{}:(a=!0,null);return e.eachVisual(t,function(o,s){var l=r.call(n,o,s);a?i=l:i[s]=l}),i},e.retrieveVisuals=function(t){var r={},n;return t&&wm(e.visualHandlers,function(a,i){t.hasOwnProperty(i)&&(r[i]=t[i],n=!0)}),n?r:null},e.prepareVisualTypes=function(t){if(ae(t))t=t.slice();else if(Mve(t)){var r=[];wm(t,function(n,a){r.push(a)}),t=r}else return[];return t.sort(function(n,a){return a==="color"&&n!=="color"&&n.indexOf("color")===0?1:-1}),t},e.dependsOn=function(t,r){return r==="color"?!!(t&&t.indexOf(r)===0):t===r},e.findPieceIndex=function(t,r,n){for(var a,i=1/0,o=0,s=r.length;o=0;i--)n[i]==null&&(delete r[t[i]],t.pop())}function ZC(e,t){var r=e.visual,n=[];Re(r)?wm(r,function(i){n.push(i)}):r!=null&&n.push(r);var a={color:1,symbol:1};!t&&n.length===1&&!a.hasOwnProperty(e.type)&&(n[1]=n[0]),_9(e,n)}function F0(e){return{applyVisual:function(t,r,n){var a=this.mapValueToVisual(t);n("color",e(r("color"),a))},_normalizedToVisual:jA([0,1])}}function R3(e){var t=this.option.visual;return t[Math.round(Nt(e,[0,1],[0,t.length-1],!0))]||{}}function _p(e){return function(t,r,n){n(e,this.mapValueToVisual(t))}}function Hp(e){var t=this.option.visual;return t[this.option.loop&&e!==Mb?e%t.length:e]}function xc(){return this.option.visual[0]}function jA(e){return{linear:function(t){return Nt(t,e,this.option.visual,!0)},category:Hp,piecewise:function(t,r){var n=EA.call(this,r);return n==null&&(n=Nt(t,e,this.option.visual,!0)),n},fixed:xc}}function EA(e){var t=this.option,r=t.pieceList;if(t.hasSpecialVisual){var n=Kr.findPieceIndex(e,r),a=r[n];if(a&&a.visual)return a.visual[this.type]}}function _9(e,t){return e.visual=t,e.type==="color"&&(e.parsedVisual=oe(t,function(r){var n=zn(r);return n||[0,0,0,1]})),t}var kve={linear:function(e){return Nt(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,r=Kr.findPieceIndex(e,t,!0);if(r!=null)return Nt(r,[0,t.length-1],[0,1],!0)},category:function(e){var t=this.option.categories?this.option.categoryMap[e]:e;return t??Mb},fixed:hr};function V0(e,t,r){return e?t<=r:t=r.length||m===r[m.depth]){var x=Eve(a,l,m,y,g,n);w9(m,x,r,n)}})}}}function Pve(e,t,r){var n=te({},t),a=r.designatedVisualItemStyle;return R(["color","colorAlpha","colorSaturation"],function(i){a[i]=t[i];var o=e.get(i);a[i]=null,o!=null&&(n[i]=o)}),n}function O3(e){var t=YC(e,"color");if(t){var r=YC(e,"colorAlpha"),n=YC(e,"colorSaturation");return n&&(t=Ls(t,null,null,n)),r&&(t=Ug(t,r)),t}}function Dve(e,t){return t!=null?Ls(t,null,null,e):null}function YC(e,t){var r=e[t];if(r!=null&&r!=="none")return r}function jve(e,t,r,n,a,i){if(!(!i||!i.length)){var o=XC(t,"color")||a.color!=null&&a.color!=="none"&&(XC(t,"colorAlpha")||XC(t,"colorSaturation"));if(o){var s=t.get("visualMin"),l=t.get("visualMax"),u=r.dataExtent.slice();s!=null&&su[1]&&(u[1]=l);var c=t.get("colorMappingBy"),h={type:o.name,dataExtent:u,visual:o.range};h.type==="color"&&(c==="index"||c==="id")?(h.mappingMethod="category",h.loop=!0):h.mappingMethod="linear";var f=new Kr(h);return b9(f).drColorMappingBy=c,f}}}function XC(e,t){var r=e.get(t);return ae(r)&&r.length?{name:t,range:r}:null}function Eve(e,t,r,n,a,i){var o=te({},t);if(a){var s=a.type,l=s==="color"&&b9(a).drColorMappingBy,u=l==="index"?n:l==="id"?i.mapIdToIndex(r.getId()):r.getValue(e.get("visualDimension"));o[s]=a.mapValueToVisual(u)}return o}function Rve(e){e.registerSeriesModel(tve),e.registerChartView(Sve),e.registerVisual(Ive),e.registerLayout(dve),eve(e)}function wd(e){return"_EC_"+e}var Ove=function(){function e(t){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=t||!1}return e.prototype.isDirected=function(){return this._directed},e.prototype.addNode=function(t,r){t=t==null?""+r:""+t;var n=this._nodesMap;if(!n[wd(t)]){var a=new _c(t,r);return a.hostGraph=this,this.nodes.push(a),n[wd(t)]=a,a}},e.prototype.getNodeByIndex=function(t){var r=this.data.getRawIndex(t);return this.nodes[r]},e.prototype.getNodeById=function(t){return this._nodesMap[wd(t)]},e.prototype.addEdge=function(t,r,n){var a=this._nodesMap,i=this._edgesMap;if(Tt(t)&&(t=this.nodes[t]),Tt(r)&&(r=this.nodes[r]),t instanceof _c||(t=a[wd(t)]),r instanceof _c||(r=a[wd(r)]),!(!t||!r)){var o=t.id+"-"+r.id,s=new S9(t,r,n);return s.hostGraph=this,this._directed&&(t.outEdges.push(s),r.inEdges.push(s)),t.edges.push(s),t!==r&&r.edges.push(s),this.edges.push(s),i[o]=s,s}},e.prototype.getEdgeByIndex=function(t){var r=this.edgeData.getRawIndex(t);return this.edges[r]},e.prototype.getEdge=function(t,r){t instanceof _c&&(t=t.id),r instanceof _c&&(r=r.id);var n=this._edgesMap;return this._directed?n[t+"-"+r]:n[t+"-"+r]||n[r+"-"+t]},e.prototype.eachNode=function(t,r){for(var n=this.nodes,a=n.length,i=0;i=0&&t.call(r,n[i],i)},e.prototype.eachEdge=function(t,r){for(var n=this.edges,a=n.length,i=0;i=0&&n[i].node1.dataIndex>=0&&n[i].node2.dataIndex>=0&&t.call(r,n[i],i)},e.prototype.breadthFirstTraverse=function(t,r,n,a){if(r instanceof _c||(r=this._nodesMap[wd(r)]),!!r){for(var i=n==="out"?"outEdges":n==="in"?"inEdges":"edges",o=0;o=0&&l.node2.dataIndex>=0});for(var i=0,o=a.length;i=0&&!t.hasKey(g)&&(t.set(g,!0),o.push(v.node1))}for(l=0;l=0&&!t.hasKey(w)&&(t.set(w,!0),s.push(_.node2))}}}return{edge:t.keys(),node:r.keys()}},e}(),S9=function(){function e(t,r,n){this.dataIndex=-1,this.node1=t,this.node2=r,this.dataIndex=n??-1}return e.prototype.getModel=function(t){if(!(this.dataIndex<0)){var r=this.hostGraph,n=r.edgeData.getItemModel(this.dataIndex);return n.getModel(t)}},e.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},e.prototype.getTrajectoryDataIndices=function(){var t=we(),r=we();t.set(this.dataIndex,!0);for(var n=[this.node1],a=[this.node2],i=0;i=0&&!t.hasKey(h)&&(t.set(h,!0),n.push(c.node1))}for(i=0;i=0&&!t.hasKey(m)&&(t.set(m,!0),a.push(g.node2))}return{edge:t.keys(),node:r.keys()}},e}();function C9(e,t){return{getValue:function(r){var n=this[e][t];return n.getStore().get(n.getDimensionIndex(r||"value"),this.dataIndex)},setVisual:function(r,n){this.dataIndex>=0&&this[e][t].setItemVisual(this.dataIndex,r,n)},getVisual:function(r){return this[e][t].getItemVisual(this.dataIndex,r)},setLayout:function(r,n){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,r,n)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}kr(_c,C9("hostGraph","data"));kr(S9,C9("hostGraph","edgeData"));function II(e,t,r,n,a){for(var i=new Ove(n),o=0;o "+f)),u++)}var v=r.get("coordinateSystem"),g;if(v==="cartesian2d"||v==="polar"||v==="matrix")g=Jo(e,r);else{var m=yv.get(v),y=m?m.dimensions||[]:[];Ye(y,"value")<0&&y.concat(["value"]);var x=wv(e,{coordDimensions:y,encodeDefine:r.getEncode()}).dimensions;g=new Bn(x,r),g.initData(e)}var _=new Bn(["value"],r);return _.initData(l,s),a&&a(g,_),l9({mainData:g,struct:i,structAttr:"graph",datas:{node:g,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),i.update(),i}var RA="-->",uw=function(e){return e.get("autoCurveness")||null},T9=function(e,t){var r=uw(e),n=20,a=[];if(Tt(r))n=r;else if(ae(r)){e.__curvenessList=r;return}t>n&&(n=t);var i=n%2?n+2:n+3;a=[];for(var o=0;o "),value:o.value,noValue:o.value==null})}var h=QH({series:this,dataIndex:r,multipleSeries:n});return h},t.prototype._updateCategoriesData=function(){var r=oe(this.option.categories||[],function(a){return a.value!=null?a:te({value:0},a)}),n=new Bn(["value"],this);n.initData(r),this._categoriesData=n,this._categoriesModels=n.mapArray(function(a){return n.getItemModel(a)})},t.prototype.isAnimationEnabled=function(){return e.prototype.isAnimationEnabled.call(this)&&!(this.get("layout")==="force"&&this.get(["force","layoutAnimation"]))},t.prototype.__ownRoamView=function(){var r=this.coordinateSystem;return Z8(r)&&r},t.type="series."+ta,t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:K.color.neutral50,width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:K.color.primary}}},t}(Ut);function G0(e){return e instanceof Array||(e=[e,e]),e}var Hve=Hr(ta,Uve);function Uve(e){e.eachSeriesByType(ta,function(t){var r=t.getGraph(),n=t.getEdgeData(),a=G0(t.get("edgeSymbol")),i=G0(t.get("edgeSymbolSize"));n.setVisual("fromSymbol",a&&a[0]),n.setVisual("toSymbol",a&&a[1]),n.setVisual("fromSymbolSize",i&&i[0]),n.setVisual("toSymbolSize",i&&i[1]),n.setVisual("style",t.getModel("lineStyle").getLineStyle()),n.each(function(o){var s=n.getItemModel(o),l=r.getEdgeByIndex(o),u=G0(s.getShallow("symbol",!0)),c=G0(s.getShallow("symbolSize",!0)),h=s.getModel("lineStyle").getLineStyle(),f=n.ensureUniqueItemVisual(o,"style");switch(te(f,h),f.stroke){case"source":{var v=l.node1.getVisual("style");f.stroke=v&&v.fill;break}case"target":{var v=l.node2.getVisual("style");f.stroke=v&&v.fill;break}}u[0]&&l.setVisual("fromSymbol",u[0]),u[1]&&l.setVisual("toSymbol",u[1]),c[0]&&l.setVisual("fromSymbolSize",c[0]),c[1]&&l.setVisual("toSymbolSize",c[1])})})}function A9(e){var t=e.coordinateSystem;if(!(t&&t.type!=="view")){var r=e.getGraph();r.eachNode(function(n){var a=n.getModel();n.setLayout([+a.get("x"),+a.get("y")])}),DI(r,e)}}function DI(e,t){e.eachEdge(function(r,n){var a=ya(r.getModel().get(["lineStyle","curveness"]),-PI(r,t,n,!0),0),i=No(r.node1.getLayout()),o=No(r.node2.getLayout()),s=[i,o];+a&&s.push([(i[0]+o[0])/2-(i[1]-o[1])*a,(i[1]+o[1])/2-(o[0]-i[0])*a]),r.setLayout(s)})}var Wve=Hr(ta,$ve);function $ve(e,t){e.eachSeriesByType(ta,function(r){var n=r.get("layout"),a=r.coordinateSystem;if(a&&a.type!=="view"){var i=r.getData(),o=[];R(a.dimensions,function(f){o=o.concat(i.mapDimensionsAll(f))});for(var s=0;s0&&(C[0]=-C[0],C[1]=-C[1]);var A=S[0]<0?-1:1;if(i.__position!=="start"&&i.__position!=="end"){var I=-Math.atan2(S[1],S[0]);h[0].8?"left":f[0]<-.8?"right":"center",m=f[1]>.8?"top":f[1]<-.8?"bottom":"middle";break;case"start":i.x=-f[0]*x+c[0],i.y=-f[1]*_+c[1],g=f[0]>.8?"right":f[0]<-.8?"left":"center",m=f[1]>.8?"bottom":f[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":i.x=x*A+c[0],i.y=c[1]+k,g=S[0]<0?"right":"left",i.originX=-x*A,i.originY=-k;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=M[0],i.y=M[1]+k,g="center",i.originY=-k;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-x*A+h[0],i.y=h[1]+k,g=S[0]>=0?"right":"left",i.originX=x*A,i.originY=-k;break}i.scaleX=i.scaleY=o,i.setStyle({verticalAlign:i.__verticalAlign||m,align:i.__align||g})}},t}(De),RI=function(){function e(t){this.group=new De,this._LineCtor=t||EI}return e.prototype.updateData=function(t){var r=this;this._progressiveEls=null;var n=this,a=n.group,i=n._lineData;n._lineData=t,i||a.removeAll();var o=H3(t);t.diff(i).add(function(s){r._doAdd(t,s,o)}).update(function(s,l){r._doUpdate(i,t,l,s,o)}).remove(function(s){a.remove(i.getItemGraphicEl(s))}).execute()},e.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl(function(r,n){r.updateLayout(t,n)},this)},e.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=H3(t),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(t,r,n){this._progressiveEls=[];function a(l){!l.isGroup&&!rpe(l)&&(l.incremental=n,l.ensureState("emphasis").hoverLayer=vv)}for(var i=t.start;i0}function H3(e){var t=e.hostModel,r=t.getModel("emphasis");return{lineStyle:t.getModel("lineStyle").getLineStyle(),emphasisLineStyle:r.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:t.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:t.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:r.get("disabled"),blurScope:r.get("blurScope"),focus:r.get("focus"),labelStatesModels:Gr(t)}}function U3(e){return isNaN(e[0])||isNaN(e[1])}function e2(e){return e&&!U3(e[0])&&!U3(e[1])}var t2=[],r2=[],n2=[],Cd=an,a2=$l,W3=Math.abs;function $3(e,t,r){for(var n=e[0],a=e[1],i=e[2],o=1/0,s,l=r*r,u=.1,c=.1;c<=.9;c+=.1){t2[0]=Cd(n[0],a[0],i[0],c),t2[1]=Cd(n[1],a[1],i[1],c);var h=W3(a2(t2,t)-l);h=0?s=s+u:s=s-u:g>=0?s=s-u:s=s+u}return s}function i2(e,t){var r=[],n=Gg,a=[[],[],[]],i=[[],[]],o=[];t/=2,e.eachEdge(function(s,l){var u=s.getLayout(),c=s.getVisual("fromSymbol"),h=s.getVisual("toSymbol");u.__original||(u.__original=[No(u[0]),No(u[1])],u[2]&&u.__original.push(No(u[2])));var f=u.__original;if(u[2]!=null){if(vn(a[0],f[0]),vn(a[1],f[2]),vn(a[2],f[1]),c&&c!=="none"){var v=Wp(s.node1),g=$3(a,f[0],v*t);n(a[0][0],a[1][0],a[2][0],g,r),a[0][0]=r[3],a[1][0]=r[4],n(a[0][1],a[1][1],a[2][1],g,r),a[0][1]=r[3],a[1][1]=r[4]}if(h&&h!=="none"){var v=Wp(s.node2),g=$3(a,f[1],v*t);n(a[0][0],a[1][0],a[2][0],g,r),a[1][0]=r[1],a[2][0]=r[2],n(a[0][1],a[1][1],a[2][1],g,r),a[1][1]=r[1],a[2][1]=r[2]}vn(u[0],a[0]),vn(u[1],a[2]),vn(u[2],a[1])}else{if(vn(i[0],f[0]),vn(i[1],f[1]),Ll(o,i[1],i[0]),Lh(o,o),c&&c!=="none"){var v=Wp(s.node1);C_(i[0],i[0],o,v*t)}if(h&&h!=="none"){var v=Wp(s.node2);C_(i[1],i[1],o,-v*t)}vn(u[0],i[0]),vn(u[1],i[1])}})}var I9=Qe();function npe(e){if(e)return I9(e).bridge}function Z3(e,t){e&&(I9(e).bridge=t)}var ape=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=ta,r}return t.prototype.init=function(r,n){var a=new ty,i=new RI,o=this.group,s=new De;this._controller=new Hh(n.getZr()),s.add(a.group),s.add(i.group),o.add(s),this._symbolDraw=a,this._lineDraw=i,this._mainGroup=s,this._firstRender=!0},t.prototype.render=function(r,n,a){var i=this,o=wb(r),s=!1;this._model=r,this._api=a,this._active=!0;var l=this._mainGroup,u=this._getThumbnailInfo();u&&u.bridge.reset(a);var c=this._symbolDraw,h=this._lineDraw;o&&lu(l,$o,o,this._firstRender?null:r),i2(r.getGraph(),Up(r));var f=r.getData();c.updateData(f);var v=r.getEdgeData();h.updateData(v),this._updateNodeAndLinkScale(),o&&sw(r,a,this._controller,function(S,C,M){return r.coordinateSystem.containPoint([C,M])},null),clearTimeout(this._layoutTimeout);var g=r.forceLayout,m=r.get(["force","layoutAnimation"]);g&&(s=!0,this._startForceLayoutIteration(g,a,m));var y=r.get("layout");f.graph.eachNode(function(S){var C=S.dataIndex,M=S.getGraphicEl(),A=S.getModel();if(M){M.off("drag").off("dragend");var I=A.get("draggable");I&&M.on("drag",function(P){switch(y){case"force":g.warmUp(),!i._layouting&&i._startForceLayoutIteration(g,a,m),g.setFixed(C),f.setItemLayout(C,[M.x,M.y]);break;case"circular":f.setItemLayout(C,[M.x,M.y]),S.setLayout({fixed:!0},!0),jI(r,"symbolSize",S,[P.offsetX,P.offsetY]),i.updateLayout(r);break;case"none":default:f.setItemLayout(C,[M.x,M.y]),DI(r.getGraph(),r),i.updateLayout(r);break}}).on("dragend",function(){g&&g.setUnfixed(C)}),M.setDraggable(I,!!A.get("cursor"));var k=A.get(["emphasis","focus"]);k==="adjacency"&&(Be(M).focus=S.getAdjacentDataIndices())}}),f.graph.eachEdge(function(S){var C=S.getGraphicEl(),M=S.getModel().get(["emphasis","focus"]);C&&M==="adjacency"&&(Be(C).focus={edge:[S.dataIndex],node:[S.node1.dataIndex,S.node2.dataIndex]})});var x=r.get("layout")==="circular"&&r.get(["circular","rotateLabel"]),_=f.getLayout("cx"),w=f.getLayout("cy");f.graph.eachNode(function(S){N9(S,x,_,w)}),this._firstRender=!1,s||this._renderThumbnail(r,a,this._symbolDraw,this._lineDraw)},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose()},t.prototype._startForceLayoutIteration=function(r,n,a){var i=this,o=!1;(function s(){r.step(function(l){i.updateLayout(i._model),(l||!o)&&(o=!0,i._renderThumbnail(i._model,n,i._symbolDraw,i._lineDraw)),(i._layouting=!l)&&(a?i._layoutTimeout=setTimeout(s,16):s())})})()},t.prototype.__updateOnOwnRoam=function(r,n,a){var i=wb(n);!this._active||!i||(lu(this._mainGroup,$o,i,null),t9(r)&&(this._updateNodeAndLinkScale(),i2(n.getGraph(),Up(n)),this._lineDraw.updateLayout(),a.updateLabelLayout()),this._updateThumbnailWindow())},t.prototype._updateNodeAndLinkScale=function(){var r=this._model,n=r.getData(),a=Up(r);n.eachItemGraphicEl(function(i,o){i&&i.setSymbolScale(a)})},t.prototype.updateLayout=function(r){this._active&&(i2(r.getGraph(),Up(r)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout())},t.prototype.remove=function(){this._active=!1,clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove(),this._controller&&this._controller.disable()},t.prototype._getThumbnailInfo=function(){var r=this._model,n=r.coordinateSystem;if(n.type==="view"){var a=npe(r);if(a)return{bridge:a,coordSys:n}}},t.prototype._updateThumbnailWindow=function(){var r=this._getThumbnailInfo();r&&r.bridge.updateWindow(_b(null,r.coordSys),this._api)},t.prototype._renderThumbnail=function(r,n,a,i){var o=this._getThumbnailInfo();if(o){var s=new De,l=a.group.children(),u=i.group.children(),c=new De,h=new De;s.add(h),s.add(c);for(var f=0;f "),value:i.value,noValue:i.value==null})}return Er("nameValue",{name:i.name,value:i.value,noValue:i.value==null})},t.prototype.getDataParams=function(r,n){var a=e.prototype.getDataParams.call(this,r,n);if(n==="node"){var i=this.getData(),o=this.getGraph().getNodeByIndex(r);if(a.name==null&&(a.name=i.getName(r)),a.value==null){var s=o.getLayout().value;a.value=s}}return a},t.type="series."+Cm,t.defaultOption={z:2,coordinateSystem:"none",legendHoverLink:!0,colorBy:"data",left:0,top:0,right:0,bottom:0,width:null,height:null,center:["50%","50%"],radius:["70%","80%"],clockwise:!0,startAngle:90,endAngle:"auto",minAngle:0,padAngle:3,itemStyle:{borderRadius:[0,0,5,5]},lineStyle:{width:0,color:"source",opacity:.2},label:{show:!0,position:"outside",distance:5},emphasis:{focus:"adjacency",lineStyle:{opacity:.5}}},t}(Ut),Y3=function(e){X(t,e);function t(r,n,a){var i=e.call(this)||this;Be(i).dataType="node",i.z2=2;var o=new wt;return i.setTextContent(o),i.updateData(r,n,a,!0),i}return t.prototype.updateData=function(r,n,a,i){var o=this,s=r.graph.getNodeByIndex(n),l=r.hostModel,u=s.getModel(),c=u.getModel("emphasis"),h=r.getItemLayout(n),f=te(Co(u.getModel("itemStyle"),h,!0),h),v=this;if(isNaN(f.startAngle)){v.setShape(f);return}i?v.setShape(f):At(v,{shape:f},l,n);var g=te(Co(u.getModel("itemStyle"),h,!0),h);o.setShape(g),o.useStyle(r.getItemVisual(n,"style")),Vr(o,u),this._updateLabel(l,u,s),r.setItemGraphicEl(n,v),Vr(v,u,"itemStyle");var m=c.get("focus");ir(this,m==="adjacency"?s.getAdjacentDataIndices():m,c.get("blurScope"),c.get("disabled"))},t.prototype._updateLabel=function(r,n,a){var i=this.getTextContent(),o=a.getLayout(),s=(o.startAngle+o.endAngle)/2,l=Math.cos(s),u=Math.sin(s),c=n.getModel("label");i.ignore=!c.get("show");var h=Gr(n),f=a.getVisual("style");Jr(i,h,{labelFetcher:{getFormattedLabel:function(_,w,S,C,M,A){return r.getFormattedLabel(_,w,"node",C,ya(M,h.normal&&h.normal.get("formatter"),n.get("name")),A)}},labelDataIndex:a.dataIndex,defaultText:a.dataIndex+"",inheritColor:f.fill,defaultOpacity:f.opacity,defaultOutsidePosition:"startArc"});var v=c.get("position")||"outside",g=c.get("distance")||0,m;v==="outside"?m=o.r+g:m=(o.r+o.r0)/2,this.textConfig={inside:v!=="outside"};var y=v!=="outside"?c.get("align")||"center":l>0?"left":"right",x=v!=="outside"?c.get("verticalAlign")||"middle":u>0?"top":"bottom";i.attr({x:l*m+o.cx,y:u*m+o.cy,rotation:0,style:{align:y,verticalAlign:x}})},t}(wn),hpe=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this)||this;return Be(o).dataType="edge",o.updateData(r,n,a,i,!0),o}return t.prototype.buildPath=function(r,n){r.moveTo(n.s1[0],n.s1[1]);var a=.7,i=n.clockwise;r.arc(n.cx,n.cy,n.r,n.sStartAngle,n.sEndAngle,!i),r.bezierCurveTo((n.cx-n.s2[0])*a+n.s2[0],(n.cy-n.s2[1])*a+n.s2[1],(n.cx-n.t1[0])*a+n.t1[0],(n.cy-n.t1[1])*a+n.t1[1],n.t1[0],n.t1[1]),r.arc(n.cx,n.cy,n.r,n.tStartAngle,n.tEndAngle,!i),r.bezierCurveTo((n.cx-n.t2[0])*a+n.t2[0],(n.cy-n.t2[1])*a+n.t2[1],(n.cx-n.s1[0])*a+n.s1[0],(n.cy-n.s1[1])*a+n.s1[1],n.s1[0],n.s1[1]),r.closePath()},t.prototype.updateData=function(r,n,a,i,o){var s=r.hostModel,l=n.graph.getEdgeByIndex(a),u=l.getLayout(),c=l.node1.getModel(),h=n.getItemModel(l.dataIndex),f=h.getModel("lineStyle"),v=h.getModel("emphasis"),g=v.get("focus"),m=te(Co(c.getModel("itemStyle"),u,!0),u),y=this;if(isNaN(m.sStartAngle)||isNaN(m.tStartAngle)){y.setShape(m);return}o?(y.setShape(m),X3(y,l,r,f)):(xi(y),X3(y,l,r,f),At(y,{shape:m},s,a)),ir(this,g==="adjacency"?l.getAdjacentDataIndices():g,v.get("blurScope"),v.get("disabled")),Vr(y,h,"lineStyle"),n.setItemGraphicEl(l.dataIndex,y)},t}(pt);function X3(e,t,r,n){var a=t.node1,i=t.node2,o=e.style;e.setStyle(n.getLineStyle());var s=n.get("color");switch(s){case"source":o.fill=r.getItemVisual(a.dataIndex,"style").fill,o.decal=a.getVisual("style").decal;break;case"target":o.fill=r.getItemVisual(i.dataIndex,"style").fill,o.decal=i.getVisual("style").decal;break;case"gradient":var l=r.getItemVisual(a.dataIndex,"style").fill,u=r.getItemVisual(i.dataIndex,"style").fill;if(ve(l)&&ve(u)){var c=e.shape,h=(c.s1[0]+c.s2[0])/2,f=(c.s1[1]+c.s2[1])/2,v=(c.t1[0]+c.t2[0])/2,g=(c.t1[1]+c.t2[1])/2;o.fill=new Eh(h,f,v,g,[{offset:0,color:l},{offset:1,color:u}],!0)}break}}var dpe=Math.PI/180,fpe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Cm,r}return t.prototype.init=function(r,n){},t.prototype.render=function(r,n,a){var i=r.getData(),o=this._data,s=this.group,l=-r.get("startAngle")*dpe;if(i.diff(o).add(function(c){var h=i.getItemLayout(c);if(h){var f=new Y3(i,c,l);Be(f).dataIndex=c,s.add(f)}}).update(function(c,h){var f=o.getItemGraphicEl(h),v=i.getItemLayout(c);if(!v){f&&Is(f,r,h);return}f?f.updateData(i,c,l):f=new Y3(i,c,l),s.add(f)}).remove(function(c){var h=o.getItemGraphicEl(c);h&&Is(h,r,c)}).execute(),!o){var u=r.get("center");this.group.scaleX=.01,this.group.scaleY=.01,this.group.originX=me(u[0],a.getWidth()),this.group.originY=me(u[1],a.getHeight()),Qt(this.group,{scaleX:1,scaleY:1},r)}this._data=i,this.renderEdges(r,l)},t.prototype.renderEdges=function(r,n){var a=r.getData(),i=r.getEdgeData(),o=this._edgeData,s=this.group;i.diff(o).add(function(l){var u=new hpe(a,i,l,n);Be(u).dataIndex=l,s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(a,i,l,n),s.add(c)}).remove(function(l){var u=o.getItemGraphicEl(l);u&&Is(u,r,l)}).execute(),this._edgeData=i},t.prototype.dispose=function(){},t.type=Cm,t}(Rt),o2=Math.PI/180,vpe=Hr(Cm,ppe);function ppe(e,t){e.eachSeriesByType(Cm,function(r){gpe(r,t)})}function gpe(e,t){var r=e.getData(),n=r.graph,a=e.getEdgeData(),i=a.count();if(i){var o=yH(e,t),s=o.cx,l=o.cy,u=o.r,c=o.r0,h=Math.max((e.get("padAngle")||0)*o2,0),f=Math.max((e.get("minAngle")||0)*o2,0),v=-e.get("startAngle")*o2,g=v+Math.PI*2,m=e.get("clockwise"),y=m?1:-1,x=[v,g];D1(x,!m);var _=x[0],w=x[1],S=w-_,C=r.getSum("value")===0&&a.getSum("value")===0,M=[],A=0;n.eachEdge(function(F){var W=C?1:F.getValue("value");C&&(W>0||f)&&(A+=2);var $=F.node1.dataIndex,Z=F.node2.dataIndex;M[$]=(M[$]||0)+W,M[Z]=(M[Z]||0)+W});var I=0;if(n.eachNode(function(F){var W=F.getValue("value");isNaN(W)||(M[F.dataIndex]=Math.max(W,M[F.dataIndex]||0)),!C&&(M[F.dataIndex]>0||f)&&A++,I+=M[F.dataIndex]||0}),!(A===0||I===0)){h*A>=Math.abs(S)&&(h=Math.max(0,(Math.abs(S)-f*A)/A)),(h+f)*A>=Math.abs(S)&&(f=(Math.abs(S)-h*A)/A);var k=(S-h*A*y)/I,P=0,D=0,z=0;n.eachNode(function(F){var W=M[F.dataIndex]||0,$=k*(I?W:1)*y;Math.abs($)D){var B=P/D;n.eachNode(function(F){var W=F.getLayout().angle;Math.abs(W)>=f?F.setLayout({angle:W*B,ratio:B},!0):F.setLayout({angle:f,ratio:f===0?1:W/f},!0)})}else n.eachNode(function(F){if(!j){var W=F.getLayout().angle,$=Math.min(W/z,1),Z=$*P;W-Zf&&f>0){var $=j?1:Math.min(W/z,1),Z=W-f,J=Math.min(Z,Math.min(H,P*$));H-=J,F.setLayout({angle:W-J,ratio:(W-J)/W},!0)}else f>0&&F.setLayout({angle:f,ratio:W===0?1:f/W},!0)}});var V=_,U=[];n.eachNode(function(F){var W=Math.max(F.getLayout().angle,f);F.setLayout({cx:s,cy:l,r0:c,r:u,startAngle:V,endAngle:V+W*y,clockwise:m},!0),U[F.dataIndex]=V,V+=(W+h)*y}),n.eachEdge(function(F){var W=C?1:F.getValue("value"),$=k*(I?W:1)*y,Z=F.node1.dataIndex,J=U[Z]||0,re=Math.abs((F.node1.getLayout().ratio||1)*$),Q=J+re*y,le=[s+c*Math.cos(J),l+c*Math.sin(J)],de=[s+c*Math.cos(Q),l+c*Math.sin(Q)],He=F.node2.dataIndex,ye=U[He]||0,ne=Math.abs((F.node2.getLayout().ratio||1)*$),xe=ye+ne*y,he=[s+c*Math.cos(ye),l+c*Math.sin(ye)],ge=[s+c*Math.cos(xe),l+c*Math.sin(xe)];F.setLayout({s1:le,s2:de,sStartAngle:J,sEndAngle:Q,t1:he,t2:ge,tStartAngle:ye,tEndAngle:xe,cx:s,cy:l,r:c,value:W,clockwise:m}),U[Z]=Q,U[He]=xe})}}}function mpe(e){e.registerChartView(fpe),e.registerSeriesModel(cpe),e.registerLayout(e.PRIORITY.VISUAL.POST_CHART_LAYOUT,vpe),e.registerProcessor(ay("chord"))}var ype=function(){function e(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return e}(),xpe=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="pointer",n}return t.prototype.getDefaultShape=function(){return new ype},t.prototype.buildPath=function(r,n){var a=Math.cos,i=Math.sin,o=n.r,s=n.width,l=n.angle,u=n.x-a(l)*s*(s>=o/3?1:2),c=n.y-i(l)*s*(s>=o/3?1:2);l=n.angle-Math.PI/2,r.moveTo(u,c),r.lineTo(n.x+a(l)*s,n.y+i(l)*s),r.lineTo(n.x+a(n.angle)*o,n.y+i(n.angle)*o),r.lineTo(n.x-a(l)*s,n.y-i(l)*s),r.lineTo(u,c)},t}(pt);function _pe(e,t){var r=e.get("center"),n=t.getWidth(),a=t.getHeight(),i=Math.min(n,a),o=me(r[0],t.getWidth()),s=me(r[1],t.getHeight()),l=me(e.get("radius"),i/2);return{cx:o,cy:s,r:l}}function H0(e,t){var r=e==null?"":e+"";return t&&(ve(t)?r=t.replace("{value}",r):Le(t)&&(r=t(e))),r}var bpe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){this.group.removeAll();var i=r.get(["axisLine","lineStyle","color"]),o=_pe(r,a);this._renderMain(r,n,a,i,o),this._data=r.getData()},t.prototype.dispose=function(){},t.prototype._renderMain=function(r,n,a,i,o){var s=this.group,l=r.get("clockwise"),u=-r.get("startAngle")/180*Math.PI,c=-r.get("endAngle")/180*Math.PI,h=r.getModel("axisLine"),f=h.get("roundCap"),v=f?mb:wn,g=h.get("show"),m=h.getModel("lineStyle"),y=m.get("width"),x=[u,c];D1(x,!l),u=x[0],c=x[1];for(var _=c-u,w=u,S=[],C=0;g&&C=k&&(P===0?0:i[P-1][0])Math.PI/2&&(Q+=Math.PI)):re==="tangential"?Q=-I-Math.PI/2:Tt(re)&&(Q=re*Math.PI/180),Q===0?h.add(new wt({style:$t(w,{text:W,x:Z,y:J,verticalAlign:H<-.8?"top":H>.8?"bottom":"middle",align:B<-.4?"left":B>.4?"right":"center"},{inheritColor:$}),silent:!0})):h.add(new wt({style:$t(w,{text:W,x:Z,y:J,verticalAlign:"middle",align:"center"},{inheritColor:$}),silent:!0,originX:Z,originY:J,rotation:Q}))}if(_.get("show")&&V!==S){var U=_.get("distance");U=U?U+c:c;for(var le=0;le<=C;le++){B=Math.cos(I),H=Math.sin(I);var de=new Tr({shape:{x1:B*(g-U)+f,y1:H*(g-U)+v,x2:B*(g-A-U)+f,y2:H*(g-A-U)+v},silent:!0,style:z});z.stroke==="auto"&&de.setStyle({stroke:i((V+le/C)/S)}),h.add(de),I+=P}I-=P}else I+=k}},t.prototype._renderPointer=function(r,n,a,i,o,s,l,u,c){var h=this.group,f=this._data,v=this._progressEls,g=[],m=r.get(["pointer","show"]),y=r.getModel("progress"),x=y.get("show"),_=r.getData(),w=_.mapDimension("value"),S=+r.get("min"),C=+r.get("max"),M=[S,C],A=[s,l];function I(P,D){var z=_.getItemModel(P),j=z.getModel("pointer"),B=me(j.get("width"),o.r),H=me(j.get("length"),o.r),V=r.get(["pointer","icon"]),U=j.get("offsetCenter"),F=me(U[0],o.r),W=me(U[1],o.r),$=j.get("keepAspect"),Z;return V?Z=Ar(V,F-B/2,W-H,B,H,null,$):Z=new xpe({shape:{angle:-Math.PI/2,width:B,r:H,x:F,y:W}}),Z.rotation=-(D+Math.PI/2),Z.x=o.cx,Z.y=o.cy,Z}function k(P,D){var z=y.get("roundCap"),j=z?mb:wn,B=y.get("overlap"),H=B?y.get("width"):c/_.count(),V=B?o.r-H:o.r-(P+1)*H,U=B?o.r:o.r-P*H,F=new j({shape:{startAngle:s,endAngle:D,cx:o.cx,cy:o.cy,clockwise:u,r0:V,r:U}});return B&&(F.z2=Nt(_.get(w,P),[S,C],[100,0],!0)),F}(x||m)&&(_.diff(f).add(function(P){var D=_.get(w,P);if(m){var z=I(P,s);Qt(z,{rotation:-((isNaN(+D)?A[0]:Nt(D,M,A,!0))+Math.PI/2)},r),h.add(z),_.setItemGraphicEl(P,z)}if(x){var j=k(P,s),B=y.get("clip");Qt(j,{shape:{endAngle:Nt(D,M,A,B)}},r),h.add(j),DM(r.seriesIndex,_.dataType,P,j),g[P]=j}}).update(function(P,D){var z=_.get(w,P);if(m){var j=f.getItemGraphicEl(D),B=j?j.rotation:s,H=I(P,B);H.rotation=B,At(H,{rotation:-((isNaN(+z)?A[0]:Nt(z,M,A,!0))+Math.PI/2)},r),h.add(H),_.setItemGraphicEl(P,H)}if(x){var V=v[D],U=V?V.shape.endAngle:s,F=k(P,U),W=y.get("clip");At(F,{shape:{endAngle:Nt(z,M,A,W)}},r),h.add(F),DM(r.seriesIndex,_.dataType,P,F),g[P]=F}}).execute(),_.each(function(P){var D=_.getItemModel(P),z=D.getModel("emphasis"),j=z.get("focus"),B=z.get("blurScope"),H=z.get("disabled"),V=i(Nt(_.get(w,P),M,[0,1],!0));if(m){var U=_.getItemGraphicEl(P),F=_.getItemVisual(P,"style"),W=F.fill;if(U instanceof Qr){var $=U.style;U.useStyle(te({image:$.image,x:$.x,y:$.y,width:$.width,height:$.height},F))}else U.useStyle(F),U.type!=="pointer"&&U.setColor(W);U.setStyle(D.getModel(["pointer","itemStyle"]).getItemStyle()),U.style.fill==="auto"&&U.setStyle("fill",V),U.z2EmphasisLift=0,Vr(U,D),ir(U,j,B,H)}if(x){var Z=g[P];Z.useStyle(_.getItemVisual(P,"style")),Z.setStyle(D.getModel(["progress","itemStyle"]).getItemStyle()),Z.style.fill==="auto"&&Z.setStyle("fill",V),Z.z2EmphasisLift=0,Vr(Z,D),ir(Z,j,B,H)}}),this._progressEls=g)},t.prototype._renderAnchor=function(r,n){var a=r.getModel("anchor"),i=a.get("show");if(i){var o=a.get("size"),s=a.get("icon"),l=a.get("offsetCenter"),u=a.get("keepAspect"),c=Ar(s,n.cx-o/2+me(l[0],n.r),n.cy-o/2+me(l[1],n.r),o,o,null,u);c.z2=a.get("showAbove")?1:0,c.setStyle(a.getModel("itemStyle").getItemStyle()),this.group.add(c)}},t.prototype._renderTitleAndDetail=function(r,n,a,i,o){var s=this,l=r.getData(),u=l.mapDimension("value"),c=+r.get("min"),h=+r.get("max"),f=new De,v=[],g=[],m=r.isAnimationEnabled(),y=r.get(["pointer","showAbove"]);l.diff(this._data).add(function(x){v[x]=new wt({silent:!0}),g[x]=new wt({silent:!0})}).update(function(x,_){v[x]=s._titleEls[_],g[x]=s._detailEls[_]}).execute(),l.each(function(x){var _=l.getItemModel(x),w=l.get(u,x),S=new De,C=i(Nt(w,[c,h],[0,1],!0)),M=_.getModel("title");if(M.get("show")){var A=M.get("offsetCenter"),I=o.cx+me(A[0],o.r),k=o.cy+me(A[1],o.r),P=v[x];P.attr({z2:y?0:2,style:$t(M,{x:I,y:k,text:l.getName(x),align:"center",verticalAlign:"middle"},{inheritColor:C})}),S.add(P)}var D=_.getModel("detail");if(D.get("show")){var z=D.get("offsetCenter"),j=o.cx+me(z[0],o.r),B=o.cy+me(z[1],o.r),H=me(D.get("width"),o.r),V=me(D.get("height"),o.r),U=r.get(["progress","show"])?l.getItemVisual(x,"style").fill:C,P=g[x],F=D.get("formatter");P.attr({z2:y?0:2,style:$t(D,{x:j,y:B,text:H0(w,F),width:isNaN(H)?null:H,height:isNaN(V)?null:V,align:"center",verticalAlign:"middle"},{inheritColor:U})}),X7(P,{normal:D},w,function($){return H0($,F)}),m&&q7(P,x,l,r,{getFormattedLabel:function($,Z,J,re,Q,le){return H0(le?le.interpolatedValue:w,F)}}),S.add(P)}f.add(S)}),this.group.add(f),this._titleEls=v,this._detailEls=g},t.type="gauge",t}(Rt),wpe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.visualStyleAccessPath="itemStyle",r}return t.prototype.getInitialData=function(r,n){return Av(this,["value"])},t.type="series.gauge",t.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,K.color.neutral10]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:K.color.axisTick,width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:K.color.axisTickMinor,width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:K.color.axisLabel,fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:K.color.neutral00,borderWidth:0,borderColor:K.color.theme[0]}},title:{show:!0,offsetCenter:[0,"20%"],color:K.color.secondary,fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:K.color.transparent,borderWidth:0,borderColor:K.color.neutral40,width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:K.color.primary,fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}},t}(Ut);function Spe(e){e.registerChartView(bpe),e.registerSeriesModel(wpe)}var Wf="funnel",Cpe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new Nv(be(this.getData,this),be(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.getInitialData=function(r,n){return Av(this,{coordDimensions:["value"],encodeDefaulter:nt(CL,this)})},t.prototype._defaultLabelLine=function(r){rh(r,"labelLine",["show"]);var n=r.labelLine,a=r.emphasis.labelLine;n.show=n.show&&r.label.show,a.show=a.show&&r.emphasis.label.show},t.prototype.getDataParams=function(r){var n=this.getData(),a=e.prototype.getDataParams.call(this,r),i=n.mapDimension("value"),o=n.getSum(i);return a.percent=o?+(n.get(i,r)/o*100).toFixed(2):0,a.$vars.push("percent"),a},t.type="series."+Wf,t.defaultOption={coordinateSystemUsage:"box",z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:65,minSize:"0%",maxSize:"100%",sort:"descending",orient:"vertical",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:K.color.neutral00,borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:K.color.primary}}},t}(Ut),Tpe=["itemStyle","opacity"],Mpe=function(e){X(t,e);function t(r,n){var a=e.call(this)||this,i=a,o=new un,s=new wt;return i.setTextContent(s),a.setTextGuideLine(o),a.updateData(r,n,!0),a}return t.prototype.updateData=function(r,n,a){var i=this,o=r.hostModel,s=r.getItemModel(n),l=r.getItemLayout(n),u=s.getModel("emphasis"),c=s.get(Tpe);c=c??1,a||xi(i),i.useStyle(r.getItemVisual(n,"style")),i.style.lineJoin="round",a?(i.setShape({points:l.points}),i.style.opacity=0,Qt(i,{style:{opacity:c}},o,n)):At(i,{style:{opacity:c},shape:{points:l.points}},o,n),Vr(i,s),this._updateLabel(r,n),ir(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r,n){var a=this,i=this.getTextGuideLine(),o=a.getTextContent(),s=r.hostModel,l=r.getItemModel(n),u=r.getItemLayout(n),c=u.label,h=r.getItemVisual(n,"style"),f=h.fill;Jr(o,Gr(l),{labelFetcher:r.hostModel,labelDataIndex:n,defaultOpacity:h.opacity,defaultText:r.getName(n)},{normal:{align:c.textAlign,verticalAlign:c.verticalAlign}});var v=l.getModel("label"),g=v.get("color"),m=g==="inherit"?f:null;a.setTextConfig({local:!0,inside:!!c.inside,insideStroke:m,outsideFill:m});var y=c.linePoints;i.setShape({points:y}),a.textGuideLineConfig={anchor:y?new Oe(y[0][0],y[0][1]):null},At(o,{style:{x:c.x,y:c.y}},s,n),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),rI(a,nI(l),{stroke:f})},t}(Sn),Ape=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Wf,r.ignoreLabelLineUpdate=!0,r}return t.prototype.render=function(r,n,a){var i=r.getData(),o=this._data,s=this.group;i.diff(o).add(function(l){var u=new Mpe(i,l);i.setItemGraphicEl(l,u),s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(i,l),s.add(c),i.setItemGraphicEl(l,c)}).remove(function(l){var u=o.getItemGraphicEl(l);Is(u,r,l)}).execute(),this._data=i},t.prototype.remove=function(){this.group.removeAll(),this._data=null},t.prototype.dispose=function(){},t.type=Wf,t}(Rt);function Npe(e,t){for(var r=e.mapDimension("value"),n=e.mapArray(r,function(l){return l}),a=[],i=t==="ascending",o=0,s=e.count();o-1&&(o="left"),r&&Ye(["left","right"],o)>-1&&(o="bottom")),o==="left"?(m=(u[3][0]+u[0][0])/2,y=(u[3][1]+u[0][1])/2,x=m-w,f=x-5,h="right"):o==="right"?(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,x=m+w,f=x+5,h="left"):o==="top"?(m=(u[3][0]+u[0][0])/2,y=(u[3][1]+u[0][1])/2,_=y-w,v=_-5,h="center"):o==="bottom"?(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,_=y+w,v=_+5,h="center"):o==="rightTop"?(m=r?u[3][0]:u[1][0],y=r?u[3][1]:u[1][1],r?(_=y-w,v=_-5,h="center"):(x=m+w,f=x+5,h="top")):o==="rightBottom"?(m=u[2][0],y=u[2][1],r?(_=y+w,v=_+5,h="center"):(x=m+w,f=x+5,h="bottom")):o==="leftTop"?(m=u[0][0],y=r?u[0][1]:u[1][1],r?(_=y-w,v=_-5,h="center"):(x=m-w,f=x-5,h="right")):o==="leftBottom"?(m=r?u[1][0]:u[3][0],y=r?u[1][1]:u[2][1],r?(_=y+w,v=_+5,h="center"):(x=m-w,f=x-5,h="right")):(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,r?(_=y+w,v=_+5,h="center"):(x=m+w,f=x+5,h="left")),r?(x=m,f=x):(_=y,v=_),g=[[m,y],[x,_]]}l.label={linePoints:g,x:f,y:v,verticalAlign:"middle",textAlign:h,inside:c}})}var Lpe=Hr(Wf,Ipe);function Ipe(e,t){e.eachSeriesByType(Wf,function(r){var n=r.getData(),a=n.mapDimension("value"),i=r.get("sort"),o=Ur(r,t),s=tr(r.getBoxLayoutParams(),o.refContainer),l=P9(r),u=s.width,c=s.height,h=Npe(n,i),f=s.x,v=s.y,g=l?[me(r.get("minSize"),c),me(r.get("maxSize"),c)]:[me(r.get("minSize"),u),me(r.get("maxSize"),u)],m=n.getDataExtent(a),y=r.get("min"),x=r.get("max");y==null&&(y=Math.min(m[0],0)),x==null&&(x=m[1]);var _=r.get("funnelAlign"),w=r.get("gap"),S=l?u:c,C=(S-w*(n.count()-1))/n.count(),M=function(H,V){if(l){var U=n.get(a,H)||0,F=Nt(U,[y,x],g,!0),W=void 0;switch(_){case"top":W=v;break;case"center":W=v+(c-F)/2;break;case"bottom":W=v+(c-F);break}return[[V,W],[V,W+F]]}var $=n.get(a,H)||0,Z=Nt($,[y,x],g,!0),J;switch(_){case"left":J=f;break;case"center":J=f+(u-Z)/2;break;case"right":J=f+u-Z;break}return[[J,V],[J+Z,V]]};i==="ascending"&&(C=-C,w=-w,l?f+=u:v+=c,h=h.reverse());for(var A=0;AWpe)return;var a=this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]);a.behavior!=="none"&&this._dispatchExpand({axisExpandWindow:a.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(e){if(!(this._mouseDownPoint||!l2(this,"mousemove"))){var t=this._model,r=t.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]),n=r.behavior;n==="jump"&&this._throttledDispatchExpand.debounceNextCall(t.get("axisExpandDebounce")),this._throttledDispatchExpand(n==="none"?null:{axisExpandWindow:r.axisExpandWindow,animation:n==="jump"?null:{duration:0}})}}};function l2(e,t){var r=e._model;return r.get("axisExpandable")&&r.get("axisExpandTriggerOn")===t}var Ab="parallel",BA=Ab,Ype=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(){e.prototype.init.apply(this,arguments),this.mergeOption({})},t.prototype.mergeOption=function(r){var n=this.option;r&&Je(n,r,!0),this._initDimensions()},t.prototype.contains=function(r,n){var a=r.get("parallelIndex");return a!=null&&n.getComponent("parallel",a)===this},t.prototype.setAxisExpand=function(r){R(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],function(n){r.hasOwnProperty(n)&&(this.option[n]=r[n])},this)},t.prototype._initDimensions=function(){var r=this.dimensions=[],n=this.parallelAxisIndex=[],a=It(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(i){return(i.get("parallelIndex")||0)===this.componentIndex},this);R(a,function(i){r.push("dim"+i.get("dim")),n.push(i.componentIndex)})},t.type=BA,t.dependencies=["parallelAxis"],t.layoutMode="box",t.defaultOption={z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null},t}(ht),Xpe=function(e){X(t,e);function t(r,n,a,i,o){var s=e.call(this,r,n,a)||this;return s.type=i||"value",s.axisIndex=o,s}return t.prototype.isHorizontal=function(){return this.coordinateSystem.getModel().get("layout")!=="horizontal"},t}(Si);function uu(e,t,r,n,a,i){e=e||0;var o=pc(r[1],-r[0]);if(a!=null&&(a=Td(a,[0,o])),i!=null&&(i=Math.max(i,a??0)),n==="all"){var s=Math.abs(pc(t[1],-t[0]));s=Td(s,[0,o]),a=i=Td(s,[a,i]),n=0}t[0]=Td(t[0],r),t[1]=Td(t[1],r);var l=u2(t,n);t[n]+=e;var u=a||0,c=r.slice();l.sign<0?c[0]=pc(c[0],u):c[1]=pc(c[1],-u),t[n]=Td(t[n],c);var h;return h=u2(t,n),a!=null&&(h.sign!==l.sign||h.spani&&(t[1-n]=pc(t[n],h.sign*i)),t}function u2(e,t){var r=e[t]-e[1-t];return{span:Math.abs(r),sign:r>0?-1:r<0?1:t?-1:1}}function Td(e,t){return Math.min(t[1]!=null?t[1]:1/0,Math.max(t[0]!=null?t[0]:-1/0,e))}var qpe=function(){function e(t,r,n){this.type=Ab,this._axesMap=we(),this._axesLayout={},this.dimensions=t.dimensions,this._model=t,this._init(t,r,n)}return e.prototype._init=function(t,r,n){var a=t.dimensions,i=t.parallelAxisIndex;R(a,function(o,s){var l=i[s],u=r.getComponent("parallelAxis",l),c=Km(u),h=this._axesMap.set(o,new Xpe(o,Sv(u,c,!1),[0,0],c,l));h.onBand=Qm(h.scale,u),h.inverse=u.get("inverse"),u.axis=h,h.model=u,h.coordinateSystem=u.coordinateSystem=this},this)},e.prototype.update=function(t,r){R(this.dimensions,function(n){var a=this._axesMap.get(n);fh(a,Vf),Gf(a)},this)},e.prototype.containPoint=function(t){var r=this._makeLayoutInfo(),n=r.axisBase,a=r.layoutBase,i=r.pixelDimIndex,o=t[1-i],s=t[i];return o>=n&&o<=n+r.axisLength&&s>=a&&s<=a+r.layoutLength},e.prototype.getModel=function(){return this._model},e.prototype.resize=function(t,r){var n=Ur(t,r).refContainer;this._rect=tr(t.getBoxLayoutParams(),n),this._layoutAxes()},e.prototype.getRect=function(){return this._rect},e.prototype._makeLayoutInfo=function(){var t=this._model,r=this._rect,n=["x","y"],a=["width","height"],i=t.get("layout"),o=i==="horizontal"?0:1,s=r[a[o]],l=[0,s],u=this.dimensions.length,c=U0(t.get("axisExpandWidth"),l),h=U0(t.get("axisExpandCount")||0,[0,u]),f=t.get("axisExpandable")&&u>3&&u>h&&h>1&&c>0&&s>0,v=t.get("axisExpandWindow"),g;if(v)g=U0(v[1]-v[0],l),v[1]=v[0]+g;else{g=U0(c*(h-1),l);var m=t.get("axisExpandCenter")||gi(u/2);v=[c*m-g/2],v[1]=v[0]+g}var y=(s-g)/(u-h);y<3&&(y=0);var x=[gi(Mt(v[0]/c,1))+1,Ph(Mt(v[1]/c,1))-1],_=y/c*v[0];return{layout:i,pixelDimIndex:o,layoutBase:r[n[o]],layoutLength:s,axisBase:r[n[1-o]],axisLength:r[a[1-o]],axisExpandable:f,axisExpandWidth:c,axisCollapseWidth:y,axisExpandWindow:v,axisCount:u,winInnerIndices:x,axisExpandWindow0Pos:_}},e.prototype._layoutAxes=function(){var t=this._rect,r=this._axesMap,n=this.dimensions,a=this._makeLayoutInfo(),i=a.layout;r.each(function(o){var s=[0,a.axisLength],l=o.inverse?1:0;o.setExtent(s[l],s[1-l])}),R(n,function(o,s){var l=(a.axisExpandable?Jpe:Kpe)(s,a),u={horizontal:{x:l.position,y:a.axisLength},vertical:{x:0,y:l.position}},c={horizontal:R_/2,vertical:0},h=[u[i].x+t.x,u[i].y+t.y],f=c[i],v=ar();Js(v,v,f),Hi(v,v,h),this._axesLayout[o]={position:h,rotation:f,transform:v,axisNameAvailableWidth:l.axisNameAvailableWidth,axisLabelShow:l.axisLabelShow,nameTruncateMaxWidth:l.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},e.prototype.getAxis=function(t){return this._axesMap.get(t)},e.prototype.dataToPoint=function(t,r){return this.axisCoordToPoint(this._axesMap.get(r).dataToCoord(t),r)},e.prototype.eachActiveState=function(t,r,n,a){n==null&&(n=0),a==null&&(a=t.count());var i=this._axesMap,o=this.dimensions,s=[],l=[];R(o,function(y){s.push(t.mapDimension(y)),l.push(i.get(y).model)});for(var u=this.hasAxisBrushed(),c=n;ci*(1-h[0])?(u="jump",l=s-i*(1-h[2])):(l=s-i*h[1])>=0&&(l=s-i*(1-h[1]))<=0&&(l=0),l*=r.axisExpandWidth/c,l?uu(l,a,o,"all"):u="none";else{var v=a[1]-a[0],g=o[1]*s/v;a=[at(0,g-v/2)],a[1]=Et(o[1],a[0]+v),a[0]=a[1]-v}return{axisExpandWindow:a,behavior:u}},e}();function U0(e,t){return Et(at(e,t[0]),t[1])}function Kpe(e,t){var r=t.layoutLength/(t.axisCount-1);return{position:r*e,axisNameAvailableWidth:r,axisLabelShow:!0}}function Jpe(e,t){var r=t.layoutLength,n=t.axisExpandWidth,a=t.axisCount,i=t.axisCollapseWidth,o=t.winInnerIndices,s,l=i,u=!1,c;return e=0;a--)on(n[a])},t.prototype.getActiveState=function(r){var n=this.activeIntervals;if(!n.length)return"normal";if(r==null||isNaN(+r))return"inactive";if(n.length===1){var a=n[0];if(a[0]<=r&&r<=a[1])return"active"}else for(var i=0,o=n.length;inge}function B9(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function F9(e,t,r,n){var a=new De;return a.add(new it({name:"main",style:VI(r),silent:!0,draggable:!0,cursor:"move",drift:nt(e4,e,t,a,["n","s","w","e"]),ondragend:nt(wh,t,{isEnd:!0})})),R(n,function(i){a.add(new it({name:i.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:nt(e4,e,t,a,i),ondragend:nt(wh,t,{isEnd:!0})}))}),a}function V9(e,t,r,n){var a=n.brushStyle.lineWidth||0,i=$f(a,age),o=r[0][0],s=r[1][0],l=o-a/2,u=s-a/2,c=r[0][1],h=r[1][1],f=c-i+a/2,v=h-i+a/2,g=c-o,m=h-s,y=g+a,x=m+a;ps(e,t,"main",o,s,g,m),n.transformable&&(ps(e,t,"w",l,u,i,x),ps(e,t,"e",f,u,i,x),ps(e,t,"n",l,u,y,i),ps(e,t,"s",l,v,y,i),ps(e,t,"nw",l,u,i,i),ps(e,t,"ne",f,u,i,i),ps(e,t,"sw",l,v,i,i),ps(e,t,"se",f,v,i,i))}function GA(e,t){var r=t.__brushOption,n=r.transformable,a=t.childAt(0);a.useStyle(VI(r)),a.attr({silent:!n,cursor:n?"move":"default"}),R([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(i){var o=t.childOfName(i.join("")),s=i.length===1?HA(e,i[0]):cge(e,i);o&&o.attr({silent:!n,invisible:!n,cursor:n?oge[s]+"-resize":null})})}function ps(e,t,r,n,a,i,o){var s=t.childOfName(r);s&&s.setShape(dge(GI(e,t,[[n,a],[n+i,a+o]])))}function VI(e){return Ee({strokeNoScale:!0},e.brushStyle)}function G9(e,t,r,n){var a=[Tm(e,r),Tm(t,n)],i=[$f(e,r),$f(t,n)];return[[a[0],i[0]],[a[1],i[1]]]}function uge(e){return Vc(e.group)}function HA(e,t){var r={w:"left",e:"right",n:"top",s:"bottom"},n={left:"w",right:"e",top:"n",bottom:"s"},a=O1(r[t],uge(e));return n[a]}function cge(e,t){var r=[HA(e,t[0]),HA(e,t[1])];return(r[0]==="e"||r[0]==="w")&&r.reverse(),r.join("")}function e4(e,t,r,n,a,i){var o=r.__brushOption,s=e.toRectRange(o.range),l=H9(t,a,i);R(n,function(u){var c=ige[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=e.fromRectRange(G9(s[0][0],s[1][0],s[0][1],s[1][1])),zI(t,r),wh(t,{isEnd:!1})}function hge(e,t,r,n){var a=t.__brushOption.range,i=H9(e,r,n);R(a,function(o){o[0]+=i[0],o[1]+=i[1]}),zI(e,t),wh(e,{isEnd:!1})}function H9(e,t,r){var n=e.group,a=n.transformCoordToLocal(t,r),i=n.transformCoordToLocal(0,0);return[a[0]-i[0],a[1]-i[1]]}function GI(e,t,r){var n=z9(e,t);return n&&n!==bh?n.clipPath(r,e._transform):ke(r)}function dge(e){var t=Tm(e[0][0],e[1][0]),r=Tm(e[0][1],e[1][1]),n=$f(e[0][0],e[1][0]),a=$f(e[0][1],e[1][1]);return{x:t,y:r,width:n-t,height:a-r}}function fge(e,t,r){if(!(!e._brushType||pge(e,t.offsetX,t.offsetY))){var n=e._zr,a=e._covers,i=FI(e,t,r);if(!e._dragging)for(var o=0;on.getWidth()||r<0||r>n.getHeight()}var cw={lineX:n4(0),lineY:n4(1),rect:{createCover:function(e,t){function r(n){return n}return F9({toRectRange:r,fromRectRange:r},e,t,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(e){var t=B9(e);return G9(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,r,n){V9(e,t,r,n)},updateCommon:GA,contain:WA},polygon:{createCover:function(e,t){var r=new De;return r.add(new un({name:"main",style:VI(t),silent:!0})),r},getCreatingRange:function(e){return e},endCreating:function(e,t){t.remove(t.childAt(0)),t.add(new Sn({name:"main",draggable:!0,drift:nt(hge,e,t),ondragend:nt(wh,e,{isEnd:!0})}))},updateCoverShape:function(e,t,r,n){t.childAt(0).setShape({points:GI(e,t,r)})},updateCommon:GA,contain:WA}};function n4(e){return{createCover:function(t,r){return F9({toRectRange:function(n){var a=[n,[0,100]];return e&&a.reverse(),a},fromRectRange:function(n){return n[e]}},t,r,[[["w"],["e"]],[["n"],["s"]]][e])},getCreatingRange:function(t){var r=B9(t),n=Tm(r[0][e],r[1][e]),a=$f(r[0][e],r[1][e]);return[n,a]},updateCoverShape:function(t,r,n,a){var i,o=z9(t,r);if(o!==bh&&o.getLinearBrushOtherExtent)i=o.getLinearBrushOtherExtent(e);else{var s=t._zr;i=[0,[s.getWidth(),s.getHeight()][1-e]]}var l=[n,i];e&&l.reverse(),V9(t,r,l,a)},updateCommon:GA,contain:WA}}function W9(e){return e=HI(e),function(t){return aL(t,e)}}function $9(e,t){return e=HI(e),function(r){var n=t??r,a=n?e.width:e.height,i=n?e.x:e.y;return[i,i+(a||0)]}}function Z9(e,t,r){var n=HI(e);return function(a,i){return n.contain(i[0],i[1])&&!F8(a,t,r)}}function HI(e){return je.create(e)}var gge=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){e.prototype.init.apply(this,arguments),(this._brushController=new OI(n.getZr())).on("brush",be(this._onBrush,this))},t.prototype.render=function(r,n,a,i){if(!mge(r,n,i)){this.axisModel=r,this.api=a,this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new De,this.group.add(this._axisGroup),!!r.get("show")){var s=xge(r,n),l=s.coordinateSystem,u=r.getAreaSelectStyle(),c=u.width,h=r.axis.dim,f=l.getAxisLayout(h),v=te({strokeContainThreshold:c},f),g=new Jn(r,a,v);g.build(),this._axisGroup.add(g.group),this._refreshBrushController(v,u,r,s,c,a),$m(o,this._axisGroup,r)}}},t.prototype._refreshBrushController=function(r,n,a,i,o,s){var l=a.axis.getExtent(),u=l[1]-l[0],c=Math.min(30,Math.abs(u)*.1),h=je.create({x:l[0],y:-o/2,width:u,height:o});h.x-=c,h.width+=2*c,this._brushController.mount({enableGlobalPan:!0,rotation:r.rotation,x:r.position[0],y:r.position[1]}).setPanels([{panelId:"pl",clipPath:W9(h),isTargetByCursor:Z9(h,s,i),getLinearBrushOtherExtent:$9(h,0)}]).enableBrush({brushType:"lineX",brushStyle:n,removeOnClick:!0}).updateCovers(yge(a))},t.prototype._onBrush=function(r){var n=r.areas,a=this.axisModel,i=a.axis,o=oe(n,function(s){return[i.coordToData(s.range[0],!0),i.coordToData(s.range[1],!0)]});(!a.option.realtime===r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:a.id,intervals:o})},t.prototype.dispose=function(){this._brushController.dispose()},t.type="parallelAxis",t}(Yt);function mge(e,t,r){return r&&r.type==="axisAreaSelect"&&t.findComponents({mainType:"parallelAxis",query:r})[0]===e}function yge(e){var t=e.axis;return oe(e.activeIntervals,function(r){return{brushType:"lineX",panelId:"pl",range:[t.dataToCoord(r[0],!0),t.dataToCoord(r[1],!0)]}})}function xge(e,t){return t.getComponent("parallel",e.get("parallelIndex"))}var _ge={type:"axisAreaSelect",event:"axisAreaSelected"};function bge(e){e.registerAction(_ge,function(t,r){r.eachComponent({mainType:"parallelAxis",query:t},function(n){n.axis.model.setActiveIntervals(t.intervals)})}),e.registerAction("parallelAxisExpand",function(t,r){r.eachComponent({mainType:"parallel",query:t},function(n){n.setAxisExpand(t)})})}var wge={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function Y9(e){e.registerComponentView($pe),e.registerComponentModel(Ype),e.registerCoordinateSystem("parallel",ege),e.registerPreprocessor(Gpe),e.registerComponentModel(FA),e.registerComponentView(gge),Uf(e,"parallel",FA,wge),bge(e)}function Sge(e){rt(Y9),e.registerChartView(jpe),e.registerSeriesModel(Ope),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,Vpe)}var Xs="sankey",Cge=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){var a=r.edges||r.links||[],i=r.data||r.nodes||[],o=r.levels||[];this.levelModels=[];for(var s=this.levelModels,l=0;l=0&&(s[o[l].depth]=new vt(o[l],this,n));var u=II(i,a,this,!0,c);return u.data;function c(h,f){h.wrapMethod("getItemModel",function(v,g){var m=v.parentModel,y=m.getData().getItemLayout(g);if(y){var x=y.depth,_=m.levelModels[x];_&&(v.parentModel=_)}return v}),f.wrapMethod("getItemModel",function(v,g){var m=v.parentModel,y=m.getGraph().getEdgeByIndex(g),x=y.node1.getLayout();if(x){var _=x.depth,w=m.levelModels[_];w&&(v.parentModel=w)}return v})}},t.prototype.setNodePosition=function(r,n){var a=this.option.data||this.option.nodes,i=a[r];i.localX=n[0],i.localY=n[1]},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(r,n,a){function i(v){return isNaN(v)||v==null}if(a==="edge"){var o=this.getDataParams(r,a),s=o.data,l=o.value,u=s.source+" -- "+s.target;return Er("nameValue",{name:u,value:l,noValue:i(l)})}else{var c=this.getGraph().getNodeByIndex(r),h=c.getLayout().value,f=this.getDataParams(r,a).data.name;return Er("nameValue",{name:f!=null?f+"":null,value:h,noValue:i(h)})}},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(r,n){var a=e.prototype.getDataParams.call(this,r,n);if(a.value==null&&n==="node"){var i=this.getGraph().getNodeByIndex(r),o=i.getLayout().value;a.value=o}return a},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type="series."+Xs,t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,roam:!1,roamTrigger:"global",center:null,zoom:1,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:K.color.neutral50,opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:K.color.primary}},animationEasing:"linear",animationDuration:1e3},t}(Ut),Tge=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return e}(),Mge=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new Tge},t.prototype.buildPath=function(r,n){var a=n.extent;r.moveTo(n.x1,n.y1),r.bezierCurveTo(n.cpx1,n.cpy1,n.cpx2,n.cpy2,n.x2,n.y2),n.orient==="vertical"?(r.lineTo(n.x2+a,n.y2),r.bezierCurveTo(n.cpx2+a,n.cpy2,n.cpx1+a,n.cpy1,n.x1+a,n.y1)):(r.lineTo(n.x2,n.y2+a),r.bezierCurveTo(n.cpx2,n.cpy2+a,n.cpx1,n.cpy1+a,n.x1,n.y1+a)),r.closePath()},t.prototype.highlight=function(){Us(this)},t.prototype.downplay=function(){Ws(this)},t}(pt),Age=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Xs,r._mainGroup=new De,r}return t.prototype.init=function(r,n){this._controller=new Hh(n.getZr()),this.group.add(this._mainGroup),this._firstRender=!0},t.prototype.render=function(r,n,a){var i=r.getGraph(),o=this._mainGroup,s=r.layoutInfo,l=s.width,u=s.height,c=r.getData(),h=r.getData("edge"),f=r.get("orient");o.removeAll(),o.x=s.x,o.y=s.y,this._updateViewCoordSys(r,a),sw(r,a,this._controller,Q8(o),null),i.eachEdge(function(v){var g=new Mge,m=Be(g);m.dataIndex=v.dataIndex,m.seriesIndex=r.seriesIndex,m.dataType="edge";var y=v.getModel(),x=y.getModel("lineStyle"),_=x.get("curveness"),w=v.node1.getLayout(),S=v.node1.getModel(),C=S.get("localX"),M=S.get("localY"),A=v.node2.getLayout(),I=v.node2.getModel(),k=I.get("localX"),P=I.get("localY"),D=v.getLayout(),z,j,B,H,V,U,F,W;g.shape.extent=Math.max(1,D.dy),g.shape.orient=f,f==="vertical"?(z=(C!=null?C*l:w.x)+D.sy,j=(M!=null?M*u:w.y)+w.dy,B=(k!=null?k*l:A.x)+D.ty,H=P!=null?P*u:A.y,V=z,U=j*(1-_)+H*_,F=B,W=j*_+H*(1-_)):(z=(C!=null?C*l:w.x)+w.dx,j=(M!=null?M*u:w.y)+D.sy,B=k!=null?k*l:A.x,H=(P!=null?P*u:A.y)+D.ty,V=z*(1-_)+B*_,U=j,F=z*_+B*(1-_),W=H),g.setShape({x1:z,y1:j,x2:B,y2:H,cpx1:V,cpy1:U,cpx2:F,cpy2:W}),g.useStyle(x.getItemStyle()),a4(g.style,f,v);var $=""+y.get("value"),Z=Gr(y,"edgeLabel");Jr(g,Z,{labelFetcher:{getFormattedLabel:function(Q,le,de,He,ye,ne){return r.getFormattedLabel(Q,le,"edge",He,ya(ye,Z.normal&&Z.normal.get("formatter"),$),ne)}},labelDataIndex:v.dataIndex,defaultText:$}),g.setTextConfig({position:"inside"});var J=y.getModel("emphasis");Vr(g,y,"lineStyle",function(Q){var le=Q.getItemStyle();return a4(le,f,v),le}),o.add(g),h.setItemGraphicEl(v.dataIndex,g);var re=J.get("focus");ir(g,re==="adjacency"?v.getAdjacentDataIndices():re==="trajectory"?v.getTrajectoryDataIndices():re,J.get("blurScope"),J.get("disabled"))}),i.eachNode(function(v){var g=v.getLayout(),m=v.getModel(),y=m.get("localX"),x=m.get("localY"),_=m.getModel("emphasis"),w=m.get(["itemStyle","borderRadius"])||0,S=new it({shape:{x:y!=null?y*l:g.x,y:x!=null?x*u:g.y,width:g.dx,height:g.dy,r:w},style:m.getModel("itemStyle").getItemStyle(),z2:10});Jr(S,Gr(m),{labelFetcher:{getFormattedLabel:function(M,A){return r.getFormattedLabel(M,A,"node")}},labelDataIndex:v.dataIndex,defaultText:v.id}),S.disableLabelAnimation=!0,S.setStyle("fill",v.getVisual("color")),S.setStyle("decal",v.getVisual("style").decal),Vr(S,m),o.add(S),c.setItemGraphicEl(v.dataIndex,S),Be(S).dataType="node";var C=_.get("focus");ir(S,C==="adjacency"?v.getAdjacentDataIndices():C==="trajectory"?v.getTrajectoryDataIndices():C,_.get("blurScope"),_.get("disabled"))}),c.eachItemGraphicEl(function(v,g){var m=c.getItemModel(g);m.get("draggable")&&(v.drift=function(y,x){this.shape.x+=y,this.shape.y+=x,this.dirty(),a.dispatchAction({type:"dragNode",seriesId:r.id,dataIndex:c.getRawIndex(g),localX:this.shape.x/l,localY:this.shape.y/u})},v.draggable=!0,v.cursor="move")}),!this._data&&r.isAnimationEnabled()&&o.setClipPath(Nge(o.getBoundingRect(),r,function(){o.removeClipPath()})),this._data=r.getData(),this._firstRender=!1},t.prototype.__updateOnOwnRoam=function(r,n,a){lu(this.group,$o,n.coordinateSystem,null)},t.prototype.dispose=function(){this._controller&&this._controller.dispose()},t.prototype._updateViewCoordSys=function(r,n){var a=r.layoutInfo,i=r.coordinateSystem=CI(r,n,a.x,a.y,a.width,a.height);lu(this.group,$o,i,this._firstRender?null:r)},t.type=Xs,t}(Rt);function a4(e,t,r){switch(e.fill){case"source":e.fill=r.node1.getVisual("color"),e.decal=r.node1.getVisual("style").decal;break;case"target":e.fill=r.node2.getVisual("color"),e.decal=r.node2.getVisual("style").decal;break;case"gradient":var n=r.node1.getVisual("color"),a=r.node2.getVisual("color");ve(n)&&ve(a)&&(e.fill=new Eh(0,0,+(t==="horizontal"),+(t==="vertical"),[{color:n,offset:0},{color:a,offset:1}]))}}function Nge(e,t,r){var n=new it({shape:{x:e.x-10,y:e.y-10,width:0,height:e.height+20}});return Qt(n,{shape:{width:e.width+20}},t,r),n}var kge=Hr(Xs,Lge);function Lge(e,t){e.eachSeriesByType(Xs,function(r){var n=r.get("nodeWidth"),a=r.get("nodeGap"),i=Ur(r,t).refContainer,o=tr(r.getBoxLayoutParams(),i);r.layoutInfo=o;var s=o.width,l=o.height,u=r.getGraph(),c=u.nodes,h=u.edges;Pge(c);var f=It(c,function(y){return y.getLayout().value===0}),v=f.length!==0?0:r.get("layoutIterations"),g=r.get("orient"),m=r.get("nodeAlign");Ige(c,h,n,a,s,l,v,g,m)})}function Ige(e,t,r,n,a,i,o,s,l){Dge(e,t,r,a,i,s,l),Oge(e,t,i,a,n,o,s),$ge(e,s)}function Pge(e){R(e,function(t){var r=eu(t.outEdges,Nb),n=eu(t.inEdges,Nb),a=t.getValue()||0,i=Math.max(r,n,a);t.setLayout({value:i},!0)})}function Dge(e,t,r,n,a,i,o){for(var s=[],l=[],u=[],c=[],h=0,f=0;f=0;x&&y.depth>v&&(v=y.depth),m.setLayout({depth:x?y.depth:h},!0),i==="vertical"?m.setLayout({dy:r},!0):m.setLayout({dx:r},!0);for(var _=0;_h-1?v:h-1;o&&o!=="left"&&jge(e,o,i,A);var I=i==="vertical"?(a-r)/A:(n-r)/A;Rge(e,I,i)}function X9(e){var t=e.hostGraph.data.getRawDataItem(e.dataIndex);return t.depth!=null&&t.depth>=0}function jge(e,t,r,n){if(t==="right"){for(var a=[],i=e,o=0;i.length;){for(var s=0;s0;i--)l*=.99,Fge(s,l,o),c2(s,a,r,n,o),Wge(s,l,o),c2(s,a,r,n,o)}function zge(e,t){var r=[],n=t==="vertical"?"y":"x",a=AM(e,function(i){return i.getLayout()[n]});return on(a.keys),R(a.keys,function(i){r.push(a.buckets.get(i))}),r}function Bge(e,t,r,n,a,i){var o=1/0;R(e,function(s){var l=s.length,u=0;R(s,function(h){u+=h.getLayout().value});var c=i==="vertical"?(n-(l-1)*a)/u:(r-(l-1)*a)/u;c0&&(s=l.getLayout()[i]+u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[i]+l.getLayout()[f]+t;var g=a==="vertical"?n:r;if(u=c-t-g,u>0){s=l.getLayout()[i]-u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0),c=s;for(var v=h-2;v>=0;--v)l=o[v],u=l.getLayout()[i]+l.getLayout()[f]+t-c,u>0&&(s=l.getLayout()[i]-u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[i]}})}function Fge(e,t,r){R(e.slice().reverse(),function(n){R(n,function(a){if(a.outEdges.length){var i=eu(a.outEdges,Vge,r)/eu(a.outEdges,Nb);if(isNaN(i)){var o=a.outEdges.length;i=o?eu(a.outEdges,Gge,r)/o:0}if(r==="vertical"){var s=a.getLayout().x+(i-cu(a,r))*t;a.setLayout({x:s},!0)}else{var l=a.getLayout().y+(i-cu(a,r))*t;a.setLayout({y:l},!0)}}})})}function Vge(e,t){return cu(e.node2,t)*e.getValue()}function Gge(e,t){return cu(e.node2,t)}function Hge(e,t){return cu(e.node1,t)*e.getValue()}function Uge(e,t){return cu(e.node1,t)}function cu(e,t){return t==="vertical"?e.getLayout().x+e.getLayout().dx/2:e.getLayout().y+e.getLayout().dy/2}function Nb(e){return e.getValue()}function eu(e,t,r){for(var n=0,a=e.length,i=-1;++io&&(o=l)}),R(n,function(s){var l=new Kr({type:"color",mappingMethod:"linear",dataExtent:[i,o],visual:t.get("color")}),u=l.mapValueToVisual(s.getLayout().value),c=s.getModel().get(["itemStyle","color"]);c!=null?(s.setVisual("color",c),s.setVisual("style",{fill:c})):(s.setVisual("color",u),s.setVisual("style",{fill:u}))})}a.length&&R(a,function(s){var l=s.getModel().get("lineStyle");s.setVisual("style",l)})})}function Xge(e){e.registerChartView(Age),e.registerSeriesModel(Cge),e.registerLayout(kge),e.registerVisual(Zge),e.registerAction({type:"dragNode",event:"dragnode",update:"update"},function(t,r){r.eachComponent({mainType:Ho,subType:Xs,query:t},function(n){n.setNodePosition(t.dataIndex,[t.localX,t.localY])})}),SI(e,Ho,Xs)}var q9=function(){function e(){}return e.prototype._hasEncodeRule=function(t){var r=this.getEncode();return r&&r.get(t)!=null},e.prototype.getInitialData=function(t,r){var n,a=r.getComponent("xAxis",this.get("xAxisIndex")),i=r.getComponent("yAxis",this.get("yAxisIndex")),o=a.get("type"),s=i.get("type"),l,u=t.layout;o==="category"?(u="horizontal",n=a.getOrdinalMeta(),l=!this._hasEncodeRule("x")):s==="category"&&(u="vertical",n=i.getOrdinalMeta(),l=!this._hasEncodeRule("y")),u||(u=s==="time"?"vertical":"horizontal"),this._layout=u;var c=["x","y"],h=u==="horizontal"?0:1,f=this._baseAxisDim=c[h],v=c[1-h],g=[a,i],m=g[h].get("type"),y=g[1-h].get("type"),x=t.data;if(x&&l){var _=[];R(x,function(C,M){var A;ae(C)?(A=C.slice(),C.unshift(M)):ae(C.value)?(A=te({},C),A.value=A.value.slice(),C.value.unshift(M)):A=C,_.push(A)}),t.data=_}var w=this.defaultValueDimensions,S=[{name:f,type:nb(m),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:v,type:nb(y),dimsDef:w.slice()}];return Av(this,{coordDimensions:S,dimensionsCount:w.length+1,encodeDefaulter:nt(TH,S,this)})},e.prototype.getBaseAxis=function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis},e.prototype.getWhiskerBoxesLayout=function(){return this._layout},e}();function kb(e,t){for(var r=t.ends.length,n=0,a=0;am){var S=[x,w];n.push(S)}}}return{boxData:r,outliers:n}}var sme={type:"echarts:boxplot",transform:function(t){var r=t.upstream;if(r.sourceFormat!==ln){var n="";Lt(n)}var a=ome(r.getRawData(),t.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:a.boxData},{data:a.outliers}]}};function lme(e){e.registerSeriesModel(K9),e.registerChartView(qge),e.registerLayout(tme),e.registerTransform(sme),ime(e)}var hu="candlestick",Q9=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.defaultValueDimensions=[{name:"open",defaultTooltip:!0},{name:"close",defaultTooltip:!0},{name:"lowest",defaultTooltip:!0},{name:"highest",defaultTooltip:!0}],r}return t.prototype.getShadowDim=function(){return"open"},t.prototype.brushSelector=function(r,n,a){var i=n.getItemLayout(r);return i&&a.rect(i.brushRect)},t.type="series."+hu,t.dependencies=["xAxis","yAxis","grid"],t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,clip:!0,itemStyle:{color:"#eb5454",color0:"#47b262",borderColor:"#eb5454",borderColor0:"#47b262",borderColorDoji:null,borderWidth:1},emphasis:{itemStyle:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,large:!0,largeThreshold:600,progressive:3e3,progressiveThreshold:1e4,progressiveChunkMode:"mod",animationEasing:"linear",animationDuration:300},t}(Ut);kr(Q9,q9,!0);var ume=["itemStyle","borderColor"],cme=["itemStyle","borderColor0"],hme=["itemStyle","borderColorDoji"],dme=["itemStyle","color"],fme=["itemStyle","color0"];function UI(e,t){return t.get(e>0?dme:fme)}function WI(e,t){return t.get(e===0?hme:e>0?ume:cme)}var vme={seriesType:hu,plan:Bh(),performRawSeries:!0,reset:function(e,t){if(!t.isSeriesFiltered(e)){var r=e.pipelineContext.large;return!r&&{progress:function(n,a){for(var i;(i=n.next())!=null;){var o=a.getItemModel(i),s=a.getItemLayout(i).sign,l=o.getItemStyle();l.fill=UI(s,o),l.stroke=WI(s,o)||l.fill;var u=a.ensureUniqueItemVisual(i,"style");te(u,l)}}}}}},pme=["color","borderColor"],gme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(r),this._isLargeDraw?this._renderLarge(r):this._renderNormal(r)},t.prototype.incrementalPrepareRender=function(r,n,a){this._clear(),this._updateDrawMode(r)},t.prototype.incrementalRender=function(r,n,a,i){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(r,n):this._incrementalRenderNormal(r,n)},t.prototype.eachRendered=function(r){Su(this._progressiveEls||this.group,r)},t.prototype._updateDrawMode=function(r){var n=r.pipelineContext.large;(this._isLargeDraw==null||n!==this._isLargeDraw)&&(this._isLargeDraw=n,this._clear())},t.prototype._renderNormal=function(r){var n=r.getData(),a=this._data,i=this.group,o=n.getLayout("isSimpleBox"),s=r.get("clip",!0),l=r.coordinateSystem,u=l.getArea&&l.getArea(),c=s&&vh(l,!1,r);this._data||i.removeAll();var h=o4(r);n.diff(a).add(function(f){if(n.hasValue(f)){var v=n.getItemLayout(f),g=s?kb(u,v):hm;if(g===fm)return;var m=h2(v,f,h,!0);Qt(m,{shape:{points:v.ends}},r,f),ef(g===dm,m,c),d2(m,n,f,o),i.add(m),n.setItemGraphicEl(f,m)}}).update(function(f,v){var g=a.getItemGraphicEl(v);if(!n.hasValue(f)){i.remove(g);return}var m=n.getItemLayout(f),y=s?kb(u,m):hm;if(y===fm){i.remove(g);return}g?(At(g,{shape:{points:m.ends}},r,f),xi(g)):g=h2(m,f,h),d2(g,n,f,o),ef(y===dm,g,c),i.add(g),n.setItemGraphicEl(f,g)}).remove(function(f){var v=a.getItemGraphicEl(f);v&&i.remove(v)}).execute(),this._data=n},t.prototype._renderLarge=function(r){this._clear(),s4(r,this.group);var n=r.get("clip",!0)?vh(r.coordinateSystem,!1,r):null;ef(!!n,this.group,n)},t.prototype._incrementalRenderNormal=function(r,n){for(var a=n.getData(),i=a.getLayout("isSimpleBox"),o=o4(n),s;(s=r.next())!=null;){var l=a.getItemLayout(s),u=h2(l,s,o);d2(u,a,s,i),u.incremental=Io(n),this.group.add(u),this._progressiveEls.push(u)}},t.prototype._incrementalRenderLarge=function(r,n){s4(n,this.group,this._progressiveEls,!0)},t.prototype.remove=function(r){this._clear()},t.prototype._clear=function(){this.group.removeAll(),ef(!1,this.group,null),this._data=null},t.type=hu,t}(Rt),mme=function(){function e(){}return e}(),yme=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="normalCandlestickBox",n}return t.prototype.getDefaultShape=function(){return new mme},t.prototype.buildPath=function(r,n){var a=n.points;this.__simpleBox?(r.moveTo(a[4][0],a[4][1]),r.lineTo(a[6][0],a[6][1])):(r.moveTo(a[0][0],a[0][1]),r.lineTo(a[1][0],a[1][1]),r.lineTo(a[2][0],a[2][1]),r.lineTo(a[3][0],a[3][1]),r.closePath(),r.moveTo(a[4][0],a[4][1]),r.lineTo(a[5][0],a[5][1]),r.moveTo(a[6][0],a[6][1]),r.lineTo(a[7][0],a[7][1]))},t}(pt);function h2(e,t,r,n){var a=e.ends;return new yme({shape:{points:n?xme(a,r,e):a},z2:100})}function d2(e,t,r,n){var a=t.getItemModel(r);e.useStyle(t.getItemVisual(r,"style")),e.style.strokeNoScale=!0;var i=a.getShallow("cursor");i&&e.attr("cursor",i),e.__simpleBox=n,Vr(e,a);var o=t.getItemLayout(r).sign;R(e.states,function(l,u){var c=a.getModel(u),h=UI(o,c),f=WI(o,c)||h,v=l.style||(l.style={});h&&(v.fill=h),f&&(v.stroke=f)});var s=a.getModel("emphasis");ir(e,s.get("focus"),s.get("blurScope"),s.get("disabled"))}function xme(e,t,r){return oe(e,function(n){return n=n.slice(),n[t]=r.initBaseline,n})}function o4(e){return e.getWhiskerBoxesLayout()==="horizontal"?1:0}var _me=function(){function e(){}return e}(),f2=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="largeCandlestickBox",n}return t.prototype.getDefaultShape=function(){return new _me},t.prototype.buildPath=function(r,n){for(var a=n.points,i=0;iC?D[i]:P[i],ends:B,brushRect:W(M,A,w)})}function U(Z,J){var re=[];return re[a]=J,re[i]=Z,isNaN(J)||isNaN(Z)?[NaN,NaN]:t.dataToPoint(re)}function F(Z,J,re){var Q=J.slice(),le=J.slice();Q[a]=Ox(Q[a]+n/2,1,!1),le[a]=Ox(le[a]-n/2,1,!0),re?Z.push(Q,le):Z.push(le,Q)}function W(Z,J,re){var Q=U(Z,re),le=U(J,re);return Q[a]-=n/2,le[a]-=n/2,{x:Q[0],y:Q[1],width:i?n:le[0]-Q[0],height:i?le[1]-Q[1]:n}}function $(Z){return Z[a]=Ox(Z[a],1),Z}}function g(m,y){for(var x=So(m.count*4),_=0,w,S=[],C=[],M,A=y.getStore(),I=!!e.get(["itemStyle","borderColorDoji"]);(M=m.next())!=null;){var k=A.get(s,M),P=A.get(u,M),D=A.get(c,M),z=A.get(h,M),j=A.get(f,M);if(isNaN(k)||isNaN(z)||isNaN(j)){x[_++]=NaN,_+=3;continue}x[_++]=l4(A,M,P,D,c,I),S[a]=k,S[i]=z,w=t.dataToPoint(S,null,C),x[_++]=w?w[0]:NaN,x[_++]=w?w[1]:NaN,S[i]=j,w=t.dataToPoint(S,null,C),x[_++]=w?w[1]:NaN}y.setLayout("largePoints",x)}}};function l4(e,t,r,n,a,i){var o;return r>n?o=-1:r0?e.get(a,t-1)<=n?1:-1:1,o}function Cme(e,t){var r=e.getBaseAxis(),n=Cn(r,{fromStat:{key:Uc(hu)},min:1}).w,a=me(Te(e.get("barMaxWidth"),n),n),i=me(Te(e.get("barMinWidth"),1),n),o=e.get("barWidth");return o!=null?me(o,n):at(Et(n/2,a),i)}function Tme(e){wme(e,function(){var t=Uc(hu);eI(e,{key:t,seriesType:hu,getMetrics:vI}),K1(t,tw(t))})}function Mme(e){e.registerChartView(gme),e.registerSeriesModel(Q9),e.registerPreprocessor(bme),e.registerVisual(vme),e.registerLayout(Sme),Tme(e)}function u4(e,t){var r=t.rippleEffectColor||t.color;e.eachChild(function(n){n.attr({z:t.z,zlevel:t.zlevel,style:{stroke:t.brushType==="stroke"?r:null,fill:t.brushType==="fill"?r:null}})})}var Ame=function(e){X(t,e);function t(r,n){var a=e.call(this)||this,i=new ey(r,n),o=new De;return a.add(i),a.add(o),a.updateData(r,n),a}return t.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},t.prototype.startEffectAnimation=function(r){for(var n=r.symbolType,a=r.color,i=r.rippleNumber,o=this.childAt(1),s=0;s0&&(s=this._getLineLength(i)/c*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){i.stopAnimation();var f=void 0;Le(h)?f=h(a):f=h,i.__t>0&&(f=-s*i.__t),this._animateSymbol(i,s,f,l,u)}this._period=s,this._loop=l,this._roundTrip=u}},t.prototype._animateSymbol=function(r,n,a,i,o){if(n>0){r.__t=0;var s=this,l=r.animate("",i).when(o?n*2:n,{__t:o?2:1}).delay(a).during(function(){s._updateSymbolPosition(r)});i||l.done(function(){s.remove(r)}),l.start()}},t.prototype._getLineLength=function(r){return Ss(r.__p1,r.__cp1)+Ss(r.__cp1,r.__p2)},t.prototype._updateAnimationPoints=function(r,n){r.__p1=n[0],r.__p2=n[1],r.__cp1=n[2]||[(n[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2]},t.prototype.updateData=function(r,n,a){this.childAt(0).updateData(r,n,a),this._updateEffectSymbol(r,n)},t.prototype._updateSymbolPosition=function(r){var n=r.__p1,a=r.__p2,i=r.__cp1,o=r.__t<=1?r.__t:2-r.__t,s=[r.x,r.y],l=s.slice(),u=an,c=dM;s[0]=u(n[0],i[0],a[0],o),s[1]=u(n[1],i[1],a[1],o);var h=r.__t<=1?c(n[0],i[0],a[0],o):c(a[0],i[0],n[0],1-o),f=r.__t<=1?c(n[1],i[1],a[1],o):c(a[1],i[1],n[1],1-o);r.rotation=-Math.atan2(f,h)-Math.PI/2,(this._symbolType==="line"||this._symbolType==="rect"||this._symbolType==="roundRect")&&(r.__lastT!==void 0&&r.__lastT=0&&!(i[l]<=n);l--);l=Math.min(l,o-2)}else{for(l=s;ln);l++);l=Math.min(l-1,o-2)}var c=(n-i[l])/(i[l+1]-i[l]),h=a[l],f=a[l+1];r.x=h[0]*(1-c)+c*f[0],r.y=h[1]*(1-c)+c*f[1];var v=r.__t<=1?f[0]-h[0]:h[0]-f[0],g=r.__t<=1?f[1]-h[1]:h[1]-f[1];r.rotation=-Math.atan2(g,v)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=n,r.ignore=!1}},t}(e$),Pme=function(){function e(){this.polyline=!1,this.curveness=0,this.segs=[]}return e}(),Dme=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.beforeBrush=function(r){r&&!r.contentRetained&&this.reset()},t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new Pme},t.prototype.buildPath=function(r,n){var a=n.segs,i=n.curveness,o;if(n.polyline)for(o=this._off;o0){r.moveTo(a[o++],a[o++]);for(var l=1;l0){var v=(u+h)/2-(c-f)*i,g=(c+f)/2-(h-u)*i;r.quadraticCurveTo(v,g,h,f)}else r.lineTo(h,f)}this.incremental&&(this._off=o,this.notClear=!0)},t.prototype.findDataIndex=function(r,n){var a=this.shape,i=a.segs,o=a.curveness,s=this.style.lineWidth;if(a.polyline)for(var l=0,u=0;u0)for(var h=i[u++],f=i[u++],v=1;v0){var y=(h+g)/2-(f-m)*o,x=(f+m)/2-(g-h)*o;if(l7(h,f,y,x,g,m,s,r,n))return l}else if(Sl(h,f,g,m,s,r,n))return l;l++}return-1},t.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();if(r=a[0],n=a[1],i.contain(r,n)){var o=this.hoverDataIdx=this.findDataIndex(r,n);return o>=0}return this.hoverDataIdx=-1,!1},t.prototype.getBoundingRect=function(){var r=this._rect;if(!r){for(var n=this.shape,a=n.segs,i=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u0&&(o.dataIndex=l+t.__startIndex)})},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),r$={seriesType:"lines",plan:Bh(),reset:function(e){var t=e.coordinateSystem;if(t){var r=e.get("polyline"),n=e.pipelineContext.large;return{progress:function(a,i){var o=[];if(n){var s=void 0,l=a.end-a.start;if(r){for(var u=0,c=a.start;c0&&c&&u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)}),o.updateData(i);var h=r.get("clip",!0)&&vh(r.coordinateSystem,!1,r);h?this.group.setClipPath(h):this.group.removeClipPath(),this._lastZlevel=s,this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,a){var i=r.getData(),o=this._updateLineDraw(i,r);o.incrementalPrepareUpdate(i),this._clearLayer(a),this._finished=!1},t.prototype.incrementalRender=function(r,n,a){this._lineDraw.incrementalUpdate(r,n.getData(),Io(n)),this._finished=r.end===n.getData().count()},t.prototype.eachRendered=function(r){this._lineDraw&&this._lineDraw.eachRendered(r)},t.prototype.updateTransform=function(r,n,a){var i=r.getData(),o=this._lineDraw;if(!this._finished||!o||!o.updateLayout)return{update:!0};var s=r$.reset(r,n,a);s.progress&&s.progress({start:0,end:i.count(),count:i.count()},i),o.updateLayout(),this._clearLayer(a)},t.prototype._updateLineDraw=function(r,n){var a=this._lineDraw,i=this._showEffect(n),o=!!n.get("polyline"),s=n.pipelineContext,l=s.large;return(!a||i!==this._hasEffet||o!==this._isPolyline||l!==this._isLargeDraw)&&(a&&a.remove(),a=this._lineDraw=l?new jme:new RI(o?i?Ime:t$:i?e$:EI),this._hasEffet=i,this._isPolyline=o,this._isLargeDraw=l),this.group.add(a.group),a},t.prototype._showEffect=function(r){return!!r.get(["effect","show"])},t.prototype._clearLayer=function(r){var n=GM(r);n&&this._lastZlevel!=null&&n.getLayer(this._lastZlevel).clear(!0)},t.prototype.remove=function(r,n){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(n)},t.prototype.dispose=function(r,n){this.remove(r,n)},t.type="lines",t}(Rt),Rme=typeof Uint32Array>"u"?Array:Uint32Array,Ome=typeof Float64Array>"u"?Array:Float64Array;function h4(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=oe(t,function(r){var n=[r[0].coord,r[1].coord],a={coords:n};return r[0].name&&(a.fromName=r[0].name),r[1].name&&(a.toName=r[1].name),y1([a,r[0],r[1]])}))}var zme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.visualStyleAccessPath="lineStyle",r.visualDrawType="stroke",r}return t.prototype.init=function(r){r.data=r.data||[],h4(r);var n=this._processFlatCoordsArray(r.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(r.data=new Float32Array(n.count)),e.prototype.init.apply(this,arguments)},t.prototype.mergeOption=function(r){if(h4(r),r.data){var n=this._processFlatCoordsArray(r.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(r.data=new Float32Array(n.count))}e.prototype.mergeOption.apply(this,arguments)},t.prototype.appendData=function(r){var n=this._processFlatCoordsArray(r.data);n.flatCoords&&(this._flatCoords?(this._flatCoords=Lf(this._flatCoords,n.flatCoords),this._flatCoordsOffset=Lf(this._flatCoordsOffset,n.flatCoordsOffset)):(this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset),r.data=new Float32Array(n.count)),this.getRawData().appendData(r.data)},t.prototype._getCoordsFromItemModel=function(r){var n=this.getData().getItemModel(r),a=n.option instanceof Array?n.option:n.getShallow("coords");return a},t.prototype.getLineCoordsCount=function(r){return this._flatCoordsOffset?this._flatCoordsOffset[r*2+1]:this._getCoordsFromItemModel(r).length},t.prototype.getLineCoords=function(r,n){if(this._flatCoordsOffset){for(var a=this._flatCoordsOffset[r*2],i=this._flatCoordsOffset[r*2+1],o=0;o ")}return Er("nameValue",{name:l,value:o,noValue:o==null||isNaN(o)})},t.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},t.prototype.getProgressive=function(){var r=this.option.progressive;return r??(this.option.large?1e4:this.get("progressive"))},t.prototype.getProgressiveThreshold=function(){var r=this.option.progressiveThreshold;return r??(this.option.large?2e4:this.get("progressiveThreshold"))},t.prototype.getZLevelKey=function(){var r=this.getModel("effect"),n=r.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:r.get("show")&&n>0?n+"":""},t.type="series.lines",t.dependencies=["grid","polar","geo","calendar"],t.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},t}(Ut);function W0(e){return e instanceof Array||(e=[e,e]),e}var Bme={seriesType:"lines",reset:function(e){var t=W0(e.get("symbol")),r=W0(e.get("symbolSize")),n=e.getData();n.setVisual("fromSymbol",t&&t[0]),n.setVisual("toSymbol",t&&t[1]),n.setVisual("fromSymbolSize",r&&r[0]),n.setVisual("toSymbolSize",r&&r[1]);function a(i,o){var s=i.getItemModel(o),l=W0(s.getShallow("symbol",!0)),u=W0(s.getShallow("symbolSize",!0));l[0]&&i.setItemVisual(o,"fromSymbol",l[0]),l[1]&&i.setItemVisual(o,"toSymbol",l[1]),u[0]&&i.setItemVisual(o,"fromSymbolSize",u[0]),u[1]&&i.setItemVisual(o,"toSymbolSize",u[1])}return{dataEach:n.hasItemOption?a:null}}};function Fme(e){e.registerChartView(Eme),e.registerSeriesModel(zme),e.registerLayout(r$),e.registerVisual(Bme)}var Vme=256,Gme=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var t=qr.createCanvas();this.canvas=t}return e.prototype.update=function(t,r,n,a,i,o){var s=this._getBrush(),l=this._getGradient(i,"inRange"),u=this._getGradient(i,"outOfRange"),c=this.pointSize+this.blurSize,h=this.canvas,f=h.getContext("2d"),v=t.length;h.width=r,h.height=n;for(var g=0;g0){var z=o(w)?l:u;w>0&&(w=w*P+I),C[M++]=z[D],C[M++]=z[D+1],C[M++]=z[D+2],C[M++]=z[D+3]*w*256}else M+=4}return f.putImageData(S,0,0),h},e.prototype._getBrush=function(){var t=this._brushCanvas||(this._brushCanvas=qr.createCanvas()),r=this.pointSize+this.blurSize,n=r*2;t.width=n,t.height=n;var a=t.getContext("2d");return a.clearRect(0,0,n,n),a.shadowOffsetX=n,a.shadowBlur=this.blurSize,a.shadowColor=K.color.neutral99,a.beginPath(),a.arc(-r,r,this.pointSize,0,Math.PI*2,!0),a.closePath(),a.fill(),t},e.prototype._getGradient=function(t,r){for(var n=this._gradientPixels,a=n[r]||(n[r]=new Uint8ClampedArray(256*4)),i=[0,0,0,0],o=0,s=0;s<256;s++)t[r](s/255,!0,i),a[o++]=i[0],a[o++]=i[1],a[o++]=i[2],a[o++]=i[3];return a},e}();function Hme(e,t,r){var n=e[1]-e[0];t=oe(t,function(o){return{interval:[(o.interval[0]-e[0])/n,(o.interval[1]-e[0])/n]}});var a=t.length,i=0;return function(o){var s;for(s=i;s=0;s--){var l=t[s].interval;if(l[0]<=o&&o<=l[1]){i=s;break}}return s>=0&&s=t[0]&&n<=t[1]}}var Wme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){var i;n.eachComponent("visualMap",function(s){s.eachTargetSeries(function(l){l===r&&(i=s)})}),this._progressiveEls=null,this.group.removeAll();var o=r.coordinateSystem;o.type==="cartesian2d"||o.type==="calendar"||o.type==="matrix"?this._renderOnGridLike(r,a,0,r.getData().count()):d5(o)&&this._renderOnGeo(o,r,i,a)},t.prototype.incrementalPrepareRender=function(r,n,a){this.group.removeAll()},t.prototype.incrementalRender=function(r,n,a,i){var o=n.coordinateSystem;o&&(d5(o)?this.render(n,a,i):(this._progressiveEls=[],this._renderOnGridLike(n,i,r.start,r.end,!0)))},t.prototype.eachRendered=function(r){Su(this._progressiveEls||this.group,r)},t.prototype._renderOnGridLike=function(r,n,a,i,o){var s=r.coordinateSystem,l=ph(s,"cartesian2d"),u=ph(s,"matrix"),c,h,f,v;if(l){var g=s.getAxis("x"),m=s.getAxis("y");c=Cn(g).w+.5,h=Cn(m).w+.5,f=g.scale.getExtent(),v=m.scale.getExtent()}for(var y=this.group,x=r.getData(),_=r.getModel(["emphasis","itemStyle"]).getItemStyle(),w=r.getModel(["blur","itemStyle"]).getItemStyle(),S=r.getModel(["select","itemStyle"]).getItemStyle(),C=r.get(["itemStyle","borderRadius"]),M=Gr(r),A=r.getModel("emphasis"),I=A.get("focus"),k=A.get("blurScope"),P=A.get("disabled"),D=l||u?[x.mapDimension("x"),x.mapDimension("y"),x.mapDimension("value")]:[x.mapDimension("time"),x.mapDimension("value")],z=a;zf[1]||Vv[1])continue;var U=s.dataToPoint([H,V]);j=new it({shape:{x:U[0]-c/2,y:U[1]-h/2,width:c,height:h},style:B})}else if(u){var F=s.dataToLayout([x.get(D[0],z),x.get(D[1],z)]).rect;if(yn(F.x))continue;j=new it({z2:1,shape:F,style:B})}else{if(isNaN(x.get(D[1],z)))continue;var W=s.dataToLayout([x.get(D[0],z)]),F=W.contentRect||W.rect;if(yn(F.x)||yn(F.y))continue;j=new it({z2:1,shape:F,style:B})}if(x.hasItemOption){var $=x.getItemModel(z),Z=$.getModel("emphasis");_=Z.getModel("itemStyle").getItemStyle(),w=$.getModel(["blur","itemStyle"]).getItemStyle(),S=$.getModel(["select","itemStyle"]).getItemStyle(),C=$.get(["itemStyle","borderRadius"]),I=Z.get("focus"),k=Z.get("blurScope"),P=Z.get("disabled"),M=Gr($)}j.shape.r=C;var J=r.getRawValue(z),re="-";J&&J[2]!=null&&(re=J[2]+""),Jr(j,M,{labelFetcher:r,labelDataIndex:z,defaultOpacity:B.opacity,defaultText:re}),j.ensureState("emphasis").style=_,j.ensureState("blur").style=w,j.ensureState("select").style=S,ir(j,I,k,P),j.incremental=Io(r,o),o&&(j.states.emphasis.hoverLayer=vv),y.add(j),x.setItemGraphicEl(z,j),this._progressiveEls&&this._progressiveEls.push(j)}},t.prototype._renderOnGeo=function(r,n,a,i){var o=a.targetVisuals.inRange,s=a.targetVisuals.outOfRange,l=n.getData(),u=this._hmLayer||this._hmLayer||new Gme;u.blurSize=n.get("blurSize"),u.pointSize=n.get("pointSize"),u.minOpacity=n.get("minOpacity"),u.maxOpacity=n.get("maxOpacity");var c=r.getViewRect().clone(),h=r.getRoamTransform();c.applyTransform(h);var f=Math.max(c.x,0),v=Math.max(c.y,0),g=Math.min(c.width+c.x,i.getWidth()),m=Math.min(c.height+c.y,i.getHeight()),y=g-f,x=m-v,_=[l.mapDimension("lng"),l.mapDimension("lat"),l.mapDimension("value")],w=l.mapArray(_,function(A,I,k){var P=r.dataToPoint([A,I]);return P[0]-=f,P[1]-=v,P.push(k),P}),S=a.getExtent(),C=a.type==="visualMap.continuous"?Ume(S,a.option.range):Hme(S,a.getPieceList(),a.option.selected);u.update(w,y,x,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:s.color.getColorMapper()},C);var M=new Qr({style:{width:y,height:x,x:f,y:v,image:u.canvas},silent:!0});this.group.add(M)},t.type="heatmap",t}(Rt),$me=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){return Jo(null,this,{generateCoord:"value"})},t.prototype.preventIncremental=function(){var r=yv.get(this.get("coordinateSystem"));if(r&&r.dimensions)return r.dimensions[0]==="lng"&&r.dimensions[1]==="lat"},t.type="series.heatmap",t.dependencies=["grid","geo","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:K.color.primary}}},t}(Ut);function Zme(e){e.registerChartView(Wme),e.registerSeriesModel($me)}var Yme=["itemStyle","borderWidth"],d4=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],p2=new Ko,Xme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=vm,r}return t.prototype.render=function(r,n,a){var i=this.group,o=r.getData(),s=this._data,l=r.coordinateSystem,u=l.getBaseAxis(),c=u.isHorizontal(),h=l.master.getRect(),f={ecSize:{width:a.getWidth(),height:a.getHeight()},seriesModel:r,coordSys:l,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:c,valueDim:d4[+c],categoryDim:d4[1-+c]};o.diff(s).add(function(g){if(o.hasValue(g)){var m=v4(o,g),y=f4(o,g,m,f),x=p4(o,f,y);o.setItemGraphicEl(g,x),i.add(x),m4(x,f,y)}}).update(function(g,m){var y=s.getItemGraphicEl(m);if(!o.hasValue(g)){i.remove(y);return}var x=v4(o,g),_=f4(o,g,x,f),w=l$(o,_);y&&w!==y.__pictorialShapeStr&&(i.remove(y),o.setItemGraphicEl(g,null),y=null),y?rye(y,f,_):y=p4(o,f,_,!0),o.setItemGraphicEl(g,y),y.__pictorialSymbolMeta=_,i.add(y),m4(y,f,_)}).remove(function(g){var m=s.getItemGraphicEl(g);m&&g4(s,g,m.__pictorialSymbolMeta.animationModel,m)}).execute();var v=r.get("clip",!0)?vh(r.coordinateSystem,!1,r):null;return v?i.setClipPath(v):i.removeClipPath(),this._data=o,this.group},t.prototype.remove=function(r,n){var a=this.group,i=this._data;r.get("animation")?i&&i.eachItemGraphicEl(function(o){g4(i,Be(o).dataIndex,r,o)}):a.removeAll()},t.type=vm,t}(Rt);function f4(e,t,r,n){var a=e.getItemLayout(t),i=r.get("symbolRepeat"),o=r.get("symbolClip"),s=r.get("symbolPosition")||"start",l=r.get("symbolRotate"),u=(l||0)*Math.PI/180||0,c=r.get("symbolPatternSize")||2,h=r.isAnimationEnabled(),f={dataIndex:t,layout:a,itemModel:r,symbolType:e.getItemVisual(t,"symbol")||"circle",style:e.getItemVisual(t,"style"),symbolClip:o,symbolRepeat:i,symbolRepeatDirection:r.get("symbolRepeatDirection"),symbolPatternSize:c,rotation:u,animationModel:h?r:null,hoverScale:h&&r.get(["emphasis","scale"]),z2:r.getShallow("z",!0)||0};qme(r,i,a,n,f),Kme(e,t,a,i,o,f.boundingLength,f.pxSign,c,n,f),Jme(r,f.symbolScale,u,n,f);var v=f.symbolSize,g=Fh(r.get("symbolOffset"),v);return Qme(r,v,a,i,o,g,s,f.valueLineWidth,f.boundingLength,f.repeatCutLength,n,f),f}function qme(e,t,r,n,a){var i=n.valueDim,o=e.get("symbolBoundingData"),s=n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()),l=s.toGlobalCoord(s.dataToCoord(0)),u=1-+(r[i.wh]<=0),c;if(ae(o)){var h=[g2(s,o[0])-l,g2(s,o[1])-l];h[1]=0?1:-1:c>0?1:-1}function g2(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function Kme(e,t,r,n,a,i,o,s,l,u){var c=l.valueDim,h=l.categoryDim,f=Math.abs(r[h.wh]),v=e.getItemVisual(t,"symbolSize"),g;ae(v)?g=v.slice():v==null?g=["100%","100%"]:g=[v,v],g[h.index]=me(g[h.index],f),g[c.index]=me(g[c.index],n?f:Math.abs(i)),u.symbolSize=g;var m=u.symbolScale=[g[0]/s,g[1]/s];m[c.index]*=(l.isHorizontal?-1:1)*o}function Jme(e,t,r,n,a){var i=e.get(Yme)||0;i&&(p2.attr({scaleX:t[0],scaleY:t[1],rotation:r}),p2.updateTransform(),i/=p2.getLineScale(),i*=t[n.valueDim.index]),a.valueLineWidth=i||0}function Qme(e,t,r,n,a,i,o,s,l,u,c,h){var f=c.categoryDim,v=c.valueDim,g=h.pxSign,m=Math.max(t[v.index]+s,0),y=m;if(n){var x=Math.abs(l),_=On(e.get("symbolMargin"),"15%")+"",w=!1;_.lastIndexOf("!")===_.length-1&&(w=!0,_=_.slice(0,_.length-1));var S=me(_,t[v.index]),C=Math.max(m+S*2,0),M=w?0:S*2,A=Bk(n),I=A?n:y4((x+M)/C),k=x-I*m;S=k/2/(w?I:Math.max(I-1,1)),C=m+S*2,M=w?0:S*2,!A&&n!=="fixed"&&(I=u?y4((Math.abs(u)+M)/C):0),y=I*C-M,h.repeatTimes=I,h.symbolMargin=S}var P=g*(y/2),D=h.pathPosition=[];D[f.index]=r[f.wh]/2,D[v.index]=o==="start"?P:o==="end"?l-P:l/2,i&&(D[0]+=i[0],D[1]+=i[1]);var z=h.bundlePosition=[];z[f.index]=r[f.xy],z[v.index]=r[v.xy];var j=h.barRectShape=te({},r);j[v.wh]=g*Math.max(Math.abs(r[v.wh]),Math.abs(D[v.index]+P)),j[f.wh]=r[f.wh];var B=h.clipShape={};B[f.xy]=-r[f.xy],B[f.wh]=c.ecSize[f.wh],B[v.xy]=0,B[v.wh]=r[v.wh]}function n$(e){var t=e.symbolPatternSize,r=Ar(e.symbolType,-t/2,-t/2,t,t);return r.attr({culling:!0}),r.type!=="image"&&r.setStyle({strokeNoScale:!0}),r}function a$(e,t,r,n){var a=e.__pictorialBundle,i=r.symbolSize,o=r.valueLineWidth,s=r.pathPosition,l=t.valueDim,u=r.repeatTimes||0,c=0,h=i[t.valueDim.index]+o+r.symbolMargin*2;for($I(e,function(m){m.__pictorialAnimationIndex=c,m.__pictorialRepeatTimes=u,c0:x<0)&&(_=u-1-m),y[l.index]=h*(_-u/2+.5)+s[l.index],{x:y[0],y:y[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation}}}function i$(e,t,r,n){var a=e.__pictorialBundle,i=e.__pictorialMainPath;i?_f(i,null,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation},r,n):(i=e.__pictorialMainPath=n$(r),a.add(i),_f(i,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:0,scaleY:0,rotation:r.rotation},{scaleX:r.symbolScale[0],scaleY:r.symbolScale[1]},r,n))}function o$(e,t,r){var n=te({},t.barRectShape),a=e.__pictorialBarRect;a?_f(a,null,{shape:n},t,r):(a=e.__pictorialBarRect=new it({z2:2,shape:n,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),a.disableMorphing=!0,e.add(a))}function s$(e,t,r,n){if(r.symbolClip){var a=e.__pictorialClipPath,i=te({},r.clipShape),o=t.valueDim,s=r.animationModel,l=r.dataIndex;if(a)At(a,{shape:i},s,l);else{i[o.wh]=0,a=new it({shape:i}),e.__pictorialBundle.setClipPath(a),e.__pictorialClipPath=a;var u={};u[o.wh]=r.clipShape[o.wh],Rh[n?"updateProps":"initProps"](a,{shape:u},s,l)}}}function v4(e,t){var r=e.getItemModel(t);return r.getAnimationDelayParams=eye,r.isAnimationEnabled=tye,r}function eye(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function tye(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function p4(e,t,r,n){var a=new De,i=new De;return a.add(i),a.__pictorialBundle=i,i.x=r.bundlePosition[0],i.y=r.bundlePosition[1],r.symbolRepeat?a$(a,t,r):i$(a,t,r),o$(a,r,n),s$(a,t,r,n),a.__pictorialShapeStr=l$(e,r),a.__pictorialSymbolMeta=r,a}function rye(e,t,r){var n=r.animationModel,a=r.dataIndex,i=e.__pictorialBundle;At(i,{x:r.bundlePosition[0],y:r.bundlePosition[1]},n,a),r.symbolRepeat?a$(e,t,r,!0):i$(e,t,r,!0),o$(e,r,!0),s$(e,t,r,!0)}function g4(e,t,r,n){var a=n.__pictorialBarRect;a&&a.removeTextContent();var i=[];$I(n,function(o){i.push(o)}),n.__pictorialMainPath&&i.push(n.__pictorialMainPath),n.__pictorialClipPath&&(r=null),R(i,function(o){su(o,{scaleX:0,scaleY:0},r,t,function(){n.parent&&n.parent.remove(n)})}),e.setItemGraphicEl(t,null)}function l$(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function $I(e,t,r){R(e.__pictorialBundle.children(),function(n){n!==e.__pictorialBarRect&&t.call(r,n)})}function _f(e,t,r,n,a,i){t&&e.attr(t),n.symbolClip&&!a?r&&e.attr(r):r&&Rh[a?"updateProps":"initProps"](e,r,n.animationModel,n.dataIndex,i)}function m4(e,t,r){var n=r.dataIndex,a=r.itemModel,i=a.getModel("emphasis"),o=i.getModel("itemStyle").getItemStyle(),s=a.getModel(["blur","itemStyle"]).getItemStyle(),l=a.getModel(["select","itemStyle"]).getItemStyle(),u=a.getShallow("cursor"),c=i.get("focus"),h=i.get("blurScope"),f=i.get("scale");$I(e,function(m){if(m instanceof Qr){var y=m.style;m.useStyle(te({image:y.image,x:y.x,y:y.y,width:y.width,height:y.height},r.style))}else m.useStyle(r.style);var x=m.ensureState("emphasis");x.style=o,f&&(x.scaleX=m.scaleX*1.1,x.scaleY=m.scaleY*1.1),m.ensureState("blur").style=s,m.ensureState("select").style=l,u&&(m.cursor=u),m.z2=r.z2});var v=t.valueDim.posDesc[+(r.boundingLength>0)],g=e.__pictorialBarRect;g.ignoreClip=!0,Jr(g,Gr(a),{labelFetcher:t.seriesModel,labelDataIndex:n,defaultText:Hf(t.seriesModel.getData(),n),inheritColor:r.style.fill,defaultOpacity:r.style.opacity,defaultOutsidePosition:v}),ir(e,c,h,i.get("disabled"))}function y4(e){var t=Math.round(e);return Math.abs(e-t)<1e-4?t:Math.ceil(e)}var nye=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r.defaultSymbol="roundRect",r}return t.prototype.getInitialData=function(r){return r.stack=null,e.prototype.getInitialData.apply(this,arguments)},t.type="series."+vm,t.dependencies=["grid"],t.defaultOption=Cu(pm.defaultOption,{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",clip:!1,progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:K.color.primary}}}),t}(pm);function aye(e){e.registerChartView(Xme),e.registerSeriesModel(nye),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,m8(vm)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,y8(vm)),_8(e)}var m2=2,Zf="themeRiver",iye=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new Nv(be(this.getData,this),be(this.getRawData,this))},t.prototype.fixData=function(r){var n=r.length,a={},i=AM(r,function(f){return a.hasOwnProperty(f[0]+"")||(a[f[0]+""]=-1),f[2]}),o=[];i.buckets.each(function(f,v){o.push({name:v,dataList:f})});for(var s=o.length,l=0;li&&(i=s),n.push(s)}for(var u=0;ui&&(i=h)}return{y0:a,max:i}}function hye(e){e.registerChartView(oye),e.registerSeriesModel(iye),e.registerLayout(lye),e.registerProcessor(ay(Zf))}var dye=2,fye=4,_4=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this)||this;o.z2=dye,o.textConfig={inside:!0},Be(o).seriesIndex=n.seriesIndex;var s=new wt({z2:fye,silent:r.getModel().get(["label","silent"])});return o.setTextContent(s),o.updateData(!0,r,n,a,i),o}return t.prototype.updateData=function(r,n,a,i,o){this.node=n,n.piece=this,a=a||this._seriesModel,i=i||this._ecModel;var s=this;Be(s).dataIndex=n.dataIndex;var l=n.getModel(),u=l.getModel("emphasis"),c=n.getLayout(),h=te({},c);h.label=null;var f=n.getVisual("style");f.lineJoin="bevel";var v=n.getVisual("decal");v&&(f.decal=zf(v,o));var g=Co(l.getModel("itemStyle"),h,!0);te(h,g),R(ea,function(_){var w=s.ensureState(_),S=l.getModel([_,"itemStyle"]);w.style=S.getItemStyle();var C=Co(S,h);C&&(w.shape=C)}),r?(s.setShape(h),s.shape.r=c.r0,Qt(s,{shape:{r:c.r}},a,n.dataIndex)):(At(s,{shape:h},a),xi(s)),s.useStyle(f),this._updateLabel(a);var m=l.getShallow("cursor");m&&s.attr("cursor",m),this._seriesModel=a||this._seriesModel,this._ecModel=i||this._ecModel;var y=u.get("focus"),x=y==="relative"?Lf(n.getAncestorsIndices(),n.getDescendantIndices()):y==="ancestor"?n.getAncestorsIndices():y==="descendant"?n.getDescendantIndices():y;ir(this,x,u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r){var n=this,a=this.node.getModel(),i=a.getModel("label"),o=this.node.getLayout(),s=o.endAngle-o.startAngle,l=(o.startAngle+o.endAngle)/2,u=Math.cos(l),c=Math.sin(l),h=this,f=h.getTextContent(),v=this.node.dataIndex,g=i.get("minAngle")/180*Math.PI,m=i.get("show")&&!(g!=null&&Math.abs(s)B&&!th(V-B)&&V0?(o.virtualPiece?o.virtualPiece.updateData(!1,_,r,n,a):(o.virtualPiece=new _4(_,r,n,a),c.add(o.virtualPiece)),w.piece.off("click"),o.virtualPiece.on("click",function(S){o._rootToNode(w.parentNode)})):o.virtualPiece&&(c.remove(o.virtualPiece),o.virtualPiece=null)}},t.prototype._initEvents=function(){var r=this;this.group.off("click"),this.group.on("click",function(n){var a=!1,i=r.seriesModel.getViewRoot();i.eachNode(function(o){if(!a&&o.piece&&o.piece===n.target){var s=o.getModel().get("nodeClick");if(s==="rootToNode")r._rootToNode(o);else if(s==="link"){var l=o.getModel(),u=l.get("link");if(u){var c=l.get("target",!0)||"_blank";Z_(u,c)}}a=!0}})})},t.prototype._rootToNode=function(r){r!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:$A,from:this.uid,seriesId:this.seriesModel.id,targetNode:r})},t.prototype.containPoint=function(r,n){var a=n.getData(),i=a.getItemLayout(0);if(i){var o=r[0]-i.cx,s=r[1]-i.cy,l=Math.sqrt(o*o+s*s);return l<=i.r&&l>=i.r0}},t.type=Sh,t}(Rt),yye=Hr(Sh,xye);function xye(e){var t={};function r(n,a,i){if(n.depth===0)return K.color.neutral50;for(var o=n;o&&o.depth>1;)o=o.parentNode;var s=a.getColorFromPalette(o.name||o.dataIndex+"",t);return n.depth>1&&ve(s)&&(s=L_(s,(n.depth-1)/(i-1)*.5)),s}e.eachSeriesByType(Sh,function(n){var a=n.getData(),i=a.tree;i.eachNode(function(o){var s=o.getModel(),l=s.getModel("itemStyle").getItemStyle();l.fill||(l.fill=r(o,n,i.root.height));var u=a.ensureUniqueItemVisual(o.dataIndex,"style");te(u,l)})})}var w4=Math.PI/180,_ye=Hr(Sh,bye);function bye(e,t){e.eachSeriesByType(Sh,function(r){var n=r.get("center"),a=r.get("radius");ae(a)||(a=[0,a]),ae(n)||(n=[n,n]);var i=t.getWidth(),o=t.getHeight(),s=Math.min(i,o),l=me(n[0],i),u=me(n[1],o),c=me(a[0],s/2),h=me(a[1],s/2),f=-r.get("startAngle")*w4,v=r.get("minAngle")*w4,g=r.getData().tree.root,m=r.getViewRoot(),y=m.depth,x=r.get("sort");x!=null&&c$(m,x);var _=0;R(m.children,function(H){!isNaN(H.getValue())&&_++});var w=m.getValue(),S=Math.PI/(w||_)*2,C=m.depth>0,M=m.height-(C?-1:1),A=(h-c)/(M||1),I=r.get("clockwise"),k=r.get("stillShowZeroSum"),P=I?1:-1,D=function(H,V){if(H){var U=V;if(H!==g){var F=H.getValue(),W=w===0&&k?S:F*S;Wn[1]&&n.reverse(),{coordSys:{type:"polar",cx:e.cx,cy:e.cy,r:n[1],r0:n[0]},api:{coord:function(a){var i=t.dataToRadius(a[0]),o=r.dataToAngle(a[1]),s=e.coordToPoint([i,o]);return s.push(i,o*Math.PI/180),s},size:be(Pye,e)}}}function jye(e){var t=e.getRect(),r=e.getRangeInfo();return{coordSys:{type:"calendar",x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:r.start,end:r.end,weeks:r.weeks,dayCount:r.allDay}},api:{coord:function(n,a){return e.dataToPoint(n,a)},layout:function(n,a){return e.dataToLayout(n,a)}}}}function Eye(e){var t=e.getRect();return{coordSys:{type:"matrix",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(r,n){return e.dataToPoint(r,n)},layout:function(r,n){return e.dataToLayout(r,n)}}}}var h$={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},C4=gt(h$);pi(Gs,function(e,t){return e[t]=1,e},{});Gs.join(", ");var Lb=["","style","shape","extra"],Yf=Qe();function ZI(e,t,r,n,a){var i=e+"Animation",o=fv(e,n,a)||{},s=Yf(t).userDuring;return o.duration>0&&(o.during=s?be(Fye,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),te(o,r[i]),o}function Yx(e,t,r,n){n=n||{};var a=n.dataIndex,i=n.isInit,o=n.clearStyle,s=r.isAnimationEnabled(),l=Yf(e),u=t.style;l.userDuring=t.during;var c={},h={};if(Gye(e,t,h),e.type==="compound")for(var f=e.shape.paths,v=t.shape.paths,g=0;g0&&e.animateFrom(y,x)}else Oye(e,t,a||0,r,c);d$(e,t),u?e.dirty():e.markRedraw()}function d$(e,t){for(var r=Yf(e).leaveToProps,n=0;n0&&e.animateFrom(a,i)}}function zye(e,t){Se(t,"silent")&&(e.silent=t.silent),Se(t,"ignore")&&(e.ignore=t.ignore),e instanceof yi&&Se(t,"invisible")&&(e.invisible=t.invisible),e instanceof pt&&Se(t,"autoBatch")&&(e.autoBatch=t.autoBatch)}var fo={},Bye={setTransform:function(e,t){return fo.el[e]=t,this},getTransform:function(e){return fo.el[e]},setShape:function(e,t){var r=fo.el,n=r.shape||(r.shape={});return n[e]=t,r.dirtyShape&&r.dirtyShape(),this},getShape:function(e){var t=fo.el.shape;if(t)return t[e]},setStyle:function(e,t){var r=fo.el,n=r.style;return n&&(n[e]=t,r.dirtyStyle&&r.dirtyStyle()),this},getStyle:function(e){var t=fo.el.style;if(t)return t[e]},setExtra:function(e,t){var r=fo.el.extra||(fo.el.extra={});return r[e]=t,this},getExtra:function(e){var t=fo.el.extra;if(t)return t[e]}};function Fye(){var e=this,t=e.el;if(t){var r=Yf(t).userDuring,n=e.userDuring;if(r!==n){e.el=e.userDuring=null;return}fo.el=t,n(Bye)}}function T4(e,t,r,n){var a=r[e];if(a){var i=t[e],o;if(i){var s=r.transition,l=a.transition;if(l)if(!o&&(o=n[e]={}),Wc(l))te(o,i);else for(var u=Zt(l),c=0;c=0){!o&&(o=n[e]={});for(var v=gt(i),c=0;c=0)){var f=e.getAnimationStyleProps(),v=f?f.style:null;if(v){!i&&(i=n.style={});for(var g=gt(r),u=0;u=0?t.getStore().get(F,V):void 0}var W=t.get(U.name,V),$=U&&U.ordinalMeta;return $?$.categories[W]:W}function A(H,V){V==null&&(V=c);var U=t.getItemVisual(V,"style"),F=U&&U.fill,W=U&&U.opacity,$=w(V,El).getItemStyle();F!=null&&($.fill=F),W!=null&&($.opacity=W);var Z={inheritColor:ve(F)?F:K.color.neutral99},J=S(V,El),re=$t(J,null,Z,!1,!0);re.text=J.getShallow("show")?Te(e.getFormattedLabel(V,El),Hf(t,V)):null;var Q=G_(J,Z,!1);return P(H,$),$=v5($,re,Q),H&&k($,H),$.legacy=!0,$}function I(H,V){V==null&&(V=c);var U=w(V,js).getItemStyle(),F=S(V,js),W=$t(F,null,null,!0,!0);W.text=F.getShallow("show")?ya(e.getFormattedLabel(V,js),e.getFormattedLabel(V,El),Hf(t,V)):null;var $=G_(F,null,!0);return P(H,U),U=v5(U,W,$),H&&k(U,H),U.legacy=!0,U}function k(H,V){for(var U in V)Se(V,U)&&(H[U]=V[U])}function P(H,V){H&&(H.textFill&&(V.textFill=H.textFill),H.textPosition&&(V.textPosition=H.textPosition))}function D(H,V){if(V==null&&(V=c),Se(S4,H)){var U=t.getItemVisual(V,"style");return U?U[S4[H]]:null}if(Se(Cye,H))return t.getItemVisual(V,H)}function z(H){if(o.type==="cartesian2d"){var V=o.getBaseAxis();return Jce(Ee({axis:V},H))}}function j(){return r.getCurrentSeriesIndices()}function B(H){return lL(H,r)}}function Qye(e){var t={};return R(e.dimensions,function(r){var n=e.getDimensionInfo(r);if(!n.isExtraCoord){var a=n.coordDim,i=t[a]=t[a]||[];i[n.coordDimIndex]=e.getDimensionIndex(r)}}),t}function b2(e,t,r,n,a,i,o){if(!n){i.remove(t);return}var s=JI(e,t,r,n,a,i);return s&&o.setItemGraphicEl(r,s),s&&ir(s,n.focus,n.blurScope,n.emphasisDisabled),s}function JI(e,t,r,n,a,i){var o=-1,s=t;t&&g$(t,n,a)&&(o=Ye(i.childrenRef(),t),t=null);var l=!t,u=t;u?u.clearStates():(u=qI(n),s&&Xye(s,u)),n.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),n.tooltipDisabled&&(u.tooltipDisabled=!0),Za.normal.cfg=Za.normal.conOpt=Za.emphasis.cfg=Za.emphasis.conOpt=Za.blur.cfg=Za.blur.conOpt=Za.select.cfg=Za.select.conOpt=null,Za.isLegacy=!1,t0e(u,r,n,a,l,Za),e0e(u,r,n,a,l),KI(e,u,r,n,Za,a,l),Se(n,"info")&&(Ds(u).info=n.info);for(var c=0;c=0?i.replaceAt(u,o):i.add(u),u}function g$(e,t,r){var n=Ds(e),a=t.type,i=t.shape,o=t.style;return r.isUniversalTransitionEnabled()||a!=null&&a!==n.customGraphicType||a==="path"&&o0e(i)&&m$(i)!==n.customPathData||a==="image"&&Se(o,"image")&&o.image!==n.customImagePath}function e0e(e,t,r,n,a){var i=r.clipPath;if(i===!1)e&&e.getClipPath()&&e.removeClipPath();else if(i){var o=e.getClipPath();o&&g$(o,i,n)&&(o=null),o||(o=qI(i),e.setClipPath(o)),KI(null,o,t,i,null,n,a)}}function t0e(e,t,r,n,a,i){if(!(e.isGroup||e.type==="compoundPath")){A4(r,null,i),A4(r,js,i);var o=i.normal.conOpt,s=i.emphasis.conOpt,l=i.blur.conOpt,u=i.select.conOpt;if(o!=null||s!=null||u!=null||l!=null){var c=e.getTextContent();if(o===!1)c&&e.removeTextContent();else{o=i.normal.conOpt=o||{type:"text"},c?c.clearStates():(c=qI(o),e.setTextContent(c)),KI(null,c,t,o,null,n,a);for(var h=o&&o.style,f=0;f=c;v--){var g=t.childAt(v);n0e(t,g,a)}}}function n0e(e,t,r){t&&hw(t,Ds(e).option,r)}function a0e(e){new $s(e.oldChildren,e.newChildren,N4,N4,e).add(k4).update(k4).remove(i0e).execute()}function N4(e,t){var r=e&&e.name;return r??Zye+t}function k4(e,t){var r=this.context,n=e!=null?r.newChildren[e]:null,a=t!=null?r.oldChildren[t]:null;JI(r.api,a,r.dataIndex,n,r.seriesModel,r.group)}function i0e(e){var t=this.context,r=t.oldChildren[e];r&&hw(r,Ds(r).option,t.seriesModel)}function m$(e){return e&&(e.pathData||e.d)}function o0e(e){return e&&(Se(e,"pathData")||Se(e,"d"))}function s0e(e){e.registerChartView(qye),e.registerSeriesModel(Tye)}var Cc=Qe(),L4=ke,w2=be,eP=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(t,r,n,a){var i=r.get("value"),o=r.get("status");if(this._axisModel=t,this._axisPointerModel=r,this._api=n,!(!a&&this._lastValue===i&&this._lastStatus===o)){this._lastValue=i,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var u={};this.makeElOption(u,i,t,r,n);var c=u.graphicKey;c!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=c;var h=this._moveAnimation=this.determineAnimation(t,r);if(!s)s=this._group=new De,this.createPointerEl(s,u,t,r),this.createLabelEl(s,u,t,r),n.getZr().add(s);else{var f=nt(I4,r,h);this.updatePointerEl(s,u,f),this.updateLabelEl(s,u,f,r)}D4(s,r,!0),this._renderHandle(i)}},e.prototype.remove=function(t){this.clear(t)},e.prototype.dispose=function(t){this.clear(t)},e.prototype.determineAnimation=function(t,r){var n=r.get("animation"),a=t.axis,i=a.type==="category",o=r.get("snap");if(!o&&!i)return!1;if(n==="auto"||n==null){var s=this.animationThreshold;if(i&&Cn(a).w>s)return!0;if(o){var l=gI(t).seriesDataCount,u=a.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return n===!0},e.prototype.makeElOption=function(t,r,n,a,i){},e.prototype.createPointerEl=function(t,r,n,a){var i=r.pointer;if(i){var o=Cc(t).pointerEl=new Rh[i.type](L4(r.pointer));t.add(o)}},e.prototype.createLabelEl=function(t,r,n,a){if(r.label){var i=Cc(t).labelEl=new wt(L4(r.label));t.add(i),P4(i,a)}},e.prototype.updatePointerEl=function(t,r,n){var a=Cc(t).pointerEl;a&&r.pointer&&(a.setStyle(r.pointer.style),n(a,{shape:r.pointer.shape}))},e.prototype.updateLabelEl=function(t,r,n,a){var i=Cc(t).labelEl;i&&(i.setStyle(r.label.style),n(i,{x:r.label.x,y:r.label.y}),P4(i,a))},e.prototype._renderHandle=function(t){if(!(this._dragging||!this.updateHandleTransform)){var r=this._axisPointerModel,n=this._api.getZr(),a=this._handle,i=r.getModel("handle"),o=r.get("status");if(!i.get("show")||!o||o==="hide"){a&&n.remove(a),this._handle=null;return}var s;this._handle||(s=!0,a=this._handle=pv(i.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){Vs(u.event)},onmousedown:w2(this._onHandleDragMove,this,0,0),drift:w2(this._onHandleDragMove,this),ondragend:w2(this._onHandleDragEnd,this)}),n.add(a)),D4(a,r,!1),a.setStyle(i.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=i.get("size");ae(l)||(l=[l,l]),a.scaleX=l[0]/2,a.scaleY=l[1]/2,xv(this,"_doDispatchAxisPointer",i.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,s)}},e.prototype._moveHandleToValue=function(t,r){I4(this._axisPointerModel,!r&&this._moveAnimation,this._handle,S2(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(t,r){var n=this._handle;if(n){this._dragging=!0;var a=this.updateHandleTransform(S2(n),[t,r],this._axisModel,this._axisPointerModel);this._payloadInfo=a,n.stopAnimation(),n.attr(S2(a)),Cc(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){var t=this._handle;if(t){var r=this._payloadInfo,n=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:r.cursorPoint[0],y:r.cursorPoint[1],tooltipOption:r.tooltipOption,axesInfo:[{axisDim:n.axis.dim,axisIndex:n.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){this._dragging=!1;var t=this._handle;if(t){var r=this._axisPointerModel.get("value");this._moveHandleToValue(r),this._api.dispatchAction({type:"hideTip"})}},e.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var r=t.getZr(),n=this._group,a=this._handle;r&&n&&(this._lastGraphicKey=null,n&&r.remove(n),a&&r.remove(a),this._group=null,this._handle=null,this._payloadInfo=null),rm(this,"_doDispatchAxisPointer")},e.prototype.doClear=function(){},e.prototype.buildLabel=function(t,r,n){return n=n||0,{x:t[n],y:t[1-n],width:r[n],height:r[1-n]}},e}();function I4(e,t,r,n){y$(Cc(r).lastProp,n)||(Cc(r).lastProp=n,t?At(r,n,e):(r.stopAnimation(),r.attr(n)))}function y$(e,t){if(Re(e)&&Re(t)){var r=!0;return R(t,function(n,a){r=r&&y$(e[a],n)}),!!r}else return e===t}function P4(e,t){e[t.get(["label","show"])?"show":"hide"]()}function S2(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function D4(e,t,r){var n=t.get("z"),a=t.get("zlevel");e&&e.traverse(function(i){i.type!=="group"&&(n!=null&&(i.z=n),a!=null&&(i.zlevel=a),i.silent=r)})}function tP(e){var t=e.get("type"),r=e.getModel(t+"Style"),n;return t==="line"?(n=r.getLineStyle(),n.fill=null):t==="shadow"&&(n=r.getAreaStyle(),n.stroke=null),n}function x$(e,t,r,n,a){var i=r.get("value"),o=_$(i,t.axis,t.ecModel,r.get("seriesDataIndices"),{precision:r.get(["label","precision"]),formatter:r.get(["label","formatter"])}),s=r.getModel("label"),l=mv(s.get("padding")||0),u=s.getFont(),c=S1(o,u),h=a.position,f=c.width+l[1]+l[3],v=c.height+l[0]+l[2],g=a.align;g==="right"&&(h[0]-=f),g==="center"&&(h[0]-=f/2);var m=a.verticalAlign;m==="bottom"&&(h[1]-=v),m==="middle"&&(h[1]-=v/2),l0e(h,f,v,n);var y=s.get("backgroundColor");(!y||y==="auto")&&(y=t.get(["axisLine","lineStyle","color"])),e.label={x:h[0],y:h[1],style:$t(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:y}),z2:10}}function l0e(e,t,r,n){var a=n.getWidth(),i=n.getHeight();e[0]=Math.min(e[0]+t,a)-t,e[1]=Math.min(e[1]+r,i)-r,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function _$(e,t,r,n,a){e=t.scale.parse(e);var i=t.scale.getLabel({value:e},{precision:a.precision}),o=a.formatter;if(o){var s={value:ob(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};R(n,function(l){var u=r.getSeriesByIndex(l.seriesIndex),c=l.dataIndexInside,h=u&&u.getDataParams(c);h&&s.seriesData.push(h)}),ve(o)?i=o.replace("{value}",i):Le(o)&&(i=o(s))}return i}function rP(e,t,r){var n=ar();return Js(n,n,r.rotation),Hi(n,n,r.position),Fi([e.dataToCoord(t),(r.labelOffset||0)+(r.labelDirection||1)*(r.labelMargin||0)],n)}function b$(e,t,r,n,a,i){var o=Jn.innerTextLayout(r.rotation,0,r.labelDirection);r.labelMargin=a.get(["label","margin"]),x$(t,n,a,i,{position:rP(n.axis,e,r),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function nP(e,t,r){return r=r||0,{x1:e[r],y1:e[1-r],x2:t[r],y2:t[1-r]}}function w$(e,t,r){return r=r||0,{x:e[r],y:e[1-r],width:t[r],height:t[1-r]}}function j4(e,t,r,n,a,i){return{cx:e,cy:t,r0:r,r:n,startAngle:a,endAngle:i,clockwise:!0}}function aP(e,t,r){return Cn(e,{fromStat:{sers:oe(t,function(n){return r.getSeriesByIndex(n.seriesIndex)})},min:1}).w}function iP(e,t,r){return[at(Et(t[0],t[1]),e-r/2),Et(e+r/2,at(t[0],t[1]))]}var u0e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis,l=s.grid,u=i.get("type"),c=s.getGlobalExtent(),h=E4(l,s).getOtherAxis(s).getGlobalExtent(),f=s.toGlobalCoord(s.dataToCoord(n,!0));if(u&&u!=="none"){var v=tP(i),g=c0e[u](s,f,c,h,i.get("seriesDataIndices"),i.ecModel);g.style=v,r.graphicKey=g.type,r.pointer=g}var m=pb(l.getRect(),a);b$(n,r,m,a,i,o)},t.prototype.getHandleTransform=function(r,n,a){var i=pb(n.axis.grid.getRect(),n,{labelInside:!1});i.labelMargin=a.get(["handle","margin"]);var o=rP(n.axis,r,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,a,i){var o=a.axis,s=o.grid,l=o.getGlobalExtent(!0),u=E4(s,o).getOtherAxis(o).getGlobalExtent(),c=o.dim==="x"?0:1,h=[r.x,r.y];h[c]+=n[c],h[c]=Et(l[1],h[c]),h[c]=at(l[0],h[c]);var f=(u[1]+u[0])/2,v=[f,f];v[c]=h[c];var g=[{verticalAlign:"middle"},{align:"center"}];return{x:h[0],y:h[1],rotation:r.rotation,cursorPoint:v,tooltipOption:g[c]}},t}(eP);function E4(e,t){var r={};return r[t.dim+"AxisIndex"]=t.index,e.getCartesian(r)}var c0e={line:function(e,t,r,n){var a=nP([t,n[0]],[t,n[1]],R4(e));return{type:"Line",subPixelOptimize:!0,shape:a}},shadow:function(e,t,r,n,a,i){var o=aP(e,a,i),s=n[1]-n[0],l=iP(t,r,o),u=l[0],c=l[1];return{type:"Rect",shape:w$([u,n[0]],[c-u,s],R4(e))}}};function R4(e){return e.dim==="x"?0:1}var h0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="axisPointer",t.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:K.color.border,width:1,type:"dashed"},shadowStyle:{color:K.color.shadowTint},label:{show:!0,formatter:null,precision:"auto",margin:3,color:K.color.neutral00,padding:[5,7,5,7],backgroundColor:K.color.accent60,borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:K.color.accent40,throttle:40}},t}(ht),Ms=Qe(),d0e=R;function S$(e,t,r){if(!xt.node){var n=t.getZr();Ms(n).records||(Ms(n).records={}),f0e(n,t);var a=Ms(n).records[e]||(Ms(n).records[e]={});a.handler=r}}function f0e(e,t){if(Ms(e).initialized)return;Ms(e).initialized=!0,r("click",nt(C2,"click")),r("mousemove",nt(C2,"mousemove")),r("mousewheel",nt(C2,"mousewheel")),r("globalout",p0e);function r(n,a){e.on(n,function(i){var o=g0e(t);d0e(Ms(e).records,function(s){s&&a(s,i,o.dispatchAction)}),v0e(o.pendings,t)})}}function v0e(e,t){var r=e.showTip.length,n=e.hideTip.length,a;r?a=e.showTip[r-1]:n&&(a=e.hideTip[n-1]),a&&(a.dispatchAction=null,t.dispatchAction(a))}function p0e(e,t,r){e.handler("leave",null,r)}function C2(e,t,r,n){t.handler(e,r,n)}function g0e(e){var t={showTip:[],hideTip:[]},r=function(n){var a=t[n.type];a?a.push(n):(n.dispatchAction=r,e.dispatchAction(n))};return{dispatchAction:r,pendings:t}}function XA(e,t){if(!xt.node){var r=t.getZr(),n=(Ms(r).records||{})[e];n&&(Ms(r).records[e]=null)}}var m0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){var i=n.getComponent("tooltip"),o=r.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click|mousewheel";S$("axisPointer",a,function(s,l,u){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&u({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},t.prototype.remove=function(r,n){XA("axisPointer",n)},t.prototype.dispose=function(r,n){XA("axisPointer",n)},t.type="axisPointer",t}(Yt);function C$(e,t){var r=[],n=e.seriesIndex,a;if(n==null||!(a=t.getSeriesByIndex(n)))return{point:[]};var i=a.getData(),o=nh(i,e);if(o==null||o<0||ae(o))return{point:[]};var s=i.getItemGraphicEl(o),l=a.coordinateSystem;if(a.getTooltipPosition)r=a.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(e.isStacked){var u=l.getBaseAxis(),c=l.getOtherAxis(u),h=c.dim,f=u.dim,v=h==="x"||h==="radius"?1:0,g=i.mapDimension(f),m=[];m[v]=i.get(g,o),m[1-v]=i.get(i.getCalculationInfo("stackResultDimension"),o),r=l.dataToPoint(m)||[]}else r=l.dataToPoint(i.getValues(oe(l.dimensions,function(x){return i.mapDimension(x)}),o))||[];else if(s){var y=s.getBoundingRect().clone();y.applyTransform(s.transform),r=[y.x+y.width/2,y.y+y.height/2]}return{point:r,el:s}}var O4=Qe();function y0e(e,t,r){var n=e.currTrigger,a=[e.x,e.y],i=e,o=e.dispatchAction||be(r.dispatchAction,r),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){Xx(a)&&(a=C$({seriesIndex:i.seriesIndex,dataIndex:i.dataIndex},t).point);var l=Xx(a),u=i.axesInfo,c=s.axesInfo,h=n==="leave"||Xx(a),f={},v={},g={list:[],map:{}},m={showPointer:nt(_0e,v),showTooltip:nt(b0e,g)};R(s.coordSysMap,function(x,_){var w=l||x.containPoint(a);R(s.coordSysAxesInfo[_],function(S,C){var M=S.axis,A=T0e(u,S);if(!h&&w&&(!u||A)){var I=A&&A.value;I==null&&!l&&(I=M.pointToData(a)),I!=null&&z4(S,I,m,!1,f)}})});var y={};return R(c,function(x,_){var w=x.linkGroup;w&&!v[_]&&R(w.axesInfo,function(S,C){var M=v[C];if(S!==x&&M){var A=M.value;w.mapper&&(A=x.axis.scale.parse(w.mapper(A,B4(S),B4(x)))),y[x.key]=A}})}),R(y,function(x,_){z4(c[_],x,m,!0,f)}),w0e(v,c,f),S0e(g,a,e,o),C0e(c,o,r),f}}function z4(e,t,r,n,a){var i=e.axis;if(!(i.scale.isBlank()||!i.containData(t))){if(!e.involveSeries){r.showPointer(e,t);return}var o=x0e(t,e),s=o.payloadBatch,l=o.snapToValue;s[0]&&a.seriesIndex==null&&te(a,s[0]),!n&&e.snap&&i.containData(l)&&l!=null&&(t=l),r.showPointer(e,t,s),r.showTooltip(e,o,l)}}function x0e(e,t){var r=t.axis,n=r.dim,a=e,i=[],o=Number.MAX_VALUE,s=-1;return R(t.seriesModels,function(l,u){var c=l.getData().mapDimensionsAll(n),h,f;if(l.getAxisTooltipData){var v=l.getAxisTooltipData(c,e,r);f=v.dataIndices,h=v.nestestValue}else{if(f=l.indicesOfNearest(n,c[0],e,r.type==="category"?.5:null),!f.length)return;h=l.getData().get(c[0],f[0])}if(mi(h)){var g=e-h,m=Math.abs(g);m<=o&&((m=0&&s<0)&&(o=m,s=g,a=h,i.length=0),R(f,function(y){i.push({seriesIndex:l.seriesIndex,dataIndexInside:y,dataIndex:l.getData().getRawIndex(y)})}))}}),{payloadBatch:i,snapToValue:a}}function _0e(e,t,r,n){e[t.key]={value:r,payloadBatch:n}}function b0e(e,t,r,n){var a=r.payloadBatch,i=t.axis,o=i.model,s=t.axisPointerModel;if(!(!t.triggerTooltip||!a.length)){var l=t.coordSys.model,u=gm(l),c=e.map[u];c||(c=e.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},e.list.push(c)),c.dataByAxis.push({axisDim:i.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:n,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:a.slice()})}}function w0e(e,t,r){var n=r.axesInfo=[];R(t,function(a,i){var o=a.axisPointerModel.option,s=e[i];s?(!a.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!a.useHandle&&(o.status="hide"),o.status==="show"&&n.push({axisDim:a.axis.dim,axisIndex:a.axis.model.componentIndex,value:o.value})})}function S0e(e,t,r,n){if(Xx(t)||!e.list.length){n({type:"hideTip"});return}var a=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:t[0],y:t[1],tooltipOption:r.tooltipOption,position:r.position,dataIndexInside:a.dataIndexInside,dataIndex:a.dataIndex,seriesIndex:a.seriesIndex,dataByCoordSys:e.list})}function C0e(e,t,r){var n=r.getZr(),a="axisPointerLastHighlights",i=O4(n)[a]||{},o=O4(n)[a]={};R(e,function(c,h){var f=c.axisPointerModel.option;f.status==="show"&&c.triggerEmphasis&&R(f.seriesDataIndices,function(v){o[v.seriesIndex+"|"+v.dataIndex]=v})});var s=[],l=[];function u(c){return{seriesIndex:c.seriesIndex,dataIndex:c.dataIndex}}R(i,function(c,h){!o[h]&&l.push(u(c))}),R(o,function(c,h){!i[h]&&s.push(u(c))}),l.length&&r.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&r.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function T0e(e,t){for(var r=0;r<(e||[]).length;r++){var n=e[r];if(t.axis.dim===n.axisDim&&t.axis.model.componentIndex===n.axisIndex)return n}}function B4(e){var t=e.axis.model,r={},n=r.axisDim=e.axis.dim;return r.axisIndex=r[n+"AxisIndex"]=t.componentIndex,r.axisName=r[n+"AxisName"]=t.name,r.axisId=r[n+"AxisId"]=t.id,r}function Xx(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function iy(e){Gh.registerAxisPointerClass("CartesianAxisPointer",u0e),e.registerComponentModel(h0e),e.registerComponentView(m0e),e.registerPreprocessor(function(t){if(t){(!t.axisPointer||t.axisPointer.length===0)&&(t.axisPointer={});var r=t.axisPointer.link;r&&!ae(r)&&(t.axisPointer.link=[r])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(t,r){t.getComponent("axisPointer").coordSysAxesInfo=Zhe(t,r)}}),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},y0e)}function M0e(e){rt(R8),rt(iy)}var A0e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis;s.dim==="angle"&&(this.animationThreshold=Math.PI/18);var l=s.polar,u=s.getExtent(),c=l.getOtherAxis(s).getExtent(),h=s.dataToCoord(n),f=i.get("type");if(f&&f!=="none"){var v=tP(i),g=k0e[f](s,l,h,u,c,i.get("seriesDataIndices"),i.ecModel);g.style=v,r.graphicKey=g.type,r.pointer=g}var m=i.get(["label","margin"]),y=N0e(n,a,i,l,m);x$(r,a,i,o,y)},t}(eP);function N0e(e,t,r,n,a){var i=t.axis,o=i.dataToCoord(e),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l=n.getRadiusAxis().getExtent(),u,c,h;if(i.dim==="radius"){var f=ar();Js(f,f,s),Hi(f,f,[n.cx,n.cy]),u=Fi([o,-a],f);var v=t.getModel("axisLabel").get("rotate")||0,g=Jn.innerTextLayout(s,v*Math.PI/180,-1);c=g.textAlign,h=g.textVerticalAlign}else{var m=l[1];u=n.coordToPoint([m+a,o]);var y=n.cx,x=n.cy;c=Math.abs(u[0]-y)/m<.3?"center":u[0]>y?"left":"right",h=Math.abs(u[1]-x)/m<.3?"middle":u[1]>x?"top":"bottom"}return{position:u,align:c,verticalAlign:h}}var k0e={line:function(e,t,r,n,a){return e.dim==="angle"?{type:"Line",shape:nP(t.coordToPoint([a[0],r]),t.coordToPoint([a[1],r]))}:{type:"Circle",shape:{cx:t.cx,cy:t.cy,r}}},shadow:function(e,t,r,n,a,i,o){var s=Math.PI/180,l=aP(e,i,o),u;if(e.dim==="angle")u=j4(t.cx,t.cy,a[0],a[1],(-r-l/2)*s,(-r+l/2)*s);else{var c=iP(r,n,l),h=c[0],f=c[1];u=j4(t.cx,t.cy,h,f,0,Math.PI*2)}return{type:"Sector",shape:u}}},jo="polar",F4=jo,L0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.findAxisModel=function(r){var n,a=this.ecModel;return a.eachComponent(r,function(i){i.getCoordSysModel()===this&&(n=i)},this),n},t.type=jo,t.dependencies=["radiusAxis","angleAxis"],t.defaultOption={z:0,center:["50%","50%"],radius:"80%"},t}(ht),oP=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",pr).models[0]},t.type="polarAxis",t}(ht);kr(oP,Tv);var I0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="angleAxis",t}(oP),P0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="radiusAxis",t}(oP),sP=function(e){X(t,e);function t(r,n){return e.call(this,"radius",r,n)||this}return t.prototype.pointToData=function(r,n){return this.polar.pointToData(r,n)[this.dim==="radius"?0:1]},t}(Si);sP.prototype.dataToRadius=Si.prototype.dataToCoord;sP.prototype.radiusToData=Si.prototype.coordToData;var D0e=Qe(),lP=function(e){X(t,e);function t(r,n){return e.call(this,"angle",r,n||[0,360])||this}return t.prototype.pointToData=function(r,n){return this.polar.pointToData(r,n)[this.dim==="radius"?0:1]},t.prototype.calculateCategoryInterval=function(){var r=this,n=r.getLabelModel(),a=r.scale,i=a.getExtent(),o=a.count();if(i[1]-i[0]<1)return 0;var s=i[0],l=r.dataToCoord(s+1)-r.dataToCoord(s),u=Math.abs(l),c=S1(s==null?"":s+"",n.getFont(),"center","top"),h=Math.max(c.height,7),f=h/u;isNaN(f)&&(f=1/0);var v=Math.max(0,Math.floor(f)),g=D0e(r.model),m=g.lastAutoInterval,y=g.lastTickCount;return m!=null&&y!=null&&Math.abs(m-v)<=1&&Math.abs(y-o)<=1&&m>v?v=m:(g.lastTickCount=o,g.lastAutoInterval=v),v},t}(Si);lP.prototype.dataToAngle=Si.prototype.dataToCoord;lP.prototype.angleToData=Si.prototype.coordToData;var T$=["radius","angle"],j0e=function(){function e(t){this.dimensions=T$,this.type=jo,this.cx=0,this.cy=0,this._radiusAxis=new sP,this._angleAxis=new lP,this.axisPointerEnabled=!0,this.name=t||"",this._radiusAxis.polar=this._angleAxis.polar=this}return e.prototype.containPoint=function(t){var r=this.pointToCoord(t);return this._radiusAxis.contain(r[0])&&this._angleAxis.contain(r[1])},e.prototype.containData=function(t){return this._radiusAxis.containData(t[0])&&this._angleAxis.containData(t[1])},e.prototype.getAxis=function(t){var r="_"+t+"Axis";return this[r]},e.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},e.prototype.getAxesByScale=function(t){var r=[],n=this._angleAxis,a=this._radiusAxis;return n.scale.type===t&&r.push(n),a.scale.type===t&&r.push(a),r},e.prototype.getAngleAxis=function(){return this._angleAxis},e.prototype.getRadiusAxis=function(){return this._radiusAxis},e.prototype.getOtherAxis=function(t){var r=this._angleAxis;return t===r?this._radiusAxis:r},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},e.prototype.getTooltipAxes=function(t){var r=t!=null&&t!=="auto"?this.getAxis(t):this.getBaseAxis();return{baseAxes:[r],otherAxes:[this.getOtherAxis(r)]}},e.prototype.dataToPoint=function(t,r,n){return this.coordToPoint([this._radiusAxis.dataToRadius(t[0],r),this._angleAxis.dataToAngle(t[1],r)],n)},e.prototype.pointToData=function(t,r,n){n=n||[];var a=this.pointToCoord(t);return n[0]=this._radiusAxis.radiusToData(a[0],r),n[1]=this._angleAxis.angleToData(a[1],r),n},e.prototype.pointToCoord=function(t){var r=t[0]-this.cx,n=t[1]-this.cy,a=this.getAngleAxis(),i=a.getExtent(),o=Math.min(i[0],i[1]),s=Math.max(i[0],i[1]);a.inverse?o=s-360:s=o+360;var l=Math.sqrt(r*r+n*n);r/=l,n/=l;for(var u=Math.atan2(-n,r)/Math.PI*180,c=us;)u+=c*360;return[l,u]},e.prototype.coordToPoint=function(t,r){r=r||[];var n=t[0],a=t[1]/180*Math.PI;return r[0]=Math.cos(a)*n+this.cx,r[1]=-Math.sin(a)*n+this.cy,r},e.prototype.getArea=function(){var t=this.getAngleAxis(),r=this.getRadiusAxis(),n=r.getExtent().slice();n[0]>n[1]&&n.reverse();var a=t.getExtent(),i=Math.PI/180,o=1e-4;return{cx:this.cx,cy:this.cy,r0:n[0],r:n[1],startAngle:-a[0]*i,endAngle:-a[1]*i,clockwise:t.inverse,contain:function(s,l){var u=s-this.cx,c=l-this.cy,h=u*u+c*c,f=this.r,v=this.r0;return f!==v&&h-o<=f*f&&h+o>=v*v},x:this.cx-n[1],y:this.cy-n[1],width:n[1]*2,height:n[1]*2}},e.prototype.convertToPixel=function(t,r,n){var a=V4(r);return a===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var a=V4(r);return a===this?this.pointToData(n):null},e}();function V4(e){var t=e.seriesModel,r=e.polarModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function E0e(e,t,r){var n=t.get("center"),a=Ur(t,r).refContainer;e.cx=me(n[0],a.width)+a.x,e.cy=me(n[1],a.height)+a.y;var i=e.getRadiusAxis(),o=Math.min(a.width,a.height)/2,s=t.get("radius");s==null?s=[0,"100%"]:ae(s)||(s=[0,s]);var l=[me(s[0],o),me(s[1],o)];i.inverse?i.setExtent(l[1],l[0]):i.setExtent(l[0],l[1])}function R0e(e,t){var r=this,n=r.getAngleAxis(),a=r.getRadiusAxis();if(fh(n,Vf),fh(a,Vf),Gf(n),Gf(a),n.type==="category"&&!n.onBand){var i=n.getExtent(),o=360/n.scale.count();n.inverse?i[1]+=o:i[1]-=o,n.setExtent(i[0],i[1])}}function O0e(e){return e.mainType==="angleAxis"}function G4(e,t){var r;if(e.type=Km(t),e.scale=Sv(t,e.type,!1),e.onBand=Qm(e.scale,t),e.inverse=t.get("inverse"),O0e(t)){e.inverse=e.inverse!==t.get("clockwise");var n=t.get("startAngle"),a=(r=t.get("endAngle"))!==null&&r!==void 0?r:n+(e.inverse?-360:360);e.setExtent(n,a)}t.axis=e,e.model=t}var z0e={dimensions:T$,create:function(e,t){var r=[];return e.eachComponent(F4,function(n,a){var i=new j0e(a+"");i.update=R0e;var o=i.getRadiusAxis(),s=i.getAngleAxis(),l=n.findAxisModel("radiusAxis"),u=n.findAxisModel("angleAxis");G4(o,l),G4(s,u),E0e(i,n,t),r.push(i),n.coordinateSystem=i,i.model=n}),e.eachSeries(function(n){if(n.get("coordinateSystem")===jo){var a=n.getReferringComponents(F4,pr).models[0],i=n.coordinateSystem=a.coordinateSystem;i&&(dh(i.getRadiusAxis(),n,jo),dh(i.getAngleAxis(),n,jo))}}),r}},B0e=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function $0(e,t,r){t[1]>t[0]&&(t=t.slice().reverse());var n=e.coordToPoint([t[0],r]),a=e.coordToPoint([t[1],r]);return{x1:n[0],y1:n[1],x2:a[0],y2:a[1]}}function Z0(e){var t=e.getRadiusAxis();return t.inverse?0:1}function H4(e){var t=e[0],r=e[e.length-1];t&&r&&Math.abs(Math.abs(t.coord-r.coord)-360)<1e-4&&e.pop()}var F0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.axisPointerClass="PolarAxisPointer",r}return t.prototype.render=function(r,n){if(this.group.removeAll(),!!r.get("show")){var a=r.axis,i=a.polar,o=i.getRadiusAxis().getExtent(),s=a.getTicksCoords({breakTicks:"none"}),l=a.getMinorTicksCoords(),u=[];R(a.getViewLabels(),function(c){if(!c.tick.offInterval){c=ke(c);var h=a.scale;c.coord=a.dataToCoord(Cv(h,c.tick)),u.push(c)}}),H4(u),H4(s),R(B0e,function(c){r.get([c,"show"])&&(!a.scale.isBlank()||c==="axisLine")&&V0e[c](this.group,r,i,s,l,o,u)},this)}},t.type="angleAxis",t}(Gh),V0e={axisLine:function(e,t,r,n,a,i){var o=t.getModel(["axisLine","lineStyle"]),s=r.getAngleAxis(),l=Math.PI/180,u=s.getExtent(),c=Z0(r),h=c?0:1,f,v=Math.abs(u[1]-u[0])===360?"Circle":"Arc";i[h]===0?f=new Rh[v]({shape:{cx:r.cx,cy:r.cy,r:i[c],startAngle:-u[0]*l,endAngle:-u[1]*l,clockwise:s.inverse},style:o.getLineStyle(),z2:1,silent:!0}):f=new hv({shape:{cx:r.cx,cy:r.cy,r:i[c],r0:i[h]},style:o.getLineStyle(),z2:1,silent:!0}),f.style.fill=null,e.add(f)},axisTick:function(e,t,r,n,a,i){var o=t.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=i[Z0(r)],u=oe(n,function(c){return new Tr({shape:$0(r,[l,l+s],c.coord)})});e.add(Aa(u,{style:Ee(o.getModel("lineStyle").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})}))},minorTick:function(e,t,r,n,a,i){if(a.length){for(var o=t.getModel("axisTick"),s=t.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),u=i[Z0(r)],c=[],h=0;hx?"left":"right",S=Math.abs(y[1]-_)/m<.3?"middle":y[1]>_?"top":"bottom";if(s&&s[g]){var C=s[g];Re(C)&&C.textStyle&&(v=new vt(C.textStyle,l,l.ecModel))}var M=new wt({silent:Jn.isLabelSilent(t),style:$t(v,{x:y[0],y:y[1],fill:v.getTextColor()||t.get(["axisLine","lineStyle","color"]),text:h.formattedLabel,align:w,verticalAlign:S})});if(e.add(M),el({el:M,componentModel:t,itemName:h.formattedLabel,formatterParamsExtra:{isTruncated:function(){return M.isTruncated},value:h.rawLabel,tickIndex:f}}),c){var A=Jn.makeAxisEventDataBase(t);A.targetType="axisLabel",A.value=h.rawLabel,Be(M).eventData=A}},this)},splitLine:function(e,t,r,n,a,i){var o=t.getModel("splitLine"),s=o.getModel("lineStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],h=0;h=0?"p":"n",k=w;x&&(n[i][A]||(n[i][A]={p:w,n:w}),k=n[i][A][I]);var P=void 0,D=void 0,z=void 0,j=void 0;if(c.dim==="radius"){var B=c.dataToCoord(M)-w,H=e.dataToCoord(A);cr(B)=j})}}function q0e(e,t){var r=Vh(t,jo),n=Cn(e,{fromStat:{key:r},min:1}).w,a=n,i=0,o="20%",s="30%",l={};hh(e,r,function(y){var x=M$(y);l[x]||i++,l[x]=l[x]||{width:0,maxWidth:0};var _=me(y.get("barWidth"),n),w=me(y.get("barMaxWidth"),n),S=y.get("barGap"),C=y.get("barCategoryGap");_&&!l[x].width&&(_=Et(a,_),l[x].width=_,a-=_),w&&(l[x].maxWidth=w),S!=null&&(s=S),C!=null&&(o=C)});var u={},c=me(o,n),h=me(s,1),f=(a-c)/(i+(i-1)*h);f=at(f,0),R(l,function(y,x){var _=y.maxWidth;_&&_=r.y&&t[1]<=r.y+r.height:n.contain(n.toLocalCoord(t[1]))&&t[0]>=r.y&&t[0]<=r.y+r.height},e.prototype.pointToData=function(t,r,n){n=n||[];var a=this.getAxis();return n[0]=a.coordToData(a.toLocalCoord(t[a.orient==="horizontal"?0:1])),n},e.prototype.dataToPoint=function(t,r,n){var a=this.getAxis(),i=this.getRect();n=n||[];var o=a.orient==="horizontal"?0:1;return t instanceof Array&&(t=t[0]),n[o]=a.toGlobalCoord(a.dataToCoord(+t)),n[1-o]=o===0?i.y+i.height/2:i.x+i.width/2,n},e.prototype.convertToPixel=function(t,r,n){var a=U4(r);return a===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var a=U4(r);return a===this?this.pointToData(n):null},e}();function U4(e){var t=e.seriesModel,r=e.singleAxisModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function sxe(e,t){var r=[];return e.eachComponent(LA,function(n,a){var i=new oxe(n,e,t);i.name="single_"+a,i.resize(n,t),n.coordinateSystem=i,r.push(i)}),e.eachSeries(function(n){if(n.get("coordinateSystem")===ade){var a=n.getReferringComponents(LA,pr).models[0],i=n.coordinateSystem=a&&a.coordinateSystem;i&&dh(i.getAxis(),n,rw)}}),r}var lxe={create:sxe,dimensions:A$},W4=["x","y"],uxe=["width","height"],cxe=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis,l=s.coordinateSystem,u=Db(s),c=Y0(l,u),h=Y0(l,1-u),f=l.dataToPoint(n)[0],v=i.get("type");if(v&&v!=="none"){var g=tP(i),m=hxe[v](s,f,c,h,i.get("seriesDataIndices"),i.ecModel);m.style=g,r.graphicKey=m.type,r.pointer=m}var y=qA(a);b$(n,r,y,a,i,o)},t.prototype.getHandleTransform=function(r,n,a){var i=qA(n,{labelInside:!1});i.labelMargin=a.get(["handle","margin"]);var o=rP(n.axis,r,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,a,i){var o=a.axis,s=o.coordinateSystem,l=Db(o),u=Y0(s,l),c=[r.x,r.y];c[l]+=n[l],c[l]=Math.min(u[1],c[l]),c[l]=Math.max(u[0],c[l]);var h=Y0(s,1-l),f=(h[1]+h[0])/2,v=[f,f];return v[l]=c[l],{x:c[0],y:c[1],rotation:r.rotation,cursorPoint:v,tooltipOption:{verticalAlign:"middle"}}},t}(eP),hxe={line:function(e,t,r,n){var a=nP([t,n[0]],[t,n[1]],Db(e));return{type:"Line",subPixelOptimize:!0,shape:a}},shadow:function(e,t,r,n,a,i){var o=aP(e,a,i),s=n[1]-n[0],l=iP(t,r,o),u=l[0],c=l[1];return{type:"Rect",shape:w$([u,n[0]],[c-u,s],Db(e))}}};function Db(e){return e.isHorizontal()?0:1}function Y0(e,t){var r=e.getRect();return[r[W4[t]],r[W4[t]]+r[uxe[t]]]}var dxe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="single",t}(Yt);function fxe(e){rt(iy),Gh.registerAxisPointerClass("SingleAxisPointer",cxe),e.registerComponentView(dxe),e.registerComponentView(nxe),e.registerComponentModel($x),Uf(e,"single",$x,$x.defaultOption),e.registerCoordinateSystem("single",lxe)}var vxe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n,a){var i=zh(r);e.prototype.init.apply(this,arguments),$4(r,i)},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),$4(this.option,r)},t.prototype.getCellSize=function(){return this.option.cellSize},t.type="calendar",t.layoutMode="box",t.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:K.color.axisLine,width:1,type:"solid"}},itemStyle:{color:K.color.neutral00,borderWidth:1,borderColor:K.color.neutral10},dayLabel:{show:!0,firstDay:0,position:"start",margin:K.size.s,color:K.color.secondary},monthLabel:{show:!0,position:"start",margin:K.size.s,align:"center",formatter:null,color:K.color.secondary},yearLabel:{show:!0,position:null,margin:K.size.xl,formatter:null,color:K.color.quaternary,fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},t}(ht);function $4(e,t){var r=e.cellSize,n;ae(r)?n=r:n=e.cellSize=[r,r],n.length===1&&(n[1]=n[0]);var a=oe([0,1],function(i){return pae(t,i)&&(n[i]="auto"),n[i]!=null&&n[i]!=="auto"});Uo(e,t,{type:"box",ignoreSize:a})}var pxe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){var i=this.group;i.removeAll();var o=r.coordinateSystem,s=o.getRangeInfo(),l=o.getOrient(),u=n.getLocaleModel();this._renderDayRect(r,s,i),this._renderLines(r,s,l,i),this._renderYearText(r,s,l,i),this._renderMonthText(r,u,l,i),this._renderWeekText(r,u,s,l,i)},t.prototype._renderDayRect=function(r,n,a){for(var i=r.coordinateSystem,o=r.getModel("itemStyle").getItemStyle(),s=i.getCellWidth(),l=i.getCellHeight(),u=n.start.time;u<=n.end.time;u=i.getNextNDay(u,1).time){var c=i.dataToCalendarLayout([u],!1).tl,h=new it({shape:{x:c[0],y:c[1],width:s,height:l},cursor:"default",style:o});a.add(h)}},t.prototype._renderLines=function(r,n,a,i){var o=this,s=r.coordinateSystem,l=r.getModel(["splitLine","lineStyle"]).getLineStyle(),u=r.get(["splitLine","show"]),c=l.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var h=n.start,f=0;h.time<=n.end.time;f++){g(h.formatedDate),f===0&&(h=s.getDateInfo(n.start.y+"-"+n.start.m));var v=h.date;v.setMonth(v.getMonth()+1),h=s.getDateInfo(v)}g(s.getNextNDay(n.end.time,1).formatedDate);function g(m){o._firstDayOfMonth.push(s.getDateInfo(m)),o._firstDayPoints.push(s.dataToCalendarLayout([m],!1).tl);var y=o._getLinePointsOfOneWeek(r,m,a);o._tlpoints.push(y[0]),o._blpoints.push(y[y.length-1]),u&&o._drawSplitline(y,l,i)}u&&this._drawSplitline(o._getEdgesPoints(o._tlpoints,c,a),l,i),u&&this._drawSplitline(o._getEdgesPoints(o._blpoints,c,a),l,i)},t.prototype._getEdgesPoints=function(r,n,a){var i=[r[0].slice(),r[r.length-1].slice()],o=a==="horizontal"?0:1;return i[0][o]=i[0][o]-n/2,i[1][o]=i[1][o]+n/2,i},t.prototype._drawSplitline=function(r,n,a){var i=new un({z2:20,shape:{points:r},style:n});a.add(i)},t.prototype._getLinePointsOfOneWeek=function(r,n,a){for(var i=r.coordinateSystem,o=i.getDateInfo(n),s=[],l=0;l<7;l++){var u=i.getNextNDay(o.time,l),c=i.dataToCalendarLayout([u.time],!1);s[2*u.day]=c.tl,s[2*u.day+1]=c[a==="horizontal"?"bl":"tr"]}return s},t.prototype._formatterLabel=function(r,n){return ve(r)&&r?lH(r,n):Le(r)?r(n):n.nameMap},t.prototype._yearTextPositionControl=function(r,n,a,i,o){var s=n[0],l=n[1],u=["center","bottom"];i==="bottom"?(l+=o,u=["center","top"]):i==="left"?s-=o:i==="right"?(s+=o,u=["center","top"]):l-=o;var c=0;return(i==="left"||i==="right")&&(c=Math.PI/2),{rotation:c,x:s,y:l,style:{align:u[0],verticalAlign:u[1]}}},t.prototype._renderYearText=function(r,n,a,i){var o=r.getModel("yearLabel");if(o.get("show")){var s=o.get("margin"),l=o.get("position");l||(l=a!=="horizontal"?"top":"left");var u=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],c=(u[0][0]+u[1][0])/2,h=(u[0][1]+u[1][1])/2,f=a==="horizontal"?0:1,v={top:[c,u[f][1]],bottom:[c,u[1-f][1]],left:[u[1-f][0],h],right:[u[f][0],h]},g=n.start.y;+n.end.y>+n.start.y&&(g=g+"-"+n.end.y);var m=o.get("formatter"),y={start:n.start.y,end:n.end.y,nameMap:g},x=this._formatterLabel(m,y),_=new wt({z2:30,style:$t(o,{text:x}),silent:o.get("silent")});_.attr(this._yearTextPositionControl(_,v[l],a,l,s)),i.add(_)}},t.prototype._monthTextPositionControl=function(r,n,a,i,o){var s="left",l="top",u=r[0],c=r[1];return a==="horizontal"?(c=c+o,n&&(s="center"),i==="start"&&(l="bottom")):(u=u+o,n&&(l="middle"),i==="start"&&(s="right")),{x:u,y:c,align:s,verticalAlign:l}},t.prototype._renderMonthText=function(r,n,a,i){var o=r.getModel("monthLabel");if(o.get("show")){var s=o.get("nameMap"),l=o.get("margin"),u=o.get("position"),c=o.get("align"),h=[this._tlpoints,this._blpoints];(!s||ve(s))&&(s&&(n=UM(s)||n),s=n.get(["time","monthAbbr"])||[]);var f=u==="start"?0:1,v=a==="horizontal"?0:1;l=u==="start"?-l:l;for(var g=c==="center",m=o.get("silent"),y=0;y=i.start.time&&a.times.end.time&&r.reverse(),r},e.prototype._getRangeInfo=function(t){var r=[this.getDateInfo(t[0]),this.getDateInfo(t[1])],n;r[0].time>r[1].time&&(n=!0,r.reverse());var a=Math.floor(r[1].time/T2)-Math.floor(r[0].time/T2)+1,i=new Date(r[0].time),o=i.getDate(),s=r[1].date.getDate();i.setDate(o+a-1);var l=i.getDate();if(l!==s)for(var u=i.getTime()-r[1].time>0?1:-1;(l=i.getDate())!==s&&(i.getTime()-r[1].time)*u>0;)a-=u,i.setDate(l-u);var c=Math.floor((a+r[0].day+6)/7),h=n?-c+1:c-1;return n&&r.reverse(),{range:[r[0].formatedDate,r[1].formatedDate],start:r[0],end:r[1],allDay:a,weeks:c,nthWeek:h,fweek:r[0].day,lweek:r[1].day}},e.prototype._getDateByWeeksAndDay=function(t,r,n){var a=this._getRangeInfo(n);if(t>a.weeks||t===0&&ra.lweek)return null;var i=(t-1)*7-a.fweek+r,o=new Date(a.start.time);return o.setDate(+a.start.d+i),this.getDateInfo(o)},e.create=function(t,r){var n=[];return t.eachComponent("calendar",function(a){var i=new e(a,t,r);n.push(i),a.coordinateSystem=i}),t.eachComponent(function(a,i){Ym({targetModel:i,coordSysType:"calendar",coordSysProvider:pH})}),n},e.dimensions=["time","value"],e}();function M2(e){var t=e.calendarModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}function mxe(e){e.registerComponentModel(vxe),e.registerComponentView(pxe),e.registerCoordinateSystem("calendar",gxe)}var _s={level:1,leaf:2,nonLeaf:3},Es={none:0,all:1,body:2,corner:3};function KA(e,t,r){var n=t[We[r]].getCell(e);return!n&&Tt(e)&&e<0&&(n=t[We[1-r]].getUnitLayoutInfo(r,Math.round(e))),n}function N$(e){var t=e||[];return t[0]=t[0]||[],t[1]=t[1]||[],t[0][0]=t[0][1]=t[1][0]=t[1][1]=NaN,t}function k$(e,t,r,n,a){Z4(e[0],t,a,r,n,0),Z4(e[1],t,a,r,n,1)}function Z4(e,t,r,n,a,i){e[0]=1/0,e[1]=-1/0;var o=n[i],s=ae(o)?o:[o],l=s.length,u=!!r;if(l>=1?(Y4(e,t,s,u,a,i,0),l>1&&Y4(e,t,s,u,a,i,l-1)):e[0]=e[1]=NaN,u){var c=-a[We[1-i]].getLocatorCount(i),h=a[We[i]].getLocatorCount(i)-1;r===Es.body?c=at(0,c):r===Es.corner&&(h=Et(-1,h)),h=t[0]&&e[0]<=t[1]}function K4(e,t){e.id.set(t[0][0],t[1][0]),e.span.set(t[0][1]-e.id.x+1,t[1][1]-e.id.y+1)}function _xe(e,t){e[0][0]=t[0][0],e[0][1]=t[0][1],e[1][0]=t[1][0],e[1][1]=t[1][1]}function J4(e,t,r,n){var a=KA(t[n][0],r,n),i=KA(t[n][1],r,n);e[We[n]]=e[_r[n]]=NaN,a&&i&&(e[We[n]]=a.xy,e[_r[n]]=i.xy+i.wh-a.xy)}function bp(e,t,r,n){return e[We[t]]=r,e[We[1-t]]=n,e}function bxe(e){return e&&(e.type===_s.leaf||e.type===_s.nonLeaf)?e:null}function jb(){return{x:NaN,y:NaN,width:NaN,height:NaN}}var Q4=function(){function e(t,r){this._cells=[],this._levels=[],this.dim=t,this.dimIdx=t==="x"?0:1,this._model=r,this._uniqueValueGen=wxe(t);var n=r.get("data",!0),a=r.get("length",!0);if(n!=null&&!ae(n)&&(n=[]),n)this._initByDimModelData(n);else if(a!=null){n=Array(a);for(var i=0;i=1,w=r[We[n]],S=i.getLocatorCount(n)-1,C=new Yl;for(o.resetLayoutIterator(C,n);C.next();)M(C.item);for(i.resetLayoutIterator(C,n);C.next();)M(C.item);function M(A){yn(A.wh)&&(A.wh=x),A.xy=w,A.id[We[n]]===S&&!_&&(A.wh=r[We[n]]+r[_r[n]]-A.xy),w+=A.wh}}function oz(e,t){for(var r=t[We[e]].resetCellIterator();r.next();){var n=r.item;Eb(n.rect,e,n.id,n.span,t),Eb(n.rect,1-e,n.id,n.span,t),n.type===_s.nonLeaf&&(n.xy=n.rect[We[e]],n.wh=n.rect[_r[e]])}}function sz(e,t){e.travelExistingCells(function(r){var n=r.span;if(n){var a=r.spanRect,i=r.id;Eb(a,0,i,n,t),Eb(a,1,i,n,t)}})}function Eb(e,t,r,n,a){e[_r[t]]=0;var i=r[We[t]],o=i<0?a[We[1-t]]:a[We[t]],s=o.getUnitLayoutInfo(t,r[We[t]]);if(e[We[t]]=s.xy,e[_r[t]]=s.wh,n[We[t]]>1){var l=o.getUnitLayoutInfo(t,r[We[t]]+n[We[t]]-1);e[_r[t]]=l.xy+l.wh-s.xy}}function Exe(e,t,r){var n=O_(e,r[_r[t]]);return QA(n,r[_r[t]])}function QA(e,t){return Math.max(Math.min(e,Te(t,1/0)),0)}function k2(e){var t=e.matrixModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}var pn={inBody:1,inCorner:2,outside:3},co={x:null,y:null,point:[]};function lz(e,t,r,n,a){var i=r[We[t]],o=r[We[1-t]],s=i.getUnitLayoutInfo(t,i.getLocatorCount(t)-1),l=i.getUnitLayoutInfo(t,0),u=o.getUnitLayoutInfo(t,-o.getLocatorCount(t)),c=o.shouldShow()?o.getUnitLayoutInfo(t,-1):null,h=e.point[t]=n[t];if(!l&&!c){e[We[t]]=pn.outside;return}if(a===Es.body){l?(e[We[t]]=pn.inBody,h=Et(s.xy+s.wh,at(l.xy,h)),e.point[t]=h):e[We[t]]=pn.outside;return}else if(a===Es.corner){c?(e[We[t]]=pn.inCorner,h=Et(c.xy+c.wh,at(u.xy,h)),e.point[t]=h):e[We[t]]=pn.outside;return}var f=l?l.xy:c?c.xy+c.wh:NaN,v=u?u.xy:f,g=s?s.xy+s.wh:f;if(hg){if(!a){e[We[t]]=pn.outside;return}h=g}e.point[t]=h,e[We[t]]=f<=h&&h<=g?pn.inBody:v<=h&&h<=f?pn.inCorner:pn.outside}function uz(e,t,r,n){var a=1-r;if(e[We[r]]!==pn.outside)for(n[We[r]].resetCellIterator(N2);N2.next();){var i=N2.item;if(hz(e.point[r],i.rect,r)&&hz(e.point[a],i.rect,a)){t[r]=i.ordinal,t[a]=i.id[We[a]];return}}}function cz(e,t,r,n){if(e[We[r]]!==pn.outside){var a=e[We[r]]===pn.inCorner?n[We[1-r]]:n[We[r]];for(a.resetLayoutIterator(Q0,r);Q0.next();)if(Rxe(e.point[r],Q0.item)){t[r]=Q0.item.id[We[r]];return}}}function Rxe(e,t){return t.xy<=e&&e<=t.xy+t.wh}function hz(e,t,r){return t[We[r]]<=e&&e<=t[We[r]]+t[_r[r]]}function Oxe(e){e.registerComponentModel(Mxe),e.registerComponentView(Ixe),e.registerCoordinateSystem("matrix",jxe)}function zxe(e,t){var r=e.existing;if(t.id=e.keyInfo.id,!t.type&&r&&(t.type=r.type),t.parentId==null){var n=t.parentOption;n?t.parentId=n.id:r&&(t.parentId=r.parentId)}t.parentOption=null}function dz(e,t){var r;return R(t,function(n){e[n]!=null&&e[n]!=="auto"&&(r=!0)}),r}function Bxe(e,t,r){var n=te({},r),a=e[t],i=r.$action||"merge";i==="merge"?a?(Je(a,n,!0),Uo(a,n,{ignoreSize:!0}),_H(r,a),ex(r,a),ex(r,a,"shape"),ex(r,a,"style"),ex(r,a,"extra"),r.clipPath=a.clipPath):e[t]=n:i==="replace"?e[t]=n:i==="remove"&&a&&(e[t]=null)}var I$=["transition","enterFrom","leaveTo"],Fxe=I$.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function ex(e,t,r){if(r&&(!e[r]&&t[r]&&(e[r]={}),e=e[r],t=t[r]),!(!e||!t))for(var n=r?I$:Fxe,a=0;a=0;c--){var h=a[c],f=Fr(h.id,null),v=f!=null?o.get(f):null;if(v){var g=v.parent,x=ei(g),_=g===i?{width:s,height:l}:{width:x.width,height:x.height},w={},S=V1(v,h,_,null,{hv:h.hv,boundingMode:h.bounding},w);if(!ei(v).isNew&&S){for(var C=h.transition,M={},A=0;A=0)?M[I]=k:v[I]=k}At(v,M,r,0)}else v.attr(w)}}},t.prototype._clear=function(){var r=this,n=this._elMap;n.each(function(a){qx(a,ei(a).option,n,r._lastGraphicModel)}),this._elMap=we()},t.prototype.dispose=function(){this._clear()},t.type="graphic",t}(Yt);function eN(e){var t=Se(fz,e)?fz[e]:Jg(e),r=new t({});return ei(r).type=e,r}function vz(e,t,r,n){var a=eN(r);return t.add(a),n.set(e,a),ei(a).id=e,ei(a).isNew=!0,a}function qx(e,t,r,n){var a=e&&e.parent;a&&(e.type==="group"&&e.traverse(function(i){qx(i,t,r,n)}),hw(e,t,n),r.removeKey(ei(e).id))}function pz(e,t,r,n){e.isGroup||R([["cursor",yi.prototype.cursor],["zlevel",n||0],["z",r||0],["z2",0]],function(a){var i=a[0];Se(t,i)?e[i]=Te(t[i],a[1]):e[i]==null&&(e[i]=a[1])}),R(gt(t),function(a){if(a.indexOf("on")===0){var i=t[a];e[a]=Le(i)?i:null}}),Se(t,"draggable")&&(e.draggable=t.draggable),t.name!=null&&(e.name=t.name),t.id!=null&&(e.id=t.id)}function Uxe(e){return e=te({},e),R(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(gH),function(t){delete e[t]}),e}function Wxe(e,t,r){var n=Be(e).eventData;!e.silent&&!e.ignore&&!n&&(n=Be(e).eventData={componentType:"graphic",componentIndex:t.componentIndex,name:e.name}),n&&(n.info=r.info)}function $xe(e){e.registerComponentModel(Gxe),e.registerComponentView(Hxe),e.registerPreprocessor(function(t){var r=t.graphic;ae(r)?!r[0]||!r[0].elements?t.graphic=[{elements:r}]:t.graphic=[t.graphic[0]]:r&&!r.elements&&(t.graphic=[{elements:[r]}])})}var gz=["x","y","radius","angle","single"],Zxe=Qe(),Yxe=["cartesian2d","polar","singleAxis"];function Xxe(e){var t=e.get("coordinateSystem");return Ye(Yxe,t)>=0}function Rl(e){return e+"Axis"}function qxe(e,t){var r=we(),n=[],a=we();e.eachComponent({mainType:"dataZoom",query:t},function(c){a.get(c.uid)||s(c)});var i;do i=!1,e.eachComponent("dataZoom",o);while(i);function o(c){!a.get(c.uid)&&l(c)&&(s(c),i=!0)}function s(c){a.set(c.uid,!0),n.push(c),u(c)}function l(c){var h=!1;return c.eachTargetAxis(function(f,v){var g=r.get(f);g&&g[v]&&(h=!0)}),h}function u(c){c.eachTargetAxis(function(h,f){(r.get(h)||r.set(h,[]))[f]=!0})}return n}function P$(e){var t=e.ecModel,r={infoList:[],infoMap:we()};return e.eachTargetAxis(function(n,a){var i=t.getComponent(Rl(n),a);if(i){var o=i.getCoordSysModel();if(o){var s=o.uid,l=r.infoMap.get(s);l||(l={model:o,axisModels:[]},r.infoList.push(l),r.infoMap.set(s,l)),l.axisModels.push(i)}}}),r}function D$(e){var t=Zxe(vU(e));return t.axisProxyMap||(t.axisProxyMap=we())}function Rb(e){if(e)return D$(e.ecModel).get(e.uid)}function Kxe(e,t){D$(e.ecModel).set(e.uid,t)}function j$(e,t){var r=t.getAxisModel().axis.__alignTo;return r&&e.getAxisProxy(r.dim,r.model.componentIndex)?Rb(r.model):null}var L2=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},e}(),Mm=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._autoThrottle=!0,r._noTarget=!0,r._rangePropMode=["percent","percent"],r}return t.prototype.init=function(r,n,a){var i=mz(r);this.settledOption=i,this.mergeDefaultAndTheme(r,a),this._doInit(i)},t.prototype.mergeOption=function(r){var n=mz(r);Je(this.option,r,!0),Je(this.settledOption,n,!0),this._doInit(n)},t.prototype._doInit=function(r){var n=this.option;this._setDefaultThrottle(r),this._updateRangeUse(r);var a=this.settledOption;R([["start","startValue"],["end","endValue"]],function(i,o){this._rangePropMode[o]==="value"&&(n[i[0]]=a[i[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var r=this.get("orient",!0),n=this._targetAxisInfoMap=we(),a=this._fillSpecifiedTargetAxis(n);a?this._orient=r||this._makeAutoOrientByTargetAxis():(this._orient=r||"horizontal",this._fillAutoTargetAxisByOrient(n,this._orient)),this._noTarget=!0,n.each(function(i){i.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(r){var n=!1;return R(gz,function(a){var i=this.getReferringComponents(Rl(a),zte);if(i.specified){n=!0;var o=new L2;R(i.models,function(s){o.add(s.componentIndex)}),r.set(a,o)}},this),n},t.prototype._fillAutoTargetAxisByOrient=function(r,n){var a=this.ecModel,i=!0;if(i){var o=n==="vertical"?"y":"x",s=a.findComponents({mainType:o+"Axis"});l(s,o)}if(i){var s=a.findComponents({mainType:"singleAxis",filter:function(c){return c.get("orient",!0)===n}});l(s,"single")}function l(u,c){var h=u[0];if(h){var f=new L2;if(f.add(h.componentIndex),r.set(c,f),i=!1,c==="x"||c==="y"){var v=h.getReferringComponents("grid",pr).models[0];v&&R(u,function(g){h.componentIndex!==g.componentIndex&&v===g.getReferringComponents("grid",pr).models[0]&&f.add(g.componentIndex)})}}}i&&R(gz,function(u){if(i){var c=a.findComponents({mainType:Rl(u),filter:function(f){return f.get("type",!0)==="category"}});if(c[0]){var h=new L2;h.add(c[0].componentIndex),r.set(u,h),i=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var r;return this.eachTargetAxis(function(n){!r&&(r=n)},this),r==="y"?"vertical":"horizontal"},t.prototype._setDefaultThrottle=function(r){if(r.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var n=this.ecModel.option;this.option.throttle=n.animation&&n.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(r){var n=this._rangePropMode,a=this.get("rangeMode");R([["start","startValue"],["end","endValue"]],function(i,o){var s=r[i[0]]!=null,l=r[i[1]]!=null;s&&!l?n[o]="percent":!s&&l?n[o]="value":a?n[o]=a[o]:s&&(n[o]="percent")})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var r;return this.eachTargetAxis(function(n,a){r==null&&(r=this.ecModel.getComponent(Rl(n),a))},this),r},t.prototype.eachTargetAxis=function(r,n){this._targetAxisInfoMap.each(function(a,i){R(a.indexList,function(o){r.call(n,i,o)})})},t.prototype.getAxisProxy=function(r,n){return Rb(this.getAxisModel(r,n))},t.prototype.getAxisModel=function(r,n){var a=this._targetAxisInfoMap.get(r);if(a&&a.indexMap[n])return this.ecModel.getComponent(Rl(r),n)},t.prototype.setRawRange=function(r){var n=this.option,a=this.settledOption;R([["start","startValue"],["end","endValue"]],function(i){(r[i[0]]!=null||r[i[1]]!=null)&&(n[i[0]]=a[i[0]]=r[i[0]],n[i[1]]=a[i[1]]=r[i[1]])},this),this._updateRangeUse(r)},t.prototype.setCalculatedRange=function(r){var n=this.option;R(["start","startValue","end","endValue"],function(a){n[a]=r[a]})},t.prototype.getPercentRange=function(){var r=this.findRepresentativeAxisProxy();if(r)return r.getWindow().percent},t.prototype.getValueRange=function(r,n){if(r==null&&n==null){var a=this.findRepresentativeAxisProxy();if(a)return a.getWindow().value}else return this.getAxisProxy(r,n).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(r){if(r)return Rb(r);for(var n,a=this._targetAxisInfoMap.keys(),i=0;io[1];if(w&&!S&&!C)return!0;w&&(y=!0),S&&(g=!0),C&&(m=!0)}return y&&g&&m})}else R(c,function(v){if(i==="empty")l.setData(u=u.map(v,function(m){return s(m)?m:NaN}));else{var g={};g[v]=o,u.selectRange(g)}});R(c,function(v){u.setApproximateExtent(o,v)})}});function s(l){return l>=o[0]&&l<=o[1]}},e.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},r=this._dataZoomModel,n=this._extent;R(["min","max"],function(a){var i=r.get(a+"Span"),o=r.get(a+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?i=Nt(n[0]+o,n,[0,100],!0):i!=null&&(o=Nt(i,[0,100],n,!0)-n[0]),t[a+"Span"]=i,t[a+"ValueSpan"]=o},this)},e}(),t_e={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(a){e.eachComponent("dataZoom",function(i){i.eachTargetAxis(function(o,s){var l=e.getComponent(Rl(o),s);a(o,s,l,i)})})}var r=[];t(function(a,i,o,s){if(!Rb(o)){var l=new e_e(a,i,s,e);r.push(l),Kxe(o,l)}});var n=we();return R(r,function(a){R(a.getTargetSeriesModels(),function(i){n.set(i.uid,i)})}),n},overallReset:function(e,t){e.eachComponent("dataZoom",function(r){var n=[];r.eachTargetAxis(function(a,i){var o=r.getAxisProxy(a,i),s=j$(r,o);s?n.push([o,s]):o.reset(r,null)}),R(n,function(a){a[0].reset(r,a[1].getWindow().percentInverted)}),r.eachTargetAxis(function(a,i){r.getAxisProxy(a,i).filterData(r,t)})}),e.eachComponent("dataZoom",function(r){var n=r.findRepresentativeAxisProxy();if(n){var a=n.getWindow(),i=a.percent,o=a.value;r.setCalculatedRange({start:i[0],end:i[1],startValue:o[0],endValue:o[1]})}})}};function r_e(e){e.registerAction("dataZoom",function(t,r){var n=qxe(r,t);R(n,function(a){a.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})})}var n_e=lv();function dP(e){n_e(e,function(){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,t_e),r_e(e),e.registerSubTypeDefaulter("dataZoom",function(){return"slider"})})}function a_e(e){e.registerComponentModel(Jxe),e.registerComponentView(Qxe),dP(e)}var Eo=function(){function e(){}return e}(),E$={};function Rd(e,t){E$[e]=t}function R$(e){return E$[e]}var i_e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n,a){var i=a.getTheme().get("toolbox"),o=i?i.feature:null;o&&(this._themeFeatureOption=te({},o),i.feature={}),e.prototype.init.call(this,r,n,a),o&&(i.feature=o)},t.prototype.optionUpdated=function(){R(this.option.feature,function(r,n){var a=this._themeFeatureOption,i=R$(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(this.ecModel)),a&&a[n]&&(Je(r,a[n]),a[n]=null),Je(r,i.defaultOption))},this)},t.type="toolbox",t.layoutMode={type:"box",ignoreSize:!0},t.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:K.size.m,itemSize:15,itemGap:K.size.s,showTitle:!0,iconStyle:{borderColor:K.color.accent50,color:"none"},emphasis:{iconStyle:{borderColor:K.color.accent70}},tooltip:{show:!1,position:"bottom"}},t}(ht);function O$(e,t){var r=mv(t.get("padding")),n=t.getItemStyle(["color","opacity"]);n.fill=t.get("backgroundColor");var a=new it({shape:{x:e.x-r[3],y:e.y-r[0],width:e.width+r[1]+r[3],height:e.height+r[0]+r[2],r:t.get("borderRadius")},style:n,silent:!0,z2:-1});return a}var o_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a,i){var o=this.group;if(o.removeAll(),!r.get("show"))return;var s=+r.get("itemSize"),l=r.get("orient")==="vertical",u=r.get("feature")||{},c=this._features||(this._features=we()),h=[];R(u,function(_,w){h.push(w)}),new $s(this._featureNames||[],h).add(f).update(f).remove(nt(f,null)).execute(),this._featureNames=It(h,function(_){return c.hasKey(_)});function f(_,w){var S=_!=null&&w==null,C=_!=null&&w!=null,M=_==null,A=S||C?h[_]:h[w],I=u[A],k=S||C?new vt(I,r,n):null,P=k&&k.get("show"),D;if(S){if(!P)return;if(s_e(A))D={onclick:k.option.onclick,featureName:A};else{var z=R$(A);if(!z)return;D=new z}c.set(A,D)}else D=c.get(A);if(M||!P){yz(D)&&D.dispose&&D.dispose(n,a),c.removeKey(A);return}i&&i.newTitle!=null&&i.featureName===A&&(I.title=i.newTitle),S&&(D.uid=Oh("toolbox-feature")),D.model=k,D.ecModel=n,D.api=a,v(k,D,A),k.setIconStatus=function(j,B){var H=this.option,V=this.iconPaths;H.iconStatus=H.iconStatus||{},H.iconStatus[j]=B,V[j]&&(B==="emphasis"?Us:Ws)(V[j])},yz(D)&&D.render&&D.render(k,n,a,i)}function v(_,w,S){var C=_.getModel("iconStyle"),M=_.getModel(["emphasis","iconStyle"]),A=w instanceof Eo&&w.getIcons?w.getIcons():_.get("icon"),I=_.get("title")||{},k,P;ve(A)?(k={},k[S]=A):k=A,ve(I)?(P={},P[S]=I):P=I;var D=_.iconPaths={};R(k,function(z,j){var B=pv(z,{},{x:-s/2,y:-s/2,width:s,height:s});B.setStyle(C.getItemStyle());var H=B.ensureState("emphasis");H.style=M.getItemStyle();var V=new wt({style:{text:P[j],align:M.get("textAlign"),borderRadius:M.get("textBorderRadius"),padding:M.get("textPadding"),fill:null,font:lL({fontStyle:M.get("textFontStyle"),fontFamily:M.get("textFontFamily"),fontSize:M.get("textFontSize"),fontWeight:M.get("textFontWeight")},n)},ignore:!0});B.setTextContent(V),el({el:B,componentModel:r,itemName:j,formatterParamsExtra:{title:P[j]}}),B.__title=P[j],B.on("mouseover",function(){var U=M.getItemStyle(),F=l?r.get("right")==null&&r.get("left")!=="right"?"right":"left":r.get("bottom")==null&&r.get("top")!=="bottom"?"bottom":"top";V.setStyle({fill:M.get("textFill")||U.fill||U.stroke||K.color.neutral99,backgroundColor:M.get("textBackgroundColor")}),B.setTextConfig({position:M.get("textPosition")||F}),V.ignore=!r.get("showTitle"),a.enterEmphasis(this)}).on("mouseout",function(){_.get(["iconStatus",j])!=="emphasis"&&a.leaveEmphasis(this),V.hide()}),(_.get(["iconStatus",j])==="emphasis"?Us:Ws)(B),o.add(B),B.on("click",be(w.onclick,w,n,a,j)),D[j]=B})}var g=Ur(r,a).refContainer,m=r.getBoxLayoutParams(),y=r.get("padding"),x=tr(m,g,y);Gc(r.get("orient"),o,r.get("itemGap"),x.width,x.height),V1(o,m,g,y),o.add(O$(o.getBoundingRect(),r)),l||o.eachChild(function(_){var w=_.__title,S=_.ensureState("emphasis"),C=S.textConfig||(S.textConfig={}),M=_.getTextContent(),A=M&&M.ensureState("emphasis");if(A&&!Le(A)&&w){var I=A.style||(A.style={}),k=S1(w,wt.makeFont(I)),P=_.x+o.x,D=_.y+o.y+s,z=!1;D+k.height>a.getHeight()&&(C.position="top",z=!0);var j=z?-5-k.height:s+10;P+k.width/2>a.getWidth()?(C.position=["100%",j],I.align="right"):P-k.width/2<0&&(C.position=[0,j],I.align="left")}})},t.prototype.updateView=function(r,n,a,i){R(this._features,function(o){o&&o instanceof Eo&&o.updateView&&o.updateView(o.model,n,a,i)})},t.prototype.dispose=function(r,n){R(this._features,function(a){a&&a instanceof Eo&&a.dispose&&a.dispose(r,n)})},t.type="toolbox",t}(Yt);function s_e(e){return e.indexOf("my")===0}function yz(e){return e instanceof Eo}var l_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){var a=this.model,i=a.get("name")||r.get("title.0.text")||"echarts",o=n.getZr().painter.getType()==="svg",s=o?"svg":a.get("type",!0)||"png",l=n.getConnectedDataURL({type:s,backgroundColor:a.get("backgroundColor",!0)||r.get("backgroundColor")||K.color.neutral00,connectedBackgroundColor:a.get("connectedBackgroundColor"),excludeComponents:a.get("excludeComponents"),pixelRatio:a.get("pixelRatio")}),u=xt.browser;if(typeof MouseEvent=="function"&&(u.newEdge||!u.ie&&!u.edge)){var c=document.createElement("a");c.download=i+"."+s,c.target="_blank",c.href=l;var h=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(h)}else if(window.navigator.msSaveOrOpenBlob||o){var f=l.split(","),v=f[0].indexOf("base64")>-1,g=o?decodeURIComponent(f[1]):f[1];v&&(g=window.atob(g));var m=i+"."+s;if(window.navigator.msSaveOrOpenBlob){for(var y=g.length,x=new Uint8Array(y);y--;)x[y]=g.charCodeAt(y);var _=new Blob([x]);window.navigator.msSaveOrOpenBlob(_,m)}else{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow,C=S.document;C.open("image/svg+xml","replace"),C.write(g),C.close(),S.focus(),C.execCommand("SaveAs",!0,m),document.body.removeChild(w)}}else{var M=a.get("lang"),A='',I=window.open();I.document.write(A),I.document.title=i}},t.getDefaultOption=function(r){var n={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:r.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:K.color.neutral00,name:"",excludeComponents:["toolbox"],lang:r.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return n},t}(Eo),xz="__ec_magicType_stack__",u_e=[["line","bar"],["stack"]],c_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getIcons=function(){var r=this.model,n=r.get("icon"),a={};return R(r.get("type"),function(i){n[i]&&(a[i]=n[i])}),a},t.getDefaultOption=function(r){var n={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:r.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return n},t.prototype.onclick=function(r,n,a){var i=this.model,o=i.get(["seriesIndex",a]);if(_z[a]){var s={series:[]},l=function(h){var f=h.subType,v=h.id,g=_z[a](f,v,h,i);g&&(Ee(g,h.option),s.series.push(g));var m=h.coordinateSystem;if(m&&m.type==="cartesian2d"&&(a==="line"||a==="bar")){var y=m.getAxesByScale("ordinal")[0];if(y){var x=y.dim,_=x+"Axis",w=h.getReferringComponents(_,pr).models[0],S=w.componentIndex;s[_]=s[_]||[];for(var C=0;C<=S;C++)s[_][S]=s[_][S]||{};s[_][S].boundaryGap=a==="bar"}}};R(u_e,function(h){Ye(h,a)>=0&&R(h,function(f){i.setIconStatus(f,"normal")})}),i.setIconStatus(a,"emphasis"),r.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,c=a;a==="stack"&&(u=Je({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),i.get(["iconStatus",a])!=="emphasis"&&(c="tiled")),n.dispatchAction({type:"changeMagicType",currentType:c,newOption:s,newTitle:u,featureName:"magicType"})}},t}(Eo),_z={line:function(e,t,r,n){if(e==="bar")return Je({id:t,type:"line",data:r.get("data"),stack:r.get("stack"),markPoint:r.get("markPoint"),markLine:r.get("markLine")},n.get(["option","line"])||{},!0)},bar:function(e,t,r,n){if(e==="line")return Je({id:t,type:"bar",data:r.get("data"),stack:r.get("stack"),markPoint:r.get("markPoint"),markLine:r.get("markLine")},n.get(["option","bar"])||{},!0)},stack:function(e,t,r,n){var a=r.get("stack")===xz;if(e==="line"||e==="bar")return n.setIconStatus("stack",a?"normal":"emphasis"),Je({id:t,stack:a?"":xz},n.get(["option","stack"])||{},!0)}};Xi({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(e,t){t.mergeOption(e.newOption)});var dw=new Array(60).join("-"),Xf=" ";function h_e(e){var t={},r=[],n=[];return e.eachRawSeries(function(a){var i=a.coordinateSystem;if(i&&(i.type==="cartesian2d"||i.type==="polar")){var o=i.getBaseAxis();if(o.type==="category"){var s=Zce(o);t[s]||(t[s]={categoryAxis:o,valueAxis:i.getOtherAxis(o),series:[]},n.push({axisDim:o.dim,axisIndex:o.index})),t[s].series.push(a)}else r.push(a)}else r.push(a)}),{seriesGroupByCategoryAxis:t,other:r,meta:n}}function d_e(e){var t=[];return R(e,function(r,n){var a=r.categoryAxis,i=r.valueAxis,o=i.dim,s=[" "].concat(oe(r.series,function(v){return v.name})),l=[a.model.getCategories()];R(r.series,function(v){var g=v.getRawData();l.push(v.getRawData().mapArray(g.mapDimension(o),function(m){return m}))});for(var u=[s.join(Xf)],c=0;c=0)return!0}var tN=new RegExp("["+Xf+"]+","g");function g_e(e){for(var t=e.split(/\n+/g),r=Ob(t.shift()).split(tN),n=[],a=oe(r,function(l){return{name:l,data:[]}}),i=0;i=0;i--){var o=r[i];if(o[a])break}if(i<0){var s=e.queryComponents({mainType:"dataZoom",subType:"select",id:a})[0];if(s){var l=s.getPercentRange();r[0][a]={dataZoomId:a,start:l[0],end:l[1]}}}}),r.push(t)}function w_e(e){var t=fP(e),r=t[t.length-1];t.length>1&&t.pop();var n={};return z$(r,function(a,i){for(var o=t.length-1;o>=0;o--)if(a=t[o][i],a){n[i]=a;break}}),n}function S_e(e){B$(e).snapshots=null}function C_e(e){return fP(e).length}function fP(e){var t=B$(e);return t.snapshots||(t.snapshots=[{}]),t.snapshots}var T_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){S_e(r),n.dispatchAction({type:"restore",from:this.uid})},t.getDefaultOption=function(r){var n={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:r.getLocaleModel().get(["toolbox","restore","title"])};return n},t}(Eo);Xi({type:"restore",event:"restore",update:"prepareAndUpdate"},function(e,t){t.resetOption("recreate")});var M_e=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],vP=function(){function e(t,r,n){var a=this;this._targetInfoList=[];var i=bz(r,t);R(A_e,function(o,s){(!n||!n.include||Ye(n.include,s)>=0)&&o(i,a._targetInfoList)})}return e.prototype.setOutputRanges=function(t,r){return this.matchOutputRanges(t,r,function(n,a,i){if((n.coordRanges||(n.coordRanges=[])).push(a),!n.coordRange){n.coordRange=a;var o=I2[n.brushType](0,i,a);n.__rangeOffset={offset:Tz[n.brushType](o.values,n.range,[1,1]),xyMinMax:o.xyMinMax}}}),t},e.prototype.matchOutputRanges=function(t,r,n){R(t,function(a){var i=this.findTargetInfo(a,r);i&&i!==!0&&R(i.coordSyses,function(o){var s=I2[a.brushType](1,o,a.range,!0);n(a,s.values,o,r)})},this)},e.prototype.setInputRanges=function(t,r){R(t,function(n){var a=this.findTargetInfo(n,r);if(n.range=n.range||[],a&&a!==!0){n.panelId=a.panelId;var i=I2[n.brushType](0,a.coordSys,n.coordRange),o=n.__rangeOffset;n.range=o?Tz[n.brushType](i.values,o.offset,N_e(i.xyMinMax,o.xyMinMax)):i.values}},this)},e.prototype.makePanelOpts=function(t,r){return oe(this._targetInfoList,function(n){var a=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:r?r(n):null,clipPath:W9(a),isTargetByCursor:Z9(a,t,n.coordSysModel),getLinearBrushOtherExtent:$9(a)}})},e.prototype.controlSeries=function(t,r,n){var a=this.findTargetInfo(t,n);return a===!0||a&&Ye(a.coordSyses,r.coordinateSystem)>=0},e.prototype.findTargetInfo=function(t,r){for(var n=this._targetInfoList,a=bz(r,t),i=0;ie[1]&&e.reverse(),e}function bz(e,t){return ff(e,t,{includeMainTypes:M_e})}var A_e={grid:function(e,t){var r=e.xAxisModels,n=e.yAxisModels,a=e.gridModels,i=we(),o={},s={};!r&&!n&&!a||(R(r,function(l){var u=l.axis.grid.model;i.set(u.id,u),o[u.id]=!0}),R(n,function(l){var u=l.axis.grid.model;i.set(u.id,u),s[u.id]=!0}),R(a,function(l){i.set(l.id,l),o[l.id]=!0,s[l.id]=!0}),i.each(function(l){var u=l.coordinateSystem,c=[];R(u.getCartesians(),function(h,f){(Ye(r,h.getAxis("x").model)>=0||Ye(n,h.getAxis("y").model)>=0)&&c.push(h)}),t.push({panelId:"grid--"+l.id,gridModel:l,coordSysModel:l,coordSys:c[0],coordSyses:c,getPanelRect:Sz.grid,xAxisDeclared:o[l.id],yAxisDeclared:s[l.id]})}))},geo:function(e,t){R(e.geoModels,function(r){var n=r.coordinateSystem;t.push({panelId:"geo--"+r.id,geoModel:r,coordSysModel:r,coordSys:n,coordSyses:[n],getPanelRect:Sz.geo})})}},wz=[function(e,t){var r=e.xAxisModel,n=e.yAxisModel,a=e.gridModel;return!a&&r&&(a=r.axis.grid.model),!a&&n&&(a=n.axis.grid.model),a&&a===t.gridModel},function(e,t){var r=e.geoModel;return r&&r===t.geoModel}],Sz={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys.view,t=U8(null,e);return dG(t,t,_b(null,e)),t}},I2={lineX:nt(Cz,0),lineY:nt(Cz,1),rect:function(e,t,r,n){var a=e?t.pointToData([r[0][0],r[1][0]],n):t.dataToPoint([r[0][0],r[1][0]],n),i=e?t.pointToData([r[0][1],r[1][1]],n):t.dataToPoint([r[0][1],r[1][1]],n),o=[rN([a[0],i[0]]),rN([a[1],i[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,r,n){var a=[gn(),gn()],i=oe(r,function(o){var s=e?t.pointToData(o,n):t.dataToPoint(o,n);return a[0][0]=Math.min(a[0][0],s[0]),a[1][0]=Math.min(a[1][0],s[1]),a[0][1]=Math.max(a[0][1],s[0]),a[1][1]=Math.max(a[1][1],s[1]),s});return{values:i,xyMinMax:a}}};function Cz(e,t,r,n){var a=r.getAxis(["x","y"][e]),i=rN(oe([0,1],function(s){return t?a.coordToData(a.toLocalCoord(n[s]),!0):a.toGlobalCoord(a.dataToCoord(n[s]))})),o=[];return o[e]=i,o[1-e]=[NaN,NaN],{values:i,xyMinMax:o}}var Tz={lineX:nt(Mz,0),lineY:nt(Mz,1),rect:function(e,t,r){return[[e[0][0]-r[0]*t[0][0],e[0][1]-r[0]*t[0][1]],[e[1][0]-r[1]*t[1][0],e[1][1]-r[1]*t[1][1]]]},polygon:function(e,t,r){return oe(e,function(n,a){return[n[0]-r[0]*t[a][0],n[1]-r[1]*t[a][1]]})}};function Mz(e,t,r,n){return[t[0]-n[e]*r[0],t[1]-n[e]*r[1]]}function N_e(e,t){var r=Az(e),n=Az(t),a=[r[0]/n[0],r[1]/n[1]];return isNaN(a[0])&&(a[0]=1),isNaN(a[1])&&(a[1]=1),a}function Az(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var nN=R,k_e=Dte("toolbox-dataZoom_"),L_e={x:"width",y:"height"},I_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a,i){this._brushController||(this._brushController=new OI(a.getZr()),this._brushController.on("brush",be(this._onBrush,this)).mount()),j_e(r,n,this,i,a),D_e(r,n)},t.prototype.onclick=function(r,n,a){P_e[a].call(this)},t.prototype.dispose=function(r,n){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(r){var n=r.areas;if(!r.isEnd||!n.length)return;var a={},i=this.ecModel;this._brushController.updateCovers([]);var o=new vP(pP(this.model),i,{include:["grid"]});o.matchOutputRanges(n,i,function(u,c,h){if(h.type==="cartesian2d"){var f=h.master.getRect().clone(),v=u.brushType;v==="rect"?(s("x",h,f,c[0]),s("y",h,f,c[1])):s({lineX:"x",lineY:"y"}[v],h,f,c)}}),b_e(i,a),this._dispatchZoomAction(a);function s(u,c,h,f){var v=c.getAxis(u),g=v.model,m=l(u,g,i),y=m.findRepresentativeAxisProxy(g).getMinMaxSpan(),x=v.scale.getExtent();(y.minValueSpan!=null||y.maxValueSpan!=null)&&(f=uu(0,f.slice(),x,0,y.minValueSpan,y.maxValueSpan));var _=Rk(x,h[L_e[u]],.5);m&&(a[m.id]={dataZoomId:m.id,startValue:isFinite(_)?Mt(f[0],_):f[0],endValue:isFinite(_)?Mt(f[1],_):f[1]})}function l(u,c,h){var f;return h.eachComponent({mainType:"dataZoom",subType:"select"},function(v){var g=v.getAxisModel(u,c.componentIndex);g&&(f=v)}),f}},t.prototype._dispatchZoomAction=function(r){var n=[];nN(r,function(a,i){n.push(ke(a))}),n.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:n})},t.getDefaultOption=function(r){var n={show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:r.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:K.color.backgroundTint}};return n},t}(Eo),P_e={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(w_e(this.ecModel))}};function pP(e){var t={xAxisIndex:e.get("xAxisIndex",!0),yAxisIndex:e.get("yAxisIndex",!0),xAxisId:e.get("xAxisId",!0),yAxisId:e.get("yAxisId",!0)};return t.xAxisIndex==null&&t.xAxisId==null&&(t.xAxisIndex="all"),t.yAxisIndex==null&&t.yAxisId==null&&(t.yAxisIndex="all"),t}function D_e(e,t){e.setIconStatus("back",C_e(t)>1?"emphasis":"normal")}function j_e(e,t,r,n,a){var i=r._isZoomActive;n&&n.type==="takeGlobalCursor"&&(i=n.key==="dataZoomSelect"?n.dataZoomSelectActive:!1),r._isZoomActive=i,e.setIconStatus("zoom",i?"emphasis":"normal");var o=new vP(pP(e),t,{include:["grid"]}),s=o.makePanelOpts(a,function(l){return l.xAxisDeclared&&!l.yAxisDeclared?"lineX":!l.xAxisDeclared&&l.yAxisDeclared?"lineY":"rect"});r._brushController.setPanels(s).enableBrush(i&&s.length?{brushType:"auto",brushStyle:e.getModel("brushStyle").getItemStyle()}:!1)}bae("dataZoom",function(e){var t=e.getComponent("toolbox",0),r=["feature","dataZoom"];if(!t||t.get(r)==null)return;var n=t.getModel(r),a=[],i=pP(n),o=ff(e,i);nN(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),nN(o.yAxisModels,function(l){return s(l,"yAxis","yAxisIndex")});function s(l,u,c){var h=l.componentIndex,f={type:"select",$fromToolbox:!0,filterMode:n.get("filterMode",!0)||"filter",id:k_e+u+h};f[c]=h,a.push(f)}return a});function E_e(e){e.registerComponentModel(i_e),e.registerComponentView(o_e),Rd("saveAsImage",l_e),Rd("magicType",c_e),Rd("dataView",x_e),Rd("dataZoom",I_e),Rd("restore",T_e),rt(a_e)}var R_e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="tooltip",t.dependencies=["axisPointer"],t.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click|mousewheel",alwaysShowContent:!1,renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:K.color.neutral00,shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:K.color.border,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:K.color.borderShade,width:1,type:"dashed",textStyle:{}}},textStyle:{color:K.color.tertiary,fontSize:14}},t}(ht);function F$(e){var t=e.get("confine");return t!=null?!!t:e.get("renderMode")==="richText"}function V$(e){if(xt.domSupported){for(var t=document.documentElement.style,r=0,n=e.length;r-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=i==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=i==="top"?225:45)+"deg)");var c=u*Math.PI/180,h=o+a,f=h*Math.abs(Math.cos(c))+h*Math.abs(Math.sin(c)),v=Math.round(((f-Math.SQRT2*a)/2+Math.SQRT2*a-(f-h)/2)*100)/100;s+=";"+i+":-"+v+"px";var g=t+" solid "+a+"px;",m=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+g,"border-right:"+g,"background-color:"+n+";"];return'
'}function H_e(e,t,r){var n="cubic-bezier(0.23,1,0.32,1)",a="",i="";return r&&(a=" "+e/2+"s "+n,i="opacity"+a+",visibility"+a),t||(a=" "+e+"s "+n,i+=(i.length?",":"")+(xt.transformSupported?""+gP+a:",left"+a+",top"+a)),B_e+":"+i}function Nz(e,t,r){var n=e.toFixed(0)+"px",a=t.toFixed(0)+"px";if(!xt.transformSupported)return r?"top:"+a+";left:"+n+";":[["top",a],["left",n]];var i=xt.transform3dSupported,o="translate"+(i?"3d":"")+"("+n+","+a+(i?",0":"")+")";return r?"top:0;left:0;"+gP+":"+o+";":[["top",0],["left",0],[G$,o]]}function U_e(e){var t=[],r=e.get("fontSize"),n=e.getTextColor();n&&t.push("color:"+n),t.push("font:"+e.getFont());var a=Te(e.get("lineHeight"),Math.round(r*3/2));r&&t.push("line-height:"+a+"px");var i=e.get("textShadowColor"),o=e.get("textShadowBlur")||0,s=e.get("textShadowOffsetX")||0,l=e.get("textShadowOffsetY")||0;return i&&o&&t.push("text-shadow:"+s+"px "+l+"px "+o+"px "+i),R(["decoration","align"],function(u){var c=e.get(u);c&&t.push("text-"+u+":"+c)}),t.join(";")}function W_e(e,t,r,n){var a=[],i=e.get("transitionDuration"),o=e.get("backgroundColor"),s=e.get("shadowBlur"),l=e.get("shadowColor"),u=e.get("shadowOffsetX"),c=e.get("shadowOffsetY"),h=e.getModel("textStyle"),f=JH(e,"html"),v=u+"px "+c+"px "+s+"px "+l;return a.push("box-shadow:"+v),t&&i>0&&a.push(H_e(i,r,n)),o&&a.push("background-color:"+o),R(["width","color","radius"],function(g){var m="border-"+g,y=bL(m),x=e.get(y);x!=null&&a.push(m+":"+x+(g==="color"?"":"px"))}),a.push(U_e(h)),f!=null&&a.push("padding:"+mv(f).join("px ")+"px"),a.join(";")+";"}function kz(e,t,r,n,a){var i=t&&t.painter;if(r){var o=i&&i.getViewportRoot();o&&ZQ(e,o,r,n,a)}else{e[0]=n,e[1]=a;var s=i&&i.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var $_e=function(){function e(t,r){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,xt.wxa)return null;var n=document.createElement("div");n.domBelongToZr=!0,this.el=n;var a=this._zr=t.getZr(),i=r.appendTo,o=i&&(ve(i)?document.querySelector(i):Qc(i)?i:Le(i)&&i(t.getDom()));kz(this._styleCoord,a,o,t.getWidth()/2,t.getHeight()/2),(o||t.getDom()).appendChild(n),this._api=t,this._container=o;var s=this;n.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},n.onmousemove=function(l){if(l=l||window.event,!s._enterable){var u=a.handler,c=a.painter.getViewportRoot();Ka(c,l,!0),u.dispatch("mousemove",l)}},n.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return e.prototype.update=function(t){if(!this._container){var r=this._api.getDom(),n=z_e(r,"position"),a=r.style;a.position!=="absolute"&&n!=="absolute"&&(a.position="relative")}var i=t.get("alwaysShowContent");i&&this._moveIfResized(),this._alwaysShowContent=i,this._enableDisplayTransition=t.get("displayTransition")&&t.get("transitionDuration")>0,this.el.className=t.get("className")||""},e.prototype.show=function(t,r){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,a=n.style,i=this._styleCoord;n.innerHTML?a.cssText=F_e+W_e(t,!this._firstShow,this._longHide,this._enableDisplayTransition)+Nz(i[0],i[1],!0)+("border-color:"+uh(r)+";")+(t.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):a.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(t,r,n,a,i){var o=this.el;if(t==null){o.innerHTML="";return}var s="";if(ve(i)&&n.get("trigger")==="item"&&!F$(n)&&(s=G_e(n,a,i)),ve(t))o.innerHTML=t+s;else if(t){o.innerHTML="",ae(t)||(t=[t]);for(var l=0;l=0?this._tryShow(i,o):a==="leave"&&this._hide(o))},this))},t.prototype._keepShow=function(){var r=this._tooltipModel,n=this._ecModel,a=this._api,i=r.get("triggerOn");if(r.get("trigger")!=="axis"&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&i!=="none"&&i!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!a.isDisposed()&&o.manuallyShowTip(r,n,a,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(r,n,a,i){if(!(i.from===this.uid||xt.node||!a.getDom())){var o=Pz(i,a);this._ticket="";var s=i.dataByCoordSys,l=Q_e(i,n,a);if(l){var u=l.el.getBoundingRect().clone();u.applyTransform(l.el.transform),this._tryShow({offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,target:l.el,position:i.position,positionDefault:"bottom"},o)}else if(i.tooltip&&i.x!=null&&i.y!=null){var c=Y_e;c.x=i.x,c.y=i.y,c.update(),Be(c).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:c},o)}else if(s)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:s,tooltipOption:i.tooltipOption},o);else if(i.seriesIndex!=null){if(this._manuallyAxisShowTip(r,n,a,i))return;var h=C$(i,n),f=h.point[0],v=h.point[1];f!=null&&v!=null&&this._tryShow({offsetX:f,offsetY:v,target:h.el,position:i.position,positionDefault:"bottom"},o)}else i.x!=null&&i.y!=null&&(a.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:a.getZr().findHover(i.x,i.y).target},o))}},t.prototype.manuallyHideTip=function(r,n,a,i){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,i.from!==this.uid&&this._hide(Pz(i,a))},t.prototype._manuallyAxisShowTip=function(r,n,a,i){var o=i.seriesIndex,s=i.dataIndex,l=n.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var u=n.getSeriesByIndex(o);if(u){var c=u.getData(),h=Sp([c.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(h.get("trigger")==="axis")return a.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:i.position}),!0}}},t.prototype._tryShow=function(r,n){var a=r.target,i=this._tooltipModel;if(i){this._lastX=r.offsetX,this._lastY=r.offsetY;var o=r.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,r);else if(a){var s=Be(a);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null,this._cbParamsList=null;var l,u;Dc(a,function(c){if(c.tooltipDisabled)return l=u=null,!0;l||u||(Be(c).dataIndex!=null?l=c:Be(c).tooltipConfig!=null&&(u=c))},!0),l?this._showSeriesItemTooltip(r,l,n):u?this._showComponentItemTooltip(r,u,n):this._hide(n)}else this._lastDataByCoordSys=null,this._cbParamsList=null,this._hide(n)}},t.prototype._showOrMove=function(r,n){var a=r.get("showDelay");n=be(n,this),clearTimeout(this._showTimout),a>0?this._showTimout=setTimeout(n,a):n()},t.prototype._showAxisTooltip=function(r,n){var a=this._ecModel,i=this._tooltipModel,o=[n.offsetX,n.offsetY],s=Sp([n.tooltipOption],i),l=this._renderMode,u=[],c=Er("section",{blocks:[],noHeader:!0}),h=[],f=new sC;R(r,function(_){R(_.dataByAxis,function(w){var S=a.getComponent(w.axisDim+"Axis",w.axisIndex),C=w.value,M=S.axis,A=M.scale.parse(C);if(!(!S||C==null)){var I=_$(C,M,a,w.seriesDataIndices,w.valueLabelOpt),k=Er("section",{header:I,noHeader:!ka(I),sortBlocks:!0,blocks:[]});c.blocks.push(k),R(w.seriesDataIndices,function(P){var D=a.getSeriesByIndex(P.seriesIndex),z=P.dataIndexInside,j=D.getDataParams(z);if(!(j.dataIndex<0)){j.axisDim=w.axisDim,j.axisIndex=w.axisIndex,j.axisType=w.axisType,j.axisId=w.axisId,j.axisValue=ob(S.axis,{value:A}),j.axisValueLabel=I,j.marker=f.makeTooltipMarker("item",uh(j.color),l);var B=BR(D.formatTooltip(z,!0,null)),H=B.frag;if(H){var V=Sp([D],i).get("valueFormatter");k.blocks.push(V?te({valueFormatter:V},H):H)}B.text&&h.push(B.text),u.push(j)}})}})}),c.blocks.reverse(),h.reverse();var v=n.position,g=s.get("order"),m=WR(c,f,l,g,a.get("useUTC"),s.get("textStyle"));m&&h.unshift(m);var y=l==="richText"?` + +`:"
",x=h.join(y);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(r,u)?this._updatePosition(s,v,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,x,u,Math.random()+"",o[0],o[1],v,null,f)})},t.prototype._showSeriesItemTooltip=function(r,n,a){var i=this._ecModel,o=Be(n),s=o.seriesIndex,l=i.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,h=o.dataType,f=u.getData(h),v=this._renderMode,g=r.positionDefault,m=Sp([f.getItemModel(c),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,g?{position:g}:null),y=m.get("trigger");if(!(y!=null&&y!=="item")){var x=u.getDataParams(c,h),_=new sC;x.marker=_.makeTooltipMarker("item",uh(x.color),v);var w=BR(u.formatTooltip(c,!1,h)),S=m.get("order"),C=m.get("valueFormatter"),M=w.frag,A=M?WR(C?te({valueFormatter:C},M):M,_,v,S,i.get("useUTC"),m.get("textStyle")):w.text,I="item_"+u.name+"_"+c;this._showOrMove(m,function(){this._showTooltipContent(m,A,x,I,r.offsetX,r.offsetY,r.position,r.target,_)}),a({type:"showTip",dataIndexInside:c,dataIndex:f.getRawIndex(c),seriesIndex:s,from:this.uid})}},t.prototype._showComponentItemTooltip=function(r,n,a){var i=this._renderMode==="html",o=Be(n),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(ve(l)){var c=l;l={content:c,formatter:c},u=!0}u&&i&&l.content&&(l=ke(l),l.content=Rn(l.content));var h=[l],f=this._ecModel.getComponent(o.componentMainType,o.componentIndex);f&&h.push(f),h.push({formatter:l.content});var v=r.positionDefault,g=Sp(h,this._tooltipModel,v?{position:v}:null),m=g.get("content"),y=Math.random()+"",x=new sC;this._showOrMove(g,function(){var _=ke(g.get("formatterParams")||{});this._showTooltipContent(g,m,_,y,r.offsetX,r.offsetY,r.position,n,x)}),a({type:"showTip",from:this.uid})},t.prototype._showTooltipContent=function(r,n,a,i,o,s,l,u,c){if(this._ticket="",!(!r.get("showContent")||!r.get("show"))){var h=this._tooltipContent;h.setEnterable(r.get("enterable"));var f=r.get("formatter");l=l||r.get("position");var v=n,g=this._getNearestPoint([o,s],a,r.get("trigger"),r.get("borderColor"),r.get("defaultBorderColor",!0)),m=g.color;if(f)if(ve(f)){var y=r.ecModel.get("useUTC"),x=ae(a)?a[0]:a,_=x&&x.axisType&&x.axisType.indexOf("time")>=0;v=f,_&&(v=Zm(x.axisValue,v,y)),v=wL(v,a,!0)}else if(Le(f)){var w=be(function(S,C){S===this._ticket&&(h.setContent(C,c,r,m,l),this._updatePosition(r,l,o,s,h,a,u))},this);this._ticket=i,v=f(a,i,w)}else v=f;h.setContent(v,c,r,m,l),h.show(r,m),this._updatePosition(r,l,o,s,h,a,u)}},t.prototype._getNearestPoint=function(r,n,a,i,o){if(a==="axis"||ae(n))return{color:i||o};if(!ae(n))return{color:i||n.color||n.borderColor}},t.prototype._updatePosition=function(r,n,a,i,o,s,l){var u=this._api.getWidth(),c=this._api.getHeight();n=n||r.get("position");var h=o.getSize(),f=r.get("align"),v=r.get("verticalAlign"),g=l&&l.getBoundingRect().clone();if(l&&g.applyTransform(l.transform),Le(n)&&(n=n([a,i],s,o.el,g,{viewSize:[u,c],contentSize:h.slice()})),ae(n))a=me(n[0],u),i=me(n[1],c);else if(Re(n)){var m=n;m.width=h[0],m.height=h[1];var y=tr(m,{width:u,height:c});a=y.x,i=y.y,f=null,v=null}else if(ve(n)&&l){var x=J_e(n,g,h,r.get("borderWidth"));a=x[0],i=x[1]}else{var x=q_e(a,i,o,u,c,f?null:20,v?null:20);a=x[0],i=x[1]}if(f&&(a-=Dz(f)?h[0]/2:f==="right"?h[0]:0),v&&(i-=Dz(v)?h[1]/2:v==="bottom"?h[1]:0),F$(r)){var x=K_e(a,i,o,u,c);a=x[0],i=x[1]}o.moveTo(a,i)},t.prototype._updateContentNotChangedOnAxis=function(r,n){var a=this._lastDataByCoordSys,i=this._cbParamsList,o=!!a&&a.length===r.length;return o&&R(a,function(s,l){var u=s.dataByAxis||[],c=r[l]||{},h=c.dataByAxis||[];o=o&&u.length===h.length,o&&R(u,function(f,v){var g=h[v]||{},m=f.seriesDataIndices||[],y=g.seriesDataIndices||[];o=o&&f.value===g.value&&f.axisType===g.axisType&&f.axisId===g.axisId&&m.length===y.length,o&&R(m,function(x,_){var w=y[_];o=o&&x.seriesIndex===w.seriesIndex&&x.dataIndex===w.dataIndex}),i&&R(f.seriesDataIndices,function(x){var _=x.seriesIndex,w=n[_],S=i[_];w&&S&&S.data!==w.data&&(o=!1)})})}),this._lastDataByCoordSys=r,this._cbParamsList=n,!!o},t.prototype._hide=function(r){this._lastDataByCoordSys=null,this._cbParamsList=null,r({type:"hideTip",from:this.uid})},t.prototype.dispose=function(r,n){xt.node||!n.getDom()||(rm(this,"_updatePosition"),this._tooltipContent.dispose(),XA("itemTooltip",n),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type="tooltip",t}(Yt);function Sp(e,t,r){var n=t.ecModel,a;r?(a=new vt(r,n,n),a=new vt(t.option,a,n)):a=t;for(var i=e.length-1;i>=0;i--){var o=e[i];o&&(o instanceof vt&&(o=o.get("tooltip",!0)),ve(o)&&(o={formatter:o}),o&&(a=new vt(o,a,n)))}return a}function Pz(e,t){return e.dispatchAction||be(t.dispatchAction,t)}function q_e(e,t,r,n,a,i,o){var s=r.getSize(),l=s[0],u=s[1];return i!=null&&(e+l+i+2>n?e-=l+i:e+=i),o!=null&&(t+u+o>a?t-=u+o:t+=o),[e,t]}function K_e(e,t,r,n,a){var i=r.getSize(),o=i[0],s=i[1];return e=Math.min(e+o,n)-o,t=Math.min(t+s,a)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function J_e(e,t,r,n){var a=r[0],i=r[1],o=Math.ceil(Math.SQRT2*n)+8,s=0,l=0,u=t.width,c=t.height;switch(e){case"inside":s=t.x+u/2-a/2,l=t.y+c/2-i/2;break;case"top":s=t.x+u/2-a/2,l=t.y-i-o;break;case"bottom":s=t.x+u/2-a/2,l=t.y+c+o;break;case"left":s=t.x-a-o,l=t.y+c/2-i/2;break;case"right":s=t.x+u+o,l=t.y+c/2-i/2}return[s,l]}function Dz(e){return e==="center"||e==="middle"}function Q_e(e,t,r){var n=Gk(e).queryOptionMap,a=n.keys()[0];if(!(!a||a==="series")){var i=sv(t,a,n.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),o=i.models[0];if(o){var s=r.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var c=Be(u).tooltipConfig;if(c&&c.name===e.name)return l=u,!0}),l)return{componentMainType:a,componentIndex:o.componentIndex,el:l}}}}function ebe(e){rt(iy),e.registerComponentModel(R_e),e.registerComponentView(X_e),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},hr),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},hr)}var tbe=["rect","polygon","keep","clear"];function rbe(e,t){var r=Zt(e?e.brush:[]);if(r.length){var n=[];R(r,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(n=n.concat(u))});var a=e&&e.toolbox;ae(a)&&(a=a[0]),a||(a={feature:{}},e.toolbox=[a]);var i=a.feature||(a.feature={}),o=i.brush||(i.brush={}),s=o.type||(o.type=[]);s.push.apply(s,n),N1(s,function(l){return l+""},null),t&&!s.length&&s.push.apply(s,tbe)}}var jz=R;function Ez(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function aN(e,t,r){var n={};return jz(t,function(i){var o=n[i]=a();jz(e[i],function(s,l){if(Kr.isValidType(l)){var u={type:l,visual:s};r&&r(u,i),o[l]=new Kr(u),l==="opacity"&&(u=ke(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new Kr(u))}})}),n;function a(){var i=function(){};i.prototype.__hidden=i.prototype;var o=new i;return o}}function U$(e,t,r){var n;R(r,function(a){t.hasOwnProperty(a)&&Ez(t[a])&&(n=!0)}),n&&R(r,function(a){t.hasOwnProperty(a)&&Ez(t[a])?e[a]=ke(t[a]):delete e[a]})}function nbe(e,t,r,n,a,i){var o={};R(e,function(h){var f=Kr.prepareVisualTypes(t[h]);o[h]=f});var s;function l(h){return PL(r,s,h)}function u(h,f){lU(r,s,h,f)}r.each(c);function c(h,f){s=h;var v=r.getRawDataItem(s);if(!(v&&v.visualMap===!1))for(var g=n.call(a,h),m=t[g],y=o[g],x=0,_=y.length;x<_;x++){var w=y[x];m[w]&&m[w].applyVisual(h,l,u)}}}function abe(e,t,r,n){var a={};return R(e,function(i){var o=Kr.prepareVisualTypes(t[i]);a[i]=o}),{progress:function(o,s){var l;n!=null&&(l=s.getDimensionIndex(n));function u(C){return PL(s,h,C)}function c(C,M){lU(s,h,C,M)}for(var h,f=s.getStore();(h=o.next())!=null;){var v=s.getRawDataItem(h);if(!(v&&v.visualMap===!1))for(var g=n!=null?f.get(l,h):h,m=r(g),y=t[m],x=a[m],_=0,w=x.length;_t[0][1]&&(t[0][1]=i[0]),i[1]t[1][1]&&(t[1][1]=i[1])}return t&&Fz(t)}};function Fz(e){return new je(e[0][0],e[1][0],e[0][1]-e[0][0],e[1][1]-e[1][0])}var dbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){this.ecModel=r,this.api=n,this.model,(this._brushController=new OI(n.getZr())).on("brush",be(this._onBrush,this)).mount()},t.prototype.render=function(r,n,a,i){this.model=r,this._updateController(r,n,a,i)},t.prototype.updateTransform=function(r,n,a,i){W$(n),this._updateController(r,n,a,i)},t.prototype.updateVisual=function(r,n,a,i){this.updateTransform(r,n,a,i)},t.prototype.updateView=function(r,n,a,i){this._updateController(r,n,a,i)},t.prototype._updateController=function(r,n,a,i){(!i||i.$from!==r.id)&&this._brushController.setPanels(r.brushTargetManager.makePanelOpts(a)).enableBrush(r.brushOption).updateCovers(r.areas.slice())},t.prototype.dispose=function(){this._brushController.dispose()},t.prototype._onBrush=function(r){var n=this.model.id,a=this.model.brushTargetManager.setOutputRanges(r.areas,this.ecModel);(!r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:ke(a),$from:n}),r.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:n,areas:ke(a),$from:n})},t.type="brush",t}(Yt),fbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.areas=[],r.brushOption={},r}return t.prototype.optionUpdated=function(r,n){var a=this.option;!n&&U$(a,r,["inBrush","outOfBrush"]);var i=a.inBrush=a.inBrush||{};a.outOfBrush=a.outOfBrush||{color:this.option.defaultOutOfBrushColor},i.hasOwnProperty("liftZ")||(i.liftZ=5)},t.prototype.setAreas=function(r){r&&(this.areas=oe(r,function(n){return Vz(this.option,n)},this))},t.prototype.setBrushOption=function(r){this.brushOption=Vz(this.option,r),this.brushType=this.brushOption.brushType},t.type="brush",t.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],t.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:K.color.backgroundTint,borderColor:K.color.borderTint},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4,defaultOutOfBrushColor:K.color.disabled},t}(ht);function Vz(e,t){return Je({brushType:e.brushType,brushMode:e.brushMode,transformable:e.transformable,brushStyle:new vt(e.brushStyle).getItemStyle(),removeOnClick:e.removeOnClick,z:e.z},t,!0)}var vbe=["rect","polygon","lineX","lineY","keep","clear"],pbe=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a){var i,o,s;n.eachComponent({mainType:"brush"},function(l){i=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=i,this._brushMode=o,R(r.get("type",!0),function(l){r.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===i)?"emphasis":"normal")})},t.prototype.updateView=function(r,n,a){this.render(r,n,a)},t.prototype.getIcons=function(){var r=this.model,n=r.get("icon",!0),a={};return R(r.get("type",!0),function(i){n[i]&&(a[i]=n[i])}),a},t.prototype.onclick=function(r,n,a){var i=this._brushType,o=this._brushMode;a==="clear"?(n.dispatchAction({type:"axisAreaSelect",intervals:[]}),n.dispatchAction({type:"brush",command:"clear",areas:[]})):n.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:a==="keep"?i:i===a?!1:a,brushMode:a==="keep"?o==="multiple"?"single":"multiple":o}})},t.getDefaultOption=function(r){var n={show:!0,type:vbe.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:r.getLocaleModel().get(["toolbox","brush","title"])};return n},t}(Eo);function gbe(e){e.registerComponentView(dbe),e.registerComponentModel(fbe),e.registerPreprocessor(rbe),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,obe),e.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(t,r){r.eachComponent({mainType:"brush",query:t},function(n){n.setAreas(t.areas)})}),e.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},hr),e.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},hr),Rd("brush",pbe)}var mbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.layoutMode={type:"box",ignoreSize:!0},r}return t.type="title",t.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:"center",top:K.size.m,backgroundColor:K.color.transparent,borderColor:K.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:K.color.primary},subtextStyle:{fontSize:12,color:K.color.quaternary}},t}(ht),ybe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){if(this.group.removeAll(),!!r.get("show")){var i=this.group,o=r.getModel("textStyle"),s=r.getModel("subtextStyle"),l=r.get("textAlign"),u=Te(r.get("textBaseline"),r.get("textVerticalAlign")),c=new wt({style:$t(o,{text:r.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),h=c.getBoundingRect(),f=r.get("subtext"),v=new wt({style:$t(s,{text:f,fill:s.getTextColor(),y:h.height+r.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),g=r.get("link"),m=r.get("sublink"),y=r.get("triggerEvent",!0);c.silent=!g&&!y,v.silent=!m&&!y,g&&c.on("click",function(){Z_(g,"_"+r.get("target"))}),m&&v.on("click",function(){Z_(m,"_"+r.get("subtarget"))}),Be(c).eventData=Be(v).eventData=y?{componentType:"title",componentIndex:r.componentIndex}:null,i.add(c),f&&i.add(v);var x=i.getBoundingRect(),_=r.getBoxLayoutParams();_.width=x.width,_.height=x.height;var w=Ur(r,a),S=tr(_,w.refContainer,r.get("padding"));l||(l=r.get("left")||r.get("right"),l==="middle"&&(l="center"),l==="right"?S.x+=S.width:l==="center"&&(S.x+=S.width/2)),u||(u=r.get("top")||r.get("bottom"),u==="center"&&(u="middle"),u==="bottom"?S.y+=S.height:u==="middle"&&(S.y+=S.height/2),u=u||"top"),i.x=S.x,i.y=S.y,i.markRedraw();var C={align:l,verticalAlign:u};c.setStyle(C),v.setStyle(C),x=i.getBoundingRect();var M=S.margin,A=r.getItemStyle(["color","opacity"]);A.fill=r.get("backgroundColor");var I=new it({shape:{x:x.x-M[3],y:x.y-M[0],width:x.width+M[1]+M[3],height:x.height+M[0]+M[2],r:r.get("borderRadius")},style:A,subPixelOptimize:!0,silent:!0});i.add(I)}},t.type="title",t}(Yt);function xbe(e){e.registerComponentModel(mbe),e.registerComponentView(ybe)}var Gz=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.layoutMode="box",r}return t.prototype.init=function(r,n,a){this.mergeDefaultAndTheme(r,a),this._initData()},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),this._initData()},t.prototype.setCurrentIndex=function(r){r==null&&(r=this.option.currentIndex);var n=this._data.count();this.option.loop?r=(r%n+n)%n:(r>=n&&(r=n-1),r<0&&(r=0)),this.option.currentIndex=r},t.prototype.getCurrentIndex=function(){return this.option.currentIndex},t.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},t.prototype.setPlayState=function(r){this.option.autoPlay=!!r},t.prototype.getPlayState=function(){return!!this.option.autoPlay},t.prototype._initData=function(){var r=this.option,n=r.data||[],a=r.axisType,i=this._names=[],o;a==="category"?(o=[],R(n,function(u,c){var h=Fr(ov(u),""),f;Re(u)?(f=ke(u),f.value=c):f=c,o.push(f),i.push(h)})):o=n;var s={category:"ordinal",time:"time",value:"number"}[a]||"number",l=this._data=new Bn([{name:"value",type:s}],this);l.initData(o,i)},t.prototype.getData=function(){return this._data},t.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},t.type="timeline",t.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:K.size.m,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:K.color.secondary},data:[]},t}(ht),$$=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline.slider",t.defaultOption=Cu(Gz.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:K.color.border,borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:K.color.accent10},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:K.color.tertiary},itemStyle:{color:K.color.accent20,borderWidth:0},checkpointStyle:{symbol:"circle",symbolSize:15,color:K.color.accent50,borderColor:K.color.accent50,borderWidth:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"rgba(0, 0, 0, 0)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10.6699C11.5 9.90014 12.3333 9.41887 13 9.80371L20.5 14.1338C21.1667 14.5187 21.1667 15.4813 20.5 15.8662L13 20.1963C12.3333 20.5811 11.5 20.0999 11.5 19.3301V10.6699Z",stopIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10C12.3284 10 13 10.6716 13 11.5V18.5C13 19.3284 12.3284 20 11.5 20C10.6716 20 10 19.3284 10 18.5V11.5C10 10.6716 10.6716 10 11.5 10ZM18.5 10C19.3284 10 20 10.6716 20 11.5V18.5C20 19.3284 19.3284 20 18.5 20C17.6716 20 17 19.3284 17 18.5V11.5C17 10.6716 17.6716 10 18.5 10Z",nextIcon:"path://M0.838834 18.7383C0.253048 18.1525 0.253048 17.2028 0.838834 16.617L7.55635 9.89949L0.838834 3.18198C0.253048 2.59619 0.253048 1.64645 0.838834 1.06066C1.42462 0.474874 2.37437 0.474874 2.96015 1.06066L10.7383 8.83883L10.8412 8.95277C11.2897 9.50267 11.2897 10.2963 10.8412 10.8462L10.7383 10.9602L2.96015 18.7383C2.37437 19.3241 1.42462 19.3241 0.838834 18.7383Z",prevIcon:"path://M10.9602 1.06066C11.5459 1.64645 11.5459 2.59619 10.9602 3.18198L4.24264 9.89949L10.9602 16.617C11.5459 17.2028 11.5459 18.1525 10.9602 18.7383C10.3744 19.3241 9.42462 19.3241 8.83883 18.7383L1.06066 10.9602L0.957771 10.8462C0.509245 10.2963 0.509245 9.50267 0.957771 8.95277L1.06066 8.83883L8.83883 1.06066C9.42462 0.474874 10.3744 0.474874 10.9602 1.06066Z",prevBtnSize:18,nextBtnSize:18,color:K.color.accent50,borderColor:K.color.accent50,borderWidth:0},emphasis:{label:{show:!0,color:K.color.accent60},itemStyle:{color:K.color.accent60,borderColor:K.color.accent60},controlStyle:{color:K.color.accent70,borderColor:K.color.accent70}},progress:{lineStyle:{color:K.color.accent30},itemStyle:{color:K.color.accent40}},data:[]}),t}(Gz);kr($$,H1.prototype);var _be=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline",t}(Yt),bbe=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this,r,n,a)||this;return o.type=i||"value",o}return t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},t}(Si),D2=Math.PI,Hz=Qe(),wbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){this.api=n},t.prototype.render=function(r,n,a){if(this.model=r,this.api=a,this.ecModel=n,this.group.removeAll(),r.get("show",!0)){var i=this._layout(r,a),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(i,r);r.formatTooltip=function(u){var c=l.scale.getLabel({value:u});return Er("nameValue",{noName:!0,value:c})},R(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](i,o,l,r)},this),this._renderAxisLabel(i,s,l,r),this._position(i,r)}this._doPlayStop(),this._updateTicksStatus()},t.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},t.prototype.dispose=function(){this._clearTimer()},t.prototype._layout=function(r,n){var a=r.get(["label","position"]),i=r.get("orient"),o=Sbe(r,n),s;a==null||a==="auto"?s=i==="horizontal"?o.y+o.height/2=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:D2/2},h=i==="vertical"?o.height:o.width,f=r.getModel("controlStyle"),v=f.get("show",!0),g=v?f.get("itemSize"):0,m=v?f.get("itemGap"):0,y=g+m,x=r.get(["label","rotate"])||0;x=x*D2/180;var _,w,S,C=f.get("position",!0),M=v&&f.get("showPlayBtn",!0),A=v&&f.get("showPrevBtn",!0),I=v&&f.get("showNextBtn",!0),k=0,P=h;C==="left"||C==="bottom"?(M&&(_=[0,0],k+=y),A&&(w=[k,0],k+=y),I&&(S=[P-g,0],P-=y)):(M&&(_=[P-g,0],P-=y),A&&(w=[0,0],k+=y),I&&(S=[P-g,0],P-=y));var D=[k,P];return r.get("inverse")&&D.reverse(),{viewRect:o,mainLength:h,orient:i,rotation:c[i],labelRotation:x,labelPosOpt:s,labelAlign:r.get(["label","align"])||l[i],labelBaseline:r.get(["label","verticalAlign"])||r.get(["label","baseline"])||u[i],playPosition:_,prevBtnPosition:w,nextBtnPosition:S,axisExtent:D,controlSize:g,controlGap:m}},t.prototype._position=function(r,n){var a=this._mainGroup,i=this._labelGroup,o=r.viewRect;if(r.orient==="vertical"){var s=ar(),l=o.x,u=o.y+o.height;Hi(s,s,[-l,-u]),Js(s,s,-D2/2),Hi(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=_(o),h=_(a.getBoundingRect()),f=_(i.getBoundingRect()),v=[a.x,a.y],g=[i.x,i.y];g[0]=v[0]=c[0][0];var m=r.labelPosOpt;if(m==null||ve(m)){var y=m==="+"?0:1;w(v,h,c,1,y),w(g,f,c,1,1-y)}else{var y=m>=0?0:1;w(v,h,c,1,y),g[1]=v[1]+m}a.setPosition(v),i.setPosition(g),a.rotation=i.rotation=r.rotation,x(a),x(i);function x(S){S.originX=c[0][0]-S.x,S.originY=c[1][0]-S.y}function _(S){return[[S.x,S.x+S.width],[S.y,S.y+S.height]]}function w(S,C,M,A,I){S[A]+=M[A][I]-C[A][I]}},t.prototype._createAxis=function(r,n){var a=n.getData(),i=n.get("axisType")||n.get("type");i!=="category"&&i!=="time"&&(i="value");var o=Sv(n,i,!1);o.getTicks=function(){return a.mapArray(["value"],function(u){return{value:u}})};var s=a.getDataExtent("value");o.setExtent(s[0],s[1]),hW(o,{fixMinMax:[!0,!0]});var l=new bbe("value",o,r.axisExtent,i);return l.model=n,l},t.prototype._createGroup=function(r){var n=this[r]=new De;return this.group.add(n),n},t.prototype._renderAxisLine=function(r,n,a,i){var o=a.getExtent();if(i.get(["lineStyle","show"])){var s=new Tr({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:te({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});n.add(s);var l=this._progressLine=new Tr({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:Ee({lineCap:"round",lineWidth:s.style.lineWidth},i.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});n.add(l)}},t.prototype._renderAxisTick=function(r,n,a,i){var o=this,s=i.getData(),l=a.scale.getTicks();this._tickSymbols=[],R(l,function(u){var c=a.dataToCoord(u.value),h=s.getItemModel(u.value),f=h.getModel("itemStyle"),v=h.getModel(["emphasis","itemStyle"]),g=h.getModel(["progress","itemStyle"]),m={x:c,y:0,onclick:be(o._changeTimeline,o,u.value)},y=Uz(h,f,n,m);y.ensureState("emphasis").style=v.getItemStyle(),y.ensureState("progress").style=g.getItemStyle(),ql(y);var x=Be(y);h.get("tooltip")?(x.dataIndex=u.value,x.dataModel=i):x.dataIndex=x.dataModel=null,o._tickSymbols.push(y)})},t.prototype._renderAxisLabel=function(r,n,a,i){var o=this,s=a.getLabelModel();if(s.get("show")){var l=i.getData(),u=a.getViewLabels();this._tickLabels=[],R(u,function(c){if(!c.tick.offInterval){var h=c.tick.value,f=l.getItemModel(h),v=f.getModel("label"),g=f.getModel(["emphasis","label"]),m=f.getModel(["progress","label"]),y=a.dataToCoord(h),x=new wt({x:y,y:0,rotation:r.labelRotation-r.rotation,onclick:be(o._changeTimeline,o,h),silent:!1,style:$t(v,{text:c.formattedLabel,align:r.labelAlign,verticalAlign:r.labelBaseline})});x.ensureState("emphasis").style=$t(g),x.ensureState("progress").style=$t(m),n.add(x),ql(x),Hz(x).dataIndex=h,o._tickLabels.push(x)}})}},t.prototype._renderControl=function(r,n,a,i){var o=r.controlSize,s=r.rotation,l=i.getModel("controlStyle").getItemStyle(),u=i.getModel(["emphasis","controlStyle"]).getItemStyle(),c=i.getPlayState(),h=i.get("inverse",!0);f(r.nextBtnPosition,"next",be(this._changeTimeline,this,h?"-":"+")),f(r.prevBtnPosition,"prev",be(this._changeTimeline,this,h?"+":"-")),f(r.playPosition,c?"stop":"play",be(this._handlePlayClick,this,!c),!0);function f(v,g,m,y){if(v){var x=Bo(Te(i.get(["controlStyle",g+"BtnSize"]),o),o),_=[0,-x/2,x,x],w=Cbe(i,g+"Icon",_,{x:v[0],y:v[1],originX:o/2,originY:0,rotation:y?-s:0,rectHover:!0,style:l,onclick:m});w.ensureState("emphasis").style=u,n.add(w),ql(w)}}},t.prototype._renderCurrentPointer=function(r,n,a,i){var o=i.getData(),s=i.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,c={onCreate:function(h){h.draggable=!0,h.drift=be(u._handlePointerDrag,u),h.ondragend=be(u._handlePointerDragend,u),Wz(h,u._progressLine,s,a,i,!0)},onUpdate:function(h){Wz(h,u._progressLine,s,a,i)}};this._currentPointer=Uz(l,l,this._mainGroup,{},this._currentPointer,c)},t.prototype._handlePlayClick=function(r){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:r,from:this.uid})},t.prototype._handlePointerDrag=function(r,n,a){this._clearTimer(),this._pointerChangeTimeline([a.offsetX,a.offsetY])},t.prototype._handlePointerDragend=function(r){this._pointerChangeTimeline([r.offsetX,r.offsetY],!0)},t.prototype._pointerChangeTimeline=function(r,n){var a=this._toAxisCoord(r)[0],i=this._axis,o=on(i.getExtent().slice());a>o[1]&&(a=o[1]),a=0&&(s[o]=+s[o].toFixed(g)),[s,v]}var ax={min:nt(nx,"min"),max:nt(nx,"max"),average:nt(nx,"average"),median:nt(nx,"median")};function Am(e,t){if(t){var r=e.getData(),n=e.coordinateSystem,a=n&&n.dimensions;if(!Lbe(t)&&!ae(t.coord)&&ae(a)){var i=Z$(t,r,n,e);if(t=ke(t),t.type&&ax[t.type]&&i.baseAxis&&i.valueAxis){var o=Ye(a,i.baseAxis.dim),s=Ye(a,i.valueAxis.dim),l=ax[t.type](r,i.valueAxis.dim,i.baseDataDim,i.valueDataDim,o,s);t.coord=l[0],t.value=l[1]}else t.coord=[t.xAxis!=null?t.xAxis:t.radiusAxis,t.yAxis!=null?t.yAxis:t.angleAxis]}if(t.coord==null||!ae(a)){t.coord=[];var u=e.getBaseAxis();if(u&&t.type&&ax[t.type]){var c=n.getOtherAxis(u);c&&(t.value=zb(r,r.mapDimension(c.dim),t.type))}}else for(var h=t.coord,f=0;f<2;f++)ax[h[f]]&&(h[f]=zb(r,r.mapDimension(a[f]),h[f]));return t}}function Z$(e,t,r,n){var a={};return e.valueIndex!=null||e.valueDim!=null?(a.valueDataDim=e.valueIndex!=null?t.getDimension(e.valueIndex):e.valueDim,a.valueAxis=r.getAxis(Ibe(n,a.valueDataDim)),a.baseAxis=r.getOtherAxis(a.valueAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim)):(a.baseAxis=n.getBaseAxis(),a.valueAxis=r.getOtherAxis(a.baseAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim),a.valueDataDim=t.mapDimension(a.valueAxis.dim)),a}function Ibe(e,t){var r=e.getData().getDimensionInfo(t);return r&&r.coordDim}function Nm(e,t){return e&&e.containData&&t.coord&&!oN(t)?e.containData(t.coord):!0}function Pbe(e,t,r){return e&&e.containZone&&t.coord&&r.coord&&!oN(t)&&!oN(r)?e.containZone(t.coord,r.coord):!0}function Y$(e,t){return e?function(r,n,a,i){var o=i<2?r.coord&&r.coord[i]:r.value;return Kl(o,t[i])}:function(r,n,a,i){return Kl(r.value,t[i])}}function zb(e,t,r){if(r==="average"){var n=0,a=0;return e.each(t,function(i,o){isNaN(i)||(n+=i,a++)}),n/a}else return r==="median"?e.getMedian(t):e.getDataExtent(t)[r==="max"?1:0]}var j2=Qe(),yP=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(){this.markerGroupMap=we()},t.prototype.render=function(r,n,a){var i=this,o=this.markerGroupMap;o.each(function(s){j2(s).keep=!1}),n.eachSeries(function(s){var l=Zo.getMarkerModelFromSeries(s,i.type);l&&i.renderSeries(s,l,n,a)}),o.each(function(s){!j2(s).keep&&i.group.remove(s.group)}),Dbe(n,o,this.type)},t.prototype.markKeep=function(r){j2(r).keep=!0},t.prototype.toggleBlurSeries=function(r,n){var a=this;R(r,function(i){var o=Zo.getMarkerModelFromSeries(i,a.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(n?w7(l):Kk(l))})}})},t.type="marker",t}(Yt);function Dbe(e,t,r){e.eachSeries(function(n){var a=Zo.getMarkerModelFromSeries(n,r),i=t.get(n.id);if(a&&i&&i.group){var o=lh(a),s=o.z,l=o.zlevel;z1(i.group,s,l)}})}function Zz(e,t,r){var n=t.coordinateSystem,a=r.getWidth(),i=r.getHeight(),o=n&&n.getArea&&n.getArea();e.each(function(s){var l=e.getItemModel(s),u=l.get("relativeTo")==="coordinate",c=u?o?o.width:0:a,h=u?o?o.height:0:i,f=u&&o?o.x:0,v=u&&o?o.y:0,g,m=me(l.get("x"),c)+f,y=me(l.get("y"),h)+v;if(!isNaN(m)&&!isNaN(y))g=[m,y];else if(t.getMarkerPosition)g=t.getMarkerPosition(e.getValues(e.dimensions,s));else if(n){var x=e.get(n.dimensions[0],s),_=e.get(n.dimensions[1],s);g=n.dataToPoint([x,_])}isNaN(m)||(g[0]=m),isNaN(y)||(g[1]=y),e.setItemLayout(s,g)})}var jbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,a){n.eachSeries(function(i){var o=Zo.getMarkerModelFromSeries(i,"markPoint");o&&(Zz(o.getData(),i,a),this.markerGroupMap.get(i.id).updateLayout())},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new ty),h=Ebe(o,r,n);n.setData(h),Zz(n.getData(),r,i),h.each(function(f){var v=h.getItemModel(f),g=v.getShallow("symbol"),m=v.getShallow("symbolSize"),y=v.getShallow("symbolRotate"),x=v.getShallow("symbolOffset"),_=v.getShallow("symbolKeepAspect");if(Le(g)||Le(m)||Le(y)||Le(x)){var w=n.getRawValue(f),S=n.getDataParams(f);Le(g)&&(g=g(w,S)),Le(m)&&(m=m(w,S)),Le(y)&&(y=y(w,S)),Le(x)&&(x=x(w,S))}var C=v.getModel("itemStyle").getItemStyle(),M=v.get("z2"),A=Xm(l,"color");C.fill||(C.fill=A),h.setItemVisual(f,{z2:Te(M,0),symbol:g,symbolSize:m,symbolRotate:y,symbolOffset:x,symbolKeepAspect:_,style:C})}),c.updateData(h),this.group.add(c.group),h.eachItemGraphicEl(function(f){f.traverse(function(v){Be(v).dataModel=n})}),this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markPoint",t}(yP);function Ebe(e,t,r){var n;e?n=oe(e&&e.dimensions,function(s){var l=t.getData(),u=l.getDimensionInfo(l.mapDimension(s))||{};return te(te({},u),{name:s,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var a=new Bn(n,r),i=oe(r.get("data"),nt(Am,t));e&&(i=It(i,nt(Nm,e)));var o=Y$(!!e,n);return a.initData(i,null,o),a}function Rbe(e){e.registerComponentModel(kbe),e.registerComponentView(jbe),e.registerPreprocessor(function(t){mP(t.series,"markPoint")&&(t.markPoint=t.markPoint||{})})}var Obe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.createMarkerModelFromSeries=function(r,n,a){return new t(r,n,a)},t.type="markLine",t.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},t}(Zo),ix=Qe(),zbe=function(e,t,r,n){var a=e.getData(),i;if(ae(n))i=n;else{var o=n.type;if(o==="min"||o==="max"||o==="average"||o==="median"||n.xAxis!=null||n.yAxis!=null){var s=void 0,l=void 0;if(n.yAxis!=null||n.xAxis!=null)s=t.getAxis(n.yAxis!=null?"y":"x"),l=On(n.yAxis,n.xAxis);else{var u=Z$(n,a,t,e);s=u.valueAxis;var c=$L(a,u.valueDataDim);l=zb(a,c,o)}var h=s.dim==="x"?0:1,f=1-h,v=ke(n),g={coord:[]};v.type=null,v.coord=[],v.coord[f]=-1/0,g.coord[f]=1/0;var m=r.get("precision");m>=0&&Tt(l)&&(l=+l.toFixed(Math.min(m,20))),v.coord[h]=g.coord[h]=l,i=[v,g,{type:o,valueIndex:n.valueIndex,value:l}]}else i=[]}var y=[Am(e,i[0]),Am(e,i[1]),te({},i[2])];return y[2].type=y[2].type||null,Je(y[2],y[0]),Je(y[2],y[1]),y};function Bb(e){return!isNaN(e)&&!isFinite(e)}function Yz(e,t,r,n){var a=1-e,i=n.dimensions[e];return Bb(t[a])&&Bb(r[a])&&t[e]===r[e]&&n.getAxis(i).containData(t[e])}function Bbe(e,t){if(e.type==="cartesian2d"){var r=t[0].coord,n=t[1].coord;if(r&&n&&(Yz(1,r,n,e)||Yz(0,r,n,e)))return!0}return Nm(e,t[0])&&Nm(e,t[1])}function E2(e,t,r,n,a){var i=n.coordinateSystem,o=e.getItemModel(t),s,l=me(o.get("x"),a.getWidth()),u=me(o.get("y"),a.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition)s=n.getMarkerPosition(e.getValues(e.dimensions,t));else{var c=i.dimensions,h=e.get(c[0],t),f=e.get(c[1],t);s=i.dataToPoint([h,f])}if(ph(i,"cartesian2d")){var v=i.getAxis("x"),g=i.getAxis("y"),c=i.dimensions;Bb(e.get(c[0],t))?s[0]=v.toGlobalCoord(v.getExtent()[r?0:1]):Bb(e.get(c[1],t))&&(s[1]=g.toGlobalCoord(g.getExtent()[r?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}e.setItemLayout(t,s)}var Fbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,a){n.eachSeries(function(i){var o=Zo.getMarkerModelFromSeries(i,"markLine");if(o){var s=o.getData(),l=ix(o).from,u=ix(o).to;l.each(function(c){E2(l,c,!0,i,a),E2(u,c,!1,i,a)}),s.each(function(c){s.setItemLayout(c,[l.getItemLayout(c),u.getItemLayout(c)])}),this.markerGroupMap.get(i.id).updateLayout()}},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new RI);this.group.add(c.group);var h=Vbe(o,r,n),f=h.from,v=h.to,g=h.line;ix(n).from=f,ix(n).to=v,n.setData(g);var m=n.get("symbol"),y=n.get("symbolSize"),x=n.get("symbolRotate"),_=n.get("symbolOffset");ae(m)||(m=[m,m]),ae(y)||(y=[y,y]),ae(x)||(x=[x,x]),ae(_)||(_=[_,_]),h.from.each(function(S){w(f,S,!0),w(v,S,!1)}),g.each(function(S){var C=g.getItemModel(S),M=C.getModel("lineStyle").getLineStyle();g.setItemLayout(S,[f.getItemLayout(S),v.getItemLayout(S)]);var A=C.get("z2");M.stroke==null&&(M.stroke=f.getItemVisual(S,"style").fill),g.setItemVisual(S,{z2:Te(A,0),fromSymbolKeepAspect:f.getItemVisual(S,"symbolKeepAspect"),fromSymbolOffset:f.getItemVisual(S,"symbolOffset"),fromSymbolRotate:f.getItemVisual(S,"symbolRotate"),fromSymbolSize:f.getItemVisual(S,"symbolSize"),fromSymbol:f.getItemVisual(S,"symbol"),toSymbolKeepAspect:v.getItemVisual(S,"symbolKeepAspect"),toSymbolOffset:v.getItemVisual(S,"symbolOffset"),toSymbolRotate:v.getItemVisual(S,"symbolRotate"),toSymbolSize:v.getItemVisual(S,"symbolSize"),toSymbol:v.getItemVisual(S,"symbol"),style:M})}),c.updateData(g),h.line.eachItemGraphicEl(function(S){Be(S).dataModel=n,S.traverse(function(C){Be(C).dataModel=n})});function w(S,C,M){var A=S.getItemModel(C);E2(S,C,M,r,i);var I=A.getModel("itemStyle").getItemStyle();I.fill==null&&(I.fill=Xm(l,"color")),S.setItemVisual(C,{symbolKeepAspect:A.get("symbolKeepAspect"),symbolOffset:Te(A.get("symbolOffset",!0),_[M?0:1]),symbolRotate:Te(A.get("symbolRotate",!0),x[M?0:1]),symbolSize:Te(A.get("symbolSize"),y[M?0:1]),symbol:Te(A.get("symbol",!0),m[M?0:1]),style:I})}this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markLine",t}(yP);function Vbe(e,t,r){var n;e?n=oe(e&&e.dimensions,function(u){var c=t.getData(),h=c.getDimensionInfo(c.mapDimension(u))||{};return te(te({},h),{name:u,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var a=new Bn(n,r),i=new Bn(n,r),o=new Bn([],r),s=oe(r.get("data"),nt(zbe,t,e,r));e&&(s=It(s,nt(Bbe,e)));var l=Y$(!!e,n);return a.initData(oe(s,function(u){return u[0]}),null,l),i.initData(oe(s,function(u){return u[1]}),null,l),o.initData(oe(s,function(u){return u[2]})),o.hasItemOption=!0,{from:a,to:i,line:o}}function Gbe(e){e.registerComponentModel(Obe),e.registerComponentView(Fbe),e.registerPreprocessor(function(t){mP(t.series,"markLine")&&(t.markLine=t.markLine||{})})}var Hbe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.createMarkerModelFromSeries=function(r,n,a){return new t(r,n,a)},t.type="markArea",t.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},t}(Zo),ox=Qe(),Ube=function(e,t,r,n){var a=n[0],i=n[1];if(!(!a||!i)){var o=Am(e,a),s=Am(e,i),l=o.coord,u=s.coord;l[0]=On(l[0],-1/0),l[1]=On(l[1],-1/0),u[0]=On(u[0],1/0),u[1]=On(u[1],1/0);var c=y1([{},o,s]);return c.coord=[o.coord,s.coord],c.x0=o.x,c.y0=o.y,c.x1=s.x,c.y1=s.y,c}};function Fb(e){return!isNaN(e)&&!isFinite(e)}function Xz(e,t,r,n){var a=1-e;return Fb(t[a])&&Fb(r[a])}function Wbe(e,t){var r=t.coord[0],n=t.coord[1],a={coord:r,x:t.x0,y:t.y0},i={coord:n,x:t.x1,y:t.y1};return ph(e,"cartesian2d")?r&&n&&(Xz(1,r,n)||Xz(0,r,n))?!0:Pbe(e,a,i):Nm(e,a)||Nm(e,i)}function qz(e,t,r,n,a){var i=n.coordinateSystem,o=e.getItemModel(t),s,l=me(o.get(r[0]),a.getWidth()),u=me(o.get(r[1]),a.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition){var c=e.getValues(["x0","y0"],t),h=e.getValues(["x1","y1"],t),f=i.clampData(c),v=i.clampData(h),g=[];r[0]==="x0"?g[0]=f[0]>v[0]?h[0]:c[0]:g[0]=f[0]>v[0]?c[0]:h[0],r[1]==="y0"?g[1]=f[1]>v[1]?h[1]:c[1]:g[1]=f[1]>v[1]?c[1]:h[1],s=n.getMarkerPosition(g,r,!0)}else{var m=e.get(r[0],t),y=e.get(r[1],t),x=[m,y];i.clampData&&i.clampData(x,x),s=i.dataToPoint(x,!0)}if(ph(i,"cartesian2d")){var _=i.getAxis("x"),w=i.getAxis("y"),m=e.get(r[0],t),y=e.get(r[1],t);Fb(m)?s[0]=_.toGlobalCoord(_.getExtent()[r[0]==="x0"?0:1]):Fb(y)&&(s[1]=w.toGlobalCoord(w.getExtent()[r[1]==="y0"?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}return s}var Kz=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],$be=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,a){n.eachSeries(function(i){var o=Zo.getMarkerModelFromSeries(i,"markArea");if(o){var s=o.getData();s.each(function(l){var u=oe(Kz,function(h){return qz(s,l,h,i,a)});s.setItemLayout(l,u);var c=s.getItemGraphicEl(l);c.setShape("points",u)})}},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,{group:new De});this.group.add(c.group),this.markKeep(c);var h=Zbe(o,r,n);n.setData(h),h.each(function(f){var v=oe(Kz,function(P){return qz(h,f,P,r,i)}),g=o.getAxis("x").scale,m=o.getAxis("y").scale,y=g.getExtent(),x=m.getExtent(),_=[g.parse(h.get("x0",f)),g.parse(h.get("x1",f))],w=[m.parse(h.get("y0",f)),m.parse(h.get("y1",f))];on(_),on(w);var S=!(y[0]>_[1]||y[1]<_[0]||x[0]>w[1]||x[1]=0},t.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},t.type="legend.plain",t.dependencies=["series"],t.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",bottom:K.size.m,align:"auto",backgroundColor:K.color.transparent,borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:K.color.disabled,inactiveBorderColor:K.color.disabled,inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:K.color.disabled,inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:K.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:K.color.tertiary,borderWidth:1,borderColor:K.color.border},emphasis:{selectorLabel:{show:!0,color:K.color.quaternary}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(ht),Ad=nt,lN=R,sx=De,X$=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.newlineDisabled=!1,r}return t.prototype.init=function(){this.group.add(this._contentGroup=new sx),this.group.add(this._selectorGroup=new sx),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(r,n,a){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!r.get("show",!0)){var o=r.get("align"),s=r.get("orient");(!o||o==="auto")&&(o=r.get("left")==="right"&&s==="vertical"?"right":"left");var l=r.get("selector",!0),u=r.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,r,n,a,l,s,u);var c=Ur(r,a).refContainer,h=r.getBoxLayoutParams(),f=r.get("padding"),v=tr(h,c,f),g=this.layoutInner(r,o,v,i,l,u),m=tr(Ee({width:g.width,height:g.height},h),c,f);this.group.x=m.x-g.x,this.group.y=m.y-g.y,this.group.markRedraw(),this.group.add(this._backgroundEl=O$(g,r))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(r,n,a,i,o,s,l){var u=this.getContentGroup(),c=we(),h=n.get("selectedMode"),f=n.get("triggerEvent"),v=[];a.eachRawSeries(function(g){!g.get("legendHoverLink")&&v.push(g.id)}),lN(n.getData(),function(g,m){var y=this,x=g.get("name");if(!this.newlineDisabled&&(x===""||x===` +`)){var _=new sx;_.newline=!0,u.add(_);return}var w=a.getSeriesByName(x)[0];if(!c.get(x))if(w){var S=w.getData(),C=S.getVisual("legendLineStyle")||{},M=S.getVisual("legendIcon"),A=S.getVisual("style"),I=this._createItem(w,x,m,g,n,r,C,A,M,h,i);I.on("click",Ad(Jz,x,null,i,v)).on("mouseover",Ad(uN,w.name,null,i,v)).on("mouseout",Ad(cN,w.name,null,i,v)),a.ssr&&I.eachChild(function(k){var P=Be(k);P.seriesIndex=w.seriesIndex,P.dataIndex=m,P.ssrType="legend"}),f&&I.eachChild(function(k){y.packEventData(k,n,w,m,x)}),c.set(x,!0)}else a.eachRawSeries(function(k){var P=this;if(!c.get(x)&&k.legendVisualProvider){var D=k.legendVisualProvider;if(!D.containName(x))return;var z=D.indexOfName(x),j=D.getItemVisual(z,"style"),B=D.getItemVisual(z,"legendIcon"),H=zn(j.fill);H&&H[3]===0&&(H[3]=.2,j=te(te({},j),{fill:ui(H,"rgba")}));var V=this._createItem(k,x,m,g,n,r,{},j,B,h,i);V.on("click",Ad(Jz,null,x,i,v)).on("mouseover",Ad(uN,null,x,i,v)).on("mouseout",Ad(cN,null,x,i,v)),a.ssr&&V.eachChild(function(U){var F=Be(U);F.seriesIndex=k.seriesIndex,F.dataIndex=m,F.ssrType="legend"}),f&&V.eachChild(function(U){P.packEventData(U,n,k,m,x)}),c.set(x,!0)}},this)},this),o&&this._createSelector(o,n,i,s,l)},t.prototype.packEventData=function(r,n,a,i,o){var s={componentType:"legend",componentIndex:n.componentIndex,dataIndex:i,value:o,seriesIndex:a.seriesIndex};Be(r).eventData=s},t.prototype._createSelector=function(r,n,a,i,o){var s=this.getSelectorGroup();lN(r,function(u){var c=u.type,h=new wt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect",legendId:n.id})}});s.add(h);var f=n.getModel("selectorLabel"),v=n.getModel(["emphasis","selectorLabel"]);Jr(h,{normal:f,emphasis:v},{defaultText:u.title}),ql(h)})},t.prototype._createItem=function(r,n,a,i,o,s,l,u,c,h,f){var v=r.visualDrawType,g=o.get("itemWidth"),m=o.get("itemHeight"),y=o.isSelected(n),x=i.get("symbolRotate"),_=i.get("symbolKeepAspect"),w=i.get("icon");c=w||c||"roundRect";var S=qbe(c,i,l,u,v,y,f),C=new sx,M=i.getModel("textStyle");if(Le(r.getLegendIcon)&&(!w||w==="inherit"))C.add(r.getLegendIcon({itemWidth:g,itemHeight:m,icon:c,iconRotate:x,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:_}));else{var A=w==="inherit"&&r.getData().getVisual("symbol")?x==="inherit"?r.getData().getVisual("symbolRotate"):x:0;C.add(Kbe({itemWidth:g,itemHeight:m,icon:c,iconRotate:A,itemStyle:S.itemStyle,symbolKeepAspect:_}))}var I=s==="left"?g+5:-5,k=s,P=o.get("formatter"),D=n;ve(P)&&P?D=P.replace("{name}",n??""):Le(P)&&(D=P(n));var z=y?M.getTextColor():i.get("inactiveColor");C.add(new wt({style:$t(M,{text:D,x:I,y:m/2,fill:z,align:k,verticalAlign:"middle"},{inheritColor:z})}));var j=new it({shape:C.getBoundingRect(),style:{fill:"transparent"}}),B=i.getModel("tooltip");return B.get("show")&&el({el:j,componentModel:o,itemName:n,itemTooltipOption:B.option}),C.add(j),C.eachChild(function(H){H.silent=!0}),j.silent=!h,this.getContentGroup().add(C),ql(C),C.__legendDataIndex=a,C},t.prototype.layoutInner=function(r,n,a,i,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();Gc(r.get("orient"),l,r.get("itemGap"),a.width,a.height);var c=l.getBoundingRect(),h=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){Gc("horizontal",u,r.get("selectorItemGap",!0));var f=u.getBoundingRect(),v=[-f.x,-f.y],g=r.get("selectorButtonGap",!0),m=r.getOrient().index,y=m===0?"width":"height",x=m===0?"height":"width",_=m===0?"y":"x";s==="end"?v[m]+=c[y]+g:h[m]+=f[y]+g,v[1-m]+=c[x]/2-f[x]/2,u.x=v[0],u.y=v[1],l.x=h[0],l.y=h[1];var w={x:0,y:0};return w[y]=c[y]+g+f[y],w[x]=Math.max(c[x],f[x]),w[_]=Math.min(0,f[_]+v[1-m]),w}else return l.x=h[0],l.y=h[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type="legend.plain",t}(Yt);function qbe(e,t,r,n,a,i,o){function s(y,x){y.lineWidth==="auto"&&(y.lineWidth=x.lineWidth>0?2:0),lN(y,function(_,w){y[w]==="inherit"&&(y[w]=x[w])})}var l=t.getModel("itemStyle"),u=l.getItemStyle(),c=e.lastIndexOf("empty",0)===0?"fill":"stroke",h=l.getShallow("decal");u.decal=!h||h==="inherit"?n.decal:zf(h,o),u.fill==="inherit"&&(u.fill=n[a]),u.stroke==="inherit"&&(u.stroke=n[c]),u.opacity==="inherit"&&(u.opacity=(a==="fill"?n:r).opacity),s(u,n);var f=t.getModel("lineStyle"),v=f.getLineStyle();if(s(v,r),u.fill==="auto"&&(u.fill=n.fill),u.stroke==="auto"&&(u.stroke=n.fill),v.stroke==="auto"&&(v.stroke=n.fill),!i){var g=t.get("inactiveBorderWidth"),m=u[c];u.lineWidth=g==="auto"?n.lineWidth>0&&m?2:0:u.lineWidth,u.fill=t.get("inactiveColor"),u.stroke=t.get("inactiveBorderColor"),v.stroke=f.get("inactiveColor"),v.lineWidth=f.get("inactiveWidth")}return{itemStyle:u,lineStyle:v}}function Kbe(e){var t=e.icon||"roundRect",r=Ar(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return r.setStyle(e.itemStyle),r.rotation=(e.iconRotate||0)*Math.PI/180,r.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf("empty")>-1&&(r.style.stroke=r.style.fill,r.style.fill=K.color.neutral00,r.style.lineWidth=2),r}function Jz(e,t,r,n){cN(e,t,r,n),r.dispatchAction({type:"legendToggleSelect",name:e??t}),uN(e,t,r,n)}function uN(e,t,r,n){r.usingTHL()||r.dispatchAction({type:"highlight",seriesName:e,name:t,excludeSeriesId:n})}function cN(e,t,r,n){r.usingTHL()||r.dispatchAction({type:"downplay",seriesName:e,name:t,excludeSeriesId:n})}function Tp(e,t,r){var n=e==="allSelect"||e==="inverseSelect",a={},i=[];r.eachComponent({mainType:"legend",query:t},function(s){n?s[e]():s[e](t.name),Qz(s,a),i.push(s.componentIndex)});var o={};return r.eachComponent("legend",function(s){R(a,function(l,u){s[l?"select":"unSelect"](u)}),Qz(s,o)}),n?{selected:o,legendIndex:i}:{name:t.name,selected:o}}function Qz(e,t){var r=t||{};return R(e.getData(),function(n){var a=n.get("name");if(!(a===` +`||a==="")){var i=e.isSelected(a);Se(r,a)?r[a]=r[a]&&i:r[a]=i}}),r}function Jbe(e){e.registerAction("legendToggleSelect","legendselectchanged",nt(Tp,"toggleSelected")),e.registerAction("legendAllSelect","legendselectall",nt(Tp,"allSelect")),e.registerAction("legendInverseSelect","legendinverseselect",nt(Tp,"inverseSelect")),e.registerAction("legendSelect","legendselected",nt(Tp,"select")),e.registerAction("legendUnSelect","legendunselected",nt(Tp,"unSelect"))}var Qbe=Vm(e1e);function e1e(e){var t=e.findComponents({mainType:"legend"});t&&t.length&&e.filterSeries(function(r){for(var n=0;na[o],y=[-v.x,-v.y];n||(y[i]=c[u]);var x=[0,0],_=[-g.x,-g.y],w=Te(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(m){var S=r.get("pageButtonPosition",!0);S==="end"?_[i]+=a[o]-g[o]:x[i]+=g[o]+w}_[1-i]+=v[s]/2-g[s]/2,c.setPosition(y),h.setPosition(x),f.setPosition(_);var C={x:0,y:0};if(C[o]=m?a[o]:v[o],C[s]=Math.max(v[s],g[s]),C[l]=Math.min(0,g[l]+_[1-i]),h.__rectSize=a[o],m){var M={x:0,y:0};M[o]=Math.max(a[o]-g[o]-w,0),M[s]=C[s],h.setClipPath(new it({shape:M})),h.__rectSize=M[o]}else f.eachChild(function(I){I.attr({invisible:!0,silent:!0})});var A=this._getPageInfo(r);return A.pageIndex!=null&&At(c,{x:A.contentPosition[0],y:A.contentPosition[1]},m?r:null),this._updatePageInfoView(r,A),C},t.prototype._pageGo=function(r,n,a){var i=this._getPageInfo(n)[r];i!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:n.id})},t.prototype._updatePageInfoView=function(r,n){var a=this._controllerGroup;R(["pagePrev","pageNext"],function(c){var h=c+"DataIndex",f=n[h]!=null,v=a.childOfName(c);v&&(v.setStyle("fill",f?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),v.cursor=f?"pointer":"default")});var i=a.childOfName("pageText"),o=r.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,u=n.pageCount;i&&o&&i.setStyle("text",ve(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},t.prototype._getPageInfo=function(r){var n=r.get("scrollDataIndex",!0),a=this.getContentGroup(),i=this._containerGroup.__rectSize,o=r.getOrient().index,s=R2[o],l=O2[o],u=this._findTargetItemIndex(n),c=a.children(),h=c[u],f=c.length,v=f?1:0,g={contentPosition:[a.x,a.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return g;var m=S(h);g.contentPosition[o]=-m.s;for(var y=u+1,x=m,_=m,w=null;y<=f;++y)w=S(c[y]),(!w&&_.e>x.s+i||w&&!C(w,x.s))&&(_.i>x.i?x=_:x=w,x&&(g.pageNextDataIndex==null&&(g.pageNextDataIndex=x.i),++g.pageCount)),_=w;for(var y=u-1,x=m,_=m,w=null;y>=-1;--y)w=S(c[y]),(!w||!C(_,w.s))&&x.i<_.i&&(_=x,g.pagePrevDataIndex==null&&(g.pagePrevDataIndex=x.i),++g.pageCount,++g.pageIndex),x=w;return g;function S(M){if(M){var A=M.getBoundingRect(),I=A[l]+M[l];return{s:I,e:I+A[s],i:M.__legendDataIndex}}}function C(M,A){return M.e>=A&&M.s<=A+i}},t.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var n,a=this.getContentGroup(),i;return a.eachChild(function(o,s){var l=o.__legendDataIndex;i==null&&l!=null&&(i=s),l===r&&(n=s)}),n??i},t.type="legend.scroll",t}(X$);function n1e(e){e.registerAction("legendScroll","legendscroll",function(t,r){var n=t.scrollDataIndex;n!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:t},function(a){a.setScrollDataIndex(n)})})}function a1e(e){rt(q$),e.registerComponentModel(t1e),e.registerComponentView(r1e),n1e(e)}function i1e(e){rt(q$),rt(a1e)}var o1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.inside",t.defaultOption=Cu(Mm.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(Mm),xP=Qe();function s1e(e,t,r){xP(e).coordSysRecordMap.each(function(n){var a=n.dataZoomInfoMap.get(t.uid);a&&(a.getRange=r)})}function l1e(e,t){for(var r=xP(e).coordSysRecordMap,n=r.keys(),a=0;ai[a+n]&&(n=h),o=o&&c.get("preventDefaultMouseMove",!0),s=Te(c.get("cursorGrab",!0),s),l=Te(c.get("cursorGrabbing",!0),l)}),{controlType:n,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:r,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint},cursorGrab:s,cursorGrabbing:l}}}function f1e(e){e.registerUpdateLifecycle("coordsys:aftercreate",function(t,r){var n=xP(r),a=n.coordSysRecordMap||(n.coordSysRecordMap=we());a.each(function(i){i.dataZoomInfoMap=null}),t.eachComponent({mainType:"dataZoom",subType:"inside"},function(i){var o=P$(i);R(o.infoList,function(s){var l=s.model.uid,u=a.get(l)||a.set(l,u1e(r,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=we());c.set(i.uid,{dzReferCoordSysInfo:s,model:i,getRange:null})})}),a.each(function(i){var o=i.controller,s,l=i.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){K$(a,i);return}var c=d1e(l,i,r);o.enable(c.controlType,c.opt),xv(i,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var v1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type="dataZoom.inside",r}return t.prototype.render=function(r,n,a){if(e.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),s1e(a,r,{pan:be(z2.pan,this),zoom:be(z2.zoom,this),scrollMove:be(z2.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){l1e(this.api,this.dataZoomModel),this.range=null},t.type="dataZoom.inside",t}(hP),z2={zoom:function(e,t,r,n){var a=this.range,i=a.slice(),o=e.axisModels[0];if(o){var s=B2[t](null,[n.originX,n.originY],o,r,e),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(i[1]-i[0])+i[0],u=Math.max(1/n.scale,0);i[0]=(i[0]-l)*u+l,i[1]=(i[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(uu(0,i,[0,100],0,c.minSpan,c.maxSpan),this.range=i,a[0]!==i[0]||a[1]!==i[1])return i}},pan:rB(function(e,t,r,n,a,i){var o=B2[n]([i.oldX,i.oldY],[i.newX,i.newY],t,a,r);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:rB(function(e,t,r,n,a,i){var o=B2[n]([0,0],[i.scrollDelta,i.scrollDelta],t,a,r);return o.signal*(e[1]-e[0])*i.scrollDelta})};function rB(e){return function(t,r,n,a){var i=this.range,o=i.slice(),s=t.axisModels[0];if(s){var l=e(o,s,t,r,n,a);if(uu(l,o,[0,100],"all"),this.range=o,i[0]!==o[0]||i[1]!==o[1])return o}}}var B2={grid:function(e,t,r,n,a){var i=r.axis,o={},s=a.model.coordinateSystem.getRect();return e=e||[0,0],i.dim==="x"?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=i.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=i.inverse?-1:1),o},polar:function(e,t,r,n,a){var i=r.axis,o={},s=a.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),r.mainType==="radiusAxis"?(o.pixel=t[0]-e[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=i.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=i.inverse?-1:1),o},singleAxis:function(e,t,r,n,a){var i=r.axis,o=a.model.coordinateSystem.getRect(),s={};return e=e||[0,0],i.orient==="horizontal"?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=i.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=i.inverse?-1:1),s}};function J$(e){dP(e),e.registerComponentModel(o1e),e.registerComponentView(v1e),f1e(e)}var p1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=Cu(Mm.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:K.color.accent10,borderRadius:0,backgroundColor:K.color.transparent,dataBackground:{lineStyle:{color:K.color.accent30,width:.5},areaStyle:{color:K.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:K.color.accent40,width:.5},areaStyle:{color:K.color.accent20,opacity:.3}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:K.color.neutral00,borderColor:K.color.accent20},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:K.color.accent40,opacity:.5},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:K.color.tertiary},brushSelect:!0,brushStyle:{color:K.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:K.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(Mm),Mp=it,g1e=1,F2=30,m1e=7,Ap="horizontal",nB="vertical",y1e=5,x1e=["line","bar","candlestick","scatter"],_1e={easing:"cubicOut",duration:100,delay:0},b1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._displayables={},r}return t.prototype.init=function(r,n){this.api=n,this._onBrush=be(this._onBrush,this),this._onBrushEnd=be(this._onBrushEnd,this)},t.prototype.render=function(r,n,a,i){if(e.prototype.render.apply(this,arguments),xv(this,"_dispatchZoomAction",r.get("throttle"),"fixRate"),this._orient=r.getOrient(),r.get("show")===!1){this.group.removeAll();return}if(r.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!=="dataZoom"||i.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){rm(this,"_dispatchZoomAction");var r=this.api.getZr();r.off("mousemove",this._onBrush),r.off("mouseup",this._onBrushEnd)},t.prototype._buildView=function(){var r=this.group;r.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var n=this._displayables.sliderGroup=new De;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),r.add(n),this._positionGroup()},t.prototype._resetLocation=function(){var r=this.dataZoomModel,n=this.api,a=r.get("brushSelect"),i=a?m1e:0,o=Ur(r,n).refContainer,s=this._findCoordRect(),l=r.get("defaultLocationEdgeGap",!0)||0,u=this._orient===Ap?{right:o.width-s.x-s.width,top:o.height-F2-l-i,width:s.width,height:F2}:{right:l,top:s.y,width:F2,height:s.height},c=zh(r.option);R(["right","top","width","height"],function(f){c[f]==="ph"&&(c[f]=u[f])});var h=tr(c,o);this._location={x:h.x,y:h.y},this._size=[h.width,h.height],this._orient===nB&&this._size.reverse()},t.prototype._positionGroup=function(){var r=this.group,n=this._location,a=this._orient,i=this.dataZoomModel.getFirstTargetAxisModel(),o=i&&i.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(a===Ap&&!o?{scaleY:l?1:-1,scaleX:1}:a===Ap&&o?{scaleY:l?1:-1,scaleX:-1}:a===nB&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=r.getBoundingRect([s]),c=isNaN(u.x)?0:u.x,h=isNaN(u.y)?0:u.y;r.x=n.x-c,r.y=n.y-h,r.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var r=this.dataZoomModel,n=this._size,a=this._displayables.sliderGroup,i=r.get("brushSelect");a.add(new Mp({silent:!0,shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:r.get("backgroundColor")},z2:-40}));var o=new Mp({shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:"transparent"},z2:0,onclick:be(this._onClickPanel,this)}),s=this.api.getZr();i?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),a.add(o)},t.prototype._renderDataShadow=function(){var r=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!r)return;var n=this._size,a=this._shadowSize||[],i=r.series,o=i.getRawData(),s=i.getShadowDim&&i.getShadowDim(),l=s&&o.getDimensionInfo(s)?i.getShadowDim():r.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||n[0]!==a[0]||n[1]!==a[1]){var h=o.getDataExtent(r.thisDim),f=o.getDataExtent(l),v=(f[1]-f[0])*.3;f=[f[0]-v,f[1]+v];var g=[0,n[1]],m=[0,n[0]],y=[[n[0],0],[0,0]],x=[],_=m[1]/Math.max(1,o.count()-1),w=n[0]/(h[1]-h[0]),S=r.thisAxis.type==="time",C=-_,M=Math.round(o.count()/n[0]),A;o.each([r.thisDim,l],function(z,j,B){if(M>0&&B%M){S||(C+=_);return}C=S?(+z-h[0])*w:C+_;var H=j==null||isNaN(j)||j==="",V=H?0:Nt(j,f,g,!0);H&&!A&&B?(y.push([y[y.length-1][0],0]),x.push([x[x.length-1][0],0])):!H&&A&&(y.push([C,0]),x.push([C,0])),H||(y.push([C,V]),x.push([C,V])),A=H}),u=this._shadowPolygonPts=y,c=this._shadowPolylinePts=x}this._shadowData=o,this._shadowDim=l,this._shadowSize=[n[0],n[1]];var I=this.dataZoomModel;function k(z){var j=I.getModel(z?"selectedDataBackground":"dataBackground"),B=new De,H=new Sn({shape:{points:u},segmentIgnoreThreshold:1,style:j.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),V=new un({shape:{points:c},segmentIgnoreThreshold:1,style:j.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return B.add(H),B.add(V),B}for(var P=0;P<3;P++){var D=k(P===1);this._displayables.sliderGroup.add(D),this._displayables.dataShadowSegs.push(D)}},t.prototype._prepareDataShadowInfo=function(){var r=this.dataZoomModel,n=r.get("showDataShadow");if(n!==!1){var a,i=this.ecModel;return r.eachTargetAxis(function(o,s){var l=r.getAxisProxy(o,s).getTargetSeriesModels();R(l,function(u){if(!a&&!(n!==!0&&Ye(x1e,u.get("type"))<0)){var c=i.getComponent(Rl(o),s).axis,h=w1e(o),f,v=u.coordinateSystem;h!=null&&v.getOtherAxis&&(f=v.getOtherAxis(c).inverse),h=u.getData().mapDimension(h);var g=u.getData().mapDimension(o);a={thisAxis:c,series:u,thisDim:g,otherDim:h,otherAxisInverse:f}}},this)},this),a}},t.prototype._renderHandle=function(){var r=this.group,n=this._displayables,a=n.handles=[null,null],i=n.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,c=l.get("borderRadius")||0,h=l.get("brushSelect"),f=n.filler=new Mp({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(f),o.add(new Mp({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:c},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:g1e,fill:K.color.transparent}})),R([0,1],function(w){var S=l.get("handleIcon");!q_[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var C=Ar(S,-1,0,2,2,null,!0);C.attr({cursor:S1e(this._orient),draggable:!0,drift:be(this._onDragMove,this,w),ondragend:be(this._onDragEnd,this),onmouseover:be(this._onOverDataInfoTriggerArea,this,!0),onmouseout:be(this._onOverDataInfoTriggerArea,this,!1),z2:5});var M=C.getBoundingRect(),A=l.get("handleSize");this._handleHeight=me(A,this._size[1]),this._handleWidth=M.width/M.height*this._handleHeight,C.setStyle(l.getModel("handleStyle").getItemStyle()),C.style.strokeNoScale=!0,C.rectHover=!0,C.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),ql(C);var I=l.get("handleColor");I!=null&&(C.style.fill=I),o.add(a[w]=C);var k=l.getModel("textStyle"),P=l.get("handleLabel")||{},D=P.show||!1;r.add(i[w]=new wt({silent:!0,invisible:!D,style:$t(k,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:k.getTextColor(),font:k.getFont()}),z2:10}))},this);var v=f;if(h){var g=me(l.get("moveHandleSize"),s[1]),m=n.moveHandle=new it({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:g}}),y=g*.8,x=n.moveHandleIcon=Ar(l.get("moveHandleIcon"),-y/2,-y/2,y,y,K.color.neutral00,!0);x.silent=!0,x.y=s[1]+g/2-.5,m.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var _=Math.min(s[1]/2,Math.max(g,10));v=n.moveZone=new it({invisible:!0,shape:{y:s[1]-_,height:g+_}}),v.on("mouseover",function(){u.enterEmphasis(m)}).on("mouseout",function(){u.leaveEmphasis(m)}),o.add(m),o.add(x),o.add(v)}v.attr({draggable:!0,cursor:"grab",drift:be(this._onActualMoveZoneDrift,this),ondragstart:be(this._onActualMoveZoneDragStart,this),ondragend:be(this._onActualMoveZoneDragEnd,this),onmouseover:be(this._onOverDataInfoTriggerArea,this,!0),onmouseout:be(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var r=this._range=this.dataZoomModel.getPercentRange(),n=this._getViewExtent();this._handleEnds=[Nt(r[0],[0,100],n,!0),Nt(r[1],[0,100],n,!0)]},t.prototype._updateInterval=function(r,n){var a=this.dataZoomModel,i=this._handleEnds,o=this._getViewExtent(),s=a.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];uu(n,i,o,a.get("zoomLock")?"all":r,s.minSpan!=null?Nt(s.minSpan,l,o,!0):null,s.maxSpan!=null?Nt(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=on([Nt(i[0],o,l,!0),Nt(i[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},t.prototype._updateView=function(r){var n=this._displayables,a=this._handleEnds,i=on(a.slice()),o=this._size;R([0,1],function(v){var g=n.handles[v],m=this._handleHeight;g.attr({scaleX:m/2,scaleY:m/2,x:a[v]+(v?-1:1),y:o[1]/2-m/2})},this),n.filler.setShape({x:i[0],y:0,width:i[1]-i[0],height:o[1]});var s={x:i[0],width:i[1]-i[0]};n.moveHandle&&(n.moveHandle.setShape(s),n.moveZone.setShape(s),n.moveZone.getBoundingRect(),n.moveHandleIcon&&n.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=n.dataShadowSegs,u=[0,i[0],i[1],o[0]],c=0;cn[0]||a[1]<0||a[1]>n[1])){var i=this._handleEnds,o=(i[0]+i[1])/2,s=this._updateInterval("all",a[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(r){var n=r.offsetX,a=r.offsetY;this._brushStart=new Oe(n,a),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(r){if(this._brushing){var n=this._displayables.brushRect;if(this._brushing=!1,!!n){n.attr("ignore",!0);var a=n.shape,i=+new Date;if(!(i-this._brushStartTime<200&&Math.abs(a.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[a.x,a.x+a.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();uu(0,l,o,0,u.minSpan!=null?Nt(u.minSpan,s,o,!0):null,u.maxSpan!=null?Nt(u.maxSpan,s,o,!0):null),this._range=on([Nt(l[0],o,s,!0),Nt(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(r){this._brushing&&(Vs(r.event),this._updateBrushRect(r.offsetX,r.offsetY))},t.prototype._updateBrushRect=function(r,n){var a=this._displayables,i=this.dataZoomModel,o=a.brushRect;o||(o=a.brushRect=new Mp({silent:!0,style:i.getModel("brushStyle").getItemStyle()}),a.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(r,n),c=l.transformCoordToLocal(s.x,s.y),h=this._size;u[0]=Math.max(Math.min(h[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:h[1]})},t.prototype._dispatchZoomAction=function(r){var n=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:r?_1e:null,start:n[0],end:n[1]})},t.prototype._findCoordRect=function(){var r,n=P$(this.dataZoomModel).infoList;if(!r&&n.length){var a=n[0].model.coordinateSystem;r=a.getRect&&a.getRect()}if(!r){var i=this.api.getWidth(),o=this.api.getHeight();r={x:i*.2,y:o*.2,width:i*.6,height:o*.6}}return r},t.type="dataZoom.slider",t}(hP);function aB(e,t,r,n){var a=e.get("labelFormatter"),i=e.get("labelPrecision");(i==null||i==="auto")&&(i=r.valuePrecision);var o=r.value[t],s=o==null||isNaN(o)?"":Vn(n)||qm(n)?n.getLabel({value:Math.round(o)}):isFinite(i)?Mt(o,i,!0):o+"";return Le(a)?a(o,s):ve(a)?a.replace("{value}",s):s}function w1e(e){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[e]}function S1e(e){return e==="vertical"?"ns-resize":"ew-resize"}function Q$(e){e.registerComponentModel(p1e),e.registerComponentView(b1e),dP(e)}function C1e(e){rt(J$),rt(Q$)}var eZ={get:function(e,t,r){var n=ke((T1e[e]||{})[t]);return r&&ae(n)?n[n.length-1]:n}},T1e={color:{active:["#006edd","#e0ffff"],inactive:[K.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},iB=Kr.mapVisual,M1e=Kr.eachVisual,A1e=ae,V2=R,N1e=on,k1e=Nt,Vb=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.stateList=["inRange","outOfRange"],r.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],r.layoutMode={type:"box",ignoreSize:!0},r.dataBound=[-1/0,1/0],r.targetVisuals={},r.controllerVisuals={},r}return t.prototype.init=function(r,n,a){this.mergeDefaultAndTheme(r,a)},t.prototype.optionUpdated=function(r,n){var a=this.option;!n&&U$(a,r,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(r){var n=this.stateList;r=be(r,this),this.controllerVisuals=aN(this.option.controller,n,r),this.targetVisuals=aN(this.option.target,n,r)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var r=this,n=this.option.seriesTargets;if(n){var a=[];return V2(n,function(l){if(l.seriesIndex!=null)a.push(l.seriesIndex);else if(l.seriesId!=null){var u;r.ecModel.eachSeries(function(c){c.id===l.seriesId&&(u=c)}),u&&a.push(u.componentIndex)}}),a}var i=this.option.seriesId,o=this.option.seriesIndex;o==null&&i==null&&(o="all");var s=sv(this.ecModel,"series",{index:o,id:i},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return oe(s,function(l){return l.componentIndex})},t.prototype.eachTargetSeries=function(r,n){R(this.getTargetSeriesIndices(),function(a){var i=this.ecModel.getSeriesByIndex(a);i&&r.call(n,i)},this)},t.prototype.isTargetSeries=function(r){var n=!1;return this.eachTargetSeries(function(a){a===r&&(n=!0)}),n},t.prototype.formatValueText=function(r,n,a){var i=this.option,o=i.precision,s=this.dataBound,l=i.formatter,u;a=a||["<",">"],ae(r)&&(r=r.slice(),u=!0);var c=n?r:u?[h(r[0]),h(r[1])]:h(r);if(ve(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(Le(l))return u?l(r[0],r[1]):l(r);if(u)return r[0]===s[0]?a[0]+" "+c[1]:r[1]===s[1]?a[1]+" "+c[0]:c[0]+" - "+c[1];return c;function h(f){return f===s[0]?"min":f===s[1]?"max":(+f).toFixed(Math.min(o,20))}},t.prototype.resetExtent=function(){var r=this.option,n=N1e([r.min,r.max]);this._dataExtent=n},t.prototype.getDimension=function(r){var n=this,a=this.option.seriesTargets;if(a){var i=Ks(a,function(o){return o.seriesIndex!=null&&o.seriesIndex===r||o.seriesId!=null&&o.seriesId===n.ecModel.getSeriesByIndex(r).id});if(i)return i.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(r){var n=r.hostModel.seriesIndex,a=this.getDimension(n);if(a!=null)return r.getDimensionIndex(a);for(var i=r.dimensions,o=i.length-1;o>=0;o--){var s=i[o],l=r.getDimensionInfo(s);if(!l.isCalculationCoord)return l.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var r=this.ecModel,n=this.option,a={inRange:n.inRange,outOfRange:n.outOfRange},i=n.target||(n.target={}),o=n.controller||(n.controller={});Je(i,a),Je(o,a);var s=this.isCategory();l.call(this,i),l.call(this,o),u.call(this,i,"inRange","outOfRange"),c.call(this,o);function l(h){A1e(n.color)&&!h.inRange&&(h.inRange={color:n.color.slice().reverse()}),h.inRange=h.inRange||{color:r.get("gradientColor")}}function u(h,f,v){var g=h[f],m=h[v];g&&!m&&(m=h[v]={},V2(g,function(y,x){if(Kr.isValidType(x)){var _=eZ.get(x,"inactive",s);_!=null&&(m[x]=_,x==="color"&&!m.hasOwnProperty("opacity")&&!m.hasOwnProperty("colorAlpha")&&(m.opacity=[0,0]))}}))}function c(h){var f=(h.inRange||{}).symbol||(h.outOfRange||{}).symbol,v=(h.inRange||{}).symbolSize||(h.outOfRange||{}).symbolSize,g=this.get("inactiveColor"),m=this.getItemSymbol(),y=m||"roundRect";V2(this.stateList,function(x){var _=this.itemSize,w=h[x];w||(w=h[x]={color:s?g:[g]}),w.symbol==null&&(w.symbol=f&&ke(f)||(s?y:[y])),w.symbolSize==null&&(w.symbolSize=v&&ke(v)||(s?_[0]:[_[0],_[0]])),w.symbol=iB(w.symbol,function(M){return M==="none"?y:M});var S=w.symbolSize;if(S!=null){var C=-1/0;M1e(S,function(M){M>C&&(C=M)}),w.symbolSize=iB(S,function(M){return k1e(M,[0,C],[0,_[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(r){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(r){return null},t.prototype.getVisualMeta=function(r){return null},t.type="visualMap",t.dependencies=["series"],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:K.color.transparent,borderColor:K.color.borderTint,contentColor:K.color.theme[0],inactiveColor:K.color.disabled,borderWidth:0,padding:K.size.m,textGap:10,precision:0,textStyle:{color:K.color.secondary}},t}(ht),oB=[20,140],L1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(a){a.mappingMethod="linear",a.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var r=this.itemSize;(r[0]==null||isNaN(r[0]))&&(r[0]=oB[0]),(r[1]==null||isNaN(r[1]))&&(r[1]=oB[1])},t.prototype._resetRange=function(){var r=this.getExtent(),n=this.option.range;!n||n.auto?(r.auto=1,this.option.range=r):ae(n)&&(n[0]>n[1]&&n.reverse(),n[0]=Math.max(n[0],r[0]),n[1]=Math.min(n[1],r[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),R(this.stateList,function(r){var n=this.option.controller[r].symbolSize;n&&n[0]!==n[1]&&(n[0]=n[1]/3)},this)},t.prototype.setSelected=function(r){this.option.range=r.slice(),this._resetRange()},t.prototype.getSelected=function(){var r=this.getExtent(),n=on((this.get("range")||[]).slice());return n[0]>r[1]&&(n[0]=r[1]),n[1]>r[1]&&(n[1]=r[1]),n[0]=a[1]||r<=n[1])?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[];return this.eachTargetSeries(function(a){var i=[],o=a.getData();o.each(this.getDataDimensionIndex(o),function(s,l){r[0]<=s&&s<=r[1]&&i.push(l)},this),n.push({seriesId:a.id,dataIndex:i})},this),n},t.prototype.getVisualMeta=function(r){var n=sB(this,"outOfRange",this.getExtent()),a=sB(this,"inRange",this.option.range.slice()),i=[];function o(v,g){i.push({value:v,color:r(v,g)})}for(var s=0,l=0,u=a.length,c=n.length;lr[1])break;i.push({color:this.getControllerVisual(l,"color",n),offset:s/a})}return i.push({color:this.getControllerVisual(r[1],"color",n),offset:1}),i},t.prototype._createBarPoints=function(r,n){var a=this.visualMapModel.itemSize;return[[a[0]-n[0],r[0]],[a[0],r[0]],[a[0],r[1]],[a[0]-n[1],r[1]]]},t.prototype._createBarGroup=function(r){var n=this._orient,a=this.visualMapModel.get("inverse");return new De(n==="horizontal"&&!a?{scaleX:r==="bottom"?1:-1,rotation:Math.PI/2}:n==="horizontal"&&a?{scaleX:r==="bottom"?-1:1,rotation:-Math.PI/2}:n==="vertical"&&!a?{scaleX:r==="left"?1:-1,scaleY:-1}:{scaleX:r==="left"?1:-1})},t.prototype._updateHandle=function(r,n){if(this._useHandle){var a=this._shapes,i=this.visualMapModel,o=a.handleThumbs,s=a.handleLabels,l=i.itemSize,u=i.getExtent(),c=this._applyTransform("left",a.mainGroup);I1e([0,1],function(h){var f=o[h];f.setStyle("fill",n.handlesColor[h]),f.y=r[h];var v=vo(r[h],[0,l[1]],u,!0),g=this.getControllerVisual(v,"symbolSize");f.scaleX=f.scaleY=g/l[0],f.x=l[0]-g/2;var m=Fi(a.handleLabelPoints[h],Vc(f,this.group));if(this._orient==="horizontal"){var y=c==="left"||c==="top"?(l[0]-g)/2:(l[0]-g)/-2;m[1]+=y}s[h].setStyle({x:m[0],y:m[1],text:i.formatValueText(this._dataInterval[h]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",a.mainGroup):"center"})},this)}},t.prototype._showIndicator=function(r,n,a,i){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],c=this._shapes,h=c.indicator;if(h){h.attr("invisible",!1);var f={convertOpacityToAlpha:!0},v=this.getControllerVisual(r,"color",f),g=this.getControllerVisual(r,"symbolSize"),m=vo(r,s,u,!0),y=l[0]-g/2,x={x:h.x,y:h.y};h.y=m,h.x=y;var _=Fi(c.indicatorLabelPoint,Vc(h,this.group)),w=c.indicatorLabel;w.attr("invisible",!1);var S=this._applyTransform("left",c.mainGroup),C=this._orient,M=C==="horizontal";w.setStyle({text:(a||"")+o.formatValueText(n),verticalAlign:M?S:"middle",align:M?"center":S});var A={x:y,y:m,style:{fill:v}},I={style:{x:_[0],y:_[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var k={duration:100,easing:"cubicInOut",additive:!0};h.x=x.x,h.y=x.y,h.animateTo(A,k),w.animateTo(I,k)}else h.attr(A),w.attr(I);this._firstShowIndicator=!1;var P=this._shapes.handleLabels;if(P)for(var D=0;Do[1]&&(h[1]=1/0),n&&(h[0]===-1/0?this._showIndicator(c,h[1],"< ",l):h[1]===1/0?this._showIndicator(c,h[0],"> ",l):this._showIndicator(c,c,"≈ ",l));var f=this._hoverLinkDataIndices,v=[];(n||hB(a))&&(v=this._hoverLinkDataIndices=a.findTargetDataIndices(h));var g=Rte(f,v);this._dispatchHighDown("downplay",Kx(g[0],a)),this._dispatchHighDown("highlight",Kx(g[1],a))}},t.prototype._hoverLinkFromSeriesMouseOver=function(r){var n;if(Dc(r.target,function(l){var u=Be(l);if(u.dataIndex!=null)return n=u,!0},!0),!!n){var a=this.ecModel.getSeriesByIndex(n.seriesIndex),i=this.visualMapModel;if(i.isTargetSeries(a)){var o=a.getData(n.dataType),s=o.getStore().get(i.getDataDimensionIndex(o),n.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},t.prototype._hideIndicator=function(){var r=this._shapes;r.indicator&&r.indicator.attr("invisible",!0),r.indicatorLabel&&r.indicatorLabel.attr("invisible",!0);var n=this._shapes.handleLabels;if(n)for(var a=0;a=0&&(i.dimension=o,n.push(i))}}),e.getData().setVisual("visualMeta",n)}}];function B1e(e,t,r,n){for(var a=t.targetVisuals[n],i=Kr.prepareVisualTypes(a),o={color:Xm(e.getData(),"color")},s=0,l=i.length;s0:t.splitNumber>0)||t.calculable)?"continuous":"piecewise"}),e.registerAction(R1e,O1e),R(z1e,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(F1e))}function aZ(e){e.registerComponentModel(L1e),e.registerComponentView(j1e),nZ(e)}var V1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._pieceList=[],r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var a=this._mode=this._determineMode();this._pieceList=[],G1e[this._mode].call(this,this._pieceList),this._resetSelected(r,n);var i=this.option.categories;this.resetVisual(function(o,s){a==="categories"?(o.mappingMethod="category",o.categories=ke(i)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=oe(this._pieceList,function(l){return l=ke(l),s!=="inRange"&&(l.visual=null),l}))})},t.prototype.completeVisualOption=function(){var r=this.option,n={},a=Kr.listVisualTypes(),i=this.isCategory();R(r.pieces,function(s){R(a,function(l){s.hasOwnProperty(l)&&(n[l]=1)})}),R(n,function(s,l){var u=!1;R(this.stateList,function(c){u=u||o(r,c,l)||o(r.target,c,l)},this),!u&&R(this.stateList,function(c){(r[c]||(r[c]={}))[l]=eZ.get(l,c==="inRange"?"active":"inactive",i)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(r,n){var a=this.option,i=this._pieceList,o=(n?a:r).selected||{};if(a.selected=o,R(i,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),a.selectedMode==="single"){var s=!1;R(i,function(l,u){var c=this.getSelectedMapKey(l);o[c]&&(s?o[c]=!1:s=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get("itemSymbol")},t.prototype.getSelectedMapKey=function(r){return this._mode==="categories"?r.value+"":r.index+""},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var r=this.option;return r.pieces&&r.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},t.prototype.setSelected=function(r){this.option.selected=ke(r)},t.prototype.getValueState=function(r){var n=Kr.findPieceIndex(r,this._pieceList);return n!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[n])]?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[],a=this._pieceList;return this.eachTargetSeries(function(i){var o=[],s=i.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=Kr.findPieceIndex(l,a);c===r&&o.push(u)},this),n.push({seriesId:i.id,dataIndex:o})},this),n},t.prototype.getRepresentValue=function(r){var n;if(this.isCategory())n=r.value;else if(r.value!=null)n=r.value;else{var a=r.interval||[];n=a[0]===-1/0&&a[1]===1/0?0:(a[0]+a[1])/2}return n},t.prototype.getVisualMeta=function(r){if(this.isCategory())return;var n=[],a=["",""],i=this;function o(c,h){var f=i.getRepresentValue({interval:c});h||(h=i.getValueState(f));var v=r(f,h);c[0]===-1/0?a[0]=v:c[1]===1/0?a[1]=v:n.push({value:c[0],color:v},{value:c[1],color:v})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return R(s,function(c){var h=c.interval;h&&(h[0]>u&&o([u,h[0]],"outOfRange"),o(h.slice()),u=h[1])},this),{stops:n,outerColors:a}},t.type="visualMap.piecewise",t.defaultOption=Cu(Vb.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),t}(Vb),G1e={splitNumber:function(e){var t=this.option,r=Math.min(t.precision,20),n=this.getExtent(),a=t.splitNumber;a=Math.max(parseInt(a,10),1),t.splitNumber=a;for(var i=(n[1]-n[0])/a;+i.toFixed(r)!==i&&r<5;)r++;t.precision=r,i=+i.toFixed(r),t.minOpen&&e.push({interval:[-1/0,n[0]],close:[0,0]});for(var o=0,s=n[0];o","≥"][n[0]]];r.text=r.text||this.formatValueText(r.value!=null?r.value:r.interval,!1,a)},this)}};function pB(e,t){var r=e.inverse;(e.orient==="vertical"?!r:r)&&t.reverse()}var H1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.doRender=function(){var r=this.group;r.removeAll();var n=this.visualMapModel,a=n.get("textGap"),i=n.textStyleModel,o=this._getItemAlign(),s=n.itemSize,l=this._getViewData(),u=l.endsText,c=On(n.get("showLabel",!0),!u),h=!n.get("selectedMode");u&&this._renderEndsText(r,u[0],s,c,o),R(l.viewPieceList,function(f){var v=f.piece,g=new De;g.onclick=be(this._onItemClick,this,v),this._enableHoverLink(g,f.indexInModelPieceList);var m=n.getRepresentValue(v);if(this._createItemSymbol(g,m,[0,0,s[0],s[1]],h),c){var y=this.visualMapModel.getValueState(m),x=i.get("align")||o;g.add(new wt({style:$t(i,{x:x==="right"?-a:s[0]+a,y:s[1]/2,text:v.text,verticalAlign:i.get("verticalAlign")||"middle",align:x,opacity:Te(i.get("opacity"),y==="outOfRange"?.5:1)}),silent:h}))}r.add(g)},this),u&&this._renderEndsText(r,u[1],s,c,o),Gc(n.get("orient"),r,n.get("itemGap")),this.renderBackground(r),this.positionGroup(r)},t.prototype._enableHoverLink=function(r,n){var a=this;r.on("mouseover",function(){return i("highlight")}).on("mouseout",function(){return i("downplay")});var i=function(o){var s=a.visualMapModel;s.option.hoverLink&&a.api.dispatchAction({type:o,batch:Kx(s.findTargetDataIndices(n),s)})}},t.prototype._getItemAlign=function(){var r=this.visualMapModel,n=r.option;if(n.orient==="vertical")return rZ(r,this.api,r.itemSize);var a=n.align;return(!a||a==="auto")&&(a="left"),a},t.prototype._renderEndsText=function(r,n,a,i,o){if(n){var s=new De,l=this.visualMapModel.textStyleModel;s.add(new wt({style:$t(l,{x:i?o==="right"?a[0]:0:a[0]/2,y:a[1]/2,verticalAlign:"middle",align:i?o:"center",text:n})})),r.add(s)}},t.prototype._getViewData=function(){var r=this.visualMapModel,n=oe(r.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),a=r.get("text"),i=r.get("orient"),o=r.get("inverse");return(i==="horizontal"?o:!o)?n.reverse():a&&(a=a.slice().reverse()),{viewPieceList:n,endsText:a}},t.prototype._createItemSymbol=function(r,n,a,i){var o=Ar(this.getControllerVisual(n,"symbol"),a[0],a[1],a[2],a[3],this.getControllerVisual(n,"color"));o.silent=i,r.add(o)},t.prototype._onItemClick=function(r){var n=this.visualMapModel,a=n.option,i=a.selectedMode;if(i){var o=ke(a.selected),s=n.getSelectedMapKey(r);i==="single"||i===!0?(o[s]=!0,R(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},t.type="visualMap.piecewise",t}(tZ);function iZ(e){e.registerComponentModel(V1e),e.registerComponentView(H1e),nZ(e)}function U1e(e){rt(aZ),rt(iZ)}var W1e=function(){function e(t){this._thumbnailModel=t}return e.prototype.reset=function(t){this._renderVersion=t.getECUpdateCycleVersion()},e.prototype.renderContent=function(t){var r=t.api.getViewOfComponentModel(this._thumbnailModel);r&&(t.group.silent=!0,r.renderContent({group:t.group,targetTrans:t.targetTrans,z2Range:$7(t.group),roamType:t.roamType,viewportRect:t.viewportRect,renderVersion:this._renderVersion}))},e.prototype.updateWindow=function(t,r){var n=r.getViewOfComponentModel(this._thumbnailModel);n&&n.updateWindow({targetTrans:t,renderVersion:this._renderVersion})},e}(),$1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.preventAutoZ=!0,r}return t.prototype.optionUpdated=function(r,n){this._updateBridge()},t.prototype._updateBridge=function(){var r=this._birdge=this._birdge||new W1e(this);if(this._target=null,this.ecModel.eachSeries(function(a){Z3(a,null)}),this.shouldShow()){var n=this.getTarget();Z3(n.baseMapProvider,r)}},t.prototype.shouldShow=function(){return this.getShallow("show",!0)},t.prototype.getBridge=function(){return this._birdge},t.prototype.getTarget=function(){if(this._target)return this._target;var r=this.getReferringComponents("series",{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];return r?r.subType!=="graph"&&(r=null):r=this.ecModel.queryComponents({mainType:"series",subType:"graph"})[0],this._target={baseMapProvider:r},this._target},t.type="thumbnail",t.layoutMode="box",t.dependencies=["series","geo"],t.defaultOption={show:!0,right:1,bottom:1,height:"25%",width:"25%",itemStyle:{borderColor:K.color.border,borderWidth:2},windowStyle:{borderWidth:1,color:K.color.neutral30,borderColor:K.color.neutral40,opacity:.3},z:10},t}(ht),Z1e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,a){if(this._api=a,this._model=r,this._coordSys||(this._coordSys=new iw),!this._isEnabled()){this._clear();return}this._renderVersion=a.getECUpdateCycleVersion();var i=this.group;i.removeAll();var o=r.getModel("itemStyle"),s=o.getItemStyle();s.fill==null&&(s.fill=n.get("backgroundColor")||K.color.neutral00);var l=Ur(r,a).refContainer,u=tr(mH(r,!0),l),c=s.lineWidth||0,h=this._contentRect=sh(u.clone(),c/2,!0,!0),f=new De;i.add(f),f.setClipPath(new it({shape:h.plain()}));var v=this._targetGroup=new De;f.add(v);var g=u.plain();g.r=o.getShallow("borderRadius",!0),i.add(this._bgRect=new it({style:s,shape:g,silent:!1,cursor:"grab"}));var m=r.getModel("windowStyle"),y=m.getShallow("borderRadius",!0);f.add(this._windowRect=new it({shape:{x:0,y:0,width:0,height:0,r:y},style:m.getItemStyle(),silent:!1,cursor:"grab"})),this._dealRenderContent(),this._dealUpdateWindow(),mB(r,this)},t.prototype.renderContent=function(r){this._bridgeRendered=r,this._isEnabled()&&(this._dealRenderContent(),this._dealUpdateWindow(),mB(this._model,this))},t.prototype._dealRenderContent=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=this._targetGroup,a=this._coordSys,i=this._contentRect;if(n.removeAll(),!!r){var o=r.group,s=o.getBoundingRect();n.add(o),this._bgRect.z2=r.z2Range.min-10,ow(a,s.x,s.y,s.width,s.height);var l=tr({left:"center",top:"center",aspect:s.width/s.height},i);bb(a,l.x,l.y,l.width,l.height),ym(o,a,mh),o.dirty(),this._windowRect.z2=r.z2Range.max+10,this._resetRoamController(r.roamType)}}},t.prototype.updateWindow=function(r){var n=this._bridgeRendered;n&&n.renderVersion===r.renderVersion&&(n.targetTrans=r.targetTrans),this._isEnabled()&&this._dealUpdateWindow()},t.prototype._dealUpdateWindow=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=Ra([],r.targetTrans),a=ja([],_b(null,this._coordSys),n);this._transThisToTarget=Ra([],a);var i=r.viewportRect;i?i=i.clone():i=new je(0,0,this._api.getWidth(),this._api.getHeight()),i.applyTransform(a);var o=this._windowRect,s=o.shape.r;o.setShape(Ee({r:s},i))}},t.prototype._resetRoamController=function(r){var n=this,a=this._api,i=this._roamController;if(i||(i=this._roamController=new Hh(a.getZr())),!r||!this._isEnabled()){i.disable();return}i.enable(r,{api:a,zInfo:{component:this._model},triggerInfo:{roamTrigger:null,isInSelf:function(o,s,l){return n._contentRect.contain(s,l)}}}),i.off("pan").off("zoom").on("pan",be(this._onPan,this)).on("zoom",be(this._onZoom,this))},t.prototype._onPan=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=dr([],[r.oldX,r.oldY],n),i=dr([],[r.oldX-r.dx,r.oldY-r.dy],n);this._api.dispatchAction(gB(this._model.getTarget().baseMapProvider,{dx:i[0]-a[0],dy:i[1]-a[1]}))}},t.prototype._onZoom=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=dr([],[r.originX,r.originY],n);this._api.dispatchAction(gB(this._model.getTarget().baseMapProvider,{zoom:1/r.scale,originX:a[0],originY:a[1]}))}},t.prototype._isEnabled=function(){var r=this._model;if(!r||!r.shouldShow())return!1;var n=r.getTarget().baseMapProvider;return!!n},t.prototype._clear=function(){this.group.removeAll(),this._bridgeRendered=null,this._roamController&&this._roamController.disable()},t.prototype.remove=function(){this._clear()},t.prototype.dispose=function(){this._clear()},t.type="thumbnail",t}(Yt);function gB(e,t){var r=e.mainType==="series"?e.subType+"Roam":e.mainType+"Roam",n={type:r};return n[e.mainType+"Id"]=e.id,te(n,t),n}function mB(e,t){var r=lh(e);z1(t.group,r.z,r.zlevel)}function Y1e(e){e.registerComponentModel($1e),e.registerComponentView(Z1e)}var X1e={label:{enabled:!0},decal:{show:!1}},yB=Qe(),xB=Qe(),q1e=Vm(K1e);function K1e(e,t){var r=e.getModel("aria");if(!r.get("enabled"))return;var n=xB(e).scope||(xB(e).scope={}),a=ke(X1e);Je(a.label,e.getLocaleModel().get("aria"),!1),Je(r.option,a,!1),i(),o();function i(){var c=r.getModel("decal"),h=c.get("show");if(h){var f=we();e.eachSeries(function(v){v.isColorBySeries()||(yB(v).scope=f.get(v.type)||f.set(v.type,{}))}),e.eachSeries(function(v){if(Le(v.enableAriaDecal)){v.enableAriaDecal();return}var g=v.getData();if(v.isColorBySeries()){var w=YM(v.ecModel,v.name,n,e.getSeriesCount()),S=g.getVisual("decal");g.setVisual("decal",C(S,w))}else{var m=v.getRawData(),y={},x=yB(v).scope;g.each(function(M){var A=g.getRawIndex(M);y[A]=M});var _=m.count();m.each(function(M){var A=y[M],I=m.getName(M)||M+"",k=YM(v.ecModel,I,x,_),P=g.getItemVisual(A,"decal");g.setItemVisual(A,"decal",C(P,k))})}function C(M,A){var I=M?te(te({},A),M):A;return I.dirty=!0,I}})}}function o(){var c=t.getZr().dom;if(c){var h=e.getLocaleModel().get("aria"),f=r.getModel("label");if(f.option=Ee(f.option,h),!!f.get("enabled")){if(c.setAttribute("role","img"),f.get("description")){c.setAttribute("aria-label",f.get("description"));return}var v=e.getSeriesCount(),g=f.get(["data","maxCount"])||10,m=f.get(["series","maxCount"])||10,y=Math.min(v,m),x;if(!(v<1)){var _=l();if(_){var w=f.get(["general","withTitle"]);x=s(w,{title:_})}else x=f.get(["general","withoutTitle"]);var S=[],C=v>1?f.get(["series","multiple","prefix"]):f.get(["series","single","prefix"]);x+=s(C,{seriesCount:v}),e.eachSeries(function(k,P){if(P1?f.get(["series","multiple",j]):f.get(["series","single",j]),D=s(D,{seriesId:k.seriesIndex,seriesName:k.get("name"),seriesType:u(k.subType)});var B=k.getData();if(B.count()>g){var H=f.get(["data","partialData"]);D+=s(H,{displayCnt:g})}else D+=f.get(["data","allData"]);for(var V=f.get(["data","separator","middle"]),U=f.get(["data","separator","end"]),F=f.get(["data","excludeDimensionId"]),W=[],$=0;$":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},ewe=function(){function e(t){var r=this._condVal=ve(t)?new RegExp(t):aG(t)?t:null;if(r==null){var n="";Lt(n)}}return e.prototype.evaluate=function(t){var r=typeof t;return ve(r)?this._condVal.test(t):Tt(r)?this._condVal.test(t+""):!1},e}(),twe=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),rwe=function(){function e(){}return e.prototype.evaluate=function(){for(var t=this.children,r=0;r2&&n.push(a),a=[j,B]}function c(j,B,H,V){tf(j,H)&&tf(B,V)||a.push(j,B,H,V,H,V)}function h(j,B,H,V,U,F){var W=Math.abs(B-j),$=Math.tan(W/4)*4/3,Z=BI:D2&&n.push(a),n}function dN(e,t,r,n,a,i,o,s,l,u){if(tf(e,r)&&tf(t,n)&&tf(a,o)&&tf(i,s)){l.push(o,s);return}var c=2/u,h=c*c,f=o-e,v=s-t,g=Math.sqrt(f*f+v*v);f/=g,v/=g;var m=r-e,y=n-t,x=a-o,_=i-s,w=m*m+y*y,S=x*x+_*_;if(w=0&&I=0){l.push(o,s);return}var k=[],P=[];iu(e,r,a,o,.5,k),iu(t,n,i,s,.5,P),dN(k[0],P[0],k[1],P[1],k[2],P[2],k[3],P[3],l,u),dN(k[4],P[4],k[5],P[5],k[6],P[6],k[7],P[7],l,u)}function gwe(e,t){var r=hN(e),n=[];t=t||1;for(var a=0;a0)for(var u=0;uMath.abs(u),h=sZ([l,u],c?0:1,t),f=(c?s:u)/h.length,v=0;va,o=sZ([n,a],i?0:1,t),s=i?"width":"height",l=i?"height":"width",u=i?"x":"y",c=i?"y":"x",h=e[s]/o.length,f=0;f1?null:new Oe(m*l+e,m*u+t)}function xwe(e,t,r){var n=new Oe;Oe.sub(n,r,t),n.normalize();var a=new Oe;Oe.sub(a,e,t);var i=a.dot(n);return i}function kd(e,t){var r=e[e.length-1];r&&r[0]===t[0]&&r[1]===t[1]||e.push(t)}function _we(e,t,r){for(var n=e.length,a=[],i=0;io?(u.x=c.x=s+i/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+i),_we(t,u,c)}function Gb(e,t,r,n){if(r===1)n.push(t);else{var a=Math.floor(r/2),i=e(t);Gb(e,i[0],a,n),Gb(e,i[1],r-a,n)}return n}function bwe(e,t){for(var r=[],n=0;n0;u/=2){var c=0,h=0;(e&u)>0&&(c=1),(t&u)>0&&(h=1),s+=u*u*(3*c^h),h===0&&(c===1&&(e=u-1-e,t=u-1-t),l=e,e=t,t=l)}return s}function Wb(e){var t=1/0,r=1/0,n=-1/0,a=-1/0,i=oe(e,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),c=l.x+l.width/2+(u?u[4]:0),h=l.y+l.height/2+(u?u[5]:0);return t=Math.min(c,t),r=Math.min(h,r),n=Math.max(c,n),a=Math.max(h,a),[c,h]}),o=oe(i,function(s,l){return{cp:s,z:Lwe(s[0],s[1],t,r,n,a),path:e[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function cZ(e){return Cwe(e.path,e.count)}function fN(){return{fromIndividuals:[],toIndividuals:[],count:0}}function Iwe(e,t,r){var n=[];function a(C){for(var M=0;M=0;a--)if(!r[a].many.length){var l=r[s].many;if(l.length<=1)if(s)s=0;else return r;var i=l.length,u=Math.ceil(i/2);r[a].many=l.slice(u,i),r[s].many=l.slice(0,u),s++}return r}var Dwe={clone:function(e){for(var t=[],r=1-Math.pow(1-e.path.style.opacity,1/e.count),n=0;n0))return;var s=n.getModel("universalTransition").get("delay"),l=te({setToFinal:!0},o),u,c;NB(e)&&(u=e,c=t),NB(t)&&(u=t,c=e);function h(x,_,w,S,C){var M=x.many,A=x.one;if(M.length===1&&!C){var I=_?M[0]:A,k=_?A:M[0];if(Hb(I))h({many:[I],one:k},!0,w,S,!0);else{var P=s?Ee({delay:s(w,S)},l):l;bP(I,k,P),i(I,k,I,k,P)}}else for(var D=Ee({dividePath:Dwe[r],individualDelay:s&&function(U,F,W,$){return s(U+w,S)}},l),z=_?Iwe(M,A,D):Pwe(A,M,D),j=z.fromIndividuals,B=z.toIndividuals,H=j.length,V=0;Vt.length,v=u?kB(c,u):kB(f?t:e,[f?e:t]),g=0,m=0;mhZ))for(var i=n.getIndices(),o=0;o0&&M.group.traverse(function(I){I instanceof pt&&!I.animators.length&&I.animateFrom({style:{opacity:0}},A)})})}function jB(e){var t=e.getModel("universalTransition").get("seriesKey");return t||e.id}function EB(e){return ae(e)?e.sort().join(","):e}function Cl(e){if(e.hostModel)return e.hostModel.getModel("universalTransition").get("divideShape")}function Fwe(e,t){var r=we(),n=we(),a=we();return R(e.oldSeries,function(i,o){var s=e.oldDataGroupIds[o],l=e.oldData[o],u=jB(i),c=EB(u);n.set(c,{dataGroupId:s,data:l}),ae(u)&&R(u,function(h){a.set(h,{key:c,dataGroupId:s,data:l})})}),R(t.updatedSeries,function(i){if(i.isUniversalTransitionEnabled()&&i.isAnimationEnabled()){var o=i.get("dataGroupId"),s=i.getData(),l=jB(i),u=EB(l),c=n.get(u);if(c)r.set(u,{oldSeries:[{dataGroupId:c.dataGroupId,divide:Cl(c.data),data:c.data}],newSeries:[{dataGroupId:o,divide:Cl(s),data:s}]});else if(ae(l)){var h=[];R(l,function(g){var m=n.get(g);m.data&&h.push({dataGroupId:m.dataGroupId,divide:Cl(m.data),data:m.data})}),h.length&&r.set(u,{oldSeries:h,newSeries:[{dataGroupId:o,data:s,divide:Cl(s)}]})}else{var f=a.get(l);if(f){var v=r.get(f.key);v||(v={oldSeries:[{dataGroupId:f.dataGroupId,data:f.data,divide:Cl(f.data)}],newSeries:[]},r.set(f.key,v)),v.newSeries.push({dataGroupId:o,data:s,divide:Cl(s)})}}}}),r}function RB(e,t){for(var r=0;r=0&&a.push({dataGroupId:t.oldDataGroupIds[s],data:t.oldData[s],divide:Cl(t.oldData[s]),groupIdDim:o.dimension})}),R(Zt(e.to),function(o){var s=RB(r.updatedSeries,o);if(s>=0){var l=r.updatedSeries[s].getData();i.push({dataGroupId:t.oldDataGroupIds[s],data:l,divide:Cl(l),groupIdDim:o.dimension})}}),a.length>0&&i.length>0&&dZ(a,i,n)}function Gwe(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){R(Zt(n.seriesTransition),function(a){R(Zt(a.to),function(i){for(var o=n.updatedSeries,s=0;ss.vmin?n+=s.vmin-a+(t-s.vmin)/(s.vmax-s.vmin)*s.gapReal:n+=t-a,a=s.vmax,i=!1;break}n+=s.vmin-a+s.gapReal,a=s.vmax}return i&&(n+=t-a),n},transformOut:function(t,r){if(r&&r.depth===Ps)return t;for(var n=OB,a=zB,i=!0,o=0,s=0;su?o=l.vmin+(t-u)/(c-u)*(l.vmax-l.vmin):o=a+t-n,a=l.vmax,i=!1;break}n=c,a=l.vmax}return i&&(o=a+t-n),o}},e}();function Uwe(e,t){return new Hwe(e,t)}var OB=0,zB=0;function Wwe(e,t){var r=0,n={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},a=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},i={S:{tpAbs:a(),tpPrct:a()},E:{tpAbs:a(),tpPrct:a()}};R(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(r+=l.val);var u=wP(s,t);if(u){var c=u.vmin!==s.vmin,h=u.vmax!==s.vmax,f=u.vmax-u.vmin;if(!(c&&h))if(c||h){var v=c?"S":"E";i[v][l.type].has=!0,i[v][l.type].span=f,i[v][l.type].inExtFrac=f/(s.vmax-s.vmin),i[v][l.type].val=l.val}else n[l.type].span+=f,n[l.type].val+=l.val}});var o=r*(0+(t[1]-t[0])+(n.tpAbs.val-n.tpAbs.span)+(i.S.tpAbs.has?(i.S.tpAbs.val-i.S.tpAbs.span)*i.S.tpAbs.inExtFrac:0)+(i.E.tpAbs.has?(i.E.tpAbs.val-i.E.tpAbs.span)*i.E.tpAbs.inExtFrac:0)-n.tpPrct.span-(i.S.tpPrct.has?i.S.tpPrct.span*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.span*i.E.tpPrct.inExtFrac:0))/(1-n.tpPrct.val-(i.S.tpPrct.has?i.S.tpPrct.val*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.val*i.E.tpPrct.inExtFrac:0));R(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(s.gapReal=r!==0?at(o,0)*l.val/r:0),l.type==="tpAbs"&&(s.gapReal=l.val),s.gapReal==null&&(s.gapReal=0)})}function $we(e,t,r,n,a,i){e!=="no"&&R(r,function(o){var s=wP(o,i);if(s)for(var l=t.length-1;l>=0;l--){var u=t[l],c=n(u),h=a*3/4;c>s.vmin-h&&ct[0]&&r=0&&o<1-1e-5}R(e,function(o){if(!(!o||o.start==null||o.end==null)&&!o.isExpanded){var s={breakOption:ke(o),vmin:t.parse(o.start),vmax:t.parse(o.end),gapParsed:{type:"tpAbs",val:0},gapReal:null};if(o.gap!=null){var l=!1;if(ve(o.gap)){var u=ka(o.gap);if(u.match(/%$/)){var c=parseFloat(u)/100;a(c)||(c=0),s.gapParsed.type="tpPrct",s.gapParsed.val=c,l=!0}}if(!l){var h=t.parse(o.gap);(!isFinite(h)||h<0)&&(h=0),s.gapParsed.type="tpAbs",s.gapParsed.val=h}}if(s.vmin===s.vmax&&(s.gapParsed.type="tpAbs",s.gapParsed.val=0),r&&r.noNegative&&R(["vmin","vmax"],function(v){s[v]<0&&(s[v]=0)}),s.vmin>s.vmax){var f=s.vmax;s.vmax=s.vmin,s.vmin=f}n.push(s)}}),n.sort(function(o,s){return o.vmin-s.vmin});var i=-1/0;return R(n,function(o,s){i>o.vmin&&(n[s]=null),i=o.vmax}),{breaks:It(n,function(o){return!!o})}}function SP(e,t){return pN(t)===pN(e)}function pN(e){return e.start+"_\0_"+e.end}function Ywe(e,t,r){var n=[];R(e,function(i,o){var s=t(i);s&&s.type==="vmin"&&n.push([o])}),R(e,function(i,o){var s=t(i);if(s&&s.type==="vmax"){var l=Ks(n,function(u){return SP(t(e[u[0]]).parsedBreak.breakOption,s.parsedBreak.breakOption)});l&&l.push(o)}});var a=[];return R(n,function(i){i.length===2&&a.push(r?i:[e[i[0]],e[i[1]]])}),a}function Xwe(e,t,r,n){if(t.break){var a=t.break.parsedBreak,i=Ks(r,function(c){return SP(c.breakOption,t.break.parsedBreak.breakOption)}),o={lookup:n,depth:Ps},s=e.transformOut(a.vmin,o),l=e.transformOut(a.vmax,o),u={vmin:s,vmax:l,breakOption:a.breakOption,gapParsed:ke(i.gapParsed),gapReal:a.gapReal};return{tickVal:u[t.break.type],vBreak:{type:t.break.type,parsedBreak:u}}}}function qwe(e,t,r,n,a){a.original=vN(e,t,r);var i=a.transformed=vN(e,t,r),o=a.lookup;i.breaks=oe(i.breaks,function(s,l){var u={depth:Ps},c=t.transformIn(s.vmin,u),h=t.transformIn(s.vmax,u),f={type:s.gapParsed.type,val:s.gapParsed.type==="tpAbs"?t.transformIn(s.vmin+s.gapParsed.val,u)-c:s.gapParsed.val};return o.from[n+l]=c,o.to[n+l]=s.vmin,o.from[n+l+1]=h,o.to[n+l+1]=s.vmax,{vmin:c,vmax:h,gapParsed:f,gapReal:s.gapReal,breakOption:s.breakOption}})}var Kwe={vmin:"start",vmax:"end"};function Jwe(e,t){return t&&(e=e||{},e.break={type:Kwe[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function Qwe(){Jne({createBreakScaleMapper:Uwe,pruneTicksByBreak:$we,addBreaksToTicks:Zwe,parseAxisBreakOption:vN,identifyAxisBreak:SP,serializeAxisBreakIdentifier:pN,retrieveAxisBreakPairs:Ywe,getTicksBreakOutwardTransform:Xwe,parseAxisBreakOptionInwardTransform:qwe,makeAxisLabelFormatterParamBreak:Jwe})}var BB=Qe();function eSe(e,t){var r=Ks(e,function(n){return Mr().identifyAxisBreak(n.parsedBreak.breakOption,t.breakOption)});return r||e.push(r={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),r}function tSe(e){R(e,function(t){return t.shouldRemove=!0})}function rSe(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function nSe(e,t,r,n,a){var i=r.axis;if(i.scale.isBlank()||!Mr())return;var o=Mr().retrieveAxisBreakPairs(i.scale.getTicks({breakTicks:"only_break"}),function(k){return k.break},!1);if(!o.length)return;var s=r.getModel("breakArea"),l=s.get("zigzagAmplitude"),u=s.get("zigzagMinSpan"),c=s.get("zigzagMaxSpan");u=Math.max(2,u||0),c=Math.max(u,c||0);var h=s.get("expandOnClick"),f=s.get("zigzagZ"),v=s.getModel("itemStyle"),g=v.getItemStyle(),m=g.stroke,y=g.lineWidth,x=g.lineDash,_=g.fill,w=new De({ignoreModelZ:!0}),S=i.isHorizontal(),C=BB(t).visualList||(BB(t).visualList=[]);tSe(C);for(var M=function(k){var P=o[k][0].break.parsedBreak,D=[];D[0]=i.toGlobalCoord(i.dataToCoord(P.vmin,!0)),D[1]=i.toGlobalCoord(i.dataToCoord(P.vmax,!0)),D[1]=F;de&&(re=F);var He=[],ye=[];He[V]=D,ye[V]=z,!le&&!de&&(He[V]+=J?-l:l,ye[V]-=J?l:-l),He[U]=re,ye[U]=re,$.push(He),Z.push(ye);var ne=void 0;if(Q_[1]&&_.reverse(),{coordPair:_,brkId:Mr().serializeAxisBreakIdentifier(x.breakOption)}});l.sort(function(y,x){return y.coordPair[0]-x.coordPair[0]});for(var u=o[0],c=null,h=0;h=0?l[0].width:l[1].width),f=(h+c.x)/2-u.x,v=Math.min(f,f-c.x),g=Math.max(f,f-c.x),m=g<0?g:v>0?v:0;s=(f-m)/c.x}var y=new Oe,x=new Oe;Oe.scale(y,n,-s),Oe.scale(x,n,1-s),vA(r[0],y),vA(r[1],x)}function oSe(e,t){var r={breaks:[]};return R(t.breaks,function(n){if(n){var a=Ks(e.get("breaks",!0),function(s){return Mr().identifyAxisBreak(s,n)});if(a){var i=t.type,o={isExpanded:!!a.isExpanded};a.isExpanded=i===ew?!0:i===n8?!1:i===a8?!a.isExpanded:a.isExpanded,r.breaks.push({start:a.start,end:a.end,isExpanded:!!a.isExpanded,old:o})}}}),r}function sSe(){Sce({adjustBreakLabelPair:iSe,buildAxisBreakLine:aSe,rectCoordBuildBreakAxis:nSe,updateModelAxisBreak:oSe})}function lSe(e){Ace(e),Qwe(),sSe()}function uSe(){Hhe(cSe)}function cSe(e,t){R(e,function(r){if(!r.model.get(["axisLabel","inside"])){var n=hSe(r);if(n){var a=r.isHorizontal()?"height":"width",i=r.model.get(["axisLabel","margin"]);t[a]-=n[a]+i,r.position==="top"?t.y+=n.height+i:r.position==="left"&&(t.x+=n.width+i)}}})}function hSe(e){var t=e.model,r=e.scale;if(!t.get(["axisLabel","show"])||r.isBlank())return;var n,a,i=r.getExtent();r instanceof sm?a=r.count():(n=r.getTicks(),a=n.length);var o=e.getLabelModel(),s=Jm(e),l,u=1;a>40&&(u=Math.ceil(a/40));for(var c=0;c1&&arguments[1]!==void 0?arguments[1]:60,a=null;return function(){for(var i=this,o=arguments.length,s=new Array(o),l=0;l12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function NSe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function kSe(e){return e==="ROUTER"||e==="ROUTER_LATE"?30:e==="REPEATER"||e==="TRACKER"?25:e==="CLIENT_MUTE"?7:e==="CLIENT_BASE"?12:15}function LSe({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const a=E.useRef(null),[i,o]=E.useState("connected"),s=E.useMemo(()=>{const y=new Set;return t.forEach(x=>{y.add(x.from_node),y.add(x.to_node)}),y},[t]),l=E.useMemo(()=>{let y=e;return i==="connected"?y=y.filter(x=>s.has(x.node_num)):i==="infra"&&(y=y.filter(x=>GB.includes(x.role))),y},[e,i,s]),u=E.useMemo(()=>new Map(l.map(y=>[y.node_num,y])),[l]),c=E.useMemo(()=>t.filter(y=>u.has(y.from_node)&&u.has(y.to_node)),[t,u]),h=E.useMemo(()=>{const y=new Set;return r!==null&&c.forEach(x=>{x.from_node===r&&y.add(x.to_node),x.to_node===r&&y.add(x.from_node)}),y},[r,c]),f=E.useMemo(()=>{const y=l.map(_=>{const w=NSe(_.latitude),S=VB[w%VB.length],C=GB.includes(_.role),M=_.node_num===r,A=h.has(_.node_num),I=r===null||M||A;return{id:String(_.node_num),name:_.short_name,value:_.node_num,symbolSize:kSe(_.role),itemStyle:{color:C?S:"#111827",borderColor:S,borderWidth:C?0:2,opacity:I?1:.15},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace",color:I?"#94a3b8":"#94a3b820"},nodeNum:_.node_num,longName:_.long_name,role:_.role}}),x=c.map(_=>{const w=r===null||_.from_node===r||_.to_node===r;return{source:String(_.from_node),target:String(_.to_node),value:_.snr,lineStyle:{color:ASe(_.snr),width:w&&r!==null?2:1,opacity:r===null?.4:w?.6:.04}}});return{nodes:y,links:x}},[l,c,r,h]),v=E.useMemo(()=>({backgroundColor:"#111827",tooltip:{trigger:"item",backgroundColor:"#1e293b",borderColor:"#334155",textStyle:{color:"#e2e8f0",fontFamily:"JetBrains Mono, monospace",fontSize:11},formatter:y=>{if(y.data&&y.data.longName){const x=y.data;return`${x.name}
${x.longName}
Role: ${x.role}`}return""}},series:[{type:"graph",layout:"force",roam:!0,draggable:!0,animation:!1,data:f.nodes,links:f.links,force:{repulsion:200,edgeLength:[80,120],gravity:.1},emphasis:{focus:"adjacency",blurScope:"coordinateSystem",scale:1.1,lineStyle:{width:2}},blur:{itemStyle:{opacity:.15},lineStyle:{opacity:.04}},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace"},edgeLabel:{show:!1},edgeSymbol:["none","none"]}]}),[f]),g=E.useCallback(y=>{if(y.data&&"nodeNum"in y.data){const x=y.data.nodeNum;n(r===x?null:x??null)}},[r,n]),m=E.useMemo(()=>({click:g}),[g]);return E.useEffect(()=>{var x;const y=(x=a.current)==null?void 0:x.getEchartsInstance();y&&y.setOption(v,{notMerge:!1,lazyUpdate:!0})},[v]),d.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[d.jsx(MSe,{ref:a,option:v,style:{height:"540px",width:"100%"},onEvents:m,opts:{renderer:"canvas"}}),d.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2",children:[d.jsx(EV,{size:14,className:"text-slate-500"}),d.jsx("div",{className:"flex gap-1",children:[{key:"connected",label:"Connected"},{key:"infra",label:"Infra"},{key:"all",label:"All"}].map(({key:y,label:x})=>d.jsx("button",{onClick:()=>o(y),className:`px-2 py-1 text-xs rounded transition-colors ${i===y?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:x},y))}),d.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[l.length," nodes • ",c.length," edges"]})]}),d.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[d.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Edge Quality (SNR)"}),d.jsx("div",{className:"space-y-1",children:[{label:"Excellent (>12)",color:"#22c55e"},{label:"Good (8-12)",color:"#4ade80"},{label:"Fair (5-8)",color:"#f59e0b"},{label:"Marginal (3-5)",color:"#f97316"},{label:"Poor (<3)",color:"#ef4444"}].map(y=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:y.color}}),d.jsx("span",{className:"text-xs text-slate-500",children:y.label})]},y.label))})]}),d.jsxs("div",{className:"absolute bottom-4 right-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[d.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Node Type"}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-3 h-3 rounded-full bg-sky-400"}),d.jsx("span",{className:"text-xs text-slate-500",children:"Infrastructure"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-900 border-2 border-sky-400"}),d.jsx("span",{className:"text-xs text-slate-500",children:"Client"})]})]})]})]})}function pZ(e,t){const r=E.useRef(t);E.useEffect(function(){t!==r.current&&e.attributionControl!=null&&(r.current!=null&&e.attributionControl.removeAttribution(r.current),t!=null&&e.attributionControl.addAttribution(t)),r.current=t},[e,t])}function ISe(e,t,r){t.center!==r.center&&e.setLatLng(t.center),t.radius!=null&&t.radius!==r.radius&&e.setRadius(t.radius)}const PSe=1;function DSe(e){return Object.freeze({__version:PSe,map:e})}function AP(e,t){return Object.freeze({...e,...t})}const gZ=E.createContext(null),mZ=gZ.Provider;function gw(){const e=E.useContext(gZ);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function jSe(e){function t(r,n){const{instance:a,context:i}=e(r).current;return E.useImperativeHandle(n,()=>a),r.children==null?null:bf.createElement(mZ,{value:i},r.children)}return E.forwardRef(t)}function ESe(e){function t(r,n){const[a,i]=E.useState(!1),{instance:o}=e(r,i).current;E.useImperativeHandle(n,()=>o),E.useEffect(function(){a&&o.update()},[o,a,r.children]);const s=o._contentNode;return s?pV.createPortal(r.children,s):null}return E.forwardRef(t)}function RSe(e){function t(r,n){const{instance:a}=e(r).current;return E.useImperativeHandle(n,()=>a),null}return E.forwardRef(t)}function NP(e,t){const r=E.useRef();E.useEffect(function(){return t!=null&&e.instance.on(t),r.current=t,function(){r.current!=null&&e.instance.off(r.current),r.current=null}},[e,t])}function mw(e,t){const r=e.pane??t.pane;return r?{...e,pane:r}:e}function OSe(e,t){return function(n,a){const i=gw(),o=e(mw(n,i),i);return pZ(i.map,n.attribution),NP(o.current,n.eventHandlers),t(o.current,i,n,a),o}}var yN={exports:{}};/* @preserve + * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com + * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade + */(function(e,t){(function(r,n){n(t)})(jY,function(r){var n="1.9.4";function a(p){var b,T,N,O;for(T=1,N=arguments.length;T"u"||!L||!L.Mixin)){p=w(p)?p:[p];for(var b=0;b0?Math.floor(p):Math.ceil(p)};F.prototype={clone:function(){return new F(this.x,this.y)},add:function(p){return this.clone()._add($(p))},_add:function(p){return this.x+=p.x,this.y+=p.y,this},subtract:function(p){return this.clone()._subtract($(p))},_subtract:function(p){return this.x-=p.x,this.y-=p.y,this},divideBy:function(p){return this.clone()._divideBy(p)},_divideBy:function(p){return this.x/=p,this.y/=p,this},multiplyBy:function(p){return this.clone()._multiplyBy(p)},_multiplyBy:function(p){return this.x*=p,this.y*=p,this},scaleBy:function(p){return new F(this.x*p.x,this.y*p.y)},unscaleBy:function(p){return new F(this.x/p.x,this.y/p.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=W(this.x),this.y=W(this.y),this},distanceTo:function(p){p=$(p);var b=p.x-this.x,T=p.y-this.y;return Math.sqrt(b*b+T*T)},equals:function(p){return p=$(p),p.x===this.x&&p.y===this.y},contains:function(p){return p=$(p),Math.abs(p.x)<=Math.abs(this.x)&&Math.abs(p.y)<=Math.abs(this.y)},toString:function(){return"Point("+f(this.x)+", "+f(this.y)+")"}};function $(p,b,T){return p instanceof F?p:w(p)?new F(p[0],p[1]):p==null?p:typeof p=="object"&&"x"in p&&"y"in p?new F(p.x,p.y):new F(p,b,T)}function Z(p,b){if(p)for(var T=b?[p,b]:p,N=0,O=T.length;N=this.min.x&&T.x<=this.max.x&&b.y>=this.min.y&&T.y<=this.max.y},intersects:function(p){p=J(p);var b=this.min,T=this.max,N=p.min,O=p.max,G=O.x>=b.x&&N.x<=T.x,Y=O.y>=b.y&&N.y<=T.y;return G&&Y},overlaps:function(p){p=J(p);var b=this.min,T=this.max,N=p.min,O=p.max,G=O.x>b.x&&N.xb.y&&N.y=b.lat&&O.lat<=T.lat&&N.lng>=b.lng&&O.lng<=T.lng},intersects:function(p){p=Q(p);var b=this._southWest,T=this._northEast,N=p.getSouthWest(),O=p.getNorthEast(),G=O.lat>=b.lat&&N.lat<=T.lat,Y=O.lng>=b.lng&&N.lng<=T.lng;return G&&Y},overlaps:function(p){p=Q(p);var b=this._southWest,T=this._northEast,N=p.getSouthWest(),O=p.getNorthEast(),G=O.lat>b.lat&&N.latb.lng&&N.lng1,Xe=function(){var p=!1;try{var b=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("testPassiveEventSupport",h,b),window.removeEventListener("testPassiveEventSupport",h,b)}catch{}return p}(),lt=function(){return!!document.createElement("canvas").getContext}(),Pt=!!(document.createElementNS&&qe("svg").createSVGRect),fr=!!Pt&&function(){var p=document.createElement("div");return p.innerHTML="",(p.firstChild&&p.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),Tn=!Pt&&function(){try{var p=document.createElement("div");p.innerHTML='';var b=p.firstChild;return b.style.behavior="url(#default#VML)",b&&typeof b.adj=="object"}catch{return!1}}(),Ct=navigator.platform.indexOf("Mac")===0,as=navigator.platform.indexOf("Linux")===0;function Mn(p){return navigator.userAgent.toLowerCase().indexOf(p)>=0}var $e={ie:bt,ielt9:et,edge:Ke,webkit:St,android:ce,android23:st,androidStock:Ft,opera:jt,chrome:Lr,gecko:Qo,safari:tl,phantom:Ki,opera12:Uh,win:Gn,ie3d:es,webkit3d:ts,gecko3d:Au,any3d:Wh,mobile:Va,mobileWebkit:$h,mobileWebkit3d:Nu,msPointer:ku,pointer:rl,touch:Iu,touchNative:Lu,mobileOpera:rs,mobileGecko:ns,retina:ue,passiveEvents:Xe,canvas:lt,svg:Pt,vml:Tn,inlineSvg:fr,mac:Ct,linux:as},Zh=$e.msPointer?"MSPointerDown":"pointerdown",Ne=$e.msPointer?"MSPointerMove":"pointermove",aa=$e.msPointer?"MSPointerUp":"pointerup",Pu=$e.msPointer?"MSPointerCancel":"pointercancel",Lv={touchstart:Zh,touchmove:Ne,touchend:aa,touchcancel:Pu},oy={touchstart:ly,touchmove:Yh,touchend:Yh,touchcancel:Yh},Ga={},sy=!1;function xw(p,b,T){return b==="touchstart"&&Rr(),oy[b]?(T=oy[b].bind(this,T),p.addEventListener(Lv[b],T,!1),T):(console.warn("wrong event specified:",b),h)}function _w(p,b,T){if(!Lv[b]){console.warn("wrong event specified:",b);return}p.removeEventListener(Lv[b],T,!1)}function bw(p){Ga[p.pointerId]=p}function ww(p){Ga[p.pointerId]&&(Ga[p.pointerId]=p)}function is(p){delete Ga[p.pointerId]}function Rr(){sy||(document.addEventListener(Zh,bw,!0),document.addEventListener(Ne,ww,!0),document.addEventListener(aa,is,!0),document.addEventListener(Pu,is,!0),sy=!0)}function Yh(p,b){if(b.pointerType!==(b.MSPOINTER_TYPE_MOUSE||"mouse")){b.touches=[];for(var T in Ga)b.touches.push(Ga[T]);b.changedTouches=[b],p(b)}}function ly(p,b){b.MSPOINTER_TYPE_TOUCH&&b.pointerType===b.MSPOINTER_TYPE_TOUCH&&hn(b),Yh(p,b)}function uy(p){var b={},T,N;for(N in p)T=p[N],b[N]=T&&T.bind?T.bind(p):T;return p=b,b.type="dblclick",b.detail=2,b.isTrusted=!1,b._simulated=!0,b}var cy=200;function hy(p,b){p.addEventListener("dblclick",b);var T=0,N;function O(G){if(G.detail!==1){N=G.detail;return}if(!(G.pointerType==="mouse"||G.sourceCapabilities&&!G.sourceCapabilities.firesTouchEvents)){var Y=EP(G);if(!(Y.some(function(ie){return ie instanceof HTMLLabelElement&&ie.attributes.for})&&!Y.some(function(ie){return ie instanceof HTMLInputElement||ie instanceof HTMLSelectElement}))){var ee=Date.now();ee-T<=cy?(N++,N===2&&b(uy(G))):N=1,T=ee}}}return p.addEventListener("click",O),{dblclick:b,simDblclick:O}}function dy(p,b){p.removeEventListener("dblclick",b.dblclick),p.removeEventListener("click",b.simDblclick)}var Xh=Ji(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),nl=Ji(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Iv=nl==="webkitTransition"||nl==="OTransition"?nl+"End":"transitionend";function se(p){return typeof p=="string"?document.getElementById(p):p}function ut(p,b){var T=p.style[b]||p.currentStyle&&p.currentStyle[b];if((!T||T==="auto")&&document.defaultView){var N=document.defaultView.getComputedStyle(p,null);T=N?N[b]:null}return T==="auto"?null:T}function Ze(p,b,T){var N=document.createElement(p);return N.className=b||"",T&&T.appendChild(N),N}function mt(p){var b=p.parentNode;b&&b.removeChild(p)}function rr(p){for(;p.firstChild;)p.removeChild(p.firstChild)}function ia(p){var b=p.parentNode;b&&b.lastChild!==p&&b.appendChild(p)}function cn(p){var b=p.parentNode;b&&b.firstChild!==p&&b.insertBefore(p,b.firstChild)}function An(p,b){if(p.classList!==void 0)return p.classList.contains(b);var T=ot(p);return T.length>0&&new RegExp("(^|\\s)"+b+"(\\s|$)").test(T)}function q(p,b){if(p.classList!==void 0)for(var T=g(b),N=0,O=T.length;N0?2*window.devicePixelRatio:1;function OP(p){return $e.edge?p.wheelDeltaY/2:p.deltaY&&p.deltaMode===0?-p.deltaY/FZ:p.deltaY&&p.deltaMode===1?-p.deltaY*20:p.deltaY&&p.deltaMode===2?-p.deltaY*60:p.deltaX||p.deltaZ?0:p.wheelDelta?(p.wheelDeltaY||p.wheelDelta)/2:p.detail&&Math.abs(p.detail)<32765?-p.detail*20:p.detail?p.detail/-32765*60:0}function Aw(p,b){var T=b.relatedTarget;if(!T)return!0;try{for(;T&&T!==p;)T=T.parentNode}catch{return!1}return T!==p}var VZ={__proto__:null,on:Ie,off:Wt,stopPropagation:Eu,disableScrollPropagation:Mw,disableClickPropagation:Pv,preventDefault:hn,stop:Ru,getPropagationPath:EP,getMousePosition:RP,getWheelDelta:OP,isExternalTarget:Aw,addListener:Ie,removeListener:Wt},zP=U.extend({run:function(p,b,T,N){this.stop(),this._el=p,this._inProgress=!0,this._duration=T||.25,this._easeOutPower=1/Math.max(N||.5,.2),this._startPos=eo(p),this._offset=b.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=D(this._animate,this),this._step()},_step:function(p){var b=+new Date-this._startTime,T=this._duration*1e3;bthis.options.maxZoom)?this.setZoom(p):this},panInsideBounds:function(p,b){this._enforcingBounds=!0;var T=this.getCenter(),N=this._limitCenter(T,this._zoom,Q(p));return T.equals(N)||this.panTo(N,b),this._enforcingBounds=!1,this},panInside:function(p,b){b=b||{};var T=$(b.paddingTopLeft||b.padding||[0,0]),N=$(b.paddingBottomRight||b.padding||[0,0]),O=this.project(this.getCenter()),G=this.project(p),Y=this.getPixelBounds(),ee=J([Y.min.add(T),Y.max.subtract(N)]),ie=ee.getSize();if(!ee.contains(G)){this._enforcingBounds=!0;var pe=G.subtract(ee.getCenter()),ze=ee.extend(G).getSize().subtract(ie);O.x+=pe.x<0?-ze.x:ze.x,O.y+=pe.y<0?-ze.y:ze.y,this.panTo(this.unproject(O),b),this._enforcingBounds=!1}return this},invalidateSize:function(p){if(!this._loaded)return this;p=a({animate:!1,pan:!0},p===!0?{animate:!0}:p);var b=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var T=this.getSize(),N=b.divideBy(2).round(),O=T.divideBy(2).round(),G=N.subtract(O);return!G.x&&!G.y?this:(p.animate&&p.pan?this.panBy(G):(p.pan&&this._rawPanBy(G),this.fire("move"),p.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:b,newSize:T}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(p){if(p=this._locateOptions=a({timeout:1e4,watch:!1},p),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var b=o(this._handleGeolocationResponse,this),T=o(this._handleGeolocationError,this);return p.watch?this._locationWatchId=navigator.geolocation.watchPosition(b,T,p):navigator.geolocation.getCurrentPosition(b,T,p),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(p){if(this._container._leaflet_id){var b=p.code,T=p.message||(b===1?"permission denied":b===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:b,message:"Geolocation error: "+T+"."})}},_handleGeolocationResponse:function(p){if(this._container._leaflet_id){var b=p.coords.latitude,T=p.coords.longitude,N=new le(b,T),O=N.toBounds(p.coords.accuracy*2),G=this._locateOptions;if(G.setView){var Y=this.getBoundsZoom(O);this.setView(N,G.maxZoom?Math.min(Y,G.maxZoom):Y)}var ee={latlng:N,bounds:O,timestamp:p.timestamp};for(var ie in p.coords)typeof p.coords[ie]=="number"&&(ee[ie]=p.coords[ie]);this.fire("locationfound",ee)}},addHandler:function(p,b){if(!b)return this;var T=this[p]=new b(this);return this._handlers.push(T),this.options[p]&&T.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),mt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(z(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var p;for(p in this._layers)this._layers[p].remove();for(p in this._panes)mt(this._panes[p]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(p,b){var T="leaflet-pane"+(p?" leaflet-"+p.replace("Pane","")+"-pane":""),N=Ze("div",T,b||this._mapPane);return p&&(this._panes[p]=N),N},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var p=this.getPixelBounds(),b=this.unproject(p.getBottomLeft()),T=this.unproject(p.getTopRight());return new re(b,T)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(p,b,T){p=Q(p),T=$(T||[0,0]);var N=this.getZoom()||0,O=this.getMinZoom(),G=this.getMaxZoom(),Y=p.getNorthWest(),ee=p.getSouthEast(),ie=this.getSize().subtract(T),pe=J(this.project(ee,N),this.project(Y,N)).getSize(),ze=$e.any3d?this.options.zoomSnap:1,ft=ie.x/pe.x,kt=ie.y/pe.y,Un=b?Math.max(ft,kt):Math.min(ft,kt);return N=this.getScaleZoom(Un,N),ze&&(N=Math.round(N/(ze/100))*(ze/100),N=b?Math.ceil(N/ze)*ze:Math.floor(N/ze)*ze),Math.max(O,Math.min(G,N))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new F(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(p,b){var T=this._getTopLeftPoint(p,b);return new Z(T,T.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(p){return this.options.crs.getProjectedBounds(p===void 0?this.getZoom():p)},getPane:function(p){return typeof p=="string"?this._panes[p]:p},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(p,b){var T=this.options.crs;return b=b===void 0?this._zoom:b,T.scale(p)/T.scale(b)},getScaleZoom:function(p,b){var T=this.options.crs;b=b===void 0?this._zoom:b;var N=T.zoom(p*T.scale(b));return isNaN(N)?1/0:N},project:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.latLngToPoint(de(p),b)},unproject:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.pointToLatLng($(p),b)},layerPointToLatLng:function(p){var b=$(p).add(this.getPixelOrigin());return this.unproject(b)},latLngToLayerPoint:function(p){var b=this.project(de(p))._round();return b._subtract(this.getPixelOrigin())},wrapLatLng:function(p){return this.options.crs.wrapLatLng(de(p))},wrapLatLngBounds:function(p){return this.options.crs.wrapLatLngBounds(Q(p))},distance:function(p,b){return this.options.crs.distance(de(p),de(b))},containerPointToLayerPoint:function(p){return $(p).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(p){return $(p).add(this._getMapPanePos())},containerPointToLatLng:function(p){var b=this.containerPointToLayerPoint($(p));return this.layerPointToLatLng(b)},latLngToContainerPoint:function(p){return this.layerPointToContainerPoint(this.latLngToLayerPoint(de(p)))},mouseEventToContainerPoint:function(p){return RP(p,this._container)},mouseEventToLayerPoint:function(p){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(p))},mouseEventToLatLng:function(p){return this.layerPointToLatLng(this.mouseEventToLayerPoint(p))},_initContainer:function(p){var b=this._container=se(p);if(b){if(b._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Ie(b,"scroll",this._onScroll,this),this._containerId=l(b)},_initLayout:function(){var p=this._container;this._fadeAnimated=this.options.fadeAnimation&&$e.any3d,q(p,"leaflet-container"+($e.touch?" leaflet-touch":"")+($e.retina?" leaflet-retina":"")+($e.ielt9?" leaflet-oldie":"")+($e.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var b=ut(p,"position");b!=="absolute"&&b!=="relative"&&b!=="fixed"&&b!=="sticky"&&(p.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var p=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),gr(this._mapPane,new F(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(q(p.markerPane,"leaflet-zoom-hide"),q(p.shadowPane,"leaflet-zoom-hide"))},_resetView:function(p,b,T){gr(this._mapPane,new F(0,0));var N=!this._loaded;this._loaded=!0,b=this._limitZoom(b),this.fire("viewprereset");var O=this._zoom!==b;this._moveStart(O,T)._move(p,b)._moveEnd(O),this.fire("viewreset"),N&&this.fire("load")},_moveStart:function(p,b){return p&&this.fire("zoomstart"),b||this.fire("movestart"),this},_move:function(p,b,T,N){b===void 0&&(b=this._zoom);var O=this._zoom!==b;return this._zoom=b,this._lastCenter=p,this._pixelOrigin=this._getNewPixelOrigin(p),N?T&&T.pinch&&this.fire("zoom",T):((O||T&&T.pinch)&&this.fire("zoom",T),this.fire("move",T)),this},_moveEnd:function(p){return p&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return z(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(p){gr(this._mapPane,this._getMapPanePos().subtract(p))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(p){this._targets={},this._targets[l(this._container)]=this;var b=p?Wt:Ie;b(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&b(window,"resize",this._onResize,this),$e.any3d&&this.options.transform3DLimit&&(p?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){z(this._resizeRequest),this._resizeRequest=D(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var p=this._getMapPanePos();Math.max(Math.abs(p.x),Math.abs(p.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(p,b){for(var T=[],N,O=b==="mouseout"||b==="mouseover",G=p.target||p.srcElement,Y=!1;G;){if(N=this._targets[l(G)],N&&(b==="click"||b==="preclick")&&this._draggableMoved(N)){Y=!0;break}if(N&&N.listens(b,!0)&&(O&&!Aw(G,p)||(T.push(N),O))||G===this._container)break;G=G.parentNode}return!T.length&&!Y&&!O&&this.listens(b,!0)&&(T=[this]),T},_isClickDisabled:function(p){for(;p&&p!==this._container;){if(p._leaflet_disable_click)return!0;p=p.parentNode}},_handleDOMEvent:function(p){var b=p.target||p.srcElement;if(!(!this._loaded||b._leaflet_disable_events||p.type==="click"&&this._isClickDisabled(b))){var T=p.type;T==="mousedown"&&ju(b),this._fireDOMEvent(p,T)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(p,b,T){if(p.type==="click"){var N=a({},p);N.type="preclick",this._fireDOMEvent(N,N.type,T)}var O=this._findEventTargets(p,b);if(T){for(var G=[],Y=0;Y0?Math.round(p-b)/2:Math.max(0,Math.ceil(p))-Math.max(0,Math.floor(b))},_limitZoom:function(p){var b=this.getMinZoom(),T=this.getMaxZoom(),N=$e.any3d?this.options.zoomSnap:1;return N&&(p=Math.round(p/N)*N),Math.max(b,Math.min(T,p))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Me(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(p,b){var T=this._getCenterOffset(p)._trunc();return(b&&b.animate)!==!0&&!this.getSize().contains(T)?!1:(this.panBy(T,b),!0)},_createAnimProxy:function(){var p=this._proxy=Ze("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(p),this.on("zoomanim",function(b){var T=Xh,N=this._proxy.style[T];Qi(this._proxy,this.project(b.center,b.zoom),this.getZoomScale(b.zoom,1)),N===this._proxy.style[T]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){mt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var p=this.getCenter(),b=this.getZoom();Qi(this._proxy,this.project(p,b),this.getZoomScale(b,1))},_catchTransitionEnd:function(p){this._animatingZoom&&p.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(p,b,T){if(this._animatingZoom)return!0;if(T=T||{},!this._zoomAnimated||T.animate===!1||this._nothingToAnimate()||Math.abs(b-this._zoom)>this.options.zoomAnimationThreshold)return!1;var N=this.getZoomScale(b),O=this._getCenterOffset(p)._divideBy(1-1/N);return T.animate!==!0&&!this.getSize().contains(O)?!1:(D(function(){this._moveStart(!0,T.noMoveStart||!1)._animateZoom(p,b,!0)},this),!0)},_animateZoom:function(p,b,T,N){this._mapPane&&(T&&(this._animatingZoom=!0,this._animateToCenter=p,this._animateToZoom=b,q(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:p,zoom:b,noUpdate:N}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(o(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Me(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function GZ(p,b){return new zt(p,b)}var Ti=B.extend({options:{position:"topright"},initialize:function(p){m(this,p)},getPosition:function(){return this.options.position},setPosition:function(p){var b=this._map;return b&&b.removeControl(this),this.options.position=p,b&&b.addControl(this),this},getContainer:function(){return this._container},addTo:function(p){this.remove(),this._map=p;var b=this._container=this.onAdd(p),T=this.getPosition(),N=p._controlCorners[T];return q(b,"leaflet-control"),T.indexOf("bottom")!==-1?N.insertBefore(b,N.firstChild):N.appendChild(b),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(mt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(p){this._map&&p&&p.screenX>0&&p.screenY>0&&this._map.getContainer().focus()}}),Dv=function(p){return new Ti(p)};zt.include({addControl:function(p){return p.addTo(this),this},removeControl:function(p){return p.remove(),this},_initControlPos:function(){var p=this._controlCorners={},b="leaflet-",T=this._controlContainer=Ze("div",b+"control-container",this._container);function N(O,G){var Y=b+O+" "+b+G;p[O+G]=Ze("div",Y,T)}N("top","left"),N("top","right"),N("bottom","left"),N("bottom","right")},_clearControlPos:function(){for(var p in this._controlCorners)mt(this._controlCorners[p]);mt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var BP=Ti.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(p,b,T,N){return T1,this._baseLayersList.style.display=p?"":"none"),this._separator.style.display=b&&p?"":"none",this},_onLayerChange:function(p){this._handlingClick||this._update();var b=this._getLayer(l(p.target)),T=b.overlay?p.type==="add"?"overlayadd":"overlayremove":p.type==="add"?"baselayerchange":null;T&&this._map.fire(T,b)},_createRadioElement:function(p,b){var T='",N=document.createElement("div");return N.innerHTML=T,N.firstChild},_addItem:function(p){var b=document.createElement("label"),T=this._map.hasLayer(p.layer),N;p.overlay?(N=document.createElement("input"),N.type="checkbox",N.className="leaflet-control-layers-selector",N.defaultChecked=T):N=this._createRadioElement("leaflet-base-layers_"+l(this),T),this._layerControlInputs.push(N),N.layerId=l(p.layer),Ie(N,"click",this._onInputClick,this);var O=document.createElement("span");O.innerHTML=" "+p.name;var G=document.createElement("span");b.appendChild(G),G.appendChild(N),G.appendChild(O);var Y=p.overlay?this._overlaysList:this._baseLayersList;return Y.appendChild(b),this._checkDisabledLayers(),b},_onInputClick:function(){if(!this._preventClick){var p=this._layerControlInputs,b,T,N=[],O=[];this._handlingClick=!0;for(var G=p.length-1;G>=0;G--)b=p[G],T=this._getLayer(b.layerId).layer,b.checked?N.push(T):b.checked||O.push(T);for(G=0;G=0;O--)b=p[O],T=this._getLayer(b.layerId).layer,b.disabled=T.options.minZoom!==void 0&&NT.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var p=this._section;this._preventClick=!0,Ie(p,"click",hn),this.expand();var b=this;setTimeout(function(){Wt(p,"click",hn),b._preventClick=!1})}}),HZ=function(p,b,T){return new BP(p,b,T)},Nw=Ti.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(p){var b="leaflet-control-zoom",T=Ze("div",b+" leaflet-bar"),N=this.options;return this._zoomInButton=this._createButton(N.zoomInText,N.zoomInTitle,b+"-in",T,this._zoomIn),this._zoomOutButton=this._createButton(N.zoomOutText,N.zoomOutTitle,b+"-out",T,this._zoomOut),this._updateDisabled(),p.on("zoomend zoomlevelschange",this._updateDisabled,this),T},onRemove:function(p){p.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(p){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(p.shiftKey?3:1))},_createButton:function(p,b,T,N,O){var G=Ze("a",T,N);return G.innerHTML=p,G.href="#",G.title=b,G.setAttribute("role","button"),G.setAttribute("aria-label",b),Pv(G),Ie(G,"click",Ru),Ie(G,"click",O,this),Ie(G,"click",this._refocusOnMap,this),G},_updateDisabled:function(){var p=this._map,b="leaflet-disabled";Me(this._zoomInButton,b),Me(this._zoomOutButton,b),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||p._zoom===p.getMinZoom())&&(q(this._zoomOutButton,b),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||p._zoom===p.getMaxZoom())&&(q(this._zoomInButton,b),this._zoomInButton.setAttribute("aria-disabled","true"))}});zt.mergeOptions({zoomControl:!0}),zt.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Nw,this.addControl(this.zoomControl))});var UZ=function(p){return new Nw(p)},FP=Ti.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(p){var b="leaflet-control-scale",T=Ze("div",b),N=this.options;return this._addScales(N,b+"-line",T),p.on(N.updateWhenIdle?"moveend":"move",this._update,this),p.whenReady(this._update,this),T},onRemove:function(p){p.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(p,b,T){p.metric&&(this._mScale=Ze("div",b,T)),p.imperial&&(this._iScale=Ze("div",b,T))},_update:function(){var p=this._map,b=p.getSize().y/2,T=p.distance(p.containerPointToLatLng([0,b]),p.containerPointToLatLng([this.options.maxWidth,b]));this._updateScales(T)},_updateScales:function(p){this.options.metric&&p&&this._updateMetric(p),this.options.imperial&&p&&this._updateImperial(p)},_updateMetric:function(p){var b=this._getRoundNum(p),T=b<1e3?b+" m":b/1e3+" km";this._updateScale(this._mScale,T,b/p)},_updateImperial:function(p){var b=p*3.2808399,T,N,O;b>5280?(T=b/5280,N=this._getRoundNum(T),this._updateScale(this._iScale,N+" mi",N/T)):(O=this._getRoundNum(b),this._updateScale(this._iScale,O+" ft",O/b))},_updateScale:function(p,b,T){p.style.width=Math.round(this.options.maxWidth*T)+"px",p.innerHTML=b},_getRoundNum:function(p){var b=Math.pow(10,(Math.floor(p)+"").length-1),T=p/b;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:1,b*T}}),WZ=function(p){return new FP(p)},$Z='',kw=Ti.extend({options:{position:"bottomright",prefix:''+($e.inlineSvg?$Z+" ":"")+"Leaflet"},initialize:function(p){m(this,p),this._attributions={}},onAdd:function(p){p.attributionControl=this,this._container=Ze("div","leaflet-control-attribution"),Pv(this._container);for(var b in p._layers)p._layers[b].getAttribution&&this.addAttribution(p._layers[b].getAttribution());return this._update(),p.on("layeradd",this._addAttribution,this),this._container},onRemove:function(p){p.off("layeradd",this._addAttribution,this)},_addAttribution:function(p){p.layer.getAttribution&&(this.addAttribution(p.layer.getAttribution()),p.layer.once("remove",function(){this.removeAttribution(p.layer.getAttribution())},this))},setPrefix:function(p){return this.options.prefix=p,this._update(),this},addAttribution:function(p){return p?(this._attributions[p]||(this._attributions[p]=0),this._attributions[p]++,this._update(),this):this},removeAttribution:function(p){return p?(this._attributions[p]&&(this._attributions[p]--,this._update()),this):this},_update:function(){if(this._map){var p=[];for(var b in this._attributions)this._attributions[b]&&p.push(b);var T=[];this.options.prefix&&T.push(this.options.prefix),p.length&&T.push(p.join(", ")),this._container.innerHTML=T.join(' ')}}});zt.mergeOptions({attributionControl:!0}),zt.addInitHook(function(){this.options.attributionControl&&new kw().addTo(this)});var ZZ=function(p){return new kw(p)};Ti.Layers=BP,Ti.Zoom=Nw,Ti.Scale=FP,Ti.Attribution=kw,Dv.layers=HZ,Dv.zoom=UZ,Dv.scale=WZ,Dv.attribution=ZZ;var ro=B.extend({initialize:function(p){this._map=p},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});ro.addTo=function(p,b){return p.addHandler(b,this),this};var YZ={Events:V},VP=$e.touch?"touchstart mousedown":"mousedown",sl=U.extend({options:{clickTolerance:3},initialize:function(p,b,T,N){m(this,N),this._element=p,this._dragStartTarget=b||p,this._preventOutline=T},enable:function(){this._enabled||(Ie(this._dragStartTarget,VP,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(sl._dragging===this&&this.finishDrag(!0),Wt(this._dragStartTarget,VP,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(p){if(this._enabled&&(this._moved=!1,!An(this._element,"leaflet-zoom-anim"))){if(p.touches&&p.touches.length!==1){sl._dragging===this&&this.finishDrag();return}if(!(sl._dragging||p.shiftKey||p.which!==1&&p.button!==1&&!p.touches)&&(sl._dragging=this,this._preventOutline&&ju(this._element),Kh(),al(),!this._moving)){this.fire("down");var b=p.touches?p.touches[0]:p,T=to(this._element);this._startPoint=new F(b.clientX,b.clientY),this._startPos=eo(this._element),this._parentScale=Vt(T);var N=p.type==="mousedown";Ie(document,N?"mousemove":"touchmove",this._onMove,this),Ie(document,N?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(p){if(this._enabled){if(p.touches&&p.touches.length>1){this._moved=!0;return}var b=p.touches&&p.touches.length===1?p.touches[0]:p,T=new F(b.clientX,b.clientY)._subtract(this._startPoint);!T.x&&!T.y||Math.abs(T.x)+Math.abs(T.y)G&&(Y=ee,G=ie);G>T&&(b[Y]=1,Iw(p,b,T,N,Y),Iw(p,b,T,Y,O))}function JZ(p,b){for(var T=[p[0]],N=1,O=0,G=p.length;Nb&&(T.push(p[N]),O=N);return Ob.max.x&&(T|=2),p.yb.max.y&&(T|=8),T}function QZ(p,b){var T=b.x-p.x,N=b.y-p.y;return T*T+N*N}function jv(p,b,T,N){var O=b.x,G=b.y,Y=T.x-O,ee=T.y-G,ie=Y*Y+ee*ee,pe;return ie>0&&(pe=((p.x-O)*Y+(p.y-G)*ee)/ie,pe>1?(O=T.x,G=T.y):pe>0&&(O+=Y*pe,G+=ee*pe)),Y=p.x-O,ee=p.y-G,N?Y*Y+ee*ee:new F(O,G)}function Ha(p){return!w(p[0])||typeof p[0][0]!="object"&&typeof p[0][0]<"u"}function YP(p){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ha(p)}function XP(p,b){var T,N,O,G,Y,ee,ie,pe;if(!p||p.length===0)throw new Error("latlngs not passed");Ha(p)||(console.warn("latlngs are not flat! Only the first ring will be used"),p=p[0]);var ze=de([0,0]),ft=Q(p),kt=ft.getNorthWest().distanceTo(ft.getSouthWest())*ft.getNorthEast().distanceTo(ft.getNorthWest());kt<1700&&(ze=Lw(p));var Un=p.length,en=[];for(T=0;TN){ie=(G-N)/O,pe=[ee.x-ie*(ee.x-Y.x),ee.y-ie*(ee.y-Y.y)];break}var oa=b.unproject($(pe));return de([oa.lat+ze.lat,oa.lng+ze.lng])}var eY={__proto__:null,simplify:UP,pointToSegmentDistance:WP,closestPointOnSegment:qZ,clipSegment:ZP,_getEdgeIntersection:fy,_getBitCode:Ou,_sqClosestPointOnSegment:jv,isFlat:Ha,_flat:YP,polylineCenter:XP},Pw={project:function(p){return new F(p.lng,p.lat)},unproject:function(p){return new le(p.y,p.x)},bounds:new Z([-180,-90],[180,90])},Dw={R:6378137,R_MINOR:6356752314245179e-9,bounds:new Z([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(p){var b=Math.PI/180,T=this.R,N=p.lat*b,O=this.R_MINOR/T,G=Math.sqrt(1-O*O),Y=G*Math.sin(N),ee=Math.tan(Math.PI/4-N/2)/Math.pow((1-Y)/(1+Y),G/2);return N=-T*Math.log(Math.max(ee,1e-10)),new F(p.lng*b*T,N)},unproject:function(p){for(var b=180/Math.PI,T=this.R,N=this.R_MINOR/T,O=Math.sqrt(1-N*N),G=Math.exp(-p.y/T),Y=Math.PI/2-2*Math.atan(G),ee=0,ie=.1,pe;ee<15&&Math.abs(ie)>1e-7;ee++)pe=O*Math.sin(Y),pe=Math.pow((1-pe)/(1+pe),O/2),ie=Math.PI/2-2*Math.atan(G*pe)-Y,Y+=ie;return new le(Y*b,p.x*b/T)}},tY={__proto__:null,LonLat:Pw,Mercator:Dw,SphericalMercator:xe},rY=a({},ye,{code:"EPSG:3395",projection:Dw,transformation:function(){var p=.5/(Math.PI*Dw.R);return ge(p,.5,-p,.5)}()}),qP=a({},ye,{code:"EPSG:4326",projection:Pw,transformation:ge(1/180,1,-1/180,.5)}),nY=a({},He,{projection:Pw,transformation:ge(1,0,-1,0),scale:function(p){return Math.pow(2,p)},zoom:function(p){return Math.log(p)/Math.LN2},distance:function(p,b){var T=b.lng-p.lng,N=b.lat-p.lat;return Math.sqrt(T*T+N*N)},infinite:!0});He.Earth=ye,He.EPSG3395=rY,He.EPSG3857=tt,He.EPSG900913=Ue,He.EPSG4326=qP,He.Simple=nY;var Mi=U.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(p){return p.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(p){return p&&p.removeLayer(this),this},getPane:function(p){return this._map.getPane(p?this.options[p]||p:this.options.pane)},addInteractiveTarget:function(p){return this._map._targets[l(p)]=this,this},removeInteractiveTarget:function(p){return delete this._map._targets[l(p)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(p){var b=p.target;if(b.hasLayer(this)){if(this._map=b,this._zoomAnimated=b._zoomAnimated,this.getEvents){var T=this.getEvents();b.on(T,this),this.once("remove",function(){b.off(T,this)},this)}this.onAdd(b),this.fire("add"),b.fire("layeradd",{layer:this})}}});zt.include({addLayer:function(p){if(!p._layerAdd)throw new Error("The provided object is not a Layer.");var b=l(p);return this._layers[b]?this:(this._layers[b]=p,p._mapToAdd=this,p.beforeAdd&&p.beforeAdd(this),this.whenReady(p._layerAdd,p),this)},removeLayer:function(p){var b=l(p);return this._layers[b]?(this._loaded&&p.onRemove(this),delete this._layers[b],this._loaded&&(this.fire("layerremove",{layer:p}),p.fire("remove")),p._map=p._mapToAdd=null,this):this},hasLayer:function(p){return l(p)in this._layers},eachLayer:function(p,b){for(var T in this._layers)p.call(b,this._layers[T]);return this},_addLayers:function(p){p=p?w(p)?p:[p]:[];for(var b=0,T=p.length;bthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&b[0]instanceof le&&b[0].equals(b[T-1])&&b.pop(),b},_setLatLngs:function(p){ls.prototype._setLatLngs.call(this,p),Ha(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ha(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var p=this._renderer._bounds,b=this.options.weight,T=new F(b,b);if(p=new Z(p.min.subtract(T),p.max.add(T)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(p))){if(this.options.noClip){this._parts=this._rings;return}for(var N=0,O=this._rings.length,G;Np.y!=O.y>p.y&&p.x<(O.x-N.x)*(p.y-N.y)/(O.y-N.y)+N.x&&(b=!b);return b||ls.prototype._containsPoint.call(this,p,!0)}});function hY(p,b){return new rd(p,b)}var us=ss.extend({initialize:function(p,b){m(this,b),this._layers={},p&&this.addData(p)},addData:function(p){var b=w(p)?p:p.features,T,N,O;if(b){for(T=0,N=b.length;T0&&O.push(O[0].slice()),O}function nd(p,b){return p.feature?a({},p.feature,{geometry:b}):xy(b)}function xy(p){return p.type==="Feature"||p.type==="FeatureCollection"?p:{type:"Feature",properties:{},geometry:p}}var Ow={toGeoJSON:function(p){return nd(this,{type:"Point",coordinates:Rw(this.getLatLng(),p)})}};vy.include(Ow),jw.include(Ow),py.include(Ow),ls.include({toGeoJSON:function(p){var b=!Ha(this._latlngs),T=yy(this._latlngs,b?1:0,!1,p);return nd(this,{type:(b?"Multi":"")+"LineString",coordinates:T})}}),rd.include({toGeoJSON:function(p){var b=!Ha(this._latlngs),T=b&&!Ha(this._latlngs[0]),N=yy(this._latlngs,T?2:b?1:0,!0,p);return b||(N=[N]),nd(this,{type:(T?"Multi":"")+"Polygon",coordinates:N})}}),ed.include({toMultiPoint:function(p){var b=[];return this.eachLayer(function(T){b.push(T.toGeoJSON(p).geometry.coordinates)}),nd(this,{type:"MultiPoint",coordinates:b})},toGeoJSON:function(p){var b=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(b==="MultiPoint")return this.toMultiPoint(p);var T=b==="GeometryCollection",N=[];return this.eachLayer(function(O){if(O.toGeoJSON){var G=O.toGeoJSON(p);if(T)N.push(G.geometry);else{var Y=xy(G);Y.type==="FeatureCollection"?N.push.apply(N,Y.features):N.push(Y)}}}),T?nd(this,{geometries:N,type:"GeometryCollection"}):{type:"FeatureCollection",features:N}}});function QP(p,b){return new us(p,b)}var dY=QP,_y=Mi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(p,b,T){this._url=p,this._bounds=Q(b),m(this,T)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(q(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){mt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(p){return this.options.opacity=p,this._image&&this._updateOpacity(),this},setStyle:function(p){return p.opacity&&this.setOpacity(p.opacity),this},bringToFront:function(){return this._map&&ia(this._image),this},bringToBack:function(){return this._map&&cn(this._image),this},setUrl:function(p){return this._url=p,this._image&&(this._image.src=p),this},setBounds:function(p){return this._bounds=Q(p),this._map&&this._reset(),this},getEvents:function(){var p={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(p.zoomanim=this._animateZoom),p},setZIndex:function(p){return this.options.zIndex=p,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var p=this._url.tagName==="IMG",b=this._image=p?this._url:Ze("img");if(q(b,"leaflet-image-layer"),this._zoomAnimated&&q(b,"leaflet-zoom-animated"),this.options.className&&q(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onload=o(this.fire,this,"load"),b.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),p){this._url=b.src;return}b.src=this._url,b.alt=this.options.alt},_animateZoom:function(p){var b=this._map.getZoomScale(p.zoom),T=this._map._latLngBoundsToNewLayerBounds(this._bounds,p.zoom,p.center).min;Qi(this._image,T,b)},_reset:function(){var p=this._image,b=new Z(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),T=b.getSize();gr(p,b.min),p.style.width=T.x+"px",p.style.height=T.y+"px"},_updateOpacity:function(){dt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var p=this.options.errorOverlayUrl;p&&this._url!==p&&(this._url=p,this._image.src=p)},getCenter:function(){return this._bounds.getCenter()}}),fY=function(p,b,T){return new _y(p,b,T)},eD=_y.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var p=this._url.tagName==="VIDEO",b=this._image=p?this._url:Ze("video");if(q(b,"leaflet-image-layer"),this._zoomAnimated&&q(b,"leaflet-zoom-animated"),this.options.className&&q(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onloadeddata=o(this.fire,this,"load"),p){for(var T=b.getElementsByTagName("source"),N=[],O=0;O0?N:[b.src];return}w(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(b.style,"objectFit")&&(b.style.objectFit="fill"),b.autoplay=!!this.options.autoplay,b.loop=!!this.options.loop,b.muted=!!this.options.muted,b.playsInline=!!this.options.playsInline;for(var G=0;GO?(b.height=O+"px",q(p,G)):Me(p,G),this._containerWidth=this._container.offsetWidth},_animateZoom:function(p){var b=this._map._latLngToNewLayerPoint(this._latlng,p.zoom,p.center),T=this._getAnchor();gr(this._container,b.add(T))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var p=this._map,b=parseInt(ut(this._container,"marginBottom"),10)||0,T=this._container.offsetHeight+b,N=this._containerWidth,O=new F(this._containerLeft,-T-this._containerBottom);O._add(eo(this._container));var G=p.layerPointToContainerPoint(O),Y=$(this.options.autoPanPadding),ee=$(this.options.autoPanPaddingTopLeft||Y),ie=$(this.options.autoPanPaddingBottomRight||Y),pe=p.getSize(),ze=0,ft=0;G.x+N+ie.x>pe.x&&(ze=G.x+N-pe.x+ie.x),G.x-ze-ee.x<0&&(ze=G.x-ee.x),G.y+T+ie.y>pe.y&&(ft=G.y+T-pe.y+ie.y),G.y-ft-ee.y<0&&(ft=G.y-ee.y),(ze||ft)&&(this.options.keepInView&&(this._autopanning=!0),p.fire("autopanstart").panBy([ze,ft]))}},_getAnchor:function(){return $(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),gY=function(p,b){return new by(p,b)};zt.mergeOptions({closePopupOnClick:!0}),zt.include({openPopup:function(p,b,T){return this._initOverlay(by,p,b,T).openOn(this),this},closePopup:function(p){return p=arguments.length?p:this._popup,p&&p.close(),this}}),Mi.include({bindPopup:function(p,b){return this._popup=this._initOverlay(by,this._popup,p,b),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(p){return this._popup&&(this instanceof ss||(this._popup._source=this),this._popup._prepareOpen(p||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(p){return this._popup&&this._popup.setContent(p),this},getPopup:function(){return this._popup},_openPopup:function(p){if(!(!this._popup||!this._map)){Ru(p);var b=p.layer||p.target;if(this._popup._source===b&&!(b instanceof ll)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(p.latlng);return}this._popup._source=b,this.openPopup(p.latlng)}},_movePopup:function(p){this._popup.setLatLng(p.latlng)},_onKeyPress:function(p){p.originalEvent.keyCode===13&&this._openPopup(p)}});var wy=no.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(p){no.prototype.onAdd.call(this,p),this.setOpacity(this.options.opacity),p.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(p){no.prototype.onRemove.call(this,p),p.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var p=no.prototype.getEvents.call(this);return this.options.permanent||(p.preclick=this.close),p},_initLayout:function(){var p="leaflet-tooltip",b=p+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=Ze("div",b),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+l(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(p){var b,T,N=this._map,O=this._container,G=N.latLngToContainerPoint(N.getCenter()),Y=N.layerPointToContainerPoint(p),ee=this.options.direction,ie=O.offsetWidth,pe=O.offsetHeight,ze=$(this.options.offset),ft=this._getAnchor();ee==="top"?(b=ie/2,T=pe):ee==="bottom"?(b=ie/2,T=0):ee==="center"?(b=ie/2,T=pe/2):ee==="right"?(b=0,T=pe/2):ee==="left"?(b=ie,T=pe/2):Y.xthis.options.maxZoom||TN?this._retainParent(O,G,Y,N):!1)},_retainChildren:function(p,b,T,N){for(var O=2*p;O<2*p+2;O++)for(var G=2*b;G<2*b+2;G++){var Y=new F(O,G);Y.z=T+1;var ee=this._tileCoordsToKey(Y),ie=this._tiles[ee];if(ie&&ie.active){ie.retain=!0;continue}else ie&&ie.loaded&&(ie.retain=!0);T+1this.options.maxZoom||this.options.minZoom!==void 0&&O1){this._setView(p,T);return}for(var ft=O.min.y;ft<=O.max.y;ft++)for(var kt=O.min.x;kt<=O.max.x;kt++){var Un=new F(kt,ft);if(Un.z=this._tileZoom,!!this._isValidTile(Un)){var en=this._tiles[this._tileCoordsToKey(Un)];en?en.current=!0:Y.push(Un)}}if(Y.sort(function(oa,id){return oa.distanceTo(G)-id.distanceTo(G)}),Y.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Ua=document.createDocumentFragment();for(kt=0;ktT.max.x)||!b.wrapLat&&(p.yT.max.y))return!1}if(!this.options.bounds)return!0;var N=this._tileCoordsToBounds(p);return Q(this.options.bounds).overlaps(N)},_keyToBounds:function(p){return this._tileCoordsToBounds(this._keyToTileCoords(p))},_tileCoordsToNwSe:function(p){var b=this._map,T=this.getTileSize(),N=p.scaleBy(T),O=N.add(T),G=b.unproject(N,p.z),Y=b.unproject(O,p.z);return[G,Y]},_tileCoordsToBounds:function(p){var b=this._tileCoordsToNwSe(p),T=new re(b[0],b[1]);return this.options.noWrap||(T=this._map.wrapLatLngBounds(T)),T},_tileCoordsToKey:function(p){return p.x+":"+p.y+":"+p.z},_keyToTileCoords:function(p){var b=p.split(":"),T=new F(+b[0],+b[1]);return T.z=+b[2],T},_removeTile:function(p){var b=this._tiles[p];b&&(mt(b.el),delete this._tiles[p],this.fire("tileunload",{tile:b.el,coords:this._keyToTileCoords(p)}))},_initTile:function(p){q(p,"leaflet-tile");var b=this.getTileSize();p.style.width=b.x+"px",p.style.height=b.y+"px",p.onselectstart=h,p.onmousemove=h,$e.ielt9&&this.options.opacity<1&&dt(p,this.options.opacity)},_addTile:function(p,b){var T=this._getTilePos(p),N=this._tileCoordsToKey(p),O=this.createTile(this._wrapCoords(p),o(this._tileReady,this,p));this._initTile(O),this.createTile.length<2&&D(o(this._tileReady,this,p,null,O)),gr(O,T),this._tiles[N]={el:O,coords:p,current:!0},b.appendChild(O),this.fire("tileloadstart",{tile:O,coords:p})},_tileReady:function(p,b,T){b&&this.fire("tileerror",{error:b,tile:T,coords:p});var N=this._tileCoordsToKey(p);T=this._tiles[N],T&&(T.loaded=+new Date,this._map._fadeAnimated?(dt(T.el,0),z(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this)):(T.active=!0,this._pruneTiles()),b||(q(T.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:T.el,coords:p})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),$e.ielt9||!this._map._fadeAnimated?D(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(p){return p.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(p){var b=new F(this._wrapX?c(p.x,this._wrapX):p.x,this._wrapY?c(p.y,this._wrapY):p.y);return b.z=p.z,b},_pxBoundsToTileRange:function(p){var b=this.getTileSize();return new Z(p.min.unscaleBy(b).floor(),p.max.unscaleBy(b).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var p in this._tiles)if(!this._tiles[p].loaded)return!1;return!0}});function xY(p){return new Rv(p)}var ad=Rv.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(p,b){this._url=p,b=m(this,b),b.detectRetina&&$e.retina&&b.maxZoom>0?(b.tileSize=Math.floor(b.tileSize/2),b.zoomReverse?(b.zoomOffset--,b.minZoom=Math.min(b.maxZoom,b.minZoom+1)):(b.zoomOffset++,b.maxZoom=Math.max(b.minZoom,b.maxZoom-1)),b.minZoom=Math.max(0,b.minZoom)):b.zoomReverse?b.minZoom=Math.min(b.maxZoom,b.minZoom):b.maxZoom=Math.max(b.minZoom,b.maxZoom),typeof b.subdomains=="string"&&(b.subdomains=b.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(p,b){return this._url===p&&b===void 0&&(b=!0),this._url=p,b||this.redraw(),this},createTile:function(p,b){var T=document.createElement("img");return Ie(T,"load",o(this._tileOnLoad,this,b,T)),Ie(T,"error",o(this._tileOnError,this,b,T)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(T.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(T.referrerPolicy=this.options.referrerPolicy),T.alt="",T.src=this.getTileUrl(p),T},getTileUrl:function(p){var b={r:$e.retina?"@2x":"",s:this._getSubdomain(p),x:p.x,y:p.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var T=this._globalTileRange.max.y-p.y;this.options.tms&&(b.y=T),b["-y"]=T}return _(this._url,a(b,this.options))},_tileOnLoad:function(p,b){$e.ielt9?setTimeout(o(p,this,null,b),0):p(null,b)},_tileOnError:function(p,b,T){var N=this.options.errorTileUrl;N&&b.getAttribute("src")!==N&&(b.src=N),p(T,b)},_onTileRemove:function(p){p.tile.onload=null},_getZoomForUrl:function(){var p=this._tileZoom,b=this.options.maxZoom,T=this.options.zoomReverse,N=this.options.zoomOffset;return T&&(p=b-p),p+N},_getSubdomain:function(p){var b=Math.abs(p.x+p.y)%this.options.subdomains.length;return this.options.subdomains[b]},_abortLoading:function(){var p,b;for(p in this._tiles)if(this._tiles[p].coords.z!==this._tileZoom&&(b=this._tiles[p].el,b.onload=h,b.onerror=h,!b.complete)){b.src=C;var T=this._tiles[p].coords;mt(b),delete this._tiles[p],this.fire("tileabort",{tile:b,coords:T})}},_removeTile:function(p){var b=this._tiles[p];if(b)return b.el.setAttribute("src",C),Rv.prototype._removeTile.call(this,p)},_tileReady:function(p,b,T){if(!(!this._map||T&&T.getAttribute("src")===C))return Rv.prototype._tileReady.call(this,p,b,T)}});function nD(p,b){return new ad(p,b)}var aD=ad.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(p,b){this._url=p;var T=a({},this.defaultWmsParams);for(var N in b)N in this.options||(T[N]=b[N]);b=m(this,b);var O=b.detectRetina&&$e.retina?2:1,G=this.getTileSize();T.width=G.x*O,T.height=G.y*O,this.wmsParams=T},onAdd:function(p){this._crs=this.options.crs||p.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var b=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[b]=this._crs.code,ad.prototype.onAdd.call(this,p)},getTileUrl:function(p){var b=this._tileCoordsToNwSe(p),T=this._crs,N=J(T.project(b[0]),T.project(b[1])),O=N.min,G=N.max,Y=(this._wmsVersion>=1.3&&this._crs===qP?[O.y,O.x,G.y,G.x]:[O.x,O.y,G.x,G.y]).join(","),ee=ad.prototype.getTileUrl.call(this,p);return ee+y(this.wmsParams,ee,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+Y},setParams:function(p,b){return a(this.wmsParams,p),b||this.redraw(),this}});function _Y(p,b){return new aD(p,b)}ad.WMS=aD,nD.wms=_Y;var cs=Mi.extend({options:{padding:.1},initialize:function(p){m(this,p),l(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),q(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var p={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(p.zoomanim=this._onAnimZoom),p},_onAnimZoom:function(p){this._updateTransform(p.center,p.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(p,b){var T=this._map.getZoomScale(b,this._zoom),N=this._map.getSize().multiplyBy(.5+this.options.padding),O=this._map.project(this._center,b),G=N.multiplyBy(-T).add(O).subtract(this._map._getNewPixelOrigin(p,b));$e.any3d?Qi(this._container,G,T):gr(this._container,G)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var p in this._layers)this._layers[p]._reset()},_onZoomEnd:function(){for(var p in this._layers)this._layers[p]._project()},_updatePaths:function(){for(var p in this._layers)this._layers[p]._update()},_update:function(){var p=this.options.padding,b=this._map.getSize(),T=this._map.containerPointToLayerPoint(b.multiplyBy(-p)).round();this._bounds=new Z(T,T.add(b.multiplyBy(1+p*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),iD=cs.extend({options:{tolerance:0},getEvents:function(){var p=cs.prototype.getEvents.call(this);return p.viewprereset=this._onViewPreReset,p},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){cs.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var p=this._container=document.createElement("canvas");Ie(p,"mousemove",this._onMouseMove,this),Ie(p,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ie(p,"mouseout",this._handleMouseOut,this),p._leaflet_disable_events=!0,this._ctx=p.getContext("2d")},_destroyContainer:function(){z(this._redrawRequest),delete this._ctx,mt(this._container),Wt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var p;this._redrawBounds=null;for(var b in this._layers)p=this._layers[b],p._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){cs.prototype._update.call(this);var p=this._bounds,b=this._container,T=p.getSize(),N=$e.retina?2:1;gr(b,p.min),b.width=N*T.x,b.height=N*T.y,b.style.width=T.x+"px",b.style.height=T.y+"px",$e.retina&&this._ctx.scale(2,2),this._ctx.translate(-p.min.x,-p.min.y),this.fire("update")}},_reset:function(){cs.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(p){this._updateDashArray(p),this._layers[l(p)]=p;var b=p._order={layer:p,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=b),this._drawLast=b,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(p){this._requestRedraw(p)},_removePath:function(p){var b=p._order,T=b.next,N=b.prev;T?T.prev=N:this._drawLast=N,N?N.next=T:this._drawFirst=T,delete p._order,delete this._layers[l(p)],this._requestRedraw(p)},_updatePath:function(p){this._extendRedrawBounds(p),p._project(),p._update(),this._requestRedraw(p)},_updateStyle:function(p){this._updateDashArray(p),this._requestRedraw(p)},_updateDashArray:function(p){if(typeof p.options.dashArray=="string"){var b=p.options.dashArray.split(/[, ]+/),T=[],N,O;for(O=0;O')}}catch{}return function(p){return document.createElement("<"+p+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),bY={_initContainer:function(){this._container=Ze("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(cs.prototype._update.call(this),this.fire("update"))},_initPath:function(p){var b=p._container=Ov("shape");q(b,"leaflet-vml-shape "+(this.options.className||"")),b.coordsize="1 1",p._path=Ov("path"),b.appendChild(p._path),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){var b=p._container;this._container.appendChild(b),p.options.interactive&&p.addInteractiveTarget(b)},_removePath:function(p){var b=p._container;mt(b),p.removeInteractiveTarget(b),delete this._layers[l(p)]},_updateStyle:function(p){var b=p._stroke,T=p._fill,N=p.options,O=p._container;O.stroked=!!N.stroke,O.filled=!!N.fill,N.stroke?(b||(b=p._stroke=Ov("stroke")),O.appendChild(b),b.weight=N.weight+"px",b.color=N.color,b.opacity=N.opacity,N.dashArray?b.dashStyle=w(N.dashArray)?N.dashArray.join(" "):N.dashArray.replace(/( *, *)/g," "):b.dashStyle="",b.endcap=N.lineCap.replace("butt","flat"),b.joinstyle=N.lineJoin):b&&(O.removeChild(b),p._stroke=null),N.fill?(T||(T=p._fill=Ov("fill")),O.appendChild(T),T.color=N.fillColor||N.color,T.opacity=N.fillOpacity):T&&(O.removeChild(T),p._fill=null)},_updateCircle:function(p){var b=p._point.round(),T=Math.round(p._radius),N=Math.round(p._radiusY||T);this._setPath(p,p._empty()?"M0 0":"AL "+b.x+","+b.y+" "+T+","+N+" 0,"+65535*360)},_setPath:function(p,b){p._path.v=b},_bringToFront:function(p){ia(p._container)},_bringToBack:function(p){cn(p._container)}},Sy=$e.vml?Ov:qe,zv=cs.extend({_initContainer:function(){this._container=Sy("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Sy("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){mt(this._container),Wt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){cs.prototype._update.call(this);var p=this._bounds,b=p.getSize(),T=this._container;(!this._svgSize||!this._svgSize.equals(b))&&(this._svgSize=b,T.setAttribute("width",b.x),T.setAttribute("height",b.y)),gr(T,p.min),T.setAttribute("viewBox",[p.min.x,p.min.y,b.x,b.y].join(" ")),this.fire("update")}},_initPath:function(p){var b=p._path=Sy("path");p.options.className&&q(b,p.options.className),p.options.interactive&&q(b,"leaflet-interactive"),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(p._path),p.addInteractiveTarget(p._path)},_removePath:function(p){mt(p._path),p.removeInteractiveTarget(p._path),delete this._layers[l(p)]},_updatePath:function(p){p._project(),p._update()},_updateStyle:function(p){var b=p._path,T=p.options;b&&(T.stroke?(b.setAttribute("stroke",T.color),b.setAttribute("stroke-opacity",T.opacity),b.setAttribute("stroke-width",T.weight),b.setAttribute("stroke-linecap",T.lineCap),b.setAttribute("stroke-linejoin",T.lineJoin),T.dashArray?b.setAttribute("stroke-dasharray",T.dashArray):b.removeAttribute("stroke-dasharray"),T.dashOffset?b.setAttribute("stroke-dashoffset",T.dashOffset):b.removeAttribute("stroke-dashoffset")):b.setAttribute("stroke","none"),T.fill?(b.setAttribute("fill",T.fillColor||T.color),b.setAttribute("fill-opacity",T.fillOpacity),b.setAttribute("fill-rule",T.fillRule||"evenodd")):b.setAttribute("fill","none"))},_updatePoly:function(p,b){this._setPath(p,Fe(p._parts,b))},_updateCircle:function(p){var b=p._point,T=Math.max(Math.round(p._radius),1),N=Math.max(Math.round(p._radiusY),1)||T,O="a"+T+","+N+" 0 1,0 ",G=p._empty()?"M0 0":"M"+(b.x-T)+","+b.y+O+T*2+",0 "+O+-T*2+",0 ";this._setPath(p,G)},_setPath:function(p,b){p._path.setAttribute("d",b)},_bringToFront:function(p){ia(p._path)},_bringToBack:function(p){cn(p._path)}});$e.vml&&zv.include(bY);function sD(p){return $e.svg||$e.vml?new zv(p):null}zt.include({getRenderer:function(p){var b=p.options.renderer||this._getPaneRenderer(p.options.pane)||this.options.renderer||this._renderer;return b||(b=this._renderer=this._createRenderer()),this.hasLayer(b)||this.addLayer(b),b},_getPaneRenderer:function(p){if(p==="overlayPane"||p===void 0)return!1;var b=this._paneRenderers[p];return b===void 0&&(b=this._createRenderer({pane:p}),this._paneRenderers[p]=b),b},_createRenderer:function(p){return this.options.preferCanvas&&oD(p)||sD(p)}});var lD=rd.extend({initialize:function(p,b){rd.prototype.initialize.call(this,this._boundsToLatLngs(p),b)},setBounds:function(p){return this.setLatLngs(this._boundsToLatLngs(p))},_boundsToLatLngs:function(p){return p=Q(p),[p.getSouthWest(),p.getNorthWest(),p.getNorthEast(),p.getSouthEast()]}});function wY(p,b){return new lD(p,b)}zv.create=Sy,zv.pointsToPath=Fe,us.geometryToLayer=gy,us.coordsToLatLng=Ew,us.coordsToLatLngs=my,us.latLngToCoords=Rw,us.latLngsToCoords=yy,us.getFeature=nd,us.asFeature=xy,zt.mergeOptions({boxZoom:!0});var uD=ro.extend({initialize:function(p){this._map=p,this._container=p._container,this._pane=p._panes.overlayPane,this._resetStateTimeout=0,p.on("unload",this._destroy,this)},addHooks:function(){Ie(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Wt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){mt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(p){if(!p.shiftKey||p.which!==1&&p.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),al(),Kh(),this._startPoint=this._map.mouseEventToContainerPoint(p),Ie(document,{contextmenu:Ru,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(p){this._moved||(this._moved=!0,this._box=Ze("div","leaflet-zoom-box",this._container),q(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(p);var b=new Z(this._point,this._startPoint),T=b.getSize();gr(this._box,b.min),this._box.style.width=T.x+"px",this._box.style.height=T.y+"px"},_finish:function(){this._moved&&(mt(this._box),Me(this._container,"leaflet-crosshair")),il(),Jh(),Wt(document,{contextmenu:Ru,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(p){if(!(p.which!==1&&p.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var b=new re(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(b).fire("boxzoomend",{boxZoomBounds:b})}},_onKeyDown:function(p){p.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});zt.addInitHook("addHandler","boxZoom",uD),zt.mergeOptions({doubleClickZoom:!0});var cD=ro.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(p){var b=this._map,T=b.getZoom(),N=b.options.zoomDelta,O=p.originalEvent.shiftKey?T-N:T+N;b.options.doubleClickZoom==="center"?b.setZoom(O):b.setZoomAround(p.containerPoint,O)}});zt.addInitHook("addHandler","doubleClickZoom",cD),zt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var hD=ro.extend({addHooks:function(){if(!this._draggable){var p=this._map;this._draggable=new sl(p._mapPane,p._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),p.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),p.on("zoomend",this._onZoomEnd,this),p.whenReady(this._onZoomEnd,this))}q(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Me(this._map._container,"leaflet-grab"),Me(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var p=this._map;if(p._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var b=Q(this._map.options.maxBounds);this._offsetLimit=J(this._map.latLngToContainerPoint(b.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(b.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;p.fire("movestart").fire("dragstart"),p.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(p){if(this._map.options.inertia){var b=this._lastTime=+new Date,T=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(T),this._times.push(b),this._prunePositions(b)}this._map.fire("move",p).fire("drag",p)},_prunePositions:function(p){for(;this._positions.length>1&&p-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var p=this._map.getSize().divideBy(2),b=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=b.subtract(p).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(p,b){return p-(p-b)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var p=this._draggable._newPos.subtract(this._draggable._startPos),b=this._offsetLimit;p.xb.max.x&&(p.x=this._viscousLimit(p.x,b.max.x)),p.y>b.max.y&&(p.y=this._viscousLimit(p.y,b.max.y)),this._draggable._newPos=this._draggable._startPos.add(p)}},_onPreDragWrap:function(){var p=this._worldWidth,b=Math.round(p/2),T=this._initialWorldOffset,N=this._draggable._newPos.x,O=(N-b+T)%p+b-T,G=(N+b+T)%p-b-T,Y=Math.abs(O+T)0?G:-G))-b;this._delta=0,this._startTime=null,Y&&(p.options.scrollWheelZoom==="center"?p.setZoom(b+Y):p.setZoomAround(this._lastMousePos,b+Y))}});zt.addInitHook("addHandler","scrollWheelZoom",fD);var SY=600;zt.mergeOptions({tapHold:$e.touchNative&&$e.safari&&$e.mobile,tapTolerance:15});var vD=ro.extend({addHooks:function(){Ie(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Wt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(p){if(clearTimeout(this._holdTimeout),p.touches.length===1){var b=p.touches[0];this._startPos=this._newPos=new F(b.clientX,b.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(Ie(document,"touchend",hn),Ie(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",b))},this),SY),Ie(document,"touchend touchcancel contextmenu",this._cancel,this),Ie(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function p(){Wt(document,"touchend",hn),Wt(document,"touchend touchcancel",p)},_cancel:function(){clearTimeout(this._holdTimeout),Wt(document,"touchend touchcancel contextmenu",this._cancel,this),Wt(document,"touchmove",this._onMove,this)},_onMove:function(p){var b=p.touches[0];this._newPos=new F(b.clientX,b.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(p,b){var T=new MouseEvent(p,{bubbles:!0,cancelable:!0,view:window,screenX:b.screenX,screenY:b.screenY,clientX:b.clientX,clientY:b.clientY});T._simulated=!0,b.target.dispatchEvent(T)}});zt.addInitHook("addHandler","tapHold",vD),zt.mergeOptions({touchZoom:$e.touch,bounceAtZoomLimits:!0});var pD=ro.extend({addHooks:function(){q(this._map._container,"leaflet-touch-zoom"),Ie(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Me(this._map._container,"leaflet-touch-zoom"),Wt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(p){var b=this._map;if(!(!p.touches||p.touches.length!==2||b._animatingZoom||this._zooming)){var T=b.mouseEventToContainerPoint(p.touches[0]),N=b.mouseEventToContainerPoint(p.touches[1]);this._centerPoint=b.getSize()._divideBy(2),this._startLatLng=b.containerPointToLatLng(this._centerPoint),b.options.touchZoom!=="center"&&(this._pinchStartLatLng=b.containerPointToLatLng(T.add(N)._divideBy(2))),this._startDist=T.distanceTo(N),this._startZoom=b.getZoom(),this._moved=!1,this._zooming=!0,b._stop(),Ie(document,"touchmove",this._onTouchMove,this),Ie(document,"touchend touchcancel",this._onTouchEnd,this),hn(p)}},_onTouchMove:function(p){if(!(!p.touches||p.touches.length!==2||!this._zooming)){var b=this._map,T=b.mouseEventToContainerPoint(p.touches[0]),N=b.mouseEventToContainerPoint(p.touches[1]),O=T.distanceTo(N)/this._startDist;if(this._zoom=b.getScaleZoom(O,this._startZoom),!b.options.bounceAtZoomLimits&&(this._zoomb.getMaxZoom()&&O>1)&&(this._zoom=b._limitZoom(this._zoom)),b.options.touchZoom==="center"){if(this._center=this._startLatLng,O===1)return}else{var G=T._add(N)._divideBy(2)._subtract(this._centerPoint);if(O===1&&G.x===0&&G.y===0)return;this._center=b.unproject(b.project(this._pinchStartLatLng,this._zoom).subtract(G),this._zoom)}this._moved||(b._moveStart(!0,!1),this._moved=!0),z(this._animRequest);var Y=o(b._move,b,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=D(Y,this,!0),hn(p)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,z(this._animRequest),Wt(document,"touchmove",this._onTouchMove,this),Wt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});zt.addInitHook("addHandler","touchZoom",pD),zt.BoxZoom=uD,zt.DoubleClickZoom=cD,zt.Drag=hD,zt.Keyboard=dD,zt.ScrollWheelZoom=fD,zt.TapHold=vD,zt.TouchZoom=pD,r.Bounds=Z,r.Browser=$e,r.CRS=He,r.Canvas=iD,r.Circle=jw,r.CircleMarker=py,r.Class=B,r.Control=Ti,r.DivIcon=rD,r.DivOverlay=no,r.DomEvent=VZ,r.DomUtil=Ot,r.Draggable=sl,r.Evented=U,r.FeatureGroup=ss,r.GeoJSON=us,r.GridLayer=Rv,r.Handler=ro,r.Icon=td,r.ImageOverlay=_y,r.LatLng=le,r.LatLngBounds=re,r.Layer=Mi,r.LayerGroup=ed,r.LineUtil=eY,r.Map=zt,r.Marker=vy,r.Mixin=YZ,r.Path=ll,r.Point=F,r.PolyUtil=XZ,r.Polygon=rd,r.Polyline=ls,r.Popup=by,r.PosAnimation=zP,r.Projection=tY,r.Rectangle=lD,r.Renderer=cs,r.SVG=zv,r.SVGOverlay=tD,r.TileLayer=ad,r.Tooltip=wy,r.Transformation=he,r.Util=j,r.VideoOverlay=eD,r.bind=o,r.bounds=J,r.canvas=oD,r.circle=uY,r.circleMarker=lY,r.control=Dv,r.divIcon=yY,r.extend=a,r.featureGroup=iY,r.geoJSON=QP,r.geoJson=dY,r.gridLayer=xY,r.icon=oY,r.imageOverlay=fY,r.latLng=de,r.latLngBounds=Q,r.layerGroup=aY,r.map=GZ,r.marker=sY,r.point=$,r.polygon=hY,r.polyline=cY,r.popup=gY,r.rectangle=wY,r.setOptions=m,r.stamp=l,r.svg=sD,r.svgOverlay=pY,r.tileLayer=nD,r.tooltip=mY,r.transformation=ge,r.version=n,r.videoOverlay=vY;var CY=window.L;r.noConflict=function(){return window.L=CY,this},window.L=r})})(yN,yN.exports);var Mu=yN.exports;const yw=_N(Mu);function kv(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function kP(e,t){return t==null?function(n,a){const i=E.useRef();return i.current||(i.current=e(n,a)),i}:function(n,a){const i=E.useRef();i.current||(i.current=e(n,a));const o=E.useRef(n),{instance:s}=i.current;return E.useEffect(function(){o.current!==n&&(t(s,n,o.current),o.current=n)},[s,n,a]),i}}function yZ(e,t){E.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var i;(i=t.layerContainer)==null||i.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function zSe(e){return function(r){const n=gw(),a=e(mw(r,n),n);return pZ(n.map,r.attribution),NP(a.current,r.eventHandlers),yZ(a.current,n),a}}function BSe(e,t){const r=E.useRef();E.useEffect(function(){if(t.pathOptions!==r.current){const a=t.pathOptions??{};e.instance.setStyle(a),r.current=a}},[e,t])}function FSe(e){return function(r){const n=gw(),a=e(mw(r,n),n);return NP(a.current,r.eventHandlers),yZ(a.current,n),BSe(a.current,r),a}}function xZ(e,t){const r=kP(e),n=OSe(r,t);return ESe(n)}function LP(e,t){const r=kP(e,t),n=FSe(r);return jSe(n)}function VSe(e,t){const r=kP(e,t),n=zSe(r);return RSe(n)}function GSe(e,t,r){const{opacity:n,zIndex:a}=t;n!=null&&n!==r.opacity&&e.setOpacity(n),a!=null&&a!==r.zIndex&&e.setZIndex(a)}function IP(){return gw().map}function HSe(e){const t=IP();return E.useEffect(function(){return t.on(e),function(){t.off(e)}},[t,e]),t}const _Z=LP(function({center:t,children:r,...n},a){const i=new Mu.CircleMarker(t,n);return kv(i,AP(a,{overlayContainer:i}))},ISe);function xN(){return xN=Object.assign||function(e){for(var t=1;t(v==null?void 0:v.map)??null,[v]);const m=E.useCallback(x=>{if(x!==null&&v===null){const _=new Mu.Map(x,c);r!=null&&u!=null?_.setView(r,u):e!=null&&_.fitBounds(e,t),l!=null&&_.whenReady(l),g(DSe(_))}},[]);E.useEffect(()=>()=>{v==null||v.map.remove()},[v]);const y=v?bf.createElement(mZ,{value:v},n):o??null;return bf.createElement("div",xN({},f,{ref:m}),y)}const bZ=E.forwardRef(USe),WSe=LP(function({positions:t,...r},n){const a=new Mu.Polyline(t,r);return kv(a,AP(n,{overlayContainer:a}))},function(t,r,n){r.positions!==n.positions&&t.setLatLngs(r.positions)}),$Se=xZ(function(t,r){const n=new Mu.Popup(t,r.overlayContainer);return kv(n,r)},function(t,r,{position:n},a){E.useEffect(function(){const{instance:o}=t;function s(u){u.popup===o&&(o.update(),a(!0))}function l(u){u.popup===o&&a(!1)}return r.map.on({popupopen:s,popupclose:l}),r.overlayContainer==null?(n!=null&&o.setLatLng(n),o.openOn(r.map)):r.overlayContainer.bindPopup(o),function(){var c;r.map.off({popupopen:s,popupclose:l}),(c=r.overlayContainer)==null||c.unbindPopup(),r.map.removeLayer(o)}},[t,r,a,n])}),ZSe=LP(function({bounds:t,...r},n){const a=new Mu.Rectangle(t,r);return kv(a,AP(n,{overlayContainer:a}))},function(t,r,n){r.bounds!==n.bounds&&t.setBounds(r.bounds)}),wZ=VSe(function({url:t,...r},n){const a=new Mu.TileLayer(t,mw(r,n));return kv(a,n)},function(t,r,n){GSe(t,r,n);const{url:a}=r;a!=null&&a!==n.url&&t.setUrl(a)}),YSe=xZ(function(t,r){const n=new Mu.Tooltip(t,r.overlayContainer);return kv(n,r)},function(t,r,{position:n},a){E.useEffect(function(){const o=r.overlayContainer;if(o==null)return;const{instance:s}=t,l=c=>{c.tooltip===s&&(n!=null&&s.setLatLng(n),s.update(),a(!0))},u=c=>{c.tooltip===s&&a(!1)};return o.on({tooltipopen:l,tooltipclose:u}),o.bindTooltip(s),function(){o.off({tooltipopen:l,tooltipclose:u}),o._map!=null&&o.unbindTooltip()}},[t,r,a,n])}),SZ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",CZ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",TZ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC";delete yw.Icon.Default.prototype._getIconUrl;yw.Icon.Default.mergeOptions({iconUrl:SZ,iconRetinaUrl:CZ,shadowUrl:TZ});const HB=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],XSe=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function qSe(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function KSe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function JSe(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function QSe({bounds:e}){const t=IP();return E.useEffect(()=>{e&&t.fitBounds(e,{padding:[50,50]})},[t,e]),null}function eCe({node:e}){const t=e.latitude!==null&&e.longitude!==null,r=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`:"Unknown";return d.jsxs("div",{className:"min-w-[200px]",children:[d.jsx("div",{className:"font-semibold text-slate-800",children:e.short_name}),d.jsx("div",{className:"text-xs text-slate-600 mb-2",children:e.long_name}),d.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[d.jsx("div",{className:"text-slate-500",children:"Role"}),d.jsx("div",{className:"text-slate-700 font-medium",children:e.role}),d.jsx("div",{className:"text-slate-500",children:"Hardware"}),d.jsx("div",{className:"text-slate-700",children:e.hardware||"Unknown"}),d.jsx("div",{className:"text-slate-500",children:"Battery"}),d.jsx("div",{className:"text-slate-700",children:r}),d.jsx("div",{className:"text-slate-500",children:"Last Heard"}),d.jsx("div",{className:"text-slate-700",children:JSe(e.last_heard)})]}),t&&d.jsxs("div",{className:"mt-3 pt-2 border-t border-slate-200 flex gap-2",children:[d.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[d.jsx(Jc,{size:10}),"Google Maps"]}),d.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[d.jsx(Jc,{size:10}),"OSM"]})]})]})}function tCe({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const a=E.useMemo(()=>e.filter(h=>h.latitude!==null&&h.longitude!==null),[e]),i=e.length-a.length,o=E.useMemo(()=>new Map(a.map(h=>[h.node_num,h])),[a]),s=E.useMemo(()=>t.filter(h=>o.has(h.from_node)&&o.has(h.to_node)),[t,o]),l=E.useMemo(()=>{if(a.length===0)return null;const h=a.map(v=>v.latitude),f=a.map(v=>v.longitude);return[[Math.min(...h),Math.min(...f)],[Math.max(...h),Math.max(...f)]]},[a]),u=[43.6,-114.4],c=E.useMemo(()=>{const h=new Set;return r!==null&&t.forEach(f=>{f.from_node===r&&h.add(f.to_node),f.to_node===r&&h.add(f.from_node)}),h},[r,t]);return d.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[d.jsxs(bZ,{center:u,zoom:7,style:{width:"100%",height:"540px"},className:"z-0",children:[d.jsx(wZ,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),d.jsx(QSe,{bounds:l}),s.map((h,f)=>{const v=o.get(h.from_node),g=o.get(h.to_node),m=r===null||h.from_node===r||h.to_node===r;return d.jsx(WSe,{positions:[[v.latitude,v.longitude],[g.latitude,g.longitude]],color:qSe(h.snr),weight:m&&r!==null?2.5:1.5,opacity:r===null?.3:m?.6:.08},f)}),a.map(h=>{const f=h.node_num===r,v=c.has(h.node_num),g=r===null||f||v,m=XSe.includes(h.role),y=KSe(h.latitude),x=HB[y%HB.length];return d.jsxs(_Z,{center:[h.latitude,h.longitude],radius:m?8:5,fillColor:m?x:"#111827",fillOpacity:g?.9:.2,stroke:!0,color:f?"#ffffff":x,weight:f?3:m?0:2,opacity:g?1:.3,eventHandlers:{click:()=>n(f?null:h.node_num)},children:[d.jsx(YSe,{direction:"top",offset:[0,-8],children:d.jsx("span",{className:"font-mono text-xs",children:h.short_name})}),d.jsx($Se,{children:d.jsx(eCe,{node:h})})]},h.node_num)})]}),d.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2 text-xs text-slate-400 flex items-center gap-2",children:[d.jsx(av,{size:12}),d.jsxs("span",{children:["Showing ",a.length," of ",e.length," nodes",i>0&&d.jsxs("span",{className:"text-slate-500",children:[" (",i," without coordinates)"]})]})]})]})}const UB=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],rCe=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function WB(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function nCe(e){return e>12?"excellent":e>8?"good":e>5?"fair":e>3?"marginal":"poor"}function aCe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function iCe(e){return["Northern ID","Central ID","SW Idaho","SC Idaho"][e]||"Unknown"}function oCe(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function sCe(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function lCe({node:e,edges:t,nodes:r,onSelectNode:n}){const a=E.useMemo(()=>{if(!e)return[];const h=new Map(r.map(v=>[v.node_num,v])),f=[];return t.forEach(v=>{if(v.from_node===e.node_num){const g=h.get(v.to_node);g&&f.push({node:g,snr:v.snr,quality:v.quality})}else if(v.to_node===e.node_num){const g=h.get(v.from_node);g&&f.push({node:g,snr:v.snr,quality:v.quality})}}),f.sort((v,g)=>g.snr-v.snr)},[e,t,r]);if(!e)return d.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border p-4 flex flex-col items-center justify-center h-[540px]",children:[d.jsx("div",{className:"w-12 h-12 rounded-full bg-bg-hover border border-border flex items-center justify-center mb-3",children:d.jsx(_i,{size:24,className:"text-slate-500"})}),d.jsx("p",{className:"text-sm text-slate-500 text-center",children:"Click a node to inspect"})]});const i=rCe.includes(e.role),o=aCe(e.latitude),s=UB[o%UB.length],l=e.latitude!==null&&e.longitude!==null,u=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB":`${e.battery_level.toFixed(0)}%`:"—",c=e.battery_level!==null&&(e.battery_level>100||e.voltage&&e.voltage>4.1);return d.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border flex flex-col h-[540px] overflow-hidden",children:[d.jsxs("div",{className:"p-4 border-b border-border",children:[d.jsx("div",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono mb-2",style:{backgroundColor:`${s}20`,color:s},children:e.node_id_hex}),d.jsx("div",{className:"font-mono text-lg text-slate-100",children:e.short_name}),d.jsx("div",{className:"text-xs text-slate-500 truncate",children:e.long_name})]}),d.jsxs("div",{className:"p-4 border-b border-border grid grid-cols-2 gap-3",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Role"}),d.jsx("div",{className:`text-sm font-medium ${i?"text-accent":"text-slate-300"}`,children:e.role})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Region"}),d.jsx("div",{className:"text-sm text-slate-300",children:iCe(o)})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Battery"}),d.jsxs("div",{className:"text-sm text-slate-300 flex items-center gap-1",children:[c&&d.jsx(rM,{size:12,className:"text-amber-400"}),u]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Status"}),d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${sCe(e.last_heard)}`}),d.jsx("span",{className:"text-sm text-slate-300",children:oCe(e.last_heard)})]})]}),d.jsxs("div",{className:"col-span-2",children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Hardware"}),d.jsx("div",{className:"text-sm text-slate-300 font-mono truncate",children:e.hardware||"Unknown"})]})]}),l&&d.jsxs("div",{className:"px-4 py-3 border-b border-border flex gap-3",children:[d.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300",children:[d.jsx(Jc,{size:10}),"Google Maps"]}),d.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300",children:[d.jsx(Jc,{size:10}),"OSM"]})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto",children:[d.jsxs("div",{className:"px-4 py-2 text-xs text-slate-500 font-medium sticky top-0 bg-bg-card border-b border-border",children:["Neighbors (",a.length,")"]}),a.length>0?d.jsx("div",{className:"divide-y divide-border",children:a.map(h=>d.jsxs("button",{onClick:()=>n(h.node.node_num),className:"w-full px-4 py-2 text-left hover:bg-bg-hover transition-colors flex items-center gap-2",style:{borderLeftWidth:3,borderLeftColor:WB(h.snr)},children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm text-slate-200 font-mono truncate",children:h.node.short_name}),d.jsx("div",{className:"text-xs text-slate-500 truncate",children:h.node.long_name})]}),d.jsxs("div",{className:"text-right flex-shrink-0",children:[d.jsxs("div",{className:"text-xs font-mono",style:{color:WB(h.snr)},children:[h.snr.toFixed(1)," dB"]}),d.jsx("div",{className:"text-xs text-slate-500",children:nCe(h.snr)})]})]},h.node.node_num))}):d.jsx("div",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No known neighbors"})]})]})}const $B=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function uCe(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function cCe(e){if(!e)return"—";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function hCe(e){return e.battery_level===null?"—":e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`}function ZB(e){return e===null?"—":e>46?"Northern":e>44.5?"Central":e>43?"SW Idaho":"SC Idaho"}function dCe({nodes:e,selectedNodeId:t,onSelectNode:r}){const[n,a]=E.useState(""),[i,o]=E.useState("short_name"),[s,l]=E.useState("asc"),[u,c]=E.useState("all"),h=E.useMemo(()=>{let g=[...e];if(u==="infra"?g=g.filter(m=>$B.includes(m.role)):u==="online"&&(g=g.filter(m=>{if(!m.last_heard)return!1;const y=new Date(m.last_heard);return(new Date().getTime()-y.getTime())/36e5<1})),n){const m=n.toLowerCase();g=g.filter(y=>y.short_name.toLowerCase().includes(m)||y.long_name.toLowerCase().includes(m)||y.role.toLowerCase().includes(m)||ZB(y.latitude).toLowerCase().includes(m))}return g.sort((m,y)=>{let x="",_="";switch(i){case"short_name":x=m.short_name.toLowerCase(),_=y.short_name.toLowerCase();break;case"role":x=m.role,_=y.role;break;case"battery_level":x=m.battery_level??-1,_=y.battery_level??-1;break;case"last_heard":x=m.last_heard?new Date(m.last_heard).getTime():0,_=y.last_heard?new Date(y.last_heard).getTime():0;break;case"hardware":x=m.hardware.toLowerCase(),_=y.hardware.toLowerCase();break}return x<_?s==="asc"?-1:1:x>_?s==="asc"?1:-1:0}),g},[e,n,i,s,u]),f=g=>{i===g?l(s==="asc"?"desc":"asc"):(o(g),l("asc"))},v=({field:g})=>i!==g?null:s==="asc"?d.jsx(gJ,{size:14,className:"inline ml-1"}):d.jsx(Em,{size:14,className:"inline ml-1"});return d.jsxs("div",{className:"bg-bg-card border border-border overflow-hidden",children:[d.jsxs("div",{className:"p-3 border-b border-border flex items-center gap-3",children:[d.jsxs("div",{className:"relative flex-1 max-w-xs",children:[d.jsx(v1,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),d.jsx("input",{type:"text",placeholder:"Search nodes...",value:n,onChange:g=>a(g.target.value),className:"w-full pl-9 pr-3 py-1.5 bg-bg-hover border border-border rounded text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-accent"})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(EV,{size:14,className:"text-slate-500 mr-1"}),["all","infra","online"].map(g=>d.jsx("button",{onClick:()=>c(g),className:`px-2 py-1 text-xs rounded transition-colors ${u===g?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:g==="all"?"All":g==="infra"?"Infra":"Online"},g))]}),d.jsxs("div",{className:"text-xs text-slate-500 ml-auto",children:[h.length," of ",e.length," nodes"]})]}),d.jsxs("div",{className:"overflow-x-auto",children:[d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-bg-hover text-slate-400 text-xs",children:[d.jsx("th",{className:"w-8 px-3 py-2"}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("short_name"),children:["Name ",d.jsx(v,{field:"short_name"})]}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("role"),children:["Role ",d.jsx(v,{field:"role"})]}),d.jsx("th",{className:"px-3 py-2 text-left",children:"Region"}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("battery_level"),children:[d.jsx("span",{title:"Battery percent (4.20V = 100%, 3.60V ~ 30% warning, 3.30V ~ 3% critical). USB ⚡ = USB-powered (>100% or >4.1V); no battery management applies.",children:"Battery"})," ",d.jsx(v,{field:"battery_level"})]}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("last_heard"),children:[d.jsx("span",{title:"Status dot: green = heard in the last hour; amber = within 24h; slate = offline (past the configured threshold). See Reference → Mesh Health for thresholds by node type.",children:"Last Heard"})," ",d.jsx(v,{field:"last_heard"})]}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("hardware"),children:["Hardware ",d.jsx(v,{field:"hardware"})]})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:h.slice(0,100).map(g=>{const m=$B.includes(g.role),y=g.node_num===t;return d.jsxs("tr",{onClick:()=>r(g.node_num),className:`cursor-pointer transition-colors ${y?"bg-accent/10":"hover:bg-bg-hover"}`,children:[d.jsx("td",{className:"px-3 py-2",children:d.jsx("div",{className:`w-2 h-2 rounded-full ${uCe(g.last_heard)}`})}),d.jsxs("td",{className:"px-3 py-2",children:[d.jsx("div",{className:"font-mono text-slate-200",children:g.short_name}),d.jsx("div",{className:"text-xs text-slate-500 truncate max-w-[200px]",children:g.long_name})]}),d.jsx("td",{className:"px-3 py-2",children:d.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded text-xs font-medium ${m?"bg-cyan-500/20 text-accent":"bg-slate-500/20 text-slate-400"}`,children:g.role})}),d.jsx("td",{className:"px-3 py-2 text-slate-400",children:ZB(g.latitude)}),d.jsx("td",{className:"px-3 py-2 font-mono text-slate-300",children:hCe(g)}),d.jsx("td",{className:"px-3 py-2 text-slate-400",children:cCe(g.last_heard)}),d.jsx("td",{className:"px-3 py-2 font-mono text-xs text-slate-400 truncate max-w-[150px]",children:g.hardware||"—"})]},g.node_num)})})]}),h.length>100&&d.jsxs("div",{className:"px-3 py-2 text-xs text-slate-500 text-center border-t border-border",children:["Showing first 100 of ",h.length," nodes"]}),h.length===0&&d.jsx("div",{className:"px-3 py-8 text-sm text-slate-500 text-center",children:"No nodes match your filters"})]})]})}function MZ(){const[e,t]=E.useState([]),[r,n]=E.useState([]),[a,i]=E.useState([]),[o,s]=E.useState(null),[l,u]=E.useState("topo"),[c,h]=E.useState(!0),[f,v]=E.useState(null);E.useEffect(()=>{document.title="Mesh — MeshAI",Promise.all([LJ(),IJ(),BJ()]).then(([y,x,_])=>{t(y),n(x),i(_),h(!1)}).catch(y=>{v(y.message),h(!1)})},[]);const g=E.useMemo(()=>e.find(y=>y.node_num===o)||null,[e,o]),m=E.useCallback(y=>{s(y)},[]);return c?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading mesh data..."})}):f?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsxs("div",{className:"text-red-400",children:["Error: ",f]})}):d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"text-sm text-slate-400",children:[e.length," nodes • ",r.length," edges"]}),d.jsxs("div",{className:"flex items-center bg-bg-card border border-border p-1",children:[d.jsxs("button",{onClick:()=>u("topo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="topo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[d.jsx(Sk,{size:14}),d.jsx("span",{title:"Force-directed graph of nodes + neighbor links. Edge weight reflects SNR; node color reflects status (green = active, amber = stale, slate = offline).",children:"Topology"})]}),d.jsxs("button",{onClick:()=>u("geo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="geo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[d.jsx(zV,{size:14}),d.jsx("span",{title:"Nodes plotted by lat/lon on a basemap. Nodes without a reported position are clustered at the top edge.",children:"Geographic"})]})]})]}),d.jsxs("div",{className:"flex gap-0",children:[d.jsx("div",{className:"flex-1 min-w-0",children:l==="topo"?d.jsx(LSe,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m}):d.jsx(tCe,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m})}),d.jsx(lCe,{node:g,edges:r,nodes:e,onSelectNode:m})]}),d.jsx(dCe,{nodes:e,selectedNodeId:o,onSelectNode:m})]})}function $p({envVar:e,label:t="API Key",helper:r="",info:n=""}){const[a,i]=E.useState(null),[o,s]=E.useState(""),[l,u]=E.useState(!1),[c,h]=E.useState(!1),[f,v]=E.useState(""),[g,m]=E.useState(""),y=async()=>{try{const w=await fetch("/api/secrets");if(w.ok){const C=(await w.json()).find(M=>M.env_var===e);i(C?C.is_set:!1)}}catch{i(!1)}};E.useEffect(()=>{y()},[e]);const x=async()=>{if(o.trim()){h(!0),m(""),v("");try{const w=await fetch("/api/secrets/"+encodeURIComponent(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:o})});if(w.ok)s(""),u(!1),v("Saved — restart required to take effect"),await y();else{const S=await w.text();m("Save failed: "+(S||String(w.status)))}}catch{m("Save failed: network error")}finally{h(!1)}}},_=a?"env set — enter a new value to change":"not set — enter a value";return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[t,a===null?d.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-slate-800 text-slate-500",children:"Loading"}):a?d.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-green-500/10 text-green-400",children:"Set"}):d.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-slate-800 text-slate-500",children:"Not set"})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx("input",{type:l?"text":"password",value:o,onChange:w=>s(w.target.value),placeholder:_,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),d.jsx("button",{type:"button",onClick:()=>u(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:l?d.jsx(h1,{size:16}):d.jsx(rv,{size:16})})]}),d.jsx("button",{type:"button",onClick:x,disabled:!o.trim()||c,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:c?"Saving…":"Save"})]}),r&&d.jsx("p",{className:"text-xs text-slate-600",children:r}),d.jsx("p",{className:"text-xs text-slate-600 font-mono",children:e}),f&&d.jsx("p",{className:"text-xs text-yellow-400",children:f}),g&&d.jsx("p",{className:"text-xs text-red-400",children:g})]})}function PP({label:e,value:t,onChange:r,helper:n,info:a,roleFilter:i,valueType:o="short_name"}){const[s,l]=E.useState([]),[u,c]=E.useState(!0),[h,f]=E.useState(""),[v,g]=E.useState(!1);E.useEffect(()=>{fetch("/api/nodes").then(S=>S.json()).then(S=>{l(S),c(!1)}).catch(()=>{l([]),c(!1)})},[]);const m=E.useMemo(()=>{let S=s;if(i&&(S=S.filter(C=>i==="ROUTER"||i==="infrastructure"?C.is_infrastructure||C.role==="ROUTER"||C.role==="ROUTER_CLIENT"||C.role==="REPEATER":C.role===i)),h.trim()){const C=h.toLowerCase();S=S.filter(M=>{var A,I,k,P;return((A=M.short_name)==null?void 0:A.toLowerCase().includes(C))||((I=M.long_name)==null?void 0:I.toLowerCase().includes(C))||((k=M.role)==null?void 0:k.toLowerCase().includes(C))||((P=M.node_id_hex)==null?void 0:P.toLowerCase().includes(C))})}return S.sort((C,M)=>(C.short_name||"").localeCompare(M.short_name||""))},[s,h,i]),y=S=>{switch(o){case"node_num":return String(S.node_num);case"node_id_hex":return S.node_id_hex;default:return S.short_name||String(S.node_num)}},x=S=>{const C=y(S);return t.includes(C)},_=S=>{const C=y(S);t.includes(C)?r(t.filter(M=>M!==C)):r([...t,C])},w=S=>{const C=[S.short_name];return S.long_name&&S.long_name!==S.short_name&&C.push(`— ${S.long_name}`),S.role&&C.push(`(${S.role})`),C.join(" ")};return!u&&s.length===0?d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),d.jsx("input",{type:"text",value:t.join(", "),onChange:S=>r(S.target.value.split(",").map(C=>C.trim()).filter(Boolean)),placeholder:"Enter node IDs separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}):d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),t.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(S=>{const C=s.find(M=>y(M)===S);return d.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-accent/20 text-accent rounded text-sm",children:[C?C.short_name:S,d.jsx("button",{type:"button",onClick:()=>r(t.filter(M=>M!==S)),className:"hover:text-white",children:d.jsx(_u,{size:14})})]},S)})}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"relative",children:[d.jsx(v1,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),d.jsx("input",{type:"text",value:h,onChange:S=>f(S.target.value),onFocus:()=>g(!0),placeholder:u?"Loading nodes...":"Search nodes...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"})]}),v&&!u&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),d.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 max-h-64 overflow-y-auto bg-[#0a0e17] border border-[#1e2a3a] shadow-xl",children:m.length===0?d.jsx("div",{className:"p-3 text-sm text-slate-500 text-center",children:"No nodes found"}):m.map(S=>d.jsxs("button",{type:"button",onClick:()=>_(S),className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[#1e2a3a] ${x(S)?"bg-accent/10":""}`,children:[d.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${x(S)?"bg-accent border-accent":"border-slate-600"}`,children:x(S)&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsx("span",{className:"text-slate-200",children:w(S)})]},S.node_num))})]})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function DP(e){const[t,r]=E.useState([]),[n,a]=E.useState(!0);E.useEffect(()=>{fetch("/api/channels").then(f=>f.json()).then(f=>{r(f),a(!1)}).catch(()=>{r([]),a(!1)})},[]);const i=f=>{const v=f.role==="PRIMARY"?"Primary":f.role==="SECONDARY"?"Secondary":"";return`${f.index}: ${f.name}${v?` (${v})`:""}`};if(!n&&t.length===0)return e.mode==="single"?d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),d.jsx("input",{type:"number",value:e.value,onChange:f=>e.onChange(Number(f.target.value)),min:e.includeDisabled?-1:0,max:7,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&d.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]}):d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),d.jsx("input",{type:"text",value:e.value.join(", "),onChange:f=>{const v=f.target.value.split(",").map(g=>parseInt(g.trim())).filter(g=>!isNaN(g));e.onChange(v)},placeholder:"Enter channel numbers separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&d.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]});if(e.mode==="single"){const{value:f,onChange:v,label:g,helper:m,includeDisabled:y}=e,x=t.filter(_=>_.enabled);return d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:g}),d.jsxs("select",{value:f,onChange:_=>v(Number(_.target.value)),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:[y&&d.jsx("option",{value:-1,children:"Disabled"}),x.map(_=>d.jsx("option",{value:_.index,children:i(_)},_.index))]}),m&&d.jsx("p",{className:"text-xs text-slate-600",children:m})]})}const{value:o,onChange:s,label:l,helper:u}=e,c=t.filter(f=>f.enabled),h=f=>{o.includes(f)?s(o.filter(v=>v!==f)):s([...o,f].sort((v,g)=>v-g))};return d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:l}),d.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[c.map(f=>d.jsxs("label",{onClick:()=>h(f.index),className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17] cursor-pointer",children:[d.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${o.includes(f.index)?"bg-accent border-accent":"border-slate-600"}`,children:o.includes(f.index)&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsx("span",{className:"text-sm text-slate-200",children:i(f)})]},f.index)),c.length===0&&d.jsx("div",{className:"text-sm text-slate-500 p-2",children:"No channels available"})]}),u&&d.jsx("p",{className:"text-xs text-slate-600",children:u})]})}function AZ({value:e,onChange:t,label:r="Serial Port",helper:n="Device path for your USB radio — click Detect to auto-fill a stable by-id path"}){const[a,i]=E.useState(null),[o,s]=E.useState(""),[l,u]=E.useState(!1),[c,h]=E.useState(null),f=async()=>{u(!0),h(null);try{const v=await NJ();i(v.ports),s(v.note||"")}catch(v){h(v instanceof Error?v.message:"Failed to list serial ports"),i([])}finally{u(!1)}};return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:r}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{type:"text",value:e,onChange:v=>t(v.target.value),placeholder:"/dev/serial/by-id/usb-... (or /dev/ttyACM0)",className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),d.jsxs("button",{type:"button",onClick:f,disabled:l,className:"flex items-center gap-2 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] hover:border-accent disabled:opacity-50 disabled:cursor-not-allowed rounded text-sm text-slate-300 whitespace-nowrap transition-colors",children:[d.jsx(Zi,{size:14,className:l?"animate-spin":""}),l?"Detecting...":"Detect USB devices"]})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}),c&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:c}),a!==null&&!c&&(a.length===0?d.jsx("div",{className:"text-sm text-slate-500 p-3 border border-[#1e2a3a] rounded",children:"No USB serial devices found — is the device passed through to the container?"}):d.jsx("div",{className:"border border-[#1e2a3a] rounded p-2 space-y-1",children:a.map(v=>{const g=e===v.stable_path,m=v.product||v.description||v.device;return d.jsxs("button",{type:"button",onClick:()=>t(v.stable_path),className:`w-full text-left flex items-start gap-2 p-2 rounded hover:bg-[#0a0e17] transition-colors ${g?"bg-[#0a0e17] ring-1 ring-accent":""}`,children:[d.jsx("div",{className:`mt-0.5 w-4 h-4 rounded-full border flex items-center justify-center flex-shrink-0 ${g?"bg-accent border-accent":"border-slate-600"}`,children:g&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-sm text-slate-200 truncate",children:m}),v.likely_radio&&d.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wide bg-accent/15 text-accent border border-accent/30 flex-shrink-0",children:[d.jsx(_i,{size:10})," likely radio"]})]}),d.jsx("div",{className:"text-xs text-slate-500 font-mono truncate",children:v.stable_path}),v.manufacturer&&d.jsx("div",{className:"text-xs text-slate-600 truncate",children:v.manufacturer})]})]},v.stable_path+v.device)})})),o&&d.jsx("p",{className:"text-xs text-slate-600 italic",children:o})]})}const Y2=[{key:"bot",label:"Bot",icon:_k},{key:"response",label:"Response",icon:wk},{key:"history",label:"History",icon:jV},{key:"memory",label:"Memory",icon:pJ},{key:"context",label:"Context",icon:rv},{key:"commands",label:"Commands",icon:HV},{key:"llm",label:"LLM",icon:DV},{key:"weather",label:"Weather",icon:kh},{key:"knowledge",label:"Knowledge",icon:kV},{key:"mesh_intelligence",label:"Intelligence",icon:Oo},{key:"dashboard",label:"Dashboard",icon:OV}],ba={bot:"Identity and behavior settings for the bot on the mesh network.",connection:"How MeshAI connects to your Meshtastic radio.",response:"Controls how quickly and how much the bot responds on the mesh.",history:"Conversation history storage and cleanup.",memory:"Short-term conversation memory management. Controls how the bot maintains context within a conversation.",context:"Passive channel monitoring. The bot listens to mesh channels and uses recent messages as context when responding.",commands:"Mesh commands available via the configured prefix. Toggle individual commands on or off.",llm:"AI model configuration. MeshAI uses an LLM to understand questions and generate responses.",weather:"Weather data for the !weather command. This is separate from NWS environmental alerts.",meshmonitor:"AIDA MeshMonitor integration. An additional data source for mesh network monitoring.",knowledge:"Knowledge base for answering questions from stored documents. Connects to Qdrant vector database or local SQLite.",mesh_sources:"Data sources for mesh network information. MeshAI can pull data from multiple sources simultaneously and merge them into a unified view.",mesh_intelligence:"Advanced mesh analysis: health scoring, region management, and automated alerting. The intelligence engine monitors your mesh and detects problems automatically.",dashboard:"Web dashboard settings. You're looking at it right now."},fCe=[{name:"help",description:"Show available commands and usage"},{name:"health",description:"Mesh network health overview with status dots"},{name:"status",description:"Quick mesh status summary"},{name:"region",description:"List regions or get detailed region breakdown"},{name:"neighbors",description:"Show top infrastructure neighbors with signal quality"},{name:"ping",description:"Test bot responsiveness"},{name:"clear",description:"Clear your conversation history"},{name:"reset",description:"Reset conversation context"},{name:"alerts",description:"Active NWS weather alerts for mesh area"},{name:"solar",description:"Space weather and HF propagation conditions"},{name:"hf",description:"HF radio propagation (alias for !solar)"},{name:"fire",description:"Active wildfires near the mesh"},{name:"avy",description:"Avalanche advisories for configured zones"},{name:"hotspots",description:"NASA FIRMS satellite fire detections"},{name:"streams",description:"USGS stream gauge readings"},{name:"roads",description:"Road conditions and closures"},{name:"traffic",description:"Traffic flow on monitored corridors"}],vCe=[{value:"US-AL",label:"Alabama"},{value:"US-AK",label:"Alaska"},{value:"US-AZ",label:"Arizona"},{value:"US-AR",label:"Arkansas"},{value:"US-CA",label:"California"},{value:"US-CO",label:"Colorado"},{value:"US-CT",label:"Connecticut"},{value:"US-DE",label:"Delaware"},{value:"US-FL",label:"Florida"},{value:"US-GA",label:"Georgia"},{value:"US-HI",label:"Hawaii"},{value:"US-ID",label:"Idaho"},{value:"US-IL",label:"Illinois"},{value:"US-IN",label:"Indiana"},{value:"US-IA",label:"Iowa"},{value:"US-KS",label:"Kansas"},{value:"US-KY",label:"Kentucky"},{value:"US-LA",label:"Louisiana"},{value:"US-ME",label:"Maine"},{value:"US-MD",label:"Maryland"},{value:"US-MA",label:"Massachusetts"},{value:"US-MI",label:"Michigan"},{value:"US-MN",label:"Minnesota"},{value:"US-MS",label:"Mississippi"},{value:"US-MO",label:"Missouri"},{value:"US-MT",label:"Montana"},{value:"US-NE",label:"Nebraska"},{value:"US-NV",label:"Nevada"},{value:"US-NH",label:"New Hampshire"},{value:"US-NJ",label:"New Jersey"},{value:"US-NM",label:"New Mexico"},{value:"US-NY",label:"New York"},{value:"US-NC",label:"North Carolina"},{value:"US-ND",label:"North Dakota"},{value:"US-OH",label:"Ohio"},{value:"US-OK",label:"Oklahoma"},{value:"US-OR",label:"Oregon"},{value:"US-PA",label:"Pennsylvania"},{value:"US-RI",label:"Rhode Island"},{value:"US-SC",label:"South Carolina"},{value:"US-SD",label:"South Dakota"},{value:"US-TN",label:"Tennessee"},{value:"US-TX",label:"Texas"},{value:"US-UT",label:"Utah"},{value:"US-VT",label:"Vermont"},{value:"US-VA",label:"Virginia"},{value:"US-WA",label:"Washington"},{value:"US-WV",label:"West Virginia"},{value:"US-WI",label:"Wisconsin"},{value:"US-WY",label:"Wyoming"}];function Wi({info:e,link:t,linkText:r="Learn more"}){const[n,a]=E.useState(!1),i=E.useRef(null);return E.useEffect(()=>{if(!n)return;function o(l){i.current&&!i.current.contains(l.target)&&a(!1)}const s=setTimeout(()=>document.addEventListener("mousedown",o),0);return()=>{clearTimeout(s),document.removeEventListener("mousedown",o)}},[n]),d.jsxs("div",{className:"relative inline-block",ref:i,children:[d.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),a(!n)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),n&&d.jsxs("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:[d.jsx("button",{type:"button",onClick:()=>a(!1),className:"absolute top-1 right-1 w-5 h-5 rounded hover:bg-slate-700 text-slate-500 hover:text-slate-300 inline-flex items-center justify-center transition-colors","aria-label":"Close",children:d.jsx(_u,{size:12})}),d.jsx("div",{className:"pr-4",children:e}),t&&d.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 text-accent hover:underline",onClick:o=>o.stopPropagation(),children:[r," ",d.jsx(Jc,{size:10})]})]})]})}function wa({text:e}){return d.jsx("p",{className:"text-sm text-slate-500 mb-6 pb-4 border-b border-[#1e2a3a]",children:e})}function yt({label:e,value:t,onChange:r,type:n="text",placeholder:a="",helper:i="",info:o="",infoLink:s=""}){const[l,u]=E.useState(!1),c=n==="password";return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&d.jsx(Wi,{info:o,link:s})]}),d.jsxs("div",{className:"relative",children:[d.jsx("input",{type:c&&!l?"password":"text",value:t,onChange:h=>r(h.target.value),placeholder:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),c&&d.jsx("button",{type:"button",onClick:()=>u(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:l?d.jsx(h1,{size:16}):d.jsx(rv,{size:16})})]}),i&&d.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function Ae({label:e,value:t,onChange:r,min:n,max:a,step:i=1,helper:o="",info:s="",infoLink:l=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&d.jsx(Wi,{info:s,link:l})]}),d.jsx("input",{type:"number",value:t,onChange:u=>r(Number(u.target.value)),min:n,max:a,step:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&d.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function qt({label:e,checked:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){return d.jsxs("div",{className:"flex items-center justify-between py-2",children:[d.jsxs("div",{children:[d.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,a&&d.jsx(Wi,{info:a,link:i})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}),d.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Dn({label:e,value:t,onChange:r,options:n,helper:a="",info:i="",infoLink:o=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&d.jsx(Wi,{info:i,link:o})]}),d.jsx("select",{value:t,onChange:s=>r(s.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:n.map(s=>d.jsx("option",{value:s.value,children:s.label},s.value))}),a&&d.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function pCe({label:e,value:t,onChange:r,rows:n=4,helper:a="",info:i="",infoLink:o=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&d.jsx(Wi,{info:i,link:o})]}),d.jsx("textarea",{value:t,onChange:s=>r(s.target.value),rows:n,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent resize-y"}),a&&d.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function la({label:e,value:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){const[o,s]=E.useState(t.join(", "));E.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>c.trim()).filter(Boolean);r(u)};return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Wi,{info:a,link:i})]}),d.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"item1, item2, item3",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function X2({label:e,value:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){const[o,s]=E.useState(t.join(", "));E.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>parseInt(c.trim(),10)).filter(c=>!isNaN(c));r(u)};return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Wi,{info:a,link:i})]}),d.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"0, 1, 2",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function Pn({label:e,description:t,checked:r,onChange:n,threshold:a,onThresholdChange:i,thresholdLabel:o,thresholdMin:s,thresholdMax:l,thresholdStep:u=1,thresholdSuffix:c=""}){return d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx("span",{className:"text-sm text-slate-300",children:e}),d.jsx("p",{className:"text-xs text-slate-600",children:t})]}),d.jsx("button",{type:"button",onClick:()=>n(!r),className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${r?"bg-accent":"bg-[#1e2a3a]"}`,children:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${r?"translate-x-5":""}`})})]}),r&&a!==void 0&&i&&d.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-[#1e2a3a]",children:[d.jsxs("span",{className:"text-xs text-slate-500",children:[o||"Threshold",":"]}),d.jsx("input",{type:"number",value:a,onChange:h=>i(Number(h.target.value)),min:s,max:l,step:u,className:"w-20 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono"}),c&&d.jsx("span",{className:"text-xs text-slate-500",children:c})]})]})}function gCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.bot}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Bot Name",value:e.name,onChange:r=>t({...e,name:r}),helper:"Name the bot responds to on the mesh",info:"When someone sends a message containing this name, the bot will respond. Also used as the sender name in broadcasts. Changing this requires a restart."}),d.jsx(yt,{label:"Owner",value:e.owner,onChange:r=>t({...e,owner:r}),helper:"Your callsign or identifier",info:"Identifies the bot operator. Shown in !help responses and used for admin-level commands."}),d.jsx(yt,{label:"Contact Email",value:e.contact_email||"",onChange:r=>t({...e,contact_email:r}),helper:"Used to synthesize the NWS User-Agent",info:"An email address identifying the operator; sent as the User-Agent when fetching NWS weather data (NWS requires a contact). Stored in local.yaml."})]}),d.jsx(qt,{label:"Respond to DMs",checked:e.respond_to_dms,onChange:r=>t({...e,respond_to_dms:r}),helper:"Reply when someone sends a direct message",info:"When enabled, the bot responds to direct messages from any node. When disabled, the bot only responds to channel messages that mention its name."}),d.jsx(qt,{label:"Filter BBS Protocols",checked:e.filter_bbs_protocols,onChange:r=>t({...e,filter_bbs_protocols:r}),helper:"Ignore BBS bulletin board traffic",info:"Filters out automated BBS protocol messages (advBBS, MAIL*, BOARD*) so the bot doesn't try to respond to machine-to-machine traffic."})]})}function mCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.connection}),d.jsx(Dn,{label:"Connection Type",value:e.type,onChange:r=>t({...e,type:r}),options:[{value:"serial",label:"Serial (USB)"},{value:"tcp",label:"TCP (Network)"}],helper:"Serial for USB-connected radios, TCP for network or meshtasticd",info:"Serial: direct USB connection to a Meshtastic radio. TCP: connect over the network to a radio's IP or to meshtasticd running on another machine."}),e.type==="serial"?d.jsx(AZ,{label:"Serial Port",value:e.serial_port,onChange:r=>t({...e,serial_port:r}),helper:"Device path for your USB radio — Detect fills a stable by-id path"}):d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"TCP Host",value:e.tcp_host,onChange:r=>t({...e,tcp_host:r}),placeholder:"192.168.1.100",helper:"IP address or hostname of the radio/meshtasticd"}),d.jsx(Ae,{label:"TCP Port",value:e.tcp_port,onChange:r=>t({...e,tcp_port:r}),min:1,max:65535,helper:"Default 4403 for meshtasticd"})]}),d.jsx("div",{className:"pt-2",children:d.jsx(uf,{to:"/meshcore/connection",className:"inline-flex items-center gap-1 text-xs text-slate-500 hover:text-accent transition-colors",children:"→ MeshCore connection"})})]})}function yCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.response}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Delay Min (sec)",value:e.delay_min,onChange:r=>t({...e,delay_min:r}),min:0,step:.1,helper:"Minimum wait before responding",info:"Adds a random delay between min and max before the bot sends a response. Prevents the bot from appearing to respond instantly, which can feel unnatural on a radio network."}),d.jsx(Ae,{label:"Delay Max (sec)",value:e.delay_max,onChange:r=>t({...e,delay_max:r}),min:0,step:.1,helper:"Maximum wait before responding",info:"Also prevents collisions with other traffic by staggering transmissions."})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Max Length",value:e.max_length,onChange:r=>t({...e,max_length:r}),min:50,max:500,helper:"Maximum characters per response message",info:"Meshtastic packets have limited size. This caps how long each message chunk can be. The bot will split longer responses into multiple messages up to Max Messages."}),d.jsx(Ae,{label:"Max Messages",value:e.max_messages,onChange:r=>t({...e,max_messages:r}),min:1,max:10,helper:"Maximum chunks per response",info:"If a response is longer than Max Length, the bot splits it into this many chunks at most. Higher values = more complete answers but more airtime used."})]})]})}function xCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.history}),d.jsx(yt,{label:"Database Path",value:e.database,onChange:r=>t({...e,database:r}),helper:"SQLite file for storing conversation history",info:"Path to the SQLite database file. Created automatically if it doesn't exist. Stores all conversation history for context."}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Max Messages Per User",value:e.max_messages_per_user,onChange:r=>t({...e,max_messages_per_user:r}),min:0,helper:"History limit per user (0 = unlimited)",info:"Limits how many messages are stored per user. Older messages are pruned when the limit is reached. Set to 0 for no limit."}),d.jsx(Ae,{label:"Conversation Timeout (sec)",value:e.conversation_timeout,onChange:r=>t({...e,conversation_timeout:r}),min:0,helper:"Seconds before context resets",info:"If a user doesn't message for this long, their next message starts a new conversation context. The bot won't remember the previous topic."})]}),d.jsx(qt,{label:"Auto Cleanup",checked:e.auto_cleanup,onChange:r=>t({...e,auto_cleanup:r}),helper:"Automatically prune old conversations"}),e.auto_cleanup&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Cleanup Interval (hours)",value:e.cleanup_interval_hours,onChange:r=>t({...e,cleanup_interval_hours:r}),min:1,helper:"Hours between cleanup runs"}),d.jsx(Ae,{label:"Max Age (days)",value:e.max_age_days,onChange:r=>t({...e,max_age_days:r}),min:1,helper:"Delete conversations older than this"})]})]})}function _Ce({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.memory}),d.jsx(qt,{label:"Enable Memory",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Keep conversation context between messages"}),e.enabled&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Window Size",value:e.window_size,onChange:r=>t({...e,window_size:r}),min:1,helper:"Recent message pairs kept in full",info:"The bot keeps this many recent exchanges (user message + bot response pairs) as full text in context. Older messages are summarized to save token space."}),d.jsx(Ae,{label:"Summarize Threshold",value:e.summarize_threshold,onChange:r=>t({...e,summarize_threshold:r}),min:1,helper:"Messages before older context is summarized",info:"When the conversation exceeds this many messages, older ones outside the window are compressed into a summary by the LLM."})]})]})}function bCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.context}),d.jsx(qt,{label:"Enable Passive Context",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Listen to channel traffic for context",info:"When enabled, the bot monitors mesh channels and includes recent messages in its context. This lets the bot reference things other people said on the channel."}),e.enabled&&d.jsx(d.Fragment,{children:d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Chat context retention (days)",value:Math.round((e.max_age??1209600)/86400),onChange:r=>t({...e,max_age:r*86400}),min:1,helper:"How long the bot remembers recent channel chat for context (applies to both meshes). Default 14 days."}),d.jsx(Ae,{label:"Max Context Items",value:e.max_context_items,onChange:r=>t({...e,max_context_items:r}),min:1,helper:"Maximum recent messages to include"})]})})]})}function wCe({data:e,onChange:t}){const r=new Set(e.disabled_commands.map(s=>s.toLowerCase())),[n,a]=E.useState(()=>Object.entries(e.custom_commands||{}));E.useEffect(()=>{const s={};for(const[l,u]of n)l.trim()&&(s[l.trim()]=u);JSON.stringify(s)!==JSON.stringify(e.custom_commands||{})&&a(Object.entries(e.custom_commands||{}))},[e.custom_commands]);const i=s=>{a(s);const l={};for(const[u,c]of s)u.trim()&&(l[u.trim()]=c);t({...e,custom_commands:l})},o=s=>{const l=s.toLowerCase();r.has(l)?t({...e,disabled_commands:e.disabled_commands.filter(u=>u.toLowerCase()!==l)}):t({...e,disabled_commands:[...e.disabled_commands,s]})};return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.commands}),d.jsx(qt,{label:"Enable Commands",checked:e.enabled,onChange:s=>t({...e,enabled:s}),helper:"Allow !commands on the mesh"}),e.enabled&&d.jsxs(d.Fragment,{children:[d.jsx(yt,{label:"Command Prefix",value:e.prefix,onChange:s=>t({...e,prefix:s}),helper:"Character that triggers commands (e.g. ! for !help)",info:"Users type this character followed by the command name. Only single characters recommended."}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Available Commands",d.jsx(Wi,{info:"Toggle commands on or off. Disabled commands won't respond when users invoke them."})]}),d.jsx("div",{className:"grid gap-1",children:fCe.map(s=>{const l=!r.has(s.name.toLowerCase());return d.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#0a0e17] border border-[#1e2a3a] rounded hover:border-[#2a3a4a] transition-colors",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("code",{className:"text-accent text-sm",children:["!",s.name]}),d.jsx("span",{className:"text-xs text-slate-500",children:s.description})]}),d.jsx("button",{type:"button",onClick:()=>o(s.name),className:`relative w-9 h-5 rounded-full transition-colors ${l?"bg-accent":"bg-[#1e2a3a]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${l?"translate-x-4":""}`})})]},s.name)})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Custom Commands",d.jsx(Wi,{info:"Define your own commands. When a user types the prefix followed by the name, the bot replies with the response text verbatim."})]}),n.map(([s,l],u)=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("input",{type:"text",value:s,onChange:c=>{const h=n.map((f,v)=>v===u?[c.target.value,f[1]]:f);i(h)},placeholder:"name",className:"w-40 flex-shrink-0 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),d.jsx("input",{type:"text",value:l,onChange:c=>{const h=n.map((f,v)=>v===u?[f[0],c.target.value]:f);i(h)},placeholder:"response text",className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"}),d.jsx("button",{type:"button",onClick:()=>i(n.filter((c,h)=>h!==u)),className:"p-2 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded flex-shrink-0","aria-label":"Remove custom command",children:d.jsx(li,{size:14})})]},u)),d.jsxs("button",{type:"button",onClick:()=>i([...n,["",""]]),className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[d.jsx(si,{size:16})," Add Custom Command"]})]})]})]})}function SCe({data:e,onChange:t}){const r={openai:"OPENAI_API_KEY",anthropic:"ANTHROPIC_API_KEY",google:"GOOGLE_API_KEY"}[(e.backend||"").toLowerCase()]||"LLM_API_KEY";return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.llm}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Dn,{label:"Backend",value:e.backend,onChange:n=>t({...e,backend:n}),options:[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"google",label:"Google (Gemini)"}],helper:"LLM provider to use",info:"OpenAI: GPT models (gpt-4o, gpt-4o-mini). Anthropic: Claude models (claude-sonnet-4-20250514). Google: Gemini models. Can also point to compatible APIs like Ollama, LM Studio, or Open WebUI by changing the Base URL."}),d.jsx(yt,{label:"Model",value:e.model,onChange:n=>t({...e,model:n}),placeholder:"gpt-4o-mini",helper:"Specific model name",info:"The specific model to use. Common choices: gpt-4o-mini (fast, cheap), gpt-4o (better, costs more), claude-sonnet-4-20250514 (Anthropic equivalent). For local models via Ollama, use the model name you pulled (e.g. llama3.1)."})]}),d.jsx($p,{envVar:r,label:"API Key",helper:"Secret stored in /data/secrets/.env; config holds the ${VAR} ref"}),d.jsx(yt,{label:"Base URL",value:e.base_url,onChange:n=>t({...e,base_url:n}),placeholder:"https://api.openai.com/v1",helper:"API endpoint (change for local LLMs)",info:"Default API endpoint for the selected backend. Change this to point to a local LLM server (Ollama at http://localhost:11434/v1, Open WebUI, LM Studio, etc.) or a proxy."}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Timeout (sec)",value:e.timeout,onChange:n=>t({...e,timeout:n}),min:5,max:120,helper:"Maximum seconds to wait for response"}),d.jsx(Ae,{label:"Max Response Tokens",value:e.max_response_tokens,onChange:n=>t({...e,max_response_tokens:n}),min:100,helper:"Token limit for LLM responses"})]}),d.jsx(qt,{label:"Use System Prompt",checked:e.use_system_prompt,onChange:n=>t({...e,use_system_prompt:n}),helper:"Enable custom system instructions"}),e.use_system_prompt&&d.jsx(pCe,{label:"System Prompt",value:e.system_prompt,onChange:n=>t({...e,system_prompt:n}),rows:6,helper:"Instructions that shape the bot's personality",info:"Instructions that shape the bot's personality and behavior. The bot always follows these instructions. MeshAI adds mesh health data and environmental context automatically — you don't need to include those here."}),d.jsx(qt,{label:"Web Search",checked:e.web_search,onChange:n=>t({...e,web_search:n}),helper:"Enable web search tool (Open WebUI feature)"}),d.jsx(qt,{label:"Google Grounding",checked:e.google_grounding,onChange:n=>t({...e,google_grounding:n}),helper:"Ground responses in web search (Gemini only)"})]})}function CCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.weather}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Dn,{label:"Primary Provider",value:e.primary,onChange:r=>t({...e,primary:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"}],helper:"Main weather data source"}),d.jsx(Dn,{label:"Fallback Provider",value:e.fallback,onChange:r=>t({...e,fallback:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"},{value:"none",label:"None"}],helper:"Backup if primary fails"})]}),d.jsx(yt,{label:"Default Location",value:e.default_location,onChange:r=>t({...e,default_location:r}),placeholder:"Your city, state",helper:"Location when none specified"}),d.jsx(yt,{label:"Open-Meteo base URL (advanced)",value:e.openmeteo.url,onChange:r=>t({...e,openmeteo:{...e.openmeteo,url:r}}),placeholder:"https://api.open-meteo.com/v1",helper:"Override the Open-Meteo API endpoint (leave default unless self-hosting)"}),d.jsx(yt,{label:"wttr.in base URL (advanced)",value:e.wttr.url,onChange:r=>t({...e,wttr:{...e.wttr,url:r}}),placeholder:"https://wttr.in",helper:"Override the wttr.in endpoint (leave default unless self-hosting)"})]})}function TCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.meshmonitor}),d.jsx(qt,{label:"Enable MeshMonitor",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Connect to AIDA MeshMonitor instance",info:"MeshMonitor by Yeraze provides node data, battery info, telemetry, and auto-responder patterns. MeshAI uses this as a data source and avoids duplicate responses."}),e.enabled&&d.jsxs(d.Fragment,{children:[d.jsx(yt,{label:"URL",value:e.url,onChange:r=>t({...e,url:r}),placeholder:"http://192.168.1.100:8080",helper:"MeshMonitor API endpoint",info:"Full URL to your MeshMonitor instance. Usually runs on port 8080."}),d.jsx(qt,{label:"Inject Into Prompt",checked:e.inject_into_prompt,onChange:r=>t({...e,inject_into_prompt:r}),helper:"Tell LLM about MeshMonitor commands",info:"Adds MeshMonitor's auto-responder patterns to the LLM context so it knows what commands MeshMonitor handles."}),d.jsx(Ae,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:r=>t({...e,refresh_interval:r}),min:10,helper:"How often to fetch patterns"}),d.jsx(qt,{label:"Polite Mode",checked:e.polite_mode,onChange:r=>t({...e,polite_mode:r}),helper:"Reduce polling frequency",info:"Reduces polling frequency for shared instances to be a good neighbor."})]})]})}function MCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.knowledge}),d.jsx(qt,{label:"Enable Knowledge Base",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Answer questions from stored documents",info:"Uses RAG (Retrieval-Augmented Generation) to answer questions from a knowledge base. Supports Qdrant vector database or local SQLite with FTS5."}),e.enabled&&d.jsxs(d.Fragment,{children:[d.jsx(Dn,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"auto",label:"Auto (Qdrant -> SQLite)"},{value:"qdrant",label:"Qdrant"},{value:"sqlite",label:"SQLite"}],helper:"Knowledge storage backend",info:"Auto tries Qdrant first, falls back to SQLite. Qdrant provides hybrid search with dense+sparse embeddings. SQLite uses FTS5 keyword search."}),(e.backend==="qdrant"||e.backend==="auto")&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Qdrant Host",value:e.qdrant_host,onChange:r=>t({...e,qdrant_host:r}),helper:"Qdrant server hostname",info:"IP or hostname of your Qdrant vector database server."}),d.jsx(Ae,{label:"Qdrant Port",value:e.qdrant_port,onChange:r=>t({...e,qdrant_port:r}),helper:"Default 6333"})]}),d.jsx(yt,{label:"Collection",value:e.qdrant_collection,onChange:r=>t({...e,qdrant_collection:r}),helper:"Qdrant collection name"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"TEI Host",value:e.tei_host,onChange:r=>t({...e,tei_host:r}),helper:"Text Embeddings Inference host",info:"TEI service for generating dense embeddings. Uses BAAI/bge-m3 model."}),d.jsx(Ae,{label:"TEI Port",value:e.tei_port,onChange:r=>t({...e,tei_port:r}),helper:"Default 8090"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Sparse Host",value:e.sparse_host,onChange:r=>t({...e,sparse_host:r}),placeholder:"localhost",helper:"SPLADE sparse-embedding service host",info:"Host of the SPLADE service that generates sparse (keyword-weighted) embeddings for hybrid search."}),d.jsx(Ae,{label:"Sparse Port",value:e.sparse_port,onChange:r=>t({...e,sparse_port:r}),helper:"Default 8091"})]}),d.jsx(qt,{label:"Use Sparse Embeddings",checked:e.use_sparse,onChange:r=>t({...e,use_sparse:r}),helper:"Enable hybrid search with sparse vectors",info:"Combines dense embeddings with sparse (keyword-based) embeddings using Reciprocal Rank Fusion for better search results."})]}),d.jsx(yt,{label:"SQLite DB Path",value:e.db_path,onChange:r=>t({...e,db_path:r}),helper:"Local knowledge database file"}),d.jsx(Ae,{label:"Top K Results",value:e.top_k,onChange:r=>t({...e,top_k:r}),min:1,max:20,helper:"Number of documents to retrieve"})]})]})}function ACe({source:e,onChange:t,onDelete:r}){const[n,a]=E.useState(!1),i={meshview:"Web-based mesh monitoring tool. Enter the full URL of a MeshView instance. No API key typically required.",meshmonitor:"AIDA MeshMonitor API. Provides node data and network statistics. Requires API token.",mqtt:"Subscribe directly to a Meshtastic MQTT broker for real-time packet data. This is push-based (instant) vs the polling approach of MeshView/MeshMonitor."};return d.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>a(!n),children:[d.jsxs("div",{className:"flex items-center gap-3",children:[n?d.jsx(Em,{size:16}):d.jsx(Ah,{size:16}),d.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`}),d.jsx("span",{className:"font-mono text-sm text-slate-200",children:e.name||"Unnamed Source"}),d.jsx("span",{className:"text-xs text-slate-500 bg-[#1e2a3a] px-2 py-0.5 rounded",children:e.type})]}),d.jsx("button",{onClick:o=>{o.stopPropagation(),r()},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:d.jsx(li,{size:14})})]}),n&&d.jsxs("div",{className:"p-4 space-y-4 border-t border-[#1e2a3a]",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Name",value:e.name,onChange:o=>t({...e,name:o}),helper:"Friendly name for this source"}),d.jsx(Dn,{label:"Type",value:e.type,onChange:o=>t({...e,type:o}),options:[{value:"meshview",label:"MeshView"},{value:"meshmonitor",label:"MeshMonitor"},{value:"mqtt",label:"MQTT Broker"}],info:i[e.type]||""})]}),e.type!=="mqtt"&&d.jsx(yt,{label:"URL",value:e.url,onChange:o=>t({...e,url:o}),helper:"Full URL including protocol"}),e.type==="meshmonitor"&&d.jsx(yt,{label:"API Token",value:e.api_token,onChange:o=>t({...e,api_token:o}),type:"password",helper:"Bearer token for authentication"}),e.type==="mqtt"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Host",value:e.host||"",onChange:o=>t({...e,host:o}),helper:"MQTT broker hostname"}),d.jsx(Ae,{label:"Port",value:e.port||1883,onChange:o=>t({...e,port:o}),min:1,max:65535,helper:"1883 plain, 8883 TLS"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Username",value:e.username||"",onChange:o=>t({...e,username:o})}),d.jsx(yt,{label:"Password",value:e.password||"",onChange:o=>t({...e,password:o}),type:"password"})]}),d.jsx(yt,{label:"Topic Root",value:e.topic_root||"msh/US",onChange:o=>t({...e,topic_root:o}),helper:"Base topic to subscribe to"}),d.jsx(qt,{label:"Use TLS",checked:e.use_tls||!1,onChange:o=>t({...e,use_tls:o}),helper:"Encrypt MQTT connection"})]}),d.jsx(Ae,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:o=>t({...e,refresh_interval:o}),min:10,helper:"Polling frequency"}),d.jsx(qt,{label:"Enabled",checked:e.enabled,onChange:o=>t({...e,enabled:o})}),d.jsx(qt,{label:"Polite Mode",checked:e.polite_mode,onChange:o=>t({...e,polite_mode:o}),helper:"Reduce polling for shared instances"})]})]})}function NCe({data:e,onChange:t}){const r=()=>{t([...e,{name:"New Source",type:"meshview",url:"",api_token:"",refresh_interval:30,polite_mode:!1,enabled:!0,host:"",port:1883,username:"",password:"",topic_root:"msh/US",use_tls:!1}])};return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.mesh_sources}),e.map((n,a)=>d.jsx(ACe,{source:n,onChange:i=>{const o=[...e];o[a]=i,t(o)},onDelete:()=>{confirm(`Delete source "${n.name}"?`)&&t(e.filter((i,o)=>o!==a))}},a)),d.jsxs("button",{onClick:r,className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[d.jsx(si,{size:16})," Add Source"]})]})}function NZ({data:e,onChange:t}){const[r,n]=E.useState(null);return d.jsxs("div",{className:"space-y-6",children:[d.jsx(wa,{text:ba.mesh_intelligence}),d.jsx(qt,{label:"Enable Mesh Intelligence",checked:e.enabled,onChange:a=>t({...e,enabled:a}),helper:"Activate health scoring and alerting"}),e.enabled&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Locality Radius (miles)",value:e.locality_radius_miles,onChange:a=>t({...e,locality_radius_miles:a}),min:1,step:.5,helper:"Region assignment radius",info:"Nodes within this distance of a region anchor point are assigned to that region."}),d.jsx(Ae,{label:"Offline Threshold (hours)",value:e.offline_threshold_hours,onChange:a=>t({...e,offline_threshold_hours:a}),min:1,helper:"Time until node marked offline",info:"A node is considered offline after not being heard for this many hours."})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Packet Threshold",value:e.packet_threshold,onChange:a=>t({...e,packet_threshold:a}),min:0,helper:"Min packets per 24h to flag",info:"Minimum packets per 24 hours. Nodes below this are flagged as low activity."}),d.jsx(Ae,{label:"Battery Warning %",value:e.battery_warning_percent,onChange:a=>t({...e,battery_warning_percent:a}),min:1,max:100,helper:"Global battery warning level"})]}),d.jsx(PP,{label:"Critical Nodes",value:e.critical_nodes,onChange:a=>t({...e,critical_nodes:a}),helper:"Critical infrastructure nodes",info:"Nodes that get priority alerting when they go offline.",roleFilter:"infrastructure"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(DP,{label:"Alert Channel",value:e.alert_channel,onChange:a=>t({...e,alert_channel:a}),helper:"Channel for broadcast alerts",info:"Meshtastic channel for broadcast alerts. Select Disabled to turn off channel broadcasting.",mode:"single",includeDisabled:!0}),d.jsx(Ae,{label:"Alert Cooldown (min)",value:e.alert_cooldown_minutes,onChange:a=>t({...e,alert_cooldown_minutes:a}),min:1,helper:"Min time between repeat alerts",info:"Minimum minutes between repeated alerts for the same condition. Uses scaling cooldown (12h, 24h, 48h)."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Regions",d.jsx(Wi,{info:"Regions group mesh nodes by geographic area. Each region has an anchor point (lat/lon) and nodes within the region radius are automatically assigned. Regions enable localized reports, alerts, and health scoring."})]}),e.regions.map((a,i)=>d.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>n(r===i?null:i),children:[d.jsxs("div",{className:"flex items-center gap-3",children:[r===i?d.jsx(Em,{size:16}):d.jsx(Ah,{size:16}),d.jsx("span",{className:"font-medium text-slate-200",children:a.name||"Unnamed Region"}),d.jsx("span",{className:"text-xs text-slate-500",children:a.local_name})]}),d.jsx("button",{onClick:o=>{if(o.stopPropagation(),confirm(`Delete region "${a.name||"Unnamed Region"}"?`)){const s=e.regions.filter((l,u)=>u!==i);t({...e,regions:s})}},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:d.jsx(li,{size:14})})]}),r===i&&d.jsxs("div",{className:"p-4 space-y-3 border-t border-[#1e2a3a]",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Name",value:a.name,onChange:o=>{const s=[...e.regions];s[i]={...a,name:o},t({...e,regions:s})}}),d.jsx(yt,{label:"Local Name",value:a.local_name,onChange:o=>{const s=[...e.regions];s[i]={...a,local_name:o},t({...e,regions:s})}})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Latitude",value:a.lat,onChange:o=>{const s=[...e.regions];s[i]={...a,lat:o},t({...e,regions:s})},step:1e-4}),d.jsx(Ae,{label:"Longitude",value:a.lon,onChange:o=>{const s=[...e.regions];s[i]={...a,lon:o},t({...e,regions:s})},step:1e-4})]}),d.jsx(yt,{label:"Description",value:a.description,onChange:o=>{const s=[...e.regions];s[i]={...a,description:o},t({...e,regions:s})}}),d.jsx(la,{label:"Aliases",value:a.aliases,onChange:o=>{const s=[...e.regions];s[i]={...a,aliases:o},t({...e,regions:s})}}),d.jsx(la,{label:"Cities",value:a.cities,onChange:o=>{const s=[...e.regions];s[i]={...a,cities:o},t({...e,regions:s})}})]})]},i)),d.jsxs("button",{onClick:()=>{const a={name:"",local_name:"",lat:0,lon:0,description:"",aliases:[],cities:[]};t({...e,regions:[...e.regions,a]}),n(e.regions.length)},className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[d.jsx(si,{size:16})," Add Region"]})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Rules",d.jsx(Wi,{info:"Configure which conditions trigger alerts. Each rule can have an optional threshold value."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Infrastructure"}),d.jsx(Pn,{label:"Infra Offline",description:"Alert when an infrastructure node (router/repeater) goes offline",checked:e.alert_rules.infra_offline,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_offline:a}})}),d.jsx(Pn,{label:"Infra Recovery",description:"Alert when an offline infrastructure node comes back online",checked:e.alert_rules.infra_recovery,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_recovery:a}})}),d.jsx(Pn,{label:"New Router",description:"Alert when a new router/repeater appears on the mesh",checked:e.alert_rules.new_router,onChange:a=>t({...e,alert_rules:{...e.alert_rules,new_router:a}})}),d.jsx(Pn,{label:"Feeder Offline",description:"Alert when a data source (MeshView/MeshMonitor) stops responding",checked:e.alert_rules.feeder_offline,onChange:a=>t({...e,alert_rules:{...e.alert_rules,feeder_offline:a}})}),d.jsx(Pn,{label:"Single Gateway",description:"Alert when an infrastructure node has only one connection path",checked:e.alert_rules.infra_single_gateway,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_single_gateway:a}})}),d.jsx(Pn,{label:"Region Blackout",description:"Alert when all infrastructure in a region goes offline",checked:e.alert_rules.region_total_blackout,onChange:a=>t({...e,alert_rules:{...e.alert_rules,region_total_blackout:a}})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Power"}),d.jsx(Pn,{label:"Battery Warning",description:"Alert when infra node battery drops below warning threshold",checked:e.alert_rules.battery_warning,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_warning:a}}),threshold:e.alert_rules.battery_warning_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_warning_threshold:a}}),thresholdLabel:"Below",thresholdMin:10,thresholdMax:90,thresholdSuffix:"%"}),d.jsx(Pn,{label:"Battery Critical",description:"Alert at critical battery level",checked:e.alert_rules.battery_critical,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_critical:a}}),threshold:e.alert_rules.battery_critical_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_critical_threshold:a}}),thresholdLabel:"Below",thresholdMin:5,thresholdMax:50,thresholdSuffix:"%"}),d.jsx(Pn,{label:"Battery Emergency",description:"Alert at emergency battery level",checked:e.alert_rules.battery_emergency,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_emergency:a}}),threshold:e.alert_rules.battery_emergency_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_emergency_threshold:a}}),thresholdLabel:"Below",thresholdMin:1,thresholdMax:25,thresholdSuffix:"%"}),d.jsx(Pn,{label:"Battery Trend Declining",description:"Alert when battery shows a declining trend over 7 days",checked:e.alert_rules.battery_trend_declining,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_trend_declining:a}})}),d.jsx(Pn,{label:"Power Source Change",description:"Alert when a node switches between battery and USB power",checked:e.alert_rules.power_source_change,onChange:a=>t({...e,alert_rules:{...e.alert_rules,power_source_change:a}})}),d.jsx(Pn,{label:"Solar Not Charging",description:"Alert when a solar-powered node isn't charging during daylight",checked:e.alert_rules.solar_not_charging,onChange:a=>t({...e,alert_rules:{...e.alert_rules,solar_not_charging:a}})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Utilization"}),d.jsx(Pn,{label:"High Utilization",description:"Alert when channel utilization stays high for extended periods",checked:e.alert_rules.sustained_high_util,onChange:a=>t({...e,alert_rules:{...e.alert_rules,sustained_high_util:a}}),threshold:e.alert_rules.high_util_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,high_util_threshold:a}}),thresholdLabel:"Above",thresholdMin:5,thresholdMax:50,thresholdSuffix:`% for ${e.alert_rules.high_util_hours}h`}),e.alert_rules.sustained_high_util&&d.jsx("div",{className:"pl-3",children:d.jsx(Ae,{label:"High-Util Window (hours)",value:e.alert_rules.high_util_hours,onChange:a=>t({...e,alert_rules:{...e.alert_rules,high_util_hours:a}}),min:1,helper:"Sustained duration above the utilization threshold before alerting"})}),d.jsx(Pn,{label:"Packet Flood",description:"Alert when a single node sends excessive packets",checked:e.alert_rules.packet_flood,onChange:a=>t({...e,alert_rules:{...e.alert_rules,packet_flood:a}}),threshold:e.alert_rules.packet_flood_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,packet_flood_threshold:a}}),thresholdLabel:"Over",thresholdMin:100,thresholdMax:2e3,thresholdSuffix:"pkts/24h"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Health Scores"}),d.jsx(Pn,{label:"Mesh Score Alert",description:"Alert when overall mesh health score drops below threshold",checked:e.alert_rules.mesh_score_alert,onChange:a=>t({...e,alert_rules:{...e.alert_rules,mesh_score_alert:a}}),threshold:e.alert_rules.mesh_score_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,mesh_score_threshold:a}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"}),d.jsx(Pn,{label:"Region Score Alert",description:"Alert when a region's health score drops below threshold",checked:e.alert_rules.region_score_alert,onChange:a=>t({...e,alert_rules:{...e.alert_rules,region_score_alert:a}}),threshold:e.alert_rules.region_score_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,region_score_threshold:a}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"})]})]})]})]})}function kCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.dashboard}),d.jsx(qt,{label:"Enable Dashboard",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Run the web dashboard"}),e.enabled&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Host",value:e.host,onChange:r=>t({...e,host:r}),placeholder:"0.0.0.0",helper:"Network bind address",info:"0.0.0.0 = accessible from any device on the network. 127.0.0.1 = only accessible from this machine."}),d.jsx(Ae,{label:"Port",value:e.port,onChange:r=>t({...e,port:r}),min:1,max:65535,helper:"Dashboard URL port",info:"Port number for the web dashboard URL. You access the dashboard at http://your-ip:port"})]})]})}function LCe({timezone:e,onSave:t}){const[r,n]=E.useState(e);return E.useEffect(()=>{n(e)},[e]),d.jsxs("div",{className:"space-y-4 mb-6 pb-6 border-b border-[#1e2a3a]",children:[d.jsx("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:"General"}),d.jsx(yt,{label:"Timezone",value:r,onChange:a=>{n(a),t(a)},placeholder:"America/Boise",helper:"Global IANA timezone, e.g. America/Boise",info:"Global IANA timezone used for local time display across MeshAI. Saved immediately."})]})}function ICe(){var z;const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState("bot"),[s]=cJ();E.useEffect(()=>{const j=s.get("section");j&&Y2.some(B=>B.key===j)&&o(j)},[s]);const[l,u]=E.useState(!0),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(null),[y,x]=E.useState(!1),[_,w]=E.useState(!1),S=E.useCallback(async()=>{try{const j=await fetch("/api/config");if(!j.ok)throw new Error("Failed to fetch config");const B=await j.json();r(B),a(JSON.parse(JSON.stringify(B))),w(!1),v(null)}catch(j){v(j instanceof Error?j.message:"Unknown error")}finally{u(!1)}},[]);E.useEffect(()=>{document.title="Config — MeshAI",S()},[S]),E.useEffect(()=>{t&&n&&w(JSON.stringify(t)!==JSON.stringify(n))},[t,n]),E.useEffect(()=>(e(_),()=>e(!1)),[_,e]);const C=async()=>{if(t){h(!0),v(null),m(null);try{const j=t[i],B=await fetch(`/api/config/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)}),H=await B.json();if(!B.ok)throw new Error(H.detail||"Save failed");m(`${i} saved successfully`),a(JSON.parse(JSON.stringify(t))),w(!1),e(!1),H.restart_required&&(x(!0),bu(Array.isArray(H.changed_keys)?H.changed_keys:[])),setTimeout(()=>m(null),3e3)}catch(j){v(j instanceof Error?j.message:"Save failed")}finally{h(!1)}}},M=()=>{n&&(r(JSON.parse(JSON.stringify(n))),w(!1))},A=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{v("Restart failed")}},I=(j,B)=>{t&&r({...t,[j]:B})},k=async j=>{try{const B=await fetch("/api/config/timezone",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)}),H=await B.json();if(!B.ok)throw new Error(H.detail||"Save failed");r(V=>V&&{...V,timezone:j}),a(V=>V&&{...V,timezone:j})}catch(B){v(B instanceof Error?B.message:"Timezone save failed")}};if(l)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading configuration..."})});if(!t)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load configuration"})});const P=()=>{switch(i){case"bot":return d.jsxs(d.Fragment,{children:[d.jsx(LCe,{timezone:t.timezone,onSave:k}),d.jsx(gCe,{data:t.bot,onChange:j=>I("bot",j)})]});case"response":return d.jsx(yCe,{data:t.response,onChange:j=>I("response",j)});case"history":return d.jsx(xCe,{data:t.history,onChange:j=>I("history",j)});case"memory":return d.jsx(_Ce,{data:t.memory,onChange:j=>I("memory",j)});case"context":return d.jsx(bCe,{data:t.context,onChange:j=>I("context",j)});case"commands":return d.jsx(wCe,{data:t.commands,onChange:j=>I("commands",j)});case"llm":return d.jsx(SCe,{data:t.llm,onChange:j=>I("llm",j)});case"weather":return d.jsx(CCe,{data:t.weather,onChange:j=>I("weather",j)});case"knowledge":return d.jsx(MCe,{data:t.knowledge,onChange:j=>I("knowledge",j)});case"mesh_intelligence":return d.jsx(NZ,{data:t.mesh_intelligence,onChange:j=>I("mesh_intelligence",j)});case"dashboard":return d.jsx(kCe,{data:t.dashboard,onChange:j=>I("dashboard",j)});default:return null}},D=((z=Y2.find(j=>j.key===i))==null?void 0:z.label)||i;return d.jsxs("div",{className:"flex gap-6 h-[calc(100vh-8rem)]",children:[d.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:Y2.map(({key:j,label:B,icon:H})=>d.jsxs("button",{onClick:()=>o(j),className:`w-full flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${i===j?"bg-accent text-white":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover"}`,children:[d.jsx(H,{size:16}),d.jsx("span",{children:B}),_&&i===j&&d.jsx("span",{className:"ml-auto w-2 h-2 bg-amber-500 rounded-full"})]},j))}),d.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[d.jsxs("div",{className:"flex items-center justify-between mb-6",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(FV,{size:20,className:"text-slate-500"}),d.jsx("h2",{className:"text-lg font-semibold text-slate-200",children:D})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[_&&d.jsxs("button",{onClick:M,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-slate-400 hover:text-slate-200 bg-bg-hover rounded transition-colors",children:[d.jsx(xa,{size:14}),"Discard"]}),d.jsxs("button",{onClick:C,disabled:c||!_,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[c?d.jsx(Zi,{size:14,className:"animate-spin"}):d.jsx(_a,{size:14}),"Save"]})]})]}),y&&d.jsxs("div",{className:"flex items-center justify-between p-3 mb-4 bg-amber-500/10 border border-amber-500/30",children:[d.jsxs("div",{className:"flex items-center gap-2 text-amber-400",children:[d.jsx(vi,{size:16}),d.jsx("span",{className:"text-sm",children:"Restart required for changes to take effect"})]}),d.jsx("button",{onClick:A,className:"px-3 py-1 text-sm bg-amber-500 text-white rounded hover:bg-amber-600 transition-colors",children:"Restart Now"})]}),f&&d.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-red-500/10 border border-red-500/30 text-red-400",children:[d.jsx(_u,{size:16}),d.jsx("span",{className:"text-sm",children:f})]}),g&&d.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-green-500/10 border border-green-500/30 text-green-400",children:[d.jsx(Yr,{size:16}),d.jsx("span",{className:"text-sm",children:g})]}),d.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:d.jsx("div",{className:"bg-bg-card border border-border p-6",children:P()})})]})]})}const PCe=["mesh_broadcast","mesh_dm"],DCe=["meshcore_broadcast","meshcore_dm"],jCe=["routine","priority","immediate"];function Yo({info:e}){const[t,r]=E.useState(!1);return d.jsxs("div",{className:"relative inline-block",children:[d.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(!t)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),t&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),d.jsx("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:e})]})]})}function ECe({label:e,value:t,onChange:r,type:n="text",placeholder:a="",helper:i="",info:o=""}){const[s,l]=E.useState(!1),u=n==="password";return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&d.jsx(Yo,{info:o})]}),d.jsxs("div",{className:"relative",children:[d.jsx("input",{type:u&&!s?"password":"text",value:t,onChange:c=>r(c.target.value),placeholder:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),u&&d.jsx("button",{type:"button",onClick:()=>l(!s),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:s?d.jsx(h1,{size:16}):d.jsx(rv,{size:16})})]}),i&&d.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function qf({label:e,value:t,onChange:r,min:n,max:a,step:i=1,helper:o="",info:s=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&d.jsx(Yo,{info:s})]}),d.jsx("input",{type:"number",value:t,onChange:l=>r(Number(l.target.value)),min:n,max:a,step:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&d.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Ch({label:e,checked:t,onChange:r,helper:n="",info:a=""}){return d.jsxs("div",{className:"flex items-center justify-between py-2",children:[d.jsxs("div",{children:[d.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,a&&d.jsx(Yo,{info:a})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}),d.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function q2({label:e,value:t,onChange:r,helper:n="",info:a=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Yo,{info:a})]}),d.jsx("input",{type:"time",value:t,onChange:i=>r(i.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function kZ({label:e,value:t,onChange:r,placeholder:n="Add item...",helper:a="",info:i=""}){const[o,s]=E.useState(""),l=()=>{o.trim()&&!t.includes(o.trim())&&(r([...t,o.trim()]),s(""))},u=c=>{r(t.filter((h,f)=>f!==c))};return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&d.jsx(Yo,{info:i})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{type:"text",value:o,onChange:c=>s(c.target.value),onKeyDown:c=>c.key==="Enter"&&(c.preventDefault(),l()),className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent",placeholder:n}),d.jsx("button",{type:"button",onClick:l,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm text-white transition-colors",children:d.jsx(si,{size:16})})]}),t.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.map((c,h)=>d.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-[#1e2a3a] rounded text-sm text-slate-300",children:[c,d.jsx("button",{type:"button",onClick:()=>u(h),className:"text-slate-500 hover:text-red-400",children:d.jsx(_u,{size:14})})]},h))}),a&&d.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function LZ({channels:e,severityChannels:t,onChange:r}){const n=a=>a.replace("meshcore_","mc_").replace("mesh_","").replace(/_/g," ");return d.jsxs("table",{className:"text-xs w-full",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{className:"text-left text-slate-600 font-normal w-20",children:"severity"}),e.map(a=>d.jsx("th",{className:"text-slate-500 font-normal px-1 whitespace-nowrap",children:n(a)},a))]})}),d.jsx("tbody",{children:jCe.map(a=>d.jsxs("tr",{children:[d.jsx("td",{className:"text-slate-400 pr-2 whitespace-nowrap",children:a}),e.map(i=>{const o=(t[a]||[]).includes(i);return d.jsx("td",{className:"text-center",children:d.jsx("input",{type:"checkbox",checked:o,onChange:s=>{const l={...t},u=new Set(l[a]||[]);s.target.checked?u.add(i):u.delete(i),l[a]=Array.from(u),r(l)}})},i)})]},a))})]})}const fu=[{key:"mesh_health",label:"Mesh Health",Icon:Oo},{key:"weather",label:"Weather",Icon:kh},{key:"fire",label:"Fire",Icon:Rm},{key:"rf_propagation",label:"RF Propagation",Icon:_i},{key:"roads",label:"Roads",Icon:u1},{key:"avalanche",label:"Avalanche",Icon:VV},{key:"satpass",label:"Satellite Passes",Icon:f1},{key:"seismic",label:"Seismic",Icon:kf},{key:"tracking",label:"Tracking",Icon:av}];function RCe(e){const t=new Set(fu.map(n=>n.key)),r=[];for(const n of e)!n||!n.key||t.has(n.key)||(t.add(n.key),r.push({key:n.key,label:n.label||n.key,Icon:RV}));return[...fu,...r]}let lx=null,K2=null;function IZ(){const[e,t]=E.useState(lx??fu);return E.useEffect(()=>{let r=!1;if(lx){t(lx);return}return K2||(K2=fetch("/api/notifications/families").then(n=>n.ok?n.json():[]).then(n=>{const a=RCe(Array.isArray(n)?n:[]);return lx=a,a}).catch(()=>fu)),K2.then(n=>{r||t(n)}),()=>{r=!0}},[]),e}function OCe(e,t,r){const n=e?{...e}:{...t,name:r};n.name=t.name||n.name||r;const a=(e==null?void 0:e.severity_channels)||{},i=t.severity_channels||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};return o.forEach(l=>{const u=(a[l]||[]).filter(h=>h.startsWith("meshcore_")),c=(i[l]||[]).filter(h=>!h.startsWith("meshcore_"));s[l]=[...u,...c]}),n.severity_channels=s,n.broadcast_channel=t.broadcast_channel,n.node_ids=t.node_ids,n}function zCe(e,t){const r=(t==null?void 0:t.mt_enabled)??(t==null?void 0:t.enabled)??!1,n=(e==null?void 0:e.mc_enabled)??!1,a=(e==null?void 0:e.cells)||{},i=(t==null?void 0:t.cells)||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};for(const l of o){const u=a[l]||{},c=i[l]||{},h=new Set([...Object.keys(u),...Object.keys(c)]),f={};for(const v of h){const g=u[v],m=c[v],y={mt:m!==void 0?m.mt:(g==null?void 0:g.mt)??null,mc:(g==null?void 0:g.mc)??null,min_severity:(m==null?void 0:m.min_severity)??(g==null?void 0:g.min_severity)??"routine",enabled:(m==null?void 0:m.enabled)??(g==null?void 0:g.enabled)??!0},x=y.mc;(y.mt!==null||x!==null&&x.trim()!=="")&&(f[v]=y)}Object.keys(f).length>0&&(s[l]=f)}return{mt_enabled:r,mc_enabled:n,cells:s}}function BCe({toggles:e,onChange:t,regions:r,regionRoutes:n,onRegionRoutesChange:a}){const i=IZ(),o=(h,f)=>t({...e,[h]:{...e[h]||{},...f}}),[s,l]=E.useState({}),u=(h,f,v)=>{var y,x,_;const g=((x=(y=n==null?void 0:n.cells)==null?void 0:y[h])==null?void 0:x[f])??{mt:null,mc:null,min_severity:"routine",enabled:!0},m={...(n==null?void 0:n.cells)||{},[h]:{...((_=n==null?void 0:n.cells)==null?void 0:_[h])||{},[f]:{...g,mt:v}}};a({mt_enabled:(n==null?void 0:n.mt_enabled)??(n==null?void 0:n.enabled)??!1,mc_enabled:(n==null?void 0:n.mc_enabled)??!1,cells:m})},c=h=>{var m;const f=((m=n==null?void 0:n.cells)==null?void 0:m[h])||{},v={};for(const[y,x]of Object.entries(f))v[y]={...x,mt:null};const g={...(n==null?void 0:n.cells)||{},[h]:v};a({mt_enabled:(n==null?void 0:n.mt_enabled)??(n==null?void 0:n.enabled)??!1,mc_enabled:(n==null?void 0:n.mc_enabled)??!1,cells:g})};return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Meshtastic Delivery",d.jsx(Yo,{info:"Per-family Meshtastic delivery matrix. Choose which channels fire at each severity, the broadcast channel index, and DM node IDs. Family on/off and severity threshold are configured on the Data Feeds page."})]}),d.jsx("div",{className:"border border-[#1e2a3a] p-3",children:d.jsx(Ch,{label:"Enable Meshtastic region routing",checked:(n==null?void 0:n.mt_enabled)??(n==null?void 0:n.enabled)??!1,onChange:h=>a({mt_enabled:h,mc_enabled:(n==null?void 0:n.mc_enabled)??!1,cells:(n==null?void 0:n.cells)||{}}),helper:"Master switch for per-region Meshtastic channel routing. When off, families deliver only to their default Meshtastic channels."})}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:i.map(({key:h,label:f,Icon:v})=>{var w;const g=e[h]||{},m=((w=n==null?void 0:n.cells)==null?void 0:w[h])||{},y=r.some(S=>{var C;return((C=m[S])==null?void 0:C.mt)!=null}),x=s[h],_=x!==void 0?x:y;return d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-200",children:[d.jsx(v,{size:15})," ",f]}),d.jsxs("div",{className:"space-y-3 p-3 bg-[#0a0e17] border border-[#1e2a3a]",children:[d.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-300",children:[d.jsx(_i,{size:13}),"Meshtastic"]}),d.jsx(LZ,{channels:PCe,severityChannels:g.severity_channels||{},onChange:S=>o(h,{severity_channels:S})}),d.jsx(qf,{label:"Broadcast channel",value:g.broadcast_channel??0,onChange:S=>o(h,{broadcast_channel:S}),min:0,helper:"Meshtastic channel index (0 = LongFast primary)",info:"The Meshtastic channel index used for mesh_broadcast delivery. 0 = primary channel."}),d.jsx(kZ,{label:"DM node IDs",value:g.node_ids||[],onChange:S=>o(h,{node_ids:S}),placeholder:"!hex_id",helper:"Meshtastic DM recipients (hex node IDs)",info:"Hex node IDs for mesh_dm delivery (e.g. !a1b2c3d4). Used when mesh_dm is enabled for a severity."})]}),d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[d.jsx(Ch,{label:"Region-based routing",checked:_,onChange:S=>{l(C=>({...C,[h]:S})),S||c(h)},helper:"Route this family to different MT channels per region"}),_&&(r.length===0?d.jsxs("p",{className:"text-xs text-slate-500 italic",children:["No regions yet — add them on the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage"})," page."]}):d.jsx("div",{className:"space-y-1.5 pt-1",children:r.map(S=>{const C=m[S]??{mt:null};return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-xs text-slate-400 flex-1 min-w-0 truncate",children:S}),d.jsx("input",{type:"number",value:C.mt!==null?C.mt:"",onChange:M=>{const A=M.target.value;u(h,S,A===""?null:parseInt(A,10))},min:0,max:7,placeholder:"ch",className:"w-16 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono focus:outline-none focus:border-accent"})]},S)})}))]})]},h)})})]})}function FCe(){const{setDirty:e}=$i(),t=IZ(),[r,n]=E.useState(null),[a,i]=E.useState(null),[o,s]=E.useState([]),[l,u]=E.useState(!0),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(null),[y,x]=E.useState(!1),_=E.useCallback(async()=>{try{const[C,M]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/regions")]);if(!C.ok)throw new Error("Failed to fetch notifications config");const A=await C.json(),I=M.ok?await M.json():[];n(A),i(JSON.parse(JSON.stringify(A))),s(Array.isArray(I)?I:[]),x(!1),v(null)}catch(C){v(C instanceof Error?C.message:"Unknown error")}finally{u(!1)}},[]);E.useEffect(()=>{document.title="Meshtastic Routing - MeshAI",_()},[_]),E.useEffect(()=>{r&&a&&x(JSON.stringify(r)!==JSON.stringify(a))},[r,a]),E.useEffect(()=>(e(y),()=>e(!1)),[y,e]);const w=async()=>{if(r){h(!0),v(null),m(null);try{const C=await fetch("/api/config/notifications");if(!C.ok)throw new Error("Failed to re-fetch notifications config");const M=await C.json(),A={...M,toggles:{...M.toggles||{}},region_routes:zCe(M.region_routes,r.region_routes)},I=r.toggles||{};for(const{key:D}of t){const z=I[D];z&&(A.toggles[D]=OCe((M.toggles||{})[D],z,D))}const k=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),P=await k.json();if(!k.ok)throw new Error(P.detail||"Save failed");n(A),i(JSON.parse(JSON.stringify(A))),x(!1),e(!1),m("Meshtastic routing saved successfully"),setTimeout(()=>m(null),3e3)}catch(C){v(C instanceof Error?C.message:"Save failed")}finally{h(!1)}}},S=()=>{a&&(n(JSON.parse(JSON.stringify(a))),x(!1))};return l?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading notifications config..."})}):r?d.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsxs("p",{className:"text-sm text-slate-500",children:["Per-family Meshtastic delivery. Family gating (enable, severity threshold, freshness/cooldown) is on"," ",d.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"}),". MeshCore delivery is on the"," ",d.jsx("a",{href:"/meshcore/routing",className:"text-accent hover:underline",children:"MeshCore Routing"})," page."]})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:_,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:S,disabled:!y,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:w,disabled:c||!y,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[d.jsx(_a,{size:16}),c?"Saving...":"Save"]})]})]}),f&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:f}),g&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),g]}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:r.toggles?d.jsx(BCe,{toggles:r.toggles,onChange:C=>n({...r,toggles:C}),regions:o,regionRoutes:r.region_routes,onRegionRoutesChange:C=>n({...r,region_routes:C})}):d.jsx("p",{className:"text-sm text-slate-500",children:"No family configuration found."})})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})})}const VCe={wfigs:["allowed_incident_types","freshness_seconds","cooldown_seconds","broadcast_on_acres","broadcast_on_contained"],tomtom_incidents:["min_magnitude","drop_non_present","drop_zero_magnitude"],itd_511:["min_severity","enabled_categories","enabled_sub_types"],wzdx:["broadcast","min_severity","sub_types"],nws:["broadcast_severities","duplicate_allowed_after_seconds"],avalanche:["min_danger_level"],swpc:["geomag_kp_floor","flare_class_floor","proton_pfu_floor"],satpass:["enabled","observers","min_elevation","norad_ids","max_broadcasts_per_hour","dry_run"]},GCe=1500;function PZ({excludeKeys:e,hideLlmToggle:t}={}){const[r,n]=E.useState({}),[a,i]=E.useState({}),[o,s]=E.useState(!0),[l,u]=E.useState(null),[c,h]=E.useState({}),[f,v]=E.useState({}),[g,m]=E.useState({}),y=E.useCallback(async()=>{s(!0),u(null);try{const[M,A]=await Promise.all([fetch("/api/adapter-config"),fetch("/api/adapter-meta")]);if(!M.ok)throw new Error(`GET /adapter-config: ${M.status}`);if(!A.ok)throw new Error(`GET /adapter-meta: ${A.status}`);n(await M.json()),i(await A.json())}catch(M){u(String(M))}finally{s(!1)}},[]);E.useEffect(()=>{y()},[y]);const x=E.useCallback((M,A,I)=>{v(k=>({...k,[M]:A})),I&&m(k=>({...k,[M]:I})),A==="saved"&&setTimeout(()=>{v(k=>k[M]==="saved"?{...k,[M]:"idle"}:k)},GCe)},[]),_=E.useCallback(async(M,A,I)=>{const k=`${M}.${A}`;x(k,"saving");try{const P=await fetch(`/api/adapter-config/${M}/${A}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:I})});if(!P.ok){const j=(await P.json().catch(()=>({}))).detail||P.statusText;x(k,"error",String(j));return}const D=await P.json();n(z=>({...z,[M]:(z[M]||[]).map(j=>j.key===A?D:j)})),x(k,"saved")}catch(P){x(k,"error",String(P))}},[x]),w=E.useCallback(async(M,A)=>{const I=`${M}.${A}`;x(I,"saving");try{const k=await fetch(`/api/adapter-config/${M}/${A}/reset`,{method:"POST"});if(!k.ok){x(I,"error",`reset failed (${k.status})`);return}const P=await k.json();n(D=>({...D,[M]:(D[M]||[]).map(z=>z.key===A?P:z)})),x(I,"saved")}catch(k){x(I,"error",String(k))}},[x]),S=E.useCallback(async(M,A)=>{const I=`meta:${M}`;x(I,"saving");try{const k=await fetch(`/api/adapter-meta/${M}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!k.ok){const D=await k.json().catch(()=>({}));x(I,"error",String(D.detail||k.statusText));return}const P=await k.json();i(D=>({...D,[M]:P})),x(I,"saved")}catch(k){x(I,"error",String(k))}},[x]);if(o)return d.jsxs("div",{className:"p-6 flex items-center gap-2 text-[#777]",children:[d.jsx(nv,{className:"w-5 h-5 animate-spin"})," Loading adapter config…"]});if(l)return d.jsxs("div",{className:"p-6 text-red-400",children:[d.jsx(Nh,{className:"w-5 h-5 inline mr-2"}),"Failed to load: ",l]});const C=Array.from(new Set([...Object.keys(a),...Object.keys(r)])).sort();return d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2 text-white",children:[d.jsx(Bg,{className:"w-5 h-5"}),d.jsx("h1",{className:"text-xl font-semibold",children:"Adapter Config"}),d.jsxs("span",{className:"text-xs text-[#666] ml-2",children:[Object.entries(r).reduce((M,[A,I])=>M+(e!=null&&e[A]?I.filter(k=>!e[A].includes(k.key)).length:I.length),0)," settings across ",C.length," adapters"]})]}),d.jsxs("p",{className:"text-xs text-[#777] max-w-3xl",children:["Per-adapter tunables (thresholds, freshness windows, toggles, curation lists). Changes take effect on the next handler call -- no container restart needed. Sentence templates, emoji, and translation maps live in code by design — see the CODE rule under ",d.jsx("a",{href:"/reference#adapter-config",className:"text-accent hover:underline",children:"Adapter Config & the CODE Rule"})," in Reference. The ",d.jsx("strong",{children:"LLM context"})," toggle on each card gates whether that adapter's data lands in the system prompt when you DM the bot; broadcasts are unaffected."]}),C.map(M=>{var j;const A=a[M]||{display_name:M,include_in_llm_context:!0,description:""},I=r[M]||[],k=e!=null&&e[M]?I.filter(B=>!e[M].includes(B.key)):I,P=c[M]??!1,D=`meta:${M}`,z=f[D]||"idle";return d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"p-4 flex items-start gap-4",children:[d.jsx("button",{onClick:()=>h(B=>({...B,[M]:!B[M]})),className:"text-[#777] hover:text-white","aria-label":"toggle expand",children:P?d.jsx(Em,{className:"w-5 h-5"}):d.jsx(Ah,{className:"w-5 h-5"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h2",{className:"text-base font-semibold text-white",children:A.display_name}),d.jsx("code",{className:"text-xs text-[#666]",children:M}),k.length>0&&d.jsxs("span",{className:"text-xs text-[#777] ml-1",children:["(",k.length," settings",(j=e==null?void 0:e[M])!=null&&j.length?`, ${e[M].length} curated`:"",")"]}),k.length===0&&d.jsx("span",{className:"text-xs text-[#666] ml-1 italic",children:I.length>0?"(all curated)":"(meta only)"})]}),A.description&&d.jsx("p",{className:"text-xs text-[#777] mt-1",children:A.description})]}),!t&&d.jsxs("label",{className:"flex items-center gap-2 text-xs text-[#e0e0e0] select-none",children:[d.jsx("input",{type:"checkbox",checked:A.include_in_llm_context,onChange:B=>S(M,{include_in_llm_context:B.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"}),"LLM context",d.jsx(DZ,{status:z,error:g[D]})]})]}),P&&k.length>0&&d.jsx("div",{className:"border-t border-border divide-y divide-border",children:k.map(B=>d.jsx(HCe,{row:B,status:f[`${M}.${B.key}`]||"idle",error:g[`${M}.${B.key}`],onCommit:H=>_(M,B.key,H),onReset:()=>w(M,B.key)},B.key))})]},M)})]})}function HCe({row:e,status:t,error:r,onCommit:n,onReset:a}){const[i,o]=E.useState(J2(e));E.useEffect(()=>{o(J2(e))},[e.value,e.type]);const s=i!==J2(e),l=JSON.stringify(e.value)===JSON.stringify(e.default),u=()=>{const c=UCe(i,e.type);c.error||c.changed(e.value)&&n(c.value)};return d.jsxs("div",{className:"px-6 py-3 flex items-start gap-4",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("code",{className:"text-sm font-mono text-accent",children:e.key}),d.jsxs("span",{className:"text-xs text-[#666]",children:["[",e.type,"]"]}),!l&&d.jsx("span",{className:"text-xs text-accent",children:"edited"})]}),e.description&&d.jsx("p",{className:"text-xs text-[#777] mt-1",children:e.description})]}),d.jsxs("div",{className:"flex items-center gap-2 min-w-[280px] justify-end",children:[e.type==="bool"?d.jsx("input",{type:"checkbox",checked:e.value===!0,onChange:c=>n(c.target.checked),className:"w-5 h-5 accent-[#f59e0b]"}):e.type==="json"?d.jsx("textarea",{className:"w-72 h-20 bg-[#0d0d0d] border border-border px-2 py-1 text-xs font-mono text-white",value:i,onChange:c=>o(c.target.value),onBlur:u}):d.jsx("input",{type:e.type==="int"||e.type==="float"?"number":"text",step:e.type==="float"?"any":"1",className:"w-48 bg-[#0d0d0d] border border-border px-2 py-1 text-sm text-white",value:i,onChange:c=>o(c.target.value),onBlur:u,onKeyDown:c=>{c.key==="Enter"&&c.target.blur()}}),d.jsx(DZ,{status:t,error:r,dirty:s}),d.jsx("button",{onClick:a,disabled:l,className:"text-[#777] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Reset to default",children:d.jsx(xa,{className:"w-4 h-4"})})]})]})}function DZ({status:e,error:t,dirty:r}){return e==="saving"?d.jsx(nv,{className:"w-4 h-4 text-accent animate-spin"}):e==="saved"?d.jsx(Yr,{className:"w-4 h-4 text-green-500"}):e==="error"?d.jsx("span",{title:t,className:"text-red-400 cursor-help",children:d.jsx(Nh,{className:"w-4 h-4"})}):r?d.jsx("span",{className:"w-2 h-2 bg-accent rounded-full",title:"unsaved"}):d.jsx("span",{className:"w-4 h-4"})}function J2(e){return e.type==="bool"?String(e.value===!0):e.type==="json"?JSON.stringify(e.value,null,2):e.value===null||e.value===void 0?"":String(e.value)}function UCe(e,t){if(t==="int"){const r=Number(e);return!Number.isFinite(r)||!Number.isInteger(r)?{error:"expected integer",value:null,changed:()=>!1}:{error:null,value:r,changed:n=>n!==r}}if(t==="float"){const r=Number(e);return Number.isFinite(r)?{error:null,value:r,changed:n=>n!==r}:{error:"expected number",value:null,changed:()=>!1}}if(t==="str")return{error:null,value:e,changed:r=>r!==e};if(t==="json")try{const r=JSON.parse(e);return{error:null,value:r,changed:n=>JSON.stringify(n)!==JSON.stringify(r)}}catch{return{error:"invalid JSON",value:null,changed:()=>!1}}return{error:null,value:e,changed:()=>!0}}const WCe=["routine","priority","immediate"];function YB(e){return{name:`source_${e}`,enabled:!0,url:"",items_path:"features",id_path:"",lat_path:"",lon_path:"",geometry_path:"geometry",title_path:"",time_path:"",category:"generic_alert",poll_seconds:300,severity:"routine",field_mappings:[],summary_template:"",emoji:"",headers:{}}}function Ya({label:e,value:t,onChange:r,placeholder:n,type:a="text",mono:i=!1}){return d.jsxs("div",{className:"min-w-0",children:[d.jsx("label",{className:"text-xs text-[#777] mb-1 block",children:e}),d.jsx("input",{type:a,value:t,placeholder:n,onChange:o=>r(o.target.value),className:`w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs ${i?"font-mono":""} text-[#e0e0e0] placeholder:text-[#555]`})]})}function ux({children:e}){return d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] pt-1",children:e})}function $Ce(){const[e,t]=E.useState(null),[r,n]=E.useState(""),[a,i]=E.useState(!0),[o,s]=E.useState(!1),[l,u]=E.useState(null),[c,h]=E.useState(null),{setDirty:f}=$i(),[v,g]=E.useState({}),[m,y]=E.useState({});E.useEffect(()=>{DJ().then(U=>{const W=(Array.isArray(U)?U:[]).map(($,Z)=>({...YB(Z+1),...$}));t(W),n(JSON.stringify(W))}).catch(U=>u(U instanceof Error?U.message:String(U))).finally(()=>i(!1))},[]);const x=e!==null&&JSON.stringify(e)!==r;E.useEffect(()=>(f(x),()=>f(!1)),[x,f]);const _=(U,F)=>{t(W=>W&&W.map(($,Z)=>Z===U?{...$,...F}:$))},w=()=>{t(U=>[...U??[],YB(((U==null?void 0:U.length)??0)+1)])},S=U=>{t(F=>F&&F.filter((W,$)=>$!==U)),g(F=>{const W={...F};return delete W[U],W})},C=U=>{t(F=>F&&F.map((W,$)=>$===U?{...W,field_mappings:[...W.field_mappings,{source_path:"",dest_key:""}]}:W))},M=(U,F,W)=>{t($=>$&&$.map((Z,J)=>J===U?{...Z,field_mappings:Z.field_mappings.map((re,Q)=>Q===F?{...re,...W}:re)}:Z))},A=(U,F)=>{t(W=>W&&W.map(($,Z)=>Z===U?{...$,field_mappings:$.field_mappings.filter((J,re)=>re!==F)}:$))},I=U=>Object.entries(U.headers??{}),k=(U,F)=>{const W={};for(const[$,Z]of F)W[$]=Z;_(U,{headers:W})},P=U=>{e&&k(U,[...I(e[U]),["",""]])},D=(U,F,W,$)=>{if(!e)return;const Z=I(e[U]);Z[F]=[W,$],k(U,Z)},z=(U,F)=>{if(!e)return;const W=I(e[U]);W.splice(F,1),k(U,W)},j=async U=>{if(!e)return;const F=e[U];y(W=>({...W,[U]:!0}));try{const W=await EJ(F.url,F.items_path,F.headers);g($=>({...$,[U]:W}))}catch(W){g($=>({...$,[U]:{ok:!1,error:W instanceof Error?W.message:String(W)}}))}finally{y(W=>({...W,[U]:!1}))}},B=()=>{r&&(t(JSON.parse(r)),g({}))},H=async()=>{if(e){s(!0),u(null),h(null);try{const U=await jJ(e);n(JSON.stringify(e)),h("Custom sources saved"),setTimeout(()=>h(null),3e3),U.restart_required&&bu(Array.isArray(U.changed_keys)?U.changed_keys:[])}catch(U){u(U instanceof Error?U.message:"Save failed")}finally{s(!1)}}};if(a)return d.jsx("div",{className:"flex items-center justify-center h-32 text-[#777]",children:"Loading custom sources…"});if(!e)return d.jsx("div",{className:"flex items-center justify-center h-32 text-red-400",children:l||"No config"});const V=d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{onClick:B,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:H,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",o?"Saving…":"Save"]})]});return d.jsxs("div",{className:"space-y-6 max-w-4xl",children:[d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("p",{className:"text-sm text-[#777]",children:["Point MeshAI at any public REST or GeoJSON feed — no code. Each source polls a URL, maps its JSON fields to an event via dotted paths, and broadcasts through the normal coverage-gated pipeline. Use ",d.jsx("span",{className:"text-accent",children:"Preview"})," to fetch a URL and read its structure before filling in the paths. Once saved, a custom source becomes a routable family —"," ",d.jsx("a",{href:"/meshtastic/routing",className:"text-accent hover:underline",children:"enable its family in Notifications"})," ","to route it to a channel."]}),x&&V]}),l&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:l}),c&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:c}),e.length===0&&d.jsx("div",{className:"border border-border p-6 text-center text-sm text-[#666]",children:"No custom sources yet. Click “Add source” to wire up a public feed."}),d.jsx("div",{className:"space-y-4",children:e.map((U,F)=>{const W=v[F],$=m[F];return d.jsxs("div",{className:"border border-border p-4 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("input",{type:"text",value:U.name,onChange:Z=>_(F,{name:Z.target.value}),placeholder:"source name (unique id)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-sm font-medium text-[#e0e0e0]"}),d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[d.jsx("span",{className:"text-xs text-[#666]",children:"Enabled"}),d.jsx("button",{type:"button",onClick:()=>_(F,{enabled:!U.enabled}),className:`relative w-9 h-4 rounded-full transition-colors ${U.enabled?"bg-accent":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${U.enabled?"translate-x-5":""}`})})]}),d.jsx("button",{onClick:()=>S(F),title:"Delete source",className:"flex items-center gap-1 px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(li,{size:12})})]}),d.jsx(ux,{children:"Basics"}),d.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[d.jsx("div",{className:"col-span-12",children:d.jsx(Ya,{label:"URL",value:U.url,onChange:Z=>_(F,{url:Z}),placeholder:"https://example.com/api/feed.geojson",mono:!0})}),d.jsx("div",{className:"col-span-3",children:d.jsx(Ya,{label:"Poll seconds",type:"number",value:U.poll_seconds,onChange:Z=>_(F,{poll_seconds:parseInt(Z,10)||0})})}),d.jsx("div",{className:"col-span-3",children:d.jsx(Ya,{label:"Category",value:U.category,onChange:Z=>_(F,{category:Z}),placeholder:"generic_alert"})}),d.jsxs("div",{className:"col-span-3",children:[d.jsx("label",{className:"text-xs text-[#777] mb-1 block",children:"Severity"}),d.jsx("select",{value:U.severity,onChange:Z=>_(F,{severity:Z.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs text-[#e0e0e0]",children:WCe.map(Z=>d.jsx("option",{value:Z,children:Z},Z))})]}),d.jsx("div",{className:"col-span-3",children:d.jsx(Ya,{label:"Emoji",value:U.emoji??"",onChange:Z=>_(F,{emoji:Z}),placeholder:"⚡"})})]}),d.jsx(ux,{children:"Extraction"}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsx(Ya,{label:"items_path (array of items)",value:U.items_path,onChange:Z=>_(F,{items_path:Z}),placeholder:"features · object.outages",mono:!0}),d.jsx(Ya,{label:"id_path (unique id, for dedup)",value:U.id_path,onChange:Z=>_(F,{id_path:Z}),placeholder:"id · omsOutageId · properties.id",mono:!0})]}),d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Headers (optional)"}),d.jsxs("button",{onClick:()=>P(F),className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[d.jsx(si,{size:12})," Add header"]})]}),d.jsxs("p",{className:"text-xs text-[#555]",children:["Custom request headers, e.g. ",d.jsx("code",{children:"User-Agent"})," or"," ",d.jsx("code",{children:"Authorization"}),". Leave empty for the default browser UA."]}),Object.entries(U.headers??{}).length>0&&d.jsx("div",{className:"space-y-2",children:Object.entries(U.headers??{}).map(([Z,J],re)=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"text",value:Z,onChange:Q=>D(F,re,Q.target.value,J),placeholder:"header name (e.g. Authorization)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("span",{className:"text-[#555] text-xs",children:":"}),d.jsx("input",{type:"text",value:J,onChange:Q=>D(F,re,Z,Q.target.value),placeholder:"value (e.g. Bearer …)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("button",{onClick:()=>z(F,re),title:"Remove header",className:"flex items-center px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(li,{size:12})})]},re))})]}),d.jsx(ux,{children:"Location — GeoJSON geometry OR lat + lon paths"}),d.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[d.jsx(Ya,{label:"geometry_path",value:U.geometry_path??"",onChange:Z=>_(F,{geometry_path:Z}),placeholder:"geometry",mono:!0}),d.jsx(Ya,{label:"lat_path",value:U.lat_path??"",onChange:Z=>_(F,{lat_path:Z}),placeholder:"properties.lat",mono:!0}),d.jsx(Ya,{label:"lon_path",value:U.lon_path??"",onChange:Z=>_(F,{lon_path:Z}),placeholder:"properties.lon",mono:!0})]}),d.jsx(ux,{children:"Display"}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsx(Ya,{label:"title_path",value:U.title_path??"",onChange:Z=>_(F,{title_path:Z}),placeholder:"properties.headline",mono:!0}),d.jsx(Ya,{label:"time_path",value:U.time_path??"",onChange:Z=>_(F,{time_path:Z}),placeholder:"properties.updated",mono:!0}),d.jsx("div",{className:"col-span-2",children:d.jsx(Ya,{label:"summary_template — use {dest_key} tokens from your field mappings",value:U.summary_template??"",onChange:Z=>_(F,{summary_template:Z}),placeholder:"⚡ Power out — {customers} affected, ETA {eta}",mono:!0})})]}),d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Field Mappings"}),d.jsxs("button",{onClick:()=>C(F),className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[d.jsx(si,{size:12})," Add mapping"]})]}),U.field_mappings.length===0?d.jsxs("p",{className:"text-xs text-[#555]",children:["No mappings. Each mapping pulls a dotted ",d.jsx("code",{children:"source_path"})," from an item into a ",d.jsx("code",{children:"dest_key"})," you can reference in the summary template."]}):d.jsx("div",{className:"space-y-2",children:U.field_mappings.map((Z,J)=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"text",value:Z.source_path,onChange:re=>M(F,J,{source_path:re.target.value}),placeholder:"source_path (e.g. properties.customers)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("span",{className:"text-[#555] text-xs",children:"→"}),d.jsx("input",{type:"text",value:Z.dest_key,onChange:re=>M(F,J,{dest_key:re.target.value}),placeholder:"dest_key (e.g. customers)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("button",{onClick:()=>A(F,J),title:"Remove mapping",className:"flex items-center px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(li,{size:12})})]},J))})]}),d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Preview"}),d.jsxs("button",{onClick:()=>j(F),disabled:!U.url||$,className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[$?d.jsx(nv,{size:12,className:"animate-spin"}):d.jsx(rv,{size:12}),$?"Fetching…":"Preview"]})]}),W&&d.jsxs("div",{className:"space-y-2",children:[W.ok?d.jsxs("div",{className:"text-xs text-green-400",children:["HTTP ",W.status??"200",typeof W.item_count=="number"&&d.jsxs("span",{className:"text-[#999]",children:[" ","— items_path resolved ",W.item_count," item",W.item_count===1?"":"s"]})]}):d.jsx("div",{className:"text-xs text-red-400 break-words",children:W.error}),W.items_path_note&&d.jsx("div",{className:"text-xs text-amber-400 break-words",children:W.items_path_note}),W.first_item&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] uppercase tracking-widest text-[#555] mb-1",children:"First item"}),d.jsx("pre",{className:"bg-[#0d0d0d] border border-border p-2 text-[11px] font-mono text-[#bbb] overflow-auto max-h-48 whitespace-pre",children:W.first_item})]}),W.sample&&d.jsxs("details",{open:!W.first_item,children:[d.jsx("summary",{className:"text-[10px] uppercase tracking-widest text-[#555] cursor-pointer",children:"Raw response"}),d.jsx("pre",{className:"mt-1 bg-[#0d0d0d] border border-border p-2 text-[11px] font-mono text-[#bbb] overflow-auto max-h-72 whitespace-pre",children:W.sample})]})]})]})]},F)})}),d.jsxs("div",{className:"flex items-center justify-between gap-2 pb-2",children:[d.jsxs("button",{onClick:w,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[d.jsx(si,{size:14})," Add source"]}),x&&V]})]})}const ZCe={enabled:!1,observers:[],tle_groups:["weather","stations"],norad_ids:[],min_elevation_deg:10,window_hours:24,tle_refresh_seconds:21600,broadcast_lead_seconds:3600,feed_source:"central"};function YCe({feed:e}){const t=e.is_loaded?e.consecutive_errors>0?"bg-amber-500":"bg-green-500":"bg-red-500",r=e.is_loaded?e.consecutive_errors>0?`${e.consecutive_errors} errors`:"Healthy":"Not loaded",n=e.last_fetch?new Date(e.last_fetch*1e3).toLocaleTimeString():"Never";return d.jsxs("div",{className:"bg-bg-hover p-4",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${t}`}),d.jsx("span",{className:"text-sm font-medium text-white uppercase",children:e.source})]}),d.jsx("span",{className:"text-xs text-[#777]",children:r})]}),d.jsxs("div",{className:"text-xs font-mono text-[#666] space-y-1",children:[d.jsxs("div",{children:["Events: ",e.event_count]}),d.jsxs("div",{children:["Last fetch: ",n]}),e.last_error&&d.jsx("div",{className:"text-accent truncate",children:e.last_error})]})]})}function XCe({event:e}){const t=e.severity.toLowerCase(),r=t==="extreme"||t==="severe"||t==="immediate"?{bg:"bg-red-500/10",border:"border-red-500",Icon:Nh,color:"text-red-500"}:t==="moderate"||t==="warning"||t==="priority"?{bg:"bg-accent/10",border:"border-amber-500",Icon:vi,color:"text-accent"}:{bg:"bg-sky-400/10",border:"border-sky-400",Icon:d1,color:"text-sky-400"},n=r.Icon;return d.jsx("div",{className:`p-3 ${r.bg} border-l-2 ${r.border}`,children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(n,{size:16,className:r.color}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-sm font-medium text-white",children:e.event_type}),d.jsx("span",{className:`text-xs px-1.5 py-0.5 ${r.bg} ${r.color}`,children:e.severity})]}),d.jsx("div",{className:"text-sm font-sans text-[#e0e0e0]",children:e.headline})]})]})})}function jZ({value:e,onChange:t,disabled:r,centralDisabled:n}){const a="px-2 py-1 text-xs transition-colors";return d.jsxs("div",{className:`flex border border-border overflow-hidden ${r?"opacity-40":""}`,children:[d.jsx("button",{type:"button",disabled:r,onClick:()=>t("native"),className:`${a} ${e==="native"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"native"}),d.jsx("button",{type:"button",disabled:r||n,title:n?"Central not available for this adapter":"",onClick:()=>{n||t("central")},className:`${a} ${n?"text-[#666] cursor-not-allowed":e==="central"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"central"})]})}function qCe({title:e,subtitle:t,enabled:r,onEnabled:n,feedSource:a,onFeedSource:i,hasCentral:o,nativeOnly:s,hasKey:l,health:u,events:c,children:h,llmContext:f,onLlmContext:v}){const g=s||!o;return d.jsxs("div",{className:"border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:e}),t&&d.jsx("p",{className:"text-xs text-[#666]",children:t})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[v!==void 0&&d.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",title:"Include this adapter's data in LLM (bot) context",children:[d.jsx("input",{type:"checkbox",checked:f??!0,onChange:m=>v(m.target.checked),className:"w-3.5 h-3.5 accent-[#f59e0b]"}),d.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"LLM"})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),d.jsx(jZ,{value:a,onChange:i,disabled:!r,centralDisabled:g})]}),d.jsx(qt,{label:"",checked:r,onChange:n})]})]}),!l&&d.jsx("div",{className:"text-xs text-accent bg-accent/10 p-2",children:"API key required — set it in the field below"}),s&&d.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available for this adapter — native only"}),d.jsx("div",{className:r?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:h}),(u||c&&c.length>0)&&d.jsxs("div",{className:"pt-2 border-t border-border space-y-3",children:[d.jsx("div",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"Live status"}),u?d.jsx(YCe,{feed:u}):d.jsx("div",{className:"text-xs text-[#666]",children:"No status reported."}),c&&c.length>0&&d.jsx("div",{className:"space-y-2",children:c.slice(0,5).map((m,y)=>d.jsx(XCe,{event:m},y))})]})]})}const dc={nws:{label:"NWS Weather Alerts",subtitle:"National Weather Service alerts",health:"nws",hasCentral:!0,nativeOnly:!1,hasKey:!0},fires:{label:"NIFC Fire Perimeters",subtitle:"Active wildfires (National Interagency Fire Center)",health:"nifc",hasCentral:!0,nativeOnly:!1,hasKey:!0},firms:{label:"NASA FIRMS Hotspots",subtitle:"Satellite thermal-anomaly detections",health:"firms",hasCentral:!0,nativeOnly:!1,hasKey:!1},swpc:{label:"NOAA Space Weather (SWPC)",subtitle:"Solar indices, geomagnetic storms",health:"swpc",hasCentral:!0,nativeOnly:!1,hasKey:!0},ducting:{label:"Tropospheric Ducting",subtitle:"VHF/UHF extended-range conditions",health:"ducting",hasCentral:!1,nativeOnly:!0,hasKey:!0},traffic:{label:"TomTom Traffic",subtitle:"Traffic flow on monitored corridors",health:"traffic",hasCentral:!0,nativeOnly:!1,hasKey:!0},roads511:{label:"511 Road Conditions",subtitle:"State DOT road events and closures",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!1},wzdx:{label:"WZDx Work Zones",subtitle:"Planned road work and construction events from ITD",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs_quake:{label:"USGS Earthquakes",subtitle:"Seismic events from the USGS feed",health:"usgs_quake",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs:{label:"USGS Stream Gauges",subtitle:"River and stream water levels",health:"usgs",hasCentral:!0,nativeOnly:!1,hasKey:!0},avalanche:{label:"Avalanche Advisories",subtitle:"Backcountry avalanche danger ratings",health:"avalanche",hasCentral:!0,nativeOnly:!1,hasKey:!0},satpass:{label:"Satellite Passes",subtitle:"Observer pass alerts via Central",health:"satpass",hasCentral:!0,nativeOnly:!1,hasKey:!0}},KCe={firms:"FIRMS_MAP_KEY",roads511:"ROADS511_API_KEY",traffic:"TOMTOM_API_KEY"},Q2=[{key:"central",label:"Central",icon:MJ,adapters:[]},{key:"weather",label:"Weather",icon:kh,adapters:["nws"]},{key:"fire",label:"Fire",icon:Rm,adapters:["fires","firms"]},{key:"rf",label:"RF Propagation",icon:_i,adapters:["swpc","ducting"]},{key:"roads",label:"Roads",icon:u1,adapters:["traffic","roads511","wzdx"]},{key:"geohazards",label:"Geohazards",icon:kf,adapters:["usgs_quake","usgs","avalanche"]},{key:"tracking",label:"Tracking",icon:f1,adapters:["satpass"]},{key:"mesh",label:"Mesh Health",icon:Oo,adapters:[]},{key:"family_settings",label:"Family Settings",icon:NV,adapters:[]}];function JCe(){var cy,hy,dy,Xh,nl,Iv;const[e,t]=E.useState(null),[r,n]=E.useState(""),[a,i]=E.useState(null),[o,s]=E.useState([]),[l,u]=E.useState(!0),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(null),[y,x]=E.useState(!1),[_,w]=E.useState("weather"),[S,C]=E.useState("nws"),[M,A]=E.useState("curated"),[I,k]=E.useState({}),[P,D]=E.useState({}),[z,j]=E.useState({allowed_incident_types:["WF"],freshness_seconds:0,cooldown_seconds:28800,broadcast_on_acres:!0,broadcast_on_contained:!0}),[B,H]=E.useState(""),[V,U]=E.useState({min_magnitude:4,drop_non_present:!0,drop_zero_magnitude:!0}),[F,W]=E.useState(""),[$,Z]=E.useState({min_severity:"None",enabled_categories:["incident","closure"],enabled_sub_types:["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]}),[J,re]=E.useState(""),[Q,le]=E.useState({broadcast:!1,min_severity:"Minor",sub_types:["road_works","lane_closed","road_closed"]}),[de,He]=E.useState(""),[ye,ne]=E.useState({broadcast_severities:["Extreme","Severe"],duplicate_allowed_after_seconds:3600}),[xe,he]=E.useState(""),[ge,tt]=E.useState({min_danger_level:3}),[Ue,qe]=E.useState(""),[Fe,_t]=E.useState({geomag_kp_floor:7,flare_class_floor:"X1",proton_pfu_floor:10}),[bt,et]=E.useState(""),[Ke,St]=E.useState({enabled:!1,observers:[],min_elevation:30,norad_ids:[],max_broadcasts_per_hour:4,dry_run:!0}),[ce,st]=E.useState(""),[Bt,Ft]=E.useState(null),[jt,Lr]=E.useState(null),[Qo,tl]=E.useState(!1),[Ki,Uh]=E.useState([]),[Gn,es]=E.useState(null),[ts,Au]=E.useState(""),[Wh,Va]=E.useState(!1),[$h,Nu]=E.useState(null),[ku,rl]=E.useState(null);E.useEffect(()=>{document.title="Environment — MeshAI",(async()=>{var se,ut,Ze,mt,rr,ia,cn,An,q,Me,ct,ot,dt,os,Ji,Qi,gr,eo,al,il,qh,ol,Kh,Jh,Du,Qh;try{const Ci=await(await fetch("/api/config/environmental")).json();Ci.satpass={...ZCe,...Ci.satpass??{}},Ci.wzdx={states:["ID"],registry_url:"",...Ci.wzdx??{}},t(Ci),n(JSON.stringify(Ci));const to=Vt=>{const Ot={};if(Array.isArray(Vt))for(const Ie of Vt)Ot[Ie.key]={value:Ie.value};return Ot};try{const Vt=await fetch("/api/adapter-config/wfigs");if(Vt.ok){const Ot=to(await Vt.json()),Ie={allowed_incident_types:((se=Ot.allowed_incident_types)==null?void 0:se.value)??["WF"],freshness_seconds:((ut=Ot.freshness_seconds)==null?void 0:ut.value)??0,cooldown_seconds:((Ze=Ot.cooldown_seconds)==null?void 0:Ze.value)??28800,broadcast_on_acres:((mt=Ot.broadcast_on_acres)==null?void 0:mt.value)??!0,broadcast_on_contained:((rr=Ot.broadcast_on_contained)==null?void 0:rr.value)??!0};j(Ie),H(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/tomtom_incidents");if(Vt.ok){const Ot=to(await Vt.json()),Ie={min_magnitude:((ia=Ot.min_magnitude)==null?void 0:ia.value)??4,drop_non_present:((cn=Ot.drop_non_present)==null?void 0:cn.value)??!0,drop_zero_magnitude:((An=Ot.drop_zero_magnitude)==null?void 0:An.value)??!0};U(Ie),W(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/itd_511");if(Vt.ok){const Ot=to(await Vt.json()),Ie={min_severity:((q=Ot.min_severity)==null?void 0:q.value)??"None",enabled_categories:((Me=Ot.enabled_categories)==null?void 0:Me.value)??["incident","closure"],enabled_sub_types:((ct=Ot.enabled_sub_types)==null?void 0:ct.value)??["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]};Z(Ie),re(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/wzdx");if(Vt.ok){const Ot=to(await Vt.json()),Ie={broadcast:((ot=Ot.broadcast)==null?void 0:ot.value)??!1,min_severity:((dt=Ot.min_severity)==null?void 0:dt.value)??"Minor",sub_types:((os=Ot.sub_types)==null?void 0:os.value)??["road_works","lane_closed","road_closed"]};le(Ie),He(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/nws");if(Vt.ok){const Ot=to(await Vt.json()),Ie={broadcast_severities:((Ji=Ot.broadcast_severities)==null?void 0:Ji.value)??["Extreme","Severe"],duplicate_allowed_after_seconds:((Qi=Ot.duplicate_allowed_after_seconds)==null?void 0:Qi.value)??3600};ne(Ie),he(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/avalanche");if(Vt.ok){const Ie={min_danger_level:((gr=to(await Vt.json()).min_danger_level)==null?void 0:gr.value)??3};tt(Ie),qe(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/swpc");if(Vt.ok){const Ot=to(await Vt.json()),Ie={geomag_kp_floor:((eo=Ot.geomag_kp_floor)==null?void 0:eo.value)??7,flare_class_floor:((al=Ot.flare_class_floor)==null?void 0:al.value)??"X1",proton_pfu_floor:((il=Ot.proton_pfu_floor)==null?void 0:il.value)??10};_t(Ie),et(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-meta");if(Vt.ok){const Ot=await Vt.json(),Ie={};for(const[Hn,Wt]of Object.entries(Ot))Ie[Hn]=Wt.include_in_llm_context??!0;k(Ie)}}catch{}try{const Vt=await fetch("/api/adapter-config/satpass");if(Vt.ok){const Ot=await Vt.json(),Ie={};for(const Wt of Ot)Ie[Wt.key]=Wt;const Hn={enabled:((qh=Ie.enabled)==null?void 0:qh.value)??!1,observers:((ol=Ie.observers)==null?void 0:ol.value)??[],min_elevation:((Kh=Ie.min_elevation)==null?void 0:Kh.value)??30,norad_ids:((Jh=Ie.norad_ids)==null?void 0:Jh.value)??[],max_broadcasts_per_hour:((Du=Ie.max_broadcasts_per_hour)==null?void 0:Du.value)??4,dry_run:((Qh=Ie.dry_run)==null?void 0:Qh.value)??!0};St(Hn),st(JSON.stringify(Hn))}}catch{}}catch(ju){v(ju instanceof Error?ju.message:"Failed to load config")}finally{u(!1)}})()},[]),E.useEffect(()=>{(async()=>{try{const se=await fetch("/api/config/notifications");if(se.ok){const ut=await se.json();es(ut),Au(JSON.stringify(ut))}}catch{}})()},[]),E.useEffect(()=>{(async()=>{try{const se=await fetch("/api/config/coverage");if(se.ok){const ut=await se.json();tl(!!ut.enabled),Uh(Array.isArray(ut.excluded_adapters)?ut.excluded_adapters:[])}}catch{}})()},[]),E.useEffect(()=>{(async()=>{try{const se=await fetch("/api/secrets");if(se.ok){const ut=await se.json(),Ze={};for(const mt of ut)Ze[mt.env_var]=mt.is_set;D(Ze)}}catch{}})()},[]),E.useEffect(()=>{const se=async()=>{try{i(await WV()),s(await $V())}catch{}};se();const ut=setInterval(se,3e4);return()=>clearInterval(ut)},[]);const Lu=e!==null&&JSON.stringify(e)!==r,Iu=JSON.stringify(z)!==B,rs=JSON.stringify(V)!==F,ns=JSON.stringify($)!==J,ue=JSON.stringify(Q)!==de,Xe=JSON.stringify(ye)!==xe,lt=JSON.stringify(ge)!==Ue,Pt=JSON.stringify(Fe)!==bt,fr=JSON.stringify(Ke)!==ce,Tn=Lu||Iu||rs||ns||ue||Xe||lt||Pt||fr,Ct=async(se,ut,Ze)=>{const mt=await fetch(`/api/adapter-config/${se}/${ut}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:Ze})});if(!mt.ok){const rr=await mt.json().catch(()=>({}));throw new Error(rr.detail||`Failed to save ${se}.${ut}`)}},as=async(se,ut)=>{k(Ze=>({...Ze,[se]:ut}));try{await fetch(`/api/adapter-meta/${se}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({include_in_llm_context:ut})})}catch{}},Mn=async()=>{if(e){h(!0),v(null),m(null);try{if(Lu){const se=await fetch("/api/config/environmental",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),ut=await se.json();if(!se.ok)throw new Error(ut.detail||"Save failed");n(JSON.stringify(e)),ut.restart_required&&x(!0)}if(Iu){const se=JSON.parse(B);z.freshness_seconds!==se.freshness_seconds&&await Ct("wfigs","freshness_seconds",z.freshness_seconds),JSON.stringify(z.allowed_incident_types)!==JSON.stringify(se.allowed_incident_types)&&await Ct("wfigs","allowed_incident_types",z.allowed_incident_types),z.cooldown_seconds!==se.cooldown_seconds&&await Ct("wfigs","cooldown_seconds",z.cooldown_seconds),z.broadcast_on_acres!==se.broadcast_on_acres&&await Ct("wfigs","broadcast_on_acres",z.broadcast_on_acres),z.broadcast_on_contained!==se.broadcast_on_contained&&await Ct("wfigs","broadcast_on_contained",z.broadcast_on_contained),H(JSON.stringify(z))}if(rs){const se=JSON.parse(F);V.min_magnitude!==se.min_magnitude&&await Ct("tomtom_incidents","min_magnitude",V.min_magnitude),V.drop_non_present!==se.drop_non_present&&await Ct("tomtom_incidents","drop_non_present",V.drop_non_present),V.drop_zero_magnitude!==se.drop_zero_magnitude&&await Ct("tomtom_incidents","drop_zero_magnitude",V.drop_zero_magnitude),W(JSON.stringify(V))}if(ns){const se=JSON.parse(J);$.min_severity!==se.min_severity&&await Ct("itd_511","min_severity",$.min_severity),JSON.stringify($.enabled_categories)!==JSON.stringify(se.enabled_categories)&&await Ct("itd_511","enabled_categories",$.enabled_categories),JSON.stringify($.enabled_sub_types)!==JSON.stringify(se.enabled_sub_types)&&await Ct("itd_511","enabled_sub_types",$.enabled_sub_types),re(JSON.stringify($))}if(ue){const se=JSON.parse(de);Q.broadcast!==se.broadcast&&await Ct("wzdx","broadcast",Q.broadcast),Q.min_severity!==se.min_severity&&await Ct("wzdx","min_severity",Q.min_severity),JSON.stringify(Q.sub_types)!==JSON.stringify(se.sub_types)&&await Ct("wzdx","sub_types",Q.sub_types),He(JSON.stringify(Q))}if(Xe){const se=JSON.parse(xe);JSON.stringify(ye.broadcast_severities)!==JSON.stringify(se.broadcast_severities)&&await Ct("nws","broadcast_severities",ye.broadcast_severities),ye.duplicate_allowed_after_seconds!==se.duplicate_allowed_after_seconds&&await Ct("nws","duplicate_allowed_after_seconds",ye.duplicate_allowed_after_seconds),he(JSON.stringify(ye))}if(lt){const se=JSON.parse(Ue);ge.min_danger_level!==se.min_danger_level&&await Ct("avalanche","min_danger_level",ge.min_danger_level),qe(JSON.stringify(ge))}if(Pt){const se=JSON.parse(bt);Fe.geomag_kp_floor!==se.geomag_kp_floor&&await Ct("swpc","geomag_kp_floor",Fe.geomag_kp_floor),Fe.flare_class_floor!==se.flare_class_floor&&await Ct("swpc","flare_class_floor",Fe.flare_class_floor),Fe.proton_pfu_floor!==se.proton_pfu_floor&&await Ct("swpc","proton_pfu_floor",Fe.proton_pfu_floor),et(JSON.stringify(Fe))}if(fr){const se=JSON.parse(ce);Ke.enabled!==se.enabled&&await Ct("satpass","enabled",Ke.enabled),JSON.stringify(Ke.observers)!==JSON.stringify(se.observers)&&await Ct("satpass","observers",Ke.observers),Ke.min_elevation!==se.min_elevation&&await Ct("satpass","min_elevation",Ke.min_elevation),JSON.stringify(Ke.norad_ids)!==JSON.stringify(se.norad_ids)&&await Ct("satpass","norad_ids",Ke.norad_ids),Ke.max_broadcasts_per_hour!==se.max_broadcasts_per_hour&&await Ct("satpass","max_broadcasts_per_hour",Ke.max_broadcasts_per_hour),Ke.dry_run!==se.dry_run&&await Ct("satpass","dry_run",Ke.dry_run),st(JSON.stringify(Ke))}m("Config saved"),setTimeout(()=>m(null),3e3)}catch(se){v(se instanceof Error?se.message:"Save failed")}finally{h(!1)}}},$e=()=>{e&&t(JSON.parse(r)),j(JSON.parse(B||JSON.stringify(z))),U(JSON.parse(F||JSON.stringify(V))),Z(JSON.parse(J||JSON.stringify($))),le(JSON.parse(de||JSON.stringify(Q))),ne(JSON.parse(xe||JSON.stringify(ye))),tt(JSON.parse(Ue||JSON.stringify(ge))),_t(JSON.parse(bt||JSON.stringify(Fe))),St(JSON.parse(ce||JSON.stringify(Ke))),Ft(null),Lr(null)},Zh=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{v("Restart failed")}},Ne=se=>e&&t({...e,...se}),aa=se=>Qo&&!Ki.includes(se),Pu={nws:"nws",fires:"wfigs",firms:"firms",swpc:"swpc",ducting:"ducting",traffic:"tomtom_incidents",roads511:"itd_511",wzdx:"wzdx",usgs:"usgs",usgs_quake:"usgs_quake",avalanche:"avalanche",satpass:"satpass"},Lv=(Gn==null?void 0:Gn.toggles)||{},oy=Gn!==null&&JSON.stringify(Gn)!==ts,Ga=(se,ut)=>{if(!Gn)return;const Ze=Gn.toggles||{};es({...Gn,toggles:{...Ze,[se]:{...Ze[se]||{},name:se,...ut}}})},sy=async()=>{if(Gn){Va(!0),Nu(null),rl(null);try{const se=await fetch("/api/config/notifications");if(!se.ok)throw new Error("Failed to re-fetch notifications config");const ut=await se.json(),Ze={...ut,toggles:{...ut.toggles||{}}},mt=Gn.toggles||{};for(const{key:cn}of fu){const An=mt[cn];if(!An)continue;const q=(ut.toggles||{})[cn]||{};Ze.toggles[cn]={...q,name:q.name||cn,enabled:An.enabled,min_severity:An.min_severity,freshness_seconds:An.freshness_seconds??q.freshness_seconds??600,cooldown_seconds:An.cooldown_seconds??q.cooldown_seconds??0,regions:An.regions??q.regions??[]}}const rr=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ze)}),ia=await rr.json();if(!rr.ok)throw new Error(ia.detail||"Save failed");es(Ze),Au(JSON.stringify(Ze)),rl("Family settings saved"),setTimeout(()=>rl(null),3e3)}catch(se){Nu(se instanceof Error?se.message:"Save failed")}finally{Va(!1)}}},xw=()=>{ts&&es(JSON.parse(ts))};if(l)return d.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading environmental config…"});if(!e)return d.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:f||"No config"});const _w=se=>a==null?void 0:a.feeds.find(ut=>ut.source===dc[se].health),bw=se=>o.filter(ut=>ut.source===dc[se].health),ww=se=>{const ut=KCe[se];if(!ut)return!0;const Ze=P[ut];return Ze===void 0?!0:Ze},is=Q2.find(se=>se.key===_),Rr=is.adapters.length===0?null:S&&is.adapters.includes(S)?S:is.adapters[0],Yh=se=>{var ut,Ze,mt,rr,ia,cn,An;switch(se){case"nws":return d.jsxs(d.Fragment,{children:[aa("nws")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Geographic scope (zones, areas) is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),'. Enable "Use own config" for NWS on that page to edit zones here.']}):d.jsxs(d.Fragment,{children:[d.jsx(la,{label:"NWS Zones",value:e.nws_zones,onChange:q=>Ne({nws_zones:q}),helper:"Zone IDs like IDZ016, IDZ030",infoLink:"https://www.weather.gov/pimar/PubZone"}),d.jsx(la,{label:"NWS Areas",value:e.nws.areas??[],onChange:q=>Ne({nws:{...e.nws,areas:q}}),helper:"State codes NWS pulls, e.g. ID"})]}),e.nws.feed_source!=="central"&&d.jsxs(d.Fragment,{children:[d.jsx(yt,{label:"User Agent",value:e.nws.user_agent,onChange:q=>Ne({nws:{...e.nws,user_agent:q}}),placeholder:"(MeshAI, you@email.com)",helper:"Format: (app_name, contact_email)"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Tick Seconds",value:e.nws.tick_seconds,onChange:q=>Ne({nws:{...e.nws,tick_seconds:q}}),min:30}),d.jsx(Dn,{label:"Min Severity",value:e.nws.severity_min,onChange:q=>Ne({nws:{...e.nws,severity_min:q}}),options:[{value:"minor",label:"Minor"},{value:"moderate",label:"Moderate"},{value:"severe",label:"Severe"},{value:"extreme",label:"Extreme"}]})]})]}),e.nws.feed_source==="central"&&d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),d.jsxs("div",{className:"mb-3",children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Severities to broadcast"}),d.jsx("div",{className:"flex gap-6",children:["Extreme","Severe","Moderate","Minor"].map(q=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:ye.broadcast_severities.includes(q),onChange:Me=>{const ct=ye.broadcast_severities;ne({...ye,broadcast_severities:Me.target.checked?[...ct,q]:ct.filter(ot=>ot!==q)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:q})]},q))})]}),d.jsx(Ae,{label:"Re-broadcast Cooldown (seconds)",value:ye.duplicate_allowed_after_seconds,onChange:q=>ne({...ye,duplicate_allowed_after_seconds:q}),min:0,helper:"Minimum seconds before the same alert ID can be re-broadcast"})]})]});case"swpc":return d.jsx("div",{className:"space-y-6",children:d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Thresholds"}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsx(Dn,{label:"Geomag Kp Floor",value:String(Fe.geomag_kp_floor),onChange:q=>_t({...Fe,geomag_kp_floor:Number(q)}),options:[{value:"5",label:"5 — G1 Minor"},{value:"6",label:"6 — G2 Moderate"},{value:"7",label:"7 — G3 Strong"},{value:"8",label:"8 — G4 Severe"},{value:"9",label:"9 — G5 Extreme"}],helper:"Kp at or above this triggers geomag broadcast"}),d.jsx(Dn,{label:"Flare Class Floor",value:Fe.flare_class_floor,onChange:q=>_t({...Fe,flare_class_floor:q}),options:[{value:"M1",label:"M1 — R1 Minor"},{value:"M5",label:"M5 — R2 Moderate"},{value:"X1",label:"X1 — R3 Strong"},{value:"X10",label:"X10 — R4 Severe"}],helper:"X-ray flare class floor for broadcast"}),d.jsx(Dn,{label:"Proton pfu Floor",value:String(Fe.proton_pfu_floor),onChange:q=>_t({...Fe,proton_pfu_floor:Number(q)}),options:[{value:"10",label:"10 — S1 Minor"},{value:"100",label:"100 — S2 Moderate"},{value:"1000",label:"1000 — S3 Strong"},{value:"10000",label:"10000 — S4 Severe"}],helper:"Proton flux (pfu) at ≥10 MeV for broadcast"})]})]})});case"ducting":return d.jsxs("div",{className:"space-y-3",children:[d.jsx(Ae,{label:"Tick Seconds",value:e.ducting.tick_seconds,onChange:q=>Ne({ducting:{...e.ducting,tick_seconds:q}}),min:60}),aa("ducting")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Lat/lon is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Latitude",value:e.ducting.latitude,onChange:q=>Ne({ducting:{...e.ducting,latitude:q}}),step:.01}),d.jsx(Ae,{label:"Longitude",value:e.ducting.longitude,onChange:q=>Ne({ducting:{...e.ducting,longitude:q}}),step:.01})]})]});case"fires":return d.jsxs("div",{className:"space-y-6",children:[e.fires.feed_source!=="central"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Tick Seconds",value:e.fires.tick_seconds,onChange:q=>Ne({fires:{...e.fires,tick_seconds:q}}),min:60}),aa("fires")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50 self-end",children:["State scoped by"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(Dn,{label:"State",value:e.fires.state,onChange:q=>Ne({fires:{...e.fires,state:q}}),options:vCe})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Incident Types"}),d.jsx("div",{className:"flex gap-6",children:[["WF","Wildfire"],["RX","Prescribed Burn"],["OTHER","Other"]].map(([q,Me])=>{var ct;return d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:((ct=z.allowed_incident_types)==null?void 0:ct.includes(q))??q==="WF",onChange:ot=>{const dt=z.allowed_incident_types??["WF"];j({...z,allowed_incident_types:ot.target.checked?[...dt,q]:dt.filter(os=>os!==q)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Me})]},q)})})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Triggers"}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on acres increase"}),d.jsx("input",{type:"checkbox",checked:z.broadcast_on_acres,onChange:q=>j({...z,broadcast_on_acres:q.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on containment increase"}),d.jsx("input",{type:"checkbox",checked:z.broadcast_on_contained,onChange:q=>j({...z,broadcast_on_contained:q.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Update Cooldown (hours)",value:Math.round(z.cooldown_seconds/3600),onChange:q=>j({...z,cooldown_seconds:q*3600}),min:0,helper:"Minimum hours between updates for the same fire"}),d.jsx(Ae,{label:"Freshness Window (hours)",value:Math.round(z.freshness_seconds/3600),onChange:q=>j({...z,freshness_seconds:q*3600}),min:0,helper:"0 = always broadcast regardless of event age"})]})]});case"avalanche":return d.jsxs("div",{className:"space-y-6",children:[e.avalanche.feed_source!=="central"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Tick Seconds",value:e.avalanche.tick_seconds,onChange:q=>Ne({avalanche:{...e.avalanche,tick_seconds:q}}),min:60}),d.jsx(X2,{label:"Season Months",value:e.avalanche.season_months,onChange:q=>Ne({avalanche:{...e.avalanche,season_months:q}}),helper:"e.g., 12, 1, 2, 3, 4"})]}),aa("avalanche")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Avalanche center IDs are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(la,{label:"Center IDs",value:e.avalanche.center_ids,onChange:q=>Ne({avalanche:{...e.avalanche,center_ids:q}}),helper:"e.g., SNFAC",infoLink:"https://avalanche.org/avalanche-centers/"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsx(Dn,{label:"Min Danger Level",value:String(ge.min_danger_level),onChange:q=>tt({...ge,min_danger_level:Number(q)}),options:[{value:"3",label:"3 — Considerable"},{value:"4",label:"4 — High"},{value:"5",label:"5 — Extreme"}],helper:"Minimum avalanche danger level to broadcast"})})]})]});case"usgs":return d.jsxs(d.Fragment,{children:[d.jsx(Ae,{label:"Tick Seconds",value:e.usgs.tick_seconds,onChange:q=>Ne({usgs:{...e.usgs,tick_seconds:q}}),min:900,helper:"Minimum 15 min (900s). tick_seconds is the native-mode poll interval; ignored when this adapter is set to feed_source=central."}),aa("usgs")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Gauge site IDs are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(la,{label:"Site IDs",value:e.usgs.sites,onChange:q=>Ne({usgs:{...e.usgs,sites:q}}),helper:"USGS gauge site numbers",infoLink:"https://waterdata.usgs.gov/nwis"}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Flood Thresholds (advanced JSON)"}),d.jsx("textarea",{value:Bt??JSON.stringify(e.usgs.flood_thresholds??{},null,2),onChange:q=>{const Me=q.target.value;Ft(Me);try{const ct=JSON.parse(Me);Lr(null),Ne({usgs:{...e.usgs,flood_thresholds:ct}})}catch(ct){Lr(ct instanceof Error?ct.message:"Invalid JSON")}},rows:6,spellCheck:!1,className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm font-mono"}),jt&&d.jsxs("p",{className:"text-xs text-red-400 mt-1",children:["Invalid JSON — not saved: ",jt]}),d.jsxs("p",{className:"text-xs text-[#666] mt-1",children:["Per-site flood levels, shape ","{",'"site_id": ',"{",' "flow": X, "height": Y ',"}","}"]})]})]});case"usgs_quake":return d.jsxs("div",{className:"space-y-6",children:[e.usgs_quake.feed_source!=="central"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Tick Seconds",value:e.usgs_quake.tick_seconds,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,tick_seconds:q}}),min:60}),d.jsx(yt,{label:"Region Tag",value:e.usgs_quake.region,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,region:q}})})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Native Feed"}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(yt,{label:"Quake Feed URL",value:e.usgs_quake.feed_url,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,feed_url:q}})}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsx(Ae,{label:"Min Magnitude",value:e.usgs_quake.min_magnitude??2.5,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,min_magnitude:q}}),step:.1,min:0,helper:"Native quake magnitude floor"})}),aa("usgs_quake")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(X2,{label:"Bounding Box [W, S, E, N]",value:e.usgs_quake.bbox??[],onChange:q=>Ne({usgs_quake:{...e.usgs_quake,bbox:q}}),helper:"Four values: west, south, east, north"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Magnitude Thresholds"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Global Floor",value:e.usgs_quake.global_mag_floor,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,global_mag_floor:q}}),step:.1,min:0,helper:"Broadcast anywhere at or above this magnitude"}),d.jsx(Ae,{label:"Regional Floor",value:e.usgs_quake.regional_mag_floor,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,regional_mag_floor:q}}),step:.1,min:0,helper:"Reduced floor within regional radius"}),d.jsx(Ae,{label:"Regional Radius (mi)",value:e.usgs_quake.regional_radius_mi,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,regional_radius_mi:q}}),min:50,helper:"Radius around region centroid for reduced floor"}),d.jsx(Ae,{label:"Escalation Floor",value:e.usgs_quake.escalate_mag_floor,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,escalate_mag_floor:q}}),step:.1,min:0,helper:"Magnitude at which broadcast uses warning emoji"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"PAGER Alert Levels"}),d.jsx("div",{className:"text-xs text-[#666] mb-2",children:"Broadcast at any magnitude when USGS PAGER alert reaches these levels"}),d.jsx("div",{className:"flex gap-6",children:["green","yellow","orange","red"].map(q=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:(e.usgs_quake.broadcast_pager_alerts??[]).includes(q),onChange:Me=>{const ct=e.usgs_quake.broadcast_pager_alerts??[];Ne({usgs_quake:{...e.usgs_quake,broadcast_pager_alerts:Me.target.checked?[...ct,q]:ct.filter(ot=>ot!==q)}})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0] capitalize",children:q})]},q))})]})]});case"traffic":return d.jsxs(d.Fragment,{children:[d.jsx($p,{envVar:"TOMTOM_API_KEY",label:"API Key",helper:"developer.tomtom.com"}),d.jsx(Ae,{label:"Tick Seconds",value:e.traffic.tick_seconds,onChange:q=>Ne({traffic:{...e.traffic,tick_seconds:q}}),min:60}),aa("traffic")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Traffic corridors are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"text-xs text-[#666] mt-2",children:"Corridors:"}),(e.traffic.corridors||[]).map((q,Me)=>d.jsxs("div",{className:"grid grid-cols-4 gap-2 items-end",children:[d.jsx(yt,{label:"Name",value:q.name,onChange:ct=>{const ot=[...e.traffic.corridors];ot[Me]={...q,name:ct},Ne({traffic:{...e.traffic,corridors:ot}})}}),d.jsx(Ae,{label:"Lat",value:q.lat,onChange:ct=>{const ot=[...e.traffic.corridors];ot[Me]={...q,lat:ct},Ne({traffic:{...e.traffic,corridors:ot}})},step:.01}),d.jsx(Ae,{label:"Lon",value:q.lon,onChange:ct=>{const ot=[...e.traffic.corridors];ot[Me]={...q,lon:ct},Ne({traffic:{...e.traffic,corridors:ot}})},step:.01}),d.jsx("button",{onClick:()=>Ne({traffic:{...e.traffic,corridors:e.traffic.corridors.filter((ct,ot)=>ot!==Me)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},Me)),d.jsx("button",{onClick:()=>Ne({traffic:{...e.traffic,corridors:[...e.traffic.corridors||[],{name:"",lat:0,lon:0}]}}),className:"text-xs text-accent hover:underline",children:"+ Add Corridor"})]}),d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Magnitude"}),d.jsxs("select",{value:V.min_magnitude,onChange:q=>U({...V,min_magnitude:parseInt(q.target.value)}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[d.jsx("option",{value:1,children:"1 — Minor (all)"}),d.jsx("option",{value:2,children:"2 — Moderate (yellow+)"}),d.jsx("option",{value:3,children:"3 — Major (orange+)"}),d.jsx("option",{value:4,children:"4 — Severe (red only)"})]}),d.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop TomTom incidents below this severity level"})]})}),d.jsxs("div",{className:"mt-3 space-y-2",children:[d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop non-present time validity"}),d.jsx("input",{type:"checkbox",checked:V.drop_non_present,onChange:q=>U({...V,drop_non_present:q.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop zero-magnitude events"}),d.jsx("input",{type:"checkbox",checked:V.drop_zero_magnitude,onChange:q=>U({...V,drop_zero_magnitude:q.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]})]});case"roads511":return d.jsxs(d.Fragment,{children:[d.jsx(yt,{label:"Base URL",value:e.roads511.base_url,onChange:q=>Ne({roads511:{...e.roads511,base_url:q}}),placeholder:"https://511.yourstate.gov/api/v2"}),d.jsx($p,{envVar:"ROADS511_API_KEY",label:"API Key",helper:"Leave unset if 511 needs no key"}),d.jsx(Ae,{label:"Tick Seconds",value:e.roads511.tick_seconds,onChange:q=>Ne({roads511:{...e.roads511,tick_seconds:q}}),min:60}),d.jsx(la,{label:"Endpoints",value:e.roads511.endpoints,onChange:q=>Ne({roads511:{...e.roads511,endpoints:q}}),helper:"e.g., /get/event"}),aa("roads511")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((q,Me)=>{var ct;return d.jsx(Ae,{label:q,value:((ct=e.roads511.bbox)==null?void 0:ct[Me])??0,onChange:ot=>{const dt=[...e.roads511.bbox||[0,0,0,0]];dt[Me]=ot,Ne({roads511:{...e.roads511,bbox:dt}})},step:.01},q)})}),d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Severity"}),d.jsxs("select",{value:$.min_severity,onChange:q=>Z({...$,min_severity:q.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[d.jsx("option",{value:"None",children:"None (all)"}),d.jsx("option",{value:"Minor",children:"Minor+"}),d.jsx("option",{value:"Major",children:"Major only"})]}),d.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop ITD 511 events below this severity"})]})}),d.jsxs("div",{className:"mt-4",children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Categories"}),d.jsx("div",{className:"flex gap-6",children:[["incident","Incident"],["closure","Closure"],["special_event","Special Event"]].map(([q,Me])=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:$.enabled_categories.includes(q),onChange:ct=>{const ot=$.enabled_categories;Z({...$,enabled_categories:ct.target.checked?[...ot,q]:ot.filter(dt=>dt!==q)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Me})]},q))})]}),d.jsxs("div",{className:"mt-4",children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),d.jsx("div",{className:"grid grid-cols-2 gap-2",children:[["accident","Crash"],["road_closed","Road Closed"],["lane_closed","Lane Closure"],["vehicle_on_fire","Vehicle Fire"],["flooding","Flooding"],["debris","Debris"],["road_works","Road Works"],["disabled_vehicle","Disabled Vehicle"]].map(([q,Me])=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:$.enabled_sub_types.includes(q),onChange:ct=>{const ot=$.enabled_sub_types;Z({...$,enabled_sub_types:ct.target.checked?[...ot,q]:ot.filter(dt=>dt!==q)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Me})]},q))})]})]})]});case"wzdx":return d.jsxs(d.Fragment,{children:[((ut=e.wzdx)==null?void 0:ut.feed_source)!=="central"&&d.jsxs(d.Fragment,{children:[d.jsx(yt,{label:"Base URL",value:((Ze=e.wzdx)==null?void 0:Ze.base_url)??"",onChange:q=>Ne({wzdx:{...e.wzdx,base_url:q}}),placeholder:"https://511.yourstate.gov/api/v2"}),d.jsx($p,{envVar:"WZDX_API_KEY",label:"API Key",helper:"Leave unset if not required"}),d.jsx(Ae,{label:"Tick Seconds",value:((mt=e.wzdx)==null?void 0:mt.tick_seconds)??300,onChange:q=>Ne({wzdx:{...e.wzdx,tick_seconds:q}}),min:60}),d.jsx(la,{label:"Endpoints",value:((rr=e.wzdx)==null?void 0:rr.endpoints)??["/get/event"],onChange:q=>Ne({wzdx:{...e.wzdx,endpoints:q}}),helper:"e.g., /get/event"}),aa("wzdx")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box and states are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((q,Me)=>{var ct,ot;return d.jsx(Ae,{label:q,value:((ot=(ct=e.wzdx)==null?void 0:ct.bbox)==null?void 0:ot[Me])??0,onChange:dt=>{var Ji;const os=[...((Ji=e.wzdx)==null?void 0:Ji.bbox)||[0,0,0,0]];os[Me]=dt,Ne({wzdx:{...e.wzdx,bbox:os}})},step:.01},q)})}),d.jsx("div",{className:"text-xs text-[#666]",children:"Bounding box [W,S,E,N] geographic filter"}),d.jsx(la,{label:"States",value:((ia=e.wzdx)==null?void 0:ia.states)??[],onChange:q=>Ne({wzdx:{...e.wzdx,states:q}}),helper:"2-letter state codes to include from the WZDx Feed Registry, e.g. ID, OR"})]}),d.jsx(yt,{label:"Registry URL",value:((cn=e.wzdx)==null?void 0:cn.registry_url)??"",onChange:q=>Ne({wzdx:{...e.wzdx,registry_url:q}}),placeholder:"https://datahub.transportation.gov/resource/69qe-yiui.json?$limit=200",helper:"FHWA WZDx Feed Registry (Socrata) URL — lists every state DOT feed"}),d.jsx(Ae,{label:"Registry TTL (sec)",value:((An=e.wzdx)==null?void 0:An.registry_ttl)??21600,onChange:q=>Ne({wzdx:{...e.wzdx,registry_ttl:q}}),min:0,helper:"How often to re-fetch the WZDx registry (default 21600 = 6h)"})]}),d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast work zone events"}),d.jsx("input",{type:"checkbox",checked:Q.broadcast,onChange:q=>le({...Q,broadcast:q.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),Q.broadcast?d.jsxs("div",{className:"space-y-3 mt-3",children:[d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Min Severity"}),d.jsxs("select",{value:Q.min_severity,onChange:q=>le({...Q,min_severity:q.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[d.jsx("option",{value:"None",children:"None (all)"}),d.jsx("option",{value:"Minor",children:"Minor+"}),d.jsx("option",{value:"Major",children:"Major only"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),d.jsx("div",{className:"flex gap-6",children:[["road_works","Road Works"],["lane_closed","Lane Closure"],["road_closed","Road Closed"]].map(([q,Me])=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:Q.sub_types.includes(q),onChange:ct=>{const ot=Q.sub_types;le({...Q,sub_types:ct.target.checked?[...ot,q]:ot.filter(dt=>dt!==q)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Me})]},q))})]})]}):d.jsxs("p",{className:"text-xs text-[#666] mt-2",children:["Work zone events stored for LLM context only ","—"," no mesh broadcasts."]})]})]});case"firms":return d.jsxs(d.Fragment,{children:[d.jsx($p,{envVar:"FIRMS_MAP_KEY",label:"MAP Key",helper:"NASA FIRMS MAP_KEY"}),d.jsx(Ae,{label:"Tick Seconds",value:e.firms.tick_seconds,onChange:q=>Ne({firms:{...e.firms,tick_seconds:q}}),min:300}),d.jsx(Dn,{label:"Satellite Source",value:e.firms.source,onChange:q=>Ne({firms:{...e.firms,source:q}}),options:[{value:"VIIRS_SNPP_NRT",label:"VIIRS SNPP (NRT)"},{value:"VIIRS_NOAA20_NRT",label:"VIIRS NOAA-20 (NRT)"},{value:"MODIS_NRT",label:"MODIS (NRT)"}]}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsx(Ae,{label:"Day Range",value:e.firms.day_range,onChange:q=>Ne({firms:{...e.firms,day_range:q}}),min:1,max:10}),d.jsx(Dn,{label:"Min Confidence",value:e.firms.confidence_min,onChange:q=>Ne({firms:{...e.firms,confidence_min:q}}),options:[{value:"low",label:"Low"},{value:"nominal",label:"Nominal"},{value:"high",label:"High"}]}),d.jsx(Ae,{label:"Proximity (km)",value:e.firms.proximity_km,onChange:q=>Ne({firms:{...e.firms,proximity_km:q}}),step:.5})]}),aa("firms")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((q,Me)=>{var ct;return d.jsx(Ae,{label:q,value:((ct=e.firms.bbox)==null?void 0:ct[Me])??0,onChange:ot=>{const dt=[...e.firms.bbox||[0,0,0,0]];dt[Me]=ot,Ne({firms:{...e.firms,bbox:dt}})},step:.01},q)})})]});case"satpass":{const q=e.satpass.enabled?Ke.dry_run?{label:"DRY RUN",color:"text-sky-400 bg-sky-400/10 border border-sky-400/30",desc:" — logging only, nothing transmits"}:{label:"⚠ LIVE",color:"text-amber-400 bg-amber-500/20 border-2 border-amber-500 font-bold animate-pulse",desc:" — transmitting to mesh"}:{label:"OFF",color:"text-[#777] bg-[#1a1a1a]",desc:""};return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:`px-4 py-2.5 text-sm rounded ${q.color}`,children:[d.jsx("span",{className:"font-semibold",children:q.label}),q.desc&&d.jsx("span",{className:"font-normal",children:q.desc})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Safety Controls"}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm text-[#e0e0e0]",children:"Dry run — log instead of transmit"}),d.jsx("p",{className:"text-xs text-[#666]",children:"When enabled, passes are logged but never broadcast to mesh"})]}),d.jsx("button",{onClick:()=>St({...Ke,dry_run:!Ke.dry_run}),className:`relative w-10 h-5 rounded-full transition-colors ${Ke.dry_run?"bg-sky-500":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${Ke.dry_run?"translate-x-5":""}`})})]}),d.jsx(Ae,{label:"Max broadcasts / hour",value:Ke.max_broadcasts_per_hour,onChange:Me=>St({...Ke,max_broadcasts_per_hour:Me}),min:1,max:60,helper:"Rate cap — broadcasts exceeding this limit are dropped"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Pass Filters"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsx(Ae,{label:"Min Elevation (deg)",value:Ke.min_elevation,onChange:Me=>St({...Ke,min_elevation:Me}),min:0,max:90,helper:"Minimum max elevation for a pass to be broadcast"})})]}),d.jsx(la,{label:"Observer Locations",value:Ke.observers,onChange:Me=>St({...Ke,observers:Me}),helper:"Observer names to include (empty = all)"}),d.jsx(la,{label:"NORAD IDs",value:Ke.norad_ids,onChange:Me=>St({...Ke,norad_ids:Me}),helper:"NORAD catalog IDs to broadcast (empty = broadcast nothing, opt-in only)"}),d.jsxs("div",{className:"border-t border-border pt-4 mt-2 space-y-6",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Native satpass (SGP4) — no Central required"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-[#777] mb-2",children:"Observers (ground stations the predictor computes passes for)"}),aa("satpass")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Observer locations are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"space-y-2",children:(e.satpass.observers||[]).map((Me,ct)=>d.jsxs("div",{className:"grid grid-cols-6 gap-2 items-end",children:[d.jsx(yt,{label:"Slug",value:Me.slug,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Me,slug:ot},Ne({satpass:{...e.satpass,observers:dt}})},placeholder:"tvly"}),d.jsx(yt,{label:"Name",value:Me.name,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Me,name:ot},Ne({satpass:{...e.satpass,observers:dt}})},placeholder:"Treasure Valley"}),d.jsx(Ae,{label:"Lat",value:Me.lat,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Me,lat:ot},Ne({satpass:{...e.satpass,observers:dt}})},step:1e-4}),d.jsx(Ae,{label:"Lon",value:Me.lon,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Me,lon:ot},Ne({satpass:{...e.satpass,observers:dt}})},step:1e-4}),d.jsx(Ae,{label:"Alt (m)",value:Me.alt_m,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Me,alt_m:ot},Ne({satpass:{...e.satpass,observers:dt}})},step:1}),d.jsx("button",{onClick:()=>Ne({satpass:{...e.satpass,observers:e.satpass.observers.filter((ot,dt)=>dt!==ct)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},ct))}),d.jsx("button",{onClick:()=>Ne({satpass:{...e.satpass,observers:[...e.satpass.observers||[],{slug:"",name:"",lat:0,lon:0,alt_m:0}]}}),className:"text-xs text-accent hover:underline mt-2",children:"+ Add Observer"})]})]}),d.jsx(la,{label:"TLE Groups",value:e.satpass.tle_groups,onChange:Me=>Ne({satpass:{...e.satpass,tle_groups:Me}}),helper:"Celestrak GP group selectors, e.g. weather, stations, amateur",infoLink:"https://celestrak.org/NORAD/elements/"}),d.jsx(X2,{label:"NORAD IDs (native)",value:e.satpass.norad_ids,onChange:Me=>Ne({satpass:{...e.satpass,norad_ids:Me}}),helper:"Specific NORAD catalog IDs to also fetch/predict, e.g. 25544, 33591"}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsx(Ae,{label:"Min Elevation (deg)",value:e.satpass.min_elevation_deg,onChange:Me=>Ne({satpass:{...e.satpass,min_elevation_deg:Me}}),min:0,max:90,helper:"Native SGP4 pass filter (separate from Central min elevation above)"}),d.jsx(Ae,{label:"Window (hours)",value:e.satpass.window_hours,onChange:Me=>Ne({satpass:{...e.satpass,window_hours:Me}}),min:1,max:168,helper:"Hours ahead to predict passes"}),d.jsx(Ae,{label:"TLE Refresh (sec)",value:e.satpass.tle_refresh_seconds,onChange:Me=>Ne({satpass:{...e.satpass,tle_refresh_seconds:Me}}),min:3600,helper:"How often to re-fetch TLEs (default 21600 = 6h)"}),d.jsx(Ae,{label:"Broadcast Lead (sec)",value:e.satpass.broadcast_lead_seconds??3600,onChange:Me=>Ne({satpass:{...e.satpass,broadcast_lead_seconds:Me}}),min:0,helper:"How far ahead of a pass to announce"})]})]})]})}}},ly=e,uy=(se,ut)=>{const Ze=e[se]||{};Ne({[se]:{...Ze,...ut}})};return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h1",{className:"text-xl font-semibold text-white",children:"Data Feeds"}),d.jsx("div",{className:"flex items-center gap-3",children:M==="curated"&&d.jsxs(d.Fragment,{children:[d.jsx(qt,{label:"Feeds Enabled",checked:e.enabled,onChange:se=>Ne({enabled:se})}),Tn&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:$e,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:Mn,disabled:c,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",c?"Saving…":"Save"]})]})]})})]}),f&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:f}),g&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:g}),y&&d.jsxs("div",{className:"flex items-center justify-between text-sm text-accent bg-accent/10 border border-accent/30 p-3",children:[d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx(Zi,{size:14})," A restart is required for some changes to take effect."]}),d.jsx("button",{onClick:Zh,className:"px-3 py-1 bg-accent/20 hover:bg-amber-500/30",children:"Restart now"})]}),d.jsxs("div",{className:"flex gap-1 border-b border-border",children:[d.jsxs("button",{onClick:()=>A("curated"),className:`flex items-center gap-2 px-4 py-2 text-sm border-b-2 -mb-px transition-colors ${M==="curated"?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[d.jsx(kh,{size:15})," Data Feeds"]}),d.jsxs("button",{onClick:()=>A("advanced"),className:`flex items-center gap-2 px-4 py-2 text-sm border-b-2 -mb-px transition-colors ${M==="advanced"?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[d.jsx(Bg,{size:15})," Advanced (raw)"]})]}),M==="advanced"&&d.jsxs("div",{className:"-mx-6",children:[d.jsx("div",{className:"px-6 pb-2 text-xs text-[#777]",children:"Curated keys (owned by the Data Feeds panels above) are hidden here. Future or unknown keys from adapters will appear in this view."}),d.jsx(PZ,{excludeKeys:VCe,hideLlmToggle:!0})]}),M==="curated"&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:Q2.map(({key:se,label:ut,icon:Ze})=>d.jsxs("button",{onClick:()=>{w(se);const mt=Q2.find(rr=>rr.key===se);C(mt.adapters[0]??null)},className:`flex items-center gap-2 px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${_===se?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[d.jsx(Ze,{size:15})," ",ut]},se))}),_==="central"&&e.central&&d.jsxs("div",{className:"border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Central Connection"}),d.jsx("p",{className:"text-xs text-[#666]",children:'NATS JetStream source for any adapter set to "central"'})]}),d.jsx(qt,{label:"",checked:!!e.central.enabled,onChange:se=>Ne({central:{...e.central,enabled:se}})})]}),d.jsxs("div",{className:e.central.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[d.jsx(yt,{label:"URL",value:e.central.url||"",onChange:se=>Ne({central:{...e.central,url:se}}),placeholder:"nats://central.echo6.mesh:4222"}),d.jsx(yt,{label:"Durable",value:e.central.durable||"",onChange:se=>Ne({central:{...e.central,durable:se}}),placeholder:"meshai-v04"}),d.jsx(Ae,{label:"Connect Timeout (sec)",value:e.central.connect_timeout??10,onChange:se=>Ne({central:{...e.central,connect_timeout:se}}),step:.5,min:0,helper:"NATS connect timeout for the Central consumer"}),d.jsx(yt,{label:"Region",value:e.central.region||"",onChange:se=>Ne({central:{...e.central,region:se}}),placeholder:"us.id",helper:"Central v0.9.20 region token (dotted, e.g. 'us.id'). Empty = bare wildcards (all-US firehose). Each adapter is either Central or native, never both — see Reference → OR-not-AND Architecture for why."})]})]}),_==="mesh"&&d.jsxs("div",{className:"border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Mesh Health"}),d.jsx("p",{className:"text-xs text-[#666]",children:"Node/infra telemetry — sourced from the mesh, not an environmental feed."})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),d.jsx(jZ,{value:"native",onChange:()=>{},disabled:!1,centralDisabled:!0})]})]}),d.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available — reserved for a future migration."})]}),_==="family_settings"&&d.jsxs("div",{className:"space-y-4",children:[d.jsxs("p",{className:"text-xs text-[#777]",children:["Per-family gating: enable/disable each notification family, set its minimum severity threshold, freshness window, and cooldown. Delivery routing (which mesh channels, email, webhook) is configured on the ",d.jsx("a",{href:"/meshtastic/routing",className:"text-accent hover:underline",children:"Meshtastic Routing"})," and"," ",d.jsx("a",{href:"/meshcore/routing",className:"text-accent hover:underline",children:"MeshCore Routing"})," pages."]}),$h&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:$h}),ku&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:ku}),Gn===null?d.jsx("div",{className:"text-xs text-[#666] italic",children:"Loading family settings…"}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:fu.map(({key:se,label:ut,Icon:Ze})=>{const mt=Lv[se]||{};return d.jsxs("div",{className:"border border-border p-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#e0e0e0]",children:[d.jsx(Ze,{size:15})," ",ut]}),d.jsx(qt,{label:"",checked:!!mt.enabled,onChange:rr=>Ga(se,{enabled:rr})})]}),d.jsxs("div",{className:mt.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[d.jsx(Dn,{label:"Min Severity",value:mt.min_severity||"priority",onChange:rr=>Ga(se,{min_severity:rr}),options:[{value:"routine",label:"Routine — informational"},{value:"priority",label:"Priority — needs attention"},{value:"immediate",label:"Immediate — act now"}]}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsx(Ae,{label:"Freshness (sec)",value:mt.freshness_seconds??600,onChange:rr=>Ga(se,{freshness_seconds:rr}),min:0,helper:"Drop events older than this"}),d.jsx(Ae,{label:"Cooldown (sec)",value:mt.cooldown_seconds??0,onChange:rr=>Ga(se,{cooldown_seconds:rr}),min:0,helper:"0 = no throttle"})]}),d.jsx(la,{label:"Regions",value:mt.regions??[],onChange:rr=>Ga(se,{regions:rr}),helper:"Empty = all regions; otherwise only these region names"})]})]},se)})}),oy&&d.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[d.jsxs("button",{onClick:xw,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:sy,disabled:Wh,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",Wh?"Saving…":"Save"]})]})]})]}),is.adapters.length>0&&Rr&&d.jsxs(d.Fragment,{children:[is.adapters.length>1&&d.jsx("div",{className:"flex gap-1",children:is.adapters.map(se=>d.jsx("button",{onClick:()=>C(se),className:`px-3 py-1.5 text-sm ${Rr===se?"bg-bg-hover text-white":"text-[#777] hover:text-white"}`,children:dc[se].label},se))}),d.jsx(qCe,{title:dc[Rr].label,subtitle:dc[Rr].subtitle,enabled:((cy=ly[Rr])==null?void 0:cy.enabled)??!1,onEnabled:se=>uy(Rr,{enabled:se}),feedSource:((hy=ly[Rr])==null?void 0:hy.feed_source)??"native",onFeedSource:se=>uy(Rr,{feed_source:se}),hasCentral:dc[Rr].hasCentral,nativeOnly:dc[Rr].nativeOnly,hasKey:ww(Rr),health:_w(Rr),events:bw(Rr),llmContext:Pu[Rr]!==void 0?I[Pu[Rr]]??!0:void 0,onLlmContext:Pu[Rr]!==void 0?se=>as(Pu[Rr],se):void 0,children:Yh(Rr)})]}),d.jsxs("div",{className:"pt-4 mt-2 border-t border-border space-y-4",children:[d.jsxs("div",{children:[d.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[d.jsx(Bg,{size:16})," Custom Sources"]}),d.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Point MeshAI at any public REST/GeoJSON feed; it becomes a routable family in Notifications — sitting alongside the built-in feeds above."})]}),d.jsx($Ce,{})]}),d.jsxs("details",{className:"group border border-border p-4",children:[d.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm font-medium text-[#e0e0e0] hover:text-white",children:[d.jsx(Ah,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced: Geocoder"]}),d.jsx("p",{className:"mt-2 text-xs text-[#666]",children:"Configures the Photon reverse-geocoder used to resolve place names."}),d.jsxs("div",{className:"mt-4 space-y-3 pl-6 border-l border-border",children:[d.jsx(yt,{label:"Geocoder URL",value:((dy=e.geocoder)==null?void 0:dy.url)??"https://photon.komoot.io",onChange:se=>Ne({geocoder:{...e.geocoder,url:se}}),placeholder:"https://photon.komoot.io",helper:"Photon geocoding endpoint"}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsx(Ae,{label:"Timeout (s)",value:((Xh=e.geocoder)==null?void 0:Xh.timeout_seconds)??2,onChange:se=>Ne({geocoder:{...e.geocoder,timeout_seconds:se}}),min:0,step:.5,helper:"HTTP timeout per geocode request"}),d.jsx(Ae,{label:"Search Radius (km)",value:((nl=e.geocoder)==null?void 0:nl.radius_km)??80,onChange:se=>Ne({geocoder:{...e.geocoder,radius_km:se}}),min:0,helper:"Bias radius around the configured center for results"}),d.jsx(Ae,{label:"Result Limit",value:((Iv=e.geocoder)==null?void 0:Iv.limit)??10,onChange:se=>Ne({geocoder:{...e.geocoder,limit:se}}),min:1,helper:"Max candidate results to consider"})]})]})]})]})]})}function QCe(e){if(e==null||e==="")return"—";let t;if(typeof e=="number")t=new Date(e<1e12?e*1e3:e);else{const r=Number(e);t=Number.isFinite(r)&&e.trim()!==""?new Date(r<1e12?r*1e3:r):new Date(e)}return isNaN(t.getTime())?"—":t.toLocaleString()}function e2e(e){switch(e){case"meshtastic":return{label:"Meshtastic",cls:"bg-blue-500/15 text-blue-400 border border-blue-500/30"};case"meshcore":return{label:"MeshCore",cls:"bg-green-500/15 text-green-400 border border-green-500/30"};default:return{label:"Legacy",cls:"bg-slate-500/15 text-slate-400 border border-slate-600/40"}}}function t2e(e){return e==null||e===""?"—":typeof e=="number"?`ch ${e}`:e.startsWith("#")?e:`#${e}`}const r2e={nws_alerts:"Weather",fires:"Fire",fire_digest_broadcasts:"Fire digest",satpass_events:"Satellite",band_conditions_broadcasts:"Band",traffic_events:"Traffic",quake_events:"Quake",swpc_events:"Space Wx",gauge_readings:"Hydro",event_log:"Avalanche"},n2e=[["🔥","Fire"],["🚧","Traffic"],["⚠️ Road Incident","Traffic"],["🚫","Traffic"],["⛷","Avalanche"],["🌊","Hydro"],["🧲","Space Wx"],["☀️","Space Wx"],["🌐","Quake"],["⏳","Weather"],["🌡️","Weather"],["🌬️","Weather"],["⛈️","Weather"],["🌩️","Weather"]];function a2e(e,t){if(e)return r2e[e]??e.replace(/_/g," ").replace(/s$/,"");if(t){for(const[r,n]of n2e)if(t.startsWith(r))return n}return"broadcast"}const i2e=[{value:"all",label:"All meshes"},{value:"meshtastic",label:"Meshtastic"},{value:"meshcore",label:"MeshCore"}],o2e=[{value:"all",label:"All types"},{value:"nws_alerts",label:"Weather"},{value:"fires",label:"Fires"},{value:"satpass_events",label:"Satellite"},{value:"band_conditions_broadcasts",label:"Band"},{value:"traffic_events",label:"Traffic"}],cx=100;function XB(){const[e,t]=E.useState([]),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState("all"),[l,u]=E.useState("all"),[c,h]=E.useState(cx);return E.useEffect(()=>{document.title="Activity Log — MeshAI"},[]),E.useEffect(()=>{let f=!0;const v=()=>{OJ(c,o,l).then(m=>{f&&(t(m),i(null),n(!1))}).catch(m=>{f&&(i(m.message),n(!1))})};v();const g=setInterval(v,5e3);return()=>{f=!1,clearInterval(g)}},[c,o,l]),r?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading activity…"})}):a?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsxs("div",{className:"text-red-400",children:["Error: ",a]})}):d.jsx("div",{className:"space-y-4",children:d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"p-4 border-b border-border flex items-center flex-wrap gap-2",children:[d.jsx(Oo,{size:14,className:"text-[#f59e0b]"}),d.jsx("h2",{className:"text-sm font-medium text-slate-300",children:"Activity Log"}),d.jsx("select",{value:o,onChange:f=>{s(f.target.value),h(cx)},className:"text-xs bg-bg-hover text-slate-300 border border-border rounded px-2 py-1",children:i2e.map(f=>d.jsx("option",{value:f.value,children:f.label},f.value))}),d.jsx("select",{value:l,onChange:f=>{u(f.target.value),h(cx)},className:"text-xs bg-bg-hover text-slate-300 border border-border rounded px-2 py-1",children:o2e.map(f=>d.jsx("option",{value:f.value,children:f.label},f.value))}),d.jsxs("span",{className:"text-xs text-slate-500 ml-auto",children:[e.length," broadcast",e.length===1?"":"s"," · newest first"]})]}),e.length===0?d.jsxs("div",{className:"flex items-center gap-2 text-slate-500 p-8",children:[d.jsx(_i,{size:18}),d.jsx("span",{children:"No outbound broadcasts recorded yet."})]}):d.jsx("ul",{className:"divide-y divide-border",children:e.map(f=>{const v=e2e(f.transport);return d.jsx("li",{className:"p-4 hover:bg-bg-hover transition-colors",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx("div",{className:"pt-0.5",children:f.success===1?d.jsx(bk,{size:16,className:"text-green-500"}):f.success===0?d.jsx(Fj,{size:16,className:"text-amber-500"}):d.jsx(Fj,{size:16,className:"text-slate-600"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center flex-wrap gap-2 mb-1",children:[d.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${v.cls}`,children:v.label}),d.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-bg-hover text-slate-400 border border-border",children:t2e(f.channel)}),d.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-[#f59e0b]/10 text-[#f59e0b]",children:a2e(f.source_event_table,f.text)}),f.success===1&&d.jsx("span",{className:"text-xs text-green-500",children:"Sent"}),f.success===0&&d.jsx("span",{className:"text-xs text-amber-500",children:"Skip"}),(f.success===null||f.success===void 0)&&d.jsx("span",{className:"text-xs text-slate-500",children:"—"})]}),d.jsx("div",{className:"text-sm text-slate-200 break-words whitespace-pre-wrap",children:f.text||d.jsx("span",{className:"text-slate-500 italic",children:"(no text)"})}),d.jsxs("div",{className:"flex items-center gap-1 mt-1.5 text-xs text-slate-500 font-mono",children:[d.jsx(LV,{size:12}),QCe(f.sent_at)]})]})]})},f.id)})}),e.length>=c&&d.jsx("div",{className:"p-3 border-t border-border flex justify-center",children:d.jsx("button",{onClick:()=>h(f=>f+cx),className:"text-xs px-3 py-1 rounded bg-bg-hover text-slate-300 border border-border hover:bg-bg-card transition-colors",children:"Load more"})})]})})}const qB=[{id:"stream-gauges",label:"Stream Gauges",icon:c1},{id:"wildfire",label:"Wildfire",icon:Rm},{id:"firms",label:"Satellite Fire Detection (FIRMS)",icon:f1},{id:"fire-tracker",label:"Fire Tracker (Fusion)",icon:xJ},{id:"weather-alerts",label:"Weather Alerts",icon:mJ},{id:"solar",label:"Solar & Geomagnetic",icon:GV},{id:"ducting",label:"Tropospheric Ducting",icon:_i},{id:"avalanche",label:"Avalanche Danger",icon:kf},{id:"traffic",label:"Traffic Flow",icon:u1},{id:"roads-511",label:"Road Conditions (511)",icon:IV},{id:"mesh-health",label:"Mesh Health",icon:Oo},{id:"broadcast-types",label:"Broadcast Types",icon:BV},{id:"reminders",label:"Reminder System",icon:LV},{id:"notifications",label:"Notifications",icon:NV},{id:"commands",label:"Commands",icon:HV},{id:"llm-dm",label:"LLM DM Queries",icon:wk},{id:"or-not-and",label:"OR-not-AND Architecture",icon:Sk},{id:"adapter-config",label:"Adapter Config & CODE Rule",icon:Bg},{id:"curation",label:"Curation: Gauges & Towns",icon:jV},{id:"schema",label:"Schema Migrations",icon:wJ},{id:"api",label:"API Reference",icon:yJ}];function mr({color:e}){const t={green:"bg-green-500",yellow:"bg-yellow-500",orange:"bg-orange-500",red:"bg-red-500",black:"bg-slate-800 border border-slate-600"};return d.jsx("span",{className:`inline-block w-3 h-3 rounded-full ${t[e]}`})}function Gt({headers:e,rows:t}){return d.jsx("div",{className:"overflow-x-auto my-4",children:d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{children:d.jsx("tr",{className:"bg-[#1a2332] border-b border-[#2a3a4a]",children:e.map((r,n)=>d.jsx("th",{className:"px-4 py-2 text-left text-slate-400 font-medium",children:r},n))})}),d.jsx("tbody",{children:t.map((r,n)=>d.jsx("tr",{className:`border-b border-[#1e2a3a] ${n%2===0?"bg-[#0d1219]":"bg-[#0a0e17]"}`,children:r.map((a,i)=>d.jsx("td",{className:"px-4 py-2 text-slate-300",children:a},i))},n))})]})})}function er({href:e,children:t}){return d.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:[t," ",d.jsx(Jc,{size:12})]})}function _e({children:e}){return d.jsx("h3",{className:"text-lg font-semibold text-slate-200 mt-6 mb-3",children:e})}function yl({children:e}){return d.jsx("h4",{className:"text-base font-medium text-slate-300 mt-4 mb-2",children:e})}function fe({children:e}){return d.jsx("code",{className:"font-mono text-accent bg-[#1a2332] px-1 rounded",children:e})}function Ir({id:e,title:t,children:r}){return d.jsxs("section",{id:e,className:"mb-12 scroll-mt-6",children:[d.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-4 pb-2 border-b border-[#2a3a4a]",children:t}),d.jsx("div",{className:"text-slate-300 leading-relaxed space-y-4",children:r})]})}function s2e(){const e=xu(),[t,r]=E.useState(""),[n,a]=E.useState("stream-gauges"),i=E.useRef(null);E.useEffect(()=>{const l=e.hash.replace("#","");if(l&&qB.find(u=>u.id===l)){a(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"})}},[e.hash]);const o=qB.filter(l=>l.label.toLowerCase().includes(t.toLowerCase())),s=l=>{a(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"}),window.history.replaceState(null,"",`#${l}`)};return d.jsxs("div",{className:"flex h-full -m-6",children:[d.jsxs("aside",{className:"w-64 flex-shrink-0 bg-bg-card border-r border-border overflow-y-auto",children:[d.jsx("div",{className:"p-4 border-b border-border",children:d.jsxs("div",{className:"relative",children:[d.jsx(v1,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),d.jsx("input",{type:"text",value:t,onChange:l=>r(l.target.value),placeholder:"Search topics...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"})]})}),d.jsx("nav",{className:"py-2",children:o.map(l=>{const u=l.icon,c=n===l.id;return d.jsxs("button",{onClick:()=>s(l.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors ${c?"text-accent bg-accent/10 border-l-2 border-accent":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover border-l-2 border-transparent"}`,children:[d.jsx(u,{size:16}),l.label]},l.id)})})]}),d.jsx("div",{ref:i,className:"flex-1 overflow-y-auto p-6",children:d.jsxs("div",{className:"max-w-4xl",children:[d.jsx("p",{className:"text-slate-400 mb-8",children:"Everything you need to understand and configure MeshAI's monitoring and alerting systems."}),d.jsxs(Ir,{id:"stream-gauges",title:"Stream Gauges",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI watches river and stream levels at gauges you configure. Each gauge reports two things:"}),d.jsxs("p",{children:[d.jsx("strong",{children:"Water Level (Gage Height)"}),` — how high the water is, measured in feet. Important: this is NOT the depth of the river. It's the height above a fixed measuring point that's different at every gauge. A reading of "10 feet" at one gauge means something completely different than "10 feet" at another. You can only compare readings from the SAME gauge over time.`]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Flow (Discharge)"}),` — how much water is moving past the gauge, in cubic feet per second (CFS). Think of it as the river's "throughput." For scale:`]}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"A small creek: 50-200 CFS"}),d.jsx("li",{children:"A mid-size river: 1,000-5,000 CFS"}),d.jsx("li",{children:"A big river in spring runoff: 10,000+ CFS"})]}),d.jsx(_e,{children:"When Does It Flood?"}),d.jsxs("p",{children:["Flood levels are set by the ",d.jsx("strong",{children:"National Weather Service"}),', not USGS. NWS looks at each specific gauge location and decides "at what water level does the road flood? At what level do buildings get water?" Those levels are different everywhere.']}),d.jsxs("p",{children:[d.jsx("strong",{children:"Action Stage"})," — water is rising, time to start paying attention. Usually still inside the riverbanks."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Minor Flood"})," — low-lying roads start getting water on them. NWS issues a Flood Advisory."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Moderate Flood"})," — water in buildings near the river. Some people need to evacuate. NWS issues a Flood Warning."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Major Flood"})," — widespread flooding. Many people evacuating. Serious property damage."]}),d.jsx("p",{children:"MeshAI automatically looks up the flood levels for your gauge from NWS when you add a site. Some remote gauges don't have flood levels assigned — for those, you set them manually if you know what water levels cause problems in your area."}),d.jsx(_e,{children:"Low Water / Drought"}),d.jsx("p",{children:`There's no official "drought stage" for most gauges. If you need to monitor low water (irrigation, fish habitat), set a manual low-water threshold based on what you know about your local river.`}),d.jsx(_e,{children:"Setting It Up"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Find your gauge at ",d.jsx(er,{href:"https://waterdata.usgs.gov/nwis",children:"waterdata.usgs.gov/nwis"})]}),d.jsxs("li",{children:["Copy the site number (like ",d.jsx(fe,{children:"13090500"}),")"]}),d.jsx("li",{children:"Add it in Config → Environmental → USGS"}),d.jsx("li",{children:"MeshAI auto-fills the gauge name and flood levels from NWS"})]}),d.jsx("p",{children:"If NWS flood levels don't populate, your gauge may not have them. Set manual thresholds if you know your local conditions."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://waterdata.usgs.gov/nwis",children:"USGS Water Data"})," — find gauges near you"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://water.noaa.gov",children:"NWS Water Prediction Service"})," — flood forecasts and thresholds"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.usgs.gov/special-topics/water-science-school/science/how-streamflow-measured",children:"Understanding Streamflow"})," — USGS explainer"]})]})]}),d.jsxs(Ir,{id:"wildfire",title:"Wildfire",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI tracks active wildfire perimeters from the National Interagency Fire Center (NIFC). For each fire, you see the name, size, how much is contained, and how far it is from your mesh nodes."}),d.jsx(_e,{children:"Fire Size — How Big Is It?"}),d.jsx(Gt,{headers:["Size","What That Means"],rows:[["10 acres","Small fire. Usually handled quickly by initial crews."],["100 acres","Notable fire. Active firefighting effort."],["1,000 acres","Large fire. Major resources being deployed."],["10,000+ acres","Very large fire. Multiple teams, aircraft, heavy equipment."],["100,000+ acres","Mega-fire. These make the national news."]]}),d.jsx("p",{children:"For reference, 1,000 acres is about 1.5 square miles."}),d.jsx(_e,{children:"Containment — Is It Under Control?"}),d.jsx("p",{children:"Containment means the percentage of the fire's edge where firefighters have built a control line (a cleared strip to stop the fire from spreading further). It does NOT mean the fire is out inside that line."}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"0-30%"})," — Essentially uncontrolled. The fire goes where it wants."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"50%"})," — Good progress, but half the edge can still grow."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"80%+"})," — Well controlled. Major growth unlikely."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"100%"}),' — The edge is fully controlled. But the fire may STILL be actively burning inside. "100% contained" does NOT mean "out."']})]}),d.jsx(_e,{children:"How Far Away Should I Worry?"}),d.jsx(Gt,{headers:["Distance","What To Do"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Under 5 km (3 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Immediate threat."})," This is evacuation-order range. Embers can fly this far in wind."]})],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," 5-15 km (3-10 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Prepare."})," The fire could reach you in hours under bad conditions. Have a plan."]})],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," 15-30 km (10-20 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Watch."})," Smoke is likely. Wind shifts could change things fast."]})],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Over 30 km (20 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Awareness."})," Keep an eye on it, but no immediate threat."]})]]}),d.jsx("p",{children:"How fast can a fire travel? In grass with wind: up to 14 mph. In heavy timber: 1-6 mph. A fire 10 miles away could theoretically reach you in 1-2 hours under worst-case conditions, but typical spread is much slower."}),d.jsx(_e,{children:"Which Matters More — Size or Distance?"}),d.jsxs("p",{children:[d.jsx("strong",{children:"Distance is the immediate concern."})," A small uncontained fire 10 km away is more dangerous right now than a huge fire 50 km away. But big fires have more energy and can grow fast under wind shifts — keep watching them."]}),d.jsx(_e,{children:"Setting It Up"}),d.jsxs("p",{children:["Just configure your state code (like ",d.jsx(fe,{children:"US-ID"})," for Idaho) in Config → Environmental → Fires. MeshAI polls NIFC every 10 minutes for active fires in that state and computes the distance to your mesh nodes automatically."]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://inciweb.nwcg.gov",children:"InciWeb"})," — detailed incident information"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://data-nifc.opendata.arcgis.com",children:"NIFC Fire Map"})," — raw perimeter data"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.ready.gov/wildfires",children:"Ready.gov Wildfires"})," — preparedness guide"]})]})]}),d.jsxs(Ir,{id:"firms",title:"Satellite Fire Detection (FIRMS)",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:`NASA's VIIRS satellites orbit the Earth and look for heat signatures on the ground. When they see something hot — a fire, a factory, a sunlit building — they flag it as a "hotspot." MeshAI checks these detections for your area.`}),d.jsxs("p",{children:[d.jsx("strong",{children:"Why this matters"}),": satellite hotspots show up ",d.jsx("strong",{children:"hours before"})," official fire perimeters are mapped. If a new fire starts near your mesh, the satellite might see it before anyone on the ground reports it."]}),d.jsx(_e,{children:"Confidence — Is It Really a Fire?"}),d.jsx("p",{children:"Each detection gets a confidence rating:"}),d.jsx(Gt,{headers:["Confidence","What It Means"],rows:[["High","Almost certainly a real fire. Strong heat signature."],["Nominal","Probably a real fire. Most actual fires get this rating."],["Low","Maybe a fire, maybe not. Could be a hot roof, sun reflecting off water, a factory, or a gas flare. Lots of false alarms."]]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Recommendation"}),`: Set the filter to "Nominal + High." If you include "Low" you'll get alerts for every hot parking lot on a summer day.`]}),d.jsx(_e,{children:"FRP — How Intense Is It?"}),d.jsx("p",{children:'FRP (Fire Radiative Power) measures the heat output in megawatts. Think of it as "how hot is this thing":'}),d.jsx(Gt,{headers:["FRP","What It Probably Is"],rows:[["Under 5 MW","Hot surface, small agricultural burn, gas flare, or warm ground"],["5-50 MW","An actual fire — brush fire, grass fire, typical wildfire"],["50-300 MW","Intense fire — trees fully burning, active fire front"],["Over 300 MW","Extreme fire — major wildfire in full force"]]}),d.jsx("p",{children:"Setting the minimum FRP to 5 MW filters out most industrial and agricultural false alarms."}),d.jsx(_e,{children:"New Ignition Detection"}),d.jsxs("p",{children:["MeshAI cross-references satellite hotspots against known NIFC fire perimeters. If a hotspot is NOT near any known fire, it gets flagged as a ",d.jsx("strong",{children:"potential new ignition"})," — maybe a new fire just started. These get elevated priority regardless of confidence level."]}),d.jsx(_e,{children:"Timing"}),d.jsxs("p",{children:["Satellite data arrives ",d.jsx("strong",{children:"1-3 hours"})," after the satellite passes overhead. Each location gets observed about ",d.jsx("strong",{children:"6 times per day"}),` across all satellites, so there are multi-hour gaps. This is not real-time — it's "pretty recent."`]}),d.jsx(_e,{children:"Getting an API Key"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Go to ",d.jsx(er,{href:"https://firms.modaps.eosdis.nasa.gov/api/area/",children:"FIRMS API page"})]}),d.jsx("li",{children:'Click "Get MAP_KEY"'}),d.jsx("li",{children:"Register for a free Earthdata account"}),d.jsx("li",{children:"Your key arrives by email"}),d.jsx("li",{children:"Enter it in Config → Environmental → FIRMS"})]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://firms.modaps.eosdis.nasa.gov",children:"FIRMS Fire Map"})," — see hotspots on a map"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://earthdata.nasa.gov/data/tools/firms/faq",children:"FIRMS FAQ"})," — how it works"]})]})]}),d.jsxs(Ir,{id:"fire-tracker",title:"Fire Tracker (Fusion)",children:[d.jsx("p",{children:"FIRMS hotspots are fast but noisy; WFIGS incidents are accurate but slow. The Fire Tracker fuses both feeds and a per-pixel attribution graph so a single fire's name, declared acreage, real-time perimeter movement, and spotting events all land as separate broadcasts on the mesh."}),d.jsx(_e,{children:"What you'll see on the mesh"}),d.jsx("p",{children:"Six fire-family alert categories, in order of when they fire during an incident's lifecycle:"}),d.jsx(Gt,{headers:["Category","Severity","Trigger","Example broadcast"],rows:[[d.jsx(fe,{children:"unattributed_hotspot_cluster"}),"Priority","3+ FIRMS pixels within 1 mi over 60 min, no WFIGS match — possible new ignition before NIFC declares it",d.jsx("span",{className:"text-amber-300",children:"🔥 Possible new fire: 3 hotspots within 1 mi @ 42.93,-114.45 (combined 78 MW)"})],[d.jsx(fe,{children:"wildfire_declared"}),"Priority","WFIGS first-sight of a new IRWIN incident — the official 'this is a fire and here is its name' record",d.jsx("span",{className:"text-amber-300",children:"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained"})],[d.jsx(fe,{children:"wildfire_growth"}),"Priority","Per-pass centroid drift >= 0.5 mi (configurable) between consecutive satellite passes — the fire's footprint moved",d.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire moving NE 1.2 mi/h, ~3 mi from Almo"})],[d.jsx(fe,{children:"wildfire_spotting"}),"Immediate","FIRMS pixel attributed to a tracked fire but >= 1.5 mi (configurable) outside its prior-pass convex-hull perimeter — ember spread",d.jsx("span",{className:"text-amber-300",children:"🔥 Possible spotting 2.1 mi NE of Cache Peak Fire perimeter"})],[d.jsx(fe,{children:"wildfire_incident"}),"Priority","WFIGS acreage or containment increased on a fire already broadcast once (the Update path; the New path uses wildfire_declared)",d.jsx("span",{className:"text-amber-300",children:"🔥 Update: Cache Peak Fire: 1,847 ac, 23% contained"})],[d.jsx(fe,{children:"wildfire_halted"}),"Routine","No FIRMS pixels attributed for 12+ hours (configurable) — fire stalled or out",d.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire no growth in 14h"})]]}),d.jsx(_e,{children:"How attribution works"}),d.jsxs("p",{children:["When a FIRMS hotspot lands, the bot walks every active fire (those not yet tombstoned) and matches by Haversine distance to that fire's running centroid. If the pixel is within the fire's ",d.jsx(fe,{children:"spread_radius_mi"})," ","(default 5 mi, per-fire override available) the pixel is attributed and appended to that fire's growth history. The centroid then re-computes as the median of the last 24 h of attributed pixels, so single-pixel outliers don't drag the perimeter around."]}),d.jsxs("p",{children:["Pixels that match no fire feed the cluster detector instead: if at least"," ",d.jsx(fe,{children:"cluster_min_pixels"})," (default 3) lie within"," ",d.jsx(fe,{children:"cluster_max_radius_mi"})," (default 1.0) over"," ",d.jsx(fe,{children:"cluster_time_window_minutes"})," (default 60), the bot fires a single ",d.jsx(fe,{children:"unattributed_hotspot_cluster"})," broadcast and marks the member pixels so a fourth arrival doesn't re-fire the same cluster."]}),d.jsx(_e,{children:"How movement is computed"}),d.jsxs("p",{children:["Each VIIRS pass groups pixels into a ",d.jsx(fe,{children:"pass_id"})," (satellite + 90-min bucket). When a pixel from a different bucket arrives, the prior pass closes: its convex hull becomes the perimeter, its median centroid becomes the comparison anchor, and the bot computes drift (Haversine to the previous pass's centroid), an 8-way compass bearing, and a wall-clock mi/h speed. If drift ≥ ",d.jsx(fe,{children:"growth_drift_threshold_mi"})," the"," ",d.jsx(fe,{children:"wildfire_growth"})," broadcast fires."]}),d.jsx(_e,{children:"How spotting is detected"}),d.jsxs("p",{children:["Once a pass closes its perimeter (a GeoJSON polygon stored on the fire), every subsequent attributed pixel runs a point-in-polygon test. Pixels outside the polygon with a vertex distance ≥"," ",d.jsx(fe,{children:"spotting_distance_threshold_mi"})," (default 1.5) fire the"," ",d.jsx(fe,{children:"wildfire_spotting"})," broadcast at ",d.jsx("em",{children:"immediate"})," severity — spread beyond the existing perimeter is the most actionable fire signal we emit. A per-fire cooldown (",d.jsx(fe,{children:"spotting_cooldown_seconds"}),", default 1 h) prevents an ember burst in the same area from spamming the mesh."]}),d.jsx(_e,{children:"Tunable knobs (Adapter Config → fires)"}),d.jsx(Gt,{headers:["Key","Default","What it does"],rows:[[d.jsx(fe,{children:"spread_radius_mi_default"}),"5.0 mi","Attribution radius for FIRMS → fire matching. Per-fire override in the fires.spread_radius_mi column."],[d.jsx(fe,{children:"growth_drift_threshold_mi"}),"0.5 mi","Per-pass centroid drift at or above this fires wildfire_growth."],[d.jsx(fe,{children:"halt_passes_threshold"}),"2","Consecutive empty satellite passes before wildfire_halted (documented; the time gate below is the operational rule)."],[d.jsx(fe,{children:"halt_minimum_seconds"}),"43,200 (12 h)","Minimum elapsed seconds since the most recent attributed pixel before wildfire_halted can fire."],[d.jsx(fe,{children:"spotting_distance_threshold_mi"}),"1.5 mi","Distance from prior-pass perimeter that fires wildfire_spotting."],[d.jsx(fe,{children:"spotting_cooldown_seconds"}),"3,600 (1 h)","Minimum seconds between consecutive spotting broadcasts per fire."]]})]}),d.jsxs(Ir,{id:"weather-alerts",title:"Weather Alerts",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI watches for NWS (National Weather Service) alerts affecting your area — warnings, watches, and advisories."}),d.jsx(_e,{children:"Alert Severity — How Serious Is It?"}),d.jsx(Gt,{headers:["Severity","What It Means","Example"],rows:[["Extreme","Life-threatening. The most serious events.","Tornado Emergency, Hurricane Warning, Tsunami Warning"],["Severe","Dangerous. Take protective action.","Tornado Warning, Flash Flood Warning, Blizzard Warning, Red Flag Warning"],["Moderate","Be prepared. Could become dangerous.","Winter Weather Advisory, Wind Advisory, Flood Watch, Heat Advisory"],["Minor","Good to know. Probably won't hurt anyone.","Special Weather Statement, Air Quality Alert"]]}),d.jsx(_e,{children:"When Should I Act? (Urgency)"}),d.jsx(Gt,{headers:["Urgency","What It Means"],rows:[["Immediate","Do something NOW"],["Expected","Do something within the hour"],["Future","Coming in the next several hours"],["Past","It's over — NWS is clearing the alert"]]}),d.jsx(_e,{children:"How Sure Are They? (Certainty)"}),d.jsx(Gt,{headers:["Certainty","What It Means"],rows:[["Observed","It's happening right now. Verified."],["Likely","More than 50% chance"],["Possible","Could happen, but less than 50%"],["Unlikely","Probably won't, but mentioned for awareness"]]}),d.jsx(_e,{children:"These Are Separate Scales"}),d.jsx("p",{children:'A single alert has all three. A hurricane warning for next week is "Severe + Future + Likely." A tornado spotted on the ground is "Extreme + Immediate + Observed." An air quality advisory is "Minor + Expected + Possible."'}),d.jsx(_e,{children:"What Minimum Severity Should I Set?"}),d.jsx(Gt,{headers:["Setting","What You Get","What You Miss"],rows:[["Minor","Everything — high volume","Nothing"],[d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Moderate"})," ✓"]}),"Watches, Advisories, and Warnings","Special Weather Statements"],["Severe","Only Warnings — things happening NOW","Watches (which give you hours of advance warning)"],["Extreme","Only the rarest events","Most Tornado and Severe Thunderstorm Warnings"]]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Moderate is recommended."})," It catches Watches (advance warning that conditions may worsen) and Advisories (conditions exist but aren't severe) while filtering out the informational stuff."]}),d.jsx(_e,{children:"Finding Your NWS Zone"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Go to ",d.jsx(er,{href:"https://www.weather.gov",children:"weather.gov"})]}),d.jsx("li",{children:"Enter your location"}),d.jsxs("li",{children:["Find your zone code at ",d.jsx(er,{href:"https://www.weather.gov/pimar/PubZone",children:"NWS Zone Map"})]}),d.jsxs("li",{children:["Zone codes look like: ",d.jsx(fe,{children:"IDZ016"}),", ",d.jsx(fe,{children:"UTZ040"}),", etc."]})]}),d.jsx(_e,{children:"The User-Agent Field"}),d.jsx("p",{children:"NWS wants to know who's using their API — not for approval, just so they can contact you if something breaks. You make it up:"}),d.jsx("p",{children:d.jsx(fe,{children:"(meshai, you@email.com)"})}),d.jsx("p",{children:"No registration. No waiting. Just type it in."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://alerts.weather.gov",children:"NWS Active Alerts"})," — see current alerts"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.weather.gov/documentation/services-web-api",children:"NWS API Docs"})," — technical details"]})]})]}),d.jsxs(Ir,{id:"solar",title:"Solar & Geomagnetic Conditions",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI tracks space weather — solar activity and its effects on Earth's magnetic field. This matters for radio operators because the sun directly controls how well HF radio works, and major solar events can affect all radio communications."}),d.jsx(_e,{children:"Solar Flux Index (SFI)"}),d.jsx("p",{children:'Think of SFI as a "how active is the sun" number. Higher = better for HF radio, but also higher risk of solar flares.'}),d.jsx(Gt,{headers:["SFI","What It Means for You"],rows:[["Below 70","Quiet sun. Higher HF bands (10m, 15m) are probably dead. Stick to lower bands."],["70-90","Getting better. Some openings on 15m and above, but inconsistent."],["90-120","Good. Most HF bands work. Reliable contacts on 20m and 15m."],["120-170","Great. All HF bands open. 10m works for worldwide contacts."],["Above 170","Excellent. Best HF conditions — but watch for flares."]]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Quick rule"}),": SFI above 90 and Kp below 4 = good day for HF radio."]}),d.jsx(_e,{children:"Kp Index"}),d.jsx("p",{children:"Kp measures how disturbed Earth's magnetic field is, on a 0-9 scale. Higher = more disturbance = worse for HF radio but better for aurora viewing."}),d.jsx(Gt,{headers:["Kp","What It Means for You"],rows:[["0-2","Quiet. Best HF conditions."],["3","Slightly unsettled. You probably won't notice."],["4","Active. Some noise and fading on HF, especially if you're at higher latitudes."],[d.jsx("strong",{children:"5"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Minor storm (G1)."})," HF noticeably degraded. Aurora visible at high latitudes (~60°N)."]})],[d.jsx("strong",{children:"6"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Moderate storm (G2)."})," HF getting rough. Aurora moving south (~55°N)."]})],[d.jsx("strong",{children:"7"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Strong storm (G3)."})," HF unreliable for 1-2 days. Aurora at mid-latitudes."]})],[d.jsx("strong",{children:"8-9"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Severe/Extreme storm."})," HF may black out completely. Aurora visible at very low latitudes. Power grid stress possible."]})]]}),d.jsx(_e,{children:"R / S / G Scales"}),d.jsx("p",{children:"NOAA's shorthand for three types of space weather events:"}),d.jsx(yl,{children:"R (Radio Blackouts) — from solar flares:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"R1-R2: Brief HF disruption. You might not notice."}),d.jsx("li",{children:"R3: HF goes out for about an hour on the sunlit side of Earth."}),d.jsx("li",{children:"R4-R5: HF dead for hours. Serious."})]}),d.jsx(yl,{children:"S (Solar Radiation Storms) — from energetic particles:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Mostly affects polar regions and satellites"}),d.jsx("li",{children:"S3+: Polar HF goes out entirely"})]}),d.jsx(yl,{children:"G (Geomagnetic Storms) — from solar wind disturbances:"}),d.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:d.jsx("li",{children:"Same as the Kp scale: G1 = Kp 5, up to G5 = Kp 9"})}),d.jsx(_e,{children:"Bz — The Storm Predictor"}),d.jsx("p",{children:"Bz measures the direction of the solar wind's magnetic field. When it points south (negative values), the solar wind can dump energy into Earth's magnetic field, causing storms."}),d.jsx(Gt,{headers:["Bz","What It Means"],rows:[["Positive","All good. Solar wind bouncing off."],["0 to -5","Slight coupling. Nothing dramatic."],["-5 to -10","Things starting to pick up. Storm possible."],["Below -10","Storm likely. Kp will start climbing."],["Below -20","Severe storm probable."]]}),d.jsx("p",{children:"Bz can change fast — minute to minute. What matters is whether it stays negative for hours, not brief dips."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://www.swpc.noaa.gov",children:"SWPC Space Weather Dashboard"})," — live data"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.swpc.noaa.gov/noaa-scales-explanation",children:"NOAA Space Weather Scales"})," — what R/S/G mean"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.hamqsl.com/solar.html",children:"HamQSL Solar Page"})," — ham-friendly display"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.swpc.noaa.gov/products/planetary-k-index",children:"Planetary K-Index"})," — live Kp"]})]})]}),d.jsxs(Ir,{id:"ducting",title:"Tropospheric Ducting",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:'Sometimes the atmosphere creates an invisible "pipe" that traps radio signals and carries them much farther than normal. This is called tropospheric ducting. It mostly affects VHF and UHF frequencies.'}),d.jsx("p",{children:"MeshAI watches for these conditions by analyzing weather data (temperature and humidity at different altitudes) over your mesh area."}),d.jsx(_e,{children:"How Do I Know If Ducting Is Happening?"}),d.jsx("p",{children:'MeshAI reports a "condition" based on the atmospheric profile:'}),d.jsx(Gt,{headers:["Condition","What It Means"],rows:[["Normal","Standard propagation. Nothing unusual."],["Super-refraction","Slightly enhanced range. You might hear a few more distant stations than usual."],["Surface Duct","Radio signals trapped near the ground. You may hear stations hundreds of km away that you've never heard before."],["Elevated Duct",'Same effect but the "pipe" is up in the atmosphere. Affects signals passing through that altitude.']]}),d.jsx(_e,{children:"What You'll Actually Notice"}),d.jsx("p",{children:"When ducting happens on your mesh:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Distant repeaters you've never heard suddenly come in"}),d.jsx("li",{children:"Nodes appear from far outside your normal range"}),d.jsx("li",{children:"You hear FM radio stations from other cities"}),d.jsx("li",{children:"ADS-B flight tracking range gets much longer"}),d.jsx("li",{children:"There might be interference from distant stations on your frequency"})]}),d.jsx(_e,{children:"The dM/dz Number"}),d.jsx("p",{children:`The dashboard shows a "dM/dz" value in "M-units/km." You don't need to understand the math — just know:`}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Around 118"})," = normal atmosphere"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Below 79"})," = enhanced propagation starting"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Below 0 (negative)"})," = ducting is happening"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Below -50"})," = strong ducting — classic VHF/UHF DX event"]})]}),d.jsx(_e,{children:"When Does Ducting Happen?"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Under high-pressure weather systems (clear, stable air)"}),d.jsx("li",{children:"When warm air sits on top of cool air (temperature inversion)"}),d.jsx("li",{children:"Most common in late summer and early fall"}),d.jsx("li",{children:"Strongest along coastlines and over water"}),d.jsx("li",{children:"In mountain valleys: cold air pooling in fall/winter can create surface ducts"})]}),d.jsx(_e,{children:"Setting It Up"}),d.jsx("p",{children:"Just configure the latitude and longitude of the center of your mesh area in Config → Environmental → Ducting. MeshAI checks the atmospheric conditions there every 3 hours using free weather model data. No API key needed."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://dxinfocentre.com/tropo.html",children:"Tropo Forecast Maps (Hepburn)"})," — 6-day tropo prediction"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://dxmaps.com",children:"DX Maps"})," — real-time VHF/UHF propagation reports"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://en.wikipedia.org/wiki/Tropospheric_propagation",children:"Wikipedia: Tropospheric Propagation"})," — background"]})]})]}),d.jsxs(Ir,{id:"avalanche",title:"Avalanche Danger",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI pulls avalanche forecasts from your regional avalanche center during winter months. The danger scale has 5 levels and it's the same across all of North America."}),d.jsx(_e,{children:"The Danger Scale"}),d.jsx(Gt,{headers:["Level","Name","Color","What To Do"],rows:[["1","Low",d.jsx(mr,{color:"green"}),"Generally safe. Normal caution in steep terrain."],["2","Moderate",d.jsx(mr,{color:"yellow"}),"Be careful on specific terrain features. Evaluate conditions."],["3","Considerable",d.jsx(mr,{color:"orange"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"DANGEROUS."}),` This is where most people die in avalanches — they see "3 out of 5" and think it's fine. It's not. Use extreme caution.`]})],["4","High",d.jsx(mr,{color:"red"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Very dangerous."})," Stay off anything steep."]})],["5","Extreme",d.jsx(mr,{color:"black"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Don't go out."})," Avalanches are happening on their own."]})]]}),d.jsx(_e,{children:"The Most Important Thing to Know"}),d.jsxs("p",{children:[d.jsx("strong",{children:"Level 3 (Considerable) kills more people than any other level."}),' People look at "3 out of 5" and think "middle of the road, probably okay." In reality, the risk roughly doubles at each step up the scale. Level 3 is where dangerous conditions overlap with people thinking they can handle it.']}),d.jsx(_e,{children:"Seasonal"}),d.jsx("p",{children:'MeshAI only checks avalanche conditions during winter months (configurable, default December through April). Outside season, it shows "off season" and saves API calls.'}),d.jsx(_e,{children:"Finding Your Avalanche Center"}),d.jsxs("p",{children:["Go to ",d.jsx(er,{href:"https://avalanche.org/avalanche-centers/",children:"avalanche.org/avalanche-centers/"})," for a map. Common center codes:"]}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"SNFAC"})," — Sawtooth (central Idaho)"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"UAC"})," — Utah"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"NWAC"})," — Cascades/Olympics (WA/OR)"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"CAIC"})," — Colorado"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"SAC"})," — Sierra Nevada (CA)"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GNFAC"})," — Gallatin (SW Montana)"]})]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://avalanche.org",children:"Avalanche.org"})," — US forecasts"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://avalanche.org/avalanche-encyclopedia/human/resources/north-american-public-avalanche-danger-scale/",children:"Avalanche Danger Scale"})," — full scale explanation"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://kbyg.org",children:"Know Before You Go"})," — avalanche awareness"]})]})]}),d.jsxs(Ir,{id:"traffic",title:"Traffic Flow",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI monitors traffic speed on road segments you configure, using data from TomTom (real vehicles with navigation apps reporting their speed)."}),d.jsx(_e,{children:"Speed Ratio — The Key Number"}),d.jsx("p",{children:'MeshAI compares current speed to "free-flow speed" (what traffic normally does when the road is empty). The ratio tells you how congested it is:'}),d.jsx(Gt,{headers:["Ratio","What It Means"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Above 85%"]}),"Normal. Traffic flowing fine."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," 65-85%"]}),"Slow. Heavier than usual but moving."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," 40-65%"]}),"Congested. Significant delays."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Below 40%"]}),"Gridlock. Barely moving."]]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Note"}),`: "free-flow speed" is NOT the speed limit. It's what traffic actually does on that road when nobody's in the way. Drivers often exceed speed limits on open highways.`]}),d.jsx(_e,{children:"Confidence — Can You Trust the Data?"}),d.jsx("p",{children:"TomTom's confidence score tells you how much of the reading comes from real vehicles right now vs historical averages:"}),d.jsx(Gt,{headers:["Confidence","What It Means"],rows:[["Above 0.9","Very reliable — lots of real-time probe data"],["0.7-0.9","Good — mix of real-time and historical"],["Below 0.7",d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Unreliable"})," — mostly guessing from historical patterns. Don't alert on this."]})]]}),d.jsx("p",{children:"Set minimum confidence to 0.7 to avoid false congestion alerts at night or on rural roads where few probe vehicles drive."}),d.jsx(_e,{children:"Setting Up Corridors"}),d.jsx("p",{children:'Each "corridor" is a point on a road you want to monitor. To add one:'}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Go to Google Maps, find the road"}),d.jsx("li",{children:`Right-click the road → "What's here?" → copy the coordinates`}),d.jsx("li",{children:"Add the corridor in Config with a name and those coordinates"}),d.jsx("li",{children:"TomTom finds the nearest road segment automatically"})]}),d.jsx(_e,{children:"Getting an API Key"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Sign up at ",d.jsx(er,{href:"https://developer.tomtom.com",children:"developer.tomtom.com"})," (free)"]}),d.jsx("li",{children:"Create an app → get your API key"}),d.jsx("li",{children:"Free tier: 2,500 requests/day (plenty for 5-10 corridors)"})]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://developer.tomtom.com",children:"TomTom Developer Portal"})," — API docs and key signup"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.tomtom.com/traffic-index/",children:"TomTom Traffic Index"})," — city congestion rankings"]})]})]}),d.jsxs(Ir,{id:"roads-511",title:"Road Conditions (511)",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"511 systems report road closures, construction, weather events, mountain pass conditions, and incidents. Every state runs their own 511 system — there is no national API."}),d.jsx(_e,{children:"Setting It Up"}),d.jsx("p",{children:"You need to find YOUR state's 511 developer API. MeshAI does not include a default URL because every state is different. Some states have free public APIs, some require registration, and some don't have developer APIs at all."}),d.jsx("p",{children:"Configure in Config → Environmental → 511:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Base URL"})," — your state's API endpoint"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"API Key"})," — if required by your state"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Endpoints"})," — which data feeds to poll (varies by state)"]})]}),d.jsx(_e,{children:"Learn More"}),d.jsx("p",{children:"Check your state's 511 or DOT website for developer information."})]}),d.jsxs(Ir,{id:"mesh-health",title:"Mesh Health",children:[d.jsx(_e,{children:"Health Score"}),d.jsx("p",{children:"MeshAI computes a 0-100 health score for your mesh network by looking at five areas, each weighted differently:"}),d.jsx(Gt,{headers:["Pillar","Weight","What It Measures"],rows:[[d.jsx("strong",{children:"Infrastructure"}),"30%","Are your routers online?"],[d.jsx("strong",{children:"Utilization"}),"25%","Is the radio channel congested?"],[d.jsx("strong",{children:"Coverage"}),"20%","Do nodes have redundant paths to gateways?"],[d.jsx("strong",{children:"Behavior"}),"15%","Are any nodes flooding the channel?"],[d.jsx("strong",{children:"Power"}),"10%","Are battery-powered nodes running low?"]]}),d.jsx("p",{children:"The overall score is the weighted sum:"}),d.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"Score = (Infrastructure × 30%) + (Utilization × 25%) + (Coverage × 20%) + (Behavior × 15%) + (Power × 10%)"}),d.jsx(_e,{children:"How Each Pillar Is Calculated"}),d.jsx(yl,{children:"Infrastructure (30%)"}),d.jsx("p",{children:"This is the simplest pillar — what percentage of your infrastructure nodes are currently online?"}),d.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"(routers online ÷ total routers) × 100"}),d.jsxs("p",{children:["Only nodes with the ",d.jsx(fe,{children:"ROUTER"}),", ",d.jsx(fe,{children:"ROUTER_LATE"}),", or ",d.jsx(fe,{children:"ROUTER_CLIENT"})," role count as infrastructure. Regular client nodes going offline doesn't affect this score. If you have 5 routers and 3 are online, infrastructure scores 60."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Special case:"})," If you have no routers at all (all clients), this pillar scores 100. You're not penalized for not having infrastructure — you just don't have any to track."]}),d.jsx(yl,{children:"Utilization (25%)"}),d.jsxs("p",{children:["MeshAI reads the channel utilization that each router reports in its telemetry — this is the firmware's own measurement of how busy the radio channel is. MeshAI uses the ",d.jsx("strong",{children:"highest"})," value from any infrastructure node because the busiest router is the bottleneck for the whole mesh."]}),d.jsx("p",{children:d.jsx("strong",{children:"How it works:"})}),d.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-4",children:[d.jsxs("li",{children:["Collect ",d.jsx(fe,{children:"channel_utilization"})," from all infrastructure nodes that report it"]}),d.jsx("li",{children:"If no infra nodes have telemetry, try all nodes"}),d.jsxs("li",{children:["Use the ",d.jsx("strong",{children:"maximum"})," value for scoring (busiest node = bottleneck)"]}),d.jsx("li",{children:"If no nodes report utilization (older firmware), fall back to packet count estimate"})]}),d.jsxs("p",{className:"mt-4",children:[d.jsx("strong",{children:"Fallback method"})," (when telemetry unavailable): estimates from packet counts using 200ms/packet airtime. This is less accurate — it assumes MediumFast preset and sums packets across all nodes."]}),d.jsx(Gt,{headers:["Channel Utilization","Score","What It Means"],rows:[["Under 20%","100","Channel is clear — this is the goal"],["20-25%","75-100","Slight degradation, occasional collisions"],["25-35%","50-75","Severe degradation — firmware throttling active"],["35-45%","25-50","Mesh struggling badly — reliability dropping"],["Over 45%","0-25","Mesh is effectively unusable"]]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Special case:"})," If no utilization data is available (no telemetry and no packet data), this pillar scores 100. You're not penalized for missing data."]}),d.jsx(yl,{children:"Coverage (20%)"}),d.jsx("p",{children:'Measures gateway redundancy — how many of your data sources can "see" each node. A node reported by all 3 of your gateways has full coverage. A node only seen by 1 gateway is a single point of failure.'}),d.jsxs("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:["coverage_ratio = average_gateways_per_node ÷ total_sources",d.jsx("br",{}),"single_gw_penalty = (single_gateway_nodes ÷ total_nodes) × 40"]}),d.jsx("p",{children:"If a node is seen by 2 out of 3 sources, its coverage ratio is 0.67. Infrastructure nodes with only single-gateway coverage get an extra penalty — they're critical but have no backup path."}),d.jsx(Gt,{headers:["Coverage Ratio","Base Score","After Penalty"],rows:[["100% (all sources)","100","100 minus single-gw penalty"],["70-99%","90","Minus penalties"],["50-69%","70","Minus penalties"],["Under 50%","50 or less","Heavy penalty"]]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Special case:"})," With only 1 data source, this pillar can't score well — there's no redundancy to measure. Coverage becomes meaningful when you have 2+ sources (MeshMonitor + MQTT, multiple gateways, etc.)."]}),d.jsx(yl,{children:"Behavior (15%)"}),d.jsx("p",{children:"Counts how many nodes are sending an unusually high number of non-text packets. This catches firmware bugs, stuck transmitters, and misconfigured nodes that are flooding the channel."}),d.jsxs("p",{children:[d.jsx("strong",{children:"What counts as flooding:"})," More than 500 non-text packets in 24 hours. Text messages don't count — the behavior pillar only flags telemetry, position, and routing packet floods."]}),d.jsx(Gt,{headers:["Flagged Nodes","Score"],rows:[["0","100"],["1","80"],["2-3","60"],["4-5","40"],["6+","20"]]}),d.jsx("p",{children:"A single misbehaving node only drops the score to 80. It takes multiple problem nodes to seriously hurt the behavior pillar."}),d.jsx(yl,{children:"Power (10%)"}),d.jsx("p",{children:"Measures what fraction of battery-powered nodes are below the warning threshold (default 20%)."}),d.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"100 × (1 − low_battery_nodes ÷ total_battery_nodes)"}),d.jsx("p",{children:"If 2 out of 10 battery nodes are below 20%, power scores 80."}),d.jsxs("p",{children:[d.jsx("strong",{children:"Important:"})," USB-powered nodes are excluded from this calculation. Many nodes report 100% battery even when running on wall power with no battery installed. Only nodes actually running on batteries affect this pillar."]}),d.jsx(_e,{children:"Health Tiers"}),d.jsx(Gt,{headers:["Score","Tier","What It Means"],rows:[["90-100",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Healthy"]}),"Everything's working well."],["75-89",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," Slight degradation"]}),"Some issues but the mesh is functional."],["50-74",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," Unhealthy"]}),"Multiple problems. Reliability is affected."],["25-49",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Warning"]}),"Significant issues. The mesh is struggling."],["0-24",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"black"})," Critical"]}),"Major failures. Barely functional."]]}),d.jsx(_e,{children:"Channel Utilization — Is the Radio Channel Full?"}),d.jsx("p",{children:"Meshtastic radios share one LoRa channel. If too many nodes are transmitting too often, they step on each other and messages get lost."}),d.jsx(Gt,{headers:["Utilization","What's Happening"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Under 25%"]}),"Healthy. The firmware itself starts throttling above 25% to protect the channel — so under 25% is the target."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," 25-40%"]}),"Getting busy. Common on larger meshes. Worth watching."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," 40-50%"]}),"Congested. The firmware throttles GPS updates above 40%. Messages are colliding and retrying."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Over 50%"]}),"Serious problem. More time is spent retrying than communicating. Mesh reliability drops fast."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"black"})," Over 65%"]}),"Documented failure point on busy LONG_FAST meshes. The mesh becomes unusable."]]}),d.jsx(_e,{children:"Packet Flooding"}),d.jsx("p",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-yellow-200",children:d.jsx("strong",{children:'⚠️ "Packet flooding" means a node sending too many RADIO PACKETS. This has nothing to do with water flooding.'})}),d.jsx("p",{children:"A normal Meshtastic node sends a packet every few minutes (announcing itself, reporting telemetry, updating position). If a node starts blasting packets every few seconds, something is wrong — firmware bug, stuck transmitter, or misconfiguration."}),d.jsx(Gt,{headers:["Packets per Minute","What It Means"],rows:[["1-5","Normal"],["5-10","Elevated — might be someone chatting a lot"],["10-20","Suspicious — worth investigating"],["Over 30","Something is broken. This node is actively hurting the mesh."]]}),d.jsx(_e,{children:"Battery Levels"}),d.jsx("p",{children:"Most Meshtastic radios (T-Beam, RAK4631, Heltec V3) use a single lithium battery cell. The voltage tells you how much charge is left:"}),d.jsx(Gt,{headers:["Voltage","Charge","What To Do"],rows:[["4.20V","100%","Full"],["3.80V","~60%","Fine"],[d.jsx("strong",{children:"3.60V"}),d.jsx("strong",{children:"~30%"}),d.jsx(d.Fragment,{children:d.jsx("strong",{children:"⚠️ Warning — charge it soon"})})],[d.jsx("strong",{children:"3.50V"}),d.jsx("strong",{children:"~15%"}),d.jsx(d.Fragment,{children:d.jsx("strong",{children:"🔴 Low — charge it now"})})],[d.jsx("strong",{children:"3.40V"}),d.jsx("strong",{children:"~7%"}),d.jsx(d.Fragment,{children:d.jsx("strong",{children:"⚫ About to die"})})],["3.30V","~3%","Device shutting down"]]}),d.jsxs("p",{children:[d.jsx("strong",{children:"USB-powered nodes"})," report 100% battery even if there's no battery installed. Battery alerts only matter for nodes actually running on battery power."]}),d.jsx(_e,{children:"Node Offline Detection"}),d.jsx("p",{children:`MeshAI marks a node as "offline" when it hasn't been heard for a configurable time period. Different node types need different thresholds:`}),d.jsx(Gt,{headers:["Node Type","Recommended Threshold","Why"],rows:[["Fixed infrastructure (wall power)",d.jsx("strong",{children:"2 hours"}),"These should always be transmitting. 2 hours of silence means something is wrong."],["Fixed client (wall power)","2-4 hours","Same logic, slightly more lenient."],["Mobile / vehicle","4-8 hours","They go behind mountains, into garages, out of range. Normal."],["Solar-powered","12-24 hours","May shut down at night when solar stops charging."]]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Rule of thumb"}),`: set the threshold to about 4× the node's beacon interval. Too tight and nodes will constantly flap "offline/online" from normal gaps. Too loose and real outages go unnoticed.`]})]}),d.jsxs(Ir,{id:"broadcast-types",title:"Broadcast Types",children:[d.jsx("p",{children:"Every broadcast the bot sends to the mesh carries a one-word prefix that tells you what kind of update it is. Three types:"}),d.jsx(Gt,{headers:["Prefix","What it means","When you see it"],rows:[[d.jsx(fe,{children:"New:"}),"The first time the bot has ever broadcast about this event","Cache Peak Fire's WFIGS first-sight; FIRMS cluster's first 3-pixel detection; first NWS warning for a CAP id"],[d.jsx(fe,{children:"Update:"}),"A material change on something the bot already announced","Cache Peak Fire's acreage grew; ITD 511 work zone's lane status changed; quake event's magnitude was revised"],[d.jsx(fe,{children:"Active:"}),"A clock-driven reminder that an already-announced event is still live","Cache Peak Fire is still burning 8 hours later; an SWPC G3 storm is still in progress"]]}),d.jsx("p",{children:"The bot tracks first-broadcast time and last-broadcast time separately on every event row, so a New: prefix is only emitted once even after a container restart. Update: respects per-adapter cooldowns (WFIGS is 8 h by default; ITD 511 is per-incident). Active: is the reminder system, covered in the next section."})]}),d.jsxs(Ir,{id:"reminders",title:"Reminder System",children:[d.jsxs("p",{children:["Some events stay live for days. A wildfire doesn't go out because WFIGS stopped publishing updates; a geomagnetic storm doesn't end because SWPC went quiet on the wire. The reminder system fires a clock-driven"," ",d.jsx(fe,{children:"Active:"}),"-prefixed re-broadcast on a human-scale cadence so an operator who came on shift after the original announcement still sees the event."]}),d.jsx(_e,{children:"Cadences"}),d.jsx(Gt,{headers:["Adapter","Reminder cadence","Termination"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"wfigs"})," (wildfires)"]}),"Every 8 h while the fire is still active","WFIGS publishes a tombstone (incident closed) → fires.tombstoned_at is stamped → reminder loop stops"],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"swpc"})," (space weather)"]}),"Every 8 h while a Kp >= floor / X-class flare / proton-storm event is ongoing","The next SWPC envelope shows the storm has subsided"],[d.jsx(fe,{children:"itd_511_work_zone"}),"Per-zone, configurable in the rule UI","WZDx publishes the zone with end_date in the past"]]}),d.jsx(_e,{children:"The tombstone"}),d.jsxs("p",{children:["When a WFIGS update declares an incident closed, the bot stamps"," ",d.jsx(fe,{children:"fires.tombstoned_at"})," with the close time. The reminder scheduler treats ",d.jsx(fe,{children:"tombstoned_at IS NOT NULL"}),` as "stop broadcasting Active: for this fire," and the LLM context layer treats it as "this fire is in the closed-out archive." A subsequent FIRMS pixel inside that fire's spread radius does not re-open it — closure is authoritative from NIFC.`]}),d.jsx(_e,{children:"Turning reminders off"}),d.jsxs("p",{children:["Per-adapter on/off lives in ",d.jsx(fe,{children:"adapter_meta.reminder_enabled"})," ","and is exposed on the Adapter Config page. The reminders themselves flow through the same dispatcher gates as everything else, so they still respect cooldowns, the cold-start grace window, and your notification rules."]})]}),d.jsxs(Ir,{id:"notifications",title:"Notifications",children:[d.jsx(_e,{children:"How It Works"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Something happens"})," — a fire is detected, weather warning issued, node goes offline, etc."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"MeshAI checks your rules"})," — does this event match any of your notification rules? Is it severe enough?"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"If a rule matches"})," — MeshAI sends the notification through whatever delivery method that rule is configured for."]})]}),d.jsx(_e,{children:"Building Rules"}),d.jsx("p",{children:"Each rule answers three questions:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"WHEN"})," does it trigger? (which categories, what severity)"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"WHERE"})," does it send? (mesh broadcast, email, webhook, etc.)"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"HOW OFTEN"})," at most? (cooldown period)"]})]}),d.jsx("p",{children:'Use "Add from Template" to start with a pre-built rule and customize it, or build from scratch with "Add Rule."'}),d.jsx(_e,{children:"Severity Levels — What Should I Set?"}),d.jsx(Gt,{headers:["Level","When It's Used","Notification Volume"],rows:[["Info","Routine stuff (ducting detected, new router appeared)","High — lots of messages"],["Advisory","Worth knowing (weather advisory, slow traffic, battery declining)","Moderate"],["Watch","Pay attention (fire within 50km, weather watch, stream rising)","Low-moderate"],[d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Warning"})," ✓"]}),"Take action (fire within 15km, severe weather, critical battery)","Low — recommended for most rules"],["Emergency","Life safety (extreme weather, fire at infrastructure, total blackout)","Very rare"]]}),d.jsxs("p",{children:[d.jsx("strong",{children:'"Warning" is the sweet spot for most rules.'})," You get alerted when something actually needs your attention without being overwhelmed by every minor event."]}),d.jsx(_e,{children:"Webhook — The Swiss Army Knife"}),d.jsx("p",{children:"A webhook sends your alert as an HTTP POST to any URL. This one delivery method works with:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Discord"})," — use a Discord webhook URL"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Slack"})," — use a Slack incoming webhook URL"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"ntfy.sh"})," — POST to ",d.jsx(fe,{children:"https://ntfy.sh/your-topic"})]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Pushover"})," — POST to the Pushover API"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Home Assistant"})," — POST to an automation webhook URL"]}),d.jsx("li",{children:"Anything else that accepts HTTP POST"})]}),d.jsx("p",{children:"MeshAI doesn't need to know what's on the other end. Give it the URL and it works."})]}),d.jsxs(Ir,{id:"commands",title:"Commands",children:[d.jsxs("p",{children:["All commands use the ",d.jsx(fe,{children:"!"})," prefix (configurable). Send these as a direct message to MeshAI on your mesh."]}),d.jsx(_e,{children:"Basic Commands"}),d.jsx(Gt,{headers:["Command","What It Does"],rows:[[d.jsx(fe,{children:"!help"}),"Shows all available commands"],[d.jsx(fe,{children:"!ping"}),"Tests if the bot is alive"],[d.jsx(fe,{children:"!status"}),"Quick mesh summary (nodes online, health score)"],[d.jsx(fe,{children:"!health"}),"Detailed health report with pillar scores"],[d.jsx(fe,{children:"!weather"}),"Current weather for your area"]]}),d.jsx(_e,{children:"Environmental Commands"}),d.jsx(Gt,{headers:["Command","What It Does"],rows:[[d.jsx(fe,{children:"!alerts"}),"Active NWS weather alerts for your area"],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"!solar"})," (or ",d.jsx(fe,{children:"!hf"}),")"]}),"Current solar indices and RF conditions"],[d.jsx(fe,{children:"!fire"}),"Active wildfires near your mesh"],[d.jsx(fe,{children:"!avy"}),'Avalanche advisory (seasonal — shows "off season" in summer)'],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"!streams"})," (or ",d.jsx(fe,{children:"!gauges"}),")"]}),"Stream gauge readings"],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"!roads"})," (or ",d.jsx(fe,{children:"!traffic"}),")"]}),"Road conditions and traffic flow"],[d.jsx(fe,{children:"!hotspots"}),"Satellite fire detections"]]}),d.jsx(_e,{children:"Conversational"}),d.jsxs("p",{children:[`Bang commands are the short, predictable interface. For anything that doesn't map cleanly to a single command — "how's the mesh doing?", "is there any ducting?", "why didn\\'t I hear about anything today?" — you can DM the bot in plain English. The LLM DM path covers the same data the commands cover, plus the dispatcher drop audit, with honest "no data" answers when a feed is quiet. Full catalog under`," ",d.jsx("a",{href:"#llm-dm",className:"text-accent hover:underline",children:"LLM DM Queries"}),"."]})]}),d.jsxs(Ir,{id:"llm-dm",title:"LLM DM (Natural-Language Queries)",children:[d.jsxs("p",{children:["Bang commands like ",d.jsx(fe,{children:"!fire"})," are short and predictable — the right tool on a mesh-constrained interface. For anything else, you can DM the bot in plain English and it will answer from the same live environmental data the broadcast pipeline uses. Both paths work; pick whichever fits the question."]}),d.jsx(_e,{children:"What it can answer"}),d.jsx("p",{children:"When you DM the bot a question, the env_reporter layer assembles up to seven data blocks and injects them into the LLM's system prompt. Each block maps to one adapter:"}),d.jsx(Gt,{headers:["Adapter block","Example question that hits it","What you get back"],rows:[[d.jsx(fe,{children:"build_fires_detail"}),'"are there any fires near me?"',"Active WFIGS-declared fires, acreage, containment, declared_at, county/state"],[d.jsx(fe,{children:"build_alerts_detail"}),'"any weather alerts?"',"Active NWS CAP alerts: type, severity, area, expiry"],[d.jsx(fe,{children:"build_quakes_detail"}),'"any earthquakes nearby?"',"USGS quakes in the last 24h: magnitude, depth, place"],[d.jsx(fe,{children:"build_traffic_detail"}),'"how is traffic on I-84?" / "any road closures?"',"TomTom + ITD 511 active incidents"],[d.jsx(fe,{children:"build_gauges_detail"}),'"what is the snake river level?"',"USGS NWIS latest readings + flood stages"],[d.jsx(fe,{children:"build_swpc_detail"}),'"what are the band conditions?" / "any space weather?"',"Recent SWPC events + band-conditions ratings"],[d.jsx(fe,{children:"build_drop_audit"}),`"why didn't I hear about anything today?"`,"Event log: what envelopes the dispatcher filtered, by adapter + category"]]}),d.jsx(_e,{children:"The grounding rule"}),d.jsxs("p",{children:["The bot is told to answer ",d.jsx("em",{children:"only"}),' from the blocks in the system prompt. If a block is empty (no recent quakes, no active NWS alerts), the response is honest about it: "No active weather alerts right now," not a fabricated "144 earthquakes worldwide in the past 24 hours." That clamp closes the failure mode where the LLM defaulted to its training data when local tables were quiet.']}),d.jsx(_e,{children:"Excluding an adapter from LLM context"}),d.jsxs("p",{children:["The ",d.jsx(fe,{children:"include_in_llm_context"})," toggle on each adapter's row in Adapter Config decides whether that adapter's ",d.jsx(fe,{children:"build_*"})," ","block lands in the system prompt. Turn an adapter off here if you don't want the bot's natural-language answers to draw on it (e.g. you ingest TomTom for situational awareness but don't want it cited in DM answers). Broadcasts are unaffected — this toggle gates LLM context only."]}),d.jsx(_e,{children:"What it can't answer"}),d.jsx("p",{children:`The bot has no general internet access. Questions that need data the env_reporter doesn't carry ("what's the weather forecast tomorrow", "who's the current president") fall back to whatever the configured LLM backend knows from training. The grounding clamp keeps the bot from inventing local data, but it can't keep the LLM from speculating about non-local topics.`})]}),d.jsxs(Ir,{id:"or-not-and",title:"OR-not-AND Architecture",children:[d.jsx("p",{children:"Every environmental adapter pulls its data from one of two places:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Central"})," (canonical) — Central polls the upstream feed once on behalf of the whole fleet and re-publishes normalized envelopes over NATS JetStream. MeshAI subscribes. One Central poll, one canonical normalization, many subscribers."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Native"})," — MeshAI polls the upstream feed directly. Stays around for adapters Central doesn't carry yet (currently Tropospheric Ducting and Avalanche Center advisories) and for operators who don't run Central."]})]}),d.jsx(_e,{children:"Why mutually exclusive"}),d.jsxs("p",{children:["An adapter is set to ",d.jsx("strong",{children:"either"})," Central ",d.jsx("strong",{children:"or"})," ","native, never both. Running both at the same time is what the codebase calls the ",d.jsx("em",{children:"AND-mode anti-pattern"}),": two independent poll loops on the same upstream feed, duplicate broadcasts, duplicate cursor state, no shared dedup. The Spokane-class leak (cross-state broadcasts that escaped the bbox filter in May 2026) was caused by an inadvertent AND-mode on the traffic adapter; the fix made the gate enforce mutual exclusion at boot and on every config save."]}),d.jsx(_e,{children:"The per-adapter source toggle"}),d.jsxs("p",{children:["Set ",d.jsx(fe,{children:"feed_source"})," on each adapter's row in Environment:"]}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"central"})," — disable the native poll loop, subscribe to the matching Central subject pattern."]}),d.jsxs("li",{children:[d.jsx(fe,{children:"native"})," — disable the Central subscription for this adapter, run the native poller."]})]}),d.jsxs("p",{children:["On the GUI, adapters with ",d.jsx("em",{children:"no Central counterpart yet"}),` show their Central button disabled with a "native only" tooltip. That's not an AND state; the adapter is still single-source, just locked to native by upstream availability.`]}),d.jsx(_e,{children:"Where this surfaces in tooltips"}),d.jsxs("p",{children:[`You'll see "AND-model anti-pattern" referenced in two places: the USGS-lookup button on Gauge Sites (disabled when the USGS adapter is on Central, because doing a one-off direct USGS poll from the GUI while the runtime is on Central is precisely the AND-mode this rule forbids) and the env_routes 404 response on`," ",d.jsxs(fe,{children:["/api/env/usgs/lookup/","{site_id}"]})," in central-feed mode. Both surfaces refuse to fall back to a direct upstream call; the right answer is to enter values manually or source them from Central."]})]}),d.jsxs(Ir,{id:"adapter-config",title:"Adapter Config & the CODE Rule",children:[d.jsx("p",{children:"The Adapter Config page is the single hub for ~50 GUI-editable knobs across the 13 adapters that touch the broadcast pipeline. Changes take effect on the next handler call — no container restart needed for most keys."}),d.jsx(_e,{children:"The CONFIG-vs-CODE rule"}),d.jsx("p",{children:"Not everything tunable becomes a GUI row. The codebase splits along one rule:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"CONFIG"})," (lives on this page) — where you send (channels), how often (cadences, schedules), thresholds (magnitude floors, severity gates, distance radii, cooldown durations, freshness windows), curation data (which sites, states, codes), toggles (enabled, include_in_llm_context)."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"CODE"})," (stays in the handlers, not on the GUI) — sentence templates, emoji choices, mapping / translation functions (TomTom icon_map, ITD sub_type_map, Central adapter_map and category_map), rendering logic (anchor priority order, expires-buckets formatting, threshold-state labels), heuristic logic (band_conditions Kp/SFI → Good/Fair/Poor function)."]})]}),d.jsx("p",{children:"If you find yourself wanting to add a wire-string template or an emoji to the GUI, stop — that's CODE. If you want to change a threshold or a curation list, the GUI is the right place."}),d.jsx(_e,{children:"Restart-required vs live"}),d.jsx("p",{children:"Most keys take effect on the next handler call (the env_store re-reads from the database). A short list requires a container restart, because they govern startup-only wiring:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Anything under the ",d.jsx(fe,{children:"environmental"})," section on the Config page (feed_source, central URL, etc.). The Spokane-fix gate runs at env_store boot and at CentralConsumer subscribe — both happen only at startup."]}),d.jsx("li",{children:"The LLM backend swap (Google → Anthropic → OpenAI)."}),d.jsx("li",{children:"The dispatcher cold-start grace window."})]}),d.jsx("p",{children:`When you save one of those keys via the GUI, a yellow Restart-Required banner surfaces at the top of the page with a "Restart now" button. Until you click it, the on-disk config and the running config intentionally disagree — that's the OR-not-AND gate refusing to transition mid-flight.`}),d.jsxs(_e,{children:["The ",d.jsx(fe,{children:"include_in_llm_context"})," toggle"]}),d.jsxs("p",{children:[`Each adapter's card on Adapter Config carries a per-adapter "LLM context" switch. When off, that adapter's `,d.jsx(fe,{children:"build_*"})," ","env_reporter block is skipped during system-prompt assembly. Broadcasts are unaffected; this toggle is purely about what the LLM sees when you DM it. See the LLM DM section above for the seven adapter blocks this gates."]})]}),d.jsxs(Ir,{id:"curation",title:"Curation: Gauge Sites & Town Anchors",children:[d.jsx("p",{children:"Two curation tables drive the broadcast text the bot puts on the mesh. Both are CRUD UIs with per-row enable/disable; both fall through to fallback chains when a row is missing or disabled."}),d.jsx(_e,{children:"Gauge Sites"}),d.jsx("p",{children:"Stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four NWS-AHPS flood thresholds in feet: Action, Minor, Moderate, Major. The handler compares an incoming gauge reading to those thresholds and emits the right broadcast severity."}),d.jsxs("p",{children:[d.jsx("strong",{children:"USGS lookup button"})," — when you add a new row in native-feed mode, the lookup queries the USGS Site Service plus NWS NWPS to auto-populate name, coordinates, and flood stages. In central-feed mode the button is disabled with a tooltip: a one-off direct USGS poll from the GUI while the runtime is on Central is the AND-mode anti-pattern the architecture forbids. Enter values manually or pull them from Central."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Disabled rows"})," are ignored at dispatch time. The corresponding gauge still ingests into ",d.jsx(fe,{children:"gauge_readings"})," ","(so historical queries still work), it just doesn't broadcast."]}),d.jsx(_e,{children:"Town Anchors"}),d.jsxs("p",{children:['Lookup table for the "X mi ',"<","bearing",">"," of ","<","town",">",'" suffix in broadcast text. When a fire or NWS alert renders, the bot walks an anchor chain to figure out where to say it is:']}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsx("li",{children:'Photon nearest-town lookup (the WFIGS path uses this — produces "near Long Creek Summit Home" style anchors)'}),d.jsx("li",{children:"Town Anchors table (your curated list)"}),d.jsx("li",{children:"Landclass label (county / federal-land identifier)"}),d.jsx("li",{children:"County + state fallback"}),d.jsx("li",{children:"Bare lat/lon coords"})]}),d.jsx("p",{children:'Each row carries a name (lowercased on save), state, lat/lon, and an enable flag. The "lowercased on save" rule keeps "Almo" / "ALMO" / "almo" from being three distinct rows. Disabled rows fall through to the next anchor in the chain — the broadcast text still goes out, it just uses a different anchor.'}),d.jsxs("p",{children:["Example broadcast text rendered from a Town Anchors row:"," ",d.jsx("span",{className:"text-amber-300",children:'"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained, @ 42.118,-113.643"'})]})]}),d.jsxs(Ir,{id:"schema",title:"Schema Migrations",children:[d.jsxs("p",{children:["MeshAI persists state in a single SQLite database (",d.jsx(fe,{children:"/data/meshai.sqlite"}),") with WAL journaling. Schema migrations live in ",d.jsx(fe,{children:"meshai/persistence/migrations/v*.sql"})," ","and apply automatically on container start. The runner reads the migrations directory, sorts by version, and applies anything past the current ",d.jsx(fe,{children:"schema_meta.version"})," in order. Idempotent re-runs are no-ops."]}),d.jsx(_e,{children:"v0.6 + v0.7 additions"}),d.jsx(Gt,{headers:["Migration","What it added"],rows:[[d.jsx(fe,{children:"v11"}),"first_broadcast_at + last_broadcast_at split + reminder_enabled per adapter (the schema basis for New / Update / Active)"],[d.jsx(fe,{children:"v12"}),"fires.tombstoned_at (WFIGS closure stamp; terminates the reminder loop)"],[d.jsx(fe,{children:"v13"}),"Fire Tracker Phase 1 — fire_pixels table + spread_radius_mi + current_centroid_lat/lon + last_hotspot_at; firms_pixels attributed_at + cluster_broadcast_at"],[d.jsx(fe,{children:"v14"}),"Fire Tracker Phase 2 — fire_passes table (per-satellite-pass centroid + drift) + last_pass_id + halt_broadcast_at on fires"],[d.jsx(fe,{children:"v15"}),"Fire Tracker Phase 3 — fire_passes.perimeter_geojson (convex hull) + fires.last_spotting_broadcast_at"],[d.jsx(fe,{children:"v16"}),"Fire Tracker Phase 4 — fire_digest_broadcasts table (idempotent twice-daily LLM digest)"]]}),d.jsx(_e,{children:"When migrations fail"}),d.jsxs("p",{children:["A migration failure leaves the database at the prior version and raises in the runner. Container logs surface the SQL error;"," ",d.jsx(fe,{children:"schema_meta.version"})," tells you where the last successful migration stopped. Re-running the container after the underlying issue is fixed picks up from there."]})]}),d.jsxs(Ir,{id:"api",title:"API Reference",children:[d.jsxs("p",{children:["MeshAI's REST API is available at ",d.jsx(fe,{children:"http://your-host:8080"}),". All endpoints return JSON."]}),d.jsx(_e,{children:"System"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/status"})," — version, uptime, node count"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/channels"})," — radio channel list"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"POST /api/restart"})," — restart the bot"]})]}),d.jsx(_e,{children:"Mesh Data"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/health"})," — health score and pillars"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/nodes"})," — all nodes with positions and telemetry"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/edges"})," — neighbor links with signal quality"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/regions"})," — region summaries"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/sources"})," — data source health"]})]}),d.jsx(_e,{children:"Configuration"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/config"})," — full config"]}),d.jsxs("li",{children:[d.jsxs(fe,{children:["GET /api/config/","{section}"]})," — one section"]}),d.jsxs("li",{children:[d.jsxs(fe,{children:["PUT /api/config/","{section}"]})," — update a section"]})]}),d.jsx(_e,{children:"Environmental"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/status"})," — per-feed health"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/active"})," — all active events"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/swpc"})," — solar/geomagnetic data"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/ducting"})," — atmospheric profile"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/fires"})," — wildfire perimeters"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/hotspots"})," — satellite fire detections"]})]}),d.jsx(_e,{children:"Alerts"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/alerts/active"})," — current alerts"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/alerts/history"})," — past alerts"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/notifications/categories"})," — available alert categories"]})]}),d.jsx(_e,{children:"Real-time"}),d.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:d.jsxs("li",{children:[d.jsx(fe,{children:"ws://your-host:8080/ws/live"})," — WebSocket for live updates"]})})]})]})})]})}const eT={site_id:"",gauge_name:"",lat:0,lon:0,action_ft:null,flood_minor_ft:null,flood_moderate_ft:null,flood_major_ft:null,enabled:!0,updated_at:0};function EZ(){const[e,t]=E.useState([]),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState(null),[l,u]=E.useState(eT),[c,h]=E.useState(!1),[f,v]=E.useState("unknown"),g=E.useCallback(async()=>{n(!0),i(null);try{const S=await fetch("/api/gauge-sites");if(!S.ok)throw new Error(`GET: ${S.status}`);t(await S.json())}catch(S){i(String(S))}finally{n(!1)}},[]);E.useEffect(()=>{g()},[g]),E.useEffect(()=>{fetch("/api/config/environmental").then(S=>S.json()).then(S=>{var C;return v(((C=S==null?void 0:S.usgs)==null?void 0:C.feed_source)||"unknown")}).catch(()=>v("unknown"))},[]);const m=S=>{s(S.site_id),u({...S}),h(!1)},y=()=>{h(!0),s(null),u({...eT})},x=()=>{s(null),h(!1),u(eT)},_=async()=>{try{const S=c?"/api/gauge-sites":`/api/gauge-sites/${o}`,M=await fetch(S,{method:c?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!M.ok){const A=await M.json().catch(()=>({}));alert(`save failed: ${A.detail||M.statusText}`);return}x(),g()}catch(S){alert(String(S))}},w=async S=>{if(!confirm(`Delete ${S}?`))return;const C=await fetch(`/api/gauge-sites/${S}`,{method:"DELETE"});if(!C.ok){alert(`delete failed: ${C.status}`);return}g()};return r?d.jsxs("div",{className:"p-6 text-slate-400",children:[d.jsx(nv,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):a?d.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",a]}):d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(c1,{className:"w-5 h-5 text-accent"}),d.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Gauge Sites"}),d.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," sites"]}),d.jsxs("button",{onClick:y,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:[d.jsx(si,{className:"w-4 h-4"})," Add site"]})]}),d.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:"NWS-AHPS stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four flood thresholds (Action / Minor / Moderate / Major, all in feet). Disabled rows still ingest into gauge_readings -- they don't broadcast. The USGS lookup button auto-populates name + coords + thresholds from USGS Site Service + NWS NWPS when this adapter is on native feed_source; Central-feed mode disables it (see Reference → OR-not-AND for why). Changes take effect on the next event."}),c&&d.jsx(KB,{draft:l,setDraft:u,onSave:_,onCancel:x,adding:!0,feedSource:f}),d.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:d.jsxs("table",{className:"w-full text-sm text-slate-200",children:[d.jsx("thead",{className:"bg-[#161616] border-b border-border",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Site ID"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat,Lon"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Action"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Minor"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Moderate"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Major"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:e.map(S=>o===S.site_id?d.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:d.jsx("td",{colSpan:9,className:"px-3 py-2",children:d.jsx(KB,{draft:l,setDraft:u,onSave:_,onCancel:x,feedSource:f})})},S.site_id):d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:S.site_id}),d.jsx("td",{className:"px-3 py-2",children:S.gauge_name}),d.jsxs("td",{className:"px-3 py-2 text-right text-xs",children:[S.lat.toFixed(3),",",S.lon.toFixed(3)]}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.action_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_minor_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_moderate_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_major_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-center",children:S.enabled?d.jsx(Yr,{className:"w-4 h-4 text-emerald-400 inline"}):d.jsx(_u,{className:"w-4 h-4 text-slate-500 inline"})}),d.jsxs("td",{className:"px-3 py-2 text-right",children:[d.jsx("button",{onClick:()=>m(S),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),d.jsx("button",{onClick:()=>w(S.site_id),className:"text-red-400 hover:text-red-300",children:d.jsx(li,{className:"w-4 h-4 inline"})})]})]},S.site_id))})]})})]})}function KB({draft:e,setDraft:t,onSave:r,onCancel:n,adding:a,feedSource:i}){const o=(g,m)=>t({...e,[g]:m}),[s,l]=E.useState(!1),[u,c]=E.useState(null),h=i!=="native"||!e.site_id.trim(),f=i!=="native"?"USGS lookup not available in central-feed mode (would be AND-model anti-pattern). Enter values manually.":e.site_id.trim()?"Auto-populate from USGS / NWS NWPS":"Enter a site_id first",v=async()=>{if(!h){l(!0),c(null);try{const g=e.site_id.replace(/^USGS-/i,""),m=await fetch(`/api/env/usgs/lookup/${encodeURIComponent(g)}`);if(m.status===404){const _=await m.json().catch(()=>({}));c(_.detail||"Lookup unavailable -- enter values manually"),l(!1);return}if(!m.ok){c(`Lookup failed (${m.status})`),l(!1);return}const y=await m.json(),x={...e};y.name&&!x.gauge_name&&(x.gauge_name=y.name),typeof y.lat=="number"&&(x.lat=y.lat),typeof y.lon=="number"&&(x.lon=y.lon),typeof y.action_ft=="number"&&(x.action_ft=y.action_ft),typeof y.flood_minor_ft=="number"&&(x.flood_minor_ft=y.flood_minor_ft),typeof y.flood_moderate_ft=="number"&&(x.flood_moderate_ft=y.flood_moderate_ft),typeof y.flood_major_ft=="number"&&(x.flood_major_ft=y.flood_major_ft),t(x)}catch(g){c(String(g))}finally{l(!1)}}};return d.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[d.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Site ID",d.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[d.jsx("input",{className:"flex-1 bg-bg border border-border px-2 py-1 text-slate-100 font-mono text-xs",value:e.site_id,onChange:g=>o("site_id",g.target.value),disabled:!a}),d.jsxs("button",{type:"button",onClick:v,disabled:h||s,title:f,className:"px-2 py-1 bg-bg-hover hover:bg-[#333] disabled:opacity-30 disabled:cursor-not-allowed text-xs text-slate-100 flex items-center gap-1",children:[s?d.jsx(nv,{className:"w-3 h-3 animate-spin"}):d.jsx(v1,{className:"w-3 h-3"}),"USGS lookup"]})]}),u&&d.jsx("span",{className:"text-amber-400 text-xs mt-1 block",children:u})]}),d.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Gauge name",d.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.gauge_name,onChange:g=>o("gauge_name",g.target.value)})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",d.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lat,onChange:g=>o("lat",parseFloat(g.target.value))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",d.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lon,onChange:g=>o("lon",parseFloat(g.target.value))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Action ft",d.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.action_ft??"",onChange:g=>o("action_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Minor flood ft",d.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_minor_ft??"",onChange:g=>o("flood_minor_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Moderate flood ft",d.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_moderate_ft??"",onChange:g=>o("flood_moderate_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Major flood ft",d.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_major_ft??"",onChange:g=>o("flood_major_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),d.jsxs("label",{className:"text-xs text-slate-300 col-span-2 flex items-center gap-2 mt-2",children:[d.jsx("input",{type:"checkbox",checked:e.enabled,onChange:g=>o("enabled",g.target.checked),className:"accent-[#f59e0b]"}),"Enabled"]}),d.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[d.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),d.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:"Save"})]})]})}const tT={anchor_id:0,name:"",lat:0,lon:0,state:"ID",enabled:!0,updated_at:0};function RZ(){const[e,t]=E.useState([]),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState(null),[l,u]=E.useState(!1),[c,h]=E.useState(tT),f=E.useCallback(async()=>{n(!0),i(null);try{const _=await fetch("/api/town-anchors");if(!_.ok)throw new Error(`GET: ${_.status}`);t(await _.json())}catch(_){i(String(_))}finally{n(!1)}},[]);E.useEffect(()=>{f()},[f]);const v=_=>{s(_.anchor_id),h({..._}),u(!1)},g=()=>{u(!0),s(null),h({...tT})},m=()=>{s(null),u(!1),h(tT)},y=async()=>{const _=l?"/api/town-anchors":`/api/town-anchors/${o}`,S=await fetch(_,{method:l?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const C=await S.json().catch(()=>({}));alert(`save failed: ${C.detail||S.statusText}`);return}m(),f()},x=async _=>{if(!confirm(`Delete anchor ${_}?`))return;const w=await fetch(`/api/town-anchors/${_}`,{method:"DELETE"});if(!w.ok){alert(`delete failed: ${w.status}`);return}f()};return r?d.jsxs("div",{className:"p-6 text-slate-400",children:[d.jsx(nv,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):a?d.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",a]}):d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(av,{className:"w-5 h-5 text-accent"}),d.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Town Anchors"}),d.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," towns"]}),d.jsxs("button",{onClick:g,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:[d.jsx(si,{className:"w-4 h-4"})," Add town"]})]}),d.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:`Lookup table for the "X mi of " suffix in the bot's broadcast text. When a fire or NWS alert renders, the bot walks: Photon nearest-town → this table → landclass → county/state → bare coords. Disabled rows fall through to the next anchor in the chain; the broadcast still goes out, it just uses a different anchor. Example: "3 mi N of Almo". See Reference → Curation: Gauges & Towns for the full chain.`}),l&&d.jsx(JB,{draft:c,setDraft:h,onSave:y,onCancel:m,adding:!0}),d.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:d.jsxs("table",{className:"w-full text-sm text-slate-200",children:[d.jsx("thead",{className:"bg-[#161616] border-b border-border",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lon"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"State"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:e.map(_=>o===_.anchor_id?d.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:d.jsx("td",{colSpan:6,className:"px-3 py-2",children:d.jsx(JB,{draft:c,setDraft:h,onSave:y,onCancel:m})})},_.anchor_id):d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-3 py-2 capitalize",children:_.name}),d.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lat.toFixed(4)}),d.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lon.toFixed(4)}),d.jsx("td",{className:"px-3 py-2 text-center text-xs",children:_.state||"-"}),d.jsx("td",{className:"px-3 py-2 text-center",children:_.enabled?d.jsx(Yr,{className:"w-4 h-4 text-emerald-400 inline"}):d.jsx(_u,{className:"w-4 h-4 text-slate-500 inline"})}),d.jsxs("td",{className:"px-3 py-2 text-right",children:[d.jsx("button",{onClick:()=>v(_),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),d.jsx("button",{onClick:()=>x(_.anchor_id),className:"text-red-400 hover:text-red-300",children:d.jsx(li,{className:"w-4 h-4 inline"})})]})]},_.anchor_id))})]})})]})}function JB({draft:e,setDraft:t,onSave:r,onCancel:n,adding:a}){const i=(o,s)=>t({...e,[o]:s});return d.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[d.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Name (lowercased on save)",d.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.name,onChange:o=>i("name",o.target.value),disabled:!a})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["State",d.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.state??"",onChange:o=>i("state",o.target.value)})]}),d.jsxs("label",{className:"text-xs text-slate-400 flex items-center gap-2",children:[d.jsx("input",{type:"checkbox",checked:e.enabled,onChange:o=>i("enabled",o.target.checked),className:"accent-[#f59e0b] mt-4"}),"Enabled"]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",d.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lat,onChange:o=>i("lat",parseFloat(o.target.value))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",d.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lon,onChange:o=>i("lon",parseFloat(o.target.value))})]}),d.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[d.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),d.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:"Save"})]})]})}function l2e(e,t,r){const n=e?{...e}:{...t,name:r};n.name=n.name||r;const a=(e==null?void 0:e.severity_channels)||{},i=t.severity_channels||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};return o.forEach(l=>{const u=(a[l]||[]).filter(h=>!h.startsWith("meshcore_")),c=(i[l]||[]).filter(h=>h.startsWith("meshcore_"));s[l]=[...u,...c]}),n.severity_channels=s,n.meshcore_channel=t.meshcore_channel??null,n.meshcore_dm_contacts=t.meshcore_dm_contacts||[],n}function u2e(e,t){const r=(t==null?void 0:t.mc_enabled)??!1,n=(e==null?void 0:e.mt_enabled)??(e==null?void 0:e.enabled)??!1,a=(e==null?void 0:e.cells)||{},i=(t==null?void 0:t.cells)||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};for(const l of o){const u=a[l]||{},c=i[l]||{},h=new Set([...Object.keys(u),...Object.keys(c)]),f={};for(const v of h){const g=u[v],m=c[v],y=m!==void 0?m.mc||null:(g==null?void 0:g.mc)??null,x={mt:(g==null?void 0:g.mt)??null,mc:y,min_severity:(m==null?void 0:m.min_severity)??(g==null?void 0:g.min_severity)??"routine",enabled:(m==null?void 0:m.enabled)??(g==null?void 0:g.enabled)??!0},_=x.mc;(x.mt!==null||_!==null&&_.trim()!=="")&&(f[v]=x)}Object.keys(f).length>0&&(s[l]=f)}return{mt_enabled:n,mc_enabled:r,cells:s}}function c2e(){var ye;const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState([]),[s,l]=E.useState(!0),[u,c]=E.useState(!1),[h,f]=E.useState(null),[v,g]=E.useState(null),[m,y]=E.useState(!1),[x,_]=E.useState([]),[w,S]=E.useState(!1),[C,M]=E.useState(null),[A,I]=E.useState(""),[k,P]=E.useState(null),[D,z]=E.useState({}),[j,B]=E.useState({}),H=(ne,xe)=>`${ne}|${xe}`,V=E.useCallback(async()=>{try{const[ne,xe]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/regions")]);if(!ne.ok)throw new Error("Failed to fetch notifications config");const he=await ne.json(),ge=xe.ok?await xe.json():[];r(he),a(JSON.parse(JSON.stringify(he))),o(Array.isArray(ge)?ge:[]),y(!1),f(null)}catch(ne){f(ne instanceof Error?ne.message:"Unknown error")}finally{l(!1)}},[]);E.useEffect(()=>{document.title="MeshCore Routing - MeshAI",V()},[V]);const U=E.useCallback(async()=>{try{const ne=await HJ();_(ne.active?ne.rooms:[]),S(ne.active)}catch{_([]),S(!1)}},[]);E.useEffect(()=>{U()},[U]),E.useEffect(()=>{t&&n&&y(JSON.stringify(t)!==JSON.stringify(n))},[t,n]),E.useEffect(()=>(e(m),()=>e(!1)),[m,e]);const F=(ne,xe)=>{if(!t)return;const he=t.toggles||{};r({...t,toggles:{...he,[ne]:{...he[ne]||{},name:ne,...xe}}})},W="room:",$=ne=>typeof ne=="string"&&ne.startsWith(W),Z=ne=>ne.slice(W.length),J=ne=>x.find(xe=>xe.pubkey===ne),re=(ne,xe,he)=>{var Ue,qe,Fe,_t,bt,et,Ke,St,ce;if(!t)return;const ge=((Fe=(qe=(Ue=t.region_routes)==null?void 0:Ue.cells)==null?void 0:qe[ne])==null?void 0:Fe[xe])??{mt:null,mc:null,min_severity:"routine",enabled:!0},tt={...((_t=t.region_routes)==null?void 0:_t.cells)||{},[ne]:{...((et=(bt=t.region_routes)==null?void 0:bt.cells)==null?void 0:et[ne])||{},[xe]:{...ge,mc:he}}};r({...t,region_routes:{mt_enabled:((Ke=t.region_routes)==null?void 0:Ke.mt_enabled)??((St=t.region_routes)==null?void 0:St.enabled)??!1,mc_enabled:((ce=t.region_routes)==null?void 0:ce.mc_enabled)??!1,cells:tt}})},Q=ne=>{var tt,Ue,qe,Fe,_t,bt;if(!t)return;const xe=((Ue=(tt=t.region_routes)==null?void 0:tt.cells)==null?void 0:Ue[ne])||{},he={};for(const[et,Ke]of Object.entries(xe))he[et]={...Ke,mc:null};const ge={...((qe=t.region_routes)==null?void 0:qe.cells)||{},[ne]:he};r({...t,region_routes:{mt_enabled:((Fe=t.region_routes)==null?void 0:Fe.mt_enabled)??((_t=t.region_routes)==null?void 0:_t.enabled)??!1,mc_enabled:((bt=t.region_routes)==null?void 0:bt.mc_enabled)??!1,cells:ge}})},le=async()=>{if(t){c(!0),f(null),g(null);try{const ne=await fetch("/api/config/notifications");if(!ne.ok)throw new Error("Failed to re-fetch notifications config");const xe=await ne.json(),he={...xe,toggles:{...xe.toggles||{}},region_routes:u2e(xe.region_routes,t.region_routes)},ge=t.toggles||{};for(const{key:qe}of fu){const Fe=ge[qe];Fe&&(he.toggles[qe]=l2e((xe.toggles||{})[qe],Fe,qe))}const tt=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(he)}),Ue=await tt.json();if(!tt.ok)throw new Error(Ue.detail||"Save failed");r(he),a(JSON.parse(JSON.stringify(he))),y(!1),e(!1),g("MeshCore routing saved successfully"),setTimeout(()=>g(null),3e3)}catch(ne){f(ne instanceof Error?ne.message:"Save failed")}finally{c(!1)}}},de=()=>{n&&(r(JSON.parse(JSON.stringify(n))),y(!1))};if(s)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading MeshCore routing..."})});if(!t)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})});const He=t.toggles||{};return d.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"Per-family MeshCore delivery. Choose which channels fire at each severity, the MeshCore channel name, and DM contacts."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:V,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:de,disabled:!m,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:le,disabled:u||!m,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[d.jsx(_a,{size:16}),u?"Saving...":"Save"]})]})]}),d.jsxs("div",{className:"flex items-start gap-2 p-3 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-400",children:[d.jsx(Jc,{size:16,className:"text-accent mt-0.5 flex-shrink-0"}),d.jsxs("div",{children:["Family gating (enable, severity threshold, freshness/cooldown) is on"," ",d.jsx(uf,{to:"/environment",className:"text-accent hover:underline",children:"Data Feeds"}),". Meshtastic delivery is on"," ",d.jsx(uf,{to:"/meshtastic/routing",className:"text-accent hover:underline",children:"Meshtastic Routing"}),". This page edits only the MeshCore delivery for each family."]})]}),h&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:h}),v&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),v]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["MeshCore Delivery",d.jsx(Yo,{info:"For each notification family, choose which MeshCore channels fire at each severity, the MeshCore channel name to broadcast on, and the DM contacts to unicast to. Enabling a family and its severity threshold are configured on the Data Feeds page."})]}),d.jsx("div",{className:"border border-[#1e2a3a] p-3",children:d.jsx(Ch,{label:"Enable MeshCore region routing",checked:((ye=t.region_routes)==null?void 0:ye.mc_enabled)??!1,onChange:ne=>{var xe,he,ge;return r({...t,region_routes:{mt_enabled:((xe=t.region_routes)==null?void 0:xe.mt_enabled)??((he=t.region_routes)==null?void 0:he.enabled)??!1,mc_enabled:ne,cells:((ge=t.region_routes)==null?void 0:ge.cells)||{}}})},helper:"Master switch for per-region MeshCore channel routing. When off, families deliver only to their default MeshCore channels."})}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:fu.map(({key:ne,label:xe,Icon:he})=>{var _t,bt;const ge=He[ne]||{},tt=((bt=(_t=t.region_routes)==null?void 0:_t.cells)==null?void 0:bt[ne])||{},Ue=i.some(et=>{var St;const Ke=(St=tt[et])==null?void 0:St.mc;return Ke!=null&&Ke.trim()!==""}),qe=D[ne],Fe=qe!==void 0?qe:Ue;return d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-200",children:[d.jsx(he,{size:15})," ",xe]}),d.jsxs("div",{className:"space-y-3 p-3 bg-[#0a0e17] border border-[#1e2a3a]",children:[d.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-300",children:[d.jsx(wk,{size:13}),"MeshCore"]}),d.jsx(LZ,{channels:DCe,severityChannels:ge.severity_channels||{},onChange:et=>F(ne,{severity_channels:et})}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"MeshCore channel name"}),d.jsx("input",{type:"text",value:ge.meshcore_channel!=null?ge.meshcore_channel:"",onChange:et=>F(ne,{meshcore_channel:et.target.value===""?null:et.target.value}),placeholder:"AIDA",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),d.jsx("p",{className:"text-xs text-slate-600",children:"Channel name on your MeshCore companion (e.g. AIDA). Blank = not broadcast on MeshCore."})]}),d.jsx(kZ,{label:"MeshCore DM contacts",value:ge.meshcore_dm_contacts||[],onChange:et=>F(ne,{meshcore_dm_contacts:et}),placeholder:"contact name or pubkey",helper:"MeshCore DM recipients (names or pubkeys)",info:"Contact names or pubkeys on the MeshCore companion. Used when meshcore_dm is enabled for a severity."})]}),d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[d.jsx(Ch,{label:"Region-based routing",checked:Fe,onChange:et=>{z(Ke=>({...Ke,[ne]:et})),et||Q(ne)},helper:"Route this family to different MC channels per region"}),Fe&&(i.length===0?d.jsxs("p",{className:"text-xs text-slate-500 italic",children:["No regions yet — add them on the"," ",d.jsx(uf,{to:"/coverage",className:"text-accent hover:underline",children:"Coverage"})," page."]}):d.jsx("div",{className:"space-y-1.5 pt-1",children:i.map(et=>{const St=(tt[et]??{mc:null}).mc??"",ce=H(ne,et),Bt=(j[ce]??($(St)?"room":"channel"))==="room",Ft=$(St)?J(Z(St)):void 0;return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-xs text-slate-400 flex-1 min-w-0 truncate",children:et}),d.jsxs("div",{className:"flex border border-[#1e2a3a] rounded overflow-hidden",children:[d.jsx("button",{type:"button",title:"Target a channel",onClick:()=>{B(jt=>({...jt,[ce]:"channel"})),$(St)&&re(ne,et,null)},className:`px-1.5 py-1 flex items-center ${Bt?"text-slate-500 hover:text-slate-300":"bg-accent text-white"}`,children:d.jsx(bJ,{size:12})}),d.jsx("button",{type:"button",title:w?"Target a room server":"MeshCore not connected",disabled:!w&&!$(St),onClick:()=>{B(jt=>({...jt,[ce]:"room"})),$(St)||re(ne,et,null)},className:`px-1.5 py-1 flex items-center ${Bt?"bg-accent text-white":"text-slate-500 hover:text-slate-300"} disabled:opacity-40 disabled:cursor-not-allowed`,children:d.jsx(SJ,{size:12})})]}),Bt?d.jsxs(d.Fragment,{children:[w||Ft?d.jsxs("div",{className:"flex items-center gap-1 w-40",children:[d.jsxs("select",{value:Ft?Ft.pubkey:"",onChange:jt=>{const Lr=jt.target.value;re(ne,et,Lr===""?null:W+Lr)},className:"flex-1 min-w-0 px-1.5 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 focus:outline-none focus:border-accent",children:[d.jsx("option",{value:"",children:"room…"}),!Ft&&$(St)&&d.jsxs("option",{value:Z(St),children:[Z(St).slice(0,10),"…"]}),x.map(jt=>d.jsx("option",{value:jt.pubkey,children:jt.name||jt.pubkey.slice(0,10)+"…"},jt.pubkey))]}),Ft&&d.jsx("span",{title:Ft.path_established?"Path established":"No path yet — first send discovers it",className:`text-[10px] ${Ft.path_established?"text-green-500":"text-slate-600"}`,children:"●"})]}):d.jsx("span",{className:"w-40 text-xs text-slate-600 italic truncate",children:"MeshCore not connected"}),Z(St)&&(()=>{var tl;const jt=Z(St),Lr=((tl=x.find(Ki=>Ki.pubkey===jt))==null?void 0:tl.password_set)??!1,Qo=C===jt;return d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("button",{type:"button",title:Lr?"Room password: set":"Room password: not set","aria-label":Lr?"Room password: set":"Room password: not set",onClick:()=>{P(null),Qo?M(null):(M(jt),I(""))},className:`px-1 py-1 text-xs ${Lr?"text-accent":"text-slate-600 hover:text-slate-400"}`,children:Lr?"🔒":"🔓"}),Qo&&d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("input",{type:"password",value:A,onChange:Ki=>I(Ki.target.value),placeholder:"room password",className:"w-28 px-1.5 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 focus:outline-none focus:border-accent"}),d.jsx("button",{type:"button",title:"Save room password",onClick:async()=>{try{P(null),await UJ(jt,A),await U(),M(null),I("")}catch{P("save failed")}},className:"px-1.5 py-1 bg-accent hover:bg-accent/80 rounded text-xs text-white",children:"Save"}),d.jsx("button",{type:"button",title:"Clear room password",onClick:async()=>{try{P(null),await WJ(jt),await U(),M(null),I("")}catch{P("clear failed")}},className:"px-1.5 py-1 border border-[#1e2a3a] rounded text-xs text-slate-400 hover:text-slate-200",children:"Clear"}),d.jsx("button",{type:"button",title:"Cancel",onClick:()=>{M(null),P(null)},className:"px-1.5 py-1 border border-[#1e2a3a] rounded text-xs text-slate-500 hover:text-slate-300",children:"Cancel"}),k&&d.jsx("span",{className:"text-[10px] text-red-400",children:k})]})]})})()]}):d.jsx("input",{type:"text",value:St,onChange:jt=>{const Lr=jt.target.value;re(ne,et,Lr===""?null:Lr)},placeholder:"channel",className:"w-40 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono focus:outline-none focus:border-accent"})]},et)})}))]})]},ne)})})]})]})}function h2e(){const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(null),[u,c]=E.useState(!0),[h,f]=E.useState(!1),[v,g]=E.useState(null),[m,y]=E.useState(null),[x,_]=E.useState(!1),[w,S]=E.useState(!1),[C,M]=E.useState([]),[A,I]=E.useState({}),[k,P]=E.useState(new Set),[D,z]=E.useState(null),[j,B]=E.useState(""),[H,V]=E.useState(""),[U,F]=E.useState(!1),[W,$]=E.useState(null),[Z,J]=E.useState(""),[re,Q]=E.useState(""),[le,de]=E.useState(!1),[He,ye]=E.useState(null),[ne,xe]=E.useState(null),he=E.useCallback(async()=>{c(!0);try{const[ce,st]=await Promise.all([Ao("connection"),Ao("meshcore_context")]);r(ce),a(JSON.parse(JSON.stringify(ce))),o(st),l(JSON.parse(JSON.stringify(st))),_(!1),g(null)}catch(ce){g(ce instanceof Error?ce.message:"Unknown error")}finally{c(!1)}},[]);E.useEffect(()=>{document.title="MeshCore Connection - MeshAI",he()},[he]);const ge=E.useCallback(async()=>{try{const ce=await ZV(),st=ce.channels.map(Ft=>Ft.name),Bt={};for(const Ft of ce.channels)Bt[Ft.name]=Ft.key;S(ce.active),M(st),I(Bt),B(Ft=>Ft&&st.includes(Ft)?Ft:st[0]??"")}catch{try{const ce=await FJ();S(ce.active),M(ce.channels),I({}),B(st=>st&&ce.channels.includes(st)?st:ce.channels[0]??"")}catch{S(!1)}}},[]);E.useEffect(()=>{ge()},[ge]);const tt=ce=>{P(st=>{const Bt=new Set(st);return Bt.has(ce)?Bt.delete(ce):Bt.add(ce),Bt})},Ue=async(ce,st)=>{try{await navigator.clipboard.writeText(st),z(ce),setTimeout(()=>z(Bt=>Bt===ce?null:Bt),1500)}catch{P(Bt=>new Set(Bt).add(ce))}},qe=async()=>{const ce=Z.trim();if(ce){de(!0),xe(null);try{await VJ(ce,re.trim()),J(""),Q(""),await ge()}catch(st){xe(st instanceof Error?st.message:"Failed to add channel")}finally{de(!1)}}},Fe=async ce=>{ye(ce),xe(null);try{await GJ(ce),o(st=>!st||!(st.observe_channels??[]).includes(ce)?st:{...st,observe_channels:(st.observe_channels??[]).filter(Bt=>Bt!==ce)}),await ge()}catch(st){xe(st instanceof Error?st.message:"Failed to remove channel")}finally{ye(null)}},_t=async()=>{F(!0),$(null);try{const ce=await YV({transport:"meshcore",channel:j,text:H.trim()||void 0});$(ce)}catch(ce){$({sent:!1,detail:ce instanceof Error?ce.message:"Send failed"})}finally{F(!1)}};E.useEffect(()=>{if(t&&n&&i&&s){const ce=JSON.stringify(t)!==JSON.stringify(n)||JSON.stringify(i)!==JSON.stringify(s);_(ce)}},[t,n,i,s]),E.useEffect(()=>(e(x),()=>e(!1)),[x,e]);const bt=ce=>r(st=>st&&{...st,...ce}),et=async()=>{if(!(!t||!i)){f(!0),g(null),y(null);try{const ce=await Promise.all([Da("connection",t),Da("meshcore_context",i)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),_(!1),e(!1),y("MeshCore connection saved successfully"),ce.some(st=>st.restart_required)&&bu([]),setTimeout(()=>y(null),3e3)}catch(ce){g(ce instanceof Error?ce.message:"Save failed")}finally{f(!1)}}},Ke=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),_(!1)},St=ce=>{o(st=>{if(!st)return st;const Bt=st.observe_channels??[],Ft=Bt.includes(ce)?Bt.filter(jt=>jt!==ce):[...Bt,ce];return{...st,observe_channels:Ft}})};return u?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading MeshCore connection..."})}):t?d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"MeshCore node connection."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:he,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:Ke,disabled:!x,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:et,disabled:h||!x,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[d.jsx(_a,{size:16}),h?"Saving...":"Save"]})]})]}),v&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:v}),m&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),m]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"MeshCore Connection"}),d.jsx("p",{className:"text-xs text-slate-500",children:"Choose how MeshAI reaches your MeshCore node. TCP talks to a companion frame server; Serial connects to a USB-attached node; BLE pairs over Bluetooth. Meshtastic is always active."}),d.jsx(Dn,{label:"Connection Type",value:t.meshcore_conn_type??"tcp",onChange:ce=>bt({meshcore_conn_type:ce}),options:[{value:"tcp",label:"TCP (companion)"},{value:"serial",label:"Serial (USB)"},{value:"ble",label:"BLE"}],helper:"TCP for a companion frame server, Serial for a USB node, BLE for Bluetooth"}),(t.meshcore_conn_type??"tcp")==="tcp"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"MeshCore Host",value:t.meshcore_host??"",onChange:ce=>bt({meshcore_host:ce}),placeholder:"192.168.1.100",helper:"IP or hostname of the companion frame server",info:"The MeshCore companion (frame server) host. Active when non-empty in TCP mode."}),d.jsx(Ae,{label:"MeshCore Port",value:t.meshcore_port??5525,onChange:ce=>bt({meshcore_port:ce}),min:1,max:65535,helper:"MeshCore TCP port (default 5525)"})]}),(t.meshcore_conn_type??"tcp")==="serial"&&d.jsxs(d.Fragment,{children:[d.jsx(AZ,{label:"MeshCore Serial Port",value:t.meshcore_serial_port??"",onChange:ce=>bt({meshcore_serial_port:ce}),helper:"USB-attached MeshCore node — Detect fills a stable by-id path"}),d.jsx(Ae,{label:"Baud Rate",value:t.meshcore_baud??115200,onChange:ce=>bt({meshcore_baud:ce}),min:1200,helper:"Serial baud rate (default 115200)"})]}),(t.meshcore_conn_type??"tcp")==="ble"&&d.jsx(yt,{label:"BLE Address",value:t.meshcore_ble_address??"",onChange:ce=>bt({meshcore_ble_address:ce}),placeholder:"AA:BB:CC:DD:EE:FF",helper:"Leave blank to scan/pair the first available device"}),d.jsx("div",{className:"pt-2",children:d.jsx(uf,{to:"/meshtastic/connection",className:"inline-flex items-center gap-1 text-xs text-slate-500 hover:text-accent transition-colors",children:"→ Meshtastic connection"})}),d.jsx(qt,{label:"Auto-add contacts (AIDA adds any node it hears — required to DM anyone)",checked:t.meshcore_auto_add_contacts??!0,onChange:ce=>bt({meshcore_auto_add_contacts:ce}),helper:"Enables firmware CMD 58 (set_autoadd_config) at connect so AIDA automatically adds every node it hears an advert from as a contact, enabling DM send/decrypt without manual contact exchange"}),d.jsxs("details",{className:"group",children:[d.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[d.jsx(Ah,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced — MeshCore Reconnect"]}),d.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[d.jsx(qt,{label:"Auto-reconnect (MeshCore)",checked:t.meshcore_auto_reconnect??!0,onChange:ce=>bt({meshcore_auto_reconnect:ce}),helper:"Automatically reconnect to the MeshCore companion if the link drops"}),d.jsx(Ae,{label:"Max Reconnect Attempts",value:t.meshcore_max_reconnect_attempts??5,onChange:ce=>bt({meshcore_max_reconnect_attempts:ce}),min:0,helper:"Maximum reconnect attempts before giving up (0 = unlimited)"})]})]})]}),i&&d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Bot behavior"}),d.jsx(qt,{label:"Enable Passive Context",checked:!!i.enable_passive_context,onChange:ce=>o({...i,enable_passive_context:ce}),helper:"Listen to MeshCore channel traffic for context",info:"When enabled, the bot monitors MeshCore channels and includes recent messages in its context so it can reference what others said."}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:"Observe MeshCore Channels"}),d.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[C.map(ce=>{const st=(i.observe_channels??[]).includes(ce),Bt=A[ce]??null,Ft=k.has(ce);return d.jsxs("div",{className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17]",children:[d.jsxs("label",{onClick:()=>St(ce),className:"flex items-center gap-2 cursor-pointer shrink-0",children:[d.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${st?"bg-accent border-accent":"border-slate-600"}`,children:st&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsx("span",{className:"text-sm text-slate-200",children:ce})]}),d.jsx("div",{className:"flex items-center gap-1 flex-1 min-w-0 justify-end",children:Bt?d.jsxs(d.Fragment,{children:[d.jsx("code",{title:Ft?Bt:"Key hidden — click the eye to reveal",className:"text-xs font-mono text-slate-400 truncate max-w-[16rem]",children:Ft?Bt:"••••••••••••••••"}),d.jsx("button",{type:"button",title:Ft?"Hide key":"Reveal key","aria-label":Ft?`Hide key for ${ce}`:`Reveal key for ${ce}`,onClick:()=>tt(ce),className:"p-1 text-slate-600 hover:text-slate-300",children:Ft?d.jsx(h1,{size:14}):d.jsx(rv,{size:14})}),d.jsx("button",{type:"button",title:"Copy key to clipboard","aria-label":`Copy key for ${ce}`,onClick:()=>Ue(ce,Bt),className:"p-1 text-slate-600 hover:text-accent",children:D===ce?d.jsx(Yr,{size:14,className:"text-green-400"}):d.jsx(PV,{size:14})})]}):d.jsx("span",{className:"text-xs font-mono text-slate-600",title:"No retrievable key for this channel",children:"—"})}),d.jsx("button",{type:"button",title:`Remove channel '${ce}' from the companion`,"aria-label":`Remove channel ${ce}`,disabled:He===ce,onClick:()=>Fe(ce),className:"p-1 text-slate-600 hover:text-red-400 disabled:opacity-50 disabled:cursor-not-allowed shrink-0",children:d.jsx(li,{size:14})})]},ce)}),C.length===0&&d.jsxs("div",{className:"text-sm text-slate-500 p-2",children:["No channels available",w?"":" (MeshCore not connected)"]})]}),d.jsx("p",{className:"text-xs text-slate-600",children:"Choose which MeshCore channels feed MeshAI's context. Empty = none are watched — pick channels to include their chatter in what the bot knows about the mesh. Leave busy/public channels out to keep them out of context. Each channel's key (PSK) is shown on the right — reveal and copy it to share with people who want to join."}),d.jsxs("div",{className:"flex items-end gap-2 pt-2",children:[d.jsxs("div",{className:"flex-1 space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:"Name"}),d.jsx("input",{type:"text",value:Z,onChange:ce=>J(ce.target.value),placeholder:"#channel-name",disabled:!w,className:"w-full px-2 py-1.5 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent disabled:opacity-50"})]}),d.jsxs("div",{className:"flex-1 space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:"Key"}),d.jsx("input",{type:"text",value:re,onChange:ce=>Q(ce.target.value),placeholder:"PSK hex (32 chars) — leave blank for public #channel",disabled:!w,className:"w-full px-2 py-1.5 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent disabled:opacity-50"})]}),d.jsx("button",{type:"button",onClick:qe,disabled:!w||le||!Z.trim(),className:"px-3 py-1.5 bg-accent hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed rounded text-sm text-white whitespace-nowrap",children:le?"Saving…":"Save"})]}),ne&&d.jsx("p",{className:"text-xs text-red-400",children:ne})]}),d.jsx(la,{label:"Ignore MeshCore Contacts",value:i.ignore_contacts??[],onChange:ce=>o({...i,ignore_contacts:ce}),helper:"Contact names or pubkey prefixes to exclude from context (comma-separated)",info:"Messages from these MeshCore contacts won't be included in passive context. Enter contact names or public-key prefixes."}),d.jsx(qt,{label:"Answer direct messages",checked:!!i.respond_to_dms,onChange:ce=>o({...i,respond_to_dms:ce}),helper:"When on, MeshAI replies to MeshCore direct messages using the LLM. Applies to MeshCore only."})]}),d.jsxs("div",{className:`bg-bg-card border border-border p-6 space-y-4${w?"":" opacity-60"}`,children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Send Test Message"}),w?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Channel"}),d.jsx("select",{value:j,onChange:ce=>B(ce.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:C.map(ce=>d.jsx("option",{value:ce,children:ce},ce))})]}),d.jsx(yt,{label:"Message (optional)",value:H,onChange:V,placeholder:`🧪 MeshAI test — ${new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}),d.jsx("button",{onClick:_t,disabled:U,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white text-sm transition-colors",children:U?"Sending...":"Send test"}),W&&(W.sent?d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),W.detail]}):d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:W.detail}))]}):d.jsx("p",{className:"text-sm text-slate-500",children:"MeshCore not connected"})]})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load connection config"})})}const d2e={serial:"bg-emerald-500/15 text-emerald-400",tcp:"bg-sky-500/15 text-sky-400",ble:"bg-violet-500/15 text-violet-400"};function f2e(e){return e?e.target?e.target:e.conn_type==="serial"?e.serial_port?`${e.serial_port}@${e.baud??115200}`:"serial":e.conn_type==="ble"?e.ble_address||"ble":e.host?`${e.host}${e.port!=null?`:${e.port}`:""}`:"—":"—"}function v2e(e){const t=Math.floor(Date.now()/1e3-e);if(t<5)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function OZ(){const[e,t]=E.useState(null),[r,n]=E.useState(null),[a,i]=E.useState(!0),[o,s]=E.useState(null),[l,u]=E.useState(null),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(3),[y,x]=E.useState(!1),[_,w]=E.useState(!1);E.useEffect(()=>{document.title="Companion & Channels - MeshAI"},[]),E.useEffect(()=>{let k=!1;return(async()=>{i(!0),s(null);try{const[P,D]=await Promise.all([Hj(),ZV()]);if(k)return;t(P),n(D)}catch(P){if(k)return;s(P instanceof Error?P.message:"Failed to load companion status")}finally{k||i(!1)}})(),()=>{k=!0}},[]),E.useEffect(()=>{(async()=>{try{const k=await fetch("/api/config/connection");if(k.ok){const D=(await k.json()).meshcore_advert_interval_seconds;typeof D=="number"&&m(D>0?D/3600:0)}}catch{}})()},[]);const S=E.useCallback(async()=>{h(!0),v(null);try{const k=await qJ();if(v(k),k.sent)try{const P=await Hj();t(P)}catch{}}catch(k){v({sent:!1,detail:k instanceof Error?k.message:"Request failed"})}finally{h(!1)}},[]),C=E.useCallback(async()=>{x(!0),w(!1);try{const k=Math.round(g*3600);await Da("connection",{meshcore_advert_interval_seconds:k}),w(!0),setTimeout(()=>w(!1),2e3)}catch{}finally{x(!1)}},[g]),M=E.useCallback(async k=>{try{await navigator.clipboard.writeText(k),u(k),setTimeout(()=>u(P=>P===k?null:P),1500)}catch{}},[]),A=(e==null?void 0:e.connected)===!0,I=r!=null&&r.active?r.channels:[];return d.jsxs("div",{className:"max-w-3xl mx-auto space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:d.jsx(_k,{size:24,className:"text-accent"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"Companion & Channels"}),d.jsx("p",{className:"text-sm text-[#777]",children:"Live status for the AIDA MeshCore companion and its joined channels."})]})]}),a?d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-slate-400",children:"Loading..."})}):o?d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:o}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"bg-bg-card border border-border p-6",children:A?d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-green-500"}),d.jsx("span",{className:"text-sm font-medium text-green-400",children:"Connected"})]}),d.jsxs("dl",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-4 text-sm",children:[d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Node name"}),d.jsx("dd",{className:"text-slate-100",children:(e==null?void 0:e.name)??"unnamed"})]}),d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Connection"}),d.jsxs("dd",{className:"flex items-center gap-2",children:[d.jsx("span",{className:`px-1.5 py-0.5 text-[10px] uppercase tracking-wide rounded ${d2e[(e==null?void 0:e.conn_type)??""]??"bg-slate-600/30 text-slate-400"}`,children:(e==null?void 0:e.conn_type)??"unknown"}),d.jsx("span",{className:"text-slate-100 font-mono text-xs break-all",children:f2e(e)})]})]}),d.jsxs("div",{className:"sm:col-span-2",children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Public key"}),d.jsx("dd",{className:"text-slate-100 font-mono text-xs break-all",children:(e==null?void 0:e.pubkey)??"—"})]}),d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Channels joined"}),d.jsx("dd",{className:"text-slate-100",children:(e==null?void 0:e.channel_count)??0})]}),(e==null?void 0:e.last_advert_sent)!=null&&d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Last advertised"}),d.jsx("dd",{className:"text-slate-100",children:v2e(e.last_advert_sent)})]})]}),d.jsxs("div",{className:"pt-2 border-t border-border space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("button",{onClick:S,disabled:c,className:"flex items-center gap-2 px-3 py-1.5 text-sm bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[d.jsx(_i,{size:14}),c?"Sending…":"Send Advert"]}),f!=null&&d.jsx("span",{className:`text-sm ${f.sent?"text-green-400":"text-red-400"}`,children:f.sent?"Advert sent":f.detail})]}),d.jsx("p",{className:"text-xs text-[#555]",children:"Announce this node to the mesh so others can discover and DM it."})]})]}):d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-slate-600"}),d.jsx("span",{className:"text-sm font-medium text-slate-400",children:"Not connected"})]}),d.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"The MeshCore companion is offline or inactive. No node identity or channel membership is available while the companion is disconnected."})]})}),d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"px-4 py-3 border-b border-border",children:[d.jsx("h3",{className:"text-sm font-medium text-slate-200",children:"Channels"}),d.jsx("p",{className:"text-xs text-[#555] mt-1",children:"Key = the channel PSK; enter it (or the # name) on a companion radio to join."})]}),I.length>0?d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full text-sm text-slate-200",children:[d.jsx("thead",{className:"bg-[#161616] border-b border-border",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"On-air hash"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Key"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:I.map(k=>d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-3 py-2 font-mono",children:k.name}),d.jsx("td",{className:"px-3 py-2 font-mono text-xs text-[#999]",children:k.hash!=null?`0x${k.hash}`:"—"}),d.jsx("td",{className:"px-3 py-2",children:k.key!=null?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-mono text-xs text-[#999] break-all",children:k.key}),d.jsx("button",{onClick:()=>M(k.key),className:"flex-shrink-0 px-2 py-0.5 text-[10px] bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded transition-colors",title:"Copy key to clipboard",children:l===k.key?"Copied":"Copy"})]}):d.jsx("span",{className:"text-xs text-[#777]",children:"—"})})]},k.name))})]})}):d.jsx("div",{className:"px-4 py-3 text-sm text-[#777]",children:"No channels"})]}),d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsx("div",{className:"px-4 py-3 border-b border-border",children:d.jsx("h3",{className:"text-sm font-medium text-slate-200",children:"Advertising"})}),d.jsx("div",{className:"px-4 py-4 space-y-4",children:d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"text-xs font-medium text-[#777] uppercase tracking-wide",children:"Auto-advert interval"}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("select",{value:g,onChange:k=>m(Number(k.target.value)),className:"bg-[#0a0e17] border border-[#1e2a3a] text-slate-200 text-sm rounded px-2 py-1.5 focus:outline-none focus:border-accent",children:[d.jsx("option",{value:0,children:"Disabled"}),d.jsx("option",{value:1,children:"Every 1 hour"}),d.jsx("option",{value:3,children:"Every 3 hours (default)"}),d.jsx("option",{value:6,children:"Every 6 hours"}),d.jsx("option",{value:12,children:"Every 12 hours"}),d.jsx("option",{value:24,children:"Every 24 hours"})]}),d.jsx("button",{onClick:C,disabled:y,className:"px-3 py-1.5 text-sm bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded disabled:opacity-50 transition-colors",children:y?"Saving…":_?"Saved":"Save"})]}),d.jsxs("p",{className:"text-xs text-[#555]",children:["AIDA sends a flood advertisement at this interval so it stays discoverable. Stored in ",d.jsx("code",{className:"text-accent/80",children:"connection.meshcore_advert_interval_seconds"}),"."]})]})})]})]})]})}function p2e(){const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(null),[u,c]=E.useState(null),[h,f]=E.useState(null),[v,g]=E.useState(!0),[m,y]=E.useState(!1),[x,_]=E.useState(null),[w,S]=E.useState(null),[C,M]=E.useState(!1),[A,I]=E.useState(0),[k,P]=E.useState(""),[D,z]=E.useState(!1),[j,B]=E.useState(null),H=async()=>{z(!0),B(null);try{const W=await YV({transport:"meshtastic",channel:A,text:k.trim()||void 0});B(W)}catch(W){B({sent:!1,detail:W instanceof Error?W.message:"Send failed"})}finally{z(!1)}},V=E.useCallback(async()=>{g(!0);try{const[W,$,Z]=await Promise.all([Ao("connection"),Ao("context"),Ao("bot")]);r(W),a(JSON.parse(JSON.stringify(W))),o($),l(JSON.parse(JSON.stringify($))),c(Z),f(JSON.parse(JSON.stringify(Z))),M(!1),_(null)}catch(W){_(W instanceof Error?W.message:"Unknown error")}finally{g(!1)}},[]);E.useEffect(()=>{document.title="Meshtastic Connection - MeshAI",V()},[V]),E.useEffect(()=>{if(t&&n&&i&&s&&u&&h){const W=JSON.stringify(t)!==JSON.stringify(n)||JSON.stringify(i)!==JSON.stringify(s)||JSON.stringify(u)!==JSON.stringify(h);M(W)}},[t,n,i,s,u,h]),E.useEffect(()=>(e(C),()=>e(!1)),[C,e]);const U=async()=>{if(!(!t||!i||!u)){y(!0),_(null),S(null);try{const W=await Promise.all([Da("connection",t),Da("context",i),Da("bot",u)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),f(JSON.parse(JSON.stringify(u))),M(!1),e(!1),S("Meshtastic connection saved successfully"),W.some($=>$.restart_required)&&bu([]),setTimeout(()=>S(null),3e3)}catch(W){_(W instanceof Error?W.message:"Save failed")}finally{y(!1)}}},F=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),h&&c(JSON.parse(JSON.stringify(h))),M(!1)};return v?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading Meshtastic connection..."})}):t?d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"Connection to your Meshtastic radio (serial or TCP)."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:V,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:F,disabled:!C,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:U,disabled:m||!C,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[d.jsx(_a,{size:16}),m?"Saving...":"Save"]})]})]}),x&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:x}),w&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),w]}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(mCe,{data:t,onChange:r})}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsxs("details",{className:"group",children:[d.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[d.jsx(Ah,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced — Reconnect & Packet Tuning"]}),d.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[d.jsx(qt,{label:"Auto-reconnect",checked:t.reconnect??!0,onChange:W=>r({...t,reconnect:W}),helper:"Automatically reconnect if the mesh link drops"}),d.jsx(Ae,{label:"Reconnect Initial Delay (s)",value:t.reconnect_initial_delay??2,onChange:W=>r({...t,reconnect_initial_delay:W}),min:0,step:.5,helper:"Backoff delay before the first reconnect attempt"}),d.jsx(Ae,{label:"Reconnect Max Delay (s)",value:t.reconnect_max_delay??60,onChange:W=>r({...t,reconnect_max_delay:W}),min:0,helper:"Ceiling for exponential reconnect backoff"}),d.jsx(Ae,{label:"Reconnect Health Interval (s)",value:t.reconnect_health_interval??30,onChange:W=>r({...t,reconnect_health_interval:W}),min:1,helper:"How often the socket-probe watchdog checks link health"}),d.jsx(Ae,{label:"Mesh Max Chars",value:t.mesh_max_chars??140,onChange:W=>r({...t,mesh_max_chars:W}),min:1,helper:"Per-packet character budget for the transport"})]})]})}),i&&u&&d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Bot behavior"}),d.jsx(qt,{label:"Enable Passive Context",checked:!!i.enabled,onChange:W=>o({...i,enabled:W}),helper:"Listen to channel traffic for context",info:"When enabled, the bot monitors mesh channels and includes recent messages in its context. This lets the bot reference things other people said on the channel."}),d.jsx(DP,{label:"Observe Channels",value:i.observe_channels??[],onChange:W=>o({...i,observe_channels:W}),helper:"Channels to monitor (empty = all)",info:"Meshtastic channels to listen on. Leave empty to monitor all channels.",mode:"multi"}),d.jsx(PP,{label:"Ignore Nodes",value:i.ignore_nodes??[],onChange:W=>o({...i,ignore_nodes:W}),helper:"Nodes to exclude from context",info:"Messages from these nodes won't be included in passive context. Useful for filtering out noisy automated nodes."}),d.jsx(qt,{label:"Answer direct messages",checked:!!u.respond_to_dms,onChange:W=>c({...u,respond_to_dms:W}),helper:"When on, MeshAI replies to Meshtastic direct messages using the LLM. Applies to Meshtastic only."})]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Send Test Message"}),d.jsx(Ae,{label:"Channel Index",value:A,onChange:I,min:0,max:7,helper:"Meshtastic channel number (0 = primary)"}),d.jsx(yt,{label:"Message (optional)",value:k,onChange:P,placeholder:`🧪 MeshAI test — ${new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}),d.jsx("button",{onClick:H,disabled:D,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white text-sm transition-colors",children:D?"Sending...":"Send test"}),j&&(j.sent?d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),j.detail]}):d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:j.detail}))]})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load connection config"})})}function zZ(){const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(null),[u,c]=E.useState(!0),[h,f]=E.useState(!1),[v,g]=E.useState(null),[m,y]=E.useState(null),[x,_]=E.useState(!1),w=E.useCallback(async()=>{c(!0);try{const[M,A]=await Promise.all([Ao("meshmonitor"),Ao("mesh_sources")]);r(M),a(JSON.parse(JSON.stringify(M))),o(A),l(JSON.parse(JSON.stringify(A))),_(!1),g(null)}catch(M){g(M instanceof Error?M.message:"Unknown error")}finally{c(!1)}},[]);E.useEffect(()=>{document.title="Meshtastic Sources - MeshAI",w()},[w]),E.useEffect(()=>{if(t&&n&&i&&s){const M=JSON.stringify(t)!==JSON.stringify(n),A=JSON.stringify(i)!==JSON.stringify(s);_(M||A)}},[t,n,i,s]),E.useEffect(()=>(e(x),()=>e(!1)),[x,e]);const S=async()=>{if(!(!t||!i)){f(!0),g(null),y(null);try{const[M,A]=await Promise.all([Da("meshmonitor",t),Da("mesh_sources",i)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),_(!1),e(!1),y("Meshtastic sources saved successfully"),(M.restart_required||A.restart_required)&&bu([]),setTimeout(()=>y(null),3e3)}catch(M){g(M instanceof Error?M.message:"Save failed")}finally{f(!1)}}},C=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),_(!1)};return u?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading Meshtastic sources..."})}):!t||!i?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load sources config"})}):d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"MeshMonitor integration and mesh awareness data sources."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:w,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:C,disabled:!x,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:S,disabled:h||!x,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[d.jsx(_a,{size:16}),h?"Saving...":"Save"]})]})]}),v&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:v}),m&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),m]}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(TCe,{data:t,onChange:r})}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(NCe,{data:i,onChange:o})})]})}const g2e=[{key:"gauge-sites",label:"Gauge Sites"},{key:"town-anchors",label:"Town Anchors"}];function m2e(){const[e,t]=E.useState("gauge-sites");return E.useEffect(()=>{document.title="Places - MeshAI"},[]),d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-1 border-b border-border",children:g2e.map(({key:r,label:n})=>d.jsx("button",{onClick:()=>t(r),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===r?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:n},r))}),e==="gauge-sites"&&d.jsx(EZ,{}),e==="town-anchors"&&d.jsx(RZ,{})]})}const y2e=[{key:"nodes",label:"Nodes"},{key:"sources",label:"Sources"},{key:"health",label:"Health"}];function x2e(){const[e,t]=E.useState("nodes"),{setDirty:r}=$i(),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(!1),[u,c]=E.useState(!1),[h,f]=E.useState(null),[v,g]=E.useState(null),[m,y]=E.useState(!1);E.useEffect(()=>{document.title="Nodes & Health - MeshAI"},[]);const x=E.useCallback(async()=>{l(!0),f(null);try{const S=await Ao("mesh_intelligence");a(S),o(JSON.parse(JSON.stringify(S))),y(!1)}catch(S){f(S instanceof Error?S.message:"Failed to load mesh intelligence config")}finally{l(!1)}},[]);E.useEffect(()=>{e==="health"&&n===null&&!s&&x()},[e,n,s,x]),E.useEffect(()=>{n&&i&&y(JSON.stringify(n)!==JSON.stringify(i))},[n,i]),E.useEffect(()=>(r(m),()=>r(!1)),[m,r]);const _=async()=>{if(n){c(!0),f(null),g(null);try{const S=await Da("mesh_intelligence",n);o(JSON.parse(JSON.stringify(n))),y(!1),r(!1),g("Mesh intelligence saved successfully"),S.restart_required&&bu([]),setTimeout(()=>g(null),3e3)}catch(S){f(S instanceof Error?S.message:"Save failed")}finally{c(!1)}}},w=()=>{i&&a(JSON.parse(JSON.stringify(i))),y(!1)};return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-1 border-b border-border",children:y2e.map(({key:S,label:C})=>d.jsx("button",{onClick:()=>t(S),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===S?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:C},S))}),e==="nodes"&&d.jsx(MZ,{}),e==="sources"&&d.jsx(zZ,{}),e==="health"&&d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"Mesh health scoring, region management, and automated alerting."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:x,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:w,disabled:!m,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:_,disabled:u||!m,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[d.jsx(_a,{size:16}),u?"Saving...":"Save"]})]})]}),h&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:h}),v&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),v]}),s?d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-slate-400",children:"Loading..."})}):n?d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(NZ,{data:n,onChange:a})}):d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-red-400",children:"Failed to load config"})})]})]})}const _2e=15e3,Np=5,BZ=14,b2e=BZ*86400;function rT(e){return e.last_advert==null||e.last_advert<=0?!1:Math.floor(Date.now()/1e3)-e.last_advert>b2e}const w2e={room_not_found:"no room server with this key is on the companion",channel_not_found:"this channel is not on the companion",not_a_room:"this key belongs to a contact that is not a room server"};function QB(e){if(e==null)return"—";const t=Math.floor(Date.now()/1e3-e);if(t<0)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function S2e(e){if(!e)return"—";const t=Date.parse(e);if(Number.isNaN(t))return"—";const r=Math.floor((Date.now()-t)/1e3);if(r<5)return"just now";if(r<60)return`${r}s ago`;const n=Math.floor(r/60);if(n<60)return`${n}m ago`;const a=Math.floor(n/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}const C2e={1:{label:"Chat",className:"bg-sky-500/15 text-sky-400"},2:{label:"Repeater",className:"bg-amber-500/15 text-amber-400"},3:{label:"Room",className:"bg-violet-500/15 text-violet-400"},4:{label:"Sensor",className:"bg-emerald-500/15 text-emerald-400"}};function T2e({type:e}){const t=e!=null&&C2e[e]||{label:"Unknown",className:"bg-slate-600/30 text-slate-400"};return d.jsx("span",{className:`px-2 py-0.5 text-[10px] uppercase tracking-wide rounded ${t.className}`,children:t.label})}function eF(e){return e.name?e.name:e.pubkey?`${e.pubkey.slice(0,12)}…`:"unnamed"}function nT(e){return e.pubkey||e.name||""}function aT(e){return e.length>12?`${e.slice(0,12)}…`:e}function M2e(e){return e.lat!=null&&e.lon!=null?`${e.lat.toFixed(4)}, ${e.lon.toFixed(4)}`:"—"}const A2e=[{key:"battery_pct",label:"Battery",unit:"%",digits:0},{key:"voltage",label:"Voltage",unit:"V",digits:2},{key:"temperature",label:"Temp",unit:"°C",digits:1},{key:"humidity",label:"Humidity",unit:"%",digits:0},{key:"current",label:"Current",unit:"A",digits:2},{key:"illuminance",label:"Light",unit:"lx",digits:0},{key:"barometer",label:"Pressure",unit:"hPa",digits:1},{key:"power",label:"Power",unit:"W",digits:1},{key:"altitude",label:"Alt",unit:"m",digits:0},{key:"distance",label:"Dist",unit:"m",digits:0}];function N2e({data:e,polledLabel:t}){const r=A2e.flatMap(n=>{const a=e[n.key];return typeof a!="number"||Number.isNaN(a)?[]:[d.jsxs("span",{className:"px-2 py-0.5 text-xs rounded bg-[#0a0e17] border border-[#1e2a3a] text-slate-200",children:[d.jsx("span",{className:"text-[#777]",children:n.label})," ",a.toFixed(n.digits),n.unit]},n.key)]});return d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.length>0?r:d.jsx("span",{className:"text-xs text-[#777]",children:"Telemetry received (no standard sensor fields)"}),d.jsxs("span",{className:"text-[11px] text-[#777] ml-1",children:["polled ",t]})]})}function k2e(){const[e,t]=E.useState(null),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState(null),[l,u]=E.useState(null),[c,h]=E.useState(null),[f,v]=E.useState(!1),[g,m]=E.useState(null),[y,x]=E.useState(null),[_,w]=E.useState(null),[S,C]=E.useState(!1),[M,A]=E.useState(""),[I,k]=E.useState(""),[P,D]=E.useState(1),[z,j]=E.useState(!1),[B,H]=E.useState(null),[V,U]=E.useState(null),[F,W]=E.useState(null),[$,Z]=E.useState(null),[J,re]=E.useState(""),[Q,le]=E.useState("all"),[de,He]=E.useState("name"),[ye,ne]=E.useState(!0),[xe,he]=E.useState(null),[ge,tt]=E.useState(null),[Ue,qe]=E.useState(null),[Fe,_t]=E.useState({}),[bt,et]=E.useState(null),[Ke,St]=E.useState(30),[ce,st]=E.useState(!1),[Bt,Ft]=E.useState(!1);E.useEffect(()=>{document.title="MeshCore Contacts - MeshAI"},[]),E.useEffect(()=>{let ue=!1;return(async()=>{n(!0),i(null);try{const Xe=await Gj();ue||(t(Xe),w(Xe.last_synced_at??null))}catch(Xe){ue||i(Xe instanceof Error?Xe.message:"Failed to load contacts")}finally{ue||n(!1)}})(),()=>{ue=!0}},[]);const jt=E.useCallback(async()=>{try{const ue=await XJ();h(ue)}catch{}},[]);E.useEffect(()=>{jt()},[jt]),E.useEffect(()=>{let ue=!1;return(async()=>{try{const Xe=await KJ();if(ue)return;s(Xe);const lt=Xe.meshcore_telemetry_interval_seconds;typeof lt=="number"&<>0&&St(Math.max(Np,Math.round(lt/60)))}catch{}})(),()=>{ue=!0}},[]),E.useEffect(()=>{let ue=!1;const Xe=async()=>{try{const Pt=await JJ();ue||u(Pt)}catch{}};Xe();const lt=setInterval(Xe,_2e);return()=>{ue=!0,clearInterval(lt)}},[]);const Lr=(o==null?void 0:o.meshcore_telemetry_contacts)??[],Qo=E.useCallback(ue=>((l==null?void 0:l.entries)??[]).find(lt=>lt.contact===ue.pubkey||ue.name!=null&<.contact===ue.name),[l]),tl=E.useCallback(ue=>Lr.includes(ue.pubkey)||ue.name!=null&&Lr.includes(ue.name),[Lr]),Ki=E.useCallback(async(ue,Xe)=>{if(!o)return;const lt=nT(ue);if(!lt)return;et(null),he(lt);const Pt=o.meshcore_telemetry_contacts??[];let fr;Xe?fr=Pt.includes(lt)?Pt:[...Pt,lt]:fr=Pt.filter(Ct=>Ct!==ue.pubkey&&Ct!==ue.name);const Tn={...o,meshcore_telemetry_contacts:fr};try{await Da("connection",Tn),s(Tn),tt(lt),setTimeout(()=>tt(Ct=>Ct===lt?null:Ct),1500)}catch(Ct){et(Ct instanceof Error?Ct.message:"Failed to save")}finally{he(Ct=>Ct===lt?null:Ct)}},[o]),Uh=E.useCallback(async ue=>{const Xe=nT(ue);if(Xe){qe(Xe);try{const lt=await QJ(Xe);_t(Pt=>({...Pt,[Xe]:lt}))}catch(lt){_t(Pt=>({...Pt,[Xe]:{available:!1,contact:Xe,detail:lt instanceof Error?lt.message:"Poll failed"}}))}finally{qe(lt=>lt===Xe?null:lt)}}},[]),Gn=E.useCallback(async()=>{v(!0),m(null),x(null),et(null);try{const ue=await $J();t({active:ue.active,contacts:ue.contacts}),w(ue.last_synced_at),m(ue.stats),x(ue.channel_stats),jt()}catch(ue){et(ue instanceof Error?ue.message:"Resync failed")}finally{v(!1)}},[jt]),es=E.useCallback(async()=>{var lt;const ue=I.trim().toLowerCase(),Xe=M.trim();if(!/^[0-9a-f]{64}$/.test(ue)){H("Pubkey must be exactly 64 hex characters (the full key, not a prefix)");return}if(!Xe){H("A name is required");return}j(!0),H(null);try{const Pt=await ZJ([{pubkey:ue,name:Xe,type:P,flags:0,out_path_len:-1,out_path:"",last_advert:0}]);if(Pt.failed>0){H(((lt=Pt.errors[0])==null?void 0:lt.detail)||"Add failed");return}C(!1),A(""),k("");const fr=await Gj();t(fr),w(fr.last_synced_at??null),jt()}catch(Pt){H(Pt instanceof Error?Pt.message:"Add failed")}finally{j(!1)}},[I,M,P,jt]),ts=E.useCallback(()=>{window.location.href="/api/meshcore/contacts/export"},[]),Au=E.useCallback(async ue=>{W(ue.pubkey),et(null);try{const Xe=await YJ(ue.pubkey);t(lt=>({active:!0,contacts:Xe.contacts,last_synced_at:(lt==null?void 0:lt.last_synced_at)??null})),U(null),jt()}catch(Xe){et(Xe instanceof Error?Xe.message:"Delete failed")}finally{W(Xe=>Xe===ue.pubkey?null:Xe)}},[jt]),Wh=E.useCallback(async ue=>{try{await navigator.clipboard.writeText(ue)}catch{}},[]),Va=E.useCallback(ue=>{He(Xe=>Xe===ue?(ne(lt=>!lt),Xe):(ne(!0),ue))},[]),$h=E.useMemo(()=>{const ue=new Set;for(const Xe of(c==null?void 0:c.collisions)??[])ue.add(Xe.name);return ue},[c]),Nu=E.useMemo(()=>{let ue=(e==null?void 0:e.contacts)??[];const Xe=J.trim().toLowerCase();return Xe&&(ue=ue.filter(Pt=>(Pt.name??"").toLowerCase().includes(Xe)||Pt.pubkey.toLowerCase().includes(Xe))),Q==="rooms"?ue=ue.filter(Pt=>Pt.type===3):Q==="stale"&&(ue=ue.filter(rT)),[...ue].sort((Pt,fr)=>{let Tn=0;return de==="name"?Tn=(Pt.name??"").localeCompare(fr.name??""):de==="type"?Tn=(Pt.type??0)-(fr.type??0):Tn=(Pt.last_advert??0)-(fr.last_advert??0),ye?Tn:-Tn})},[e,J,Q,de,ye]),ku=E.useMemo(()=>((e==null?void 0:e.contacts)??[]).filter(rT).length,[e]),rl=E.useMemo(()=>((e==null?void 0:e.contacts)??[]).filter(ue=>ue.type===3).length,[e]),Lu=E.useCallback(async()=>{if(!o)return;const ue=Math.max(Np,Math.round(Ke)||Np),Xe={...o,meshcore_telemetry_interval_seconds:ue*60};st(!0),Ft(!1),et(null);try{await Da("connection",Xe),s(Xe),St(ue),Ft(!0),setTimeout(()=>Ft(!1),2e3)}catch(lt){et(lt instanceof Error?lt.message:"Failed to save interval")}finally{st(!1)}},[o,Ke]),Iu=(e==null?void 0:e.active)!==!1,rs=(c==null?void 0:c.dangling)??[],ns=(c==null?void 0:c.collisions)??[];return d.jsxs("div",{className:"max-w-5xl mx-auto space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:d.jsx(UV,{size:24,className:"text-accent"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"MeshCore Contacts"}),d.jsx("p",{className:"text-sm text-[#777]",children:"The companion's known contact roster — names, types, last-heard times, and telemetry auto-poll."})]})]}),rs.length>0&&d.jsx("div",{className:"border border-red-500/40 bg-red-500/10 p-4 space-y-2",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(vi,{size:18,className:"text-red-400 flex-shrink-0 mt-0.5"}),d.jsxs("div",{className:"space-y-2 min-w-0",children:[d.jsxs("h3",{className:"text-sm font-semibold text-red-300",children:[rs.length," routing ",rs.length===1?"cell points":"cells point"," at a destination that no longer exists"]}),d.jsx("p",{className:"text-xs text-red-300/70 max-w-prose",children:"These cells cannot be delivered — a send to a missing room or channel fails silently. Fix the target on the Routing page, or resync if the roster is stale."}),d.jsx("ul",{className:"space-y-1",children:rs.map(ue=>d.jsxs("li",{className:"text-xs text-slate-200 flex flex-wrap items-center gap-x-2 gap-y-1",children:[d.jsx("span",{className:"px-1.5 py-0.5 rounded bg-red-500/20 text-red-300 uppercase tracking-wide text-[10px]",children:ue.family}),d.jsx("span",{className:"text-slate-300",children:ue.region}),d.jsx("span",{className:"text-[#777]",children:"→"}),d.jsx("span",{className:"font-mono text-[11px] text-red-300 break-all",children:ue.target}),d.jsxs("span",{className:"text-[#777]",children:["— ",w2e[ue.reason]??ue.reason]}),!ue.enabled&&d.jsx("span",{className:"px-1.5 py-0.5 rounded bg-slate-600/30 text-slate-400 text-[10px] uppercase tracking-wide",children:"disabled"})]},`${ue.family}-${ue.region}-${ue.target}`))})]})]})}),ns.length>0&&d.jsx("div",{className:"border border-amber-500/40 bg-amber-500/10 p-4",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(vi,{size:18,className:"text-amber-400 flex-shrink-0 mt-0.5"}),d.jsxs("div",{className:"space-y-2 min-w-0",children:[d.jsxs("h3",{className:"text-sm font-semibold text-amber-300",children:[ns.length," duplicated ",ns.length===1?"name":"names"," on the roster"]}),d.jsx("p",{className:"text-xs text-amber-300/70 max-w-prose",children:"These names each map to more than one public key. A name alone cannot identify them — always confirm the key before routing to or deleting one."}),d.jsx("ul",{className:"space-y-1",children:ns.map(ue=>d.jsxs("li",{className:"text-xs text-slate-200",children:[d.jsx("span",{className:"text-slate-100",children:ue.name})," ",d.jsxs("span",{className:"text-[#777]",children:["×",ue.count]}),d.jsx("span",{className:"ml-2 font-mono text-[11px] text-amber-300/80",children:ue.contacts.map(Xe=>aT(Xe.pubkey)).join(" · ")})]},ue.name))})]})]})}),Iu&&d.jsxs("div",{className:"bg-bg-card border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[d.jsxs("button",{onClick:Gn,disabled:f,className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",title:"Refetch the full roster from the companion and drop entries it no longer has",children:[d.jsx(Zi,{size:14,className:f?"animate-spin":void 0}),f?"Resyncing…":"Resync from node"]}),d.jsxs("button",{onClick:ts,className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded bg-[#0a0e17] border border-[#1e2a3a] text-slate-200 hover:border-accent/40",title:"Download the roster as JSON",children:[d.jsx(_J,{size:14}),"Export JSON"]}),d.jsxs("button",{onClick:()=>{C(ue=>!ue),H(null)},className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded bg-[#0a0e17] border border-[#1e2a3a] text-slate-200 hover:border-accent/40",title:"Add a contact by public key",children:[d.jsx(si,{size:14}),"Add contact"]}),d.jsxs("span",{className:"text-xs text-[#777]",children:["Last synced ",_!=null?QB(_):"unknown"]}),g&&d.jsxs("span",{className:"text-xs text-slate-300",children:[d.jsxs("span",{className:"text-emerald-400",children:["+",g.added," added"]})," · ",d.jsxs("span",{className:"text-red-400",children:["−",g.removed," removed"]})," · ",d.jsxs("span",{className:"text-[#777]",children:[g.updated," updated"]})," · ",d.jsxs("span",{className:"text-[#777]",children:[g.after," total"]}),y&&d.jsxs("span",{className:"text-[#777]",children:[" · ","channels ",y.after,y.added.length>0&&d.jsxs("span",{className:"text-emerald-400",children:[" +",y.added.length]}),y.removed.length>0&&d.jsxs("span",{className:"text-red-400",children:[" −",y.removed.length]})]})]})]}),S&&d.jsxs("div",{className:"border border-[#1e2a3a] bg-[#0a0e17] p-3 space-y-2",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("input",{value:M,onChange:ue=>A(ue.target.value),placeholder:"Name",className:"w-40 px-2 py-1 text-sm bg-bg-card border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]"}),d.jsx("input",{value:I,onChange:ue=>k(ue.target.value),placeholder:"Full 64-character hex public key",className:"flex-1 min-w-[280px] px-2 py-1 text-sm font-mono bg-bg-card border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]"}),d.jsxs("select",{value:P,onChange:ue=>D(Number(ue.target.value)),className:"px-2 py-1 text-sm bg-bg-card border border-[#1e2a3a] rounded text-slate-200",children:[d.jsx("option",{value:1,children:"Chat"}),d.jsx("option",{value:2,children:"Repeater"}),d.jsx("option",{value:3,children:"Room"}),d.jsx("option",{value:4,children:"Sensor"})]}),d.jsx("button",{onClick:es,disabled:z,className:"px-3 py-1 text-sm rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",children:z?"Adding…":"Add"}),d.jsx("button",{onClick:()=>C(!1),className:"px-2 py-1 text-sm text-[#777] hover:text-slate-200",children:"Cancel"})]}),B&&d.jsx("p",{className:"text-xs text-red-400",children:B}),d.jsx("p",{className:"text-xs text-[#777] max-w-prose",children:"Writes the contact straight to the companion — nothing is transmitted. Use this when a node has been rebuilt with a new keypair, or is not yet in range to advert."})]}),d.jsx("p",{className:"text-xs text-[#777] max-w-prose",children:"The roster and channel list are a snapshot cached from the companion at connect. Resync re-reads both from the node and reconciles them — the only action that removes entries the companion has dropped, or picks up a channel added on the radio."})]}),Iu&&o&&d.jsxs("div",{className:"bg-bg-card border border-border p-4 space-y-2",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[d.jsx("label",{className:"text-sm text-slate-200",children:"Auto-poll every"}),d.jsx("input",{type:"number",min:Np,value:Ke,onChange:ue=>St(Number(ue.target.value)),className:"w-20 px-2 py-1 text-sm bg-[#0a0e17] border border-[#1e2a3a] rounded text-slate-100"}),d.jsx("span",{className:"text-sm text-slate-300",children:"minutes"}),d.jsx("button",{onClick:Lu,disabled:ce,className:"px-3 py-1 text-sm rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",children:ce?"Saving…":Bt?"Saved":"Save"})]}),d.jsxs("p",{className:"text-xs text-[#777] max-w-prose",children:["Polls only the nodes you select below. Keep this list small — telemetry uses mesh airtime. Minimum ",Np," minutes."]})]}),bt&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:bt}),r?d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-slate-400",children:"Loading..."})}):a?d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:a}):e&&e.active===!1?d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"The MeshCore companion is not connected. The contact roster is unavailable until the companion comes online."})}):e&&e.contacts.length===0?d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"No contacts yet. The companion is connected but has not discovered any nodes so far."})}):d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-4 py-3 border-b border-border",children:[d.jsx("input",{type:"search",value:J,onChange:ue=>re(ue.target.value),placeholder:"Search name or pubkey…",className:"flex-1 min-w-[180px] px-2 py-1 text-sm bg-[#0a0e17] border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]"}),d.jsx("div",{className:"flex gap-1",children:[{key:"all",label:`All ${(e==null?void 0:e.contacts.length)??0}`},{key:"rooms",label:`Rooms ${rl}`},{key:"stale",label:`Stale ${ku}`}].map(({key:ue,label:Xe})=>d.jsx("button",{onClick:()=>le(ue),className:`px-2.5 py-1 text-xs rounded border transition-colors ${Q===ue?"border-accent/40 bg-accent/15 text-accent":"border-[#1e2a3a] bg-[#0a0e17] text-[#777] hover:text-slate-200"}`,children:Xe},ue))})]}),d.jsxs("div",{className:"overflow-x-auto",children:[d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"border-b border-border text-left text-[11px] uppercase tracking-wide text-[#777]",children:[d.jsx("th",{className:"px-4 py-2.5 font-medium",children:d.jsxs("button",{onClick:()=>Va("name"),className:"hover:text-slate-200 uppercase",children:["Name",de==="name"?ye?" ▲":" ▼":""]})}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:d.jsxs("button",{onClick:()=>Va("type"),className:"hover:text-slate-200 uppercase",children:["Type",de==="type"?ye?" ▲":" ▼":""]})}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:d.jsxs("button",{onClick:()=>Va("last_advert"),className:"hover:text-slate-200 uppercase",children:["Last heard",de==="last_advert"?ye?" ▲":" ▼":""]})}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Position"}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Pubkey"}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Auto-poll"}),d.jsx("th",{className:"px-4 py-2.5 font-medium"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:Nu.map(ue=>{const Xe=nT(ue),lt=Qo(ue),Pt=tl(ue),fr=Fe[Xe],Tn=lt!=null&<.available===!1,Ct=xe===Xe||Tn&&!Pt;let as=null,Mn="",$e=!1;fr?fr.available&&fr.data?(as=fr.data,Mn="just now"):$e=!0:lt&&(lt.available&<.data?(as=lt.data,Mn=S2e(lt.polled_at)):$e=!0);const Zh=as!=null||$e;return d.jsxs(E.Fragment,{children:[d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-4 py-2.5 text-slate-100",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{children:eF(ue)}),ue.name!=null&&$h.has(ue.name)&&d.jsx("span",{className:"px-1.5 py-0.5 text-[10px] uppercase tracking-wide rounded bg-amber-500/15 text-amber-400",title:"Another contact advertises this same name with a different key — check the pubkey",children:"dup name"})]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsx(T2e,{type:ue.type})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-slate-300",children:QB(ue.last_advert)}),rT(ue)&&d.jsx("span",{className:"px-1.5 py-0.5 text-[10px] uppercase tracking-wide rounded bg-orange-500/15 text-orange-400",title:`Not heard from in over ${BZ} days`,children:"stale"})]})}),d.jsx("td",{className:"px-4 py-2.5 text-slate-300 font-mono text-xs",children:M2e(ue)}),d.jsx("td",{className:"px-4 py-2.5 text-slate-400 font-mono text-xs",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("button",{onClick:()=>Z(Ne=>Ne===ue.pubkey?null:ue.pubkey),className:"hover:text-accent",title:ue.pubkey,children:$===ue.pubkey?ue.pubkey:aT(ue.pubkey)}),d.jsx("button",{onClick:()=>Wh(ue.pubkey),className:"text-[#555] hover:text-accent flex-shrink-0",title:"Copy full pubkey",children:d.jsx(PV,{size:11})})]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsxs("label",{className:`inline-flex items-center gap-2 ${Ct?"opacity-50":"cursor-pointer"}`,title:Tn&&!Pt?"no telemetry available":void 0,children:[d.jsx("input",{type:"checkbox",checked:Pt,disabled:Ct,onChange:Ne=>Ki(ue,Ne.target.checked),className:"accent-accent"}),d.jsx("span",{className:"text-xs text-slate-300",children:xe===Xe?"saving…":ge===Xe?"saved":Tn&&!Pt?"no telemetry":"auto-poll"})]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[d.jsx("button",{onClick:()=>Uh(ue),disabled:Ue===Xe,className:"px-2 py-1 text-xs rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",children:Ue===Xe?"Polling…":"Poll now"}),V===ue.pubkey?d.jsxs(d.Fragment,{children:[d.jsx("button",{onClick:()=>Au(ue),disabled:F===ue.pubkey,className:"px-2 py-1 text-xs rounded bg-red-500/20 text-red-300 hover:bg-red-500/30 disabled:opacity-50",children:F===ue.pubkey?"Deleting…":"Confirm"}),d.jsx("button",{onClick:()=>U(null),className:"px-2 py-1 text-xs rounded text-[#777] hover:text-slate-200",children:"Cancel"})]}):d.jsx("button",{onClick:()=>U(ue.pubkey),className:"p-1 rounded text-[#555] hover:text-red-400 hover:bg-red-500/10",title:"Remove this contact from the companion",children:d.jsx(li,{size:13})})]})})]}),V===ue.pubkey&&d.jsx("tr",{className:"bg-red-500/5",children:d.jsx("td",{colSpan:7,className:"px-4 py-2 border-t border-red-500/20",children:d.jsxs("span",{className:"text-xs text-red-300",children:["Remove ",d.jsx("span",{className:"text-slate-100",children:eF(ue)})," ",d.jsx("span",{className:"font-mono text-[11px]",children:aT(ue.pubkey)})," ","from the companion? It will only return if the node advertises again."]})})}),Zh&&d.jsx("tr",{className:"bg-[#0a0e17]/40",children:d.jsx("td",{colSpan:7,className:"px-4 py-2 border-t border-border/50",children:as?d.jsx(N2e,{data:as,polledLabel:Mn}):d.jsxs("span",{className:"text-xs text-[#777]",children:["no telemetry",fr!=null&&fr.detail?` — ${fr.detail}`:""]})})})]},ue.pubkey)})})]}),Nu.length===0&&d.jsx("div",{className:"px-4 py-6 text-sm text-[#777]",children:"No contacts match this filter."})]})]})]})}const L2e=[{key:"contacts",label:"Contacts"},{key:"companion",label:"Companion"}];function I2e(){const[e,t]=E.useState("contacts");return E.useEffect(()=>{document.title="Contacts & Companion - MeshAI"},[]),d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-1 border-b border-border",children:L2e.map(({key:r,label:n})=>d.jsx("button",{onClick:()=>t(r),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===r?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:n},r))}),e==="contacts"&&d.jsx(k2e,{}),e==="companion"&&d.jsx(OZ,{})]})}function tF({family:e="meshtastic"}){const{setDirty:t}=$i(),[r,n]=E.useState(null),[a,i]=E.useState(null),[o,s]=E.useState(!0),[l,u]=E.useState(!1),[c,h]=E.useState(null),[f,v]=E.useState(null),[g,m]=E.useState(!1),y=E.useCallback(async()=>{s(!0),h(null);try{const S=await Ao("notifications");n(S),i(JSON.parse(JSON.stringify(S))),m(!1)}catch(S){h(S instanceof Error?S.message:"Failed to load config")}finally{s(!1)}},[]);E.useEffect(()=>{document.title="Scheduled Broadcasts - MeshAI",y()},[y]),E.useEffect(()=>{if(r&&a){const S=JSON.stringify(r)!==JSON.stringify(a);m(S)}},[r,a]),E.useEffect(()=>(t(g),()=>t(!1)),[g,t]);const x=async()=>{if(r){u(!0),h(null),v(null);try{const S=await Da("notifications",r);i(JSON.parse(JSON.stringify(r))),S.restart_required&&bu([]),m(!1),t(!1),v("Scheduled broadcasts saved successfully"),setTimeout(()=>v(null),3e3)}catch(S){h(S instanceof Error?S.message:"Save failed")}finally{u(!1)}}},_=()=>{a&&n(JSON.parse(JSON.stringify(a))),m(!1)},w=e==="meshcore"?"MeshCore scheduled broadcasts and band condition reports.":"Meshtastic scheduled broadcasts and band condition reports.";return o?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading scheduled broadcasts..."})}):r?d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:w})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:y,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:_,disabled:!g,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:x,disabled:l||!g,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[d.jsx(_a,{size:16}),l?"Saving...":"Save"]})]})]}),c&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:c}),f&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),f]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Cold-start grace"})}),d.jsx(qf,{label:"Grace period (seconds)",value:r.cold_start_grace_seconds??60,onChange:S=>n({...r,cold_start_grace_seconds:S}),min:0,max:600,helper:"Suppress broadcasts for this many seconds after the first event arrives",info:"When meshai starts seeing events for the first time, suppress mesh broadcasts for this many seconds to absorb any JetStream backlog. Persistence rows still get written; only broadcasts are suppressed."})]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Band Conditions (HF propagation)"})}),d.jsx(Ch,{label:"Enable scheduled band-conditions broadcasts",checked:r.band_conditions_enabled??!0,onChange:S=>n({...r,band_conditions_enabled:S}),helper:"3x/day HF propagation summary (Day/Night ratings per band group). See Reference -> Fire Tracker (Fusion) and Reference -> Broadcast Types for the New/Update/Active prefix system.",info:"Source priority: (1) recent SWPC readings persisted locally; (2) HamQSL.com fallback; (3) silent skip if both fail. Persistence rows are written either way for an audit trail."}),(r.band_conditions_enabled??!0)&&d.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[d.jsx(q2,{label:"Slot 1",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[0]||"06:00",onChange:S=>{const C=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];C[0]=S,n({...r,band_conditions_schedule:C})},helper:"Morning (default 06:00 MT)"}),d.jsx(q2,{label:"Slot 2",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[1]||"14:00",onChange:S=>{const C=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];C[1]=S,n({...r,band_conditions_schedule:C})},helper:"Afternoon (default 14:00 MT)"}),d.jsx(q2,{label:"Slot 3",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[2]||"22:00",onChange:S=>{const C=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];C[2]=S,n({...r,band_conditions_schedule:C})},helper:"Night (default 22:00 MT)"})]}),d.jsx("p",{className:"text-xs text-slate-600",children:"All times are Mountain Time (America/Boise). DST handled automatically."})]})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load config"})})}function P2e({info:e}){const[t,r]=E.useState(!1);return d.jsxs("div",{className:"relative inline-block",children:[d.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(!t)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),t&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),d.jsx("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:e})]})]})}function D2e({label:e,value:t,onChange:r,helper:n,info:a,keyPlaceholder:i="Key",valuePlaceholder:o="Value"}){const[s,l]=E.useState(()=>Object.entries(t||{}));E.useEffect(()=>{const c={};for(const[h,f]of s)h.trim()&&(c[h.trim()]=f);JSON.stringify(c)!==JSON.stringify(t||{})&&l(Object.entries(t||{}))},[t]);const u=c=>{l(c),r(Object.fromEntries(c.filter(([h])=>h.trim())))};return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(P2e,{info:a})]}),s.map(([c,h],f)=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("input",{type:"text",value:c,onChange:v=>u(s.map((g,m)=>m===f?[v.target.value,g[1]]:g)),placeholder:i,className:"w-40 flex-shrink-0 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),d.jsx("input",{type:"text",value:h,onChange:v=>u(s.map((g,m)=>m===f?[g[0],v.target.value]:g)),placeholder:o,className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"}),d.jsx("button",{type:"button",onClick:()=>u(s.filter((v,g)=>g!==f)),className:"p-2 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded flex-shrink-0","aria-label":"Remove header",children:d.jsx(li,{size:14})})]},f)),d.jsxs("button",{type:"button",onClick:()=>u([...s,["",""]]),className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[d.jsx(si,{size:16})," Add Header"]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}const j2e=["CLIENT_BASE","ROUTER","ROUTER_LATE"],E2e=[{value:"mesh_dm",label:"Mesh DM (unicast to nodes)"},{value:"mesh_broadcast",label:"Mesh Broadcast (channel)"},{value:"email",label:"Email"},{value:"webhook",label:"Webhook"},{value:"none",label:"(None / log only)"}],R2e=[{key:"fire",label:"Fire",description:"Active wildfires (radius from fire perimeter).",Icon:Rm,showAcres:!0},{key:"weather",label:"Weather",description:"Severe weather warnings near a node.",Icon:kh},{key:"snow",label:"Snow (sub-gate of Weather)",description:"Snow-category weather events.",Icon:VV},{key:"flood",label:"Flood (sub-gate of Seismic)",description:"Stream/flood gauge events.",Icon:Oo},{key:"avalanche",label:"Avalanche",description:"Avalanche advisories near a node.",Icon:kf},{key:"seismic",label:"Seismic",description:"Earthquakes and seismic events near a node.",Icon:kf}];function Pd(){return{enabled:!1,buffer_mi:5,min_acres:0}}function rF(){return{enabled:!1,dry_run:!0,monitor_roles:["ROUTER","ROUTER_LATE","CLIENT_BASE"],default_buffer_mi:5,cooldown_minutes:360,fire:Pd(),weather:Pd(),snow:Pd(),flood:Pd(),avalanche:Pd(),seismic:Pd(),delivery_type:"mesh_dm",node_ids:[],broadcast_channel:null,webhook_url:"",webhook_headers:{}}}function O2e({label:e,value:t,onChange:r,options:n,info:a=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Yo,{info:a})]}),d.jsx("select",{value:t,onChange:i=>r(i.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:n.map(i=>d.jsx("option",{value:i.value,children:i.label},i.value))})]})}function z2e({meta:e,cfg:t,onChange:r}){const{Icon:n}=e;return d.jsxs("div",{className:`border border-[#1e2a3a] p-3 space-y-2 ${e.tabled?"opacity-50":""}`,children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-start gap-2 flex-1",children:[d.jsx(n,{size:15,className:"text-slate-400 mt-0.5 flex-shrink-0"}),d.jsxs("div",{className:"flex-1",children:[d.jsx("span",{className:"text-sm text-slate-300",children:e.label}),d.jsx("p",{className:"text-xs text-slate-600",children:e.description}),e.tabled&&d.jsx("span",{className:"inline-block mt-1 px-2 py-0.5 text-[10px] uppercase tracking-wide rounded bg-slate-700 text-slate-300",children:"Tabled — needs snowfall + elevation pipeline"})]})]}),d.jsx("button",{type:"button",disabled:e.tabled,onClick:()=>{e.tabled||r({...t,enabled:!t.enabled})},className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${t.enabled?"bg-accent":"bg-[#1e2a3a]"} ${e.tabled?"cursor-not-allowed":""}`,children:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t.enabled?"translate-x-5":""}`})})]}),t.enabled&&!e.tabled&&d.jsxs("div",{className:`grid gap-3 pt-2 border-t border-[#1e2a3a] ${e.showAcres?"grid-cols-2":"grid-cols-1"}`,children:[d.jsx(qf,{label:"Buffer (mi)",value:t.buffer_mi??0,onChange:a=>r({...t,buffer_mi:a}),min:0,step:.5}),e.showAcres&&d.jsx(qf,{label:"Min Acres",value:t.min_acres??0,onChange:a=>r({...t,min_acres:a}),min:0,step:1})]})]})}function B2e(){const[e,t]=E.useState(!1),[r,n]=E.useState(null),[a,i]=E.useState(!0),[o,s]=E.useState(!1),[l,u]=E.useState(null),[c,h]=E.useState(null),f=E.useCallback(async()=>{i(!0),u(null);try{const y=await Ao("danger_zones"),x=rF();n({...x,...y,fire:{...x.fire,...y.fire||{}},weather:{...x.weather,...y.weather||{}},snow:{...x.snow,...y.snow||{}},flood:{...x.flood,...y.flood||{}},avalanche:{...x.avalanche,...y.avalanche||{}},seismic:{...x.seismic,...y.seismic||{}},monitor_roles:y.monitor_roles??x.monitor_roles,node_ids:y.node_ids??x.node_ids,webhook_headers:y.webhook_headers??x.webhook_headers})}catch(y){u(y instanceof Error?y.message:"Failed to load danger zones config"),n(rF())}finally{i(!1)}},[]);E.useEffect(()=>{f()},[f]);const v=async()=>{if(r){s(!0),u(null),h(null);try{await Da("danger_zones",r),h("Danger Zones config saved"),setTimeout(()=>h(null),3e3)}catch(y){u(y instanceof Error?y.message:"Save failed")}finally{s(!1)}}},g=y=>n(x=>x&&{...x,...y}),m=y=>{if(!r)return;const x=r.monitor_roles||[];g({monitor_roles:x.includes(y)?x.filter(_=>_!==y):[...x,y]})};return d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("button",{type:"button",onClick:()=>t(y=>!y),className:"w-full flex items-center justify-between p-4 text-left",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(vi,{size:18,className:"text-amber-400"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-sm font-medium text-slate-200",children:"Danger Zones"}),d.jsx("div",{className:"text-xs text-slate-500",children:"Alert when monitored infrastructure nodes are in/near a hazard"})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[r&&d.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${r.enabled?r.dry_run?"bg-yellow-500/10 text-yellow-400":"bg-green-500/10 text-green-400":"bg-slate-800 text-slate-500"}`,children:r.enabled?r.dry_run?"Dry-run":"Live":"Disabled"}),e?d.jsx(Em,{size:18,className:"text-slate-500"}):d.jsx(Ah,{size:18,className:"text-slate-500"})]})]}),e&&d.jsxs("div",{className:"p-6 pt-0 space-y-6",children:[d.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-500/10 border border-amber-500/20",children:[d.jsx(Nh,{size:16,className:"text-amber-400 mt-0.5 flex-shrink-0"}),d.jsxs("div",{className:"text-xs text-amber-200/90 leading-relaxed",children:["Ships disabled; when enabled, defaults to dry-run / log-only — no mesh traffic until you turn dry-run off. Requires ",d.jsx("span",{className:"font-medium",children:"Enable Notifications"})," (above) and environmental feeds to be on, since hazard events only flow when those are active."]})]}),l&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:l}),c&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),c]}),a||!r?d.jsx("div",{className:"text-sm text-slate-500",children:"Loading danger zones config..."}):d.jsxs(d.Fragment,{children:[d.jsx(Ch,{label:"Enable Danger Zones",checked:r.enabled,onChange:y=>g({enabled:y}),helper:"Master switch for the infrastructure danger-zone correlator"}),d.jsx(Ch,{label:"Dry-run (log only)",checked:r.dry_run,onChange:y=>g({dry_run:y}),helper:"When on, matches are logged but nothing is sent to the mesh. Turn off only after verifying dry-run output."}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Monitored Roles",d.jsx(Yo,{info:"Which Meshtastic node roles to correlate against hazards. Only nodes that have a GPS position are scanned."})]}),d.jsx("div",{className:"flex flex-wrap gap-2",children:j2e.map(y=>{const x=(r.monitor_roles||[]).includes(y);return d.jsx("button",{type:"button",onClick:()=>m(y),className:`px-3 py-1.5 rounded text-sm transition-colors ${x?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:y},y)})})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(qf,{label:"Default Buffer (mi)",value:r.default_buffer_mi,onChange:y=>g({default_buffer_mi:y}),min:0,step:.5,helper:"Buffer used when a family has none set"}),d.jsx(qf,{label:"Cooldown (min)",value:r.cooldown_minutes,onChange:y=>g({cooldown_minutes:y}),min:0,helper:"Min time between repeat alerts per node+family"})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Hazard Families",d.jsx(Yo,{info:"Enable each hazard family to monitor, with its own buffer distance and severity threshold. Snow is a sub-gate of Weather; Flood a sub-gate of Seismic."})]}),R2e.map(y=>d.jsx(z2e,{meta:y,cfg:r[y.key],onChange:x=>g({[y.key]:x})},y.key))]}),d.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[d.jsx(BV,{size:14}),"DELIVERY"]}),d.jsx(O2e,{label:"Delivery Method",value:r.delivery_type||"mesh_dm",onChange:y=>g({delivery_type:y}),options:E2e,info:"Where danger-zone alerts get delivered. Mesh DM unicasts to specific nodes; broadcast sends to a channel. Has no effect while dry-run is on."}),r.delivery_type==="mesh_dm"&&d.jsx(PP,{label:"Recipient Nodes",value:r.node_ids||[],onChange:y=>g({node_ids:y}),helper:"Nodes that receive direct messages",valueType:"node_id_hex"}),r.delivery_type==="mesh_broadcast"&&d.jsx(DP,{label:"Broadcast Channel",value:r.broadcast_channel??0,onChange:y=>g({broadcast_channel:y}),helper:"Select the mesh radio channel",mode:"single"}),r.delivery_type==="webhook"&&d.jsxs(d.Fragment,{children:[d.jsx(ECe,{label:"Webhook URL",value:r.webhook_url||"",onChange:y=>g({webhook_url:y}),placeholder:"https://discord.com/api/webhooks/...",helper:"POST alert as JSON"}),d.jsx(D2e,{label:"Webhook Headers",value:r.webhook_headers||{},onChange:y=>g({webhook_headers:y}),helper:"Custom HTTP headers sent with the danger-zone webhook",keyPlaceholder:"Header",valuePlaceholder:"Value"})]}),r.delivery_type==="email"&&d.jsx("p",{className:"text-xs text-slate-600",children:"Email delivery uses the SMTP settings configured for notification rules."})]}),d.jsx("div",{className:"flex justify-end",children:d.jsxs("button",{type:"button",onClick:v,disabled:o,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[d.jsx(_a,{size:16}),o?"Saving...":"Save Danger Zones"]})})]})]})]})}function F2e(){return E.useEffect(()=>{document.title="Danger Zones - MeshAI"},[]),d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsx("p",{className:"text-sm text-slate-500",children:"Alert infrastructure nodes when they are within a configurable buffer distance of an active hazard."}),d.jsx(B2e,{})]})}function V2e(){return E.useEffect(()=>{document.title="Danger Zones - MeshAI"},[]),d.jsx("div",{className:"max-w-3xl mx-auto",children:d.jsx("div",{className:"bg-bg-card border border-border p-8",children:d.jsxs("div",{className:"flex items-start gap-4",children:[d.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:d.jsx(vi,{size:24,className:"text-accent"})}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"MeshCore Danger Zones"}),d.jsx("span",{className:"px-2 py-0.5 text-[10px] uppercase tracking-wide rounded bg-slate-700 text-slate-300",children:"Coming soon"})]}),d.jsx("p",{className:"text-sm text-slate-400 leading-relaxed max-w-prose",children:"MeshCore danger zone alerting will correlate infrastructure node positions with active hazards and deliver targeted DMs via the MeshCore companion. This becomes available once the MeshCore delivery pipeline supports infrastructure-targeted messaging."})]})]})})})}delete yw.Icon.Default.prototype._getIconUrl;yw.Icon.Default.mergeOptions({iconUrl:SZ,iconRetinaUrl:CZ,shadowUrl:TZ});const hx=e=>Math.round(e*1e6)/1e6,dx=["#f59e0b","#60a5fa","#34d399","#a78bfa","#f87171","#fb923c"],G2e=[{key:"fires",label:"NIFC Fire Perimeters"},{key:"nws",label:"NWS Weather Alerts"},{key:"wzdx",label:"WZDx Work Zones"},{key:"usgs_quake",label:"USGS Earthquakes"},{key:"firms",label:"NASA FIRMS Hotspots"},{key:"roads511",label:"511 Road Conditions"},{key:"usgs",label:"USGS Stream Gauges"},{key:"avalanche",label:"Avalanche Advisories"},{key:"traffic",label:"TomTom Traffic"},{key:"satpass",label:"Satellite Passes"},{key:"ducting",label:"Tropospheric Ducting"}];function H2e({bounds:e}){const t=IP(),r=E.useRef(!1);return E.useEffect(()=>{!r.current&&e&&(t.fitBounds(e,{padding:[40,40]}),r.current=!0)},[t,e]),null}function U2e({mode:e,firstCorner:t,onFirstClick:r,onSecondClick:n}){return HSe({click(a){const i=[a.latlng.lat,a.latlng.lng];e==="awaiting-first"?r(i):e==="awaiting-second"&&n(i)}}),t?d.jsx(_Z,{center:t,radius:6,pathOptions:{color:"#f59e0b",fillColor:"#f59e0b",fillOpacity:1}}):null}function W2e(){const[e,t]=E.useState(null),[r,n]=E.useState(""),[a,i]=E.useState(!0),[o,s]=E.useState(!1),[l,u]=E.useState(null),[c,h]=E.useState(null),{setDirty:f}=$i(),[v,g]=E.useState("idle"),[m,y]=E.useState(null);E.useEffect(()=>{document.title="Coverage — MeshAI",fetch("/api/config").then(j=>{if(!j.ok)throw new Error("Failed to fetch config");return j.json()}).then(j=>{const B=j.coverage??{bbox:[],enabled:!0,excluded_adapters:[],areas:[]};let H=Array.isArray(B.areas)?B.areas:[];if(H.length===0&&Array.isArray(B.bbox)&&B.bbox.length===4){const[U,F,W,$]=B.bbox;H=[{name:"Area 1",west:U,south:F,east:W,north:$}]}const V={bbox:Array.isArray(B.bbox)?B.bbox:[],enabled:B.enabled??!0,excluded_adapters:Array.isArray(B.excluded_adapters)?B.excluded_adapters:[],areas:H};t(V),n(JSON.stringify(V))}).catch(j=>u(j instanceof Error?j.message:String(j))).finally(()=>i(!1))},[]);const x=e!==null&&JSON.stringify(e)!==r;E.useEffect(()=>(f(x),()=>f(!1)),[x,f]);const _=(e==null?void 0:e.areas)??[],w=_.length>0?[[Math.min(..._.map(j=>j.south)),Math.min(..._.map(j=>j.west))],[Math.max(..._.map(j=>j.north)),Math.max(..._.map(j=>j.east))]]:null,S=[39.5,-98.35],C=E.useCallback(j=>{y(j),g("awaiting-second")},[]),M=E.useCallback(j=>{if(!m)return;const[B,H]=m,[V,U]=j;t(F=>{if(!F)return F;const W={name:`Area ${F.areas.length+1}`,west:hx(Math.min(H,U)),south:hx(Math.min(B,V)),east:hx(Math.max(H,U)),north:hx(Math.max(B,V))};return{...F,areas:[...F.areas,W]}}),y(null),g("idle")},[m]),A=(j,B,H)=>{t(V=>{if(!V)return V;const U=V.areas.map((F,W)=>{if(W!==j)return F;if(B==="name")return{...F,name:H};const $=parseFloat(H);return isNaN($)?F:{...F,[B]:$}});return{...V,areas:U}})},I=j=>{t(B=>B&&{...B,areas:B.areas.filter((H,V)=>V!==j)})},k=j=>{if(!e)return;const B=e.excluded_adapters??[];t({...e,excluded_adapters:B.includes(j)?B.filter(H=>H!==j):[...B,j]})},P=()=>{r&&(t(JSON.parse(r)),g("idle"),y(null))},D=async()=>{if(e){s(!0),u(null),h(null);try{const j=await fetch("/api/config/coverage",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({areas:e.areas,bbox:[],enabled:e.enabled,excluded_adapters:e.excluded_adapters})}),B=await j.json();if(!j.ok)throw new Error(B.detail||"Save failed");n(JSON.stringify(e)),h("Coverage saved"),setTimeout(()=>h(null),3e3),B.restart_required&&bu(Array.isArray(B.changed_keys)?B.changed_keys:[])}catch(j){u(j instanceof Error?j.message:"Save failed")}finally{s(!1)}}};if(a)return d.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading coverage config…"});if(!e)return d.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:l||"No config"});const z=v==="awaiting-first"?"Click the first corner of the new area on the map…":v==="awaiting-second"?"Click the opposite corner to complete the area…":_.length>0?`${_.length} area${_.length!==1?"s":""} defined`:"No areas defined — draw one on the map or enter coordinates below.";return d.jsxs("div",{className:"space-y-6 max-w-4xl",children:[d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("p",{className:"text-sm text-[#777]",children:[`Define one or more bounding boxes that scope every native adapter's geographic focus (set-union of all areas). Adapters with "Use own config" on ignore these areas and use the geographic settings on the`," ",d.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"})," ","page."]}),x&&d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{onClick:P,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:D,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",o?"Saving…":"Save"]})]})]}),l&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:l}),c&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:c}),d.jsxs("div",{className:"border border-border p-4 flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Use coverage areas to scope all adapters"}),d.jsx("p",{className:"text-xs text-[#666] mt-0.5",children:"When disabled, every adapter uses its own geographic config regardless of the areas below."})]}),d.jsx("button",{type:"button",onClick:()=>t({...e,enabled:!e.enabled}),className:`relative w-10 h-5 rounded-full transition-colors ${e.enabled?"bg-accent":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${e.enabled?"translate-x-5":""}`})})]}),d.jsxs("div",{className:"border border-border overflow-hidden",children:[d.jsxs("div",{className:"bg-bg-card border-b border-border px-4 py-2 flex items-center justify-between gap-4",children:[d.jsx("span",{className:"text-xs text-[#777] min-w-0 truncate font-mono",children:z}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[v!=="idle"&&d.jsx("button",{onClick:()=>{g("idle"),y(null)},className:"px-2 py-1 text-xs text-[#777] hover:text-white border border-border",children:"Cancel"}),d.jsxs("button",{onClick:()=>g("awaiting-first"),disabled:v!=="idle",className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[d.jsx(CJ,{size:12}),"Add area"]})]})]}),d.jsxs(bZ,{center:S,zoom:4,style:{width:"100%",height:"400px"},className:"z-0",children:[d.jsx(wZ,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),d.jsx(H2e,{bounds:w}),_.map((j,B)=>{const H=dx[B%dx.length],V=[[j.south,j.west],[j.north,j.east]];return d.jsx(ZSe,{bounds:V,pathOptions:{color:H,fillColor:H,fillOpacity:.08,weight:2}},B)}),d.jsx(U2e,{mode:v,firstCorner:m,onFirstClick:C,onSecondClick:M})]})]}),d.jsxs("div",{className:"border border-border p-4 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-xs font-sans font-medium uppercase tracking-widest text-[#666]",children:"Coverage Areas"}),d.jsxs("button",{onClick:()=>g("awaiting-first"),disabled:v!=="idle",className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[d.jsx(si,{size:12})," Add area"]})]}),_.length===0?d.jsx("p",{className:"text-xs text-[#555]",children:'No areas defined. Draw one on the map or click "Add area" to start.'}):d.jsx("div",{className:"space-y-3",children:_.map((j,B)=>{const H=dx[B%dx.length];return d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:H}}),d.jsx("input",{type:"text",value:j.name,onChange:V=>A(B,"name",V.target.value),className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1 text-sm font-medium text-[#e0e0e0]",placeholder:"Area name"}),d.jsx("button",{onClick:()=>I(B),title:"Delete area",className:"flex items-center gap-1 px-2 py-1 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(li,{size:12})})]}),d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["west","south","east","north"].map(V=>d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-[#777] mb-1 block capitalize",children:V}),d.jsx("input",{type:"number",step:"0.000001",value:j[V],onChange:U=>A(B,V,U.target.value),className:"w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono"})]},V))})]},B)})}),d.jsx("p",{className:"text-xs text-[#666]",children:"Decimal degrees. W/E = longitude; S/N = latitude. Each area is a bounding box; the coverage filter uses the set-union of all areas. Drawn coordinates are rounded to 6 decimal places."})]}),d.jsxs("div",{className:"border border-border p-4 space-y-4",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-sans font-medium uppercase tracking-widest text-[#666] mb-1",children:"Adapter Overrides"}),d.jsxs("p",{className:"text-xs text-[#777]",children:['Toggle "Use own config" to have that adapter ignore the coverage areas. Its geographic settings (state, bbox, corridors, observers…) then become active on the'," ",d.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"})," ","page."]})]}),d.jsx("div",{className:"divide-y divide-border",children:G2e.map(({key:j,label:B})=>{var V;const H=((V=e.excluded_adapters)==null?void 0:V.includes(j))??!1;return d.jsxs("div",{className:"flex items-center justify-between py-2.5",children:[d.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[d.jsx("span",{className:"text-sm text-[#e0e0e0]",children:B}),H?d.jsx("span",{className:"text-[10px] text-accent/70 uppercase tracking-wide",children:"own config"}):d.jsx("span",{className:"text-[10px] text-[#555] uppercase tracking-wide",children:"coverage areas"})]}),d.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[H&&d.jsx("a",{href:"/environment",className:"text-xs text-accent hover:underline",children:"Configure"}),d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[d.jsx("span",{className:"text-xs text-[#666] whitespace-nowrap",children:"Use own config"}),d.jsx("button",{type:"button",onClick:()=>k(j),className:`relative w-8 h-4 rounded-full transition-colors ${H?"bg-accent":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${H?"translate-x-4":""}`})})]})]})]},j)})})]}),x&&d.jsxs("div",{className:"flex justify-end gap-2 pb-2",children:[d.jsxs("button",{onClick:P,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:D,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",o?"Saving…":"Save"]})]})]})}function $2e(){return d.jsx(hJ,{children:d.jsx(nQ,{children:d.jsx(uQ,{children:d.jsxs(JK,{children:[d.jsx(nr,{path:"/",element:d.jsx(yQ,{})}),d.jsx(nr,{path:"/environment",element:d.jsx(JCe,{})}),d.jsx(nr,{path:"/config",element:d.jsx(ICe,{})}),d.jsx(nr,{path:"/alerts",element:d.jsx(XB,{})}),d.jsx(nr,{path:"/activity",element:d.jsx(XB,{})}),d.jsx(nr,{path:"/meshtastic/routing",element:d.jsx(FCe,{})}),d.jsx(nr,{path:"/notifications",element:d.jsx(jj,{to:"/meshtastic/routing",replace:!0})}),d.jsx(nr,{path:"/reference",element:d.jsx(s2e,{})}),d.jsx(nr,{path:"/adapter-config",element:d.jsx(PZ,{})}),d.jsx(nr,{path:"/places",element:d.jsx(m2e,{})}),d.jsx(nr,{path:"/coverage",element:d.jsx(W2e,{})}),d.jsx(nr,{path:"/data-sources",element:d.jsx(jj,{to:"/environment",replace:!0})}),d.jsx(nr,{path:"/gauge-sites",element:d.jsx(EZ,{})}),d.jsx(nr,{path:"/town-anchors",element:d.jsx(RZ,{})}),d.jsx(nr,{path:"/mesh",element:d.jsx(MZ,{})}),d.jsx(nr,{path:"/meshtastic/connection",element:d.jsx(p2e,{})}),d.jsx(nr,{path:"/meshtastic/sources",element:d.jsx(zZ,{})}),d.jsx(nr,{path:"/meshtastic/scheduled",element:d.jsx(tF,{family:"meshtastic"})}),d.jsx(nr,{path:"/meshtastic/nodes",element:d.jsx(x2e,{})}),d.jsx(nr,{path:"/meshtastic/danger-zones",element:d.jsx(F2e,{})}),d.jsx(nr,{path:"/meshcore/connection",element:d.jsx(h2e,{})}),d.jsx(nr,{path:"/meshcore/routing",element:d.jsx(c2e,{})}),d.jsx(nr,{path:"/meshcore/scheduled",element:d.jsx(tF,{family:"meshcore"})}),d.jsx(nr,{path:"/meshcore/contacts",element:d.jsx(I2e,{})}),d.jsx(nr,{path:"/meshcore/companion",element:d.jsx(OZ,{})}),d.jsx(nr,{path:"/meshcore/danger-zones",element:d.jsx(V2e,{})})]})})})})}iT.createRoot(document.getElementById("root")).render(d.jsx(bf.StrictMode,{children:d.jsx(oJ,{children:d.jsx($2e,{})})})); diff --git a/work/meshai/dashboard/static/assets/index-oCy31pjB.css b/work/meshai/dashboard/static/assets/index-oCy31pjB.css deleted file mode 100644 index 74c643b..0000000 --- a/work/meshai/dashboard/static/assets/index-oCy31pjB.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap";@import"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap";.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-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-3{left:.75rem}.left-4{left:1rem}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-4{top:1rem}.top-6{top:1.5rem}.top-full{top:100%}.z-0{z-index:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-12{grid-column:span 12 / span 12}.col-span-2{grid-column:span 2 / span 2}.col-span-3{grid-column:span 3 / span 3}.-m-6{margin:-1.5rem}.-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.-my-4{margin-top:-1rem;margin-bottom:-1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-px{margin-bottom:-1px}.-ml-2{margin-left:-.5rem}.-ml-4{margin-left:-1rem}.-mr-1{margin-right:-.25rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.\!table{display:table!important}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-\[540px\]{height:540px}.h-\[calc\(100vh-8rem\)\]{height:calc(100vh - 8rem)}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-72{max-height:18rem}.max-h-80{max-height:20rem}.min-h-\[36px\]{min-height:36px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[190px\]{width:190px}.w-\[220px\]{width:220px}.w-\[250px\]{width:250px}.w-\[2px\]{width:2px}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-prose{max-width:65ch}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-4{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-y{resize:vertical}.scroll-mt-6{scroll-margin-top:1.5rem}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-8{-moz-column-gap:2rem;column-gap:2rem}.gap-y-1{row-gap:.25rem}.gap-y-4{row-gap:1rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 30 30 / var(--tw-divide-opacity, 1))}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:0}.rounded-full{border-radius:9999px}.rounded-lg,.rounded-sm{border-radius:0}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#1e2a3a\]{--tw-border-opacity: 1;border-color:rgb(30 42 58 / var(--tw-border-opacity, 1))}.border-\[\#222\]{--tw-border-opacity: 1;border-color:rgb(34 34 34 / var(--tw-border-opacity, 1))}.border-\[\#2a3a4a\]{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.border-\[\#333\]{--tw-border-opacity: 1;border-color:rgb(51 51 51 / var(--tw-border-opacity, 1))}.border-accent{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-accent-dim\/30{border-color:#d977064d}.border-accent\/30{border-color:#f59e0b4d}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-blue-500\/30{border-color:#3b82f64d}.border-border{--tw-border-opacity: 1;border-color:rgb(30 30 30 / var(--tw-border-opacity, 1))}.border-border\/50{border-color:#1e1e1e80}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-red-400\/30{border-color:#f871714d}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-sky-400{--tw-border-opacity: 1;border-color:rgb(56 189 248 / var(--tw-border-opacity, 1))}.border-sky-400\/30{border-color:#38bdf84d}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-600\/40{border-color:#47556966}.border-transparent{border-color:transparent}.border-yellow-500\/30{border-color:#eab3084d}.border-yellow-700{--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity, 1))}.border-l-accent{--tw-border-opacity: 1;border-left-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.bg-\[\#000000\]{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0e17\]{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d0d\]{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1219\]{--tw-bg-opacity: 1;background-color:rgb(13 18 25 / var(--tw-bg-opacity, 1))}.bg-\[\#161616\]{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1a2332\]{--tw-bg-opacity: 1;background-color:rgb(26 35 50 / var(--tw-bg-opacity, 1))}.bg-\[\#1e1e1e\]{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.bg-\[\#333\]{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]\/10{background-color:#f59e0b1a}.bg-accent{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-accent-dim{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-accent\/10{background-color:#f59e0b1a}.bg-accent\/15{background-color:#f59e0b26}.bg-accent\/20{background-color:#f59e0b33}.bg-accent\/5{background-color:#f59e0b0d}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-bg{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity, 1))}.bg-bg-card{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.bg-bg-card\/90{background-color:#0d0d0de6}.bg-bg-hover{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-blue-500\/15{background-color:#3b82f626}.bg-border{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-cyan-500\/20{background-color:#06b6d433}.bg-emerald-500\/15{background-color:#10b98126}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/15{background-color:#22c55e26}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/5{background-color:#ef44440d}.bg-sky-400{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-sky-400\/10{background-color:#38bdf81a}.bg-sky-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-sky-500\/15{background-color:#0ea5e926}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/15{background-color:#64748b26}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.bg-slate-600\/30{background-color:#4755694d}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-violet-500\/15{background-color:#8b5cf626}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/40{background-color:#713f1266}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-6{padding-left:1.5rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,monospace}.font-sans{font-family:Inter,system-ui,-apple-system,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#555\]{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.text-\[\#666\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}.text-\[\#777\]{--tw-text-opacity: 1;color:rgb(119 119 119 / var(--tw-text-opacity, 1))}.text-\[\#999\]{--tw-text-opacity: 1;color:rgb(153 153 153 / var(--tw-text-opacity, 1))}.text-\[\#bbb\]{--tw-text-opacity: 1;color:rgb(187 187 187 / var(--tw-text-opacity, 1))}.text-\[\#e0e0e0\]{--tw-text-opacity: 1;color:rgb(224 224 224 / var(--tw-text-opacity, 1))}.text-\[\#f59e0b\],.text-accent{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-accent-dim{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-accent\/70{color:#f59e0bb3}.text-accent\/80{color:#f59e0bcc}.text-amber-200\/90{color:#fde68ae6}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-sky-500{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-violet-400{--tw-text-opacity: 1;color:rgb(167 139 250 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-100{--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.text-yellow-200{--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-300\/80{color:#fde047cc}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.accent-\[\#f59e0b\]{accent-color:#f59e0b}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-accent{--tw-ring-opacity: 1;--tw-ring-color: rgb(245 158 11 / var(--tw-ring-opacity, 1))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}body{background:#111;margin:0;font-family:Inter,system-ui,-apple-system,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#111}::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:0}::-webkit-scrollbar-thumb:hover{background:#2a2a2a}.font-mono{font-family:JetBrains Mono,monospace}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse-slow{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes slide-in{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.animate-slide-in{animation:slide-in .3s ease-out}.line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.placeholder\:text-\[\#555\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.placeholder\:text-\[\#555\]::placeholder{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.last\:border-0:last-child{border-width:0px}.hover\:border-\[\#2a3a4a\]:hover{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.hover\:border-accent:hover{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#0a0e17\]:hover{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]:hover{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#333\]:hover{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#d97706\]:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-accent\/20:hover{background-color:#f59e0b33}.hover\:bg-accent\/30:hover{background-color:#f59e0b4d}.hover\:bg-accent\/80:hover{background-color:#f59e0bcc}.hover\:bg-amber-500\/30:hover{background-color:#f59e0b4d}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-card:hover{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-hover:hover{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-accent:hover{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-sky-300:hover{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.focus\:border-accent:focus{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-slate-700:disabled{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 640px){.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/work/meshai/dashboard/static/index.html b/work/meshai/dashboard/static/index.html index c35398f..6b9cc4d 100644 --- a/work/meshai/dashboard/static/index.html +++ b/work/meshai/dashboard/static/index.html @@ -8,8 +8,8 @@ - - + +
diff --git a/work/meshai/meshcore_roster.py b/work/meshai/meshcore_roster.py new file mode 100644 index 0000000..91f1034 --- /dev/null +++ b/work/meshai/meshcore_roster.py @@ -0,0 +1,234 @@ +"""Pure roster helpers for the MeshCore companion: reconcile + route health. + +Deliberately free of device I/O and of the ``meshcore`` lib itself, so the two +pieces of logic worth getting right — what a roster IS after a resync, and +whether the routing matrix still points at destinations that exist — can be +unit-tested without a radio. + +Two independent concerns live here: + +``reconcile_contacts`` + Replace-semantics for a FULL contact refetch. The lib only ever merges + (see below), so this is what makes an operator-triggered resync able to + *drop* entries rather than only ever grow the roster. + +``check_route_health`` / ``find_name_collisions`` + Read-only checks over the companion roster + the region-routing matrix. + Preventive: they answer "would this cell resolve if it fired right now?" + without sending anything. +""" + +from typing import Any, Optional + +# MeshCore contact.type as reported by the firmware CONTACT_TYPENAMES table +# [NONE, CLI, REP, ROOM, SENS]. Mirrors MeshCoreTransport.ROOM_CONTACT_TYPE. +ROOM_CONTACT_TYPE = 3 + + +def reconcile_contacts( + cached: dict[str, dict], fresh: dict[str, dict] +) -> tuple[dict[str, dict], dict[str, Any]]: + """Reconcile a cached roster against a FULL refetch, with replace semantics. + + The meshcore lib's contact handler (``meshcore/meshcore.py::_update_contacts``) + only ever ``.update()``s existing entries or adds new ones — it has no + removal path. So merging a fetch into the cache can never shrink it: an + entry removed on the companion would persist in the cache until reconnect. + Reconciling against an authoritative full fetch restores replace semantics: + anything absent from *fresh* is dropped. + + Per-contact FIELDS are merged (fresh wins) rather than replaced wholesale, + which keeps the lib's field-merge behavior for contacts that still exist — + a fresh record missing an optional field must not blank the cached one. + + IMPORTANT — the caller must only pass a *fresh* that came from a SUCCESSFUL + full fetch (``get_contacts(lastmod=0)`` returning a CONTACTS event). This + function trusts *fresh* as authoritative: an empty *fresh* legitimately + means "the companion has no contacts" and will empty the roster. Passing a + partial/failed fetch here would silently delete real contacts. + + Args: + cached: pubkey -> contact dict (the lib's current mirror). + fresh: pubkey -> contact dict (authoritative FULL fetch). + + Returns: + (reconciled, stats). ``stats`` carries before/after/added/removed/updated + counts plus ``added_keys``/``removed_keys`` (sorted pubkey lists) so the + caller can report exactly what a resync changed. + """ + reconciled: dict[str, dict] = {} + added: list[str] = [] + updated: list[str] = [] + + for pubkey, contact in fresh.items(): + previous = cached.get(pubkey) + if previous is None: + reconciled[pubkey] = dict(contact) + added.append(pubkey) + continue + merged = {**previous, **contact} + reconciled[pubkey] = merged + if merged != previous: + updated.append(pubkey) + + removed = [pubkey for pubkey in cached if pubkey not in fresh] + + stats: dict[str, Any] = { + "before": len(cached), + "after": len(reconciled), + "added": len(added), + "removed": len(removed), + "updated": len(updated), + "added_keys": sorted(added), + "removed_keys": sorted(removed), + } + return reconciled, stats + + +def _find_contact_by_key_prefix( + contacts: list[dict], prefix: str +) -> Optional[dict]: + """Resolve *prefix* to a contact the way the send path does. + + Mirrors ``meshcore.MeshCore.get_contact_by_key_prefix``: case-insensitive + ``startswith`` on the contact's pubkey. Room routing cells are resolved + through that same call (``MeshCoreTransport._resolve_contact``), so the + health check MUST use identical matching or it would report a cell as + dangling that the dispatcher can in fact resolve (a 12-hex prefix from the + room picker is a legitimate cell value, not just a full key). + """ + if not prefix: + return None + needle = prefix.lower() + for contact in contacts: + pubkey = (contact.get("pubkey") or "").lower() + if pubkey.startswith(needle): + return contact + return None + + +def check_route_health( + cells: dict, + channel_names: list[str], + contacts: list[dict], +) -> list[dict]: + """Flag region-routing cells whose MeshCore target does not exist. + + Preventive check — it resolves each cell's ``mc`` target against the live + companion roster/channel table and reports the ones that would not resolve. + Nothing is sent. + + A cell's ``mc`` value is either ``room:`` (addressed room send) or a + bare channel NAME; the parse is delegated to the single canonical + implementation in ``meshai.notifications.channels`` so this can never drift + from what the dispatcher actually does. + + Cells with no ``mc`` target are skipped (nothing to resolve). Disabled cells + ARE still checked and returned with ``enabled: False`` — a broken cell is + worth surfacing before someone re-enables it — so callers should weight the + enabled ones when deciding how loudly to complain. + + Args: + cells: ``region_routes.cells`` — family -> region -> cell dict. + channel_names: channel NAMES on the companion (``known_channels()``). + contacts: roster dicts with at least ``pubkey``/``name``/``type``. + + Returns: + A list of offending cells, each + ``{family, region, target, kind, reason, enabled}``. Empty list = healthy. + """ + # Lazy import: keeps this module dependency-free at import time and avoids + # pulling the notifications stack (httpx/smtplib) into transport callers. + from meshai.notifications.channels import parse_meshcore_room # noqa: PLC0415 + + known = {name for name in channel_names} + problems: list[dict] = [] + + for family, regions in (cells or {}).items(): + if not isinstance(regions, dict): + continue + for region, cell in regions.items(): + if not isinstance(cell, dict): + continue + target = cell.get("mc") + if not target or not isinstance(target, str): + continue + enabled = bool(cell.get("enabled", True)) + + room_pubkey = parse_meshcore_room(target) + if room_pubkey is not None: + contact = _find_contact_by_key_prefix(contacts, room_pubkey) + if contact is None: + problems.append({ + "family": family, + "region": region, + "target": target, + "kind": "room", + "reason": "room_not_found", + "enabled": enabled, + }) + elif contact.get("type") != ROOM_CONTACT_TYPE: + # Resolves to a real contact that is not a room server — + # an addressed send would go to the wrong kind of node. + problems.append({ + "family": family, + "region": region, + "target": target, + "kind": "room", + "reason": "not_a_room", + "enabled": enabled, + }) + continue + + if target not in known: + problems.append({ + "family": family, + "region": region, + "target": target, + "kind": "channel", + "reason": "channel_not_found", + "enabled": enabled, + }) + + return problems + + +def find_name_collisions(contacts: list[dict]) -> list[dict]: + """Group roster entries that share a name but have different pubkeys. + + A name is not a stable identifier on MeshCore — two operators can advertise + the same ``adv_name`` from different keypairs. Anything that picks a target + by name alone (a room picker, an operator reading a table) cannot tell them + apart, so surfacing the collision is what makes the ambiguity visible. + + Only same-name/different-pubkey groups are returned; duplicates of the same + pubkey are not a collision. + + Returns: + ``[{name, count, contacts: [{pubkey, type}, ...]}]``, sorted by name. + Empty list = no collisions. + """ + by_name: dict[str, dict[str, dict]] = {} + for contact in contacts: + name = contact.get("name") + if not name: + continue + pubkey = contact.get("pubkey") or "" + if not pubkey: + continue + by_name.setdefault(name, {})[pubkey] = contact + + collisions: list[dict] = [] + for name, keyed in by_name.items(): + if len(keyed) < 2: + continue + collisions.append({ + "name": name, + "count": len(keyed), + "contacts": [ + {"pubkey": pubkey, "type": c.get("type")} + for pubkey, c in sorted(keyed.items()) + ], + }) + + return sorted(collisions, key=lambda c: c["name"]) diff --git a/work/meshai/transport/meshcore_transport.py b/work/meshai/transport/meshcore_transport.py index 3796b4f..9be229d 100644 --- a/work/meshai/transport/meshcore_transport.py +++ b/work/meshai/transport/meshcore_transport.py @@ -21,6 +21,7 @@ from typing import Callable, Optional from .base import MeshTransport from .send_queue import RadioSendQueue from ..connector import MeshMessage +from ..meshcore_roster import reconcile_contacts logger = logging.getLogger(__name__) @@ -123,6 +124,10 @@ class MeshCoreTransport(MeshTransport): self._chan_details: list[dict] = [] # Self-advertisement tracking. self._last_advert_sent: Optional[float] = None # epoch seconds or None + # When the contact roster was last synced from the companion (epoch + # seconds): set at connect and on every refresh_contacts(). Lets the + # dashboard show roster freshness rather than implying "live". + self._contacts_synced_at: Optional[float] = None # asyncio.Task handle for the periodic advert loop; None when inactive. self._advert_task = None # asyncio.Task handle for the telemetry auto-poll loop; None when inactive. @@ -146,6 +151,48 @@ class MeshCoreTransport(MeshTransport): # Internal helpers # ------------------------------------------------------------------ + def _connection_descriptor(self) -> dict: + """Describe the CONFIGURED connection: how we attach to the companion. + + Single source of truth for both the connect() log line and the + ``self_info()`` API payload, so the two can never disagree about which + device meshai is attached to. Exactly one transport's fields are + populated per ``conn_type``; the rest are None. ``target`` is the + human-readable form ("serial:/dev/x@115200", "host:port", "ble:addr"). + + Reads config only — it describes the configured attachment, not a live + handle, so it is safe to call before connect() and while disconnected. + """ + conn_type = (getattr(self.config, "meshcore_conn_type", "tcp") or "tcp").strip().lower() + base = { + "conn_type": conn_type, + "host": None, + "port": None, + "serial_port": None, + "baud": None, + "ble_address": None, + } + if conn_type == "serial": + serial_port = getattr(self.config, "meshcore_serial_port", "") or "" + baud = getattr(self.config, "meshcore_baud", 115200) + base.update({ + "serial_port": serial_port or None, + "baud": baud, + "target": f"serial:{serial_port}@{baud}", + }) + return base + if conn_type == "ble": + ble_address = getattr(self.config, "meshcore_ble_address", "") or "" + base.update({ + "ble_address": ble_address or None, + "target": f"ble:{ble_address or 'auto'}", + }) + return base + host = getattr(self.config, "meshcore_host", "") or "" + port = getattr(self.config, "meshcore_port", 5050) + base.update({"host": host or None, "port": port, "target": f"{host}:{port}"}) + return base + def _run_coro(self, coro, timeout: float = _COMMAND_TIMEOUT): """Submit *coro* to the dedicated event loop and block until done. @@ -991,6 +1038,238 @@ class MeshCoreTransport(MeshTransport): }) return roster + def contacts_synced_at(self) -> Optional[float]: + """Epoch seconds when the roster was last synced from the companion.""" + return self._contacts_synced_at + + async def _refresh_contacts_async(self) -> dict: + """Force a FULL contact refetch and reconcile the lib's cache. Runs on the MC loop. + + ``ensure_contacts()`` is a no-op once the cache is populated, and even + when it does fetch it passes ``lastmod`` (incremental). Neither path can + ever shrink the cache, because the lib's CONTACTS handler only merges. + This forces ``get_contacts(lastmod=0)`` — the authoritative FULL set — + and then REPLACES the cache with it, so entries the companion no longer + has are dropped rather than surviving forever. + + Only reconciles on a successful CONTACTS event: an ERROR/timeout leaves + the cache untouched, because treating a failed fetch as authoritative + would delete the entire roster. + + Returns the reconcile stats dict (before/after/added/removed/updated). + """ + from meshcore import EventType # noqa: PLC0415 (lazy import intentional) + + mc = self._mc + if mc is None: + raise RuntimeError("MeshCore not connected") + + result = await mc.commands.get_contacts(lastmod=0) + if result is None: + raise RuntimeError("contact refresh failed: no response from companion") + if getattr(result, "type", None) == EventType.ERROR: + reason = (getattr(result, "payload", None) or {}).get("reason", "unknown") + raise RuntimeError(f"contact refresh failed: {reason}") + + payload = getattr(result, "payload", None) or {} + # Re-key by public_key to match the lib's own cache layout — the event + # payload may be keyed differently, but every value carries its key. + fresh: dict[str, dict] = {} + for contact in payload.values(): + if not isinstance(contact, dict): + continue + pubkey = contact.get("public_key") + if pubkey: + fresh[pubkey] = contact + + cached = dict(getattr(mc, "contacts", None) or {}) + reconciled, stats = reconcile_contacts(cached, fresh) + + # Replace the lib's cache in place. The lib exposes ``contacts`` as a + # read-only property over ``_contacts``, so the private attr is the only + # way to apply removals; assigning a fresh dict would also break the + # lib's own handlers that mutate it in place. + mc._contacts.clear() + mc._contacts.update(reconciled) + mc._contacts_dirty = False + + self._contacts_synced_at = _time.time() + logger.info( + "MeshCore: roster resync — %d before, %d after (+%d added, -%d removed, %d updated)", + stats["before"], stats["after"], stats["added"], stats["removed"], stats["updated"], + ) + return stats + + def refresh_contacts(self) -> dict: + """Force a FULL roster resync from the companion and reconcile the cache. + + Blocking wrapper around ``_refresh_contacts_async``. Raises RuntimeError + when not connected or when the companion fetch fails. Returns the + reconcile stats dict. + """ + if self._mc is None or not self._connected: + raise RuntimeError("MeshCore not connected") + return self._run_coro(self._refresh_contacts_async(), timeout=30.0) + + def resync(self) -> dict: + """Re-read the companion's full device view: contacts AND channels. + + meshai's picture of the device is otherwise built once at connect — + contacts by ``ensure_contacts()``, channels by ``_enumerate_channels()`` + — and never re-read. A channel provisioned on the radio afterwards is + invisible until the process restarts. This is the one operator action + that re-reads both. + + Must be called OFF the MC loop (it bridges through ``_run_coro``); the + dashboard route thread is the intended caller. + + Returns ``{"contacts": , "channels": {before, after, + added, removed}}``. + """ + if self._mc is None or not self._connected: + raise RuntimeError("MeshCore not connected") + + contact_stats = self.refresh_contacts() + + # Channels: re-walk the companion's slot table. _enumerate_channels() + # rebuilds BOTH _chan_name_to_idx and _chan_details (the async variant + # only does the former, which would leave the Channels view stale). + before = set(self.known_channels()) + self._enumerate_channels() + after = set(self.known_channels()) + channel_stats = { + "before": len(before), + "after": len(after), + "added": sorted(after - before), + "removed": sorted(before - after), + } + if channel_stats["added"] or channel_stats["removed"]: + logger.info( + "MeshCore: channel resync — +%s / -%s", + channel_stats["added"], channel_stats["removed"], + ) + return {"contacts": contact_stats, "channels": channel_stats} + + def remove_contact(self, pubkey: str) -> None: + """Remove a contact from the companion by full pubkey. + + Wraps the lib's ``commands.remove_contact`` (CMD 0x0f). The lib does not + touch its own cache on removal, so the entry is dropped from the mirror + here too — otherwise the deleted contact would reappear in the roster + until the next full resync. + + A FULL 64-hex pubkey is required: the lib validates with + ``prefix_length=32``, and a prefix could otherwise resolve to the wrong + node — the wrong contact silently deleted. Raises ValueError on a bad + key, RuntimeError when not connected or when the companion rejects it. + """ + if self._mc is None or not self._connected: + raise RuntimeError("MeshCore not connected") + key = (pubkey or "").strip().lower() + if len(key) != 64: + raise ValueError("A full 64-character hex pubkey is required to remove a contact") + try: + bytes.fromhex(key) + except ValueError: + raise ValueError(f"Invalid pubkey hex: {pubkey!r}") + + from meshcore import EventType # noqa: PLC0415 (lazy import intentional) + + result = self._run_coro(self._mc.commands.remove_contact(key), timeout=15.0) + if result is None: + raise RuntimeError("remove_contact failed: no response from companion") + if getattr(result, "type", None) == EventType.ERROR: + reason = (getattr(result, "payload", None) or {}).get("reason", "unknown") + raise RuntimeError(f"remove_contact failed: {reason}") + + try: + self._mc._contacts.pop(key, None) + except Exception: + logger.debug("MeshCore: could not drop %s from cache mirror", key, exc_info=True) + logger.info("MeshCore: removed contact %s from companion", key) + + def export_roster(self) -> list[dict]: + """Roster as importable records: the raw lib fields, not the UI view. + + ``get_contacts()`` returns a display projection; a record has to carry + every field ``commands.update_contact`` writes back (type, flags, the + out_path triplet, adv_name, last_advert, adv_lat/adv_lon) or it cannot + be imported onto another companion. Returns [] when not connected. + """ + if self._mc is None or not self._connected: + return [] + contacts = getattr(self._mc, "contacts", None) or {} + records: list[dict] = [] + for pubkey_hex, contact in contacts.items(): + if not isinstance(contact, dict): + continue + pubkey = contact.get("public_key") or pubkey_hex + try: + out_path_len = int(contact.get("out_path_len", -1)) + except (TypeError, ValueError): + out_path_len = -1 + records.append({ + "name": contact.get("adv_name"), + "pubkey": pubkey, + "type": contact.get("type"), + "flags": contact.get("flags"), + "last_advert": contact.get("last_advert"), + "adv_lat": contact.get("adv_lat"), + "adv_lon": contact.get("adv_lon"), + "out_path": contact.get("out_path"), + "out_path_len": out_path_len, + "out_path_hash_mode": contact.get("out_path_hash_mode"), + "path_established": out_path_len >= 0, + }) + return sorted(records, key=lambda r: (r["name"] or "").lower()) + + def import_contact(self, record: dict) -> None: + """Write one exported roster record onto the companion. + + Uses ``commands.add_contact`` (which delegates to ``update_contact``, + CMD 0x09) to rebuild a contact on a replacement companion without + waiting to rediscover it by advert. This is a LOCAL device write — it + does not transmit to the mesh. + + Additive/idempotent by nature: CMD 0x09 upserts, so re-importing an + existing contact overwrites that record rather than duplicating it. + Raises ValueError on a malformed record, RuntimeError on rejection. + """ + if self._mc is None or not self._connected: + raise RuntimeError("MeshCore not connected") + pubkey = (record.get("pubkey") or "").strip().lower() + if len(pubkey) != 64: + raise ValueError("Each contact needs a full 64-character hex pubkey") + try: + bytes.fromhex(pubkey) + except ValueError: + raise ValueError(f"Invalid pubkey hex: {pubkey!r}") + + # Rebuild the lib-shaped contact dict update_contact() expects. The + # defaults keep a hand-written or older export importable: an unknown + # path simply means "flood until a path is discovered". + contact = { + "public_key": pubkey, + "type": int(record.get("type") or 0), + "flags": int(record.get("flags") or 0), + "out_path": record.get("out_path") or "", + "out_path_len": int(record.get("out_path_len", -1) if record.get("out_path_len") is not None else -1), + "out_path_hash_mode": int(record.get("out_path_hash_mode") or 0), + "adv_name": record.get("name") or "", + "last_advert": int(record.get("last_advert") or 0), + "adv_lat": float(record.get("adv_lat") or 0.0), + "adv_lon": float(record.get("adv_lon") or 0.0), + } + + from meshcore import EventType # noqa: PLC0415 (lazy import intentional) + + result = self._run_coro(self._mc.commands.add_contact(contact), timeout=15.0) + if result is None: + raise RuntimeError("import_contact failed: no response from companion") + if getattr(result, "type", None) == EventType.ERROR: + reason = (getattr(result, "payload", None) or {}).get("reason", "unknown") + raise RuntimeError(f"import_contact failed: {reason}") + # A MeshCore ROOM SERVER is a contact whose ``type`` is ROOM (3) in the # firmware CONTACT_TYPENAMES table [NONE, CLI, REP, ROOM, SENS]. We route # to a room via the DM primitive (send_msg to its pubkey), so a room is @@ -1106,18 +1385,34 @@ class MeshCoreTransport(MeshTransport): return await self._do_mc_dm_send_async(text, pubkey) def self_info(self) -> dict: - """Companion self/connection status. {connected: False} if not connected.""" + """Companion self/connection status. {connected: False} if not connected. + + ``name``/``pubkey`` identify the ACTUAL connected device; the connection + fields describe how we are attached to it. Only the fields belonging to + the live ``conn_type`` are populated — the others are None. Reporting + ``host``/``port`` unconditionally (as this did previously) meant a serial + connection still advertised whatever stale ``meshcore_host`` sat in the + config, i.e. the API named a device meshai was not talking to. Anyone + trusting that pointer investigates the wrong physical radio. + """ if self._mc is None or not self._connected: return {"connected": False} info = self._self_info or {} + descriptor = self._connection_descriptor() return { "name": info.get("name"), "pubkey": info.get("public_key"), "connected": True, - "host": getattr(self.config, "meshcore_host", "100.64.0.9"), - "port": getattr(self.config, "meshcore_port", 5050), + "conn_type": descriptor["conn_type"], + "target": descriptor["target"], + "host": descriptor["host"], + "port": descriptor["port"], + "serial_port": descriptor["serial_port"], + "baud": descriptor["baud"], + "ble_address": descriptor["ble_address"], "channel_count": len(self.known_channels()), "last_advert_sent": self._last_advert_sent, + "contacts_synced_at": self._contacts_synced_at, } def set_context_config(self, cfg) -> None: @@ -1532,8 +1827,28 @@ class MeshCoreTransport(MeshTransport): self._mc.subscribe(EventType.NEW_CONTACT, self._on_new_contact) try: await self._mc.ensure_contacts() + self._contacts_synced_at = _time.time() except Exception: logger.debug("MeshCore: ensure_contacts failed (non-fatal)", exc_info=True) + + # Let the lib refresh its roster when it hears an ADVERTISEMENT / + # PATH_UPDATE. The lib defaults this OFF, which leaves the roster a + # connect-time snapshot that only grows (its CONTACTS handler merges and + # never removes) until something forces a refetch. + # + # TRADE-OFF: each advert heard costs one incremental get_contacts() + # round-trip to the companion — local serial/TCP chatter, never a mesh + # transmission. On a dense mesh (and especially with + # meshcore_auto_add_contacts, where the firmware adds every node it + # hears) that is a steady trickle of fetches. Set + # meshcore_auto_update_contacts=false to keep the lib default and rely + # on the explicit "Resync" action instead. + if getattr(self.config, "meshcore_auto_update_contacts", True): + try: + self._mc.auto_update_contacts = True + logger.info("MeshCore: auto-update-contacts ENABLED (adverts refresh the roster)") + except Exception as exc: + logger.warning("MeshCore: could not enable auto_update_contacts (non-fatal): %s", exc) if getattr(self.config, "meshcore_auto_add_contacts", True): try: await self._mc.commands.set_autoadd_config(1) @@ -1571,13 +1886,9 @@ class MeshCoreTransport(MeshTransport): auto_reconnect = getattr(self.config, "meshcore_auto_reconnect", True) max_attempts = getattr(self.config, "meshcore_max_reconnect_attempts", 5) - # Build a human-readable target string for logging. - if conn_type == "serial": - target = f"serial:{serial_port}@{baud}" - elif conn_type == "ble": - target = f"ble:{ble_address or 'auto'}" - else: - target = f"{host}:{port}" + # Human-readable target for logging — from the same descriptor that + # self_info() reports, so the log and the API never disagree. + target = self._connection_descriptor()["target"] logger.info("MeshCoreTransport: connecting to %s …", target) diff --git a/work/tests/test_mesh_send_api.py b/work/tests/test_mesh_send_api.py index 7714948..9461362 100644 --- a/work/tests/test_mesh_send_api.py +++ b/work/tests/test_mesh_send_api.py @@ -6,6 +6,7 @@ Uses a bare FastAPI() + TestClient with a hand-seeded ``app.state.connector`` """ from __future__ import annotations +from types import SimpleNamespace from unittest.mock import AsyncMock, MagicMock import pytest @@ -198,12 +199,17 @@ _SAMPLE_ROSTER = [ def test_meshcore_contacts_active(): mc = _child("meshcore", connected=True) mc.get_contacts.return_value = list(_SAMPLE_ROSTER) + mc.contacts_synced_at.return_value = 1700000000.0 connector = _composite([mc]) client = _client(connector) r = client.get("/api/meshcore/contacts") assert r.status_code == 200 - assert r.json() == {"active": True, "contacts": _SAMPLE_ROSTER} + assert r.json() == { + "active": True, + "contacts": _SAMPLE_ROSTER, + "last_synced_at": 1700000000.0, + } def test_meshcore_contacts_no_meshcore(): @@ -213,7 +219,7 @@ def test_meshcore_contacts_no_meshcore(): r = client.get("/api/meshcore/contacts") assert r.status_code == 200 - assert r.json() == {"active": False, "contacts": []} + assert r.json() == {"active": False, "contacts": [], "last_synced_at": None} def test_meshcore_contacts_disconnected(): @@ -223,7 +229,250 @@ def test_meshcore_contacts_disconnected(): r = client.get("/api/meshcore/contacts") assert r.status_code == 200 - assert r.json() == {"active": False, "contacts": []} + assert r.json() == {"active": False, "contacts": [], "last_synced_at": None} + + +# ============================================================================ +# POST /api/meshcore/contacts/refresh — full resync + reconcile +# ============================================================================ + +_REFRESH_STATS = { + "before": 3, "after": 3, "added": 1, "removed": 1, "updated": 0, + "added_keys": ["cc" * 32], "removed_keys": ["bb" * 32], +} + + +_CHANNEL_STATS = {"before": 4, "after": 5, "added": ["#new-chan"], "removed": []} + + +def test_meshcore_refresh_returns_contact_and_channel_stats(): + """The resync re-reads BOTH halves of the device view, and reports each.""" + mc = _child("meshcore", connected=True, known=["#aida", "#new-chan"]) + mc.resync.return_value = {"contacts": dict(_REFRESH_STATS), "channels": dict(_CHANNEL_STATS)} + mc.get_contacts.return_value = list(_SAMPLE_ROSTER) + mc.contacts_synced_at.return_value = 1700000000.0 + client = _client(_composite([mc])) + + r = client.post("/api/meshcore/contacts/refresh") + + assert r.status_code == 200 + body = r.json() + assert body["stats"] == _REFRESH_STATS + assert body["channel_stats"] == _CHANNEL_STATS + assert body["contacts"] == _SAMPLE_ROSTER + assert body["channels"] == ["#aida", "#new-chan"] + assert body["last_synced_at"] == 1700000000.0 + mc.resync.assert_called_once() + + +def test_meshcore_refresh_conflict_when_disconnected(): + mc = _child("meshcore", connected=False) + client = _client(_composite([mc])) + + r = client.post("/api/meshcore/contacts/refresh") + + assert r.status_code == 409 + mc.resync.assert_not_called() + + +def test_meshcore_refresh_surfaces_companion_failure(): + """A failed fetch must surface, not be reported as a successful resync.""" + mc = _child("meshcore", connected=True) + mc.resync.side_effect = RuntimeError("contact refresh failed: timeout") + client = _client(_composite([mc])) + + r = client.post("/api/meshcore/contacts/refresh") + + assert r.status_code == 502 + assert "timeout" in r.json()["detail"] + + +# ============================================================================ +# DELETE /api/meshcore/contacts/{pubkey} +# ============================================================================ + +def test_meshcore_delete_contact_removes_and_returns_roster(): + mc = _child("meshcore", connected=True) + mc.get_contacts.return_value = list(_SAMPLE_ROSTER) + client = _client(_composite([mc])) + + r = client.delete(f"/api/meshcore/contacts/{'aa' * 32}") + + assert r.status_code == 200 + assert r.json() == {"active": True, "contacts": _SAMPLE_ROSTER} + mc.remove_contact.assert_called_once_with("aa" * 32) + + +def test_meshcore_delete_contact_rejects_bad_key(): + mc = _child("meshcore", connected=True) + mc.remove_contact.side_effect = ValueError("A full 64-character hex pubkey is required") + client = _client(_composite([mc])) + + r = client.delete("/api/meshcore/contacts/aa11") + + assert r.status_code == 400 + + +def test_meshcore_delete_contact_conflict_when_disconnected(): + mc = _child("meshcore", connected=False) + client = _client(_composite([mc])) + + r = client.delete(f"/api/meshcore/contacts/{'aa' * 32}") + + assert r.status_code == 409 + mc.remove_contact.assert_not_called() + + +# ============================================================================ +# GET /api/meshcore/contacts/export +# ============================================================================ + +def test_meshcore_export_returns_envelope_and_attachment(): + mc = _child("meshcore", connected=True) + mc.export_roster.return_value = [{"name": "N", "pubkey": "aa" * 32, "type": 1}] + mc.self_info.return_value = { + "name": "AIDA", "pubkey": "a6" * 32, + "conn_type": "serial", "target": "serial:/dev/meshcore-rak@115200", + } + mc.contacts_synced_at.return_value = 1700000000.0 + client = _client(_composite([mc])) + + r = client.get("/api/meshcore/contacts/export") + + assert r.status_code == 200 + assert "attachment" in r.headers["content-disposition"] + body = r.json() + assert body["format"] == "meshai.meshcore.roster" + assert body["count"] == 1 + # The roster is only meaningful paired with the device it came from. + assert body["device"]["conn_type"] == "serial" + assert body["device"]["target"] == "serial:/dev/meshcore-rak@115200" + + +def test_meshcore_export_conflict_when_disconnected(): + mc = _child("meshcore", connected=False) + client = _client(_composite([mc])) + + assert client.get("/api/meshcore/contacts/export").status_code == 409 + + +# ============================================================================ +# POST /api/meshcore/contacts/import +# ============================================================================ + +def test_meshcore_import_writes_each_record(): + mc = _child("meshcore", connected=True) + client = _client(_composite([mc])) + + r = client.post("/api/meshcore/contacts/import", json={ + "contacts": [{"pubkey": "aa" * 32}, {"pubkey": "bb" * 32}], + }) + + assert r.status_code == 200 + assert r.json() == {"active": True, "imported": 2, "failed": 0, "errors": []} + assert mc.import_contact.call_count == 2 + + +def test_meshcore_import_collects_per_record_errors(): + """One bad record must not strand the batch with no report of what landed.""" + mc = _child("meshcore", connected=True) + mc.import_contact.side_effect = [None, ValueError("bad pubkey")] + client = _client(_composite([mc])) + + r = client.post("/api/meshcore/contacts/import", json={ + "contacts": [{"pubkey": "aa" * 32}, {"pubkey": "nope"}], + }) + + body = r.json() + assert body["imported"] == 1 + assert body["failed"] == 1 + assert body["errors"][0]["pubkey"] == "nope" + + +def test_meshcore_import_rejects_empty_payload(): + mc = _child("meshcore", connected=True) + client = _client(_composite([mc])) + + assert client.post("/api/meshcore/contacts/import", json={"contacts": []}).status_code == 400 + + +# ============================================================================ +# GET /api/meshcore/route-health +# ============================================================================ + +def _config_with_cells(cells, mc_enabled=True): + return SimpleNamespace( + notifications=SimpleNamespace( + region_routes=SimpleNamespace(mt_enabled=True, mc_enabled=mc_enabled, cells=cells) + ) + ) + + +def _health_client(connector, config): + app = FastAPI() + app.include_router(router, prefix="/api") + app.state.connector = connector + app.state.config = config + return TestClient(app) + + +def test_route_health_flags_dangling_room_cell(): + mc = _child("meshcore", connected=True, known=["#aida"]) + mc.get_contacts.return_value = [] + config = _config_with_cells({"fire": {"SC Idaho": {"mc": f"room:{'de' * 32}", "enabled": True}}}) + client = _health_client(_composite([mc]), config) + + body = client.get("/api/meshcore/route-health").json() + + assert body["active"] is True + assert len(body["dangling"]) == 1 + assert body["dangling"][0]["reason"] == "room_not_found" + assert body["dangling_enabled"] == 1 + + +def test_route_health_clean_when_targets_resolve(): + mc = _child("meshcore", connected=True, known=["#aida"]) + mc.get_contacts.return_value = [ + {"pubkey": "aa" * 32, "name": "Room", "type": 3}, + ] + config = _config_with_cells({ + "weather": { + "SW Idaho": {"mc": "#aida", "enabled": True}, + "SC Idaho": {"mc": f"room:{'aa' * 32}", "enabled": True}, + } + }) + client = _health_client(_composite([mc]), config) + + body = client.get("/api/meshcore/route-health").json() + + assert body["dangling"] == [] + assert body["checked"] == 2 + + +def test_route_health_reports_name_collisions(): + mc = _child("meshcore", connected=True, known=[]) + mc.get_contacts.return_value = [ + {"pubkey": "aa" * 32, "name": "SC ID AIDA Alerts", "type": 3}, + {"pubkey": "bb" * 32, "name": "SC ID AIDA Alerts", "type": 3}, + ] + client = _health_client(_composite([mc]), _config_with_cells({})) + + body = client.get("/api/meshcore/route-health").json() + + assert len(body["collisions"]) == 1 + assert body["collisions"][0]["count"] == 2 + + +def test_route_health_inactive_when_disconnected(): + """A disconnected companion is not evidence that a route is broken.""" + mc = _child("meshcore", connected=False) + config = _config_with_cells({"fire": {"SC Idaho": {"mc": "room:dead", "enabled": True}}}) + client = _health_client(_composite([mc]), config) + + body = client.get("/api/meshcore/route-health").json() + + assert body["active"] is False + assert body["dangling"] == [] # ============================================================================ diff --git a/work/tests/test_meshcore_roster.py b/work/tests/test_meshcore_roster.py new file mode 100644 index 0000000..399edbc --- /dev/null +++ b/work/tests/test_meshcore_roster.py @@ -0,0 +1,714 @@ +"""Tests for MeshCore roster management: reconcile, route health, name collisions. + +Covers: + - reconcile_contacts(): full-refetch replace semantics (the crux — a merge + can never remove, so this is what lets a resync drop stale entries) + - check_route_health(): region-routing cells pointing at absent rooms/channels + - find_name_collisions(): same name, different pubkey + - MeshCoreTransport.self_info(): reports the ACTUAL connection, never a + config value belonging to a different conn_type + - MeshCoreTransport._refresh_contacts_async / remove_contact / import_contact + +The companion is mocked throughout: no device I/O, no mesh traffic, nothing +removed from a real radio. +""" + +import asyncio +import sys +import types + +import pytest + +from meshai.meshcore_roster import ( + check_route_health, + find_name_collisions, + reconcile_contacts, +) + + +# --------------------------------------------------------------------------- +# Helpers +# --------------------------------------------------------------------------- + +def _contact(pubkey: str, name: str = "node", type_: int = 1, **extra) -> dict: + """A lib-shaped contact dict (public_key is the lib's key field).""" + base = { + "public_key": pubkey, + "adv_name": name, + "type": type_, + "last_advert": 1000, + "out_path_len": -1, + "out_path": "", + "out_path_hash_mode": 0, + "flags": 0, + "adv_lat": 0.0, + "adv_lon": 0.0, + } + base.update(extra) + return base + + +def _roster(pubkey: str, name: str = "node", type_: int = 1) -> dict: + """A roster-projection contact dict (as get_contacts() returns).""" + return {"pubkey": pubkey, "name": name, "type": type_, "last_advert": 1000} + + +KEY_A = "aa" * 32 +KEY_B = "bb" * 32 +KEY_C = "cc" * 32 + + +# --------------------------------------------------------------------------- +# Part 1: reconcile_contacts — replace semantics +# --------------------------------------------------------------------------- + +class TestReconcileContacts: + def test_absent_contact_is_dropped(self): + """The crux: a contact missing from the FULL refetch is removed. + + The lib's own fetch handler only merges, so without this a deleted + contact survives in the cache forever. + """ + cached = {KEY_A: _contact(KEY_A, "alpha"), KEY_B: _contact(KEY_B, "bravo")} + fresh = {KEY_A: _contact(KEY_A, "alpha")} + + reconciled, stats = reconcile_contacts(cached, fresh) + + assert KEY_B not in reconciled + assert set(reconciled) == {KEY_A} + assert stats["removed"] == 1 + assert stats["removed_keys"] == [KEY_B] + assert stats["before"] == 2 + assert stats["after"] == 1 + + def test_new_contact_is_added(self): + cached = {KEY_A: _contact(KEY_A, "alpha")} + fresh = {KEY_A: _contact(KEY_A, "alpha"), KEY_B: _contact(KEY_B, "bravo")} + + reconciled, stats = reconcile_contacts(cached, fresh) + + assert set(reconciled) == {KEY_A, KEY_B} + assert stats["added"] == 1 + assert stats["added_keys"] == [KEY_B] + assert stats["removed"] == 0 + + def test_changed_contact_is_updated(self): + cached = {KEY_A: _contact(KEY_A, "alpha", last_advert=1000)} + fresh = {KEY_A: _contact(KEY_A, "alpha", last_advert=2000)} + + reconciled, stats = reconcile_contacts(cached, fresh) + + assert reconciled[KEY_A]["last_advert"] == 2000 + assert stats["updated"] == 1 + assert stats["added"] == 0 + assert stats["removed"] == 0 + + def test_unchanged_contact_not_counted_as_updated(self): + cached = {KEY_A: _contact(KEY_A, "alpha")} + fresh = {KEY_A: _contact(KEY_A, "alpha")} + + _, stats = reconcile_contacts(cached, fresh) + + assert stats["updated"] == 0 + assert stats["added"] == 0 + assert stats["removed"] == 0 + assert stats["after"] == 1 + + def test_fields_merge_rather_than_replace(self): + """A fresh record missing an optional field must not blank the cached one.""" + cached = {KEY_A: _contact(KEY_A, "alpha", nickname="local-only")} + fresh = {KEY_A: {"public_key": KEY_A, "adv_name": "alpha-renamed"}} + + reconciled, _ = reconcile_contacts(cached, fresh) + + assert reconciled[KEY_A]["adv_name"] == "alpha-renamed" # fresh wins + assert reconciled[KEY_A]["nickname"] == "local-only" # survives + assert reconciled[KEY_A]["type"] == 1 # survives + + def test_add_remove_and_update_together(self): + cached = { + KEY_A: _contact(KEY_A, "alpha", last_advert=1000), + KEY_B: _contact(KEY_B, "bravo"), + } + fresh = { + KEY_A: _contact(KEY_A, "alpha", last_advert=2000), + KEY_C: _contact(KEY_C, "charlie"), + } + + reconciled, stats = reconcile_contacts(cached, fresh) + + assert set(reconciled) == {KEY_A, KEY_C} + assert (stats["added"], stats["removed"], stats["updated"]) == (1, 1, 1) + assert stats["added_keys"] == [KEY_C] + assert stats["removed_keys"] == [KEY_B] + + def test_empty_fresh_empties_roster(self): + """An authoritative full fetch of zero contacts means zero contacts. + + Guarding this would mean a genuinely-wiped companion could never be + reflected; the caller is responsible for only passing a SUCCESSFUL fetch. + """ + cached = {KEY_A: _contact(KEY_A), KEY_B: _contact(KEY_B)} + + reconciled, stats = reconcile_contacts(cached, {}) + + assert reconciled == {} + assert stats["removed"] == 2 + assert stats["after"] == 0 + + def test_empty_cache_adds_everything(self): + fresh = {KEY_A: _contact(KEY_A), KEY_B: _contact(KEY_B)} + + reconciled, stats = reconcile_contacts({}, fresh) + + assert set(reconciled) == {KEY_A, KEY_B} + assert stats["added"] == 2 + assert stats["before"] == 0 + + def test_does_not_mutate_inputs(self): + cached = {KEY_A: _contact(KEY_A, "alpha", last_advert=1000)} + fresh = {KEY_B: _contact(KEY_B, "bravo")} + cached_snapshot = {KEY_A: dict(cached[KEY_A])} + + reconcile_contacts(cached, fresh) + + assert cached == cached_snapshot # caller's cache untouched + assert set(fresh) == {KEY_B} + + def test_merge_semantics_alone_can_never_remove(self): + """Contrast: the lib's merge keeps a stale entry that reconcile drops. + + Documents exactly what the reconcile adds over the lib's behavior. + """ + cached = {KEY_A: _contact(KEY_A), KEY_B: _contact(KEY_B)} + fresh = {KEY_A: _contact(KEY_A)} + + merged = dict(cached) + merged.update(fresh) # what the lib does + reconciled, _ = reconcile_contacts(cached, fresh) # what we do + + assert KEY_B in merged # stale entry survives a merge + assert KEY_B not in reconciled # ...and is dropped by reconcile + + +# --------------------------------------------------------------------------- +# Part 2: check_route_health — dangling routing cells +# --------------------------------------------------------------------------- + +class TestCheckRouteHealth: + CHANNELS = ["Public", "#aida", "#sw-id-aida"] + + def test_healthy_cells_report_nothing(self): + cells = { + "weather": { + "SW Idaho": {"mc": "#sw-id-aida", "enabled": True}, + "SC Idaho": {"mc": f"room:{KEY_A}", "enabled": True}, + } + } + contacts = [_roster(KEY_A, "SC Room", type_=3)] + + assert check_route_health(cells, self.CHANNELS, contacts) == [] + + def test_cell_pointing_at_missing_room_is_flagged(self): + cells = {"weather": {"SC Idaho": {"mc": f"room:{KEY_B}", "enabled": True}}} + contacts = [_roster(KEY_A, "SC Room", type_=3)] + + problems = check_route_health(cells, self.CHANNELS, contacts) + + assert len(problems) == 1 + assert problems[0]["family"] == "weather" + assert problems[0]["region"] == "SC Idaho" + assert problems[0]["kind"] == "room" + assert problems[0]["reason"] == "room_not_found" + assert problems[0]["enabled"] is True + + def test_cell_pointing_at_missing_channel_is_flagged(self): + cells = {"fire": {"East Idaho": {"mc": "#e-id-aida", "enabled": True}}} + + problems = check_route_health(cells, self.CHANNELS, []) + + assert len(problems) == 1 + assert problems[0]["kind"] == "channel" + assert problems[0]["reason"] == "channel_not_found" + assert problems[0]["target"] == "#e-id-aida" + + def test_room_cell_resolving_to_non_room_is_flagged(self): + """A room cell that resolves to a plain node would address the wrong kind.""" + cells = {"weather": {"SC Idaho": {"mc": f"room:{KEY_A}", "enabled": True}}} + contacts = [_roster(KEY_A, "Just A Node", type_=1)] + + problems = check_route_health(cells, self.CHANNELS, contacts) + + assert len(problems) == 1 + assert problems[0]["reason"] == "not_a_room" + + def test_room_cell_matches_by_prefix(self): + """The send path resolves rooms by pubkey PREFIX — so must this check. + + A 12-hex prefix (what the room picker stores) is a legitimate cell + value; treating it as dangling would be a false alarm. + """ + cells = {"weather": {"SC Idaho": {"mc": f"room:{KEY_A[:12]}", "enabled": True}}} + contacts = [_roster(KEY_A, "SC Room", type_=3)] + + assert check_route_health(cells, self.CHANNELS, contacts) == [] + + def test_room_prefix_match_is_case_insensitive(self): + cells = {"weather": {"SC Idaho": {"mc": f"room:{KEY_A[:12].upper()}", "enabled": True}}} + contacts = [_roster(KEY_A, "SC Room", type_=3)] + + assert check_route_health(cells, self.CHANNELS, contacts) == [] + + def test_disabled_cell_still_reported_but_marked(self): + cells = {"weather": {"SC Idaho": {"mc": f"room:{KEY_B}", "enabled": False}}} + + problems = check_route_health(cells, self.CHANNELS, []) + + assert len(problems) == 1 + assert problems[0]["enabled"] is False + + def test_cell_without_mc_target_is_skipped(self): + cells = {"weather": {"SW Idaho": {"mt": 3, "mc": None, "enabled": True}}} + + assert check_route_health(cells, self.CHANNELS, []) == [] + + def test_empty_room_pubkey_treated_as_channel_name(self): + """``room:`` with no pubkey is not a room target (parser yields None).""" + cells = {"weather": {"SC Idaho": {"mc": "room:", "enabled": True}}} + + problems = check_route_health(cells, self.CHANNELS, []) + + assert len(problems) == 1 + assert problems[0]["kind"] == "channel" + + def test_empty_cells_and_missing_families(self): + assert check_route_health({}, self.CHANNELS, []) == [] + assert check_route_health({"weather": None}, self.CHANNELS, []) == [] + + def test_multiple_families_and_regions(self): + cells = { + "weather": { + "SW Idaho": {"mc": "#sw-id-aida", "enabled": True}, # healthy + "SC Idaho": {"mc": f"room:{KEY_B}", "enabled": True}, # dangling + }, + "fire": { + "East Idaho": {"mc": "#gone", "enabled": True}, # dangling + }, + } + contacts = [_roster(KEY_A, "SC Room", type_=3)] + + problems = check_route_health(cells, self.CHANNELS, contacts) + + assert len(problems) == 2 + assert {p["reason"] for p in problems} == {"room_not_found", "channel_not_found"} + + +# --------------------------------------------------------------------------- +# Part 3: find_name_collisions +# --------------------------------------------------------------------------- + +class TestFindNameCollisions: + def test_same_name_different_pubkey_is_a_collision(self): + contacts = [ + _roster(KEY_A, "SC ID AIDA Alerts", type_=3), + _roster(KEY_B, "SC ID AIDA Alerts", type_=3), + ] + + collisions = find_name_collisions(contacts) + + assert len(collisions) == 1 + assert collisions[0]["name"] == "SC ID AIDA Alerts" + assert collisions[0]["count"] == 2 + assert {c["pubkey"] for c in collisions[0]["contacts"]} == {KEY_A, KEY_B} + + def test_distinct_names_are_not_collisions(self): + contacts = [_roster(KEY_A, "SC ID AIDA"), _roster(KEY_B, "SC ID AIDA Alerts")] + + assert find_name_collisions(contacts) == [] + + def test_same_pubkey_twice_is_not_a_collision(self): + contacts = [_roster(KEY_A, "dup"), _roster(KEY_A, "dup")] + + assert find_name_collisions(contacts) == [] + + def test_unnamed_contacts_ignored(self): + contacts = [_roster(KEY_A, None), _roster(KEY_B, None)] + + assert find_name_collisions(contacts) == [] + + def test_empty_roster(self): + assert find_name_collisions([]) == [] + + +# --------------------------------------------------------------------------- +# Part 4: transport — self_info() connection reporting +# --------------------------------------------------------------------------- + +@pytest.fixture +def fake_meshcore(monkeypatch): + """Register a fake ``meshcore`` module for the lazy imports in the transport. + + monkeypatch.setitem (not sys.modules.setdefault) so this wins even when the + real lib — or another test module's fake — is already imported, and is + restored afterwards. + """ + mod = types.ModuleType("meshcore") + + class EventType: + ERROR = "ERROR" + CONTACTS = "CONTACTS" + OK = "OK" + + mod.EventType = EventType + monkeypatch.setitem(sys.modules, "meshcore", mod) + return mod + + +class _Event: + def __init__(self, type_, payload=None): + self.type = type_ + self.payload = payload or {} + + +class _FakeCommands: + """Records calls; returns whatever the test queues up.""" + + def __init__(self): + self.get_contacts_calls = [] + self.removed = [] + self.added = [] + self.get_contacts_result = None + self.remove_result = _Event("OK") + self.add_result = _Event("OK") + + async def get_contacts(self, lastmod=0, timeout=5): + self.get_contacts_calls.append(lastmod) + return self.get_contacts_result + + async def remove_contact(self, key): + self.removed.append(key) + return self.remove_result + + async def add_contact(self, contact): + self.added.append(contact) + return self.add_result + + +class _FakeMC: + def __init__(self, contacts=None): + self._contacts = dict(contacts or {}) + self._contacts_dirty = True + self._lastmod = 500 + self.commands = _FakeCommands() + self.auto_update_contacts = False + + @property + def contacts(self): + return self._contacts + + +def _transport(**cfg_kwargs): + """Build a transport with a fake MC attached and marked connected.""" + from meshai.config import ConnectionConfig + from meshai.transport.meshcore_transport import MeshCoreTransport + + transport = MeshCoreTransport(ConnectionConfig(**cfg_kwargs)) + return transport + + +class TestSelfInfoConnectionReporting: + """self_info() must describe the ACTUAL connection, never a stale config value.""" + + def test_serial_does_not_report_config_host(self): + """The bug: a serial connection reporting a leftover meshcore_host. + + meshcore_host/port are never read on the serial path, so surfacing them + names a device meshai is not talking to — which is what sends an + investigation to the wrong physical radio. + """ + t = _transport( + meshcore_conn_type="serial", + meshcore_serial_port="/dev/meshcore-rak", + meshcore_baud=115200, + # A stale TCP host left in config from a previous companion: + meshcore_host="192.168.1.253", + meshcore_port=5050, + ) + t._mc = _FakeMC() + t._connected = True + t._self_info = {"name": "AIDA", "public_key": KEY_A} + + info = t.self_info() + + assert info["conn_type"] == "serial" + assert info["serial_port"] == "/dev/meshcore-rak" + assert info["baud"] == 115200 + assert info["target"] == "serial:/dev/meshcore-rak@115200" + # The stale host must NOT be surfaced: + assert info["host"] is None + assert info["port"] is None + # Identity still comes from the real device: + assert info["name"] == "AIDA" + assert info["pubkey"] == KEY_A + + def test_tcp_reports_host_and_port(self): + t = _transport( + meshcore_conn_type="tcp", + meshcore_host="100.64.0.9", + meshcore_port=5050, + ) + t._mc = _FakeMC() + t._connected = True + t._self_info = {"name": "TCPNode", "public_key": KEY_B} + + info = t.self_info() + + assert info["conn_type"] == "tcp" + assert info["host"] == "100.64.0.9" + assert info["port"] == 5050 + assert info["target"] == "100.64.0.9:5050" + assert info["serial_port"] is None + assert info["baud"] is None + + def test_ble_reports_address_only(self): + t = _transport( + meshcore_conn_type="ble", + meshcore_ble_address="AA:BB:CC:DD:EE:FF", + meshcore_host="192.168.1.253", + ) + t._mc = _FakeMC() + t._connected = True + t._self_info = {"name": "BleNode", "public_key": KEY_C} + + info = t.self_info() + + assert info["conn_type"] == "ble" + assert info["ble_address"] == "AA:BB:CC:DD:EE:FF" + assert info["target"] == "ble:AA:BB:CC:DD:EE:FF" + assert info["host"] is None + assert info["port"] is None + + def test_not_connected_reports_only_connected_false(self): + t = _transport(meshcore_conn_type="serial", meshcore_serial_port="/dev/x") + + assert t.self_info() == {"connected": False} + + def test_descriptor_matches_connect_log_target(self): + """connect() and self_info() must never disagree about the target.""" + t = _transport( + meshcore_conn_type="serial", + meshcore_serial_port="/dev/meshcore-rak", + meshcore_baud=115200, + ) + t._mc = _FakeMC() + t._connected = True + t._self_info = {} + + assert t.self_info()["target"] == t._connection_descriptor()["target"] + + +# --------------------------------------------------------------------------- +# Part 5: transport — refresh / remove / import against a mocked companion +# --------------------------------------------------------------------------- + +class TestRefreshContactsAsync: + def test_full_refetch_uses_lastmod_zero_and_reconciles(self, fake_meshcore): + """The resync must be FULL (lastmod=0), not the lib's incremental fetch. + + An incremental fetch cannot see a contact whose last_advert predates + _lastmod, and merging its result could never drop the stale KEY_B. + """ + t = _transport(meshcore_conn_type="serial", meshcore_serial_port="/dev/x") + mc = _FakeMC({KEY_A: _contact(KEY_A, "alpha"), KEY_B: _contact(KEY_B, "bravo")}) + mc.commands.get_contacts_result = _Event( + "CONTACTS", {KEY_A: _contact(KEY_A, "alpha"), KEY_C: _contact(KEY_C, "charlie")} + ) + t._mc = mc + t._connected = True + + stats = asyncio.run(t._refresh_contacts_async()) + + assert mc.commands.get_contacts_calls == [0] # FULL, not _lastmod + assert set(mc._contacts) == {KEY_A, KEY_C} # cache replaced in place + assert stats["removed"] == 1 and stats["added"] == 1 + assert t._contacts_synced_at is not None + + def test_payload_rekeyed_by_public_key(self, fake_meshcore): + """The event payload may be keyed by anything; the cache is by pubkey.""" + t = _transport() + mc = _FakeMC() + mc.commands.get_contacts_result = _Event( + "CONTACTS", {"some-other-key": _contact(KEY_A, "alpha")} + ) + t._mc = mc + t._connected = True + + asyncio.run(t._refresh_contacts_async()) + + assert set(mc._contacts) == {KEY_A} + + def test_error_event_leaves_cache_untouched(self, fake_meshcore): + """A failed fetch must never be treated as authoritative — that would + delete the entire roster.""" + t = _transport() + mc = _FakeMC({KEY_A: _contact(KEY_A), KEY_B: _contact(KEY_B)}) + mc.commands.get_contacts_result = _Event("ERROR", {"reason": "timeout"}) + t._mc = mc + t._connected = True + + with pytest.raises(RuntimeError, match="timeout"): + asyncio.run(t._refresh_contacts_async()) + + assert set(mc._contacts) == {KEY_A, KEY_B} # intact + + def test_no_response_raises(self, fake_meshcore): + t = _transport() + mc = _FakeMC({KEY_A: _contact(KEY_A)}) + mc.commands.get_contacts_result = None + t._mc = mc + t._connected = True + + with pytest.raises(RuntimeError, match="no response"): + asyncio.run(t._refresh_contacts_async()) + + assert set(mc._contacts) == {KEY_A} + + def test_cache_object_identity_preserved(self, fake_meshcore): + """The lib mutates _contacts in place; replacing the dict would orphan it.""" + t = _transport() + mc = _FakeMC({KEY_B: _contact(KEY_B)}) + original = mc._contacts + mc.commands.get_contacts_result = _Event("CONTACTS", {KEY_A: _contact(KEY_A)}) + t._mc = mc + t._connected = True + + asyncio.run(t._refresh_contacts_async()) + + assert mc._contacts is original + + +class TestResync: + """resync() must re-read BOTH halves of the connect-time device view. + + Channels are enumerated once at connect (_enumerate_channels) and never + re-read, so a channel provisioned on the radio afterwards stays invisible + until the process restarts — the resync is the only path that picks it up. + """ + + def _transport_with_loop(self): + """A transport whose _run_coro works (real loop, fake device).""" + import threading + + t = _transport(meshcore_conn_type="serial", meshcore_serial_port="/dev/x") + mc = _FakeMC({KEY_A: _contact(KEY_A, "alpha"), KEY_B: _contact(KEY_B, "bravo")}) + mc.commands.get_contacts_result = _Event("CONTACTS", {KEY_A: _contact(KEY_A, "alpha")}) + t._mc = mc + t._connected = True + t._loop = asyncio.new_event_loop() + threading.Thread( + target=lambda: (asyncio.set_event_loop(t._loop), t._loop.run_forever()), + daemon=True, + ).start() + for _ in range(50): + if t._loop.is_running(): + break + __import__("time").sleep(0.02) + return t, mc + + def test_resync_reports_contact_and_channel_deltas(self, fake_meshcore, monkeypatch): + t, mc = self._transport_with_loop() + try: + t._chan_name_to_idx = {"#aida": 1, "#old": 2} + + # Stand in for the companion's channel table on re-enumeration: + # #old is gone, #new appeared. + def fake_enumerate(): + t._chan_name_to_idx = {"#aida": 1, "#new": 3} + + monkeypatch.setattr(t, "_enumerate_channels", fake_enumerate) + + result = t.resync() + + assert result["contacts"]["removed"] == 1 # KEY_B dropped + assert result["channels"]["added"] == ["#new"] + assert result["channels"]["removed"] == ["#old"] + assert result["channels"]["before"] == 2 + assert result["channels"]["after"] == 2 + finally: + t._loop.call_soon_threadsafe(t._loop.stop) + + def test_resync_raises_when_not_connected(self): + with pytest.raises(RuntimeError, match="not connected"): + _transport().resync() + + +class TestRemoveContact: + def test_rejects_prefix_requiring_full_key(self): + """A prefix could match the wrong node — and a wrong delete is permanent.""" + t = _transport() + t._mc = _FakeMC() + t._connected = True + + with pytest.raises(ValueError, match="full 64-character"): + t.remove_contact(KEY_A[:12]) + + def test_rejects_non_hex(self): + t = _transport() + t._mc = _FakeMC() + t._connected = True + + with pytest.raises(ValueError, match="Invalid pubkey hex"): + t.remove_contact("z" * 64) + + def test_raises_when_not_connected(self): + t = _transport() + + with pytest.raises(RuntimeError, match="not connected"): + t.remove_contact(KEY_A) + + +class TestImportContact: + def test_rejects_record_without_full_pubkey(self): + t = _transport() + t._mc = _FakeMC() + t._connected = True + + with pytest.raises(ValueError, match="full 64-character"): + t.import_contact({"pubkey": "abcd", "name": "x"}) + + def test_raises_when_not_connected(self): + t = _transport() + + with pytest.raises(RuntimeError, match="not connected"): + t.import_contact({"pubkey": KEY_A}) + + +class TestExportRoster: + def test_export_carries_importable_fields(self): + """An export missing the update_contact field set cannot be re-imported.""" + t = _transport() + t._mc = _FakeMC({KEY_A: _contact(KEY_A, "alpha", out_path_len=2, out_path="abcd")}) + t._connected = True + + records = t.export_roster() + + assert len(records) == 1 + record = records[0] + for field in ( + "name", "pubkey", "type", "flags", "last_advert", + "adv_lat", "adv_lon", "out_path", "out_path_len", "out_path_hash_mode", + ): + assert field in record + assert record["pubkey"] == KEY_A + assert record["name"] == "alpha" + assert record["path_established"] is True + + def test_export_marks_flood_only_contact(self): + t = _transport() + t._mc = _FakeMC({KEY_A: _contact(KEY_A, "alpha", out_path_len=-1)}) + t._connected = True + + assert t.export_roster()[0]["path_established"] is False + + def test_export_empty_when_not_connected(self): + assert _transport().export_roster() == []