@darajs/components 1.16.5 → 1.16.6-alpha.2
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/dist/dara_components-1.16.6a2-py3-none-any.whl +0 -0
- package/dist/index.css +120 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/smart/code-editor.d.ts.map +1 -1
- package/dist/smart/code-editor.js +27 -2
- package/dist/smart/code-editor.js.map +1 -1
- package/dist/smart/index.d.ts +1 -0
- package/dist/smart/index.d.ts.map +1 -1
- package/dist/smart/index.js +1 -0
- package/dist/smart/index.js.map +1 -1
- package/dist/smart/ui-code-editor/code-editor.d.ts +118 -0
- package/dist/smart/ui-code-editor/code-editor.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/code-editor.js +357 -0
- package/dist/smart/ui-code-editor/code-editor.js.map +1 -0
- package/dist/smart/ui-code-editor/codemirror-context.d.ts +18 -0
- package/dist/smart/ui-code-editor/codemirror-context.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/codemirror-context.js +10 -0
- package/dist/smart/ui-code-editor/codemirror-context.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/argument-hints.d.ts +21 -0
- package/dist/smart/ui-code-editor/extensions/argument-hints.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/argument-hints.js +250 -0
- package/dist/smart/ui-code-editor/extensions/argument-hints.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/code-folding.d.ts +3 -0
- package/dist/smart/ui-code-editor/extensions/code-folding.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/code-folding.js +69 -0
- package/dist/smart/ui-code-editor/extensions/code-folding.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/json.d.ts +16 -0
- package/dist/smart/ui-code-editor/extensions/json.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/json.js +29 -0
- package/dist/smart/ui-code-editor/extensions/json.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/lsp-utils.d.ts +39 -0
- package/dist/smart/ui-code-editor/extensions/lsp-utils.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/lsp-utils.js +299 -0
- package/dist/smart/ui-code-editor/extensions/lsp-utils.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/markdown.d.ts +13 -0
- package/dist/smart/ui-code-editor/extensions/markdown.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/markdown.js +19 -0
- package/dist/smart/ui-code-editor/extensions/markdown.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/python.d.ts +15 -0
- package/dist/smart/ui-code-editor/extensions/python.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/python.js +21 -0
- package/dist/smart/ui-code-editor/extensions/python.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/shared.d.ts +48 -0
- package/dist/smart/ui-code-editor/extensions/shared.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/shared.js +166 -0
- package/dist/smart/ui-code-editor/extensions/shared.js.map +1 -0
- package/dist/smart/ui-code-editor/extensions/sql.d.ts +14 -0
- package/dist/smart/ui-code-editor/extensions/sql.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/extensions/sql.js +23 -0
- package/dist/smart/ui-code-editor/extensions/sql.js.map +1 -0
- package/dist/smart/ui-code-editor/index.d.ts +25 -0
- package/dist/smart/ui-code-editor/index.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/index.js +25 -0
- package/dist/smart/ui-code-editor/index.js.map +1 -0
- package/dist/smart/ui-code-editor/types.d.ts +65 -0
- package/dist/smart/ui-code-editor/types.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/types.js +5 -0
- package/dist/smart/ui-code-editor/types.js.map +1 -0
- package/dist/smart/ui-code-editor/utils.d.ts +16 -0
- package/dist/smart/ui-code-editor/utils.d.ts.map +1 -0
- package/dist/smart/ui-code-editor/utils.js +33 -0
- package/dist/smart/ui-code-editor/utils.js.map +1 -0
- package/dist/umd/dara.components.umd.js +35001 -31083
- package/dist/umd/style.css +750 -1
- package/package.json +28 -15
- package/dist/dara_components-1.16.5-py3-none-any.whl +0 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { nanoid } from 'nanoid';
|
|
11
|
+
import { CompletionItemKind } from 'vscode-languageserver-types';
|
|
12
|
+
import { LSP_MESSAGE_KIND, isErrorResponse } from '../types';
|
|
13
|
+
const LSP_CODEMIRROR_TYPE_MAP = Object.fromEntries(Object.entries(CompletionItemKind).map(([key, value]) => [value, key]));
|
|
14
|
+
function lspCompletionToCodeMirror(completion) {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
16
|
+
return {
|
|
17
|
+
label: completion.label,
|
|
18
|
+
detail: ((_b = (_a = completion === null || completion === void 0 ? void 0 : completion.labelDetails) === null || _a === void 0 ? void 0 : _a.detail) !== null && _b !== void 0 ? _b : '') + ((_d = (_c = completion === null || completion === void 0 ? void 0 : completion.labelDetails) === null || _c === void 0 ? void 0 : _c.description) !== null && _d !== void 0 ? _d : ''),
|
|
19
|
+
type: completion.kind ? (_e = LSP_CODEMIRROR_TYPE_MAP[completion.kind]) === null || _e === void 0 ? void 0 : _e.toLowerCase() : undefined,
|
|
20
|
+
apply: (_h = (_g = (_f = completion.textEdit) === null || _f === void 0 ? void 0 : _f.newText) !== null && _g !== void 0 ? _g : completion.insertText) !== null && _h !== void 0 ? _h : completion.label,
|
|
21
|
+
sortText: (_j = completion.sortText) !== null && _j !== void 0 ? _j : completion.label,
|
|
22
|
+
filterText: (_k = completion.filterText) !== null && _k !== void 0 ? _k : completion.label,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Convert a set of characters to a RegExp character set string.
|
|
27
|
+
* For word-like characters, \w is used instead of listing them all.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Only word characters
|
|
31
|
+
* toSet(new Set(['a', 'b', 'c', '1', '2', '3']))
|
|
32
|
+
* // Returns: '[\\w]'
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Mix of word and non-word characters
|
|
36
|
+
* toSet(new Set(['a', 'b', '!', '@', '1', '2']))
|
|
37
|
+
* // Returns: '[\\w!@]'
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Only non-word characters
|
|
41
|
+
* toSet(new Set(['!', '@', '#', '$']))
|
|
42
|
+
* // Returns: '[!@#$]'
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Empty set
|
|
46
|
+
* toSet(new Set([]))
|
|
47
|
+
* // Returns: '[]'
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Set with RegExp special characters
|
|
51
|
+
* toSet(new Set(['[', ']', '-', '^']))
|
|
52
|
+
* // Returns: '[\\[\\]\\-\\^]'
|
|
53
|
+
*
|
|
54
|
+
* @param chars - the set of characters to convert
|
|
55
|
+
* @returns the RegExp character set string
|
|
56
|
+
*/
|
|
57
|
+
function toSet(chars) {
|
|
58
|
+
let preamble = '';
|
|
59
|
+
let flat = Array.from(chars).join('');
|
|
60
|
+
// Check if the set contains any word characters (\w in RegExp)
|
|
61
|
+
const words = /\w/.test(flat);
|
|
62
|
+
if (words) {
|
|
63
|
+
// If word characters are present, add \w to the preamble instead of the explicit set
|
|
64
|
+
// This represents all word characters in the set
|
|
65
|
+
preamble += '\\w';
|
|
66
|
+
flat = flat.replace(/\w/g, '');
|
|
67
|
+
}
|
|
68
|
+
// $& in the replacement string means "replace with the matched substring", used here to add an extra backslash
|
|
69
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement
|
|
70
|
+
return `[${preamble}${flat.replace(/[^\w\s]/g, '\\$&')}]`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Generate a RegExp pattern to match the prefix of a completion.
|
|
74
|
+
*
|
|
75
|
+
* Adapted from https://github.com/FurqanSoftware/codemirror-languageserver
|
|
76
|
+
*
|
|
77
|
+
* @param options - the list of completions
|
|
78
|
+
* @returns the RegExp pattern
|
|
79
|
+
*/
|
|
80
|
+
function prefixMatch(options) {
|
|
81
|
+
// First character of each completion
|
|
82
|
+
const first = new Set();
|
|
83
|
+
// Rest of the characters of each completion
|
|
84
|
+
const rest = new Set();
|
|
85
|
+
for (const { apply } of options) {
|
|
86
|
+
const [initial, ...restStr] = apply;
|
|
87
|
+
first.add(initial);
|
|
88
|
+
for (const char of restStr) {
|
|
89
|
+
rest.add(char);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Create a RegExp source string using the collected characters
|
|
93
|
+
// This pattern will match any number of characters from both sets
|
|
94
|
+
const source = `${toSet(first) + toSet(rest)}*$`;
|
|
95
|
+
return new RegExp(source);
|
|
96
|
+
}
|
|
97
|
+
/** The characters that trigger completion, i.e. if one of those is the last character in the line then completion is triggered */
|
|
98
|
+
const TRIGGER_CHARS = new Set(['.', '[', '"', "'"]);
|
|
99
|
+
/** The regex that matches prior characters that trigger completion */
|
|
100
|
+
const COMPLETION_REGEX = new RegExp(`[a-z_A-Z0-9${[...TRIGGER_CHARS].join('')}]+$`);
|
|
101
|
+
/** The minimum length of a word matching COMPLETION_REGEX to trigger completion */
|
|
102
|
+
const COMPLETION_MIN_LENGTH = 2;
|
|
103
|
+
/**
|
|
104
|
+
* Helper to get LSP completions
|
|
105
|
+
*
|
|
106
|
+
* @param client - the websocket client
|
|
107
|
+
* @param context - the completion context
|
|
108
|
+
* @param uri - the uri of the file
|
|
109
|
+
*/
|
|
110
|
+
export function getLspCompletion(client, context, uri) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const linePosInfo = context.state.doc.lineAt(context.pos);
|
|
113
|
+
const ch = context.pos - linePosInfo.from;
|
|
114
|
+
const id = nanoid();
|
|
115
|
+
const lastChar = linePosInfo.text.charAt(ch - 1);
|
|
116
|
+
let canComplete = false;
|
|
117
|
+
// complete if a trigger char is the last one
|
|
118
|
+
if (TRIGGER_CHARS.has(lastChar)) {
|
|
119
|
+
canComplete = true;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
// only complete if user has typed a matching sequence of at least MIN_LENGTH
|
|
123
|
+
const wordMatch = linePosInfo.text.slice(0, ch).match(COMPLETION_REGEX);
|
|
124
|
+
canComplete = wordMatch !== null && wordMatch[0].length >= COMPLETION_MIN_LENGTH;
|
|
125
|
+
}
|
|
126
|
+
if (!canComplete) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const msg = yield (client === null || client === void 0 ? void 0 : client.sendCustomMessage(LSP_MESSAGE_KIND, {
|
|
130
|
+
method: 'textDocument/completion',
|
|
131
|
+
id,
|
|
132
|
+
uri,
|
|
133
|
+
params: {
|
|
134
|
+
line: linePosInfo.number - 1,
|
|
135
|
+
character: ch,
|
|
136
|
+
},
|
|
137
|
+
}, true));
|
|
138
|
+
if (!msg) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const data = msg.message.data;
|
|
142
|
+
if (isErrorResponse(data)) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Whether all returned completions are files.
|
|
147
|
+
* This can occur in completions e.g. within open() or os.path.join()
|
|
148
|
+
*/
|
|
149
|
+
let allFiles = true;
|
|
150
|
+
let options = data.items.map((item) => {
|
|
151
|
+
const completion = lspCompletionToCodeMirror(item);
|
|
152
|
+
if (completion.type !== 'file') {
|
|
153
|
+
allFiles = false;
|
|
154
|
+
}
|
|
155
|
+
return completion;
|
|
156
|
+
});
|
|
157
|
+
// build a regex to match the prefix of the completion
|
|
158
|
+
const match = prefixMatch(options);
|
|
159
|
+
// find the current word being typed
|
|
160
|
+
const token = context.matchBefore(match);
|
|
161
|
+
let from = context.pos;
|
|
162
|
+
// if the token is found
|
|
163
|
+
if (token) {
|
|
164
|
+
const word = token.text;
|
|
165
|
+
// if we're in file-matching mode
|
|
166
|
+
if (allFiles) {
|
|
167
|
+
// Find the position of the last path separator
|
|
168
|
+
const lastSeparatorIndex = Math.max(word.lastIndexOf('/'), word.lastIndexOf('\\'));
|
|
169
|
+
if (lastSeparatorIndex !== -1) {
|
|
170
|
+
// Adjust pos to the position after the last separator
|
|
171
|
+
from = token.from + lastSeparatorIndex + 1;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
// If no separator found, use the start of the token
|
|
175
|
+
from = token.from;
|
|
176
|
+
}
|
|
177
|
+
// Extract the last segment of the path for filtering
|
|
178
|
+
const lastSegment = word.slice(lastSeparatorIndex + 1).toLowerCase();
|
|
179
|
+
options = options
|
|
180
|
+
.filter(({ filterText }) => filterText.toLowerCase().includes(lastSegment))
|
|
181
|
+
.sort((a, b) => a.filterText.toLowerCase().indexOf(lastSegment) -
|
|
182
|
+
b.filterText.toLowerCase().indexOf(lastSegment));
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// update the from position to the start of the word
|
|
186
|
+
from = token.from;
|
|
187
|
+
const lowerWord = token.text.toLowerCase();
|
|
188
|
+
if (/^\w+$/.test(lowerWord)) {
|
|
189
|
+
options = options
|
|
190
|
+
.filter(({ filterText }) => filterText.toLowerCase().startsWith(lowerWord))
|
|
191
|
+
.sort(({ apply: a }, { apply: b }) => {
|
|
192
|
+
if (a.startsWith(token.text) && !b.startsWith(token.text)) {
|
|
193
|
+
return -1;
|
|
194
|
+
}
|
|
195
|
+
if (!a.startsWith(token.text) && b.startsWith(token.text)) {
|
|
196
|
+
return 1;
|
|
197
|
+
}
|
|
198
|
+
return 0;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
from,
|
|
205
|
+
options,
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Helper to send hover request to backend
|
|
211
|
+
*
|
|
212
|
+
* @param client - the websocket client
|
|
213
|
+
* @param uri - the uri of the file
|
|
214
|
+
* @param line - the line number
|
|
215
|
+
* @param ch - the character number
|
|
216
|
+
*/
|
|
217
|
+
export function getLspInspection(client, uri, line, ch) {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
const id = nanoid();
|
|
220
|
+
const msg = yield (client === null || client === void 0 ? void 0 : client.sendCustomMessage(LSP_MESSAGE_KIND, {
|
|
221
|
+
method: 'textDocument/hover',
|
|
222
|
+
id,
|
|
223
|
+
uri,
|
|
224
|
+
params: {
|
|
225
|
+
line,
|
|
226
|
+
character: ch,
|
|
227
|
+
},
|
|
228
|
+
}, true));
|
|
229
|
+
if (!msg) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
const data = msg.message.data;
|
|
233
|
+
if (isErrorResponse(data)) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
return data;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Helper to get definition from LSP server
|
|
241
|
+
*
|
|
242
|
+
* @param client - the websocket client
|
|
243
|
+
* @param uri - the uri of the file
|
|
244
|
+
* @param line - the line number
|
|
245
|
+
* @param ch - the character number
|
|
246
|
+
*/
|
|
247
|
+
export function getLspDefinition(client, uri, line, ch) {
|
|
248
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
+
const id = nanoid();
|
|
250
|
+
const msg = yield client.sendCustomMessage(LSP_MESSAGE_KIND, {
|
|
251
|
+
method: 'textDocument/definition',
|
|
252
|
+
id,
|
|
253
|
+
uri,
|
|
254
|
+
params: {
|
|
255
|
+
line,
|
|
256
|
+
character: ch,
|
|
257
|
+
},
|
|
258
|
+
}, true);
|
|
259
|
+
if (!msg) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
const data = msg.message.data;
|
|
263
|
+
if (isErrorResponse(data)) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
return data;
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Helper function to get signature help from LSP server
|
|
271
|
+
*
|
|
272
|
+
* @param client - the websocket client
|
|
273
|
+
* @param uri - the uri of the file
|
|
274
|
+
* @param line - the line number
|
|
275
|
+
* @param ch - the character number
|
|
276
|
+
*/
|
|
277
|
+
export function getLspSignatureHelp(client, uri, line, ch) {
|
|
278
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
279
|
+
const id = nanoid();
|
|
280
|
+
const msg = yield client.sendCustomMessage(LSP_MESSAGE_KIND, {
|
|
281
|
+
method: 'textDocument/signatureHelp',
|
|
282
|
+
id,
|
|
283
|
+
uri,
|
|
284
|
+
params: {
|
|
285
|
+
line,
|
|
286
|
+
character: ch,
|
|
287
|
+
},
|
|
288
|
+
}, true);
|
|
289
|
+
if (!msg) {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
const data = msg.message.data;
|
|
293
|
+
if (isErrorResponse(data)) {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
return data.signature;
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=lsp-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-utils.js","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GAAG,MAAM,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,iBAAiB,CACtC,gBAAgB,EAChB;YACI,MAAM,EAAE,yBAAyB;YACjC,EAAE;YACF,GAAG;YACH,MAAM,EAAE;gBACJ,IAAI;gBACJ,SAAS,EAAE,EAAE;aAChB;SACU,EACf,IAAI,CACP,CAAC;QAEF,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAA6C,CAAC;QAEvE,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CAAA;AAED;;;;;;;GAOG;AACH,MAAM,UAAgB,mBAAmB,CACrC,MAAgB,EAChB,GAAW,EACX,IAAY,EACZ,EAAU;;QAEV,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,iBAAiB,CACtC,gBAAgB,EAChB;YACI,MAAM,EAAE,4BAA4B;YACpC,EAAE;YACF,GAAG;YACH,MAAM,EAAE;gBACJ,IAAI;gBACJ,SAAS,EAAE,EAAE;aAChB;SACU,EACf,IAAI,CACP,CAAC;QAEF,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAgD,CAAC;QAE1E,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
/**
|
|
3
|
+
* Get the extensions for markdown
|
|
4
|
+
* Currently includes:
|
|
5
|
+
* - highlightActiveLine
|
|
6
|
+
* - highlightActiveLineGutter
|
|
7
|
+
* - markdownExtension
|
|
8
|
+
* - EditorView.lineWrapping
|
|
9
|
+
*
|
|
10
|
+
* @returns - an array of extensions for markdown
|
|
11
|
+
*/
|
|
12
|
+
export declare const getMarkdownExtensions: () => Extension[];
|
|
13
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/markdown.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,QAAO,SAAS,EAKjD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { markdown as markdownExtension, markdownLanguage } from '@codemirror/lang-markdown';
|
|
2
|
+
import { EditorView, highlightActiveLine, highlightActiveLineGutter } from '@codemirror/view';
|
|
3
|
+
/**
|
|
4
|
+
* Get the extensions for markdown
|
|
5
|
+
* Currently includes:
|
|
6
|
+
* - highlightActiveLine
|
|
7
|
+
* - highlightActiveLineGutter
|
|
8
|
+
* - markdownExtension
|
|
9
|
+
* - EditorView.lineWrapping
|
|
10
|
+
*
|
|
11
|
+
* @returns - an array of extensions for markdown
|
|
12
|
+
*/
|
|
13
|
+
export const getMarkdownExtensions = () => [
|
|
14
|
+
highlightActiveLine(),
|
|
15
|
+
highlightActiveLineGutter(),
|
|
16
|
+
EditorView.lineWrapping,
|
|
17
|
+
markdownExtension({ base: markdownLanguage }),
|
|
18
|
+
];
|
|
19
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE5F,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAE9F;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAgB,EAAE,CAAC;IACpD,mBAAmB,EAAE;IACrB,yBAAyB,EAAE;IAC3B,UAAU,CAAC,YAAY;IACvB,iBAAiB,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;CAChD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
/**
|
|
3
|
+
* Get the extensions for Python
|
|
4
|
+
* Currently includes:
|
|
5
|
+
* - lineNumbers
|
|
6
|
+
* - python
|
|
7
|
+
* - pythonLanguage
|
|
8
|
+
* - bracketMatching
|
|
9
|
+
* - closeBrackets
|
|
10
|
+
* - codeFoldingExtensions
|
|
11
|
+
*
|
|
12
|
+
* @returns - an array of extensions for Python
|
|
13
|
+
*/
|
|
14
|
+
export declare const getPythonExtensions: () => Extension[];
|
|
15
|
+
//# sourceMappingURL=python.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/python.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,QAAO,SAAS,EAE/C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { closeBrackets } from '@codemirror/autocomplete';
|
|
2
|
+
import { python, pythonLanguage } from '@codemirror/lang-python';
|
|
3
|
+
import { bracketMatching } from '@codemirror/language';
|
|
4
|
+
import { lineNumbers } from '@codemirror/view';
|
|
5
|
+
import { codeFoldingExtensions } from './code-folding';
|
|
6
|
+
/**
|
|
7
|
+
* Get the extensions for Python
|
|
8
|
+
* Currently includes:
|
|
9
|
+
* - lineNumbers
|
|
10
|
+
* - python
|
|
11
|
+
* - pythonLanguage
|
|
12
|
+
* - bracketMatching
|
|
13
|
+
* - closeBrackets
|
|
14
|
+
* - codeFoldingExtensions
|
|
15
|
+
*
|
|
16
|
+
* @returns - an array of extensions for Python
|
|
17
|
+
*/
|
|
18
|
+
export const getPythonExtensions = () => {
|
|
19
|
+
return [lineNumbers(), python(), pythonLanguage, bracketMatching(), closeBrackets(), codeFoldingExtensions()];
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=python.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.js","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/python.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAgB,EAAE;IACjD,OAAO,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,eAAe,EAAE,EAAE,aAAa,EAAE,EAAE,qBAAqB,EAAE,CAAC,CAAC;AAClH,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
import { EditorView } from '@codemirror/view';
|
|
3
|
+
export type LangsType = 'json' | 'markdown' | 'python';
|
|
4
|
+
export type NonPythonLangsType = Exclude<LangsType, 'python'>;
|
|
5
|
+
export type ThemeType = 'light' | 'dark';
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to get a selection range matching the currently hovered element as well as the nodeType of that element.
|
|
8
|
+
*
|
|
9
|
+
* @param view - the editor view
|
|
10
|
+
* @param event - the mouse event triggering this query
|
|
11
|
+
* @returns - a tuple of [from: number, to: number, nodeType: strin]
|
|
12
|
+
*/
|
|
13
|
+
export declare function getHoveredElement(view: EditorView, event: MouseEvent): [from: number, to: number, nodeType: string];
|
|
14
|
+
/**
|
|
15
|
+
* Extension to handle the logic for jumping to definition.
|
|
16
|
+
* Adds underline decorations to clickable elements and invokes provided callback on click.
|
|
17
|
+
*
|
|
18
|
+
* @param callback - the callback to handle the jump to definition
|
|
19
|
+
*/
|
|
20
|
+
export declare function goToDefinitionExtension(callback: (ch: number, line: number) => void): Extension;
|
|
21
|
+
export declare const acceptCompletionKeymap: {
|
|
22
|
+
key: string;
|
|
23
|
+
run: (target: any) => boolean;
|
|
24
|
+
win: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Get the default codemirror editor extensions.
|
|
28
|
+
* Currently includes:
|
|
29
|
+
* - multiple selections
|
|
30
|
+
* - tab size of 4
|
|
31
|
+
* - indent unit of 4 spaces
|
|
32
|
+
* - rectangular selection
|
|
33
|
+
* - draw selection
|
|
34
|
+
* - crosshair cursor
|
|
35
|
+
* - default keymap
|
|
36
|
+
* - search keymap
|
|
37
|
+
* - indent with tab keymap
|
|
38
|
+
*
|
|
39
|
+
* @returns The default editor extensions
|
|
40
|
+
*/
|
|
41
|
+
export declare const getDefaultExtensions: (themeType: ThemeType) => Extension[];
|
|
42
|
+
/**
|
|
43
|
+
* Format a file path into an LSP URI string.
|
|
44
|
+
* This is the format expected by the backend convention. Also supports a cell-based notebook
|
|
45
|
+
* system with a #cellId appended to the URI.
|
|
46
|
+
*/
|
|
47
|
+
export declare function formatUri(filePath: string, cellId?: string): string;
|
|
48
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/shared.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,OAAO,EAAc,UAAU,EAAgE,MAAM,kBAAkB,CAAC;AAExH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;AACvD,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC9D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CA2BnH;AAsCD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,SAAS,CA8B/F;AAED,eAAO,MAAM,sBAAsB;;kBAEjB,GAAG;;CAEpB,CAAC;AAaF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,cAAe,SAAS,KAAG,SAAS,EAcpE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAQnE"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { acceptCompletion } from '@codemirror/autocomplete';
|
|
2
|
+
import { defaultKeymap, indentWithTab, toggleComment } from '@codemirror/commands';
|
|
3
|
+
import { defaultHighlightStyle, indentUnit, syntaxHighlighting, syntaxTree } from '@codemirror/language';
|
|
4
|
+
import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
|
|
5
|
+
import { EditorState, Prec, StateEffect, StateField, findClusterBreak } from '@codemirror/state';
|
|
6
|
+
import { oneDarkHighlightStyle, oneDarkTheme } from '@codemirror/theme-one-dark';
|
|
7
|
+
import { Decoration, EditorView, crosshairCursor, drawSelection, keymap, rectangularSelection } from '@codemirror/view';
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to get a selection range matching the currently hovered element as well as the nodeType of that element.
|
|
10
|
+
*
|
|
11
|
+
* @param view - the editor view
|
|
12
|
+
* @param event - the mouse event triggering this query
|
|
13
|
+
* @returns - a tuple of [from: number, to: number, nodeType: strin]
|
|
14
|
+
*/
|
|
15
|
+
export function getHoveredElement(view, event) {
|
|
16
|
+
const position = view.posAtCoords({ x: event.clientX, y: event.clientY }, false);
|
|
17
|
+
const line = view.state.doc.lineAt(position);
|
|
18
|
+
const linePos = position - line.from;
|
|
19
|
+
let to = findClusterBreak(line.text, linePos);
|
|
20
|
+
let from = findClusterBreak(line.text, linePos, false);
|
|
21
|
+
const categorize = view.state.charCategorizer(position);
|
|
22
|
+
const cat = categorize(line.text.slice(from, to));
|
|
23
|
+
while (from > 0) {
|
|
24
|
+
const prev = findClusterBreak(line.text, from, false);
|
|
25
|
+
if (categorize(line.text.slice(prev, from)) !== cat) {
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
from = prev;
|
|
29
|
+
}
|
|
30
|
+
while (to < line.length) {
|
|
31
|
+
const next = findClusterBreak(line.text, to);
|
|
32
|
+
if (categorize(line.text.slice(to, next)) !== cat) {
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
to = next;
|
|
36
|
+
}
|
|
37
|
+
const nodeType = syntaxTree(view.state).resolve(line.from + from).type.name;
|
|
38
|
+
return [line.from + from, line.from + to, nodeType];
|
|
39
|
+
}
|
|
40
|
+
// This whitelist represents the types of nodes that have a definition to jump to. It will likely need refining with
|
|
41
|
+
// time and a better lezer would make this much more robust.
|
|
42
|
+
const jumpToDefWhitelist = new Set(['ArgList', 'VariableName', 'AssignStatement', 'MemberExpression', 'ParamList']);
|
|
43
|
+
// The following StateEffects and StateField manage the presence of the plain underline decoration for hovering
|
|
44
|
+
// clickable elements
|
|
45
|
+
const addUnderline = StateEffect.define({
|
|
46
|
+
map: ({ from, to }, change) => ({ from: change.mapPos(from), to: change.mapPos(to) }),
|
|
47
|
+
});
|
|
48
|
+
const removeUnderline = StateEffect.define();
|
|
49
|
+
const underlineMark = Decoration.mark({ class: 'cm-underline' });
|
|
50
|
+
const underlineField = StateField.define({
|
|
51
|
+
create() {
|
|
52
|
+
return Decoration.none;
|
|
53
|
+
},
|
|
54
|
+
provide: (f) => EditorView.decorations.from(f),
|
|
55
|
+
update(underlines, tr) {
|
|
56
|
+
let mappedUnderlines = underlines.map(tr.changes);
|
|
57
|
+
for (const e of tr.effects) {
|
|
58
|
+
if (e.is(addUnderline)) {
|
|
59
|
+
mappedUnderlines = underlines.update({
|
|
60
|
+
add: [underlineMark.range(e.value.from, e.value.to)],
|
|
61
|
+
filter: (from, to) => from === e.value.from && to === e.value.to,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (e.is(removeUnderline)) {
|
|
65
|
+
return Decoration.none;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return mappedUnderlines;
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Extension to handle the logic for jumping to definition.
|
|
73
|
+
* Adds underline decorations to clickable elements and invokes provided callback on click.
|
|
74
|
+
*
|
|
75
|
+
* @param callback - the callback to handle the jump to definition
|
|
76
|
+
*/
|
|
77
|
+
export function goToDefinitionExtension(callback) {
|
|
78
|
+
return [
|
|
79
|
+
EditorView.domEventHandlers({
|
|
80
|
+
mousemove: (event, view) => {
|
|
81
|
+
if (event.metaKey || event.ctrlKey) {
|
|
82
|
+
const [from, to, nodeType] = getHoveredElement(view, event);
|
|
83
|
+
if (jumpToDefWhitelist.has(nodeType)) {
|
|
84
|
+
const effects = [addUnderline.of({ from, to }), StateEffect.appendConfig.of([underlineField])];
|
|
85
|
+
view.dispatch({ effects });
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const effects = [removeUnderline.of(null), StateEffect.appendConfig.of([underlineField])];
|
|
89
|
+
view.dispatch({ effects });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const effects = [removeUnderline.of(null), StateEffect.appendConfig.of([underlineField])];
|
|
94
|
+
view.dispatch({ effects });
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
98
|
+
EditorView.mouseSelectionStyle.of((view, event) => {
|
|
99
|
+
if (event.metaKey || event.ctrlKey) {
|
|
100
|
+
const position = view.posAtCoords({ x: event.clientX, y: event.clientY }, false);
|
|
101
|
+
const line = view.state.doc.lineAt(position);
|
|
102
|
+
const linePos = position - line.from;
|
|
103
|
+
callback(linePos - 1, line.number - 1);
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}),
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
export const acceptCompletionKeymap = {
|
|
110
|
+
key: 'Tab',
|
|
111
|
+
run: (target) => acceptCompletion(target),
|
|
112
|
+
win: 'Tab',
|
|
113
|
+
};
|
|
114
|
+
// Localization Overrides
|
|
115
|
+
const localizationKeymap = [
|
|
116
|
+
// Overrides for German Keyboards
|
|
117
|
+
{
|
|
118
|
+
key: 'Ctrl-Shift-7',
|
|
119
|
+
preventDefault: false,
|
|
120
|
+
run: toggleComment,
|
|
121
|
+
stopPropagation: false,
|
|
122
|
+
},
|
|
123
|
+
];
|
|
124
|
+
/**
|
|
125
|
+
* Get the default codemirror editor extensions.
|
|
126
|
+
* Currently includes:
|
|
127
|
+
* - multiple selections
|
|
128
|
+
* - tab size of 4
|
|
129
|
+
* - indent unit of 4 spaces
|
|
130
|
+
* - rectangular selection
|
|
131
|
+
* - draw selection
|
|
132
|
+
* - crosshair cursor
|
|
133
|
+
* - default keymap
|
|
134
|
+
* - search keymap
|
|
135
|
+
* - indent with tab keymap
|
|
136
|
+
*
|
|
137
|
+
* @returns The default editor extensions
|
|
138
|
+
*/
|
|
139
|
+
export const getDefaultExtensions = (themeType) => {
|
|
140
|
+
return [
|
|
141
|
+
EditorState.allowMultipleSelections.of(true),
|
|
142
|
+
EditorState.tabSize.of(4),
|
|
143
|
+
indentUnit.of(' '.repeat(4)),
|
|
144
|
+
rectangularSelection(),
|
|
145
|
+
drawSelection(),
|
|
146
|
+
crosshairCursor(),
|
|
147
|
+
highlightSelectionMatches(),
|
|
148
|
+
keymap.of([...defaultKeymap, ...searchKeymap, ...localizationKeymap, indentWithTab]),
|
|
149
|
+
Prec.highest(keymap.of([acceptCompletionKeymap])),
|
|
150
|
+
themeType === 'dark' ? oneDarkTheme : EditorView.baseTheme({}),
|
|
151
|
+
syntaxHighlighting(themeType === 'dark' ? oneDarkHighlightStyle : defaultHighlightStyle),
|
|
152
|
+
];
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Format a file path into an LSP URI string.
|
|
156
|
+
* This is the format expected by the backend convention. Also supports a cell-based notebook
|
|
157
|
+
* system with a #cellId appended to the URI.
|
|
158
|
+
*/
|
|
159
|
+
export function formatUri(filePath, cellId) {
|
|
160
|
+
const base = `file:///${filePath}`;
|
|
161
|
+
if (cellId) {
|
|
162
|
+
return `${base}#${cellId}`;
|
|
163
|
+
}
|
|
164
|
+
return base;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACzG,OAAO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,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC;QACjD,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9D,kBAAkB,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,CAAC;KAC3F,CAAC;AACN,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB,EAAE,MAAe;IACvD,MAAM,IAAI,GAAG,WAAW,QAAQ,EAAE,CAAC;IAEnC,IAAI,MAAM,EAAE,CAAC;QACT,OAAO,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
/**
|
|
3
|
+
* Get the extensions for SQL
|
|
4
|
+
* Currently includes:
|
|
5
|
+
* - lineNumbers
|
|
6
|
+
* - sql
|
|
7
|
+
* - StandardSQL
|
|
8
|
+
* - bracketMatching
|
|
9
|
+
* - closeBrackets
|
|
10
|
+
*
|
|
11
|
+
* @returns - an array of extensions for SQL
|
|
12
|
+
*/
|
|
13
|
+
export declare const getSQLExtensions: () => Extension[];
|
|
14
|
+
//# sourceMappingURL=sql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../../../js/smart/ui-code-editor/extensions/sql.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,QAAO,SAAS,EAM5C,CAAC"}
|