@let-value/translate-extract 1.0.30 → 1.0.31

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.
@@ -1,212 +1,6 @@
1
- import { PluralFormsLocale } from "@let-value/translate";
2
- import { LogLevelNames, Logger } from "loglevel";
1
+ import { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeFn, Filter, LoadArgs, LoadHook, LoadResult, Logger, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, UniversalPlugin, UserConfig, cleanup$1 as cleanup, core$1 as core, defineConfig, po$1 as po, react$1 as react } from "../configuration-nsGqA5N9.cjs";
2
+ import "../core-CPg6_re5.cjs";
3
3
 
4
- //#region src/logger.d.ts
5
- type LogLevel = LogLevelNames;
6
- //#endregion
7
- //#region src/plugin.d.ts
8
- type MaybePromise<T> = T | Promise<T>;
9
- interface Context {
10
- config: ResolvedConfig;
11
- generatedAt: Date;
12
- logger?: Logger;
13
- }
14
- interface ResolveArgs<TInput = unknown> {
15
- entrypoint: string;
16
- path: string;
17
- namespace: string;
18
- data?: TInput;
19
- }
20
- interface ResolveResult<TInput = unknown> {
21
- entrypoint: string;
22
- path: string;
23
- namespace: string;
24
- data?: TInput;
25
- }
26
- interface LoadArgs<TInput = unknown> {
27
- entrypoint: string;
28
- path: string;
29
- namespace: string;
30
- data?: TInput;
31
- }
32
- interface LoadResult<TInput = unknown> {
33
- entrypoint: string;
34
- path: string;
35
- namespace: string;
36
- data: TInput;
37
- }
38
- interface ProcessArgs<TInput = unknown> {
39
- entrypoint: string;
40
- path: string;
41
- namespace: string;
42
- data: TInput;
43
- }
44
- interface ProcessResult<TOutput = unknown> {
45
- entrypoint: string;
46
- path: string;
47
- namespace: string;
48
- data: TOutput;
49
- }
50
- type Filter = {
51
- filter: RegExp;
52
- namespace?: string;
53
- };
54
- type ResolveHook<TInput = unknown> = (args: ResolveArgs<TInput>) => MaybePromise<ResolveResult<TInput> | undefined>;
55
- type LoadHook<TInput = unknown> = (args: LoadArgs<TInput>) => MaybePromise<LoadResult<TInput> | undefined>;
56
- type ProcessHook<TInput = unknown, TOutput = unknown> = (args: ProcessArgs<TInput>) => MaybePromise<ProcessResult<TOutput> | undefined>;
57
- interface Build<TInput = unknown, TOutput = unknown> {
58
- context: Context;
59
- resolve(args: ResolveArgs<unknown>): void;
60
- load(args: LoadArgs<unknown>): void;
61
- process(args: ProcessArgs<unknown>): void;
62
- defer(namespace: string): Promise<void>;
63
- onResolve(options: Filter, hook: ResolveHook<TInput>): void;
64
- onLoad(options: Filter, hook: LoadHook<TInput>): void;
65
- onProcess(options: Filter, hook: ProcessHook<TInput, TOutput>): void;
66
- }
67
- interface Plugin<TInput = unknown, TOutput = unknown> {
68
- name: string;
69
- setup(build: Build<TInput, TOutput>): void;
70
- }
71
- //#endregion
72
- //#region src/plugins/cleanup/cleanup.d.ts
73
- declare function cleanup(): Plugin;
74
- //#endregion
75
- //#region src/plugins/core/queries/types.d.ts
76
- interface Comments {
77
- translator?: string;
78
- reference?: string;
79
- extracted?: string;
80
- flag?: string;
81
- previous?: string;
82
- }
83
- interface Translation {
84
- context?: string;
85
- id: string;
86
- plural?: string;
87
- message: string[];
88
- comments?: Comments;
89
- obsolete?: boolean;
90
- }
91
- //#endregion
92
- //#region src/plugins/core/core.d.ts
93
- declare function core(): Plugin<string, Translation[]>;
94
- //#endregion
95
- //#region src/plugins/po/po.d.ts
96
- declare function po(): Plugin;
97
- //#endregion
98
- //#region src/configuration.d.ts
99
- type DestinationFn = (args: {
100
- locale: string;
101
- entrypoint: string;
102
- path: string;
103
- }) => string;
104
- type ExcludeFn = (args: {
105
- entrypoint: string;
106
- path: string;
107
- }) => boolean;
108
- type Exclude = RegExp | ExcludeFn;
109
- declare const defaultPlugins: {
110
- core: typeof core;
111
- po: typeof po;
112
- cleanup: typeof cleanup;
113
- };
114
- type DefaultPlugins = typeof defaultPlugins;
115
- /**
116
- * Strategy to handle obsolete translations in existing locale files:
117
- * - "mark": keep obsolete entries in the locale file but mark them as obsolete
118
- * - "remove": remove obsolete entries from the locale file
119
- */
120
- type ObsoleteStrategy = "mark" | "remove";
121
- interface EntrypointConfig {
122
- entrypoint: string;
123
- destination?: DestinationFn;
124
- obsolete?: ObsoleteStrategy;
125
- walk?: boolean;
126
- exclude?: Exclude | Exclude[];
127
- }
128
- interface UserConfig {
129
- /**
130
- * Default locale to use as the base for extraction
131
- * @default "en"
132
- * @see {@link PluralFormsLocale} for available locales
133
- */
134
- defaultLocale?: PluralFormsLocale;
135
- /**
136
- * Array of locales to extract translations for
137
- * @default [defaultLocale]
138
- * @see {@link PluralFormsLocale} for available locales
139
- */
140
- locales?: PluralFormsLocale[];
141
- /**
142
- * Array of plugins to use or a function to override the default plugins
143
- * @default DefaultPlugins
144
- * @see {@link DefaultPlugins} for available plugins
145
- */
146
- plugins?: Plugin[] | ((defaultPlugins: DefaultPlugins) => Plugin[]);
147
- /**
148
- * One or more entrypoints to extract translations from, could be:
149
- * - file path, will be treated as a single file entrypoint
150
- * - glob pattern will be expanded to match files, each treated as a separate entrypoint
151
- * - configuration object with options for the entrypoint
152
- * @see {@link EntrypointConfig} for configuration options
153
- */
154
- entrypoints: string | EntrypointConfig | Array<string | EntrypointConfig>;
155
- /**
156
- * Function to determine the destination path for each extracted locale file
157
- * @default `./translations/entrypoint.locale.po`
158
- * @see {@link DestinationFn}
159
- * @see Can be overridden per entrypoint via `destination` in {@link EntrypointConfig
160
- */
161
- destination?: DestinationFn;
162
- /**
163
- * Strategy to handle obsolete translations in existing locale files
164
- * @default "mark"
165
- * @see {@link ObsoleteStrategy} for available strategies
166
- * @see Can be overridden per entrypoint via `obsolete` in {@link EntrypointConfig
167
- */
168
- obsolete?: ObsoleteStrategy;
169
- /**
170
- * Whether to recursively walk dependencies of the entrypoints
171
- * @default true
172
- * @see Can be overridden per entrypoint via `walk` in {@link EntrypointConfig}.
173
- */
174
- walk?: boolean;
175
- /**
176
- * Paths or patterns to exclude from extraction, applied to all entrypoints
177
- * @default [/node_modules/, /dist/, /build/]
178
- * @see Can be overridden per entrypoint via `exclude` in {@link EntrypointConfig}.
179
- */
180
- exclude?: Exclude | Exclude[];
181
- /**
182
- * Log level for the extraction process
183
- * @default "info"
184
- */
185
- logLevel?: LogLevel;
186
- }
187
- interface ResolvedEntrypoint extends Omit<EntrypointConfig, "exclude"> {
188
- exclude?: Exclude[];
189
- }
190
- interface ResolvedConfig {
191
- plugins: Plugin[];
192
- entrypoints: ResolvedEntrypoint[];
193
- defaultLocale: string;
194
- locales: string[];
195
- destination: DestinationFn;
196
- obsolete: ObsoleteStrategy;
197
- walk: boolean;
198
- logLevel: LogLevel;
199
- exclude: Exclude[];
200
- }
201
- /**
202
- * Type helper to make it easier to use translate.config.ts
203
- * @param config - {@link UserConfig}.
204
- */
205
- declare function defineConfig(config: UserConfig): ResolvedConfig;
206
- //#endregion
207
- //#region src/plugins/react/react.d.ts
208
- declare function react(): Plugin<string, Translation[]>;
209
- //#endregion
210
4
  //#region src/run.d.ts
211
5
  type Task = {
212
6
  type: "resolve";
@@ -226,5 +20,5 @@ declare function run(entrypoint: ResolvedEntrypoint, {
226
20
  logger?: Logger;
227
21
  }): Promise<void>;
228
22
  //#endregion
229
- export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeFn, Filter, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, Task, UserConfig, cleanup, core, defineConfig, po, react, run };
23
+ export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeFn, Filter, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, Task, UniversalPlugin, UserConfig, cleanup, core, defineConfig, po, react, run };
230
24
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/logger.ts","../../src/plugin.ts","../../src/plugins/cleanup/cleanup.ts","../../src/plugins/core/queries/types.ts","../../src/plugins/core/core.ts","../../src/plugins/po/po.ts","../../src/configuration.ts","../../src/plugins/react/react.ts","../../src/run.ts"],"sourcesContent":[],"mappings":";;;;KAIY,QAAA,GAAW;;;KCDlB,kBAAkB,IAAI,QAAQ;UAElB,OAAA;EDDL,MAAA,ECEA,cDFW;eCGN;WACJ;;AALR,UAQY,WARA,CAAA,SAAA,OAAA,CAAA,CAAA;EAAA,UAAA,EAAA,MAAA;MAAM,EAAA,MAAA;WAAY,EAAA,MAAA;MAAR,CAAA,EAYhB,MAZgB;;AAEV,UAaA,aAbO,CAAA,SAAA,OAAA,CAAA,CAAA;EAAA,UAAA,EAAA,MAAA;MACZ,EAAA,MAAA;WACK,EAAA,MAAA;MACJ,CAAA,EAcF,MAdE;;AAGI,UAcA,QAdW,CAAA,SAIjB,OAAM,CAAA,CAAA;EAGA,UAAA,EAAA,MAAa;EAOb,IAAA,EAAA,MAAQ;EAOR,SAAA,EAAA,MAAU;EAOV,IAAA,CAAA,EAVN,MAUM;AAOjB;AAOY,UArBK,UAqBc,CAAA,SAAM,OAAA,CAAA,CAAA;EACzB,UAAA,EAAA,MAAW;EAAA,IAAA,EAAA,MAAA;WACD,EAAA,MAAA;MAAZ,EAnBA,MAmBA;;AACQ,UAjBD,WAiBC,CAAA,SAAA,OAAA,CAAA,CAAA;YAAb,EAAA,MAAA;EAAY,IAAA,EAAA,MAAA;EACL,SAAA,EAAQ,MAAA;EAAA,IAAA,EAdV,MAcU;;AAA4B,UAX/B,aAW+B,CAAA,UAAA,OAAA,CAAA,CAAA;YAA6C,EAAA,MAAA;MAAX,EAAA,MAAA;WAAb,EAAA,MAAA;EAAY,IAAA,EAPvE,OAOuE;AACjF;AAAuB,KALX,MAAA,GAKW;QACD,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,WAGS;;AAEnB,iBAFgB,GAAA,CAEhB,UAAA,EADU,kBACV,EAAA;EAAA,MAAA;EAAA;CAAA,EAAA;QAAQ,EAAoB,cAApB;QAAoB,CAAA,EAAyB,MAAzB;IAAiC,OAAR,CAAA,IAAA,CAAA"}
@@ -1,213 +1,6 @@
1
- import log, { LogLevelNames, Logger } from "loglevel";
2
- import Parser from "tree-sitter";
3
- import { PluralFormsLocale } from "@let-value/translate";
1
+ import { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeFn, Filter, LoadArgs, LoadHook, LoadResult, Logger, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, UniversalPlugin, UserConfig, cleanup$1 as cleanup, core$1 as core, defineConfig, po$1 as po, react$1 as react } from "../configuration-CFa8J7EM.js";
2
+ import "../core-ACuLoi2B.js";
4
3
 
5
- //#region src/logger.d.ts
6
- type LogLevel = LogLevelNames;
7
- //#endregion
8
- //#region src/plugin.d.ts
9
- type MaybePromise<T> = T | Promise<T>;
10
- interface Context {
11
- config: ResolvedConfig;
12
- generatedAt: Date;
13
- logger?: Logger;
14
- }
15
- interface ResolveArgs<TInput = unknown> {
16
- entrypoint: string;
17
- path: string;
18
- namespace: string;
19
- data?: TInput;
20
- }
21
- interface ResolveResult<TInput = unknown> {
22
- entrypoint: string;
23
- path: string;
24
- namespace: string;
25
- data?: TInput;
26
- }
27
- interface LoadArgs<TInput = unknown> {
28
- entrypoint: string;
29
- path: string;
30
- namespace: string;
31
- data?: TInput;
32
- }
33
- interface LoadResult<TInput = unknown> {
34
- entrypoint: string;
35
- path: string;
36
- namespace: string;
37
- data: TInput;
38
- }
39
- interface ProcessArgs<TInput = unknown> {
40
- entrypoint: string;
41
- path: string;
42
- namespace: string;
43
- data: TInput;
44
- }
45
- interface ProcessResult<TOutput = unknown> {
46
- entrypoint: string;
47
- path: string;
48
- namespace: string;
49
- data: TOutput;
50
- }
51
- type Filter = {
52
- filter: RegExp;
53
- namespace?: string;
54
- };
55
- type ResolveHook<TInput = unknown> = (args: ResolveArgs<TInput>) => MaybePromise<ResolveResult<TInput> | undefined>;
56
- type LoadHook<TInput = unknown> = (args: LoadArgs<TInput>) => MaybePromise<LoadResult<TInput> | undefined>;
57
- type ProcessHook<TInput = unknown, TOutput = unknown> = (args: ProcessArgs<TInput>) => MaybePromise<ProcessResult<TOutput> | undefined>;
58
- interface Build<TInput = unknown, TOutput = unknown> {
59
- context: Context;
60
- resolve(args: ResolveArgs<unknown>): void;
61
- load(args: LoadArgs<unknown>): void;
62
- process(args: ProcessArgs<unknown>): void;
63
- defer(namespace: string): Promise<void>;
64
- onResolve(options: Filter, hook: ResolveHook<TInput>): void;
65
- onLoad(options: Filter, hook: LoadHook<TInput>): void;
66
- onProcess(options: Filter, hook: ProcessHook<TInput, TOutput>): void;
67
- }
68
- interface Plugin<TInput = unknown, TOutput = unknown> {
69
- name: string;
70
- setup(build: Build<TInput, TOutput>): void;
71
- }
72
- //#endregion
73
- //#region src/plugins/cleanup/cleanup.d.ts
74
- declare function cleanup(): Plugin;
75
- //#endregion
76
- //#region src/plugins/core/queries/types.d.ts
77
- interface Comments {
78
- translator?: string;
79
- reference?: string;
80
- extracted?: string;
81
- flag?: string;
82
- previous?: string;
83
- }
84
- interface Translation {
85
- context?: string;
86
- id: string;
87
- plural?: string;
88
- message: string[];
89
- comments?: Comments;
90
- obsolete?: boolean;
91
- }
92
- //#endregion
93
- //#region src/plugins/core/core.d.ts
94
- declare function core(): Plugin<string, Translation[]>;
95
- //#endregion
96
- //#region src/plugins/po/po.d.ts
97
- declare function po(): Plugin;
98
- //#endregion
99
- //#region src/configuration.d.ts
100
- type DestinationFn = (args: {
101
- locale: string;
102
- entrypoint: string;
103
- path: string;
104
- }) => string;
105
- type ExcludeFn = (args: {
106
- entrypoint: string;
107
- path: string;
108
- }) => boolean;
109
- type Exclude = RegExp | ExcludeFn;
110
- declare const defaultPlugins: {
111
- core: typeof core;
112
- po: typeof po;
113
- cleanup: typeof cleanup;
114
- };
115
- type DefaultPlugins = typeof defaultPlugins;
116
- /**
117
- * Strategy to handle obsolete translations in existing locale files:
118
- * - "mark": keep obsolete entries in the locale file but mark them as obsolete
119
- * - "remove": remove obsolete entries from the locale file
120
- */
121
- type ObsoleteStrategy = "mark" | "remove";
122
- interface EntrypointConfig {
123
- entrypoint: string;
124
- destination?: DestinationFn;
125
- obsolete?: ObsoleteStrategy;
126
- walk?: boolean;
127
- exclude?: Exclude | Exclude[];
128
- }
129
- interface UserConfig {
130
- /**
131
- * Default locale to use as the base for extraction
132
- * @default "en"
133
- * @see {@link PluralFormsLocale} for available locales
134
- */
135
- defaultLocale?: PluralFormsLocale;
136
- /**
137
- * Array of locales to extract translations for
138
- * @default [defaultLocale]
139
- * @see {@link PluralFormsLocale} for available locales
140
- */
141
- locales?: PluralFormsLocale[];
142
- /**
143
- * Array of plugins to use or a function to override the default plugins
144
- * @default DefaultPlugins
145
- * @see {@link DefaultPlugins} for available plugins
146
- */
147
- plugins?: Plugin[] | ((defaultPlugins: DefaultPlugins) => Plugin[]);
148
- /**
149
- * One or more entrypoints to extract translations from, could be:
150
- * - file path, will be treated as a single file entrypoint
151
- * - glob pattern will be expanded to match files, each treated as a separate entrypoint
152
- * - configuration object with options for the entrypoint
153
- * @see {@link EntrypointConfig} for configuration options
154
- */
155
- entrypoints: string | EntrypointConfig | Array<string | EntrypointConfig>;
156
- /**
157
- * Function to determine the destination path for each extracted locale file
158
- * @default `./translations/entrypoint.locale.po`
159
- * @see {@link DestinationFn}
160
- * @see Can be overridden per entrypoint via `destination` in {@link EntrypointConfig
161
- */
162
- destination?: DestinationFn;
163
- /**
164
- * Strategy to handle obsolete translations in existing locale files
165
- * @default "mark"
166
- * @see {@link ObsoleteStrategy} for available strategies
167
- * @see Can be overridden per entrypoint via `obsolete` in {@link EntrypointConfig
168
- */
169
- obsolete?: ObsoleteStrategy;
170
- /**
171
- * Whether to recursively walk dependencies of the entrypoints
172
- * @default true
173
- * @see Can be overridden per entrypoint via `walk` in {@link EntrypointConfig}.
174
- */
175
- walk?: boolean;
176
- /**
177
- * Paths or patterns to exclude from extraction, applied to all entrypoints
178
- * @default [/node_modules/, /dist/, /build/]
179
- * @see Can be overridden per entrypoint via `exclude` in {@link EntrypointConfig}.
180
- */
181
- exclude?: Exclude | Exclude[];
182
- /**
183
- * Log level for the extraction process
184
- * @default "info"
185
- */
186
- logLevel?: LogLevel;
187
- }
188
- interface ResolvedEntrypoint extends Omit<EntrypointConfig, "exclude"> {
189
- exclude?: Exclude[];
190
- }
191
- interface ResolvedConfig {
192
- plugins: Plugin[];
193
- entrypoints: ResolvedEntrypoint[];
194
- defaultLocale: string;
195
- locales: string[];
196
- destination: DestinationFn;
197
- obsolete: ObsoleteStrategy;
198
- walk: boolean;
199
- logLevel: LogLevel;
200
- exclude: Exclude[];
201
- }
202
- /**
203
- * Type helper to make it easier to use translate.config.ts
204
- * @param config - {@link UserConfig}.
205
- */
206
- declare function defineConfig(config: UserConfig): ResolvedConfig;
207
- //#endregion
208
- //#region src/plugins/react/react.d.ts
209
- declare function react(): Plugin<string, Translation[]>;
210
- //#endregion
211
4
  //#region src/run.d.ts
212
5
  type Task = {
213
6
  type: "resolve";
@@ -227,5 +20,5 @@ declare function run(entrypoint: ResolvedEntrypoint, {
227
20
  logger?: Logger;
228
21
  }): Promise<void>;
229
22
  //#endregion
230
- export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeFn, Filter, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, Task, UserConfig, cleanup, core, defineConfig, po, react, run };
23
+ export { Build, Context, DestinationFn, EntrypointConfig, Exclude, ExcludeFn, Filter, LoadArgs, LoadHook, LoadResult, ObsoleteStrategy, Plugin, ProcessArgs, ProcessHook, ProcessResult, ResolveArgs, ResolveHook, ResolveResult, ResolvedConfig, ResolvedEntrypoint, Task, UniversalPlugin, UserConfig, cleanup, core, defineConfig, po, react, run };
231
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/logger.ts","../../src/plugin.ts","../../src/plugins/cleanup/cleanup.ts","../../src/plugins/core/queries/types.ts","../../src/plugins/core/core.ts","../../src/plugins/po/po.ts","../../src/configuration.ts","../../src/plugins/react/react.ts","../../src/run.ts"],"sourcesContent":[],"mappings":";;;;;KAIY,QAAA,GAAW;;;KCDlB,kBAAkB,IAAI,QAAQ;UAElB,OAAA;UACL;EDFA,WAAQ,ECGH,IDHG;WCIP;;UAGI;EARZ,UAAA,EAAA,MAAY;EAAA,IAAA,EAAA,MAAA;WAAM,EAAA,MAAA;MAAY,CAAA,EAYxB,MAZwB;;AAAD,UAejB,aAfiB,CAAA,SAAA,OAAA,CAAA,CAAA;EAEjB,UAAO,EAAA,MAAA;EAAA,IAAA,EAAA,MAAA;WACZ,EAAA,MAAA;MACK,CAAA,EAeN,MAfM;;AACE,UAiBF,QAjBE,CAAA,SAAA,OAAA,CAAA,CAAA;EAGF,UAAA,EAAA,MAAW;EAOX,IAAA,EAAA,MAAA;EAOA,SAAA,EAAQ,MAAA;EAOR,IAAA,CAAA,EAHN,MAGgB;AAO3B;AAOiB,UAdA,UAca,CAAA,SAIpB,OAAO,CAAA,CAAA;EAGL,UAAM,EAAA,MAAA;EACN,IAAA,EAAA,MAAA;EAAW,SAAA,EAAA,MAAA;MACD,EAnBZ,MAmBY;;AACU,UAjBf,WAiBe,CAAA,SAAA,OAAA,CAAA,CAAA;YAAd,EAAA,MAAA;MAAb,EAAA,MAAA;EAAY,SAAA,EAAA,MAAA;EACL,IAAA,EAdF,MAcU;;AAAqC,UAXxC,aAWwC,CAAA,UAAA,OAAA,CAAA,CAAA;YAAT,EAAA,MAAA;MAA6C,EAAA,MAAA;WAAX,EAAA,MAAA;MAAb,EAP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