@hardlydifficult/repo-processor 1.0.140 → 1.0.142

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,178 +1,260 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RepoProcessor = void 0;
4
+ exports.createRepoProcessorForTests = createRepoProcessorForTests;
4
5
  const collections_1 = require("@hardlydifficult/collections");
5
6
  const github_1 = require("@hardlydifficult/github");
6
7
  const text_1 = require("@hardlydifficult/text");
8
+ const GitYamlStore_js_1 = require("./GitYamlStore.js");
9
+ const RepoWatcher_js_1 = require("./RepoWatcher.js");
7
10
  const resolveDirectories_js_1 = require("./resolveDirectories.js");
8
- /**
9
- * Generic pipeline for incrementally processing a GitHub repo's file tree.
10
- *
11
- * Pipeline: init fetch tree filter → diff → process changed files →
12
- * remove deleted files → resolve stale dirs → process dirs bottom-up → commit.
13
- */
11
+ function parseRepoReference(value, label) {
12
+ const parsed = (0, github_1.parseGitHubRepoReference)(value);
13
+ if (parsed === null) {
14
+ throw new Error(`Invalid ${label}: ${value}. Expected "owner/repo" or a GitHub URL.`);
15
+ }
16
+ return {
17
+ owner: parsed.owner,
18
+ name: parsed.repo,
19
+ fullName: `${parsed.owner}/${parsed.repo}`,
20
+ };
21
+ }
22
+ function formatFailures(label, failures) {
23
+ const details = failures
24
+ .map((failure) => ` ${failure.path}: ${(0, text_1.getErrorMessage)(failure.reason)}`)
25
+ .join("\n");
26
+ return new Error(`${String(failures.length)} ${label} failed to process:\n${details}`);
27
+ }
28
+ /** Incrementally processes repository files/directories and stores derived results. */
14
29
  class RepoProcessor {
15
- github;
30
+ static open(options) {
31
+ const repo = parseRepoReference(options.repo, "repo");
32
+ const resultsRepo = parseRepoReference(options.results.repo, "results repo");
33
+ const githubToken = options.githubToken ?? process.env.GH_PAT ?? process.env.GITHUB_TOKEN;
34
+ const github = new github_1.GitHubClient({ token: githubToken });
35
+ const sourceRepo = github.repo(repo.fullName);
36
+ const { processDirectory } = options;
37
+ const store = new GitYamlStore_js_1.GitYamlStore({
38
+ sourceRepo: repo,
39
+ resultsRepo,
40
+ localPath: options.results.directory,
41
+ root: options.results.root ?? "repos",
42
+ branch: options.results.branch,
43
+ authToken: githubToken,
44
+ gitUser: options.results.gitUser,
45
+ });
46
+ return Promise.resolve(new RepoProcessor({
47
+ repo,
48
+ repoClient: {
49
+ getFileTree(ref) {
50
+ return sourceRepo.tree(ref);
51
+ },
52
+ getFileContent(filePath, ref) {
53
+ return sourceRepo.read(filePath, ref);
54
+ },
55
+ },
56
+ store,
57
+ ref: options.ref,
58
+ concurrency: options.concurrency ?? 5,
59
+ include: options.include ?? (() => true),
60
+ processFile: (input) => options.processFile(input),
61
+ processDirectory: processDirectory === undefined
62
+ ? undefined
63
+ : (input) => processDirectory(input),
64
+ }));
65
+ }
66
+ repoRef;
67
+ repoClient;
16
68
  store;
17
- callbacks;
69
+ ref;
18
70
  concurrency;
19
- branch;
20
- constructor(config) {
21
- this.github = config.githubClient;
22
- this.store = config.store;
23
- this.callbacks = config.callbacks;
24
- this.concurrency = config.concurrency ?? 5;
25
- this.branch = config.branch ?? "main";
71
+ include;
72
+ processFileHandler;
73
+ processDirectoryHandler;
74
+ constructor(internals) {
75
+ this.repoRef = internals.repo;
76
+ this.repoClient = internals.repoClient;
77
+ this.store = internals.store;
78
+ this.ref = internals.ref;
79
+ this.concurrency = internals.concurrency;
80
+ this.include = internals.include;
81
+ const { processDirectory } = internals;
82
+ this.processFileHandler = (input) => internals.processFile(input);
83
+ this.processDirectoryHandler =
84
+ processDirectory === undefined
85
+ ? undefined
86
+ : (input) => processDirectory(input);
87
+ }
88
+ get repo() {
89
+ return this.repoRef.fullName;
26
90
  }
27
- async run(owner, repo, onProgress) {
91
+ async run(options = {}) {
92
+ const { onProgress } = options;
28
93
  const emitProgress = (phase, message, filesTotal, filesCompleted, dirsTotal, dirsCompleted) => {
29
94
  onProgress?.({
30
95
  phase,
31
96
  message,
32
- filesTotal,
33
- filesCompleted,
34
- dirsTotal,
35
- dirsCompleted,
97
+ files: { total: filesTotal, completed: filesCompleted },
98
+ directories: { total: dirsTotal, completed: dirsCompleted },
36
99
  });
37
100
  };
38
- // 1. Init store
39
- emitProgress("loading", "Initializing store...", 0, 0, 0, 0);
40
- await this.store.ensureReady?.(owner, repo);
41
- // 2. Fetch tree
42
- emitProgress("loading", "Fetching file tree...", 0, 0, 0, 0);
43
- const { entries, rootSha } = await this.github
44
- .repo(owner, repo)
45
- .getFileTree();
101
+ emitProgress("loading", "Initializing results store...", 0, 0, 0, 0);
102
+ await this.store.ensureReady();
103
+ emitProgress("loading", "Fetching source tree...", 0, 0, 0, 0);
104
+ const { entries, rootSha } = await this.repoClient.getFileTree(this.ref);
46
105
  const tree = [
47
106
  ...entries,
48
107
  { path: "", type: "tree", sha: rootSha },
49
108
  ];
50
- // 3. Filter blobs
51
- const blobs = entries.filter((e) => e.type === "blob" && this.callbacks.shouldProcess(e));
52
- // 4. Diff
53
- const currentManifest = await this.store.getFileManifest(owner, repo);
109
+ const blobs = entries.filter((entry) => {
110
+ if (entry.type !== "blob") {
111
+ return false;
112
+ }
113
+ return this.include({
114
+ path: entry.path,
115
+ sha: entry.sha,
116
+ size: entry.size,
117
+ });
118
+ });
119
+ const currentManifest = await this.store.getFileManifest();
54
120
  const diff = (0, github_1.diffTree)(blobs, currentManifest);
55
121
  const filesTotal = diff.changedFiles.length;
56
122
  let filesCompleted = 0;
57
- emitProgress("files", `Processing ${String(filesTotal)} files...`, filesTotal, 0, diff.staleDirs.length, 0);
58
- // 5. Process changed files in batches
59
- const fileBatches = (0, collections_1.chunk)(diff.changedFiles, this.concurrency);
60
- for (const batch of fileBatches) {
123
+ emitProgress("files", filesTotal === 0
124
+ ? "No files to process."
125
+ : `Processing ${String(filesTotal)} files...`, filesTotal, 0, 0, 0);
126
+ const fileFailures = [];
127
+ for (const batch of (0, collections_1.inBatches)(diff.changedFiles, this.concurrency)) {
61
128
  const results = await Promise.allSettled(batch.map(async (entry) => {
62
- const content = await this.github
63
- .repo(owner, repo)
64
- .getFileContent(entry.path);
65
- const result = await this.callbacks.processFile({ entry, content });
66
- await this.store.writeFileResult(owner, repo, entry.path, entry.sha, result);
129
+ const content = await this.repoClient.getFileContent(entry.path, this.ref);
130
+ const result = await this.processFileHandler({
131
+ repo: this.repo,
132
+ path: entry.path,
133
+ sha: entry.sha,
134
+ content,
135
+ });
136
+ await this.store.writeFileResult(entry.path, entry.sha, result);
67
137
  }));
68
- const failures = [];
69
138
  let succeededCount = 0;
70
- for (let i = 0; i < results.length; i++) {
71
- const result = results[i];
139
+ for (let index = 0; index < results.length; index++) {
140
+ const result = results[index];
72
141
  filesCompleted++;
73
142
  if (result.status === "rejected") {
74
- failures.push({
75
- path: batch[i]?.path ?? `unknown-${String(i)}`,
143
+ fileFailures.push({
144
+ path: batch[index]?.path ?? `unknown-${String(index)}`,
76
145
  reason: result.reason,
77
146
  });
78
147
  }
79
148
  else {
80
149
  succeededCount++;
81
150
  }
82
- emitProgress("files", `Files: ${String(filesCompleted)}/${String(filesTotal)}`, filesTotal, filesCompleted, diff.staleDirs.length, 0);
83
- }
84
- if (failures.length > 0) {
85
- const details = failures
86
- .map((f) => ` ${f.path}: ${(0, text_1.getErrorMessage)(f.reason)}`)
87
- .join("\n");
88
- throw new Error(`${String(failures.length)} file(s) failed to process:\n${details}`);
151
+ emitProgress("files", `Files: ${String(filesCompleted)}/${String(filesTotal)}`, filesTotal, filesCompleted, 0, 0);
89
152
  }
90
153
  if (succeededCount > 0) {
91
- await this.store.commitBatch(owner, repo, succeededCount);
154
+ await this.store.commitBatch(this.repo, succeededCount);
92
155
  }
93
156
  }
94
- // 6. Remove deleted files
157
+ if (fileFailures.length > 0) {
158
+ throw formatFailures("file(s)", fileFailures);
159
+ }
95
160
  for (const removedPath of diff.removedFiles) {
96
- await this.store.deleteFileResult(owner, repo, removedPath);
161
+ await this.store.deleteFileResult(removedPath);
97
162
  }
98
163
  if (diff.removedFiles.length > 0) {
99
- await this.store.commitBatch(owner, repo, diff.removedFiles.length);
164
+ await this.store.commitBatch(this.repo, diff.removedFiles.length);
100
165
  }
101
- // 7. Resolve stale directories
102
- const allFilePaths = blobs.map((b) => b.path);
103
- const allDirs = await (0, resolveDirectories_js_1.resolveStaleDirectories)(owner, repo, diff.staleDirs, allFilePaths, tree, this.store);
104
166
  let dirsCompleted = 0;
105
- if (allDirs.length > 0) {
106
- emitProgress("directories", `Processing ${String(allDirs.length)} directories...`, filesTotal, filesCompleted, allDirs.length, 0);
107
- // 8. Process directories bottom-up by depth
108
- const depthGroups = (0, collections_1.groupByDepth)(allDirs);
109
- for (const { paths: dirsAtDepth } of depthGroups) {
110
- const batches = (0, collections_1.chunk)(dirsAtDepth, this.concurrency);
111
- let dirsInDepthGroup = 0;
112
- for (const batch of batches) {
167
+ if (this.processDirectoryHandler !== undefined) {
168
+ const allFilePaths = blobs.map((blob) => blob.path);
169
+ const allDirs = await (0, resolveDirectories_js_1.resolveStaleDirectories)(diff.staleDirs, allFilePaths, tree, this.store);
170
+ emitProgress("directories", allDirs.length === 0
171
+ ? "No directories to process."
172
+ : `Processing ${String(allDirs.length)} directories...`, filesTotal, filesCompleted, allDirs.length, 0);
173
+ const directoryFailures = [];
174
+ for (const dirsAtDepth of (0, collections_1.bottomUp)(allDirs)) {
175
+ let succeededCount = 0;
176
+ for (const batch of (0, collections_1.inBatches)(dirsAtDepth, this.concurrency)) {
113
177
  const results = await Promise.allSettled(batch.map(async (dirPath) => {
114
- const ctx = this.buildDirectoryContext(dirPath, tree, allFilePaths);
115
- const result = await this.callbacks.processDirectory(ctx);
116
- await this.store.writeDirResult(owner, repo, dirPath, ctx.sha, result);
178
+ const directory = this.buildDirectoryInput(dirPath, tree, allFilePaths);
179
+ const result = await this.processDirectoryHandler?.(directory);
180
+ await this.store.writeDirResult(dirPath, directory.sha, result);
117
181
  }));
118
- const failures = [];
119
- for (let i = 0; i < results.length; i++) {
120
- const result = results[i];
182
+ for (let index = 0; index < results.length; index++) {
183
+ const result = results[index];
121
184
  dirsCompleted++;
122
- dirsInDepthGroup++;
123
185
  if (result.status === "rejected") {
124
- failures.push({
125
- path: batch[i] ?? `unknown-${String(i)}`,
186
+ directoryFailures.push({
187
+ path: batch[index] ?? `unknown-${String(index)}`,
126
188
  reason: result.reason,
127
189
  });
128
190
  }
129
- emitProgress("directories", `Dirs: ${String(dirsCompleted)}/${String(allDirs.length)}`, filesTotal, filesCompleted, allDirs.length, dirsCompleted);
130
- }
131
- if (failures.length > 0) {
132
- const details = failures
133
- .map((f) => ` ${f.path}: ${(0, text_1.getErrorMessage)(f.reason)}`)
134
- .join("\n");
135
- throw new Error(`${String(failures.length)} directory(ies) failed to process:\n${details}`);
191
+ else {
192
+ succeededCount++;
193
+ }
194
+ emitProgress("directories", `Directories: ${String(dirsCompleted)}/${String(allDirs.length)}`, filesTotal, filesCompleted, allDirs.length, dirsCompleted);
136
195
  }
137
196
  }
138
- if (dirsInDepthGroup > 0) {
139
- await this.store.commitBatch(owner, repo, dirsInDepthGroup);
197
+ if (succeededCount > 0) {
198
+ await this.store.commitBatch(this.repo, succeededCount);
140
199
  }
141
200
  }
201
+ if (directoryFailures.length > 0) {
202
+ throw formatFailures("directory(ies)", directoryFailures);
203
+ }
142
204
  }
143
- // 9. Final safety commit
144
- emitProgress("committing", "Final commit...", filesTotal, filesCompleted, allDirs.length, dirsCompleted);
145
- await this.store.commitBatch(owner, repo, 0);
205
+ emitProgress("committing", "Finalizing results...", filesTotal, filesCompleted, this.processDirectoryHandler === undefined ? 0 : dirsCompleted, dirsCompleted);
206
+ await this.store.commitBatch(this.repo, 0);
146
207
  return {
147
- filesProcessed: filesCompleted,
148
- filesRemoved: diff.removedFiles.length,
149
- dirsProcessed: dirsCompleted,
208
+ repo: this.repo,
209
+ sourceSha: rootSha,
210
+ processedFiles: filesCompleted,
211
+ removedFiles: diff.removedFiles.length,
212
+ processedDirectories: dirsCompleted,
150
213
  };
151
214
  }
152
- buildDirectoryContext(dirPath, tree, allFilePaths) {
153
- const dirTreeEntry = tree.find((e) => e.type === "tree" && e.path === dirPath);
154
- const sha = dirTreeEntry?.sha ?? "";
215
+ async readFileResult(filePath, schema) {
216
+ return this.store.readFileResult(filePath, schema);
217
+ }
218
+ async readDirectoryResult(dirPath, schema) {
219
+ return this.store.readDirectoryResult(dirPath, schema);
220
+ }
221
+ async watch(options = {}) {
222
+ return RepoWatcher_js_1.RepoWatcher.open(this, options);
223
+ }
224
+ buildDirectoryInput(dirPath, tree, allFilePaths) {
225
+ const dirTreeEntry = tree.find((entry) => entry.type === "tree" && entry.path === dirPath);
155
226
  const prefix = dirPath === "" ? "" : `${dirPath}/`;
156
- const subtreeFilePaths = allFilePaths.filter((fp) => dirPath === "" || fp.startsWith(prefix));
157
- // Build immediate children list
227
+ const files = allFilePaths.filter((filePath) => dirPath === "" || filePath.startsWith(prefix));
158
228
  const seen = new Set();
159
229
  const children = [];
160
- for (const fp of subtreeFilePaths) {
161
- const relative = prefix ? fp.slice(prefix.length) : fp;
230
+ for (const filePath of files) {
231
+ const relative = prefix === "" ? filePath : filePath.slice(prefix.length);
162
232
  const slashIndex = relative.indexOf("/");
163
- const isDir = slashIndex !== -1;
164
- const childName = isDir ? relative.slice(0, slashIndex) : relative;
165
- if (!seen.has(childName)) {
166
- seen.add(childName);
167
- children.push({
168
- name: childName,
169
- isDir,
170
- fullPath: dirPath === "" ? childName : `${dirPath}/${childName}`,
171
- });
233
+ const isDirectory = slashIndex !== -1;
234
+ const childName = isDirectory ? relative.slice(0, slashIndex) : relative;
235
+ if (seen.has(childName)) {
236
+ continue;
172
237
  }
238
+ seen.add(childName);
239
+ children.push({
240
+ name: childName,
241
+ path: dirPath === "" ? childName : `${dirPath}/${childName}`,
242
+ type: isDirectory ? "directory" : "file",
243
+ });
173
244
  }
174
- return { path: dirPath, sha, subtreeFilePaths, children, tree };
245
+ return {
246
+ repo: this.repo,
247
+ path: dirPath,
248
+ sha: dirTreeEntry?.sha ?? "",
249
+ files,
250
+ children,
251
+ };
175
252
  }
176
253
  }
177
254
  exports.RepoProcessor = RepoProcessor;
255
+ /** Creates a RepoProcessor instance using test doubles for internal dependencies. */
256
+ function createRepoProcessorForTests(internals) {
257
+ const RepoProcessorCtor = RepoProcessor;
258
+ return new RepoProcessorCtor(internals);
259
+ }
178
260
  //# sourceMappingURL=RepoProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RepoProcessor.js","sourceRoot":"","sources":["../src/RepoProcessor.ts"],"names":[],"mappings":";;;AAAA,8DAAmE;AACnE,oDAIiC;AACjC,gDAAwD;AAExD,mEAAkE;AAmBlE;;;;;GAKG;AACH,MAAa,aAAa;IACP,MAAM,CAAe;IACrB,KAAK,CAAiB;IACtB,SAAS,CAAqB;IAC9B,WAAW,CAAS;IACpB,MAAM,CAAS;IAEhC,YAAY,MAA2B;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,GAAG,CACP,KAAa,EACb,IAAY,EACZ,UAA6B;QAE7B,MAAM,YAAY,GAAG,CACnB,KAAkC,EAClC,OAAe,EACf,UAAkB,EAClB,cAAsB,EACtB,SAAiB,EACjB,aAAqB,EACf,EAAE;YACR,UAAU,EAAE,CAAC;gBACX,KAAK;gBACL,OAAO;gBACP,UAAU;gBACV,cAAc;gBACd,SAAS;gBACT,aAAa;aACd,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,gBAAgB;QAChB,YAAY,CAAC,SAAS,EAAE,uBAAuB,EAAE,CAAC,EAAE,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G,IAAI,EAAE;YAC5B,KAAK;YACL,QAAQ;SACT,CAAC;IACJ,CAAC;CACF;AA3WD,sCA2WC;AAMD,qFAAqF;AACrF,SAAgB,2BAA2B,CAIzC,SAA0D;IAE1D,MAAM,iBAAiB,GAAG,aAGzB,CAAC;IACF,OAAO,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,68 +1,25 @@
1
- import { type StateTrackerEvent, type StorageAdapter } from "@hardlydifficult/state-tracker";
2
- export interface RepoWatcherConfig<TResult> {
3
- /** Key used for persisting state to disk or adapter. */
4
- stateKey: string;
5
- /** Directory where state is persisted (not needed when storageAdapter is provided). */
6
- stateDirectory?: string;
7
- /** Custom storage adapter (takes priority over stateDirectory). */
8
- storageAdapter?: StorageAdapter;
9
- /** Auto-save interval in milliseconds. Default 5000. */
10
- autoSaveMs?: number;
11
- /** The work to run for a repo. */
12
- run: (owner: string, name: string) => Promise<TResult>;
13
- /** Called after a successful run. */
14
- onComplete?: (owner: string, name: string, result: TResult, sha: string) => void;
15
- /** Called when a run fails. */
16
- onError?: (owner: string, name: string, error: unknown) => void;
17
- /** Logger/event callback. */
18
- onEvent?: (event: StateTrackerEvent) => void;
19
- /** Number of attempts (initial + retries). Default 1 (no retry). */
20
- maxAttempts?: number;
21
- }
22
- /**
23
- * Watches for SHA changes on GitHub repos and triggers processing.
24
- *
25
- * Handles state persistence (last-processed SHA per repo), concurrent run
26
- * prevention, pending SHA re-triggers, and manual triggers. Consumers
27
- * provide the `run` callback containing domain-specific logic.
28
- */
29
- export declare class RepoWatcher<TResult = void> {
1
+ import type { RepoProcessor } from "./RepoProcessor.js";
2
+ import type { RepoProcessorRunResult, RepoWatcherOptions } from "./types.js";
3
+ /** Watches for repository updates and schedules processor runs with retries. */
4
+ export declare class RepoWatcher<TFileResult = unknown, TDirResult = never> {
5
+ static open<TFileResult, TDirResult>(processor: RepoProcessor<TFileResult, TDirResult>, options?: RepoWatcherOptions): Promise<RepoWatcher<TFileResult, TDirResult>>;
6
+ private readonly processor;
30
7
  private readonly stateTracker;
31
- private readonly running;
32
- private readonly pendingSha;
33
- private readonly config;
8
+ private readonly onComplete;
9
+ private readonly onError;
10
+ private readonly onEvent;
34
11
  private readonly maxAttempts;
35
- constructor(config: RepoWatcherConfig<TResult>);
36
- /** Load persisted state from disk. */
37
- init(): Promise<void>;
38
- /**
39
- * Handle a push event. Compares the SHA against tracked state,
40
- * queues processing if changed, stores as pending if already running.
41
- */
42
- handlePush(owner: string, name: string, sha: string): void;
43
- /**
44
- * Queue a run unconditionally (no SHA comparison).
45
- * Skips if already running. Returns false if skipped.
46
- */
47
- trigger(owner: string, name: string): boolean;
48
- /**
49
- * Run processing synchronously (blocks until complete).
50
- * Returns an error if already running.
51
- */
52
- triggerManual(owner: string, name: string): Promise<{
53
- success: true;
54
- result: TResult;
55
- } | {
56
- success: false;
57
- reason: string;
58
- }>;
59
- /** Check if a repo is currently being processed. */
60
- isRunning(owner: string, name: string): boolean;
61
- /** Get the last processed SHA for a repo key. */
62
- getLastSha(key: string): string | undefined;
63
- /** Persist a processed SHA for a repo key. */
64
- setLastSha(key: string, sha: string): void;
12
+ private running;
13
+ private pendingSha;
14
+ private constructor();
15
+ handlePush(sha: string): void;
16
+ runNow(): Promise<RepoProcessorRunResult>;
17
+ isRunning(): boolean;
18
+ getLastSha(): string | undefined;
19
+ setLastSha(sha: string): void;
65
20
  private queueRun;
21
+ private completeRun;
22
+ private flushPendingRun;
66
23
  private executeWithRetry;
67
24
  }
68
25
  //# sourceMappingURL=RepoWatcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RepoWatcher.d.ts","sourceRoot":"","sources":["../src/RepoWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AAExC,MAAM,WAAW,iBAAiB,CAAC,OAAO;IACxC,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;I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