tsconfig-migrate 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Shiro Wang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # tsconfig-migrate
2
+
3
+ Migrate the tsconfig compilerOptions to other transformer options.
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import migrate from "tsconfig-migrate/oxc.js";
9
+ import { transform } from "oxc-transform";
10
+
11
+ transform(fileName, code, migrate(compilerOptions));
12
+ ```
13
+
14
+ ```ts
15
+ import migrate from "tsconfig-migrate/swc.js";
16
+ import { transform } from "@swc/core";
17
+
18
+ transform(code, migrate(compilerOptions));
19
+ ```
@@ -0,0 +1,26 @@
1
+ type NullableOptions<T> = {
2
+ [P in keyof T]?: T[P] | null;
3
+ };
4
+ export type CompilerOptions = NullableOptions<{
5
+ target: string;
6
+ module: string;
7
+ experimentalDecorators: boolean;
8
+ emitDecoratorMetadata: boolean;
9
+ useDefineForClassFields: boolean;
10
+ esModuleInterop: boolean;
11
+ verbatimModuleSyntax: boolean;
12
+ importHelpers: boolean;
13
+ jsx: string;
14
+ jsxFactory: string;
15
+ jsxFragmentFactory: string;
16
+ jsxImportSource: string;
17
+ declaration: boolean;
18
+ declarationMap: boolean;
19
+ stripInternal: boolean;
20
+ sourceMap: boolean;
21
+ sourceRoot: string;
22
+ inlineSourceMap: boolean;
23
+ inlineSources: boolean;
24
+ }>;
25
+ export {};
26
+ //# sourceMappingURL=loose-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loose-types.d.ts","sourceRoot":"","sources":["src/loose-types.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;CAAE,CAAC;AAE3D,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IAEf,sBAAsB,EAAE,OAAO,CAAC;IAChC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,uBAAuB,EAAE,OAAO,CAAC;IACjC,eAAe,EAAE,OAAO,CAAC;IACzB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,OAAO,CAAC;IAEvB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IAExB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IAEvB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAAC"}
package/loose-types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=loose-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loose-types.js","sourceRoot":"","sources":["src/loose-types.ts"],"names":[],"mappings":""}
package/oxc.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { TransformOptions } from "oxc-transform";
2
+ import type { CompilerOptions } from "./loose-types.js";
3
+ declare const migrate: ({ target, declaration, declarationMap, sourceMap, jsx, jsxFactory, jsxFragmentFactory, jsxImportSource, experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields, stripInternal, }: CompilerOptions) => TransformOptions;
4
+ export default migrate;
5
+ //# sourceMappingURL=oxc.d.ts.map
package/oxc.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxc.d.ts","sourceRoot":"","sources":["src/oxc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA6D,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAiDxD,QAAA,MAAM,OAAO,GAAI,kMAad,eAAe,KAAG,gBAgBpB,CAAC;AAEF,eAAe,OAAO,CAAC"}
package/oxc.js ADDED
@@ -0,0 +1,51 @@
1
+ const normalizeDeclaration = ({ declaration, declarationMap, stripInternal, }) => {
2
+ if (declaration) {
3
+ return {
4
+ sourcemap: declarationMap,
5
+ stripInternal,
6
+ };
7
+ }
8
+ };
9
+ const normalizeDecorator = ({ experimentalDecorators, emitDecoratorMetadata, }) => {
10
+ const emitDecorator = experimentalDecorators !== null && experimentalDecorators !== undefined;
11
+ if (emitDecorator) {
12
+ return {
13
+ legacy: experimentalDecorators,
14
+ emitDecoratorMetadata: experimentalDecorators && emitDecoratorMetadata,
15
+ };
16
+ }
17
+ };
18
+ const normalizeJSX = ({ jsx, jsxFactory, jsxFragmentFactory, jsxImportSource, }) => {
19
+ if (!jsx) {
20
+ return;
21
+ }
22
+ if (jsx === "preserve" || jsx === "react-native") {
23
+ return "preserve";
24
+ }
25
+ return {
26
+ runtime: jsx === "react" ? "classic" : "automatic",
27
+ importSource: jsxImportSource,
28
+ pragmaFrag: jsxFragmentFactory,
29
+ pragma: jsxFactory,
30
+ development: jsx === "react-jsxdev",
31
+ };
32
+ };
33
+ const migrate = ({ target, declaration, declarationMap, sourceMap, jsx, jsxFactory, jsxFragmentFactory, jsxImportSource, experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields, stripInternal, }) => {
34
+ return {
35
+ target: target?.toLowerCase(),
36
+ sourcemap: sourceMap,
37
+ sourceType: "module",
38
+ assumptions: {
39
+ setPublicClassFields: !useDefineForClassFields,
40
+ },
41
+ jsx: normalizeJSX({ jsx, jsxFactory, jsxFragmentFactory, jsxImportSource }),
42
+ decorator: normalizeDecorator({ experimentalDecorators, emitDecoratorMetadata }),
43
+ typescript: {
44
+ removeClassFieldsWithoutInitializer: !useDefineForClassFields,
45
+ rewriteImportExtensions: true,
46
+ declaration: normalizeDeclaration({ declaration, declarationMap, stripInternal }),
47
+ },
48
+ };
49
+ };
50
+ export default migrate;
51
+ //# sourceMappingURL=oxc.js.map
package/oxc.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxc.js","sourceRoot":"","sources":["src/oxc.ts"],"names":[],"mappings":"AAGA,MAAM,oBAAoB,GAAG,CAAC,EAC5B,WAAW,EACX,cAAc,EACd,aAAa,GAC6D,EAA+B,EAAE;IAC3G,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO;YACL,SAAS,EAAE,cAAc;YACzB,aAAa;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,EAC1B,sBAAsB,EACtB,qBAAqB,GACqD,EAAgC,EAAE;IAC5G,MAAM,aAAa,GAAG,sBAAsB,KAA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mCAAmC,EAAE,CAAC,uBAAuB;YAC7D,uBAAuB,EAAE,IAAI;YAC7B,WAAW,EAAE,oBAAoB,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;SAClF;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "tsconfig-migrate",
3
+ "version": "0.0.0",
4
+ "description": "tsconfig migration",
5
+ "type": "module",
6
+ "scripts": {
7
+ "build": "tsc"
8
+ },
9
+ "devDependencies": {
10
+ "@swc/core": "^1.12.9",
11
+ "oxc-transform": "^0.75.1",
12
+ "typescript": "^5.8.3"
13
+ },
14
+ "exports": {
15
+ "./swc.js": "./swc.js",
16
+ "./oxc.js": "./oxc.js",
17
+ "./loose-types.js": {
18
+ "types": "./loose-types.d.js"
19
+ },
20
+ "./package.json": "./package.json"
21
+ },
22
+ "files": [
23
+ "**/*.{js,d.ts}+(|.map)",
24
+ "src"
25
+ ],
26
+ "keywords": [
27
+ "tsconfig"
28
+ ],
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/startracex/tsconfig-migrate.git"
32
+ },
33
+ "author": "startracex",
34
+ "license": "MIT",
35
+ "packageManager": "pnpm@10.12.4"
36
+ }
@@ -0,0 +1,27 @@
1
+ type NullableOptions<T> = { [P in keyof T]?: T[P] | null };
2
+
3
+ export type CompilerOptions = NullableOptions<{
4
+ target: string;
5
+ module: string;
6
+
7
+ experimentalDecorators: boolean;
8
+ emitDecoratorMetadata: boolean;
9
+ useDefineForClassFields: boolean;
10
+ esModuleInterop: boolean;
11
+ verbatimModuleSyntax: boolean;
12
+ importHelpers: boolean;
13
+
14
+ jsx: string; // "react" | "react-jsx" | "react-jsxdev" | "react-native" | "preserve"
15
+ jsxFactory: string;
16
+ jsxFragmentFactory: string;
17
+ jsxImportSource: string;
18
+
19
+ declaration: boolean;
20
+ declarationMap: boolean;
21
+ stripInternal: boolean;
22
+
23
+ sourceMap: boolean;
24
+ sourceRoot: string;
25
+ inlineSourceMap: boolean;
26
+ inlineSources: boolean;
27
+ }>;
package/src/oxc.ts ADDED
@@ -0,0 +1,82 @@
1
+ import type { DecoratorOptions, IsolatedDeclarationsOptions, JsxOptions, TransformOptions } from "oxc-transform";
2
+ import type { CompilerOptions } from "./loose-types.js";
3
+
4
+ const normalizeDeclaration = ({
5
+ declaration,
6
+ declarationMap,
7
+ stripInternal,
8
+ }: Pick<CompilerOptions, "declaration" | "declarationMap" | "stripInternal">): IsolatedDeclarationsOptions => {
9
+ if (declaration) {
10
+ return {
11
+ sourcemap: declarationMap,
12
+ stripInternal,
13
+ };
14
+ }
15
+ };
16
+
17
+ const normalizeDecorator = ({
18
+ experimentalDecorators,
19
+ emitDecoratorMetadata,
20
+ }: Pick<CompilerOptions, "experimentalDecorators" | "emitDecoratorMetadata">): DecoratorOptions | undefined => {
21
+ const emitDecorator = experimentalDecorators !== null && experimentalDecorators !== undefined;
22
+ if (emitDecorator) {
23
+ return {
24
+ legacy: experimentalDecorators,
25
+ emitDecoratorMetadata: experimentalDecorators && emitDecoratorMetadata,
26
+ };
27
+ }
28
+ };
29
+
30
+ const normalizeJSX = ({
31
+ jsx,
32
+ jsxFactory,
33
+ jsxFragmentFactory,
34
+ jsxImportSource,
35
+ }: Pick<CompilerOptions, "jsx" | "jsxFactory" | "jsxFragmentFactory" | "jsxImportSource">): "preserve" | JsxOptions | undefined => {
36
+ if (!jsx) {
37
+ return;
38
+ }
39
+ if (jsx === "preserve" || jsx === "react-native") {
40
+ return "preserve";
41
+ }
42
+ return {
43
+ runtime: jsx === "react" ? "classic" : "automatic",
44
+ importSource: jsxImportSource,
45
+ pragmaFrag: jsxFragmentFactory,
46
+ pragma: jsxFactory,
47
+ development: jsx === "react-jsxdev",
48
+ };
49
+ };
50
+
51
+ const migrate = ({
52
+ target,
53
+ declaration,
54
+ declarationMap,
55
+ sourceMap,
56
+ jsx,
57
+ jsxFactory,
58
+ jsxFragmentFactory,
59
+ jsxImportSource,
60
+ experimentalDecorators,
61
+ emitDecoratorMetadata,
62
+ useDefineForClassFields,
63
+ stripInternal,
64
+ }: CompilerOptions): TransformOptions => {
65
+ return {
66
+ target: target?.toLowerCase(),
67
+ sourcemap: sourceMap,
68
+ sourceType: "module",
69
+ assumptions: {
70
+ setPublicClassFields: !useDefineForClassFields,
71
+ },
72
+ jsx: normalizeJSX({ jsx, jsxFactory, jsxFragmentFactory, jsxImportSource }),
73
+ decorator: normalizeDecorator({ experimentalDecorators, emitDecoratorMetadata }),
74
+ typescript: {
75
+ removeClassFieldsWithoutInitializer: !useDefineForClassFields,
76
+ rewriteImportExtensions: true,
77
+ declaration: normalizeDeclaration({ declaration, declarationMap, stripInternal }),
78
+ },
79
+ };
80
+ };
81
+
82
+ export default migrate;
package/src/swc.ts ADDED
@@ -0,0 +1,89 @@
1
+ import type { CompilerOptions } from "./loose-types.js";
2
+ import type { JscTarget, ModuleConfig, Options, ReactConfig } from "@swc/core";
3
+
4
+ const normalizeJSX = ({
5
+ jsx,
6
+ jsxFactory,
7
+ jsxFragmentFactory,
8
+ jsxImportSource,
9
+ }: Pick<CompilerOptions, "jsx" | "jsxFactory" | "jsxFragmentFactory" | "jsxImportSource">): ReactConfig | undefined => {
10
+ if (!jsx || jsx === "preserve" || jsx === "react-native") {
11
+ return;
12
+ }
13
+ return {
14
+ runtime: jsx === "react" ? "classic" : "automatic",
15
+ importSource: jsxImportSource,
16
+ pragmaFrag: jsxFragmentFactory,
17
+ pragma: jsxFactory,
18
+ development: jsx === "react-jsxdev",
19
+ };
20
+ };
21
+
22
+ export const migrateOptions = ({
23
+ target,
24
+ sourceMap,
25
+ jsx,
26
+ jsxFactory,
27
+ jsxFragmentFactory,
28
+ jsxImportSource,
29
+ experimentalDecorators,
30
+ emitDecoratorMetadata,
31
+ useDefineForClassFields,
32
+ inlineSourceMap,
33
+ declaration,
34
+ sourceRoot,
35
+ inlineSources,
36
+ module,
37
+ esModuleInterop,
38
+ verbatimModuleSyntax,
39
+ importHelpers,
40
+ }: CompilerOptions): Options => {
41
+ let moduleType: ModuleConfig["type"] = "es6";
42
+
43
+ switch (module?.toLowerCase()) {
44
+ case "amd":
45
+ moduleType = "amd";
46
+ break;
47
+ case "system":
48
+ moduleType = "systemjs";
49
+ break;
50
+ case "umd":
51
+ moduleType = "umd";
52
+ break;
53
+ case "commonjs":
54
+ moduleType = "commonjs";
55
+ break;
56
+ }
57
+
58
+ const emitDecorator = experimentalDecorators !== null && experimentalDecorators !== undefined;
59
+ return {
60
+ module: {
61
+ type: moduleType,
62
+ importInterop: esModuleInterop ? "swc" : "none",
63
+ },
64
+ jsc: {
65
+ target: target?.toLowerCase() as JscTarget,
66
+ externalHelpers: importHelpers,
67
+ parser: {
68
+ syntax: "typescript",
69
+ tsx: !!jsx,
70
+ decorators: emitDecorator,
71
+ },
72
+ transform: {
73
+ decoratorMetadata: emitDecorator && experimentalDecorators && emitDecoratorMetadata,
74
+ decoratorVersion: emitDecorator ? (experimentalDecorators ? "2021-12" : "2022-03") : undefined,
75
+ legacyDecorator: emitDecorator ? experimentalDecorators : undefined,
76
+ useDefineForClassFields,
77
+ verbatimModuleSyntax: verbatimModuleSyntax,
78
+ react: normalizeJSX({ jsx, jsxFactory, jsxFragmentFactory, jsxImportSource }),
79
+ },
80
+ experimental: {
81
+ emitIsolatedDts: declaration,
82
+ },
83
+ },
84
+ sourceMaps: inlineSourceMap ? "inline" : sourceMap,
85
+ sourceRoot: sourceRoot,
86
+ inlineSourcesContent: inlineSources ?? true,
87
+ isModule: module !== "none",
88
+ };
89
+ };
package/swc.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { CompilerOptions } from "./loose-types.js";
2
+ import type { Options } from "@swc/core";
3
+ export declare const migrateOptions: ({ target, sourceMap, jsx, jsxFactory, jsxFragmentFactory, jsxImportSource, experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields, inlineSourceMap, declaration, sourceRoot, inlineSources, module, esModuleInterop, verbatimModuleSyntax, importHelpers, }: CompilerOptions) => Options;
4
+ //# sourceMappingURL=swc.d.ts.map
package/swc.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swc.d.ts","sourceRoot":"","sources":["src/swc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAA2B,OAAO,EAAe,MAAM,WAAW,CAAC;AAoB/E,eAAO,MAAM,cAAc,GAAI,6QAkB5B,eAAe,KAAG,OAiDpB,CAAC"}
package/swc.js ADDED
@@ -0,0 +1,61 @@
1
+ const normalizeJSX = ({ jsx, jsxFactory, jsxFragmentFactory, jsxImportSource, }) => {
2
+ if (!jsx || jsx === "preserve" || jsx === "react-native") {
3
+ return;
4
+ }
5
+ return {
6
+ runtime: jsx === "react" ? "classic" : "automatic",
7
+ importSource: jsxImportSource,
8
+ pragmaFrag: jsxFragmentFactory,
9
+ pragma: jsxFactory,
10
+ development: jsx === "react-jsxdev",
11
+ };
12
+ };
13
+ export const migrateOptions = ({ target, sourceMap, jsx, jsxFactory, jsxFragmentFactory, jsxImportSource, experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields, inlineSourceMap, declaration, sourceRoot, inlineSources, module, esModuleInterop, verbatimModuleSyntax, importHelpers, }) => {
14
+ let moduleType = "es6";
15
+ switch (module?.toLowerCase()) {
16
+ case "amd":
17
+ moduleType = "amd";
18
+ break;
19
+ case "system":
20
+ moduleType = "systemjs";
21
+ break;
22
+ case "umd":
23
+ moduleType = "umd";
24
+ break;
25
+ case "commonjs":
26
+ moduleType = "commonjs";
27
+ break;
28
+ }
29
+ const emitDecorator = experimentalDecorators !== null && experimentalDecorators !== undefined;
30
+ return {
31
+ module: {
32
+ type: moduleType,
33
+ importInterop: esModuleInterop ? "swc" : "none",
34
+ },
35
+ jsc: {
36
+ target: target?.toLowerCase(),
37
+ externalHelpers: importHelpers,
38
+ parser: {
39
+ syntax: "typescript",
40
+ tsx: !!jsx,
41
+ decorators: emitDecorator,
42
+ },
43
+ transform: {
44
+ decoratorMetadata: emitDecorator && experimentalDecorators && emitDecoratorMetadata,
45
+ decoratorVersion: emitDecorator ? (experimentalDecorators ? "2021-12" : "2022-03") : undefined,
46
+ legacyDecorator: emitDecorator ? experimentalDecorators : undefined,
47
+ useDefineForClassFields,
48
+ verbatimModuleSyntax: verbatimModuleSyntax,
49
+ react: normalizeJSX({ jsx, jsxFactory, jsxFragmentFactory, jsxImportSource }),
50
+ },
51
+ experimental: {
52
+ emitIsolatedDts: declaration,
53
+ },
54
+ },
55
+ sourceMaps: inlineSourceMap ? "inline" : sourceMap,
56
+ sourceRoot: sourceRoot,
57
+ inlineSourcesContent: inlineSources ?? true,
58
+ isModule: module !== "none",
59
+ };
60
+ };
61
+ //# sourceMappingURL=swc.js.map
package/swc.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swc.js","sourceRoot":"","sources":["src/swc.ts"],"names":[],"mappings":"AAGA,MAAM,YAAY,GAAG,CAAC,EACpB,GAAG,EACH,UAAU,EACV,kBAAkB,EAClB,eAAe,GACwE,EAA2B,EAAE;IACpH,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,cAAc,EAAE,CAAC;QACzD,OAAO;IACT,CAAC;IACD,OAAO;QACL,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;QAClD,YAAY,EAAE,eAAe;QAC7B,UAAU,EAAE,kBAAkB;QAC9B,MAAM,EAAE,UAAU;QAClB,WAAW,EAAE,GAAG,KAAK,cAAc;KACpC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,MAAM,EACN,SAAS,EACT,GAAG,EACH,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,eA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