@agentshouse/mdmodel 0.1.0-cdbd463e01dc2 → 0.1.0-ce4af152f38d8
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.
- package/API.md +29 -18
- package/README.md +1 -1
- package/dist/blocks.d.ts.map +1 -1
- package/dist/blocks.js +0 -4
- package/dist/definition.js +4 -3
- package/dist/document.d.ts +2 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +24 -5
- package/dist/event.d.ts +2 -2
- package/dist/event.d.ts.map +1 -1
- package/dist/event.js +15 -44
- package/dist/facts.d.ts +2 -2
- package/dist/facts.d.ts.map +1 -1
- package/dist/facts.js +1 -2
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/kinds.d.ts +1 -2
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +0 -11
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +5 -15
- package/dist/pattern.d.ts.map +1 -1
- package/dist/pattern.js +4 -3
- package/dist/project.js +5 -7
- package/dist/query/language.d.ts +35 -4
- package/dist/query/language.d.ts.map +1 -1
- package/dist/query/language.js +80 -25
- package/dist/query/match.d.ts.map +1 -1
- package/dist/query/match.js +37 -8
- package/dist/query/sql.d.ts.map +1 -1
- package/dist/query/sql.js +7 -1
- package/dist/reserved.d.ts +1 -0
- package/dist/reserved.d.ts.map +1 -1
- package/dist/reserved.js +2 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +4 -3
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +91 -43
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +4 -11
- package/fixtures/division.json +1 -2
- package/fixtures/projection.json +1 -2
- package/fixtures/queries.json +51 -0
- package/package.json +1 -1
- package/dist/profile.d.ts +0 -6
- package/dist/profile.d.ts.map +0 -1
- package/dist/profile.js +0 -5
package/dist/validate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ATTACHMENT, BUILT_IN_TYPE, readSchema } from './definition.js';
|
|
1
|
+
import { ATTACHMENT, BUILT_IN_TYPE, readSchema, } from './definition.js';
|
|
2
2
|
import { links, parse } from './document.js';
|
|
3
3
|
import { MEMBER_FIELD } from './fields.js';
|
|
4
4
|
import { hrefOccurrences, linkInventory } from './links.js';
|
|
@@ -18,10 +18,10 @@ function unmarkedMember(file, document, definition) {
|
|
|
18
18
|
? refuse(file, 'undeclared-field', { location: `/${MEMBER_FIELD}` })
|
|
19
19
|
: null;
|
|
20
20
|
}
|
|
21
|
-
function reservedLink(file, document) {
|
|
21
|
+
function reservedLink(file, document, changed) {
|
|
22
22
|
return (document.type !== undefined &&
|
|
23
23
|
isDocumentPath(file) &&
|
|
24
|
-
links(document, file).some((link) => !isDocumentPath(link.target)));
|
|
24
|
+
links(document, file).some((link) => !isDocumentPath(link.target) && (changed?.has(link.target) ?? true)));
|
|
25
25
|
}
|
|
26
26
|
function describedRoom(file, document) {
|
|
27
27
|
return file === ROOM_DESCRIPTION && document.type !== undefined
|
|
@@ -107,6 +107,32 @@ function itemHrefs(content, items, uses) {
|
|
|
107
107
|
}
|
|
108
108
|
return hrefs;
|
|
109
109
|
}
|
|
110
|
+
function listReads(content, definition, spans = headingSpans(content, bodyStartOf(content))) {
|
|
111
|
+
const uses = usesIn(content);
|
|
112
|
+
const reads = [];
|
|
113
|
+
for (const span of spans) {
|
|
114
|
+
const spec = Object.hasOwn(definition.sections, span.name)
|
|
115
|
+
? definition.sections[span.name]
|
|
116
|
+
: undefined;
|
|
117
|
+
if (spec?.kind !== 'list')
|
|
118
|
+
continue;
|
|
119
|
+
const listed = listItems(content, span.bodyStart, span.bodyEnd);
|
|
120
|
+
reads.push({
|
|
121
|
+
section: span.name,
|
|
122
|
+
items: spec.items,
|
|
123
|
+
listed,
|
|
124
|
+
hrefs: listed === null || spec.items.reference === undefined
|
|
125
|
+
? null
|
|
126
|
+
: itemHrefs(content, listed, uses),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return reads;
|
|
130
|
+
}
|
|
131
|
+
function listedReferences(reads) {
|
|
132
|
+
return reads.flatMap(({ section, items, hrefs }) => items.reference === undefined || hrefs === null
|
|
133
|
+
? []
|
|
134
|
+
: [{ section, to: items.reference, crossRoom: items.crossRoom === true, hrefs }]);
|
|
135
|
+
}
|
|
110
136
|
export function verify(schema, provided) {
|
|
111
137
|
const read = readSchema(schema, provided);
|
|
112
138
|
if ('types' in read)
|
|
@@ -131,8 +157,7 @@ function structure(file, content, document, definition) {
|
|
|
131
157
|
return { refusal: refuse(file, fieldFailure.rule, { location: fieldFailure.location }) };
|
|
132
158
|
}
|
|
133
159
|
const spans = headingSpans(content, bodyStartOf(content));
|
|
134
|
-
const
|
|
135
|
-
const sections = [];
|
|
160
|
+
const reads = listReads(content, definition, spans);
|
|
136
161
|
const conditioned = conditionedSections(definition, document.fields);
|
|
137
162
|
for (const [name, spec] of Object.entries(definition.sections)) {
|
|
138
163
|
const occurrences = spans.filter((one) => one.name === name);
|
|
@@ -141,28 +166,19 @@ function structure(file, content, document, definition) {
|
|
|
141
166
|
if (conditioned.includes(name) &&
|
|
142
167
|
occurrences.every((span) => content.slice(span.bodyStart, span.bodyEnd).trim() === ''))
|
|
143
168
|
return { refusal: refuse(file, 'conditional-section', { location: name }) };
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (items === null ||
|
|
149
|
-
items.some((item) => !fitsItem(definition, name, content.slice(item.start, item.end))))
|
|
150
|
-
return { refusal: refuse(file, 'structured-section', { location: name }) };
|
|
151
|
-
if (spec.items.reference === undefined)
|
|
152
|
-
continue;
|
|
153
|
-
const hrefs = itemHrefs(content, items, uses);
|
|
154
|
-
if (hrefs === null)
|
|
169
|
+
for (const { items, listed, hrefs } of reads.filter((read) => read.section === name)) {
|
|
170
|
+
if (listed === null ||
|
|
171
|
+
listed.some((item) => !fitsItem(definition, name, content.slice(item.start, item.end))) ||
|
|
172
|
+
(items.reference !== undefined && hrefs === null))
|
|
155
173
|
return { refusal: refuse(file, 'structured-section', { location: name }) };
|
|
156
|
-
sections.push({
|
|
157
|
-
section: name,
|
|
158
|
-
to: spec.items.reference,
|
|
159
|
-
crossRoom: spec.items.crossRoom === true,
|
|
160
|
-
hrefs,
|
|
161
|
-
});
|
|
162
174
|
}
|
|
163
175
|
}
|
|
164
176
|
const member = unmarkedMember(file, document, definition);
|
|
165
|
-
|
|
177
|
+
if (member !== null)
|
|
178
|
+
return { refusal: member };
|
|
179
|
+
return {
|
|
180
|
+
sections: Object.keys(definition.sections).flatMap((name) => listedReferences(reads.filter((read) => read.section === name))),
|
|
181
|
+
};
|
|
166
182
|
}
|
|
167
183
|
function linked(file, content) {
|
|
168
184
|
return hrefOccurrences(bodyAfterFrontmatter(content)).every((occurrence) => classifyHref(file, occurrence.href).kind !== 'invalid');
|
|
@@ -226,14 +242,12 @@ export function bodyRoomLinks(body) {
|
|
|
226
242
|
}
|
|
227
243
|
return found;
|
|
228
244
|
}
|
|
229
|
-
export function roomReferences(
|
|
245
|
+
export function roomReferences(document, definition) {
|
|
246
|
+
const { content } = document;
|
|
230
247
|
const found = bodyRoomLinks(bodyAfterFrontmatter(content));
|
|
231
248
|
if (definition === undefined)
|
|
232
249
|
return found;
|
|
233
|
-
const
|
|
234
|
-
if (!parsed.ok)
|
|
235
|
-
return found;
|
|
236
|
-
for (const { pointer, value, to, crossRoom } of references(parsed.document, definition)) {
|
|
250
|
+
for (const { pointer, value, to, crossRoom } of references(document, definition)) {
|
|
237
251
|
const room = roomTarget(value);
|
|
238
252
|
if (room !== null)
|
|
239
253
|
found.push({
|
|
@@ -245,24 +259,17 @@ export function roomReferences(file, content, definition) {
|
|
|
245
259
|
...(crossRoom ? { crossRoom } : {}),
|
|
246
260
|
});
|
|
247
261
|
}
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
const spec = Object.hasOwn(definition.sections, span.name)
|
|
251
|
-
? definition.sections[span.name]
|
|
252
|
-
: undefined;
|
|
253
|
-
if (spec?.kind !== 'list' || spec.items.reference === undefined)
|
|
254
|
-
continue;
|
|
255
|
-
const listed = listItems(content, span.bodyStart, span.bodyEnd);
|
|
256
|
-
for (const href of (listed === null ? null : itemHrefs(content, listed, uses)) ?? []) {
|
|
262
|
+
for (const { section, to, crossRoom, hrefs } of listedReferences(listReads(content, definition))) {
|
|
263
|
+
for (const href of hrefs) {
|
|
257
264
|
const room = roomTarget(href);
|
|
258
265
|
if (room !== null)
|
|
259
266
|
found.push({
|
|
260
267
|
kind: 'item',
|
|
261
|
-
section
|
|
268
|
+
section,
|
|
262
269
|
href,
|
|
263
|
-
to
|
|
270
|
+
to,
|
|
264
271
|
...room,
|
|
265
|
-
...(
|
|
272
|
+
...(crossRoom ? { crossRoom: true } : {}),
|
|
266
273
|
});
|
|
267
274
|
}
|
|
268
275
|
}
|
|
@@ -271,14 +278,14 @@ export function roomReferences(file, content, definition) {
|
|
|
271
278
|
function least(refused, file, verdict) {
|
|
272
279
|
return refused === undefined || file < refused.file ? { file, verdict } : refused;
|
|
273
280
|
}
|
|
274
|
-
export function assess(file,
|
|
281
|
+
export function assess(file, parsed, binary, model = { types: {} }, context = {}) {
|
|
275
282
|
const unread = { file, type: undefined, targets: [], structured: null, fields: [], sections: [] };
|
|
276
283
|
if (binary)
|
|
277
284
|
return { ...unread, read: refuse(file, 'binary-target-document'), linked: true };
|
|
278
|
-
const parsed = parse(content, file);
|
|
279
285
|
if (!parsed.ok)
|
|
280
286
|
return { ...unread, read: { verdict: 'refuse', ...parsed.refusal }, linked: true };
|
|
281
287
|
const document = parsed.document;
|
|
288
|
+
const content = document.content;
|
|
282
289
|
const type = document.type ?? BUILT_IN_TYPE;
|
|
283
290
|
const typed = { file, type, read: null, structured: null };
|
|
284
291
|
const typedPath = typedPathOf(file, context.typedPaths);
|
|
@@ -346,6 +353,47 @@ function structured(file, content, typed, document, definition, context) {
|
|
|
346
353
|
sections,
|
|
347
354
|
};
|
|
348
355
|
}
|
|
356
|
+
export function assessReferences(file, parsed, changed, model = { types: {} }, context = {}) {
|
|
357
|
+
const unread = {
|
|
358
|
+
file,
|
|
359
|
+
type: undefined,
|
|
360
|
+
targets: [],
|
|
361
|
+
read: null,
|
|
362
|
+
structured: null,
|
|
363
|
+
fields: [],
|
|
364
|
+
linked: true,
|
|
365
|
+
sections: [],
|
|
366
|
+
};
|
|
367
|
+
if (!parsed.ok)
|
|
368
|
+
return unread;
|
|
369
|
+
const { document } = parsed;
|
|
370
|
+
const definition = definitionOf(kindOf(document, typedPathOf(file, context.typedPaths)), model);
|
|
371
|
+
const placed = (href, to, location) => {
|
|
372
|
+
const resolved = classifyHref(file, href);
|
|
373
|
+
return resolved.kind === 'path' && changed.has(resolved.path)
|
|
374
|
+
? [{ reference: referred(file, href, to), location }]
|
|
375
|
+
: [];
|
|
376
|
+
};
|
|
377
|
+
const fields = definition === undefined
|
|
378
|
+
? []
|
|
379
|
+
: references(document, definition).flatMap(({ pointer, value, to }) => placed(value, to, pointer));
|
|
380
|
+
const sections = definition === undefined
|
|
381
|
+
? []
|
|
382
|
+
: listedReferences(listReads(document.content, definition)).flatMap(({ section, to, hrefs }) => hrefs.flatMap((href) => placed(href, to, section)));
|
|
383
|
+
const targets = new Set();
|
|
384
|
+
for (const { reference } of [...fields, ...sections]) {
|
|
385
|
+
if (reference.target !== null)
|
|
386
|
+
targets.add(reference.target);
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
...unread,
|
|
390
|
+
type: document.type ?? BUILT_IN_TYPE,
|
|
391
|
+
targets: [...targets],
|
|
392
|
+
fields,
|
|
393
|
+
linked: !reservedLink(file, document, changed),
|
|
394
|
+
sections,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
349
397
|
export function verdicts() {
|
|
350
398
|
let read;
|
|
351
399
|
let structured;
|
|
@@ -410,7 +458,7 @@ export function* validating(library, context = { binaryTargets: [] }, model = {
|
|
|
410
458
|
const closeBudget = openPatternBudget();
|
|
411
459
|
try {
|
|
412
460
|
for (const [file, content] of library) {
|
|
413
|
-
const assessment = assess(file, content, binary(file), model, context);
|
|
461
|
+
const assessment = assess(file, parse(content, file), binary(file), model, context);
|
|
414
462
|
if (assessment.type !== undefined)
|
|
415
463
|
types.set(file, assessment.type);
|
|
416
464
|
assessments.push(assessment);
|
package/dist/yaml.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../src/yaml.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAnC,YAAqB,MAAM,EAAE,MAAM,EAGlC;CACF;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,OAAO,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AAM,CAEjD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAG3E;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GACd;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAoB9F;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAgBjE;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEzD"}
|
package/dist/yaml.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export class YamlError extends Error {
|
|
2
2
|
offset;
|
|
3
3
|
constructor(offset) {
|
|
4
|
-
super(
|
|
4
|
+
super();
|
|
5
5
|
this.offset = offset;
|
|
6
6
|
this.name = 'YamlError';
|
|
7
7
|
}
|
|
@@ -221,8 +221,6 @@ function parseFlowMap(c) {
|
|
|
221
221
|
}
|
|
222
222
|
function flowMap(c) {
|
|
223
223
|
const start = c.i;
|
|
224
|
-
if (peek(c) !== '{')
|
|
225
|
-
throw new YamlError(c.i);
|
|
226
224
|
c.i += 1;
|
|
227
225
|
skipFlowSpace(c);
|
|
228
226
|
const entries = [];
|
|
@@ -262,8 +260,6 @@ function parseFlowSeq(c) {
|
|
|
262
260
|
}
|
|
263
261
|
function flowSeq(c) {
|
|
264
262
|
const start = c.i;
|
|
265
|
-
if (peek(c) !== '[')
|
|
266
|
-
throw new YamlError(c.i);
|
|
267
263
|
c.i += 1;
|
|
268
264
|
skipFlowSpace(c);
|
|
269
265
|
const items = [];
|
|
@@ -335,10 +331,8 @@ function mappingAhead(c) {
|
|
|
335
331
|
const next = c.text[c.i + 1];
|
|
336
332
|
return next === ' ' || next === '\n' || next === '\r' || c.i + 1 >= c.end;
|
|
337
333
|
}
|
|
338
|
-
catch
|
|
339
|
-
|
|
340
|
-
return false;
|
|
341
|
-
throw error;
|
|
334
|
+
catch {
|
|
335
|
+
return false;
|
|
342
336
|
}
|
|
343
337
|
finally {
|
|
344
338
|
c.i = start;
|
|
@@ -528,7 +522,7 @@ export function extractFrontmatter(content) {
|
|
|
528
522
|
return { kind: 'unclosed' };
|
|
529
523
|
const yamlStart = firstNl + 1;
|
|
530
524
|
let i = yamlStart;
|
|
531
|
-
|
|
525
|
+
for (;;) {
|
|
532
526
|
const nl = content.indexOf('\n', i);
|
|
533
527
|
const lineEnd = nl === -1 ? content.length : nl;
|
|
534
528
|
let line = content.slice(i, lineEnd);
|
|
@@ -540,7 +534,6 @@ export function extractFrontmatter(content) {
|
|
|
540
534
|
return { kind: 'unclosed' };
|
|
541
535
|
i = nl + 1;
|
|
542
536
|
}
|
|
543
|
-
return { kind: 'unclosed' };
|
|
544
537
|
}
|
|
545
538
|
export function equalValue(left, right) {
|
|
546
539
|
if (left === right)
|
package/fixtures/division.json
CHANGED
package/fixtures/projection.json
CHANGED
package/fixtures/queries.json
CHANGED
|
@@ -841,6 +841,57 @@
|
|
|
841
841
|
"document": "task",
|
|
842
842
|
"matches": false
|
|
843
843
|
},
|
|
844
|
+
{
|
|
845
|
+
"name": "a Document outside a named directory is read",
|
|
846
|
+
"query": {
|
|
847
|
+
"outside": [
|
|
848
|
+
"notes"
|
|
849
|
+
]
|
|
850
|
+
},
|
|
851
|
+
"document": "task",
|
|
852
|
+
"matches": true
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
"name": "a Document under a named directory is left out",
|
|
856
|
+
"query": {
|
|
857
|
+
"outside": [
|
|
858
|
+
"tasks"
|
|
859
|
+
]
|
|
860
|
+
},
|
|
861
|
+
"document": "task",
|
|
862
|
+
"matches": false
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
"name": "a Document that is not Markdown is left out under a named directory",
|
|
866
|
+
"query": {
|
|
867
|
+
"outside": [
|
|
868
|
+
"data"
|
|
869
|
+
]
|
|
870
|
+
},
|
|
871
|
+
"document": "export",
|
|
872
|
+
"matches": false
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
"name": "a directory left out is a whole directory",
|
|
876
|
+
"query": {
|
|
877
|
+
"outside": [
|
|
878
|
+
"task"
|
|
879
|
+
]
|
|
880
|
+
},
|
|
881
|
+
"document": "task",
|
|
882
|
+
"matches": true
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
"name": "a Document under any of the directories named is left out",
|
|
886
|
+
"query": {
|
|
887
|
+
"outside": [
|
|
888
|
+
"data",
|
|
889
|
+
"tasks"
|
|
890
|
+
]
|
|
891
|
+
},
|
|
892
|
+
"document": "task",
|
|
893
|
+
"matches": false
|
|
894
|
+
},
|
|
844
895
|
{
|
|
845
896
|
"name": "a phrase is found ignoring case",
|
|
846
897
|
"query": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdmodel",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-ce4af152f38d8",
|
|
4
4
|
"description": "MD Type language, parser, validator, structured change application, Markdown syntax profile, and conformance fixtures",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/dist/profile.d.ts
DELETED
package/dist/profile.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;aAClC,IAAI,EAAE,0BAA0B;aAChC,IAAI,EAAE,MAAM;aACZ,GAAG,EAAE,gCAAgC;CAC7B,CAAC"}
|