@agent-surface/cli 0.10.0 → 0.11.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 (40) hide show
  1. package/README.md +64 -23
  2. package/dist/bin.js +63 -41
  3. package/dist/bin.js.map +1 -1
  4. package/dist/check-BYQ34OVQ.js +122 -0
  5. package/dist/check-BYQ34OVQ.js.map +1 -0
  6. package/dist/chunk-DYDSJM7R.js +170 -0
  7. package/dist/chunk-DYDSJM7R.js.map +1 -0
  8. package/dist/{chunk-4AEQKM2X.js → chunk-GXXKZTQB.js} +261 -206
  9. package/dist/chunk-GXXKZTQB.js.map +1 -0
  10. package/dist/{chunk-FYEXHWGG.js → chunk-QIVOZAWX.js} +52 -2
  11. package/dist/chunk-QIVOZAWX.js.map +1 -0
  12. package/dist/chunk-RXX63JSL.js +298 -0
  13. package/dist/chunk-RXX63JSL.js.map +1 -0
  14. package/dist/index.d.ts +15 -1
  15. package/dist/init-LYYVXFEQ.js +141 -0
  16. package/dist/init-LYYVXFEQ.js.map +1 -0
  17. package/dist/{ink-HBPOQTRS.js → ink-P23VKP4H.js} +102 -33
  18. package/dist/ink-P23VKP4H.js.map +1 -0
  19. package/dist/inspect-3CBRKTDM.js +108 -0
  20. package/dist/inspect-3CBRKTDM.js.map +1 -0
  21. package/dist/snapshot-DJ22WCT4.js +59 -0
  22. package/dist/snapshot-DJ22WCT4.js.map +1 -0
  23. package/package.json +4 -4
  24. package/dist/capabilities-OLFYMHCL.js +0 -37
  25. package/dist/capabilities-OLFYMHCL.js.map +0 -1
  26. package/dist/check-IN4XKAND.js +0 -84
  27. package/dist/check-IN4XKAND.js.map +0 -1
  28. package/dist/chunk-4AEQKM2X.js.map +0 -1
  29. package/dist/chunk-A27Y7ALQ.js +0 -51
  30. package/dist/chunk-A27Y7ALQ.js.map +0 -1
  31. package/dist/chunk-FYEXHWGG.js.map +0 -1
  32. package/dist/chunk-ODUIFFPM.js +0 -104
  33. package/dist/chunk-ODUIFFPM.js.map +0 -1
  34. package/dist/coverage-HCHLJTDD.js +0 -133
  35. package/dist/coverage-HCHLJTDD.js.map +0 -1
  36. package/dist/ink-HBPOQTRS.js.map +0 -1
  37. package/dist/inspect-NJNB6CAS.js +0 -213
  38. package/dist/inspect-NJNB6CAS.js.map +0 -1
  39. package/dist/snapshot-JQAB73OV.js +0 -38
  40. package/dist/snapshot-JQAB73OV.js.map +0 -1
@@ -1,213 +0,0 @@
1
- import {
2
- renderSurfacePlain
3
- } from "./chunk-4AEQKM2X.js";
4
- import {
5
- createSurfaceRunner
6
- } from "./chunk-FYEXHWGG.js";
7
- import {
8
- isPlain,
9
- loadInk,
10
- paint,
11
- transient,
12
- write
13
- } from "./chunk-A27Y7ALQ.js";
14
- import "./chunk-ODUIFFPM.js";
15
-
16
- // src/render/model.ts
17
- function leafOf(capabilityId) {
18
- const withoutPlane = capabilityId.replace(/^(view|domain):/, "");
19
- const dot = withoutPlane.lastIndexOf(".");
20
- return dot === -1 ? withoutPlane : withoutPlane.slice(dot + 1);
21
- }
22
- function observationTags() {
23
- return ["observation"];
24
- }
25
- function actionTags(action) {
26
- const tags = [action.effect];
27
- if (action.idempotent) tags.push("idempotent");
28
- if (action.reversible) tags.push("reversible");
29
- if (action.confirmation !== "never") tags.push(`confirmation:${action.confirmation}`);
30
- return tags;
31
- }
32
- function procedureTags(procedure) {
33
- const tags = [procedure.effect];
34
- if (procedure.confirmation !== "never") tags.push(`confirmation:${procedure.confirmation}`);
35
- for (const field of procedure.boundFields) {
36
- tags.push(`${field.path} bound${field.locked ? "+locked" : ""}`);
37
- }
38
- return tags;
39
- }
40
- function explanationIndex(explanation) {
41
- const index = /* @__PURE__ */ new Map();
42
- for (const capability of explanation.capabilities) {
43
- index.set(`${capability.capabilityId}\0${capability.registrationId}`, capability);
44
- }
45
- return index;
46
- }
47
- function buildView(result, options = {}) {
48
- const { snapshot, explanation } = result;
49
- const index = explanationIndex(explanation);
50
- const groups = [];
51
- const counts = { callable: 0, disabled: 0, hidden: 0 };
52
- const enrich = (row, capabilityId, registrationId) => {
53
- const explained = index.get(`${capabilityId}\0${registrationId}`);
54
- if (options.explain && explained) {
55
- row.policies = explained.policies;
56
- row.availability = explained.availability;
57
- }
58
- return row;
59
- };
60
- for (const component of snapshot.components) {
61
- const rows = [];
62
- for (const observation of component.observations) {
63
- rows.push(
64
- enrich(
65
- rowFor(observation, "observation", observationTags(), options, {
66
- input: void 0,
67
- output: observation.outputSchema
68
- }),
69
- observation.capabilityId,
70
- component.registrationId
71
- )
72
- );
73
- }
74
- for (const action of component.actions) {
75
- rows.push(
76
- enrich(
77
- rowFor(action, "action", actionTags(action), options, {
78
- input: action.inputSchema,
79
- output: action.outputSchema
80
- }),
81
- action.capabilityId,
82
- component.registrationId
83
- )
84
- );
85
- }
86
- groups.push({
87
- heading: component.instanceId === "default" ? component.type : `${component.type}@${component.instanceId}`,
88
- rows
89
- });
90
- }
91
- if (snapshot.procedures.length > 0) {
92
- groups.push({
93
- heading: "authoritative (domain)",
94
- rows: snapshot.procedures.map(
95
- (procedure) => enrich(
96
- {
97
- capabilityId: procedure.procedureId,
98
- name: procedure.procedureId.replace(/^domain:/, ""),
99
- kind: "procedure",
100
- plane: "domain",
101
- outcome: procedure.available ? "expose" : "disable",
102
- description: procedure.description,
103
- ...procedure.unavailableReason ? { reason: procedure.unavailableReason } : {},
104
- tags: procedureTags(procedure),
105
- ...options.schemas ? { schemas: { input: procedure.inputSchema, output: procedure.outputSchema } } : {}
106
- },
107
- procedure.procedureId,
108
- procedure.registrationId
109
- )
110
- )
111
- });
112
- }
113
- if (options.explain) {
114
- const hidden = explanation.capabilities.filter((c) => c.outcome === "hide");
115
- if (hidden.length > 0) {
116
- groups.push({
117
- heading: "hidden by policy (absent from the snapshot)",
118
- rows: hidden.map((capability) => ({
119
- capabilityId: capability.capabilityId,
120
- name: leafOf(capability.capabilityId),
121
- kind: capability.kind,
122
- plane: capability.plane,
123
- outcome: "hide",
124
- description: capability.description,
125
- tags: [`${capability.component.type}@${capability.component.instanceId}`],
126
- policies: capability.policies,
127
- availability: capability.availability
128
- }))
129
- });
130
- }
131
- }
132
- for (const capability of explanation.capabilities) {
133
- if (capability.outcome === "expose") counts.callable += 1;
134
- else if (capability.outcome === "disable") counts.disabled += 1;
135
- else counts.hidden += 1;
136
- }
137
- return {
138
- scenario: result.scenario,
139
- ...snapshot.route?.path ? { route: snapshot.route.path } : {},
140
- ...result.scope ? { scope: result.scope } : {},
141
- groups,
142
- counts,
143
- rejections: result.rejections ?? [],
144
- explained: options.explain === true
145
- };
146
- }
147
- function rowFor(descriptor, kind, tags, options, schemas) {
148
- return {
149
- capabilityId: descriptor.capabilityId,
150
- name: descriptor.name,
151
- kind,
152
- plane: "view",
153
- outcome: descriptor.available ? "expose" : "disable",
154
- description: descriptor.description,
155
- ...descriptor.unavailableReason ? { reason: descriptor.unavailableReason } : {},
156
- tags,
157
- ...options.schemas ? { schemas } : {}
158
- };
159
- }
160
-
161
- // src/commands/inspect.tsx
162
- import { jsx } from "react/jsx-runtime";
163
- function jsonFor(result, explain) {
164
- return {
165
- scenario: result.scenario,
166
- ...result.scope ? { scope: result.scope } : {},
167
- snapshot: result.snapshot,
168
- // Unconditional, and unconditionally present even when empty (`AS-CLI-006`):
169
- // a consumer that has to distinguish "no rejections" from "this CLI predates
170
- // the field" cannot rely on an absent key.
171
- rejections: result.rejections,
172
- ...explain ? { explanation: result.explanation } : {}
173
- };
174
- }
175
- async function runInspect(options) {
176
- const runner = await createSurfaceRunner(options.configPath);
177
- const ink = isPlain(options) ? null : await loadInk();
178
- try {
179
- const scenarios = options.scenario ? [options.scenario] : runner.scenarioNames;
180
- const collected = [];
181
- for (const [index, scenario] of scenarios.entries()) {
182
- const stop = ink ? await transient(/* @__PURE__ */ jsx(ink.Loading, { label: `mounting ${scenario}\u2026` })) : void 0;
183
- let result;
184
- try {
185
- result = await runner.collect({
186
- scenario,
187
- ...options.scope ? { scope: options.scope } : {}
188
- });
189
- } finally {
190
- stop?.();
191
- }
192
- if (options.json) {
193
- collected.push(jsonFor(result, options.explain === true));
194
- continue;
195
- }
196
- const view = buildView(result, {
197
- ...options.explain ? { explain: true } : {},
198
- ...options.schemas ? { schemas: true } : {}
199
- });
200
- if (ink) await paint(/* @__PURE__ */ jsx(ink.Surface, { view }));
201
- else write(index === 0 ? renderSurfacePlain(view) : `
202
- ${renderSurfacePlain(view)}`);
203
- }
204
- if (options.json) write(JSON.stringify({ scenarios: collected }, null, 2));
205
- return 0;
206
- } finally {
207
- await runner.close();
208
- }
209
- }
210
- export {
211
- runInspect
212
- };
213
- //# sourceMappingURL=inspect-NJNB6CAS.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/render/model.ts","../src/commands/inspect.tsx"],"sourcesContent":["import type {\n AgentActionDescriptor,\n AgentObservationDescriptor,\n AgentProcedureDescriptor,\n AgentSurfaceSnapshot,\n} from \"@agent-surface/core\";\nimport type { CapabilityExplanation, SurfaceExplanation } from \"@agent-surface/core/explain\";\nimport type { CollectResult, RegistrationRejection } from \"../collect.js\";\n\n/**\n * One view model, two renderers. The Ink UI and the plain-text fallback both\n * consume this, so `--plain` can never drift into showing something different\n * from what a TTY shows.\n */\nexport interface CapabilityRow {\n capabilityId: string;\n /** Leaf name — the group heading already carries the rest of the id. */\n name: string;\n kind: \"observation\" | \"action\" | \"procedure\";\n plane: \"view\" | \"domain\";\n outcome: \"expose\" | \"disable\" | \"hide\";\n description: string;\n reason?: string;\n tags: string[];\n policies?: CapabilityExplanation[\"policies\"];\n availability?: CapabilityExplanation[\"availability\"];\n schemas?: { input?: unknown; output?: unknown };\n}\n\nexport interface CapabilityGroup {\n heading: string;\n rows: CapabilityRow[];\n}\n\nexport interface SurfaceView {\n scenario: string;\n route?: string;\n /**\n * The scope the counts below were computed under (`AS-CLI-007`). A scope\n * filters the snapshot *and* the explanation, so without it on screen the\n * header reads as a statement about the whole surface when it is a statement\n * about one prefix of it.\n */\n scope?: string[];\n groups: CapabilityGroup[];\n counts: { callable: number; disabled: number; hidden: number };\n /** Refused during the mount — absent from both projections (`AS-CLI-006`). */\n rejections: RegistrationRejection[];\n explained: boolean;\n}\n\nexport interface ViewOptions {\n explain?: boolean;\n schemas?: boolean;\n}\n\nfunction leafOf(capabilityId: string): string {\n const withoutPlane = capabilityId.replace(/^(view|domain):/, \"\");\n const dot = withoutPlane.lastIndexOf(\".\");\n return dot === -1 ? withoutPlane : withoutPlane.slice(dot + 1);\n}\n\nfunction observationTags(): string[] {\n return [\"observation\"];\n}\n\nfunction actionTags(action: AgentActionDescriptor): string[] {\n const tags: string[] = [action.effect];\n if (action.idempotent) tags.push(\"idempotent\");\n if (action.reversible) tags.push(\"reversible\");\n if (action.confirmation !== \"never\") tags.push(`confirmation:${action.confirmation}`);\n return tags;\n}\n\nfunction procedureTags(procedure: AgentProcedureDescriptor): string[] {\n const tags: string[] = [procedure.effect];\n if (procedure.confirmation !== \"never\") tags.push(`confirmation:${procedure.confirmation}`);\n for (const field of procedure.boundFields) {\n tags.push(`${field.path} bound${field.locked ? \"+locked\" : \"\"}`);\n }\n return tags;\n}\n\nfunction explanationIndex(explanation: SurfaceExplanation): Map<string, CapabilityExplanation> {\n const index = new Map<string, CapabilityExplanation>();\n for (const capability of explanation.capabilities) {\n // Keyed by id + registration so two instances of one component stay apart.\n index.set(`${capability.capabilityId}\\u0000${capability.registrationId}`, capability);\n }\n return index;\n}\n\nexport function buildView(result: CollectResult, options: ViewOptions = {}): SurfaceView {\n const { snapshot, explanation } = result;\n const index = explanationIndex(explanation);\n const groups: CapabilityGroup[] = [];\n const counts = { callable: 0, disabled: 0, hidden: 0 };\n\n const enrich = (\n row: CapabilityRow,\n capabilityId: string,\n registrationId: string,\n ): CapabilityRow => {\n const explained = index.get(`${capabilityId}\\u0000${registrationId}`);\n if (options.explain && explained) {\n row.policies = explained.policies;\n row.availability = explained.availability;\n }\n return row;\n };\n\n for (const component of snapshot.components) {\n const rows: CapabilityRow[] = [];\n\n for (const observation of component.observations) {\n rows.push(\n enrich(\n rowFor(observation, \"observation\", observationTags(), options, {\n input: undefined,\n output: observation.outputSchema,\n }),\n observation.capabilityId,\n component.registrationId,\n ),\n );\n }\n for (const action of component.actions) {\n rows.push(\n enrich(\n rowFor(action, \"action\", actionTags(action), options, {\n input: action.inputSchema,\n output: action.outputSchema,\n }),\n action.capabilityId,\n component.registrationId,\n ),\n );\n }\n\n groups.push({\n heading:\n component.instanceId === \"default\"\n ? component.type\n : `${component.type}@${component.instanceId}`,\n rows,\n });\n }\n\n if (snapshot.procedures.length > 0) {\n groups.push({\n heading: \"authoritative (domain)\",\n rows: snapshot.procedures.map((procedure) =>\n enrich(\n {\n capabilityId: procedure.procedureId,\n name: procedure.procedureId.replace(/^domain:/, \"\"),\n kind: \"procedure\",\n plane: \"domain\",\n outcome: procedure.available ? \"expose\" : \"disable\",\n description: procedure.description,\n ...(procedure.unavailableReason ? { reason: procedure.unavailableReason } : {}),\n tags: procedureTags(procedure),\n ...(options.schemas\n ? { schemas: { input: procedure.inputSchema, output: procedure.outputSchema } }\n : {}),\n },\n procedure.procedureId,\n procedure.registrationId,\n ),\n ),\n });\n }\n\n // Hidden capabilities exist only in the explanation — that is the whole point\n // of it. They get their own group so nobody mistakes them for callable.\n if (options.explain) {\n const hidden = explanation.capabilities.filter((c) => c.outcome === \"hide\");\n if (hidden.length > 0) {\n groups.push({\n heading: \"hidden by policy (absent from the snapshot)\",\n rows: hidden.map((capability) => ({\n capabilityId: capability.capabilityId,\n name: leafOf(capability.capabilityId),\n kind: capability.kind,\n plane: capability.plane,\n outcome: \"hide\" as const,\n description: capability.description,\n tags: [`${capability.component.type}@${capability.component.instanceId}`],\n policies: capability.policies,\n availability: capability.availability,\n })),\n });\n }\n }\n\n for (const capability of explanation.capabilities) {\n if (capability.outcome === \"expose\") counts.callable += 1;\n else if (capability.outcome === \"disable\") counts.disabled += 1;\n else counts.hidden += 1;\n }\n\n return {\n scenario: result.scenario,\n ...(snapshot.route?.path ? { route: snapshot.route.path } : {}),\n ...(result.scope ? { scope: result.scope } : {}),\n groups,\n counts,\n rejections: result.rejections ?? [],\n explained: options.explain === true,\n };\n}\n\nfunction rowFor(\n descriptor: AgentObservationDescriptor | AgentActionDescriptor,\n kind: \"observation\" | \"action\",\n tags: string[],\n options: ViewOptions,\n schemas: { input?: unknown; output?: unknown },\n): CapabilityRow {\n return {\n capabilityId: descriptor.capabilityId,\n name: descriptor.name,\n kind,\n plane: \"view\",\n outcome: descriptor.available ? \"expose\" : \"disable\",\n description: descriptor.description,\n ...(descriptor.unavailableReason ? { reason: descriptor.unavailableReason } : {}),\n tags,\n ...(options.schemas ? { schemas } : {}),\n };\n}\n","import { createSurfaceRunner } from \"../load.js\";\nimport { buildView } from \"../render/model.js\";\nimport { renderSurfacePlain } from \"../render/plain.js\";\nimport { isPlain, loadInk, paint, transient, write } from \"../output.js\";\nimport type { CollectResult } from \"../collect.js\";\n\nexport interface InspectOptions {\n configPath: string;\n scenario?: string;\n scope?: string[];\n explain?: boolean;\n schemas?: boolean;\n json?: boolean;\n plain?: boolean;\n}\n\nfunction jsonFor(result: CollectResult, explain: boolean): Record<string, unknown> {\n return {\n scenario: result.scenario,\n ...(result.scope ? { scope: result.scope } : {}),\n snapshot: result.snapshot,\n // Unconditional, and unconditionally present even when empty (`AS-CLI-006`):\n // a consumer that has to distinguish \"no rejections\" from \"this CLI predates\n // the field\" cannot rely on an absent key.\n rejections: result.rejections,\n ...(explain ? { explanation: result.explanation } : {}),\n };\n}\n\n/**\n * Renders the live surface. A bare `inspect` covers every scenario the config\n * defines, the same way bare `snapshot` and `check` do — a config lists the\n * contexts worth looking at, and picking one of them by `Object.keys` order\n * made the default silently depend on the order they happened to be written in.\n */\nexport async function runInspect(options: InspectOptions): Promise<number> {\n const runner = await createSurfaceRunner(options.configPath);\n // `null` when Ink cannot run here (React 18 host), which is a fallback to\n // plain text rather than a failed command — see loadInk().\n const ink = isPlain(options) ? null : await loadInk();\n try {\n const scenarios = options.scenario ? [options.scenario] : runner.scenarioNames;\n const collected: Array<Record<string, unknown>> = [];\n\n for (const [index, scenario] of scenarios.entries()) {\n const stop = ink\n ? await transient(<ink.Loading label={`mounting ${scenario}…`} />)\n : undefined;\n\n let result;\n try {\n result = await runner.collect({\n scenario,\n ...(options.scope ? { scope: options.scope } : {}),\n });\n } finally {\n stop?.();\n }\n\n // Each scenario is mounted and rendered before the next one is mounted,\n // so a slow config prints as it goes instead of after the last mount.\n // `--json` is the exception: one document, so it has to be complete.\n if (options.json) {\n collected.push(jsonFor(result, options.explain === true));\n continue;\n }\n\n const view = buildView(result, {\n ...(options.explain ? { explain: true } : {}),\n ...(options.schemas ? { schemas: true } : {}),\n });\n\n if (ink) await paint(<ink.Surface view={view} />);\n else write(index === 0 ? renderSurfacePlain(view) : `\\n${renderSurfacePlain(view)}`);\n }\n\n if (options.json) write(JSON.stringify({ scenarios: collected }, null, 2));\n return 0;\n } finally {\n await runner.close();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwDA,SAAS,OAAO,cAA8B;AAC5C,QAAM,eAAe,aAAa,QAAQ,mBAAmB,EAAE;AAC/D,QAAM,MAAM,aAAa,YAAY,GAAG;AACxC,SAAO,QAAQ,KAAK,eAAe,aAAa,MAAM,MAAM,CAAC;AAC/D;AAEA,SAAS,kBAA4B;AACnC,SAAO,CAAC,aAAa;AACvB;AAEA,SAAS,WAAW,QAAyC;AAC3D,QAAM,OAAiB,CAAC,OAAO,MAAM;AACrC,MAAI,OAAO,WAAY,MAAK,KAAK,YAAY;AAC7C,MAAI,OAAO,WAAY,MAAK,KAAK,YAAY;AAC7C,MAAI,OAAO,iBAAiB,QAAS,MAAK,KAAK,gBAAgB,OAAO,YAAY,EAAE;AACpF,SAAO;AACT;AAEA,SAAS,cAAc,WAA+C;AACpE,QAAM,OAAiB,CAAC,UAAU,MAAM;AACxC,MAAI,UAAU,iBAAiB,QAAS,MAAK,KAAK,gBAAgB,UAAU,YAAY,EAAE;AAC1F,aAAW,SA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selineDirFor,
9
- baselinePath,
10
- normalize,
11
- writeBaseline
12
- } from "./chunk-ODUIFFPM.js";
13
-
14
- // src/commands/snapshot.ts
15
- import { relative } from "path";
16
- async function runSnapshot(options) {
17
- const runner = await createSurfaceRunner(options.configPath);
18
- try {
19
- const scenarios = options.scenario ? [options.scenario] : runner.scenarioNames;
20
- const dir = baselineDirFor(options.configPath, options.baselineDir ?? runner.config.baselineDir);
21
- for (const scenario of scenarios) {
22
- const result = await runner.collect({
23
- scenario,
24
- ...options.scope ? { scope: options.scope } : {}
25
- });
26
- const path = baselinePath(dir, scenario);
27
- writeBaseline(path, normalize(result.snapshot));
28
- write(`wrote ${relative(process.cwd(), path)}`);
29
- }
30
- return 0;
31
- } finally {
32
- await runner.close();
33
- }
34
- }
35
- export {
36
- runSnapshot
37
- };
38
- //# sourceMappingURL=snapshot-JQAB73OV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/snapshot.ts"],"sourcesContent":["import { relative } from \"node:path\";\nimport { createSurfaceRunner } from \"../load.js\";\nimport { baselineDirFor, baselinePath, normalize, writeBaseline } from \"../baseline.js\";\nimport { write } from \"../output.js\";\n\nexport interface SnapshotOptions {\n configPath: string;\n scenario?: string;\n scope?: string[];\n baselineDir?: string;\n}\n\n/** Writes (or refreshes) the committed baseline `check` compares against. */\nexport async function runSnapshot(options: SnapshotOptions): Promise<number> {\n const runner = await createSurfaceRunner(options.configPath);\n try {\n const scenarios = options.scenario ? [options.scenario] : runner.scenarioNames;\n const dir = baselineDirFor(options.configPath, options.baselineDir ?? runner.config.baselineDir);\n\n for (const scenario of scenarios) {\n const result = await runner.collect({\n scenario,\n ...(options.scope ? { scope: options.scope } : {}),\n });\n const path = baselinePath(dir, scenario);\n writeBaseline(path, normalize(result.snapshot));\n write(`wrote ${relative(process.cwd(), path)}`);\n }\n return 0;\n } finally {\n await runner.close();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AAazB,eAAsB,YAAY,SAA2C;AAC3E,QAAM,SAAS,MAAM,oBAAoB,QAAQ,UAAU;AAC3D,MAAI;AACF,UAAM,YAAY,QAAQ,WAAW,CAAC,QAAQ,QAAQ,IAAI,OAAO;AACjE,UAAM,MAAM,eAAe,QAAQ,YAAY,QAAQ,eAAe,OAAO,OAAO,WAAW;AAE/F,eAAW,YAAY,WAAW;AAChC,YAAM,SAAS,MAAM,OAAO,QAAQ;AAAA,QAClC;AAAA,QACA,GAAI,QAAQ,QAAQ,EAAE,OAAO,QAAQ,MAAM,IAAI,CAAC;AAAA,MAClD,CAAC;AACD,YAAM,OAAO,aAAa,KAAK,QAAQ;AACvC,oBAAc,MAAM,UAAU,OAAO,QAAQ,CAAC;AAC9C,YAAM,SAAS,SAAS,QAAQ,IAAI,GAAG,IAAI,CAAC,EAAE;AAAA,IAChD;AACA,WAAO;AAAA,EACT,UAAE;AACA,UAAM,OAAO,MAAM;AAAA,EACrB;AACF;","names":[]}