{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "telemetry-inspector",
  "title": "Telemetry inspector",
  "description": "Inspect rooftop temperature and wind readings over three time windows.",
  "registryDependencies": [
    "https://www.cyberspec.dev/r/recipe-layout.json",
    "https://www.cyberspec.dev/r/readout.json",
    "https://www.cyberspec.dev/r/segmented-control.json",
    "https://www.cyberspec.dev/r/signal-graph.json"
  ],
  "files": [
    {
      "path": "registry/cyber/recipes/telemetry-inspector.tsx",
      "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport { Readout } from \"@/registry/cyber/ui/readout\"\nimport { SegmentedControl } from \"@/registry/cyber/ui/segmented-control\"\nimport { SignalGraph } from \"@/registry/cyber/ui/signal-graph\"\nimport \"./recipe-layout.css\"\n\nconst channels = {\n  Thermal: { unit: \"°C\", samples: [16, 16, 15, 15, 16, 18, 22, 23, 26, 28, 27, 25, 23, 24, 23, 22, 21, 19, 18, 18, 17, 16, 16, 15] },\n  Wind: { unit: \"km/h\", samples: [4, 7, 8, 6, 4, 5, 7, 11, 10, 6, 5, 7, 14, 18, 11, 13, 8, 6, 5, 8, 6, 5, 4, 3] },\n}\ntype Channel = keyof typeof channels\n\nexport default function TelemetryInspector() {\n  const [channel, setChannel] = useState<Channel>(\"Thermal\")\n  const [period, setPeriod] = useState(\"24 h\")\n  const { unit, samples } = channels[channel]\n  const window = samples.slice(-parseInt(period, 10))\n  const mean = window.reduce((sum, value) => sum + value, 0) / window.length\n  return (\n    <div className=\"sink-stack\">\n      <SegmentedControl<Channel> label=\"Rooftop sensor\" options={[\"Thermal\", \"Wind\"]} fill value={channel}\n        onValueChange={next => next && setChannel(next)} />\n      <SignalGraph label={channel === \"Thermal\" ? \"Air temperature\" : \"Wind speed\"} unit={unit} data={window}\n        min={0} max={channel === \"Thermal\" ? 32 : 20} variant={channel === \"Wind\" ? \"bars\" : \"line\"} />\n      <div className=\"sink-row\" style={{ gap: \"12px 30px\" }}>\n        <Readout label=\"Low\" size=\"sm\" unit={unit} value={Math.min(...window)} />\n        <Readout label=\"Mean\" size=\"sm\" unit={unit} value={mean} precision={1} />\n        <Readout label=\"High\" size=\"sm\" unit={unit} value={Math.max(...window)} tone=\"flag\" />\n      </div>\n      <SegmentedControl label=\"History\" options={[\"6 h\", \"12 h\", \"24 h\"]} value={period}\n        onValueChange={next => next && setPeriod(next)} />\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "@components/recipes/telemetry-inspector.tsx"
    }
  ],
  "categories": [
    "recipe",
    "instruments"
  ],
  "type": "registry:component"
}
