@graview/pages 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/LICENSE +96 -0
  2. package/README.md +47 -0
  3. package/dist/ask.d.ts +21 -0
  4. package/dist/ask.d.ts.map +1 -0
  5. package/dist/ask.js +109 -0
  6. package/dist/ask.js.map +1 -0
  7. package/dist/face-controls.d.ts +68 -0
  8. package/dist/face-controls.d.ts.map +1 -0
  9. package/dist/face-controls.js +231 -0
  10. package/dist/face-controls.js.map +1 -0
  11. package/dist/face-placed.d.ts +16 -0
  12. package/dist/face-placed.d.ts.map +1 -0
  13. package/dist/face-placed.js +34 -0
  14. package/dist/face-placed.js.map +1 -0
  15. package/dist/facts.d.ts +115 -0
  16. package/dist/facts.d.ts.map +1 -0
  17. package/dist/facts.js +180 -0
  18. package/dist/facts.js.map +1 -0
  19. package/dist/form.d.ts +53 -0
  20. package/dist/form.d.ts.map +1 -0
  21. package/dist/form.js +183 -0
  22. package/dist/form.js.map +1 -0
  23. package/dist/index.d.ts +15 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +8 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/page-context.d.ts +74 -0
  28. package/dist/page-context.d.ts.map +1 -0
  29. package/dist/page-context.js +38 -0
  30. package/dist/page-context.js.map +1 -0
  31. package/dist/page-home.d.ts +19 -0
  32. package/dist/page-home.d.ts.map +1 -0
  33. package/dist/page-home.js +67 -0
  34. package/dist/page-home.js.map +1 -0
  35. package/dist/page-list.d.ts +23 -0
  36. package/dist/page-list.d.ts.map +1 -0
  37. package/dist/page-list.js +196 -0
  38. package/dist/page-list.js.map +1 -0
  39. package/dist/page-map.d.ts +20 -0
  40. package/dist/page-map.d.ts.map +1 -0
  41. package/dist/page-map.js +71 -0
  42. package/dist/page-map.js.map +1 -0
  43. package/dist/page-places.d.ts +72 -0
  44. package/dist/page-places.d.ts.map +1 -0
  45. package/dist/page-places.js +304 -0
  46. package/dist/page-places.js.map +1 -0
  47. package/dist/page-problems.d.ts +58 -0
  48. package/dist/page-problems.d.ts.map +1 -0
  49. package/dist/page-problems.js +113 -0
  50. package/dist/page-problems.js.map +1 -0
  51. package/dist/page-record.d.ts +14 -0
  52. package/dist/page-record.d.ts.map +1 -0
  53. package/dist/page-record.js +111 -0
  54. package/dist/page-record.js.map +1 -0
  55. package/dist/page-search.d.ts +50 -0
  56. package/dist/page-search.d.ts.map +1 -0
  57. package/dist/page-search.js +108 -0
  58. package/dist/page-search.js.map +1 -0
  59. package/dist/page-shell.d.ts +43 -0
  60. package/dist/page-shell.d.ts.map +1 -0
  61. package/dist/page-shell.js +171 -0
  62. package/dist/page-shell.js.map +1 -0
  63. package/dist/page-typography.d.ts +54 -0
  64. package/dist/page-typography.d.ts.map +1 -0
  65. package/dist/page-typography.js +166 -0
  66. package/dist/page-typography.js.map +1 -0
  67. package/dist/pages.d.ts +19 -0
  68. package/dist/pages.d.ts.map +1 -0
  69. package/dist/pages.js +19 -0
  70. package/dist/pages.js.map +1 -0
  71. package/dist/registry.d.ts +111 -0
  72. package/dist/registry.d.ts.map +1 -0
  73. package/dist/registry.js +105 -0
  74. package/dist/registry.js.map +1 -0
  75. package/dist/router.d.ts +35 -0
  76. package/dist/router.d.ts.map +1 -0
  77. package/dist/router.js +155 -0
  78. package/dist/router.js.map +1 -0
  79. package/package.json +63 -0
@@ -0,0 +1,113 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { labelOf, violationsTouching } from "@graview/core";
3
+ import { Link } from "react-router-dom";
4
+ import { useRef, useState } from "react";
5
+ import { DerivedForm } from "./form.js";
6
+ import { recordPath } from "./registry.js";
7
+ import { useStoreTick } from "./page-context.js";
8
+ import { SeatQuestions } from "./page-map.js";
9
+ import { KindMark, button, column, eyebrow, h1, h2, lede, link, plain, quiet, rule } from "./page-typography.js";
10
+ import { PageMain } from "./page-shell.js";
11
+ /**
12
+ * The standing, as a page: each broken rule in its own words, the thing it
13
+ * is about as a link, and the repairs the rule itself named.
14
+ */
15
+ export function DefaultProblemsPage({ context }) {
16
+ const { store, brand, invariantContext, principal } = context;
17
+ useStoreTick(store);
18
+ const violations = store.violations(invariantContext);
19
+ return (_jsxs(PageMain, { context: context, children: [_jsxs("header", { style: { display: "grid", gap: 12 }, children: [_jsx("p", { style: eyebrow, children: violations.length === 0 ? "The standing" : `${violations.length} ${violations.length === 1 ? "problem" : "problems"}` }), _jsx("h1", { style: h1, children: violations.length === 0 ? "All rules hold" : "What is broken" }), violations.length === 0 ? (_jsx("p", { style: lede, children: "Every declared rule is satisfied by what is here." })) : (_jsx("p", { style: lede, children: "Each rule says what it found, and names what would fix it." }))] }), _jsx(SeatQuestions, { context: context }), violations.map((violation, index) => {
20
+ const first = violation.nodeIds[0];
21
+ const node = first ? store.graph.getNode(first) : undefined;
22
+ return (_jsxs("section", { style: {
23
+ display: "grid",
24
+ gap: 10,
25
+ padding: "16px 18px",
26
+ borderLeft: "3px solid var(--graview-warn)",
27
+ background: "var(--graview-panel-warning)",
28
+ borderRadius: "0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0",
29
+ }, children: [_jsx("p", { style: { margin: 0, color: "var(--graview-warn)", fontWeight: 550 }, children: violation.message }), node ? (_jsxs("p", { style: { margin: 0, display: "inline-flex", alignItems: "center", gap: 8 }, children: [_jsx(KindMark, { kind: node.kind, brand: brand, schema: store.schema, size: 7 }), _jsx(Link, { to: recordPath(store.schema, node.kind, node.id), style: link, children: labelOf(store.schema.tryDefinition(node.kind), node) })] })) : null, _jsx(Repairs, { store: store, repairs: violation.repairs, ...(principal ? { principal } : {}) })] }, index));
30
+ })] }));
31
+ }
32
+ /**
33
+ * A RULE'S REPAIRS, EACH IN THE SHAPE IT ACTUALLY IS.
34
+ *
35
+ * A repair that needs nothing is one press. A repair that still has an
36
+ * argument to choose — the invariant said `missing: ["owner"]` — is an ASK:
37
+ * the same derived form the record page uses, with everything the violation
38
+ * already decided filled in.
39
+ *
40
+ * Both were rendered as a bare button calling `store.apply` with the
41
+ * violation's partial args, so pressing "Hand Buy milk to somebody" on the
42
+ * problems page threw `Invalid arguments for mutation "assign-item": owner:
43
+ * expected string, received undefined` into the console and told the person
44
+ * nothing at all. The actions strip has always turned this repair into an
45
+ * ask; the two faces simply disagreed.
46
+ */
47
+ export function Repairs({ store, repairs, principal, }) {
48
+ const [open, setOpen] = useState(null);
49
+ const [failed, setFailed] = useState(null);
50
+ /* The repair buttons, so an answered ask gives the keyboard back to the one that asked. */
51
+ const pressed = useRef([]);
52
+ if (repairs.length === 0)
53
+ return null;
54
+ const opened = open === null ? null : repairs[open];
55
+ const asking = opened && (opened.missing ?? []).length > 0
56
+ ? store.allMutations().find((mutation) => mutation.name === opened.mutation)
57
+ : undefined;
58
+ return (_jsxs("div", { style: { display: "grid", gap: 10 }, "data-testid": "repairs", children: [_jsx("div", { style: { display: "flex", gap: 8, flexWrap: "wrap" }, children: repairs.map((repair, at) => {
59
+ const asks = (repair.missing ?? []).length > 0;
60
+ const verdict = store.permits({ name: repair.mutation, args: { ...repair.args } }, principal);
61
+ if (!verdict.ok) {
62
+ return (_jsxs("p", { "data-testid": "withheld", "data-withheld": verdict.refusal.wouldNeed.join(",") || "nobody", style: { margin: 0, fontSize: "0.875rem", color: "var(--graview-ink-muted)" }, children: [_jsx("s", { children: repair.label }), " \u2014 ", verdict.refusal.message] }, at));
63
+ }
64
+ return (_jsx("button", { ref: (element) => {
65
+ pressed.current[at] = element;
66
+ }, type: "button", "data-graview-repair": repair.mutation, "data-graview-asks": asks || undefined, "aria-expanded": asks ? open === at : undefined, onClick: () => {
67
+ setFailed(null);
68
+ if (asks) {
69
+ setOpen(open === at ? null : at);
70
+ return;
71
+ }
72
+ setOpen(null);
73
+ try {
74
+ // As the person at the keyboard: the store judges the author, and the log names them.
75
+ store.apply({ name: repair.mutation, args: { ...repair.args } }, principal ? { author: principal } : {});
76
+ }
77
+ catch (error) {
78
+ // A refusal is a result, said where the press happened.
79
+ setFailed(error instanceof Error ? error.message : String(error));
80
+ }
81
+ }, style: button, children: asks ? `${repair.label} …` : repair.label }, at));
82
+ }) }), asking && opened ? (_jsx(DerivedForm, { store: store, mutation: asking, prefilled: { ...opened.args },
83
+ // What the rule left open, and only that, under the repair's own words.
84
+ only: opened.missing ?? [], label: opened.label, onDone: () => {
85
+ const asked = open;
86
+ setOpen(null);
87
+ // The form goes; the keyboard goes back to the press that opened it, if the repair is still here.
88
+ requestAnimationFrame(() => {
89
+ const home = asked === null ? null : pressed.current[asked];
90
+ if (home?.isConnected) {
91
+ home.focus();
92
+ return;
93
+ }
94
+ // The problem is gone with its repairs: the page's own heading is the honest home.
95
+ const heading = document.querySelector("main h1, h1");
96
+ if (!heading)
97
+ return;
98
+ if (!heading.hasAttribute("tabindex"))
99
+ heading.tabIndex = -1;
100
+ heading.focus();
101
+ });
102
+ }, ...(principal ? { principal } : {}) })) : null, opened && !asking && (opened.missing ?? []).length > 0 ? (_jsxs("p", { "data-testid": "refused", role: "alert", style: { margin: 0, color: "var(--graview-warn)", fontSize: "0.875rem" }, children: ["\u201C", opened.label, "\u201D names ", opened.mutation, ", which this app does not declare."] })) : null, failed ? (_jsx("p", { "data-testid": "refused", role: "alert", style: { margin: 0, color: "var(--graview-warn)", fontSize: "0.875rem" }, children: failed })) : null] }));
103
+ }
104
+ /** Violations that implicate one node — re-exported so pages and tests share it. */
105
+ export { violationsTouching };
106
+ /**
107
+ * The face's own type and spacing, for a page an app writes itself. A
108
+ * custom record page that had to copy these to look like its neighbours
109
+ * would drift from them by the second release; one object, shared, is how
110
+ * a heavily customised face stays one face.
111
+ */
112
+ export const pageStyles = { column, h1, h2, eyebrow, lede, quiet, rule, link, plain, button };
113
+ //# sourceMappingURL=page-problems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-problems.js","sourceRoot":"","sources":["../src/page-problems.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,kBAAkB,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,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,UAAU,EAAE,YAC3G,MAAM,GACL,CACL,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC;AAGD,oFAAoF;AACpF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAW,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type AnySchema } from "@graview/core";
2
+ import { type PageContext } from "./page-context.js";
3
+ /**
4
+ * A record opens with the thing: its kind as an eyebrow, its name in the
5
+ * display face, and what the declaration says it is. What is wrong with it
6
+ * comes next, because it is the one thing a reader must not miss. Then the
7
+ * facts, the things it is related to — each captioned in the declared
8
+ * words for that relation — and, beneath the content, what can be done and
9
+ * what has happened.
10
+ */
11
+ export declare function DefaultRecordPage<S extends AnySchema>({ context }: {
12
+ context: PageContext<S>;
13
+ }): import("react").JSX.Element;
14
+ //# sourceMappingURL=page-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-record.d.ts","sourceRoot":"","sources":["../src/page-record.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAM5E,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAsBnE;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;CAAE,+BAuR9F"}
@@ -0,0 +1,111 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { describeNode, humaniseField } from "@graview/core";
3
+ import { Link, useParams } from "react-router-dom";
4
+ import { useRef, useState } from "react";
5
+ import { rankedRepairs, recordFacts } from "./facts.js";
6
+ import { DerivedForm } from "./form.js";
7
+ import { placeHref, placePath, pluralSlug, recordPath, spatialHref } from "./registry.js";
8
+ import { useStoreTick } from "./page-context.js";
9
+ import { placesOf } from "./page-places.js";
10
+ import { Repairs } from "./page-problems.js";
11
+ import { KindMark, button, eyebrow, h1, h2, lede, link, listed, plain, pluralOf, quiet, rule, whoDid, } from "./page-typography.js";
12
+ import { PageMain } from "./page-shell.js";
13
+ import { capitalise } from "./page-typography.js";
14
+ /**
15
+ * A record opens with the thing: its kind as an eyebrow, its name in the
16
+ * display face, and what the declaration says it is. What is wrong with it
17
+ * comes next, because it is the one thing a reader must not miss. Then the
18
+ * facts, the things it is related to — each captioned in the declared
19
+ * words for that relation — and, beneath the content, what can be done and
20
+ * what has happened.
21
+ */
22
+ export function DefaultRecordPage({ context }) {
23
+ const { store, brand, principal, invariantContext } = context;
24
+ useStoreTick(store);
25
+ const params = useParams();
26
+ const id = decodeURIComponent(params["id"] ?? "");
27
+ const facts = recordFacts(store, id, {
28
+ ...(principal ? { principal } : {}),
29
+ ...(invariantContext ? { context: invariantContext } : {}),
30
+ });
31
+ const [open, setOpen] = useState(null);
32
+ const actsHeading = useRef(null);
33
+ if (!facts) {
34
+ return (_jsx(PageMain, { context: context, children: _jsx("h1", { style: h1, children: "Nothing lives at this address." }) }));
35
+ }
36
+ const node = store.graph.getNode(id);
37
+ const definition = store.schema.tryDefinition(facts.kind);
38
+ // The declaration's own sentence for this thing, when it has one and it
39
+ // says more than the name.
40
+ const described = definition?.describe && node ? describeNode(definition, node) : null;
41
+ const history = [...store.log.all()]
42
+ .filter((op) => op.writes.includes(id) || op.reads.includes(id))
43
+ .slice(-8)
44
+ .reverse();
45
+ /*
46
+ * A repair is offered ONCE, beside the rule that named it. The derived
47
+ * set still carries it — parity with the scene is a claim about the
48
+ * facts, not the rendering — but listing it again under "what can be
49
+ * done" is the same button twice on one page.
50
+ */
51
+ const offered = facts.actions.affordances.filter((affordance) => affordance.provider !== "invariant");
52
+ return (_jsxs(PageMain, { context: context, children: [_jsxs("header", { style: { display: "grid", gap: 12 }, children: [_jsxs("p", { style: { ...eyebrow, display: "flex", alignItems: "center", gap: 8 }, children: [_jsx(KindMark, { kind: facts.kind, brand: brand, schema: store.schema, size: 8 }), _jsx(Link, { to: `/${pluralSlug(store.schema, facts.kind)}`, style: plain, children: pluralOf(store, facts.kind) })] }), _jsx("h1", { style: h1, children: facts.label }), described && described !== facts.label ? _jsx("p", { style: lede, children: described }) : null, _jsx("a", { href: spatialHref(id), style: { ...link, ...quiet }, "data-testid": "spatial-link", children: "See it in the scene \u2197" }), placesOf(context).some((place) => place.kind === facts.kind || place.across === facts.kind) ? (
53
+ /* WHERE IT IS SEEN: the pictures this kind of thing appears in, each as a page and as a stop in the scene. */
54
+ _jsxs("p", { style: { ...quiet, margin: 0 }, "data-testid": "seen-in", children: ["Seen in:", " ", placesOf(context)
55
+ .filter((place) => place.kind === facts.kind || place.across === facts.kind)
56
+ .map((place, index) => (_jsxs("span", { children: [index > 0 ? " · " : null, _jsx(Link, { to: placePath(place.as), style: link, children: place.title }), " ", _jsx("a", { href: placeHref(place.as, context.sceneHref ?? "/"), style: { ...link, ...quiet }, title: `${place.title}, in the scene`, children: "\u2197" })] }, place.as)))] })) : null] }), facts.violations.length > 0 ? (_jsx("section", { "data-testid": "record-violations", style: {
57
+ display: "grid",
58
+ gap: 12,
59
+ padding: "16px 18px",
60
+ borderLeft: "3px solid var(--graview-warn)",
61
+ background: "var(--graview-panel-warning)",
62
+ borderRadius: "0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0",
63
+ }, children: facts.violations.map((violation, index) => (_jsxs("div", { style: { display: "grid", gap: 8 }, children: [_jsx("p", { style: { margin: 0, color: "var(--graview-warn)", fontWeight: 550 }, children: violation.message }), _jsx(Repairs, { store: store, repairs: rankedRepairs(facts.actions, violation.repairs), ...(principal ? { principal } : {}) })] }, index))) })) : null, facts.fields.length > 0 ? (_jsxs("section", { style: { ...rule, display: "grid", gap: 14 }, "data-testid": "record-fields", children: [_jsx("h2", { style: h2, children: "The facts" }), _jsx("dl", { style: {
64
+ margin: 0,
65
+ display: "grid",
66
+ gridTemplateColumns: "repeat(auto-fill, minmax(200px, 1fr))",
67
+ gap: "14px 24px",
68
+ }, children: facts.fields.map((field) => (_jsxs("div", { style: { display: "grid", gap: 2, minWidth: 0 }, children: [_jsx("dt", { style: { ...eyebrow, fontSize: "0.75rem" }, children: field.label }), _jsx("dd", { style: { margin: 0, fontSize: "1.125rem", overflowWrap: "anywhere" }, children: field.value })] }, field.key))) })] })) : null, facts.links.map((group) => (_jsxs("section", { style: { ...rule, display: "grid", gap: 10 }, children: [_jsx("p", { style: eyebrow, children: listed(store, group) }), _jsx("h2", { style: h2, children: group.description ? capitalise(group.description) : humaniseField(group.edgeKind) }), _jsx("ul", { style: { margin: 0, padding: 0, listStyle: "none", display: "flex", flexWrap: "wrap", gap: "6px 18px" }, children: group.targets.map((target) => (_jsxs("li", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: [_jsx(KindMark, { kind: target.kind, brand: brand, schema: store.schema, size: 7 }), _jsxs(Link, { to: recordPath(store.schema, target.kind, target.id), style: { ...link, fontSize: "1.125rem" }, children: [target.label, target.apart ? _jsxs("span", { style: quiet, children: [" \u00B7 ", target.apart] }) : null] })] }, target.id))) }), (group.direction === "out" && store.schema.edge(group.edgeKind)?.cardinality === "one"
69
+ ? []
70
+ : [...new Set(group.targets.map((target) => target.kind))]).map((farKind) => (_jsxs(Link, { to: `/${pluralSlug(store.schema, farKind)}?${encodeURIComponent(group.edgeKind)}=${encodeURIComponent(id)}`, style: { ...link, ...quiet }, "data-testid": "related-all", children: ["Sort and filter ", group.description ?? `these ${pluralOf(store, farKind).toLowerCase()}`, group.targets.some((target) => target.kind !== farKind) ? ` (${pluralOf(store, farKind).toLowerCase()})` : "", " \u2192"] }, farKind)))] }, `${group.edgeKind}|${group.direction}`))), offered.length > 0 || facts.actions.withheld.length > 0 ? (_jsxs("section", { style: { ...rule, display: "grid", gap: 14 }, "data-testid": "record-actions", children: [_jsx("h2", { style: h2, ref: actsHeading, tabIndex: -1, children: "What can be done" }), _jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 8 }, children: offered.map((affordance) => {
71
+ const opened = open === affordance.id;
72
+ return (_jsx("button", { type: "button", "data-affordance": affordance.id, "data-rank": affordance.rank, "aria-expanded": opened, onClick: () => setOpen(opened ? null : affordance.id), style: {
73
+ ...button,
74
+ ...(opened
75
+ ? { borderColor: "var(--graview-accent)", color: "var(--graview-accent)" }
76
+ : {}),
77
+ }, children: affordance.label }, affordance.id));
78
+ }) }), offered.map((affordance) => {
79
+ if (open !== affordance.id)
80
+ return null;
81
+ const mutation = store.allMutations().find((m) => m.name === affordance.mutation);
82
+ if (!mutation)
83
+ return null;
84
+ return (_jsxs("div", { style: {
85
+ display: "grid",
86
+ gap: 10,
87
+ padding: 18,
88
+ border: "1px solid var(--graview-edge)",
89
+ borderRadius: "var(--graview-radius, 12px)",
90
+ background: "var(--graview-panel)",
91
+ }, children: [_jsx("h3", { style: { ...h2, fontSize: "1.1875rem" }, children: affordance.label }), mutation.description ? _jsx("p", { style: { ...quiet, margin: 0 }, children: mutation.description }) : null, _jsx(DerivedForm, { store: store, mutation: mutation, prefilled: affordance.args,
92
+ // The candidates the derivation narrowed, not every node.
93
+ open: affordance.open,
94
+ // The button says what the heading says: this end's words.
95
+ label: affordance.label, onDone: () => {
96
+ setOpen(null);
97
+ /*
98
+ * THE KEYBOARD GOES BACK TO THE ACT THAT ASKED. The form
99
+ * unmounts on done and took the keyboard to <body>; the
100
+ * button that opened it is where it belongs, and when the
101
+ * act is no longer offered, the heading of the acts.
102
+ */
103
+ const asked = affordance.id;
104
+ requestAnimationFrame(() => {
105
+ const opener = actsHeading.current?.parentElement?.querySelector(`[data-affordance="${asked.replace(/["\\]/g, "\\$&")}"]`);
106
+ (opener ?? actsHeading.current)?.focus();
107
+ });
108
+ }, ...(principal ? { principal } : {}) })] }, affordance.id));
109
+ }), facts.actions.withheld.length > 0 ? (_jsx("ul", { style: { margin: 0, padding: 0, listStyle: "none", display: "grid", gap: 4 }, children: facts.actions.withheld.map((withheld) => (_jsxs("li", { style: quiet, children: [_jsx("s", { children: withheld.label }), " \u2014 ", withheld.refusal.message] }, withheld.id))) })) : null] })) : null, history.length > 0 ? (_jsxs("section", { style: { ...rule, display: "grid", gap: 10 }, "data-testid": "record-history", children: [_jsx("h2", { style: h2, children: "What has happened" }), _jsx("ul", { style: { margin: 0, padding: 0, listStyle: "none", display: "grid", gap: 6 }, children: history.map((op) => (_jsxs("li", { style: quiet, children: [_jsx("span", { style: { color: "var(--graview-ink)" }, children: op.intent }), " \u2014 ", whoDid(op, principal, { graph: store.graph, schema: store.schema, ...(context.seats ? { seats: context.seats } : {}) })] }, op.id))) })] })) : null] }));
110
+ }
111
+ //# sourceMappingURL=page-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-record.js","sourceRoot":"","sources":["../src/page-record.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAkB,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAoB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CA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EAAE,CAEf,CACN,CAAC,GACC,CACN,CAAC,CAAC,CAAC,IAAI,IACA,CACX,CAAC,CAAC,CAAC,IAAI,EAEP,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACpB,mBAAS,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAc,gBAAgB,aACjF,aAAI,KAAK,EAAE,EAAE,kCAAwB,EACrC,aAAI,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,YAC7E,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CACnB,cAAgB,KAAK,EAAE,KAAK,aAC1B,eAAM,KAAK,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,YAAG,EAAE,CAAC,MAAM,GAAQ,cAAI,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAc,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAD7L,EAAE,CAAC,EAAE,CAET,CACN,CAAC,GACC,IACG,CACX,CAAC,CAAC,CAAC,IAAI,IACC,CACZ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { type AnyMutationDefinition, type AnySchema, type Hit, type Principal, type Store } from "@graview/core";
2
+ import type { Affordance } from "@graview/tools";
3
+ import { type PageContext } from "./page-context.js";
4
+ /**
5
+ * `/search?q=` — WHAT THE WORDS FIND, grouped by kind.
6
+ *
7
+ * The scene's Find box and this page are one matcher and one address: the
8
+ * same hits, the same why, the same `key:value` conditions. Each kind's
9
+ * heading is a link to its list with the words carried, so "the three tasks
10
+ * about the van" is one press from here and arranged from there. The record
11
+ * is the destination; this page only says where things are.
12
+ */
13
+ export declare function DefaultSearchPage<S extends AnySchema>({ context }: {
14
+ context: PageContext<S>;
15
+ }): import("react").JSX.Element;
16
+ /** What made a hit a hit, when it was not the name: "Notes: …the van on Friday…". */
17
+ export declare function WhyLine({ why }: {
18
+ why: Hit["why"];
19
+ }): import("react").JSX.Element | null;
20
+ /**
21
+ * THE WAY FORWARD FROM NOTHING. Every act the seat may run that begins one
22
+ * of the searched kinds and takes a name, offered with the words already in
23
+ * it — "A task called “zzz”", pressed with the act's own title. Every piece is derived already: the
24
+ * beginnings, the form, the policy.
25
+ */
26
+ export interface Beginning<S extends AnySchema> {
27
+ readonly kind: string;
28
+ readonly affordance: Affordance;
29
+ readonly mutation: AnyMutationDefinition<S>;
30
+ /** The argument the words go into. */
31
+ readonly arg: string;
32
+ }
33
+ export declare function beginningsFor<S extends AnySchema>(store: Store<S>, kinds: readonly string[], options?: {
34
+ readonly principal?: Principal;
35
+ readonly invariantContext?: Readonly<Record<string, unknown>>;
36
+ }): readonly Beginning<S>[];
37
+ /**
38
+ * The same, from affordances a page already derived for the kind — a list
39
+ * page has asked `kindFacts` once, and asking again on every keystroke of
40
+ * its box is work for nothing.
41
+ */
42
+ export declare function beginningsFrom<S extends AnySchema>(store: Store<S>, kind: string, affordances: readonly Affordance[]): readonly Beginning<S>[];
43
+ export declare function SearchToCreate<S extends AnySchema>({ store, kinds, words, principal, invariantContext, }: {
44
+ store: Store<S>;
45
+ kinds: readonly string[];
46
+ words: string;
47
+ principal?: Principal;
48
+ invariantContext?: Readonly<Record<string, unknown>>;
49
+ }): import("react").JSX.Element | null;
50
+ //# sourceMappingURL=page-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-search.d.ts","sourceRoot":"","sources":["../src/page-search.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,qBAA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IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,SAAS,UAAU,EAAE,GACjC,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,CAazB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,SAAS,EAAE,EAClD,KAAK,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACtD,sCA0BA"}
@@ -0,0 +1,108 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { describeSearched, formFields, nounOf, search, withArticle, } from "@graview/core";
3
+ import { Link, useSearchParams } from "react-router-dom";
4
+ import { kindFacts } from "./facts.js";
5
+ import { DerivedForm } from "./form.js";
6
+ import { useStoreTick } from "./page-context.js";
7
+ import { PageMain } from "./page-shell.js";
8
+ import { placesOf } from "./page-places.js";
9
+ import { DISPLAY, KindMark, eyebrow, h1, h2, lede, link, plain, pluralOf, quiet, rule } from "./page-typography.js";
10
+ import { placePath, pluralSlug, recordPath } from "./registry.js";
11
+ /**
12
+ * `/search?q=` — WHAT THE WORDS FIND, grouped by kind.
13
+ *
14
+ * The scene's Find box and this page are one matcher and one address: the
15
+ * same hits, the same why, the same `key:value` conditions. Each kind's
16
+ * heading is a link to its list with the words carried, so "the three tasks
17
+ * about the van" is one press from here and arranged from there. The record
18
+ * is the destination; this page only says where things are.
19
+ */
20
+ export function DefaultSearchPage({ context }) {
21
+ const { store, brand, principal, invariantContext } = context;
22
+ useStoreTick(store);
23
+ const [params] = useSearchParams();
24
+ const q = params.get("q") ?? "";
25
+ const today = typeof invariantContext?.["today"] === "string" ? invariantContext["today"] : undefined;
26
+ const found = search(store, q, {
27
+ ...(principal ? { principal } : {}),
28
+ places: placesOf(context),
29
+ flagged: new Set(store.violations(invariantContext).flatMap((violation) => violation.nodeIds)),
30
+ ...(today ? { today } : {}),
31
+ limit: 200,
32
+ });
33
+ const records = found.hits.filter((hit) => hit.about === "node");
34
+ const named = found.hits.filter((hit) => hit.about === "kind" || hit.about === "place" || hit.about === "rule");
35
+ const kinds = [...new Set(records.map((hit) => hit.kind))];
36
+ const asked = q.trim();
37
+ return (_jsxs(PageMain, { context: context, children: [_jsxs("header", { style: { display: "grid", gap: 12 }, children: [_jsx("p", { style: eyebrow, children: "Search" }), _jsx("h1", { style: h1, "data-testid": "search-heading", children: asked.length === 0
38
+ ? "Find anything by its name"
39
+ : found.hits.length === 0
40
+ ? _jsxs(_Fragment, { children: ["Nothing here is called \u201C", asked, "\u201D."] })
41
+ : _jsxs(_Fragment, { children: [countSentence(store, found.byKind), " for \u201C", asked, "\u201D"] }) }), asked.length > 0 ? (_jsxs("p", { style: { ...quiet, margin: 0 }, "data-testid": "search-searched", children: [describeSearched(store.schema, found.searched), found.conditions
42
+ .filter((condition) => condition.key !== "is" && condition.admittedBy.length < found.searched.kinds.length)
43
+ .map((condition) => (_jsxs("span", { children: [" ", condition.key, ":", condition.value, " narrows", " ", condition.admittedBy.length === 0 ? "nothing here" : condition.admittedBy.map((kind) => pluralOf(store, kind).toLowerCase()).join(" and "), "."] }, `${condition.key}:${condition.value}`)))] })) : (_jsxs("p", { style: lede, children: ["Type in the box above. Words find the start of words in names and in what each record says;", " ", _jsx("code", { children: "done:false" }), " and the like narrow as a list does, and ", _jsx("code", { children: "is:any" }), " includes what is past."] }))] }), named.length > 0 ? (_jsx("ul", { style: { margin: 0, padding: 0, listStyle: "none", display: "grid", gap: 6 }, "data-testid": "search-named", children: named.map((hit) => (_jsx("li", { "data-testid": "search-hit", "data-about": hit.about, children: hit.about === "kind" ? (_jsxs(Link, { to: `/${pluralSlug(store.schema, hit.kind)}`, style: link, children: [hit.label, hit.count > 0 ? _jsxs("span", { style: quiet, children: [" \u00B7 ", hit.count, " match"] }) : null] })) : hit.about === "place" ? (_jsxs(Link, { to: placePath(hit.as), style: link, children: ["Go to ", hit.title] })) : hit.about === "rule" ? (_jsxs(Link, { to: "/problems", style: link, children: ["The rule \u201C", hit.label, "\u201D"] })) : null }, `${hit.about}:${hit.about === "rule" ? hit.name : hit.about === "place" ? hit.as : hit.kind}`))) })) : null, kinds.map((kind) => (
44
+ // A track the width it was given, and words that break: a hit told apart by its VIN at a
45
+ // reader's 200% was a word wider than a phone, and the whole page scrolled sideways.
46
+ _jsxs("section", { style: { display: "grid", gridTemplateColumns: "minmax(0, 1fr)", gap: 0, minWidth: 0 }, "data-testid": "search-group", "data-kind": kind, children: [_jsxs("h2", { style: { ...h2, fontSize: "1.0625rem", marginBottom: 4, display: "flex", alignItems: "center", gap: 8 }, children: [_jsx(KindMark, { kind: kind, brand: brand, schema: store.schema, size: 8 }), _jsx(Link, { to: `/${pluralSlug(store.schema, kind)}?${new URLSearchParams({ q: asked }).toString()}`, style: link, "data-testid": "search-kind-link", children: pluralOf(store, kind) }), _jsx("span", { style: quiet, children: found.byKind[kind] })] }), _jsx("ul", { style: { margin: 0, padding: 0, listStyle: "none", display: "grid", gap: 0 }, children: records
47
+ .filter((hit) => hit.kind === kind)
48
+ .map((hit) => (_jsxs("li", { "data-testid": "search-hit", "data-about": "node", style: { display: "grid", gap: 2, padding: "12px 0", minWidth: 0, borderTop: "1px solid var(--graview-edge)" }, children: [_jsxs(Link, { to: recordPath(store.schema, kind, hit.id), style: { ...plain, fontFamily: DISPLAY, fontSize: "1.1875rem", fontWeight: 600, lineHeight: 1.3, overflowWrap: "anywhere" }, children: [hit.flagged ? _jsx("span", { style: { color: "var(--graview-warn)" }, children: "\u26A0 " }) : null, hit.label, hit.apart ? _jsxs("span", { style: quiet, children: [" \u00B7 ", hit.apart] }) : null, hit.current ? null : _jsx("span", { style: quiet, children: " \u00B7 past" })] }), _jsx(WhyLine, { why: hit.why })] }, hit.id))) })] }, kind))), asked.length > 0 && found.hits.length === 0 ? (_jsx(SearchToCreate, { store: store, kinds: found.searched.kinds, words: found.words, ...(principal ? { principal } : {}), ...(invariantContext ? { invariantContext } : {}) })) : null] }));
49
+ }
50
+ /** What made a hit a hit, when it was not the name: "Notes: …the van on Friday…". */
51
+ export function WhyLine({ why }) {
52
+ if (why.field === "label")
53
+ return null;
54
+ return (_jsxs("span", { style: quiet, "data-testid": "search-why", children: [why.reading, ": ", why.fragment] }));
55
+ }
56
+ function countSentence(store, byKind) {
57
+ const parts = Object.entries(byKind).map(([kind, count]) => `${count} ${count === 1 ? nounOf(store.schema.tryDefinition(kind), kind) : pluralOf(store, kind).toLowerCase()}`);
58
+ if (parts.length === 0)
59
+ return "Found";
60
+ return parts.length === 1 ? capitalFirst(parts[0]) : capitalFirst(`${parts.slice(0, -1).join(", ")} and ${parts[parts.length - 1]}`);
61
+ }
62
+ const capitalFirst = (text) => text.charAt(0).toUpperCase() + text.slice(1);
63
+ export function beginningsFor(store, kinds, options = {}) {
64
+ const out = [];
65
+ for (const kind of kinds) {
66
+ const facts = kindFacts(store, kind, {
67
+ ...(options.principal ? { principal: options.principal } : {}),
68
+ ...(options.invariantContext ? { context: options.invariantContext } : {}),
69
+ });
70
+ for (const beginning of beginningsFrom(store, kind, facts.actions.affordances)) {
71
+ if (!out.some((held) => held.mutation.name === beginning.mutation.name))
72
+ out.push(beginning);
73
+ }
74
+ }
75
+ return out;
76
+ }
77
+ /**
78
+ * The same, from affordances a page already derived for the kind — a list
79
+ * page has asked `kindFacts` once, and asking again on every keystroke of
80
+ * its box is work for nothing.
81
+ */
82
+ export function beginningsFrom(store, kind, affordances) {
83
+ const named = store.schema.tryDefinition(kind)?.fieldRoles?.["label"];
84
+ const out = [];
85
+ for (const affordance of affordances) {
86
+ const mutation = store.allMutations().find((candidate) => candidate.name === affordance.mutation);
87
+ if (!mutation || !mutation.creates?.includes(kind))
88
+ continue;
89
+ if (out.some((held) => held.mutation.name === mutation.name))
90
+ continue;
91
+ const args = formFields(mutation.input).map((field) => field.name);
92
+ const arg = args.includes("label") ? "label" : named && args.includes(named) ? named : undefined;
93
+ if (!arg || affordance.args[arg] !== undefined)
94
+ continue;
95
+ out.push({ kind, affordance, mutation, arg });
96
+ }
97
+ return out;
98
+ }
99
+ export function SearchToCreate({ store, kinds, words, principal, invariantContext, }) {
100
+ const offered = beginningsFor(store, kinds, {
101
+ ...(principal ? { principal } : {}),
102
+ ...(invariantContext ? { invariantContext } : {}),
103
+ });
104
+ if (offered.length === 0 || words.trim().length === 0)
105
+ return null;
106
+ return (_jsx("div", { style: { display: "grid", gap: 24 }, "data-testid": "search-to-create", children: offered.map(({ kind, affordance, mutation, arg }) => (_jsxs("section", { style: { ...rule, display: "grid", gap: 14 }, children: [_jsxs("h2", { style: h2, children: [capitalFirst(withArticle(nounOf(store.schema.tryDefinition(kind), kind))), " called \u201C", words, "\u201D"] }), _jsx(DerivedForm, { store: store, mutation: mutation, prefilled: affordance.args, open: affordance.open, initial: { [arg]: words }, ...(principal ? { principal } : {}) })] }, `${affordance.id}|${words}`))) }));
107
+ }
108
+ //# sourceMappingURL=page-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-search.js","sourceRoot":"","sources":["../src/page-search.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,MAAM,EACN,WAAW,GAMZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAoB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE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EAAE,GAAG,EAAE,EAAE,EAAE,iBAAc,kBAAkB,YACrE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CACpD,mBAA2C,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,aAErF,cAAI,KAAK,EAAE,EAAE,aACV,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,oBAAW,KAAK,cACvF,EACL,KAAC,WAAW,IACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,UAAU,CAAC,IAAI,EAC1B,IAAI,EAAE,UAAU,CAAC,IAAI,EACrB,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,KACrB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACpC,KAZU,GAAG,UAAU,CAAC,EAAE,IAAI,KAAK,EAAE,CAa/B,CACX,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { AnySchema } from "@graview/core";
2
+ import type { ReactNode } from "react";
3
+ import { type PageContext } from "./page-context.js";
4
+ /**
5
+ * The shell: the installation's masthead, one row of navigation, the way to
6
+ * the scene. The pictures are the home, so they are not also a row of the
7
+ * nav — the row is the kinds, the map and the standing, and on a phone it
8
+ * scrolls sideways inside itself rather than wrapping to three rows over
9
+ * the page.
10
+ */
11
+ export declare function DefaultShell<S extends AnySchema>({ context, children, }: {
12
+ context: PageContext<S>;
13
+ children: ReactNode;
14
+ }): import("react").JSX.Element;
15
+ /**
16
+ * A page's outer element: <main> when the face owns the document, a plain
17
+ * section when it is embedded in a page that has its own — `main` allows no
18
+ * other role, so the tag itself has to change.
19
+ */
20
+ export declare function PageMain<S extends AnySchema>({ context, style, children, ...rest }: {
21
+ context: PageContext<S>;
22
+ style?: React.CSSProperties;
23
+ children?: React.ReactNode;
24
+ } & Record<`data-${string}`, string>): import("react").JSX.Element;
25
+ /**
26
+ * THE NAV'S FIND BOX. On a kind's list it narrows that list — `?q=` is the
27
+ * list's own word — and anywhere else it goes to `/search`. Typing is an
28
+ * adjustment of the page you are on, so each keystroke replaces the address
29
+ * rather than piling up history; the first keystroke away from a list or
30
+ * the search page is the one step Back undoes.
31
+ *
32
+ * Exported for a shell an app draws itself. `narrowsLists: false` is for an
33
+ * app whose own list pages already carry a box for their words: then this
34
+ * one always goes to `/search`, and a list never has two.
35
+ *
36
+ * Placed by a shell, it is THE face's Find box: the face's root sees it and
37
+ * draws no second one above the shell (face-controls.tsx).
38
+ */
39
+ export declare function PageFind<S extends AnySchema>({ context, narrowsLists, }: {
40
+ context: PageContext<S>;
41
+ narrowsLists?: boolean;
42
+ }): import("react").JSX.Element;
43
+ //# sourceMappingURL=page-shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-shell.d.ts","sourceRoot":"","sources":["../src/page-shell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAE,KAAK,WAAW,EAAgC,MAAM,mBAAmB,CAAC;AAMnF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,EAChD,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB,+BA0JA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAAE,EAC5C,OAAO,EACP,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE;IAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,+BAQzH;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAAE,EAC5C,OAAO,EACP,YAAmB,GACpB,EAAE;IACD,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,+BAsEA"}