diff --git a/forebear/api.py b/forebear/api.py index 65bca88..9c54c2e 100644 --- a/forebear/api.py +++ b/forebear/api.py @@ -218,12 +218,13 @@ async def list_assessments(k: str | None = None): def do(g: Graph): rows = g.assessments(kk) - verdicts: dict[str, str | None] = {} - for r in rows: # does the graph still give the saved verdict? - if r["k"] not in verdicts: - cur = assess(g, r["k"]) - verdicts[r["k"]] = cur["verdict"] if cur else None - r["verdict_now"] = verdicts[r["k"]] + verdicts: dict[tuple[str, int], str | None] = {} + for r in rows: # does the graph still give the saved verdict, at the depth it was saved at? + key = (r["k"], r["depth"]) + if key not in verdicts: + cur = assess(g, r["k"], r["depth"]) + verdicts[key] = cur["verdict"] if cur else None + r["verdict_now"] = verdicts[key] r["stale"] = bool(r["stale"] or r["verdict_now"] != r["verdict"]) return rows return await run(do) @@ -318,8 +319,8 @@ def do(g: Graph): payload = {"verdict": a["verdict"], "signals": [{k2: s[k2] for k2 in ("code", "severity", "title", "chain")} for s in a["signals"]], "coverage": a["coverage"], "rules_version": a["rules_version"], "depth": a["depth"]} - aid = g.save_assessment(k, a["verdict"], payload, text, "template", flagged) - return {"id": aid, "verdict": a["verdict"], "flagged_recalls": flagged} + aid = g.save_assessment(k, a["verdict"], payload, text, "template", flagged, depth=a["depth"]) + return {"id": aid, "verdict": a["verdict"], "depth": a["depth"], "flagged_recalls": flagged} r = await run(do) if r is None: raise HTTPException(404, f"{k} is not in the graph") diff --git a/forebear/graph.py b/forebear/graph.py index dc5cbc8..7e8f41e 100644 --- a/forebear/graph.py +++ b/forebear/graph.py @@ -9,7 +9,7 @@ (:Company {name}) (:Recall {id, recall_number, event, classification, root_cause, design_related, initiated, status, firm, reason, product, url}) - (:Assessment {id, created_at, target_k, verdict, payload, memo, memo_source}) + (:Assessment {id, created_at, target_k, verdict, depth, payload, memo, memo_source}) (Device)-[:CITES {kind: predicate|reference|mention, confidence, page, snippet, quote, method, text_source, source_url, source_sha256, name_check, panel_check, @@ -249,16 +249,19 @@ def citation(self, src: str, dst: str) -> dict | None: return rows[0] if rows else None def save_assessment(self, target_k: str, verdict: str, payload: dict, memo: str, - memo_source: str, recall_ids: list[str]) -> str: + memo_source: str, recall_ids: list[str], depth: int | None = None) -> str: + """`depth` is the number of predicate generations the saved verdict was computed over; history recomputes + and checks staleness at that depth. Defaults to payload['depth'] when the payload carries it.""" aid = "A-" + uuid.uuid4().hex[:10] + depth = _assessment_depth(depth if depth is not None else payload.get("depth"))[0] self.conn.execute( """MATCH (d:Device {k:$k}) - CREATE (a:Assessment {id:$id, created_at: datetime(), target_k:$k, verdict:$verdict, + CREATE (a:Assessment {id:$id, created_at: datetime(), target_k:$k, verdict:$verdict, depth:$depth, payload:$payload, memo:$memo, memo_source:$src}) CREATE (a)-[:ASSESSED]->(d) WITH a UNWIND $recalls AS rid MATCH (x:Recall {id: rid}) MERGE (a)-[:FLAGGED]->(x)""", - {"k": target_k, "id": aid, "verdict": verdict, "payload": json.dumps(payload), + {"k": target_k, "id": aid, "verdict": verdict, "depth": depth, "payload": json.dumps(payload), "memo": memo, "src": memo_source, "recalls": recall_ids}) return aid @@ -463,25 +466,63 @@ def recall_event_reach(self, event: str, depth: int = 3) -> dict: return {"event": event, "recalled": devs, "descendants": desc} def assessments(self, k: str | None = None, limit: int = 20) -> list[dict]: - """Saved assessments, each with a `stale` flag: after it was saved, a citation somewhere in - the assessed device's ancestry (4 generations) was reviewed or AI-labelled, or a device in - that ancestry was (re-)ingested - so the saved verdict may no longer match the graph.""" + """Saved assessments, each with its `depth` and a `stale` flag: after it was saved, a citation leaving the + assessed device or an ancestor within that depth was reviewed or AI-labelled, or a device within that + depth was (re-)ingested - so the saved verdict may no longer match the graph. These are the edges and + devices assess() reads at that depth. `depth_source` says where the depth came from: 'recorded' on the + node, or for an assessment saved before depth was stored, 'legacy_payload' (the depth inside its saved + payload, which is the depth its verdict was computed at) or 'legacy_default' (neither: the API default 4).""" rows = self.q( """MATCH (a:Assessment)-[:ASSESSED]->(d:Device) WHERE $k IS NULL OR d.k = $k + RETURN a.id AS id, a.depth AS depth, a.payload AS payload, toString(a.created_at) AS created_at + ORDER BY created_at DESC LIMIT $n""", {"k": k, "n": limit}) + if not rows: + return [] + scoped = [] + for r in rows: + if r["depth"] is not None: + depth, source = _assessment_depth(r["depth"])[0], "recorded" + else: + try: + legacy = json.loads(r["payload"] or "{}").get("depth") + except (TypeError, ValueError, AttributeError): + legacy = None + depth, ok = _assessment_depth(legacy) + source = "legacy_payload" if ok else "legacy_default" + scoped.append({"id": r["id"], "depth": depth, "source": source}) + return self.q( + """UNWIND $rows AS r + MATCH (a:Assessment {id: r.id})-[:ASSESSED]->(d:Device) OPTIONAL MATCH (a)-[:FLAGGED]->(x:Recall) - WITH a, d, collect(x.id) AS flagged - OPTIONAL MATCH (d)-[:CITES*0..4]->(y:Device)-[c:CITES]->(:Device) - WHERE c.reviewed_at > a.created_at OR c.ai_at > a.created_at - WITH a, d, flagged, collect(DISTINCT y.k + '->' + endNode(c).k) AS changed_edges - OPTIONAL MATCH (d)-[:CITES*0..4]->(z:Device) WHERE z.ingested_live_at > a.created_at - WITH a, d, flagged, changed_edges, collect(DISTINCT z.k) AS reingested + WITH r, a, d, collect(x.id) AS flagged + OPTIONAL MATCH p = (d)-[:CITES*0..8]->(y:Device)-[c:CITES]->(:Device) + WHERE length(p) <= r.depth + 1 AND (c.reviewed_at > a.created_at OR c.ai_at > a.created_at) + WITH r, a, d, flagged, collect(DISTINCT y.k + '->' + endNode(c).k) AS changed_edges + OPTIONAL MATCH q = (d)-[:CITES*0..8]->(z:Device) + WHERE length(q) <= r.depth AND z.ingested_live_at > a.created_at + WITH r, a, d, flagged, changed_edges, collect(DISTINCT z.k) AS reingested RETURN a.id AS id, toString(a.created_at) AS created_at, d.k AS k, d.name AS name, - a.verdict AS verdict, a.memo AS memo, a.memo_source AS memo_source, flagged, + a.verdict AS verdict, r.depth AS depth, r.source AS depth_source, + a.memo AS memo, a.memo_source AS memo_source, flagged, changed_edges, reingested, size(changed_edges) > 0 OR size(reingested) > 0 AS stale - ORDER BY created_at DESC LIMIT $n""", {"k": k, "n": limit}) - return rows + ORDER BY created_at DESC""", {"rows": scoped}) + + +ASSESSMENT_DEFAULT_DEPTH = 4 # what POST /api/assessments used when no depth was sent + + +def _assessment_depth(v) -> tuple[int, bool]: + """(depth, valid): an assessment depth clamped to the 1-8 generations assess() traverses, or the API default + when `v` is missing or not an integer (booleans included).""" + if isinstance(v, bool) or not isinstance(v, (int, float, str)): + return ASSESSMENT_DEFAULT_DEPTH, False + try: + n = int(v) + except (ValueError, OverflowError): + return ASSESSMENT_DEFAULT_DEPTH, False + return max(1, min(n, 8)), True def _clean(d: dict | None) -> dict | None: diff --git a/forebear/mcp_server.py b/forebear/mcp_server.py index ec907b1..6c12e5a 100644 --- a/forebear/mcp_server.py +++ b/forebear/mcp_server.py @@ -53,8 +53,12 @@ "a person's review. Only a person's review in the app makes a link trusted or removes it.", "inputSchema": {"type": "object", "properties": {"src": K, "dst": K, "status": {"type": "string", "enum": ["confirmed", "rejected", ""]}, "note": {"type": "string"}}, "required": ["src", "dst", "status"]}}, - {"name": "save_assessment", "description": "Persist the current check as an (:Assessment) node linked to the device and its flagged recalls.", - "inputSchema": {"type": "object", "properties": {"k_number": K, "note": {"type": "string"}}, "required": ["k_number"]}}, + {"name": "save_assessment", "description": "Persist the current check as an (:Assessment) node linked to the device and its flagged recalls. " + "`depth` is the number of predicate generations the saved verdict is computed over " + "(1-6, default 4); history rechecks the assessment at that depth.", + "inputSchema": {"type": "object", "properties": {"k_number": K, "note": {"type": "string"}, + "depth": {"type": "integer", "minimum": 1, "maximum": 6, "default": 4}}, + "required": ["k_number"]}}, {"name": "investigate", "description": "Run Forebear's autonomous investigation agent (NVIDIA-hosted LLM over the graph tools; labelled " "deterministic fallback if inference is unavailable) on one device and wait for the report. " "Returns the deterministic conclusion, recall totals, uncertainties, verified and rejected agent " @@ -148,7 +152,10 @@ def call_tool(name: str, args: dict): "status": args["status"], "note": args.get("note"), "via": "mcp-client"}) if name == "save_assessment": - return _http("POST", "/api/assessments", json={"k": up(args["k_number"]), "note": args.get("note")}) + depth = args.get("depth", 4) + if isinstance(depth, bool) or not isinstance(depth, int) or not 1 <= depth <= 6: + raise ValueError("depth must be an integer from 1 to 6") + return _http("POST", "/api/assessments", json={"k": up(args["k_number"]), "note": args.get("note"), "depth": depth}) if name == "investigate": body = {"request": args["request"], "depth": int(args.get("generations", 4)), "mode": args.get("mode", "auto")} if args.get("k_number"): diff --git a/tests/test_mcp.py b/tests/test_mcp.py index 30c7d2c..8d809ac 100644 --- a/tests/test_mcp.py +++ b/tests/test_mcp.py @@ -59,3 +59,31 @@ def test_relate_native_mcp_read_cypher(real_copy): body = json.loads(res[2]["result"]["content"][0]["text"]) assert body["rows"] == [{"p": "K113053", "n": 1}] # Z-1973-2021 (event 88058; Z-1957/1958 are event 88071) assert res[3]["result"]["isError"] is True # writes refused on the read-only surface + + +def test_mcp_save_assessment_records_the_requested_depth(live_api): + """K251770 reports no design-recall signal at depth 1 and REVIEW_LINEAGE from depth 2.""" + call = lambda i, args: {"jsonrpc": "2.0", "id": i, "method": "tools/call", # noqa: E731 + "params": {"name": "save_assessment", "arguments": {"k_number": "K251770", **args}}} + res = rpc_session([sys.executable, "-m", "forebear.mcp_server"], INIT + [ + {"jsonrpc": "2.0", "id": 2, "method": "tools/list"}, + call(3, {"depth": 1}), call(4, {"depth": 2}), call(5, {}), call(6, {"depth": 6}), + call(7, {"depth": 0}), call(8, {"depth": 7}), call(9, {"depth": "2"}), call(10, {"depth": True}), + call(11, {"depth": 1.5}), + ], env=live_api) + tool = next(t for t in res[2]["result"]["tools"] if t["name"] == "save_assessment") + assert tool["inputSchema"]["properties"]["depth"] == {"type": "integer", "minimum": 1, "maximum": 6, "default": 4} + assert tool["inputSchema"]["required"] == ["k_number"] + out = {i: json.loads(res[i]["result"]["content"][0]["text"]) for i in (3, 4, 5, 6)} + assert {i: (o["depth"], o["verdict"]) for i, o in out.items()} == { + 3: (1, "NO_DESIGN_RECALL_SIGNAL"), 4: (2, "REVIEW_LINEAGE"), 5: (4, "REVIEW_LINEAGE"), 6: (6, "REVIEW_LINEAGE")} + for i in (7, 8, 9, 10, 11): # rejected, never saved at another depth + assert res[i]["result"]["isError"] is True + assert "depth must be an integer from 1 to 6" in res[i]["result"]["content"][0]["text"] + import httpx + hist = {h["id"]: h for h in httpx.get(live_api["FOREBEAR_URL"] + "/api/assessments", params={"k": "K251770"}).json()} + assert len(hist) == 4 # the invalid calls saved nothing + for o in out.values(): + h = hist[o["id"]] + assert (h["depth"], h["depth_source"], h["verdict"]) == (o["depth"], "recorded", o["verdict"]) + assert h["verdict_now"] == h["verdict"] and h["stale"] is False diff --git a/tests/test_saved_assessment_depth.py b/tests/test_saved_assessment_depth.py new file mode 100644 index 0000000..c81a3f6 --- /dev/null +++ b/tests/test_saved_assessment_depth.py @@ -0,0 +1,131 @@ +"""A saved assessment keeps the query depth it was computed at: history recomputes its verdict and checks staleness +at that depth, so an unchanged graph never makes it stale, while a change to evidence that depth reads still does. + +Tiny graph lineage used here: K000004 -> K000003 -> K000002 (design-related Class I recall) -> K000001, and +K000004 -> K000008. At depth 1 K000004 reports no signal; from depth 2 the recall makes it REVIEW_LINEAGE. +""" +import importlib +import json + +import pytest +from fastapi.testclient import TestClient + +from conftest import build_tiny +from forebear.lineage import assess + +K = "K000004" + + +def _legacy(g, aid, verdict, payload): + """An assessment node as saved before depth was stored on it.""" + g.conn.execute("""MATCH (d:Device {k:$k}) + CREATE (a:Assessment {id:$id, created_at: datetime(), target_k:$k, verdict:$v, payload:$p, + memo:'m', memo_source:'template'})-[:ASSESSED]->(d)""", + {"k": K, "id": aid, "v": verdict, "p": payload}) + + +@pytest.fixture +def tiny_api(tmp_path, monkeypatch): + path = tmp_path / "tiny.rl" + g = build_tiny(path) + assert [assess(g, K, d)["verdict"] for d in (1, 2, 4)] == \ + ["NO_DESIGN_RECALL_SIGNAL", "REVIEW_LINEAGE", "REVIEW_LINEAGE"] + _legacy(g, "A-legacy-p1", "NO_DESIGN_RECALL_SIGNAL", json.dumps({"verdict": "NO_DESIGN_RECALL_SIGNAL", "depth": 1})) + _legacy(g, "A-legacy-none", "REVIEW_LINEAGE", json.dumps({"verdict": "REVIEW_LINEAGE"})) + _legacy(g, "A-legacy-bad", "REVIEW_LINEAGE", "not json") + g.close() + monkeypatch.setenv("FOREBEAR_DB", str(path)) + from forebear import api + importlib.reload(api) + with TestClient(api.app) as c: + yield c, path + + +def _history(c): + return {h["id"]: h for h in c.get("/api/assessments", params={"k": K}).json()} + + +def _save(c, depth): + r = c.post("/api/assessments", json={"k": K, "depth": depth}) + assert r.status_code == 200 + return r.json() + + +def test_each_depth_is_saved_and_unchanged_graph_is_not_stale(tiny_api): + c, _ = tiny_api + saved = {d: _save(c, d) for d in (1, 2, 4)} + assert {d: (s["depth"], s["verdict"]) for d, s in saved.items()} == { + 1: (1, "NO_DESIGN_RECALL_SIGNAL"), 2: (2, "REVIEW_LINEAGE"), 4: (4, "REVIEW_LINEAGE")} + h = _history(c) + for d, s in saved.items(): + row = h[s["id"]] + assert (row["depth"], row["depth_source"]) == (d, "recorded") + # recomputed at its own depth: the depth-1 verdict is not compared with the depth-4 one + assert row["verdict_now"] == row["verdict"] == s["verdict"] + assert row["stale"] is False and row["changed_edges"] == [] and row["reingested"] == [] + + +def test_depth_is_stored_on_the_assessment_node(tiny_api): + c, _ = tiny_api + ids = {_save(c, d)["id"]: d for d in (1, 2, 4)} + from forebear import api # the API is the single writer: read through its store and thread + rows = c.portal.call(api.run, lambda g: g.q( + "MATCH (a:Assessment) WHERE a.id IN $ids RETURN a.id AS id, a.depth AS depth, a.payload AS p", + {"ids": list(ids)})) + assert {r["id"]: r["depth"] for r in rows} == ids + assert {r["id"]: json.loads(r["p"])["depth"] for r in rows} == ids + + +def test_a_change_within_the_saved_depth_makes_it_stale_and_one_beyond_does_not(tiny_api): + c, _ = tiny_api + ids = {d: _save(c, d)["id"] for d in (1, 2, 4)} + # K000002 -> K000001 leaves the generation-2 ancestor: read at depth 2 and 4, not at depth 1 + assert c.post("/api/citation/review", json={"src": "K000002", "dst": "K000001", "status": "confirmed"}).status_code == 200 + h = _history(c) + assert h[ids[1]]["stale"] is False and h[ids[1]]["changed_edges"] == [] + for d in (2, 4): + assert h[ids[d]]["stale"] is True and h[ids[d]]["changed_edges"] == ["K000002->K000001"] + assert h[ids[d]]["verdict_now"] == h[ids[d]]["verdict"] + + +def test_a_relevant_citation_change_flags_every_depth_and_reports_the_new_verdict(tiny_api): + c, _ = tiny_api + ids = {d: _save(c, d)["id"] for d in (1, 2, 4)} + # rejecting the direct predicate removes the whole ancestry: relevant at every depth + assert c.post("/api/citation/review", json={"src": K, "dst": "K000003", "status": "rejected"}).status_code == 200 + h = _history(c) + for d in (1, 2, 4): + assert h[ids[d]]["stale"] is True and f"{K}->K000003" in h[ids[d]]["changed_edges"] + assert h[ids[d]]["verdict_now"] == assess_now(c, d) + assert h[ids[2]]["verdict_now"] != h[ids[2]]["verdict"] + assert h[ids[4]]["verdict_now"] != h[ids[4]]["verdict"] + + +def assess_now(c, depth): + return c.get(f"/api/assess/{K}", params={"depth": depth}).json()["verdict"] + + +def test_legacy_assessments_use_the_payload_depth_or_the_old_default(tiny_api): + c, _ = tiny_api + h = _history(c) + # saved before depth was stored: the payload records the depth its verdict was computed at + assert (h["A-legacy-p1"]["depth"], h["A-legacy-p1"]["depth_source"]) == (1, "legacy_payload") + assert h["A-legacy-p1"]["verdict_now"] == "NO_DESIGN_RECALL_SIGNAL" and h["A-legacy-p1"]["stale"] is False + # no depth anywhere (or an unreadable payload): the API default the assessment was saved with + for aid in ("A-legacy-none", "A-legacy-bad"): + assert (h[aid]["depth"], h[aid]["depth_source"]) == (4, "legacy_default") + assert h[aid]["verdict_now"] == "REVIEW_LINEAGE" and h[aid]["stale"] is False + # and genuine changes still flag legacy records, scoped to their depth + c.post("/api/citation/review", json={"src": "K000002", "dst": "K000001", "status": "confirmed"}) + h = _history(c) + assert h["A-legacy-p1"]["stale"] is False + assert h["A-legacy-none"]["stale"] is True and h["A-legacy-bad"]["stale"] is True + + +def test_depth_parsing_falls_back_safely(): + from forebear.graph import _assessment_depth + assert _assessment_depth(2) == (2, True) + assert _assessment_depth("3") == (3, True) + assert _assessment_depth(0) == (1, True) and _assessment_depth(99) == (8, True) + for bad in (None, True, "x", [], {}, float("inf")): + assert _assessment_depth(bad) == (4, False) diff --git a/web/dist/assets/History-B4TVd-Qw.js b/web/dist/assets/History-B4TVd-Qw.js deleted file mode 100644 index b61d375..0000000 --- a/web/dist/assets/History-B4TVd-Qw.js +++ /dev/null @@ -1 +0,0 @@ -import{r as i,j as e,V as p,d as b,c as j}from"./index-Ch_7cPZN.js";function y({go:a}){const[n,d]=i.useState(null),[t,r]=i.useState(null),[l,h]=i.useState(null),[o,x]=i.useState(null),c=()=>{j.assessments().then(d).catch(s=>x(s.message)),j.investigations(null,50).then(r).catch(()=>r([])),j.proposals("pending_human_decision").then(h).catch(()=>h([]))};return i.useEffect(c,[]),e.jsxs("div",{children:[e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:"Graph"}),e.jsx("h1",{children:"Investigation history"}),e.jsx("p",{children:"Saved assessments and their staleness against today's graph, then optional agent runs and the proposals they left for a person."})]}),o&&e.jsx("p",{className:"err",children:o}),e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"panel-head",children:[e.jsxs("h2",{children:["Saved assessments ",e.jsx("span",{className:"count",children:(n==null?void 0:n.length)??"…"})]}),e.jsx("p",{className:"hint",children:"Stale means a citation in the ancestry was reviewed or re-ingested after saving."})]}),n&&n.length===0&&e.jsx("p",{className:"muted",children:"None yet. Save one from any investigation."}),n&&n.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Assessment"}),e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Saved verdict"}),e.jsx("th",{children:"Now"}),e.jsx("th",{children:"Saved"})]})}),e.jsx("tbody",{children:n.map(s=>{var m,u,N,g;return e.jsxs("tr",{className:"click",tabIndex:0,onClick:()=>a("check",s.k),onKeyDown:v=>v.key==="Enter"&&a("check",s.k),children:[e.jsx("td",{className:"mono",children:s.id}),e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k}),e.jsx("div",{className:"sub",children:s.name})]}),e.jsx("td",{children:e.jsx("span",{className:`chip tone-${((m=p[s.verdict])==null?void 0:m.tone)||"muted"}`,children:((u=p[s.verdict])==null?void 0:u.label)||s.verdict})}),e.jsx("td",{children:s.stale?e.jsxs("span",{className:"stale",children:["Stale",s.verdict_now!==s.verdict?` · now ${((N=p[s.verdict_now])==null?void 0:N.label)||s.verdict_now}`:""]}):e.jsx("span",{className:"ok",children:"Current"})}),e.jsx("td",{className:"sub num",children:(g=s.created_at)==null?void 0:g.slice(0,16).replace("T"," ")})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Agent runs (optional) ",e.jsx("span",{className:"count",children:(t==null?void 0:t.length)??"…"})]})}),e.jsx("p",{className:"lede",children:"Machine findings, verified against tool results but never human-approved. Deterministic assessments remain the authoritative record."}),t&&t.length===0&&e.jsx("p",{className:"muted",children:"No agent runs in this store. They can be started from the command line or the API (see README)."}),t&&t.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Run"}),e.jsx("th",{children:"Target"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Mode"}),e.jsx("th",{children:"Pending proposals"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:t.map(s=>{var m;return e.jsxs("tr",{children:[e.jsxs("td",{className:"mono",children:[s.id,e.jsx("div",{className:"sub",children:(m=s.created_at)==null?void 0:m.slice(0,16).replace("T"," ")})]}),e.jsx("td",{children:e.jsx("a",{href:`#/check/${s.target_k}`,className:"k mono",children:s.target_k})}),e.jsxs("td",{children:[e.jsx("span",{className:"chip",children:s.status}),s.stale&&e.jsx("span",{className:"stale",children:" · stale"})]}),e.jsxs("td",{className:"sub",children:[s.mode,s.model_used?` · ${s.model_used}`:""]}),e.jsx("td",{className:"num",children:s.pending_proposals}),e.jsx("td",{children:e.jsx("a",{href:b(s.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Proposals awaiting a person ",e.jsx("span",{className:"count",children:(l==null?void 0:l.length)??"…"})]})}),l&&l.length===0&&e.jsx("p",{className:"muted",children:"None pending."}),l&&l.map(s=>e.jsx(k,{p:s,onDone:c},s.id))]})]})}function k({p:a,onDone:n}){const[d,t]=i.useState(""),[r,l]=i.useState(!1),[h,o]=i.useState(null),x=async c=>{try{await j.decide(a.id,c,d.trim()),o({ok:!0,text:`Recorded: ${c}.`}),n()}catch(s){o({ok:!1,text:s.message})}};return e.jsxs("div",{className:"review-item tone-muted",children:[e.jsxs("h3",{children:[e.jsx("span",{className:"sev sev-info",children:a.kind}),e.jsx("span",{className:"mono",children:a.id}),e.jsx("span",{children:a.k||`${a.src} → ${a.dst}`})]}),a.reason&&e.jsx("p",{className:"muted small",style:{margin:"0 0 8px"},children:a.reason}),e.jsxs("div",{className:"cit-a",children:[e.jsx("input",{className:"field",style:{maxWidth:220},placeholder:"Your name",value:d,onChange:c=>t(c.target.value),"aria-label":"Your name"}),e.jsxs("label",{className:"small",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:c=>l(c.target.checked)})," I am a person deciding this"]}),e.jsx("button",{className:"btn btn-line btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("approve"),children:"Approve"}),e.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("dismiss"),children:"Dismiss"})]}),h&&e.jsx("p",{className:h.ok?"ok":"err",children:h.text})]})}export{y as default}; diff --git a/web/dist/assets/History-CRNBlWcy.js b/web/dist/assets/History-CRNBlWcy.js new file mode 100644 index 0000000..f2996c1 --- /dev/null +++ b/web/dist/assets/History-CRNBlWcy.js @@ -0,0 +1 @@ +import{r as i,j as e,d as b,V as p,e as k,c as j}from"./index-DCKpjP6o.js";function S({go:a}){const[n,d]=i.useState(null),[t,r]=i.useState(null),[l,h]=i.useState(null),[o,x]=i.useState(null),c=()=>{j.assessments().then(d).catch(s=>x(s.message)),j.investigations(null,50).then(r).catch(()=>r([])),j.proposals("pending_human_decision").then(h).catch(()=>h([]))};return i.useEffect(c,[]),e.jsxs("div",{children:[e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:"Graph"}),e.jsx("h1",{children:"Investigation history"}),e.jsx("p",{children:"Saved assessments and their staleness against today's graph, then optional agent runs and the proposals they left for a person."})]}),o&&e.jsx("p",{className:"err",children:o}),e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"panel-head",children:[e.jsxs("h2",{children:["Saved assessments ",e.jsx("span",{className:"count",children:(n==null?void 0:n.length)??"…"})]}),e.jsx("p",{className:"hint",children:"Stale means a citation in the ancestry was reviewed or re-ingested after saving."})]}),n&&n.length===0&&e.jsx("p",{className:"muted",children:"None yet. Save one from any investigation."}),n&&n.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Assessment"}),e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Depth"}),e.jsx("th",{children:"Saved verdict"}),e.jsx("th",{children:"Now"}),e.jsx("th",{children:"Saved"})]})}),e.jsx("tbody",{children:n.map(s=>{var m,u,N,v;return e.jsxs("tr",{className:"click",tabIndex:0,onClick:()=>a("check",s.k),onKeyDown:g=>g.key==="Enter"&&a("check",s.k),children:[e.jsx("td",{className:"mono",children:s.id}),e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k}),e.jsx("div",{className:"sub",children:s.name})]}),e.jsx("td",{className:"sub num","data-testid":"saved-depth",children:b(s)}),e.jsx("td",{children:e.jsx("span",{className:`chip tone-${((m=p[s.verdict])==null?void 0:m.tone)||"muted"}`,children:((u=p[s.verdict])==null?void 0:u.label)||s.verdict})}),e.jsx("td",{children:s.stale?e.jsxs("span",{className:"stale",children:["Stale",s.verdict_now!==s.verdict?` · now ${((N=p[s.verdict_now])==null?void 0:N.label)||s.verdict_now}`:""]}):e.jsx("span",{className:"ok",children:"Current"})}),e.jsx("td",{className:"sub num",children:(v=s.created_at)==null?void 0:v.slice(0,16).replace("T"," ")})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Agent runs (optional) ",e.jsx("span",{className:"count",children:(t==null?void 0:t.length)??"…"})]})}),e.jsx("p",{className:"lede",children:"Machine findings, verified against tool results but never human-approved. Deterministic assessments remain the authoritative record."}),t&&t.length===0&&e.jsx("p",{className:"muted",children:"No agent runs in this store. They can be started from the command line or the API (see README)."}),t&&t.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Run"}),e.jsx("th",{children:"Target"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Mode"}),e.jsx("th",{children:"Pending proposals"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:t.map(s=>{var m;return e.jsxs("tr",{children:[e.jsxs("td",{className:"mono",children:[s.id,e.jsx("div",{className:"sub",children:(m=s.created_at)==null?void 0:m.slice(0,16).replace("T"," ")})]}),e.jsx("td",{children:e.jsx("a",{href:`#/check/${s.target_k}`,className:"k mono",children:s.target_k})}),e.jsxs("td",{children:[e.jsx("span",{className:"chip",children:s.status}),s.stale&&e.jsx("span",{className:"stale",children:" · stale"})]}),e.jsxs("td",{className:"sub",children:[s.mode,s.model_used?` · ${s.model_used}`:""]}),e.jsx("td",{className:"num",children:s.pending_proposals}),e.jsx("td",{children:e.jsx("a",{href:k(s.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Proposals awaiting a person ",e.jsx("span",{className:"count",children:(l==null?void 0:l.length)??"…"})]})}),l&&l.length===0&&e.jsx("p",{className:"muted",children:"None pending."}),l&&l.map(s=>e.jsx(f,{p:s,onDone:c},s.id))]})]})}function f({p:a,onDone:n}){const[d,t]=i.useState(""),[r,l]=i.useState(!1),[h,o]=i.useState(null),x=async c=>{try{await j.decide(a.id,c,d.trim()),o({ok:!0,text:`Recorded: ${c}.`}),n()}catch(s){o({ok:!1,text:s.message})}};return e.jsxs("div",{className:"review-item tone-muted",children:[e.jsxs("h3",{children:[e.jsx("span",{className:"sev sev-info",children:a.kind}),e.jsx("span",{className:"mono",children:a.id}),e.jsx("span",{children:a.k||`${a.src} → ${a.dst}`})]}),a.reason&&e.jsx("p",{className:"muted small",style:{margin:"0 0 8px"},children:a.reason}),e.jsxs("div",{className:"cit-a",children:[e.jsx("input",{className:"field",style:{maxWidth:220},placeholder:"Your name",value:d,onChange:c=>t(c.target.value),"aria-label":"Your name"}),e.jsxs("label",{className:"small",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:c=>l(c.target.checked)})," I am a person deciding this"]}),e.jsx("button",{className:"btn btn-line btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("approve"),children:"Approve"}),e.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("dismiss"),children:"Dismiss"})]}),h&&e.jsx("p",{className:h.ok?"ok":"err",children:h.text})]})}export{S as default}; diff --git a/web/dist/assets/Landing-0CfXrj7l.js b/web/dist/assets/Landing-DOKreNVa.js similarity index 99% rename from web/dist/assets/Landing-0CfXrj7l.js rename to web/dist/assets/Landing-DOKreNVa.js index 6416e73..5cbf8b5 100644 --- a/web/dist/assets/Landing-0CfXrj7l.js +++ b/web/dist/assets/Landing-DOKreNVa.js @@ -1 +1 @@ -import{r as h,m as M,j as e,W as q,f as N,p as L,R as T,M as B,_ as O}from"./index-Ch_7cPZN.js";import{u as re}from"./index-Ch_7cPZN.js";const K="Every claim the opening film makes. tests/test_story_facts.py checks each value against the shipped Relate store.",W={k:"K252078",name:"BreathePal Bilevel",applicant:"Compal Electronics, Inc.",decision_date:"2026-03-17",summary_url:"https://www.accessdata.fda.gov/cdrh_docs/pdf25/K252078.pdf",verdict:"REVIEW_LINEAGE"},V={src:"K252078",dst:"K113053",page:6,quote:"substantially equivalent to the legally marketed predicate device, BiPAP A30 Ventilatory support system (K113053)."},z={k:"K113053",name:"BiPAP A30 Ventilatory Support System",applicant:"Respironics, Inc.",decision_date:"2012-02-01"},Z={holder:"K113053",event:"88071",ids:["Z-1957-2021","Z-1958-2021"],classification:"Class I",root_cause:"Device Design",initiated:"2021-06-14",reason:"The polyester-based polyurethane (PE-PUR) foam may degrade into particles"},H=[{k:"K092818",name:"BiPAP AVAPS",decision_date:"2010-01-22"},{k:"K082660",name:"V60 Ventilator",decision_date:"2009-01-09"},{k:"K103167",name:"Stellar 150",decision_date:"2011-03-01"}],g={_note:K,candidate:W,citation:V,predicate:z,recall:Z,grand_predicates:H},Y={k:"K251770",name:"SleepRes PAP System"},G={id:"Z-1974-2021",classification:"Class I"},v={candidate:Y,recall:G},_=(()=>{let s=0;const a=new Set;return{set(t){t!==s&&(s=t,a.forEach(n=>n()))},get:()=>s,subscribe(t){return a.add(t),()=>a.delete(t)}}})(),$=()=>h.useSyncExternalStore(_.subscribe,_.get);function P(){const s=h.useRef(null);return h.useEffect(()=>{const a=s.current;if(!a||typeof IntersectionObserver>"u"){a==null||a.classList.add("in-frame");return}const t=new IntersectionObserver(([n])=>a.classList.toggle("in-frame",n.isIntersecting),{rootMargin:"-12% 0px -12% 0px"});return t.observe(a),()=>t.disconnect()},[]),s}function I(){const s=innerHeight;return[...document.querySelectorAll("[data-scene]")].map(a=>{const t=a.getBoundingClientRect(),n=t.top+scrollY,c=innerWidth<=860,l=a.dataset.align==="top"?0:c&&a.classList.contains("chapter-copy")?n-s*.55:n+t.height/2-s*.5;return[Math.max(0,l),Number(a.dataset.scene)]}).sort((a,t)=>a[1]-t[1]).map((a,t,n)=>t&&a[0]<=n[t-1][0]?[n[t-1][0]+1,a[1]]:a)}function U(){try{return!!document.createElement("canvas").getContext("2d")}catch{return!1}}function D(){const s=innerWidth,a=innerHeight,t=48,n=Math.max(24,s*.03),c={},l=document.querySelector(".hero-copy");if(l){const r=l.getBoundingClientRect();c[0]=[Math.min(s*.62,r.right+t),a*.18,s-n-40,a*.82]}document.querySelectorAll(".chapter-copy[data-scene]").forEach(r=>{const m=r.getBoundingClientRect(),i=Number(r.dataset.scene),d=m.left+m.width/2{if(s||!U()){document.documentElement.dataset.film="off";return}let d=!1;const x=matchMedia("(max-width: 860px), (pointer: coarse)").matches,u=/[?&]gl=1\b/.test(location.search);return O(async()=>{const{createFilm:j}=await import("./renderer-DE7JEwcd.js");return{createFilm:j}},[]).then(({createFilm:j})=>{var b;if(!(d||!l.current))try{r.current=j(l.current,{glCanvas:o.current,facts:g,deviceCount:((b=t==null?void 0:t.nodes)==null?void 0:b.Device)||1187,compact:x,forceGL:u,onScene:n,onRenderer:p=>{i(p),c&&c(p)}}),r.current.setAnchors(I()),r.current.setZones(D()),r.current.snap(),delete document.documentElement.dataset.film,i(r.current.kind),c&&c(r.current.kind)}catch{document.documentElement.dataset.film="off"}}).catch(()=>{document.documentElement.dataset.film="off"}),()=>{var j;d=!0,(j=r.current)==null||j.dispose(),r.current=null}},[s]),h.useEffect(()=>{var b;if(!m)return;const d=()=>{var p,k;(p=r.current)==null||p.setAnchors(I()),(k=r.current)==null||k.setZones(D())},x=new ResizeObserver(()=>{var p;(p=r.current)==null||p.resize(),d()});x.observe(document.body),(b=document.fonts)==null||b.ready.then(d);const u=p=>{var k;return(k=r.current)==null?void 0:k.setPointer(p.clientX,p.clientY,!0)},j=()=>{var p;return(p=r.current)==null?void 0:p.setPointer(-9999,-9999,!1)};return addEventListener("pointermove",u,{passive:!0}),document.addEventListener("pointerleave",j),()=>{x.disconnect(),removeEventListener("pointermove",u),document.removeEventListener("pointerleave",j)}},[!!m]),h.useEffect(()=>{var d;m&&a==="bloom"&&((d=r.current)==null||d.bloom())},[!!m,a]),e.jsxs("div",{className:"film-stage","aria-hidden":"true",children:[e.jsx("div",{className:"film-fallback",children:e.jsxs("svg",{viewBox:"0 0 560 320",children:[e.jsx("path",{d:"M520 60 C 380 60, 380 160, 240 160",stroke:"#7fa2ff",strokeWidth:"1.6",fill:"none"}),e.jsx("path",{d:"M240 160 C 160 160, 160 80, 80 80 M240 160 C 160 160, 160 250, 70 250",stroke:"#7fa2ff",strokeOpacity:".4",fill:"none"}),e.jsx("path",{d:"M240 160 L 420 160",stroke:"#e7a948",strokeDasharray:"2 4"}),e.jsx("path",{d:"M420 152 l8 8 -8 8 -8 -8z",fill:"#e7a948"}),e.jsx("circle",{cx:"520",cy:"60",r:"9",fill:"#f1ebdd",stroke:"#7fa2ff",strokeWidth:"3"}),e.jsx("circle",{cx:"240",cy:"160",r:"7",fill:"#e7a948"}),e.jsx("circle",{cx:"80",cy:"80",r:"6",fill:"#e7a948"}),e.jsx("circle",{cx:"70",cy:"250",r:"6",fill:"#9aa7c2"})]})}),e.jsx("canvas",{ref:o,className:"film-gl"+(m==="webgl"?" is-live":"")}),e.jsx("div",{className:"film-grid"}),e.jsx("canvas",{ref:l,className:"film-story"+(m?" is-live":""),"data-testid":"film-canvas","data-renderer":m||"fallback"}),e.jsx("div",{className:"film-vignette"})]})}const F=[{n:"00",name:"The field",read:s=>`${s.k} · one point among the store's clearances`},{n:"01",name:"The filing",read:(s,a)=>`${s.k} · 510(k) summary · page ${a.page}`},{n:"02",name:"The connection",read:(s,a,t)=>`${s.k} → ${t.k} · ${s.decision_date.slice(0,4)} → ${t.decision_date.slice(0,4)}`},{n:"03",name:"The discovery",read:(s,a,t,n)=>`${t.k} · ${n.classification} · ${n.root_cause} · ${n.initiated}`},{n:"04",name:"The handoff",read:()=>"generation columns · same layout as the workspace"}];function J(){const s=$(),[a,t]=h.useState(!1);h.useEffect(()=>{const c=document.querySelector(".paths");if(!c||typeof IntersectionObserver>"u")return;const l=new IntersectionObserver(([o])=>t(o.isIntersecting||o.boundingClientRect.top<0));return l.observe(c),()=>l.disconnect()},[]);const n=F[s]||F[0];return e.jsxs("div",{className:"film-hud"+(a?" is-away":""),"aria-hidden":"true",children:[e.jsxs("span",{className:"hud-n",children:["[",n.n," / 04]"]}),e.jsx("span",{className:"hud-name",children:n.name}),e.jsx("span",{className:"hud-read",children:n.read(g.candidate,g.citation,g.predicate,g.recall)})]})}function w({v:s}){const[a,t]=h.useState(0);return h.useEffect(()=>{if(s==null)return;if(matchMedia("(prefers-reduced-motion: reduce)").matches){t(s);return}let n,c;const l=o=>{c??(c=o);const r=Math.min(1,(o-c)/1100);t(Math.round(s*(1-Math.pow(1-r,3)))),r<1&&(n=requestAnimationFrame(l))};return n=requestAnimationFrame(l),()=>cancelAnimationFrame(n)},[s]),s==null?null:e.jsx("b",{children:a.toLocaleString("en-US")})}function Q({reduced:s}){const a=$();return e.jsx("nav",{className:"film-index","aria-label":"Film chapters",children:ee.map(([t,n],c)=>e.jsxs("a",{href:`#${t}`,className:a===c?"on":"","aria-current":a===c?"step":void 0,onClick:l=>{var o;l.preventDefault(),(o=document.getElementById(t==="top"?"top":`${t}-copy`))==null||o.scrollIntoView({block:"center",behavior:s?"auto":"smooth"})},children:[e.jsx("span",{children:n}),e.jsx("i",{})]},t))})}const A=({children:s})=>e.jsx("span",{className:"ln",children:e.jsx("span",{children:s})});function E({id:s,scene:a,mark:t,label:n,place:c,statement:l,children:o,foot:r}){const m=P();return e.jsx("article",{id:s,className:`chapter place-${c}`,"aria-labelledby":`${s}-title`,children:e.jsxs("div",{ref:m,className:"chapter-copy reveal","data-scene":a,id:`${s}-copy`,children:[e.jsxs("p",{className:"chapter-label",children:[e.jsxs("span",{children:[t," / 03"]}),n]}),e.jsx("h2",{className:"chapter-statement",id:`${s}-title`,children:l.map((i,d)=>e.jsxs(A,{children:[i," "]},d))}),o,r&&e.jsx("p",{className:"chapter-foot",children:r})]})})}const ee=[["top","Opening"],["the-filing","The filing"],["the-connection","The connection"],["the-discovery","The discovery"],["handoff","Investigate"]];function se({go:s,stats:a,introDone:t,reduced:n}){var S,R,C;const[c,l]=h.useState(!1),[o,r]=h.useState(null),m=P();h.useEffect(()=>{const f=()=>l(scrollY>40);return f(),addEventListener("scroll",f,{passive:!0}),()=>removeEventListener("scroll",f)},[]);const i=g.candidate,d=g.predicate,x=g.recall,u=g.citation,j=M(x.initiated,i.decision_date),b=Math.floor(j/12),p=j%12,k=u.quote.split(u.dst);return e.jsxs("div",{className:"film",id:"top",children:[e.jsx(X,{reduced:n,introDone:t,stats:a,onScene:_.set,onKind:r}),o&&e.jsx(J,{}),e.jsxs("header",{className:"film-top"+(c?" is-solid":""),children:[e.jsx("a",{href:"#/","aria-label":"Forebear, start of film",onClick:f=>{f.preventDefault(),scrollTo({top:0})},children:e.jsx(q,{size:26})}),e.jsx("span",{className:"spacer"}),e.jsxs("nav",{"aria-label":"Product",children:[e.jsx("a",{href:"#/check",children:"Investigate"}),e.jsx("a",{href:"#/reach/88058,88071",children:"Recall reach"}),e.jsx("a",{href:"#/watch",children:"Watchlist"}),e.jsx("a",{href:"#/method",children:"Method"})]}),e.jsxs("a",{className:"btn btn-primary btn-sm",href:"#/check","data-testid":"open-workspace",children:["Open workspace ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]})]}),e.jsx(Q,{reduced:n}),e.jsxs("main",{id:"main",children:[e.jsx("section",{className:"hero","data-scene":"0","data-align":"top","aria-labelledby":"hero-title",children:e.jsxs("div",{className:"hero-copy",children:[e.jsx("p",{className:"eyebrow",children:"510(k) predicate due diligence"}),e.jsxs("h1",{id:"hero-title",tabIndex:-1,style:{outline:"none"},children:["Every clearance has ",e.jsx("em",{children:"a past."})]}),e.jsxs("p",{className:"hero-lede",children:["Forebear reads the predicates out of FDA 510(k) summaries, stores the family tree in a ",e.jsx("b",{children:"Relate graph"})," joined to FDA recall records, and shows in one query whether a predicate, or any of its ancestors, was recalled for a design problem, as far back as their summaries can be read: ",e.jsx("b",{children:"with the page and quote behind every link."})]}),e.jsxs("div",{className:"hero-actions",children:[e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"hero-investigate",onClick:f=>{f.preventDefault(),s("check",i.k,{transition:!0})},children:["Investigate ",i.k," ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsxs("a",{className:"btn btn-line",href:"#the-filing-copy",onClick:f=>{var y;f.preventDefault(),(y=document.getElementById("the-filing-copy"))==null||y.scrollIntoView({block:"center",behavior:n?"auto":"smooth"})},children:["Follow one thread ",e.jsx("span",{"aria-hidden":"true",children:"↓"})]})]}),e.jsxs("a",{className:"hero-alt",href:`#/check/${v.candidate.k}`,"data-testid":"hero-two-hop",onClick:f=>{f.preventDefault(),s("check",v.candidate.k,{transition:!0})},children:[e.jsx("span",{className:"hero-alt-tag",children:"Two hops deep"}),e.jsxs("span",{children:[e.jsx("span",{className:"k",children:v.candidate.k}),": at depth 1, no design-recall signal. At depth 2, a ",v.recall.classification," design recall (",v.recall.id,") on its predicate's predicates. ",e.jsx("b",{children:"See both depths →"})]})]}),a&&e.jsxs("div",{className:"hero-proof","aria-label":"What is in the shipped graph",children:[e.jsxs("div",{children:[e.jsx(w,{v:(S=a.nodes)==null?void 0:S.Device}),e.jsx("span",{children:"clearances in the graph"})]}),e.jsxs("div",{children:[e.jsx(w,{v:(R=a.citations_by_kind)==null?void 0:R.predicate}),e.jsx("span",{children:"predicate links, each with a page"})]}),e.jsxs("div",{children:[e.jsx(w,{v:(C=a.nodes)==null?void 0:C.Recall}),e.jsx("span",{children:"FDA recall records joined"})]})]})]})}),e.jsxs(E,{id:"the-filing",scene:1,mark:"01",label:"The filing",place:"left",statement:["One document","tells one step."],foot:"A 510(k) summary names its predicate. It does not tell you what became of it.",children:[e.jsxs("p",{className:"chapter-body",children:[i.name," (",e.jsx("span",{className:"k",children:i.k}),") was cleared on ",N(i.decision_date),". Its 510(k) summary names a single predicate, on page ",u.page,":"]}),e.jsxs("figure",{className:"doc","aria-label":`Quote from page ${u.page} of the ${i.k} summary`,children:[e.jsxs("div",{className:"doc-meta",children:[e.jsxs("span",{children:[i.k," · 510(k) summary"]}),e.jsxs("span",{children:["page ",u.page]})]}),e.jsxs("blockquote",{style:{margin:0},children:["“…",k[0],e.jsx("mark",{children:u.dst}),k[1],"”"]}),e.jsx("div",{style:{marginTop:10},children:e.jsxs("a",{href:L(i.summary_url,u.page),target:"_blank",rel:"noreferrer",children:["Open the FDA PDF at page ",u.page," ↗"]})})]})]}),e.jsx(E,{id:"the-connection",scene:2,mark:"02",label:"The connection",place:"right",statement:["Follow the thread","back in time."],foot:"Each thread is an edge in the graph, stored with its page, quote and source PDF.",children:e.jsxs("p",{className:"chapter-body",children:[e.jsx("span",{className:"k",children:i.k})," → ",e.jsx("span",{className:"k",children:d.k}),": the ",e.jsx("b",{children:d.name}),", cleared to ",d.applicant," on ",N(d.decision_date),". And ",d.k," cites predicates of its own: ",g.grand_predicates.map((f,y)=>e.jsxs(T.Fragment,{children:[y?y===g.grand_predicates.length-1?" and ":", ":"",e.jsx("span",{className:"k",children:f.k})]},f.k)),". FDA's databases answer one hop at a time. Relate walks them all in one variable-length query."]})}),e.jsxs(E,{id:"the-discovery",scene:3,mark:"03",label:"The discovery",place:"left",statement:["FDA recalls name",e.jsx("em",{children:"the predicate."},"e")],foot:"A recall on a predicate is not a finding about the new device. It is a question the predicate rationale should answer.",children:[e.jsxs("p",{className:"chapter-body",children:["On ",N(x.initiated)," a ",e.jsx("b",{children:x.classification})," recall of the BiPAP A30 began, root cause ",e.jsx("b",{children:x.root_cause}),": “",x.reason,"…” (event ",x.event,", records ",x.ids.join(" and "),")."]}),e.jsxs("div",{className:"fact-row",children:[e.jsxs("div",{className:"fact amber",children:[e.jsxs("b",{children:[b," yr ",p," mo"]}),e.jsxs("span",{children:["between recall start and ",i.k,"'s clearance"]})]}),e.jsxs("div",{className:"fact",children:[e.jsx("b",{children:"Review lineage"}),e.jsxs("span",{children:["deterministic verdict for ",i.k]})]})]}),e.jsx("p",{className:"chapter-body",style:{fontSize:14},children:"FDA's 2023 draft guidance recommends predicates not subject to design-related recalls."})]}),e.jsx("section",{id:"handoff",className:"handoff","aria-labelledby":"handoff-title",children:e.jsxs("div",{ref:m,className:"reveal","data-scene":"4",id:"handoff-copy",children:[e.jsxs("p",{className:"lead",id:"handoff-title",children:[e.jsx(A,{children:"Every fact above is real evidence."}),e.jsx(A,{children:e.jsx("em",{children:"Now work with it."})})]}),e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"handoff-investigate",onClick:f=>{f.preventDefault(),s("check",i.k,{transition:!0})},children:["Open the investigation ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsx("p",{className:"sub",children:"Every node, date and quote above is read from the shipped Relate store; the background field is illustrative."})]})}),e.jsxs("section",{className:"paths","aria-labelledby":"paths-title",children:[e.jsx("h2",{id:"paths-title",children:"Or start somewhere else"}),e.jsxs("div",{className:"path-grid",children:[e.jsxs("a",{className:"path-card",href:"#/reach/88058,88071",children:[e.jsx("span",{className:"k",children:"Recall 88058 + 88071"}),e.jsx("h3",{children:"Recall reach"}),e.jsx("p",{children:"From the June 2021 Philips foam recall: which later clearances descend from it?"})]}),e.jsxs("a",{className:"path-card",href:"#/watch",children:[e.jsx("span",{className:"k",children:"Watchlist"}),e.jsx("h3",{children:"Cited after a recall"}),e.jsx("p",{children:"Clearances whose predicate was already under a design-related recall."})]}),e.jsxs("a",{className:"path-card",href:"#/compare/K200480 K113053 K233643 K143677",children:[e.jsx("span",{className:"k",children:"Compare"}),e.jsx("h3",{children:"Choose a predicate"}),e.jsx("p",{children:"Candidate predicates side by side, with their own and inherited recalls."})]}),e.jsxs("a",{className:"path-card",href:`#/check/${v.candidate.k}`,children:[e.jsxs("span",{className:"k",children:[v.candidate.k," · two hops"]}),e.jsx("h3",{children:v.candidate.name}),e.jsxs("p",{children:["One hop finds nothing. Two hops reach the ",v.recall.classification," recall ",v.recall.id,"."]})]})]})]})]}),e.jsxs("footer",{className:"film-foot",children:[e.jsx("p",{children:"Public FDA data: openFDA 510(k), recall and enforcement records and 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."}),e.jsx(B,{size:18})]})]})}export{se as default,re as useMedia}; +import{r as h,m as M,j as e,W as q,f as N,p as L,R as T,M as B,_ as O}from"./index-DCKpjP6o.js";import{u as re}from"./index-DCKpjP6o.js";const K="Every claim the opening film makes. tests/test_story_facts.py checks each value against the shipped Relate store.",W={k:"K252078",name:"BreathePal Bilevel",applicant:"Compal Electronics, Inc.",decision_date:"2026-03-17",summary_url:"https://www.accessdata.fda.gov/cdrh_docs/pdf25/K252078.pdf",verdict:"REVIEW_LINEAGE"},V={src:"K252078",dst:"K113053",page:6,quote:"substantially equivalent to the legally marketed predicate device, BiPAP A30 Ventilatory support system (K113053)."},z={k:"K113053",name:"BiPAP A30 Ventilatory Support System",applicant:"Respironics, Inc.",decision_date:"2012-02-01"},Z={holder:"K113053",event:"88071",ids:["Z-1957-2021","Z-1958-2021"],classification:"Class I",root_cause:"Device Design",initiated:"2021-06-14",reason:"The polyester-based polyurethane (PE-PUR) foam may degrade into particles"},H=[{k:"K092818",name:"BiPAP AVAPS",decision_date:"2010-01-22"},{k:"K082660",name:"V60 Ventilator",decision_date:"2009-01-09"},{k:"K103167",name:"Stellar 150",decision_date:"2011-03-01"}],g={_note:K,candidate:W,citation:V,predicate:z,recall:Z,grand_predicates:H},Y={k:"K251770",name:"SleepRes PAP System"},G={id:"Z-1974-2021",classification:"Class I"},v={candidate:Y,recall:G},_=(()=>{let s=0;const a=new Set;return{set(t){t!==s&&(s=t,a.forEach(n=>n()))},get:()=>s,subscribe(t){return a.add(t),()=>a.delete(t)}}})(),$=()=>h.useSyncExternalStore(_.subscribe,_.get);function P(){const s=h.useRef(null);return h.useEffect(()=>{const a=s.current;if(!a||typeof IntersectionObserver>"u"){a==null||a.classList.add("in-frame");return}const t=new IntersectionObserver(([n])=>a.classList.toggle("in-frame",n.isIntersecting),{rootMargin:"-12% 0px -12% 0px"});return t.observe(a),()=>t.disconnect()},[]),s}function I(){const s=innerHeight;return[...document.querySelectorAll("[data-scene]")].map(a=>{const t=a.getBoundingClientRect(),n=t.top+scrollY,c=innerWidth<=860,l=a.dataset.align==="top"?0:c&&a.classList.contains("chapter-copy")?n-s*.55:n+t.height/2-s*.5;return[Math.max(0,l),Number(a.dataset.scene)]}).sort((a,t)=>a[1]-t[1]).map((a,t,n)=>t&&a[0]<=n[t-1][0]?[n[t-1][0]+1,a[1]]:a)}function U(){try{return!!document.createElement("canvas").getContext("2d")}catch{return!1}}function D(){const s=innerWidth,a=innerHeight,t=48,n=Math.max(24,s*.03),c={},l=document.querySelector(".hero-copy");if(l){const r=l.getBoundingClientRect();c[0]=[Math.min(s*.62,r.right+t),a*.18,s-n-40,a*.82]}document.querySelectorAll(".chapter-copy[data-scene]").forEach(r=>{const m=r.getBoundingClientRect(),i=Number(r.dataset.scene),d=m.left+m.width/2{if(s||!U()){document.documentElement.dataset.film="off";return}let d=!1;const x=matchMedia("(max-width: 860px), (pointer: coarse)").matches,u=/[?&]gl=1\b/.test(location.search);return O(async()=>{const{createFilm:j}=await import("./renderer-DE7JEwcd.js");return{createFilm:j}},[]).then(({createFilm:j})=>{var b;if(!(d||!l.current))try{r.current=j(l.current,{glCanvas:o.current,facts:g,deviceCount:((b=t==null?void 0:t.nodes)==null?void 0:b.Device)||1187,compact:x,forceGL:u,onScene:n,onRenderer:p=>{i(p),c&&c(p)}}),r.current.setAnchors(I()),r.current.setZones(D()),r.current.snap(),delete document.documentElement.dataset.film,i(r.current.kind),c&&c(r.current.kind)}catch{document.documentElement.dataset.film="off"}}).catch(()=>{document.documentElement.dataset.film="off"}),()=>{var j;d=!0,(j=r.current)==null||j.dispose(),r.current=null}},[s]),h.useEffect(()=>{var b;if(!m)return;const d=()=>{var p,k;(p=r.current)==null||p.setAnchors(I()),(k=r.current)==null||k.setZones(D())},x=new ResizeObserver(()=>{var p;(p=r.current)==null||p.resize(),d()});x.observe(document.body),(b=document.fonts)==null||b.ready.then(d);const u=p=>{var k;return(k=r.current)==null?void 0:k.setPointer(p.clientX,p.clientY,!0)},j=()=>{var p;return(p=r.current)==null?void 0:p.setPointer(-9999,-9999,!1)};return addEventListener("pointermove",u,{passive:!0}),document.addEventListener("pointerleave",j),()=>{x.disconnect(),removeEventListener("pointermove",u),document.removeEventListener("pointerleave",j)}},[!!m]),h.useEffect(()=>{var d;m&&a==="bloom"&&((d=r.current)==null||d.bloom())},[!!m,a]),e.jsxs("div",{className:"film-stage","aria-hidden":"true",children:[e.jsx("div",{className:"film-fallback",children:e.jsxs("svg",{viewBox:"0 0 560 320",children:[e.jsx("path",{d:"M520 60 C 380 60, 380 160, 240 160",stroke:"#7fa2ff",strokeWidth:"1.6",fill:"none"}),e.jsx("path",{d:"M240 160 C 160 160, 160 80, 80 80 M240 160 C 160 160, 160 250, 70 250",stroke:"#7fa2ff",strokeOpacity:".4",fill:"none"}),e.jsx("path",{d:"M240 160 L 420 160",stroke:"#e7a948",strokeDasharray:"2 4"}),e.jsx("path",{d:"M420 152 l8 8 -8 8 -8 -8z",fill:"#e7a948"}),e.jsx("circle",{cx:"520",cy:"60",r:"9",fill:"#f1ebdd",stroke:"#7fa2ff",strokeWidth:"3"}),e.jsx("circle",{cx:"240",cy:"160",r:"7",fill:"#e7a948"}),e.jsx("circle",{cx:"80",cy:"80",r:"6",fill:"#e7a948"}),e.jsx("circle",{cx:"70",cy:"250",r:"6",fill:"#9aa7c2"})]})}),e.jsx("canvas",{ref:o,className:"film-gl"+(m==="webgl"?" is-live":"")}),e.jsx("div",{className:"film-grid"}),e.jsx("canvas",{ref:l,className:"film-story"+(m?" is-live":""),"data-testid":"film-canvas","data-renderer":m||"fallback"}),e.jsx("div",{className:"film-vignette"})]})}const F=[{n:"00",name:"The field",read:s=>`${s.k} · one point among the store's clearances`},{n:"01",name:"The filing",read:(s,a)=>`${s.k} · 510(k) summary · page ${a.page}`},{n:"02",name:"The connection",read:(s,a,t)=>`${s.k} → ${t.k} · ${s.decision_date.slice(0,4)} → ${t.decision_date.slice(0,4)}`},{n:"03",name:"The discovery",read:(s,a,t,n)=>`${t.k} · ${n.classification} · ${n.root_cause} · ${n.initiated}`},{n:"04",name:"The handoff",read:()=>"generation columns · same layout as the workspace"}];function J(){const s=$(),[a,t]=h.useState(!1);h.useEffect(()=>{const c=document.querySelector(".paths");if(!c||typeof IntersectionObserver>"u")return;const l=new IntersectionObserver(([o])=>t(o.isIntersecting||o.boundingClientRect.top<0));return l.observe(c),()=>l.disconnect()},[]);const n=F[s]||F[0];return e.jsxs("div",{className:"film-hud"+(a?" is-away":""),"aria-hidden":"true",children:[e.jsxs("span",{className:"hud-n",children:["[",n.n," / 04]"]}),e.jsx("span",{className:"hud-name",children:n.name}),e.jsx("span",{className:"hud-read",children:n.read(g.candidate,g.citation,g.predicate,g.recall)})]})}function w({v:s}){const[a,t]=h.useState(0);return h.useEffect(()=>{if(s==null)return;if(matchMedia("(prefers-reduced-motion: reduce)").matches){t(s);return}let n,c;const l=o=>{c??(c=o);const r=Math.min(1,(o-c)/1100);t(Math.round(s*(1-Math.pow(1-r,3)))),r<1&&(n=requestAnimationFrame(l))};return n=requestAnimationFrame(l),()=>cancelAnimationFrame(n)},[s]),s==null?null:e.jsx("b",{children:a.toLocaleString("en-US")})}function Q({reduced:s}){const a=$();return e.jsx("nav",{className:"film-index","aria-label":"Film chapters",children:ee.map(([t,n],c)=>e.jsxs("a",{href:`#${t}`,className:a===c?"on":"","aria-current":a===c?"step":void 0,onClick:l=>{var o;l.preventDefault(),(o=document.getElementById(t==="top"?"top":`${t}-copy`))==null||o.scrollIntoView({block:"center",behavior:s?"auto":"smooth"})},children:[e.jsx("span",{children:n}),e.jsx("i",{})]},t))})}const A=({children:s})=>e.jsx("span",{className:"ln",children:e.jsx("span",{children:s})});function E({id:s,scene:a,mark:t,label:n,place:c,statement:l,children:o,foot:r}){const m=P();return e.jsx("article",{id:s,className:`chapter place-${c}`,"aria-labelledby":`${s}-title`,children:e.jsxs("div",{ref:m,className:"chapter-copy reveal","data-scene":a,id:`${s}-copy`,children:[e.jsxs("p",{className:"chapter-label",children:[e.jsxs("span",{children:[t," / 03"]}),n]}),e.jsx("h2",{className:"chapter-statement",id:`${s}-title`,children:l.map((i,d)=>e.jsxs(A,{children:[i," "]},d))}),o,r&&e.jsx("p",{className:"chapter-foot",children:r})]})})}const ee=[["top","Opening"],["the-filing","The filing"],["the-connection","The connection"],["the-discovery","The discovery"],["handoff","Investigate"]];function se({go:s,stats:a,introDone:t,reduced:n}){var S,R,C;const[c,l]=h.useState(!1),[o,r]=h.useState(null),m=P();h.useEffect(()=>{const f=()=>l(scrollY>40);return f(),addEventListener("scroll",f,{passive:!0}),()=>removeEventListener("scroll",f)},[]);const i=g.candidate,d=g.predicate,x=g.recall,u=g.citation,j=M(x.initiated,i.decision_date),b=Math.floor(j/12),p=j%12,k=u.quote.split(u.dst);return e.jsxs("div",{className:"film",id:"top",children:[e.jsx(X,{reduced:n,introDone:t,stats:a,onScene:_.set,onKind:r}),o&&e.jsx(J,{}),e.jsxs("header",{className:"film-top"+(c?" is-solid":""),children:[e.jsx("a",{href:"#/","aria-label":"Forebear, start of film",onClick:f=>{f.preventDefault(),scrollTo({top:0})},children:e.jsx(q,{size:26})}),e.jsx("span",{className:"spacer"}),e.jsxs("nav",{"aria-label":"Product",children:[e.jsx("a",{href:"#/check",children:"Investigate"}),e.jsx("a",{href:"#/reach/88058,88071",children:"Recall reach"}),e.jsx("a",{href:"#/watch",children:"Watchlist"}),e.jsx("a",{href:"#/method",children:"Method"})]}),e.jsxs("a",{className:"btn btn-primary btn-sm",href:"#/check","data-testid":"open-workspace",children:["Open workspace ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]})]}),e.jsx(Q,{reduced:n}),e.jsxs("main",{id:"main",children:[e.jsx("section",{className:"hero","data-scene":"0","data-align":"top","aria-labelledby":"hero-title",children:e.jsxs("div",{className:"hero-copy",children:[e.jsx("p",{className:"eyebrow",children:"510(k) predicate due diligence"}),e.jsxs("h1",{id:"hero-title",tabIndex:-1,style:{outline:"none"},children:["Every clearance has ",e.jsx("em",{children:"a past."})]}),e.jsxs("p",{className:"hero-lede",children:["Forebear reads the predicates out of FDA 510(k) summaries, stores the family tree in a ",e.jsx("b",{children:"Relate graph"})," joined to FDA recall records, and shows in one query whether a predicate, or any of its ancestors, was recalled for a design problem, as far back as their summaries can be read: ",e.jsx("b",{children:"with the page and quote behind every link."})]}),e.jsxs("div",{className:"hero-actions",children:[e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"hero-investigate",onClick:f=>{f.preventDefault(),s("check",i.k,{transition:!0})},children:["Investigate ",i.k," ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsxs("a",{className:"btn btn-line",href:"#the-filing-copy",onClick:f=>{var y;f.preventDefault(),(y=document.getElementById("the-filing-copy"))==null||y.scrollIntoView({block:"center",behavior:n?"auto":"smooth"})},children:["Follow one thread ",e.jsx("span",{"aria-hidden":"true",children:"↓"})]})]}),e.jsxs("a",{className:"hero-alt",href:`#/check/${v.candidate.k}`,"data-testid":"hero-two-hop",onClick:f=>{f.preventDefault(),s("check",v.candidate.k,{transition:!0})},children:[e.jsx("span",{className:"hero-alt-tag",children:"Two hops deep"}),e.jsxs("span",{children:[e.jsx("span",{className:"k",children:v.candidate.k}),": at depth 1, no design-recall signal. At depth 2, a ",v.recall.classification," design recall (",v.recall.id,") on its predicate's predicates. ",e.jsx("b",{children:"See both depths →"})]})]}),a&&e.jsxs("div",{className:"hero-proof","aria-label":"What is in the shipped graph",children:[e.jsxs("div",{children:[e.jsx(w,{v:(S=a.nodes)==null?void 0:S.Device}),e.jsx("span",{children:"clearances in the graph"})]}),e.jsxs("div",{children:[e.jsx(w,{v:(R=a.citations_by_kind)==null?void 0:R.predicate}),e.jsx("span",{children:"predicate links, each with a page"})]}),e.jsxs("div",{children:[e.jsx(w,{v:(C=a.nodes)==null?void 0:C.Recall}),e.jsx("span",{children:"FDA recall records joined"})]})]})]})}),e.jsxs(E,{id:"the-filing",scene:1,mark:"01",label:"The filing",place:"left",statement:["One document","tells one step."],foot:"A 510(k) summary names its predicate. It does not tell you what became of it.",children:[e.jsxs("p",{className:"chapter-body",children:[i.name," (",e.jsx("span",{className:"k",children:i.k}),") was cleared on ",N(i.decision_date),". Its 510(k) summary names a single predicate, on page ",u.page,":"]}),e.jsxs("figure",{className:"doc","aria-label":`Quote from page ${u.page} of the ${i.k} summary`,children:[e.jsxs("div",{className:"doc-meta",children:[e.jsxs("span",{children:[i.k," · 510(k) summary"]}),e.jsxs("span",{children:["page ",u.page]})]}),e.jsxs("blockquote",{style:{margin:0},children:["“…",k[0],e.jsx("mark",{children:u.dst}),k[1],"”"]}),e.jsx("div",{style:{marginTop:10},children:e.jsxs("a",{href:L(i.summary_url,u.page),target:"_blank",rel:"noreferrer",children:["Open the FDA PDF at page ",u.page," ↗"]})})]})]}),e.jsx(E,{id:"the-connection",scene:2,mark:"02",label:"The connection",place:"right",statement:["Follow the thread","back in time."],foot:"Each thread is an edge in the graph, stored with its page, quote and source PDF.",children:e.jsxs("p",{className:"chapter-body",children:[e.jsx("span",{className:"k",children:i.k})," → ",e.jsx("span",{className:"k",children:d.k}),": the ",e.jsx("b",{children:d.name}),", cleared to ",d.applicant," on ",N(d.decision_date),". And ",d.k," cites predicates of its own: ",g.grand_predicates.map((f,y)=>e.jsxs(T.Fragment,{children:[y?y===g.grand_predicates.length-1?" and ":", ":"",e.jsx("span",{className:"k",children:f.k})]},f.k)),". FDA's databases answer one hop at a time. Relate walks them all in one variable-length query."]})}),e.jsxs(E,{id:"the-discovery",scene:3,mark:"03",label:"The discovery",place:"left",statement:["FDA recalls name",e.jsx("em",{children:"the predicate."},"e")],foot:"A recall on a predicate is not a finding about the new device. It is a question the predicate rationale should answer.",children:[e.jsxs("p",{className:"chapter-body",children:["On ",N(x.initiated)," a ",e.jsx("b",{children:x.classification})," recall of the BiPAP A30 began, root cause ",e.jsx("b",{children:x.root_cause}),": “",x.reason,"…” (event ",x.event,", records ",x.ids.join(" and "),")."]}),e.jsxs("div",{className:"fact-row",children:[e.jsxs("div",{className:"fact amber",children:[e.jsxs("b",{children:[b," yr ",p," mo"]}),e.jsxs("span",{children:["between recall start and ",i.k,"'s clearance"]})]}),e.jsxs("div",{className:"fact",children:[e.jsx("b",{children:"Review lineage"}),e.jsxs("span",{children:["deterministic verdict for ",i.k]})]})]}),e.jsx("p",{className:"chapter-body",style:{fontSize:14},children:"FDA's 2023 draft guidance recommends predicates not subject to design-related recalls."})]}),e.jsx("section",{id:"handoff",className:"handoff","aria-labelledby":"handoff-title",children:e.jsxs("div",{ref:m,className:"reveal","data-scene":"4",id:"handoff-copy",children:[e.jsxs("p",{className:"lead",id:"handoff-title",children:[e.jsx(A,{children:"Every fact above is real evidence."}),e.jsx(A,{children:e.jsx("em",{children:"Now work with it."})})]}),e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"handoff-investigate",onClick:f=>{f.preventDefault(),s("check",i.k,{transition:!0})},children:["Open the investigation ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsx("p",{className:"sub",children:"Every node, date and quote above is read from the shipped Relate store; the background field is illustrative."})]})}),e.jsxs("section",{className:"paths","aria-labelledby":"paths-title",children:[e.jsx("h2",{id:"paths-title",children:"Or start somewhere else"}),e.jsxs("div",{className:"path-grid",children:[e.jsxs("a",{className:"path-card",href:"#/reach/88058,88071",children:[e.jsx("span",{className:"k",children:"Recall 88058 + 88071"}),e.jsx("h3",{children:"Recall reach"}),e.jsx("p",{children:"From the June 2021 Philips foam recall: which later clearances descend from it?"})]}),e.jsxs("a",{className:"path-card",href:"#/watch",children:[e.jsx("span",{className:"k",children:"Watchlist"}),e.jsx("h3",{children:"Cited after a recall"}),e.jsx("p",{children:"Clearances whose predicate was already under a design-related recall."})]}),e.jsxs("a",{className:"path-card",href:"#/compare/K200480 K113053 K233643 K143677",children:[e.jsx("span",{className:"k",children:"Compare"}),e.jsx("h3",{children:"Choose a predicate"}),e.jsx("p",{children:"Candidate predicates side by side, with their own and inherited recalls."})]}),e.jsxs("a",{className:"path-card",href:`#/check/${v.candidate.k}`,children:[e.jsxs("span",{className:"k",children:[v.candidate.k," · two hops"]}),e.jsx("h3",{children:v.candidate.name}),e.jsxs("p",{children:["One hop finds nothing. Two hops reach the ",v.recall.classification," recall ",v.recall.id,"."]})]})]})]})]}),e.jsxs("footer",{className:"film-foot",children:[e.jsx("p",{children:"Public FDA data: openFDA 510(k), recall and enforcement records and 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."}),e.jsx(B,{size:18})]})]})}export{se as default,re as useMedia}; diff --git a/web/dist/assets/Views-Cl1sIo7q.js b/web/dist/assets/Views-BJljN5JI.js similarity index 99% rename from web/dist/assets/Views-Cl1sIo7q.js rename to web/dist/assets/Views-BJljN5JI.js index 047c100..02dcaab 100644 --- a/web/dist/assets/Views-Cl1sIo7q.js +++ b/web/dist/assets/Views-BJljN5JI.js @@ -1 +1 @@ -import{r as h,j as e,v as E,f as g,E as F,a as R,A as k,b as _,P as D,c as C,T as A}from"./index-Ch_7cPZN.js";const y=({eyebrow:l,title:c,children:t})=>e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:l}),e.jsx("h1",{children:c}),t&&e.jsx("p",{children:t})]}),S=l=>c=>{c.key==="Enter"&&l()};function $({initial:l,go:c}){const[t,o]=h.useState(l||"K200480 K113053 K233643 K143677"),[d,m]=h.useState(null),[p,n]=h.useState(null),[x,u]=h.useState(!1),a=(s=t)=>{const i=[...new Set(s.toUpperCase().match(/K\d{6}/g)||[])].slice(0,8);if(!i.length){n("Enter one or more K-numbers");return}n(null),u(!0),C.compare(i).then(m).catch(j=>n(j.message)).finally(()=>u(!1))};return h.useEffect(()=>{a(l||t)},[l]),e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Investigate",title:"Compare candidate predicates",children:"FDA's draft guidance suggests documenting how each candidate predicate meets the selection best practices. This table covers the recall practice: each candidate's own recalls and those in its ancestry, computed live from the graph."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:s=>{s.preventDefault(),a()},children:[e.jsx("input",{className:"field",value:t,onChange:s=>o(s.target.value),"aria-label":"K-numbers to compare (up to 8)"}),e.jsx("button",{className:"btn btn-primary",disabled:x,children:x?"Comparing…":"Compare"})]}),p&&e.jsx("p",{className:"err",children:p})]}),d&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Candidate"}),e.jsx("th",{children:"Cleared"}),e.jsx("th",{children:"Verdict"}),e.jsxs("th",{children:["Evidence",e.jsx("br",{}),"(verdict window)"]}),e.jsxs("th",{children:["Own recalls",e.jsx("br",{}),"(design)"]}),e.jsxs("th",{children:["Flagged ancestors",e.jsx("br",{}),"gen 1–2"]}),e.jsxs("th",{children:["Ancestors",e.jsx("br",{}),"(unread)"]}),e.jsx("th",{children:"Top signal"})]})}),e.jsx("tbody",{children:d.map(s=>{if(!s.found)return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("span",{className:"k mono",children:s.k})}),e.jsxs("td",{colSpan:7,className:"sub",children:["Not in the graph. ",e.jsx("a",{href:`#/ingest/${s.k}`,children:"Read it from FDA →"})]})]},s.k);const i=E(s.verdict,s.evidence);return e.jsxs("tr",{className:"click",tabIndex:0,"data-k":s.k,"data-evidence":s.evidence,onClick:()=>c("check",s.k),onKeyDown:S(()=>c("check",s.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k}),e.jsx("div",{className:"sub",children:s.name}),e.jsx("div",{className:"sub",children:s.applicant})]}),e.jsx("td",{className:"num",children:g(s.decision_date)}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${i.tone}`,"data-testid":"compare-verdict",children:i.label}),s.conditional&&e.jsx("div",{children:e.jsx("span",{className:"chip tone-violet",children:"conditional"})}),e.jsx("div",{className:"sub",style:{maxWidth:320},"data-testid":"compare-reason",children:s.verdict_reason})]}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${F[s.evidence]||"muted"}`,"data-testid":"compare-evidence",children:s.evidence}),(s.evidence_reasons||[]).map(j=>e.jsx("div",{className:"sub",children:R[j]||j},j))]}),e.jsxs("td",{className:"num",children:[s.own_recalls," ",e.jsxs("span",{className:"sub",children:["(",s.own_design_recalls,")"]})]}),e.jsx("td",{className:"num",children:s.flagged_ancestors_gen12}),e.jsxs("td",{className:"num",children:[s.ancestors," ",e.jsxs("span",{className:"sub",children:["(",s.lineage_unknown,")"]})]}),e.jsx("td",{className:"sub",style:{maxWidth:360},children:s.top_signal||"—"})]},s.k)})})]})}),e.jsx("p",{className:"graph-hint",children:"Verdicts are deterministic documentation signals; a lower count is not a statement that a device is safer. A verdict on partial or uncertain evidence is provisional: equal verdicts on unequal evidence are not equivalent."})]})]})}function K({initial:l,go:c}){const[t,o]=h.useState(l||"88058,88071"),[d,m]=h.useState(null),[p,n]=h.useState(null),x=(i=t)=>{n(null),m(null),C.recallEvent(i.replace(/\s/g,"")).then(m).catch(j=>n(j.message))};h.useEffect(()=>{o(l||"88058,88071"),x(l||"88058,88071")},[l]);const u=(d==null?void 0:d.descendants)||[],a=(d==null?void 0:d.counts)||{},s=[["after-supported","Cleared after the recall began · supported route",u.filter(i=>i.timing==="after"&&i.evidence==="supported"),'"After it began", not after it was resolved. A descendant is not recalled because of its ancestor.',!0],["after-conditional","Cleared after the recall began · conditional route only",u.filter(i=>i.timing==="after"&&i.evidence==="conditional"),"Every route to the recalled clearance runs through a citation the audit could not resolve.",!1],["same-day","Cleared the day the recall began",u.filter(i=>i.timing==="same_day"),"Same calendar day: the dates cannot order them, so these count as neither before nor after.",!1],["unknown","Timing unknown",u.filter(i=>i.timing==="unknown"),"A clearance date or recall start is missing.",!1],["before","Cleared before the recall began",u.filter(i=>i.timing==="before"),null,!0]];return e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Recall evidence",title:"Recall reach",children:"Start from an FDA recall event. Forebear finds every clearance FDA lists on it, then every later clearance that cites one of them, up to three generations, and compares each clearance date with the recall start on its own supported route."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:i=>{i.preventDefault(),x()},children:[e.jsx("input",{className:"field",value:t,onChange:i=>o(i.target.value),"aria-label":"Recall event numbers, comma-separated"}),e.jsx("button",{className:"btn btn-primary",children:"Trace"})]}),e.jsxs("p",{className:"muted small",style:{marginBottom:0},children:["Examples: ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("88058,88071"),x("88058,88071")},children:"88058,88071"})," Philips PE-PUR foam recall, June 2021 (openFDA files it as two events) ·"," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("86646"),x("86646")},children:"86646"})," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("84406"),x("84406")},children:"84406"})]}),p&&e.jsx("p",{className:"err",children:p})]}),!d&&!p&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Tracing descendants in Relate…"]}),d&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"panel","data-testid":"reach-stats",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:d.recalled.length}),e.jsxs("span",{children:["clearances FDA lists on recall event(s) ",d.event]})]}),e.jsxs("div",{children:[e.jsx("b",{children:u.length}),e.jsx("span",{children:"later clearances descend from them"})]}),e.jsxs("div",{className:"amber","data-testid":"reach-count-after",children:[e.jsx("b",{children:a.after_supported??0}),e.jsxs("span",{children:["cleared after the recall on a supported route began",d.initiated?` (earliest ${g(d.initiated)})`:""]})]}),e.jsxs("div",{className:"violet","data-testid":"reach-count-conditional",children:[e.jsx("b",{children:a.conditional??0}),e.jsxs("span",{children:["reached only through an unresolved citation (conditional)",a.after_conditional?`, ${a.after_conditional} of them cleared after`:""]})]}),(a.same_day>0||a.unknown>0)&&e.jsxs("div",{"data-testid":"reach-count-undetermined",children:[e.jsx("b",{children:(a.same_day||0)+(a.unknown||0)}),e.jsxs("span",{children:["timing not determinable (",a.same_day||0," same day, ",a.unknown||0," missing a date)"]})]})]}),e.jsx("div",{className:"tags",style:{marginTop:14},children:d.recalled.map(i=>e.jsxs("button",{className:"tag-btn",onClick:()=>c("check",i.k),"data-testid":"reach-holder",title:k[_(i)].text+(i.linked_before_clearance?" "+D.text:""),children:[e.jsx("span",{className:"k",children:i.k})," ",i.name," ",e.jsxs("span",{className:"muted",children:["· ",k[_(i)].short,i.linked_before_clearance?` · ${D.short.toLowerCase()}`:""]})]},i.k))}),e.jsx("p",{className:"muted small",style:{marginBottom:0},children:"FDA lists these clearances on the recall record. That is an association, not verified model identity: a name match is a fuzzy heuristic on the recall text, and a recall that began before a clearance does not by itself show whether that model was affected."})]}),e.jsx("section",{className:"panel",children:s.filter(([,,i,,j])=>j||i.length).map(([i,j,v,b],w)=>e.jsxs("div",{"data-testid":`reach-${i}`,children:[e.jsxs("div",{className:"panel-head",style:w?{marginTop:22}:void 0,children:[e.jsxs("h2",{children:[j," ",e.jsx("span",{className:"count",children:v.length})]}),b&&e.jsx("p",{className:"hint",children:b})]}),e.jsx(T,{rows:v,go:c})]},i))})]})]})}function T({rows:l,go:c}){return l.length?e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Applicant"}),e.jsx("th",{children:"Cleared"}),e.jsxs("th",{children:["Recall began",e.jsx("br",{}),"on its route"]}),e.jsx("th",{children:"Distance"}),e.jsx("th",{children:"Descends from"})]})}),e.jsx("tbody",{children:l.map(t=>{var p;const o=t.evidence==="conditional",d=!o&&((p=t.conditional_via)==null?void 0:p.length)>0,m=t.supported_gen??t.gen;return e.jsxs("tr",{className:"click"+(o?" is-conditional":""),tabIndex:0,"data-k":t.k,"data-timing":t.timing,"data-evidence":t.evidence,onClick:()=>c("check",t.k),onKeyDown:S(()=>c("check",t.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:t.k})," ",o&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),d&&e.jsx("span",{className:"chip tone-muted",title:"Some routes are supported, others rest on an unresolved citation",children:"mixed routes"}),e.jsx("div",{className:"sub",children:t.name})]}),e.jsx("td",{className:"sub",children:t.applicant}),e.jsx("td",{className:"num",children:g(t.decision_date)}),e.jsxs("td",{className:"num",children:[g(t.recall_started),e.jsx("div",{className:"sub",children:A[t.timing]}),d&&t.conditional_timing&&t.conditional_timing!==t.timing&&e.jsxs("div",{className:"sub",style:{color:"var(--violet)"},children:["Conditional route only: recall began ",g(t.conditional_recall_started),", ",A[t.conditional_timing]]})]}),e.jsx("td",{children:m===1?"direct predicate":`${m} generations`}),e.jsx("td",{className:"sub",children:t.via.map(n=>{var x,u;return e.jsxs("span",{style:(x=t.conditional_via)!=null&&x.includes(n)?{color:"var(--violet)"}:void 0,title:(u=t.conditional_via)!=null&&u.includes(n)?"Reached only through an unresolved citation":"Reached through a supported citation",children:[n," "]},n)})})]},t.k)})})]})}):e.jsx("p",{className:"muted",children:"None."})}function P({go:l}){const[c,t]=h.useState(null),[o,d]=h.useState(null),[m,p]=h.useState("all");h.useEffect(()=>{C.watchlist().then(t).catch(a=>d(a.message))},[]);const n=(c==null?void 0:c.rows)||[],x=n.filter(a=>m==="all"||m==="direct"&&a.supported_min_gen===1||m==="supported"&&!a.conditional||m==="conditional"&&a.conditional),u=(c==null?void 0:c.conditional)??n.filter(a=>a.conditional).length;return e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Recall evidence",title:"Watchlist: cleared after a predicate recall began",children:"Clearances whose FDA decision date falls after a design-related recall had started on their predicate or grand-predicate. Only the clearance date is compared: it does not show when the predicate was chosen or cited, and the application's receipt date does not establish that either. Same-day dates are not counted as after. Close to, but not the same as, the JAMA study's measure (Class I predicate recalls, any cause). A question to ask, not a finding: the recall may have been fixed, or limited to lots or software versions."}),o&&e.jsx("p",{className:"err",children:o}),!c&&!o&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Querying the graph…"]}),c&&e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:c.count}),e.jsx("span",{children:"clearances decided after a recall began on their lineage"})]}),e.jsxs("div",{className:"amber",children:[e.jsx("b",{children:c.direct_supported??c.direct}),e.jsx("span",{children:"cite a directly recalled predicate through a supported citation"})]}),e.jsxs("div",{className:"violet",children:[e.jsx("b",{children:u}),e.jsx("span",{children:"conditional: every route runs through an unresolved citation"})]})]}),e.jsx("div",{className:"seg",role:"group","aria-label":"Filter",style:{marginTop:14},children:[["all","All"],["direct","Direct predicate"],["supported","Supported routes"],["conditional","Conditional only"]].map(([a,s])=>e.jsx("button",{"aria-pressed":m===a,onClick:()=>p(a),children:s},a))})]}),c&&e.jsx("section",{className:"panel",children:e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Cleared device"}),e.jsx("th",{children:"Cleared · recall began"}),e.jsx("th",{children:"Recalled ancestor"}),e.jsx("th",{children:"Recall records"})]})}),e.jsx("tbody",{children:x.map(a=>e.jsxs("tr",{className:"click"+(a.conditional?" is-conditional":""),tabIndex:0,"data-k":a.k,onClick:()=>l("check",a.k),onKeyDown:S(()=>l("check",a.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:a.k})," ",a.conditional&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),e.jsx("div",{className:"sub",children:a.name}),e.jsx("div",{className:"sub",children:a.applicant})]}),e.jsxs("td",{className:"num","data-testid":"watch-dates",children:["Cleared ",g(a.decision_date),e.jsxs("div",{className:"sub",children:["recall began ",g(a.recall_basis),a.days_after_recall!=null?`, ${a.days_after_recall} days earlier`:""]})]}),e.jsxs("td",{children:[e.jsx("span",{className:"mono",children:(a.conditional?a.ancestors:a.supported_ancestors||a.ancestors).join(", ")}),e.jsx("div",{className:"sub",children:a.conditional?"cited device · citation unresolved":a.supported_min_gen===1?"direct predicate":"grand-predicate"})]}),e.jsxs("td",{className:"sub",children:[a.recall_count>2&&e.jsxs("div",{className:"muted",children:[a.recall_count," recall routes; first two:"]}),a.recalls.slice(0,2).map(s=>e.jsxs("div",{children:[s.recall_id," · ",s.classification||"unclassified"," · ",s.root_cause," · ",g(s.initiated),s.conditional&&e.jsx("span",{style:{color:"var(--violet)"},children:" · conditional"}),e.jsxs("div",{className:"muted",title:k[_(s)].text+(s.linked_before_clearance?" "+D.text:""),"data-testid":"watch-attribution",children:[s.ancestor,": ",k[_(s)].short,s.linked_before_clearance?` · ${D.short.toLowerCase()}`:""]})]},s.recall_id+s.ancestor))]})]},a.k))})]})})})]})}function V({initial:l,go:c,onChanged:t}){var b,w;const[o,d]=h.useState(l||""),[m,p]=h.useState(!1),[n,x]=h.useState(null),[u,a]=h.useState(null),[s,i]=h.useState(!1);h.useEffect(()=>{l&&d(l)},[l]);const j=async()=>{p(!0),a(null),x(null);try{const r=await C.ingest(o,s);x(r),t&&t()}catch(r){a(r.message)}finally{p(!1)}},v=(r,f)=>Object.keys({...r,...f}).map(N=>[N,(f[N]||0)-(r[N]||0)]).filter(([,N])=>N);return e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Graph",title:"Add a clearance",children:"Enter any 510(k) number. Forebear fetches its openFDA record and summary PDF live, extracts the predicates it cites, validates them against openFDA, links recalls, and MERGEs everything into the Relate store. Use it on an ancestor whose summary was not read to extend a lineage by one generation. Needs internet."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:r=>{r.preventDefault(),j()},children:[e.jsx("input",{className:"field",value:o,placeholder:"K-number, e.g. K241135",onChange:r=>d(r.target.value),"aria-label":"K-number to read from FDA"}),e.jsx("button",{className:"btn btn-primary",disabled:m||!o,children:m?"Reading from FDA…":"Read and add"})]}),e.jsxs("label",{className:"muted small",style:{display:"block",marginTop:8},children:[e.jsx("input",{type:"checkbox",checked:s,onChange:r=>i(r.target.checked),"data-testid":"ingest-refresh"})," ","Re-download the summary PDF from FDA to detect a changed document (otherwise the cached text is reused). Reviews made on an earlier version then need re-review."]}),m&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Downloading the summary PDF and extracting citations…"]}),u&&e.jsx("p",{className:"err",role:"alert",children:u})]}),n&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:[n.k,": ",n.was_present?n.lineage_was_known?"re-read":"lineage extended":"added to the graph"]})}),e.jsxs("p",{children:["Summary: ",e.jsx("b",{children:n.summary_status}),n.summary_url&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:n.summary_url,target:"_blank",rel:"noreferrer",children:"PDF ↗"})]})]}),n.refresh&&e.jsx("p",{className:"muted small","data-testid":"ingest-refresh-result",children:n.refresh.changed?`FDA's PDF changed (sha256 ${String(n.refresh.previous_sha256||"none").slice(0,12)} → ${String(n.summary_sha256).slice(0,12)}); citations were reconciled against the new text.`:"FDA's PDF is unchanged since it was cached."}),e.jsxs("p",{className:"muted",children:["Graph change: ",v(n.graph_before,n.graph_after).concat(v(n.rels_before,n.rels_after)).map(([r,f])=>`${f>0?"+":""}${f} ${r}`).join(" · ")||"no new nodes or relationships (already up to date)"]}),e.jsx("h3",{style:{fontSize:13},children:"Citations read from the summary"}),n.citations_added.length===0?e.jsxs("p",{className:"muted",children:["None found",n.summary_status!=="ok"?" (summary not machine-readable)":"","."]}):n.citations_added.map(r=>e.jsxs("div",{className:"cit",children:[e.jsxs("div",{className:"cit-h",children:[e.jsx("span",{className:"k mono",children:r.dst})," ",e.jsx("span",{className:"chip",children:r.kind})," ",e.jsxs("span",{className:"muted",children:["p.",r.page]})]}),e.jsxs("blockquote",{className:"quote",children:["“",r.snippet,"”"]})]},r.dst)),((w=(b=n.reconciliation)==null?void 0:b.retired)==null?void 0:w.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:13},children:"Citations no longer in the refreshed summary"}),e.jsxs("p",{className:"muted small","data-testid":"ingest-retired",children:["Retired from the lineage, kept with their reviews and provenance:"," ",n.reconciliation.retired.map(r=>`${r.dst}${r.review?` (${r.review} by ${r.reviewer||"unknown"})`:""}`).join(", "),"."]})]}),n.reconciliation&&!n.reconciliation.ran&&e.jsxs("p",{className:"muted small",children:[n.reconciliation.skipped_reason,"."]}),e.jsxs("p",{className:"muted small",children:[n.recalls_linked.length," recall record(s) linked."]}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>c("check",n.k),children:["Investigate ",n.k," ",e.jsx("span",{className:"arr",children:"→"})]})]})]})}function L({stats:l}){return e.jsxs("div",{className:"method",children:[e.jsx(y,{eyebrow:"Method",title:"How Forebear decides, and what it does not",children:"Verdicts come from a small set of deterministic rules over Relate queries. They are documentation signals inside a stated scope, never safety findings."}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"What the verdict means"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-alert",children:"Design-related recall on file"})," the candidate has a design-related recall of its own."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-amber",children:"Review lineage"})," a direct or grand-predicate has a design-related recall (Class I/II or not yet classified), the direct predicate has a Class I recall, or the candidate has a Class I recall."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-muted",children:"Lineage not checkable"})," the candidate's own predicates could not be read, or every direct predicate link rests on uncertain evidence, so nothing was checked."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-calm",children:"No design-recall signal"})," none of the above in the readable ancestry. Lower-severity signals are still listed. Not a safety finding."]})]}),e.jsx("p",{className:"muted small",children:'"Design-related" means an openFDA root cause containing "design" but not "process". This is coarse. Lineage is limited to summaries that are online and machine-readable; gaps are reported, never filled in.'})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How a thread is classified"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsxs("span",{className:"status status-confirmed",children:[e.jsx("span",{className:"line"}),"Confirmed"]})," a person confirmed the citation. Confirmations sent through the MCP client do not count."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-extracted",children:[e.jsx("span",{className:"line"}),"Machine-extracted"]})," read from the summary text, validated against openFDA, not yet reviewed."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-disputed",children:[e.jsx("span",{className:"line"}),"Disputed"]})," the cited device's FDA name is absent near the citation, it is in a different FDA panel, its K-number was corrected by the audit, or only an LLM labelled it a predicate."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-conditional",children:[e.jsx("span",{className:"line"}),"Conditional"]})," the extraction audit could not resolve the citation. Recalls reached only through it are marked conditional in assessments, the watchlist and recall reach."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-rejected",children:[e.jsx("span",{className:"line"}),"Rejected"]})," a reviewer removed it; it no longer counts in any lineage query."]})]})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"The optional agent"})}),e.jsx("p",{className:"lede",style:{margin:0},children:"An NVIDIA-hosted model can investigate a device by calling the same graph tools. Phase 3 evaluation found it unsuitable as the primary due-diligence workflow, so its findings appear only as history: never human-approved, never a verdict input, and unable to change lineage."})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How it uses Relate"})}),e.jsxs("ol",{children:[e.jsxs("li",{children:[e.jsx("b",{children:"Ingest."})," openFDA 510(k), recall and enforcement records, and the text of each 510(k) summary PDF, with page-level evidence."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Store."})," One single-file store, ",e.jsx("code",{children:"data/forebear.rl"}),": ",e.jsx("code",{children:"(:Device)-[:CITES]->(:Device)"}),", ",e.jsx("code",{children:"(:Device)-[:SUBJECT_OF]->(:Recall)"}),", saved ",e.jsx("code",{children:"(:Assessment)"})," nodes."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Query."})," Variable-length Cypher walks the family tree both ways, joins recalls on every ancestor, compares dates."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Update."})," Ingest, review a citation, save an assessment: each is a graph write the next query reads."]})]}),l&&e.jsxs("p",{className:"muted small",children:["Live: ",l.nodes.Device.toLocaleString("en-US")," devices, ",l.relationships.CITES.toLocaleString("en-US")," citation edges, ",l.nodes.Recall.toLocaleString("en-US")," recall records."]})]})]})}export{$ as CompareView,V as IngestView,L as MethodView,K as ReachView,P as WatchlistView}; +import{r as h,j as e,v as E,f as g,E as F,a as R,A as k,b as _,P as D,c as C,T as A}from"./index-DCKpjP6o.js";const y=({eyebrow:l,title:c,children:t})=>e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:l}),e.jsx("h1",{children:c}),t&&e.jsx("p",{children:t})]}),S=l=>c=>{c.key==="Enter"&&l()};function $({initial:l,go:c}){const[t,o]=h.useState(l||"K200480 K113053 K233643 K143677"),[d,m]=h.useState(null),[p,n]=h.useState(null),[x,u]=h.useState(!1),a=(s=t)=>{const i=[...new Set(s.toUpperCase().match(/K\d{6}/g)||[])].slice(0,8);if(!i.length){n("Enter one or more K-numbers");return}n(null),u(!0),C.compare(i).then(m).catch(j=>n(j.message)).finally(()=>u(!1))};return h.useEffect(()=>{a(l||t)},[l]),e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Investigate",title:"Compare candidate predicates",children:"FDA's draft guidance suggests documenting how each candidate predicate meets the selection best practices. This table covers the recall practice: each candidate's own recalls and those in its ancestry, computed live from the graph."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:s=>{s.preventDefault(),a()},children:[e.jsx("input",{className:"field",value:t,onChange:s=>o(s.target.value),"aria-label":"K-numbers to compare (up to 8)"}),e.jsx("button",{className:"btn btn-primary",disabled:x,children:x?"Comparing…":"Compare"})]}),p&&e.jsx("p",{className:"err",children:p})]}),d&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Candidate"}),e.jsx("th",{children:"Cleared"}),e.jsx("th",{children:"Verdict"}),e.jsxs("th",{children:["Evidence",e.jsx("br",{}),"(verdict window)"]}),e.jsxs("th",{children:["Own recalls",e.jsx("br",{}),"(design)"]}),e.jsxs("th",{children:["Flagged ancestors",e.jsx("br",{}),"gen 1–2"]}),e.jsxs("th",{children:["Ancestors",e.jsx("br",{}),"(unread)"]}),e.jsx("th",{children:"Top signal"})]})}),e.jsx("tbody",{children:d.map(s=>{if(!s.found)return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("span",{className:"k mono",children:s.k})}),e.jsxs("td",{colSpan:7,className:"sub",children:["Not in the graph. ",e.jsx("a",{href:`#/ingest/${s.k}`,children:"Read it from FDA →"})]})]},s.k);const i=E(s.verdict,s.evidence);return e.jsxs("tr",{className:"click",tabIndex:0,"data-k":s.k,"data-evidence":s.evidence,onClick:()=>c("check",s.k),onKeyDown:S(()=>c("check",s.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k}),e.jsx("div",{className:"sub",children:s.name}),e.jsx("div",{className:"sub",children:s.applicant})]}),e.jsx("td",{className:"num",children:g(s.decision_date)}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${i.tone}`,"data-testid":"compare-verdict",children:i.label}),s.conditional&&e.jsx("div",{children:e.jsx("span",{className:"chip tone-violet",children:"conditional"})}),e.jsx("div",{className:"sub",style:{maxWidth:320},"data-testid":"compare-reason",children:s.verdict_reason})]}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${F[s.evidence]||"muted"}`,"data-testid":"compare-evidence",children:s.evidence}),(s.evidence_reasons||[]).map(j=>e.jsx("div",{className:"sub",children:R[j]||j},j))]}),e.jsxs("td",{className:"num",children:[s.own_recalls," ",e.jsxs("span",{className:"sub",children:["(",s.own_design_recalls,")"]})]}),e.jsx("td",{className:"num",children:s.flagged_ancestors_gen12}),e.jsxs("td",{className:"num",children:[s.ancestors," ",e.jsxs("span",{className:"sub",children:["(",s.lineage_unknown,")"]})]}),e.jsx("td",{className:"sub",style:{maxWidth:360},children:s.top_signal||"—"})]},s.k)})})]})}),e.jsx("p",{className:"graph-hint",children:"Verdicts are deterministic documentation signals; a lower count is not a statement that a device is safer. A verdict on partial or uncertain evidence is provisional: equal verdicts on unequal evidence are not equivalent."})]})]})}function K({initial:l,go:c}){const[t,o]=h.useState(l||"88058,88071"),[d,m]=h.useState(null),[p,n]=h.useState(null),x=(i=t)=>{n(null),m(null),C.recallEvent(i.replace(/\s/g,"")).then(m).catch(j=>n(j.message))};h.useEffect(()=>{o(l||"88058,88071"),x(l||"88058,88071")},[l]);const u=(d==null?void 0:d.descendants)||[],a=(d==null?void 0:d.counts)||{},s=[["after-supported","Cleared after the recall began · supported route",u.filter(i=>i.timing==="after"&&i.evidence==="supported"),'"After it began", not after it was resolved. A descendant is not recalled because of its ancestor.',!0],["after-conditional","Cleared after the recall began · conditional route only",u.filter(i=>i.timing==="after"&&i.evidence==="conditional"),"Every route to the recalled clearance runs through a citation the audit could not resolve.",!1],["same-day","Cleared the day the recall began",u.filter(i=>i.timing==="same_day"),"Same calendar day: the dates cannot order them, so these count as neither before nor after.",!1],["unknown","Timing unknown",u.filter(i=>i.timing==="unknown"),"A clearance date or recall start is missing.",!1],["before","Cleared before the recall began",u.filter(i=>i.timing==="before"),null,!0]];return e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Recall evidence",title:"Recall reach",children:"Start from an FDA recall event. Forebear finds every clearance FDA lists on it, then every later clearance that cites one of them, up to three generations, and compares each clearance date with the recall start on its own supported route."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:i=>{i.preventDefault(),x()},children:[e.jsx("input",{className:"field",value:t,onChange:i=>o(i.target.value),"aria-label":"Recall event numbers, comma-separated"}),e.jsx("button",{className:"btn btn-primary",children:"Trace"})]}),e.jsxs("p",{className:"muted small",style:{marginBottom:0},children:["Examples: ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("88058,88071"),x("88058,88071")},children:"88058,88071"})," Philips PE-PUR foam recall, June 2021 (openFDA files it as two events) ·"," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("86646"),x("86646")},children:"86646"})," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("84406"),x("84406")},children:"84406"})]}),p&&e.jsx("p",{className:"err",children:p})]}),!d&&!p&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Tracing descendants in Relate…"]}),d&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"panel","data-testid":"reach-stats",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:d.recalled.length}),e.jsxs("span",{children:["clearances FDA lists on recall event(s) ",d.event]})]}),e.jsxs("div",{children:[e.jsx("b",{children:u.length}),e.jsx("span",{children:"later clearances descend from them"})]}),e.jsxs("div",{className:"amber","data-testid":"reach-count-after",children:[e.jsx("b",{children:a.after_supported??0}),e.jsxs("span",{children:["cleared after the recall on a supported route began",d.initiated?` (earliest ${g(d.initiated)})`:""]})]}),e.jsxs("div",{className:"violet","data-testid":"reach-count-conditional",children:[e.jsx("b",{children:a.conditional??0}),e.jsxs("span",{children:["reached only through an unresolved citation (conditional)",a.after_conditional?`, ${a.after_conditional} of them cleared after`:""]})]}),(a.same_day>0||a.unknown>0)&&e.jsxs("div",{"data-testid":"reach-count-undetermined",children:[e.jsx("b",{children:(a.same_day||0)+(a.unknown||0)}),e.jsxs("span",{children:["timing not determinable (",a.same_day||0," same day, ",a.unknown||0," missing a date)"]})]})]}),e.jsx("div",{className:"tags",style:{marginTop:14},children:d.recalled.map(i=>e.jsxs("button",{className:"tag-btn",onClick:()=>c("check",i.k),"data-testid":"reach-holder",title:k[_(i)].text+(i.linked_before_clearance?" "+D.text:""),children:[e.jsx("span",{className:"k",children:i.k})," ",i.name," ",e.jsxs("span",{className:"muted",children:["· ",k[_(i)].short,i.linked_before_clearance?` · ${D.short.toLowerCase()}`:""]})]},i.k))}),e.jsx("p",{className:"muted small",style:{marginBottom:0},children:"FDA lists these clearances on the recall record. That is an association, not verified model identity: a name match is a fuzzy heuristic on the recall text, and a recall that began before a clearance does not by itself show whether that model was affected."})]}),e.jsx("section",{className:"panel",children:s.filter(([,,i,,j])=>j||i.length).map(([i,j,v,b],w)=>e.jsxs("div",{"data-testid":`reach-${i}`,children:[e.jsxs("div",{className:"panel-head",style:w?{marginTop:22}:void 0,children:[e.jsxs("h2",{children:[j," ",e.jsx("span",{className:"count",children:v.length})]}),b&&e.jsx("p",{className:"hint",children:b})]}),e.jsx(T,{rows:v,go:c})]},i))})]})]})}function T({rows:l,go:c}){return l.length?e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Applicant"}),e.jsx("th",{children:"Cleared"}),e.jsxs("th",{children:["Recall began",e.jsx("br",{}),"on its route"]}),e.jsx("th",{children:"Distance"}),e.jsx("th",{children:"Descends from"})]})}),e.jsx("tbody",{children:l.map(t=>{var p;const o=t.evidence==="conditional",d=!o&&((p=t.conditional_via)==null?void 0:p.length)>0,m=t.supported_gen??t.gen;return e.jsxs("tr",{className:"click"+(o?" is-conditional":""),tabIndex:0,"data-k":t.k,"data-timing":t.timing,"data-evidence":t.evidence,onClick:()=>c("check",t.k),onKeyDown:S(()=>c("check",t.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:t.k})," ",o&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),d&&e.jsx("span",{className:"chip tone-muted",title:"Some routes are supported, others rest on an unresolved citation",children:"mixed routes"}),e.jsx("div",{className:"sub",children:t.name})]}),e.jsx("td",{className:"sub",children:t.applicant}),e.jsx("td",{className:"num",children:g(t.decision_date)}),e.jsxs("td",{className:"num",children:[g(t.recall_started),e.jsx("div",{className:"sub",children:A[t.timing]}),d&&t.conditional_timing&&t.conditional_timing!==t.timing&&e.jsxs("div",{className:"sub",style:{color:"var(--violet)"},children:["Conditional route only: recall began ",g(t.conditional_recall_started),", ",A[t.conditional_timing]]})]}),e.jsx("td",{children:m===1?"direct predicate":`${m} generations`}),e.jsx("td",{className:"sub",children:t.via.map(n=>{var x,u;return e.jsxs("span",{style:(x=t.conditional_via)!=null&&x.includes(n)?{color:"var(--violet)"}:void 0,title:(u=t.conditional_via)!=null&&u.includes(n)?"Reached only through an unresolved citation":"Reached through a supported citation",children:[n," "]},n)})})]},t.k)})})]})}):e.jsx("p",{className:"muted",children:"None."})}function P({go:l}){const[c,t]=h.useState(null),[o,d]=h.useState(null),[m,p]=h.useState("all");h.useEffect(()=>{C.watchlist().then(t).catch(a=>d(a.message))},[]);const n=(c==null?void 0:c.rows)||[],x=n.filter(a=>m==="all"||m==="direct"&&a.supported_min_gen===1||m==="supported"&&!a.conditional||m==="conditional"&&a.conditional),u=(c==null?void 0:c.conditional)??n.filter(a=>a.conditional).length;return e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Recall evidence",title:"Watchlist: cleared after a predicate recall began",children:"Clearances whose FDA decision date falls after a design-related recall had started on their predicate or grand-predicate. Only the clearance date is compared: it does not show when the predicate was chosen or cited, and the application's receipt date does not establish that either. Same-day dates are not counted as after. Close to, but not the same as, the JAMA study's measure (Class I predicate recalls, any cause). A question to ask, not a finding: the recall may have been fixed, or limited to lots or software versions."}),o&&e.jsx("p",{className:"err",children:o}),!c&&!o&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Querying the graph…"]}),c&&e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:c.count}),e.jsx("span",{children:"clearances decided after a recall began on their lineage"})]}),e.jsxs("div",{className:"amber",children:[e.jsx("b",{children:c.direct_supported??c.direct}),e.jsx("span",{children:"cite a directly recalled predicate through a supported citation"})]}),e.jsxs("div",{className:"violet",children:[e.jsx("b",{children:u}),e.jsx("span",{children:"conditional: every route runs through an unresolved citation"})]})]}),e.jsx("div",{className:"seg",role:"group","aria-label":"Filter",style:{marginTop:14},children:[["all","All"],["direct","Direct predicate"],["supported","Supported routes"],["conditional","Conditional only"]].map(([a,s])=>e.jsx("button",{"aria-pressed":m===a,onClick:()=>p(a),children:s},a))})]}),c&&e.jsx("section",{className:"panel",children:e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Cleared device"}),e.jsx("th",{children:"Cleared · recall began"}),e.jsx("th",{children:"Recalled ancestor"}),e.jsx("th",{children:"Recall records"})]})}),e.jsx("tbody",{children:x.map(a=>e.jsxs("tr",{className:"click"+(a.conditional?" is-conditional":""),tabIndex:0,"data-k":a.k,onClick:()=>l("check",a.k),onKeyDown:S(()=>l("check",a.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:a.k})," ",a.conditional&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),e.jsx("div",{className:"sub",children:a.name}),e.jsx("div",{className:"sub",children:a.applicant})]}),e.jsxs("td",{className:"num","data-testid":"watch-dates",children:["Cleared ",g(a.decision_date),e.jsxs("div",{className:"sub",children:["recall began ",g(a.recall_basis),a.days_after_recall!=null?`, ${a.days_after_recall} days earlier`:""]})]}),e.jsxs("td",{children:[e.jsx("span",{className:"mono",children:(a.conditional?a.ancestors:a.supported_ancestors||a.ancestors).join(", ")}),e.jsx("div",{className:"sub",children:a.conditional?"cited device · citation unresolved":a.supported_min_gen===1?"direct predicate":"grand-predicate"})]}),e.jsxs("td",{className:"sub",children:[a.recall_count>2&&e.jsxs("div",{className:"muted",children:[a.recall_count," recall routes; first two:"]}),a.recalls.slice(0,2).map(s=>e.jsxs("div",{children:[s.recall_id," · ",s.classification||"unclassified"," · ",s.root_cause," · ",g(s.initiated),s.conditional&&e.jsx("span",{style:{color:"var(--violet)"},children:" · conditional"}),e.jsxs("div",{className:"muted",title:k[_(s)].text+(s.linked_before_clearance?" "+D.text:""),"data-testid":"watch-attribution",children:[s.ancestor,": ",k[_(s)].short,s.linked_before_clearance?` · ${D.short.toLowerCase()}`:""]})]},s.recall_id+s.ancestor))]})]},a.k))})]})})})]})}function V({initial:l,go:c,onChanged:t}){var b,w;const[o,d]=h.useState(l||""),[m,p]=h.useState(!1),[n,x]=h.useState(null),[u,a]=h.useState(null),[s,i]=h.useState(!1);h.useEffect(()=>{l&&d(l)},[l]);const j=async()=>{p(!0),a(null),x(null);try{const r=await C.ingest(o,s);x(r),t&&t()}catch(r){a(r.message)}finally{p(!1)}},v=(r,f)=>Object.keys({...r,...f}).map(N=>[N,(f[N]||0)-(r[N]||0)]).filter(([,N])=>N);return e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Graph",title:"Add a clearance",children:"Enter any 510(k) number. Forebear fetches its openFDA record and summary PDF live, extracts the predicates it cites, validates them against openFDA, links recalls, and MERGEs everything into the Relate store. Use it on an ancestor whose summary was not read to extend a lineage by one generation. Needs internet."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:r=>{r.preventDefault(),j()},children:[e.jsx("input",{className:"field",value:o,placeholder:"K-number, e.g. K241135",onChange:r=>d(r.target.value),"aria-label":"K-number to read from FDA"}),e.jsx("button",{className:"btn btn-primary",disabled:m||!o,children:m?"Reading from FDA…":"Read and add"})]}),e.jsxs("label",{className:"muted small",style:{display:"block",marginTop:8},children:[e.jsx("input",{type:"checkbox",checked:s,onChange:r=>i(r.target.checked),"data-testid":"ingest-refresh"})," ","Re-download the summary PDF from FDA to detect a changed document (otherwise the cached text is reused). Reviews made on an earlier version then need re-review."]}),m&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Downloading the summary PDF and extracting citations…"]}),u&&e.jsx("p",{className:"err",role:"alert",children:u})]}),n&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:[n.k,": ",n.was_present?n.lineage_was_known?"re-read":"lineage extended":"added to the graph"]})}),e.jsxs("p",{children:["Summary: ",e.jsx("b",{children:n.summary_status}),n.summary_url&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:n.summary_url,target:"_blank",rel:"noreferrer",children:"PDF ↗"})]})]}),n.refresh&&e.jsx("p",{className:"muted small","data-testid":"ingest-refresh-result",children:n.refresh.changed?`FDA's PDF changed (sha256 ${String(n.refresh.previous_sha256||"none").slice(0,12)} → ${String(n.summary_sha256).slice(0,12)}); citations were reconciled against the new text.`:"FDA's PDF is unchanged since it was cached."}),e.jsxs("p",{className:"muted",children:["Graph change: ",v(n.graph_before,n.graph_after).concat(v(n.rels_before,n.rels_after)).map(([r,f])=>`${f>0?"+":""}${f} ${r}`).join(" · ")||"no new nodes or relationships (already up to date)"]}),e.jsx("h3",{style:{fontSize:13},children:"Citations read from the summary"}),n.citations_added.length===0?e.jsxs("p",{className:"muted",children:["None found",n.summary_status!=="ok"?" (summary not machine-readable)":"","."]}):n.citations_added.map(r=>e.jsxs("div",{className:"cit",children:[e.jsxs("div",{className:"cit-h",children:[e.jsx("span",{className:"k mono",children:r.dst})," ",e.jsx("span",{className:"chip",children:r.kind})," ",e.jsxs("span",{className:"muted",children:["p.",r.page]})]}),e.jsxs("blockquote",{className:"quote",children:["“",r.snippet,"”"]})]},r.dst)),((w=(b=n.reconciliation)==null?void 0:b.retired)==null?void 0:w.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:13},children:"Citations no longer in the refreshed summary"}),e.jsxs("p",{className:"muted small","data-testid":"ingest-retired",children:["Retired from the lineage, kept with their reviews and provenance:"," ",n.reconciliation.retired.map(r=>`${r.dst}${r.review?` (${r.review} by ${r.reviewer||"unknown"})`:""}`).join(", "),"."]})]}),n.reconciliation&&!n.reconciliation.ran&&e.jsxs("p",{className:"muted small",children:[n.reconciliation.skipped_reason,"."]}),e.jsxs("p",{className:"muted small",children:[n.recalls_linked.length," recall record(s) linked."]}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>c("check",n.k),children:["Investigate ",n.k," ",e.jsx("span",{className:"arr",children:"→"})]})]})]})}function L({stats:l}){return e.jsxs("div",{className:"method",children:[e.jsx(y,{eyebrow:"Method",title:"How Forebear decides, and what it does not",children:"Verdicts come from a small set of deterministic rules over Relate queries. They are documentation signals inside a stated scope, never safety findings."}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"What the verdict means"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-alert",children:"Design-related recall on file"})," the candidate has a design-related recall of its own."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-amber",children:"Review lineage"})," a direct or grand-predicate has a design-related recall (Class I/II or not yet classified), the direct predicate has a Class I recall, or the candidate has a Class I recall."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-muted",children:"Lineage not checkable"})," the candidate's own predicates could not be read, or every direct predicate link rests on uncertain evidence, so nothing was checked."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-calm",children:"No design-recall signal"})," none of the above in the readable ancestry. Lower-severity signals are still listed. Not a safety finding."]})]}),e.jsx("p",{className:"muted small",children:'"Design-related" means an openFDA root cause containing "design" but not "process". This is coarse. Lineage is limited to summaries that are online and machine-readable; gaps are reported, never filled in.'})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How a thread is classified"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsxs("span",{className:"status status-confirmed",children:[e.jsx("span",{className:"line"}),"Confirmed"]})," a person confirmed the citation. Confirmations sent through the MCP client do not count."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-extracted",children:[e.jsx("span",{className:"line"}),"Machine-extracted"]})," read from the summary text, validated against openFDA, not yet reviewed."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-disputed",children:[e.jsx("span",{className:"line"}),"Disputed"]})," the cited device's FDA name is absent near the citation, it is in a different FDA panel, its K-number was corrected by the audit, or only an LLM labelled it a predicate."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-conditional",children:[e.jsx("span",{className:"line"}),"Conditional"]})," the extraction audit could not resolve the citation. Recalls reached only through it are marked conditional in assessments, the watchlist and recall reach."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-rejected",children:[e.jsx("span",{className:"line"}),"Rejected"]})," a reviewer removed it; it no longer counts in any lineage query."]})]})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"The optional agent"})}),e.jsx("p",{className:"lede",style:{margin:0},children:"An NVIDIA-hosted model can investigate a device by calling the same graph tools. Phase 3 evaluation found it unsuitable as the primary due-diligence workflow, so its findings appear only as history: never human-approved, never a verdict input, and unable to change lineage."})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How it uses Relate"})}),e.jsxs("ol",{children:[e.jsxs("li",{children:[e.jsx("b",{children:"Ingest."})," openFDA 510(k), recall and enforcement records, and the text of each 510(k) summary PDF, with page-level evidence."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Store."})," One single-file store, ",e.jsx("code",{children:"data/forebear.rl"}),": ",e.jsx("code",{children:"(:Device)-[:CITES]->(:Device)"}),", ",e.jsx("code",{children:"(:Device)-[:SUBJECT_OF]->(:Recall)"}),", saved ",e.jsx("code",{children:"(:Assessment)"})," nodes."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Query."})," Variable-length Cypher walks the family tree both ways, joins recalls on every ancestor, compares dates."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Update."})," Ingest, review a citation, save an assessment: each is a graph write the next query reads."]})]}),l&&e.jsxs("p",{className:"muted small",children:["Live: ",l.nodes.Device.toLocaleString("en-US")," devices, ",l.relationships.CITES.toLocaleString("en-US")," citation edges, ",l.nodes.Recall.toLocaleString("en-US")," recall records."]})]})]})}export{$ as CompareView,V as IngestView,L as MethodView,K as ReachView,P as WatchlistView}; diff --git a/web/dist/assets/index-Ch_7cPZN.js b/web/dist/assets/index-DCKpjP6o.js similarity index 61% rename from web/dist/assets/index-Ch_7cPZN.js rename to web/dist/assets/index-DCKpjP6o.js index 3193dc7..d941222 100644 --- a/web/dist/assets/index-Ch_7cPZN.js +++ b/web/dist/assets/index-DCKpjP6o.js @@ -1,4 +1,4 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(l){if(l.ep)return;l.ep=!0;const s=n(l);fetch(l.href,s)}})();function td(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lo={exports:{}},Sl={},Ro={exports:{}},z={};/** +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(l){if(l.ep)return;l.ep=!0;const s=n(l);fetch(l.href,s)}})();function td(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lo={exports:{}},_l={},Ro={exports:{}},z={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var dr=Symbol.for("react.element"),nd=Symbol.for("react.portal"),rd=Symbol.for("react.fragment"),ld=Symbol.for("react.strict_mode"),sd=Symbol.for("react.profiler"),id=Symbol.for("react.provider"),ad=Symbol.for("react.context"),od=Symbol.for("react.forward_ref"),ud=Symbol.for("react.suspense"),cd=Symbol.for("react.memo"),dd=Symbol.for("react.lazy"),da=Symbol.iterator;function fd(e){return e===null||typeof e!="object"?null:(e=da&&e[da]||e["@@iterator"],typeof e=="function"?e:null)}var Do={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$o=Object.assign,zo={};function jn(e,t,n){this.props=e,this.context=t,this.refs=zo,this.updater=n||Do}jn.prototype.isReactComponent={};jn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};jn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Fo(){}Fo.prototype=jn.prototype;function fi(e,t,n){this.props=e,this.context=t,this.refs=zo,this.updater=n||Do}var pi=fi.prototype=new Fo;pi.constructor=fi;$o(pi,jn.prototype);pi.isPureReactComponent=!0;var fa=Array.isArray,Mo=Object.prototype.hasOwnProperty,hi={current:null},Io={key:!0,ref:!0,__self:!0,__source:!0};function Ao(e,t,n){var r,l={},s=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(s=""+t.key),t)Mo.call(t,r)&&!Io.hasOwnProperty(r)&&(l[r]=t[r]);var o=arguments.length-2;if(o===1)l.children=n;else if(1>>1,ee=T[X];if(0>>1;Xl(Vl,$))Rtl(gr,Vl)?(T[X]=gr,T[Rt]=$,X=Rt):(T[X]=Vl,T[Lt]=$,X=Lt);else if(Rtl(gr,$))T[X]=gr,T[Rt]=$,X=Rt;else break e}}return D}function l(T,D){var $=T.sortIndex-D.sortIndex;return $!==0?$:T.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],p=1,h=null,f=3,v=!1,y=!1,x=!1,C=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(T){for(var D=n(c);D!==null;){if(D.callback===null)r(c);else if(D.startTime<=T)r(c),D.sortIndex=D.expirationTime,t(u,D);else break;D=n(c)}}function w(T){if(x=!1,m(T),!y)if(n(u)!==null)y=!0,Ze(_);else{var D=n(c);D!==null&&F(w,D.startTime-T)}}function _(T,D){y=!1,x&&(x=!1,g(k),k=-1),v=!0;var $=f;try{for(m(D),h=n(u);h!==null&&(!(h.expirationTime>D)||T&&!I());){var X=h.callback;if(typeof X=="function"){h.callback=null,f=h.priorityLevel;var ee=X(h.expirationTime<=D);D=e.unstable_now(),typeof ee=="function"?h.callback=ee:h===n(u)&&r(u),m(D)}else r(u);h=n(u)}if(h!==null)var vr=!0;else{var Lt=n(c);Lt!==null&&F(w,Lt.startTime-D),vr=!1}return vr}finally{h=null,f=$,v=!1}}var E=!1,j=null,k=-1,R=5,P=-1;function I(){return!(e.unstable_now()-PT||125X?(T.sortIndex=$,t(c,T),n(u)===null&&T===n(c)&&(x?(g(k),k=-1):x=!0,F(w,$-X))):(T.sortIndex=ee,t(u,T),y||v||(y=!0,Ze(_))),T},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(T){var D=f;return function(){var $=f;f=D;try{return T.apply(this,arguments)}finally{f=$}}}})(Bo);Wo.exports=Bo;var Nd=Wo.exports;/** + */(function(e){function t(T,D){var $=T.length;T.push(D);e:for(;0<$;){var X=$-1>>>1,ee=T[X];if(0>>1;Xl(Vl,$))Rtl(gr,Vl)?(T[X]=gr,T[Rt]=$,X=Rt):(T[X]=Vl,T[Lt]=$,X=Lt);else if(Rtl(gr,$))T[X]=gr,T[Rt]=$,X=Rt;else break e}}return D}function l(T,D){var $=T.sortIndex-D.sortIndex;return $!==0?$:T.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],p=1,h=null,f=3,v=!1,y=!1,x=!1,C=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(T){for(var D=n(c);D!==null;){if(D.callback===null)r(c);else if(D.startTime<=T)r(c),D.sortIndex=D.expirationTime,t(u,D);else break;D=n(c)}}function w(T){if(x=!1,m(T),!y)if(n(u)!==null)y=!0,Ze(S);else{var D=n(c);D!==null&&F(w,D.startTime-T)}}function S(T,D){y=!1,x&&(x=!1,g(k),k=-1),v=!0;var $=f;try{for(m(D),h=n(u);h!==null&&(!(h.expirationTime>D)||T&&!I());){var X=h.callback;if(typeof X=="function"){h.callback=null,f=h.priorityLevel;var ee=X(h.expirationTime<=D);D=e.unstable_now(),typeof ee=="function"?h.callback=ee:h===n(u)&&r(u),m(D)}else r(u);h=n(u)}if(h!==null)var vr=!0;else{var Lt=n(c);Lt!==null&&F(w,Lt.startTime-D),vr=!1}return vr}finally{h=null,f=$,v=!1}}var E=!1,j=null,k=-1,R=5,P=-1;function I(){return!(e.unstable_now()-PT||125X?(T.sortIndex=$,t(c,T),n(u)===null&&T===n(c)&&(x?(g(k),k=-1):x=!0,F(w,$-X))):(T.sortIndex=ee,t(u,T),y||v||(y=!0,Ze(S))),T},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(T){var D=f;return function(){var $=f;f=D;try{return T.apply(this,arguments)}finally{f=$}}}})(Bo);Wo.exports=Bo;var Nd=Wo.exports;/** * @license React * react-dom.production.min.js * @@ -30,15 +30,15 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Sd=S,Ee=Nd;function N(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gs=Object.prototype.hasOwnProperty,_d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ha={},ma={};function Ed(e){return gs.call(ma,e)?!0:gs.call(ha,e)?!1:_d.test(e)?ma[e]=!0:(ha[e]=!0,!1)}function Cd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Td(e,t,n,r){if(t===null||typeof t>"u"||Cd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function he(e,t,n,r,l,s,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=a}var se={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){se[e]=new he(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];se[t]=new he(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){se[e]=new he(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){se[e]=new he(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){se[e]=new he(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){se[e]=new he(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){se[e]=new he(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){se[e]=new he(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){se[e]=new he(e,5,!1,e.toLowerCase(),null,!1,!1)});var vi=/[\-:]([a-z])/g;function gi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(vi,gi);se[t]=new he(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vi,gi);se[t]=new he(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vi,gi);se[t]=new he(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){se[e]=new he(e,1,!1,e.toLowerCase(),null,!1,!1)});se.xlinkHref=new he("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){se[e]=new he(e,1,!1,e.toLowerCase(),null,!0,!0)});function yi(e,t,n,r){var l=se.hasOwnProperty(t)?se[t]:null;(l!==null?l.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gs=Object.prototype.hasOwnProperty,Sd=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ha={},ma={};function Ed(e){return gs.call(ma,e)?!0:gs.call(ha,e)?!1:Sd.test(e)?ma[e]=!0:(ha[e]=!0,!1)}function Cd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Td(e,t,n,r){if(t===null||typeof t>"u"||Cd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function he(e,t,n,r,l,s,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=a}var se={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){se[e]=new he(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];se[t]=new he(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){se[e]=new he(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){se[e]=new he(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){se[e]=new he(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){se[e]=new he(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){se[e]=new he(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){se[e]=new he(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){se[e]=new he(e,5,!1,e.toLowerCase(),null,!1,!1)});var vi=/[\-:]([a-z])/g;function gi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(vi,gi);se[t]=new he(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vi,gi);se[t]=new he(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vi,gi);se[t]=new he(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){se[e]=new he(e,1,!1,e.toLowerCase(),null,!1,!1)});se.xlinkHref=new he("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){se[e]=new he(e,1,!1,e.toLowerCase(),null,!0,!0)});function yi(e,t,n,r){var l=se.hasOwnProperty(t)?se[t]:null;(l!==null?l.type!==0:r||!(2o||l[a]!==s[o]){var u=` -`+l[a].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=a&&0<=o);break}}}finally{Hl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$n(e):""}function Pd(e){switch(e.tag){case 5:return $n(e.type);case 16:return $n("Lazy");case 13:return $n("Suspense");case 19:return $n("SuspenseList");case 0:case 2:case 15:return e=Ql(e.type,!1),e;case 11:return e=Ql(e.type.render,!1),e;case 1:return e=Ql(e.type,!0),e;default:return""}}function ws(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case qt:return"Fragment";case Xt:return"Portal";case ys:return"Profiler";case xi:return"StrictMode";case xs:return"Suspense";case ks:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ko:return(e.displayName||"Context")+".Consumer";case Qo:return(e._context.displayName||"Context")+".Provider";case ki:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case wi:return t=e.displayName||null,t!==null?t:ws(e.type)||"Memo";case ct:t=e._payload,e=e._init;try{return ws(e(t))}catch{}}return null}function Ld(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ws(t);case 8:return t===xi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function St(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Yo(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Rd(e){var t=Yo(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function kr(e){e._valueTracker||(e._valueTracker=Rd(e))}function Xo(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Yo(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Jr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function js(e,t){var n=t.checked;return Q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ga(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=St(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function qo(e,t){t=t.checked,t!=null&&yi(e,"checked",t,!1)}function Ns(e,t){qo(e,t);var n=St(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ss(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ss(e,t.type,St(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ya(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ss(e,t,n){(t!=="number"||Jr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function on(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=wr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var In={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Dd=["Webkit","ms","Moz","O"];Object.keys(In).forEach(function(e){Dd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),In[t]=In[e]})});function eu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||In.hasOwnProperty(e)&&In[e]?(""+t).trim():t+"px"}function tu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=eu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var $d=Q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Cs(e,t){if(t){if($d[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function Ts(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ps=null;function ji(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ls=null,un=null,cn=null;function wa(e){if(e=hr(e)){if(typeof Ls!="function")throw Error(N(280));var t=e.stateNode;t&&(t=Ll(t),Ls(e.stateNode,e.type,t))}}function nu(e){un?cn?cn.push(e):cn=[e]:un=e}function ru(){if(un){var e=un,t=cn;if(cn=un=null,wa(e),t)for(e=0;e>>=0,e===0?32:31-(Hd(e)/Qd|0)|0}var jr=64,Nr=4194304;function Fn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,s=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~l;o!==0?r=Fn(o):(s&=a,s!==0&&(r=Fn(s)))}else a=n&~l,a!==0?r=Fn(a):s!==0&&(r=Fn(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,s=t&-t,l>=s||l===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function fr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ue(t),e[t]=n}function Xd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=On),La=" ",Ra=!1;function Nu(e,t){switch(e){case"keyup":return Sf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Su(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zt=!1;function Ef(e,t){switch(e){case"compositionend":return Su(t);case"keypress":return t.which!==32?null:(Ra=!0,La);case"textInput":return e=t.data,e===La&&Ra?null:e;default:return null}}function Cf(e,t){if(Zt)return e==="compositionend"||!Li&&Nu(e,t)?(e=wu(),Br=Ci=ht=null,Zt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Fa(n)}}function Tu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pu(){for(var e=window,t=Jr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jr(e.document)}return t}function Ri(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Mf(e){var t=Pu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Tu(n.ownerDocument.documentElement,n)){if(r!==null&&Ri(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,s=Math.min(r.start,l);r=r.end===void 0?s:Math.min(r.end,l),!e.extend&&s>r&&(l=r,r=s,s=l),l=Ma(n,s);var a=Ma(n,r);l&&a&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Jt=null,Ms=null,Vn=null,Is=!1;function Ia(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Is||Jt==null||Jt!==Jr(r)||(r=Jt,"selectionStart"in r&&Ri(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vn&&er(Vn,r)||(Vn=r,r=sl(Ms,"onSelect"),0tn||(e.current=Bs[tn],Bs[tn]=null,tn--)}function O(e,t){tn++,Bs[tn]=e.current,e.current=t}var _t={},ce=Tt(_t),ye=Tt(!1),Vt=_t;function mn(e,t){var n=e.type.contextTypes;if(!n)return _t;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},s;for(s in n)l[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function xe(e){return e=e.childContextTypes,e!=null}function al(){V(ye),V(ce)}function Ha(e,t,n){if(ce.current!==_t)throw Error(N(168));O(ce,t),O(ye,n)}function Au(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(N(108,Ld(e)||"Unknown",l));return Q({},n,r)}function ol(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_t,Vt=ce.current,O(ce,e),O(ye,ye.current),!0}function Qa(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=Au(e,t,Vt),r.__reactInternalMemoizedMergedChildContext=e,V(ye),V(ce),O(ce,e)):V(ye),O(ye,n)}var be=null,Rl=!1,ss=!1;function Ou(e){be===null?be=[e]:be.push(e)}function Yf(e){Rl=!0,Ou(e)}function Pt(){if(!ss&&be!==null){ss=!0;var e=0,t=A;try{var n=be;for(A=1;e>=a,l-=a,et=1<<32-Ue(t)+l|n<k?(R=j,j=null):R=j.sibling;var P=f(g,j,m[k],w);if(P===null){j===null&&(j=R);break}e&&j&&P.alternate===null&&t(g,j),d=s(P,d,k),E===null?_=P:E.sibling=P,E=P,j=R}if(k===m.length)return n(g,j),W&&$t(g,k),_;if(j===null){for(;kk?(R=j,j=null):R=j.sibling;var I=f(g,j,P.value,w);if(I===null){j===null&&(j=R);break}e&&j&&I.alternate===null&&t(g,j),d=s(I,d,k),E===null?_=I:E.sibling=I,E=I,j=R}if(P.done)return n(g,j),W&&$t(g,k),_;if(j===null){for(;!P.done;k++,P=m.next())P=h(g,P.value,w),P!==null&&(d=s(P,d,k),E===null?_=P:E.sibling=P,E=P);return W&&$t(g,k),_}for(j=r(g,j);!P.done;k++,P=m.next())P=v(j,g,k,P.value,w),P!==null&&(e&&P.alternate!==null&&j.delete(P.key===null?k:P.key),d=s(P,d,k),E===null?_=P:E.sibling=P,E=P);return e&&j.forEach(function(K){return t(g,K)}),W&&$t(g,k),_}function C(g,d,m,w){if(typeof m=="object"&&m!==null&&m.type===qt&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case xr:e:{for(var _=m.key,E=d;E!==null;){if(E.key===_){if(_=m.type,_===qt){if(E.tag===7){n(g,E.sibling),d=l(E,m.props.children),d.return=g,g=d;break e}}else if(E.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===ct&&Ya(_)===E.type){n(g,E.sibling),d=l(E,m.props),d.ref=Ln(g,E,m),d.return=g,g=d;break e}n(g,E);break}else t(g,E);E=E.sibling}m.type===qt?(d=Ut(m.props.children,g.mode,w,m.key),d.return=g,g=d):(w=Zr(m.type,m.key,m.props,null,g.mode,w),w.ref=Ln(g,d,m),w.return=g,g=w)}return a(g);case Xt:e:{for(E=m.key;d!==null;){if(d.key===E)if(d.tag===4&&d.stateNode.containerInfo===m.containerInfo&&d.stateNode.implementation===m.implementation){n(g,d.sibling),d=l(d,m.children||[]),d.return=g,g=d;break e}else{n(g,d);break}else t(g,d);d=d.sibling}d=ps(m,g.mode,w),d.return=g,g=d}return a(g);case ct:return E=m._init,C(g,d,E(m._payload),w)}if(zn(m))return y(g,d,m,w);if(_n(m))return x(g,d,m,w);Lr(g,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,d!==null&&d.tag===6?(n(g,d.sibling),d=l(d,m),d.return=g,g=d):(n(g,d),d=fs(m,g.mode,w),d.return=g,g=d),a(g)):n(g,d)}return C}var gn=Bu(!0),Hu=Bu(!1),dl=Tt(null),fl=null,ln=null,Fi=null;function Mi(){Fi=ln=fl=null}function Ii(e){var t=dl.current;V(dl),e._currentValue=t}function Ks(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function fn(e,t){fl=e,Fi=ln=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ge=!0),e.firstContext=null)}function ze(e){var t=e._currentValue;if(Fi!==e)if(e={context:e,memoizedValue:t,next:null},ln===null){if(fl===null)throw Error(N(308));ln=e,fl.dependencies={lanes:0,firstContext:e}}else ln=ln.next=e;return t}var It=null;function Ai(e){It===null?It=[e]:It.push(e)}function Qu(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ai(t)):(n.next=l.next,l.next=n),t.interleaved=n,st(e,r)}function st(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var dt=!1;function Oi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ku(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function nt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function kt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,M&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,st(e,n)}return l=r.interleaved,l===null?(t.next=t,Ai(r)):(t.next=l.next,l.next=t),r.interleaved=t,st(e,n)}function Qr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Si(e,n)}}function Xa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?l=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?l=s=t:s=s.next=t}else l=s=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function pl(e,t,n,r){var l=e.updateQueue;dt=!1;var s=l.firstBaseUpdate,a=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?s=c:a.next=c,a=u;var p=e.alternate;p!==null&&(p=p.updateQueue,o=p.lastBaseUpdate,o!==a&&(o===null?p.firstBaseUpdate=c:o.next=c,p.lastBaseUpdate=u))}if(s!==null){var h=l.baseState;a=0,p=c=u=null,o=s;do{var f=o.lane,v=o.eventTime;if((r&f)===f){p!==null&&(p=p.next={eventTime:v,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var y=e,x=o;switch(f=t,v=n,x.tag){case 1:if(y=x.payload,typeof y=="function"){h=y.call(v,h,f);break e}h=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=x.payload,f=typeof y=="function"?y.call(v,h,f):y,f==null)break e;h=Q({},h,f);break e;case 2:dt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,f=l.effects,f===null?l.effects=[o]:f.push(o))}else v={eventTime:v,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},p===null?(c=p=v,u=h):p=p.next=v,a|=f;if(o=o.next,o===null){if(o=l.shared.pending,o===null)break;f=o,o=f.next,f.next=null,l.lastBaseUpdate=f,l.shared.pending=null}}while(!0);if(p===null&&(u=h),l.baseState=u,l.firstBaseUpdate=c,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else s===null&&(l.shared.lanes=0);Ht|=a,e.lanes=a,e.memoizedState=h}}function qa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=as.transition;as.transition={};try{e(!1),t()}finally{A=n,as.transition=r}}function uc(){return Fe().memoizedState}function Jf(e,t,n){var r=jt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},cc(e))dc(t,n);else if(n=Qu(e,t,n,r),n!==null){var l=fe();Ve(n,e,r,l),fc(n,t,r)}}function bf(e,t,n){var r=jt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(cc(e))dc(t,l);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,o=s(a,n);if(l.hasEagerState=!0,l.eagerState=o,We(o,a)){var u=t.interleaved;u===null?(l.next=l,Ai(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=Qu(e,t,l,r),n!==null&&(l=fe(),Ve(n,e,r,l),fc(n,t,r))}}function cc(e){var t=e.alternate;return e===H||t!==null&&t===H}function dc(e,t){Wn=ml=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Si(e,n)}}var vl={readContext:ze,useCallback:ie,useContext:ie,useEffect:ie,useImperativeHandle:ie,useInsertionEffect:ie,useLayoutEffect:ie,useMemo:ie,useReducer:ie,useRef:ie,useState:ie,useDebugValue:ie,useDeferredValue:ie,useTransition:ie,useMutableSource:ie,useSyncExternalStore:ie,useId:ie,unstable_isNewReconciler:!1},ep={readContext:ze,useCallback:function(e,t){return Qe().memoizedState=[e,t===void 0?null:t],e},useContext:ze,useEffect:Ja,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Gr(4194308,4,lc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Gr(4,2,e,t)},useMemo:function(e,t){var n=Qe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qe();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Jf.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Qe();return e={current:e},t.memoizedState=e},useState:Za,useDebugValue:Gi,useDeferredValue:function(e){return Qe().memoizedState=e},useTransition:function(){var e=Za(!1),t=e[0];return e=Zf.bind(null,e[1]),Qe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Qe();if(W){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),ne===null)throw Error(N(349));Bt&30||qu(r,t,n)}l.memoizedState=n;var s={value:n,getSnapshot:t};return l.queue=s,Ja(Ju.bind(null,r,s,e),[e]),r.flags|=2048,or(9,Zu.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Qe(),t=ne.identifierPrefix;if(W){var n=tt,r=et;n=(r&~(1<<32-Ue(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ir++,0")&&(u=u.replace("",e.displayName)),u}while(1<=a&&0<=o);break}}}finally{Hl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$n(e):""}function Pd(e){switch(e.tag){case 5:return $n(e.type);case 16:return $n("Lazy");case 13:return $n("Suspense");case 19:return $n("SuspenseList");case 0:case 2:case 15:return e=Ql(e.type,!1),e;case 11:return e=Ql(e.type.render,!1),e;case 1:return e=Ql(e.type,!0),e;default:return""}}function ws(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case qt:return"Fragment";case Xt:return"Portal";case ys:return"Profiler";case xi:return"StrictMode";case xs:return"Suspense";case ks:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ko:return(e.displayName||"Context")+".Consumer";case Qo:return(e._context.displayName||"Context")+".Provider";case ki:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case wi:return t=e.displayName||null,t!==null?t:ws(e.type)||"Memo";case ct:t=e._payload,e=e._init;try{return ws(e(t))}catch{}}return null}function Ld(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ws(t);case 8:return t===xi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function _t(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Yo(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Rd(e){var t=Yo(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function kr(e){e._valueTracker||(e._valueTracker=Rd(e))}function Xo(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Yo(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Jr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function js(e,t){var n=t.checked;return Q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ga(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=_t(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function qo(e,t){t=t.checked,t!=null&&yi(e,"checked",t,!1)}function Ns(e,t){qo(e,t);var n=_t(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?_s(e,t.type,n):t.hasOwnProperty("defaultValue")&&_s(e,t.type,_t(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ya(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function _s(e,t,n){(t!=="number"||Jr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function on(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=wr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var In={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Dd=["Webkit","ms","Moz","O"];Object.keys(In).forEach(function(e){Dd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),In[t]=In[e]})});function eu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||In.hasOwnProperty(e)&&In[e]?(""+t).trim():t+"px"}function tu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=eu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var $d=Q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Cs(e,t){if(t){if($d[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function Ts(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ps=null;function ji(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ls=null,un=null,cn=null;function wa(e){if(e=hr(e)){if(typeof Ls!="function")throw Error(N(280));var t=e.stateNode;t&&(t=Ll(t),Ls(e.stateNode,e.type,t))}}function nu(e){un?cn?cn.push(e):cn=[e]:un=e}function ru(){if(un){var e=un,t=cn;if(cn=un=null,wa(e),t)for(e=0;e>>=0,e===0?32:31-(Hd(e)/Qd|0)|0}var jr=64,Nr=4194304;function Fn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,s=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~l;o!==0?r=Fn(o):(s&=a,s!==0&&(r=Fn(s)))}else a=n&~l,a!==0?r=Fn(a):s!==0&&(r=Fn(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,s=t&-t,l>=s||l===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function fr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ue(t),e[t]=n}function Xd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=On),La=" ",Ra=!1;function Nu(e,t){switch(e){case"keyup":return _f.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _u(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zt=!1;function Ef(e,t){switch(e){case"compositionend":return _u(t);case"keypress":return t.which!==32?null:(Ra=!0,La);case"textInput":return e=t.data,e===La&&Ra?null:e;default:return null}}function Cf(e,t){if(Zt)return e==="compositionend"||!Li&&Nu(e,t)?(e=wu(),Br=Ci=ht=null,Zt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Fa(n)}}function Tu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pu(){for(var e=window,t=Jr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jr(e.document)}return t}function Ri(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Mf(e){var t=Pu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Tu(n.ownerDocument.documentElement,n)){if(r!==null&&Ri(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,s=Math.min(r.start,l);r=r.end===void 0?s:Math.min(r.end,l),!e.extend&&s>r&&(l=r,r=s,s=l),l=Ma(n,s);var a=Ma(n,r);l&&a&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Jt=null,Ms=null,Vn=null,Is=!1;function Ia(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Is||Jt==null||Jt!==Jr(r)||(r=Jt,"selectionStart"in r&&Ri(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vn&&er(Vn,r)||(Vn=r,r=sl(Ms,"onSelect"),0tn||(e.current=Bs[tn],Bs[tn]=null,tn--)}function O(e,t){tn++,Bs[tn]=e.current,e.current=t}var St={},ce=Tt(St),ye=Tt(!1),Vt=St;function mn(e,t){var n=e.type.contextTypes;if(!n)return St;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},s;for(s in n)l[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function xe(e){return e=e.childContextTypes,e!=null}function al(){V(ye),V(ce)}function Ha(e,t,n){if(ce.current!==St)throw Error(N(168));O(ce,t),O(ye,n)}function Au(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(N(108,Ld(e)||"Unknown",l));return Q({},n,r)}function ol(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||St,Vt=ce.current,O(ce,e),O(ye,ye.current),!0}function Qa(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=Au(e,t,Vt),r.__reactInternalMemoizedMergedChildContext=e,V(ye),V(ce),O(ce,e)):V(ye),O(ye,n)}var be=null,Rl=!1,ss=!1;function Ou(e){be===null?be=[e]:be.push(e)}function Yf(e){Rl=!0,Ou(e)}function Pt(){if(!ss&&be!==null){ss=!0;var e=0,t=A;try{var n=be;for(A=1;e>=a,l-=a,et=1<<32-Ue(t)+l|n<k?(R=j,j=null):R=j.sibling;var P=f(g,j,m[k],w);if(P===null){j===null&&(j=R);break}e&&j&&P.alternate===null&&t(g,j),d=s(P,d,k),E===null?S=P:E.sibling=P,E=P,j=R}if(k===m.length)return n(g,j),W&&$t(g,k),S;if(j===null){for(;kk?(R=j,j=null):R=j.sibling;var I=f(g,j,P.value,w);if(I===null){j===null&&(j=R);break}e&&j&&I.alternate===null&&t(g,j),d=s(I,d,k),E===null?S=I:E.sibling=I,E=I,j=R}if(P.done)return n(g,j),W&&$t(g,k),S;if(j===null){for(;!P.done;k++,P=m.next())P=h(g,P.value,w),P!==null&&(d=s(P,d,k),E===null?S=P:E.sibling=P,E=P);return W&&$t(g,k),S}for(j=r(g,j);!P.done;k++,P=m.next())P=v(j,g,k,P.value,w),P!==null&&(e&&P.alternate!==null&&j.delete(P.key===null?k:P.key),d=s(P,d,k),E===null?S=P:E.sibling=P,E=P);return e&&j.forEach(function(K){return t(g,K)}),W&&$t(g,k),S}function C(g,d,m,w){if(typeof m=="object"&&m!==null&&m.type===qt&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case xr:e:{for(var S=m.key,E=d;E!==null;){if(E.key===S){if(S=m.type,S===qt){if(E.tag===7){n(g,E.sibling),d=l(E,m.props.children),d.return=g,g=d;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ct&&Ya(S)===E.type){n(g,E.sibling),d=l(E,m.props),d.ref=Ln(g,E,m),d.return=g,g=d;break e}n(g,E);break}else t(g,E);E=E.sibling}m.type===qt?(d=Ut(m.props.children,g.mode,w,m.key),d.return=g,g=d):(w=Zr(m.type,m.key,m.props,null,g.mode,w),w.ref=Ln(g,d,m),w.return=g,g=w)}return a(g);case Xt:e:{for(E=m.key;d!==null;){if(d.key===E)if(d.tag===4&&d.stateNode.containerInfo===m.containerInfo&&d.stateNode.implementation===m.implementation){n(g,d.sibling),d=l(d,m.children||[]),d.return=g,g=d;break e}else{n(g,d);break}else t(g,d);d=d.sibling}d=ps(m,g.mode,w),d.return=g,g=d}return a(g);case ct:return E=m._init,C(g,d,E(m._payload),w)}if(zn(m))return y(g,d,m,w);if(Sn(m))return x(g,d,m,w);Lr(g,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,d!==null&&d.tag===6?(n(g,d.sibling),d=l(d,m),d.return=g,g=d):(n(g,d),d=fs(m,g.mode,w),d.return=g,g=d),a(g)):n(g,d)}return C}var gn=Bu(!0),Hu=Bu(!1),dl=Tt(null),fl=null,ln=null,Fi=null;function Mi(){Fi=ln=fl=null}function Ii(e){var t=dl.current;V(dl),e._currentValue=t}function Ks(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function fn(e,t){fl=e,Fi=ln=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ge=!0),e.firstContext=null)}function ze(e){var t=e._currentValue;if(Fi!==e)if(e={context:e,memoizedValue:t,next:null},ln===null){if(fl===null)throw Error(N(308));ln=e,fl.dependencies={lanes:0,firstContext:e}}else ln=ln.next=e;return t}var It=null;function Ai(e){It===null?It=[e]:It.push(e)}function Qu(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ai(t)):(n.next=l.next,l.next=n),t.interleaved=n,st(e,r)}function st(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var dt=!1;function Oi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ku(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function nt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function kt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,M&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,st(e,n)}return l=r.interleaved,l===null?(t.next=t,Ai(r)):(t.next=l.next,l.next=t),r.interleaved=t,st(e,n)}function Qr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,_i(e,n)}}function Xa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?l=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?l=s=t:s=s.next=t}else l=s=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function pl(e,t,n,r){var l=e.updateQueue;dt=!1;var s=l.firstBaseUpdate,a=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?s=c:a.next=c,a=u;var p=e.alternate;p!==null&&(p=p.updateQueue,o=p.lastBaseUpdate,o!==a&&(o===null?p.firstBaseUpdate=c:o.next=c,p.lastBaseUpdate=u))}if(s!==null){var h=l.baseState;a=0,p=c=u=null,o=s;do{var f=o.lane,v=o.eventTime;if((r&f)===f){p!==null&&(p=p.next={eventTime:v,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var y=e,x=o;switch(f=t,v=n,x.tag){case 1:if(y=x.payload,typeof y=="function"){h=y.call(v,h,f);break e}h=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=x.payload,f=typeof y=="function"?y.call(v,h,f):y,f==null)break e;h=Q({},h,f);break e;case 2:dt=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,f=l.effects,f===null?l.effects=[o]:f.push(o))}else v={eventTime:v,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},p===null?(c=p=v,u=h):p=p.next=v,a|=f;if(o=o.next,o===null){if(o=l.shared.pending,o===null)break;f=o,o=f.next,f.next=null,l.lastBaseUpdate=f,l.shared.pending=null}}while(!0);if(p===null&&(u=h),l.baseState=u,l.firstBaseUpdate=c,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else s===null&&(l.shared.lanes=0);Ht|=a,e.lanes=a,e.memoizedState=h}}function qa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=as.transition;as.transition={};try{e(!1),t()}finally{A=n,as.transition=r}}function uc(){return Fe().memoizedState}function Jf(e,t,n){var r=jt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},cc(e))dc(t,n);else if(n=Qu(e,t,n,r),n!==null){var l=fe();Ve(n,e,r,l),fc(n,t,r)}}function bf(e,t,n){var r=jt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(cc(e))dc(t,l);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,o=s(a,n);if(l.hasEagerState=!0,l.eagerState=o,We(o,a)){var u=t.interleaved;u===null?(l.next=l,Ai(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=Qu(e,t,l,r),n!==null&&(l=fe(),Ve(n,e,r,l),fc(n,t,r))}}function cc(e){var t=e.alternate;return e===H||t!==null&&t===H}function dc(e,t){Wn=ml=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,_i(e,n)}}var vl={readContext:ze,useCallback:ie,useContext:ie,useEffect:ie,useImperativeHandle:ie,useInsertionEffect:ie,useLayoutEffect:ie,useMemo:ie,useReducer:ie,useRef:ie,useState:ie,useDebugValue:ie,useDeferredValue:ie,useTransition:ie,useMutableSource:ie,useSyncExternalStore:ie,useId:ie,unstable_isNewReconciler:!1},ep={readContext:ze,useCallback:function(e,t){return Qe().memoizedState=[e,t===void 0?null:t],e},useContext:ze,useEffect:Ja,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Gr(4194308,4,lc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Gr(4,2,e,t)},useMemo:function(e,t){var n=Qe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qe();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Jf.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Qe();return e={current:e},t.memoizedState=e},useState:Za,useDebugValue:Gi,useDeferredValue:function(e){return Qe().memoizedState=e},useTransition:function(){var e=Za(!1),t=e[0];return e=Zf.bind(null,e[1]),Qe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Qe();if(W){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),ne===null)throw Error(N(349));Bt&30||qu(r,t,n)}l.memoizedState=n;var s={value:n,getSnapshot:t};return l.queue=s,Ja(Ju.bind(null,r,s,e),[e]),r.flags|=2048,or(9,Zu.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Qe(),t=ne.identifierPrefix;if(W){var n=tt,r=et;n=(r&~(1<<32-Ue(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ir++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Ke]=t,e[rr]=r,jc(e,t,!1,!1),t.stateNode=e;e:{switch(a=Ts(n,r),n){case"dialog":U("cancel",e),U("close",e),l=r;break;case"iframe":case"object":case"embed":U("load",e),l=r;break;case"video":case"audio":for(l=0;lkn&&(t.flags|=128,r=!0,Rn(s,!1),t.lanes=4194304)}else{if(!r)if(e=hl(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rn(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!W)return ae(t),null}else 2*q()-s.renderingStartTime>kn&&n!==1073741824&&(t.flags|=128,r=!0,Rn(s,!1),t.lanes=4194304);s.isBackwards?(a.sibling=t.child,t.child=a):(n=s.last,n!==null?n.sibling=a:t.child=a,s.last=a)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=q(),t.sibling=null,n=B.current,O(B,r?n&1|2:n&1),t):(ae(t),null);case 22:case 23:return bi(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?je&1073741824&&(ae(t),t.subtreeFlags&6&&(t.flags|=8192)):ae(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function op(e,t){switch($i(t),t.tag){case 1:return xe(t.type)&&al(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yn(),V(ye),V(ce),Wi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Vi(t),null;case 13:if(V(B),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(B),null;case 4:return yn(),null;case 10:return Ii(t.type._context),null;case 22:case 23:return bi(),null;case 24:return null;default:return null}}var Dr=!1,ue=!1,up=typeof WeakSet=="function"?WeakSet:Set,L=null;function sn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){G(e,t,r)}else n.current=null}function ti(e,t,n){try{n()}catch(r){G(e,t,r)}}var uo=!1;function cp(e,t){if(As=rl,e=Pu(),Ri(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,o=-1,u=-1,c=0,p=0,h=e,f=null;t:for(;;){for(var v;h!==n||l!==0&&h.nodeType!==3||(o=a+l),h!==s||r!==0&&h.nodeType!==3||(u=a+r),h.nodeType===3&&(a+=h.nodeValue.length),(v=h.firstChild)!==null;)f=h,h=v;for(;;){if(h===e)break t;if(f===n&&++c===l&&(o=a),f===s&&++p===r&&(u=a),(v=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=v}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Os={focusedElem:e,selectionRange:n},rl=!1,L=t;L!==null;)if(t=L,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,L=e;else for(;L!==null;){t=L;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var x=y.memoizedProps,C=y.memoizedState,g=t.stateNode,d=g.getSnapshotBeforeUpdate(t.elementType===t.type?x:Ie(t.type,x),C);g.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(w){G(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,L=e;break}L=t.return}return y=uo,uo=!1,y}function Bn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var s=l.destroy;l.destroy=void 0,s!==void 0&&ti(t,n,s)}l=l.next}while(l!==r)}}function zl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ni(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function _c(e){var t=e.alternate;t!==null&&(e.alternate=null,_c(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ke],delete t[rr],delete t[Ws],delete t[Kf],delete t[Gf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function co(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ri(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=il));else if(r!==4&&(e=e.child,e!==null))for(ri(e,t,n),e=e.sibling;e!==null;)ri(e,t,n),e=e.sibling}function li(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(li(e,t,n),e=e.sibling;e!==null;)li(e,t,n),e=e.sibling}var re=null,Ae=!1;function ot(e,t,n){for(n=n.child;n!==null;)Cc(e,t,n),n=n.sibling}function Cc(e,t,n){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(El,n)}catch{}switch(n.tag){case 5:ue||sn(n,t);case 6:var r=re,l=Ae;re=null,ot(e,t,n),re=r,Ae=l,re!==null&&(Ae?(e=re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):re.removeChild(n.stateNode));break;case 18:re!==null&&(Ae?(e=re,n=n.stateNode,e.nodeType===8?ls(e.parentNode,n):e.nodeType===1&&ls(e,n),Jn(e)):ls(re,n.stateNode));break;case 4:r=re,l=Ae,re=n.stateNode.containerInfo,Ae=!0,ot(e,t,n),re=r,Ae=l;break;case 0:case 11:case 14:case 15:if(!ue&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var s=l,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&ti(n,t,a),l=l.next}while(l!==r)}ot(e,t,n);break;case 1:if(!ue&&(sn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){G(n,t,o)}ot(e,t,n);break;case 21:ot(e,t,n);break;case 22:n.mode&1?(ue=(r=ue)||n.memoizedState!==null,ot(e,t,n),ue=r):ot(e,t,n);break;default:ot(e,t,n)}}function fo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new up),t.forEach(function(r){var l=xp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Me(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=a),r&=~s}if(r=l,r=q()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*fp(r/1960))-r,10e?16:e,mt===null)var r=!1;else{if(e=mt,mt=null,xl=0,M&6)throw Error(N(331));var l=M;for(M|=4,L=e.current;L!==null;){var s=L,a=s.child;if(L.flags&16){var o=s.deletions;if(o!==null){for(var u=0;uq()-Zi?Ot(e,0):qi|=n),ke(e,t)}function Fc(e,t){t===0&&(e.mode&1?(t=Nr,Nr<<=1,!(Nr&130023424)&&(Nr=4194304)):t=1);var n=fe();e=st(e,t),e!==null&&(fr(e,t,n),ke(e,n))}function yp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Fc(e,n)}function xp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(t),Fc(e,n)}var Mc;Mc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ye.current)ge=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ge=!1,ip(e,t,n);ge=!!(e.flags&131072)}else ge=!1,W&&t.flags&1048576&&Uu(t,cl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yr(e,t),e=t.pendingProps;var l=mn(t,ce.current);fn(t,n),l=Hi(null,t,r,e,l,n);var s=Qi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xe(r)?(s=!0,ol(t)):s=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Oi(t),l.updater=$l,t.stateNode=l,l._reactInternals=t,Ys(t,r,e,n),t=Zs(null,t,r,!0,s,n)):(t.tag=0,W&&s&&Di(t),de(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=wp(r),e=Ie(r,e),l){case 0:t=qs(null,t,r,e,n);break e;case 1:t=io(null,t,r,e,n);break e;case 11:t=lo(null,t,r,e,n);break e;case 14:t=so(null,t,r,Ie(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),qs(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),io(e,t,r,l,n);case 3:e:{if(xc(t),e===null)throw Error(N(387));r=t.pendingProps,s=t.memoizedState,l=s.element,Ku(e,t),pl(t,r,null,n);var a=t.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){l=xn(Error(N(423)),t),t=ao(e,t,r,n,l);break e}else if(r!==l){l=xn(Error(N(424)),t),t=ao(e,t,r,n,l);break e}else for(Ne=xt(t.stateNode.containerInfo.firstChild),_e=t,W=!0,Oe=null,n=Hu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vn(),r===l){t=it(e,t,n);break e}de(e,t,r,n)}t=t.child}return t;case 5:return Gu(t),e===null&&Qs(t),r=t.type,l=t.pendingProps,s=e!==null?e.memoizedProps:null,a=l.children,Us(r,l)?a=null:s!==null&&Us(r,s)&&(t.flags|=32),yc(e,t),de(e,t,a,n),t.child;case 6:return e===null&&Qs(t),null;case 13:return kc(e,t,n);case 4:return Ui(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gn(t,null,r,n):de(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),lo(e,t,r,l,n);case 7:return de(e,t,t.pendingProps,n),t.child;case 8:return de(e,t,t.pendingProps.children,n),t.child;case 12:return de(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,s=t.memoizedProps,a=l.value,O(dl,r._currentValue),r._currentValue=a,s!==null)if(We(s.value,a)){if(s.children===l.children&&!ye.current){t=it(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var u=o.firstContext;u!==null;){if(u.context===r){if(s.tag===1){u=nt(-1,n&-n),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?u.next=u:(u.next=p.next,p.next=u),c.pending=u}}s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Ks(s.return,n,t),o.lanes|=n;break}u=u.next}}else if(s.tag===10)a=s.type===t.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(N(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),Ks(a,n,t),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===t){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}de(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,fn(t,n),l=ze(l),r=r(l),t.flags|=1,de(e,t,r,n),t.child;case 14:return r=t.type,l=Ie(r,t.pendingProps),l=Ie(r.type,l),so(e,t,r,l,n);case 15:return vc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),Yr(e,t),t.tag=1,xe(r)?(e=!0,ol(t)):e=!1,fn(t,n),pc(t,r,l),Ys(t,r,l,n),Zs(null,t,r,!0,e,n);case 19:return wc(e,t,n);case 22:return gc(e,t,n)}throw Error(N(156,t.tag))};function Ic(e,t){return cu(e,t)}function kp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Re(e,t,n,r){return new kp(e,t,n,r)}function ta(e){return e=e.prototype,!(!e||!e.isReactComponent)}function wp(e){if(typeof e=="function")return ta(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ki)return 11;if(e===wi)return 14}return 2}function Nt(e,t){var n=e.alternate;return n===null?(n=Re(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Zr(e,t,n,r,l,s){var a=2;if(r=e,typeof e=="function")ta(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case qt:return Ut(n.children,l,s,t);case xi:a=8,l|=8;break;case ys:return e=Re(12,n,t,l|2),e.elementType=ys,e.lanes=s,e;case xs:return e=Re(13,n,t,l),e.elementType=xs,e.lanes=s,e;case ks:return e=Re(19,n,t,l),e.elementType=ks,e.lanes=s,e;case Go:return Ml(n,l,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Qo:a=10;break e;case Ko:a=9;break e;case ki:a=11;break e;case wi:a=14;break e;case ct:a=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Re(a,n,t,l),t.elementType=e,t.type=r,t.lanes=s,t}function Ut(e,t,n,r){return e=Re(7,e,r,t),e.lanes=n,e}function Ml(e,t,n,r){return e=Re(22,e,r,t),e.elementType=Go,e.lanes=n,e.stateNode={isHidden:!1},e}function fs(e,t,n){return e=Re(6,e,null,t),e.lanes=n,e}function ps(e,t,n){return t=Re(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function jp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gl(0),this.expirationTimes=Gl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function na(e,t,n,r,l,s,a,o,u){return e=new jp(e,t,n,o,u),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Re(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Oi(s),e}function Np(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Vc)}catch(e){console.error(e)}}Vc(),Vo.exports=Ce;var Wc=Vo.exports,Bc,ko=Wc;Bc=ko.createRoot,ko.hydrateRoot;const Tp="modulepreload",Pp=function(e){return"/"+e},wo={},Ft=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));l=Promise.allSettled(n.map(u=>{if(u=Pp(u),u in wo)return;wo[u]=!0;const c=u.endsWith(".css"),p=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":Tp,c||(h.as="script"),h.crossOrigin="",h.href=u,o&&h.setAttribute("nonce",o),document.head.appendChild(h),c)return new Promise((f,v)=>{h.addEventListener("load",f),h.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return l.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return t().catch(s)})};async function oe(e,t={}){const n=await fetch(e,{headers:{"content-type":"application/json"},...t,body:t.body?JSON.stringify(t.body):void 0});let r=null;try{r=await n.json()}catch{}if(!n.ok){const l=r!=null&&r.detail?typeof r.detail=="string"?r.detail:JSON.stringify(r.detail):`HTTP ${n.status}`;throw new Error(l)}return r}const Se={stats:()=>oe("/api/stats"),search:e=>oe(`/api/search?q=${encodeURIComponent(e)}`),assess:(e,t=4)=>oe(`/api/assess/${e}?depth=${t}`),compare:e=>oe("/api/compare",{method:"POST",body:{ks:e}}),recallEvent:e=>oe(`/api/recall-event/${e}`),watchlist:()=>oe("/api/watchlist"),ingest:(e,t=!1)=>oe("/api/ingest",{method:"POST",body:{k:e,refresh:t}}),review:(e,t,n,r)=>oe("/api/citation/review",{method:"POST",body:{src:e,dst:t,status:n,note:r}}),triage:(e,t)=>oe("/api/citation/triage",{method:"POST",body:{src:e,dst:t}}),save:(e,t)=>oe("/api/assessments",{method:"POST",body:{k:e,note:t}}),assessments:e=>oe(`/api/assessments${e?`?k=${e}`:""}`),investigations:(e,t=30)=>oe(`/api/investigations?limit=${t}${e?`&k=${e}`:""}`),investigation:e=>oe(`/api/investigations/${e}`),startInvestigation:(e,t,n="auto")=>oe("/api/investigations",{method:"POST",body:{k:e,request:t,mode:n}}),proposals:e=>oe(`/api/proposals${e?`?status=${e}`:""}`),decide:(e,t,n,r)=>oe(`/api/proposals/${e}/decision`,{method:"POST",body:{decision:t,reviewer:n,human:!0,note:r}})},Hc=e=>`https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID=${e}`,Lp=(e,t=!0)=>`/api/investigations/${e}/report${t?"?format=markdown":""}`,ui={nodes:[{id:"a",x:11,y:7,r:3.6},{id:"b",x:27,y:7,r:2.8},{id:"c",x:11,y:19,r:3},{id:"d",x:23,y:19,r:2.6},{id:"e",x:11,y:31,r:3.4,past:!0}],threads:[["a","b"],["a","c"],["c","d"],["c","e"]]},Fr=Object.fromEntries(ui.nodes.map(e=>[e.id,e]));function Qc({size:e=28,className:t="",title:n}){return i.jsxs("svg",{className:"mark "+t,width:e,height:e,viewBox:"0 0 38 38",role:n?"img":void 0,"aria-hidden":n?void 0:!0,"aria-label":n,children:[ui.threads.map(([r,l],s)=>i.jsx("line",{className:`mark-thread t${s}`,x1:Fr[r].x,y1:Fr[r].y,x2:Fr[l].x,y2:Fr[l].y,pathLength:"1"},s)),ui.nodes.map((r,l)=>i.jsx("circle",{className:`mark-node n${l}${r.past?" past":""}`,cx:r.x,cy:r.y,r:r.r},r.id))]})}function Rp({size:e=28,className:t=""}){return i.jsxs("span",{className:"wordmark "+t,children:[i.jsx(Qc,{size:e}),i.jsx("span",{className:"wordmark-name",children:"Forebear"})]})}const ia="forebear:intro",Dp=3e3,jo=2450;function $p(){try{return!!sessionStorage.getItem(ia)}catch{return!0}}function zp(){try{sessionStorage.setItem(ia,"seen")}catch{}}function Fp(){try{sessionStorage.removeItem(ia)}catch{}}function Mp({onDone:e}){const[t,n]=S.useState(!1),r=S.useRef(!1),l=S.useRef(null),s=()=>{r.current||(r.current=!0,zp(),n(!0),e())};S.useEffect(()=>{var h;const c=setTimeout(s,jo),p=f=>{(f.key==="Escape"||f.key==="Enter"||f.key===" ")&&(f.preventDefault(),s())};return addEventListener("keydown",p),(h=l.current)==null||h.focus({preventScroll:!0}),()=>{clearTimeout(c),removeEventListener("keydown",p)}},[]);const[a,o]=S.useState(!1);if(S.useEffect(()=>{if(!t)return;const c=setTimeout(()=>o(!0),Dp-jo+100);return()=>clearTimeout(c)},[t]),a)return null;const u="Forebear".split("");return i.jsxs("div",{className:"intro"+(t?" is-leaving":""),"data-testid":"intro",onClick:s,role:"dialog","aria-modal":"true","aria-label":"Forebear opening",children:[i.jsxs("div",{className:"intro-lockup","aria-hidden":"true",children:[i.jsx(Qc,{className:"intro-mark",size:116}),i.jsx("div",{className:"intro-word",children:u.map((c,p)=>i.jsx("span",{style:{animationDelay:`${.95+p*.045}s`},children:c},p))}),i.jsx("p",{className:"intro-tag",children:i.jsxs("span",{children:["Every clearance has ",i.jsx("em",{children:"a past."})]})})]}),i.jsx("span",{className:"sr-only",role:"status",children:"Forebear. Every clearance has a past."}),i.jsxs("button",{ref:l,className:"btn btn-line btn-sm intro-skip",onClick:c=>{c.stopPropagation(),s()},children:["Skip intro ",i.jsx("span",{"aria-hidden":"true",children:"→"})]})]})}function Ip(e){const[t,n]=S.useState(()=>typeof matchMedia<"u"&&matchMedia(e).matches);return S.useEffect(()=>{const r=matchMedia(e),l=()=>n(r.matches);return l(),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[e]),t}const cr=["mcp-client"],Kn={DESIGN_RECALL_ON_FILE:{tone:"alert",label:"Design-related recall on file",plain:"The candidate itself has a design-related recall on file."},REVIEW_LINEAGE:{tone:"amber",label:"Review lineage",plain:"A recall in the predicate lineage warrants documented review."},INSUFFICIENT_LINEAGE:{tone:"muted",label:"Lineage not checkable",plain:"The ancestry could not be checked from readable evidence."},NO_DESIGN_RECALL_SIGNAL:{tone:"calm",label:"No design-recall signal",plain:"No design-related recall in the readable verdict window. Not a safety finding."}},Kc={audit_unresolved:"The extraction audit could not resolve whether this is the predicate",audit_correction:"K-number supplied by the audit, not as printed in the PDF",name_mismatch:"The cited device's FDA name does not appear near the citation",different_fda_panel:"Cited device sits in a different FDA review panel",llm_label_only:"A predicate only because an LLM labelled the mention",client_confirmation_only:"Confirmed only through the automated MCP client, not a person",client_rejection_pending:"Rejected through the automated MCP client; kept until a person decides",review_outdated:"A person reviewed an earlier version of the FDA summary; it needs re-review"};function Ap(e){if(!e)return[];if(e.review==="confirmed"&&Ge(e))return[];const t=[];return Gc(e)&&t.push("review_outdated"),e.audit==="unresolved"&&t.push("audit_unresolved"),e.audit==="corrected"&&t.push("audit_correction"),e.name_check==="mismatch"&&!["variant","corrected"].includes(e.audit)&&t.push("name_mismatch"),e.panel_check==="different"&&!["variant","corrected"].includes(e.audit)&&t.push("different_fda_panel"),e.kind!=null&&e.kind!=="predicate"&&e.ai_label==="predicate"&&t.push("llm_label_only"),e.kind!=null&&e.kind!=="predicate"&&e.review==="confirmed"&&cr.includes(e.reviewer)&&t.push("client_confirmation_only"),e.review==="rejected"&&cr.includes(e.reviewer)&&t.push("client_rejection_pending"),t}const Ge=e=>!!(e!=null&&e.review)&&!cr.includes(e.reviewer)&&(e.reviewed_source_sha256||"")===(e.source_sha256||""),Gc=e=>!!(e!=null&&e.review)&&!cr.includes(e.reviewer)&&!Ge(e),$e={confirmed:{label:"Confirmed by a person",short:"Confirmed"},extracted:{label:"Machine-extracted",short:"Extracted"},disputed:{label:"Disputed evidence",short:"Disputed"},conditional:{label:"Conditional route",short:"Conditional"},rejected:{label:"Rejected by a person",short:"Rejected"},advisory:{label:"Advisory: suggested by an LLM or the MCP client, awaiting a person; not a verdict input",short:"Advisory"},retired:{label:"Retired: the refreshed FDA summary no longer cites it; kept for the record",short:"Retired"}};function Et(e){if(e!=null&&e.retired_at||(e==null?void 0:e.trust)==="retired")return{key:"retired",reasons:[]};if((e==null?void 0:e.review)==="rejected"&&Ge(e))return{key:"rejected",reasons:[]};if(e!=null&&e.advisory||(e==null?void 0:e.trust)==="advisory")return{key:"advisory",reasons:[]};const t=Ap(e);return t.includes("audit_unresolved")?{key:"conditional",reasons:t}:t.length?{key:"disputed",reasons:t}:(e==null?void 0:e.review)==="confirmed"&&Ge(e)?{key:"confirmed",reasons:t}:{key:"extracted",reasons:t}}function Op(e){return e.design_related?"design":e.classification==="Class I"?"class1":"other"}function aa(e){const t=e.recalls||[];return t.some(n=>n.design_related)?"design":t.length?"recall":"clean"}function oa(e){return{events:new Set(e.map(n=>n.event||n.id)).size,records:e.length}}const Up=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function we(e){if(!e)return"—";const[t,n,r]=String(e).slice(0,10).split("-").map(Number);return t?`${r} ${Up[(n||1)-1]} ${t}`:String(e)}const Yc=e=>e?String(e).slice(0,4):"";function No(e,t){if(!e||!t)return null;const[n,r,l]=e.slice(0,10).split("-").map(Number),[s,a,o]=t.slice(0,10).split("-").map(Number);return(s-n)*12+(a-r)-(or?1:0}function ua(e,t){const n=Vp(e,t);if(n==null)return null;if(n===0)return{relation:"same-day",months:0,duration:""};const r=n<0?No(e,t):No(t,e);return{relation:n<0?"before":"after",months:r,duration:Wp(r)}}function Xc(e,t,n="clause"){if(!e)return"";const{relation:r,duration:l}=e;return n==="chip"?r==="same-day"?`Recall began on the day of ${t}'s clearance`:`Recall began ${l} ${r} ${t}'s clearance`:r==="same-day"?`on the day ${t} was cleared`:`${l} ${r} ${t} was cleared`}function Wp(e){if(e==null)return"";const t=e<0,n=Math.abs(e),r=Math.floor(n/12),l=n%12,s=[r?`${r} yr`:"",l?`${l} mo`:""].filter(Boolean).join(" ")||"<1 mo";return t?`-${s}`:s}function jl(e,t){const n=e.filter(s=>s.design_related),r=n.length?n:e.filter(s=>s.classification==="Class I");return r.filter(s=>s.initiated&&t&&s.initiateds.initiated.localeCompare(a.initiated))[0]||[...r].sort((s,a)=>(a.initiated||"").localeCompare(s.initiated||""))[0]||null}const ci=(e,t)=>e?t?`${e}#page=${t}`:e:null,Bp={pdf_text_layer:"PDF text layer",ocr:"Local OCR of the scanned PDF",embedded_pdf_attachment:"Summary embedded in a PDF Portfolio"};function qe(e,t=30){const n=(e||"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function Hp(e,t){return e==="NO_DESIGN_RECALL_SIGNAL"&&t!=="complete"}function qc(e,t){const n=Kn[e];return n?Hp(e,t)?{tone:"muted",label:`${n.label} · provisional`,provisional:!0}:{tone:n.tone,label:n.label,provisional:!1}:{tone:"muted",label:e||"Unknown",provisional:!1}}const Th={complete:"calm",partial:"amber",uncertain:"alert",none:"muted"},Qp={direct_predicate_links_all_uncertain:"every direct predicate link rests on uncertain evidence",unresolved_predicate_citations:"predicate citations within two generations could not be resolved",direct_predicate_summaries_unread:"a direct predicate's own summary was not read",doubtful_links_in_window:"links within two generations rest on doubtful evidence",recall_cause_or_class_unknown:"a recall has no stated cause or FDA class",unattributed_recalls_in_product_code:"design-related recalls in the product code name no 510(k)",shallow_traversal:"grand-predicates were not traversed",advisory_links_pending_review:"predicate links suggested only by an LLM or the MCP client await a person",human_confirmed_citation_retired:"a citation a person confirmed is no longer in the refreshed FDA summary"},Zc={name_token_match:{short:"FDA-listed · name match (heuristic)",tone:"other",text:"FDA lists this 510(k) on the recall. A distinctive word of its FDA device name appears in the recall text, possibly as a fuzzy match. This heuristic does not verify that the recall names this exact model."},name_token_absent:{short:"FDA-listed · name not found (heuristic)",tone:"muted",text:"FDA lists this 510(k) on the recall, but no distinctive word of its FDA device name was found in the recall text. The recalled model may differ, or the text may name it differently."},name_not_checkable:{short:"FDA-listed · name not checked",tone:"muted",text:"FDA lists this 510(k) on the recall. No name check is available: its FDA device name has no distinctive word to look for, or no check was recorded for this link. Which model was recalled is not established here."}},hs={short:"Recall began before this clearance",text:"This recall began before this 510(k) was cleared, yet FDA lists it on the record. The dates alone do not establish whether this cleared model was affected: read the FDA record."},Ph={after:"cleared after the recall began",before:"cleared before the recall began",same_day:"cleared the day the recall began (order unknown)",unknown:"timing unknown (a date is missing)"};function So(e){return e!=null&&e.attribution&&Zc[e.attribution]?e.attribution:(e==null?void 0:e.link_name_check)==="match"?"name_token_match":(e==null?void 0:e.link_name_check)==="mismatch"?"name_token_absent":"name_not_checkable"}const ms=70,Mr=110,_o=46,Kp=62,Gp=190,Eo=300;function Yp(e){return e.signals.filter(t=>{var n;return(t.severity==="high"||t.severity==="medium")&&((n=t.chain)==null?void 0:n.length)>1}).map(t=>t.chain)}function Xp(e,{depth:t,descendants:n}){const r=new Map,l=Yp(e),s=new Set(l.flat()),a=new Set;l.forEach(h=>h.slice(1).forEach((f,v)=>a.add(h[v]+">"+f))),r.set(e.k,{...e.device,k:e.k,gen:0,side:"self",recalls:e.device.recalls||[]});let o=0,u=new Set;for(const h of e.ancestors)h.gen<=t||s.has(h.k)?r.set(h.k,{...h,side:"up"}):(o++,u.add(h.gen));if(n)for(const h of e.descendants)r.set(h.k,{...h,side:"down"});const c=new Map,p=h=>{for(const f of h||[]){if(!r.has(f.src)||!r.has(f.dst))continue;const v=f.src+">"+f.dst;c.has(v)||c.set(v,{id:v,hop:f,status:Et(f),critical:a.has(v)})}};for(const h of e.ancestors)r.has(h.k)&&p(h.hops);if(n)for(const h of e.descendants)p(h.hops);return{nodes:r,edges:c,hidden:o,hiddenGens:[...u].sort(),critK:s,critE:a}}function qp(e,t){var E;const{nodes:n,edges:r}=e,l=new Map;for(const j of n.values())((E=j.chain)==null?void 0:E.length)>1&&l.set(j.k,j.chain[j.chain.length-2]);const s=[...n.values()].filter(j=>j.side==="up").map(j=>j.gen),a=[...n.values()].filter(j=>j.side==="down").map(j=>j.gen),o=s.length?Math.max(...s):0,u=a.length?Math.max(...a):0,c=j=>j.side==="self"?o:j.side==="up"?o-j.gen:o+j.gen,p=new Map;for(const j of n.values()){const k=c(j);p.has(k)||p.set(k,[]),p.get(k).push(j)}const h=new Map([[[...n.values()].find(j=>j.side==="self").k,0]]),f=[...p.keys()].sort((j,k)=>Math.abs(j-o)-Math.abs(k-o)),v=Math.max(...[...p.values()].map(j=>j.length));for(const j of f){const k=p.get(j);k.sort((R,P)=>{const I=h.get(l.get(R.k))??0,K=h.get(l.get(P.k))??0;return I-K||(P.decision_date||"").localeCompare(R.decision_date||"")}),k.forEach((R,P)=>{R.side!=="self"&&h.set(R.k,(P-(k.length-1)/2)*ms)})}const y=o+u,x=y?Math.max(Gp,Math.min(Eo,(t-Mr*2)/y)):Eo,C=Math.max(t,Mr*2+y*x),g=Mr+(C-(Mr*2+y*x))/2,d=_o+Kp+Math.max(1,v)*ms,m=_o+Math.max(1,v)*ms/2,w=new Map([...n.values()].map(j=>[j.k,{x:g+c(j)*x,y:m+h.get(j.k)}])),_=[...p.keys()].map(j=>{const k=j-o;return{x:g+j*x,label:k===0?"Candidate":k<0?k===-1?"Predicates":k===-2?"Grand-predicates":`Generation ${-k}`:`Cites it · +${k}`}});return{pos:w,width:C,height:d,colLabels:_,edges:r}}function Zp({a:e,depth:t,onDepth:n,descendants:r,selected:l,onSelect:s,focusChain:a}){const o=S.useMemo(()=>Xp(e,{depth:t,descendants:r}),[e,t,r]),u=S.useRef(null),[c,p]=S.useState(900);S.useEffect(()=>{const d=()=>u.current&&p(u.current.clientWidth);d();const m=new ResizeObserver(d);return m.observe(u.current),()=>m.disconnect()},[]);const h=S.useMemo(()=>qp(o,c),[o,c]),[f,v]=S.useState(null);S.useEffect(()=>{const d=u.current;d&&(d.scrollLeft=d.scrollWidth)},[e.k,h.width]);const y=S.useMemo(()=>{const d=f||null;if(!d)return a?new Set(a):null;const m=o.nodes.get(d);return new Set((m==null?void 0:m.chain)||[d])},[f,o,a]),x=d=>{if(!y)return!0;const[m,w]=d.split(">");return y.has(m)&&y.has(w)},C=d=>{const m=d.recalls||[],w=m.filter(_=>_.design_related).length;return`${d.k}, ${d.name||"unnamed"}, cleared ${d.decision_date||"date unknown"}. `+(d.side==="self"?"Candidate. ":d.side==="up"?`Generation ${d.gen} predicate. `:`Cites the candidate, ${d.gen} generation(s) later. `)+(m.length?`${m.length} recall record(s), ${w} design-related. `:"No recall records. ")+(d.lineage_known===!1?"Its own predicates were not read.":"")},g=d=>m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),d())};return i.jsxs("div",{children:[i.jsx("div",{className:"graph-wrap",ref:u,"data-testid":"evidence-graph",children:i.jsxs("svg",{width:h.width,height:h.height,role:"group","aria-label":`Predicate lineage graph for ${e.k}: ${o.nodes.size} devices, ${o.edges.size} citations`,children:[h.colLabels.map(d=>i.jsxs("g",{children:[i.jsx("line",{className:"g-col-rule",x1:d.x,x2:d.x,y1:30,y2:h.height-10}),i.jsx("text",{className:"g-col-label",x:d.x,y:20,textAnchor:"middle",children:d.label})]},d.x)),[...o.edges.values()].map(d=>{const m=h.pos.get(d.hop.src),w=h.pos.get(d.hop.dst),_=(m.x+w.x)/2,E=`M${m.x-12},${m.y} C${_},${m.y} ${_},${w.y} ${w.x+12},${w.y}`,j=d.status.key,k=!x(d.id),R=(l==null?void 0:l.type)==="edge"&&l.id===d.id;return i.jsxs("g",{className:"g-edge-g",tabIndex:0,role:"button","aria-label":`Citation: ${d.hop.src} cites ${d.hop.dst}${d.hop.page?`, page ${d.hop.page}`:""}. ${$e[j].label}. Open provenance.`,"aria-pressed":R,onClick:()=>s({type:"edge",id:d.id,hop:d.hop}),onKeyDown:g(()=>s({type:"edge",id:d.id,hop:d.hop})),children:[i.jsx("path",{d:E,className:`g-edge st-${j}${d.critical?" is-critical":""}${k?" is-dim":""}`,style:R?{opacity:1,strokeWidth:3.2}:void 0}),d.critical&&!k&&i.jsx("path",{d:E,className:"g-flow"}),i.jsx("path",{d:E,className:"g-edge-hit"}),i.jsx("rect",{x:_-22,y:(m.y+w.y)/2-9,width:44,height:18,rx:9,fill:"transparent",style:{cursor:"pointer"}}),i.jsx("title",{children:`${d.hop.src} → ${d.hop.dst} · p.${d.hop.page??"?"} · ${$e[j].label}`})]},d.id)}),[...o.nodes.values()].map(d=>{const m=h.pos.get(d.k),w=aa(d),_=d.side==="self",E=_?11:8,j=y&&!y.has(d.k),k=(l==null?void 0:l.type)==="node"&&l.k===d.k;return i.jsxs("g",{transform:`translate(${m.x},${m.y})`,tabIndex:0,role:"button","aria-label":C(d),"aria-pressed":k,className:`g-node${_?" is-self":""}${j?" is-dim":""}${k?" is-selected":""}`,"data-k":d.k,onMouseEnter:()=>v(d.k),onMouseLeave:()=>v(null),onFocus:()=>v(d.k),onBlur:()=>v(null),onClick:()=>s({type:"node",k:d.k}),onKeyDown:g(()=>s({type:"node",k:d.k})),children:[w==="design"&&!_&&i.jsx("circle",{className:"glow",r:E*2.2}),i.jsx("circle",{className:"halo",r:E+5}),i.jsx("circle",{className:`dot tone-${w}${d.lineage_known===!1?" unread":""}`,r:E}),i.jsx("text",{className:"lk",y:-E-9,textAnchor:"middle",children:d.k}),i.jsxs("text",{className:"ln",y:E+16,textAnchor:"middle",children:[qe(d.name,26)," · ",Yc(d.decision_date)]})]},d.k)}),o.hidden>0&&i.jsxs("g",{className:"g-more",tabIndex:0,role:"button",transform:`translate(14, ${h.height-40})`,"aria-label":`Show ${o.hidden} more ancestors in generations ${o.hiddenGens.join(", ")}`,onClick:()=>n(Math.max(...o.hiddenGens)),onKeyDown:g(()=>n(Math.max(...o.hiddenGens))),children:[i.jsx("rect",{width:"212",height:"28",rx:"14"}),i.jsxs("text",{x:"106",y:"18.5",textAnchor:"middle",children:["+ ",o.hidden," more in generation",o.hiddenGens.length>1?`s ${o.hiddenGens[0]}–${o.hiddenGens[o.hiddenGens.length-1]}`:` ${o.hiddenGens[0]}`]})]})]})}),i.jsxs("div",{className:"g-legend","aria-label":"Legend",children:[i.jsxs("span",{className:"sw",children:[i.jsx("i",{className:"lg-design"}),"design-related recall"]}),i.jsxs("span",{className:"sw",children:[i.jsx("i",{className:"lg-recall"}),"other recall"]}),i.jsxs("span",{className:"sw",children:[i.jsx("i",{className:"lg-clean"}),"no recall record"]}),i.jsxs("span",{className:"sw",children:[i.jsx("i",{className:"lg-unread"}),"own predicates unread"]}),i.jsx("span",{className:"sep","aria-hidden":"true"}),["confirmed","extracted","disputed","conditional"].map(d=>i.jsxs("span",{className:`status status-${d}`,children:[i.jsx("span",{className:"line"}),$e[d].short]},d)),i.jsxs("span",{className:"status",style:{color:"var(--amber)"},children:[i.jsx("span",{className:"line"}),"critical chain"]})]}),i.jsx("div",{className:"graph-hint",children:"Select any device or thread for its record, quote, page and source PDF. Tab moves between them; Enter opens."})]})}const Dt=28,Ir=34,vs=260,ut=e=>e?Date.parse(e.slice(0,10)+"T00:00:00Z"):null;function Jp(e,t){const n=new Map,r=(u,c,p,h)=>{n.has(u.k)||n.set(u.k,{...u,side:c,gen:p,parent:h,children:[]})};r({...e.device,k:e.k},"self",0,null);for(const u of e.ancestors)u.gen<=t&&r(u,"up",u.gen,u.chain[u.chain.length-2]);for(const u of e.descendants)r(u,"down",u.gen,u.chain[u.chain.length-2]);for(const u of n.values())u.parent&&n.has(u.parent)&&n.get(u.parent).children.push(u.k);const l=(u,c)=>(n.get(u).decision_date||"").localeCompare(n.get(c).decision_date||""),s=[],a=u=>{for(const c of n.get(u).children.filter(p=>n.get(p).side==="down").sort(l).reverse())a(c),s.push(c)},o=u=>{for(const c of n.get(u).children.filter(p=>n.get(p).side==="up").sort(l).reverse())s.push(c),o(c)};return a(e.k),s.push(e.k),o(e.k),{nodes:n,order:s}}function bp({a:e,depth:t,highlight:n,onSelect:r}){const l=S.useRef(null),[s,a]=S.useState(1e3);S.useEffect(()=>{const k=()=>l.current&&a(Math.max(760,l.current.clientWidth));k();const R=new ResizeObserver(k);return R.observe(l.current),()=>R.disconnect()},[]);const{nodes:o,order:u}=S.useMemo(()=>Jp(e,t),[e,t]),c=new Map(u.map((k,R)=>[k,R])),p=[];for(const k of o.values()){k.decision_date&&p.push(ut(k.decision_date));for(const R of k.recalls||[])R.initiated&&p.push(ut(R.initiated))}const h=new Date(Math.min(...p)).getUTCFullYear(),f=new Date(Math.max(...p)).getUTCFullYear()+1,v=Date.UTC(h,0,1),y=Date.UTC(f,0,1),x=s-vs-40,C=k=>16+(k-v)/(y-v)*x,g=k=>Ir+k*Dt+Dt/2,d=Ir+u.length*Dt+16,m=new Set(n||[]),w=new Set;if(n)for(let k=0;k+1"+n[k+1]);const _=f-h>24?4:f-h>12?2:1,E=[];for(let k=h;k<=f;k+=_)E.push(k);const j=C(ut(e.device.decision_date));return i.jsx("div",{className:"graph-wrap",ref:l,"data-testid":"timeline",children:i.jsxs("svg",{width:s,height:d,role:"group","aria-label":`Lineage timeline for ${e.k}`,children:[E.map(k=>i.jsxs("g",{children:[i.jsx("line",{className:"tl-grid",x1:C(Date.UTC(k,0,1)),x2:C(Date.UTC(k,0,1)),y1:Ir-8,y2:d-8}),i.jsx("text",{className:"tl-axis",x:C(Date.UTC(k,0,1)),y:18,textAnchor:"middle",children:k})]},k)),i.jsx("rect",{x:0,y:g(c.get(e.k))-Dt/2,width:s,height:Dt,className:"tl-band"}),i.jsx("line",{className:"tl-clear",x1:j,x2:j,y1:Ir-8,y2:d-8}),[...o.values()].filter(k=>k.parent&&o.has(k.parent)).map(k=>{const[R,P]=k.side==="up"?[k.parent,k.k]:[k.k,k.parent],I=o.get(R),K=o.get(P);if(!I.decision_date||!K.decision_date)return null;const me=C(ut(I.decision_date)),Be=g(c.get(R)),Y=C(ut(K.decision_date)),Ze=g(c.get(P)),F=(me+Y)/2;return i.jsx("path",{d:`M${me-6},${Be} C${F},${Be} ${F},${Ze} ${Y+7},${Ze}`,className:"tl-edge"+(w.has(R+">"+P)?" on":"")},R+P)}),u.map((k,R)=>{const P=o.get(k);if(!P.decision_date)return null;const I=C(ut(P.decision_date)),K=g(R),me=aa(P),Be=m.size&&!m.has(k);return i.jsxs("g",{className:"tl-row g-node",style:{opacity:Be?.3:1},tabIndex:0,role:"button","aria-label":`${k} ${P.name}, cleared ${P.decision_date}, ${(P.recalls||[]).length} recall records`,onClick:()=>r({type:"node",k}),onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),r({type:"node",k}))},children:[i.jsx("rect",{className:"tl-rowhit",x:0,y:K-Dt/2,width:s,height:Dt}),(P.recalls||[]).map(Y=>Y.initiated&&i.jsxs("g",{children:[i.jsx("line",{className:"tl-rlink",x1:I,x2:C(ut(Y.initiated)),y1:K,y2:K}),i.jsx("path",{d:`M${C(ut(Y.initiated))},${K-5} l5,5 l-5,5 l-5,-5 z`,className:"tl-dia "+(Y.design_related?"design":"other"),children:i.jsx("title",{children:`${Y.id} · ${Y.classification||"unclassified"} · ${Y.root_cause} · began ${Y.initiated}`})})]},Y.id)),i.jsx("circle",{cx:I,cy:K,r:k===e.k?7:5.5,className:`dot tone-${me}${P.lineage_known===!1?" unread":""}`,style:k===e.k?{fill:"var(--ivory)",stroke:"var(--blue)",strokeWidth:3}:void 0}),i.jsxs("text",{x:s-vs+8,y:K+4,className:"tl-label",children:[i.jsx("tspan",{className:"lk",children:k}),i.jsx("tspan",{dx:"7",children:qe(P.name,24)})]}),i.jsx("text",{x:s-vs-6,y:K+4,textAnchor:"end",className:"tl-gen",children:P.side==="self"?"candidate":P.side==="up"?`G-${P.gen}`:`D+${P.gen}`})]},k)})]})})}const Nl=e=>(e.severity==="high"||e.severity==="medium")&&!e.conditional;function eh(e,t){var v,y;if(!e||!t||e.k!==t.k||e.depth!==1||t.depth<2||e.verdict===t.verdict)return null;const n=t.signals.filter(x=>{var C;return Nl(x)&&((C=x.chain)==null?void 0:C.length)>2});if(!n.length||t.signals.some(x=>{var C;return Nl(x)&&(((C=x.chain)==null?void 0:C.length)||0)<=2}))return null;const r=n[0],l=jl(r.evidence.filter(x=>x.type==="recall"),t.device.decision_date);if(!l)return null;const s=x=>t.ancestors.find(C=>C.k===x),a=(x,C)=>{var g,d;return((d=(g=s(C))==null?void 0:g.hops)==null?void 0:d.find(m=>m.src===x&&m.dst===C))||null},o=r.chain.slice(0,-1),u=o[o.length-1],c=n.filter(x=>x.chain.slice(0,-1).join(">")===o.join(">")&&x.evidence.some(C=>C.type==="recall"&&C.id===l.id)).map(x=>s(x.chain[x.chain.length-1])).filter(Boolean),p=o.slice(1).map((x,C)=>({device:s(x),hop:a(o[C],x)})),h=c.map(x=>({device:x,hop:a(u,x.k)})).filter(x=>x.hop),f=s(r.chain[1]);return{k:t.k,device:t.device,shallow:e,deep:t,recall:l,steps:p,fanout:h,predicate:f,predicateOnRecall:!!((v=f==null?void 0:f.recalls)!=null&&v.some(x=>x.id===l.id)),predicateRecalls:((y=f==null?void 0:f.recalls)==null?void 0:y.length)||0,timing:ua(l.initiated,t.device.decision_date),gen:r.gen}}function th(e,t,n=64,r=16){const l=(e||"").replace(/\s+/g," ").trim(),s=l.indexOf(t);if(s<0)return{head:qe(l,140),k:"",tail:""};let a=Math.max(0,s-n),o=Math.min(l.length,s+t.length+r);return a>0&&(a=l.indexOf(" ",a)+1||a),os+t.length?l.lastIndexOf(" ",o):o),{head:(a>0?"…":"")+l.slice(a,s),k:t,tail:l.slice(s+t.length,o)+(oe.length<2?e:e.flatMap((t,n)=>n===0?[t]:[n===e.length-1?" and ":", ",t]);function nh({a:e,onSelect:t}){var h;const[n,r]=S.useState(null),l=e.depth>=2&&e.signals.some(f=>{var v;return Nl(f)&&((v=f.chain)==null?void 0:v.length)>2})&&!e.signals.some(f=>{var v;return Nl(f)&&(((v=f.chain)==null?void 0:v.length)||0)<=2});S.useEffect(()=>{if(!l)return;let f=!0;return Promise.all([Se.assess(e.k,1),Se.assess(e.k,2)]).then(([v,y])=>{f&&r({of:e,one:v,two:y})}).catch(()=>{f&&r(null)}),()=>{f=!1}},[e,l]);const s=l&&(n==null?void 0:n.of)===e?eh(n.one,n.two):null;if(!s)return null;const{recall:a,predicate:o,timing:u}=s,c=f=>t({type:"edge",id:f.src+">"+f.dst,hop:f}),p=s.fanout.map(f=>i.jsx("span",{className:"k",children:f.device.k},f.device.k));return i.jsxs("section",{className:"panel depth-contrast corner-marks","aria-labelledby":"dc-title","data-testid":"depth-contrast",children:[i.jsxs("div",{className:"panel-head",children:[i.jsxs("h2",{id:"dc-title",children:["Why the graph matters ",i.jsx("span",{className:"count",children:"same clearance, same rules, one generation deeper"})]}),i.jsx("p",{className:"hint",children:"Depth is the number of predicate generations the Relate query walks."})]}),i.jsxs("div",{className:"dc-grid",children:[i.jsxs("div",{className:"dc-col","data-testid":"depth-1",children:[i.jsxs("p",{className:"dc-depth",children:[i.jsx("b",{children:"Depth 1"})," · direct predicates only"]}),i.jsx(Co,{a:s.shallow}),i.jsxs("p",{children:[i.jsx("span",{className:"k",children:s.k})," cites ",i.jsx("span",{className:"k",children:o.k})," (",o.name.split(",")[0],")."," ",s.predicateRecalls===0?i.jsxs(i.Fragment,{children:["FDA's recall records in this dataset name no recall for ",o.k,"."]}):i.jsxs(i.Fragment,{children:["FDA's recall records list ",s.predicateRecalls," record(s) for ",o.k,", none of them design-related."]})," ","A one-hop lookup stops here."]})]}),i.jsx("div",{className:"dc-step","aria-hidden":"true",children:i.jsx("span",{children:"+1 hop"})}),i.jsxs("div",{className:"dc-col is-deep","data-testid":"depth-2",children:[i.jsxs("p",{className:"dc-depth",children:[i.jsx("b",{children:"Depth 2"})," · one Relate query, two hops"]}),i.jsx(Co,{a:s.deep}),i.jsxs("p",{children:[i.jsx("span",{className:"k",children:o.k})," itself cites ",Po(p),"."," ","FDA lists ",s.fanout.length>1?"both":"it"," on ",i.jsx("a",{className:"mono",href:a.url,target:"_blank",rel:"noreferrer",children:a.id}),", a"," ",i.jsxs("span",{className:"amber",children:[a.classification," · ",a.root_cause]})," recall that began ",we(a.initiated),(u==null?void 0:u.relation)==="before"&&i.jsxs(i.Fragment,{children:[", ",i.jsxs("span",{className:"amber",children:[u.duration," before"]})," ",s.k," was cleared"]}),"."]})]})]}),i.jsxs("ol",{className:"dc-route","aria-label":"Evidence route, from the candidate's summary to the recall",children:[s.steps.map(({device:f,hop:v})=>v&&i.jsxs("li",{children:[i.jsxs("span",{className:"dc-n mono",children:[v.src," → ",f.k]}),i.jsx(To,{hop:v}),i.jsxs("span",{className:"dc-a",children:[i.jsxs("a",{href:ci(v.source_url,v.page),target:"_blank",rel:"noreferrer",children:[v.src," summary PDF, p.",v.page," ↗"]}),i.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>c(v),children:"Provenance"})]})]},v.src+v.dst)),s.fanout.map(({device:f,hop:v})=>i.jsxs("li",{children:[i.jsxs("span",{className:"dc-n mono",children:[v.src," → ",f.k]}),i.jsx(To,{hop:v}),i.jsxs("span",{className:"dc-a",children:[i.jsxs("a",{href:ci(v.source_url,v.page),target:"_blank",rel:"noreferrer",children:[v.src," summary PDF, p.",v.page," ↗"]}),i.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>c(v),children:"Provenance"})]})]},v.src+v.dst)),i.jsxs("li",{className:"is-recall",children:[i.jsx("span",{className:"dc-n mono",children:a.id}),i.jsxs("span",{className:"dc-q",children:[a.classification," · ",a.root_cause," · event ",a.event," · began ",we(a.initiated),". FDA's record lists ",Po(p),s.predicateOnRecall?i.jsxs(i.Fragment,{children:[", and ",i.jsx("span",{className:"k",children:o.k})]}):i.jsxs(i.Fragment,{children:[", not ",i.jsx("span",{className:"k",children:o.k})]}),"."]}),i.jsxs("span",{className:"dc-a",children:[i.jsx("a",{href:a.url,target:"_blank",rel:"noreferrer",children:"FDA recall record ↗"}),i.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>{var f;return t({type:"node",k:(f=s.fanout[0])==null?void 0:f.device.k})},children:["Open ",(h=s.fanout[0])==null?void 0:h.device.k]})]})]})]}),i.jsxs("p",{className:"dc-foot muted small",children:["A documentation signal for the predicate rationale, not a safety finding about ",s.k,". FDA attributes the recall to product families that list these clearances; it does not say which model was affected."]})]})}function Jc({text:e,k:t,ocr:n}){if(!e)return i.jsx("p",{className:"quote muted",children:"No quote stored for this citation."});const r=t?e.split(new RegExp(`(${t.replace(/^K/,"K\\s?")})`)):[e];return i.jsxs("blockquote",{className:"quote"+(n?" is-ocr":""),children:["“",/^[a-z]/.test(e)?"…":"",r.map((l,s)=>s%2?i.jsx("mark",{children:l},s):i.jsx(_l.Fragment,{children:l},s)),"”"]})}function rh({hop:e}){const t=Et(e);return i.jsxs("span",{className:`status status-${t.key}`,children:[i.jsx("span",{className:"line"}),$e[t.key].label]})}function bc({r:e}){const t=Op(e),n=Zc[So(e)];return i.jsxs("div",{className:"recall","data-attribution":So(e),children:[i.jsxs("div",{className:"recall-h",children:[i.jsx("span",{className:`chip tone-${t}`,children:t==="design"?"Design-related":t==="class1"?"Class I, other cause":"Other cause"}),i.jsx("span",{className:"k mono",children:e.id}),i.jsxs("span",{className:"muted",children:[e.classification||"Unclassified"," · ",e.root_cause||"cause not stated"," · began ",we(e.initiated)]}),e.url&&i.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:"FDA record ↗"})]}),i.jsxs("div",{className:"recall-r",children:[i.jsx("span",{className:`chip tone-${n.tone}`,title:n.text,children:n.short})," ",i.jsx("span",{className:"muted small",children:n.text})]}),e.linked_before_clearance&&i.jsxs("div",{className:"recall-r","data-testid":"recall-predates",children:[i.jsx("span",{className:"chip tone-muted",title:hs.text,children:hs.short})," ",i.jsx("span",{className:"muted small",children:hs.text})]}),e.reason&&i.jsx("div",{className:"recall-r",children:e.reason}),e.status&&i.jsxs("div",{className:"recall-r",children:["Status: ",e.status,e.event?` · event ${e.event}`:"",e.firm?` · ${e.firm}`:""]})]})}function wn(e,t){return t===e.k?{...e.device,k:e.k,gen:0,side:"self"}:e.ancestors.find(n=>n.k===t)&&{...e.ancestors.find(n=>n.k===t),side:"up"}||e.descendants.find(n=>n.k===t)&&{...e.descendants.find(n=>n.k===t),side:"down"}||null}function lh({sel:e,a:t,onClose:n,go:r,reload:l,onSelect:s}){const a=S.useRef(null),o=S.useRef(null);return S.useEffect(()=>{var p;const u=document.activeElement;(p=o.current)==null||p.focus();const c=h=>{if(h.key==="Escape"&&n(),h.key==="Tab"&&a.current){const f=a.current.querySelectorAll('a[href], button:not([disabled]), input, textarea, [tabindex="0"]');if(!f.length)return;const v=f[0],y=f[f.length-1];h.shiftKey&&document.activeElement===v?(h.preventDefault(),y.focus()):!h.shiftKey&&document.activeElement===y&&(h.preventDefault(),v.focus())}};return addEventListener("keydown",c),()=>{var h;removeEventListener("keydown",c),(h=u==null?void 0:u.focus)==null||h.call(u)}},[]),i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"drawer-scrim",onClick:n}),i.jsx("aside",{className:"drawer",ref:a,role:"dialog","aria-modal":"true","aria-labelledby":"drawer-title","data-testid":"provenance",children:e.type==="edge"?i.jsx(sh,{sel:e,a:t,closeBtn:o,onClose:n,go:r,reload:l,onSelect:s}):i.jsx(ih,{sel:e,a:t,closeBtn:o,onClose:n,go:r,onSelect:s})})]})}function di({eyebrow:e,children:t,closeBtn:n,onClose:r}){return i.jsxs("div",{className:"drawer-head",children:[i.jsxs("div",{className:"t",children:[i.jsx("p",{className:"eyebrow",children:e}),i.jsx("h2",{id:"drawer-title",children:t})]}),i.jsx("button",{ref:n,className:"btn btn-quiet",onClick:r,"aria-label":"Close provenance (Escape)",children:"✕"})]})}function sh({sel:e,a:t,closeBtn:n,onClose:r,go:l,reload:s,onSelect:a}){const o=e.hop,u=wn(t,o.src)||{},c=wn(t,o.dst)||{},p=Et(o),[h,f]=S.useState(!1),[v,y]=S.useState(null),x=o.source_url||u.summary_url,C=(o.text_source||u.text_source)&&(o.text_source||u.text_source)!=="pdf_text_layer",g=async d=>{f(!0),y(null);try{const m=await Se.review(o.src,o.dst,d);m!=null&&m.citation&&a({...e,hop:m.citation}),y(m!=null&&m.citation?{ok:!0,text:d?`Recorded: ${d}. The assessment has been recomputed from the graph.`:"Review cleared. The assessment has been recomputed."}:{ok:!1,text:"The review was sent, but the graph did not return the citation. Reopen it to see its current state."}),s()}catch(m){y({ok:!1,text:m.message})}finally{f(!1)}};return i.jsxs(i.Fragment,{children:[i.jsxs(di,{eyebrow:"Citation provenance",closeBtn:n,onClose:r,children:[i.jsx("span",{className:"k",children:o.src})," cites ",i.jsx("span",{className:"k",children:o.dst})]}),i.jsxs("div",{className:"drawer-body",children:[i.jsxs("div",{className:"drawer-sec",children:[i.jsx(rh,{hop:o}),p.reasons.length>0&&i.jsx("ul",{style:{margin:"8px 0 0",paddingLeft:18,color:"var(--ink-2)",fontSize:12.5},children:p.reasons.map(d=>i.jsx("li",{children:Kc[d]||d},d))}),p.key==="conditional"&&i.jsxs("p",{className:"note-box violet",style:{marginTop:10},children:["Recall signals reached through this thread are ",i.jsx("b",{children:"conditional"}),": they hold only if this citation is a predicate. Read the page, then confirm or reject it: your review rewrites the verdict."]})]}),i.jsxs("div",{className:"drawer-sec",children:[i.jsx("h3",{children:"What the summary says"}),i.jsx(Jc,{text:o.quote||o.snippet,k:o.dst,ocr:C})]}),x&&i.jsxs("a",{className:"page-card",href:ci(x,o.page),target:"_blank",rel:"noreferrer","data-testid":"pdf-page-link",children:[i.jsx("span",{className:"sheet",children:i.jsxs("b",{children:["p.",o.page??"?"]})}),i.jsxs("span",{className:"tx",children:[i.jsxs("b",{children:["Open the original FDA PDF",o.page?` at page ${o.page}`:""," ↗"]}),i.jsxs("span",{children:[o.src," 510(k) summary · accessdata.fda.gov"]})]})]}),i.jsxs("div",{className:"drawer-sec",children:[i.jsx("h3",{children:"Source and extraction"}),i.jsxs("dl",{className:"prov-grid",children:[i.jsx("dt",{children:"Citing device"}),i.jsxs("dd",{children:[o.src," · ",qe(u.name,40),u.decision_date?` · ${we(u.decision_date)}`:""]}),i.jsx("dt",{children:"Cited device"}),i.jsxs("dd",{children:[o.dst," · ",qe(c.name,40),c.decision_date?` · ${we(c.decision_date)}`:""]}),i.jsx("dt",{children:"Role"}),i.jsx("dd",{children:o.kind||"predicate"}),i.jsx("dt",{children:"Page"}),i.jsx("dd",{children:o.page??"not recorded"}),i.jsx("dt",{children:"Text source"}),i.jsx("dd",{children:Bp[o.text_source||u.text_source]||o.text_source||u.text_source||"not recorded"}),i.jsx("dt",{children:"Extraction"}),i.jsxs("dd",{children:[o.method||"—",o.confidence!=null?` · confidence ${o.confidence}`:""]}),i.jsx("dt",{children:"Name check"}),i.jsx("dd",{children:o.name_check||"—"}),i.jsx("dt",{children:"FDA panel"}),i.jsx("dd",{children:o.panel_check||"—"}),o.audit&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"Audit"}),i.jsxs("dd",{children:[o.audit,o.audit_note?` — ${o.audit_note}`:""]})]}),o.ai_label&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"LLM label"}),i.jsxs("dd",{children:[o.ai_label,o.ai_model?` · ${o.ai_model}`:""," (advisory; never a verdict input until a person confirms)"]})]}),i.jsx("dt",{children:"Review"}),i.jsx("dd",{"data-testid":"edge-review",children:o.review?`${o.review} by ${o.reviewer||"unknown"}${cr.includes(o.reviewer)?" (automated client; advisory)":Gc(o)?" on an earlier version of the summary; needs re-review":""}`:"not reviewed by a person"}),i.jsx("dt",{children:"Trust"}),i.jsx("dd",{"data-testid":"edge-trust",children:$e[Et(o).key].label}),o.retired_at&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"Retired"}),i.jsxs("dd",{children:[we(o.retired_at)," · no longer cited by the refreshed summary"]})]}),u.summary_sha256&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"PDF SHA-256"}),i.jsx("dd",{children:i.jsx("span",{className:"mono",children:u.summary_sha256})})]})]})]}),i.jsxs("div",{className:"drawer-sec",children:[i.jsx("h3",{children:"Your review"}),i.jsxs("div",{className:"drawer-acts",children:[i.jsx("button",{className:"btn btn-line btn-sm",disabled:h,onClick:()=>g(o.review==="confirmed"&&Ge(o)?"":"confirmed"),children:o.review==="confirmed"&&Ge(o)?"Clear confirmation":"Confirm citation"}),i.jsx("button",{className:"btn btn-line btn-sm",disabled:h,onClick:()=>g(o.review==="rejected"&&Ge(o)?"":"rejected"),children:o.review==="rejected"&&Ge(o)?"Restore citation":"Reject citation"})]}),i.jsx("p",{className:"note",style:{marginTop:8},children:"A review is a write to the Relate graph. Every lineage query, verdict and saved-assessment staleness check reads it immediately."}),v&&i.jsx("p",{className:v.ok?"ok":"err",role:"status",children:v.text})]}),i.jsxs("div",{className:"drawer-acts",children:[i.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>a({type:"node",k:o.dst}),children:[o.dst," record →"]}),i.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>a({type:"node",k:o.src}),children:[o.src," record →"]})]})]})]})}function ih({sel:e,a:t,closeBtn:n,onClose:r,go:l,onSelect:s}){var h,f;const a=wn(t,e.k);if(!a)return i.jsxs(i.Fragment,{children:[i.jsx(di,{eyebrow:"Device",closeBtn:n,onClose:r,children:e.k}),i.jsx("div",{className:"drawer-body",children:"Not in this view."})]});const o=[...a.recalls||[]].sort((v,y)=>y.design_related-v.design_related||(v.initiated||"").localeCompare(y.initiated||"")),u=oa(o),c=a.side==="self"?"Candidate":a.side==="up"?{1:"Direct predicate",2:"Grand-predicate"}[a.gen]||`Generation ${a.gen} ancestor`:`Later device citing this lineage (+${a.gen})`,p=o.filter(v=>v.initiated&&t.device.decision_date&&v.initiated1&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"Route"}),i.jsx("dd",{className:"mono",style:{fontSize:12},children:a.chain.join(" → ")})]})]}),i.jsxs("div",{className:"drawer-acts",children:[a.k!==t.k&&i.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>l("check",a.k),children:["Investigate ",a.k," ",i.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),i.jsx("a",{className:"btn btn-line btn-sm",href:Hc(a.k),target:"_blank",rel:"noreferrer",children:"FDA 510(k) record ↗"}),a.summary_url&&i.jsx("a",{className:"btn btn-line btn-sm",href:a.summary_url,target:"_blank",rel:"noreferrer",children:"Summary PDF ↗"}),a.lineage_known===!1&&i.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>l("ingest",a.k),children:"Try to read its summary"})]}),((f=a.hops)==null?void 0:f.length)>0&&i.jsxs("div",{className:"drawer-sec",children:[i.jsx("h3",{children:"How it is reached"}),i.jsx("div",{className:"tags",children:a.hops.map(v=>i.jsxs("button",{className:"tag-btn",onClick:()=>s({type:"edge",id:v.src+">"+v.dst,hop:v}),children:[i.jsx("span",{className:"k",children:v.src})," → ",i.jsx("span",{className:"k",children:v.dst})," · p.",v.page??"?"," · ",$e[Et(v).key].short]},v.src+v.dst))})]}),i.jsxs("div",{className:"drawer-sec",children:[i.jsxs("h3",{children:["Recall records on which FDA lists this 510(k) · ",u.events," event(s), ",u.records," product record(s)"]}),a.side!=="self"&&p.length>0&&i.jsxs("p",{className:"note-box amber",style:{marginBottom:10},children:[p.length," of these record(s) began before ",t.k," was cleared on ",we(t.device.decision_date),"."]}),o.length===0?i.jsx("p",{className:"muted",children:"openFDA lists this 510(k) on no recall record."}):i.jsx("div",{style:{display:"grid",gap:8},children:o.slice(0,20).map(v=>i.jsx(bc,{r:v},v.id))}),o.length>20&&i.jsxs("p",{className:"muted small",children:["+ ",o.length-20," more record(s): open the device to see all."]})]})]})]})}const ah={rejected_by_reviewer:"rejected by a reviewer",audit_not_predicate:"the audit found it is not a predicate citation",audit_error:"the audit found a K-number error",audit_unresolved:"the audit could not resolve it",not_in_openfda:"K-number not found in openFDA",cleared_after_citing_device:"K-number cleared after the citing device",audit_variant:"audit marked it a naming variant",audit_corrected:"K-number corrected by the audit"};function ed(e){const t=[];for(const n of e.signals)switch(n.code){case"DIRECT_RECALL":if(n.severity==="info")break;t.push({id:n.code,tone:n.severity==="high"?"alert":"amber",sev:n.severity,title:n.title,what:"The candidate itself appears in FDA recall records.",why:n.severity==="high"?"A design-related recall on the device you would cite is what FDA's 2023 draft guidance asks you to avoid or explain.":"A Class I recall on the candidate is a documented question for any submission that cites it.",todo:"Open each recall record and document how it is addressed (scope, lots, corrective action).",node:e.k});break;case"ANCESTOR_RECALL":if(n.severity!=="medium")break;t.push({id:n.code+n.chain.join(),tone:n.conditional?"violet":"amber",sev:n.severity,title:n.title,conditional:n.conditional,what:n.conditional?"The recall holder is reached only through a citation the audit could not resolve.":`A ${n.gen===1?"direct predicate":"grand-predicate"} carries recall records the verdict rules treat as review-worthy.`,why:n.conditional?"If that citation is not a predicate, this recall does not belong to the lineage; if it is, it does.":"Reviewers expect the predicate rationale to address design-related recalls in the lineage (FDA 2023 draft guidance; Kadakia et al., JAMA 2023, an association).",todo:n.conditional?"Open the uncertain thread, read the PDF page, and confirm or reject it.":"Verify the citation on its PDF page, read the recall records, and record how the rationale addresses them.",chain:n.chain,hops:n.evidence.filter(r=>r.type==="citation")});break;case"UNCERTAIN_LINK_IN_LINEAGE":case"NAME_MISMATCH_IN_LINEAGE":t.push({id:n.code,tone:"alert",sev:"info",title:n.title,what:"Threads in this ancestry rest on evidence that conflicts with FDA records or needed correction.",why:"A doubtful thread may route the lineage to the wrong device, and the right one may be missing; these links never count as checked.",todo:"Open each thread, compare the quote with the cited device, then confirm or reject it.",hops:n.evidence.filter(r=>r.type==="citation")});break;case"ADVISORY_LINK_PENDING_REVIEW":t.push({id:n.code,tone:"violet",sev:"info",title:n.title,what:"An LLM label or the automated MCP client calls these citations predicates; no person has decided.",why:"They are not used for the verdict. If one is a real predicate, its recalls belong in the lineage and the verdict could change.",todo:"Open each link, read the PDF page, and confirm or reject it yourself.",hops:n.evidence.filter(r=>r.type==="advisory_citation")});break;case"CITATION_RETIRED_BY_REINGEST":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Re-reading the citing device's FDA summary no longer found these citations, so they were retired from the lineage.",why:"Earlier reviews, labels and provenance are kept for the record; a review made on the old text may no longer apply.",todo:"Compare the refreshed summary with the earlier one and record a new review if the citation still matters.",hops:n.evidence});break;case"PREDICATE_CITATION_UNRESOLVED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Predicate citations printed in a summary did not become lineage threads.",why:"A missing thread means part of the ancestry is invisible: a recall there would not show.",todo:"Check each quote. If the citation is real and the K-number valid, add that clearance to extend the graph.",missing:n.evidence});break;case"LINEAGE_UNKNOWN":case"LINEAGE_TRUNCATED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Some summaries are not machine-readable, so the ancestry stops there.",why:"Recalls further up those branches cannot be seen. The verdict reports this gap; it never fills it in.",todo:"Try reading each summary live (needs internet), which extends the lineage by one generation.",ingest:n.code==="LINEAGE_UNKNOWN"?[{k:e.k}]:n.evidence});break;case"UNATTRIBUTED_RECALLS_IN_PRODUCT_CODE":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"FDA filed these recalls under the product code without naming a 510(k) number.",why:"No lineage query can attribute them; one may still concern a device in this lineage.",todo:"Read the product descriptions and check whether any names a device in this ancestry.",recalls:n.evidence});break;case"RECALL_CAUSE_OR_CLASS_UNKNOWN":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Recall records without a stated root cause or FDA classification.",why:"They cannot be ruled out as design-related or Class I, so they could change the verdict once classified.",todo:"Re-check the FDA records for an updated classification or root cause.",recalls:n.evidence});break;case"DEEPER_ANCESTRY_GAPS":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Gaps beyond the two-generation verdict window.",why:"They cannot change the verdict, but the lower-severity list may be incomplete.",todo:"Expand the graph to deeper generations if the deeper ancestry matters to your rationale."});break}return t}function oh({a:e,onSelect:t,go:n,onFocusChain:r}){const l=ed(e);return l.length?i.jsx("div",{"data-testid":"review-queue",children:l.map(s=>{var a,o,u,c;return i.jsxs("section",{className:`review-item tone-${s.tone}`,onMouseEnter:()=>s.chain&&r(s.chain),onMouseLeave:()=>r(null),children:[i.jsxs("h3",{children:[i.jsx("span",{className:`sev sev-${s.sev}`,children:s.conditional?"conditional":s.sev==="info"?"gap":s.sev}),i.jsx("span",{children:s.title})]}),i.jsxs("dl",{children:[i.jsx("dt",{children:"Conflict"}),i.jsx("dd",{children:s.what}),i.jsx("dt",{children:"Why it matters"}),i.jsx("dd",{children:s.why}),i.jsx("dt",{children:"Next step"}),i.jsx("dd",{children:s.todo})]}),((a=s.hops)==null?void 0:a.length)>0&&i.jsx("div",{className:"links",children:s.hops.slice(0,8).map(p=>{const h=Et(p);return i.jsxs("button",{className:"tag-btn",onClick:()=>t({type:"edge",id:p.src+">"+p.dst,hop:p}),title:h.reasons.map(f=>Kc[f]).join("; ")||$e[h.key].label,children:[i.jsx("span",{className:"k",children:p.src})," → ",i.jsx("span",{className:"k",children:p.dst})," · p.",p.page??"?"," · ",i.jsx("span",{className:`status-${h.key}`,children:$e[h.key].short})]},p.src+p.dst)})}),((o=s.missing)==null?void 0:o.length)>0&&i.jsx("div",{className:"links",children:s.missing.slice(0,8).map(p=>i.jsxs("button",{className:"tag-btn",title:p.quote||"",onClick:()=>n("ingest",p.cited),children:[i.jsx("span",{className:"k",children:p.src})," → ",i.jsx("span",{className:"k",children:p.cited})," · ",ah[p.reason]||p.reason]},p.src+p.cited))}),((u=s.ingest)==null?void 0:u.length)>0&&i.jsx("div",{className:"links",children:s.ingest.slice(0,10).map(p=>i.jsxs("button",{className:"tag-btn",onClick:()=>n("ingest",p.k),children:[i.jsx("span",{className:"k",children:p.k}),p.summary_status?` · ${p.summary_status}`:""," · read now"]},p.k))}),((c=s.recalls)==null?void 0:c.length)>0&&i.jsx("div",{className:"links",children:s.recalls.slice(0,8).map(p=>p.url?i.jsxs("a",{className:"tag-btn",href:p.url,target:"_blank",rel:"noreferrer",children:[p.id," ↗"]},p.id):i.jsx("span",{className:"tag-btn",children:p.id},p.id))}),s.node&&i.jsx("div",{className:"acts",children:i.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:s.node}),children:"Open recall records"})}),s.chain&&i.jsx("div",{className:"acts",children:i.jsxs("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:s.chain[s.chain.length-1]}),children:["Open ",s.chain[s.chain.length-1]," records"]})})]},s.id)})}):i.jsx("p",{className:"muted",children:"Nothing in this lineage needs a person's attention under the current rules."})}function ca(e){const t=e.signals.filter(n=>{var r;return(n.severity==="high"||n.severity==="medium")&&((r=n.chain)==null?void 0:r.length)>1});return t.find(n=>!n.conditional)||t[0]||null}function uh({a:e}){const t=e.device,n=ca(e),r=e.signals.find(l=>l.code==="DIRECT_RECALL"&&l.severity!=="info"&&l.severity!=="low");if(r&&(!n||r.severity==="high")){const l=jl(r.evidence.filter(s=>s.type==="recall"),null);return i.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[i.jsx("span",{className:"k",children:e.k})," itself appears in FDA recall records",l&&i.jsxs(i.Fragment,{children:[": a ",i.jsxs("span",{className:"amber",children:[l.classification||"unclassified"," ",l.root_cause]})," recall began ",we(l.initiated)]}),"."," ","Citing it as a predicate would need that addressed."]})}if(n){const l=wn(e,n.chain[n.chain.length-1]),s=n.evidence.filter(p=>p.type==="recall"),a=jl(s,t.decision_date),o=n.evidence.find(p=>p.type==="citation"&&p.src===e.k),u=a?ua(a.initiated,t.decision_date):null,c=oa(s);return i.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[qe(t.name,48)," cites ",i.jsx("span",{className:"k",children:n.chain[1]}),o!=null&&o.page?i.jsxs(i.Fragment,{children:[" on page ",o.page," of its summary"]}):null,"."," ",n.conditional?i.jsxs(i.Fragment,{children:["The cited device ",i.jsx("span",{className:"k",children:l==null?void 0:l.k}),", reached through a citation the audit could not resolve,"]}):n.chain.length>2?i.jsxs(i.Fragment,{children:["Through it, ",n.gen===2?"grand-predicate":`generation-${n.gen} ancestor`," ",i.jsx("span",{className:"k",children:l==null?void 0:l.k})]}):i.jsx(i.Fragment,{children:"That predicate"})," ","(",qe(l==null?void 0:l.name,52),") is listed by FDA on ",c.events," recall event",c.events===1?"":"s"," in this signal",a&&i.jsxs(i.Fragment,{children:[", including a ",i.jsxs("span",{className:"amber",children:[a.classification||"unclassified"," ",a.root_cause]})," recall that began ",we(a.initiated),u&&i.jsxs(i.Fragment,{children:[", ",u.relation==="before"?i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"amber",children:[u.duration," before"]})," ",e.k," was cleared"]}):Xc(u,e.k)]})]}),".",n.conditional&&i.jsxs(i.Fragment,{children:[" This route is ",i.jsx("b",{style:{color:"var(--violet)"},children:"conditional"}),": it holds only if that citation is a predicate."]})]})}return i.jsx("p",{className:"finding-sentence","data-testid":"finding-sentence",children:e.verdict_reason})}function ch({a:e,onSelect:t}){const n=ca(e);if(!n)return null;const r=n.evidence.filter(c=>c.type==="citation"),l=(c,p)=>{var h,f;return r.find(v=>v.src===c&&v.dst===p)||((f=(h=wn(e,p))==null?void 0:h.hops)==null?void 0:f.find(v=>v.src===c&&v.dst===p))},s=n.chain[n.chain.length-1],a=n.evidence.filter(c=>c.type==="recall"),o=jl(a,e.device.decision_date),u=o?ua(o.initiated,e.device.decision_date):null;return i.jsxs("section",{className:"panel corner-marks","aria-labelledby":"chain-title","data-testid":"critical-chain",children:[i.jsxs("div",{className:"panel-head",children:[i.jsxs("h2",{id:"chain-title",children:["Critical chain ",i.jsx("span",{className:"count",children:"predicate → recall, the route that raised the verdict"})]}),i.jsx("p",{className:"hint",children:"Select a thread for its page and quote."})]}),i.jsx("div",{className:"chain",children:n.chain.map((c,p)=>{const h=wn(e,c)||{},f=p===0?"Candidate":n.conditional?"Cited device · citation unresolved":p===1?"Direct predicate":p===2?"Grand-predicate":`Generation ${p}`,v=c===s,y=v?aa({recalls:a}):"none",x=p>0?l(n.chain[p-1],c):null,C=x?Et(x):null;return i.jsxs(_l.Fragment,{children:[p>0&&i.jsxs("button",{className:`chain-link st-${(C==null?void 0:C.key)||"extracted"}`,onClick:()=>x&&t({type:"edge",id:x.src+">"+x.dst,hop:x}),"aria-label":`${n.chain[p-1]} cites ${c}${x!=null&&x.page?` on page ${x.page}`:""}, ${$e[(C==null?void 0:C.key)||"extracted"].label}. Open provenance.`,children:[i.jsxs("span",{className:"lbl",children:["cites",x!=null&&x.page?` · p.${x.page}`:""]}),i.jsx("span",{className:"sub",children:$e[(C==null?void 0:C.key)||"extracted"].short})]}),i.jsxs("button",{className:`chain-node${p===0?" is-self":""}${y==="design"?" tone-design":""}`,onClick:()=>t({type:"node",k:c}),children:[i.jsx("span",{className:"role",children:f}),i.jsx("span",{className:"k",children:c}),i.jsx("span",{className:"nm",children:qe(h.name,44)}),i.jsxs("span",{className:"dt",children:["Cleared ",we(h.decision_date)]}),v&&o&&i.jsxs("span",{className:"rc",children:[i.jsxs("span",{className:`chip tone-${o.design_related?"design":"class1"}`,children:[o.classification||"Unclassified"," · ",o.root_cause]}),i.jsxs("span",{className:"dt",children:["Recall began ",we(o.initiated)," · ",i.jsx("span",{className:"mono",children:o.id})]})]})]})]},c)})}),o&&u&&i.jsxs("div",{className:"chain-timing",children:[i.jsxs("span",{className:"chip tone-amber",children:[i.jsx("span",{className:"glyph"}),Xc(u,e.k,"chip")]}),i.jsxs("span",{className:"muted",children:[oa(a).events," recall event(s) · ",a.length," product record(s) in this signal. Documentation signal, not a safety finding."]})]})]})}function dh({k:e,go:t,onChanged:n}){var Y,Ze;const[r,l]=S.useState(null),[s,a]=S.useState(null),[o,u]=S.useState(!1),[c,p]=S.useState(4),[h,f]=S.useState(2),[v,y]=S.useState("graph"),[x,C]=S.useState(!1),[g,d]=S.useState(null),[m,w]=S.useState(null),[_,E]=S.useState([]),[j,k]=S.useState([]),R=()=>{u(!0),a(null),Se.assess(e,c).then(F=>{l(F)}).catch(F=>{l(null),a(F.message)}).finally(()=>u(!1)),Se.assessments(e).then(E).catch(()=>E([])),Se.investigations(e,10).then(k).catch(()=>k([]))};if(S.useEffect(()=>{d(null),f(2),R()},[e,c]),s)return i.jsxs("div",{className:"panel",role:"alert",children:[i.jsx("p",{className:"err",style:{fontSize:15},children:s}),s.includes("not in the graph")&&i.jsxs("button",{className:"btn btn-primary",onClick:()=>t("ingest",e),children:["Read ",e," from FDA now ",i.jsx("span",{className:"arr",children:"→"})]})]});if(!r)return i.jsxs("div",{"aria-busy":"true",children:[i.jsxs("div",{className:"loading-thread",children:[i.jsx("i",{}),"Walking ",e,"'s lineage in the Relate graph…"]}),i.jsx("div",{className:"skeleton",style:{height:210,marginBottom:16}}),i.jsx("div",{className:"skeleton",style:{height:160,marginBottom:16}}),i.jsx("div",{className:"skeleton",style:{height:380}})]});const P=r.device,I=r.coverage,K={...Kn[r.verdict],...qc(r.verdict,I.evidence)},me=ed(r).length,Be=r.signals.filter(F=>F.conditional).length;return i.jsxs("div",{className:"investigation","aria-busy":o,children:[i.jsxs("section",{className:`finding tone-${K.tone}`,"aria-labelledby":"finding-title","data-testid":"finding",children:[i.jsxs("div",{className:"finding-top",children:[i.jsxs("div",{className:"finding-id",children:[i.jsxs("div",{className:"kline",children:[i.jsx("span",{className:"k",children:r.k}),i.jsxs("span",{children:[P.product_code,(Y=P.product)!=null&&Y.name?` · ${P.product.name}`:""]})]}),i.jsx("h1",{id:"finding-title",children:P.name}),i.jsxs("div",{className:"meta",children:[i.jsx("span",{children:P.applicant}),i.jsxs("span",{children:["Cleared ",we(P.decision_date)]}),i.jsx("span",{children:P.clearance_type||"510(k)"}),i.jsx("a",{href:Hc(r.k),target:"_blank",rel:"noreferrer",children:"FDA record ↗"}),P.summary_url&&i.jsx("a",{href:P.summary_url,target:"_blank",rel:"noreferrer",children:"510(k) summary PDF ↗"})]})]}),i.jsxs("div",{className:`verdict tone-${K.tone}`,"data-testid":"verdict",children:[i.jsxs("div",{className:"verdict-label",children:[i.jsx("i",{"aria-hidden":"true"}),K.label]}),i.jsx("p",{className:"verdict-reason",children:r.verdict_reason}),i.jsx("div",{className:"verdict-actions",children:i.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t("compare",r.k),children:"Compare with other candidates"})}),i.jsxs("div",{className:"authority",children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:i.jsx("path",{d:"M8 1.5l5.5 2v4.2c0 3.3-2.3 5.8-5.5 6.8-3.2-1-5.5-3.5-5.5-6.8V3.5z M5.5 8l1.8 1.8L10.8 6.3"})}),i.jsxs("span",{children:[i.jsx("b",{children:"Deterministic assessment"})," · ",r.rules_version,". Authoritative within its documented scope: ",I.evidence_scope,", from machine-readable FDA records. A documentation signal, not a safety determination."]})]})]})]}),i.jsx(uh,{a:r}),i.jsxs("div",{className:"coverage-row","aria-label":"Evidence coverage",children:[i.jsxs("span",{className:`chip tone-${I.evidence==="complete"?"calm":I.evidence==="uncertain"?"alert":"muted"}`,title:"Completeness of evidence inside the verdict window",children:["Evidence ",I.evidence]}),(I.evidence_reasons||[]).map(F=>i.jsx("span",{className:"chip tone-muted","data-testid":"evidence-reason",children:Qp[F]||F},F)),i.jsxs("span",{className:"chip",children:[I.ancestors," ancestors · ",I.generations_traversed," generations"]}),I.ancestors_lineage_unknown>0&&i.jsxs("span",{className:"chip tone-muted",children:[I.ancestors_lineage_unknown," with unread summaries"]}),I.doubtful_links>0&&i.jsxs("span",{className:"chip tone-alert",children:[I.doubtful_links," doubtful link(s)"]}),Be>0&&i.jsxs("span",{className:"chip tone-violet",children:[Be," conditional signal(s)"]}),me>0&&i.jsxs("a",{className:"chip tone-blue",href:"#review",onClick:F=>{var T;F.preventDefault(),(T=document.getElementById("review"))==null||T.scrollIntoView({block:"start"})},children:[me," item(s) need human review ↓"]})]})]}),i.jsx(nh,{a:r,onSelect:d}),i.jsx(ch,{a:r,onSelect:d}),i.jsxs("section",{className:"panel","aria-labelledby":"graph-title",children:[i.jsxs("div",{className:"panel-head",children:[i.jsxs("h2",{id:"graph-title",children:["Evidence graph ",i.jsxs("span",{className:"count",children:[r.ancestors.length," ancestors · ",r.descendants.length," later devices"]})]}),i.jsxs("div",{className:"graph-tools",children:[i.jsxs("div",{className:"seg",role:"group","aria-label":"View",children:[i.jsx("button",{"aria-pressed":v==="graph",onClick:()=>y("graph"),children:"Graph"}),i.jsx("button",{"aria-pressed":v==="timeline",onClick:()=>y("timeline"),children:"Timeline"})]}),i.jsxs("label",{className:"small muted",children:["Show ",i.jsx("select",{className:"field",value:h,onChange:F=>f(+F.target.value),"aria-label":"Generations shown",children:Array.from({length:c},(F,T)=>T+1).map(F=>i.jsxs("option",{value:F,children:[F," gen"]},F))})]}),i.jsxs("label",{className:"small muted",children:["Query ",i.jsx("select",{className:"field",value:c,onChange:F=>p(+F.target.value),"aria-label":"Generations traversed by the query",children:[2,3,4,5,6].map(F=>i.jsxs("option",{value:F,children:[F," gen"]},F))})]}),v==="graph"&&r.descendants.length>0&&i.jsxs("button",{className:"btn btn-line btn-sm","aria-pressed":x,onClick:()=>C(!x),children:[x?"Hide":"Show"," later devices"]})]})]}),v==="graph"?i.jsx(Zp,{a:r,depth:h,onDepth:f,descendants:x,selected:g,onSelect:d,focusChain:m}):i.jsx(bp,{a:r,depth:h,highlight:m||((Ze=ca(r))==null?void 0:Ze.chain),onSelect:d}),i.jsxs("p",{className:"graph-hint",children:["By hand, this is ",1+r.ancestors.filter(F=>F.lineage_known).length," summary PDFs opened one generation at a time and ",1+r.ancestors.length," separate recall searches. Here it is one Relate query."]})]}),i.jsxs("div",{className:"grid-main",children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsxs("section",{className:"panel",id:"review","aria-labelledby":"review-title",style:{scrollMarginTop:120},children:[i.jsxs("div",{className:"panel-head",children:[i.jsxs("h2",{id:"review-title",children:["What needs human review ",i.jsx("span",{className:"count",children:me})]}),i.jsx("p",{className:"hint",children:"What conflicts, why it matters, and what to do next."})]}),i.jsx(oh,{a:r,onSelect:d,go:t,onFocusChain:w})]}),i.jsx(fh,{a:r,onSelect:d})]}),i.jsxs("aside",{style:{minWidth:0},children:[i.jsx(hh,{a:r,reload:R,go:t,onSelect:d}),i.jsx(mh,{a:r,onSaved:()=>{Se.assessments(e).then(E),n&&n()}}),i.jsx(vh,{a:r,assessments:_,runs:j,go:t})]})]}),g&&i.jsx(lh,{sel:g,a:r,onClose:()=>d(null),go:(F,T)=>{d(null),t(F,T)},reload:R,onSelect:d})]})}function fh({a:e,onSelect:t}){const n=e.signals.filter(r=>r.severity==="high"||r.severity==="medium"||r.severity==="low");return i.jsxs("section",{className:"panel","aria-labelledby":"signals-title",children:[i.jsxs("div",{className:"panel-head",children:[i.jsxs("h2",{id:"signals-title",children:["Recall signals ",i.jsxs("span",{className:"count",children:[n.length," in the readable ancestry"]})]}),i.jsx("p",{className:"hint",children:"Every recall record behind the verdict, by generation."})]}),n.length===0&&i.jsx("p",{className:"muted",children:"No recall records anywhere in the readable ancestry."}),n.map((r,l)=>i.jsx(ph,{s:r,onSelect:t},l))]})}function ph({s:e,onSelect:t}){var s;const[n,r]=S.useState(e.severity==="high"),l=e.evidence.filter(a=>a.type==="recall");return i.jsxs("div",{className:"signal",children:[i.jsxs("button",{className:"signal-head","aria-expanded":n,onClick:()=>r(!n),children:[i.jsx("span",{className:`sev sev-${e.severity}`,children:e.conditional?"cond.":e.severity}),i.jsx("span",{className:"t",children:e.title}),i.jsx("svg",{className:"chev",width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:i.jsx("path",{d:"M4 2l4 4-4 4",stroke:"currentColor",fill:"none",strokeWidth:"1.5"})})]}),n&&i.jsxs("div",{className:"signal-body",children:[((s=e.chain)==null?void 0:s.length)>1&&i.jsx("div",{className:"tags",children:e.chain.map((a,o)=>i.jsxs(_l.Fragment,{children:[o>0&&i.jsx("span",{className:"muted small","aria-hidden":"true",children:"→"}),i.jsx("button",{className:"tag-btn",onClick:()=>t({type:"node",k:a}),children:i.jsx("span",{className:"k",children:a})})]},a))}),l.slice(0,6).map(a=>i.jsx(bc,{r:a},a.id)),l.length>6&&i.jsxs("p",{className:"muted small",children:["+ ",l.length-6," more record(s): open ",e.chain[e.chain.length-1]," for all."]})]})]})}const Ar=(e,t)=>e.review===t&&Ge(e);function hh({a:e,reload:t,go:n,onSelect:r}){const[l,s]=S.useState(null),[a,o]=S.useState(null),u=async(c,p,h)=>{s(c.dst+h),o(null);try{const f=await p();o(h==="ai"?{ok:!0,text:`LLM labelled ${c.dst} "${f.ai_label}" (${f.model.split("/")[1]}, ${f.seconds}s). Advisory only: it is not used for the verdict until a person confirms the citation.`}:null),t()}catch(f){o({ok:!1,text:f.message})}finally{s(null)}};return i.jsxs("section",{className:"panel","aria-labelledby":"cites-title",children:[i.jsx("div",{className:"panel-head",children:i.jsxs("h2",{id:"cites-title",children:["What ",e.k," cites ",i.jsx("span",{className:"count",children:e.citations.length})]})}),i.jsx("p",{className:"lede",children:"Read from its 510(k) summary. Your review is written to the graph and changes every lineage query."}),e.device.lineage_known===!1&&i.jsxs("p",{className:"note-box",children:["Summary not machine-readable (",e.device.summary_status,")."," ",i.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>n("ingest",e.k),children:"Try reading it now →"})]}),a&&i.jsx("p",{className:a.ok?"ok":"err",role:"status",children:a.text}),e.citations.map(c=>{const p={...c,src:e.k},h=c.in_lineage??c.kind==="predicate",f=Et(p);return i.jsxs("div",{className:"cit"+(c.review==="rejected"&&Ge(c)?" is-rejected":""),children:[i.jsxs("div",{className:"cit-h",children:[i.jsx("button",{className:"k mono",onClick:()=>r({type:"edge",id:e.k+">"+c.dst,hop:p}),children:c.dst}),i.jsx("span",{className:`chip ${c.kind==="predicate"?"tone-blue":"tone-muted"}`,children:c.kind}),h||f.key==="advisory"||f.key==="retired"?i.jsxs("span",{className:`status status-${f.key}`,title:$e[f.key].label,"data-testid":`cit-status-${c.dst}`,children:[i.jsx("span",{className:"line"}),$e[f.key].short]}):i.jsx("span",{className:"status status-rejected",title:"Reference devices and mentions are not lineage links","data-testid":`cit-status-${c.dst}`,children:"Not a lineage link"}),c.ai_label&&i.jsxs("span",{className:"chip tone-violet",title:c.ai_quote,children:["LLM: ",c.ai_label]}),i.jsxs("span",{className:"muted small",children:[qe(c.name,34)," · ",Yc(c.dst_decision_date)]})]}),i.jsx(Jc,{text:c.quote||c.snippet,k:c.dst,ocr:c.text_source&&c.text_source!=="pdf_text_layer"}),i.jsxs("div",{className:"cit-a",children:[i.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(c,()=>Se.review(e.k,c.dst,Ar(c,"confirmed")?"":"confirmed"),"ok"),children:Ar(c,"confirmed")?"Unconfirm":"Confirm"}),i.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(c,()=>Se.review(e.k,c.dst,Ar(c,"rejected")?"":"rejected"),"no"),children:Ar(c,"rejected")?"Restore":"Reject"}),c.kind!=="predicate"&&i.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!!l,onClick:()=>u(c,()=>Se.triage(e.k,c.dst),"ai"),children:l===c.dst+"ai"?"Asking…":"Ask LLM to label"}),i.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>r({type:"edge",id:e.k+">"+c.dst,hop:p}),children:["Provenance · p.",c.page]})]})]},c.dst)})]})}function mh({a:e,onSaved:t}){const[n,r]=S.useState(!1),[l,s]=S.useState(""),[a,o]=S.useState(null),[u,c]=S.useState(!1);S.useEffect(()=>{o(null),r(!1),s("")},[e.k]);const p=async()=>{c(!0);try{const f=await Se.save(e.k,l);o(f),r(!1),s(""),t()}catch(f){o({error:f.message})}finally{c(!1)}},h=e.memo.headline+` +`+s.stack}return{value:e,source:t,stack:l,digest:null}}function cs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Xs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var rp=typeof WeakMap=="function"?WeakMap:Map;function hc(e,t,n){n=nt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){yl||(yl=!0,si=r),Xs(e,t)},n}function mc(e,t,n){n=nt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){Xs(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Xs(e,t),typeof r!="function"&&(wt===null?wt=new Set([this]):wt.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function to(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new rp;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=gp.bind(null,e,t,n),t.then(e,e))}function no(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ro(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=nt(-1,1),t.tag=2,kt(n,t,1))),n.lanes|=1),e)}var lp=at.ReactCurrentOwner,ge=!1;function de(e,t,n,r){t.child=e===null?Hu(t,null,n,r):gn(t,e.child,n,r)}function lo(e,t,n,r,l){n=n.render;var s=t.ref;return fn(t,l),r=Hi(e,t,n,r,s,l),n=Qi(),e!==null&&!ge?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,it(e,t,l)):(W&&n&&Di(t),t.flags|=1,de(e,t,r,l),t.child)}function so(e,t,n,r,l){if(e===null){var s=n.type;return typeof s=="function"&&!ta(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,vc(e,t,s,r,l)):(e=Zr(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&l)){var a=s.memoizedProps;if(n=n.compare,n=n!==null?n:er,n(a,r)&&e.ref===t.ref)return it(e,t,l)}return t.flags|=1,e=Nt(s,r),e.ref=t.ref,e.return=t,t.child=e}function vc(e,t,n,r,l){if(e!==null){var s=e.memoizedProps;if(er(s,r)&&e.ref===t.ref)if(ge=!1,t.pendingProps=r=s,(e.lanes&l)!==0)e.flags&131072&&(ge=!0);else return t.lanes=e.lanes,it(e,t,l)}return qs(e,t,n,r,l)}function gc(e,t,n){var r=t.pendingProps,l=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},O(an,je),je|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,O(an,je),je|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,O(an,je),je|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,O(an,je),je|=r;return de(e,t,l,n),t.child}function yc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function qs(e,t,n,r,l){var s=xe(n)?Vt:ce.current;return s=mn(t,s),fn(t,l),n=Hi(e,t,n,r,s,l),r=Qi(),e!==null&&!ge?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,it(e,t,l)):(W&&r&&Di(t),t.flags|=1,de(e,t,n,l),t.child)}function io(e,t,n,r,l){if(xe(n)){var s=!0;ol(t)}else s=!1;if(fn(t,l),t.stateNode===null)Yr(e,t),pc(t,n,r),Ys(t,n,r,l),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var u=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=ze(c):(c=xe(n)?Vt:ce.current,c=mn(t,c));var p=n.getDerivedStateFromProps,h=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function";h||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||u!==c)&&eo(t,a,r,c),dt=!1;var f=t.memoizedState;a.state=f,pl(t,r,a,l),u=t.memoizedState,o!==r||f!==u||ye.current||dt?(typeof p=="function"&&(Gs(t,n,p,r),u=t.memoizedState),(o=dt||ba(t,n,o,r,f,u,c))?(h||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),a.props=r,a.state=u,a.context=c,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ku(e,t),o=t.memoizedProps,c=t.type===t.elementType?o:Ie(t.type,o),a.props=c,h=t.pendingProps,f=a.context,u=n.contextType,typeof u=="object"&&u!==null?u=ze(u):(u=xe(n)?Vt:ce.current,u=mn(t,u));var v=n.getDerivedStateFromProps;(p=typeof v=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==h||f!==u)&&eo(t,a,r,u),dt=!1,f=t.memoizedState,a.state=f,pl(t,r,a,l);var y=t.memoizedState;o!==h||f!==y||ye.current||dt?(typeof v=="function"&&(Gs(t,n,v,r),y=t.memoizedState),(c=dt||ba(t,n,c,r,f,y,u)||!1)?(p||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,y,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,y,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),a.props=r,a.state=y,a.context=u,r=c):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Zs(e,t,n,r,s,l)}function Zs(e,t,n,r,l,s){yc(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return l&&Qa(t,n,!1),it(e,t,s);r=t.stateNode,lp.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=gn(t,e.child,null,s),t.child=gn(t,null,o,s)):de(e,t,o,s),t.memoizedState=r.state,l&&Qa(t,n,!0),t.child}function xc(e){var t=e.stateNode;t.pendingContext?Ha(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ha(e,t.context,!1),Ui(e,t.containerInfo)}function ao(e,t,n,r,l){return vn(),zi(l),t.flags|=256,de(e,t,n,r),t.child}var Js={dehydrated:null,treeContext:null,retryLane:0};function bs(e){return{baseLanes:e,cachePool:null,transitions:null}}function kc(e,t,n){var r=t.pendingProps,l=B.current,s=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(l&2)!==0),o?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),O(B,l&1),e===null)return Qs(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,s?(r=t.mode,s=t.child,a={mode:"hidden",children:a},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=Ml(a,r,0,null),e=Ut(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=bs(n),t.memoizedState=Js,e):Yi(t,a));if(l=e.memoizedState,l!==null&&(o=l.dehydrated,o!==null))return sp(e,t,a,r,o,l,n);if(s){s=r.fallback,a=t.mode,l=e.child,o=l.sibling;var u={mode:"hidden",children:r.children};return!(a&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=Nt(l,u),r.subtreeFlags=l.subtreeFlags&14680064),o!==null?s=Nt(o,s):(s=Ut(s,a,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,a=e.child.memoizedState,a=a===null?bs(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=e.childLanes&~n,t.memoizedState=Js,r}return s=e.child,e=s.sibling,r=Nt(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Yi(e,t){return t=Ml({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Rr(e,t,n,r){return r!==null&&zi(r),gn(t,e.child,null,n),e=Yi(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sp(e,t,n,r,l,s,a){if(n)return t.flags&256?(t.flags&=-257,r=cs(Error(N(422))),Rr(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,l=t.mode,r=Ml({mode:"visible",children:r.children},l,0,null),s=Ut(s,l,a,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&gn(t,e.child,null,a),t.child.memoizedState=bs(a),t.memoizedState=Js,s);if(!(t.mode&1))return Rr(e,t,a,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var o=r.dgst;return r=o,s=Error(N(419)),r=cs(s,r,void 0),Rr(e,t,a,r)}if(o=(a&e.childLanes)!==0,ge||o){if(r=ne,r!==null){switch(a&-a){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|a)?0:l,l!==0&&l!==s.retryLane&&(s.retryLane=l,st(e,l),Ve(r,e,l,-1))}return ea(),r=cs(Error(N(421))),Rr(e,t,a,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=yp.bind(null,e),l._reactRetry=t,null):(e=s.treeContext,Ne=xt(l.nextSibling),Se=t,W=!0,Oe=null,e!==null&&(Pe[Le++]=et,Pe[Le++]=tt,Pe[Le++]=Wt,et=e.id,tt=e.overflow,Wt=t),t=Yi(t,r.children),t.flags|=4096,t)}function oo(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ks(e.return,t,n)}function ds(e,t,n,r,l){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=l)}function wc(e,t,n){var r=t.pendingProps,l=r.revealOrder,s=r.tail;if(de(e,t,r.children,n),r=B.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&oo(e,n,t);else if(e.tag===19)oo(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(O(B,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&hl(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),ds(t,!1,l,n,s);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&hl(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}ds(t,!0,n,null,s);break;case"together":ds(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Yr(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function it(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ht|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(N(153));if(t.child!==null){for(e=t.child,n=Nt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Nt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ip(e,t,n){switch(t.tag){case 3:xc(t),vn();break;case 5:Gu(t);break;case 1:xe(t.type)&&ol(t);break;case 4:Ui(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;O(dl,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(O(B,B.current&1),t.flags|=128,null):n&t.child.childLanes?kc(e,t,n):(O(B,B.current&1),e=it(e,t,n),e!==null?e.sibling:null);O(B,B.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return wc(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),O(B,B.current),r)break;return null;case 22:case 23:return t.lanes=0,gc(e,t,n)}return it(e,t,n)}var jc,ei,Nc,_c;jc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};ei=function(){};Nc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,At(Xe.current);var s=null;switch(n){case"input":l=js(e,l),r=js(e,r),s=[];break;case"select":l=Q({},l,{value:void 0}),r=Q({},r,{value:void 0}),s=[];break;case"textarea":l=Ss(e,l),r=Ss(e,r),s=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=il)}Cs(n,r);var a;n=null;for(c in l)if(!r.hasOwnProperty(c)&&l.hasOwnProperty(c)&&l[c]!=null)if(c==="style"){var o=l[c];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Gn.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var u=r[c];if(o=l!=null?l[c]:void 0,r.hasOwnProperty(c)&&u!==o&&(u!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in u)u.hasOwnProperty(a)&&o[a]!==u[a]&&(n||(n={}),n[a]=u[a])}else n||(s||(s=[]),s.push(c,n)),n=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(s=s||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(s=s||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Gn.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&U("scroll",e),s||o===u||(s=[])):(s=s||[]).push(c,u))}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};_c=function(e,t,n,r){n!==r&&(t.flags|=4)};function Rn(e,t){if(!W)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ae(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ap(e,t,n){var r=t.pendingProps;switch($i(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ae(t),null;case 1:return xe(t.type)&&al(),ae(t),null;case 3:return r=t.stateNode,yn(),V(ye),V(ce),Wi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Pr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Oe!==null&&(oi(Oe),Oe=null))),ei(e,t),ae(t),null;case 5:Vi(t);var l=At(sr.current);if(n=t.type,e!==null&&t.stateNode!=null)Nc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(N(166));return ae(t),null}if(e=At(Xe.current),Pr(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Ke]=t,r[rr]=s,e=(t.mode&1)!==0,n){case"dialog":U("cancel",r),U("close",r);break;case"iframe":case"object":case"embed":U("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Ke]=t,e[rr]=r,jc(e,t,!1,!1),t.stateNode=e;e:{switch(a=Ts(n,r),n){case"dialog":U("cancel",e),U("close",e),l=r;break;case"iframe":case"object":case"embed":U("load",e),l=r;break;case"video":case"audio":for(l=0;lkn&&(t.flags|=128,r=!0,Rn(s,!1),t.lanes=4194304)}else{if(!r)if(e=hl(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rn(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!W)return ae(t),null}else 2*q()-s.renderingStartTime>kn&&n!==1073741824&&(t.flags|=128,r=!0,Rn(s,!1),t.lanes=4194304);s.isBackwards?(a.sibling=t.child,t.child=a):(n=s.last,n!==null?n.sibling=a:t.child=a,s.last=a)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=q(),t.sibling=null,n=B.current,O(B,r?n&1|2:n&1),t):(ae(t),null);case 22:case 23:return bi(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?je&1073741824&&(ae(t),t.subtreeFlags&6&&(t.flags|=8192)):ae(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function op(e,t){switch($i(t),t.tag){case 1:return xe(t.type)&&al(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yn(),V(ye),V(ce),Wi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Vi(t),null;case 13:if(V(B),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(B),null;case 4:return yn(),null;case 10:return Ii(t.type._context),null;case 22:case 23:return bi(),null;case 24:return null;default:return null}}var Dr=!1,ue=!1,up=typeof WeakSet=="function"?WeakSet:Set,L=null;function sn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){G(e,t,r)}else n.current=null}function ti(e,t,n){try{n()}catch(r){G(e,t,r)}}var uo=!1;function cp(e,t){if(As=rl,e=Pu(),Ri(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,o=-1,u=-1,c=0,p=0,h=e,f=null;t:for(;;){for(var v;h!==n||l!==0&&h.nodeType!==3||(o=a+l),h!==s||r!==0&&h.nodeType!==3||(u=a+r),h.nodeType===3&&(a+=h.nodeValue.length),(v=h.firstChild)!==null;)f=h,h=v;for(;;){if(h===e)break t;if(f===n&&++c===l&&(o=a),f===s&&++p===r&&(u=a),(v=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=v}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Os={focusedElem:e,selectionRange:n},rl=!1,L=t;L!==null;)if(t=L,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,L=e;else for(;L!==null;){t=L;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var x=y.memoizedProps,C=y.memoizedState,g=t.stateNode,d=g.getSnapshotBeforeUpdate(t.elementType===t.type?x:Ie(t.type,x),C);g.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(w){G(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,L=e;break}L=t.return}return y=uo,uo=!1,y}function Bn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var s=l.destroy;l.destroy=void 0,s!==void 0&&ti(t,n,s)}l=l.next}while(l!==r)}}function zl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ni(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Sc(e){var t=e.alternate;t!==null&&(e.alternate=null,Sc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ke],delete t[rr],delete t[Ws],delete t[Kf],delete t[Gf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function co(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ri(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=il));else if(r!==4&&(e=e.child,e!==null))for(ri(e,t,n),e=e.sibling;e!==null;)ri(e,t,n),e=e.sibling}function li(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(li(e,t,n),e=e.sibling;e!==null;)li(e,t,n),e=e.sibling}var re=null,Ae=!1;function ot(e,t,n){for(n=n.child;n!==null;)Cc(e,t,n),n=n.sibling}function Cc(e,t,n){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(El,n)}catch{}switch(n.tag){case 5:ue||sn(n,t);case 6:var r=re,l=Ae;re=null,ot(e,t,n),re=r,Ae=l,re!==null&&(Ae?(e=re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):re.removeChild(n.stateNode));break;case 18:re!==null&&(Ae?(e=re,n=n.stateNode,e.nodeType===8?ls(e.parentNode,n):e.nodeType===1&&ls(e,n),Jn(e)):ls(re,n.stateNode));break;case 4:r=re,l=Ae,re=n.stateNode.containerInfo,Ae=!0,ot(e,t,n),re=r,Ae=l;break;case 0:case 11:case 14:case 15:if(!ue&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var s=l,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&ti(n,t,a),l=l.next}while(l!==r)}ot(e,t,n);break;case 1:if(!ue&&(sn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){G(n,t,o)}ot(e,t,n);break;case 21:ot(e,t,n);break;case 22:n.mode&1?(ue=(r=ue)||n.memoizedState!==null,ot(e,t,n),ue=r):ot(e,t,n);break;default:ot(e,t,n)}}function fo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new up),t.forEach(function(r){var l=xp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Me(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=a),r&=~s}if(r=l,r=q()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*fp(r/1960))-r,10e?16:e,mt===null)var r=!1;else{if(e=mt,mt=null,xl=0,M&6)throw Error(N(331));var l=M;for(M|=4,L=e.current;L!==null;){var s=L,a=s.child;if(L.flags&16){var o=s.deletions;if(o!==null){for(var u=0;uq()-Zi?Ot(e,0):qi|=n),ke(e,t)}function Fc(e,t){t===0&&(e.mode&1?(t=Nr,Nr<<=1,!(Nr&130023424)&&(Nr=4194304)):t=1);var n=fe();e=st(e,t),e!==null&&(fr(e,t,n),ke(e,n))}function yp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Fc(e,n)}function xp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(t),Fc(e,n)}var Mc;Mc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ye.current)ge=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ge=!1,ip(e,t,n);ge=!!(e.flags&131072)}else ge=!1,W&&t.flags&1048576&&Uu(t,cl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yr(e,t),e=t.pendingProps;var l=mn(t,ce.current);fn(t,n),l=Hi(null,t,r,e,l,n);var s=Qi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xe(r)?(s=!0,ol(t)):s=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Oi(t),l.updater=$l,t.stateNode=l,l._reactInternals=t,Ys(t,r,e,n),t=Zs(null,t,r,!0,s,n)):(t.tag=0,W&&s&&Di(t),de(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=wp(r),e=Ie(r,e),l){case 0:t=qs(null,t,r,e,n);break e;case 1:t=io(null,t,r,e,n);break e;case 11:t=lo(null,t,r,e,n);break e;case 14:t=so(null,t,r,Ie(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),qs(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),io(e,t,r,l,n);case 3:e:{if(xc(t),e===null)throw Error(N(387));r=t.pendingProps,s=t.memoizedState,l=s.element,Ku(e,t),pl(t,r,null,n);var a=t.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){l=xn(Error(N(423)),t),t=ao(e,t,r,n,l);break e}else if(r!==l){l=xn(Error(N(424)),t),t=ao(e,t,r,n,l);break e}else for(Ne=xt(t.stateNode.containerInfo.firstChild),Se=t,W=!0,Oe=null,n=Hu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vn(),r===l){t=it(e,t,n);break e}de(e,t,r,n)}t=t.child}return t;case 5:return Gu(t),e===null&&Qs(t),r=t.type,l=t.pendingProps,s=e!==null?e.memoizedProps:null,a=l.children,Us(r,l)?a=null:s!==null&&Us(r,s)&&(t.flags|=32),yc(e,t),de(e,t,a,n),t.child;case 6:return e===null&&Qs(t),null;case 13:return kc(e,t,n);case 4:return Ui(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gn(t,null,r,n):de(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),lo(e,t,r,l,n);case 7:return de(e,t,t.pendingProps,n),t.child;case 8:return de(e,t,t.pendingProps.children,n),t.child;case 12:return de(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,s=t.memoizedProps,a=l.value,O(dl,r._currentValue),r._currentValue=a,s!==null)if(We(s.value,a)){if(s.children===l.children&&!ye.current){t=it(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var u=o.firstContext;u!==null;){if(u.context===r){if(s.tag===1){u=nt(-1,n&-n),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?u.next=u:(u.next=p.next,p.next=u),c.pending=u}}s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Ks(s.return,n,t),o.lanes|=n;break}u=u.next}}else if(s.tag===10)a=s.type===t.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(N(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),Ks(a,n,t),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===t){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}de(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,fn(t,n),l=ze(l),r=r(l),t.flags|=1,de(e,t,r,n),t.child;case 14:return r=t.type,l=Ie(r,t.pendingProps),l=Ie(r.type,l),so(e,t,r,l,n);case 15:return vc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),Yr(e,t),t.tag=1,xe(r)?(e=!0,ol(t)):e=!1,fn(t,n),pc(t,r,l),Ys(t,r,l,n),Zs(null,t,r,!0,e,n);case 19:return wc(e,t,n);case 22:return gc(e,t,n)}throw Error(N(156,t.tag))};function Ic(e,t){return cu(e,t)}function kp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Re(e,t,n,r){return new kp(e,t,n,r)}function ta(e){return e=e.prototype,!(!e||!e.isReactComponent)}function wp(e){if(typeof e=="function")return ta(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ki)return 11;if(e===wi)return 14}return 2}function Nt(e,t){var n=e.alternate;return n===null?(n=Re(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Zr(e,t,n,r,l,s){var a=2;if(r=e,typeof e=="function")ta(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case qt:return Ut(n.children,l,s,t);case xi:a=8,l|=8;break;case ys:return e=Re(12,n,t,l|2),e.elementType=ys,e.lanes=s,e;case xs:return e=Re(13,n,t,l),e.elementType=xs,e.lanes=s,e;case ks:return e=Re(19,n,t,l),e.elementType=ks,e.lanes=s,e;case Go:return Ml(n,l,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Qo:a=10;break e;case Ko:a=9;break e;case ki:a=11;break e;case wi:a=14;break e;case ct:a=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Re(a,n,t,l),t.elementType=e,t.type=r,t.lanes=s,t}function Ut(e,t,n,r){return e=Re(7,e,r,t),e.lanes=n,e}function Ml(e,t,n,r){return e=Re(22,e,r,t),e.elementType=Go,e.lanes=n,e.stateNode={isHidden:!1},e}function fs(e,t,n){return e=Re(6,e,null,t),e.lanes=n,e}function ps(e,t,n){return t=Re(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function jp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gl(0),this.expirationTimes=Gl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function na(e,t,n,r,l,s,a,o,u){return e=new jp(e,t,n,o,u),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Re(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Oi(s),e}function Np(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Vc)}catch(e){console.error(e)}}Vc(),Vo.exports=Ce;var Wc=Vo.exports,Bc,ko=Wc;Bc=ko.createRoot,ko.hydrateRoot;const Tp="modulepreload",Pp=function(e){return"/"+e},wo={},Ft=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));l=Promise.allSettled(n.map(u=>{if(u=Pp(u),u in wo)return;wo[u]=!0;const c=u.endsWith(".css"),p=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":Tp,c||(h.as="script"),h.crossOrigin="",h.href=u,o&&h.setAttribute("nonce",o),document.head.appendChild(h),c)return new Promise((f,v)=>{h.addEventListener("load",f),h.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return l.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return t().catch(s)})};async function oe(e,t={}){const n=await fetch(e,{headers:{"content-type":"application/json"},...t,body:t.body?JSON.stringify(t.body):void 0});let r=null;try{r=await n.json()}catch{}if(!n.ok){const l=r!=null&&r.detail?typeof r.detail=="string"?r.detail:JSON.stringify(r.detail):`HTTP ${n.status}`;throw new Error(l)}return r}const _e={stats:()=>oe("/api/stats"),search:e=>oe(`/api/search?q=${encodeURIComponent(e)}`),assess:(e,t=4)=>oe(`/api/assess/${e}?depth=${t}`),compare:e=>oe("/api/compare",{method:"POST",body:{ks:e}}),recallEvent:e=>oe(`/api/recall-event/${e}`),watchlist:()=>oe("/api/watchlist"),ingest:(e,t=!1)=>oe("/api/ingest",{method:"POST",body:{k:e,refresh:t}}),review:(e,t,n,r)=>oe("/api/citation/review",{method:"POST",body:{src:e,dst:t,status:n,note:r}}),triage:(e,t)=>oe("/api/citation/triage",{method:"POST",body:{src:e,dst:t}}),save:(e,t,n)=>oe("/api/assessments",{method:"POST",body:{k:e,note:t,depth:n}}),assessments:e=>oe(`/api/assessments${e?`?k=${e}`:""}`),investigations:(e,t=30)=>oe(`/api/investigations?limit=${t}${e?`&k=${e}`:""}`),investigation:e=>oe(`/api/investigations/${e}`),startInvestigation:(e,t,n="auto")=>oe("/api/investigations",{method:"POST",body:{k:e,request:t,mode:n}}),proposals:e=>oe(`/api/proposals${e?`?status=${e}`:""}`),decide:(e,t,n,r)=>oe(`/api/proposals/${e}/decision`,{method:"POST",body:{decision:t,reviewer:n,human:!0,note:r}})},Hc=e=>`https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID=${e}`,Lp=(e,t=!0)=>`/api/investigations/${e}/report${t?"?format=markdown":""}`,ui={nodes:[{id:"a",x:11,y:7,r:3.6},{id:"b",x:27,y:7,r:2.8},{id:"c",x:11,y:19,r:3},{id:"d",x:23,y:19,r:2.6},{id:"e",x:11,y:31,r:3.4,past:!0}],threads:[["a","b"],["a","c"],["c","d"],["c","e"]]},Fr=Object.fromEntries(ui.nodes.map(e=>[e.id,e]));function Qc({size:e=28,className:t="",title:n}){return i.jsxs("svg",{className:"mark "+t,width:e,height:e,viewBox:"0 0 38 38",role:n?"img":void 0,"aria-hidden":n?void 0:!0,"aria-label":n,children:[ui.threads.map(([r,l],s)=>i.jsx("line",{className:`mark-thread t${s}`,x1:Fr[r].x,y1:Fr[r].y,x2:Fr[l].x,y2:Fr[l].y,pathLength:"1"},s)),ui.nodes.map((r,l)=>i.jsx("circle",{className:`mark-node n${l}${r.past?" past":""}`,cx:r.x,cy:r.y,r:r.r},r.id))]})}function Rp({size:e=28,className:t=""}){return i.jsxs("span",{className:"wordmark "+t,children:[i.jsx(Qc,{size:e}),i.jsx("span",{className:"wordmark-name",children:"Forebear"})]})}const ia="forebear:intro",Dp=3e3,jo=2450;function $p(){try{return!!sessionStorage.getItem(ia)}catch{return!0}}function zp(){try{sessionStorage.setItem(ia,"seen")}catch{}}function Fp(){try{sessionStorage.removeItem(ia)}catch{}}function Mp({onDone:e}){const[t,n]=_.useState(!1),r=_.useRef(!1),l=_.useRef(null),s=()=>{r.current||(r.current=!0,zp(),n(!0),e())};_.useEffect(()=>{var h;const c=setTimeout(s,jo),p=f=>{(f.key==="Escape"||f.key==="Enter"||f.key===" ")&&(f.preventDefault(),s())};return addEventListener("keydown",p),(h=l.current)==null||h.focus({preventScroll:!0}),()=>{clearTimeout(c),removeEventListener("keydown",p)}},[]);const[a,o]=_.useState(!1);if(_.useEffect(()=>{if(!t)return;const c=setTimeout(()=>o(!0),Dp-jo+100);return()=>clearTimeout(c)},[t]),a)return null;const u="Forebear".split("");return i.jsxs("div",{className:"intro"+(t?" is-leaving":""),"data-testid":"intro",onClick:s,role:"dialog","aria-modal":"true","aria-label":"Forebear opening",children:[i.jsxs("div",{className:"intro-lockup","aria-hidden":"true",children:[i.jsx(Qc,{className:"intro-mark",size:116}),i.jsx("div",{className:"intro-word",children:u.map((c,p)=>i.jsx("span",{style:{animationDelay:`${.95+p*.045}s`},children:c},p))}),i.jsx("p",{className:"intro-tag",children:i.jsxs("span",{children:["Every clearance has ",i.jsx("em",{children:"a past."})]})})]}),i.jsx("span",{className:"sr-only",role:"status",children:"Forebear. Every clearance has a past."}),i.jsxs("button",{ref:l,className:"btn btn-line btn-sm intro-skip",onClick:c=>{c.stopPropagation(),s()},children:["Skip intro ",i.jsx("span",{"aria-hidden":"true",children:"→"})]})]})}function Ip(e){const[t,n]=_.useState(()=>typeof matchMedia<"u"&&matchMedia(e).matches);return _.useEffect(()=>{const r=matchMedia(e),l=()=>n(r.matches);return l(),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[e]),t}const cr=["mcp-client"],Kn={DESIGN_RECALL_ON_FILE:{tone:"alert",label:"Design-related recall on file",plain:"The candidate itself has a design-related recall on file."},REVIEW_LINEAGE:{tone:"amber",label:"Review lineage",plain:"A recall in the predicate lineage warrants documented review."},INSUFFICIENT_LINEAGE:{tone:"muted",label:"Lineage not checkable",plain:"The ancestry could not be checked from readable evidence."},NO_DESIGN_RECALL_SIGNAL:{tone:"calm",label:"No design-recall signal",plain:"No design-related recall in the readable verdict window. Not a safety finding."}},Kc={audit_unresolved:"The extraction audit could not resolve whether this is the predicate",audit_correction:"K-number supplied by the audit, not as printed in the PDF",name_mismatch:"The cited device's FDA name does not appear near the citation",different_fda_panel:"Cited device sits in a different FDA review panel",llm_label_only:"A predicate only because an LLM labelled the mention",client_confirmation_only:"Confirmed only through the automated MCP client, not a person",client_rejection_pending:"Rejected through the automated MCP client; kept until a person decides",review_outdated:"A person reviewed an earlier version of the FDA summary; it needs re-review"};function Ap(e){if(!e)return[];if(e.review==="confirmed"&&Ge(e))return[];const t=[];return Gc(e)&&t.push("review_outdated"),e.audit==="unresolved"&&t.push("audit_unresolved"),e.audit==="corrected"&&t.push("audit_correction"),e.name_check==="mismatch"&&!["variant","corrected"].includes(e.audit)&&t.push("name_mismatch"),e.panel_check==="different"&&!["variant","corrected"].includes(e.audit)&&t.push("different_fda_panel"),e.kind!=null&&e.kind!=="predicate"&&e.ai_label==="predicate"&&t.push("llm_label_only"),e.kind!=null&&e.kind!=="predicate"&&e.review==="confirmed"&&cr.includes(e.reviewer)&&t.push("client_confirmation_only"),e.review==="rejected"&&cr.includes(e.reviewer)&&t.push("client_rejection_pending"),t}const Ge=e=>!!(e!=null&&e.review)&&!cr.includes(e.reviewer)&&(e.reviewed_source_sha256||"")===(e.source_sha256||""),Gc=e=>!!(e!=null&&e.review)&&!cr.includes(e.reviewer)&&!Ge(e),$e={confirmed:{label:"Confirmed by a person",short:"Confirmed"},extracted:{label:"Machine-extracted",short:"Extracted"},disputed:{label:"Disputed evidence",short:"Disputed"},conditional:{label:"Conditional route",short:"Conditional"},rejected:{label:"Rejected by a person",short:"Rejected"},advisory:{label:"Advisory: suggested by an LLM or the MCP client, awaiting a person; not a verdict input",short:"Advisory"},retired:{label:"Retired: the refreshed FDA summary no longer cites it; kept for the record",short:"Retired"}};function Et(e){if(e!=null&&e.retired_at||(e==null?void 0:e.trust)==="retired")return{key:"retired",reasons:[]};if((e==null?void 0:e.review)==="rejected"&&Ge(e))return{key:"rejected",reasons:[]};if(e!=null&&e.advisory||(e==null?void 0:e.trust)==="advisory")return{key:"advisory",reasons:[]};const t=Ap(e);return t.includes("audit_unresolved")?{key:"conditional",reasons:t}:t.length?{key:"disputed",reasons:t}:(e==null?void 0:e.review)==="confirmed"&&Ge(e)?{key:"confirmed",reasons:t}:{key:"extracted",reasons:t}}function Op(e){return e.design_related?"design":e.classification==="Class I"?"class1":"other"}function aa(e){const t=e.recalls||[];return t.some(n=>n.design_related)?"design":t.length?"recall":"clean"}function oa(e){return{events:new Set(e.map(n=>n.event||n.id)).size,records:e.length}}const Up=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function we(e){if(!e)return"—";const[t,n,r]=String(e).slice(0,10).split("-").map(Number);return t?`${r} ${Up[(n||1)-1]} ${t}`:String(e)}const Yc=e=>e?String(e).slice(0,4):"";function No(e,t){if(!e||!t)return null;const[n,r,l]=e.slice(0,10).split("-").map(Number),[s,a,o]=t.slice(0,10).split("-").map(Number);return(s-n)*12+(a-r)-(or?1:0}function ua(e,t){const n=Vp(e,t);if(n==null)return null;if(n===0)return{relation:"same-day",months:0,duration:""};const r=n<0?No(e,t):No(t,e);return{relation:n<0?"before":"after",months:r,duration:Wp(r)}}function Xc(e,t,n="clause"){if(!e)return"";const{relation:r,duration:l}=e;return n==="chip"?r==="same-day"?`Recall began on the day of ${t}'s clearance`:`Recall began ${l} ${r} ${t}'s clearance`:r==="same-day"?`on the day ${t} was cleared`:`${l} ${r} ${t} was cleared`}function Wp(e){if(e==null)return"";const t=e<0,n=Math.abs(e),r=Math.floor(n/12),l=n%12,s=[r?`${r} yr`:"",l?`${l} mo`:""].filter(Boolean).join(" ")||"<1 mo";return t?`-${s}`:s}function jl(e,t){const n=e.filter(s=>s.design_related),r=n.length?n:e.filter(s=>s.classification==="Class I");return r.filter(s=>s.initiated&&t&&s.initiateds.initiated.localeCompare(a.initiated))[0]||[...r].sort((s,a)=>(a.initiated||"").localeCompare(s.initiated||""))[0]||null}const ci=(e,t)=>e?t?`${e}#page=${t}`:e:null,Bp={pdf_text_layer:"PDF text layer",ocr:"Local OCR of the scanned PDF",embedded_pdf_attachment:"Summary embedded in a PDF Portfolio"};function qe(e,t=30){const n=(e||"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function Hp(e,t){return e==="NO_DESIGN_RECALL_SIGNAL"&&t!=="complete"}function qc(e,t){const n=Kn[e];return n?Hp(e,t)?{tone:"muted",label:`${n.label} · provisional`,provisional:!0}:{tone:n.tone,label:n.label,provisional:!1}:{tone:"muted",label:e||"Unknown",provisional:!1}}const Ph={complete:"calm",partial:"amber",uncertain:"alert",none:"muted"},Qp={direct_predicate_links_all_uncertain:"every direct predicate link rests on uncertain evidence",unresolved_predicate_citations:"predicate citations within two generations could not be resolved",direct_predicate_summaries_unread:"a direct predicate's own summary was not read",doubtful_links_in_window:"links within two generations rest on doubtful evidence",recall_cause_or_class_unknown:"a recall has no stated cause or FDA class",unattributed_recalls_in_product_code:"design-related recalls in the product code name no 510(k)",shallow_traversal:"grand-predicates were not traversed",advisory_links_pending_review:"predicate links suggested only by an LLM or the MCP client await a person",human_confirmed_citation_retired:"a citation a person confirmed is no longer in the refreshed FDA summary"},Zc={name_token_match:{short:"FDA-listed · name match (heuristic)",tone:"other",text:"FDA lists this 510(k) on the recall. A distinctive word of its FDA device name appears in the recall text, possibly as a fuzzy match. This heuristic does not verify that the recall names this exact model."},name_token_absent:{short:"FDA-listed · name not found (heuristic)",tone:"muted",text:"FDA lists this 510(k) on the recall, but no distinctive word of its FDA device name was found in the recall text. The recalled model may differ, or the text may name it differently."},name_not_checkable:{short:"FDA-listed · name not checked",tone:"muted",text:"FDA lists this 510(k) on the recall. No name check is available: its FDA device name has no distinctive word to look for, or no check was recorded for this link. Which model was recalled is not established here."}},hs={short:"Recall began before this clearance",text:"This recall began before this 510(k) was cleared, yet FDA lists it on the record. The dates alone do not establish whether this cleared model was affected: read the FDA record."},Lh={after:"cleared after the recall began",before:"cleared before the recall began",same_day:"cleared the day the recall began (order unknown)",unknown:"timing unknown (a date is missing)"};function _o(e){return e!=null&&e.attribution&&Zc[e.attribution]?e.attribution:(e==null?void 0:e.link_name_check)==="match"?"name_token_match":(e==null?void 0:e.link_name_check)==="mismatch"?"name_token_absent":"name_not_checkable"}const ms=70,Mr=110,So=46,Kp=62,Gp=190,Eo=300;function Yp(e){return e.signals.filter(t=>{var n;return(t.severity==="high"||t.severity==="medium")&&((n=t.chain)==null?void 0:n.length)>1}).map(t=>t.chain)}function Xp(e,{depth:t,descendants:n}){const r=new Map,l=Yp(e),s=new Set(l.flat()),a=new Set;l.forEach(h=>h.slice(1).forEach((f,v)=>a.add(h[v]+">"+f))),r.set(e.k,{...e.device,k:e.k,gen:0,side:"self",recalls:e.device.recalls||[]});let o=0,u=new Set;for(const h of e.ancestors)h.gen<=t||s.has(h.k)?r.set(h.k,{...h,side:"up"}):(o++,u.add(h.gen));if(n)for(const h of e.descendants)r.set(h.k,{...h,side:"down"});const c=new Map,p=h=>{for(const f of h||[]){if(!r.has(f.src)||!r.has(f.dst))continue;const v=f.src+">"+f.dst;c.has(v)||c.set(v,{id:v,hop:f,status:Et(f),critical:a.has(v)})}};for(const h of e.ancestors)r.has(h.k)&&p(h.hops);if(n)for(const h of e.descendants)p(h.hops);return{nodes:r,edges:c,hidden:o,hiddenGens:[...u].sort(),critK:s,critE:a}}function qp(e,t){var E;const{nodes:n,edges:r}=e,l=new Map;for(const j of n.values())((E=j.chain)==null?void 0:E.length)>1&&l.set(j.k,j.chain[j.chain.length-2]);const s=[...n.values()].filter(j=>j.side==="up").map(j=>j.gen),a=[...n.values()].filter(j=>j.side==="down").map(j=>j.gen),o=s.length?Math.max(...s):0,u=a.length?Math.max(...a):0,c=j=>j.side==="self"?o:j.side==="up"?o-j.gen:o+j.gen,p=new Map;for(const j of n.values()){const k=c(j);p.has(k)||p.set(k,[]),p.get(k).push(j)}const h=new Map([[[...n.values()].find(j=>j.side==="self").k,0]]),f=[...p.keys()].sort((j,k)=>Math.abs(j-o)-Math.abs(k-o)),v=Math.max(...[...p.values()].map(j=>j.length));for(const j of f){const k=p.get(j);k.sort((R,P)=>{const I=h.get(l.get(R.k))??0,K=h.get(l.get(P.k))??0;return I-K||(P.decision_date||"").localeCompare(R.decision_date||"")}),k.forEach((R,P)=>{R.side!=="self"&&h.set(R.k,(P-(k.length-1)/2)*ms)})}const y=o+u,x=y?Math.max(Gp,Math.min(Eo,(t-Mr*2)/y)):Eo,C=Math.max(t,Mr*2+y*x),g=Mr+(C-(Mr*2+y*x))/2,d=So+Kp+Math.max(1,v)*ms,m=So+Math.max(1,v)*ms/2,w=new Map([...n.values()].map(j=>[j.k,{x:g+c(j)*x,y:m+h.get(j.k)}])),S=[...p.keys()].map(j=>{const k=j-o;return{x:g+j*x,label:k===0?"Candidate":k<0?k===-1?"Predicates":k===-2?"Grand-predicates":`Generation ${-k}`:`Cites it · +${k}`}});return{pos:w,width:C,height:d,colLabels:S,edges:r}}function Zp({a:e,depth:t,onDepth:n,descendants:r,selected:l,onSelect:s,focusChain:a}){const o=_.useMemo(()=>Xp(e,{depth:t,descendants:r}),[e,t,r]),u=_.useRef(null),[c,p]=_.useState(900);_.useEffect(()=>{const d=()=>u.current&&p(u.current.clientWidth);d();const m=new ResizeObserver(d);return m.observe(u.current),()=>m.disconnect()},[]);const h=_.useMemo(()=>qp(o,c),[o,c]),[f,v]=_.useState(null);_.useEffect(()=>{const d=u.current;d&&(d.scrollLeft=d.scrollWidth)},[e.k,h.width]);const y=_.useMemo(()=>{const d=f||null;if(!d)return a?new Set(a):null;const m=o.nodes.get(d);return new Set((m==null?void 0:m.chain)||[d])},[f,o,a]),x=d=>{if(!y)return!0;const[m,w]=d.split(">");return y.has(m)&&y.has(w)},C=d=>{const m=d.recalls||[],w=m.filter(S=>S.design_related).length;return`${d.k}, ${d.name||"unnamed"}, cleared ${d.decision_date||"date unknown"}. `+(d.side==="self"?"Candidate. ":d.side==="up"?`Generation ${d.gen} predicate. `:`Cites the candidate, ${d.gen} generation(s) later. `)+(m.length?`${m.length} recall record(s), ${w} design-related. `:"No recall records. ")+(d.lineage_known===!1?"Its own predicates were not read.":"")},g=d=>m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),d())};return i.jsxs("div",{children:[i.jsx("div",{className:"graph-wrap",ref:u,"data-testid":"evidence-graph",children:i.jsxs("svg",{width:h.width,height:h.height,role:"group","aria-label":`Predicate lineage graph for ${e.k}: ${o.nodes.size} devices, ${o.edges.size} citations`,children:[h.colLabels.map(d=>i.jsxs("g",{children:[i.jsx("line",{className:"g-col-rule",x1:d.x,x2:d.x,y1:30,y2:h.height-10}),i.jsx("text",{className:"g-col-label",x:d.x,y:20,textAnchor:"middle",children:d.label})]},d.x)),[...o.edges.values()].map(d=>{const m=h.pos.get(d.hop.src),w=h.pos.get(d.hop.dst),S=(m.x+w.x)/2,E=`M${m.x-12},${m.y} C${S},${m.y} ${S},${w.y} ${w.x+12},${w.y}`,j=d.status.key,k=!x(d.id),R=(l==null?void 0:l.type)==="edge"&&l.id===d.id;return i.jsxs("g",{className:"g-edge-g",tabIndex:0,role:"button","aria-label":`Citation: ${d.hop.src} cites ${d.hop.dst}${d.hop.page?`, page ${d.hop.page}`:""}. ${$e[j].label}. Open provenance.`,"aria-pressed":R,onClick:()=>s({type:"edge",id:d.id,hop:d.hop}),onKeyDown:g(()=>s({type:"edge",id:d.id,hop:d.hop})),children:[i.jsx("path",{d:E,className:`g-edge st-${j}${d.critical?" is-critical":""}${k?" is-dim":""}`,style:R?{opacity:1,strokeWidth:3.2}:void 0}),d.critical&&!k&&i.jsx("path",{d:E,className:"g-flow"}),i.jsx("path",{d:E,className:"g-edge-hit"}),i.jsx("rect",{x:S-22,y:(m.y+w.y)/2-9,width:44,height:18,rx:9,fill:"transparent",style:{cursor:"pointer"}}),i.jsx("title",{children:`${d.hop.src} → ${d.hop.dst} · p.${d.hop.page??"?"} · ${$e[j].label}`})]},d.id)}),[...o.nodes.values()].map(d=>{const m=h.pos.get(d.k),w=aa(d),S=d.side==="self",E=S?11:8,j=y&&!y.has(d.k),k=(l==null?void 0:l.type)==="node"&&l.k===d.k;return i.jsxs("g",{transform:`translate(${m.x},${m.y})`,tabIndex:0,role:"button","aria-label":C(d),"aria-pressed":k,className:`g-node${S?" is-self":""}${j?" is-dim":""}${k?" is-selected":""}`,"data-k":d.k,onMouseEnter:()=>v(d.k),onMouseLeave:()=>v(null),onFocus:()=>v(d.k),onBlur:()=>v(null),onClick:()=>s({type:"node",k:d.k}),onKeyDown:g(()=>s({type:"node",k:d.k})),children:[w==="design"&&!S&&i.jsx("circle",{className:"glow",r:E*2.2}),i.jsx("circle",{className:"halo",r:E+5}),i.jsx("circle",{className:`dot tone-${w}${d.lineage_known===!1?" unread":""}`,r:E}),i.jsx("text",{className:"lk",y:-E-9,textAnchor:"middle",children:d.k}),i.jsxs("text",{className:"ln",y:E+16,textAnchor:"middle",children:[qe(d.name,26)," · ",Yc(d.decision_date)]})]},d.k)}),o.hidden>0&&i.jsxs("g",{className:"g-more",tabIndex:0,role:"button",transform:`translate(14, ${h.height-40})`,"aria-label":`Show ${o.hidden} more ancestors in generations ${o.hiddenGens.join(", ")}`,onClick:()=>n(Math.max(...o.hiddenGens)),onKeyDown:g(()=>n(Math.max(...o.hiddenGens))),children:[i.jsx("rect",{width:"212",height:"28",rx:"14"}),i.jsxs("text",{x:"106",y:"18.5",textAnchor:"middle",children:["+ ",o.hidden," more in generation",o.hiddenGens.length>1?`s ${o.hiddenGens[0]}–${o.hiddenGens[o.hiddenGens.length-1]}`:` ${o.hiddenGens[0]}`]})]})]})}),i.jsxs("div",{className:"g-legend","aria-label":"Legend",children:[i.jsxs("span",{className:"sw",children:[i.jsx("i",{className:"lg-design"}),"design-related recall"]}),i.jsxs("span",{className:"sw",children:[i.jsx("i",{className:"lg-recall"}),"other recall"]}),i.jsxs("span",{className:"sw",children:[i.jsx("i",{className:"lg-clean"}),"no recall record"]}),i.jsxs("span",{className:"sw",children:[i.jsx("i",{className:"lg-unread"}),"own predicates unread"]}),i.jsx("span",{className:"sep","aria-hidden":"true"}),["confirmed","extracted","disputed","conditional"].map(d=>i.jsxs("span",{className:`status status-${d}`,children:[i.jsx("span",{className:"line"}),$e[d].short]},d)),i.jsxs("span",{className:"status",style:{color:"var(--amber)"},children:[i.jsx("span",{className:"line"}),"critical chain"]})]}),i.jsx("div",{className:"graph-hint",children:"Select any device or thread for its record, quote, page and source PDF. Tab moves between them; Enter opens."})]})}const Dt=28,Ir=34,vs=260,ut=e=>e?Date.parse(e.slice(0,10)+"T00:00:00Z"):null;function Jp(e,t){const n=new Map,r=(u,c,p,h)=>{n.has(u.k)||n.set(u.k,{...u,side:c,gen:p,parent:h,children:[]})};r({...e.device,k:e.k},"self",0,null);for(const u of e.ancestors)u.gen<=t&&r(u,"up",u.gen,u.chain[u.chain.length-2]);for(const u of e.descendants)r(u,"down",u.gen,u.chain[u.chain.length-2]);for(const u of n.values())u.parent&&n.has(u.parent)&&n.get(u.parent).children.push(u.k);const l=(u,c)=>(n.get(u).decision_date||"").localeCompare(n.get(c).decision_date||""),s=[],a=u=>{for(const c of n.get(u).children.filter(p=>n.get(p).side==="down").sort(l).reverse())a(c),s.push(c)},o=u=>{for(const c of n.get(u).children.filter(p=>n.get(p).side==="up").sort(l).reverse())s.push(c),o(c)};return a(e.k),s.push(e.k),o(e.k),{nodes:n,order:s}}function bp({a:e,depth:t,highlight:n,onSelect:r}){const l=_.useRef(null),[s,a]=_.useState(1e3);_.useEffect(()=>{const k=()=>l.current&&a(Math.max(760,l.current.clientWidth));k();const R=new ResizeObserver(k);return R.observe(l.current),()=>R.disconnect()},[]);const{nodes:o,order:u}=_.useMemo(()=>Jp(e,t),[e,t]),c=new Map(u.map((k,R)=>[k,R])),p=[];for(const k of o.values()){k.decision_date&&p.push(ut(k.decision_date));for(const R of k.recalls||[])R.initiated&&p.push(ut(R.initiated))}const h=new Date(Math.min(...p)).getUTCFullYear(),f=new Date(Math.max(...p)).getUTCFullYear()+1,v=Date.UTC(h,0,1),y=Date.UTC(f,0,1),x=s-vs-40,C=k=>16+(k-v)/(y-v)*x,g=k=>Ir+k*Dt+Dt/2,d=Ir+u.length*Dt+16,m=new Set(n||[]),w=new Set;if(n)for(let k=0;k+1"+n[k+1]);const S=f-h>24?4:f-h>12?2:1,E=[];for(let k=h;k<=f;k+=S)E.push(k);const j=C(ut(e.device.decision_date));return i.jsx("div",{className:"graph-wrap",ref:l,"data-testid":"timeline",children:i.jsxs("svg",{width:s,height:d,role:"group","aria-label":`Lineage timeline for ${e.k}`,children:[E.map(k=>i.jsxs("g",{children:[i.jsx("line",{className:"tl-grid",x1:C(Date.UTC(k,0,1)),x2:C(Date.UTC(k,0,1)),y1:Ir-8,y2:d-8}),i.jsx("text",{className:"tl-axis",x:C(Date.UTC(k,0,1)),y:18,textAnchor:"middle",children:k})]},k)),i.jsx("rect",{x:0,y:g(c.get(e.k))-Dt/2,width:s,height:Dt,className:"tl-band"}),i.jsx("line",{className:"tl-clear",x1:j,x2:j,y1:Ir-8,y2:d-8}),[...o.values()].filter(k=>k.parent&&o.has(k.parent)).map(k=>{const[R,P]=k.side==="up"?[k.parent,k.k]:[k.k,k.parent],I=o.get(R),K=o.get(P);if(!I.decision_date||!K.decision_date)return null;const me=C(ut(I.decision_date)),Be=g(c.get(R)),Y=C(ut(K.decision_date)),Ze=g(c.get(P)),F=(me+Y)/2;return i.jsx("path",{d:`M${me-6},${Be} C${F},${Be} ${F},${Ze} ${Y+7},${Ze}`,className:"tl-edge"+(w.has(R+">"+P)?" on":"")},R+P)}),u.map((k,R)=>{const P=o.get(k);if(!P.decision_date)return null;const I=C(ut(P.decision_date)),K=g(R),me=aa(P),Be=m.size&&!m.has(k);return i.jsxs("g",{className:"tl-row g-node",style:{opacity:Be?.3:1},tabIndex:0,role:"button","aria-label":`${k} ${P.name}, cleared ${P.decision_date}, ${(P.recalls||[]).length} recall records`,onClick:()=>r({type:"node",k}),onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),r({type:"node",k}))},children:[i.jsx("rect",{className:"tl-rowhit",x:0,y:K-Dt/2,width:s,height:Dt}),(P.recalls||[]).map(Y=>Y.initiated&&i.jsxs("g",{children:[i.jsx("line",{className:"tl-rlink",x1:I,x2:C(ut(Y.initiated)),y1:K,y2:K}),i.jsx("path",{d:`M${C(ut(Y.initiated))},${K-5} l5,5 l-5,5 l-5,-5 z`,className:"tl-dia "+(Y.design_related?"design":"other"),children:i.jsx("title",{children:`${Y.id} · ${Y.classification||"unclassified"} · ${Y.root_cause} · began ${Y.initiated}`})})]},Y.id)),i.jsx("circle",{cx:I,cy:K,r:k===e.k?7:5.5,className:`dot tone-${me}${P.lineage_known===!1?" unread":""}`,style:k===e.k?{fill:"var(--ivory)",stroke:"var(--blue)",strokeWidth:3}:void 0}),i.jsxs("text",{x:s-vs+8,y:K+4,className:"tl-label",children:[i.jsx("tspan",{className:"lk",children:k}),i.jsx("tspan",{dx:"7",children:qe(P.name,24)})]}),i.jsx("text",{x:s-vs-6,y:K+4,textAnchor:"end",className:"tl-gen",children:P.side==="self"?"candidate":P.side==="up"?`G-${P.gen}`:`D+${P.gen}`})]},k)})]})})}const Nl=e=>(e.severity==="high"||e.severity==="medium")&&!e.conditional;function eh(e,t){var v,y;if(!e||!t||e.k!==t.k||e.depth!==1||t.depth<2||e.verdict===t.verdict)return null;const n=t.signals.filter(x=>{var C;return Nl(x)&&((C=x.chain)==null?void 0:C.length)>2});if(!n.length||t.signals.some(x=>{var C;return Nl(x)&&(((C=x.chain)==null?void 0:C.length)||0)<=2}))return null;const r=n[0],l=jl(r.evidence.filter(x=>x.type==="recall"),t.device.decision_date);if(!l)return null;const s=x=>t.ancestors.find(C=>C.k===x),a=(x,C)=>{var g,d;return((d=(g=s(C))==null?void 0:g.hops)==null?void 0:d.find(m=>m.src===x&&m.dst===C))||null},o=r.chain.slice(0,-1),u=o[o.length-1],c=n.filter(x=>x.chain.slice(0,-1).join(">")===o.join(">")&&x.evidence.some(C=>C.type==="recall"&&C.id===l.id)).map(x=>s(x.chain[x.chain.length-1])).filter(Boolean),p=o.slice(1).map((x,C)=>({device:s(x),hop:a(o[C],x)})),h=c.map(x=>({device:x,hop:a(u,x.k)})).filter(x=>x.hop),f=s(r.chain[1]);return{k:t.k,device:t.device,shallow:e,deep:t,recall:l,steps:p,fanout:h,predicate:f,predicateOnRecall:!!((v=f==null?void 0:f.recalls)!=null&&v.some(x=>x.id===l.id)),predicateRecalls:((y=f==null?void 0:f.recalls)==null?void 0:y.length)||0,timing:ua(l.initiated,t.device.decision_date),gen:r.gen}}function th(e,t,n=64,r=16){const l=(e||"").replace(/\s+/g," ").trim(),s=l.indexOf(t);if(s<0)return{head:qe(l,140),k:"",tail:""};let a=Math.max(0,s-n),o=Math.min(l.length,s+t.length+r);return a>0&&(a=l.indexOf(" ",a)+1||a),os+t.length?l.lastIndexOf(" ",o):o),{head:(a>0?"…":"")+l.slice(a,s),k:t,tail:l.slice(s+t.length,o)+(oe.length<2?e:e.flatMap((t,n)=>n===0?[t]:[n===e.length-1?" and ":", ",t]);function rh({a:e,onSelect:t}){var h;const[n,r]=_.useState(null),l=e.depth>=2&&e.signals.some(f=>{var v;return Nl(f)&&((v=f.chain)==null?void 0:v.length)>2})&&!e.signals.some(f=>{var v;return Nl(f)&&(((v=f.chain)==null?void 0:v.length)||0)<=2});_.useEffect(()=>{if(!l)return;let f=!0;return Promise.all([_e.assess(e.k,1),_e.assess(e.k,2)]).then(([v,y])=>{f&&r({of:e,one:v,two:y})}).catch(()=>{f&&r(null)}),()=>{f=!1}},[e,l]);const s=l&&(n==null?void 0:n.of)===e?eh(n.one,n.two):null;if(!s)return null;const{recall:a,predicate:o,timing:u}=s,c=f=>t({type:"edge",id:f.src+">"+f.dst,hop:f}),p=s.fanout.map(f=>i.jsx("span",{className:"k",children:f.device.k},f.device.k));return i.jsxs("section",{className:"panel depth-contrast corner-marks","aria-labelledby":"dc-title","data-testid":"depth-contrast",children:[i.jsxs("div",{className:"panel-head",children:[i.jsxs("h2",{id:"dc-title",children:["Why the graph matters ",i.jsx("span",{className:"count",children:"same clearance, same rules, one generation deeper"})]}),i.jsx("p",{className:"hint",children:"Depth is the number of predicate generations the Relate query walks."})]}),i.jsxs("div",{className:"dc-grid",children:[i.jsxs("div",{className:"dc-col","data-testid":"depth-1",children:[i.jsxs("p",{className:"dc-depth",children:[i.jsx("b",{children:"Depth 1"})," · direct predicates only"]}),i.jsx(Co,{a:s.shallow}),i.jsxs("p",{children:[i.jsx("span",{className:"k",children:s.k})," cites ",i.jsx("span",{className:"k",children:o.k})," (",o.name.split(",")[0],")."," ",s.predicateRecalls===0?i.jsxs(i.Fragment,{children:["FDA's recall records in this dataset name no recall for ",o.k,"."]}):i.jsxs(i.Fragment,{children:["FDA's recall records list ",s.predicateRecalls," record(s) for ",o.k,", none of them design-related."]})," ","A one-hop lookup stops here."]})]}),i.jsx("div",{className:"dc-step","aria-hidden":"true",children:i.jsx("span",{children:"+1 hop"})}),i.jsxs("div",{className:"dc-col is-deep","data-testid":"depth-2",children:[i.jsxs("p",{className:"dc-depth",children:[i.jsx("b",{children:"Depth 2"})," · one Relate query, two hops"]}),i.jsx(Co,{a:s.deep}),i.jsxs("p",{children:[i.jsx("span",{className:"k",children:o.k})," itself cites ",Po(p),"."," ","FDA lists ",s.fanout.length>1?"both":"it"," on ",i.jsx("a",{className:"mono",href:a.url,target:"_blank",rel:"noreferrer",children:a.id}),", a"," ",i.jsxs("span",{className:"amber",children:[a.classification," · ",a.root_cause]})," recall that began ",we(a.initiated),(u==null?void 0:u.relation)==="before"&&i.jsxs(i.Fragment,{children:[", ",i.jsxs("span",{className:"amber",children:[u.duration," before"]})," ",s.k," was cleared"]}),"."]})]})]}),i.jsxs("ol",{className:"dc-route","aria-label":"Evidence route, from the candidate's summary to the recall",children:[s.steps.map(({device:f,hop:v})=>v&&i.jsxs("li",{children:[i.jsxs("span",{className:"dc-n mono",children:[v.src," → ",f.k]}),i.jsx(To,{hop:v}),i.jsxs("span",{className:"dc-a",children:[i.jsxs("a",{href:ci(v.source_url,v.page),target:"_blank",rel:"noreferrer",children:[v.src," summary PDF, p.",v.page," ↗"]}),i.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>c(v),children:"Provenance"})]})]},v.src+v.dst)),s.fanout.map(({device:f,hop:v})=>i.jsxs("li",{children:[i.jsxs("span",{className:"dc-n mono",children:[v.src," → ",f.k]}),i.jsx(To,{hop:v}),i.jsxs("span",{className:"dc-a",children:[i.jsxs("a",{href:ci(v.source_url,v.page),target:"_blank",rel:"noreferrer",children:[v.src," summary PDF, p.",v.page," ↗"]}),i.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>c(v),children:"Provenance"})]})]},v.src+v.dst)),i.jsxs("li",{className:"is-recall",children:[i.jsx("span",{className:"dc-n mono",children:a.id}),i.jsxs("span",{className:"dc-q",children:[a.classification," · ",a.root_cause," · event ",a.event," · began ",we(a.initiated),". FDA's record lists ",Po(p),s.predicateOnRecall?i.jsxs(i.Fragment,{children:[", and ",i.jsx("span",{className:"k",children:o.k})]}):i.jsxs(i.Fragment,{children:[", not ",i.jsx("span",{className:"k",children:o.k})]}),"."]}),i.jsxs("span",{className:"dc-a",children:[i.jsx("a",{href:a.url,target:"_blank",rel:"noreferrer",children:"FDA recall record ↗"}),i.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>{var f;return t({type:"node",k:(f=s.fanout[0])==null?void 0:f.device.k})},children:["Open ",(h=s.fanout[0])==null?void 0:h.device.k]})]})]})]}),i.jsxs("p",{className:"dc-foot muted small",children:["A documentation signal for the predicate rationale, not a safety finding about ",s.k,". FDA attributes the recall to product families that list these clearances; it does not say which model was affected."]})]})}function Jc({text:e,k:t,ocr:n}){if(!e)return i.jsx("p",{className:"quote muted",children:"No quote stored for this citation."});const r=t?e.split(new RegExp(`(${t.replace(/^K/,"K\\s?")})`)):[e];return i.jsxs("blockquote",{className:"quote"+(n?" is-ocr":""),children:["“",/^[a-z]/.test(e)?"…":"",r.map((l,s)=>s%2?i.jsx("mark",{children:l},s):i.jsx(Sl.Fragment,{children:l},s)),"”"]})}function lh({hop:e}){const t=Et(e);return i.jsxs("span",{className:`status status-${t.key}`,children:[i.jsx("span",{className:"line"}),$e[t.key].label]})}function bc({r:e}){const t=Op(e),n=Zc[_o(e)];return i.jsxs("div",{className:"recall","data-attribution":_o(e),children:[i.jsxs("div",{className:"recall-h",children:[i.jsx("span",{className:`chip tone-${t}`,children:t==="design"?"Design-related":t==="class1"?"Class I, other cause":"Other cause"}),i.jsx("span",{className:"k mono",children:e.id}),i.jsxs("span",{className:"muted",children:[e.classification||"Unclassified"," · ",e.root_cause||"cause not stated"," · began ",we(e.initiated)]}),e.url&&i.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:"FDA record ↗"})]}),i.jsxs("div",{className:"recall-r",children:[i.jsx("span",{className:`chip tone-${n.tone}`,title:n.text,children:n.short})," ",i.jsx("span",{className:"muted small",children:n.text})]}),e.linked_before_clearance&&i.jsxs("div",{className:"recall-r","data-testid":"recall-predates",children:[i.jsx("span",{className:"chip tone-muted",title:hs.text,children:hs.short})," ",i.jsx("span",{className:"muted small",children:hs.text})]}),e.reason&&i.jsx("div",{className:"recall-r",children:e.reason}),e.status&&i.jsxs("div",{className:"recall-r",children:["Status: ",e.status,e.event?` · event ${e.event}`:"",e.firm?` · ${e.firm}`:""]})]})}function wn(e,t){return t===e.k?{...e.device,k:e.k,gen:0,side:"self"}:e.ancestors.find(n=>n.k===t)&&{...e.ancestors.find(n=>n.k===t),side:"up"}||e.descendants.find(n=>n.k===t)&&{...e.descendants.find(n=>n.k===t),side:"down"}||null}function sh({sel:e,a:t,onClose:n,go:r,reload:l,onSelect:s}){const a=_.useRef(null),o=_.useRef(null);return _.useEffect(()=>{var p;const u=document.activeElement;(p=o.current)==null||p.focus();const c=h=>{if(h.key==="Escape"&&n(),h.key==="Tab"&&a.current){const f=a.current.querySelectorAll('a[href], button:not([disabled]), input, textarea, [tabindex="0"]');if(!f.length)return;const v=f[0],y=f[f.length-1];h.shiftKey&&document.activeElement===v?(h.preventDefault(),y.focus()):!h.shiftKey&&document.activeElement===y&&(h.preventDefault(),v.focus())}};return addEventListener("keydown",c),()=>{var h;removeEventListener("keydown",c),(h=u==null?void 0:u.focus)==null||h.call(u)}},[]),i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"drawer-scrim",onClick:n}),i.jsx("aside",{className:"drawer",ref:a,role:"dialog","aria-modal":"true","aria-labelledby":"drawer-title","data-testid":"provenance",children:e.type==="edge"?i.jsx(ih,{sel:e,a:t,closeBtn:o,onClose:n,go:r,reload:l,onSelect:s}):i.jsx(ah,{sel:e,a:t,closeBtn:o,onClose:n,go:r,onSelect:s})})]})}function di({eyebrow:e,children:t,closeBtn:n,onClose:r}){return i.jsxs("div",{className:"drawer-head",children:[i.jsxs("div",{className:"t",children:[i.jsx("p",{className:"eyebrow",children:e}),i.jsx("h2",{id:"drawer-title",children:t})]}),i.jsx("button",{ref:n,className:"btn btn-quiet",onClick:r,"aria-label":"Close provenance (Escape)",children:"✕"})]})}function ih({sel:e,a:t,closeBtn:n,onClose:r,go:l,reload:s,onSelect:a}){const o=e.hop,u=wn(t,o.src)||{},c=wn(t,o.dst)||{},p=Et(o),[h,f]=_.useState(!1),[v,y]=_.useState(null),x=o.source_url||u.summary_url,C=(o.text_source||u.text_source)&&(o.text_source||u.text_source)!=="pdf_text_layer",g=async d=>{f(!0),y(null);try{const m=await _e.review(o.src,o.dst,d);m!=null&&m.citation&&a({...e,hop:m.citation}),y(m!=null&&m.citation?{ok:!0,text:d?`Recorded: ${d}. The assessment has been recomputed from the graph.`:"Review cleared. The assessment has been recomputed."}:{ok:!1,text:"The review was sent, but the graph did not return the citation. Reopen it to see its current state."}),s()}catch(m){y({ok:!1,text:m.message})}finally{f(!1)}};return i.jsxs(i.Fragment,{children:[i.jsxs(di,{eyebrow:"Citation provenance",closeBtn:n,onClose:r,children:[i.jsx("span",{className:"k",children:o.src})," cites ",i.jsx("span",{className:"k",children:o.dst})]}),i.jsxs("div",{className:"drawer-body",children:[i.jsxs("div",{className:"drawer-sec",children:[i.jsx(lh,{hop:o}),p.reasons.length>0&&i.jsx("ul",{style:{margin:"8px 0 0",paddingLeft:18,color:"var(--ink-2)",fontSize:12.5},children:p.reasons.map(d=>i.jsx("li",{children:Kc[d]||d},d))}),p.key==="conditional"&&i.jsxs("p",{className:"note-box violet",style:{marginTop:10},children:["Recall signals reached through this thread are ",i.jsx("b",{children:"conditional"}),": they hold only if this citation is a predicate. Read the page, then confirm or reject it: your review rewrites the verdict."]})]}),i.jsxs("div",{className:"drawer-sec",children:[i.jsx("h3",{children:"What the summary says"}),i.jsx(Jc,{text:o.quote||o.snippet,k:o.dst,ocr:C})]}),x&&i.jsxs("a",{className:"page-card",href:ci(x,o.page),target:"_blank",rel:"noreferrer","data-testid":"pdf-page-link",children:[i.jsx("span",{className:"sheet",children:i.jsxs("b",{children:["p.",o.page??"?"]})}),i.jsxs("span",{className:"tx",children:[i.jsxs("b",{children:["Open the original FDA PDF",o.page?` at page ${o.page}`:""," ↗"]}),i.jsxs("span",{children:[o.src," 510(k) summary · accessdata.fda.gov"]})]})]}),i.jsxs("div",{className:"drawer-sec",children:[i.jsx("h3",{children:"Source and extraction"}),i.jsxs("dl",{className:"prov-grid",children:[i.jsx("dt",{children:"Citing device"}),i.jsxs("dd",{children:[o.src," · ",qe(u.name,40),u.decision_date?` · ${we(u.decision_date)}`:""]}),i.jsx("dt",{children:"Cited device"}),i.jsxs("dd",{children:[o.dst," · ",qe(c.name,40),c.decision_date?` · ${we(c.decision_date)}`:""]}),i.jsx("dt",{children:"Role"}),i.jsx("dd",{children:o.kind||"predicate"}),i.jsx("dt",{children:"Page"}),i.jsx("dd",{children:o.page??"not recorded"}),i.jsx("dt",{children:"Text source"}),i.jsx("dd",{children:Bp[o.text_source||u.text_source]||o.text_source||u.text_source||"not recorded"}),i.jsx("dt",{children:"Extraction"}),i.jsxs("dd",{children:[o.method||"—",o.confidence!=null?` · confidence ${o.confidence}`:""]}),i.jsx("dt",{children:"Name check"}),i.jsx("dd",{children:o.name_check||"—"}),i.jsx("dt",{children:"FDA panel"}),i.jsx("dd",{children:o.panel_check||"—"}),o.audit&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"Audit"}),i.jsxs("dd",{children:[o.audit,o.audit_note?` — ${o.audit_note}`:""]})]}),o.ai_label&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"LLM label"}),i.jsxs("dd",{children:[o.ai_label,o.ai_model?` · ${o.ai_model}`:""," (advisory; never a verdict input until a person confirms)"]})]}),i.jsx("dt",{children:"Review"}),i.jsx("dd",{"data-testid":"edge-review",children:o.review?`${o.review} by ${o.reviewer||"unknown"}${cr.includes(o.reviewer)?" (automated client; advisory)":Gc(o)?" on an earlier version of the summary; needs re-review":""}`:"not reviewed by a person"}),i.jsx("dt",{children:"Trust"}),i.jsx("dd",{"data-testid":"edge-trust",children:$e[Et(o).key].label}),o.retired_at&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"Retired"}),i.jsxs("dd",{children:[we(o.retired_at)," · no longer cited by the refreshed summary"]})]}),u.summary_sha256&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"PDF SHA-256"}),i.jsx("dd",{children:i.jsx("span",{className:"mono",children:u.summary_sha256})})]})]})]}),i.jsxs("div",{className:"drawer-sec",children:[i.jsx("h3",{children:"Your review"}),i.jsxs("div",{className:"drawer-acts",children:[i.jsx("button",{className:"btn btn-line btn-sm",disabled:h,onClick:()=>g(o.review==="confirmed"&&Ge(o)?"":"confirmed"),children:o.review==="confirmed"&&Ge(o)?"Clear confirmation":"Confirm citation"}),i.jsx("button",{className:"btn btn-line btn-sm",disabled:h,onClick:()=>g(o.review==="rejected"&&Ge(o)?"":"rejected"),children:o.review==="rejected"&&Ge(o)?"Restore citation":"Reject citation"})]}),i.jsx("p",{className:"note",style:{marginTop:8},children:"A review is a write to the Relate graph. Every lineage query, verdict and saved-assessment staleness check reads it immediately."}),v&&i.jsx("p",{className:v.ok?"ok":"err",role:"status",children:v.text})]}),i.jsxs("div",{className:"drawer-acts",children:[i.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>a({type:"node",k:o.dst}),children:[o.dst," record →"]}),i.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>a({type:"node",k:o.src}),children:[o.src," record →"]})]})]})]})}function ah({sel:e,a:t,closeBtn:n,onClose:r,go:l,onSelect:s}){var h,f;const a=wn(t,e.k);if(!a)return i.jsxs(i.Fragment,{children:[i.jsx(di,{eyebrow:"Device",closeBtn:n,onClose:r,children:e.k}),i.jsx("div",{className:"drawer-body",children:"Not in this view."})]});const o=[...a.recalls||[]].sort((v,y)=>y.design_related-v.design_related||(v.initiated||"").localeCompare(y.initiated||"")),u=oa(o),c=a.side==="self"?"Candidate":a.side==="up"?{1:"Direct predicate",2:"Grand-predicate"}[a.gen]||`Generation ${a.gen} ancestor`:`Later device citing this lineage (+${a.gen})`,p=o.filter(v=>v.initiated&&t.device.decision_date&&v.initiated1&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"Route"}),i.jsx("dd",{className:"mono",style:{fontSize:12},children:a.chain.join(" → ")})]})]}),i.jsxs("div",{className:"drawer-acts",children:[a.k!==t.k&&i.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>l("check",a.k),children:["Investigate ",a.k," ",i.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),i.jsx("a",{className:"btn btn-line btn-sm",href:Hc(a.k),target:"_blank",rel:"noreferrer",children:"FDA 510(k) record ↗"}),a.summary_url&&i.jsx("a",{className:"btn btn-line btn-sm",href:a.summary_url,target:"_blank",rel:"noreferrer",children:"Summary PDF ↗"}),a.lineage_known===!1&&i.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>l("ingest",a.k),children:"Try to read its summary"})]}),((f=a.hops)==null?void 0:f.length)>0&&i.jsxs("div",{className:"drawer-sec",children:[i.jsx("h3",{children:"How it is reached"}),i.jsx("div",{className:"tags",children:a.hops.map(v=>i.jsxs("button",{className:"tag-btn",onClick:()=>s({type:"edge",id:v.src+">"+v.dst,hop:v}),children:[i.jsx("span",{className:"k",children:v.src})," → ",i.jsx("span",{className:"k",children:v.dst})," · p.",v.page??"?"," · ",$e[Et(v).key].short]},v.src+v.dst))})]}),i.jsxs("div",{className:"drawer-sec",children:[i.jsxs("h3",{children:["Recall records on which FDA lists this 510(k) · ",u.events," event(s), ",u.records," product record(s)"]}),a.side!=="self"&&p.length>0&&i.jsxs("p",{className:"note-box amber",style:{marginBottom:10},children:[p.length," of these record(s) began before ",t.k," was cleared on ",we(t.device.decision_date),"."]}),o.length===0?i.jsx("p",{className:"muted",children:"openFDA lists this 510(k) on no recall record."}):i.jsx("div",{style:{display:"grid",gap:8},children:o.slice(0,20).map(v=>i.jsx(bc,{r:v},v.id))}),o.length>20&&i.jsxs("p",{className:"muted small",children:["+ ",o.length-20," more record(s): open the device to see all."]})]})]})]})}const oh={rejected_by_reviewer:"rejected by a reviewer",audit_not_predicate:"the audit found it is not a predicate citation",audit_error:"the audit found a K-number error",audit_unresolved:"the audit could not resolve it",not_in_openfda:"K-number not found in openFDA",cleared_after_citing_device:"K-number cleared after the citing device",audit_variant:"audit marked it a naming variant",audit_corrected:"K-number corrected by the audit"};function ed(e){const t=[];for(const n of e.signals)switch(n.code){case"DIRECT_RECALL":if(n.severity==="info")break;t.push({id:n.code,tone:n.severity==="high"?"alert":"amber",sev:n.severity,title:n.title,what:"The candidate itself appears in FDA recall records.",why:n.severity==="high"?"A design-related recall on the device you would cite is what FDA's 2023 draft guidance asks you to avoid or explain.":"A Class I recall on the candidate is a documented question for any submission that cites it.",todo:"Open each recall record and document how it is addressed (scope, lots, corrective action).",node:e.k});break;case"ANCESTOR_RECALL":if(n.severity!=="medium")break;t.push({id:n.code+n.chain.join(),tone:n.conditional?"violet":"amber",sev:n.severity,title:n.title,conditional:n.conditional,what:n.conditional?"The recall holder is reached only through a citation the audit could not resolve.":`A ${n.gen===1?"direct predicate":"grand-predicate"} carries recall records the verdict rules treat as review-worthy.`,why:n.conditional?"If that citation is not a predicate, this recall does not belong to the lineage; if it is, it does.":"Reviewers expect the predicate rationale to address design-related recalls in the lineage (FDA 2023 draft guidance; Kadakia et al., JAMA 2023, an association).",todo:n.conditional?"Open the uncertain thread, read the PDF page, and confirm or reject it.":"Verify the citation on its PDF page, read the recall records, and record how the rationale addresses them.",chain:n.chain,hops:n.evidence.filter(r=>r.type==="citation")});break;case"UNCERTAIN_LINK_IN_LINEAGE":case"NAME_MISMATCH_IN_LINEAGE":t.push({id:n.code,tone:"alert",sev:"info",title:n.title,what:"Threads in this ancestry rest on evidence that conflicts with FDA records or needed correction.",why:"A doubtful thread may route the lineage to the wrong device, and the right one may be missing; these links never count as checked.",todo:"Open each thread, compare the quote with the cited device, then confirm or reject it.",hops:n.evidence.filter(r=>r.type==="citation")});break;case"ADVISORY_LINK_PENDING_REVIEW":t.push({id:n.code,tone:"violet",sev:"info",title:n.title,what:"An LLM label or the automated MCP client calls these citations predicates; no person has decided.",why:"They are not used for the verdict. If one is a real predicate, its recalls belong in the lineage and the verdict could change.",todo:"Open each link, read the PDF page, and confirm or reject it yourself.",hops:n.evidence.filter(r=>r.type==="advisory_citation")});break;case"CITATION_RETIRED_BY_REINGEST":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Re-reading the citing device's FDA summary no longer found these citations, so they were retired from the lineage.",why:"Earlier reviews, labels and provenance are kept for the record; a review made on the old text may no longer apply.",todo:"Compare the refreshed summary with the earlier one and record a new review if the citation still matters.",hops:n.evidence});break;case"PREDICATE_CITATION_UNRESOLVED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Predicate citations printed in a summary did not become lineage threads.",why:"A missing thread means part of the ancestry is invisible: a recall there would not show.",todo:"Check each quote. If the citation is real and the K-number valid, add that clearance to extend the graph.",missing:n.evidence});break;case"LINEAGE_UNKNOWN":case"LINEAGE_TRUNCATED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Some summaries are not machine-readable, so the ancestry stops there.",why:"Recalls further up those branches cannot be seen. The verdict reports this gap; it never fills it in.",todo:"Try reading each summary live (needs internet), which extends the lineage by one generation.",ingest:n.code==="LINEAGE_UNKNOWN"?[{k:e.k}]:n.evidence});break;case"UNATTRIBUTED_RECALLS_IN_PRODUCT_CODE":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"FDA filed these recalls under the product code without naming a 510(k) number.",why:"No lineage query can attribute them; one may still concern a device in this lineage.",todo:"Read the product descriptions and check whether any names a device in this ancestry.",recalls:n.evidence});break;case"RECALL_CAUSE_OR_CLASS_UNKNOWN":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Recall records without a stated root cause or FDA classification.",why:"They cannot be ruled out as design-related or Class I, so they could change the verdict once classified.",todo:"Re-check the FDA records for an updated classification or root cause.",recalls:n.evidence});break;case"DEEPER_ANCESTRY_GAPS":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Gaps beyond the two-generation verdict window.",why:"They cannot change the verdict, but the lower-severity list may be incomplete.",todo:"Expand the graph to deeper generations if the deeper ancestry matters to your rationale."});break}return t}function uh({a:e,onSelect:t,go:n,onFocusChain:r}){const l=ed(e);return l.length?i.jsx("div",{"data-testid":"review-queue",children:l.map(s=>{var a,o,u,c;return i.jsxs("section",{className:`review-item tone-${s.tone}`,onMouseEnter:()=>s.chain&&r(s.chain),onMouseLeave:()=>r(null),children:[i.jsxs("h3",{children:[i.jsx("span",{className:`sev sev-${s.sev}`,children:s.conditional?"conditional":s.sev==="info"?"gap":s.sev}),i.jsx("span",{children:s.title})]}),i.jsxs("dl",{children:[i.jsx("dt",{children:"Conflict"}),i.jsx("dd",{children:s.what}),i.jsx("dt",{children:"Why it matters"}),i.jsx("dd",{children:s.why}),i.jsx("dt",{children:"Next step"}),i.jsx("dd",{children:s.todo})]}),((a=s.hops)==null?void 0:a.length)>0&&i.jsx("div",{className:"links",children:s.hops.slice(0,8).map(p=>{const h=Et(p);return i.jsxs("button",{className:"tag-btn",onClick:()=>t({type:"edge",id:p.src+">"+p.dst,hop:p}),title:h.reasons.map(f=>Kc[f]).join("; ")||$e[h.key].label,children:[i.jsx("span",{className:"k",children:p.src})," → ",i.jsx("span",{className:"k",children:p.dst})," · p.",p.page??"?"," · ",i.jsx("span",{className:`status-${h.key}`,children:$e[h.key].short})]},p.src+p.dst)})}),((o=s.missing)==null?void 0:o.length)>0&&i.jsx("div",{className:"links",children:s.missing.slice(0,8).map(p=>i.jsxs("button",{className:"tag-btn",title:p.quote||"",onClick:()=>n("ingest",p.cited),children:[i.jsx("span",{className:"k",children:p.src})," → ",i.jsx("span",{className:"k",children:p.cited})," · ",oh[p.reason]||p.reason]},p.src+p.cited))}),((u=s.ingest)==null?void 0:u.length)>0&&i.jsx("div",{className:"links",children:s.ingest.slice(0,10).map(p=>i.jsxs("button",{className:"tag-btn",onClick:()=>n("ingest",p.k),children:[i.jsx("span",{className:"k",children:p.k}),p.summary_status?` · ${p.summary_status}`:""," · read now"]},p.k))}),((c=s.recalls)==null?void 0:c.length)>0&&i.jsx("div",{className:"links",children:s.recalls.slice(0,8).map(p=>p.url?i.jsxs("a",{className:"tag-btn",href:p.url,target:"_blank",rel:"noreferrer",children:[p.id," ↗"]},p.id):i.jsx("span",{className:"tag-btn",children:p.id},p.id))}),s.node&&i.jsx("div",{className:"acts",children:i.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:s.node}),children:"Open recall records"})}),s.chain&&i.jsx("div",{className:"acts",children:i.jsxs("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:s.chain[s.chain.length-1]}),children:["Open ",s.chain[s.chain.length-1]," records"]})})]},s.id)})}):i.jsx("p",{className:"muted",children:"Nothing in this lineage needs a person's attention under the current rules."})}function ca(e){const t=e.signals.filter(n=>{var r;return(n.severity==="high"||n.severity==="medium")&&((r=n.chain)==null?void 0:r.length)>1});return t.find(n=>!n.conditional)||t[0]||null}function ch({a:e}){const t=e.device,n=ca(e),r=e.signals.find(l=>l.code==="DIRECT_RECALL"&&l.severity!=="info"&&l.severity!=="low");if(r&&(!n||r.severity==="high")){const l=jl(r.evidence.filter(s=>s.type==="recall"),null);return i.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[i.jsx("span",{className:"k",children:e.k})," itself appears in FDA recall records",l&&i.jsxs(i.Fragment,{children:[": a ",i.jsxs("span",{className:"amber",children:[l.classification||"unclassified"," ",l.root_cause]})," recall began ",we(l.initiated)]}),"."," ","Citing it as a predicate would need that addressed."]})}if(n){const l=wn(e,n.chain[n.chain.length-1]),s=n.evidence.filter(p=>p.type==="recall"),a=jl(s,t.decision_date),o=n.evidence.find(p=>p.type==="citation"&&p.src===e.k),u=a?ua(a.initiated,t.decision_date):null,c=oa(s);return i.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[qe(t.name,48)," cites ",i.jsx("span",{className:"k",children:n.chain[1]}),o!=null&&o.page?i.jsxs(i.Fragment,{children:[" on page ",o.page," of its summary"]}):null,"."," ",n.conditional?i.jsxs(i.Fragment,{children:["The cited device ",i.jsx("span",{className:"k",children:l==null?void 0:l.k}),", reached through a citation the audit could not resolve,"]}):n.chain.length>2?i.jsxs(i.Fragment,{children:["Through it, ",n.gen===2?"grand-predicate":`generation-${n.gen} ancestor`," ",i.jsx("span",{className:"k",children:l==null?void 0:l.k})]}):i.jsx(i.Fragment,{children:"That predicate"})," ","(",qe(l==null?void 0:l.name,52),") is listed by FDA on ",c.events," recall event",c.events===1?"":"s"," in this signal",a&&i.jsxs(i.Fragment,{children:[", including a ",i.jsxs("span",{className:"amber",children:[a.classification||"unclassified"," ",a.root_cause]})," recall that began ",we(a.initiated),u&&i.jsxs(i.Fragment,{children:[", ",u.relation==="before"?i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"amber",children:[u.duration," before"]})," ",e.k," was cleared"]}):Xc(u,e.k)]})]}),".",n.conditional&&i.jsxs(i.Fragment,{children:[" This route is ",i.jsx("b",{style:{color:"var(--violet)"},children:"conditional"}),": it holds only if that citation is a predicate."]})]})}return i.jsx("p",{className:"finding-sentence","data-testid":"finding-sentence",children:e.verdict_reason})}function dh({a:e,onSelect:t}){const n=ca(e);if(!n)return null;const r=n.evidence.filter(c=>c.type==="citation"),l=(c,p)=>{var h,f;return r.find(v=>v.src===c&&v.dst===p)||((f=(h=wn(e,p))==null?void 0:h.hops)==null?void 0:f.find(v=>v.src===c&&v.dst===p))},s=n.chain[n.chain.length-1],a=n.evidence.filter(c=>c.type==="recall"),o=jl(a,e.device.decision_date),u=o?ua(o.initiated,e.device.decision_date):null;return i.jsxs("section",{className:"panel corner-marks","aria-labelledby":"chain-title","data-testid":"critical-chain",children:[i.jsxs("div",{className:"panel-head",children:[i.jsxs("h2",{id:"chain-title",children:["Critical chain ",i.jsx("span",{className:"count",children:"predicate → recall, the route that raised the verdict"})]}),i.jsx("p",{className:"hint",children:"Select a thread for its page and quote."})]}),i.jsx("div",{className:"chain",children:n.chain.map((c,p)=>{const h=wn(e,c)||{},f=p===0?"Candidate":n.conditional?"Cited device · citation unresolved":p===1?"Direct predicate":p===2?"Grand-predicate":`Generation ${p}`,v=c===s,y=v?aa({recalls:a}):"none",x=p>0?l(n.chain[p-1],c):null,C=x?Et(x):null;return i.jsxs(Sl.Fragment,{children:[p>0&&i.jsxs("button",{className:`chain-link st-${(C==null?void 0:C.key)||"extracted"}`,onClick:()=>x&&t({type:"edge",id:x.src+">"+x.dst,hop:x}),"aria-label":`${n.chain[p-1]} cites ${c}${x!=null&&x.page?` on page ${x.page}`:""}, ${$e[(C==null?void 0:C.key)||"extracted"].label}. Open provenance.`,children:[i.jsxs("span",{className:"lbl",children:["cites",x!=null&&x.page?` · p.${x.page}`:""]}),i.jsx("span",{className:"sub",children:$e[(C==null?void 0:C.key)||"extracted"].short})]}),i.jsxs("button",{className:`chain-node${p===0?" is-self":""}${y==="design"?" tone-design":""}`,onClick:()=>t({type:"node",k:c}),children:[i.jsx("span",{className:"role",children:f}),i.jsx("span",{className:"k",children:c}),i.jsx("span",{className:"nm",children:qe(h.name,44)}),i.jsxs("span",{className:"dt",children:["Cleared ",we(h.decision_date)]}),v&&o&&i.jsxs("span",{className:"rc",children:[i.jsxs("span",{className:`chip tone-${o.design_related?"design":"class1"}`,children:[o.classification||"Unclassified"," · ",o.root_cause]}),i.jsxs("span",{className:"dt",children:["Recall began ",we(o.initiated)," · ",i.jsx("span",{className:"mono",children:o.id})]})]})]})]},c)})}),o&&u&&i.jsxs("div",{className:"chain-timing",children:[i.jsxs("span",{className:"chip tone-amber",children:[i.jsx("span",{className:"glyph"}),Xc(u,e.k,"chip")]}),i.jsxs("span",{className:"muted",children:[oa(a).events," recall event(s) · ",a.length," product record(s) in this signal. Documentation signal, not a safety finding."]})]})]})}function fh({k:e,go:t,onChanged:n}){var Y,Ze;const[r,l]=_.useState(null),[s,a]=_.useState(null),[o,u]=_.useState(!1),[c,p]=_.useState(4),[h,f]=_.useState(2),[v,y]=_.useState("graph"),[x,C]=_.useState(!1),[g,d]=_.useState(null),[m,w]=_.useState(null),[S,E]=_.useState([]),[j,k]=_.useState([]),R=()=>{u(!0),a(null),_e.assess(e,c).then(F=>{l(F)}).catch(F=>{l(null),a(F.message)}).finally(()=>u(!1)),_e.assessments(e).then(E).catch(()=>E([])),_e.investigations(e,10).then(k).catch(()=>k([]))};if(_.useEffect(()=>{d(null),f(Math.min(2,c)),R()},[e,c]),s)return i.jsxs("div",{className:"panel",role:"alert",children:[i.jsx("p",{className:"err",style:{fontSize:15},children:s}),s.includes("not in the graph")&&i.jsxs("button",{className:"btn btn-primary",onClick:()=>t("ingest",e),children:["Read ",e," from FDA now ",i.jsx("span",{className:"arr",children:"→"})]})]});if(!r)return i.jsxs("div",{"aria-busy":"true",children:[i.jsxs("div",{className:"loading-thread",children:[i.jsx("i",{}),"Walking ",e,"'s lineage in the Relate graph…"]}),i.jsx("div",{className:"skeleton",style:{height:210,marginBottom:16}}),i.jsx("div",{className:"skeleton",style:{height:160,marginBottom:16}}),i.jsx("div",{className:"skeleton",style:{height:380}})]});const P=r.device,I=r.coverage,K={...Kn[r.verdict],...qc(r.verdict,I.evidence)},me=ed(r).length,Be=r.signals.filter(F=>F.conditional).length;return i.jsxs("div",{className:"investigation","aria-busy":o,children:[i.jsxs("section",{className:`finding tone-${K.tone}`,"aria-labelledby":"finding-title","data-testid":"finding",children:[i.jsxs("div",{className:"finding-top",children:[i.jsxs("div",{className:"finding-id",children:[i.jsxs("div",{className:"kline",children:[i.jsx("span",{className:"k",children:r.k}),i.jsxs("span",{children:[P.product_code,(Y=P.product)!=null&&Y.name?` · ${P.product.name}`:""]})]}),i.jsx("h1",{id:"finding-title",children:P.name}),i.jsxs("div",{className:"meta",children:[i.jsx("span",{children:P.applicant}),i.jsxs("span",{children:["Cleared ",we(P.decision_date)]}),i.jsx("span",{children:P.clearance_type||"510(k)"}),i.jsx("a",{href:Hc(r.k),target:"_blank",rel:"noreferrer",children:"FDA record ↗"}),P.summary_url&&i.jsx("a",{href:P.summary_url,target:"_blank",rel:"noreferrer",children:"510(k) summary PDF ↗"})]})]}),i.jsxs("div",{className:`verdict tone-${K.tone}`,"data-testid":"verdict",children:[i.jsxs("div",{className:"verdict-label",children:[i.jsx("i",{"aria-hidden":"true"}),K.label]}),i.jsx("p",{className:"verdict-reason",children:r.verdict_reason}),i.jsx("div",{className:"verdict-actions",children:i.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t("compare",r.k),children:"Compare with other candidates"})}),i.jsxs("div",{className:"authority",children:[i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:i.jsx("path",{d:"M8 1.5l5.5 2v4.2c0 3.3-2.3 5.8-5.5 6.8-3.2-1-5.5-3.5-5.5-6.8V3.5z M5.5 8l1.8 1.8L10.8 6.3"})}),i.jsxs("span",{children:[i.jsx("b",{children:"Deterministic assessment"})," · ",r.rules_version,". Authoritative within its documented scope: ",I.evidence_scope,", from machine-readable FDA records. A documentation signal, not a safety determination."]})]})]})]}),i.jsx(ch,{a:r}),i.jsxs("div",{className:"coverage-row","aria-label":"Evidence coverage",children:[i.jsxs("span",{className:`chip tone-${I.evidence==="complete"?"calm":I.evidence==="uncertain"?"alert":"muted"}`,title:"Completeness of evidence inside the verdict window",children:["Evidence ",I.evidence]}),(I.evidence_reasons||[]).map(F=>i.jsx("span",{className:"chip tone-muted","data-testid":"evidence-reason",children:Qp[F]||F},F)),i.jsxs("span",{className:"chip",children:[I.ancestors," ancestors · ",I.generations_traversed," generations"]}),I.ancestors_lineage_unknown>0&&i.jsxs("span",{className:"chip tone-muted",children:[I.ancestors_lineage_unknown," with unread summaries"]}),I.doubtful_links>0&&i.jsxs("span",{className:"chip tone-alert",children:[I.doubtful_links," doubtful link(s)"]}),Be>0&&i.jsxs("span",{className:"chip tone-violet",children:[Be," conditional signal(s)"]}),me>0&&i.jsxs("a",{className:"chip tone-blue",href:"#review",onClick:F=>{var T;F.preventDefault(),(T=document.getElementById("review"))==null||T.scrollIntoView({block:"start"})},children:[me," item(s) need human review ↓"]})]})]}),i.jsx(rh,{a:r,onSelect:d}),i.jsx(dh,{a:r,onSelect:d}),i.jsxs("section",{className:"panel","aria-labelledby":"graph-title",children:[i.jsxs("div",{className:"panel-head",children:[i.jsxs("h2",{id:"graph-title",children:["Evidence graph ",i.jsxs("span",{className:"count",children:[r.ancestors.length," ancestors · ",r.descendants.length," later devices"]})]}),i.jsxs("div",{className:"graph-tools",children:[i.jsxs("div",{className:"seg",role:"group","aria-label":"View",children:[i.jsx("button",{"aria-pressed":v==="graph",onClick:()=>y("graph"),children:"Graph"}),i.jsx("button",{"aria-pressed":v==="timeline",onClick:()=>y("timeline"),children:"Timeline"})]}),i.jsxs("label",{className:"small muted",children:["Show ",i.jsx("select",{className:"field",value:h,onChange:F=>f(+F.target.value),"aria-label":"Generations shown",children:Array.from({length:c},(F,T)=>T+1).map(F=>i.jsxs("option",{value:F,children:[F," gen"]},F))})]}),i.jsxs("label",{className:"small muted",children:["Query ",i.jsx("select",{className:"field",value:c,onChange:F=>p(+F.target.value),"aria-label":"Generations traversed by the query",children:[1,2,3,4,5,6].map(F=>i.jsxs("option",{value:F,children:[F," gen"]},F))})]}),v==="graph"&&r.descendants.length>0&&i.jsxs("button",{className:"btn btn-line btn-sm","aria-pressed":x,onClick:()=>C(!x),children:[x?"Hide":"Show"," later devices"]})]})]}),v==="graph"?i.jsx(Zp,{a:r,depth:h,onDepth:f,descendants:x,selected:g,onSelect:d,focusChain:m}):i.jsx(bp,{a:r,depth:h,highlight:m||((Ze=ca(r))==null?void 0:Ze.chain),onSelect:d}),i.jsxs("p",{className:"graph-hint",children:["By hand, this is ",1+r.ancestors.filter(F=>F.lineage_known).length," summary PDFs opened one generation at a time and ",1+r.ancestors.length," separate recall searches. Here it is one Relate query."]})]}),i.jsxs("div",{className:"grid-main",children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsxs("section",{className:"panel",id:"review","aria-labelledby":"review-title",style:{scrollMarginTop:120},children:[i.jsxs("div",{className:"panel-head",children:[i.jsxs("h2",{id:"review-title",children:["What needs human review ",i.jsx("span",{className:"count",children:me})]}),i.jsx("p",{className:"hint",children:"What conflicts, why it matters, and what to do next."})]}),i.jsx(uh,{a:r,onSelect:d,go:t,onFocusChain:w})]}),i.jsx(ph,{a:r,onSelect:d})]}),i.jsxs("aside",{style:{minWidth:0},children:[i.jsx(mh,{a:r,reload:R,go:t,onSelect:d}),i.jsx(vh,{a:r,onSaved:()=>{_e.assessments(e).then(E),n&&n()}}),i.jsx(gh,{a:r,assessments:S,runs:j,go:t})]})]}),g&&i.jsx(sh,{sel:g,a:r,onClose:()=>d(null),go:(F,T)=>{d(null),t(F,T)},reload:R,onSelect:d})]})}function ph({a:e,onSelect:t}){const n=e.signals.filter(r=>r.severity==="high"||r.severity==="medium"||r.severity==="low");return i.jsxs("section",{className:"panel","aria-labelledby":"signals-title",children:[i.jsxs("div",{className:"panel-head",children:[i.jsxs("h2",{id:"signals-title",children:["Recall signals ",i.jsxs("span",{className:"count",children:[n.length," in the readable ancestry"]})]}),i.jsx("p",{className:"hint",children:"Every recall record behind the verdict, by generation."})]}),n.length===0&&i.jsx("p",{className:"muted",children:"No recall records anywhere in the readable ancestry."}),n.map((r,l)=>i.jsx(hh,{s:r,onSelect:t},l))]})}function hh({s:e,onSelect:t}){var s;const[n,r]=_.useState(e.severity==="high"),l=e.evidence.filter(a=>a.type==="recall");return i.jsxs("div",{className:"signal",children:[i.jsxs("button",{className:"signal-head","aria-expanded":n,onClick:()=>r(!n),children:[i.jsx("span",{className:`sev sev-${e.severity}`,children:e.conditional?"cond.":e.severity}),i.jsx("span",{className:"t",children:e.title}),i.jsx("svg",{className:"chev",width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:i.jsx("path",{d:"M4 2l4 4-4 4",stroke:"currentColor",fill:"none",strokeWidth:"1.5"})})]}),n&&i.jsxs("div",{className:"signal-body",children:[((s=e.chain)==null?void 0:s.length)>1&&i.jsx("div",{className:"tags",children:e.chain.map((a,o)=>i.jsxs(Sl.Fragment,{children:[o>0&&i.jsx("span",{className:"muted small","aria-hidden":"true",children:"→"}),i.jsx("button",{className:"tag-btn",onClick:()=>t({type:"node",k:a}),children:i.jsx("span",{className:"k",children:a})})]},a))}),l.slice(0,6).map(a=>i.jsx(bc,{r:a},a.id)),l.length>6&&i.jsxs("p",{className:"muted small",children:["+ ",l.length-6," more record(s): open ",e.chain[e.chain.length-1]," for all."]})]})]})}const Ar=(e,t)=>e.review===t&&Ge(e);function mh({a:e,reload:t,go:n,onSelect:r}){const[l,s]=_.useState(null),[a,o]=_.useState(null),u=async(c,p,h)=>{s(c.dst+h),o(null);try{const f=await p();o(h==="ai"?{ok:!0,text:`LLM labelled ${c.dst} "${f.ai_label}" (${f.model.split("/")[1]}, ${f.seconds}s). Advisory only: it is not used for the verdict until a person confirms the citation.`}:null),t()}catch(f){o({ok:!1,text:f.message})}finally{s(null)}};return i.jsxs("section",{className:"panel","aria-labelledby":"cites-title",children:[i.jsx("div",{className:"panel-head",children:i.jsxs("h2",{id:"cites-title",children:["What ",e.k," cites ",i.jsx("span",{className:"count",children:e.citations.length})]})}),i.jsx("p",{className:"lede",children:"Read from its 510(k) summary. Your review is written to the graph and changes every lineage query."}),e.device.lineage_known===!1&&i.jsxs("p",{className:"note-box",children:["Summary not machine-readable (",e.device.summary_status,")."," ",i.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>n("ingest",e.k),children:"Try reading it now →"})]}),a&&i.jsx("p",{className:a.ok?"ok":"err",role:"status",children:a.text}),e.citations.map(c=>{const p={...c,src:e.k},h=c.in_lineage??c.kind==="predicate",f=Et(p);return i.jsxs("div",{className:"cit"+(c.review==="rejected"&&Ge(c)?" is-rejected":""),children:[i.jsxs("div",{className:"cit-h",children:[i.jsx("button",{className:"k mono",onClick:()=>r({type:"edge",id:e.k+">"+c.dst,hop:p}),children:c.dst}),i.jsx("span",{className:`chip ${c.kind==="predicate"?"tone-blue":"tone-muted"}`,children:c.kind}),h||f.key==="advisory"||f.key==="retired"?i.jsxs("span",{className:`status status-${f.key}`,title:$e[f.key].label,"data-testid":`cit-status-${c.dst}`,children:[i.jsx("span",{className:"line"}),$e[f.key].short]}):i.jsx("span",{className:"status status-rejected",title:"Reference devices and mentions are not lineage links","data-testid":`cit-status-${c.dst}`,children:"Not a lineage link"}),c.ai_label&&i.jsxs("span",{className:"chip tone-violet",title:c.ai_quote,children:["LLM: ",c.ai_label]}),i.jsxs("span",{className:"muted small",children:[qe(c.name,34)," · ",Yc(c.dst_decision_date)]})]}),i.jsx(Jc,{text:c.quote||c.snippet,k:c.dst,ocr:c.text_source&&c.text_source!=="pdf_text_layer"}),i.jsxs("div",{className:"cit-a",children:[i.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(c,()=>_e.review(e.k,c.dst,Ar(c,"confirmed")?"":"confirmed"),"ok"),children:Ar(c,"confirmed")?"Unconfirm":"Confirm"}),i.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(c,()=>_e.review(e.k,c.dst,Ar(c,"rejected")?"":"rejected"),"no"),children:Ar(c,"rejected")?"Restore":"Reject"}),c.kind!=="predicate"&&i.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!!l,onClick:()=>u(c,()=>_e.triage(e.k,c.dst),"ai"),children:l===c.dst+"ai"?"Asking…":"Ask LLM to label"}),i.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>r({type:"edge",id:e.k+">"+c.dst,hop:p}),children:["Provenance · p.",c.page]})]})]},c.dst)})]})}function vh({a:e,onSaved:t}){const[n,r]=_.useState(!1),[l,s]=_.useState(""),[a,o]=_.useState(null),[u,c]=_.useState(!1);_.useEffect(()=>{o(null),r(!1),s("")},[e.k]);const p=async()=>{c(!0);try{const f=await _e.save(e.k,l,e.depth);o(f),r(!1),s(""),t()}catch(f){o({error:f.message})}finally{c(!1)}},h=e.memo.headline+` `+e.memo.paragraphs.map(f=>f.text).join(` -`);return i.jsxs("section",{className:"panel memo","aria-labelledby":"memo-title",children:[i.jsx("div",{className:"panel-head",children:i.jsx("h2",{id:"memo-title",children:"Due-diligence note"})}),i.jsx("div",{className:"src",children:e.memo.source}),i.jsx("p",{children:i.jsx("b",{children:e.memo.headline})}),e.memo.paragraphs.slice(0,2).map((f,v)=>i.jsx("p",{children:f.text},v)),e.memo.paragraphs.length>2&&i.jsxs("p",{className:"muted small",children:["+ ",e.memo.paragraphs.length-2," more paragraph(s) in the copied note."]}),i.jsxs("div",{className:"cit-a",style:{marginTop:8},children:[i.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>r(!n),"aria-expanded":n,children:"Save assessment to graph"}),i.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>{var f;return(f=navigator.clipboard)==null?void 0:f.writeText(h)},children:"Copy note"})]}),n&&i.jsxs("div",{style:{marginTop:10,display:"grid",gap:8},children:[i.jsx("label",{className:"small muted",htmlFor:"analyst-note",children:"Optional analyst note, stored with the assessment"}),i.jsx("textarea",{id:"analyst-note",className:"field",rows:3,value:l,onChange:f=>s(f.target.value),maxLength:1e3}),i.jsxs("div",{className:"cit-a",children:[i.jsx("button",{className:"btn btn-primary btn-sm",disabled:u,onClick:p,children:u?"Saving…":"Save to Relate"}),i.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>r(!1),children:"Cancel"})]})]}),a&&(a.error?i.jsx("p",{className:"err",children:a.error}):i.jsxs("p",{className:"ok",role:"status",children:["Saved ",a.id,": linked to ",a.flagged_recalls.length," flagged recall record(s)."]}))]})}function vh({a:e,assessments:t,runs:n,go:r}){return i.jsxs("section",{className:"panel","aria-labelledby":"hist-title",children:[i.jsxs("div",{className:"panel-head",children:[i.jsx("h2",{id:"hist-title",children:"Investigation history"}),i.jsx("a",{className:"small",href:"#/history",children:"All history →"})]}),i.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"0 0 8px"},children:"Saved assessments"}),t.length===0?i.jsxs("p",{className:"muted small",children:["None saved for ",e.k," yet."]}):t.map(l=>{var s,a,o,u,c,p;return i.jsxs("div",{className:"hist",children:[i.jsxs("div",{className:"hist-h",children:[i.jsx("span",{className:"k mono",children:l.id}),i.jsx("span",{className:"muted",children:(s=l.created_at)==null?void 0:s.slice(0,16).replace("T"," ")}),i.jsx("span",{className:`chip tone-${((a=Kn[l.verdict])==null?void 0:a.tone)||"muted"}`,children:((o=Kn[l.verdict])==null?void 0:o.label)||l.verdict})]}),l.stale&&i.jsxs("div",{className:"stale",children:["Stale: the graph changed after this was saved",l.verdict_now!==l.verdict&&i.jsxs(i.Fragment,{children:[" (verdict now ",((u=Kn[l.verdict_now])==null?void 0:u.label)||l.verdict_now,")"]}),((c=l.changed_edges)==null?void 0:c.length)>0&&i.jsxs(i.Fragment,{children:[" · reviewed links: ",l.changed_edges.join(", ")]}),((p=l.reingested)==null?void 0:p.length)>0&&i.jsxs(i.Fragment,{children:[" · re-ingested: ",l.reingested.join(", ")]})]})]},l.id)}),i.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"16px 0 8px"},children:"Agent runs (optional)"}),i.jsx("p",{className:"muted small",style:{margin:"0 0 6px"},children:"Machine findings, never human-approved. The verdict above does not depend on them."}),n.length===0?i.jsxs("p",{className:"muted small",children:["No agent runs examined ",e.k," in this store."]}):n.map(l=>i.jsxs("div",{className:"hist",children:[i.jsxs("div",{className:"hist-h",children:[i.jsx("span",{className:"k mono",children:l.id}),i.jsx("span",{className:"chip",children:l.status}),l.stale&&i.jsx("span",{className:"stale",children:"stale"}),i.jsx("a",{href:Lp(l.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})]}),i.jsx("div",{className:"muted",children:(l.request||"").slice(0,110)})]},l.id))]})}function gh({go:e,stats:t}){const n=[["K252078","BreathePal Bilevel","Cleared 2026 · direct predicate under a Class I design recall"],["K251770","SleepRes PAP System","Cleared 2025 · depth 1 finds no signal; depth 2 finds a Class I design recall"],["K200480","DreamStation 2","Cleared 2020, before the June 2021 recall began"]];return i.jsxs("div",{className:"home-hero",children:[i.jsxs("div",{className:"page-head",children:[i.jsx("p",{className:"eyebrow",children:"Investigate"}),i.jsx("h1",{children:"Check a predicate's ancestry before you cite it."}),i.jsxs("p",{children:["Search any clearance above (press ",i.jsx("code",{children:"/"}),"), or open one of the real cases in the shipped dataset of CPAP, BiPAP and ventilator clearances."]})]}),i.jsxs("div",{className:"home-cases",children:[n.map(([r,l,s])=>i.jsxs("button",{className:"case",onClick:()=>e("check",r),children:[i.jsx("span",{className:"k mono",children:r}),i.jsx("h3",{children:l}),i.jsx("p",{children:s})]},r)),i.jsxs("button",{className:"case",onClick:()=>e("reach","88058,88071"),children:[i.jsx("span",{className:"k mono",children:"Recall 88058 + 88071"}),i.jsx("h3",{children:"Philips foam recall reach"}),i.jsx("p",{children:"Who descends from the June 2021 recall?"})]})]}),t&&i.jsxs("p",{className:"muted small",style:{marginTop:18},children:[t.nodes.Device.toLocaleString("en-US")," clearances · ",t.citations_by_kind.predicate.toLocaleString("en-US")," predicate links · ",t.nodes.Recall.toLocaleString("en-US")," recall records in the Relate store."]})]})}const yh={compare:S.lazy(()=>Ft(()=>import("./Views-Cl1sIo7q.js"),[]).then(e=>({default:e.CompareView}))),reach:S.lazy(()=>Ft(()=>import("./Views-Cl1sIo7q.js"),[]).then(e=>({default:e.ReachView}))),watch:S.lazy(()=>Ft(()=>import("./Views-Cl1sIo7q.js"),[]).then(e=>({default:e.WatchlistView}))),ingest:S.lazy(()=>Ft(()=>import("./Views-Cl1sIo7q.js"),[]).then(e=>({default:e.IngestView}))),history:S.lazy(()=>Ft(()=>import("./History-B4TVd-Qw.js"),[])),method:S.lazy(()=>Ft(()=>import("./Views-Cl1sIo7q.js"),[]).then(e=>({default:e.MethodView})))},xh={check:i.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"}),compare:i.jsx("path",{d:"M2 3h5v10H2zM9 3h5v10H9z"}),reach:i.jsx("path",{d:"M3 8a5 5 0 1010 0A5 5 0 003 8zm3 0a2 2 0 104 0 2 2 0 00-4 0z"}),watch:i.jsx("path",{d:"M1.5 8S4 3 8 3s6.5 5 6.5 5S12 13 8 13 1.5 8 1.5 8zM8 10a2 2 0 100-4 2 2 0 000 4z"}),ingest:i.jsx("path",{d:"M8 2v8m0 0l-3-3m3 3l3-3M2 12v2h12v-2"}),history:i.jsx("path",{d:"M8 4v4l2.5 2M2.5 8a5.5 5.5 0 105.5-5.5A5.6 5.6 0 003 6M3 2.5V6h3.5"}),method:i.jsx("path",{d:"M3 2h7l3 3v9H3zM10 2v3h3M5.5 8h5M5.5 11h5"})},kh=({name:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:xh[e]}),wh=[["Investigate",[["check","Predicate check"],["compare","Compare predicates"]]],["Recall evidence",[["reach","Recall reach"],["watch","Watchlist"]]],["Graph",[["ingest","Add a clearance"],["history","History"],["method","Method"]]]];function jh({route:e,go:t,stats:n,statsErr:r,refreshStats:l,onReplay:s}){var u,c;const a=S.useRef(null);S.useEffect(()=>{var p;(p=a.current)==null||p.focus({preventScroll:!0})},[e.tab]);const o=yh[e.tab];return i.jsxs("div",{className:"ws",children:[i.jsxs("header",{className:"ws-top",children:[i.jsx("a",{className:"brand",href:"#/","aria-label":"Forebear home: the film",children:i.jsx(Rp,{size:24})}),i.jsx(Nh,{go:t}),i.jsx("span",{className:"spacer"}),i.jsxs("div",{className:"store-chip",title:"Live counts from the Relate single-file store",children:[i.jsx("i",{className:"dot"+(r?" off":""),"aria-hidden":"true"}),n?i.jsxs("span",{className:"counts",children:[i.jsx("b",{children:(u=n.nodes.Device)==null?void 0:u.toLocaleString("en-US")})," devices · ",i.jsx("b",{children:(c=n.nodes.Recall)==null?void 0:c.toLocaleString("en-US")})," recalls · Relate"]}):i.jsx("span",{children:r?"API unavailable":"Connecting…"})]})]}),i.jsxs("nav",{className:"ws-rail","aria-label":"Workspace",children:[wh.map(([p,h])=>i.jsxs(_l.Fragment,{children:[i.jsx("div",{className:"group",children:p}),h.map(([f,v])=>i.jsxs("a",{href:`#/${f}`,"aria-current":e.tab===f?"page":void 0,children:[i.jsx(kh,{name:f}),v]},f))]},p)),i.jsxs("div",{className:"rail-foot",children:["Verdicts are deterministic documentation signals from FDA records, not safety findings.",!matchMedia("(prefers-reduced-motion: reduce)").matches&&i.jsx("div",{style:{marginTop:10},children:i.jsx("button",{onClick:s,children:"Replay the film"})})]})]}),i.jsxs("main",{className:"ws-main",id:"main",ref:a,tabIndex:-1,style:{outline:"none"},children:[e.tab==="check"&&(e.arg?i.jsx(dh,{k:e.arg.toUpperCase(),go:t,onChanged:l}):i.jsx(gh,{go:t,stats:n})),o&&i.jsx(S.Suspense,{fallback:i.jsxs("div",{className:"loading-thread",children:[i.jsx("i",{}),"Loading…"]}),children:i.jsx(o,{initial:e.arg,go:t,onChanged:l,stats:n})}),!o&&e.tab!=="check"&&i.jsx("div",{className:"panel",children:i.jsxs("p",{children:["Unknown page. ",i.jsx("a",{href:"#/check",children:"Go to the workspace →"})]})}),i.jsx("footer",{className:"ws-foot",children:"Public FDA data: openFDA 510(k), recall and enforcement records; 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."})]})]})}function Nh({go:e}){const[t,n]=S.useState(""),[r,l]=S.useState([]),[s,a]=S.useState(!1),[o,u]=S.useState(0),c=S.useRef(null),p=S.useRef(null);S.useEffect(()=>{if(clearTimeout(p.current),t.trim().length<2){l([]);return}let v=!0;return p.current=setTimeout(()=>Se.search(t).then(y=>{v&&(l(y),u(0))}).catch(()=>v&&l([])),160),()=>{v=!1}},[t]),S.useEffect(()=>{const v=y=>{var x,C;y.key==="/"&&!/INPUT|TEXTAREA|SELECT/.test((x=document.activeElement)==null?void 0:x.tagName)&&(y.preventDefault(),(C=c.current)==null||C.focus())};return addEventListener("keydown",v),()=>removeEventListener("keydown",v)},[]);const h=v=>{var y;a(!1),n(""),(y=c.current)==null||y.blur(),e("check",v)},f=s&&r.length>0;return i.jsxs("div",{className:"search",role:"search",children:[i.jsx("svg",{className:"icon",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:i.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"})}),i.jsx("input",{ref:c,className:"field",value:t,placeholder:"Search a device or K-number","aria-label":"Search devices by name or K-number",role:"combobox","aria-expanded":f,"aria-controls":"search-results","aria-activedescendant":f?`sr-${o}`:void 0,"aria-autocomplete":"list",onChange:v=>{n(v.target.value),a(!0)},onFocus:()=>a(!0),onBlur:()=>setTimeout(()=>a(!1),150),onKeyDown:v=>{if(v.key==="ArrowDown")v.preventDefault(),u(y=>Math.min(y+1,r.length-1));else if(v.key==="ArrowUp")v.preventDefault(),u(y=>Math.max(y-1,0));else if(v.key==="Escape")a(!1),v.currentTarget.blur();else if(v.key==="Enter"){const y=t.trim().toUpperCase();/^K\d{6}$/.test(y)?h(y):r[o]&&h(r[o].k)}}}),!t&&i.jsx("kbd",{"aria-hidden":"true",children:"/"}),f&&i.jsx("ul",{className:"search-results",id:"search-results",role:"listbox",children:r.map((v,y)=>i.jsxs("li",{id:`sr-${y}`,role:"option","aria-selected":y===o,onMouseDown:()=>h(v.k),onMouseEnter:()=>u(y),children:[i.jsxs("span",{children:[i.jsx("span",{className:"k",children:v.k})," ",v.name]}),i.jsxs("small",{children:[v.applicant," · ",v.decision_date," · ",v.product_code]})]},v.k))})]})}const Sh=S.lazy(()=>Ft(()=>import("./Landing-0CfXrj7l.js"),[])),_h={about:"method"};function Or(e=window.location.hash){if(!e.startsWith("#/"))return{tab:"film",arg:""};const t=e.replace(/^#\/?/,"");if(!t)return{tab:"film",arg:""};const[n,...r]=t.split("/");return{tab:_h[n]||n||"film",arg:decodeURIComponent(r.join("/")||"")}}const Eh=(e,t)=>e==="film"?"#/":`#/${e}${t?"/"+t:""}`;function Ch(){const[e,t]=S.useState(Or),[n,r]=S.useState(null),[l,s]=S.useState(null),a=Ip("(prefers-reduced-motion: reduce)"),[o,u]=S.useState(()=>e.tab==="film"&&!$p()&&!matchMedia("(prefers-reduced-motion: reduce)").matches),[c,p]=S.useState(o?"pending":"none");S.useEffect(()=>{document.documentElement.dataset.motion=a?"reduced":"full"},[a]),S.useEffect(()=>{const y=()=>t(Or());return addEventListener("hashchange",y),()=>removeEventListener("hashchange",y)},[]);const h=S.useCallback((y=0)=>Se.stats().then(x=>{r(x),s(null)}).catch(x=>{y<5?setTimeout(()=>h(y+1),800*(y+1)):s(x.message)}),[]);S.useEffect(()=>{h()},[h]),S.useEffect(()=>{const y={film:"Forebear · Every clearance has a past",check:e.arg?`${e.arg} · Forebear`:"Investigate · Forebear",compare:"Compare predicates · Forebear",reach:"Recall reach · Forebear",watch:"Watchlist · Forebear",ingest:"Add a clearance · Forebear",history:"History · Forebear",method:"Method · Forebear"};document.title=y[e.tab]||"Forebear"},[e]);const f=S.useCallback((y,x="",C={})=>{const g=Eh(y,x),d=()=>{history.pushState(null,"",g),t(Or(g)),window.scrollTo(0,0)};C.transition&&!a&&document.startViewTransition?document.startViewTransition(()=>Wc.flushSync(d)):d()},[a]);S.useEffect(()=>{const y=()=>t(Or());return addEventListener("popstate",y),()=>removeEventListener("popstate",y)},[]);const v=()=>{Fp(),e.tab!=="film"&&f("film"),window.scrollTo(0,0),a||(p("pending"),u(!0))};return i.jsxs(i.Fragment,{children:[i.jsx("a",{className:"skip-link",href:"#main",onClick:y=>{var x;y.preventDefault(),(x=document.getElementById("main"))==null||x.focus()},children:"Skip to content"}),o&&i.jsx(Mp,{onDone:()=>{p("bloom"),setTimeout(()=>u(!1),700),requestAnimationFrame(()=>{var y;return(y=document.getElementById("hero-title"))==null?void 0:y.focus({preventScroll:!0})})}}),i.jsx("div",{inert:o&&c==="pending"?"":void 0,style:{display:"contents"},children:e.tab==="film"?i.jsx(S.Suspense,{fallback:i.jsx("div",{style:{minHeight:"100vh"}}),children:i.jsx(Sh,{go:f,stats:n,introDone:c,reduced:a})}):i.jsx(jh,{route:e,go:f,stats:n,statsErr:l,refreshStats:h,onReplay:v})})]})}Bc(document.getElementById("root")).render(i.jsx(Ch,{}));export{Zc as A,Th as E,Qc as M,hs as P,_l as R,Ph as T,Kn as V,Rp as W,Ft as _,Qp as a,So as b,Se as c,Lp as d,we as f,i as j,No as m,ci as p,S as r,Ip as u,qc as v}; +`);return i.jsxs("section",{className:"panel memo","aria-labelledby":"memo-title",children:[i.jsx("div",{className:"panel-head",children:i.jsx("h2",{id:"memo-title",children:"Due-diligence note"})}),i.jsx("div",{className:"src",children:e.memo.source}),i.jsx("p",{children:i.jsx("b",{children:e.memo.headline})}),e.memo.paragraphs.slice(0,2).map((f,v)=>i.jsx("p",{children:f.text},v)),e.memo.paragraphs.length>2&&i.jsxs("p",{className:"muted small",children:["+ ",e.memo.paragraphs.length-2," more paragraph(s) in the copied note."]}),i.jsxs("div",{className:"cit-a",style:{marginTop:8},children:[i.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>r(!n),"aria-expanded":n,children:"Save assessment to graph"}),i.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>{var f;return(f=navigator.clipboard)==null?void 0:f.writeText(h)},children:"Copy note"})]}),n&&i.jsxs("div",{style:{marginTop:10,display:"grid",gap:8},children:[i.jsx("label",{className:"small muted",htmlFor:"analyst-note",children:"Optional analyst note, stored with the assessment"}),i.jsx("textarea",{id:"analyst-note",className:"field",rows:3,value:l,onChange:f=>s(f.target.value),maxLength:1e3}),i.jsxs("div",{className:"cit-a",children:[i.jsx("button",{className:"btn btn-primary btn-sm",disabled:u,onClick:p,children:u?"Saving…":"Save to Relate"}),i.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>r(!1),children:"Cancel"})]})]}),a&&(a.error?i.jsx("p",{className:"err",children:a.error}):i.jsxs("p",{className:"ok",role:"status",children:["Saved ",a.id," at ",a.depth," gen: linked to ",a.flagged_recalls.length," flagged recall record(s)."]}))]})}function gh({a:e,assessments:t,runs:n,go:r}){return i.jsxs("section",{className:"panel","aria-labelledby":"hist-title",children:[i.jsxs("div",{className:"panel-head",children:[i.jsx("h2",{id:"hist-title",children:"Investigation history"}),i.jsx("a",{className:"small",href:"#/history",children:"All history →"})]}),i.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"0 0 8px"},children:"Saved assessments"}),t.length===0?i.jsxs("p",{className:"muted small",children:["None saved for ",e.k," yet."]}):t.map(l=>{var s,a,o,u,c,p;return i.jsxs("div",{className:"hist",children:[i.jsxs("div",{className:"hist-h",children:[i.jsx("span",{className:"k mono",children:l.id}),i.jsx("span",{className:"muted",children:(s=l.created_at)==null?void 0:s.slice(0,16).replace("T"," ")}),i.jsx("span",{className:"muted","data-testid":"saved-depth",children:nh(l)}),i.jsx("span",{className:`chip tone-${((a=Kn[l.verdict])==null?void 0:a.tone)||"muted"}`,children:((o=Kn[l.verdict])==null?void 0:o.label)||l.verdict})]}),l.stale&&i.jsxs("div",{className:"stale",children:["Stale: the graph changed after this was saved",l.verdict_now!==l.verdict&&i.jsxs(i.Fragment,{children:[" (verdict now ",((u=Kn[l.verdict_now])==null?void 0:u.label)||l.verdict_now,")"]}),((c=l.changed_edges)==null?void 0:c.length)>0&&i.jsxs(i.Fragment,{children:[" · reviewed links: ",l.changed_edges.join(", ")]}),((p=l.reingested)==null?void 0:p.length)>0&&i.jsxs(i.Fragment,{children:[" · re-ingested: ",l.reingested.join(", ")]})]})]},l.id)}),i.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"16px 0 8px"},children:"Agent runs (optional)"}),i.jsx("p",{className:"muted small",style:{margin:"0 0 6px"},children:"Machine findings, never human-approved. The verdict above does not depend on them."}),n.length===0?i.jsxs("p",{className:"muted small",children:["No agent runs examined ",e.k," in this store."]}):n.map(l=>i.jsxs("div",{className:"hist",children:[i.jsxs("div",{className:"hist-h",children:[i.jsx("span",{className:"k mono",children:l.id}),i.jsx("span",{className:"chip",children:l.status}),l.stale&&i.jsx("span",{className:"stale",children:"stale"}),i.jsx("a",{href:Lp(l.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})]}),i.jsx("div",{className:"muted",children:(l.request||"").slice(0,110)})]},l.id))]})}function yh({go:e,stats:t}){const n=[["K252078","BreathePal Bilevel","Cleared 2026 · direct predicate under a Class I design recall"],["K251770","SleepRes PAP System","Cleared 2025 · depth 1 finds no signal; depth 2 finds a Class I design recall"],["K200480","DreamStation 2","Cleared 2020, before the June 2021 recall began"]];return i.jsxs("div",{className:"home-hero",children:[i.jsxs("div",{className:"page-head",children:[i.jsx("p",{className:"eyebrow",children:"Investigate"}),i.jsx("h1",{children:"Check a predicate's ancestry before you cite it."}),i.jsxs("p",{children:["Search any clearance above (press ",i.jsx("code",{children:"/"}),"), or open one of the real cases in the shipped dataset of CPAP, BiPAP and ventilator clearances."]})]}),i.jsxs("div",{className:"home-cases",children:[n.map(([r,l,s])=>i.jsxs("button",{className:"case",onClick:()=>e("check",r),children:[i.jsx("span",{className:"k mono",children:r}),i.jsx("h3",{children:l}),i.jsx("p",{children:s})]},r)),i.jsxs("button",{className:"case",onClick:()=>e("reach","88058,88071"),children:[i.jsx("span",{className:"k mono",children:"Recall 88058 + 88071"}),i.jsx("h3",{children:"Philips foam recall reach"}),i.jsx("p",{children:"Who descends from the June 2021 recall?"})]})]}),t&&i.jsxs("p",{className:"muted small",style:{marginTop:18},children:[t.nodes.Device.toLocaleString("en-US")," clearances · ",t.citations_by_kind.predicate.toLocaleString("en-US")," predicate links · ",t.nodes.Recall.toLocaleString("en-US")," recall records in the Relate store."]})]})}const xh={compare:_.lazy(()=>Ft(()=>import("./Views-BJljN5JI.js"),[]).then(e=>({default:e.CompareView}))),reach:_.lazy(()=>Ft(()=>import("./Views-BJljN5JI.js"),[]).then(e=>({default:e.ReachView}))),watch:_.lazy(()=>Ft(()=>import("./Views-BJljN5JI.js"),[]).then(e=>({default:e.WatchlistView}))),ingest:_.lazy(()=>Ft(()=>import("./Views-BJljN5JI.js"),[]).then(e=>({default:e.IngestView}))),history:_.lazy(()=>Ft(()=>import("./History-CRNBlWcy.js"),[])),method:_.lazy(()=>Ft(()=>import("./Views-BJljN5JI.js"),[]).then(e=>({default:e.MethodView})))},kh={check:i.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"}),compare:i.jsx("path",{d:"M2 3h5v10H2zM9 3h5v10H9z"}),reach:i.jsx("path",{d:"M3 8a5 5 0 1010 0A5 5 0 003 8zm3 0a2 2 0 104 0 2 2 0 00-4 0z"}),watch:i.jsx("path",{d:"M1.5 8S4 3 8 3s6.5 5 6.5 5S12 13 8 13 1.5 8 1.5 8zM8 10a2 2 0 100-4 2 2 0 000 4z"}),ingest:i.jsx("path",{d:"M8 2v8m0 0l-3-3m3 3l3-3M2 12v2h12v-2"}),history:i.jsx("path",{d:"M8 4v4l2.5 2M2.5 8a5.5 5.5 0 105.5-5.5A5.6 5.6 0 003 6M3 2.5V6h3.5"}),method:i.jsx("path",{d:"M3 2h7l3 3v9H3zM10 2v3h3M5.5 8h5M5.5 11h5"})},wh=({name:e})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:kh[e]}),jh=[["Investigate",[["check","Predicate check"],["compare","Compare predicates"]]],["Recall evidence",[["reach","Recall reach"],["watch","Watchlist"]]],["Graph",[["ingest","Add a clearance"],["history","History"],["method","Method"]]]];function Nh({route:e,go:t,stats:n,statsErr:r,refreshStats:l,onReplay:s}){var u,c;const a=_.useRef(null);_.useEffect(()=>{var p;(p=a.current)==null||p.focus({preventScroll:!0})},[e.tab]);const o=xh[e.tab];return i.jsxs("div",{className:"ws",children:[i.jsxs("header",{className:"ws-top",children:[i.jsx("a",{className:"brand",href:"#/","aria-label":"Forebear home: the film",children:i.jsx(Rp,{size:24})}),i.jsx(_h,{go:t}),i.jsx("span",{className:"spacer"}),i.jsxs("div",{className:"store-chip",title:"Live counts from the Relate single-file store",children:[i.jsx("i",{className:"dot"+(r?" off":""),"aria-hidden":"true"}),n?i.jsxs("span",{className:"counts",children:[i.jsx("b",{children:(u=n.nodes.Device)==null?void 0:u.toLocaleString("en-US")})," devices · ",i.jsx("b",{children:(c=n.nodes.Recall)==null?void 0:c.toLocaleString("en-US")})," recalls · Relate"]}):i.jsx("span",{children:r?"API unavailable":"Connecting…"})]})]}),i.jsxs("nav",{className:"ws-rail","aria-label":"Workspace",children:[jh.map(([p,h])=>i.jsxs(Sl.Fragment,{children:[i.jsx("div",{className:"group",children:p}),h.map(([f,v])=>i.jsxs("a",{href:`#/${f}`,"aria-current":e.tab===f?"page":void 0,children:[i.jsx(wh,{name:f}),v]},f))]},p)),i.jsxs("div",{className:"rail-foot",children:["Verdicts are deterministic documentation signals from FDA records, not safety findings.",!matchMedia("(prefers-reduced-motion: reduce)").matches&&i.jsx("div",{style:{marginTop:10},children:i.jsx("button",{onClick:s,children:"Replay the film"})})]})]}),i.jsxs("main",{className:"ws-main",id:"main",ref:a,tabIndex:-1,style:{outline:"none"},children:[e.tab==="check"&&(e.arg?i.jsx(fh,{k:e.arg.toUpperCase(),go:t,onChanged:l}):i.jsx(yh,{go:t,stats:n})),o&&i.jsx(_.Suspense,{fallback:i.jsxs("div",{className:"loading-thread",children:[i.jsx("i",{}),"Loading…"]}),children:i.jsx(o,{initial:e.arg,go:t,onChanged:l,stats:n})}),!o&&e.tab!=="check"&&i.jsx("div",{className:"panel",children:i.jsxs("p",{children:["Unknown page. ",i.jsx("a",{href:"#/check",children:"Go to the workspace →"})]})}),i.jsx("footer",{className:"ws-foot",children:"Public FDA data: openFDA 510(k), recall and enforcement records; 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."})]})]})}function _h({go:e}){const[t,n]=_.useState(""),[r,l]=_.useState([]),[s,a]=_.useState(!1),[o,u]=_.useState(0),c=_.useRef(null),p=_.useRef(null);_.useEffect(()=>{if(clearTimeout(p.current),t.trim().length<2){l([]);return}let v=!0;return p.current=setTimeout(()=>_e.search(t).then(y=>{v&&(l(y),u(0))}).catch(()=>v&&l([])),160),()=>{v=!1}},[t]),_.useEffect(()=>{const v=y=>{var x,C;y.key==="/"&&!/INPUT|TEXTAREA|SELECT/.test((x=document.activeElement)==null?void 0:x.tagName)&&(y.preventDefault(),(C=c.current)==null||C.focus())};return addEventListener("keydown",v),()=>removeEventListener("keydown",v)},[]);const h=v=>{var y;a(!1),n(""),(y=c.current)==null||y.blur(),e("check",v)},f=s&&r.length>0;return i.jsxs("div",{className:"search",role:"search",children:[i.jsx("svg",{className:"icon",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:i.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"})}),i.jsx("input",{ref:c,className:"field",value:t,placeholder:"Search a device or K-number","aria-label":"Search devices by name or K-number",role:"combobox","aria-expanded":f,"aria-controls":"search-results","aria-activedescendant":f?`sr-${o}`:void 0,"aria-autocomplete":"list",onChange:v=>{n(v.target.value),a(!0)},onFocus:()=>a(!0),onBlur:()=>setTimeout(()=>a(!1),150),onKeyDown:v=>{if(v.key==="ArrowDown")v.preventDefault(),u(y=>Math.min(y+1,r.length-1));else if(v.key==="ArrowUp")v.preventDefault(),u(y=>Math.max(y-1,0));else if(v.key==="Escape")a(!1),v.currentTarget.blur();else if(v.key==="Enter"){const y=t.trim().toUpperCase();/^K\d{6}$/.test(y)?h(y):r[o]&&h(r[o].k)}}}),!t&&i.jsx("kbd",{"aria-hidden":"true",children:"/"}),f&&i.jsx("ul",{className:"search-results",id:"search-results",role:"listbox",children:r.map((v,y)=>i.jsxs("li",{id:`sr-${y}`,role:"option","aria-selected":y===o,onMouseDown:()=>h(v.k),onMouseEnter:()=>u(y),children:[i.jsxs("span",{children:[i.jsx("span",{className:"k",children:v.k})," ",v.name]}),i.jsxs("small",{children:[v.applicant," · ",v.decision_date," · ",v.product_code]})]},v.k))})]})}const Sh=_.lazy(()=>Ft(()=>import("./Landing-DOKreNVa.js"),[])),Eh={about:"method"};function Or(e=window.location.hash){if(!e.startsWith("#/"))return{tab:"film",arg:""};const t=e.replace(/^#\/?/,"");if(!t)return{tab:"film",arg:""};const[n,...r]=t.split("/");return{tab:Eh[n]||n||"film",arg:decodeURIComponent(r.join("/")||"")}}const Ch=(e,t)=>e==="film"?"#/":`#/${e}${t?"/"+t:""}`;function Th(){const[e,t]=_.useState(Or),[n,r]=_.useState(null),[l,s]=_.useState(null),a=Ip("(prefers-reduced-motion: reduce)"),[o,u]=_.useState(()=>e.tab==="film"&&!$p()&&!matchMedia("(prefers-reduced-motion: reduce)").matches),[c,p]=_.useState(o?"pending":"none");_.useEffect(()=>{document.documentElement.dataset.motion=a?"reduced":"full"},[a]),_.useEffect(()=>{const y=()=>t(Or());return addEventListener("hashchange",y),()=>removeEventListener("hashchange",y)},[]);const h=_.useCallback((y=0)=>_e.stats().then(x=>{r(x),s(null)}).catch(x=>{y<5?setTimeout(()=>h(y+1),800*(y+1)):s(x.message)}),[]);_.useEffect(()=>{h()},[h]),_.useEffect(()=>{const y={film:"Forebear · Every clearance has a past",check:e.arg?`${e.arg} · Forebear`:"Investigate · Forebear",compare:"Compare predicates · Forebear",reach:"Recall reach · Forebear",watch:"Watchlist · Forebear",ingest:"Add a clearance · Forebear",history:"History · Forebear",method:"Method · Forebear"};document.title=y[e.tab]||"Forebear"},[e]);const f=_.useCallback((y,x="",C={})=>{const g=Ch(y,x),d=()=>{history.pushState(null,"",g),t(Or(g)),window.scrollTo(0,0)};C.transition&&!a&&document.startViewTransition?document.startViewTransition(()=>Wc.flushSync(d)):d()},[a]);_.useEffect(()=>{const y=()=>t(Or());return addEventListener("popstate",y),()=>removeEventListener("popstate",y)},[]);const v=()=>{Fp(),e.tab!=="film"&&f("film"),window.scrollTo(0,0),a||(p("pending"),u(!0))};return i.jsxs(i.Fragment,{children:[i.jsx("a",{className:"skip-link",href:"#main",onClick:y=>{var x;y.preventDefault(),(x=document.getElementById("main"))==null||x.focus()},children:"Skip to content"}),o&&i.jsx(Mp,{onDone:()=>{p("bloom"),setTimeout(()=>u(!1),700),requestAnimationFrame(()=>{var y;return(y=document.getElementById("hero-title"))==null?void 0:y.focus({preventScroll:!0})})}}),i.jsx("div",{inert:o&&c==="pending"?"":void 0,style:{display:"contents"},children:e.tab==="film"?i.jsx(_.Suspense,{fallback:i.jsx("div",{style:{minHeight:"100vh"}}),children:i.jsx(Sh,{go:f,stats:n,introDone:c,reduced:a})}):i.jsx(Nh,{route:e,go:f,stats:n,statsErr:l,refreshStats:h,onReplay:v})})]})}Bc(document.getElementById("root")).render(i.jsx(Th,{}));export{Zc as A,Ph as E,Qc as M,hs as P,Sl as R,Lh as T,Kn as V,Rp as W,Ft as _,Qp as a,_o as b,_e as c,nh as d,Lp as e,we as f,i as j,No as m,ci as p,_ as r,Ip as u,qc as v}; diff --git a/web/dist/index.html b/web/dist/index.html index 3b46a58..cafacf3 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -7,7 +7,7 @@ - + diff --git a/web/e2e/saved-depth.spec.js b/web/e2e/saved-depth.spec.js new file mode 100644 index 0000000..0e3c612 --- /dev/null +++ b/web/e2e/saved-depth.spec.js @@ -0,0 +1,127 @@ +import { test, expect } from '@playwright/test' +import { startIsolatedApi } from './server.mjs' + +/* + A saved assessment keeps the query depth it was computed at, and history rechecks it at that depth. + K251770 (the two-hop showcase) reports no design-recall signal at depth 1 and REVIEW_LINEAGE from depth 2, so a + depth-1 assessment rechecked at the old default of 4 would be called stale on an unchanged graph. + K113068 -> K091319 leaves a generation-3 ancestor: a change to it matters at depth 4, not at depth 1 or 2. + K251770 -> K200480 is the direct predicate: rejecting it changes the evidence at every depth. + e2e/seed_legacy_assessment.py adds A-e2elegacy1, saved at depth 1 before depth was stored on the node. + Saves and reviews consume the store, so every attempt runs against its own freshly seeded API. +*/ +const K = 'K251770', LEGACY = 'A-e2elegacy1' + +const withStore = test.extend({ + api: async ({}, use) => { + const api = await startIsolatedApi({ seed: 'seed_legacy_assessment.py' }) + try { await use(api.url) } finally { await api.stop() } + }, +}) + +async function saveFromUi(page, depth) { + const select = page.getByLabel('Generations traversed by the query') + if (await select.inputValue() !== String(depth)) { + await Promise.all([ + page.waitForResponse((r) => r.url().includes(`/api/assess/${K}?depth=${depth}`)), + select.selectOption(String(depth)), + ]) + } + await expect(page.getByRole('button', { name: 'Save assessment to graph' })).toBeVisible() + await page.getByRole('button', { name: 'Save assessment to graph' }).click() + const [req, res] = await Promise.all([ + page.waitForRequest((r) => r.url().endsWith('/api/assessments') && r.method() === 'POST'), + page.waitForResponse((r) => r.url().endsWith('/api/assessments') && r.request().method() === 'POST'), + page.getByRole('button', { name: 'Save to Relate' }).click(), + ]) + expect(req.postDataJSON().depth).toBe(depth) + const saved = await res.json() + expect(saved.depth).toBe(depth) + await expect(page.locator('.memo').getByRole('status')).toContainText(`Saved ${saved.id} at ${depth} gen`) + return saved +} + +const row = (page, id) => page.locator('tr', { has: page.getByText(id, { exact: true }) }) + +async function expectRow(page, id, depthText, state) { + const r = row(page, id) + await expect(r.getByTestId('saved-depth')).toHaveText(depthText) + await expect(r.locator('td').nth(4)).toHaveText(state) +} + +withStore('saved assessments keep their depth and go stale only on evidence that depth reads', async ({ page, request, api }) => { + await page.goto(`${api}/#/check/${K}`) + const d1 = await saveFromUi(page, 1) + const d2 = await saveFromUi(page, 2) + const d4 = await saveFromUi(page, 4) + expect([d1.verdict, d2.verdict, d4.verdict]).toEqual(['NO_DESIGN_RECALL_SIGNAL', 'REVIEW_LINEAGE', 'REVIEW_LINEAGE']) + + // the investigation's own history lists each save with its depth, none stale on the unchanged graph + await page.reload() + for (const [s, label] of [[d1, '1 gen'], [d2, '2 gen'], [d4, '4 gen']]) { + const hist = page.locator('.hist', { has: page.getByText(s.id, { exact: true }) }) + await expect(hist.getByTestId('saved-depth')).toHaveText(label) + } + await expect(page.locator('.hist .stale')).toHaveCount(0) + + await page.goto(`${api}/#/history`) + await expectRow(page, d1.id, '1 gen', 'Current') + await expectRow(page, d2.id, '2 gen', 'Current') + await expectRow(page, d4.id, '4 gen', 'Current') + await expectRow(page, LEGACY, '1 gen · legacy', 'Current') + + // a review in generation 3 is evidence for the depth-4 assessment only + expect((await request.post(`${api}/api/citation/review`, { data: { src: 'K113068', dst: 'K091319', status: 'confirmed' } })).ok()).toBe(true) + await page.reload() + await expectRow(page, d4.id, '4 gen', 'Stale') + await expectRow(page, d2.id, '2 gen', 'Current') + await expectRow(page, d1.id, '1 gen', 'Current') + await expectRow(page, LEGACY, '1 gen · legacy', 'Current') + + // rejecting the direct predicate changes the evidence at every depth, and the verdict where it was a signal + expect((await request.post(`${api}/api/citation/review`, { data: { src: K, dst: 'K200480', status: 'rejected' } })).ok()).toBe(true) + await page.reload() + await expectRow(page, d4.id, '4 gen', /^Stale · now /) + await expectRow(page, d2.id, '2 gen', /^Stale · now /) + await expectRow(page, d1.id, '1 gen', /^Stale/) + await expectRow(page, LEGACY, '1 gen · legacy', /^Stale/) +}) + +withStore('a depth-1 query works through the verdict, graph, generation selector and saved history', async ({ page, api }) => { + await page.goto(`${api}/#/check/${K}`) + const query = page.getByLabel('Generations traversed by the query') + const shown = page.getByLabel('Generations shown') + await expect(query.locator('option')).toHaveText(['1 gen', '2 gen', '3 gen', '4 gen', '5 gen', '6 gen']) + await expect(page.getByTestId('depth-contrast')).toBeVisible() // the depth-4 query finds the two-hop recall + + await Promise.all([page.waitForResponse((r) => r.url().includes(`/api/assess/${K}?depth=1`)), query.selectOption('1')]) + await expect(page.getByTestId('verdict')).toContainText('No design-recall signal') + // only the direct predicate is queried and drawn; the shown generations cannot exceed the query + await expect(shown.locator('option')).toHaveText(['1 gen']) + await expect(shown).toHaveValue('1') + const graph = page.getByTestId('evidence-graph') + await expect(graph.locator('svg')).toHaveAttribute('aria-label', `Predicate lineage graph for ${K}: 2 devices, 1 citations`) + await expect(graph.locator('.lk', { hasText: 'K200480' })).toHaveCount(1) + await expect(graph.locator('.lk', { hasText: 'K131982' })).toHaveCount(0) + await expect(graph.locator('.g-more')).toHaveCount(0) + await expect(page.getByTestId('depth-contrast')).toHaveCount(0) // nothing deeper to contrast with + await page.getByRole('button', { name: 'Timeline', exact: true }).click() + await expect(page.getByText('K131982', { exact: true })).toHaveCount(0) + await page.getByRole('button', { name: 'Graph', exact: true }).click() + + const saved = await saveFromUi(page, 1) + expect([saved.depth, saved.verdict]).toEqual([1, 'NO_DESIGN_RECALL_SIGNAL']) + const hist = page.locator('.hist', { has: page.getByText(saved.id, { exact: true }) }) + await expect(hist.getByTestId('saved-depth')).toHaveText('1 gen') + await expect(hist).toContainText('No design-recall signal') + await expect(hist.locator('.stale')).toHaveCount(0) + + // back to a deeper query: the verdict and generation choices follow, the depth-1 save stays current + await Promise.all([page.waitForResponse((r) => r.url().includes(`/api/assess/${K}?depth=2`)), query.selectOption('2')]) + await expect(page.getByTestId('verdict')).toContainText('Review lineage') + await expect(shown.locator('option')).toHaveText(['1 gen', '2 gen']) + await expect(shown).toHaveValue('2') + await expect(graph.locator('.lk', { hasText: 'K131982' })).toHaveCount(1) + await page.goto(`${api}/#/history`) + await expectRow(page, saved.id, '1 gen', 'Current') +}) diff --git a/web/e2e/seed_legacy_assessment.py b/web/e2e/seed_legacy_assessment.py new file mode 100644 index 0000000..1b47cc7 --- /dev/null +++ b/web/e2e/seed_legacy_assessment.py @@ -0,0 +1,25 @@ +"""Give the throwaway e2e store one saved assessment of K251770 as it was stored before the query depth was kept on +the node: no `depth` property, the depth only inside its payload. It was computed at depth 1, where K251770 reports +no design-recall signal (depth 2 and deeper report REVIEW_LINEAGE), so rechecking it at any other depth would wrongly +call it stale. Run by e2e/server.mjs startIsolatedApi on a fresh store copy before its API opens it; never on +data/forebear.rl.""" +import json +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parents[2])) +from forebear.graph import open_graph # noqa: E402 + +K, AID, VERDICT = "K251770", "A-e2elegacy1", "NO_DESIGN_RECALL_SIGNAL" + +db = Path(sys.argv[1]).resolve() +if db.name == "forebear.rl" and db.parent.name == "data": + sys.exit("refusing to seed the shipped store") +g = open_graph(db) +rows = g.q("""MATCH (d:Device {k:$k}) + CREATE (a:Assessment {id:$id, created_at: datetime(), target_k:$k, verdict:$v, payload:$p, + memo:'e2e seed: saved before depth was stored', memo_source:'template'})-[:ASSESSED]->(d) + RETURN a.id AS id""", {"k": K, "id": AID, "v": VERDICT, "p": json.dumps({"verdict": VERDICT, "depth": 1})}) +g.close() +if not rows: + sys.exit(f"could not seed a legacy assessment on {K}") diff --git a/web/src/api.js b/web/src/api.js index d5b18fb..113cdc1 100644 --- a/web/src/api.js +++ b/web/src/api.js @@ -23,7 +23,7 @@ export const api = { ingest: (k, refresh = false) => req('/api/ingest', { method: 'POST', body: { k, refresh } }), review: (src, dst, status, note) => req('/api/citation/review', { method: 'POST', body: { src, dst, status, note } }), triage: (src, dst) => req('/api/citation/triage', { method: 'POST', body: { src, dst } }), - save: (k, note) => req('/api/assessments', { method: 'POST', body: { k, note } }), + save: (k, note, depth) => req('/api/assessments', { method: 'POST', body: { k, note, depth } }), assessments: (k) => req(`/api/assessments${k ? `?k=${k}` : ''}`), // Phase 2 agent runs: secondary to the deterministic assessment, shown as history investigations: (k, limit = 30) => req(`/api/investigations?limit=${limit}${k ? `&k=${k}` : ''}`), diff --git a/web/src/workspace/History.jsx b/web/src/workspace/History.jsx index 8855c62..e112b12 100644 --- a/web/src/workspace/History.jsx +++ b/web/src/workspace/History.jsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react' import { api, reportUrl } from '../api.js' import { VERDICTS } from '../evidence.js' +import { depthLabel } from './depth.js' /* Everything that was saved or run against the graph: assessments first (deterministic), agent runs second. */ export default function History({ go }) { @@ -28,11 +29,12 @@ export default function History({ go }) { {assess && assess.length === 0 &&

None yet. Save one from any investigation.

} {assess && assess.length > 0 && (
- + {assess.map((h) => ( go('check', h.k)} onKeyDown={(e) => e.key === 'Enter' && go('check', h.k)}> + diff --git a/web/src/workspace/Investigation.jsx b/web/src/workspace/Investigation.jsx index ff57599..68ca5e8 100644 --- a/web/src/workspace/Investigation.jsx +++ b/web/src/workspace/Investigation.jsx @@ -6,6 +6,7 @@ import { import EvidenceGraph from './EvidenceGraph.jsx' import Timeline from './Timeline.jsx' import DepthContrast from './DepthContrast.jsx' +import { depthLabel } from './depth.js' import Provenance, { Quote, RecallCard, deviceIn } from './Provenance.jsx' import ReviewQueue, { reviewItems } from './Review.jsx' @@ -133,7 +134,7 @@ export default function Investigation({ k, go, onChanged }) { api.assessments(k).then(setAssessments).catch(() => setAssessments([])) api.investigations(k, 10).then(setRuns).catch(() => setRuns([])) } - useEffect(() => { setSel(null); setShown(2); load() }, [k, depth]) + useEffect(() => { setSel(null); setShown(Math.min(2, depth)); load() }, [k, depth]) if (err) return (
@@ -211,7 +212,7 @@ export default function Investigation({ k, go, onChanged }) { + {[1, 2, 3, 4, 5, 6].map((n) => )} {mode === 'graph' && a.descendants.length > 0 && ( )} @@ -350,7 +351,7 @@ function Note({ a, onSaved }) { useEffect(() => { setSaved(null); setOpen(false); setNote('') }, [a.k]) const save = async () => { setBusy(true) - try { const r = await api.save(a.k, note); setSaved(r); setOpen(false); setNote(''); onSaved() } + try { const r = await api.save(a.k, note, a.depth); setSaved(r); setOpen(false); setNote(''); onSaved() } catch (e) { setSaved({ error: e.message }) } finally { setBusy(false) } } const text = a.memo.headline + '\n\n' + a.memo.paragraphs.map((p) => p.text).join('\n\n') @@ -374,7 +375,7 @@ function Note({ a, onSaved }) {
)} {saved && (saved.error ?

{saved.error}

- :

Saved {saved.id}: linked to {saved.flagged_recalls.length} flagged recall record(s).

)} + :

Saved {saved.id} at {saved.depth} gen: linked to {saved.flagged_recalls.length} flagged recall record(s).

)} ) } @@ -387,6 +388,7 @@ function HistoryPanel({ a, assessments, runs, go }) { {assessments.length === 0 ?

None saved for {a.k} yet.

: assessments.map((h) => (
{h.id}{h.created_at?.slice(0, 16).replace('T', ' ')} + {depthLabel(h)} {VERDICTS[h.verdict]?.label || h.verdict}
{h.stale &&
Stale: the graph changed after this was saved {h.verdict_now !== h.verdict && <> (verdict now {VERDICTS[h.verdict_now]?.label || h.verdict_now})} diff --git a/web/src/workspace/depth.js b/web/src/workspace/depth.js index 0c72085..f3d259c 100644 --- a/web/src/workspace/depth.js +++ b/web/src/workspace/depth.js @@ -40,3 +40,10 @@ export function excerpt(text, k, before = 64, after = 16) { if (b < t.length) b = t.lastIndexOf(' ', b) > i + k.length ? t.lastIndexOf(' ', b) : b return { head: (a > 0 ? '…' : '') + t.slice(a, i), k, tail: t.slice(i + k.length, b) + (b < t.length ? '…' : '') } } + +/* The query depth a saved assessment was computed and is re-checked at. Assessments saved before depth was stored + carry 'legacy': their depth is read from the saved payload, or is the old API default of 4 when that is missing. */ +export function depthLabel(h) { + if (h?.depth == null) return '' + return `${h.depth} gen${h.depth_source && h.depth_source !== 'recorded' ? ' · legacy' : ''}` +}
AssessmentDeviceSaved verdictNowSaved
AssessmentDeviceDepthSaved verdictNowSaved
{h.id} {h.k}
{h.name}
{depthLabel(h)} {VERDICTS[h.verdict]?.label || h.verdict} {h.stale ? Stale{h.verdict_now !== h.verdict ? ` · now ${VERDICTS[h.verdict_now]?.label || h.verdict_now}` : ''} : Current} {h.created_at?.slice(0, 16).replace('T', ' ')}