@uipath/solution-sdk 1.204.0 → 1.205.0-preview.258

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.
Files changed (29) hide show
  1. package/dist/THIRD-PARTY-NOTICES.md +2 -2
  2. package/dist/deployment-search.js +182 -0
  3. package/dist/{embedded-file-reader-rf2g1kfj.js → embedded-file-reader-z4becc02.js} +2 -2
  4. package/dist/index-78paj2kz.js +1908 -0
  5. package/dist/index-cs3g624n.js +28 -0
  6. package/dist/index-eav127tv.js +3004 -0
  7. package/dist/{index-fb21bjwj.js → index-enc2hqq5.js} +255 -1409
  8. package/dist/{index-6gp5j7j5.js → index-hkexw5er.js} +193 -118
  9. package/dist/{index-g0hcxnae.js → index-y4vgqz1w.js} +11 -1
  10. package/dist/index-zmneg45c.js +1184 -0
  11. package/dist/index.js +1551 -4214
  12. package/dist/package-search.js +105 -0
  13. package/dist/resources/index.js +1183 -1177
  14. package/dist/solution-auth.js +4 -3
  15. package/dist/src/deployment-search.d.ts +104 -0
  16. package/dist/src/legacy-deployment-search-v3.d.ts +24 -0
  17. package/dist/src/legacy-package-search.d.ts +25 -0
  18. package/dist/src/package-search.d.ts +41 -0
  19. package/dist/src/pipelines-route.d.ts +43 -0
  20. package/dist/src/resources/index.d.ts +3 -0
  21. package/dist/src/resources/providers/artefact-pair-binding-provider.d.ts +4 -0
  22. package/dist/src/resources/services/catalog-lookup-failure.d.ts +50 -0
  23. package/dist/src/resources/services/remote-resources.d.ts +2 -0
  24. package/dist/src/resources/services/resource-configurations.d.ts +44 -0
  25. package/dist/src/resources/services/resource-lookup.d.ts +29 -0
  26. package/dist/src/resources/services/resource-refresh-service.d.ts +13 -0
  27. package/dist/src/resources/services/sync-resources-from-bindings.d.ts +43 -6
  28. package/dist/src/zip-utils.d.ts +5 -0
  29. package/package.json +10 -2
@@ -0,0 +1,1184 @@
1
+ import {
2
+ catchError,
3
+ logger,
4
+ quoteForShell,
5
+ unsupportedSolutionProjectType
6
+ } from "./index-enc2hqq5.js";
7
+
8
+ // src/solution-file.ts
9
+ var STUDIO_WEB_PROJECT_TYPE_OVERRIDES = {
10
+ ProcessOrchestration: "processOrchestration"
11
+ };
12
+ function normalizeProjectType(projectType) {
13
+ return STUDIO_WEB_PROJECT_TYPE_OVERRIDES[projectType] ?? projectType;
14
+ }
15
+ function toPortableRelativePath(relativePath) {
16
+ return relativePath.replace(/\\/g, "/");
17
+ }
18
+ async function readUipxFile(fs, solutionDir) {
19
+ const dirEntries = await fs.readdir(solutionDir);
20
+ const uipxFileName = dirEntries.find((f) => f.endsWith(".uipx"));
21
+ if (!uipxFileName) {
22
+ throw new Error(`No .uipx file found in ${solutionDir}. Run 'uip solution init' first.`);
23
+ }
24
+ const uipxContent = await fs.readFile(fs.path.join(solutionDir, uipxFileName), "utf-8");
25
+ if (!uipxContent) {
26
+ throw new Error(`Could not read .uipx file: ${uipxFileName} is empty or missing.`);
27
+ }
28
+ const [parseError, parsed] = catchError(() => JSON.parse(uipxContent));
29
+ if (parseError) {
30
+ throw new Error(`Invalid .uipx file: could not parse JSON in ${uipxFileName}.`);
31
+ }
32
+ const uipx = validateUipxFile(parsed, uipxFileName);
33
+ return { uipx, uipxFileName };
34
+ }
35
+ function validateUipxFile(parsed, uipxFileName) {
36
+ if (!isRecord(parsed)) {
37
+ throw new Error(`Invalid .uipx file: ${uipxFileName} must contain a JSON object.`);
38
+ }
39
+ if (typeof parsed.SolutionId !== "string" || !parsed.SolutionId.trim()) {
40
+ throw new Error("Invalid .uipx file: missing SolutionId.");
41
+ }
42
+ if (!Array.isArray(parsed.Projects) || parsed.Projects.length === 0) {
43
+ throw new Error("Invalid .uipx file: missing Projects.");
44
+ }
45
+ for (const [index, project] of parsed.Projects.entries()) {
46
+ if (!isRecord(project)) {
47
+ throw new Error(`Invalid .uipx file: Projects[${index}] must be an object.`);
48
+ }
49
+ if (typeof project.ProjectRelativePath !== "string" || !project.ProjectRelativePath.trim()) {
50
+ const pathHint = typeof project.Path === "string" ? " Found Path, but .uipx uses ProjectRelativePath." : "";
51
+ throw new Error(`Invalid .uipx file: Projects[${index}] is missing ProjectRelativePath.${pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`);
52
+ }
53
+ }
54
+ return parsed;
55
+ }
56
+ function isRecord(value) {
57
+ return typeof value === "object" && value !== null && !Array.isArray(value);
58
+ }
59
+ async function createSolutionManifest(fs, solutionDir, solutionName, options = {}) {
60
+ const resolvedDir = fs.path.resolve(solutionDir);
61
+ if (!(options.allowExistingDir && await fs.exists(resolvedDir))) {
62
+ await fs.mkdir(resolvedDir);
63
+ }
64
+ const solutionId = crypto.randomUUID();
65
+ const manifest = {
66
+ DocVersion: "1.0.0",
67
+ StudioMinVersion: "2025.10.0",
68
+ SolutionId: solutionId,
69
+ Projects: []
70
+ };
71
+ const solutionFile = fs.path.join(resolvedDir, `${solutionName}.uipx`);
72
+ await fs.writeFile(solutionFile, `${JSON.stringify(manifest, null, 2)}
73
+ `);
74
+ return {
75
+ solutionDir: resolvedDir,
76
+ solutionFile,
77
+ solutionId
78
+ };
79
+ }
80
+ var AUTO_SOLUTION_SUFFIX = "Solution";
81
+ async function autoScaffoldSolution(fs, baseDir, projectName) {
82
+ const solutionName = `${projectName}${AUTO_SOLUTION_SUFFIX}`;
83
+ const solutionDir = fs.path.resolve(baseDir, solutionName);
84
+ const expectedSolutionFile = fs.path.join(solutionDir, `${solutionName}.uipx`);
85
+ if (await fs.exists(expectedSolutionFile)) {
86
+ return {
87
+ Name: solutionName,
88
+ Path: solutionDir,
89
+ SolutionFile: expectedSolutionFile
90
+ };
91
+ }
92
+ const { solutionFile } = await createSolutionManifest(fs, solutionDir, solutionName, { allowExistingDir: true });
93
+ return {
94
+ Name: solutionName,
95
+ Path: solutionDir,
96
+ SolutionFile: solutionFile
97
+ };
98
+ }
99
+ async function prepareProjectLocation(fs, candidateProjectDir, projectName, options = {}) {
100
+ const resolved = fs.path.resolve(candidateProjectDir);
101
+ if (options.skipRegistration) {
102
+ return { projectDir: resolved };
103
+ }
104
+ const discovery = await findNearestParentUipxFile(fs, resolved);
105
+ if (discovery.status !== "notFound") {
106
+ return { projectDir: resolved };
107
+ }
108
+ const baseDir = fs.path.dirname(resolved);
109
+ const autoCreatedSolution = await autoScaffoldSolution(fs, baseDir, projectName);
110
+ const projectDir = fs.path.join(autoCreatedSolution.Path, projectName);
111
+ await warnIfCandidateDirShadowed(fs, resolved, projectDir);
112
+ return { projectDir, autoCreatedSolution };
113
+ }
114
+ async function warnIfCandidateDirShadowed(fs, candidateDir, projectDir) {
115
+ const [, exists] = await catchError(fs.exists(candidateDir));
116
+ if (!exists) {
117
+ return;
118
+ }
119
+ const [, entries] = await catchError(fs.readdir(candidateDir));
120
+ if (!entries || entries.length === 0) {
121
+ return;
122
+ }
123
+ logger.warn(`An existing directory "${candidateDir}" was left untouched. ` + `The project was created inside the auto-created solution at "${projectDir}". ` + "Run init from inside an existing solution, or pass --skip-solution-registration, if you meant to use the existing directory.");
124
+ }
125
+ function resolveSolutionDir(fs, inputPath) {
126
+ const resolved = fs.path.resolve(inputPath);
127
+ if (resolved.endsWith(".uipx")) {
128
+ return fs.path.dirname(resolved);
129
+ }
130
+ return resolved;
131
+ }
132
+ async function updateUipxSolutionId(fs, uipxPath, newSolutionId) {
133
+ const [readError, content] = await catchError(fs.readFile(uipxPath, "utf-8"));
134
+ if (readError || !content) {
135
+ logger.error(`Could not read .uipx file for update: ${readError?.message ?? "empty file"}`);
136
+ return;
137
+ }
138
+ const [parseError, parsed] = catchError(() => JSON.parse(content));
139
+ if (parseError) {
140
+ logger.error(`Could not parse .uipx file for update: ${parseError.message}`);
141
+ return;
142
+ }
143
+ parsed.SolutionId = newSolutionId;
144
+ const [writeError] = await catchError(fs.writeFile(uipxPath, JSON.stringify(parsed, null, 4)));
145
+ if (writeError) {
146
+ logger.error(`Could not update .uipx with new SolutionId: ${writeError.message}`);
147
+ } else {
148
+ logger.info(`Updated .uipx with Studio Web SolutionId: ${newSolutionId}`);
149
+ }
150
+ }
151
+ async function findSolutionFile(fs, projectPath) {
152
+ const parentDir = fs.path.resolve(projectPath, "..");
153
+ const [dirError, entries] = await catchError(fs.readdir(parentDir));
154
+ if (dirError) {
155
+ logger.error(`Could not read parent directory for .uipx file: ${dirError.message}`);
156
+ return;
157
+ }
158
+ const uipxFile = entries.find((entry) => entry.endsWith(".uipx"));
159
+ if (!uipxFile) {
160
+ logger.info("No .uipx solution file found in parent directory.");
161
+ return;
162
+ }
163
+ const uipxPath = fs.path.join(parentDir, uipxFile);
164
+ const [readError, content] = await catchError(fs.readFile(uipxPath, "utf-8"));
165
+ if (readError || content === null) {
166
+ logger.error(`Could not read .uipx file: ${readError?.message ?? "file returned null"}`);
167
+ return;
168
+ }
169
+ const [parseError, parsed] = catchError(() => JSON.parse(content));
170
+ if (parseError) {
171
+ logger.error(`Could not parse .uipx file: ${parseError.message}`);
172
+ return;
173
+ }
174
+ const solutionId = parsed.SolutionId;
175
+ const projectId = parsed.Projects?.[0]?.Id;
176
+ if (!solutionId) {
177
+ logger.info("No SolutionId found in .uipx file.");
178
+ return;
179
+ }
180
+ logger.info(`Found solution file: ${uipxFile} (SolutionId: ${solutionId})`);
181
+ return {
182
+ solutionId,
183
+ projectId: projectId ?? crypto.randomUUID()
184
+ };
185
+ }
186
+ async function updateSolutionFile(fs, projectPath, newSolutionId) {
187
+ const parentDir = fs.path.resolve(projectPath, "..");
188
+ const [dirError, entries] = await catchError(fs.readdir(parentDir));
189
+ if (dirError)
190
+ return;
191
+ const uipxFile = entries.find((entry) => entry.endsWith(".uipx"));
192
+ if (!uipxFile)
193
+ return;
194
+ const uipxPath = fs.path.join(parentDir, uipxFile);
195
+ await updateUipxSolutionId(fs, uipxPath, newSolutionId);
196
+ }
197
+ async function tryRegisterProjectInParentSolution(fs, projectDir, options) {
198
+ if (options?.skipRegistration) {
199
+ return {
200
+ Status: "OptedOut",
201
+ Message: "Solution auto-registration skipped (--skip-solution-registration).",
202
+ Instructions: buildOptedOutInstructions(fs.path.resolve(projectDir))
203
+ };
204
+ }
205
+ const [registrationError, registration] = await catchError(registerProjectInParentSolution(fs, projectDir));
206
+ if (registrationError) {
207
+ return {
208
+ Status: "Failed",
209
+ Message: "Project registration failed.",
210
+ Instructions: buildRegistrationFailureInstructions(projectDir, registrationError.message)
211
+ };
212
+ }
213
+ return registration;
214
+ }
215
+ async function registerProjectInParentSolution(fs, projectDir) {
216
+ const resolvedProjectDir = fs.path.resolve(projectDir);
217
+ const discovery = await findNearestParentUipxFile(fs, resolvedProjectDir);
218
+ if (discovery.status === "notFound") {
219
+ return {
220
+ Status: "NotInSolution",
221
+ Message: "Project created in standalone mode; no parent .uipx solution found.",
222
+ Instructions: buildStandaloneInstructions(resolvedProjectDir)
223
+ };
224
+ }
225
+ if (discovery.status === "skipped") {
226
+ return discovery.registration;
227
+ }
228
+ const solutionFile = discovery.solutionFile;
229
+ const solutionDir = fs.path.dirname(solutionFile);
230
+ const relativeProjectDir = fs.path.relative(solutionDir, resolvedProjectDir);
231
+ if (relativeProjectDir === "" || relativeProjectDir.startsWith("..") || fs.path.isAbsolute(relativeProjectDir)) {
232
+ return {
233
+ Status: "Skipped",
234
+ Message: "Project registration skipped.",
235
+ Solution: solutionFile,
236
+ Instructions: `Project must reside within the solution folder.
237
+ Solution: ${solutionDir}
238
+ Project: ${resolvedProjectDir}`
239
+ };
240
+ }
241
+ const [projectFileError, projectFile] = await findProjectFile(fs, resolvedProjectDir);
242
+ if (projectFileError) {
243
+ return {
244
+ Status: "Failed",
245
+ Message: "Project registration failed.",
246
+ Solution: solutionFile,
247
+ Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, projectFileError.message)
248
+ };
249
+ }
250
+ const [projectManifestError, projectManifest] = await readProjectManifest(fs, projectFile.filePath, projectFile.useProjectJson);
251
+ if (projectManifestError) {
252
+ return {
253
+ Status: "Failed",
254
+ Message: "Project registration failed.",
255
+ Solution: solutionFile,
256
+ Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, projectManifestError.message)
257
+ };
258
+ }
259
+ const unsupportedReason = unsupportedSolutionProjectType(projectManifest.projectType);
260
+ if (unsupportedReason) {
261
+ return {
262
+ Status: "Skipped",
263
+ Message: "Project registration skipped.",
264
+ Solution: solutionFile,
265
+ Instructions: unsupportedReason
266
+ };
267
+ }
268
+ const projectRelativePath = toPortableRelativePath(fs.path.join(relativeProjectDir, projectFile.fileName));
269
+ const [solutionError, solution] = await readSolutionManifest(fs, solutionFile);
270
+ if (solutionError) {
271
+ return {
272
+ Status: "Failed",
273
+ Message: "Project registration failed.",
274
+ Solution: solutionFile,
275
+ Project: projectRelativePath,
276
+ Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, solutionError.message)
277
+ };
278
+ }
279
+ const existingProject = solution.projects.find((project) => toPortableRelativePath(project.ProjectRelativePath) === projectRelativePath);
280
+ if (existingProject) {
281
+ return {
282
+ Status: "AlreadyRegistered",
283
+ Message: "Project already registered in solution.",
284
+ Solution: solutionFile,
285
+ Project: projectRelativePath,
286
+ ProjectId: typeof existingProject.Id === "string" ? existingProject.Id : undefined,
287
+ Instructions: buildRegistrationSuccessInstructions(solutionDir)
288
+ };
289
+ }
290
+ const projectId = crypto.randomUUID();
291
+ solution.projects.push({
292
+ Type: normalizeProjectType(projectManifest.projectType),
293
+ ProjectRelativePath: projectRelativePath,
294
+ Id: projectId
295
+ });
296
+ solution.content.Projects = solution.projects;
297
+ const [writeError] = await catchError(fs.writeFile(solutionFile, `${JSON.stringify(solution.content, null, 2)}
298
+ `));
299
+ if (writeError) {
300
+ return {
301
+ Status: "Failed",
302
+ Message: "Project registration failed.",
303
+ Solution: solutionFile,
304
+ Project: projectRelativePath,
305
+ Instructions: buildRegistrationFailureInstructions(resolvedProjectDir, writeError.message)
306
+ };
307
+ }
308
+ return {
309
+ Status: "Registered",
310
+ Message: "Project registered in parent solution.",
311
+ Solution: solutionFile,
312
+ Project: projectRelativePath,
313
+ ProjectId: projectId,
314
+ Instructions: buildRegistrationSuccessInstructions(solutionDir)
315
+ };
316
+ }
317
+ async function findNearestParentUipxFile(fs, projectDir) {
318
+ let currentDir = fs.path.dirname(fs.path.resolve(projectDir));
319
+ while (true) {
320
+ const [readDirError, entries] = await catchError(fs.readdir(currentDir));
321
+ if (readDirError) {
322
+ return {
323
+ status: "skipped",
324
+ registration: {
325
+ Status: "Failed",
326
+ Message: "Project registration failed.",
327
+ Instructions: buildRegistrationFailureInstructions(projectDir, `Could not inspect parent directory for a solution: ${currentDir}
328
+ ${readDirError.message}`)
329
+ }
330
+ };
331
+ }
332
+ const solutionFiles = entries.filter((entry) => entry.endsWith(".uipx"));
333
+ if (solutionFiles.length > 1) {
334
+ return {
335
+ status: "skipped",
336
+ registration: {
337
+ Status: "Skipped",
338
+ Message: "Project registration skipped.",
339
+ Instructions: `Found multiple .uipx files in ${currentDir}: ${solutionFiles.join(", ")}. Run 'uip solution projects add "${projectDir}" <solution.uipx>' to choose one.`
340
+ }
341
+ };
342
+ }
343
+ if (solutionFiles.length === 1) {
344
+ return {
345
+ status: "found",
346
+ solutionFile: fs.path.join(currentDir, solutionFiles[0])
347
+ };
348
+ }
349
+ const parentDir = fs.path.dirname(currentDir);
350
+ if (parentDir === currentDir) {
351
+ return { status: "notFound" };
352
+ }
353
+ currentDir = parentDir;
354
+ }
355
+ }
356
+ async function findProjectFile(fs, projectDir) {
357
+ const uiprojPath = fs.path.join(projectDir, "project.uiproj");
358
+ if (await fs.exists(uiprojPath)) {
359
+ return [
360
+ null,
361
+ {
362
+ filePath: uiprojPath,
363
+ fileName: "project.uiproj",
364
+ useProjectJson: false
365
+ }
366
+ ];
367
+ }
368
+ const jsonProjectPath = fs.path.join(projectDir, "project.json");
369
+ if (await fs.exists(jsonProjectPath)) {
370
+ return [
371
+ null,
372
+ {
373
+ filePath: jsonProjectPath,
374
+ fileName: "project.json",
375
+ useProjectJson: true
376
+ }
377
+ ];
378
+ }
379
+ return [
380
+ new Error(`No project file found in ${projectDir}. Expected project.uiproj or project.json.`),
381
+ null
382
+ ];
383
+ }
384
+ async function readProjectManifest(fs, filePath, useProjectJson) {
385
+ const [readError, rawContent] = await catchError(fs.readFile(filePath, "utf-8"));
386
+ if (readError || !rawContent) {
387
+ return [readError ?? new Error(`Unable to read ${filePath}.`), null];
388
+ }
389
+ const [parseError, parsed] = catchError(() => JSON.parse(rawContent));
390
+ if (parseError) {
391
+ return [
392
+ new Error(`Invalid JSON in project file: ${parseError.message}`),
393
+ null
394
+ ];
395
+ }
396
+ if (!isRecord(parsed)) {
397
+ return [new Error(`Invalid project file: ${filePath}`), null];
398
+ }
399
+ const designOptions = parsed.designOptions;
400
+ const outputType = useProjectJson && isRecord(designOptions) ? readString(designOptions.outputType) : undefined;
401
+ const projectType = outputType ?? readString(parsed.ProjectType);
402
+ if (!projectType) {
403
+ return [new Error(`ProjectType not found in ${filePath}`), null];
404
+ }
405
+ return [
406
+ null,
407
+ {
408
+ projectType
409
+ }
410
+ ];
411
+ }
412
+ async function readSolutionManifest(fs, solutionFile) {
413
+ const [readError, rawContent] = await catchError(fs.readFile(solutionFile, "utf-8"));
414
+ if (readError || !rawContent) {
415
+ return [
416
+ readError ?? new Error(`Unable to read solution file: ${solutionFile}`),
417
+ null
418
+ ];
419
+ }
420
+ const [parseError, parsed] = catchError(() => JSON.parse(rawContent));
421
+ if (parseError) {
422
+ return [
423
+ new Error(`Invalid JSON in solution file: ${parseError.message}`),
424
+ null
425
+ ];
426
+ }
427
+ if (!isRecord(parsed)) {
428
+ return [
429
+ new Error(`Invalid solution file: ${solutionFile} must contain a JSON object.`),
430
+ null
431
+ ];
432
+ }
433
+ if (!Array.isArray(parsed.Projects)) {
434
+ return [
435
+ new Error(`Invalid solution file: ${solutionFile} must contain a Projects array.`),
436
+ null
437
+ ];
438
+ }
439
+ const projects = [];
440
+ for (const [index, project] of parsed.Projects.entries()) {
441
+ if (!isRecord(project)) {
442
+ return [
443
+ new Error(`Invalid solution file: Projects[${index}] must be an object.`),
444
+ null
445
+ ];
446
+ }
447
+ const projectRelativePath = readString(project.ProjectRelativePath);
448
+ if (!projectRelativePath) {
449
+ return [
450
+ new Error(`Invalid solution file: Projects[${index}] is missing ProjectRelativePath. Use 'uip solution projects add' to repair the manifest.`),
451
+ null
452
+ ];
453
+ }
454
+ projects.push({
455
+ ...project,
456
+ Type: readString(project.Type) ?? "",
457
+ ProjectRelativePath: projectRelativePath,
458
+ Id: readString(project.Id) ?? ""
459
+ });
460
+ }
461
+ return [null, { content: parsed, projects }];
462
+ }
463
+ function readString(value) {
464
+ return typeof value === "string" && value.length > 0 ? value : undefined;
465
+ }
466
+ function buildRegistrationSuccessInstructions(solutionDir) {
467
+ return [
468
+ "The project is listed in the parent solution manifest.",
469
+ "Packing or uploading the solution will sync solution resources automatically.",
470
+ `To sync resources before packaging, run: uip solution resources refresh --solution-folder ${quoteForShell(solutionDir)}`
471
+ ].join(`
472
+ `);
473
+ }
474
+ function buildRegistrationFailureInstructions(projectDir, details) {
475
+ return [
476
+ "Automatic solution registration could not complete.",
477
+ `Run 'uip solution projects add "${projectDir}" <solution.uipx>' after checking the project and solution files.`,
478
+ `Details: ${details}`
479
+ ].join(`
480
+ `);
481
+ }
482
+ function buildStandaloneInstructions(projectDir) {
483
+ return [
484
+ "No parent solution was found by walking ancestor directories.",
485
+ "Studio Web upload, `flow debug`, and packaging require an enclosing solution.",
486
+ `To link this project to a solution, run 'uip solution init "<SolutionName>"' then 'uip solution projects add "${projectDir}" <SolutionName>.uipx'.`
487
+ ].join(`
488
+ `);
489
+ }
490
+ function buildOptedOutInstructions(projectDir) {
491
+ return [
492
+ "Automatic solution registration was skipped because --skip-solution-registration was passed.",
493
+ `To register this project later, run 'uip solution projects add "${projectDir}" <SolutionName>.uipx' from within the solution.`
494
+ ].join(`
495
+ `);
496
+ }
497
+ async function isProjectRegisteredInSolution(fs, projectDir, solutionFile) {
498
+ const [readErr, manifest] = await readSolutionManifest(fs, solutionFile);
499
+ if (readErr) {
500
+ throw readErr;
501
+ }
502
+ if (!manifest) {
503
+ throw new Error(`Unable to read solution manifest: ${solutionFile}`);
504
+ }
505
+ const solutionDir = fs.path.dirname(solutionFile);
506
+ const projectDirReal = await canonicalizePath(fs, projectDir);
507
+ for (const project of manifest.projects) {
508
+ const candidateDir = fs.path.resolve(solutionDir, fs.path.dirname(toPortableRelativePath(project.ProjectRelativePath)));
509
+ const candidateReal = await canonicalizePath(fs, candidateDir);
510
+ if (candidateReal === projectDirReal) {
511
+ return true;
512
+ }
513
+ }
514
+ return false;
515
+ }
516
+ async function canonicalizePath(fs, p) {
517
+ const [err, real] = await catchError(fs.realpath(p));
518
+ return err || !real ? p : real;
519
+ }
520
+ async function findSolutionFileUpward(fs, startDir) {
521
+ let dir = startDir;
522
+ while (true) {
523
+ const entries = await fs.readdir(dir);
524
+ const files = entries.filter((f) => f.endsWith(".uipx"));
525
+ if (files.length === 1) {
526
+ return fs.path.join(dir, files[0]);
527
+ }
528
+ if (files.length > 1) {
529
+ throw new Error(`Multiple .uipx files found in ${dir}. Please specify which solution file to use.`);
530
+ }
531
+ const parent = fs.path.dirname(dir);
532
+ if (parent === dir) {
533
+ throw new Error(`No .uipx solution file found (searched from ${startDir} to filesystem root)`);
534
+ }
535
+ dir = parent;
536
+ }
537
+ }
538
+
539
+ // ../../node_modules/fflate/esm/index.mjs
540
+ import { createRequire } from "module";
541
+ var require2 = createRequire("/");
542
+ var _a;
543
+ var Worker;
544
+ var isMarkedAsUntransferable;
545
+ try {
546
+ _a = require2("worker_threads"), Worker = _a.Worker, isMarkedAsUntransferable = _a.isMarkedAsUntransferable;
547
+ } catch (e) {}
548
+ var u8 = Uint8Array;
549
+ var u16 = Uint16Array;
550
+ var i32 = Int32Array;
551
+ var fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]);
552
+ var fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]);
553
+ var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
554
+ var freb = function(eb, start) {
555
+ var b = new u16(31);
556
+ for (var i = 0;i < 31; ++i) {
557
+ b[i] = start += 1 << eb[i - 1];
558
+ }
559
+ var r = new i32(b[30]);
560
+ for (var i = 1;i < 30; ++i) {
561
+ for (var j = b[i];j < b[i + 1]; ++j) {
562
+ r[j] = j - b[i] << 5 | i;
563
+ }
564
+ }
565
+ return { b, r };
566
+ };
567
+ var _a = freb(fleb, 2);
568
+ var fl = _a.b;
569
+ var revfl = _a.r;
570
+ fl[28] = 258, revfl[258] = 28;
571
+ var _b = freb(fdeb, 0);
572
+ var fd = _b.b;
573
+ var revfd = _b.r;
574
+ var rev = new u16(32768);
575
+ for (i = 0;i < 32768; ++i) {
576
+ x = (i & 43690) >> 1 | (i & 21845) << 1;
577
+ x = (x & 52428) >> 2 | (x & 13107) << 2;
578
+ x = (x & 61680) >> 4 | (x & 3855) << 4;
579
+ rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
580
+ }
581
+ var x;
582
+ var i;
583
+ var hMap = function(cd, mb, r) {
584
+ var s = cd.length;
585
+ var i2 = 0;
586
+ var l = new u16(mb);
587
+ for (;i2 < s; ++i2) {
588
+ if (cd[i2])
589
+ ++l[cd[i2] - 1];
590
+ }
591
+ var le = new u16(mb);
592
+ for (i2 = 1;i2 < mb; ++i2) {
593
+ le[i2] = le[i2 - 1] + l[i2 - 1] << 1;
594
+ }
595
+ var co;
596
+ if (r) {
597
+ co = new u16(1 << mb);
598
+ var rvb = 15 - mb;
599
+ for (i2 = 0;i2 < s; ++i2) {
600
+ if (cd[i2]) {
601
+ var sv = i2 << 4 | cd[i2];
602
+ var r_1 = mb - cd[i2];
603
+ var v = le[cd[i2] - 1]++ << r_1;
604
+ for (var m = v | (1 << r_1) - 1;v <= m; ++v) {
605
+ co[rev[v] >> rvb] = sv;
606
+ }
607
+ }
608
+ }
609
+ } else {
610
+ co = new u16(s);
611
+ for (i2 = 0;i2 < s; ++i2) {
612
+ if (cd[i2]) {
613
+ co[i2] = rev[le[cd[i2] - 1]++] >> 15 - cd[i2];
614
+ }
615
+ }
616
+ }
617
+ return co;
618
+ };
619
+ var flt = new u8(288);
620
+ for (i = 0;i < 144; ++i)
621
+ flt[i] = 8;
622
+ var i;
623
+ for (i = 144;i < 256; ++i)
624
+ flt[i] = 9;
625
+ var i;
626
+ for (i = 256;i < 280; ++i)
627
+ flt[i] = 7;
628
+ var i;
629
+ for (i = 280;i < 288; ++i)
630
+ flt[i] = 8;
631
+ var i;
632
+ var fdt = new u8(32);
633
+ for (i = 0;i < 32; ++i)
634
+ fdt[i] = 5;
635
+ var i;
636
+ var flm = /* @__PURE__ */ hMap(flt, 9, 0);
637
+ var fdm = /* @__PURE__ */ hMap(fdt, 5, 0);
638
+ var shft = function(p) {
639
+ return (p + 7) / 8 | 0;
640
+ };
641
+ var slc = function(v, s, e) {
642
+ if (s == null || s < 0)
643
+ s = 0;
644
+ if (e == null || e > v.length)
645
+ e = v.length;
646
+ return new u8(v.subarray(s, e));
647
+ };
648
+ var ec = [
649
+ "unexpected EOF",
650
+ "invalid block type",
651
+ "invalid length/literal",
652
+ "invalid distance",
653
+ "stream finished",
654
+ "no stream handler",
655
+ ,
656
+ "no callback",
657
+ "invalid UTF-8 data",
658
+ "extra field too long",
659
+ "date not in range 1980-2099",
660
+ "filename too long",
661
+ "stream finishing",
662
+ "invalid zip data"
663
+ ];
664
+ var err = function(ind, msg, nt) {
665
+ var e = new Error(msg || ec[ind]);
666
+ e.code = ind;
667
+ if (Error.captureStackTrace)
668
+ Error.captureStackTrace(e, err);
669
+ if (!nt)
670
+ throw e;
671
+ return e;
672
+ };
673
+ var wbits = function(d, p, v) {
674
+ v <<= p & 7;
675
+ var o = p / 8 | 0;
676
+ d[o] |= v;
677
+ d[o + 1] |= v >> 8;
678
+ };
679
+ var wbits16 = function(d, p, v) {
680
+ v <<= p & 7;
681
+ var o = p / 8 | 0;
682
+ d[o] |= v;
683
+ d[o + 1] |= v >> 8;
684
+ d[o + 2] |= v >> 16;
685
+ };
686
+ var hTree = function(d, mb) {
687
+ var t = [];
688
+ for (var i2 = 0;i2 < d.length; ++i2) {
689
+ if (d[i2])
690
+ t.push({ s: i2, f: d[i2] });
691
+ }
692
+ var s = t.length;
693
+ var t2 = t.slice();
694
+ if (!s)
695
+ return { t: et, l: 0 };
696
+ if (s == 1) {
697
+ var v = new u8(t[0].s + 1);
698
+ v[t[0].s] = 1;
699
+ return { t: v, l: 1 };
700
+ }
701
+ t.sort(function(a, b) {
702
+ return a.f - b.f;
703
+ });
704
+ t.push({ s: -1, f: 25001 });
705
+ var l = t[0], r = t[1], i0 = 0, i1 = 1, i22 = 2;
706
+ t[0] = { s: -1, f: l.f + r.f, l, r };
707
+ while (i1 != s - 1) {
708
+ l = t[t[i0].f < t[i22].f ? i0++ : i22++];
709
+ r = t[i0 != i1 && t[i0].f < t[i22].f ? i0++ : i22++];
710
+ t[i1++] = { s: -1, f: l.f + r.f, l, r };
711
+ }
712
+ var maxSym = t2[0].s;
713
+ for (var i2 = 1;i2 < s; ++i2) {
714
+ if (t2[i2].s > maxSym)
715
+ maxSym = t2[i2].s;
716
+ }
717
+ var tr = new u16(maxSym + 1);
718
+ var mbt = ln(t[i1 - 1], tr, 0);
719
+ if (mbt > mb) {
720
+ var i2 = 0, dt = 0;
721
+ var lft = mbt - mb, cst = 1 << lft;
722
+ t2.sort(function(a, b) {
723
+ return tr[b.s] - tr[a.s] || a.f - b.f;
724
+ });
725
+ for (;i2 < s; ++i2) {
726
+ var i2_1 = t2[i2].s;
727
+ if (tr[i2_1] > mb) {
728
+ dt += cst - (1 << mbt - tr[i2_1]);
729
+ tr[i2_1] = mb;
730
+ } else
731
+ break;
732
+ }
733
+ dt >>= lft;
734
+ while (dt > 0) {
735
+ var i2_2 = t2[i2].s;
736
+ if (tr[i2_2] < mb)
737
+ dt -= 1 << mb - tr[i2_2]++ - 1;
738
+ else
739
+ ++i2;
740
+ }
741
+ for (;i2 >= 0 && dt; --i2) {
742
+ var i2_3 = t2[i2].s;
743
+ if (tr[i2_3] == mb) {
744
+ --tr[i2_3];
745
+ ++dt;
746
+ }
747
+ }
748
+ mbt = mb;
749
+ }
750
+ return { t: new u8(tr), l: mbt };
751
+ };
752
+ var ln = function(n, l, d) {
753
+ return n.s == -1 ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) : l[n.s] = d;
754
+ };
755
+ var lc = function(c) {
756
+ var s = c.length;
757
+ while (s && !c[--s])
758
+ ;
759
+ var cl = new u16(++s);
760
+ var cli = 0, cln = c[0], cls = 1;
761
+ var w = function(v) {
762
+ cl[cli++] = v;
763
+ };
764
+ for (var i2 = 1;i2 <= s; ++i2) {
765
+ if (c[i2] == cln && i2 != s)
766
+ ++cls;
767
+ else {
768
+ if (!cln && cls > 2) {
769
+ for (;cls > 138; cls -= 138)
770
+ w(32754);
771
+ if (cls > 2) {
772
+ w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);
773
+ cls = 0;
774
+ }
775
+ } else if (cls > 3) {
776
+ w(cln), --cls;
777
+ for (;cls > 6; cls -= 6)
778
+ w(8304);
779
+ if (cls > 2)
780
+ w(cls - 3 << 5 | 8208), cls = 0;
781
+ }
782
+ while (cls--)
783
+ w(cln);
784
+ cls = 1;
785
+ cln = c[i2];
786
+ }
787
+ }
788
+ return { c: cl.subarray(0, cli), n: s };
789
+ };
790
+ var clen = function(cf, cl) {
791
+ var l = 0;
792
+ for (var i2 = 0;i2 < cl.length; ++i2)
793
+ l += cf[i2] * cl[i2];
794
+ return l;
795
+ };
796
+ var wfblk = function(out, pos, dat) {
797
+ var s = dat.length;
798
+ var o = shft(pos + 2);
799
+ out[o] = s & 255;
800
+ out[o + 1] = s >> 8;
801
+ out[o + 2] = out[o] ^ 255;
802
+ out[o + 3] = out[o + 1] ^ 255;
803
+ for (var i2 = 0;i2 < s; ++i2)
804
+ out[o + i2 + 4] = dat[i2];
805
+ return (o + 4 + s) * 8;
806
+ };
807
+ var wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {
808
+ wbits(out, p++, final);
809
+ ++lf[256];
810
+ var _a2 = hTree(lf, 15), dlt = _a2.t, mlb = _a2.l;
811
+ var _b2 = hTree(df, 15), ddt = _b2.t, mdb = _b2.l;
812
+ var _c = lc(dlt), lclt = _c.c, nlc = _c.n;
813
+ var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;
814
+ var lcfreq = new u16(19);
815
+ for (var i2 = 0;i2 < lclt.length; ++i2)
816
+ ++lcfreq[lclt[i2] & 31];
817
+ for (var i2 = 0;i2 < lcdt.length; ++i2)
818
+ ++lcfreq[lcdt[i2] & 31];
819
+ var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;
820
+ var nlcc = 19;
821
+ for (;nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)
822
+ ;
823
+ var flen = bl + 5 << 3;
824
+ var ftlen = clen(lf, flt) + clen(df, fdt) + eb;
825
+ var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];
826
+ if (bs >= 0 && flen <= ftlen && flen <= dtlen)
827
+ return wfblk(out, p, dat.subarray(bs, bs + bl));
828
+ var lm, ll, dm, dl;
829
+ wbits(out, p, 1 + (dtlen < ftlen)), p += 2;
830
+ if (dtlen < ftlen) {
831
+ lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;
832
+ var llm = hMap(lct, mlcb, 0);
833
+ wbits(out, p, nlc - 257);
834
+ wbits(out, p + 5, ndc - 1);
835
+ wbits(out, p + 10, nlcc - 4);
836
+ p += 14;
837
+ for (var i2 = 0;i2 < nlcc; ++i2)
838
+ wbits(out, p + 3 * i2, lct[clim[i2]]);
839
+ p += 3 * nlcc;
840
+ var lcts = [lclt, lcdt];
841
+ for (var it = 0;it < 2; ++it) {
842
+ var clct = lcts[it];
843
+ for (var i2 = 0;i2 < clct.length; ++i2) {
844
+ var len = clct[i2] & 31;
845
+ wbits(out, p, llm[len]), p += lct[len];
846
+ if (len > 15)
847
+ wbits(out, p, clct[i2] >> 5 & 127), p += clct[i2] >> 12;
848
+ }
849
+ }
850
+ } else {
851
+ lm = flm, ll = flt, dm = fdm, dl = fdt;
852
+ }
853
+ for (var i2 = 0;i2 < li; ++i2) {
854
+ var sym = syms[i2];
855
+ if (sym > 255) {
856
+ var len = sym >> 18 & 31;
857
+ wbits16(out, p, lm[len + 257]), p += ll[len + 257];
858
+ if (len > 7)
859
+ wbits(out, p, sym >> 23 & 31), p += fleb[len];
860
+ var dst = sym & 31;
861
+ wbits16(out, p, dm[dst]), p += dl[dst];
862
+ if (dst > 3)
863
+ wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];
864
+ } else {
865
+ wbits16(out, p, lm[sym]), p += ll[sym];
866
+ }
867
+ }
868
+ wbits16(out, p, lm[256]);
869
+ return p + ll[256];
870
+ };
871
+ var deo = /* @__PURE__ */ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
872
+ var et = /* @__PURE__ */ new u8(0);
873
+ var dflt = function(dat, lvl, plvl, pre, post, st) {
874
+ var s = st.z || dat.length;
875
+ var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);
876
+ var w = o.subarray(pre, o.length - post);
877
+ var lst = st.l;
878
+ var pos = (st.r || 0) & 7;
879
+ if (lvl) {
880
+ if (pos)
881
+ w[0] = st.r >> 3;
882
+ var opt = deo[lvl - 1];
883
+ var n = opt >> 13, c = opt & 8191;
884
+ var msk_1 = (1 << plvl) - 1;
885
+ var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);
886
+ var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
887
+ var hsh = function(i3) {
888
+ return (dat[i3] ^ dat[i3 + 1] << bs1_1 ^ dat[i3 + 2] << bs2_1) & msk_1;
889
+ };
890
+ var syms = new i32(25000);
891
+ var lf = new u16(288), df = new u16(32);
892
+ var lc_1 = 0, eb = 0, i2 = st.i || 0, li = 0, wi = st.w || 0, bs = 0;
893
+ for (;i2 + 2 < s; ++i2) {
894
+ var hv = hsh(i2);
895
+ var imod = i2 & 32767, pimod = head[hv];
896
+ prev[imod] = pimod;
897
+ head[hv] = imod;
898
+ if (wi <= i2) {
899
+ var rem = s - i2;
900
+ if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) {
901
+ pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i2 - bs, pos);
902
+ li = lc_1 = eb = 0, bs = i2;
903
+ for (var j = 0;j < 286; ++j)
904
+ lf[j] = 0;
905
+ for (var j = 0;j < 30; ++j)
906
+ df[j] = 0;
907
+ }
908
+ var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;
909
+ if (rem > 2 && hv == hsh(i2 - dif)) {
910
+ var maxn = Math.min(n, rem) - 1;
911
+ var maxd = Math.min(32767, i2);
912
+ var ml = Math.min(258, rem);
913
+ while (dif <= maxd && --ch_1 && imod != pimod) {
914
+ if (dat[i2 + l] == dat[i2 + l - dif]) {
915
+ var nl = 0;
916
+ for (;nl < ml && dat[i2 + nl] == dat[i2 + nl - dif]; ++nl)
917
+ ;
918
+ if (nl > l) {
919
+ l = nl, d = dif;
920
+ if (nl > maxn)
921
+ break;
922
+ var mmd = Math.min(dif, nl - 2);
923
+ var md = 0;
924
+ for (var j = 0;j < mmd; ++j) {
925
+ var ti = i2 - dif + j & 32767;
926
+ var pti = prev[ti];
927
+ var cd = ti - pti & 32767;
928
+ if (cd > md)
929
+ md = cd, pimod = ti;
930
+ }
931
+ }
932
+ }
933
+ imod = pimod, pimod = prev[imod];
934
+ dif += imod - pimod & 32767;
935
+ }
936
+ }
937
+ if (d) {
938
+ syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];
939
+ var lin = revfl[l] & 31, din = revfd[d] & 31;
940
+ eb += fleb[lin] + fdeb[din];
941
+ ++lf[257 + lin];
942
+ ++df[din];
943
+ wi = i2 + l;
944
+ ++lc_1;
945
+ } else {
946
+ syms[li++] = dat[i2];
947
+ ++lf[dat[i2]];
948
+ }
949
+ }
950
+ }
951
+ for (i2 = Math.max(i2, wi);i2 < s; ++i2) {
952
+ syms[li++] = dat[i2];
953
+ ++lf[dat[i2]];
954
+ }
955
+ pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i2 - bs, pos);
956
+ if (!lst) {
957
+ st.r = pos & 7 | w[pos / 8 | 0] << 3;
958
+ pos -= 7;
959
+ st.h = head, st.p = prev, st.i = i2, st.w = wi;
960
+ }
961
+ } else {
962
+ for (var i2 = st.w || 0;i2 < s + lst; i2 += 65535) {
963
+ var e = i2 + 65535;
964
+ if (e >= s) {
965
+ w[pos / 8 | 0] = lst;
966
+ e = s;
967
+ }
968
+ pos = wfblk(w, pos + 1, dat.subarray(i2, e));
969
+ }
970
+ st.i = s;
971
+ }
972
+ return slc(o, 0, pre + shft(pos) + post);
973
+ };
974
+ var crct = /* @__PURE__ */ function() {
975
+ var t = new Int32Array(256);
976
+ for (var i2 = 0;i2 < 256; ++i2) {
977
+ var c = i2, k = 9;
978
+ while (--k)
979
+ c = (c & 1 && -306674912) ^ c >>> 1;
980
+ t[i2] = c;
981
+ }
982
+ return t;
983
+ }();
984
+ var crc = function() {
985
+ var c = -1;
986
+ return {
987
+ p: function(d) {
988
+ var cr = c;
989
+ for (var i2 = 0;i2 < d.length; ++i2)
990
+ cr = crct[cr & 255 ^ d[i2]] ^ cr >>> 8;
991
+ c = cr;
992
+ },
993
+ d: function() {
994
+ return ~c;
995
+ }
996
+ };
997
+ };
998
+ var dopt = function(dat, opt, pre, post, st) {
999
+ if (!st) {
1000
+ st = { l: 1 };
1001
+ if (opt.dictionary) {
1002
+ var dict = opt.dictionary.subarray(-32768);
1003
+ var newDat = new u8(dict.length + dat.length);
1004
+ newDat.set(dict);
1005
+ newDat.set(dat, dict.length);
1006
+ dat = newDat;
1007
+ st.w = dict.length;
1008
+ }
1009
+ }
1010
+ return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);
1011
+ };
1012
+ var mrg = function(a, b) {
1013
+ var o = {};
1014
+ for (var k in a)
1015
+ o[k] = a[k];
1016
+ for (var k in b)
1017
+ o[k] = b[k];
1018
+ return o;
1019
+ };
1020
+ var wbytes = function(d, b, v) {
1021
+ for (;v; ++b)
1022
+ d[b] = v, v >>>= 8;
1023
+ };
1024
+ function deflateSync(data, opts) {
1025
+ return dopt(data, opts || {}, 0, 0);
1026
+ }
1027
+ var fltn = function(d, p, t, o) {
1028
+ for (var k in d) {
1029
+ var val = d[k], n = p + k, op = o;
1030
+ if (Array.isArray(val))
1031
+ op = mrg(o, val[1]), val = val[0];
1032
+ if (ArrayBuffer.isView(val))
1033
+ t[n] = [val, op];
1034
+ else {
1035
+ t[n += "/"] = [new u8(0), op];
1036
+ fltn(val, n, t, o);
1037
+ }
1038
+ }
1039
+ };
1040
+ var te = typeof TextEncoder != "undefined" && /* @__PURE__ */ new TextEncoder;
1041
+ var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder;
1042
+ var tds = 0;
1043
+ try {
1044
+ td.decode(et, { stream: true });
1045
+ tds = 1;
1046
+ } catch (e) {}
1047
+ function strToU8(str, latin1) {
1048
+ if (latin1) {
1049
+ var ar_1 = new u8(str.length);
1050
+ for (var i2 = 0;i2 < str.length; ++i2)
1051
+ ar_1[i2] = str.charCodeAt(i2);
1052
+ return ar_1;
1053
+ }
1054
+ if (te)
1055
+ return te.encode(str);
1056
+ var l = str.length;
1057
+ var ar = new u8(str.length + (str.length >> 1));
1058
+ var ai = 0;
1059
+ var w = function(v) {
1060
+ ar[ai++] = v;
1061
+ };
1062
+ for (var i2 = 0;i2 < l; ++i2) {
1063
+ if (ai + 5 > ar.length) {
1064
+ var n = new u8(ai + 8 + (l - i2 << 1));
1065
+ n.set(ar);
1066
+ ar = n;
1067
+ }
1068
+ var c = str.charCodeAt(i2);
1069
+ if (c < 128 || latin1)
1070
+ w(c);
1071
+ else if (c < 2048)
1072
+ w(192 | c >> 6), w(128 | c & 63);
1073
+ else if (c > 55295 && c < 57344)
1074
+ c = 65536 + (c & 1023 << 10) | str.charCodeAt(++i2) & 1023, w(240 | c >> 18), w(128 | c >> 12 & 63), w(128 | c >> 6 & 63), w(128 | c & 63);
1075
+ else
1076
+ w(224 | c >> 12), w(128 | c >> 6 & 63), w(128 | c & 63);
1077
+ }
1078
+ return slc(ar, 0, ai);
1079
+ }
1080
+ var exfl = function(ex) {
1081
+ var le = 0;
1082
+ if (ex) {
1083
+ for (var k in ex) {
1084
+ var l = ex[k].length;
1085
+ if (l > 65535)
1086
+ err(9);
1087
+ le += l + 4;
1088
+ }
1089
+ }
1090
+ return le;
1091
+ };
1092
+ var wzh = function(d, b, f, fn, u, c, ce, co) {
1093
+ var fl2 = fn.length, ex = f.extra, col = co && co.length;
1094
+ var exl = exfl(ex);
1095
+ wbytes(d, b, ce != null ? 33639248 : 67324752), b += 4;
1096
+ if (ce != null)
1097
+ d[b++] = 20, d[b++] = f.os;
1098
+ d[b] = 20, b += 2;
1099
+ d[b++] = f.flag << 1 | (c < 0 && 8), d[b++] = u && 8;
1100
+ d[b++] = f.compression & 255, d[b++] = f.compression >> 8;
1101
+ var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;
1102
+ if (y < 0 || y > 119)
1103
+ err(10);
1104
+ wbytes(d, b, y << 25 | dt.getMonth() + 1 << 21 | dt.getDate() << 16 | dt.getHours() << 11 | dt.getMinutes() << 5 | dt.getSeconds() >> 1), b += 4;
1105
+ if (c != -1) {
1106
+ wbytes(d, b, f.crc);
1107
+ wbytes(d, b + 4, c < 0 ? -c - 2 : c);
1108
+ wbytes(d, b + 8, f.size);
1109
+ }
1110
+ wbytes(d, b + 12, fl2);
1111
+ wbytes(d, b + 14, exl), b += 16;
1112
+ if (ce != null) {
1113
+ wbytes(d, b, col);
1114
+ wbytes(d, b + 6, f.attrs);
1115
+ wbytes(d, b + 10, ce), b += 14;
1116
+ }
1117
+ d.set(fn, b);
1118
+ b += fl2;
1119
+ if (exl) {
1120
+ for (var k in ex) {
1121
+ var exf = ex[k], l = exf.length;
1122
+ wbytes(d, b, +k);
1123
+ wbytes(d, b + 2, l);
1124
+ d.set(exf, b + 4), b += 4 + l;
1125
+ }
1126
+ }
1127
+ if (col)
1128
+ d.set(co, b), b += col;
1129
+ return b;
1130
+ };
1131
+ var wzf = function(o, b, c, d, e) {
1132
+ wbytes(o, b, 101010256);
1133
+ wbytes(o, b + 8, c);
1134
+ wbytes(o, b + 10, c);
1135
+ wbytes(o, b + 12, d);
1136
+ wbytes(o, b + 16, e);
1137
+ };
1138
+ function zipSync(data, opts) {
1139
+ if (!opts)
1140
+ opts = {};
1141
+ var r = {};
1142
+ var files = [];
1143
+ fltn(data, "", r, opts);
1144
+ var o = 0;
1145
+ var tot = 0;
1146
+ for (var fn in r) {
1147
+ var _a2 = r[fn], file = _a2[0], p = _a2[1];
1148
+ var compression = p.level == 0 ? 0 : 8;
1149
+ var f = strToU8(fn), s = f.length;
1150
+ var com = p.comment, m = com && strToU8(com), ms = m && m.length;
1151
+ var exl = exfl(p.extra);
1152
+ if (s > 65535)
1153
+ err(11);
1154
+ var d = compression ? deflateSync(file, p) : file, l = d.length;
1155
+ var c = crc();
1156
+ c.p(file);
1157
+ files.push(mrg(p, {
1158
+ size: file.length,
1159
+ crc: c.d(),
1160
+ c: d,
1161
+ f,
1162
+ m,
1163
+ u: s != fn.length || m && com.length != ms,
1164
+ o,
1165
+ compression
1166
+ }));
1167
+ o += 30 + s + exl + l;
1168
+ tot += 76 + 2 * (s + exl) + (ms || 0) + l;
1169
+ }
1170
+ var out = new u8(tot + 22), oe = o, cdl = tot - o;
1171
+ for (var i2 = 0;i2 < files.length; ++i2) {
1172
+ var f = files[i2];
1173
+ wzh(out, f.o, f, f.f, f.u, f.c.length);
1174
+ var badd = 30 + f.f.length + exfl(f.extra);
1175
+ out.set(f.c, f.o + badd);
1176
+ wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);
1177
+ }
1178
+ wzf(out, o, files.length, cdl, oe);
1179
+ return out;
1180
+ }
1181
+
1182
+ export { normalizeProjectType, toPortableRelativePath, readUipxFile, createSolutionManifest, autoScaffoldSolution, prepareProjectLocation, resolveSolutionDir, updateUipxSolutionId, findSolutionFile, updateSolutionFile, tryRegisterProjectInParentSolution, findNearestParentUipxFile, readSolutionManifest, isProjectRegisteredInSolution, findSolutionFileUpward, zipSync };
1183
+
1184
+ //# debugId=65E6C00D8DAA035464756E2164756E21