@modelform/react-native 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  ConfigLoader,
9
9
  DASHBOARD_DS,
10
10
  DEFAULT_GAZETTEER,
11
+ DICTATION_TYPES,
11
12
  DOCUMENT_GUIDE,
12
13
  EDITABLE_VARIABLE_TYPES,
13
14
  EXAMPLE_TEMPLATE,
@@ -62,6 +63,7 @@ import {
62
63
  dashboardSourceIds,
63
64
  defaultFetchJson,
64
65
  describeRange,
66
+ dictationHints,
65
67
  diffJson,
66
68
  documentChanges,
67
69
  documentIdFor,
@@ -127,6 +129,7 @@ import {
127
129
  mappingProblem,
128
130
  mappingRow,
129
131
  mappingRows,
132
+ matchChoices,
130
133
  metricChanges,
131
134
  movePanel,
132
135
  newDocument,
@@ -154,6 +157,9 @@ import {
154
157
  parseLocalDateTime,
155
158
  parseRange,
156
159
  parseSnippet,
160
+ parseSpokenDuration,
161
+ parseSpokenNumber,
162
+ parseSpokenYesNo,
157
163
  parseTemplate,
158
164
  parseTime,
159
165
  pasteSnippet,
@@ -202,9 +208,11 @@ import {
202
208
  settleLayout,
203
209
  snapToGrid,
204
210
  splitPath,
211
+ spokenValue,
205
212
  startOf,
206
213
  stringifyCompact,
207
214
  tabIdFor,
215
+ takesDictation,
208
216
  templateNeeds,
209
217
  templatePrompt,
210
218
  textSuggestions,
@@ -234,7 +242,7 @@ import {
234
242
  variableWithType,
235
243
  visibleVariables,
236
244
  zoomRange
237
- } from "./chunk-YUSXYDXG.mjs";
245
+ } from "./chunk-OFXIKI2L.mjs";
238
246
 
239
247
  // src/ui/theme.tsx
240
248
  import { createContext, useContext } from "react";
@@ -586,14 +594,14 @@ function usePanelLinks(panel) {
586
594
  }
587
595
 
588
596
  // src/ui/DashboardView.tsx
589
- import { useCallback as useCallback3, useContext as useContext4, useMemo as useMemo9, useRef as useRef5, useState as useState11 } from "react";
597
+ import { useCallback as useCallback3, useContext as useContext4, useMemo as useMemo9, useRef as useRef6, useState as useState12 } from "react";
590
598
  import {
591
599
  ActivityIndicator,
592
- Pressable as Pressable12,
600
+ Pressable as Pressable13,
593
601
  RefreshControl,
594
602
  ScrollView as ScrollView6,
595
- StyleSheet as StyleSheet14,
596
- Text as Text13,
603
+ StyleSheet as StyleSheet15,
604
+ Text as Text14,
597
605
  View as View13,
598
606
  useWindowDimensions
599
607
  } from "react-native";
@@ -629,12 +637,12 @@ function useInputForm() {
629
637
  }
630
638
 
631
639
  // src/ui/inputs/InputGroup.tsx
632
- import { useMemo as useMemo2, useRef as useRef2, useState as useState6 } from "react";
633
- import { Pressable as Pressable6, ScrollView as ScrollView4, StyleSheet as StyleSheet7, Text as Text7, View as View6 } from "react-native";
640
+ import { useMemo as useMemo2, useRef as useRef3, useState as useState7 } from "react";
641
+ import { Pressable as Pressable7, ScrollView as ScrollView4, StyleSheet as StyleSheet8, Text as Text8, View as View6 } from "react-native";
634
642
 
635
643
  // src/ui/inputs/InputPanels.tsx
636
- import { useEffect as useEffect2, useState as useState5 } from "react";
637
- import { Platform, Pressable as Pressable5, ScrollView as ScrollView3, StyleSheet as StyleSheet6, Switch, Text as Text6, TextInput as TextInput2, View as View5 } from "react-native";
644
+ import { useEffect as useEffect3, useState as useState6 } from "react";
645
+ import { Platform, Pressable as Pressable6, ScrollView as ScrollView3, StyleSheet as StyleSheet7, Switch, Text as Text7, TextInput as TextInput2, View as View5 } from "react-native";
638
646
 
639
647
  // src/ui/Toolbar.tsx
640
648
  import { useState as useState3 } from "react";
@@ -1408,29 +1416,134 @@ var styles5 = StyleSheet5.create({
1408
1416
  tooltipValue: { fontSize: 12, fontWeight: "600", marginLeft: "auto", paddingLeft: 8 }
1409
1417
  });
1410
1418
 
1411
- // src/ui/inputs/InputPanels.tsx
1419
+ // src/ui/inputs/Dictation.tsx
1420
+ import { useEffect as useEffect2, useRef as useRef2, useState as useState5 } from "react";
1421
+ import { Pressable as Pressable5, StyleSheet as StyleSheet6, Text as Text6 } from "react-native";
1422
+ import Svg4, { Path as Path4 } from "react-native-svg";
1412
1423
  import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1424
+ var listening = null;
1425
+ var HINT_MS = 4e3;
1426
+ function useDictation(panel, value, onChange, choices) {
1427
+ const form = useInputForm();
1428
+ const speech = form.speech;
1429
+ const [on, setOn] = useState5(false);
1430
+ const [hint, setHint] = useState5(null);
1431
+ const session = useRef2(null);
1432
+ const latest = useRef2({ value, onChange, choices });
1433
+ useEffect2(() => {
1434
+ latest.current = { value, onChange, choices };
1435
+ });
1436
+ useEffect2(
1437
+ () => () => {
1438
+ session.current?.abort();
1439
+ },
1440
+ []
1441
+ );
1442
+ useEffect2(() => {
1443
+ if (on || !hint) return;
1444
+ const t = setTimeout(() => setHint(null), HINT_MS);
1445
+ return () => clearTimeout(t);
1446
+ }, [on, hint]);
1447
+ const toggle = () => {
1448
+ if (!speech) return;
1449
+ if (session.current) {
1450
+ session.current.stop();
1451
+ return;
1452
+ }
1453
+ listening?.abort();
1454
+ setHint(null);
1455
+ let mine = null;
1456
+ let ended = false;
1457
+ const end = () => {
1458
+ ended = true;
1459
+ if (session.current === mine) session.current = null;
1460
+ if (listening === mine) listening = null;
1461
+ setOn(false);
1462
+ };
1463
+ try {
1464
+ mine = speech.start({
1465
+ lang: form.speechLang,
1466
+ hints: dictationHints(panel, choices),
1467
+ onText(text, final) {
1468
+ if (!final) return setHint(text ? `\u201C${text}\u201D` : null);
1469
+ const result = spokenValue(panel, text, latest.current.value, latest.current.choices);
1470
+ if ("value" in result) {
1471
+ latest.current.onChange(result.value);
1472
+ setHint(null);
1473
+ } else setHint(result.problem);
1474
+ },
1475
+ onError: (message) => setHint(message),
1476
+ onEnd: end
1477
+ });
1478
+ } catch {
1479
+ setHint("Dictation couldn\u2019t start");
1480
+ return;
1481
+ }
1482
+ if (!ended) {
1483
+ session.current = mine;
1484
+ listening = mine;
1485
+ setOn(true);
1486
+ }
1487
+ };
1488
+ return { available: !!speech && takesDictation(panel), listening: on, hint, toggle };
1489
+ }
1490
+ function MicButton({ dictation, title, size = 32 }) {
1491
+ const theme = useDashTheme();
1492
+ if (!dictation.available) return null;
1493
+ const on = dictation.listening;
1494
+ return /* @__PURE__ */ jsx8(
1495
+ Pressable5,
1496
+ {
1497
+ onPress: dictation.toggle,
1498
+ accessibilityRole: "button",
1499
+ accessibilityLabel: on ? "Stop dictating" : title ? `Dictate ${title}` : "Dictate",
1500
+ accessibilityState: { selected: on },
1501
+ hitSlop: 6,
1502
+ style: ({ pressed }) => [
1503
+ styles6.mic,
1504
+ { width: size, height: size, borderRadius: size / 2, borderColor: on ? theme.accent : theme.border },
1505
+ { backgroundColor: on ? theme.accent : pressed ? theme.grid : theme.surface }
1506
+ ],
1507
+ children: /* @__PURE__ */ jsxs6(Svg4, { width: size * 0.55, height: size * 0.55, viewBox: "0 0 24 24", fill: "none", stroke: on ? "#fff" : theme.textSecondary, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [
1508
+ /* @__PURE__ */ jsx8(Path4, { d: "M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z" }),
1509
+ /* @__PURE__ */ jsx8(Path4, { d: "M19 11a7 7 0 0 1-14 0M12 18v3" })
1510
+ ] })
1511
+ }
1512
+ );
1513
+ }
1514
+ function DictationHint({ dictation }) {
1515
+ const theme = useDashTheme();
1516
+ if (!dictation.hint) return null;
1517
+ return /* @__PURE__ */ jsx8(Text6, { style: [styles6.hint, { color: dictation.listening ? theme.textSecondary : theme.textMuted }], numberOfLines: 1, accessibilityLiveRegion: "polite", children: dictation.hint });
1518
+ }
1519
+ var styles6 = StyleSheet6.create({
1520
+ mic: { borderWidth: 1, alignItems: "center", justifyContent: "center" },
1521
+ hint: { fontSize: 12, fontStyle: "italic" }
1522
+ });
1523
+
1524
+ // src/ui/inputs/InputPanels.tsx
1525
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1413
1526
  function InputPanelBody({ panel }) {
1414
1527
  const form = useInputForm();
1415
1528
  const metric = panel.options.metric;
1416
1529
  const props = { panel, value: form.value(metric), onChange: (v) => form.setValue(metric, v) };
1417
1530
  switch (panel.type) {
1418
1531
  case "input-number":
1419
- return /* @__PURE__ */ jsx8(NumberInput, { ...props });
1532
+ return /* @__PURE__ */ jsx9(NumberInput, { ...props });
1420
1533
  case "input-slider":
1421
- return /* @__PURE__ */ jsx8(SliderInput, { ...props });
1534
+ return /* @__PURE__ */ jsx9(SliderInput, { ...props });
1422
1535
  case "input-select":
1423
- return /* @__PURE__ */ jsx8(SelectInput, { ...props });
1536
+ return /* @__PURE__ */ jsx9(SelectInput, { ...props });
1424
1537
  case "input-toggle":
1425
- return /* @__PURE__ */ jsx8(ToggleInput, { ...props });
1538
+ return /* @__PURE__ */ jsx9(ToggleInput, { ...props });
1426
1539
  case "input-rating":
1427
- return /* @__PURE__ */ jsx8(RatingInput, { ...props });
1540
+ return /* @__PURE__ */ jsx9(RatingInput, { ...props });
1428
1541
  case "input-text":
1429
- return panel.options.suggest ? /* @__PURE__ */ jsx8(SuggestTextInput, { ...props }) : /* @__PURE__ */ jsx8(FreeTextInput, { ...props });
1542
+ return panel.options.suggest ? /* @__PURE__ */ jsx9(SuggestTextInput, { ...props }) : /* @__PURE__ */ jsx9(FreeTextInput, { ...props });
1430
1543
  case "input-counter":
1431
- return /* @__PURE__ */ jsx8(CounterInput, { panel });
1544
+ return /* @__PURE__ */ jsx9(CounterInput, { panel });
1432
1545
  case "input-duration":
1433
- return /* @__PURE__ */ jsx8(DurationInput, { ...props });
1546
+ return /* @__PURE__ */ jsx9(DurationInput, { ...props });
1434
1547
  default:
1435
1548
  return null;
1436
1549
  }
@@ -1440,10 +1553,10 @@ var decimalsOf = (step) => (String(step).split(".")[1] ?? "").length;
1440
1553
  function NumberInput({ panel, value, onChange }) {
1441
1554
  const theme = useDashTheme();
1442
1555
  const { step = 1, min, max, unit, placeholder } = panel.options;
1443
- const [text, setText] = useState5(value == null ? "" : String(value));
1556
+ const [text, setText] = useState6(value == null ? "" : String(value));
1444
1557
  const [size, onLayout] = useLayout();
1445
1558
  const compact = size.width > 0 && size.width < COMPACT_NUMBER_WIDTH;
1446
- const [syncedValue, setSyncedValue] = useState5(value);
1559
+ const [syncedValue, setSyncedValue] = useState6(value);
1447
1560
  if (value !== syncedValue) {
1448
1561
  setSyncedValue(value);
1449
1562
  setText((t) => value == null ? "" : Number(t.replace(",", ".")) === value && t.trim() ? t : String(value));
@@ -1456,61 +1569,73 @@ function NumberInput({ panel, value, onChange }) {
1456
1569
  const base = typeof value === "number" ? value : Number(text) || 0;
1457
1570
  onChange(Number(clamp2(base + dir * step).toFixed(decimalsOf(step))));
1458
1571
  };
1459
- return /* @__PURE__ */ jsxs6(View5, { style: [styles6.numberRow, compact && styles6.numberRowCompact], onLayout, children: [
1460
- /* @__PURE__ */ jsx8(StepButton, { label: "\u2212", onPress: () => bump(-1), compact }),
1461
- /* @__PURE__ */ jsxs6(View5, { style: [styles6.numberField, compact && styles6.numberFieldCompact, { borderColor: theme.border }], children: [
1462
- /* @__PURE__ */ jsx8(
1463
- TextInput2,
1464
- {
1465
- value: text,
1466
- onChangeText: (t) => {
1467
- setText(t);
1468
- const n = Number(t.replace(",", "."));
1469
- if (t.trim() && !Number.isNaN(n)) onChange(clamp2(integer ? Math.round(n) : n));
1470
- else if (!t.trim()) onChange(null);
1471
- },
1472
- keyboardType,
1473
- placeholder: placeholder ?? "\u2014",
1474
- placeholderTextColor: theme.textMuted,
1475
- style: [styles6.numberText, compact && styles6.numberTextCompact, { color: theme.text }],
1476
- accessibilityLabel: unit ? `${panel.title} (${unit})` : panel.title,
1477
- selectTextOnFocus: true
1478
- }
1479
- ),
1480
- unit && !compact ? /* @__PURE__ */ jsx8(Text6, { style: [styles6.unit, { color: theme.textMuted }], children: unit }) : null
1572
+ const dictation = useDictation(panel, value, onChange);
1573
+ return /* @__PURE__ */ jsxs7(View5, { style: styles7.dictated, children: [
1574
+ /* @__PURE__ */ jsxs7(View5, { style: [styles7.numberRow, compact && styles7.numberRowCompact], onLayout, children: [
1575
+ /* @__PURE__ */ jsx9(StepButton, { label: "\u2212", onPress: () => bump(-1), compact }),
1576
+ /* @__PURE__ */ jsxs7(View5, { style: [styles7.numberField, compact && styles7.numberFieldCompact, { borderColor: theme.border }], children: [
1577
+ /* @__PURE__ */ jsx9(
1578
+ TextInput2,
1579
+ {
1580
+ value: text,
1581
+ onChangeText: (t) => {
1582
+ setText(t);
1583
+ const n = Number(t.replace(",", "."));
1584
+ if (t.trim() && !Number.isNaN(n)) onChange(clamp2(integer ? Math.round(n) : n));
1585
+ else if (!t.trim()) onChange(null);
1586
+ },
1587
+ keyboardType,
1588
+ placeholder: placeholder ?? "\u2014",
1589
+ placeholderTextColor: theme.textMuted,
1590
+ style: [styles7.numberText, compact && styles7.numberTextCompact, { color: theme.text }],
1591
+ accessibilityLabel: unit ? `${panel.title} (${unit})` : panel.title,
1592
+ selectTextOnFocus: true
1593
+ }
1594
+ ),
1595
+ unit && !compact ? /* @__PURE__ */ jsx9(Text7, { style: [styles7.unit, { color: theme.textMuted }], children: unit }) : null,
1596
+ /* @__PURE__ */ jsx9(MicButton, { dictation, title: panel.title, size: compact ? 24 : 28 })
1597
+ ] }),
1598
+ /* @__PURE__ */ jsx9(StepButton, { label: "+", onPress: () => bump(1), compact })
1481
1599
  ] }),
1482
- /* @__PURE__ */ jsx8(StepButton, { label: "+", onPress: () => bump(1), compact })
1600
+ /* @__PURE__ */ jsx9(DictationHint, { dictation })
1483
1601
  ] });
1484
1602
  }
1485
1603
  function DurationInput({ panel, value, onChange }) {
1486
1604
  const theme = useDashTheme();
1487
1605
  const toDigits = (v) => typeof v === "number" ? formatClock(v).replace(/\D/g, "").replace(/^0+/, "") : "";
1488
- const [digits, setDigits] = useState5(toDigits(value));
1489
- const [syncedValue, setSyncedValue] = useState5(value);
1606
+ const [digits, setDigits] = useState6(toDigits(value));
1607
+ const [syncedValue, setSyncedValue] = useState6(value);
1490
1608
  if (value !== syncedValue) {
1491
1609
  setSyncedValue(value);
1492
1610
  setDigits((d) => value == null ? parseClockDigits(d) == null ? d : "" : parseClockDigits(d) === value ? d : toDigits(value));
1493
1611
  }
1494
1612
  const masked = digits ? maskClock(digits) : "";
1495
1613
  const invalid = !!digits && parseClockDigits(digits) == null;
1496
- return /* @__PURE__ */ jsx8(View5, { style: [styles6.numberField, { borderColor: invalid ? theme.danger : theme.border }], children: /* @__PURE__ */ jsx8(
1497
- TextInput2,
1498
- {
1499
- value: masked,
1500
- onChangeText: (t) => {
1501
- const d = t.replace(/\D/g, "").replace(/^0+/, "").slice(0, 6);
1502
- setDigits(d);
1503
- onChange(parseClockDigits(d));
1504
- },
1505
- keyboardType: "number-pad",
1506
- placeholder: panel.options.placeholder ?? "00:00.00",
1507
- placeholderTextColor: theme.textMuted,
1508
- style: [styles6.numberText, { color: invalid ? theme.danger : theme.text }],
1509
- accessibilityLabel: panel.title,
1510
- accessibilityHint: "Type the digits only, for example 13245 for 1 minute 32.45 seconds",
1511
- selection: { start: masked.length, end: masked.length }
1512
- }
1513
- ) });
1614
+ const dictation = useDictation(panel, value, onChange);
1615
+ return /* @__PURE__ */ jsxs7(View5, { style: styles7.dictated, children: [
1616
+ /* @__PURE__ */ jsxs7(View5, { style: [styles7.numberField, { borderColor: invalid ? theme.danger : theme.border }], children: [
1617
+ /* @__PURE__ */ jsx9(
1618
+ TextInput2,
1619
+ {
1620
+ value: masked,
1621
+ onChangeText: (t) => {
1622
+ const d = t.replace(/\D/g, "").replace(/^0+/, "").slice(0, 6);
1623
+ setDigits(d);
1624
+ onChange(parseClockDigits(d));
1625
+ },
1626
+ keyboardType: "number-pad",
1627
+ placeholder: panel.options.placeholder ?? "00:00.00",
1628
+ placeholderTextColor: theme.textMuted,
1629
+ style: [styles7.numberText, { color: invalid ? theme.danger : theme.text }],
1630
+ accessibilityLabel: panel.title,
1631
+ accessibilityHint: "Type the digits only, for example 13245 for 1 minute 32.45 seconds",
1632
+ selection: { start: masked.length, end: masked.length }
1633
+ }
1634
+ ),
1635
+ /* @__PURE__ */ jsx9(MicButton, { dictation, title: panel.title, size: 28 })
1636
+ ] }),
1637
+ /* @__PURE__ */ jsx9(DictationHint, { dictation })
1638
+ ] });
1514
1639
  }
1515
1640
  function maskClock(digits) {
1516
1641
  const p = digits.slice(-6).padStart(6, "0");
@@ -1518,14 +1643,14 @@ function maskClock(digits) {
1518
1643
  }
1519
1644
  function StepButton({ label, onPress, compact }) {
1520
1645
  const theme = useDashTheme();
1521
- return /* @__PURE__ */ jsx8(
1522
- Pressable5,
1646
+ return /* @__PURE__ */ jsx9(
1647
+ Pressable6,
1523
1648
  {
1524
1649
  onPress,
1525
1650
  accessibilityRole: "button",
1526
1651
  accessibilityLabel: label === "+" ? "Increase" : "Decrease",
1527
- style: ({ pressed }) => [styles6.stepBtn, compact && styles6.stepBtnCompact, { borderColor: theme.border, backgroundColor: pressed ? theme.grid : theme.surface }],
1528
- children: /* @__PURE__ */ jsx8(Text6, { style: [styles6.stepText, { color: theme.text }], children: label })
1652
+ style: ({ pressed }) => [styles7.stepBtn, compact && styles7.stepBtnCompact, { borderColor: theme.border, backgroundColor: pressed ? theme.grid : theme.surface }],
1653
+ children: /* @__PURE__ */ jsx9(Text7, { style: [styles7.stepText, { color: theme.text }], children: label })
1529
1654
  }
1530
1655
  );
1531
1656
  }
@@ -1549,17 +1674,17 @@ function SliderInput({ panel, value, onChange }) {
1549
1674
  const raw = min + Math.min(1, Math.max(0, x / size.width)) * (max - min);
1550
1675
  onChange(Number((Math.round((raw - min) / step) * step + min).toFixed(decimalsOf(step))));
1551
1676
  };
1552
- return /* @__PURE__ */ jsxs6(View5, { style: styles6.sliderWrap, children: [
1553
- /* @__PURE__ */ jsxs6(View5, { style: styles6.sliderLabels, children: [
1554
- !labels?.length && /* @__PURE__ */ jsx8(Text6, { style: [styles6.minmax, { color: theme.textMuted }], children: min }),
1555
- /* @__PURE__ */ jsx8(Text6, { style: [styles6.sliderValue, { color: theme.text }, !!labels?.length && styles6.sliderValueCentered], children: display }),
1556
- !labels?.length && /* @__PURE__ */ jsx8(Text6, { style: [styles6.minmax, { color: theme.textMuted }], children: max })
1677
+ return /* @__PURE__ */ jsxs7(View5, { style: styles7.sliderWrap, children: [
1678
+ /* @__PURE__ */ jsxs7(View5, { style: styles7.sliderLabels, children: [
1679
+ !labels?.length && /* @__PURE__ */ jsx9(Text7, { style: [styles7.minmax, { color: theme.textMuted }], children: min }),
1680
+ /* @__PURE__ */ jsx9(Text7, { style: [styles7.sliderValue, { color: theme.text }, !!labels?.length && styles7.sliderValueCentered], children: display }),
1681
+ !labels?.length && /* @__PURE__ */ jsx9(Text7, { style: [styles7.minmax, { color: theme.textMuted }], children: max })
1557
1682
  ] }),
1558
- /* @__PURE__ */ jsxs6(
1683
+ /* @__PURE__ */ jsxs7(
1559
1684
  View5,
1560
1685
  {
1561
1686
  onLayout,
1562
- style: styles6.sliderHit,
1687
+ style: styles7.sliderHit,
1563
1688
  onStartShouldSetResponder: () => true,
1564
1689
  onMoveShouldSetResponder: () => true,
1565
1690
  onResponderTerminationRequest: () => false,
@@ -1570,29 +1695,29 @@ function SliderInput({ panel, value, onChange }) {
1570
1695
  accessibilityActions: [{ name: "increment" }, { name: "decrement" }],
1571
1696
  onAccessibilityAction: (e) => onChange(Math.min(max, Math.max(min, (v ?? min) + (e.nativeEvent.actionName === "increment" ? step : -step)))),
1572
1697
  children: [
1573
- /* @__PURE__ */ jsx8(View5, { pointerEvents: "none", style: [styles6.track, { backgroundColor: theme.grid }], children: /* @__PURE__ */ jsx8(
1698
+ /* @__PURE__ */ jsx9(View5, { pointerEvents: "none", style: [styles7.track, { backgroundColor: theme.grid }], children: /* @__PURE__ */ jsx9(
1574
1699
  View5,
1575
1700
  {
1576
1701
  style: [
1577
- styles6.trackFill,
1702
+ styles7.trackFill,
1578
1703
  { left: `${fillStart * 100}%`, width: `${v == null ? 0 : Math.abs(frac - origin) * 100}%`, backgroundColor: theme.accent }
1579
1704
  ]
1580
1705
  }
1581
1706
  ) }),
1582
- v != null && /* @__PURE__ */ jsx8(
1707
+ v != null && /* @__PURE__ */ jsx9(
1583
1708
  View5,
1584
1709
  {
1585
1710
  pointerEvents: "none",
1586
- style: [styles6.thumb, { left: frac * size.width - 11, backgroundColor: theme.accent, borderColor: theme.surface }]
1711
+ style: [styles7.thumb, { left: frac * size.width - 11, backgroundColor: theme.accent, borderColor: theme.surface }]
1587
1712
  }
1588
1713
  )
1589
1714
  ]
1590
1715
  }
1591
1716
  ),
1592
- !!labels?.length && /* @__PURE__ */ jsx8(View5, { style: styles6.tickRow, children: labels.map((l, i) => {
1717
+ !!labels?.length && /* @__PURE__ */ jsx9(View5, { style: styles7.tickRow, children: labels.map((l, i) => {
1593
1718
  const last = labels.length - 1;
1594
- const edge = i === 0 ? styles6.tickStart : i === last ? styles6.tickEnd : { left: `${i / last * 100}%` };
1595
- return /* @__PURE__ */ jsx8(Text6, { style: [styles6.minmax, styles6.tick, edge, { color: theme.textMuted }], numberOfLines: 1, children: l }, i);
1719
+ const edge = i === 0 ? styles7.tickStart : i === last ? styles7.tickEnd : { left: `${i / last * 100}%` };
1720
+ return /* @__PURE__ */ jsx9(Text7, { style: [styles7.minmax, styles7.tick, edge, { color: theme.textMuted }], numberOfLines: 1, children: l }, i);
1596
1721
  }) })
1597
1722
  ] });
1598
1723
  }
@@ -1602,29 +1727,36 @@ function SelectInput({ panel, value, onChange }) {
1602
1727
  const { choicesFrom, multi, placeholder } = panel.options;
1603
1728
  const choices = (choicesFrom ? form.choices[choicesFrom] : panel.options.choices) ?? [];
1604
1729
  const selected = Array.isArray(value) ? value : value == null ? [] : [value];
1605
- if (!choices.length && placeholder) return /* @__PURE__ */ jsx8(Text6, { style: { color: theme.textMuted }, children: placeholder });
1606
- return /* @__PURE__ */ jsx8(View5, { style: styles6.wrap, children: choices.map((c) => {
1607
- const on = selected.includes(c.value);
1608
- return /* @__PURE__ */ jsx8(
1609
- Chip,
1610
- {
1611
- label: c.label,
1612
- selected: on,
1613
- onPress: () => {
1614
- if (!multi) return onChange(on ? null : c.value);
1615
- const next = on ? selected.filter((s) => s !== c.value) : [...selected, c.value];
1616
- onChange(next.length ? next : null);
1617
- }
1618
- },
1619
- String(c.value)
1620
- );
1621
- }) });
1730
+ const dictation = useDictation(panel, value, onChange, choices);
1731
+ if (!choices.length && placeholder) return /* @__PURE__ */ jsx9(Text7, { style: { color: theme.textMuted }, children: placeholder });
1732
+ return /* @__PURE__ */ jsxs7(View5, { style: styles7.selectWrap, children: [
1733
+ /* @__PURE__ */ jsxs7(View5, { style: styles7.wrap, children: [
1734
+ choices.map((c) => {
1735
+ const on = selected.includes(c.value);
1736
+ return /* @__PURE__ */ jsx9(
1737
+ Chip,
1738
+ {
1739
+ label: c.label,
1740
+ selected: on,
1741
+ onPress: () => {
1742
+ if (!multi) return onChange(on ? null : c.value);
1743
+ const next = on ? selected.filter((s) => s !== c.value) : [...selected, c.value];
1744
+ onChange(next.length ? next : null);
1745
+ }
1746
+ },
1747
+ String(c.value)
1748
+ );
1749
+ }),
1750
+ choices.length > 0 && /* @__PURE__ */ jsx9(MicButton, { dictation, title: panel.title })
1751
+ ] }),
1752
+ /* @__PURE__ */ jsx9(DictationHint, { dictation })
1753
+ ] });
1622
1754
  }
1623
1755
  function ToggleInput({ panel, value, onChange }) {
1624
1756
  const theme = useDashTheme();
1625
- return /* @__PURE__ */ jsxs6(View5, { style: styles6.toggleRow, children: [
1626
- /* @__PURE__ */ jsx8(Text6, { style: { color: theme.textSecondary, flex: 1 }, children: value == null ? "Not set" : value ? "Yes" : "No" }),
1627
- /* @__PURE__ */ jsx8(Switch, { value: !!value, onValueChange: (v) => onChange(v), trackColor: { true: theme.accent }, accessibilityLabel: panel.title })
1757
+ return /* @__PURE__ */ jsxs7(View5, { style: styles7.toggleRow, children: [
1758
+ /* @__PURE__ */ jsx9(Text7, { style: { color: theme.textSecondary, flex: 1 }, children: value == null ? "Not set" : value ? "Yes" : "No" }),
1759
+ /* @__PURE__ */ jsx9(Switch, { value: !!value, onValueChange: (v) => onChange(v), trackColor: { true: theme.accent }, accessibilityLabel: panel.title })
1628
1760
  ] });
1629
1761
  }
1630
1762
  var MAX_RATING_LEVELS = 10;
@@ -1633,17 +1765,17 @@ function RatingInput({ panel, value, onChange }) {
1633
1765
  const min = Math.round(panel.options.min ?? 1);
1634
1766
  const max = Math.round(panel.options.max ?? 5);
1635
1767
  const levels = Array.from({ length: Math.min(Math.max(0, max - min + 1), MAX_RATING_LEVELS) }, (_, i) => min + i);
1636
- return /* @__PURE__ */ jsx8(View5, { style: styles6.rating, children: levels.map((n) => {
1768
+ return /* @__PURE__ */ jsx9(View5, { style: styles7.rating, children: levels.map((n) => {
1637
1769
  const on = typeof value === "number" && n <= value;
1638
- return /* @__PURE__ */ jsx8(
1639
- Pressable5,
1770
+ return /* @__PURE__ */ jsx9(
1771
+ Pressable6,
1640
1772
  {
1641
1773
  onPress: () => onChange(value === n ? null : n),
1642
1774
  accessibilityRole: "button",
1643
1775
  accessibilityLabel: `${n} of ${max}`,
1644
1776
  accessibilityState: { selected: value === n },
1645
- style: [styles6.ratingDot, { borderColor: on ? theme.accent : theme.border, backgroundColor: on ? theme.accent : theme.surface }],
1646
- children: /* @__PURE__ */ jsx8(Text6, { style: { color: on ? "#fff" : theme.textSecondary, fontWeight: "600" }, children: n })
1777
+ style: [styles7.ratingDot, { borderColor: on ? theme.accent : theme.border, backgroundColor: on ? theme.accent : theme.surface }],
1778
+ children: /* @__PURE__ */ jsx9(Text7, { style: { color: on ? "#fff" : theme.textSecondary, fontWeight: "600" }, children: n })
1647
1779
  },
1648
1780
  n
1649
1781
  );
@@ -1651,27 +1783,35 @@ function RatingInput({ panel, value, onChange }) {
1651
1783
  }
1652
1784
  function FreeTextInput({ panel, value, onChange }) {
1653
1785
  const theme = useDashTheme();
1654
- return /* @__PURE__ */ jsx8(
1655
- TextInput2,
1656
- {
1657
- value: typeof value === "string" ? value : "",
1658
- onChangeText: (t) => onChange(t || null),
1659
- placeholder: panel.options.placeholder ?? "Type here",
1660
- placeholderTextColor: theme.textMuted,
1661
- multiline: true,
1662
- style: [styles6.textArea, { color: theme.text, borderColor: theme.border }]
1663
- }
1664
- );
1786
+ const dictation = useDictation(panel, value, onChange);
1787
+ return /* @__PURE__ */ jsxs7(View5, { style: styles7.dictated, children: [
1788
+ /* @__PURE__ */ jsxs7(View5, { style: styles7.fill, children: [
1789
+ /* @__PURE__ */ jsx9(
1790
+ TextInput2,
1791
+ {
1792
+ value: typeof value === "string" ? value : "",
1793
+ onChangeText: (t) => onChange(t || null),
1794
+ placeholder: panel.options.placeholder ?? "Type here",
1795
+ placeholderTextColor: theme.textMuted,
1796
+ multiline: true,
1797
+ accessibilityLabel: panel.title,
1798
+ style: [styles7.textArea, dictation.available && styles7.textAreaWithMic, { color: theme.text, borderColor: theme.border }]
1799
+ }
1800
+ ),
1801
+ dictation.available && /* @__PURE__ */ jsx9(View5, { style: styles7.textAreaMic, children: /* @__PURE__ */ jsx9(MicButton, { dictation, title: panel.title, size: 28 }) })
1802
+ ] }),
1803
+ /* @__PURE__ */ jsx9(DictationHint, { dictation })
1804
+ ] });
1665
1805
  }
1666
1806
  function SuggestTextInput({ panel, value, onChange }) {
1667
1807
  const theme = useDashTheme();
1668
1808
  const form = useInputForm();
1669
1809
  const { metric, suggestWith, placeholder } = panel.options;
1670
- const [entries, setEntries] = useState5([]);
1671
- const [typed, setTyped] = useState5(false);
1810
+ const [entries, setEntries] = useState6([]);
1811
+ const [typed, setTyped] = useState6(false);
1672
1812
  const text = typeof value === "string" ? value : "";
1673
1813
  const { store } = form;
1674
- useEffect2(() => {
1814
+ useEffect3(() => {
1675
1815
  let run = 0;
1676
1816
  const load = () => {
1677
1817
  const mine = ++run;
@@ -1690,26 +1830,34 @@ function SuggestTextInput({ panel, value, onChange }) {
1690
1830
  const query = typed ? text : "";
1691
1831
  const fromScoped = textSuggestions(scoped, query);
1692
1832
  const suggestions = (fromScoped.length ? fromScoped : textSuggestions(own, query)).filter((s) => s.toLowerCase() !== text.trim().toLowerCase());
1693
- return /* @__PURE__ */ jsxs6(View5, { style: styles6.suggest, children: [
1694
- /* @__PURE__ */ jsx8(
1695
- TextInput2,
1696
- {
1697
- value: text,
1698
- onChangeText: (t) => {
1699
- setTyped(!!t);
1700
- onChange(t || null);
1701
- },
1702
- placeholder: placeholder ?? "Type here",
1703
- placeholderTextColor: theme.textMuted,
1704
- style: [styles6.textLine, { color: theme.text, borderColor: theme.border }],
1705
- accessibilityLabel: panel.title,
1706
- autoCorrect: false,
1707
- autoCapitalize: "words",
1708
- returnKeyType: "done",
1709
- selectTextOnFocus: true
1710
- }
1711
- ),
1712
- /* @__PURE__ */ jsx8(ScrollView3, { horizontal: true, keyboardShouldPersistTaps: "handled", showsHorizontalScrollIndicator: false, contentContainerStyle: styles6.wrap, children: suggestions.map((s) => /* @__PURE__ */ jsx8(
1833
+ const dictation = useDictation(panel, value, (v) => {
1834
+ setTyped(false);
1835
+ onChange(v);
1836
+ });
1837
+ return /* @__PURE__ */ jsxs7(View5, { style: styles7.suggest, children: [
1838
+ /* @__PURE__ */ jsxs7(View5, { style: styles7.lineRow, children: [
1839
+ /* @__PURE__ */ jsx9(
1840
+ TextInput2,
1841
+ {
1842
+ value: text,
1843
+ onChangeText: (t) => {
1844
+ setTyped(!!t);
1845
+ onChange(t || null);
1846
+ },
1847
+ placeholder: placeholder ?? "Type here",
1848
+ placeholderTextColor: theme.textMuted,
1849
+ style: [styles7.textLine, { color: theme.text, borderColor: theme.border }],
1850
+ accessibilityLabel: panel.title,
1851
+ autoCorrect: false,
1852
+ autoCapitalize: "words",
1853
+ returnKeyType: "done",
1854
+ selectTextOnFocus: true
1855
+ }
1856
+ ),
1857
+ /* @__PURE__ */ jsx9(MicButton, { dictation, title: panel.title })
1858
+ ] }),
1859
+ /* @__PURE__ */ jsx9(DictationHint, { dictation }),
1860
+ /* @__PURE__ */ jsx9(ScrollView3, { horizontal: true, keyboardShouldPersistTaps: "handled", showsHorizontalScrollIndicator: false, contentContainerStyle: styles7.wrap, children: suggestions.map((s) => /* @__PURE__ */ jsx9(
1713
1861
  Chip,
1714
1862
  {
1715
1863
  label: s,
@@ -1726,28 +1874,28 @@ function CounterInput({ panel }) {
1726
1874
  const theme = useDashTheme();
1727
1875
  const { store } = useInputForm();
1728
1876
  const { metric, increment = 1, unit } = panel.options;
1729
- const [today, setToday] = useState5(0);
1730
- useEffect2(() => {
1877
+ const [today, setToday] = useState6(0);
1878
+ useEffect3(() => {
1731
1879
  const load = () => store.list({ metrics: [metric], from: startOf(/* @__PURE__ */ new Date(), "d").getTime() }).then((rows) => setToday(rows.reduce((a, e) => a + (e.value ?? 0), 0)));
1732
1880
  load();
1733
1881
  return store.subscribe(load);
1734
1882
  }, [store, metric]);
1735
- return /* @__PURE__ */ jsxs6(View5, { style: styles6.counter, children: [
1736
- /* @__PURE__ */ jsxs6(View5, { style: { flex: 1 }, children: [
1737
- /* @__PURE__ */ jsxs6(Text6, { style: [styles6.counterValue, { color: theme.text }], children: [
1883
+ return /* @__PURE__ */ jsxs7(View5, { style: styles7.counter, children: [
1884
+ /* @__PURE__ */ jsxs7(View5, { style: { flex: 1 }, children: [
1885
+ /* @__PURE__ */ jsxs7(Text7, { style: [styles7.counterValue, { color: theme.text }], children: [
1738
1886
  today,
1739
- unit ? /* @__PURE__ */ jsx8(Text6, { style: { fontSize: 14, color: theme.textMuted }, children: ` ${unit}` }) : null
1887
+ unit ? /* @__PURE__ */ jsx9(Text7, { style: { fontSize: 14, color: theme.textMuted }, children: ` ${unit}` }) : null
1740
1888
  ] }),
1741
- /* @__PURE__ */ jsx8(Text6, { style: { color: theme.textMuted, fontSize: 12 }, children: "today" })
1889
+ /* @__PURE__ */ jsx9(Text7, { style: { color: theme.textMuted, fontSize: 12 }, children: "today" })
1742
1890
  ] }),
1743
- /* @__PURE__ */ jsx8(
1744
- Pressable5,
1891
+ /* @__PURE__ */ jsx9(
1892
+ Pressable6,
1745
1893
  {
1746
1894
  onPress: () => store.add([{ metric, ts: Date.now(), value: increment, text: null }]),
1747
1895
  accessibilityRole: "button",
1748
1896
  accessibilityLabel: `Add ${increment}`,
1749
- style: ({ pressed }) => [styles6.counterBtn, { backgroundColor: theme.accent, opacity: pressed ? 0.8 : 1 }],
1750
- children: /* @__PURE__ */ jsxs6(Text6, { style: styles6.counterBtnText, children: [
1897
+ style: ({ pressed }) => [styles7.counterBtn, { backgroundColor: theme.accent, opacity: pressed ? 0.8 : 1 }],
1898
+ children: /* @__PURE__ */ jsxs7(Text7, { style: styles7.counterBtnText, children: [
1751
1899
  "+",
1752
1900
  increment
1753
1901
  ] })
@@ -1755,7 +1903,13 @@ function CounterInput({ panel }) {
1755
1903
  )
1756
1904
  ] });
1757
1905
  }
1758
- var styles6 = StyleSheet6.create({
1906
+ var styles7 = StyleSheet7.create({
1907
+ fill: { flex: 1 },
1908
+ dictated: { flex: 1, gap: 4 },
1909
+ selectWrap: { gap: 4 },
1910
+ lineRow: { flexDirection: "row", alignItems: "center", gap: 8 },
1911
+ textAreaWithMic: { paddingRight: 44 },
1912
+ textAreaMic: { position: "absolute", top: 8, right: 8 },
1759
1913
  numberRow: { flex: 1, flexDirection: "row", alignItems: "center", gap: 8 },
1760
1914
  numberField: { flex: 1, flexDirection: "row", alignItems: "center", borderWidth: 1, borderRadius: 8, paddingHorizontal: 10, height: 44 },
1761
1915
  // Android gives TextInput default padding that eats into narrow fields.
@@ -1786,7 +1940,7 @@ var styles6 = StyleSheet6.create({
1786
1940
  rating: { flex: 1, flexDirection: "row", alignItems: "center", justifyContent: "space-between", gap: 6 },
1787
1941
  ratingDot: { flex: 1, maxWidth: 52, aspectRatio: 1, borderRadius: 26, borderWidth: 1, alignItems: "center", justifyContent: "center" },
1788
1942
  suggest: { flex: 1, gap: 8 },
1789
- textLine: { height: 44, borderWidth: 1, borderRadius: 8, paddingHorizontal: 10, paddingVertical: 0, fontSize: 16 },
1943
+ textLine: { flex: 1, height: 44, borderWidth: 1, borderRadius: 8, paddingHorizontal: 10, paddingVertical: 0, fontSize: 16 },
1790
1944
  textArea: { flex: 1, borderWidth: 1, borderRadius: 8, padding: 10, fontSize: 15, textAlignVertical: "top" },
1791
1945
  counter: { flex: 1, flexDirection: "row", alignItems: "center", gap: 12 },
1792
1946
  counterValue: { fontSize: 28, fontWeight: "600", fontVariant: ["tabular-nums"] },
@@ -1795,7 +1949,7 @@ var styles6 = StyleSheet6.create({
1795
1949
  });
1796
1950
 
1797
1951
  // src/ui/inputs/InputGroup.tsx
1798
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1952
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1799
1953
  function titleText(v) {
1800
1954
  if (v == null || v === "") return void 0;
1801
1955
  if (Array.isArray(v)) return v.length ? v.join(", ") : void 0;
@@ -1824,11 +1978,11 @@ function InputGroupBody({ panel }) {
1824
1978
  const theme = useDashTheme();
1825
1979
  const form = useInputForm();
1826
1980
  const group = form.group?.(panel);
1827
- const [collapsed, setCollapsed] = useState6(/* @__PURE__ */ new Set());
1828
- const [drag, setDrag] = useState6(null);
1829
- const [heights, setHeights] = useState6({});
1830
- const dragging = useRef2(null);
1831
- const [wasEdited, setWasEdited] = useState6(group?.edited);
1981
+ const [collapsed, setCollapsed] = useState7(/* @__PURE__ */ new Set());
1982
+ const [drag, setDrag] = useState7(null);
1983
+ const [heights, setHeights] = useState7({});
1984
+ const dragging = useRef3(null);
1985
+ const [wasEdited, setWasEdited] = useState7(group?.edited);
1832
1986
  if (group && group.edited !== wasEdited) {
1833
1987
  setWasEdited(group.edited);
1834
1988
  if (!group.edited) setCollapsed(/* @__PURE__ */ new Set());
@@ -1869,12 +2023,12 @@ function InputGroupBody({ panel }) {
1869
2023
  if (to <= i && i < drag.from) return room;
1870
2024
  return 0;
1871
2025
  };
1872
- return /* @__PURE__ */ jsxs7(ScrollView4, { style: styles7.fill, contentContainerStyle: styles7.list, nestedScrollEnabled: true, keyboardShouldPersistTaps: "handled", scrollEnabled: !drag, children: [
2026
+ return /* @__PURE__ */ jsxs8(ScrollView4, { style: styles8.fill, contentContainerStyle: styles8.list, nestedScrollEnabled: true, keyboardShouldPersistTaps: "handled", scrollEnabled: !drag, children: [
1873
2027
  group.items.map((item, i) => {
1874
2028
  const named = panel.options.titleFrom ? titleText(item.values[panel.options.titleFrom]) : void 0;
1875
2029
  const title = named ?? `${label} ${i + 1}`;
1876
2030
  const troubled = groupFields(panel).some((f) => group.fieldProblem(i, f.options.metric));
1877
- return /* @__PURE__ */ jsx9(
2031
+ return /* @__PURE__ */ jsx10(
1878
2032
  ItemCard,
1879
2033
  {
1880
2034
  panel,
@@ -1905,16 +2059,16 @@ function InputGroupBody({ panel }) {
1905
2059
  item.key
1906
2060
  );
1907
2061
  }),
1908
- group.canAdd && /* @__PURE__ */ jsx9(
1909
- Pressable6,
2062
+ group.canAdd && /* @__PURE__ */ jsx10(
2063
+ Pressable7,
1910
2064
  {
1911
2065
  onPress: () => {
1912
2066
  collapseFilled();
1913
2067
  group.add();
1914
2068
  },
1915
2069
  accessibilityRole: "button",
1916
- style: ({ pressed }) => [styles7.add, { borderColor: theme.accent, opacity: pressed ? 0.7 : 1 }],
1917
- children: /* @__PURE__ */ jsxs7(Text7, { style: { color: theme.accent, fontWeight: "600" }, children: [
2070
+ style: ({ pressed }) => [styles8.add, { borderColor: theme.accent, opacity: pressed ? 0.7 : 1 }],
2071
+ children: /* @__PURE__ */ jsxs8(Text8, { style: { color: theme.accent, fontWeight: "600" }, children: [
1918
2072
  "+ ",
1919
2073
  panel.options.addLabel || `Add ${label.toLowerCase()}`
1920
2074
  ] })
@@ -1936,59 +2090,59 @@ function ItemCard({ panel, group, form, index, title, last, collapsed, onToggle,
1936
2090
  }),
1937
2091
  [form, group, index, item]
1938
2092
  );
1939
- const button = (text, onPress, a11y, disabled = false) => /* @__PURE__ */ jsx9(
1940
- Pressable6,
2093
+ const button = (text, onPress, a11y, disabled = false) => /* @__PURE__ */ jsx10(
2094
+ Pressable7,
1941
2095
  {
1942
2096
  onPress,
1943
2097
  disabled,
1944
2098
  accessibilityRole: "button",
1945
2099
  accessibilityLabel: a11y,
1946
2100
  hitSlop: 6,
1947
- style: ({ pressed }) => [styles7.iconBtn, { opacity: disabled ? 0.3 : pressed ? 0.6 : 1 }],
1948
- children: /* @__PURE__ */ jsx9(Text7, { style: { color: theme.textSecondary, fontSize: 15 }, children: text })
2101
+ style: ({ pressed }) => [styles8.iconBtn, { opacity: disabled ? 0.3 : pressed ? 0.6 : 1 }],
2102
+ children: /* @__PURE__ */ jsx10(Text8, { style: { color: theme.textSecondary, fontSize: 15 }, children: text })
1949
2103
  }
1950
2104
  );
1951
2105
  const summary = collapsed ? fields.filter((f) => f.options.metric !== panel.options.titleFrom).map((f) => summaryText(f, item.values[f.options.metric])).filter(Boolean).join(" \xB7 ") : "";
1952
- return /* @__PURE__ */ jsxs7(
2106
+ return /* @__PURE__ */ jsxs8(
1953
2107
  View6,
1954
2108
  {
1955
2109
  onLayout: (e) => onLayout(e.nativeEvent.layout.height),
1956
2110
  style: [
1957
- styles7.item,
2111
+ styles8.item,
1958
2112
  { borderColor: lifted ? theme.accent : theme.border, backgroundColor: theme.surface },
1959
2113
  !!dragOffset && { transform: [{ translateY: dragOffset }] },
1960
2114
  lifted && { zIndex: 1, opacity: 0.95 }
1961
2115
  ],
1962
2116
  children: [
1963
- /* @__PURE__ */ jsxs7(View6, { style: styles7.itemHeader, children: [
1964
- /* @__PURE__ */ jsx9(View6, { ...handle, style: styles7.handle, accessibilityLabel: `Drag ${title} to reorder`, children: /* @__PURE__ */ jsx9(Text7, { style: { color: theme.textMuted, fontSize: 16 }, children: "\u2261" }) }),
1965
- /* @__PURE__ */ jsxs7(Pressable6, { onPress: onToggle, style: styles7.titleArea, accessibilityRole: "button", accessibilityLabel: `${collapsed ? "Expand" : "Collapse"} ${title}`, accessibilityState: { expanded: !collapsed }, children: [
1966
- /* @__PURE__ */ jsxs7(Text7, { style: [styles7.itemTitle, { color: theme.text }], numberOfLines: 1, children: [
2117
+ /* @__PURE__ */ jsxs8(View6, { style: styles8.itemHeader, children: [
2118
+ /* @__PURE__ */ jsx10(View6, { ...handle, style: styles8.handle, accessibilityLabel: `Drag ${title} to reorder`, children: /* @__PURE__ */ jsx10(Text8, { style: { color: theme.textMuted, fontSize: 16 }, children: "\u2261" }) }),
2119
+ /* @__PURE__ */ jsxs8(Pressable7, { onPress: onToggle, style: styles8.titleArea, accessibilityRole: "button", accessibilityLabel: `${collapsed ? "Expand" : "Collapse"} ${title}`, accessibilityState: { expanded: !collapsed }, children: [
2120
+ /* @__PURE__ */ jsxs8(Text8, { style: [styles8.itemTitle, { color: theme.text }], numberOfLines: 1, children: [
1967
2121
  collapsed ? "\u25B8 " : "\u25BE ",
1968
2122
  title
1969
2123
  ] }),
1970
- !!summary && /* @__PURE__ */ jsx9(Text7, { style: [styles7.summary, { color: theme.textSecondary }], numberOfLines: 1, children: summary })
2124
+ !!summary && /* @__PURE__ */ jsx10(Text8, { style: [styles8.summary, { color: theme.textSecondary }], numberOfLines: 1, children: summary })
1971
2125
  ] }),
1972
2126
  button("\u2191", () => group.move(index, -1), `Move ${title} up`, index === 0),
1973
2127
  button("\u2193", () => group.move(index, 1), `Move ${title} down`, last),
1974
2128
  button("\u29C9", onDuplicate, `Duplicate ${title}`, !group.canAdd),
1975
2129
  button("\u2715", () => group.remove(index), `Remove ${title}`)
1976
2130
  ] }),
1977
- !collapsed && /* @__PURE__ */ jsx9(InputFormContext.Provider, { value: scoped, children: /* @__PURE__ */ jsx9(View6, { style: styles7.fields, children: fields.map((f) => {
2131
+ !collapsed && /* @__PURE__ */ jsx10(InputFormContext.Provider, { value: scoped, children: /* @__PURE__ */ jsx10(View6, { style: styles8.fields, children: fields.map((f) => {
1978
2132
  const problem = scoped.problem?.(f.options.metric);
1979
- return /* @__PURE__ */ jsxs7(View6, { style: [styles7.field, { width: `${Math.min(24, Math.max(1, f.gridPos.w)) / 24 * 100}%` }], children: [
1980
- /* @__PURE__ */ jsxs7(View6, { style: styles7.fieldHeader, children: [
1981
- !!f.title && /* @__PURE__ */ jsx9(Text7, { style: [styles7.fieldTitle, { color: theme.textSecondary }], numberOfLines: 1, children: f.title }),
1982
- !!problem && /* @__PURE__ */ jsx9(Text7, { style: [styles7.problem, { color: theme.danger }], numberOfLines: 1, accessibilityRole: "alert", children: problem })
2133
+ return /* @__PURE__ */ jsxs8(View6, { style: [styles8.field, { width: `${Math.min(24, Math.max(1, f.gridPos.w)) / 24 * 100}%` }], children: [
2134
+ /* @__PURE__ */ jsxs8(View6, { style: styles8.fieldHeader, children: [
2135
+ !!f.title && /* @__PURE__ */ jsx10(Text8, { style: [styles8.fieldTitle, { color: theme.textSecondary }], numberOfLines: 1, children: f.title }),
2136
+ !!problem && /* @__PURE__ */ jsx10(Text8, { style: [styles8.problem, { color: theme.danger }], numberOfLines: 1, accessibilityRole: "alert", children: problem })
1983
2137
  ] }),
1984
- /* @__PURE__ */ jsx9(View6, { style: styles7.fieldBody, children: /* @__PURE__ */ jsx9(InputPanelBody, { panel: f }) })
2138
+ /* @__PURE__ */ jsx10(View6, { style: styles8.fieldBody, children: /* @__PURE__ */ jsx10(InputPanelBody, { panel: f }) })
1985
2139
  ] }, f.options.metric);
1986
2140
  }) }) })
1987
2141
  ]
1988
2142
  }
1989
2143
  );
1990
2144
  }
1991
- var styles7 = StyleSheet7.create({
2145
+ var styles8 = StyleSheet8.create({
1992
2146
  fill: { flex: 1 },
1993
2147
  list: { gap: 8, paddingBottom: 4 },
1994
2148
  item: { borderWidth: 1, borderRadius: 8, padding: 8, gap: 6 },
@@ -2010,20 +2164,20 @@ var styles7 = StyleSheet7.create({
2010
2164
 
2011
2165
  // src/ui/panels/GaugePanels.tsx
2012
2166
  import { useMemo as useMemo4 } from "react";
2013
- import { Pressable as Pressable8, StyleSheet as StyleSheet9, Text as Text9, View as View8 } from "react-native";
2014
- import Svg5, { Path as Path5 } from "react-native-svg";
2167
+ import { Pressable as Pressable9, StyleSheet as StyleSheet10, Text as Text10, View as View8 } from "react-native";
2168
+ import Svg6, { Path as Path6 } from "react-native-svg";
2015
2169
 
2016
2170
  // src/ui/panels/StatPanel.tsx
2017
2171
  import { useMemo as useMemo3 } from "react";
2018
- import { Pressable as Pressable7, StyleSheet as StyleSheet8, Text as Text8, View as View7 } from "react-native";
2019
- import Svg4, { Path as Path4 } from "react-native-svg";
2020
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2172
+ import { Pressable as Pressable8, StyleSheet as StyleSheet9, Text as Text9, View as View7 } from "react-native";
2173
+ import Svg5, { Path as Path5 } from "react-native-svg";
2174
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2021
2175
  function StatPanel({ panel, frames }) {
2022
2176
  const theme = useDashTheme();
2023
2177
  const values = useMemo3(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
2024
- if (!values.length) return /* @__PURE__ */ jsx10(NoData, {});
2178
+ if (!values.length) return /* @__PURE__ */ jsx11(NoData, {});
2025
2179
  const horizontal = panel.options?.orientation === "horizontal";
2026
- return /* @__PURE__ */ jsx10(View7, { style: [styles8.grid, { flexDirection: horizontal ? "column" : "row" }], children: values.map((v) => /* @__PURE__ */ jsx10(StatTile, { v, showName: values.length > 1, panel }, v.key)) });
2180
+ return /* @__PURE__ */ jsx11(View7, { style: [styles9.grid, { flexDirection: horizontal ? "column" : "row" }], children: values.map((v) => /* @__PURE__ */ jsx11(StatTile, { v, showName: values.length > 1, panel }, v.key)) });
2027
2181
  }
2028
2182
  function StatTile({ v, showName, panel }) {
2029
2183
  const theme = useDashTheme();
@@ -2033,25 +2187,25 @@ function StatTile({ v, showName, panel }) {
2033
2187
  const fontSize = Math.max(18, Math.min(56, size.height * (graph ? 0.4 : 0.5), size.width / 4.5));
2034
2188
  const { resolve, openLinks } = usePanelLinks(panel);
2035
2189
  const hasLinks = !!v.config.links?.length;
2036
- return /* @__PURE__ */ jsxs8(
2037
- Pressable7,
2190
+ return /* @__PURE__ */ jsxs9(
2191
+ Pressable8,
2038
2192
  {
2039
2193
  onLayout,
2040
2194
  disabled: !hasLinks,
2041
2195
  onPress: () => openLinks(valueLinks(panel, v, resolve), v.name),
2042
2196
  accessibilityRole: hasLinks ? "link" : void 0,
2043
2197
  style: ({ pressed }) => [
2044
- styles8.tile,
2198
+ styles9.tile,
2045
2199
  // With a sparkline, the number sits in the top half so the line runs beneath it.
2046
2200
  graph && { justifyContent: "flex-start", paddingTop: 4 },
2047
2201
  colorMode === "background" && { backgroundColor: withAlpha(v.stateColor, 0.14) },
2048
2202
  pressed && { opacity: 0.7 }
2049
2203
  ],
2050
2204
  children: [
2051
- colorMode !== "none" && /* @__PURE__ */ jsx10(View7, { style: [styles8.accent, { backgroundColor: v.stateColor }] }),
2052
- graph && size.width > 0 && /* @__PURE__ */ jsx10(Sparkline, { values: v.sparkline, width: size.width, height: size.height * 0.4, color: v.stateColor }),
2053
- showName && /* @__PURE__ */ jsx10(Text8, { style: [styles8.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name }),
2054
- /* @__PURE__ */ jsx10(Text8, { style: [styles8.value, { color: theme.text, fontSize }], numberOfLines: 1, adjustsFontSizeToFit: true, children: v.text })
2205
+ colorMode !== "none" && /* @__PURE__ */ jsx11(View7, { style: [styles9.accent, { backgroundColor: v.stateColor }] }),
2206
+ graph && size.width > 0 && /* @__PURE__ */ jsx11(Sparkline, { values: v.sparkline, width: size.width, height: size.height * 0.4, color: v.stateColor }),
2207
+ showName && /* @__PURE__ */ jsx11(Text9, { style: [styles9.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name }),
2208
+ /* @__PURE__ */ jsx11(Text9, { style: [styles9.value, { color: theme.text, fontSize }], numberOfLines: 1, adjustsFontSizeToFit: true, children: v.text })
2055
2209
  ]
2056
2210
  }
2057
2211
  );
@@ -2066,16 +2220,16 @@ function Sparkline({ values, width, height, color }) {
2066
2220
  values.forEach((v, i) => {
2067
2221
  if (v != null) line += `${line ? "L" : "M"}${x(i)},${y(v)}`;
2068
2222
  });
2069
- return /* @__PURE__ */ jsxs8(Svg4, { width, height, style: styles8.spark, children: [
2070
- /* @__PURE__ */ jsx10(Path4, { d: `${line}L${width},${height}L0,${height}Z`, fill: color, opacity: 0.1 }),
2071
- /* @__PURE__ */ jsx10(Path4, { d: line, stroke: color, strokeWidth: 2, fill: "none", strokeLinejoin: "round" })
2223
+ return /* @__PURE__ */ jsxs9(Svg5, { width, height, style: styles9.spark, children: [
2224
+ /* @__PURE__ */ jsx11(Path5, { d: `${line}L${width},${height}L0,${height}Z`, fill: color, opacity: 0.1 }),
2225
+ /* @__PURE__ */ jsx11(Path5, { d: line, stroke: color, strokeWidth: 2, fill: "none", strokeLinejoin: "round" })
2072
2226
  ] });
2073
2227
  }
2074
2228
  function withAlpha(hex, alpha) {
2075
2229
  if (!/^#[0-9a-f]{6}$/i.test(hex)) return hex;
2076
2230
  return `${hex}${Math.round(alpha * 255).toString(16).padStart(2, "0")}`;
2077
2231
  }
2078
- var styles8 = StyleSheet8.create({
2232
+ var styles9 = StyleSheet9.create({
2079
2233
  grid: { flex: 1, gap: 8 },
2080
2234
  tile: { flex: 1, justifyContent: "center", paddingLeft: 12, borderRadius: 6, overflow: "hidden" },
2081
2235
  accent: { position: "absolute", left: 0, top: 6, bottom: 6, width: 3, borderRadius: 2 },
@@ -2085,13 +2239,13 @@ var styles8 = StyleSheet8.create({
2085
2239
  });
2086
2240
 
2087
2241
  // src/ui/panels/GaugePanels.tsx
2088
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2242
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2089
2243
  var SWEEP = 240;
2090
2244
  function GaugePanel({ panel, frames }) {
2091
2245
  const theme = useDashTheme();
2092
2246
  const values = useMemo4(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
2093
- if (!values.length) return /* @__PURE__ */ jsx11(NoData, {});
2094
- return /* @__PURE__ */ jsx11(View8, { style: styles9.row, children: values.map((v) => /* @__PURE__ */ jsx11(Gauge, { v, showName: values.length > 1, panel }, v.key)) });
2247
+ if (!values.length) return /* @__PURE__ */ jsx12(NoData, {});
2248
+ return /* @__PURE__ */ jsx12(View8, { style: styles10.row, children: values.map((v) => /* @__PURE__ */ jsx12(Gauge, { v, showName: values.length > 1, panel }, v.key)) });
2095
2249
  }
2096
2250
  function Gauge({ v, showName, panel }) {
2097
2251
  const theme = useDashTheme();
@@ -2106,22 +2260,22 @@ function Gauge({ v, showName, panel }) {
2106
2260
  const r = d / 2 - stroke;
2107
2261
  const cx = size.width / 2;
2108
2262
  const cy = size.height / 2 + d * 0.08;
2109
- return /* @__PURE__ */ jsxs9(
2110
- Pressable8,
2263
+ return /* @__PURE__ */ jsxs10(
2264
+ Pressable9,
2111
2265
  {
2112
- style: ({ pressed }) => [styles9.fill, pressed && { opacity: 0.7 }],
2266
+ style: ({ pressed }) => [styles10.fill, pressed && { opacity: 0.7 }],
2113
2267
  onLayout,
2114
2268
  disabled: !hasLinks,
2115
2269
  onPress: () => openLinks(valueLinks(panel, v, resolve), v.name),
2116
2270
  accessibilityRole: hasLinks ? "link" : void 0,
2117
2271
  children: [
2118
- size.width > 0 && r > 0 && /* @__PURE__ */ jsxs9(Svg5, { width: size.width, height: size.height, children: [
2119
- /* @__PURE__ */ jsx11(Path5, { d: arc(cx, cy, r, 0, 1), stroke: withAlpha(v.stateColor, 0.18), strokeWidth: stroke, fill: "none", strokeLinecap: "round" }),
2120
- frac > 0 && /* @__PURE__ */ jsx11(Path5, { d: arc(cx, cy, r, 0, frac), stroke: v.stateColor, strokeWidth: stroke, fill: "none", strokeLinecap: "round" })
2272
+ size.width > 0 && r > 0 && /* @__PURE__ */ jsxs10(Svg6, { width: size.width, height: size.height, children: [
2273
+ /* @__PURE__ */ jsx12(Path6, { d: arc(cx, cy, r, 0, 1), stroke: withAlpha(v.stateColor, 0.18), strokeWidth: stroke, fill: "none", strokeLinecap: "round" }),
2274
+ frac > 0 && /* @__PURE__ */ jsx12(Path6, { d: arc(cx, cy, r, 0, frac), stroke: v.stateColor, strokeWidth: stroke, fill: "none", strokeLinecap: "round" })
2121
2275
  ] }),
2122
- /* @__PURE__ */ jsxs9(View8, { style: [StyleSheet9.absoluteFill, styles9.center, { top: d * 0.12 }], pointerEvents: "none", children: [
2123
- /* @__PURE__ */ jsx11(Text9, { style: [styles9.value, { color: theme.text, fontSize: Math.max(14, d * 0.18) }], numberOfLines: 1, adjustsFontSizeToFit: true, children: v.text }),
2124
- showName && /* @__PURE__ */ jsx11(Text9, { style: [styles9.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name })
2276
+ /* @__PURE__ */ jsxs10(View8, { style: [StyleSheet10.absoluteFill, styles10.center, { top: d * 0.12 }], pointerEvents: "none", children: [
2277
+ /* @__PURE__ */ jsx12(Text10, { style: [styles10.value, { color: theme.text, fontSize: Math.max(14, d * 0.18) }], numberOfLines: 1, adjustsFontSizeToFit: true, children: v.text }),
2278
+ showName && /* @__PURE__ */ jsx12(Text10, { style: [styles10.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name })
2125
2279
  ] })
2126
2280
  ]
2127
2281
  }
@@ -2139,33 +2293,33 @@ function BarGaugePanel({ panel, frames }) {
2139
2293
  const theme = useDashTheme();
2140
2294
  const values = useMemo4(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
2141
2295
  const { resolve, openLinks } = usePanelLinks(panel);
2142
- if (!values.length) return /* @__PURE__ */ jsx11(NoData, {});
2143
- return /* @__PURE__ */ jsx11(View8, { style: styles9.bars, children: values.map((v) => {
2296
+ if (!values.length) return /* @__PURE__ */ jsx12(NoData, {});
2297
+ return /* @__PURE__ */ jsx12(View8, { style: styles10.bars, children: values.map((v) => {
2144
2298
  const min = v.config.min ?? 0;
2145
2299
  const max = v.config.max ?? Math.max(...values.map((o) => o.value ?? 0), 1);
2146
2300
  const frac = v.value == null ? 0 : Math.min(1, Math.max(0, (v.value - min) / (max - min || 1)));
2147
2301
  const color = v.config.thresholds || v.mapped?.color ? v.stateColor : resolveColor(v.config.color?.fixedColor, v.color);
2148
2302
  const hasLinks = !!v.config.links?.length;
2149
- return /* @__PURE__ */ jsxs9(
2150
- Pressable8,
2303
+ return /* @__PURE__ */ jsxs10(
2304
+ Pressable9,
2151
2305
  {
2152
- style: ({ pressed }) => [styles9.barRow, pressed && { opacity: 0.7 }],
2306
+ style: ({ pressed }) => [styles10.barRow, pressed && { opacity: 0.7 }],
2153
2307
  disabled: !hasLinks,
2154
2308
  onPress: () => openLinks(valueLinks(panel, v, resolve), v.name),
2155
2309
  accessibilityRole: hasLinks ? "link" : void 0,
2156
2310
  children: [
2157
- /* @__PURE__ */ jsxs9(View8, { style: styles9.barLabels, children: [
2158
- /* @__PURE__ */ jsx11(Text9, { style: [styles9.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name }),
2159
- /* @__PURE__ */ jsx11(Text9, { style: [styles9.barValue, { color: theme.text }], children: v.text })
2311
+ /* @__PURE__ */ jsxs10(View8, { style: styles10.barLabels, children: [
2312
+ /* @__PURE__ */ jsx12(Text10, { style: [styles10.name, { color: theme.textSecondary }], numberOfLines: 1, children: v.name }),
2313
+ /* @__PURE__ */ jsx12(Text10, { style: [styles10.barValue, { color: theme.text }], children: v.text })
2160
2314
  ] }),
2161
- /* @__PURE__ */ jsx11(View8, { style: [styles9.track, { backgroundColor: withAlpha(color, 0.18) }], children: /* @__PURE__ */ jsx11(View8, { style: [styles9.meter, { width: `${frac * 100}%`, backgroundColor: color }] }) })
2315
+ /* @__PURE__ */ jsx12(View8, { style: [styles10.track, { backgroundColor: withAlpha(color, 0.18) }], children: /* @__PURE__ */ jsx12(View8, { style: [styles10.meter, { width: `${frac * 100}%`, backgroundColor: color }] }) })
2162
2316
  ]
2163
2317
  },
2164
2318
  v.key
2165
2319
  );
2166
2320
  }) });
2167
2321
  }
2168
- var styles9 = StyleSheet9.create({
2322
+ var styles10 = StyleSheet10.create({
2169
2323
  fill: { flex: 1 },
2170
2324
  row: { flex: 1, flexDirection: "row", gap: 8 },
2171
2325
  center: { alignItems: "center", justifyContent: "center" },
@@ -2180,9 +2334,9 @@ var styles9 = StyleSheet9.create({
2180
2334
  });
2181
2335
 
2182
2336
  // src/ui/panels/GeomapPanel.tsx
2183
- import { useEffect as useEffect3, useMemo as useMemo5, useRef as useRef3, useState as useState7 } from "react";
2184
- import { Image, PixelRatio, Pressable as Pressable9, StyleSheet as StyleSheet10, Text as Text10, View as View9 } from "react-native";
2185
- import Svg6, { Path as Path6, Text as SvgText2 } from "react-native-svg";
2337
+ import { useEffect as useEffect4, useMemo as useMemo5, useRef as useRef4, useState as useState8 } from "react";
2338
+ import { Image, PixelRatio, Pressable as Pressable10, StyleSheet as StyleSheet11, Text as Text11, View as View9 } from "react-native";
2339
+ import Svg7, { Path as Path7, Text as SvgText2 } from "react-native-svg";
2186
2340
 
2187
2341
  // src/ui/geomap.ts
2188
2342
  var TILE = 256;
@@ -2598,7 +2752,7 @@ function heatmapCells(px, py, weights, radius, blur, width, height, cell = 4) {
2598
2752
  }
2599
2753
 
2600
2754
  // src/ui/panels/GeomapPanel.tsx
2601
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2755
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2602
2756
  var HIT_PX = 24;
2603
2757
  var DRAG_PX = 6;
2604
2758
  var MAX_LABELS = 300;
@@ -2609,8 +2763,8 @@ function GeomapPanel({ panel, frames }) {
2609
2763
  const { gazetteers, error } = useGazetteers(panel, frames);
2610
2764
  const layers = useMemo5(() => geomapLayers(panel, frames, theme.scheme, retina, gazetteers), [panel, frames, theme.scheme, retina, gazetteers]);
2611
2765
  const home = useMemo5(() => initialView(panel, layers, size.width, size.height), [panel, layers, size.width, size.height]);
2612
- const [moved, setMoved] = useState7(null);
2613
- const [picked, setPicked] = useState7(null);
2766
+ const [moved, setMoved] = useState8(null);
2767
+ const [picked, setPicked] = useState8(null);
2614
2768
  const links = usePanelLinks(panel);
2615
2769
  const view = moved ?? home;
2616
2770
  const [minZoom, maxZoom] = zoomLimits(panel);
@@ -2651,7 +2805,7 @@ function GeomapPanel({ panel, frames }) {
2651
2805
  }
2652
2806
  return best;
2653
2807
  };
2654
- const gesture = useRef3(null);
2808
+ const gesture = useRef4(null);
2655
2809
  const responder = {
2656
2810
  onStartShouldSetResponder: () => true,
2657
2811
  // Keep the gesture while panning instead of handing it to the dashboard's scroll view.
@@ -2693,15 +2847,15 @@ function GeomapPanel({ panel, frames }) {
2693
2847
  const attribution = [...new Set(layers.flatMap((l) => l.type === "tiles" && l.source.attribution ? [l.source.attribution] : []))].join(" ");
2694
2848
  const legend = layers.flatMap((l) => l.type === "markers" || l.type === "route" ? l.legend : []);
2695
2849
  const ready = size.width > 0 && size.height > 0;
2696
- return /* @__PURE__ */ jsxs10(View9, { style: styles10.fill, children: [
2697
- /* @__PURE__ */ jsxs10(View9, { style: [styles10.fill, styles10.map, { backgroundColor: theme.grid }], onLayout, ...responder, children: [
2850
+ return /* @__PURE__ */ jsxs11(View9, { style: styles11.fill, children: [
2851
+ /* @__PURE__ */ jsxs11(View9, { style: [styles11.fill, styles11.map, { backgroundColor: theme.grid }], onLayout, ...responder, children: [
2698
2852
  ready && // Nothing inside takes touches, so locationX/Y are always relative to the map.
2699
- /* @__PURE__ */ jsxs10(View9, { pointerEvents: "none", style: StyleSheet10.absoluteFill, children: [
2853
+ /* @__PURE__ */ jsxs11(View9, { pointerEvents: "none", style: StyleSheet11.absoluteFill, children: [
2700
2854
  layers.map(
2701
- (l) => l.type === "tiles" ? /* @__PURE__ */ jsx12(Tiles, { layer: l, view, width: size.width, height: size.height }, l.key) : /* @__PURE__ */ jsx12(DataLayerSvg, { layer: l, screen: screen.get(l.key) ?? [], width: size.width, height: size.height, textColor: theme.text }, l.key)
2855
+ (l) => l.type === "tiles" ? /* @__PURE__ */ jsx13(Tiles, { layer: l, view, width: size.width, height: size.height }, l.key) : /* @__PURE__ */ jsx13(DataLayerSvg, { layer: l, screen: screen.get(l.key) ?? [], width: size.width, height: size.height, textColor: theme.text }, l.key)
2702
2856
  ),
2703
- shown && /* @__PURE__ */ jsx12(Svg6, { width: size.width, height: size.height, style: StyleSheet10.absoluteFill, children: /* @__PURE__ */ jsx12(
2704
- Path6,
2857
+ shown && /* @__PURE__ */ jsx13(Svg7, { width: size.width, height: size.height, style: StyleSheet11.absoluteFill, children: /* @__PURE__ */ jsx13(
2858
+ Path7,
2705
2859
  {
2706
2860
  d: symbolPath("circle", shown.px, shown.py, Math.max(shown.layer.type === "markers" ? shown.radius + 2 : 5, 5)),
2707
2861
  fill: "none",
@@ -2710,7 +2864,7 @@ function GeomapPanel({ panel, frames }) {
2710
2864
  }
2711
2865
  ) })
2712
2866
  ] }),
2713
- shown && /* @__PURE__ */ jsx12(
2867
+ shown && /* @__PURE__ */ jsx13(
2714
2868
  RowTooltip,
2715
2869
  {
2716
2870
  at: { x: shown.px, y: shown.py },
@@ -2722,23 +2876,23 @@ function GeomapPanel({ panel, frames }) {
2722
2876
  onOpenLink: (l) => links.openLinks([l])
2723
2877
  }
2724
2878
  ),
2725
- controls.showZoom !== false && /* @__PURE__ */ jsxs10(View9, { style: styles10.zoom, children: [
2726
- /* @__PURE__ */ jsx12(MapButton, { label: "+", onPress: () => zoomTo(view, Math.round(view.zoom) + 1) }),
2727
- /* @__PURE__ */ jsx12(MapButton, { label: "\u2212", onPress: () => zoomTo(view, Math.round(view.zoom) - 1) }),
2728
- moved && /* @__PURE__ */ jsx12(MapButton, { label: "\u27F2", onPress: () => setMoved(null) })
2879
+ controls.showZoom !== false && /* @__PURE__ */ jsxs11(View9, { style: styles11.zoom, children: [
2880
+ /* @__PURE__ */ jsx13(MapButton, { label: "+", onPress: () => zoomTo(view, Math.round(view.zoom) + 1) }),
2881
+ /* @__PURE__ */ jsx13(MapButton, { label: "\u2212", onPress: () => zoomTo(view, Math.round(view.zoom) - 1) }),
2882
+ moved && /* @__PURE__ */ jsx13(MapButton, { label: "\u27F2", onPress: () => setMoved(null) })
2729
2883
  ] }),
2730
- error ? /* @__PURE__ */ jsx12(Text10, { pointerEvents: "none", style: [styles10.error, { color: theme.danger, backgroundColor: theme.surface }], numberOfLines: 2, children: error }) : null,
2731
- controls.showAttribution !== false && attribution ? /* @__PURE__ */ jsx12(Text10, { pointerEvents: "none", style: [styles10.attribution, { color: theme.textSecondary, backgroundColor: theme.surface }], numberOfLines: 1, children: attribution }) : null
2884
+ error ? /* @__PURE__ */ jsx13(Text11, { pointerEvents: "none", style: [styles11.error, { color: theme.danger, backgroundColor: theme.surface }], numberOfLines: 2, children: error }) : null,
2885
+ controls.showAttribution !== false && attribution ? /* @__PURE__ */ jsx13(Text11, { pointerEvents: "none", style: [styles11.attribution, { color: theme.textSecondary, backgroundColor: theme.surface }], numberOfLines: 1, children: attribution }) : null
2732
2886
  ] }),
2733
- legend.length > 0 && /* @__PURE__ */ jsx12(Legend, { items: legend })
2887
+ legend.length > 0 && /* @__PURE__ */ jsx13(Legend, { items: legend })
2734
2888
  ] });
2735
2889
  }
2736
2890
  var NONE = {};
2737
2891
  function useGazetteers(panel, frames) {
2738
2892
  const { resolve } = useDashboard();
2739
2893
  const key = gazetteerPaths(panel, frames).join("\n");
2740
- const [state, setState] = useState7({ key: "", gazetteers: NONE });
2741
- useEffect3(() => {
2894
+ const [state, setState] = useState8({ key: "", gazetteers: NONE });
2895
+ useEffect4(() => {
2742
2896
  if (!key) return;
2743
2897
  let live = true;
2744
2898
  let ds;
@@ -2765,13 +2919,13 @@ function useGazetteers(panel, frames) {
2765
2919
  }
2766
2920
  function MapButton({ label, onPress }) {
2767
2921
  const theme = useDashTheme();
2768
- return /* @__PURE__ */ jsx12(Pressable9, { onPress, hitSlop: 4, style: [styles10.button, { backgroundColor: theme.surface, borderColor: theme.border }], children: /* @__PURE__ */ jsx12(Text10, { style: [styles10.buttonText, { color: theme.text }], children: label }) });
2922
+ return /* @__PURE__ */ jsx13(Pressable10, { onPress, hitSlop: 4, style: [styles11.button, { backgroundColor: theme.surface, borderColor: theme.border }], children: /* @__PURE__ */ jsx13(Text11, { style: [styles11.buttonText, { color: theme.text }], children: label }) });
2769
2923
  }
2770
2924
  function Tiles({ layer, view, width, height }) {
2771
2925
  const tiles = visibleTiles(layer.source, view, width, height);
2772
- return /* @__PURE__ */ jsx12(View9, { style: [StyleSheet10.absoluteFill, { opacity: layer.opacity }], children: tiles.map((t) => (
2926
+ return /* @__PURE__ */ jsx13(View9, { style: [StyleSheet11.absoluteFill, { opacity: layer.opacity }], children: tiles.map((t) => (
2773
2927
  // Half a pixel of overlap hides seams between scaled tiles.
2774
- /* @__PURE__ */ jsx12(
2928
+ /* @__PURE__ */ jsx13(
2775
2929
  Image,
2776
2930
  {
2777
2931
  source: { uri: t.url },
@@ -2788,12 +2942,12 @@ function DataLayerSvg({ layer, screen, width, height, textColor }) {
2788
2942
  const px = screen.flatMap((s) => s.px);
2789
2943
  const py = screen.flatMap((s) => s.py);
2790
2944
  const weights = layer.points.flatMap((p) => p.sizes);
2791
- return heatmapCells(px, py, weights, layer.radius, layer.blur, width, height).map((c) => /* @__PURE__ */ jsx12(Path6, { d: c.d, fill: c.color, fillOpacity: c.opacity }, c.color));
2945
+ return heatmapCells(px, py, weights, layer.radius, layer.blur, width, height).map((c) => /* @__PURE__ */ jsx13(Path7, { d: c.d, fill: c.color, fillOpacity: c.opacity }, c.color));
2792
2946
  }
2793
2947
  if (layer.type === "route") return routePaths(layer, screen);
2794
2948
  return markerPaths(layer, screen, width, height, textColor);
2795
2949
  }, [layer, screen, width, height, textColor]);
2796
- return /* @__PURE__ */ jsx12(Svg6, { width, height, style: [StyleSheet10.absoluteFill, { opacity: layer.opacity }], children: body });
2950
+ return /* @__PURE__ */ jsx13(Svg7, { width, height, style: [StyleSheet11.absoluteFill, { opacity: layer.opacity }], children: body });
2797
2951
  }
2798
2952
  function markerPaths(layer, screen, width, height, textColor) {
2799
2953
  const byColor = /* @__PURE__ */ new Map();
@@ -2808,7 +2962,7 @@ function markerPaths(layer, screen, width, height, textColor) {
2808
2962
  const label = p.labels?.[i];
2809
2963
  if (label && labels.length < MAX_LABELS)
2810
2964
  labels.push(
2811
- /* @__PURE__ */ jsx12(
2965
+ /* @__PURE__ */ jsx13(
2812
2966
  SvgText2,
2813
2967
  {
2814
2968
  x: px[i] + layer.labelOffset[0],
@@ -2825,7 +2979,7 @@ function markerPaths(layer, screen, width, height, textColor) {
2825
2979
  });
2826
2980
  const outline = layer.symbol === "cross" || layer.symbol === "x";
2827
2981
  return [
2828
- ...[...byColor].map(([color, parts]) => /* @__PURE__ */ jsx12(Path6, { d: parts.join(""), fill: outline ? "none" : color, fillOpacity: layer.fillOpacity, stroke: color, strokeWidth: outline ? 2 : 1 }, color)),
2982
+ ...[...byColor].map(([color, parts]) => /* @__PURE__ */ jsx13(Path7, { d: parts.join(""), fill: outline ? "none" : color, fillOpacity: layer.fillOpacity, stroke: color, strokeWidth: outline ? 2 : 1 }, color)),
2829
2983
  ...labels
2830
2984
  ];
2831
2985
  }
@@ -2838,7 +2992,7 @@ function routePaths(layer, screen) {
2838
2992
  parts.push(`M${px[i]},${py[i]}L${px[i + 1]},${py[i + 1]}`);
2839
2993
  }
2840
2994
  });
2841
- return [...byColor].map(([color, parts]) => /* @__PURE__ */ jsx12(Path6, { d: parts.join(""), stroke: color, strokeWidth: layer.lineWidth, strokeLinecap: "round", fill: "none" }, color));
2995
+ return [...byColor].map(([color, parts]) => /* @__PURE__ */ jsx13(Path7, { d: parts.join(""), stroke: color, strokeWidth: layer.lineWidth, strokeLinecap: "round", fill: "none" }, color));
2842
2996
  }
2843
2997
  function resolvePicked(layers, screen, picked) {
2844
2998
  const layer = layers.find((l) => l.key === picked.layer);
@@ -2856,7 +3010,7 @@ function resolvePicked(layers, screen, picked) {
2856
3010
  py: s.py[picked.index]
2857
3011
  };
2858
3012
  }
2859
- var styles10 = StyleSheet10.create({
3013
+ var styles11 = StyleSheet11.create({
2860
3014
  fill: { flex: 1 },
2861
3015
  map: { overflow: "hidden", borderRadius: 4 },
2862
3016
  zoom: { position: "absolute", top: 6, left: 6, gap: 4 },
@@ -2864,7 +3018,7 @@ var styles10 = StyleSheet10.create({
2864
3018
  width: 28,
2865
3019
  height: 28,
2866
3020
  borderRadius: 4,
2867
- borderWidth: StyleSheet10.hairlineWidth,
3021
+ borderWidth: StyleSheet11.hairlineWidth,
2868
3022
  alignItems: "center",
2869
3023
  justifyContent: "center"
2870
3024
  },
@@ -2874,9 +3028,9 @@ var styles10 = StyleSheet10.create({
2874
3028
  });
2875
3029
 
2876
3030
  // src/ui/panels/OtherPanels.tsx
2877
- import { useMemo as useMemo6, useState as useState8 } from "react";
2878
- import { Pressable as Pressable10, ScrollView as ScrollView5, StyleSheet as StyleSheet11, Text as Text11, View as View10 } from "react-native";
2879
- import Svg7, { Path as Path7 } from "react-native-svg";
3031
+ import { useMemo as useMemo6, useState as useState9 } from "react";
3032
+ import { Pressable as Pressable11, ScrollView as ScrollView5, StyleSheet as StyleSheet12, Text as Text12, View as View10 } from "react-native";
3033
+ import Svg8, { Path as Path8 } from "react-native-svg";
2880
3034
 
2881
3035
  // src/ui/table.ts
2882
3036
  var DEFAULT_WIDTH = 120;
@@ -3014,7 +3168,7 @@ function sortedRows(columns, length, sort) {
3014
3168
  var compareText = typeof Intl !== "undefined" && typeof Intl.Collator === "function" ? new Intl.Collator(void 0, { numeric: true, sensitivity: "base" }).compare : (a, b) => a < b ? -1 : a > b ? 1 : 0;
3015
3169
 
3016
3170
  // src/ui/panels/OtherPanels.tsx
3017
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3171
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3018
3172
  function PieChartPanel({ panel, frames }) {
3019
3173
  const theme = useDashTheme();
3020
3174
  const [size, onLayout] = useLayout();
@@ -3022,7 +3176,7 @@ function PieChartPanel({ panel, frames }) {
3022
3176
  () => reducedValues(panel, frames, theme.scheme).filter((v) => (v.value ?? 0) > 0),
3023
3177
  [panel, frames, theme.scheme]
3024
3178
  );
3025
- if (!values.length) return /* @__PURE__ */ jsx13(NoData, {});
3179
+ if (!values.length) return /* @__PURE__ */ jsx14(NoData, {});
3026
3180
  const total = values.reduce((a, v) => a + (v.value ?? 0), 0);
3027
3181
  const r = Math.min(size.width, size.height) / 2 - 2;
3028
3182
  const inner = panel.options?.pieType === "pie" ? 0 : r * 0.62;
@@ -3036,9 +3190,9 @@ function PieChartPanel({ panel, frames }) {
3036
3190
  slices.push({ key: v.key, d: donutSlice(cx, cy, r, inner, angle + gap / 2, angle + sweep - gap / 2), color: v.color });
3037
3191
  angle += sweep;
3038
3192
  }
3039
- return /* @__PURE__ */ jsxs11(View10, { style: styles11.fill, children: [
3040
- /* @__PURE__ */ jsx13(View10, { style: styles11.fill, onLayout, children: r > 0 && /* @__PURE__ */ jsx13(Svg7, { width: size.width, height: size.height, children: slices.map((s) => /* @__PURE__ */ jsx13(Path7, { d: s.d, fill: s.color }, s.key)) }) }),
3041
- /* @__PURE__ */ jsx13(
3193
+ return /* @__PURE__ */ jsxs12(View10, { style: styles12.fill, children: [
3194
+ /* @__PURE__ */ jsx14(View10, { style: styles12.fill, onLayout, children: r > 0 && /* @__PURE__ */ jsx14(Svg8, { width: size.width, height: size.height, children: slices.map((s) => /* @__PURE__ */ jsx14(Path8, { d: s.d, fill: s.color }, s.key)) }) }),
3195
+ /* @__PURE__ */ jsx14(
3042
3196
  Legend,
3043
3197
  {
3044
3198
  items: values.map((v) => ({
@@ -3063,26 +3217,26 @@ function TablePanel({ panel, frames }) {
3063
3217
  const { resolve, openLinks } = usePanelLinks(panel);
3064
3218
  const frame = frames[0];
3065
3219
  const columns = useMemo6(() => frame ? tableColumns(panel, frame, frames.length > 1) : [], [panel, frame, frames.length]);
3066
- const [tapped, setSort] = useState8();
3220
+ const [tapped, setSort] = useState9();
3067
3221
  const sort = tapped === void 0 ? initialSort(panel, columns) : tapped;
3068
3222
  const order = useMemo6(() => sortedRows(columns, frame ? frameLength(frame) : 0, sort), [columns, frame, sort]);
3069
- if (!frame || !frameLength(frame)) return /* @__PURE__ */ jsx13(NoData, {});
3223
+ if (!frame || !frameLength(frame)) return /* @__PURE__ */ jsx14(NoData, {});
3070
3224
  const shown = order.slice(0, 500);
3071
3225
  const rowColumn = columns.find((c) => c.applyToRow);
3072
3226
  const footer = tableFooter(columns);
3073
- return /* @__PURE__ */ jsx13(ScrollView5, { horizontal: true, children: /* @__PURE__ */ jsxs11(View10, { style: styles11.fill, children: [
3074
- /* @__PURE__ */ jsxs11(ScrollView5, { nestedScrollEnabled: true, style: styles11.fill, children: [
3075
- /* @__PURE__ */ jsx13(View10, { style: [styles11.tr, { borderBottomColor: theme.border }], children: columns.map((c) => {
3227
+ return /* @__PURE__ */ jsx14(ScrollView5, { horizontal: true, children: /* @__PURE__ */ jsxs12(View10, { style: styles12.fill, children: [
3228
+ /* @__PURE__ */ jsxs12(ScrollView5, { nestedScrollEnabled: true, style: styles12.fill, children: [
3229
+ /* @__PURE__ */ jsx14(View10, { style: [styles12.tr, { borderBottomColor: theme.border }], children: columns.map((c) => {
3076
3230
  const active = sort?.key === c.key;
3077
- return /* @__PURE__ */ jsx13(
3078
- Pressable10,
3231
+ return /* @__PURE__ */ jsx14(
3232
+ Pressable11,
3079
3233
  {
3080
3234
  onPress: () => setSort(nextSort(sort, c.key)),
3081
3235
  accessibilityRole: "button",
3082
3236
  accessibilityLabel: `Sort by ${c.name}`,
3083
3237
  accessibilityState: { selected: active },
3084
3238
  style: { width: c.width },
3085
- children: /* @__PURE__ */ jsxs11(Text11, { style: [styles11.th, { color: active ? theme.text : theme.textSecondary, textAlign: c.align }], numberOfLines: 2, children: [
3239
+ children: /* @__PURE__ */ jsxs12(Text12, { style: [styles12.th, { color: active ? theme.text : theme.textSecondary, textAlign: c.align }], numberOfLines: 2, children: [
3086
3240
  c.name,
3087
3241
  active ? sort.desc ? " \u2193" : " \u2191" : ""
3088
3242
  ] })
@@ -3092,14 +3246,14 @@ function TablePanel({ panel, frames }) {
3092
3246
  }) }),
3093
3247
  shown.map((i) => {
3094
3248
  const rowBg = rowColumn ? cellDisplay(rowColumn, rowColumn.field.values[i], theme.accent).background : void 0;
3095
- return /* @__PURE__ */ jsx13(View10, { style: [styles11.tr, { borderBottomColor: theme.grid }, rowBg ? { backgroundColor: rowBg } : null], children: columns.map((c) => {
3249
+ return /* @__PURE__ */ jsx14(View10, { style: [styles12.tr, { borderBottomColor: theme.grid }, rowBg ? { backgroundColor: rowBg } : null], children: columns.map((c) => {
3096
3250
  const d = cellDisplay(c, c.field.values[i], theme.accent);
3097
3251
  const bg = d.background ?? rowBg;
3098
3252
  const linked = !!c.config.links?.length;
3099
3253
  const color = d.color ?? (bg ? contrastText(bg, theme.text) : linked ? theme.accent : theme.text);
3100
- const cellStyle = [styles11.td, { width: c.width }, d.background ? { backgroundColor: d.background } : null];
3101
- return /* @__PURE__ */ jsxs11(
3102
- Pressable10,
3254
+ const cellStyle = [styles12.td, { width: c.width }, d.background ? { backgroundColor: d.background } : null];
3255
+ return /* @__PURE__ */ jsxs12(
3256
+ Pressable11,
3103
3257
  {
3104
3258
  disabled: !linked,
3105
3259
  onPress: () => openLinks(
@@ -3109,8 +3263,8 @@ function TablePanel({ panel, frames }) {
3109
3263
  accessibilityRole: linked ? "link" : void 0,
3110
3264
  style: ({ pressed }) => [cellStyle, pressed && { opacity: 0.6 }],
3111
3265
  children: [
3112
- d.gauge != null && /* @__PURE__ */ jsx13(View10, { style: [styles11.gaugeTrack, { backgroundColor: theme.grid }], children: /* @__PURE__ */ jsx13(View10, { style: [styles11.gaugeFill, { width: `${d.gauge * 100}%`, backgroundColor: d.gaugeColor ?? theme.accent }] }) }),
3113
- /* @__PURE__ */ jsx13(Text11, { style: [styles11.cellText, { color, textAlign: c.align }, c.field.type === "number" && styles11.num], numberOfLines: c.wrap ? void 0 : 1, children: d.text })
3266
+ d.gauge != null && /* @__PURE__ */ jsx14(View10, { style: [styles12.gaugeTrack, { backgroundColor: theme.grid }], children: /* @__PURE__ */ jsx14(View10, { style: [styles12.gaugeFill, { width: `${d.gauge * 100}%`, backgroundColor: d.gaugeColor ?? theme.accent }] }) }),
3267
+ /* @__PURE__ */ jsx14(Text12, { style: [styles12.cellText, { color, textAlign: c.align }, c.field.type === "number" && styles12.num], numberOfLines: c.wrap ? void 0 : 1, children: d.text })
3114
3268
  ]
3115
3269
  },
3116
3270
  c.key
@@ -3118,8 +3272,8 @@ function TablePanel({ panel, frames }) {
3118
3272
  }) }, i);
3119
3273
  })
3120
3274
  ] }),
3121
- footer && /* @__PURE__ */ jsx13(View10, { style: [styles11.tr, styles11.footer, { borderTopColor: theme.border }], children: columns.map((c, ci) => /* @__PURE__ */ jsx13(View10, { style: [styles11.td, { width: c.width }], children: footer[ci].map((line, li) => /* @__PURE__ */ jsxs11(Text11, { style: [styles11.cellText, styles11.footerText, { color: theme.text, textAlign: c.align }], numberOfLines: 1, children: [
3122
- line.label ? /* @__PURE__ */ jsx13(Text11, { style: { color: theme.textMuted, fontWeight: "400" }, children: `${line.label} ` }) : null,
3275
+ footer && /* @__PURE__ */ jsx14(View10, { style: [styles12.tr, styles12.footer, { borderTopColor: theme.border }], children: columns.map((c, ci) => /* @__PURE__ */ jsx14(View10, { style: [styles12.td, { width: c.width }], children: footer[ci].map((line, li) => /* @__PURE__ */ jsxs12(Text12, { style: [styles12.cellText, styles12.footerText, { color: theme.text, textAlign: c.align }], numberOfLines: 1, children: [
3276
+ line.label ? /* @__PURE__ */ jsx14(Text12, { style: { color: theme.textMuted, fontWeight: "400" }, children: `${line.label} ` }) : null,
3123
3277
  line.text
3124
3278
  ] }, li)) }, c.key)) })
3125
3279
  ] }) });
@@ -3129,9 +3283,9 @@ function TextPanel({ panel }) {
3129
3283
  const raw = panel.options?.content;
3130
3284
  const content = typeof raw === "string" ? raw : "";
3131
3285
  const text = panel.options?.mode === "html" ? content.replace(/<[^>]+>/g, "") : content;
3132
- return /* @__PURE__ */ jsx13(ScrollView5, { children: text.split(/\n{2,}/).map((block, i) => {
3286
+ return /* @__PURE__ */ jsx14(ScrollView5, { children: text.split(/\n{2,}/).map((block, i) => {
3133
3287
  const heading = /^#{1,6}\s+/.test(block);
3134
- return /* @__PURE__ */ jsx13(Text11, { style: [styles11.para, { color: heading ? theme.text : theme.textSecondary }, heading && styles11.heading], children: block.replace(/^#{1,6}\s+/, "").replace(/\*\*(.+?)\*\*/g, "$1").replace(/\[(.+?)\]\(.+?\)/g, "$1") }, i);
3288
+ return /* @__PURE__ */ jsx14(Text12, { style: [styles12.para, { color: heading ? theme.text : theme.textSecondary }, heading && styles12.heading], children: block.replace(/^#{1,6}\s+/, "").replace(/\*\*(.+?)\*\*/g, "$1").replace(/\[(.+?)\]\(.+?\)/g, "$1") }, i);
3135
3289
  }) });
3136
3290
  }
3137
3291
  function BarChartPanel({ panel, frames, width }) {
@@ -3140,13 +3294,13 @@ function BarChartPanel({ panel, frames, width }) {
3140
3294
  const values = useMemo6(() => reducedValues(panel, frames, theme.scheme), [panel, frames, theme.scheme]);
3141
3295
  const frame = frames[0];
3142
3296
  const category = frame && barCategory(panel, frame);
3143
- if (!frame || !values.length) return /* @__PURE__ */ jsx13(NoData, {});
3297
+ if (!frame || !values.length) return /* @__PURE__ */ jsx14(NoData, {});
3144
3298
  const xField = panel.options?.xField;
3145
- if (xField && !category) return /* @__PURE__ */ jsx13(NoData, { message: `No field named \u201C${String(xField)}\u201D` });
3299
+ if (xField && !category) return /* @__PURE__ */ jsx14(NoData, { message: `No field named \u201C${String(xField)}\u201D` });
3146
3300
  const allNumeric = frame.fields.filter((f) => f.type === "number");
3147
3301
  const at = (f) => values[allNumeric.indexOf(f)];
3148
3302
  const numeric = category ? allNumeric.filter((f) => f !== category) : [];
3149
- if (category && !numeric.length) return /* @__PURE__ */ jsx13(NoData, { message: `No number fields to draw besides \u201C${category.name}\u201D` });
3303
+ if (category && !numeric.length) return /* @__PURE__ */ jsx14(NoData, { message: `No number fields to draw besides \u201C${category.name}\u201D` });
3150
3304
  const fields = category ? numeric.map((f) => ({ key: f.name, name: at(f)?.name ?? f.name, color: at(f)?.color ?? theme.accent, config: at(f)?.config ?? {}, values: f.values.map(num2) })) : [{ key: "reduced", name: "", color: theme.accent, config: values[0].config, values: values.map((v) => v.value) }];
3151
3305
  const labels = category ? categoryLabels(category) : values.map((v) => v.name);
3152
3306
  const colorAt = (fi, i) => category ? fields[fi].color : values[i].color;
@@ -3161,34 +3315,34 @@ function BarChartPanel({ panel, frames, width }) {
3161
3315
  const gridAxis = left ?? right;
3162
3316
  const plotW = width - (left ? AXIS_W : 0) - (right ? AXIS_W : 0);
3163
3317
  const every = Math.max(1, Math.ceil(labels.length / Math.max(1, Math.floor(plotW / 44))));
3164
- const axisColumn = (axis) => /* @__PURE__ */ jsx13(View10, { style: [styles11.axis, axis.side === "left" ? styles11.axisLeft : styles11.axisRight], children: plot.height > 0 && axis.ticks.map((t) => /* @__PURE__ */ jsx13(
3165
- Text11,
3318
+ const axisColumn = (axis) => /* @__PURE__ */ jsx14(View10, { style: [styles12.axis, axis.side === "left" ? styles12.axisLeft : styles12.axisRight], children: plot.height > 0 && axis.ticks.map((t) => /* @__PURE__ */ jsx14(
3319
+ Text12,
3166
3320
  {
3167
- style: [styles11.tick, { color: theme.textMuted, top: plot.height * (1 - barFraction(axis, t)) - 7 }, axis.side === "left" ? styles11.tickLeft : styles11.tickRight],
3321
+ style: [styles12.tick, { color: theme.textMuted, top: plot.height * (1 - barFraction(axis, t)) - 7 }, axis.side === "left" ? styles12.tickLeft : styles12.tickRight],
3168
3322
  numberOfLines: 1,
3169
3323
  children: formatValue(t, { ...axis.config, decimals: tickDecimals(axis.ticks) })
3170
3324
  },
3171
3325
  t
3172
3326
  )) });
3173
- return /* @__PURE__ */ jsxs11(View10, { style: styles11.fill, children: [
3174
- (left?.label || right?.label) && /* @__PURE__ */ jsxs11(View10, { style: styles11.axisLabels, children: [
3175
- /* @__PURE__ */ jsx13(Text11, { style: [styles11.axisLabel, { color: theme.textMuted }], children: left?.label ?? "" }),
3176
- /* @__PURE__ */ jsx13(Text11, { style: [styles11.axisLabel, { color: theme.textMuted }], children: right?.label ?? "" })
3327
+ return /* @__PURE__ */ jsxs12(View10, { style: styles12.fill, children: [
3328
+ (left?.label || right?.label) && /* @__PURE__ */ jsxs12(View10, { style: styles12.axisLabels, children: [
3329
+ /* @__PURE__ */ jsx14(Text12, { style: [styles12.axisLabel, { color: theme.textMuted }], children: left?.label ?? "" }),
3330
+ /* @__PURE__ */ jsx14(Text12, { style: [styles12.axisLabel, { color: theme.textMuted }], children: right?.label ?? "" })
3177
3331
  ] }),
3178
- /* @__PURE__ */ jsxs11(View10, { style: styles11.barRow, children: [
3332
+ /* @__PURE__ */ jsxs12(View10, { style: styles12.barRow, children: [
3179
3333
  left && axisColumn(left),
3180
- /* @__PURE__ */ jsxs11(View10, { style: styles11.fill, onLayout: onPlotLayout, children: [
3181
- gridAxis && plot.height > 0 && gridAxis.ticks.map((t) => /* @__PURE__ */ jsx13(View10, { style: [styles11.gridLine, { backgroundColor: theme.grid, top: plot.height * (1 - barFraction(gridAxis, t)) }] }, t)),
3182
- /* @__PURE__ */ jsx13(View10, { style: styles11.barchart, children: labels.map((_, i) => /* @__PURE__ */ jsx13(View10, { style: styles11.barStack, children: fields.map((f, fi) => {
3334
+ /* @__PURE__ */ jsxs12(View10, { style: styles12.fill, onLayout: onPlotLayout, children: [
3335
+ gridAxis && plot.height > 0 && gridAxis.ticks.map((t) => /* @__PURE__ */ jsx14(View10, { style: [styles12.gridLine, { backgroundColor: theme.grid, top: plot.height * (1 - barFraction(gridAxis, t)) }] }, t)),
3336
+ /* @__PURE__ */ jsx14(View10, { style: styles12.barchart, children: labels.map((_, i) => /* @__PURE__ */ jsx14(View10, { style: styles12.barStack, children: fields.map((f, fi) => {
3183
3337
  const axis = axisOf(fi);
3184
3338
  const base = barFraction(axis, Math.min(Math.max(0, axis.bottom), axis.top));
3185
3339
  const end = barFraction(axis, f.values[i] ?? 0);
3186
- return /* @__PURE__ */ jsx13(View10, { style: styles11.barSlot, children: /* @__PURE__ */ jsx13(
3340
+ return /* @__PURE__ */ jsx14(View10, { style: styles12.barSlot, children: /* @__PURE__ */ jsx14(
3187
3341
  View10,
3188
3342
  {
3189
3343
  style: [
3190
- styles11.bar,
3191
- end < base && styles11.barDown,
3344
+ styles12.bar,
3345
+ end < base && styles12.barDown,
3192
3346
  { bottom: `${Math.min(base, end) * 100}%`, height: `${Math.abs(end - base) * 100}%`, backgroundColor: colorAt(fi, i) }
3193
3347
  ]
3194
3348
  }
@@ -3197,8 +3351,8 @@ function BarChartPanel({ panel, frames, width }) {
3197
3351
  ] }),
3198
3352
  right && axisColumn(right)
3199
3353
  ] }),
3200
- /* @__PURE__ */ jsx13(View10, { style: [styles11.barLabels, { marginLeft: left ? AXIS_W : 0, marginRight: right ? AXIS_W : 0 }], children: labels.map((label, i) => /* @__PURE__ */ jsx13(Text11, { style: [styles11.barLabel, { color: theme.textMuted }], numberOfLines: 1, children: i % every === 0 ? label : " " }, i)) }),
3201
- category && fields.length > 1 && /* @__PURE__ */ jsx13(Legend, { items: fields })
3354
+ /* @__PURE__ */ jsx14(View10, { style: [styles12.barLabels, { marginLeft: left ? AXIS_W : 0, marginRight: right ? AXIS_W : 0 }], children: labels.map((label, i) => /* @__PURE__ */ jsx14(Text12, { style: [styles12.barLabel, { color: theme.textMuted }], numberOfLines: 1, children: i % every === 0 ? label : " " }, i)) }),
3355
+ category && fields.length > 1 && /* @__PURE__ */ jsx14(Legend, { items: fields })
3202
3356
  ] });
3203
3357
  }
3204
3358
  var AXIS_W = 40;
@@ -3208,15 +3362,15 @@ function num2(v) {
3208
3362
  return Number.isFinite(n) ? n : null;
3209
3363
  }
3210
3364
  function UnsupportedPanel({ panel }) {
3211
- return /* @__PURE__ */ jsx13(NoData, { message: `"${panel.type}" panels aren't supported yet` });
3365
+ return /* @__PURE__ */ jsx14(NoData, { message: `"${panel.type}" panels aren't supported yet` });
3212
3366
  }
3213
- var styles11 = StyleSheet11.create({
3367
+ var styles12 = StyleSheet12.create({
3214
3368
  fill: { flex: 1 },
3215
- tr: { flexDirection: "row", borderBottomWidth: StyleSheet11.hairlineWidth },
3369
+ tr: { flexDirection: "row", borderBottomWidth: StyleSheet12.hairlineWidth },
3216
3370
  th: { paddingVertical: 6, paddingHorizontal: 6, fontSize: 12, fontWeight: "600" },
3217
3371
  td: { paddingVertical: 6, paddingHorizontal: 6, justifyContent: "center" },
3218
3372
  cellText: { fontSize: 12 },
3219
- footer: { borderBottomWidth: 0, borderTopWidth: StyleSheet11.hairlineWidth },
3373
+ footer: { borderBottomWidth: 0, borderTopWidth: StyleSheet12.hairlineWidth },
3220
3374
  footerText: { fontWeight: "600", fontVariant: ["tabular-nums"] },
3221
3375
  gaugeTrack: { position: "absolute", left: 6, right: 6, bottom: 3, height: 3, borderRadius: 2, overflow: "hidden" },
3222
3376
  gaugeFill: { height: "100%", borderRadius: 2 },
@@ -3232,7 +3386,7 @@ var styles11 = StyleSheet11.create({
3232
3386
  barDown: { borderTopLeftRadius: 0, borderTopRightRadius: 0, borderBottomLeftRadius: 4, borderBottomRightRadius: 4 },
3233
3387
  barLabels: { flexDirection: "row", gap: 2 },
3234
3388
  barLabel: { flex: 1, fontSize: 10, marginTop: 4, textAlign: "center" },
3235
- gridLine: { position: "absolute", left: 0, right: 0, height: StyleSheet11.hairlineWidth },
3389
+ gridLine: { position: "absolute", left: 0, right: 0, height: StyleSheet12.hairlineWidth },
3236
3390
  axis: { width: AXIS_W },
3237
3391
  axisLeft: { paddingRight: 6 },
3238
3392
  axisRight: { paddingLeft: 6 },
@@ -3244,10 +3398,10 @@ var styles11 = StyleSheet11.create({
3244
3398
  });
3245
3399
 
3246
3400
  // src/ui/panels/TimeSeriesPanel.tsx
3247
- import { useId, useMemo as useMemo7, useRef as useRef4, useState as useState9 } from "react";
3248
- import { Pressable as Pressable11, StyleSheet as StyleSheet12, Text as Text12, View as View11 } from "react-native";
3249
- import Svg8, { Circle, ClipPath, Defs, G, Line, Path as Path8, Rect, Text as SvgText3 } from "react-native-svg";
3250
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3401
+ import { useId, useMemo as useMemo7, useRef as useRef5, useState as useState10 } from "react";
3402
+ import { Pressable as Pressable12, StyleSheet as StyleSheet13, Text as Text13, View as View11 } from "react-native";
3403
+ import Svg9, { Circle, ClipPath, Defs, G, Line, Path as Path9, Rect, Text as SvgText3 } from "react-native-svg";
3404
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3251
3405
  var BASE_PAD = { top: 8, right: 8, bottom: 20, left: 44 };
3252
3406
  var BAR_MAX = 24;
3253
3407
  function TimeSeriesPanel({ panel, frames }) {
@@ -3255,20 +3409,20 @@ function TimeSeriesPanel({ panel, frames }) {
3255
3409
  const { range: range3, setRawRange, pinned, setPinned } = useDashboard();
3256
3410
  const { resolve, openLinks } = usePanelLinks(panel);
3257
3411
  const [size, onLayout] = useLayout();
3258
- const [hoverX, setHoverX] = useState9(null);
3259
- const [preview, setPreview] = useState9(null);
3260
- const [xZoom, setXZoom] = useState9(null);
3261
- const pinch = useRef4(null);
3262
- const originX = useRef4(0);
3412
+ const [hoverX, setHoverX] = useState10(null);
3413
+ const [preview, setPreview] = useState10(null);
3414
+ const [xZoom, setXZoom] = useState10(null);
3415
+ const pinch = useRef5(null);
3416
+ const originX = useRef5(0);
3263
3417
  const id = useId();
3264
3418
  const clipId = `plot${id.replace(/[^a-zA-Z0-9]/g, "")}`;
3265
- const [touching, setTouching] = useState9(false);
3419
+ const [touching, setTouching] = useState10(false);
3266
3420
  const numericX = panel.type === "trend";
3267
3421
  const { series, xConfig } = useMemo7(
3268
3422
  () => numericX ? styledXYSeries(panel, frames, theme.scheme) : { series: styledSeries(panel, frames, theme.scheme), xConfig: {} },
3269
3423
  [numericX, panel, frames, theme.scheme]
3270
3424
  );
3271
- if (!series.length || series.every((s) => s.values.every((v) => v == null))) return /* @__PURE__ */ jsx14(NoData, {});
3425
+ if (!series.length || series.every((s) => s.values.every((v) => v == null))) return /* @__PURE__ */ jsx15(NoData, {});
3272
3426
  const style = (s) => s.config.custom?.drawStyle ?? (panel.type === "graph" && panel.bars ? "bars" : "line");
3273
3427
  const anyBars = series.some((s) => style(s) === "bars");
3274
3428
  const anyFill = series.some((s) => (s.config.custom?.fillOpacity ?? 0) > 0);
@@ -3327,11 +3481,11 @@ function TimeSeriesPanel({ panel, frames }) {
3327
3481
  )
3328
3482
  ) : [];
3329
3483
  const isPinned = !!hover && pinned === id;
3330
- return /* @__PURE__ */ jsxs12(View11, { style: styles12.fill, children: [
3331
- /* @__PURE__ */ jsx14(
3484
+ return /* @__PURE__ */ jsxs13(View11, { style: styles13.fill, children: [
3485
+ /* @__PURE__ */ jsx15(
3332
3486
  View11,
3333
3487
  {
3334
- style: styles12.fill,
3488
+ style: styles13.fill,
3335
3489
  onStartShouldSetResponderCapture: twoFingers,
3336
3490
  onMoveShouldSetResponderCapture: twoFingers,
3337
3491
  onResponderTerminationRequest: () => false,
@@ -3343,10 +3497,10 @@ function TimeSeriesPanel({ panel, frames }) {
3343
3497
  onResponderMove: onPinchMove,
3344
3498
  onResponderRelease: () => onPinchEnd(true),
3345
3499
  onResponderTerminate: () => onPinchEnd(false),
3346
- children: /* @__PURE__ */ jsxs12(
3500
+ children: /* @__PURE__ */ jsxs13(
3347
3501
  View11,
3348
3502
  {
3349
- style: styles12.fill,
3503
+ style: styles13.fill,
3350
3504
  onLayout,
3351
3505
  onStartShouldSetResponder: () => true,
3352
3506
  onResponderGrant: (e) => {
@@ -3366,12 +3520,12 @@ function TimeSeriesPanel({ panel, frames }) {
3366
3520
  setHoverX(null);
3367
3521
  },
3368
3522
  children: [
3369
- size.width > 0 && /* @__PURE__ */ jsxs12(Svg8, { width: size.width, height: size.height, children: [
3370
- ticks.map((t) => /* @__PURE__ */ jsxs12(G, { children: [
3371
- /* @__PURE__ */ jsx14(Line, { x1: PAD.left, x2: PAD.left + plotW, y1: y(t), y2: y(t), stroke: theme.grid, strokeWidth: 1 }),
3372
- /* @__PURE__ */ jsx14(SvgText3, { x: PAD.left - 6, y: y(t) + 3, fontSize: 10, fill: theme.textMuted, textAnchor: "end", children: formatValue(t, { ...unitConfig, decimals: tickDecimals(ticks) }) })
3523
+ size.width > 0 && /* @__PURE__ */ jsxs13(Svg9, { width: size.width, height: size.height, children: [
3524
+ ticks.map((t) => /* @__PURE__ */ jsxs13(G, { children: [
3525
+ /* @__PURE__ */ jsx15(Line, { x1: PAD.left, x2: PAD.left + plotW, y1: y(t), y2: y(t), stroke: theme.grid, strokeWidth: 1 }),
3526
+ /* @__PURE__ */ jsx15(SvgText3, { x: PAD.left - 6, y: y(t) + 3, fontSize: 10, fill: theme.textMuted, textAnchor: "end", children: formatValue(t, { ...unitConfig, decimals: tickDecimals(ticks) }) })
3373
3527
  ] }, t)),
3374
- xTicks.map((t) => /* @__PURE__ */ jsx14(
3528
+ xTicks.map((t) => /* @__PURE__ */ jsx15(
3375
3529
  SvgText3,
3376
3530
  {
3377
3531
  x: x(t),
@@ -3383,65 +3537,65 @@ function TimeSeriesPanel({ panel, frames }) {
3383
3537
  },
3384
3538
  t
3385
3539
  )),
3386
- /* @__PURE__ */ jsx14(AxisTitles, { x: xTitle, y: yTitle, plot: { left: PAD.left, top: PAD.top, width: plotW, height: plotH }, height: size.height }),
3387
- /* @__PURE__ */ jsx14(Defs, { children: /* @__PURE__ */ jsx14(ClipPath, { id: clipId, children: /* @__PURE__ */ jsx14(Rect, { x: PAD.left - 6, y: 0, width: plotW + 12, height: size.height }) }) }),
3388
- /* @__PURE__ */ jsxs12(G, { clipPath: `url(#${clipId})`, children: [
3540
+ /* @__PURE__ */ jsx15(AxisTitles, { x: xTitle, y: yTitle, plot: { left: PAD.left, top: PAD.top, width: plotW, height: plotH }, height: size.height }),
3541
+ /* @__PURE__ */ jsx15(Defs, { children: /* @__PURE__ */ jsx15(ClipPath, { id: clipId, children: /* @__PURE__ */ jsx15(Rect, { x: PAD.left - 6, y: 0, width: plotW + 12, height: size.height }) }) }),
3542
+ /* @__PURE__ */ jsxs13(G, { clipPath: `url(#${clipId})`, children: [
3389
3543
  barSeries.map(
3390
3544
  (s, si) => s.times.map((t, i) => {
3391
3545
  const v = s.values[i];
3392
3546
  if (v == null || t < xFrom || t > xTo) return null;
3393
3547
  const left = x(t) - groupW / 2 + si * (groupW / barSeries.length);
3394
- return /* @__PURE__ */ jsx14(Path8, { d: barPath(left, barW, y(Math.max(v, 0)), y(Math.min(v, 0)), v >= 0), fill: s.color }, `${s.key}-${i}`);
3548
+ return /* @__PURE__ */ jsx15(Path9, { d: barPath(left, barW, y(Math.max(v, 0)), y(Math.min(v, 0)), v >= 0), fill: s.color }, `${s.key}-${i}`);
3395
3549
  })
3396
3550
  ),
3397
3551
  series.filter((s) => style(s) !== "bars").map((s) => {
3398
3552
  const fill = (s.config.custom?.fillOpacity ?? 0) / 100;
3399
3553
  const showPoints = style(s) === "points" || s.config.custom?.showPoints === "always" || s.config.custom?.showPoints !== "never" && s.times.length <= plotW / 14;
3400
3554
  const segs = segments(s, x, y, s.config.custom?.lineInterpolation === "stepAfter");
3401
- return /* @__PURE__ */ jsxs12(G, { children: [
3402
- fill > 0 && segs.map((seg, i) => /* @__PURE__ */ jsx14(Path8, { d: `${seg.d}L${seg.lastX},${y(Math.max(yMin, 0))}L${seg.firstX},${y(Math.max(yMin, 0))}Z`, fill: s.color, opacity: fill }, `f${i}`)),
3403
- style(s) !== "points" && segs.map((seg, i) => /* @__PURE__ */ jsx14(Path8, { d: seg.d, stroke: s.color, strokeWidth: s.config.custom?.lineWidth ?? 2, fill: "none", strokeLinejoin: "round", strokeLinecap: "round" }, `l${i}`)),
3555
+ return /* @__PURE__ */ jsxs13(G, { children: [
3556
+ fill > 0 && segs.map((seg, i) => /* @__PURE__ */ jsx15(Path9, { d: `${seg.d}L${seg.lastX},${y(Math.max(yMin, 0))}L${seg.firstX},${y(Math.max(yMin, 0))}Z`, fill: s.color, opacity: fill }, `f${i}`)),
3557
+ style(s) !== "points" && segs.map((seg, i) => /* @__PURE__ */ jsx15(Path9, { d: seg.d, stroke: s.color, strokeWidth: s.config.custom?.lineWidth ?? 2, fill: "none", strokeLinejoin: "round", strokeLinecap: "round" }, `l${i}`)),
3404
3558
  showPoints && s.times.map(
3405
- (t, i) => s.values[i] == null ? null : /* @__PURE__ */ jsx14(Circle, { cx: x(t), cy: y(s.values[i]), r: 4, fill: s.color, stroke: theme.surface, strokeWidth: 2 }, i)
3559
+ (t, i) => s.values[i] == null ? null : /* @__PURE__ */ jsx15(Circle, { cx: x(t), cy: y(s.values[i]), r: 4, fill: s.color, stroke: theme.surface, strokeWidth: 2 }, i)
3406
3560
  )
3407
3561
  ] }, s.key);
3408
3562
  }),
3409
- hover && /* @__PURE__ */ jsxs12(G, { children: [
3410
- /* @__PURE__ */ jsx14(Line, { x1: x(hover.time), x2: x(hover.time), y1: PAD.top, y2: PAD.top + plotH, stroke: theme.textMuted, strokeWidth: 1 }),
3563
+ hover && /* @__PURE__ */ jsxs13(G, { children: [
3564
+ /* @__PURE__ */ jsx15(Line, { x1: x(hover.time), x2: x(hover.time), y1: PAD.top, y2: PAD.top + plotH, stroke: theme.textMuted, strokeWidth: 1 }),
3411
3565
  hover.rows.map(
3412
- (r) => r.value == null ? null : /* @__PURE__ */ jsx14(Circle, { cx: x(r.time), cy: y(r.value), r: 5, fill: r.color, stroke: theme.surface, strokeWidth: 2 }, r.key)
3566
+ (r) => r.value == null ? null : /* @__PURE__ */ jsx15(Circle, { cx: x(r.time), cy: y(r.value), r: 5, fill: r.color, stroke: theme.surface, strokeWidth: 2 }, r.key)
3413
3567
  )
3414
3568
  ] })
3415
3569
  ] })
3416
3570
  ] }),
3417
- xZoom && !preview && /* @__PURE__ */ jsx14(
3418
- Pressable11,
3571
+ xZoom && !preview && /* @__PURE__ */ jsx15(
3572
+ Pressable12,
3419
3573
  {
3420
3574
  onPress: () => setXZoom(null),
3421
3575
  accessibilityRole: "button",
3422
3576
  hitSlop: 8,
3423
- style: ({ pressed }) => [styles12.reset, { backgroundColor: theme.surface, borderColor: theme.border }, pressed && { opacity: 0.7 }],
3424
- children: /* @__PURE__ */ jsx14(Text12, { style: [styles12.resetText, { color: theme.accent }], children: "Reset zoom" })
3577
+ style: ({ pressed }) => [styles13.reset, { backgroundColor: theme.surface, borderColor: theme.border }, pressed && { opacity: 0.7 }],
3578
+ children: /* @__PURE__ */ jsx15(Text13, { style: [styles13.resetText, { color: theme.accent }], children: "Reset zoom" })
3425
3579
  }
3426
3580
  ),
3427
- hover && /* @__PURE__ */ jsxs12(
3581
+ hover && /* @__PURE__ */ jsxs13(
3428
3582
  View11,
3429
3583
  {
3430
3584
  pointerEvents: isPinned ? "auto" : "none",
3431
3585
  onStartShouldSetResponder: () => isPinned,
3432
3586
  style: [
3433
- styles12.tooltip,
3587
+ styles13.tooltip,
3434
3588
  { backgroundColor: theme.surface, borderColor: theme.border },
3435
3589
  x(hover.time) > size.width / 2 ? { right: size.width - x(hover.time) + 8 } : { left: x(hover.time) + 8 }
3436
3590
  ],
3437
3591
  children: [
3438
- /* @__PURE__ */ jsx14(Text12, { style: [styles12.tooltipTime, { color: theme.textMuted }], children: numericX ? formatValue(hover.time, xConfig) : formatTooltipTime(hover.time) }),
3439
- hover.rows.map((r) => /* @__PURE__ */ jsxs12(View11, { style: styles12.tooltipRow, children: [
3440
- /* @__PURE__ */ jsx14(View11, { style: [styles12.swatch, { backgroundColor: r.color }] }),
3441
- /* @__PURE__ */ jsx14(Text12, { style: [styles12.tooltipName, { color: theme.textSecondary }], numberOfLines: 1, children: r.name }),
3442
- /* @__PURE__ */ jsx14(Text12, { style: [styles12.tooltipValue, { color: theme.text }], children: formatValue(r.value, r.config) })
3592
+ /* @__PURE__ */ jsx15(Text13, { style: [styles13.tooltipTime, { color: theme.textMuted }], children: numericX ? formatValue(hover.time, xConfig) : formatTooltipTime(hover.time) }),
3593
+ hover.rows.map((r) => /* @__PURE__ */ jsxs13(View11, { style: styles13.tooltipRow, children: [
3594
+ /* @__PURE__ */ jsx15(View11, { style: [styles13.swatch, { backgroundColor: r.color }] }),
3595
+ /* @__PURE__ */ jsx15(Text13, { style: [styles13.tooltipName, { color: theme.textSecondary }], numberOfLines: 1, children: r.name }),
3596
+ /* @__PURE__ */ jsx15(Text13, { style: [styles13.tooltipValue, { color: theme.text }], children: formatValue(r.value, r.config) })
3443
3597
  ] }, r.key)),
3444
- isPinned && /* @__PURE__ */ jsx14(TooltipLinks, { links: hoverLinks, onOpen: (l) => openLinks([l]) })
3598
+ isPinned && /* @__PURE__ */ jsx15(TooltipLinks, { links: hoverLinks, onOpen: (l) => openLinks([l]) })
3445
3599
  ]
3446
3600
  }
3447
3601
  )
@@ -3450,7 +3604,7 @@ function TimeSeriesPanel({ panel, frames }) {
3450
3604
  )
3451
3605
  }
3452
3606
  ),
3453
- showLegend(panel, series.length) && /* @__PURE__ */ jsx14(Legend, { items: series })
3607
+ showLegend(panel, series.length) && /* @__PURE__ */ jsx15(Legend, { items: series })
3454
3608
  ] });
3455
3609
  }
3456
3610
  function segments(s, x, y, step = false) {
@@ -3539,7 +3693,7 @@ function linkData(r, frames, xField) {
3539
3693
  time: xField === void 0 ? r.time : void 0
3540
3694
  };
3541
3695
  }
3542
- var styles12 = StyleSheet12.create({
3696
+ var styles13 = StyleSheet13.create({
3543
3697
  fill: { flex: 1 },
3544
3698
  tooltip: {
3545
3699
  position: "absolute",
@@ -3547,7 +3701,7 @@ var styles12 = StyleSheet12.create({
3547
3701
  paddingHorizontal: 8,
3548
3702
  paddingVertical: 6,
3549
3703
  borderRadius: 6,
3550
- borderWidth: StyleSheet12.hairlineWidth,
3704
+ borderWidth: StyleSheet13.hairlineWidth,
3551
3705
  maxWidth: 220,
3552
3706
  shadowColor: "#000",
3553
3707
  shadowOpacity: 0.12,
@@ -3555,7 +3709,7 @@ var styles12 = StyleSheet12.create({
3555
3709
  shadowOffset: { width: 0, height: 2 },
3556
3710
  elevation: 3
3557
3711
  },
3558
- reset: { position: "absolute", top: 4, right: 8, paddingHorizontal: 8, paddingVertical: 3, borderRadius: 6, borderWidth: StyleSheet12.hairlineWidth },
3712
+ reset: { position: "absolute", top: 4, right: 8, paddingHorizontal: 8, paddingVertical: 3, borderRadius: 6, borderWidth: StyleSheet13.hairlineWidth },
3559
3713
  resetText: { fontSize: 11, fontWeight: "600" },
3560
3714
  tooltipTime: { fontSize: 11, marginBottom: 3 },
3561
3715
  tooltipRow: { flexDirection: "row", alignItems: "center", gap: 6 },
@@ -3565,9 +3719,9 @@ var styles12 = StyleSheet12.create({
3565
3719
  });
3566
3720
 
3567
3721
  // src/ui/panels/XYChartPanel.tsx
3568
- import { useId as useId2, useMemo as useMemo8, useState as useState10 } from "react";
3569
- import { StyleSheet as StyleSheet13, View as View12 } from "react-native";
3570
- import Svg9, { Circle as Circle2, G as G2, Line as Line2, Path as Path9, Text as SvgText4 } from "react-native-svg";
3722
+ import { useId as useId2, useMemo as useMemo8, useState as useState11 } from "react";
3723
+ import { StyleSheet as StyleSheet14, View as View12 } from "react-native";
3724
+ import Svg10, { Circle as Circle2, G as G2, Line as Line2, Path as Path10, Text as SvgText4 } from "react-native-svg";
3571
3725
 
3572
3726
  // src/ui/xychart.ts
3573
3727
  var byName = (name) => name ? { matcher: { id: "byName", options: name } } : void 0;
@@ -3698,15 +3852,15 @@ function xyDomain(values, config) {
3698
3852
  }
3699
3853
 
3700
3854
  // src/ui/panels/XYChartPanel.tsx
3701
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3855
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3702
3856
  var AXIS = { left: 44, bottom: 20 };
3703
3857
  var EDGE = 8;
3704
3858
  var HIT_PX2 = 32;
3705
3859
  function XYChartPanel({ panel, frames }) {
3706
3860
  const theme = useDashTheme();
3707
3861
  const [size, onLayout] = useLayout();
3708
- const [touch, setTouch] = useState10(null);
3709
- const [touching, setTouching] = useState10(false);
3862
+ const [touch, setTouch] = useState11(null);
3863
+ const [touching, setTouching] = useState11(false);
3710
3864
  const id = useId2();
3711
3865
  const { pinned, setPinned } = useDashboard();
3712
3866
  const { resolve, openLinks } = usePanelLinks(panel);
@@ -3733,7 +3887,7 @@ function XYChartPanel({ panel, frames }) {
3733
3887
  const points = series.map((s) => ({ px: s.xs.map(x), py: s.ys.map(y) }));
3734
3888
  return { x, y, x0, x1, y0, y1, points, paths: series.map((s, i) => drawSeries(s, points[i].px, points[i].py)) };
3735
3889
  }, [series, first, pad.left, pad.top, plotW, plotH]);
3736
- if (!first || !layout || series.every((s) => !s.rows.length)) return /* @__PURE__ */ jsx15(NoData, {});
3890
+ if (!first || !layout || series.every((s) => !s.rows.length)) return /* @__PURE__ */ jsx16(NoData, {});
3737
3891
  const xTicks = showX ? axisTicks(layout.x0, layout.x1, plotW < 220 ? 2 : plotW < 400 ? 3 : 5) : [];
3738
3892
  const yTicks = showY ? axisTicks(layout.y0, layout.y1, plotH < 100 ? 2 : 4) : [];
3739
3893
  const gridX = first.xConfig.custom?.axisGridShow !== false;
@@ -3742,11 +3896,11 @@ function XYChartPanel({ panel, frames }) {
3742
3896
  const hoverLinks = hover ? rowLinks(panel, hover.series.frame, hover.series.rows[hover.index], frames.length > 1, resolve) : [];
3743
3897
  const isPinned = !!hover && pinned === id;
3744
3898
  const legendItems = series.filter((s) => !s.yConfig.custom?.hideFrom?.legend);
3745
- return /* @__PURE__ */ jsxs13(View12, { style: styles13.fill, children: [
3746
- /* @__PURE__ */ jsxs13(
3899
+ return /* @__PURE__ */ jsxs14(View12, { style: styles14.fill, children: [
3900
+ /* @__PURE__ */ jsxs14(
3747
3901
  View12,
3748
3902
  {
3749
- style: styles13.fill,
3903
+ style: styles14.fill,
3750
3904
  onLayout,
3751
3905
  onStartShouldSetResponder: () => true,
3752
3906
  onResponderGrant: (e) => {
@@ -3765,14 +3919,14 @@ function XYChartPanel({ panel, frames }) {
3765
3919
  setTouch(null);
3766
3920
  },
3767
3921
  children: [
3768
- size.width > 0 && /* @__PURE__ */ jsxs13(Svg9, { width: size.width, height: size.height, children: [
3769
- yTicks.map((t) => /* @__PURE__ */ jsxs13(G2, { children: [
3770
- gridY && /* @__PURE__ */ jsx15(Line2, { x1: pad.left, x2: pad.left + plotW, y1: layout.y(t), y2: layout.y(t), stroke: theme.grid, strokeWidth: 1 }),
3771
- /* @__PURE__ */ jsx15(SvgText4, { x: pad.left - 6, y: layout.y(t) + 3, fontSize: 10, fill: theme.textMuted, textAnchor: "end", children: formatValue(t, { ...first.yConfig, decimals: first.yConfig.decimals ?? tickDecimals(yTicks) }) })
3922
+ size.width > 0 && /* @__PURE__ */ jsxs14(Svg10, { width: size.width, height: size.height, children: [
3923
+ yTicks.map((t) => /* @__PURE__ */ jsxs14(G2, { children: [
3924
+ gridY && /* @__PURE__ */ jsx16(Line2, { x1: pad.left, x2: pad.left + plotW, y1: layout.y(t), y2: layout.y(t), stroke: theme.grid, strokeWidth: 1 }),
3925
+ /* @__PURE__ */ jsx16(SvgText4, { x: pad.left - 6, y: layout.y(t) + 3, fontSize: 10, fill: theme.textMuted, textAnchor: "end", children: formatValue(t, { ...first.yConfig, decimals: first.yConfig.decimals ?? tickDecimals(yTicks) }) })
3772
3926
  ] }, `y${t}`)),
3773
- xTicks.map((t) => /* @__PURE__ */ jsxs13(G2, { children: [
3774
- gridX && /* @__PURE__ */ jsx15(Line2, { x1: layout.x(t), x2: layout.x(t), y1: pad.top, y2: pad.top + plotH, stroke: theme.grid, strokeWidth: 1 }),
3775
- /* @__PURE__ */ jsx15(
3927
+ xTicks.map((t) => /* @__PURE__ */ jsxs14(G2, { children: [
3928
+ gridX && /* @__PURE__ */ jsx16(Line2, { x1: layout.x(t), x2: layout.x(t), y1: pad.top, y2: pad.top + plotH, stroke: theme.grid, strokeWidth: 1 }),
3929
+ /* @__PURE__ */ jsx16(
3776
3930
  SvgText4,
3777
3931
  {
3778
3932
  x: layout.x(t),
@@ -3784,12 +3938,12 @@ function XYChartPanel({ panel, frames }) {
3784
3938
  }
3785
3939
  )
3786
3940
  ] }, `x${t}`)),
3787
- /* @__PURE__ */ jsx15(AxisTitles, { x: xTitle, y: yTitle, plot: { left: pad.left, top: pad.top, width: plotW, height: plotH }, height: size.height }),
3788
- series.map((s, si) => /* @__PURE__ */ jsxs13(G2, { children: [
3789
- layout.paths[si].line && /* @__PURE__ */ jsx15(Path9, { d: layout.paths[si].line, stroke: s.color, strokeWidth: s.lineWidth, fill: "none", strokeLinejoin: "round" }),
3790
- layout.paths[si].dots.map(([color, d]) => /* @__PURE__ */ jsx15(Path9, { d, fill: color }, color))
3941
+ /* @__PURE__ */ jsx16(AxisTitles, { x: xTitle, y: yTitle, plot: { left: pad.left, top: pad.top, width: plotW, height: plotH }, height: size.height }),
3942
+ series.map((s, si) => /* @__PURE__ */ jsxs14(G2, { children: [
3943
+ layout.paths[si].line && /* @__PURE__ */ jsx16(Path10, { d: layout.paths[si].line, stroke: s.color, strokeWidth: s.lineWidth, fill: "none", strokeLinejoin: "round" }),
3944
+ layout.paths[si].dots.map(([color, d]) => /* @__PURE__ */ jsx16(Path10, { d, fill: color }, color))
3791
3945
  ] }, s.key)),
3792
- hover && /* @__PURE__ */ jsx15(
3946
+ hover && /* @__PURE__ */ jsx16(
3793
3947
  Circle2,
3794
3948
  {
3795
3949
  cx: hover.px,
@@ -3801,7 +3955,7 @@ function XYChartPanel({ panel, frames }) {
3801
3955
  }
3802
3956
  )
3803
3957
  ] }),
3804
- hover && /* @__PURE__ */ jsx15(
3958
+ hover && /* @__PURE__ */ jsx16(
3805
3959
  RowTooltip,
3806
3960
  {
3807
3961
  at: { x: hover.px, y: hover.py },
@@ -3816,7 +3970,7 @@ function XYChartPanel({ panel, frames }) {
3816
3970
  ]
3817
3971
  }
3818
3972
  ),
3819
- showLegend(panel, legendItems.length) && /* @__PURE__ */ jsx15(Legend, { items: legendItems })
3973
+ showLegend(panel, legendItems.length) && /* @__PURE__ */ jsx16(Legend, { items: legendItems })
3820
3974
  ] });
3821
3975
  }
3822
3976
  function drawSeries(s, px, py) {
@@ -3850,7 +4004,7 @@ function nearestPoint(series, points, at) {
3850
4004
  });
3851
4005
  return best;
3852
4006
  }
3853
- var styles13 = StyleSheet13.create({
4007
+ var styles14 = StyleSheet14.create({
3854
4008
  fill: { flex: 1 }
3855
4009
  });
3856
4010
 
@@ -3878,7 +4032,7 @@ function panelComponent(type) {
3878
4032
  }
3879
4033
 
3880
4034
  // src/ui/DashboardView.tsx
3881
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
4035
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3882
4036
  var GAP2 = 8;
3883
4037
  var SIDE = 12;
3884
4038
  var TITLE_H = 28;
@@ -3896,44 +4050,44 @@ function DashboardView({ mode = "auto", header, footer, refreshable }) {
3896
4050
  () => layoutDashboard(dashboard, layoutMode, { values: variables, info: variableInfo2 }),
3897
4051
  [dashboard, layoutMode, variables, variableInfo2]
3898
4052
  );
3899
- const [toggled, setToggled] = useState11({});
4053
+ const [toggled, setToggled] = useState12({});
3900
4054
  const { seen, viewportH, onScroll, onViewportLayout, onSectionLayout } = useSeenSections(window.height);
3901
4055
  const maxPanelH = Math.max(MIN_PANEL_H, viewportH - SIDE * 2);
3902
4056
  const contentW = width - SIDE * 2;
3903
4057
  const canRefresh = refreshable ?? dashboard.panels.some((p) => panelHasQueries(p) || p.panels?.some(panelHasQueries));
3904
- return /* @__PURE__ */ jsxs14(View13, { style: [styles14.fill, { backgroundColor: theme.background }], onLayout, children: [
3905
- width > 0 && /* @__PURE__ */ jsxs14(
4058
+ return /* @__PURE__ */ jsxs15(View13, { style: [styles15.fill, { backgroundColor: theme.background }], onLayout, children: [
4059
+ width > 0 && /* @__PURE__ */ jsxs15(
3906
4060
  ScrollView6,
3907
4061
  {
3908
4062
  onScroll,
3909
4063
  onScrollBeginDrag: () => setPinned(null),
3910
4064
  onLayout: onViewportLayout,
3911
4065
  scrollEventThrottle: 100,
3912
- contentContainerStyle: [styles14.content, { paddingLeft: SIDE + insets.left, paddingRight: SIDE + insets.right }],
4066
+ contentContainerStyle: [styles15.content, { paddingLeft: SIDE + insets.left, paddingRight: SIDE + insets.right }],
3913
4067
  keyboardShouldPersistTaps: "handled",
3914
- refreshControl: canRefresh ? /* @__PURE__ */ jsx16(RefreshControl, { refreshing: false, onRefresh: refresh }) : void 0,
4068
+ refreshControl: canRefresh ? /* @__PURE__ */ jsx17(RefreshControl, { refreshing: false, onRefresh: refresh }) : void 0,
3915
4069
  children: [
3916
4070
  header,
3917
4071
  sections.map((section) => {
3918
4072
  const collapsed = toggled[section.key] ?? section.collapsed;
3919
- return /* @__PURE__ */ jsxs14(View13, { style: styles14.section, onLayout: (e) => onSectionLayout(section.key, e), children: [
3920
- section.row && /* @__PURE__ */ jsxs14(
3921
- Pressable12,
4073
+ return /* @__PURE__ */ jsxs15(View13, { style: styles15.section, onLayout: (e) => onSectionLayout(section.key, e), children: [
4074
+ section.row && /* @__PURE__ */ jsxs15(
4075
+ Pressable13,
3922
4076
  {
3923
4077
  onPress: () => setToggled((t) => ({ ...t, [section.key]: !collapsed })),
3924
- style: styles14.rowHeader,
4078
+ style: styles15.rowHeader,
3925
4079
  accessibilityRole: "button",
3926
4080
  accessibilityState: { expanded: !collapsed },
3927
4081
  children: [
3928
- /* @__PURE__ */ jsx16(Text13, { style: [styles14.chevron, { color: theme.textMuted }], children: collapsed ? "\u25B8" : "\u25BE" }),
3929
- /* @__PURE__ */ jsx16(Text13, { style: [styles14.rowTitle, { color: theme.text }], numberOfLines: 2, children: interpolate(section.row.title ?? "", { values: variables, info: variableInfo2, scoped: section.row.scopedVars, timezone: dashboard.timezone }) })
4082
+ /* @__PURE__ */ jsx17(Text14, { style: [styles15.chevron, { color: theme.textMuted }], children: collapsed ? "\u25B8" : "\u25BE" }),
4083
+ /* @__PURE__ */ jsx17(Text14, { style: [styles15.rowTitle, { color: theme.text }], numberOfLines: 2, children: interpolate(section.row.title ?? "", { values: variables, info: variableInfo2, scoped: section.row.scopedVars, timezone: dashboard.timezone }) })
3930
4084
  ]
3931
4085
  }
3932
4086
  ),
3933
- !collapsed && layoutMode === "grid" && /* @__PURE__ */ jsx16(GridSection, { grid: section.grid, width: contentW, maxPanelH, deferred: !seen.has(section.key) }),
3934
- !collapsed && layoutMode === "phone" && section.rows.map((row, ri) => /* @__PURE__ */ jsx16(View13, { style: styles14.row, children: row.cells.map((cell) => {
4087
+ !collapsed && layoutMode === "grid" && /* @__PURE__ */ jsx17(GridSection, { grid: section.grid, width: contentW, maxPanelH, deferred: !seen.has(section.key) }),
4088
+ !collapsed && layoutMode === "phone" && section.rows.map((row, ri) => /* @__PURE__ */ jsx17(View13, { style: styles15.row, children: row.cells.map((cell) => {
3935
4089
  const w = (contentW + GAP2) * (cell.span / GRID_COLUMNS) - GAP2;
3936
- return /* @__PURE__ */ jsx16(PanelCard, { panel: cell.panel, width: w, height: Math.min(gridUnitsToPx(row.h), maxPanelH), deferred: !seen.has(section.key) }, cell.key);
4090
+ return /* @__PURE__ */ jsx17(PanelCard, { panel: cell.panel, width: w, height: Math.min(gridUnitsToPx(row.h), maxPanelH), deferred: !seen.has(section.key) }, cell.key);
3937
4091
  }) }, ri))
3938
4092
  ] }, section.key);
3939
4093
  })
@@ -3947,13 +4101,13 @@ function GridSection({ grid, width, maxPanelH, deferred }) {
3947
4101
  const colW = (width + GAP2) / GRID_COLUMNS;
3948
4102
  const tallest = Math.max(0, ...grid.cells.map((c) => gridUnitsToPx(c.h)));
3949
4103
  const scale = tallest > maxPanelH ? maxPanelH / tallest : 1;
3950
- return /* @__PURE__ */ jsx16(View13, { style: { height: gridUnitsToPx(grid.h) * scale }, children: grid.cells.map((cell) => /* @__PURE__ */ jsx16(View13, { style: [styles14.gridCell, { left: cell.x * colW, top: gridOffsetPx(cell.y) * scale }], children: /* @__PURE__ */ jsx16(PanelCard, { panel: cell.panel, width: cell.w * colW - GAP2, height: gridUnitsToPx(cell.h) * scale, deferred }) }, cell.key)) });
4104
+ return /* @__PURE__ */ jsx17(View13, { style: { height: gridUnitsToPx(grid.h) * scale }, children: grid.cells.map((cell) => /* @__PURE__ */ jsx17(View13, { style: [styles15.gridCell, { left: cell.x * colW, top: gridOffsetPx(cell.y) * scale }], children: /* @__PURE__ */ jsx17(PanelCard, { panel: cell.panel, width: cell.w * colW - GAP2, height: gridUnitsToPx(cell.h) * scale, deferred }) }, cell.key)) });
3951
4105
  }
3952
4106
  function useSeenSections(viewportHeight) {
3953
- const [seen, setSeen] = useState11(/* @__PURE__ */ new Set());
3954
- const view = useRef5({ y: 0, h: viewportHeight });
3955
- const [viewportH, setViewportH] = useState11(viewportHeight);
3956
- const positions = useRef5(/* @__PURE__ */ new Map());
4107
+ const [seen, setSeen] = useState12(/* @__PURE__ */ new Set());
4108
+ const view = useRef6({ y: 0, h: viewportHeight });
4109
+ const [viewportH, setViewportH] = useState12(viewportHeight);
4110
+ const positions = useRef6(/* @__PURE__ */ new Map());
3957
4111
  const reveal = useCallback3(() => {
3958
4112
  const { y, h } = view.current;
3959
4113
  setSeen((prev) => {
@@ -3992,14 +4146,14 @@ function useSeenSections(viewportHeight) {
3992
4146
  }
3993
4147
  function PanelCard(props) {
3994
4148
  const { panel, width, height } = props;
3995
- return /* @__PURE__ */ jsx16(RenderBoundary, { resetKeys: [panel, width, height], fallback: (error) => /* @__PURE__ */ jsx16(PanelError, { panel, width, height, error }), children: /* @__PURE__ */ jsx16(PanelCardContent, { ...props }) });
4149
+ return /* @__PURE__ */ jsx17(RenderBoundary, { resetKeys: [panel, width, height], fallback: (error) => /* @__PURE__ */ jsx17(PanelError, { panel, width, height, error }), children: /* @__PURE__ */ jsx17(PanelCardContent, { ...props }) });
3996
4150
  }
3997
4151
  function PanelError({ panel, width, height, error }) {
3998
4152
  const theme = useDashTheme();
3999
- return /* @__PURE__ */ jsxs14(View13, { style: [styles14.card, { width, height, backgroundColor: theme.surface, borderColor: theme.danger }], accessibilityRole: "alert", children: [
4000
- !!panel.title && /* @__PURE__ */ jsx16(Text13, { style: [styles14.title, styles14.errorTitle, { color: theme.text }], numberOfLines: 1, children: panel.title }),
4001
- /* @__PURE__ */ jsx16(Text13, { style: [styles14.errorText, { color: theme.danger }], children: "This panel couldn\u2019t be shown." }),
4002
- /* @__PURE__ */ jsx16(Text13, { style: [styles14.errorText, { color: theme.textMuted }], numberOfLines: 3, children: error.message })
4153
+ return /* @__PURE__ */ jsxs15(View13, { style: [styles15.card, { width, height, backgroundColor: theme.surface, borderColor: theme.danger }], accessibilityRole: "alert", children: [
4154
+ !!panel.title && /* @__PURE__ */ jsx17(Text14, { style: [styles15.title, styles15.errorTitle, { color: theme.text }], numberOfLines: 1, children: panel.title }),
4155
+ /* @__PURE__ */ jsx17(Text14, { style: [styles15.errorText, { color: theme.danger }], children: "This panel couldn\u2019t be shown." }),
4156
+ /* @__PURE__ */ jsx17(Text14, { style: [styles15.errorText, { color: theme.textMuted }], numberOfLines: 3, children: error.message })
4003
4157
  ] });
4004
4158
  }
4005
4159
  function PanelCardContent({ panel, width, height, deferred }) {
@@ -4013,23 +4167,23 @@ function PanelCardContent({ panel, width, height, deferred }) {
4013
4167
  const hasLinks = !!panel.links?.length;
4014
4168
  const hasTitle = !!panel.title || hasLinks || !!problem;
4015
4169
  const title = panel.title ? interpolate(panel.title, { values: variables, info: variableInfo2, scoped: panel.scopedVars, timezone: dashboard.timezone }) : "";
4016
- return /* @__PURE__ */ jsxs14(View13, { style: [styles14.card, { width, height, backgroundColor: theme.surface, borderColor: theme.border }], children: [
4017
- hasTitle && /* @__PURE__ */ jsxs14(View13, { style: styles14.titleRow, children: [
4018
- /* @__PURE__ */ jsx16(Text13, { style: [styles14.title, { color: theme.text }], numberOfLines: 1, children: title }),
4019
- !!problem && /* @__PURE__ */ jsx16(Text13, { style: [styles14.problem, { color: theme.danger }], numberOfLines: 1, accessibilityRole: "alert", children: problem }),
4020
- hasLinks && /* @__PURE__ */ jsx16(
4021
- Pressable12,
4170
+ return /* @__PURE__ */ jsxs15(View13, { style: [styles15.card, { width, height, backgroundColor: theme.surface, borderColor: theme.border }], children: [
4171
+ hasTitle && /* @__PURE__ */ jsxs15(View13, { style: styles15.titleRow, children: [
4172
+ /* @__PURE__ */ jsx17(Text14, { style: [styles15.title, { color: theme.text }], numberOfLines: 1, children: title }),
4173
+ !!problem && /* @__PURE__ */ jsx17(Text14, { style: [styles15.problem, { color: theme.danger }], numberOfLines: 1, accessibilityRole: "alert", children: problem }),
4174
+ hasLinks && /* @__PURE__ */ jsx17(
4175
+ Pressable13,
4022
4176
  {
4023
4177
  onPress: () => openLinks(resolve(panel.links), title || void 0),
4024
4178
  accessibilityRole: "button",
4025
4179
  accessibilityLabel: panel.links.length === 1 ? panel.links[0].title || "Open link" : "Panel links",
4026
4180
  hitSlop: 10,
4027
- style: ({ pressed }) => [styles14.titleLink, pressed && { opacity: 0.6 }],
4028
- children: /* @__PURE__ */ jsx16(LinkIcon, { color: theme.textMuted })
4181
+ style: ({ pressed }) => [styles15.titleLink, pressed && { opacity: 0.6 }],
4182
+ children: /* @__PURE__ */ jsx17(LinkIcon, { color: theme.textMuted })
4029
4183
  }
4030
4184
  )
4031
4185
  ] }),
4032
- /* @__PURE__ */ jsx16(View13, { style: styles14.body, children: deferred && !input ? null : input ? group ? /* @__PURE__ */ jsx16(InputGroupBody, { panel }) : /* @__PURE__ */ jsx16(InputPanelBody, { panel }) : /* @__PURE__ */ jsx16(DataPanelBody, { panel, width: width - 24, height: height - (hasTitle ? TITLE_H : 0) - 16 }) })
4186
+ /* @__PURE__ */ jsx17(View13, { style: styles15.body, children: deferred && !input ? null : input ? group ? /* @__PURE__ */ jsx17(InputGroupBody, { panel }) : /* @__PURE__ */ jsx17(InputPanelBody, { panel }) : /* @__PURE__ */ jsx17(DataPanelBody, { panel, width: width - 24, height: height - (hasTitle ? TITLE_H : 0) - 16 }) })
4033
4187
  ] });
4034
4188
  }
4035
4189
  function DataPanelBody({ panel, width, height }) {
@@ -4038,14 +4192,14 @@ function DataPanelBody({ panel, width, height }) {
4038
4192
  const data = usePanelData(panel, width, needsData);
4039
4193
  const Component2 = panelComponent(panel.type);
4040
4194
  if (needsData && data.error) {
4041
- return /* @__PURE__ */ jsx16(View13, { style: styles14.center, children: /* @__PURE__ */ jsx16(Text13, { style: [styles14.error, { color: theme.danger }], numberOfLines: 4, children: data.error }) });
4195
+ return /* @__PURE__ */ jsx17(View13, { style: styles15.center, children: /* @__PURE__ */ jsx17(Text14, { style: [styles15.error, { color: theme.danger }], numberOfLines: 4, children: data.error }) });
4042
4196
  }
4043
4197
  if (needsData && data.loading && !data.frames.length) {
4044
- return /* @__PURE__ */ jsx16(View13, { style: styles14.center, children: /* @__PURE__ */ jsx16(ActivityIndicator, { color: theme.textMuted }) });
4198
+ return /* @__PURE__ */ jsx17(View13, { style: styles15.center, children: /* @__PURE__ */ jsx17(ActivityIndicator, { color: theme.textMuted }) });
4045
4199
  }
4046
- return /* @__PURE__ */ jsx16(Component2, { panel, frames: data.frames, width, height });
4200
+ return /* @__PURE__ */ jsx17(Component2, { panel, frames: data.frames, width, height });
4047
4201
  }
4048
- var styles14 = StyleSheet14.create({
4202
+ var styles15 = StyleSheet15.create({
4049
4203
  fill: { flex: 1 },
4050
4204
  content: { padding: SIDE, paddingBottom: 32, gap: GAP2 },
4051
4205
  section: { gap: GAP2 },
@@ -4054,7 +4208,7 @@ var styles14 = StyleSheet14.create({
4054
4208
  rowTitle: { fontSize: 15, fontWeight: "600" },
4055
4209
  row: { flexDirection: "row", gap: GAP2 },
4056
4210
  gridCell: { position: "absolute" },
4057
- card: { borderRadius: 10, borderWidth: StyleSheet14.hairlineWidth, paddingHorizontal: 12, paddingVertical: 8, overflow: "hidden" },
4211
+ card: { borderRadius: 10, borderWidth: StyleSheet15.hairlineWidth, paddingHorizontal: 12, paddingVertical: 8, overflow: "hidden" },
4058
4212
  titleRow: { flexDirection: "row", alignItems: "flex-start", gap: 8, height: TITLE_H - 8, marginBottom: 8 },
4059
4213
  title: { flex: 1, fontSize: 13, fontWeight: "600" },
4060
4214
  titleLink: { paddingTop: 1 },
@@ -4067,11 +4221,76 @@ var styles14 = StyleSheet14.create({
4067
4221
  });
4068
4222
 
4069
4223
  // src/ui/inputs/InputForm.tsx
4070
- import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo10, useState as useState12 } from "react";
4071
- import { Pressable as Pressable13, StyleSheet as StyleSheet15, Text as Text14, View as View14 } from "react-native";
4072
- import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
4224
+ import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo10, useState as useState13 } from "react";
4225
+ import { Platform as Platform2, Pressable as Pressable14, StyleSheet as StyleSheet16, Text as Text15, View as View14 } from "react-native";
4226
+
4227
+ // src/ui/speech.ts
4228
+ var WEB_ERRORS = {
4229
+ "not-allowed": "Microphone access is blocked for this site",
4230
+ "service-not-allowed": "Speech recognition isn\u2019t allowed in this browser",
4231
+ "audio-capture": "No microphone found",
4232
+ network: "Speech recognition needs an internet connection",
4233
+ "no-speech": "Didn\u2019t hear anything",
4234
+ "language-not-supported": "Speech recognition doesn\u2019t support this language"
4235
+ };
4236
+ function webSpeechRecognizer() {
4237
+ const g = globalThis;
4238
+ const Recognition = g.SpeechRecognition ?? g.webkitSpeechRecognition;
4239
+ if (!Recognition) return null;
4240
+ return {
4241
+ start(o) {
4242
+ const r = new Recognition();
4243
+ if (o.lang) r.lang = o.lang;
4244
+ r.interimResults = true;
4245
+ r.continuous = false;
4246
+ r.maxAlternatives = 1;
4247
+ let delivered = false;
4248
+ let aborted = false;
4249
+ let lastText = "";
4250
+ r.onresult = (e) => {
4251
+ let text = "";
4252
+ let final = true;
4253
+ for (let i = 0; i < e.results.length; i++) {
4254
+ text += e.results[i][0].transcript;
4255
+ if (!e.results[i].isFinal) final = false;
4256
+ }
4257
+ lastText = text.trim();
4258
+ if (final) delivered = true;
4259
+ o.onText(lastText, final);
4260
+ };
4261
+ r.onerror = (e) => {
4262
+ if (e.error === "aborted") return;
4263
+ o.onError(WEB_ERRORS[e.error] ?? "Speech recognition stopped");
4264
+ };
4265
+ r.onend = () => {
4266
+ if (!delivered && !aborted && lastText) o.onText(lastText, true);
4267
+ o.onEnd();
4268
+ };
4269
+ try {
4270
+ r.start();
4271
+ } catch {
4272
+ queueMicrotask(() => {
4273
+ o.onError("Speech recognition couldn\u2019t start");
4274
+ o.onEnd();
4275
+ });
4276
+ }
4277
+ return {
4278
+ stop: () => r.stop(),
4279
+ abort: () => {
4280
+ aborted = true;
4281
+ r.abort();
4282
+ }
4283
+ };
4284
+ }
4285
+ };
4286
+ }
4287
+
4288
+ // src/ui/inputs/InputForm.tsx
4289
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
4073
4290
  var NO_CHOICES = {};
4074
4291
  var NO_DEFAULTS = {};
4292
+ var webSpeech;
4293
+ var defaultSpeech = () => Platform2.OS === "web" ? webSpeech ??= webSpeechRecognizer() : null;
4075
4294
  function savedValues(panels, entries) {
4076
4295
  const values = {};
4077
4296
  for (const p of panels) {
@@ -4101,19 +4320,20 @@ function baseItems(group, editing, last) {
4101
4320
  return values.map((v, i) => ({ key: `b${i}`, values: v, edited: [] }));
4102
4321
  }
4103
4322
  var nextItemKey = 1;
4104
- function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, timestamp, defaults: given = NO_DEFAULTS, beforeSave, editing }) {
4323
+ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, timestamp, defaults: given = NO_DEFAULTS, beforeSave, editing, speech: givenSpeech, speechLang }) {
4324
+ const speech = givenSpeech === void 0 ? defaultSpeech() : givenSpeech;
4105
4325
  const theme = useDashTheme();
4106
4326
  const panels = useMemo10(() => plainInputPanels(dashboard), [dashboard]);
4107
4327
  const groups = useMemo10(() => inputGroups(dashboard), [dashboard]);
4108
4328
  const saved = useMemo10(() => editing ? savedValues(panels, editing) : NO_DEFAULTS, [panels, editing]);
4109
- const [defaults, setDefaults] = useState12({});
4110
- const [edits, setEdits] = useState12({});
4111
- const [last, setLast] = useState12({});
4112
- const [groupEdits, setGroupEdits] = useState12({});
4113
- const [offsetMs, setOffsetMs] = useState12(0);
4114
- const [status, setStatus] = useState12(null);
4115
- const [checked, setChecked] = useState12(false);
4116
- useEffect4(() => {
4329
+ const [defaults, setDefaults] = useState13({});
4330
+ const [edits, setEdits] = useState13({});
4331
+ const [last, setLast] = useState13({});
4332
+ const [groupEdits, setGroupEdits] = useState13({});
4333
+ const [offsetMs, setOffsetMs] = useState13(0);
4334
+ const [status, setStatus] = useState13(null);
4335
+ const [checked, setChecked] = useState13(false);
4336
+ useEffect5(() => {
4117
4337
  let run = 0;
4118
4338
  const load = async () => {
4119
4339
  const mine = ++run;
@@ -4153,6 +4373,8 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
4153
4373
  isDirty: (m) => m in edits,
4154
4374
  store,
4155
4375
  choices,
4376
+ speech,
4377
+ speechLang,
4156
4378
  problem: (m) => {
4157
4379
  const p = panels.find((x) => x.options.metric === m);
4158
4380
  return p && (checked || m in edits) ? inputProblem(p, value(m)) : void 0;
@@ -4162,7 +4384,7 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
4162
4384
  setGroupEdits((all) => ({ ...all, [groupKey(g)]: update(all[groupKey(g)] ?? base[groupKey(g)] ?? []) }));
4163
4385
  })
4164
4386
  };
4165
- }, [edits, saved, defaults, given, store, choices, panels, checked, itemsOf, last, groupEdits, base]);
4387
+ }, [edits, saved, defaults, given, store, choices, speech, speechLang, panels, checked, itemsOf, last, groupEdits, base]);
4166
4388
  const dirty = Object.keys(edits).length + groups.reduce((n, g) => n + groupChanges(base[groupKey(g)] ?? [], groupEdits[groupKey(g)]), 0);
4167
4389
  const recordedGroups = useCallback4(
4168
4390
  () => groups.filter((g) => editing || groupKey(g) in groupEdits || groupFields(g).some((f) => f.options.record === "always")),
@@ -4196,14 +4418,14 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
4196
4418
  setStatus(`Saved ${added.length} ${added.length === 1 ? "value" : "values"}`);
4197
4419
  onSaved?.(added.length, added);
4198
4420
  }, [panels, edits, state, offsetMs, store, onSaved, header, timestamp, beforeSave, editing, recordedGroups, itemsOf]);
4199
- return /* @__PURE__ */ jsx17(InputFormContext.Provider, { value: state, children: /* @__PURE__ */ jsx17(DashboardProvider, { dashboard, children: /* @__PURE__ */ jsx17(
4421
+ return /* @__PURE__ */ jsx18(InputFormContext.Provider, { value: state, children: /* @__PURE__ */ jsx18(DashboardProvider, { dashboard, children: /* @__PURE__ */ jsx18(
4200
4422
  DashboardView,
4201
4423
  {
4202
- header: header !== void 0 ? header : /* @__PURE__ */ jsx17(TimestampPicker, { offsetMs, onChange: setOffsetMs }),
4203
- footer: /* @__PURE__ */ jsxs15(View14, { style: [styles15.footer, { backgroundColor: theme.surface, borderTopColor: theme.border }], children: [
4204
- /* @__PURE__ */ jsx17(Text14, { style: [styles15.status, { color: status?.startsWith("Can\u2019t") ? theme.danger : theme.textSecondary }], children: status ?? (dirty ? `${dirty} unsaved ${dirty === 1 ? "change" : "changes"}` : "Nothing to save") }),
4205
- dirty > 0 && /* @__PURE__ */ jsx17(
4206
- Pressable13,
4424
+ header: header !== void 0 ? header : /* @__PURE__ */ jsx18(TimestampPicker, { offsetMs, onChange: setOffsetMs }),
4425
+ footer: /* @__PURE__ */ jsxs16(View14, { style: [styles16.footer, { backgroundColor: theme.surface, borderTopColor: theme.border }], children: [
4426
+ /* @__PURE__ */ jsx18(Text15, { style: [styles16.status, { color: status?.startsWith("Can\u2019t") ? theme.danger : theme.textSecondary }], children: status ?? (dirty ? `${dirty} unsaved ${dirty === 1 ? "change" : "changes"}` : "Nothing to save") }),
4427
+ dirty > 0 && /* @__PURE__ */ jsx18(
4428
+ Pressable14,
4207
4429
  {
4208
4430
  onPress: () => {
4209
4431
  setEdits({});
@@ -4211,19 +4433,19 @@ function InputForm({ dashboard, store, onSaved, choices = NO_CHOICES, header, ti
4211
4433
  setChecked(false);
4212
4434
  setStatus(null);
4213
4435
  },
4214
- style: styles15.secondary,
4436
+ style: styles16.secondary,
4215
4437
  accessibilityRole: "button",
4216
- children: /* @__PURE__ */ jsx17(Text14, { style: { color: theme.textSecondary, fontWeight: "500" }, children: "Discard" })
4438
+ children: /* @__PURE__ */ jsx18(Text15, { style: { color: theme.textSecondary, fontWeight: "500" }, children: "Discard" })
4217
4439
  }
4218
4440
  ),
4219
- /* @__PURE__ */ jsx17(
4220
- Pressable13,
4441
+ /* @__PURE__ */ jsx18(
4442
+ Pressable14,
4221
4443
  {
4222
4444
  onPress: save,
4223
4445
  disabled: !dirty,
4224
4446
  accessibilityRole: "button",
4225
- style: ({ pressed }) => [styles15.save, { backgroundColor: theme.accent, opacity: !dirty ? 0.4 : pressed ? 0.8 : 1 }],
4226
- children: /* @__PURE__ */ jsx17(Text14, { style: styles15.saveText, children: "Save" })
4447
+ style: ({ pressed }) => [styles16.save, { backgroundColor: theme.accent, opacity: !dirty ? 0.4 : pressed ? 0.8 : 1 }],
4448
+ children: /* @__PURE__ */ jsx18(Text15, { style: styles16.saveText, children: "Save" })
4227
4449
  }
4228
4450
  )
4229
4451
  ] })
@@ -4282,33 +4504,33 @@ async function replace(store, ids, entries) {
4282
4504
  var HOUR = 36e5;
4283
4505
  function TimestampPicker({ offsetMs, onChange }) {
4284
4506
  const theme = useDashTheme();
4285
- const [now, setNow] = useState12(() => Date.now());
4286
- useEffect4(() => {
4507
+ const [now, setNow] = useState13(() => Date.now());
4508
+ useEffect5(() => {
4287
4509
  const id = setInterval(() => setNow(Date.now()), 3e4);
4288
4510
  return () => clearInterval(id);
4289
4511
  }, []);
4290
4512
  const when = new Date(now + offsetMs);
4291
4513
  const step = (ms) => () => onChange(Math.min(0, offsetMs + ms));
4292
- return /* @__PURE__ */ jsxs15(View14, { style: [styles15.when, { backgroundColor: theme.surface, borderColor: theme.border }], children: [
4293
- /* @__PURE__ */ jsxs15(View14, { style: { flex: 1 }, children: [
4294
- /* @__PURE__ */ jsx17(Text14, { style: [styles15.whenLabel, { color: theme.textMuted }], children: "Recording for" }),
4295
- /* @__PURE__ */ jsx17(Text14, { style: [styles15.whenValue, { color: theme.text }], children: offsetMs === 0 ? "Now" : when.toLocaleString(void 0, { weekday: "short", month: "short", day: "numeric", hour: "numeric", minute: "2-digit" }) })
4514
+ return /* @__PURE__ */ jsxs16(View14, { style: [styles16.when, { backgroundColor: theme.surface, borderColor: theme.border }], children: [
4515
+ /* @__PURE__ */ jsxs16(View14, { style: { flex: 1 }, children: [
4516
+ /* @__PURE__ */ jsx18(Text15, { style: [styles16.whenLabel, { color: theme.textMuted }], children: "Recording for" }),
4517
+ /* @__PURE__ */ jsx18(Text15, { style: [styles16.whenValue, { color: theme.text }], children: offsetMs === 0 ? "Now" : when.toLocaleString(void 0, { weekday: "short", month: "short", day: "numeric", hour: "numeric", minute: "2-digit" }) })
4296
4518
  ] }),
4297
4519
  [
4298
4520
  ["\u22121d", -24 * HOUR],
4299
4521
  ["\u22121h", -HOUR],
4300
4522
  ["+1h", HOUR]
4301
- ].map(([label, ms]) => /* @__PURE__ */ jsx17(Pressable13, { onPress: step(ms), style: [styles15.stepBtn, { borderColor: theme.border }], accessibilityRole: "button", children: /* @__PURE__ */ jsx17(Text14, { style: { color: theme.text, fontSize: 13 }, children: label }) }, label)),
4302
- offsetMs !== 0 && /* @__PURE__ */ jsx17(Pressable13, { onPress: () => onChange(0), style: [styles15.stepBtn, { borderColor: theme.accent }], accessibilityRole: "button", children: /* @__PURE__ */ jsx17(Text14, { style: { color: theme.accent, fontSize: 13, fontWeight: "600" }, children: "Now" }) })
4523
+ ].map(([label, ms]) => /* @__PURE__ */ jsx18(Pressable14, { onPress: step(ms), style: [styles16.stepBtn, { borderColor: theme.border }], accessibilityRole: "button", children: /* @__PURE__ */ jsx18(Text15, { style: { color: theme.text, fontSize: 13 }, children: label }) }, label)),
4524
+ offsetMs !== 0 && /* @__PURE__ */ jsx18(Pressable14, { onPress: () => onChange(0), style: [styles16.stepBtn, { borderColor: theme.accent }], accessibilityRole: "button", children: /* @__PURE__ */ jsx18(Text15, { style: { color: theme.accent, fontSize: 13, fontWeight: "600" }, children: "Now" }) })
4303
4525
  ] });
4304
4526
  }
4305
- var styles15 = StyleSheet15.create({
4306
- footer: { flexDirection: "row", alignItems: "center", gap: 12, paddingHorizontal: 16, paddingVertical: 10, borderTopWidth: StyleSheet15.hairlineWidth },
4527
+ var styles16 = StyleSheet16.create({
4528
+ footer: { flexDirection: "row", alignItems: "center", gap: 12, paddingHorizontal: 16, paddingVertical: 10, borderTopWidth: StyleSheet16.hairlineWidth },
4307
4529
  status: { flex: 1, fontSize: 13 },
4308
4530
  secondary: { paddingHorizontal: 8, paddingVertical: 10 },
4309
4531
  save: { paddingHorizontal: 22, paddingVertical: 10, borderRadius: 8 },
4310
4532
  saveText: { color: "#fff", fontWeight: "600", fontSize: 15 },
4311
- when: { flexDirection: "row", alignItems: "center", gap: 6, padding: 12, borderRadius: 10, borderWidth: StyleSheet15.hairlineWidth },
4533
+ when: { flexDirection: "row", alignItems: "center", gap: 6, padding: 12, borderRadius: 10, borderWidth: StyleSheet16.hairlineWidth },
4312
4534
  whenLabel: { fontSize: 11 },
4313
4535
  whenValue: { fontSize: 15, fontWeight: "600" },
4314
4536
  stepBtn: { paddingHorizontal: 10, paddingVertical: 6, borderRadius: 6, borderWidth: 1 }
@@ -4325,6 +4547,7 @@ export {
4325
4547
  ConfigLoader,
4326
4548
  DASHBOARD_DS,
4327
4549
  DEFAULT_GAZETTEER,
4550
+ DICTATION_TYPES,
4328
4551
  DOCUMENT_GUIDE,
4329
4552
  DashThemeProvider,
4330
4553
  DashboardProvider,
@@ -4390,6 +4613,7 @@ export {
4390
4613
  dashboardSourceIds,
4391
4614
  defaultFetchJson,
4392
4615
  describeRange,
4616
+ dictationHints,
4393
4617
  diffJson,
4394
4618
  documentChanges,
4395
4619
  documentIdFor,
@@ -4457,6 +4681,7 @@ export {
4457
4681
  mappingProblem,
4458
4682
  mappingRow,
4459
4683
  mappingRows,
4684
+ matchChoices,
4460
4685
  metricChanges,
4461
4686
  movePanel,
4462
4687
  newDocument,
@@ -4484,6 +4709,9 @@ export {
4484
4709
  parseLocalDateTime,
4485
4710
  parseRange,
4486
4711
  parseSnippet,
4712
+ parseSpokenDuration,
4713
+ parseSpokenNumber,
4714
+ parseSpokenYesNo,
4487
4715
  parseTemplate,
4488
4716
  parseTime,
4489
4717
  pasteSnippet,
@@ -4533,9 +4761,11 @@ export {
4533
4761
  settleLayout,
4534
4762
  snapToGrid,
4535
4763
  splitPath,
4764
+ spokenValue,
4536
4765
  startOf,
4537
4766
  stringifyCompact,
4538
4767
  tabIdFor,
4768
+ takesDictation,
4539
4769
  templateNeeds,
4540
4770
  templatePrompt,
4541
4771
  textSuggestions,
@@ -4568,5 +4798,6 @@ export {
4568
4798
  variableWithQuery,
4569
4799
  variableWithType,
4570
4800
  visibleVariables,
4801
+ webSpeechRecognizer,
4571
4802
  zoomRange
4572
4803
  };