{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "jobs",
  "title": "Jobs",
  "description": "A job board: tabs, a list of jobs, objectives to tick off, and the brief.",
  "dependencies": [
    "@ui-sdk/react@0.1.0-beta.5",
    "lucide-react@1.73.0"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json",
    "https://www.cyberspec.dev/r/alert-dialog.json",
    "https://www.cyberspec.dev/r/badge.json",
    "https://www.cyberspec.dev/r/button.json",
    "https://www.cyberspec.dev/r/card.json",
    "https://www.cyberspec.dev/r/checkbox.json",
    "https://www.cyberspec.dev/r/glitch-text.json",
    "https://www.cyberspec.dev/r/hover-card.json",
    "https://www.cyberspec.dev/r/micro.json",
    "https://www.cyberspec.dev/r/panel.json",
    "https://www.cyberspec.dev/r/progress.json",
    "https://www.cyberspec.dev/r/readout.json",
    "https://www.cyberspec.dev/r/screen.json",
    "https://www.cyberspec.dev/r/tabs.json",
    "https://www.cyberspec.dev/r/toaster.json",
    "https://www.cyberspec.dev/r/toggle.json"
  ],
  "files": [
    {
      "path": "registry/cyber/blocks/jobs/art.tsx",
      "content": "\"use client\"\n\nimport type { VehicleShape } from \"@/registry/cyber/blocks/jobs/data\"\n\n// The stills on a job's linked records, drawn rather than fetched: a\n// silhouette for the contact, a block of the district for the place, a side\n// elevation for the vehicle. All three sit on a 320 × 150 field and take\n// their colors from the theme.\n\n// A small deterministic stream of numbers from a string, so the same record\n// always draws the same picture.\nfunction seeded(seed: string) {\n  let state = [...seed].reduce((sum, letter) => (sum * 31 + letter.charCodeAt(0)) >>> 0, 7)\n  return () => {\n    state = (state * 1664525 + 1013904223) >>> 0\n    return state / 4294967296\n  }\n}\n\nconst frameProps = { viewBox: \"0 0 320 150\", preserveAspectRatio: \"xMidYMid slice\", \"aria-hidden\": true, focusable: false } as const\n\n// Three heads: a crop, a long fringe and a hood. Each is the outline of the\n// hair over the same faceted bust.\nconst hair = [\n  \"M132 62 138 34 160 24 184 32 190 62 182 48 160 42 140 48Z\",\n  \"M128 86 134 34 160 22 188 32 192 70 180 44 150 46 140 84Z\",\n  \"M124 96 130 38 160 18 190 38 196 96 184 60 160 34 136 60Z\",\n]\n\nfunction Portrait({ look, seed }: { look: 0 | 1 | 2; seed: string }) {\n  const next = seeded(seed)\n  return (\n    <svg {...frameProps}>\n      {/* An ID plate behind the head: scan rows, a height rule. */}\n      {Array.from({ length: 9 }, (_, row) => (\n        <path key={row} d={`M0 ${14 + row * 16}H320`} stroke=\"var(--cy-line-deco)\" strokeWidth=\"1\" strokeDasharray={row % 3 === 0 ? undefined : \"2 7\"} />\n      ))}\n      {Array.from({ length: 12 }, (_, tick) => (\n        <path key={tick} d={`M22 ${16 + tick * 11}h${tick % 4 === 0 ? 12 : 6}`} stroke=\"var(--cy-line-ctl)\" strokeWidth=\"1\" />\n      ))}\n      <path d=\"M90 150 100 118 138 104h44l38 14 10 32Z\" fill=\"var(--cy-panel-2)\" stroke=\"var(--cy-line-ctl)\" strokeWidth=\"1\" />\n      <path d=\"M148 88h24v20l-12 8-12-8Z\" fill=\"var(--cy-panel-2)\" stroke=\"var(--cy-line-ctl)\" strokeWidth=\"1\" />\n      <path d=\"M138 44 160 34l22 10 2 30-12 18h-24l-12-18Z\" fill=\"var(--cy-panel)\" stroke=\"var(--cy-ink)\" strokeWidth=\"1\" />\n      <path d={hair[look]} fill=\"var(--cy-fill-active)\" stroke=\"var(--cy-accent)\" strokeWidth=\"1\" />\n      {/* The optics: one lit band across the eyes. */}\n      <path d=\"M141 60h38v7h-38Z\" fill=\"var(--cy-signal)\" />\n      <path d=\"M160 92 152 82M160 92l8-10M138 104l22 12 22-12\" fill=\"none\" stroke=\"var(--cy-line-ctl)\" strokeWidth=\"1\" />\n      {/* Recognition marks, different for each face. */}\n      <path d=\"M118 26h-8v8M202 26h8v8M118 110h-8v-8M202 110h8v-8\" fill=\"none\" stroke=\"var(--cy-flag)\" strokeWidth=\"1\" />\n      {Array.from({ length: 14 }, (_, bar) => (\n        <rect key={bar} x={236 + bar * 5} y={104} width={next() > 0.5 ? 3 : 1} height={12 + Math.round(next() * 18)} fill=\"var(--cy-line-ctl)\" />\n      ))}\n    </svg>\n  )\n}\n\nfunction Place({ seed }: { seed: string }) {\n  const next = seeded(seed)\n  // Towers left to right, one of them the address: it gets the marker.\n  const towers: { x: number; top: number; width: number }[] = []\n  for (let x = 4; x < 312; ) {\n    const width = 16 + Math.round(next() * 22)\n    towers.push({ x, top: 26 + Math.round(next() * 74), width })\n    x += width + 3 + Math.round(next() * 5)\n  }\n  const target = towers[1 + Math.floor(next() * (towers.length - 2))]\n  const mid = target.x + target.width / 2\n  return (\n    <svg {...frameProps}>\n      {[128, 136, 145].map((y) => (\n        <path key={y} d={`M0 ${y}H320`} stroke=\"var(--cy-line-deco)\" strokeWidth=\"1\" />\n      ))}\n      {towers.map((tower, index) => (\n        <g key={tower.x}>\n          <rect\n            x={tower.x}\n            y={tower.top}\n            width={tower.width}\n            height={128 - tower.top}\n            fill={tower === target ? \"var(--cy-fill-hover)\" : \"var(--cy-panel-2)\"}\n            stroke={tower === target ? \"var(--cy-accent)\" : \"var(--cy-line-ctl)\"}\n            strokeWidth=\"1\"\n          />\n          {Array.from({ length: Math.floor((128 - tower.top) / 10) }, (_, row) =>\n            Array.from({ length: Math.floor(tower.width / 7) }, (_, col) =>\n              (row * 3 + col * 5 + index * 7) % 4 === 0 ? (\n                <rect key={`${row}-${col}`} x={tower.x + 3 + col * 7} y={tower.top + 5 + row * 10} width=\"3\" height=\"4\" fill=\"var(--cy-signal)\" />\n              ) : null,\n            ),\n          )}\n        </g>\n      ))}\n      <path d=\"M0 128H320\" stroke=\"var(--cy-accent)\" strokeWidth=\"1.5\" />\n      {/* The marker: a drop line and a diamond over the address. */}\n      <path d={`M${mid} ${target.top - 4}V${target.top - 14}`} stroke=\"var(--cy-flag)\" strokeWidth=\"1\" />\n      <path d={`M${mid} ${target.top - 26} ${mid + 6} ${target.top - 20} ${mid} ${target.top - 14} ${mid - 6} ${target.top - 20}Z`} fill=\"var(--cy-flag)\" />\n    </svg>\n  )\n}\n\n// A wheel is an octagon here: nothing in the kit is round.\nfunction Wheel({ x, y, r = 15 }: { x: number; y: number; r?: number }) {\n  const ring = (radius: number) =>\n    Array.from({ length: 8 }, (_, i) => {\n      const angle = (Math.PI / 4) * i + Math.PI / 8\n      return `${(x + Math.cos(angle) * radius).toFixed(1)},${(y + Math.sin(angle) * radius).toFixed(1)}`\n    }).join(\" \")\n  return (\n    <>\n      <polygon points={ring(r)} fill=\"var(--cy-panel)\" stroke=\"var(--cy-ink)\" strokeWidth=\"1\" />\n      <polygon points={ring(r * 0.45)} fill=\"none\" stroke=\"var(--cy-line-ctl)\" strokeWidth=\"1\" />\n    </>\n  )\n}\n\nconst bodies: Record<VehicleShape, { body: string; glass: string; detail: string; wheels: [number, number, number?][] }> = {\n  coupe: {\n    body: \"M40 106 44 86 96 78 132 54h64l48 24 34 8 6 20Z\",\n    glass: \"M138 60h28v18h-48ZM172 60h22l34 18h-56Z\",\n    detail: \"M44 92h40M240 92h40M100 98h118\",\n    wheels: [\n      [92, 106],\n      [236, 106],\n    ],\n  },\n  hauler: {\n    body: \"M30 108V44h150v64ZM184 108V58h50l40 22v28Z\",\n    glass: \"M192 64h38l28 16h-66Z\",\n    detail: \"M40 56h130M40 70h130M40 84h130M105 44v64M266 92h8\",\n    wheels: [\n      [72, 110, 16],\n      [146, 110, 16],\n      [238, 110, 16],\n    ],\n  },\n  bike: {\n    body: \"M92 104 128 66h52l22-14 24 4-14 14 34 34h-22l-24-22-30 8-28 18Z\",\n    glass: \"M202 52 222 34l8 4-6 20Z\",\n    detail: \"M128 66 112 56h-22M150 96h40M224 70l22 34\",\n    wheels: [\n      [96, 104, 20],\n      [246, 104, 20],\n    ],\n  },\n}\n\nfunction Vehicle({ shape }: { shape: VehicleShape }) {\n  const { body, glass, detail, wheels } = bodies[shape]\n  return (\n    <svg {...frameProps}>\n      {/* A dimensioned drawing: ground line, wheelbase rule, grid ticks. */}\n      {Array.from({ length: 16 }, (_, tick) => (\n        <path key={tick} d={`M${10 + tick * 20} 14v${tick % 4 === 0 ? 8 : 4}`} stroke=\"var(--cy-line-deco)\" strokeWidth=\"1\" />\n      ))}\n      <path d=\"M0 126H320\" stroke=\"var(--cy-accent)\" strokeWidth=\"1.5\" />\n      <path d={body} fill=\"var(--cy-panel-2)\" stroke=\"var(--cy-ink)\" strokeWidth=\"1\" strokeLinejoin=\"miter\" />\n      <path d={glass} fill=\"var(--cy-signal-fill)\" stroke=\"var(--cy-signal)\" strokeWidth=\"1\" />\n      <path d={detail} fill=\"none\" stroke=\"var(--cy-line-ctl)\" strokeWidth=\"1\" />\n      {wheels.map(([x, y, r]) => (\n        <Wheel key={x} x={x} y={y} r={r} />\n      ))}\n      <path\n        d={`M${wheels[0][0]} 138H${wheels[wheels.length - 1][0]}M${wheels[0][0]} 134v8M${wheels[wheels.length - 1][0]} 134v8`}\n        stroke=\"var(--cy-flag)\"\n        strokeWidth=\"1\"\n      />\n    </svg>\n  )\n}\n\nexport { Place, Portrait, Vehicle }\n",
      "type": "registry:component",
      "target": "@components/blocks/jobs/art.tsx"
    },
    {
      "path": "registry/cyber/blocks/jobs/data.ts",
      "content": "// The board's fiction: who posts work in the Halcyon Sprawl, and the jobs\n// that are open when the screen loads. Nothing here is fetched.\n\ntype Difficulty = \"Low\" | \"Moderate\" | \"Dangerous\"\ntype Kind = \"Intrusion\" | \"Courier\" | \"Recovery\" | \"Extraction\" | \"Escort\" | \"Bench work\" | \"Survey\"\ntype Group = \"nearby\" | \"side\"\ntype VehicleShape = \"coupe\" | \"hauler\" | \"bike\"\n\ntype Contact = {\n  name: string\n  role: string\n  district: string\n  /** A second fact for the dossier: a label and what it reads. */\n  fact: [string, string]\n  /** Which of the three drawn silhouettes this person gets. */\n  look: 0 | 1 | 2\n}\n\ntype Job = {\n  id: string\n  name: string\n  code: string\n  kind: Kind\n  group: Group\n  priority: boolean\n  difficulty: Difficulty\n  /** Metres from here. */\n  distance: number\n  district: string\n  pay: number\n  contact: keyof typeof contacts\n  objectives: { id: string; label: string }[]\n  /** The objectives already ticked when the job is first opened. */\n  done: string[]\n  brief: string[]\n  place: { name: string; meta: string; note: string }\n  vehicle: { name: string; meta: string; note: string; shape: VehicleShape }\n}\n\nconst contacts = {\n  mara: { name: \"Mara Voss\", role: \"Fixer\", district: \"Lowtide\", fact: [\"Jobs cleared\", \"214\"], look: 0 },\n  juno: { name: \"Juno Okafor\", role: \"Medic\", district: \"Lowtide\", fact: [\"Clinic hours\", \"20:00 to 06:00\"], look: 1 },\n  ren: { name: \"Ren Aoki\", role: \"Broker\", district: \"Glasswater\", fact: [\"Cut\", \"12%\"], look: 2 },\n  dex: { name: \"Dex Marlowe\", role: \"Driver\", district: \"The Stacks\", fact: [\"Holds a dock for\", \"6 min\"], look: 1 },\n  ilya: { name: \"Ilya Brandt\", role: \"Tech\", district: \"Cinder Row\", fact: [\"Rate\", \"¤ 900 / hr\"], look: 2 },\n  sable: { name: \"Sable Quinn\", role: \"Runner\", district: \"Meridian Heights\", fact: [\"Crew\", \"Static Saints\"], look: 0 },\n} satisfies Record<string, Contact>\n\nconst board: Job[] = [\n  {\n    id: \"dead-air\",\n    name: \"Dead Air\",\n    code: \"JB-0341\",\n    kind: \"Intrusion\",\n    group: \"nearby\",\n    priority: true,\n    difficulty: \"Moderate\",\n    distance: 340,\n    district: \"Glasswater\",\n    pay: 3800,\n    contact: \"mara\",\n    objectives: [\n      { id: \"mast\", label: \"Reach the Glasswater relay mast\" },\n      { id: \"splice\", label: \"Splice the Vanta trunk line\" },\n      { id: \"load\", label: \"Load Null Ping onto the relay\" },\n      { id: \"leave\", label: \"Walk out before the trace lands\" },\n    ],\n    done: [\"mast\"],\n    brief: [\n      \"Vanta Systems has been sitting on Lowtide Union's dispatch channel for a month. Mara wants the tap turned around so that it listens to nothing.\",\n      \"The mast is on a canal-side roof, lightly watched after dark. It will give you one clean uplink before someone notices the load.\",\n      \"Null Ping does the rest. Leave it running, and leave.\",\n    ],\n    place: { name: \"Glasswater relay\", meta: \"Vanta Systems // Roof mast\", note: \"Fire stair on the canal side. No camera on the third landing.\" },\n    vehicle: { name: \"Sparrow K2\", meta: \"Courier bike // Yours\", note: \"Parked under the lock bridge.\", shape: \"bike\" },\n  },\n  {\n    id: \"cold-chain\",\n    name: \"Cold Chain\",\n    code: \"JB-0352\",\n    kind: \"Courier\",\n    group: \"nearby\",\n    priority: false,\n    difficulty: \"Low\",\n    distance: 1200,\n    district: \"Lowtide\",\n    pay: 900,\n    contact: \"juno\",\n    objectives: [\n      { id: \"collect\", label: \"Collect the coolant case from the clinic\" },\n      { id: \"cold\", label: \"Keep the case under four degrees\" },\n      { id: \"desk\", label: \"Hand it to the Stacks night desk\" },\n    ],\n    done: [],\n    brief: [\n      \"A Meridian coolant case needs to be across the district before it warms. Juno won't say what's in it, only that it isn't hers.\",\n      \"The case logs its own temperature. Take the shaded route under the tideway: the direct one runs past two vents.\",\n      \"It pays on the reading, not on the clock.\",\n    ],\n    place: { name: \"Okafor clinic\", meta: \"Lowtide // Back door\", note: \"Knock twice. The front is for patients.\" },\n    vehicle: { name: \"Mule 440\", meta: \"Hauler // On loan\", note: \"Cold box fitted behind the cab.\", shape: \"hauler\" },\n  },\n  {\n    id: \"paper-lantern\",\n    name: \"Paper Lantern\",\n    code: \"JB-0347\",\n    kind: \"Recovery\",\n    group: \"nearby\",\n    priority: true,\n    difficulty: \"Moderate\",\n    distance: 2100,\n    district: \"Cinder Row\",\n    pay: 2600,\n    contact: \"ren\",\n    objectives: [\n      { id: \"stall\", label: \"Find the pawn stall on Cinder Row\" },\n      { id: \"shard\", label: \"Buy back or lift the ledger shard\" },\n      { id: \"verify\", label: \"Verify the shard on a clean deck\" },\n      { id: \"return\", label: \"Return the shard to the broker\" },\n    ],\n    done: [],\n    brief: [\n      \"A ledger shard went across a pawn counter by mistake. It lists who owes Ren, and how much, which makes it worth more to the people on it than to him.\",\n      \"The stall keeper doesn't know what she has. Keep it that way, and pay the tag price if you can.\",\n      \"Check it before you carry it. A copied shard is a different job.\",\n    ],\n    place: { name: \"Ash Market, stall 14\", meta: \"Cinder Row // Open late\", note: \"Third row in, under the paper lanterns.\" },\n    vehicle: { name: \"Halberd GT-4\", meta: \"Coupe // Rented\", note: \"Plates are clean until Friday.\", shape: \"coupe\" },\n  },\n  {\n    id: \"glass-jaw\",\n    name: \"Glass Jaw\",\n    code: \"JB-0329\",\n    kind: \"Extraction\",\n    group: \"nearby\",\n    priority: true,\n    difficulty: \"Dangerous\",\n    distance: 3600,\n    district: \"Meridian Heights\",\n    pay: 6400,\n    contact: \"mara\",\n    objectives: [\n      { id: \"pass\", label: \"Get a pass for the Meridian Heights lifts\" },\n      { id: \"level\", label: \"Reach lab level 31\" },\n      { id: \"find\", label: \"Find the auditor\" },\n      { id: \"core\", label: \"Bring her out through the service core\" },\n      { id: \"dock\", label: \"Meet the driver at the freight dock\" },\n    ],\n    done: [\"pass\", \"level\"],\n    brief: [\n      \"A Meridian Biotech auditor found something in the reflex booster trials and stopped answering her messages. Her sister is paying to have her walked out.\",\n      \"The lab levels are badge-locked and the lifts log every ride. The service core doesn't, but it's forty floors of ladder.\",\n      \"Dex holds the dock for six minutes. After that you're walking home.\",\n    ],\n    place: { name: \"Meridian tower, level 31\", meta: \"Meridian Biotech // Labs\", note: \"Service core hatch is behind the cold store.\" },\n    vehicle: { name: \"Mule 440 \\\"Patience\\\"\", meta: \"Hauler // Dex Marlowe\", note: \"Freight dock C, engine running.\", shape: \"hauler\" },\n  },\n  {\n    id: \"night-shift\",\n    name: \"Night Shift\",\n    code: \"JB-0350\",\n    kind: \"Escort\",\n    group: \"nearby\",\n    priority: false,\n    difficulty: \"Dangerous\",\n    distance: 780,\n    district: \"The Stacks\",\n    pay: 4100,\n    contact: \"dex\",\n    objectives: [\n      { id: \"meet\", label: \"Meet the convoy at Stack 9\" },\n      { id: \"ride\", label: \"Ride with the lead hauler to the tideway\" },\n      { id: \"second\", label: \"Keep the Neon Jackals off the second truck\" },\n    ],\n    done: [],\n    brief: [\n      \"Lowtide Union moves its payroll by road once a month, and the Neon Jackals have learned the date.\",\n      \"Dex drives lead. You're in the cab with him as far as the tideway gate, then on the roof of the second truck.\",\n      \"Nobody needs to get hurt. They need to decide it isn't worth it.\",\n    ],\n    place: { name: \"Stack 9 loading yard\", meta: \"The Stacks // Gate B\", note: \"Convoy rolls at 02:10. Be early.\" },\n    vehicle: { name: \"Union hauler 02\", meta: \"Hauler // Lowtide Union\", note: \"Roof rail fitted on the cab side.\", shape: \"hauler\" },\n  },\n  {\n    id: \"loose-wires\",\n    name: \"Loose Wires\",\n    code: \"JB-0318\",\n    kind: \"Bench work\",\n    group: \"side\",\n    priority: false,\n    difficulty: \"Low\",\n    distance: 4400,\n    district: \"Cinder Row\",\n    pay: 650,\n    contact: \"ilya\",\n    objectives: [\n      { id: \"pull\", label: \"Pull three capacitors from the scrap line\" },\n      { id: \"bring\", label: \"Bring them to the bench\" },\n      { id: \"probe\", label: \"Hold the probe while the deck is tested\" },\n    ],\n    done: [\"pull\"],\n    brief: [\n      \"Ilya is rebuilding a Vanta Mk.II from two dead ones and is three capacitors short.\",\n      \"The scrap line behind the foundry has the right boards. Ask the foreman first: he likes being asked.\",\n      \"She'll tune your deck for free while you're there.\",\n    ],\n    place: { name: \"Brandt's bench\", meta: \"Cinder Row // Unit 6\", note: \"Shutter is down. Use the side door.\" },\n    vehicle: { name: \"Sparrow K2 \\\"Wren\\\"\", meta: \"Courier bike // Ilya Brandt\", note: \"Borrow it. Bring it back charged.\", shape: \"bike\" },\n  },\n  {\n    id: \"second-opinion\",\n    name: \"Second Opinion\",\n    code: \"JB-0333\",\n    kind: \"Survey\",\n    group: \"side\",\n    priority: false,\n    difficulty: \"Moderate\",\n    distance: 5200,\n    district: \"Meridian Heights\",\n    pay: 1800,\n    contact: \"sable\",\n    objectives: [\n      { id: \"heron\", label: \"Scout the medevac pad on Heron Street\" },\n      { id: \"locks\", label: \"Scout the pad over the Glasswater locks\" },\n      { id: \"cycle\", label: \"Time one full launch cycle\" },\n      { id: \"send\", label: \"Send the timings to the runner\" },\n    ],\n    done: [],\n    brief: [\n      \"Sable wants to know how long a Solace Mutual medevac takes to lift, and from where. She hasn't said why, and it's better not to ask.\",\n      \"Two pads, both overlooked. Sit, watch, and write it down.\",\n      \"Don't be seen writing it down.\",\n    ],\n    place: { name: \"Heron Street pad\", meta: \"Solace Mutual // Roof\", note: \"The car park opposite has a clear line.\" },\n    vehicle: { name: \"Halberd GT-4 \\\"Grey\\\"\", meta: \"Coupe // Sable Quinn\", note: \"Tinted. Nobody looks twice.\", shape: \"coupe\" },\n  },\n]\n\n// The job that arrives while the board is open. Taking it adds it to the list.\nconst offer: Job = {\n  id: \"quiet-money\",\n  name: \"Quiet Money\",\n  code: \"JB-0356\",\n  kind: \"Courier\",\n  group: \"side\",\n  priority: false,\n  difficulty: \"Moderate\",\n  distance: 1900,\n  district: \"Glasswater\",\n  pay: 2200,\n  contact: \"ren\",\n  objectives: [\n    { id: \"locker\", label: \"Collect the credit chit from locker 40\" },\n    { id: \"cross\", label: \"Cross Glasswater without a scan\" },\n    { id: \"cashier\", label: \"Leave the chit with the union cashier\" },\n  ],\n  done: [],\n  brief: [\n    \"A credit chit has to cross Glasswater without touching a scanner, and Ren can't be seen anywhere near it.\",\n    \"There are three checkpoints between the lockers and the union hall. The canal path skips two.\",\n    \"The third one is your problem.\",\n  ],\n  place: { name: \"Canal lockers\", meta: \"Glasswater // Row 4\", note: \"Locker 40 opens to the code on the chit sleeve.\" },\n  vehicle: { name: \"Sparrow K2 \\\"Minnow\\\"\", meta: \"Courier bike // Yours\", note: \"Narrow enough for the canal path.\", shape: \"bike\" },\n}\n\nconst distanceOf = (metres: number) => (metres < 1000 ? `${metres} m` : `${(metres / 1000).toFixed(1)} km`)\n\n// Credits the way the Sprawl writes them: \"¤ 15 240\".\nconst creditsOf = (amount: number) => `¤ ${String(amount).replace(/\\B(?=(\\d{3})+$)/g, \" \")}`\n\nexport { board, contacts, creditsOf, distanceOf, offer }\nexport type { Contact, Difficulty, Group, Job, Kind, VehicleShape }\n",
      "type": "registry:component",
      "target": "@components/blocks/jobs/data.ts"
    },
    {
      "path": "registry/cyber/blocks/jobs/jobs.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.blocks {\n  [data-skin=\"cyber\"] [data-jobs-screen] {\n    grid-template-columns: minmax(0, 1fr);\n    container: job-screen / inline-size;\n    @media (pointer: coarse) {\n      --cy-h-sm: 44px;\n    }\n  }\n\n  /* Three columns: the board, the chosen job's sheet, its linked records.\n     The records drop under the other two when there isn't room for three,\n     and everything stacks on a phone. */\n  [data-skin=\"cyber\"] [data-kit=\"jobs\"] {\n    display: grid;\n    grid-template-columns: minmax(250px, 27fr) minmax(0, 48fr) minmax(200px, 21fr);\n    gap: 24px clamp(16px, 2cqi, 30px);\n    align-items: start;\n\n    @container job-screen (max-width: 1020px) {\n      grid-template-columns: minmax(224px, .65fr) minmax(0, 1fr);\n    }\n\n    @container job-screen (max-width: 690px) {\n      grid-template-columns: minmax(0, 1fr);\n      gap: 16px;\n    }\n  }\n\n  /* ── Status strip ──────────────────────────────────────────────────── */\n\n  /* What's tracked and where the waypoint is, at the far end of the strip. */\n  [data-skin=\"cyber\"] [data-jobs-now] {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 8px 28px;\n    margin: 0;\n\n    & div {\n      display: grid;\n      gap: 4px;\n      justify-items: start;\n    }\n\n    & dt {\n      font-size: var(--cy-text-xs);\n      color: var(--cy-ink-mute);\n    }\n\n    & dd {\n      min-height: 20px;\n      display: flex;\n      align-items: center;\n    }\n  }\n\n  /* ── The board ─────────────────────────────────────────────────────── */\n\n  [data-skin=\"cyber\"] [data-jobs-board] {\n    display: grid;\n    gap: 26px;\n    min-width: 0;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-browse] {\n    display: none;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-list] {\n    display: grid;\n    gap: 16px;\n    min-width: 0;\n    outline: none;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-group] {\n    display: grid;\n    gap: 4px;\n    min-width: 0;\n  }\n\n  /* A group's name over a rule, with how many rows it holds and a hot tick\n     at the rule's leading end. */\n  [data-skin=\"cyber\"] :is([data-jobs-group-label], [data-jobs-rule]) {\n    position: relative;\n    display: flex;\n    align-items: baseline;\n    justify-content: space-between;\n    gap: 12px;\n    min-width: 0;\n    padding: 0 2px 5px;\n    border-block-end: 1px solid var(--cy-line-deco);\n\n    &::after {\n      content: \"\";\n      position: absolute;\n      inset-block-end: -1px;\n      inset-inline-start: 0;\n      width: 28px;\n      height: 3px;\n      background: var(--cy-accent);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-group-label] {\n    margin-block-end: 2px;\n  }\n\n  /* A job: its type in a cut tile, its name over its difficulty, and what\n     marks it (new, tracked) over how far away it is. The row follows the\n     kit's state language through its frame. */\n  [data-skin=\"cyber\"] [data-jobs-row] {\n    --frame-cut: var(--cy-cut-sm);\n    --frame-line: var(--cy-line-ctl);\n    --frame-fill: var(--cy-panel-a);\n\n    display: grid;\n    grid-template-columns: 32px minmax(0, 1fr) auto;\n    grid-template-areas:\n      \"glyph name tags\"\n      \"glyph level distance\";\n    align-items: center;\n    gap: 3px 12px;\n    min-height: 54px;\n    padding: 7px 12px 7px 10px;\n    color: var(--cy-ink);\n    cursor: default;\n    user-select: none;\n    transition: color var(--cy-t-fast) linear;\n\n    @media (hover: hover) {\n      &:hover:not([data-selected]) {\n        --frame-line: var(--cy-line-hot);\n        --frame-fill: var(--cy-fill-hover);\n      }\n    }\n\n    /* Where the keyboard is, on a row that isn't the chosen one. */\n    &[data-highlighted]:not([data-selected]) {\n      --frame-fill: var(--cy-fill-active);\n      color: var(--cy-ink-hi);\n      box-shadow: inset 3px 0 0 var(--cy-signal);\n\n      &:dir(rtl) {\n        box-shadow: inset -3px 0 0 var(--cy-signal);\n      }\n    }\n\n    /* The chosen row is lit, and a pointer appears at its far end. */\n    &[data-selected] {\n      --frame-line: var(--cy-line-hot);\n      --frame-fill: var(--cy-fill-active);\n      color: var(--cy-ink-hi);\n    }\n\n    /* The tracked job: a yellow edge and a solid bar down its leading side,\n       beside the badge that says so. */\n    &[data-tracked] {\n      --frame-line: var(--cy-flag);\n\n      &::before {\n        content: \"\";\n        position: absolute;\n        inset-block: -1px;\n        inset-inline-start: -1px;\n        width: 4px;\n        background: var(--cy-flag);\n      }\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-glyph] {\n    grid-area: glyph;\n    display: grid;\n    place-items: center;\n    width: 32px;\n    height: 32px;\n    color: var(--cy-ink);\n    background: var(--cy-panel-2);\n    border: 1px solid var(--cy-line-deco);\n    clip-path: polygon(7px 0, 100% 0, 100% 100%, 0 100%, 0 7px);\n\n    & svg {\n      width: 16px;\n      height: 16px;\n    }\n\n    [data-selected] > & {\n      color: var(--cy-signal);\n      border-color: var(--cy-signal-dim);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-name] {\n    grid-area: name;\n    min-width: 0;\n    overflow-wrap: anywhere;\n    text-wrap: balance;\n    font-size: var(--cy-text-lg);\n    font-weight: 700;\n    line-height: 1.1;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-tags] {\n    grid-area: tags;\n    display: flex;\n    align-items: center;\n    justify-content: flex-end;\n    gap: 6px;\n    min-height: 18px;\n\n    & [data-kit=\"badge\"] svg {\n      width: 10px;\n      height: 10px;\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-pointer] {\n    display: grid;\n    place-items: center;\n    color: var(--cy-signal);\n    animation: var(--cy-fx-in) 200ms var(--cy-ease-snap) backwards;\n\n    & svg {\n      width: 14px;\n      height: 14px;\n      stroke-width: 2.5;\n    }\n\n    &:dir(rtl) svg {\n      scale: -1 1;\n    }\n  }\n\n  /* A difficulty: the word, after three pips of which one, two or three are\n     lit. The word and the count carry it; the color only agrees. */\n  [data-skin=\"cyber\"] [data-jobs-level] {\n    display: inline-flex;\n    align-items: center;\n    gap: 7px;\n    font-size: var(--cy-text-sm);\n    font-weight: 600;\n    line-height: 1.1;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n    white-space: nowrap;\n    color: var(--cy-ink);\n\n    &[data-jobs-level=\"low\"] {\n      color: var(--cy-ok);\n    }\n\n    &[data-jobs-level=\"dangerous\"] {\n      color: var(--cy-ink-hi);\n    }\n\n    [data-jobs-row] > & {\n      grid-area: level;\n    }\n\n    [data-jobs-row]:is([data-selected], [data-highlighted]) > &[data-jobs-level=\"moderate\"] {\n      color: var(--cy-ink-hi);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-pips] {\n    display: inline-flex;\n    gap: 2px;\n\n    & span {\n      width: 5px;\n      height: 9px;\n      border: 1px solid currentColor;\n      opacity: 0.55;\n\n      &[data-on] {\n        background: currentColor;\n        opacity: 1;\n      }\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-distance] {\n    grid-area: distance;\n    justify-self: end;\n    white-space: nowrap;\n\n    &::before {\n      content: \"[\";\n    }\n    &::after {\n      content: \"]\";\n    }\n  }\n\n  /* The offer that's come in: the terms as a short sheet, the way a fixer\n     sends them. */\n  [data-skin=\"cyber\"] [data-jobs-offer] {\n    animation: var(--cy-fx-in) 280ms var(--cy-ease-snap) backwards;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-terms] {\n    display: grid;\n    gap: 8px;\n    margin: 0;\n\n    & div {\n      display: grid;\n      grid-template-columns: 72px minmax(0, 1fr);\n      gap: 10px;\n      align-items: baseline;\n    }\n\n    & dt {\n      font-size: var(--cy-text-xs);\n      font-weight: 600;\n      letter-spacing: var(--cy-track);\n      text-transform: uppercase;\n      color: var(--cy-ink-mute);\n    }\n\n    & dd {\n      margin: 0;\n      font-size: var(--cy-text-sm);\n      color: var(--cy-ink-hi);\n    }\n  }\n\n  /* ── The sheet ─────────────────────────────────────────────────────── */\n\n  [data-skin=\"cyber\"] [data-jobs-sheet] {\n    display: grid;\n    gap: 20px;\n    min-width: 0;\n    padding: clamp(14px, 1.75cqi, 24px);\n    border: 1px solid var(--cy-line-deco);\n    border-block-start: 2px solid var(--cy-line-hot);\n    background: var(--cy-panel-a);\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-head] {\n    display: grid;\n    gap: 8px;\n    min-width: 0;\n    padding-block-end: 14px;\n    border-block-end: 1px solid var(--cy-line-ctl);\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-serial] {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 12px;\n    min-width: 0;\n    overflow: hidden;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-title] {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: baseline;\n    justify-content: space-between;\n    gap: 6px 20px;\n\n    & h2 {\n      font-size: clamp(var(--cy-text-2xl), 3.5cqi, var(--cy-text-3xl));\n      font-weight: 700;\n      line-height: 1;\n      letter-spacing: var(--cy-track);\n      text-transform: uppercase;\n      color: var(--cy-ink);\n      overflow-wrap: anywhere;\n    }\n\n    & [data-jobs-level] {\n      font-size: var(--cy-text-md);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-summary] {\n    max-inline-size: 58ch;\n    font-size: var(--cy-text-lg);\n    line-height: 1.35;\n    color: var(--cy-ink-hi);\n    text-wrap: pretty;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-meta] {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    justify-content: space-between;\n    gap: 8px 16px;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-marks] {\n    display: flex;\n    gap: 6px;\n    min-height: 18px;\n  }\n\n  /* Everything about the job that changes with the selection tears in\n     together. */\n  [data-skin=\"cyber\"] :is([data-jobs-body], [data-jobs-cards]) {\n    animation: var(--cy-fx-in) 240ms var(--cy-ease-snap) backwards;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-body] {\n    display: grid;\n    gap: 24px;\n    min-width: 0;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-objectives] {\n    display: grid;\n    gap: 16px;\n    min-width: 0;\n\n    & [data-kit=\"checkbox-item\"] + [data-kit=\"checkbox-item\"] {\n      border-block-start: 1px solid var(--cy-line-deco);\n    }\n  }\n\n  /* The bar that follows the ticks, and what the job pays beside it. */\n  [data-skin=\"cyber\"] [data-jobs-progress] {\n    display: grid;\n    grid-template-columns: minmax(0, 1fr) auto;\n    align-items: end;\n    gap: 14px 28px;\n\n    & [data-kit=\"progress\"] {\n      min-width: 0;\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-brief] {\n    display: grid;\n    gap: 12px;\n    min-width: 0;\n\n    & p {\n      max-width: 64ch;\n      padding-inline-start: 14px;\n      border-inline-start: 2px solid var(--cy-line-deco);\n      font-size: var(--cy-text-md);\n      line-height: 1.45;\n      color: var(--cy-ink-hi);\n      text-wrap: pretty;\n    }\n\n    & p:first-of-type {\n      border-inline-start-color: var(--cy-accent);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-rule] [data-micro] {\n    min-width: 0;\n    overflow: hidden;\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-actions] {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    justify-content: space-between;\n    gap: 12px 20px;\n    padding-block-start: 16px;\n    border-block-start: 1px solid var(--cy-line-deco);\n\n    & > p {\n      flex: 1 1 200px;\n    }\n  }\n\n  /* Nothing left on the board. */\n  [data-skin=\"cyber\"] [data-jobs-clear] {\n    display: grid;\n    gap: 12px;\n    justify-items: start;\n    padding-block: 12px 32px;\n    animation: var(--cy-fx-in) 240ms var(--cy-ease-snap) backwards;\n\n    & h2 {\n      font-size: var(--cy-text-2xl);\n      font-weight: 700;\n      line-height: 1;\n      letter-spacing: var(--cy-track);\n      text-transform: uppercase;\n      color: var(--cy-ink);\n    }\n\n    & p {\n      max-width: 48ch;\n    }\n  }\n\n  /* ── Linked records ────────────────────────────────────────────────── */\n\n  [data-skin=\"cyber\"] [data-jobs-records] {\n    display: grid;\n    gap: 12px;\n    min-width: 0;\n\n    @container job-screen (max-width: 1020px) {\n      grid-column: 1 / -1;\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-jobs-cards] {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));\n    gap: 14px;\n    align-items: start;\n    min-width: 0;\n  }\n\n  @container job-screen (max-width: 690px) {\n    [data-skin=\"cyber\"] [data-jobs-browse] {\n      display: flex;\n      inline-size: 100%;\n      min-block-size: 44px;\n      justify-content: start;\n      gap: 10px;\n\n      & > svg:last-child {\n        margin-inline-start: auto;\n      }\n      &[aria-expanded=\"true\"] > svg:last-child {\n        rotate: 180deg;\n      }\n    }\n\n    [data-skin=\"cyber\"] [data-jobs-board]:not([data-open]) {\n      display: none;\n    }\n\n    [data-skin=\"cyber\"] [data-jobs-now] {\n      gap: 6px 16px;\n      & div {\n        display: flex;\n        flex-wrap: wrap;\n        align-items: center;\n        gap: 6px;\n      }\n    }\n  }\n\n  @container job-screen (max-width: 475px) {\n    [data-skin=\"cyber\"] [data-jobs-sheet] {\n      gap: 16px;\n    }\n    [data-skin=\"cyber\"] [data-jobs-actions] > [data-kit=\"actions\"] {\n      display: grid;\n      grid-template-columns: repeat(2, minmax(0, 1fr));\n      inline-size: 100%;\n      & > :last-child {\n        grid-column: 1 / -1;\n      }\n    }\n    [data-skin=\"cyber\"] [data-jobs-cards] {\n      grid-template-columns: minmax(0, 1fr);\n      gap: 10px;\n      & > [data-kit=\"card\"] {\n        display: grid;\n        grid-template-columns: minmax(72px, 32%) minmax(0, 1fr);\n        align-items: center;\n      }\n      & [data-kit=\"card-media\"] {\n        margin-inline-end: 0;\n      }\n      & [data-kit=\"card-footer\"] {\n        grid-column: 1 / -1;\n      }\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@components/blocks/jobs/jobs.css"
    },
    {
      "path": "registry/cyber/blocks/jobs/jobs.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Listbox, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxItemIndicator } from \"@ui-sdk/react/listbox\"\nimport { BriefcaseBusiness, ChevronDown, ChevronRight, Cpu, Crosshair, LogOut, MapPin, Package, PhoneCall, Radar, RotateCcw, ScanSearch, Shield, Truck, Wrench } from \"lucide-react\"\nimport { Place, Portrait, Vehicle } from \"@/registry/cyber/blocks/jobs/art\"\nimport { board, contacts, creditsOf, distanceOf, offer, type Difficulty, type Group, type Job, type Kind } from \"@/registry/cyber/blocks/jobs/data\"\nimport { AlertDialog } from \"@/registry/cyber/ui/alert-dialog\"\nimport { Badge } from \"@/registry/cyber/ui/badge\"\nimport { Button } from \"@/registry/cyber/ui/button\"\nimport { Card } from \"@/registry/cyber/ui/card\"\nimport { Checkbox, CheckboxGroup } from \"@/registry/cyber/ui/checkbox\"\nimport { GlitchText } from \"@/registry/cyber/ui/glitch-text\"\nimport { HoverCard } from \"@/registry/cyber/ui/hover-card\"\nimport { Barcode, Micro, Ruler } from \"@/registry/cyber/ui/micro\"\nimport { Panel } from \"@/registry/cyber/ui/panel\"\nimport { Progress } from \"@/registry/cyber/ui/progress\"\nimport { Readout } from \"@/registry/cyber/ui/readout\"\nimport { Screen } from \"@/registry/cyber/ui/screen\"\nimport { Tabs } from \"@/registry/cyber/ui/tabs\"\nimport { notify } from \"@/registry/cyber/ui/toaster\"\nimport { Toggle } from \"@/registry/cyber/ui/toggle\"\nimport \"@/registry/cyber/blocks/jobs/jobs.css\"\n\n// The job board: what's open on the left, the chosen job in the middle, the\n// people and places it touches on the right. One job is tracked, and that's\n// the only thing on the screen in yellow besides whatever is new.\n//\n// The list is a ui-sdk Listbox with its own rows, since a job row carries\n// more than the kit's ItemList prints (a type, a difficulty, a distance).\n// Choosing follows the arrow keys, so the sheet beside it changes as the\n// list is walked. Whatever removes the chosen job (turning it in, abandoning\n// it) sends focus to the sheet's heading, which is always there.\n\nconst groups: { value: Group; label: string }[] = [\n  { value: \"nearby\", label: \"Nearby\" },\n  { value: \"side\", label: \"Side work\" },\n]\n\nconst glyphs: Record<Kind, React.ReactNode> = {\n  Intrusion: <Cpu />,\n  Courier: <Package />,\n  Recovery: <ScanSearch />,\n  Extraction: <LogOut />,\n  Escort: <Shield />,\n  \"Bench work\": <Wrench />,\n  Survey: <Radar />,\n}\n\nconst ranks: Record<Difficulty, number> = { Low: 1, Moderate: 2, Dangerous: 3 }\n\n// A difficulty is its word, with one to three pips lit before it.\nfunction Level({ difficulty }: { difficulty: Difficulty }) {\n  return (\n    <span data-jobs-level={difficulty.toLowerCase()}>\n      <span data-jobs-pips=\"\" aria-hidden>\n        {[1, 2, 3].map((pip) => (\n          <span key={pip} data-on={pip <= ranks[difficulty] ? \"\" : undefined} />\n        ))}\n      </span>\n      {difficulty}\n    </span>\n  )\n}\n\nfunction JobList({\n  label,\n  jobs,\n  selected,\n  tracked,\n  fresh,\n  onSelect,\n}: {\n  label: string\n  jobs: Job[]\n  selected: string | null\n  tracked: string | null\n  fresh: string[]\n  onSelect: (id: string, pressed: boolean) => void\n}) {\n  if (!jobs.length) return <p data-kit=\"hint\">Nothing open under this filter.</p>\n  return (\n    <Listbox\n      aria-label={label}\n      data-jobs-list=\"\"\n      // An explicit press also opens the brief for the already selected row.\n      deselectable\n      value={jobs.some((job) => job.id === selected) ? selected : null}\n      onValueChange={(value, details) => {\n        const id = value ?? selected\n        if (id) onSelect(id, details.reason === \"item-press\")\n      }}\n    >\n      {groups.map((group) => {\n        const rows = jobs.filter((job) => job.group === group.value)\n        if (!rows.length) return null\n        return (\n          <ListboxGroup key={group.value} data-jobs-group=\"\">\n            <ListboxGroupLabel data-jobs-group-label=\"\">\n              <span data-kit=\"label\">{group.label}</span>\n              <span data-kit=\"value\" aria-hidden>\n                {String(rows.length).padStart(2, \"0\")}\n              </span>\n            </ListboxGroupLabel>\n            {rows.map((job) => (\n              <ListboxItem\n                key={job.id}\n                value={job.id}\n                label={job.name}\n                data-jobs-row=\"\"\n                data-frame=\"br\"\n                data-tracked={tracked === job.id ? \"\" : undefined}\n              >\n                <span data-jobs-glyph=\"\" aria-hidden>\n                  {glyphs[job.kind]}\n                </span>\n                <span data-jobs-name=\"\">{job.name}</span>\n                <span data-jobs-tags=\"\">\n                  {fresh.includes(job.id) && <Badge tone=\"flag\">New</Badge>}\n                  {tracked === job.id && (\n                    <Badge tone=\"flag\">\n                      <Crosshair aria-hidden />\n                      Tracked\n                    </Badge>\n                  )}\n                  <ListboxItemIndicator data-jobs-pointer=\"\" aria-hidden>\n                    <ChevronRight />\n                  </ListboxItemIndicator>\n                </span>\n                <Level difficulty={job.difficulty} />\n                <span data-jobs-distance=\"\" data-kit=\"value\">\n                  {distanceOf(job.distance)}\n                </span>\n              </ListboxItem>\n            ))}\n          </ListboxGroup>\n        )\n      })}\n    </Listbox>\n  )\n}\n\nconst startDone = () => Object.fromEntries([...board, offer].map((job) => [job.id, job.done]))\n\nexport default function Jobs() {\n  const [jobs, setJobs] = React.useState(board)\n  const [filter, setFilter] = React.useState<\"all\" | \"priority\">(\"all\")\n  const [selected, setSelected] = React.useState<string | null>(\"glass-jaw\")\n  const [tracked, setTracked] = React.useState<string | null>(\"glass-jaw\")\n  const [waypoint, setWaypoint] = React.useState<string | null>(null)\n  const [fresh, setFresh] = React.useState([\"cold-chain\", \"paper-lantern\"])\n  const [done, setDone] = React.useState<Record<string, string[]>>(startDone)\n  const [credits, setCredits] = React.useState(15240)\n  const [cleared, setCleared] = React.useState(12)\n  const [offered, setOffered] = React.useState(true)\n  const [boardOpen, setBoardOpen] = React.useState(false)\n  const boardId = React.useId()\n  const browse = React.useRef<HTMLButtonElement>(null)\n  // The job the open question is about. It's held apart from the selection\n  // so the dialog keeps its wording while it closes over the next job.\n  const [abandoning, setAbandoning] = React.useState<Job | null>(null)\n\n  // Focus goes to the sheet's heading whenever the thing that had it is\n  // about to leave the page or go dead: bump the tick with the change.\n  const heading = React.useRef<HTMLHeadingElement>(null)\n  const [focusTick, setFocusTick] = React.useState(0)\n  const afterDialog = React.useRef(false)\n  React.useEffect(() => {\n    if (focusTick) heading.current?.focus()\n  }, [focusTick])\n\n  const job = jobs.find((entry) => entry.id === selected) ?? null\n  const trackedJob = jobs.find((entry) => entry.id === tracked) ?? null\n  const waypointJob = jobs.find((entry) => entry.id === waypoint) ?? null\n\n  const select = (id: string, pressed: boolean) => {\n    setSelected(id)\n    setFresh((ids) => ids.filter((entry) => entry !== id))\n    if (pressed && browse.current?.getClientRects().length) {\n      setBoardOpen(false)\n      setFocusTick((tick) => tick + 1)\n    }\n  }\n\n  // Takes a job off the board and chooses the one that moves into its place.\n  const remove = (id: string) => {\n    const rest = jobs.filter((entry) => entry.id !== id)\n    const visible = filter === \"priority\" ? jobs.filter((entry) => entry.priority) : jobs\n    const remaining = visible.filter((entry) => entry.id !== id)\n    const index = visible.findIndex((entry) => entry.id === id)\n    const next = remaining[Math.min(index, remaining.length - 1)] ?? rest[0]\n    if (!remaining.length) setFilter(\"all\")\n    setJobs(rest)\n    setSelected(next?.id ?? null)\n    if (next) setFresh((ids) => ids.filter((entry) => entry !== next.id))\n    if (tracked === id) setTracked(null)\n    if (waypoint === id) setWaypoint(null)\n  }\n\n  const restore = () => {\n    setJobs(board)\n    setFilter(\"all\")\n    setSelected(\"glass-jaw\")\n    setTracked(\"glass-jaw\")\n    setWaypoint(null)\n    setFresh([\"cold-chain\", \"paper-lantern\"])\n    setDone(startDone())\n    setOffered(true)\n    setFocusTick((tick) => tick + 1)\n    notify(\"Board restored\", { description: \"Seven jobs open, one offer waiting.\" })\n  }\n\n  const list = (label: string, rows: Job[]) => (\n    <JobList label={label} jobs={rows} selected={selected} tracked={tracked} fresh={fresh} onSelect={select} />\n  )\n  const priority = jobs.filter((entry) => entry.priority)\n  const isNew = (rows: Job[]) => (rows.some((entry) => fresh.includes(entry.id)) ? \"New\" : undefined)\n\n  const ticked = job ? (done[job.id] ?? []) : []\n  const complete = job != null && ticked.length === job.objectives.length\n  const contact = job ? contacts[job.contact] : null\n  const sender = contacts[offer.contact]\n\n  return (\n    <Screen\n      label=\"Job board\"\n      data-jobs-screen=\"\"\n      status={\n        <>\n          <Readout label=\"Open jobs\" value={jobs.length} size=\"sm\" tone=\"accent\" />\n          <Readout label=\"Jobs cleared\" value={cleared} size=\"sm\" />\n          <Readout label=\"Credits\" value={credits} prefix=\"¤\" size=\"sm\" />\n        </>\n      }\n      aside={\n        <dl data-jobs-now=\"\">\n          <div>\n            <dt data-kit=\"label\">Tracking</dt>\n            <dd>{trackedJob ? <Badge tone=\"flag\">{trackedJob.name}</Badge> : <Badge tone=\"mute\">Nothing</Badge>}</dd>\n          </div>\n          <div>\n            <dt data-kit=\"label\">Waypoint</dt>\n            <dd data-kit=\"value\">{waypointJob ? waypointJob.place.name : \"Not set\"}</dd>\n          </div>\n        </dl>\n      }\n      hints={[\n        { keys: [\"↑\", \"↓\"], label: \"Browse jobs\" },\n        { keys: [\"←\", \"→\"], label: \"Switch filter\" },\n        { keys: \"Space\", label: \"Tick objective\" },\n      ]}\n      code=\"CS-J7 // BOARD SYNCED // LOWTIDE EXCHANGE // PROTOCOL 7741-C\"\n    >\n      <div data-kit=\"jobs\">\n        <Button\n          ref={browse}\n          data-jobs-browse=\"\"\n          aria-expanded={boardOpen}\n          aria-controls={boardId}\n          onClick={() => setBoardOpen((open) => !open)}\n        >\n          <BriefcaseBusiness aria-hidden />\n          Browse jobs\n          {offered && <Badge tone=\"flag\">1 offer</Badge>}\n          <ChevronDown aria-hidden />\n        </Button>\n        <div id={boardId} data-jobs-board=\"\" data-open={boardOpen ? \"\" : undefined}>\n          <h2 data-sr-only>Open jobs</h2>\n          <Tabs\n            label=\"Job filter\"\n            variant=\"key\"\n            value={filter}\n            onValueChange={(value) => {\n              setFilter(value === \"priority\" ? \"priority\" : \"all\")\n              if (value === \"priority\" && !job?.priority && priority[0]) select(priority[0].id, false)\n            }}\n            tabs={[\n              { value: \"all\", label: \"All jobs\", content: list(\"All jobs\", jobs) },\n              { value: \"priority\", label: \"Priority\", flag: isNew(priority), disabled: !priority.length, content: list(\"Priority jobs\", priority) },\n            ]}\n          />\n\n          {offered && (\n            <Panel\n              variant=\"titled\"\n              tone=\"flag\"\n              title={`Job offer: ${offer.name}`}\n              code={`${offer.code} // INBOUND // ANSWER BEFORE 04:00`}\n              actions={sender.name}\n              data-jobs-offer=\"\"\n              footer={\n                <>\n                  <span>Pays {creditsOf(offer.pay)}</span>\n                  <span data-kit=\"actions\">\n                    <Button\n                      size=\"sm\"\n                      data-agent-confirm={`Declines the job offer \"${offer.name}\" from ${sender.name}. It won't be offered again.`}\n                      onClick={() => {\n                        setOffered(false)\n                        setBoardOpen(false)\n                        setFocusTick((tick) => tick + 1)\n                        notify(\"Offer declined\", { description: `${sender.name} will find someone else.` })\n                      }}\n                    >\n                      Decline offer\n                    </Button>\n                    <Button\n                      size=\"sm\"\n                      tone=\"flag\"\n                      onClick={() => {\n                        setOffered(false)\n                        setBoardOpen(false)\n                        setJobs((rows) => [...rows, offer])\n                        setFilter(\"all\")\n                        setSelected(offer.id)\n                        setFocusTick((tick) => tick + 1)\n                        notify(\"Job accepted\", { tone: \"success\", description: `${offer.name} is on the board under Side work.` })\n                      }}\n                    >\n                      Accept offer\n                    </Button>\n                  </span>\n                </>\n              }\n            >\n              <dl data-jobs-terms=\"\">\n                <div>\n                  <dt>Type</dt>\n                  <dd>\n                    {offer.kind}, <Level difficulty={offer.difficulty} />\n                  </dd>\n                </div>\n                <div>\n                  <dt>Objective</dt>\n                  <dd>Carry a credit chit across Glasswater without a scan.</dd>\n                </div>\n                <div>\n                  <dt>Location</dt>\n                  <dd>\n                    {offer.place.name}, {distanceOf(offer.distance)}\n                  </dd>\n                </div>\n              </dl>\n            </Panel>\n          )}\n        </div>\n\n        <article data-jobs-sheet=\"\" aria-labelledby=\"jobs-sheet-title\">\n          {job && contact ? (\n            <>\n              <header data-jobs-head=\"\">\n                <div data-jobs-serial=\"\">\n                  <Micro>\n                    {job.code} // {job.kind} // {job.district}\n                  </Micro>\n                  <Barcode value={job.code} size={8} />\n                </div>\n                <div data-jobs-title=\"\">\n                  <h2 id=\"jobs-sheet-title\" ref={heading} tabIndex={-1}>\n                    <GlitchText>{job.name}</GlitchText>\n                  </h2>\n                  <Level difficulty={job.difficulty} />\n                </div>\n                <p data-jobs-summary=\"\">{job.brief[0]}</p>\n                <div data-jobs-meta=\"\">\n                  <p data-kit=\"hint\">\n                    {job.kind} in {job.district}, <span data-kit=\"value\">{distanceOf(job.distance)}</span> out. Posted by{\" \"}\n                    <HoverCard\n                      name={contact.name}\n                      role={contact.role}\n                      href=\"#jobs-contact\"\n                      facts={[\n                        { label: \"District\", value: contact.district },\n                        { label: contact.fact[0], value: contact.fact[1] },\n                      ]}\n                    />\n                    .\n                  </p>\n                  <span data-jobs-marks=\"\">\n                    {job.priority && <Badge>Priority</Badge>}\n                    {tracked === job.id && <Badge tone=\"flag\">Tracked</Badge>}\n                  </span>\n                </div>\n              </header>\n\n              {/* Keyed by the job, so the sheet tears in when another is chosen. */}\n              <div key={job.id} data-jobs-body=\"\">\n                <div data-jobs-objectives=\"\">\n                  <CheckboxGroup\n                    label=\"Objectives\"\n                    value={ticked}\n                    onValueChange={(value) => {\n                      setDone((all) => ({ ...all, [job.id]: value }))\n                      if (value.length === job.objectives.length && !complete) {\n                        notify(\"Objectives complete\", { tone: \"success\", description: `${job.name} is ready to turn in.` })\n                      }\n                    }}\n                  >\n                    {job.objectives.map((objective) => (\n                      <Checkbox key={objective.id} value={objective.id} label={objective.label} />\n                    ))}\n                  </CheckboxGroup>\n                  <div data-jobs-progress=\"\">\n                    <Progress\n                      label=\"Job progress\"\n                      value={(ticked.length / job.objectives.length) * 100}\n                      segments={job.objectives.length * 4}\n                    />\n                    <Readout label=\"Pays\" value={job.pay} prefix=\"¤\" size=\"sm\" />\n                  </div>\n                </div>\n\n                <section data-jobs-brief=\"\" aria-labelledby=\"jobs-brief-title\">\n                  <div data-jobs-rule=\"\">\n                    <h3 id=\"jobs-brief-title\" data-kit=\"label\">\n                      Brief\n                    </h3>\n                    <Micro>Net protocol 7741-C // From {contact.name}</Micro>\n                  </div>\n                  {job.brief.slice(1).map((paragraph) => (\n                    <p key={paragraph}>{paragraph}</p>\n                  ))}\n                </section>\n              </div>\n\n              <footer data-jobs-actions=\"\">\n                <p data-kit=\"hint\" role=\"status\">\n                  {complete\n                    ? \"Every objective is done. Turn the job in to be paid.\"\n                    : `${ticked.length} of ${job.objectives.length} objectives done. Tick them all to turn the job in.`}\n                </p>\n                <div data-kit=\"actions\">\n                  <Toggle\n                    icon={<Crosshair aria-hidden />}\n                    pressed={tracked === job.id}\n                    onPressedChange={(on) => {\n                      setTracked(on ? job.id : null)\n                      notify(on ? `Tracking ${job.name}` : \"Tracking off\", {\n                        description: on ? \"The route and its objectives are on your overlay.\" : `${job.name} is off your overlay.`,\n                      })\n                    }}\n                  >\n                    Track job\n                  </Toggle>\n                  <AlertDialog\n                    trigger=\"Abandon job\"\n                    title={`Abandon ${(abandoning ?? job).name}?`}\n                    description={`${contacts[(abandoning ?? job).contact].name} gives the work to someone else, and the objectives you've ticked are lost. An abandoned job doesn't come back to the board.`}\n                    confirm=\"Abandon\"\n                    cancel=\"Keep job\"\n                    agentConfirm={`Abandons the job \"${(abandoning ?? job).name}\": removes it from the board and discards its objective progress. This can't be undone.`}\n                    code={`${(abandoning ?? job).code} // ANSWER REQUIRED`}\n                    onOpenChange={(open) => {\n                      if (open) setAbandoning(job)\n                    }}\n                    onOpenChangeComplete={(open) => {\n                      if (open) return\n                      setAbandoning(null)\n                      if (!afterDialog.current) return\n                      afterDialog.current = false\n                      setFocusTick((tick) => tick + 1)\n                    }}\n                    onConfirm={() => {\n                      const gone = abandoning ?? job\n                      // The dialog hands focus back to its key once it has\n                      // closed, so the move to the heading waits for that.\n                      // Abandoning the last job takes the dialog off the\n                      // page with the sheet, and nothing is left to wait for.\n                      if (jobs.length > 1) afterDialog.current = true\n                      else setFocusTick((tick) => tick + 1)\n                      remove(gone.id)\n                      notify(\"Job abandoned\", { tone: \"warning\", description: `${gone.name} is off the board.` })\n                    }}\n                  />\n                  <Button\n                    tone=\"primary\"\n                    disabled={!complete}\n                    onClick={() => {\n                      setCredits((sum) => sum + job.pay)\n                      setCleared((count) => count + 1)\n                      remove(job.id)\n                      setFocusTick((tick) => tick + 1)\n                      notify(\"Job turned in\", { tone: \"success\", description: `${creditsOf(job.pay)} paid by ${contact.name}.` })\n                    }}\n                  >\n                    Turn in job\n                  </Button>\n                </div>\n              </footer>\n              <Ruler />\n            </>\n          ) : (\n            <div data-jobs-clear=\"\">\n              <Micro>CS-J7 // No open contracts</Micro>\n              <h2 id=\"jobs-sheet-title\" ref={heading} tabIndex={-1}>\n                Board clear\n              </h2>\n              <p data-kit=\"hint\">Nothing is open. Fixers post again after dark, or you can put this board back the way it was.</p>\n              <Button onClick={restore}>\n                <RotateCcw aria-hidden />\n                Restore board\n              </Button>\n            </div>\n          )}\n        </article>\n\n        {job && contact && (\n          <aside data-jobs-records=\"\" aria-labelledby=\"jobs-records-title\">\n            <div data-jobs-rule=\"\">\n              <h3 id=\"jobs-records-title\" data-kit=\"label\">\n                Linked records\n              </h3>\n              <span data-kit=\"value\" aria-hidden>\n                03\n              </span>\n            </div>\n            <div key={job.id} data-jobs-cards=\"\">\n              <Card\n                id=\"jobs-contact\"\n                level={4}\n                title={contact.name}\n                meta={`${contact.role} // ${contact.district}`}\n                media={<Portrait look={contact.look} seed={contact.name} />}\n                footer={\n                  <>\n                    <span>Contact</span>\n                    <Button\n                      size=\"sm\"\n                      onClick={() => notify(`Calling ${contact.name}`, { description: \"Line open. Keep it short.\" })}\n                    >\n                      <PhoneCall aria-hidden />\n                      Call contact\n                    </Button>\n                  </>\n                }\n              >\n                {contact.fact[0]}: {contact.fact[1]}\n              </Card>\n              <Card\n                level={4}\n                title={job.place.name}\n                meta={job.place.meta}\n                media={<Place seed={job.place.name} />}\n                footer={\n                  <>\n                    <span>Place</span>\n                    <Toggle\n                      size=\"sm\"\n                      icon={<MapPin aria-hidden />}\n                      pressed={waypoint === job.id}\n                      onPressedChange={(on) => {\n                        setWaypoint(on ? job.id : null)\n                        notify(on ? \"Waypoint set\" : \"Waypoint cleared\", { description: job.place.name })\n                      }}\n                    >\n                      Waypoint\n                    </Toggle>\n                  </>\n                }\n              >\n                {job.place.note}\n              </Card>\n              <Card\n                level={4}\n                title={job.vehicle.name}\n                meta={job.vehicle.meta}\n                media={<Vehicle shape={job.vehicle.shape} />}\n                footer={\n                  <>\n                    <span>Vehicle</span>\n                    <Button\n                      size=\"sm\"\n                      onClick={() => notify(`${job.vehicle.name} requested`, { description: \"Two minutes out, if the tideway is clear.\" })}\n                    >\n                      <Truck aria-hidden />\n                      Request vehicle\n                    </Button>\n                  </>\n                }\n              >\n                {job.vehicle.note}\n              </Card>\n            </div>\n          </aside>\n        )}\n      </div>\n    </Screen>\n  )\n}\n",
      "type": "registry:component",
      "target": "@components/blocks/jobs/jobs.tsx"
    }
  ],
  "categories": [
    "screen"
  ],
  "type": "registry:block"
}
