@sasjs/lint 2.7.0 → 4.0.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.
- package/README.md +60 -5
- package/format/formatFile.js +2 -1
- package/format/formatFile.js.map +1 -1
- package/format/formatText.js +1 -1
- package/format/formatText.js.map +1 -1
- package/lint/lintFile.js +3 -2
- package/lint/lintFile.js.map +1 -1
- package/lint/lintText.js +1 -1
- package/lint/lintText.js.map +1 -1
- package/package.json +3 -1
- package/rules/file/index.d.ts +2 -0
- package/rules/file/index.js +5 -1
- package/rules/file/index.js.map +1 -1
- package/rules/file/noUndeclaredMacros.d.ts +7 -0
- package/rules/file/noUndeclaredMacros.js +77 -0
- package/rules/file/noUndeclaredMacros.js.map +1 -0
- package/rules/file/noUnusedMacros.d.ts +7 -0
- package/rules/file/noUnusedMacros.js +67 -0
- package/rules/file/noUnusedMacros.js.map +1 -0
- package/sasjslint-schema.json +51 -15
- package/scripts/generate-macro-names.mjs +101 -0
- package/types/LintConfig.d.ts +13 -0
- package/types/LintConfig.js +37 -15
- package/types/LintConfig.js.map +1 -1
- package/utils/getLintConfig.d.ts +26 -13
- package/utils/getLintConfig.js +28 -15
- package/utils/getLintConfig.js.map +1 -1
- package/utils/headerMacros.d.ts +51 -0
- package/utils/headerMacros.js +309 -0
- package/utils/headerMacros.js.map +1 -0
- package/utils/index.d.ts +5 -0
- package/utils/index.js +5 -0
- package/utils/index.js.map +1 -1
- package/utils/mergeLintConfig.d.ts +10 -0
- package/utils/mergeLintConfig.js +67 -0
- package/utils/mergeLintConfig.js.map +1 -0
- package/utils/parseLintOverride.d.ts +36 -0
- package/utils/parseLintOverride.js +109 -0
- package/utils/parseLintOverride.js.map +1 -0
- package/utils/parseMacroCalls.d.ts +28 -0
- package/utils/parseMacroCalls.js +230 -0
- package/utils/parseMacroCalls.js.map +1 -0
- package/utils/sasMacros.d.ts +16 -0
- package/utils/sasMacros.generated.d.ts +6 -0
- package/utils/sasMacros.generated.js +136 -0
- package/utils/sasMacros.generated.js.map +1 -0
- package/utils/sasMacros.js +22 -0
- package/utils/sasMacros.js.map +1 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMacroCalls = void 0;
|
|
4
|
+
/** Matches a macro invocation at the start of the supplied text. */
|
|
5
|
+
const macroNameStart = /^%([a-z_][a-z0-9_]*)/i;
|
|
6
|
+
/** Matches the statements that open a data section. */
|
|
7
|
+
const dataSectionStart = /^(datalines4?|cards4?|parmcards4?)\s*;/i;
|
|
8
|
+
/** Matches the functions whose argument is data rather than code. */
|
|
9
|
+
const maskingFunctionStart = /^%(nrstr|str)\s*\(/i;
|
|
10
|
+
/** Matches the procedures whose `submit` block holds another language. */
|
|
11
|
+
const embeddedLanguageProc = /^proc\s+(lua|groovy)\b/i;
|
|
12
|
+
/** Matches the statement that closes an embedded-language block. */
|
|
13
|
+
const embeddedLanguageEnd = /^endsubmit\s*;/i;
|
|
14
|
+
const embeddedLanguageEndSearch = /endsubmit/i;
|
|
15
|
+
/**
|
|
16
|
+
* Finds the macro invocations in a file.
|
|
17
|
+
*
|
|
18
|
+
* SAS resolves macro triggers inside double-quoted strings but not inside
|
|
19
|
+
* single-quoted strings, so a double-quoted string is scanned as code while a
|
|
20
|
+
* single-quoted string is opaque. Invocations inside block comments, macro
|
|
21
|
+
* comments, comment statements, masking functions (`%str` / `%nrstr`), data
|
|
22
|
+
* sections and embedded-language `submit` blocks are excluded.
|
|
23
|
+
*
|
|
24
|
+
* Every `%name` token is reported, including the macro language keywords and
|
|
25
|
+
* the macros that ship with SAS. Callers decide which names are interesting.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} text - the text content to scan.
|
|
28
|
+
* @param {LintConfig} config - the lint configuration. It is accepted for
|
|
29
|
+
* symmetry with the other utilities and is not used by the scan.
|
|
30
|
+
* @returns {MacroCall[]} the invocations, in the order they appear.
|
|
31
|
+
*/
|
|
32
|
+
const parseMacroCalls = (text, config) => {
|
|
33
|
+
const calls = [];
|
|
34
|
+
if (!text)
|
|
35
|
+
return calls;
|
|
36
|
+
const length = text.length;
|
|
37
|
+
let index = 0;
|
|
38
|
+
let lineNumber = 1;
|
|
39
|
+
let columnNumber = 1;
|
|
40
|
+
let atStatementStart = true;
|
|
41
|
+
let inDoubleQuote = false;
|
|
42
|
+
/**
|
|
43
|
+
* Advances the cursor to `target`, keeping the line and column counters in
|
|
44
|
+
* step. Every branch that consumes a non-code region moves through here.
|
|
45
|
+
*/
|
|
46
|
+
const advanceTo = (target) => {
|
|
47
|
+
const limit = Math.min(target, length);
|
|
48
|
+
while (index < limit) {
|
|
49
|
+
if (text[index] === '\n') {
|
|
50
|
+
lineNumber++;
|
|
51
|
+
columnNumber = 1;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
columnNumber++;
|
|
55
|
+
}
|
|
56
|
+
index++;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
while (index < length) {
|
|
60
|
+
const char = text[index];
|
|
61
|
+
if (char === '\n') {
|
|
62
|
+
lineNumber++;
|
|
63
|
+
columnNumber = 1;
|
|
64
|
+
inDoubleQuote = false;
|
|
65
|
+
index++;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (char === '\r' || char === ' ' || char === '\t') {
|
|
69
|
+
columnNumber++;
|
|
70
|
+
index++;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
// Single-quoted string - opaque. `''` is an escaped quote character. An
|
|
74
|
+
// apostrophe inside a double-quoted string is ordinary text.
|
|
75
|
+
if (char === "'") {
|
|
76
|
+
if (inDoubleQuote) {
|
|
77
|
+
columnNumber++;
|
|
78
|
+
index++;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
let end = index + 1;
|
|
82
|
+
while (end < length) {
|
|
83
|
+
if (text[end] === "'") {
|
|
84
|
+
if (text[end + 1] === "'") {
|
|
85
|
+
end += 2;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
end++;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
if (text[end] === '\n')
|
|
92
|
+
break;
|
|
93
|
+
end++;
|
|
94
|
+
}
|
|
95
|
+
advanceTo(end);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
// Double-quoted string - SAS resolves macro triggers inside it, so the
|
|
99
|
+
// scan continues until the closing quote.
|
|
100
|
+
if (char === '"') {
|
|
101
|
+
inDoubleQuote = !inDoubleQuote;
|
|
102
|
+
columnNumber++;
|
|
103
|
+
index++;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (!inDoubleQuote) {
|
|
107
|
+
if (char === ';') {
|
|
108
|
+
atStatementStart = true;
|
|
109
|
+
columnNumber++;
|
|
110
|
+
index++;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
// Block comment - /* ... */
|
|
114
|
+
if (char === '/' && text[index + 1] === '*') {
|
|
115
|
+
let end = index + 2;
|
|
116
|
+
while (end < length && !(text[end] === '*' && text[end + 1] === '/')) {
|
|
117
|
+
end++;
|
|
118
|
+
}
|
|
119
|
+
advanceTo(Math.min(end + 2, length));
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (char === '%') {
|
|
124
|
+
// Macro comment - %* ... ;
|
|
125
|
+
if (text[index + 1] === '*') {
|
|
126
|
+
let end = index + 2;
|
|
127
|
+
while (end < length && text[end] !== ';')
|
|
128
|
+
end++;
|
|
129
|
+
advanceTo(Math.min(end + 1, length));
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
// Masking functions - the argument is data, not code. `%(` and `%)` are
|
|
133
|
+
// the escapes for literal parentheses inside the argument, so they do
|
|
134
|
+
// not affect the nesting depth.
|
|
135
|
+
const maskingFunction = maskingFunctionStart.exec(text.slice(index));
|
|
136
|
+
if (maskingFunction) {
|
|
137
|
+
let depth = 0;
|
|
138
|
+
let end = index + maskingFunction[0].length - 1;
|
|
139
|
+
while (end < length) {
|
|
140
|
+
if (text[end] === '%' &&
|
|
141
|
+
(text[end + 1] === '(' || text[end + 1] === ')')) {
|
|
142
|
+
end += 2;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (text[end] === '(')
|
|
146
|
+
depth++;
|
|
147
|
+
else if (text[end] === ')') {
|
|
148
|
+
depth--;
|
|
149
|
+
if (depth === 0) {
|
|
150
|
+
end++;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
end++;
|
|
155
|
+
}
|
|
156
|
+
advanceTo(end);
|
|
157
|
+
atStatementStart = false;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const macroName = macroNameStart.exec(text.slice(index));
|
|
161
|
+
if (macroName) {
|
|
162
|
+
// A macro statement label - `%label:` - is not an invocation.
|
|
163
|
+
if (text[index + macroName[0].length] !== ':') {
|
|
164
|
+
calls.push({
|
|
165
|
+
name: macroName[1],
|
|
166
|
+
lineNumber,
|
|
167
|
+
startColumnNumber: columnNumber,
|
|
168
|
+
endColumnNumber: columnNumber + 1 + macroName[1].length
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
advanceTo(index + macroName[0].length);
|
|
172
|
+
atStatementStart = false;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (atStatementStart && !inDoubleQuote) {
|
|
177
|
+
// A proc lua / proc groovy submit block holds another language, so its
|
|
178
|
+
// body is skipped. The block is only entered when an `endsubmit`
|
|
179
|
+
// statement closes it, so a stray `proc lua;` cannot swallow the rest
|
|
180
|
+
// of the file.
|
|
181
|
+
const embeddedProcStart = embeddedLanguageProc.exec(text.slice(index));
|
|
182
|
+
if (embeddedProcStart &&
|
|
183
|
+
embeddedLanguageEndSearch.test(text.slice(index))) {
|
|
184
|
+
const afterProc = index + embeddedProcStart[0].length;
|
|
185
|
+
const offset = text.slice(afterProc).search(embeddedLanguageEndSearch);
|
|
186
|
+
const endSubmit = embeddedLanguageEnd.exec(text.slice(afterProc + offset));
|
|
187
|
+
advanceTo(endSubmit ? afterProc + offset + endSubmit[0].length : length);
|
|
188
|
+
atStatementStart = true;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
// A data section - everything up to its terminating line is data, not
|
|
192
|
+
// code. The terminator is a line containing only the `;` or `;;;;`.
|
|
193
|
+
const dataSection = dataSectionStart.exec(text.slice(index));
|
|
194
|
+
if (dataSection) {
|
|
195
|
+
const terminator = /4/.test(dataSection[1]) ? ';;;;' : ';';
|
|
196
|
+
let lineStart = index + dataSection[0].length;
|
|
197
|
+
let end = length;
|
|
198
|
+
while (lineStart <= length) {
|
|
199
|
+
const lineEnd = text.indexOf('\n', lineStart);
|
|
200
|
+
const actualEnd = lineEnd === -1 ? length : lineEnd;
|
|
201
|
+
if (text.slice(lineStart, actualEnd).trim() === terminator) {
|
|
202
|
+
end = actualEnd;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
if (lineEnd === -1)
|
|
206
|
+
break;
|
|
207
|
+
lineStart = lineEnd + 1;
|
|
208
|
+
}
|
|
209
|
+
advanceTo(end);
|
|
210
|
+
atStatementStart = true;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
// A comment statement - its body is opaque up to the terminating `;`.
|
|
214
|
+
if (char === '*') {
|
|
215
|
+
let end = index + 1;
|
|
216
|
+
while (end < length && text[end] !== ';')
|
|
217
|
+
end++;
|
|
218
|
+
advanceTo(end + 1);
|
|
219
|
+
atStatementStart = true;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
atStatementStart = false;
|
|
224
|
+
columnNumber++;
|
|
225
|
+
index++;
|
|
226
|
+
}
|
|
227
|
+
return calls;
|
|
228
|
+
};
|
|
229
|
+
exports.parseMacroCalls = parseMacroCalls;
|
|
230
|
+
//# sourceMappingURL=parseMacroCalls.js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AAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAxNY,QAAA,eAAe,mBAwN3B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The set of macro names that ship with SAS, lower-cased for comparison.
|
|
3
|
+
*
|
|
4
|
+
* The names are generated from the macroStatements and macroFunctions groups of
|
|
5
|
+
* `@sasjs/sas-language`, which owns the SAS language data - see
|
|
6
|
+
* `scripts/generate-macro-names.mjs`. A macro matching one of these names is
|
|
7
|
+
* treated as declared, so it is never reported by `noUndeclaredMacros` and
|
|
8
|
+
* never written to a file header by the formatter.
|
|
9
|
+
*/
|
|
10
|
+
export declare const sasMacros: Set<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Reports whether a macro name is one of the macros that ship with SAS.
|
|
13
|
+
* @param {string} name - the macro name to test.
|
|
14
|
+
* @returns {boolean} true when the name belongs to a SAS-provided macro.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isSasMacro: (name: string) => boolean;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated by scripts/generate-macro-names.mjs from @sasjs/sas-language.
|
|
3
|
+
// Do not edit. Regenerate with `npm run generate:macros`.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.sasMacros = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* The macro names that ship with SAS, lower-cased and without the leading
|
|
8
|
+
* `%`, as published in the macroStatements and macroFunctions groups of
|
|
9
|
+
* `@sasjs/sas-language`.
|
|
10
|
+
*/
|
|
11
|
+
exports.sasMacros = [
|
|
12
|
+
'abort',
|
|
13
|
+
'armconv',
|
|
14
|
+
'armend',
|
|
15
|
+
'armgtid',
|
|
16
|
+
'arminit',
|
|
17
|
+
'armjoin',
|
|
18
|
+
'armproc',
|
|
19
|
+
'armstop',
|
|
20
|
+
'armstrt',
|
|
21
|
+
'armupdt',
|
|
22
|
+
'bquote',
|
|
23
|
+
'by',
|
|
24
|
+
'cmpres',
|
|
25
|
+
'colormac',
|
|
26
|
+
'compstor',
|
|
27
|
+
'copy',
|
|
28
|
+
'datatyp',
|
|
29
|
+
'dequote',
|
|
30
|
+
'display',
|
|
31
|
+
'do',
|
|
32
|
+
'dqload',
|
|
33
|
+
'dqputloc',
|
|
34
|
+
'dqunload',
|
|
35
|
+
'else',
|
|
36
|
+
'end',
|
|
37
|
+
'eval',
|
|
38
|
+
'global',
|
|
39
|
+
'goto',
|
|
40
|
+
'helpclr',
|
|
41
|
+
'if',
|
|
42
|
+
'inc',
|
|
43
|
+
'include',
|
|
44
|
+
'index',
|
|
45
|
+
'indexc',
|
|
46
|
+
'indexw',
|
|
47
|
+
'input',
|
|
48
|
+
'kcmpres',
|
|
49
|
+
'kindex',
|
|
50
|
+
'kleft',
|
|
51
|
+
'klength',
|
|
52
|
+
'klowcase',
|
|
53
|
+
'kscan',
|
|
54
|
+
'ksubstr',
|
|
55
|
+
'ktrim',
|
|
56
|
+
'kupcase',
|
|
57
|
+
'kverify',
|
|
58
|
+
'left',
|
|
59
|
+
'length',
|
|
60
|
+
'let',
|
|
61
|
+
'list',
|
|
62
|
+
'local',
|
|
63
|
+
'lowcase',
|
|
64
|
+
'macro',
|
|
65
|
+
'mend',
|
|
66
|
+
'nrbquote',
|
|
67
|
+
'nrquote',
|
|
68
|
+
'nrstr',
|
|
69
|
+
'perfend',
|
|
70
|
+
'perfinit',
|
|
71
|
+
'perfstop',
|
|
72
|
+
'perfstrt',
|
|
73
|
+
'put',
|
|
74
|
+
'qbquote',
|
|
75
|
+
'qcmpres',
|
|
76
|
+
'qdequote',
|
|
77
|
+
'qindex',
|
|
78
|
+
'qindexc',
|
|
79
|
+
'qindexw',
|
|
80
|
+
'qkcmpres',
|
|
81
|
+
'qkleft',
|
|
82
|
+
'qklowcas',
|
|
83
|
+
'qklowcase',
|
|
84
|
+
'qkscan',
|
|
85
|
+
'qksubstr',
|
|
86
|
+
'qktrim',
|
|
87
|
+
'qkupcase',
|
|
88
|
+
'qleft',
|
|
89
|
+
'qlowcase',
|
|
90
|
+
'qscan',
|
|
91
|
+
'qsubstr',
|
|
92
|
+
'qsysfunc',
|
|
93
|
+
'qtrim',
|
|
94
|
+
'quote',
|
|
95
|
+
'qupcase',
|
|
96
|
+
'return',
|
|
97
|
+
'run',
|
|
98
|
+
'scan',
|
|
99
|
+
'str',
|
|
100
|
+
'substr',
|
|
101
|
+
'superq',
|
|
102
|
+
'symdel',
|
|
103
|
+
'symexist',
|
|
104
|
+
'symglobl',
|
|
105
|
+
'symlocal',
|
|
106
|
+
'syscall',
|
|
107
|
+
'sysevalf',
|
|
108
|
+
'sysexec',
|
|
109
|
+
'sysfunc',
|
|
110
|
+
'sysget',
|
|
111
|
+
'syslput',
|
|
112
|
+
'sysmacdelete',
|
|
113
|
+
'sysmacexec',
|
|
114
|
+
'sysmacexist',
|
|
115
|
+
'sysmexecdepth',
|
|
116
|
+
'sysmexecname',
|
|
117
|
+
'sysmstoreclear',
|
|
118
|
+
'sysprod',
|
|
119
|
+
'sysrc',
|
|
120
|
+
'sysrput',
|
|
121
|
+
'then',
|
|
122
|
+
'to',
|
|
123
|
+
'tplot',
|
|
124
|
+
'translate',
|
|
125
|
+
'tranwrd',
|
|
126
|
+
'trim',
|
|
127
|
+
'trimn',
|
|
128
|
+
'unquote',
|
|
129
|
+
'until',
|
|
130
|
+
'upcase',
|
|
131
|
+
'validchs',
|
|
132
|
+
'verify',
|
|
133
|
+
'while',
|
|
134
|
+
'window'
|
|
135
|
+
];
|
|
136
|
+
//# sourceMappingURL=sasMacros.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sasMacros.generated.js","sourceRoot":"","sources":["../../src/utils/sasMacros.generated.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,0DAA0D;;;AAE1D;;;;GAIG;AACU,QAAA,SAAS,GAAsB;IAC1C,OAAO;IACP,SAAS;IACT,QAAQ;IACR,SAAS;IACT,SAA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O;IACP,SAAS;IACT,OAAO;IACP,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;CACT,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSasMacro = exports.sasMacros = void 0;
|
|
4
|
+
const sasMacros_generated_1 = require("./sasMacros.generated");
|
|
5
|
+
/**
|
|
6
|
+
* The set of macro names that ship with SAS, lower-cased for comparison.
|
|
7
|
+
*
|
|
8
|
+
* The names are generated from the macroStatements and macroFunctions groups of
|
|
9
|
+
* `@sasjs/sas-language`, which owns the SAS language data - see
|
|
10
|
+
* `scripts/generate-macro-names.mjs`. A macro matching one of these names is
|
|
11
|
+
* treated as declared, so it is never reported by `noUndeclaredMacros` and
|
|
12
|
+
* never written to a file header by the formatter.
|
|
13
|
+
*/
|
|
14
|
+
exports.sasMacros = new Set(sasMacros_generated_1.sasMacros);
|
|
15
|
+
/**
|
|
16
|
+
* Reports whether a macro name is one of the macros that ship with SAS.
|
|
17
|
+
* @param {string} name - the macro name to test.
|
|
18
|
+
* @returns {boolean} true when the name belongs to a SAS-provided macro.
|
|
19
|
+
*/
|
|
20
|
+
const isSasMacro = (name) => exports.sasMacros.has(name.toLowerCase());
|
|
21
|
+
exports.isSasMacro = isSasMacro;
|
|
22
|
+
//# sourceMappingURL=sasMacros.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sasMacros.js","sourceRoot":"","sources":["../../src/utils/sasMacros.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAE1D;;;;;;;;GAQG;AACU,QAAA,SAAS,GAAgB,IAAI,GAAG,CAAC,+BAAK,CAAC,CAAA;AAEpD;;;;GAIG;AACI,MAAM,UAAU,GAAG,CAAC,IAAY,EAAW,EAAE,CAClD,iBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;AADtB,QAAA,UAAU,cACY"}
|