@m4l/components 9.16.0 → 9.17.1-beta-feature-731-m4l-components-code-editor.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/@types/types.d.ts +11 -0
- package/components/DynamicFilter/DynamicFilter.styles.d.ts.map +1 -1
- package/components/DynamicFilter/DynamicFilter.styles.js +12 -2
- package/components/DynamicFilter/subcomponents/AppliedFilters/AppliedFilters.d.ts.map +1 -1
- package/components/DynamicFilter/subcomponents/AppliedFilters/AppliedFilters.js +13 -13
- package/components/DynamicSort/DynamicSort.js +5 -5
- package/components/DynamicSort/DynamicSort.styles.d.ts.map +1 -1
- package/components/DynamicSort/DynamicSort.styles.js +217 -93
- package/components/DynamicSort/constants.js +4 -11
- package/components/DynamicSort/dictionary.d.ts +2 -0
- package/components/DynamicSort/dictionary.d.ts.map +1 -1
- package/components/DynamicSort/dictionary.js +10 -8
- package/components/DynamicSort/slots/DynamicSortSlots.d.ts +36 -0
- package/components/DynamicSort/slots/DynamicSortSlots.d.ts.map +1 -1
- package/components/DynamicSort/slots/DynamicSortSlots.js +102 -64
- package/components/DynamicSort/slots/SlotsEnum.d.ts +10 -1
- package/components/DynamicSort/slots/SlotsEnum.d.ts.map +1 -1
- package/components/DynamicSort/slots/SlotsEnum.js +2 -2
- package/components/DynamicSort/subcomponents/AppliedSortChip/AppliedSortChip.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/AppliedSortChip/AppliedSortChip.js +20 -15
- package/components/DynamicSort/subcomponents/AppliedSortChip/useAppliedSortChip.d.ts +3 -2
- package/components/DynamicSort/subcomponents/AppliedSortChip/useAppliedSortChip.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/AppliedSortChip/useAppliedSortChip.js +19 -19
- package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.d.ts +3 -1
- package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.js +86 -16
- package/components/DynamicSort/subcomponents/AppliedSorts/useAppliedSorts.d.ts +10 -1
- package/components/DynamicSort/subcomponents/AppliedSorts/useAppliedSorts.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/AppliedSorts/useAppliedSorts.js +29 -9
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.d.ts +2 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +9 -11
- package/components/DynamicSort/subcomponents/FieldTypes/StringSort/index.d.ts +2 -2
- package/components/DynamicSort/subcomponents/FieldTypes/StringSort/index.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/FieldTypes/StringSort/index.js +21 -21
- package/components/DynamicSort/subcomponents/FieldTypes/fieldFactory.d.ts +2 -1
- package/components/DynamicSort/subcomponents/FieldTypes/fieldFactory.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/FieldTypes/fieldFactory.js +2 -2
- package/components/DynamicSort/subcomponents/InputSort/InputSort.d.ts +2 -1
- package/components/DynamicSort/subcomponents/InputSort/InputSort.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/InputSort/InputSort.js +44 -35
- package/components/DynamicSort/subcomponents/InputSort/useInputSort.d.ts +17 -41
- package/components/DynamicSort/subcomponents/InputSort/useInputSort.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/InputSort/useInputSort.js +57 -81
- package/components/DynamicSort/subcomponents/OverflowSortPopover/OverflowSortPopover.d.ts +9 -0
- package/components/DynamicSort/subcomponents/OverflowSortPopover/OverflowSortPopover.d.ts.map +1 -0
- package/components/DynamicSort/subcomponents/OverflowSortPopover/OverflowSortPopover.js +85 -0
- package/components/DynamicSort/subcomponents/OverflowSortPopover/index.d.ts +3 -0
- package/components/DynamicSort/subcomponents/OverflowSortPopover/index.d.ts.map +1 -0
- package/components/DynamicSort/subcomponents/OverflowSortPopover/types.d.ts +11 -0
- package/components/DynamicSort/subcomponents/OverflowSortPopover/types.d.ts.map +1 -0
- package/components/DynamicSort/subcomponents/PopoverMenuFields/PopoverMenuFields.d.ts +16 -1
- package/components/DynamicSort/subcomponents/PopoverMenuFields/PopoverMenuFields.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/PopoverMenuFields/PopoverMenuFields.js +52 -30
- package/components/DynamicSort/subcomponents/SortActions/SortActions.d.ts +5 -4
- package/components/DynamicSort/subcomponents/SortActions/SortActions.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/SortActions/SortActions.js +35 -32
- package/components/DynamicSort/subcomponents/SortActions/useSortActions.d.ts +4 -3
- package/components/DynamicSort/subcomponents/SortActions/useSortActions.d.ts.map +1 -1
- package/components/DynamicSort/subcomponents/SortActions/useSortActions.js +17 -18
- package/components/DynamicSort/types.d.ts +4 -0
- package/components/DynamicSort/types.d.ts.map +1 -1
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.d.ts +6 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.js +247 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.d.ts +3 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.js +297 -0
- package/components/extended/ReactSimpleCodeEditor/constants.d.ts +82 -0
- package/components/extended/ReactSimpleCodeEditor/constants.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/constants.js +149 -0
- package/components/extended/ReactSimpleCodeEditor/dictionary.d.ts +11 -0
- package/components/extended/ReactSimpleCodeEditor/dictionary.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/dictionary.js +7 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.d.ts +59 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.js +1063 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.d.ts +6 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.js +7 -0
- package/components/extended/ReactSimpleCodeEditor/index.d.ts +4 -0
- package/components/extended/ReactSimpleCodeEditor/index.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.d.ts +18 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.js +4 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.d.ts +84 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.js +63 -0
- package/components/extended/ReactSimpleCodeEditor/slots/index.d.ts +3 -0
- package/components/extended/ReactSimpleCodeEditor/slots/index.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/storybookRuntime.d.ts +15 -0
- package/components/extended/ReactSimpleCodeEditor/storybookRuntime.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/types.d.ts +127 -0
- package/components/extended/ReactSimpleCodeEditor/types.d.ts.map +1 -0
- package/components/extended/index.d.ts +1 -0
- package/components/extended/index.d.ts.map +1 -1
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.d.ts +7 -0
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.d.ts.map +1 -0
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.js +6 -0
- package/components/hook-form/RHFCodeEditor/index.d.ts +3 -0
- package/components/hook-form/RHFCodeEditor/index.d.ts.map +1 -0
- package/components/hook-form/index.d.ts +1 -0
- package/components/hook-form/index.d.ts.map +1 -1
- package/index.js +561 -548
- package/package.json +9 -6
- package/test/mocks/dictionary-mock.d.ts +3 -0
- package/test/mocks/dictionary-mock.d.ts.map +1 -1
- package/components/DynamicSort/icons.js +0 -7
|
@@ -0,0 +1,1063 @@
|
|
|
1
|
+
import { jsx as f, Fragment as st } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import K from "prismjs";
|
|
3
|
+
import { Highlight as Tt } from "prism-react-renderer";
|
|
4
|
+
import { CODE_EDITOR_AT_TEMPLATE_TOKENS as S, CODE_EDITOR_AT_LANGUAGE as B, CODE_EDITOR_AT_TEMPLATE_NAME as St, CODE_EDITOR_AT_TEMPLATE_LANGUAGE_LABEL as vt, CODE_EDITOR_DEFAULT_LANGUAGE as at, CODE_EDITOR_LANGUAGE_ALIASES as Ot, getCodeEditorVSCodeModernPalette as Q } from "../constants.js";
|
|
5
|
+
const V = K.languages, ct = {}, lt = {}, j = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new Set(["(", ")", "[", "]", "{", "}"]), bt = /* @__PURE__ */ new Set([
|
|
6
|
+
"javascript",
|
|
7
|
+
"jsx",
|
|
8
|
+
"typescript",
|
|
9
|
+
"tsx"
|
|
10
|
+
]), Lt = /* @__PURE__ */ new Set([
|
|
11
|
+
"(",
|
|
12
|
+
")",
|
|
13
|
+
"[",
|
|
14
|
+
"]",
|
|
15
|
+
"{",
|
|
16
|
+
"}",
|
|
17
|
+
".",
|
|
18
|
+
",",
|
|
19
|
+
":",
|
|
20
|
+
";",
|
|
21
|
+
"=",
|
|
22
|
+
"=>",
|
|
23
|
+
"as",
|
|
24
|
+
"await",
|
|
25
|
+
"case",
|
|
26
|
+
"const",
|
|
27
|
+
"default",
|
|
28
|
+
"export",
|
|
29
|
+
"from",
|
|
30
|
+
"import",
|
|
31
|
+
"in",
|
|
32
|
+
"instanceof",
|
|
33
|
+
"let",
|
|
34
|
+
"new",
|
|
35
|
+
"of",
|
|
36
|
+
"return",
|
|
37
|
+
"throw",
|
|
38
|
+
"typeof",
|
|
39
|
+
"var",
|
|
40
|
+
"yield"
|
|
41
|
+
]), _t = /* @__PURE__ */ new Set([
|
|
42
|
+
"(",
|
|
43
|
+
":",
|
|
44
|
+
"=>",
|
|
45
|
+
"as",
|
|
46
|
+
"case",
|
|
47
|
+
"class",
|
|
48
|
+
"enum",
|
|
49
|
+
"extends",
|
|
50
|
+
"implements",
|
|
51
|
+
"instanceof",
|
|
52
|
+
"interface",
|
|
53
|
+
"new",
|
|
54
|
+
"type",
|
|
55
|
+
"typeof"
|
|
56
|
+
]), kt = /^[+\-*/%!?&|^~]+$/, y = {
|
|
57
|
+
isValid: !0
|
|
58
|
+
}, pe = {
|
|
59
|
+
languageLabel: vt,
|
|
60
|
+
languageText: B,
|
|
61
|
+
templateName: St,
|
|
62
|
+
templateType: B,
|
|
63
|
+
tokens: {
|
|
64
|
+
argumentSeparators: [...S.argumentSeparators],
|
|
65
|
+
commandPrefixes: [...S.commandPrefixes],
|
|
66
|
+
concatenationSeparators: [...S.concatenationSeparators],
|
|
67
|
+
reservedWords: [...S.reservedWords]
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
function Nt(t) {
|
|
71
|
+
return [...Q(t).bracketPalette];
|
|
72
|
+
}
|
|
73
|
+
function Rt(t) {
|
|
74
|
+
const e = Q(t);
|
|
75
|
+
return {
|
|
76
|
+
constant: e.syntax.constant,
|
|
77
|
+
type: e.syntax.type,
|
|
78
|
+
variable: e.syntax.variable
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function Pt(t) {
|
|
82
|
+
return bt.has(t);
|
|
83
|
+
}
|
|
84
|
+
function It(t) {
|
|
85
|
+
const e = [], n = Array.from(t.matchAll(/[A-Za-z_$][\w$]*/g));
|
|
86
|
+
let r = 0;
|
|
87
|
+
return n.forEach((s) => {
|
|
88
|
+
const o = s[0], i = s.index ?? 0;
|
|
89
|
+
i > r && e.push({
|
|
90
|
+
content: t.slice(r, i),
|
|
91
|
+
isIdentifier: !1
|
|
92
|
+
}), e.push({
|
|
93
|
+
content: o,
|
|
94
|
+
isIdentifier: !0
|
|
95
|
+
}), r = i + o.length;
|
|
96
|
+
}), r < t.length && e.push({
|
|
97
|
+
content: t.slice(r),
|
|
98
|
+
isIdentifier: !1
|
|
99
|
+
}), e.length ? e : [{ content: t, isIdentifier: !1 }];
|
|
100
|
+
}
|
|
101
|
+
function X(t) {
|
|
102
|
+
const e = t.trimStart();
|
|
103
|
+
if (!e)
|
|
104
|
+
return;
|
|
105
|
+
if (e.startsWith("=>"))
|
|
106
|
+
return "=>";
|
|
107
|
+
const n = e.match(/^[A-Za-z_$][\w$]*/);
|
|
108
|
+
if (n)
|
|
109
|
+
return n[0];
|
|
110
|
+
const r = e.match(/^[+\-*/%!?&|^~]+/);
|
|
111
|
+
return r ? r[0] : e[0];
|
|
112
|
+
}
|
|
113
|
+
function wt(t, e, n = "") {
|
|
114
|
+
const r = X(
|
|
115
|
+
n
|
|
116
|
+
);
|
|
117
|
+
if (r)
|
|
118
|
+
return r;
|
|
119
|
+
for (let s = e + 1; s < t.length; s += 1) {
|
|
120
|
+
const o = X(
|
|
121
|
+
t[s].content
|
|
122
|
+
);
|
|
123
|
+
if (o)
|
|
124
|
+
return o;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function Dt(t) {
|
|
128
|
+
return t.length > 1 && t === t.toUpperCase() && /[A-Z]/.test(t);
|
|
129
|
+
}
|
|
130
|
+
function Mt(t) {
|
|
131
|
+
return /^[A-Z][A-Za-z0-9]*$/.test(t) && t !== t.toUpperCase();
|
|
132
|
+
}
|
|
133
|
+
function $t(t, e) {
|
|
134
|
+
return t === ">" && e === "<" ? !1 : [t, e].some(
|
|
135
|
+
(n) => !!n && (Lt.has(n) || kt.test(n))
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
function zt(t) {
|
|
139
|
+
if (t.some((e) => ["constant", "symbol"].includes(e)))
|
|
140
|
+
return "constant";
|
|
141
|
+
if (t.some((e) => [
|
|
142
|
+
"builtin",
|
|
143
|
+
"class-name",
|
|
144
|
+
"known-class-name",
|
|
145
|
+
"maybe-class-name",
|
|
146
|
+
"namespace"
|
|
147
|
+
].includes(e)))
|
|
148
|
+
return "type";
|
|
149
|
+
if (t.some((e) => [
|
|
150
|
+
"alias",
|
|
151
|
+
"imports",
|
|
152
|
+
"literal-property",
|
|
153
|
+
"parameter",
|
|
154
|
+
"property",
|
|
155
|
+
"variable"
|
|
156
|
+
].includes(e)))
|
|
157
|
+
return "variable";
|
|
158
|
+
}
|
|
159
|
+
function Gt({
|
|
160
|
+
identifier: t,
|
|
161
|
+
nextSignificantText: e,
|
|
162
|
+
previousIdentifierGroup: n,
|
|
163
|
+
previousSignificantText: r
|
|
164
|
+
}) {
|
|
165
|
+
if ($t(
|
|
166
|
+
r,
|
|
167
|
+
e
|
|
168
|
+
))
|
|
169
|
+
return r === "." && n === "type" || Dt(t) ? "constant" : Mt(t) && (e === "." || e === "(" || r && _t.has(r)) ? "type" : "variable";
|
|
170
|
+
}
|
|
171
|
+
function I(t, e, n) {
|
|
172
|
+
const r = X(e);
|
|
173
|
+
if (r) {
|
|
174
|
+
if (t.previousSignificantText = r, n) {
|
|
175
|
+
t.previousIdentifierGroup = n;
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
r !== "." && (t.previousIdentifierGroup = void 0);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function Ft(t) {
|
|
182
|
+
return At.has(t);
|
|
183
|
+
}
|
|
184
|
+
function Ut(t, e) {
|
|
185
|
+
if ("([{".includes(t))
|
|
186
|
+
return {
|
|
187
|
+
renderedBracketDepth: e,
|
|
188
|
+
nextBracketDepth: e + 1
|
|
189
|
+
};
|
|
190
|
+
const n = Math.max(e - 1, 0);
|
|
191
|
+
return {
|
|
192
|
+
renderedBracketDepth: n,
|
|
193
|
+
nextBracketDepth: n
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function Bt(t) {
|
|
197
|
+
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
198
|
+
}
|
|
199
|
+
function J(t) {
|
|
200
|
+
const e = t?.map((n) => n.trim()).filter(Boolean);
|
|
201
|
+
if (e?.length)
|
|
202
|
+
return e.map(Bt).join("|");
|
|
203
|
+
}
|
|
204
|
+
function Vt(t) {
|
|
205
|
+
const e = J(t.tokens?.commandPrefixes) || "AT\\+", n = J(
|
|
206
|
+
t.tokens?.reservedWords
|
|
207
|
+
), r = J([
|
|
208
|
+
...t.tokens?.argumentSeparators || [],
|
|
209
|
+
...t.tokens?.concatenationSeparators || []
|
|
210
|
+
]);
|
|
211
|
+
return {
|
|
212
|
+
comment: {
|
|
213
|
+
pattern: /(^|\s)(?:#|\/\/).*$/m,
|
|
214
|
+
lookbehind: !0,
|
|
215
|
+
alias: "comment"
|
|
216
|
+
},
|
|
217
|
+
"at-command": {
|
|
218
|
+
pattern: new RegExp(
|
|
219
|
+
`(?:${e})[A-Z][A-Z0-9_:-]*`,
|
|
220
|
+
"i"
|
|
221
|
+
),
|
|
222
|
+
inside: {
|
|
223
|
+
operator: new RegExp(`^(?:${e})`, "i"),
|
|
224
|
+
...n ? {
|
|
225
|
+
keyword: new RegExp(`\\b(?:${n})\\b`, "i")
|
|
226
|
+
} : {},
|
|
227
|
+
function: /\b[A-Z][A-Z0-9_:-]*\b/
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
...n ? {
|
|
231
|
+
keyword: new RegExp(`\\b(?:${n})\\b`, "i")
|
|
232
|
+
} : {},
|
|
233
|
+
property: /\b[A-Z_][A-Z0-9_]*(?=\s*=)/,
|
|
234
|
+
string: {
|
|
235
|
+
pattern: /"(?:\\.|[^"\\])*"/,
|
|
236
|
+
greedy: !0
|
|
237
|
+
},
|
|
238
|
+
boolean: /\b(?:ON|OFF|TRUE|FALSE)\b/i,
|
|
239
|
+
number: /\b\d+(?:\.\d+)?\b/,
|
|
240
|
+
constant: /\b(?:OK|ERROR|CONNECT|READY|BUSY)\b/i,
|
|
241
|
+
punctuation: r ? new RegExp(`(?:${r})|[()[\\]{}.:=]`) : /[()[\]{}.,:;=]/,
|
|
242
|
+
operator: /[+\-*/<>]/
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function Zt(t) {
|
|
246
|
+
return t.templateType === B ? Vt(t) : {};
|
|
247
|
+
}
|
|
248
|
+
function ge(t, e) {
|
|
249
|
+
t.trim() && (V[b(t)] = e);
|
|
250
|
+
}
|
|
251
|
+
function he(t) {
|
|
252
|
+
const e = t.templateName.trim();
|
|
253
|
+
e && (ct[e] = t);
|
|
254
|
+
}
|
|
255
|
+
function ut(t) {
|
|
256
|
+
if (t)
|
|
257
|
+
return typeof t == "string" ? ct[t] : t;
|
|
258
|
+
}
|
|
259
|
+
function Wt(t) {
|
|
260
|
+
return ut(t);
|
|
261
|
+
}
|
|
262
|
+
function Ee(t, e) {
|
|
263
|
+
t.trim() && (lt[b(t)] = e);
|
|
264
|
+
}
|
|
265
|
+
function ye(t) {
|
|
266
|
+
return ({ code: e }) => Qt(e, t);
|
|
267
|
+
}
|
|
268
|
+
function Ht(t) {
|
|
269
|
+
return t ? Array.isArray(t) ? t : [t] : [];
|
|
270
|
+
}
|
|
271
|
+
async function Ce(t) {
|
|
272
|
+
await Promise.all(
|
|
273
|
+
Ht(t).map((e) => {
|
|
274
|
+
const n = j.get(e);
|
|
275
|
+
if (n)
|
|
276
|
+
return n;
|
|
277
|
+
const r = Promise.resolve().then(() => e()).then(() => {
|
|
278
|
+
}).catch((s) => {
|
|
279
|
+
throw j.delete(e), s;
|
|
280
|
+
});
|
|
281
|
+
return j.set(e, r), r;
|
|
282
|
+
})
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
function b(t) {
|
|
286
|
+
const e = t?.trim().toLowerCase() || at;
|
|
287
|
+
return Ot[e] || e;
|
|
288
|
+
}
|
|
289
|
+
function D(t, e) {
|
|
290
|
+
return Math.max(0, Math.min(e, t.length));
|
|
291
|
+
}
|
|
292
|
+
function m(t, e) {
|
|
293
|
+
const n = D(t, e), s = t.slice(0, n).split(`
|
|
294
|
+
`);
|
|
295
|
+
return {
|
|
296
|
+
column: (s[s.length - 1] || "").length + 1,
|
|
297
|
+
line: s.length,
|
|
298
|
+
offset: n
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function dt(t, e, n) {
|
|
302
|
+
const r = t.split(`
|
|
303
|
+
`), s = Math.min(Math.max(e, 1), Math.max(r.length, 1)), o = r.slice(0, s - 1).join(`
|
|
304
|
+
`), i = s === 1 ? 0 : o.length + 1, c = r[s - 1] || "";
|
|
305
|
+
return D(
|
|
306
|
+
t,
|
|
307
|
+
i + Math.max(Math.min(n - 1, c.length), 0)
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
function it(t, e) {
|
|
311
|
+
return typeof e.offset == "number" ? m(t, e.offset) : m(
|
|
312
|
+
t,
|
|
313
|
+
dt(t, e.line, e.column)
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
function w(t, e, n) {
|
|
317
|
+
const r = D(t, e), s = Math.max(
|
|
318
|
+
r + 1,
|
|
319
|
+
D(t, n)
|
|
320
|
+
);
|
|
321
|
+
return {
|
|
322
|
+
end: m(
|
|
323
|
+
t,
|
|
324
|
+
s - 1
|
|
325
|
+
),
|
|
326
|
+
start: m(t, r)
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function jt(t, e) {
|
|
330
|
+
if (!e)
|
|
331
|
+
return;
|
|
332
|
+
const n = it(
|
|
333
|
+
t,
|
|
334
|
+
e.start
|
|
335
|
+
), r = it(
|
|
336
|
+
t,
|
|
337
|
+
e.end ?? e.start
|
|
338
|
+
), s = Math.min(
|
|
339
|
+
n.offset,
|
|
340
|
+
r.offset
|
|
341
|
+
), o = Math.max(
|
|
342
|
+
n.offset,
|
|
343
|
+
r.offset
|
|
344
|
+
) + 1;
|
|
345
|
+
return {
|
|
346
|
+
start: m(
|
|
347
|
+
t,
|
|
348
|
+
s
|
|
349
|
+
),
|
|
350
|
+
end: m(
|
|
351
|
+
t,
|
|
352
|
+
o
|
|
353
|
+
)
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function q(t) {
|
|
357
|
+
const e = [];
|
|
358
|
+
let n = 0;
|
|
359
|
+
return t.forEach((r) => {
|
|
360
|
+
e.push(n), n += r.length + 1;
|
|
361
|
+
}), e;
|
|
362
|
+
}
|
|
363
|
+
function v(t, e) {
|
|
364
|
+
const n = t.split(`
|
|
365
|
+
`), r = n[e];
|
|
366
|
+
if (r === void 0)
|
|
367
|
+
return;
|
|
368
|
+
const s = q(n)[e] || 0, o = r.length - r.trimStart().length, i = r.trimEnd().length, c = s + o, a = s + Math.max(i, o + 1);
|
|
369
|
+
return w(t, c, a);
|
|
370
|
+
}
|
|
371
|
+
function Y(t, e) {
|
|
372
|
+
for (let n = e; n >= 0; n -= 1)
|
|
373
|
+
if (!/\s/.test(t[n]))
|
|
374
|
+
return n;
|
|
375
|
+
}
|
|
376
|
+
function Jt(t, e) {
|
|
377
|
+
const n = e.match(/\bposition\s+(\d+)\b/i);
|
|
378
|
+
if (n)
|
|
379
|
+
return D(t, Number(n[1]));
|
|
380
|
+
const r = e.match(/\bline\s+(\d+)\s+column\s+(\d+)\b/i);
|
|
381
|
+
if (r)
|
|
382
|
+
return dt(
|
|
383
|
+
t,
|
|
384
|
+
Number(r[1]),
|
|
385
|
+
Number(r[2])
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
function Kt(t, e) {
|
|
389
|
+
const n = Jt(t, e);
|
|
390
|
+
if (typeof n != "number") {
|
|
391
|
+
const l = Y(
|
|
392
|
+
t,
|
|
393
|
+
t.length - 1
|
|
394
|
+
);
|
|
395
|
+
return typeof l != "number" ? void 0 : v(
|
|
396
|
+
t,
|
|
397
|
+
m(t, l).line - 1
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
const s = m(
|
|
401
|
+
t,
|
|
402
|
+
n
|
|
403
|
+
).line - 1, o = t.split(`
|
|
404
|
+
`), i = o[s] || "", c = t[n], a = Y(
|
|
405
|
+
t,
|
|
406
|
+
Math.min(n - 1, t.length - 1)
|
|
407
|
+
);
|
|
408
|
+
if ((c === "}" || c === "]") && typeof a == "number" && t[a] === ",")
|
|
409
|
+
return v(
|
|
410
|
+
t,
|
|
411
|
+
m(
|
|
412
|
+
t,
|
|
413
|
+
a
|
|
414
|
+
).line - 1
|
|
415
|
+
);
|
|
416
|
+
if (i.trim()) {
|
|
417
|
+
const l = q(o)[s] || 0, M = i.length - i.trimStart().length;
|
|
418
|
+
return w(
|
|
419
|
+
t,
|
|
420
|
+
l + M,
|
|
421
|
+
n + 1
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
return typeof a == "number" ? v(
|
|
425
|
+
t,
|
|
426
|
+
m(
|
|
427
|
+
t,
|
|
428
|
+
a
|
|
429
|
+
).line - 1
|
|
430
|
+
) : v(t, s);
|
|
431
|
+
}
|
|
432
|
+
function E(t, e) {
|
|
433
|
+
return {
|
|
434
|
+
errorRange: e,
|
|
435
|
+
isValid: !1,
|
|
436
|
+
message: t
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function Xt(t, e, n) {
|
|
440
|
+
if (e < n)
|
|
441
|
+
return w(t, e, n);
|
|
442
|
+
const r = m(
|
|
443
|
+
t,
|
|
444
|
+
e
|
|
445
|
+
), s = v(
|
|
446
|
+
t,
|
|
447
|
+
r.line - 1
|
|
448
|
+
);
|
|
449
|
+
if (s)
|
|
450
|
+
return s;
|
|
451
|
+
const o = Y(
|
|
452
|
+
t,
|
|
453
|
+
Math.min(e - 1, t.length - 1)
|
|
454
|
+
);
|
|
455
|
+
return typeof o == "number" ? w(
|
|
456
|
+
t,
|
|
457
|
+
o,
|
|
458
|
+
o + 1
|
|
459
|
+
) : w(t, e, e + 1);
|
|
460
|
+
}
|
|
461
|
+
function Yt(t, e) {
|
|
462
|
+
const n = e.parse(t).cursor();
|
|
463
|
+
for (; ; ) {
|
|
464
|
+
if (n.type.isError)
|
|
465
|
+
return Xt(
|
|
466
|
+
t,
|
|
467
|
+
n.from,
|
|
468
|
+
n.to
|
|
469
|
+
);
|
|
470
|
+
if (!n.firstChild()) {
|
|
471
|
+
for (; !n.nextSibling(); )
|
|
472
|
+
if (!n.parent())
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function Qt(t, e) {
|
|
478
|
+
if (!t.trim())
|
|
479
|
+
return y;
|
|
480
|
+
const n = Yt(
|
|
481
|
+
t,
|
|
482
|
+
e.parser
|
|
483
|
+
);
|
|
484
|
+
return n ? E(
|
|
485
|
+
`Invalid ${e.label} syntax.`,
|
|
486
|
+
n
|
|
487
|
+
) : y;
|
|
488
|
+
}
|
|
489
|
+
function Z(t, e, n) {
|
|
490
|
+
return e.find((r) => t.slice(n, n + r.length).toUpperCase() === r.toUpperCase());
|
|
491
|
+
}
|
|
492
|
+
function tt(t, e) {
|
|
493
|
+
let n = 0;
|
|
494
|
+
for (let r = e - 1; r >= 0 && t[r] === "\\"; r -= 1)
|
|
495
|
+
n += 1;
|
|
496
|
+
return n % 2 === 1;
|
|
497
|
+
}
|
|
498
|
+
function qt(t) {
|
|
499
|
+
let e = !1;
|
|
500
|
+
for (let n = 0; n < t.length; n += 1) {
|
|
501
|
+
const r = t[n];
|
|
502
|
+
if (r === '"' && !tt(t, n)) {
|
|
503
|
+
e = !e;
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
if (e)
|
|
507
|
+
continue;
|
|
508
|
+
const s = n > 0 ? t[n - 1] : void 0, o = r === "#" && (n === 0 || /\s/.test(s || "")), i = t.slice(n, n + 2) === "//" && (n === 0 || /\s/.test(s || ""));
|
|
509
|
+
if (o || i)
|
|
510
|
+
return t.slice(0, n).trimEnd();
|
|
511
|
+
}
|
|
512
|
+
return t.trimEnd();
|
|
513
|
+
}
|
|
514
|
+
function te(t, e) {
|
|
515
|
+
if (!e.length)
|
|
516
|
+
return [t];
|
|
517
|
+
const n = [];
|
|
518
|
+
let r = !1, s = 0;
|
|
519
|
+
for (let o = 0; o < t.length; ) {
|
|
520
|
+
if (t[o] === '"' && !tt(t, o)) {
|
|
521
|
+
r = !r, o += 1;
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
if (!r) {
|
|
525
|
+
const c = Z(
|
|
526
|
+
t,
|
|
527
|
+
e,
|
|
528
|
+
o
|
|
529
|
+
);
|
|
530
|
+
if (c) {
|
|
531
|
+
n.push(t.slice(s, o)), o += c.length, s = o;
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
o += 1;
|
|
536
|
+
}
|
|
537
|
+
return n.push(t.slice(s)), n;
|
|
538
|
+
}
|
|
539
|
+
function ee(t, e, n) {
|
|
540
|
+
let r = e;
|
|
541
|
+
for (; r < t.length && /\s/.test(t[r]); )
|
|
542
|
+
r += 1;
|
|
543
|
+
if (r >= t.length)
|
|
544
|
+
return;
|
|
545
|
+
if (t[r] === '"') {
|
|
546
|
+
for (r += 1; r < t.length; ) {
|
|
547
|
+
if (t[r] === '"' && !tt(t, r))
|
|
548
|
+
return {
|
|
549
|
+
nextIndex: r + 1
|
|
550
|
+
};
|
|
551
|
+
r += 1;
|
|
552
|
+
}
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
const s = r;
|
|
556
|
+
for (; r < t.length && !Z(
|
|
557
|
+
t,
|
|
558
|
+
n,
|
|
559
|
+
r
|
|
560
|
+
); )
|
|
561
|
+
r += 1;
|
|
562
|
+
if (t.slice(s, r).trim())
|
|
563
|
+
return {
|
|
564
|
+
nextIndex: r
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function ne(t, e) {
|
|
568
|
+
const n = t.trim(), r = [
|
|
569
|
+
...e.tokens?.commandPrefixes || S.commandPrefixes
|
|
570
|
+
].sort((a, l) => l.length - a.length), s = [
|
|
571
|
+
...e.tokens?.argumentSeparators || S.argumentSeparators
|
|
572
|
+
].sort((a, l) => l.length - a.length);
|
|
573
|
+
let o = 0;
|
|
574
|
+
if (!n)
|
|
575
|
+
return E("AT command segments cannot be empty.");
|
|
576
|
+
const i = Z(
|
|
577
|
+
n,
|
|
578
|
+
r,
|
|
579
|
+
o
|
|
580
|
+
);
|
|
581
|
+
if (!i)
|
|
582
|
+
return E("AT commands must start with a configured prefix.");
|
|
583
|
+
o += i.length;
|
|
584
|
+
const c = n.slice(o).match(/^[A-Z][A-Z0-9_:-]*/i);
|
|
585
|
+
if (!c)
|
|
586
|
+
return E("AT commands must include a command name.");
|
|
587
|
+
for (o += c[0].length; o < n.length; ) {
|
|
588
|
+
for (; o < n.length && /\s/.test(n[o]); )
|
|
589
|
+
o += 1;
|
|
590
|
+
if (o >= n.length)
|
|
591
|
+
return y;
|
|
592
|
+
const a = n[o] === "=" ? "=" : Z(n, s, o);
|
|
593
|
+
if (!a)
|
|
594
|
+
return E("AT commands can only continue with assignments or arguments.");
|
|
595
|
+
o += a.length;
|
|
596
|
+
const l = ee(
|
|
597
|
+
n,
|
|
598
|
+
o,
|
|
599
|
+
s
|
|
600
|
+
);
|
|
601
|
+
if (!l)
|
|
602
|
+
return E("AT command arguments must provide a value.");
|
|
603
|
+
o = l.nextIndex;
|
|
604
|
+
}
|
|
605
|
+
return y;
|
|
606
|
+
}
|
|
607
|
+
function re(t, e) {
|
|
608
|
+
if (!e)
|
|
609
|
+
return y;
|
|
610
|
+
const n = e, r = [
|
|
611
|
+
...n.tokens?.concatenationSeparators || S.concatenationSeparators
|
|
612
|
+
].sort((o, i) => i.length - o.length), s = t.split(`
|
|
613
|
+
`);
|
|
614
|
+
for (let o = 0; o < s.length; o += 1) {
|
|
615
|
+
const i = qt(s[o]).trim();
|
|
616
|
+
if (!i)
|
|
617
|
+
continue;
|
|
618
|
+
const c = te(i, r);
|
|
619
|
+
if (c.some((a) => !a.trim()))
|
|
620
|
+
return E(
|
|
621
|
+
`Invalid AT commands syntax on line ${o + 1}.`,
|
|
622
|
+
v(t, o)
|
|
623
|
+
);
|
|
624
|
+
for (const a of c)
|
|
625
|
+
if (!ne(
|
|
626
|
+
a,
|
|
627
|
+
n
|
|
628
|
+
).isValid)
|
|
629
|
+
return E(
|
|
630
|
+
`Invalid AT commands syntax on line ${o + 1}.`,
|
|
631
|
+
v(t, o)
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
return y;
|
|
635
|
+
}
|
|
636
|
+
function oe(t) {
|
|
637
|
+
if (!t.trim())
|
|
638
|
+
return y;
|
|
639
|
+
try {
|
|
640
|
+
return JSON.parse(t), y;
|
|
641
|
+
} catch (e) {
|
|
642
|
+
return E(
|
|
643
|
+
"Invalid JSON syntax.",
|
|
644
|
+
Kt(
|
|
645
|
+
t,
|
|
646
|
+
e instanceof Error ? e.message : "Invalid JSON syntax."
|
|
647
|
+
)
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
function se(t) {
|
|
652
|
+
return lt[t];
|
|
653
|
+
}
|
|
654
|
+
function xe({
|
|
655
|
+
code: t,
|
|
656
|
+
languageTemplate: e,
|
|
657
|
+
languageText: n
|
|
658
|
+
}) {
|
|
659
|
+
const r = ut(e), s = b(
|
|
660
|
+
n ?? r?.languageText
|
|
661
|
+
);
|
|
662
|
+
switch (s) {
|
|
663
|
+
case B:
|
|
664
|
+
return re(t, r);
|
|
665
|
+
case "json":
|
|
666
|
+
return oe(t);
|
|
667
|
+
default:
|
|
668
|
+
return se(s)?.({
|
|
669
|
+
code: t,
|
|
670
|
+
languageTemplate: e,
|
|
671
|
+
languageText: s
|
|
672
|
+
}) ?? y;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
function Te(t) {
|
|
676
|
+
return t.split(`
|
|
677
|
+
`).length;
|
|
678
|
+
}
|
|
679
|
+
function ie(t, e) {
|
|
680
|
+
return e ? Object.entries(e).find(
|
|
681
|
+
([r]) => b(r) === t
|
|
682
|
+
)?.[1] : void 0;
|
|
683
|
+
}
|
|
684
|
+
function ae(t, e) {
|
|
685
|
+
const n = ie(
|
|
686
|
+
t,
|
|
687
|
+
e.customLanguages
|
|
688
|
+
);
|
|
689
|
+
return n || (e.languageTemplate && b(e.languageTemplate.languageText) === t ? Zt(e.languageTemplate) : V[t]);
|
|
690
|
+
}
|
|
691
|
+
function ce(t, e) {
|
|
692
|
+
return !e || V[t] === e ? K : {
|
|
693
|
+
...K,
|
|
694
|
+
languages: {
|
|
695
|
+
...V,
|
|
696
|
+
[t]: e
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
function A(t, e, n) {
|
|
701
|
+
if (!t)
|
|
702
|
+
return !1;
|
|
703
|
+
const r = Math.max(e + 1, n);
|
|
704
|
+
return e < t.end.offset && t.start.offset < r;
|
|
705
|
+
}
|
|
706
|
+
function le(t, e, n) {
|
|
707
|
+
const r = e + t.length, s = Math.max(n.start.offset, e), o = Math.min(n.end.offset, r);
|
|
708
|
+
if (s >= o)
|
|
709
|
+
return [{ text: t || " ", hasError: !1 }];
|
|
710
|
+
const i = s - e, c = o - e, a = [];
|
|
711
|
+
return i > 0 && a.push({
|
|
712
|
+
hasError: !1,
|
|
713
|
+
text: t.slice(0, i)
|
|
714
|
+
}), a.push({
|
|
715
|
+
hasError: !0,
|
|
716
|
+
text: t.slice(i, c)
|
|
717
|
+
}), c < t.length && a.push({
|
|
718
|
+
hasError: !1,
|
|
719
|
+
text: t.slice(c)
|
|
720
|
+
}), a.filter((l) => l.text.length > 0);
|
|
721
|
+
}
|
|
722
|
+
function Se(t) {
|
|
723
|
+
const e = Q(t), n = Rt(t);
|
|
724
|
+
return {
|
|
725
|
+
plain: {
|
|
726
|
+
backgroundColor: "transparent",
|
|
727
|
+
color: e.surface.editorForeground
|
|
728
|
+
},
|
|
729
|
+
bracketPalette: Nt(t),
|
|
730
|
+
semanticPalette: n,
|
|
731
|
+
styles: [
|
|
732
|
+
{
|
|
733
|
+
types: ["comment", "prolog", "doctype", "cdata"],
|
|
734
|
+
style: {
|
|
735
|
+
color: e.syntax.comment,
|
|
736
|
+
fontStyle: "italic"
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
types: ["punctuation"],
|
|
741
|
+
style: {
|
|
742
|
+
color: e.surface.editorForeground
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
types: ["operator"],
|
|
747
|
+
style: {
|
|
748
|
+
color: e.syntax.operator
|
|
749
|
+
}
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
types: ["property", "literal-property", "selector"],
|
|
753
|
+
style: {
|
|
754
|
+
color: n.variable
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
types: ["attr-name"],
|
|
759
|
+
style: {
|
|
760
|
+
color: e.syntax.attributeName
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
types: ["tag"],
|
|
765
|
+
style: {
|
|
766
|
+
color: e.syntax.tag
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
types: ["boolean"],
|
|
771
|
+
style: {
|
|
772
|
+
color: e.syntax.boolean
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
types: ["number"],
|
|
777
|
+
style: {
|
|
778
|
+
color: e.syntax.number
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
types: ["symbol"],
|
|
783
|
+
style: {
|
|
784
|
+
color: e.syntax.constant
|
|
785
|
+
}
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
types: ["atrule"],
|
|
789
|
+
style: {
|
|
790
|
+
color: e.syntax.keyword
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
types: ["constant"],
|
|
795
|
+
style: {
|
|
796
|
+
color: n.constant
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
types: ["string", "char", "inserted"],
|
|
801
|
+
style: {
|
|
802
|
+
color: e.syntax.string
|
|
803
|
+
}
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
types: ["regex"],
|
|
807
|
+
style: {
|
|
808
|
+
color: e.syntax.regex
|
|
809
|
+
}
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
types: ["constant.character.escape"],
|
|
813
|
+
style: {
|
|
814
|
+
color: e.syntax.escape
|
|
815
|
+
}
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
types: ["keyword"],
|
|
819
|
+
style: {
|
|
820
|
+
color: e.syntax.keyword
|
|
821
|
+
}
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
types: ["function", "function-variable", "method", "method-variable"],
|
|
825
|
+
style: {
|
|
826
|
+
color: e.syntax.function
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
types: ["builtin", "class-name", "known-class-name", "maybe-class-name"],
|
|
831
|
+
style: {
|
|
832
|
+
color: n.type
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
types: ["alias", "imports", "parameter", "variable"],
|
|
837
|
+
style: {
|
|
838
|
+
color: n.variable
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
types: ["deleted"],
|
|
843
|
+
style: {
|
|
844
|
+
color: e.surface.errorBorderColor
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
]
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
function ve({
|
|
851
|
+
code: t,
|
|
852
|
+
customLanguages: e,
|
|
853
|
+
languageTemplate: n,
|
|
854
|
+
languageText: r,
|
|
855
|
+
prismTheme: s,
|
|
856
|
+
syntaxErrorRange: o
|
|
857
|
+
}) {
|
|
858
|
+
const i = Wt(n), c = b(
|
|
859
|
+
r ?? i?.languageText
|
|
860
|
+
), a = ae(c, {
|
|
861
|
+
customLanguages: e,
|
|
862
|
+
languageTemplate: i
|
|
863
|
+
}), l = t.split(`
|
|
864
|
+
`), M = q(l), C = jt(
|
|
865
|
+
t,
|
|
866
|
+
o
|
|
867
|
+
), ft = ce(c, a);
|
|
868
|
+
return !a || c === at ? /* @__PURE__ */ f(st, { children: l.map((L, _) => {
|
|
869
|
+
const k = M[_] || 0, N = A(
|
|
870
|
+
C,
|
|
871
|
+
k,
|
|
872
|
+
k + L.length
|
|
873
|
+
), R = C ? le(
|
|
874
|
+
L,
|
|
875
|
+
k,
|
|
876
|
+
C
|
|
877
|
+
) : [{ hasError: !1, text: L || " " }];
|
|
878
|
+
return /* @__PURE__ */ f(
|
|
879
|
+
"div",
|
|
880
|
+
{
|
|
881
|
+
className: "token-line",
|
|
882
|
+
"data-code-editor-error-line": N || void 0,
|
|
883
|
+
children: R.map(($, z) => /* @__PURE__ */ f(
|
|
884
|
+
"span",
|
|
885
|
+
{
|
|
886
|
+
className: "token plain",
|
|
887
|
+
"data-code-editor-error-token": $.hasError || void 0,
|
|
888
|
+
children: $.text || " "
|
|
889
|
+
},
|
|
890
|
+
`plain-line-${_}-segment-${z}`
|
|
891
|
+
))
|
|
892
|
+
},
|
|
893
|
+
`plain-line-${_}`
|
|
894
|
+
);
|
|
895
|
+
}) }) : /* @__PURE__ */ f(
|
|
896
|
+
Tt,
|
|
897
|
+
{
|
|
898
|
+
code: t || " ",
|
|
899
|
+
language: c,
|
|
900
|
+
prism: ft,
|
|
901
|
+
theme: s,
|
|
902
|
+
children: ({ tokens: L, getLineProps: _, getTokenProps: k }) => {
|
|
903
|
+
const N = s.bracketPalette, R = s.semanticPalette, $ = !!R && Pt(c);
|
|
904
|
+
let z = 0;
|
|
905
|
+
const x = {};
|
|
906
|
+
return /* @__PURE__ */ f(st, { children: L.map((W, O) => {
|
|
907
|
+
const H = M[O] || 0, mt = l[O] || "", pt = A(
|
|
908
|
+
C,
|
|
909
|
+
H,
|
|
910
|
+
H + mt.length
|
|
911
|
+
);
|
|
912
|
+
let et = 0;
|
|
913
|
+
const gt = _({ line: W });
|
|
914
|
+
return /* @__PURE__ */ f(
|
|
915
|
+
"div",
|
|
916
|
+
{
|
|
917
|
+
...gt,
|
|
918
|
+
"data-code-editor-error-line": pt || void 0,
|
|
919
|
+
children: W.map((u, G) => {
|
|
920
|
+
const T = H + et, ht = T + u.content.length, Et = A(
|
|
921
|
+
C,
|
|
922
|
+
T,
|
|
923
|
+
ht
|
|
924
|
+
);
|
|
925
|
+
et += u.content.length;
|
|
926
|
+
const p = k({ token: u }), nt = zt(
|
|
927
|
+
u.types
|
|
928
|
+
);
|
|
929
|
+
if ($ && u.types.includes("plain") && u.content.trim()) {
|
|
930
|
+
const g = It(u.content);
|
|
931
|
+
if (g.some((h) => h.isIdentifier)) {
|
|
932
|
+
let h = 0;
|
|
933
|
+
return g.map((d, F) => {
|
|
934
|
+
const P = `token-${O}-${G}-${F}`, rt = T + h, yt = rt + d.content.length, ot = A(
|
|
935
|
+
C,
|
|
936
|
+
rt,
|
|
937
|
+
yt
|
|
938
|
+
);
|
|
939
|
+
if (h += d.content.length, !d.isIdentifier || !R)
|
|
940
|
+
return I(
|
|
941
|
+
x,
|
|
942
|
+
d.content
|
|
943
|
+
), /* @__PURE__ */ f(
|
|
944
|
+
"span",
|
|
945
|
+
{
|
|
946
|
+
className: p.className,
|
|
947
|
+
style: p.style,
|
|
948
|
+
"data-code-editor-error-token": ot || void 0,
|
|
949
|
+
children: d.content
|
|
950
|
+
},
|
|
951
|
+
P
|
|
952
|
+
);
|
|
953
|
+
const Ct = g.slice(F + 1).map((xt) => xt.content).join(""), U = Gt({
|
|
954
|
+
identifier: d.content,
|
|
955
|
+
nextSignificantText: wt(
|
|
956
|
+
W,
|
|
957
|
+
G,
|
|
958
|
+
Ct
|
|
959
|
+
),
|
|
960
|
+
previousIdentifierGroup: x.previousIdentifierGroup,
|
|
961
|
+
previousSignificantText: x.previousSignificantText
|
|
962
|
+
});
|
|
963
|
+
return I(
|
|
964
|
+
x,
|
|
965
|
+
d.content,
|
|
966
|
+
U
|
|
967
|
+
), /* @__PURE__ */ f(
|
|
968
|
+
"span",
|
|
969
|
+
{
|
|
970
|
+
className: p.className,
|
|
971
|
+
style: U ? {
|
|
972
|
+
...p.style,
|
|
973
|
+
color: R[U]
|
|
974
|
+
} : p.style,
|
|
975
|
+
"data-code-editor-error-token": ot || void 0,
|
|
976
|
+
"data-code-editor-token-group": U,
|
|
977
|
+
children: d.content
|
|
978
|
+
},
|
|
979
|
+
P
|
|
980
|
+
);
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
return !N?.length || !u.types.includes("punctuation") || !/[()[\]{}]/.test(u.content) ? (I(
|
|
985
|
+
x,
|
|
986
|
+
u.content,
|
|
987
|
+
nt
|
|
988
|
+
), /* @__PURE__ */ f(
|
|
989
|
+
"span",
|
|
990
|
+
{
|
|
991
|
+
...p,
|
|
992
|
+
"data-code-editor-error-token": Et || void 0,
|
|
993
|
+
"data-code-editor-token-group": nt
|
|
994
|
+
},
|
|
995
|
+
`token-${O}-${G}`
|
|
996
|
+
)) : Array.from(u.content).map((g, h) => {
|
|
997
|
+
const d = `token-${O}-${G}-${h}`;
|
|
998
|
+
if (!Ft(g))
|
|
999
|
+
return I(x, g), /* @__PURE__ */ f(
|
|
1000
|
+
"span",
|
|
1001
|
+
{
|
|
1002
|
+
className: p.className,
|
|
1003
|
+
style: p.style,
|
|
1004
|
+
"data-code-editor-error-token": A(
|
|
1005
|
+
C,
|
|
1006
|
+
T + h,
|
|
1007
|
+
T + h + 1
|
|
1008
|
+
) || void 0,
|
|
1009
|
+
children: g
|
|
1010
|
+
},
|
|
1011
|
+
d
|
|
1012
|
+
);
|
|
1013
|
+
const {
|
|
1014
|
+
nextBracketDepth: F,
|
|
1015
|
+
renderedBracketDepth: P
|
|
1016
|
+
} = Ut(g, z);
|
|
1017
|
+
return z = F, I(x, g), /* @__PURE__ */ f(
|
|
1018
|
+
"span",
|
|
1019
|
+
{
|
|
1020
|
+
className: p.className,
|
|
1021
|
+
style: {
|
|
1022
|
+
...p.style,
|
|
1023
|
+
color: N[P % N.length]
|
|
1024
|
+
},
|
|
1025
|
+
"data-code-editor-error-token": A(
|
|
1026
|
+
C,
|
|
1027
|
+
T + h,
|
|
1028
|
+
T + h + 1
|
|
1029
|
+
) || void 0,
|
|
1030
|
+
"data-code-editor-bracket-depth": P,
|
|
1031
|
+
children: g
|
|
1032
|
+
},
|
|
1033
|
+
d
|
|
1034
|
+
);
|
|
1035
|
+
});
|
|
1036
|
+
})
|
|
1037
|
+
},
|
|
1038
|
+
`token-line-${O}`
|
|
1039
|
+
);
|
|
1040
|
+
}) });
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
);
|
|
1044
|
+
}
|
|
1045
|
+
export {
|
|
1046
|
+
pe as DEFAULT_CODE_EDITOR_AT_LANGUAGE_TEMPLATE,
|
|
1047
|
+
Vt as buildAtCommandGrammar,
|
|
1048
|
+
Zt as createCodeEditorLanguageGrammar,
|
|
1049
|
+
ye as createCodeEditorLezerSyntaxValidator,
|
|
1050
|
+
Se as createCodeEditorPrismTheme,
|
|
1051
|
+
J as createTokenAlternation,
|
|
1052
|
+
Wt as ensureCodeEditorLanguageTemplate,
|
|
1053
|
+
Ce as ensureCodeEditorRuntimeDependencies,
|
|
1054
|
+
Bt as escapeRegExpToken,
|
|
1055
|
+
Te as getCodeEditorLineCount,
|
|
1056
|
+
ve as highlightCode,
|
|
1057
|
+
ge as registerCodeEditorLanguage,
|
|
1058
|
+
he as registerCodeEditorLanguageTemplate,
|
|
1059
|
+
Ee as registerCodeEditorSyntaxValidator,
|
|
1060
|
+
b as resolveCodeEditorLanguage,
|
|
1061
|
+
ut as resolveCodeEditorLanguageTemplate,
|
|
1062
|
+
xe as validateCodeEditorSyntax
|
|
1063
|
+
};
|