@theia/core 1.66.0-next.44 → 1.66.0-next.73
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/lib/browser/authentication-service.d.ts +14 -10
- package/lib/browser/authentication-service.d.ts.map +1 -1
- package/lib/browser/authentication-service.js +23 -11
- package/lib/browser/authentication-service.js.map +1 -1
- package/lib/browser/catalog.json +17 -9
- package/lib/browser/credentials-service.d.ts +2 -0
- package/lib/browser/credentials-service.d.ts.map +1 -1
- package/lib/browser/credentials-service.js +6 -0
- package/lib/browser/credentials-service.js.map +1 -1
- package/lib/browser/frontend-application-module.d.ts.map +1 -1
- package/lib/browser/frontend-application-module.js +3 -0
- package/lib/browser/frontend-application-module.js.map +1 -1
- package/lib/browser/symbol-icon-color-contribution.d.ts +6 -0
- package/lib/browser/symbol-icon-color-contribution.d.ts.map +1 -0
- package/lib/browser/symbol-icon-color-contribution.js +212 -0
- package/lib/browser/symbol-icon-color-contribution.js.map +1 -0
- package/lib/browser/tree/tree-widget.d.ts +6 -0
- package/lib/browser/tree/tree-widget.d.ts.map +1 -1
- package/lib/browser/tree/tree-widget.js +23 -6
- package/lib/browser/tree/tree-widget.js.map +1 -1
- package/lib/browser-only/frontend-only-application-module.d.ts.map +1 -1
- package/lib/browser-only/frontend-only-application-module.js +2 -1
- package/lib/browser-only/frontend-only-application-module.js.map +1 -1
- package/lib/common/color.d.ts +17 -1
- package/lib/common/color.d.ts.map +1 -1
- package/lib/common/color.js +62 -1
- package/lib/common/color.js.map +1 -1
- package/lib/common/content-replacer-v2-impl.d.ts +70 -0
- package/lib/common/content-replacer-v2-impl.d.ts.map +1 -0
- package/lib/common/content-replacer-v2-impl.js +407 -0
- package/lib/common/content-replacer-v2-impl.js.map +1 -0
- package/lib/common/content-replacer-v2-impl.spec.d.ts +2 -0
- package/lib/common/content-replacer-v2-impl.spec.d.ts.map +1 -0
- package/lib/common/content-replacer-v2-impl.spec.js +319 -0
- package/lib/common/content-replacer-v2-impl.spec.js.map +1 -0
- package/lib/common/content-replacer.d.ts +13 -1
- package/lib/common/content-replacer.d.ts.map +1 -1
- package/lib/common/content-replacer.js +3 -3
- package/lib/common/content-replacer.js.map +1 -1
- package/lib/common/content-replacer.spec.js +2 -2
- package/lib/common/content-replacer.spec.js.map +1 -1
- package/lib/common/key-store.d.ts +1 -0
- package/lib/common/key-store.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-menu-contribution.js +1 -1
- package/lib/electron-browser/menu/electron-menu-contribution.js.map +1 -1
- package/lib/node/key-store-server.d.ts +1 -0
- package/lib/node/key-store-server.d.ts.map +1 -1
- package/lib/node/key-store-server.js +4 -0
- package/lib/node/key-store-server.js.map +1 -1
- package/lib/node/key-store-server.spec.d.ts +2 -0
- package/lib/node/key-store-server.spec.d.ts.map +1 -0
- package/lib/node/key-store-server.spec.js +226 -0
- package/lib/node/key-store-server.spec.js.map +1 -0
- package/package.json +4 -4
- package/src/browser/authentication-service.ts +57 -18
- package/src/browser/credentials-service.ts +9 -0
- package/src/browser/frontend-application-module.ts +3 -0
- package/src/browser/style/index.css +1 -0
- package/src/browser/style/symbol-icon.css +258 -0
- package/src/browser/symbol-icon-color-contribution.ts +242 -0
- package/src/browser/tree/tree-widget.tsx +25 -6
- package/src/browser-only/frontend-only-application-module.ts +2 -1
- package/src/common/color.ts +51 -1
- package/src/common/content-replacer-v2-impl.spec.ts +344 -0
- package/src/common/content-replacer-v2-impl.ts +471 -0
- package/src/common/content-replacer.spec.ts +4 -4
- package/src/common/content-replacer.ts +11 -1
- package/src/common/key-store.ts +1 -0
- package/src/electron-browser/menu/electron-menu-contribution.ts +1 -1
- package/src/node/key-store-server.spec.ts +262 -0
- package/src/node/key-store-server.ts +5 -0
package/lib/common/color.d.ts
CHANGED
|
@@ -10,12 +10,16 @@ export declare namespace Color {
|
|
|
10
10
|
function transparent(v: string, f: number): ColorTransformation;
|
|
11
11
|
function lighten(v: string, f: number): ColorTransformation;
|
|
12
12
|
function darken(v: string, f: number): ColorTransformation;
|
|
13
|
+
function is(value: unknown): value is Color;
|
|
13
14
|
}
|
|
14
15
|
export interface ColorTransformation {
|
|
15
16
|
kind: 'transparent' | 'lighten' | 'darken';
|
|
16
17
|
v: string;
|
|
17
18
|
f: number;
|
|
18
19
|
}
|
|
20
|
+
export declare namespace ColorTransformation {
|
|
21
|
+
function is(value: unknown): value is ColorTransformation;
|
|
22
|
+
}
|
|
19
23
|
export interface RGBA {
|
|
20
24
|
/**
|
|
21
25
|
* Red: integer in [0-255]
|
|
@@ -34,6 +38,9 @@ export interface RGBA {
|
|
|
34
38
|
*/
|
|
35
39
|
readonly a: number;
|
|
36
40
|
}
|
|
41
|
+
export declare namespace RGBA {
|
|
42
|
+
function is(value: unknown): value is RGBA;
|
|
43
|
+
}
|
|
37
44
|
export interface HSLA {
|
|
38
45
|
/**
|
|
39
46
|
* Hue: integer in [0, 360]
|
|
@@ -52,6 +59,9 @@ export interface HSLA {
|
|
|
52
59
|
*/
|
|
53
60
|
readonly a: number;
|
|
54
61
|
}
|
|
62
|
+
export declare namespace HSLA {
|
|
63
|
+
function is(value: unknown): value is HSLA;
|
|
64
|
+
}
|
|
55
65
|
export interface ColorDefaults {
|
|
56
66
|
light?: Color;
|
|
57
67
|
dark?: Color;
|
|
@@ -60,9 +70,15 @@ export interface ColorDefaults {
|
|
|
60
70
|
hcDark?: Color;
|
|
61
71
|
hcLight?: Color;
|
|
62
72
|
}
|
|
73
|
+
export declare namespace ColorDefaults {
|
|
74
|
+
function getLight(defaults: ColorDefaults | Color | undefined): Color | undefined;
|
|
75
|
+
function getDark(defaults: ColorDefaults | Color | undefined): Color | undefined;
|
|
76
|
+
function getHCDark(defaults: ColorDefaults | Color | undefined): Color | undefined;
|
|
77
|
+
function getHCLight(defaults: ColorDefaults | Color | undefined): Color | undefined;
|
|
78
|
+
}
|
|
63
79
|
export interface ColorDefinition {
|
|
64
80
|
id: string;
|
|
65
|
-
defaults?: ColorDefaults;
|
|
81
|
+
defaults?: ColorDefaults | Color;
|
|
66
82
|
description: string;
|
|
67
83
|
}
|
|
68
84
|
export interface ColorCssVariable {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/common/color.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/common/color.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,mBAAmB,CAAC;AAC/D,yBAAiB,KAAK,CAAC;IACnB,SAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAE,MAAU,GAAG,KAAK,CAE1E;IACD,SAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAE,MAAU,GAAG,KAAK,CAE1E;IACM,MAAM,KAAK,OAAyB,CAAC;IACrC,MAAM,KAAK,OAAmB,CAAC;IACtC,SAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAErE;IACD,SAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAEjE;IACD,SAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAEhE;IACD,SAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAEjD;CACJ;AACD,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG,QAAQ,CAAA;IAC1C,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACZ;AACD,yBAAiB,mBAAmB,CAAC;IACjC,S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CAKtF;IACD,SAAgB,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAKxF;IACD,SAAgB,UAAU,CAAC,QAAQ,EAAE,aAAa,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAKzF;CACJ;AAED,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,CAAC,EAAE,aAAa,GAAG,KAAK,CAAC;IACjC,WAAW,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CAChB"}
|
package/lib/common/color.js
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
16
|
// *****************************************************************************
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.Color = void 0;
|
|
18
|
+
exports.ColorDefaults = exports.HSLA = exports.RGBA = exports.ColorTransformation = exports.Color = void 0;
|
|
19
|
+
const types_1 = require("./types");
|
|
19
20
|
var Color;
|
|
20
21
|
(function (Color) {
|
|
21
22
|
function rgba(r, g, b, a = 1) {
|
|
@@ -40,5 +41,65 @@ var Color;
|
|
|
40
41
|
return { v, f, kind: 'darken' };
|
|
41
42
|
}
|
|
42
43
|
Color.darken = darken;
|
|
44
|
+
function is(value) {
|
|
45
|
+
return typeof value === 'string' || (ColorTransformation.is(value) || RGBA.is(value) || HSLA.is(value));
|
|
46
|
+
}
|
|
47
|
+
Color.is = is;
|
|
43
48
|
})(Color || (exports.Color = Color = {}));
|
|
49
|
+
var ColorTransformation;
|
|
50
|
+
(function (ColorTransformation) {
|
|
51
|
+
function is(value) {
|
|
52
|
+
return (0, types_1.isObject)(value)
|
|
53
|
+
&& (value.kind === 'transparent' || value.kind === 'lighten' || value.kind === 'darken')
|
|
54
|
+
&& typeof value.v === 'string'
|
|
55
|
+
&& typeof value.f === 'number';
|
|
56
|
+
}
|
|
57
|
+
ColorTransformation.is = is;
|
|
58
|
+
})(ColorTransformation || (exports.ColorTransformation = ColorTransformation = {}));
|
|
59
|
+
var RGBA;
|
|
60
|
+
(function (RGBA) {
|
|
61
|
+
function is(value) {
|
|
62
|
+
return (0, types_1.isObject)(value) && typeof value.r === 'number' && typeof value.g === 'number' && typeof value.b === 'number' && typeof value.a === 'number';
|
|
63
|
+
}
|
|
64
|
+
RGBA.is = is;
|
|
65
|
+
})(RGBA || (exports.RGBA = RGBA = {}));
|
|
66
|
+
var HSLA;
|
|
67
|
+
(function (HSLA) {
|
|
68
|
+
function is(value) {
|
|
69
|
+
return (0, types_1.isObject)(value) && typeof value.h === 'number' && typeof value.s === 'number' && typeof value.l === 'number' && typeof value.a === 'number';
|
|
70
|
+
}
|
|
71
|
+
HSLA.is = is;
|
|
72
|
+
})(HSLA || (exports.HSLA = HSLA = {}));
|
|
73
|
+
var ColorDefaults;
|
|
74
|
+
(function (ColorDefaults) {
|
|
75
|
+
function getLight(defaults) {
|
|
76
|
+
if (Color.is(defaults)) {
|
|
77
|
+
return defaults;
|
|
78
|
+
}
|
|
79
|
+
return defaults === null || defaults === void 0 ? void 0 : defaults.light;
|
|
80
|
+
}
|
|
81
|
+
ColorDefaults.getLight = getLight;
|
|
82
|
+
function getDark(defaults) {
|
|
83
|
+
if (Color.is(defaults)) {
|
|
84
|
+
return defaults;
|
|
85
|
+
}
|
|
86
|
+
return defaults === null || defaults === void 0 ? void 0 : defaults.dark;
|
|
87
|
+
}
|
|
88
|
+
ColorDefaults.getDark = getDark;
|
|
89
|
+
function getHCDark(defaults) {
|
|
90
|
+
var _a;
|
|
91
|
+
if (Color.is(defaults)) {
|
|
92
|
+
return defaults;
|
|
93
|
+
}
|
|
94
|
+
return (_a = defaults === null || defaults === void 0 ? void 0 : defaults.hcDark) !== null && _a !== void 0 ? _a : defaults === null || defaults === void 0 ? void 0 : defaults.hc;
|
|
95
|
+
}
|
|
96
|
+
ColorDefaults.getHCDark = getHCDark;
|
|
97
|
+
function getHCLight(defaults) {
|
|
98
|
+
if (Color.is(defaults)) {
|
|
99
|
+
return defaults;
|
|
100
|
+
}
|
|
101
|
+
return defaults === null || defaults === void 0 ? void 0 : defaults.hcLight;
|
|
102
|
+
}
|
|
103
|
+
ColorDefaults.getHCLight = getHCLight;
|
|
104
|
+
})(ColorDefaults || (exports.ColorDefaults = ColorDefaults = {}));
|
|
44
105
|
//# sourceMappingURL=color.js.map
|
package/lib/common/color.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/common/color.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/common/color.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,mCAAmC;AAMnC,IAAiB,KAAK,CAqBrB;AArBD,WAAiB,KAAK;IAClB,SAAgB,IAAI,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,IAAY,CAAC;QAC/D,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1B,CAAC;IAFe,UAAI,OAEnB,CAAA;IACD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AO,QAAQ,CAAC;QACpB,CAAC;QACD,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,CAAC;IAC3B,CAAC;IALe,sBAAQ,WAKvB,CAAA;IACD,SAAgB,OAAO,CAAC,QAA2C;QAC/D,IAAI,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrB,OAAO,QAAQ,CAAC;QACpB,CAAC;QACD,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAC;IAC1B,CAAC;IALe,qBAAO,UAKtB,CAAA;IACD,SAAgB,SAAS,CAAC,QAA2C;;QACjE,IAAI,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrB,OAAO,QAAQ,CAAC;QACpB,CAAC;QACD,OAAO,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,mCAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,EAAE,CAAC;IAC5C,CAAC;IALe,uBAAS,YAKxB,CAAA;IACD,SAAgB,UAAU,CAAC,QAA2C;QAClE,IAAI,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrB,OAAO,QAAQ,CAAC;QACpB,CAAC;QACD,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC;IAC7B,CAAC;IALe,wBAAU,aAKzB,CAAA;AACL,CAAC,EAzBgB,aAAa,6BAAb,aAAa,QAyB7B"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ContentReplacer, Replacement } from './content-replacer';
|
|
2
|
+
export declare class ContentReplacerV2Impl implements ContentReplacer {
|
|
3
|
+
/**
|
|
4
|
+
* Applies a list of replacements to the original content using a multi-step matching strategy with improved flexibility.
|
|
5
|
+
* @param originalContent The original file content.
|
|
6
|
+
* @param replacements Array of Replacement objects.
|
|
7
|
+
* @returns An object containing the updated content and any error messages.
|
|
8
|
+
*/
|
|
9
|
+
applyReplacements(originalContent: string, replacements: Replacement[]): {
|
|
10
|
+
updatedContent: string;
|
|
11
|
+
errors: string[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Normalizes line endings to LF
|
|
15
|
+
*/
|
|
16
|
+
private normalizeLineEndings;
|
|
17
|
+
/**
|
|
18
|
+
* Finds matches using multiple strategies with increasing flexibility
|
|
19
|
+
*/
|
|
20
|
+
private findMatches;
|
|
21
|
+
/**
|
|
22
|
+
* Finds all exact matches of a substring within a string.
|
|
23
|
+
*/
|
|
24
|
+
private findExactMatches;
|
|
25
|
+
/**
|
|
26
|
+
* Finds matches after normalizing line endings
|
|
27
|
+
*/
|
|
28
|
+
private findNormalizedLineEndingMatches;
|
|
29
|
+
/**
|
|
30
|
+
* Maps a position in normalized content back to the original content
|
|
31
|
+
*/
|
|
32
|
+
private mapNormalizedPositionToOriginal;
|
|
33
|
+
/**
|
|
34
|
+
* Attempts to find matches by trimming whitespace from lines (single line only, for backward compatibility)
|
|
35
|
+
*/
|
|
36
|
+
private findLineTrimmedMatches;
|
|
37
|
+
/**
|
|
38
|
+
* Finds matches using fuzzy multi-line comparison with trimmed lines
|
|
39
|
+
*/
|
|
40
|
+
private findFuzzyMultilineMatches;
|
|
41
|
+
/**
|
|
42
|
+
* Calculates the starting index of a specific line number in the content.
|
|
43
|
+
*/
|
|
44
|
+
private getLineStartIndex;
|
|
45
|
+
/**
|
|
46
|
+
* Calculates the ending index of a specific line number in the content (including the line).
|
|
47
|
+
*/
|
|
48
|
+
private getLineEndIndex;
|
|
49
|
+
/**
|
|
50
|
+
* Replaces a single match while preserving indentation
|
|
51
|
+
*/
|
|
52
|
+
private replaceSingleMatch;
|
|
53
|
+
/**
|
|
54
|
+
* Replaces all matches
|
|
55
|
+
*/
|
|
56
|
+
private replaceAllMatches;
|
|
57
|
+
/**
|
|
58
|
+
* Preserves the indentation from the original content when applying the replacement
|
|
59
|
+
*/
|
|
60
|
+
private preserveIndentation;
|
|
61
|
+
/**
|
|
62
|
+
* Converts line endings in content to the specified line ending style
|
|
63
|
+
*/
|
|
64
|
+
private convertLineEndings;
|
|
65
|
+
/**
|
|
66
|
+
* Truncates content for error messages to avoid overly long error messages
|
|
67
|
+
*/
|
|
68
|
+
private truncateForError;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=content-replacer-v2-impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-replacer-v2-impl.d.ts","sourceRoot":"","sources":["../../src/common/content-replacer-v2-impl.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAmBlE,qBAAa,qBAAsB,YAAW,eAAe;IACzD;;;;;OAKG;IACH,iBAAiB,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE;IA0CrH;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;OAEG;IACH,OAAO,CAAC,WAAW;IA4BnB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAuBvC;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAyBvC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAqB9B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA0DjC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAqBzB;;OAEG;IACH,OAAO,CAAC,eAAe;IAuBvB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuBzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAgE3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAQ3B"}
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ContentReplacerV2Impl = void 0;
|
|
19
|
+
class ContentReplacerV2Impl {
|
|
20
|
+
/**
|
|
21
|
+
* Applies a list of replacements to the original content using a multi-step matching strategy with improved flexibility.
|
|
22
|
+
* @param originalContent The original file content.
|
|
23
|
+
* @param replacements Array of Replacement objects.
|
|
24
|
+
* @returns An object containing the updated content and any error messages.
|
|
25
|
+
*/
|
|
26
|
+
applyReplacements(originalContent, replacements) {
|
|
27
|
+
let updatedContent = originalContent;
|
|
28
|
+
const errorMessages = [];
|
|
29
|
+
// Guard against conflicting replacements: if the same oldContent appears with different newContent, return with an error.
|
|
30
|
+
const conflictMap = new Map();
|
|
31
|
+
for (const replacement of replacements) {
|
|
32
|
+
if (conflictMap.has(replacement.oldContent) && conflictMap.get(replacement.oldContent) !== replacement.newContent) {
|
|
33
|
+
return { updatedContent: originalContent, errors: [`Conflicting replacement values for: "${replacement.oldContent}"`] };
|
|
34
|
+
}
|
|
35
|
+
conflictMap.set(replacement.oldContent, replacement.newContent);
|
|
36
|
+
}
|
|
37
|
+
replacements.forEach(({ oldContent, newContent, multiple }) => {
|
|
38
|
+
// If the old content is empty, prepend the new content to the beginning of the file (e.g. in new file)
|
|
39
|
+
if (oldContent === '') {
|
|
40
|
+
updatedContent = newContent + updatedContent;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// Try multiple matching strategies
|
|
44
|
+
const matchResult = this.findMatches(updatedContent, oldContent);
|
|
45
|
+
if (matchResult.matches.length === 0) {
|
|
46
|
+
const truncatedOld = this.truncateForError(oldContent);
|
|
47
|
+
errorMessages.push(`Content to replace not found: "${truncatedOld}"`);
|
|
48
|
+
}
|
|
49
|
+
else if (matchResult.matches.length > 1) {
|
|
50
|
+
if (multiple) {
|
|
51
|
+
updatedContent = this.replaceAllMatches(updatedContent, matchResult.matches, newContent);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const truncatedOld = this.truncateForError(oldContent);
|
|
55
|
+
errorMessages.push(`Multiple occurrences found for: "${truncatedOld}". Set 'multiple' to true if multiple occurrences of the oldContent are expected to be\
|
|
56
|
+
replaced at once.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
updatedContent = this.replaceSingleMatch(updatedContent, matchResult.matches[0], newContent);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return { updatedContent, errors: errorMessages };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Normalizes line endings to LF
|
|
67
|
+
*/
|
|
68
|
+
normalizeLineEndings(text) {
|
|
69
|
+
return text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Finds matches using multiple strategies with increasing flexibility
|
|
73
|
+
*/
|
|
74
|
+
findMatches(content, search) {
|
|
75
|
+
// Strategy 1: Exact match
|
|
76
|
+
const exactMatches = this.findExactMatches(content, search);
|
|
77
|
+
if (exactMatches.length > 0) {
|
|
78
|
+
return { matches: exactMatches, strategy: 'exact' };
|
|
79
|
+
}
|
|
80
|
+
// Strategy 2: Match with normalized line endings
|
|
81
|
+
const normalizedMatches = this.findNormalizedLineEndingMatches(content, search);
|
|
82
|
+
if (normalizedMatches.length > 0) {
|
|
83
|
+
return { matches: normalizedMatches, strategy: 'normalized-line-endings' };
|
|
84
|
+
}
|
|
85
|
+
// Strategy 3: Single line trimmed match (for backward compatibility)
|
|
86
|
+
const lineTrimmedMatches = this.findLineTrimmedMatches(content, search);
|
|
87
|
+
if (lineTrimmedMatches.length > 0) {
|
|
88
|
+
return { matches: lineTrimmedMatches, strategy: 'line-trimmed' };
|
|
89
|
+
}
|
|
90
|
+
// Strategy 4: Multi-line fuzzy match with trimmed comparison
|
|
91
|
+
const fuzzyMatches = this.findFuzzyMultilineMatches(content, search);
|
|
92
|
+
if (fuzzyMatches.length > 0) {
|
|
93
|
+
return { matches: fuzzyMatches, strategy: 'fuzzy-multiline' };
|
|
94
|
+
}
|
|
95
|
+
return { matches: [], strategy: 'none' };
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Finds all exact matches of a substring within a string.
|
|
99
|
+
*/
|
|
100
|
+
findExactMatches(content, search) {
|
|
101
|
+
const matches = [];
|
|
102
|
+
let startIndex = 0;
|
|
103
|
+
while ((startIndex = content.indexOf(search, startIndex)) !== -1) {
|
|
104
|
+
matches.push({
|
|
105
|
+
startIndex,
|
|
106
|
+
endIndex: startIndex + search.length,
|
|
107
|
+
matchedContent: search
|
|
108
|
+
});
|
|
109
|
+
startIndex += search.length;
|
|
110
|
+
}
|
|
111
|
+
return matches;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Finds matches after normalizing line endings
|
|
115
|
+
*/
|
|
116
|
+
findNormalizedLineEndingMatches(content, search) {
|
|
117
|
+
const normalizedContent = this.normalizeLineEndings(content);
|
|
118
|
+
const normalizedSearch = this.normalizeLineEndings(search);
|
|
119
|
+
const matches = [];
|
|
120
|
+
let startIndex = 0;
|
|
121
|
+
while ((startIndex = normalizedContent.indexOf(normalizedSearch, startIndex)) !== -1) {
|
|
122
|
+
// Map back to original content position
|
|
123
|
+
const originalStartIndex = this.mapNormalizedPositionToOriginal(content, startIndex);
|
|
124
|
+
const originalEndIndex = this.mapNormalizedPositionToOriginal(content, startIndex + normalizedSearch.length);
|
|
125
|
+
matches.push({
|
|
126
|
+
startIndex: originalStartIndex,
|
|
127
|
+
endIndex: originalEndIndex,
|
|
128
|
+
matchedContent: content.substring(originalStartIndex, originalEndIndex)
|
|
129
|
+
});
|
|
130
|
+
startIndex += normalizedSearch.length;
|
|
131
|
+
}
|
|
132
|
+
return matches;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Maps a position in normalized content back to the original content
|
|
136
|
+
*/
|
|
137
|
+
mapNormalizedPositionToOriginal(originalContent, normalizedPosition) {
|
|
138
|
+
let originalPos = 0;
|
|
139
|
+
let normalizedPos = 0;
|
|
140
|
+
while (normalizedPos < normalizedPosition && originalPos < originalContent.length) {
|
|
141
|
+
if (originalPos + 1 < originalContent.length &&
|
|
142
|
+
originalContent[originalPos] === '\r' &&
|
|
143
|
+
originalContent[originalPos + 1] === '\n') {
|
|
144
|
+
// CRLF in original maps to single LF in normalized
|
|
145
|
+
originalPos += 2;
|
|
146
|
+
normalizedPos += 1;
|
|
147
|
+
}
|
|
148
|
+
else if (originalContent[originalPos] === '\r') {
|
|
149
|
+
// Single CR in original maps to LF in normalized
|
|
150
|
+
originalPos += 1;
|
|
151
|
+
normalizedPos += 1;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// All other characters map 1:1
|
|
155
|
+
originalPos += 1;
|
|
156
|
+
normalizedPos += 1;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return originalPos;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Attempts to find matches by trimming whitespace from lines (single line only, for backward compatibility)
|
|
163
|
+
*/
|
|
164
|
+
findLineTrimmedMatches(content, search) {
|
|
165
|
+
const trimmedSearch = search.trim();
|
|
166
|
+
const lines = content.split(/\r?\n/);
|
|
167
|
+
for (let i = 0; i < lines.length; i++) {
|
|
168
|
+
const trimmedLine = lines[i].trim();
|
|
169
|
+
if (trimmedLine === trimmedSearch) {
|
|
170
|
+
// Calculate the starting index of this line in the original content
|
|
171
|
+
const startIndex = this.getLineStartIndex(content, i);
|
|
172
|
+
const endIndex = startIndex + lines[i].length;
|
|
173
|
+
return [{
|
|
174
|
+
startIndex,
|
|
175
|
+
endIndex,
|
|
176
|
+
matchedContent: lines[i]
|
|
177
|
+
}];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Finds matches using fuzzy multi-line comparison with trimmed lines
|
|
184
|
+
*/
|
|
185
|
+
findFuzzyMultilineMatches(content, search) {
|
|
186
|
+
// Extract non-empty lines from search for matching
|
|
187
|
+
const searchLines = search.split(/\r?\n/);
|
|
188
|
+
const nonEmptySearchLines = searchLines
|
|
189
|
+
.map(line => line.trim())
|
|
190
|
+
.filter(line => line.length > 0);
|
|
191
|
+
if (nonEmptySearchLines.length === 0) {
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
const contentLines = content.split(/\r?\n/);
|
|
195
|
+
const matches = [];
|
|
196
|
+
// Try to find sequences in content that match all non-empty lines from search
|
|
197
|
+
for (let contentStart = 0; contentStart < contentLines.length; contentStart++) {
|
|
198
|
+
// First, check if this could be a valid starting position
|
|
199
|
+
const startLineTrimmed = contentLines[contentStart].trim();
|
|
200
|
+
if (startLineTrimmed.length === 0 || startLineTrimmed !== nonEmptySearchLines[0]) {
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
let searchIndex = 1; // We already matched the first line
|
|
204
|
+
let contentIndex = contentStart + 1;
|
|
205
|
+
let lastMatchedLine = contentStart;
|
|
206
|
+
// Try to match remaining non-empty lines from search
|
|
207
|
+
while (searchIndex < nonEmptySearchLines.length && contentIndex < contentLines.length) {
|
|
208
|
+
const contentLineTrimmed = contentLines[contentIndex].trim();
|
|
209
|
+
if (contentLineTrimmed.length === 0) {
|
|
210
|
+
// Skip empty lines in content
|
|
211
|
+
contentIndex++;
|
|
212
|
+
}
|
|
213
|
+
else if (contentLineTrimmed === nonEmptySearchLines[searchIndex]) {
|
|
214
|
+
// Found a match
|
|
215
|
+
lastMatchedLine = contentIndex;
|
|
216
|
+
searchIndex++;
|
|
217
|
+
contentIndex++;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
// No match, this starting position doesn't work
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// Check if we matched all non-empty lines
|
|
225
|
+
if (searchIndex === nonEmptySearchLines.length) {
|
|
226
|
+
const startIndex = this.getLineStartIndex(content, contentStart);
|
|
227
|
+
const endIndex = this.getLineEndIndex(content, lastMatchedLine);
|
|
228
|
+
matches.push({
|
|
229
|
+
startIndex,
|
|
230
|
+
endIndex,
|
|
231
|
+
matchedContent: content.substring(startIndex, endIndex)
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return matches;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Calculates the starting index of a specific line number in the content.
|
|
239
|
+
*/
|
|
240
|
+
getLineStartIndex(content, lineNumber) {
|
|
241
|
+
if (lineNumber === 0) {
|
|
242
|
+
return 0;
|
|
243
|
+
}
|
|
244
|
+
let index = 0;
|
|
245
|
+
let currentLine = 0;
|
|
246
|
+
while (currentLine < lineNumber && index < content.length) {
|
|
247
|
+
if (content[index] === '\r' && index + 1 < content.length && content[index + 1] === '\n') {
|
|
248
|
+
index += 2; // CRLF
|
|
249
|
+
currentLine++;
|
|
250
|
+
}
|
|
251
|
+
else if (content[index] === '\r' || content[index] === '\n') {
|
|
252
|
+
index += 1; // CR or LF
|
|
253
|
+
currentLine++;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
index += 1;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return index;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Calculates the ending index of a specific line number in the content (including the line).
|
|
263
|
+
*/
|
|
264
|
+
getLineEndIndex(content, lineNumber) {
|
|
265
|
+
const lines = content.split(/\r?\n/);
|
|
266
|
+
if (lineNumber >= lines.length) {
|
|
267
|
+
return content.length;
|
|
268
|
+
}
|
|
269
|
+
let index = 0;
|
|
270
|
+
for (let i = 0; i <= lineNumber; i++) {
|
|
271
|
+
index += lines[i].length;
|
|
272
|
+
if (i < lineNumber) {
|
|
273
|
+
// Add line ending length
|
|
274
|
+
const searchPos = index;
|
|
275
|
+
if (content.indexOf('\r\n', searchPos) === searchPos) {
|
|
276
|
+
index += 2; // CRLF
|
|
277
|
+
}
|
|
278
|
+
else if (index < content.length && (content[index] === '\r' || content[index] === '\n')) {
|
|
279
|
+
index += 1; // CR or LF
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return index;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Replaces a single match while preserving indentation
|
|
287
|
+
*/
|
|
288
|
+
replaceSingleMatch(content, match, newContent) {
|
|
289
|
+
const beforeMatch = content.substring(0, match.startIndex);
|
|
290
|
+
const afterMatch = content.substring(match.endIndex);
|
|
291
|
+
// Detect the line ending style from entire original content, not just the match
|
|
292
|
+
const originalLineEnding = content.includes('\r\n') ? '\r\n' :
|
|
293
|
+
content.includes('\r') ? '\r' : '\n';
|
|
294
|
+
// Convert line endings in newContent to match original
|
|
295
|
+
const newContentWithCorrectLineEndings = this.convertLineEndings(newContent, originalLineEnding);
|
|
296
|
+
// Preserve indentation from the matched content
|
|
297
|
+
const preservedReplacement = this.preserveIndentation(match.matchedContent, newContentWithCorrectLineEndings, originalLineEnding);
|
|
298
|
+
return beforeMatch + preservedReplacement + afterMatch;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Replaces all matches
|
|
302
|
+
*/
|
|
303
|
+
replaceAllMatches(content, matches, newContent) {
|
|
304
|
+
// Sort matches by position (descending) to avoid position shifts
|
|
305
|
+
const sortedMatches = [...matches].sort((a, b) => b.startIndex - a.startIndex);
|
|
306
|
+
// Detect the line ending style from entire original content
|
|
307
|
+
const originalLineEnding = content.includes('\r\n') ? '\r\n' :
|
|
308
|
+
content.includes('\r') ? '\r' : '\n';
|
|
309
|
+
let result = content;
|
|
310
|
+
for (const match of sortedMatches) {
|
|
311
|
+
const beforeMatch = result.substring(0, match.startIndex);
|
|
312
|
+
const afterMatch = result.substring(match.endIndex);
|
|
313
|
+
// Convert line endings in newContent to match original
|
|
314
|
+
const newContentWithCorrectLineEndings = this.convertLineEndings(newContent, originalLineEnding);
|
|
315
|
+
const preservedReplacement = this.preserveIndentation(match.matchedContent, newContentWithCorrectLineEndings, originalLineEnding);
|
|
316
|
+
result = beforeMatch + preservedReplacement + afterMatch;
|
|
317
|
+
}
|
|
318
|
+
return result;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Preserves the indentation from the original content when applying the replacement
|
|
322
|
+
*/
|
|
323
|
+
preserveIndentation(originalContent, newContent, lineEnding) {
|
|
324
|
+
var _a, _b;
|
|
325
|
+
const originalLines = originalContent.split(/\r?\n/);
|
|
326
|
+
const newLines = newContent.split(/\r?\n/);
|
|
327
|
+
if (originalLines.length === 0 || newLines.length === 0) {
|
|
328
|
+
return newContent;
|
|
329
|
+
}
|
|
330
|
+
// Find first non-empty line in original to get base indentation
|
|
331
|
+
let originalBaseIndent = '';
|
|
332
|
+
let originalUseTabs = false;
|
|
333
|
+
for (const line of originalLines) {
|
|
334
|
+
if (line.trim().length > 0) {
|
|
335
|
+
originalBaseIndent = ((_a = line.match(/^\s*/)) === null || _a === void 0 ? void 0 : _a[0]) || '';
|
|
336
|
+
originalUseTabs = originalBaseIndent.includes('\t');
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
// Find first non-empty line in new content to get base indentation
|
|
341
|
+
let newBaseIndent = '';
|
|
342
|
+
for (const line of newLines) {
|
|
343
|
+
if (line.trim().length > 0) {
|
|
344
|
+
newBaseIndent = ((_b = line.match(/^\s*/)) === null || _b === void 0 ? void 0 : _b[0]) || '';
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
// Apply the indentation to all lines of new content
|
|
349
|
+
const result = newLines.map(line => {
|
|
350
|
+
var _a;
|
|
351
|
+
// Empty lines remain empty
|
|
352
|
+
if (line.trim().length === 0) {
|
|
353
|
+
return '';
|
|
354
|
+
}
|
|
355
|
+
// Get current line's indentation
|
|
356
|
+
const currentIndent = ((_a = line.match(/^\s*/)) === null || _a === void 0 ? void 0 : _a[0]) || '';
|
|
357
|
+
// Calculate relative indentation
|
|
358
|
+
let relativeIndent = currentIndent;
|
|
359
|
+
if (newBaseIndent.length > 0) {
|
|
360
|
+
// If the current line has at least the base indentation, preserve relative indentation
|
|
361
|
+
if (currentIndent.startsWith(newBaseIndent)) {
|
|
362
|
+
relativeIndent = currentIndent.substring(newBaseIndent.length);
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
// If current line has less indentation than base, use it as-is
|
|
366
|
+
relativeIndent = '';
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
// Convert spaces to tabs if original uses tabs
|
|
370
|
+
let convertedIndent = originalBaseIndent + relativeIndent;
|
|
371
|
+
if (originalUseTabs && !relativeIndent.includes('\t')) {
|
|
372
|
+
// Convert 4 spaces to 1 tab (common convention)
|
|
373
|
+
convertedIndent = convertedIndent.replace(/ /g, '\t');
|
|
374
|
+
}
|
|
375
|
+
// Apply converted indentation + trimmed content
|
|
376
|
+
return convertedIndent + line.trim();
|
|
377
|
+
});
|
|
378
|
+
return result.join(lineEnding);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Converts line endings in content to the specified line ending style
|
|
382
|
+
*/
|
|
383
|
+
convertLineEndings(content, lineEnding) {
|
|
384
|
+
// First normalize to LF
|
|
385
|
+
const normalized = content.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
386
|
+
// Then convert to target line ending
|
|
387
|
+
if (lineEnding === '\r\n') {
|
|
388
|
+
return normalized.replace(/\n/g, '\r\n');
|
|
389
|
+
}
|
|
390
|
+
else if (lineEnding === '\r') {
|
|
391
|
+
return normalized.replace(/\n/g, '\r');
|
|
392
|
+
}
|
|
393
|
+
return normalized;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Truncates content for error messages to avoid overly long error messages
|
|
397
|
+
*/
|
|
398
|
+
truncateForError(content, maxLength = 100) {
|
|
399
|
+
if (content.length <= maxLength) {
|
|
400
|
+
return content;
|
|
401
|
+
}
|
|
402
|
+
const half = Math.floor(maxLength / 2) - 3; // -3 for "..."
|
|
403
|
+
return content.substring(0, half) + '...' + content.substring(content.length - half);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
exports.ContentReplacerV2Impl = ContentReplacerV2Impl;
|
|
407
|
+
//# sourceMappingURL=content-replacer-v2-impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-replacer-v2-impl.js","sourceRoot":"","sources":["../../src/common/content-replacer-v2-impl.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAqBhF,MAAa,qBAAqB;IAC9B;;;;;OAKG;IACH,iBAAiB,CAAC,eAAuB,EAAE,YAA2B;QAClE,IAAI,cAAc,GAAG,eAAe,CAAC;QACrC,MAAM,aAAa,GAAa,EAAE,CAAC;QAEnC,0HAA0H;QAC1H,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;QAC9C,KAAK,MA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