@uipath/api-workflow-tool 1.199.0 → 1.201.0-preview.115

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.
@@ -0,0 +1,2360 @@
1
+ // ../../node_modules/fflate/esm/index.mjs
2
+ import { createRequire } from "module";
3
+ var require2 = createRequire("/");
4
+ var _a;
5
+ var Worker;
6
+ var isMarkedAsUntransferable;
7
+ try {
8
+ _a = require2("worker_threads"), Worker = _a.Worker, isMarkedAsUntransferable = _a.isMarkedAsUntransferable;
9
+ } catch (e) {}
10
+ var u8 = Uint8Array;
11
+ var u16 = Uint16Array;
12
+ var i32 = Int32Array;
13
+ 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]);
14
+ 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]);
15
+ var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
16
+ var freb = function(eb, start) {
17
+ var b = new u16(31);
18
+ for (var i = 0;i < 31; ++i) {
19
+ b[i] = start += 1 << eb[i - 1];
20
+ }
21
+ var r = new i32(b[30]);
22
+ for (var i = 1;i < 30; ++i) {
23
+ for (var j = b[i];j < b[i + 1]; ++j) {
24
+ r[j] = j - b[i] << 5 | i;
25
+ }
26
+ }
27
+ return { b, r };
28
+ };
29
+ var _a = freb(fleb, 2);
30
+ var fl = _a.b;
31
+ var revfl = _a.r;
32
+ fl[28] = 258, revfl[258] = 28;
33
+ var _b = freb(fdeb, 0);
34
+ var fd = _b.b;
35
+ var revfd = _b.r;
36
+ var rev = new u16(32768);
37
+ for (i = 0;i < 32768; ++i) {
38
+ x = (i & 43690) >> 1 | (i & 21845) << 1;
39
+ x = (x & 52428) >> 2 | (x & 13107) << 2;
40
+ x = (x & 61680) >> 4 | (x & 3855) << 4;
41
+ rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
42
+ }
43
+ var x;
44
+ var i;
45
+ var hMap = function(cd, mb, r) {
46
+ var s = cd.length;
47
+ var i2 = 0;
48
+ var l = new u16(mb);
49
+ for (;i2 < s; ++i2) {
50
+ if (cd[i2])
51
+ ++l[cd[i2] - 1];
52
+ }
53
+ var le = new u16(mb);
54
+ for (i2 = 1;i2 < mb; ++i2) {
55
+ le[i2] = le[i2 - 1] + l[i2 - 1] << 1;
56
+ }
57
+ var co;
58
+ if (r) {
59
+ co = new u16(1 << mb);
60
+ var rvb = 15 - mb;
61
+ for (i2 = 0;i2 < s; ++i2) {
62
+ if (cd[i2]) {
63
+ var sv = i2 << 4 | cd[i2];
64
+ var r_1 = mb - cd[i2];
65
+ var v = le[cd[i2] - 1]++ << r_1;
66
+ for (var m = v | (1 << r_1) - 1;v <= m; ++v) {
67
+ co[rev[v] >> rvb] = sv;
68
+ }
69
+ }
70
+ }
71
+ } else {
72
+ co = new u16(s);
73
+ for (i2 = 0;i2 < s; ++i2) {
74
+ if (cd[i2]) {
75
+ co[i2] = rev[le[cd[i2] - 1]++] >> 15 - cd[i2];
76
+ }
77
+ }
78
+ }
79
+ return co;
80
+ };
81
+ var flt = new u8(288);
82
+ for (i = 0;i < 144; ++i)
83
+ flt[i] = 8;
84
+ var i;
85
+ for (i = 144;i < 256; ++i)
86
+ flt[i] = 9;
87
+ var i;
88
+ for (i = 256;i < 280; ++i)
89
+ flt[i] = 7;
90
+ var i;
91
+ for (i = 280;i < 288; ++i)
92
+ flt[i] = 8;
93
+ var i;
94
+ var fdt = new u8(32);
95
+ for (i = 0;i < 32; ++i)
96
+ fdt[i] = 5;
97
+ var i;
98
+ var flm = /* @__PURE__ */ hMap(flt, 9, 0);
99
+ var flrm = /* @__PURE__ */ hMap(flt, 9, 1);
100
+ var fdm = /* @__PURE__ */ hMap(fdt, 5, 0);
101
+ var fdrm = /* @__PURE__ */ hMap(fdt, 5, 1);
102
+ var max = function(a) {
103
+ var m = a[0];
104
+ for (var i2 = 1;i2 < a.length; ++i2) {
105
+ if (a[i2] > m)
106
+ m = a[i2];
107
+ }
108
+ return m;
109
+ };
110
+ var bits = function(d, p, m) {
111
+ var o = p / 8 | 0;
112
+ return (d[o] | d[o + 1] << 8) >> (p & 7) & m;
113
+ };
114
+ var bits16 = function(d, p) {
115
+ var o = p / 8 | 0;
116
+ return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);
117
+ };
118
+ var shft = function(p) {
119
+ return (p + 7) / 8 | 0;
120
+ };
121
+ var slc = function(v, s, e) {
122
+ if (s == null || s < 0)
123
+ s = 0;
124
+ if (e == null || e > v.length)
125
+ e = v.length;
126
+ return new u8(v.subarray(s, e));
127
+ };
128
+ var ec = [
129
+ "unexpected EOF",
130
+ "invalid block type",
131
+ "invalid length/literal",
132
+ "invalid distance",
133
+ "stream finished",
134
+ "no stream handler",
135
+ ,
136
+ "no callback",
137
+ "invalid UTF-8 data",
138
+ "extra field too long",
139
+ "date not in range 1980-2099",
140
+ "filename too long",
141
+ "stream finishing",
142
+ "invalid zip data"
143
+ ];
144
+ var err = function(ind, msg, nt) {
145
+ var e = new Error(msg || ec[ind]);
146
+ e.code = ind;
147
+ if (Error.captureStackTrace)
148
+ Error.captureStackTrace(e, err);
149
+ if (!nt)
150
+ throw e;
151
+ return e;
152
+ };
153
+ var inflt = function(dat, st, buf, dict) {
154
+ var sl = dat.length, dl = dict ? dict.length : 0;
155
+ if (!sl || st.f && !st.l)
156
+ return buf || new u8(0);
157
+ var noBuf = !buf;
158
+ var resize = noBuf || st.i != 2;
159
+ var noSt = st.i;
160
+ if (noBuf)
161
+ buf = new u8(sl * 3);
162
+ var cbuf = function(l2) {
163
+ var bl = buf.length;
164
+ if (l2 > bl) {
165
+ var nbuf = new u8(Math.max(bl * 2, l2));
166
+ nbuf.set(buf);
167
+ buf = nbuf;
168
+ }
169
+ };
170
+ var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
171
+ var tbts = sl * 8;
172
+ do {
173
+ if (!lm) {
174
+ final = bits(dat, pos, 1);
175
+ var type = bits(dat, pos + 1, 3);
176
+ pos += 3;
177
+ if (!type) {
178
+ var s = shft(pos) + 4, l = dat[s - 4] | dat[s - 3] << 8, t = s + l;
179
+ if (t > sl) {
180
+ if (noSt)
181
+ err(0);
182
+ break;
183
+ }
184
+ if (resize)
185
+ cbuf(bt + l);
186
+ buf.set(dat.subarray(s, t), bt);
187
+ st.b = bt += l, st.p = pos = t * 8, st.f = final;
188
+ continue;
189
+ } else if (type == 1)
190
+ lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
191
+ else if (type == 2) {
192
+ var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;
193
+ var tl = hLit + bits(dat, pos + 5, 31) + 1;
194
+ pos += 14;
195
+ var ldt = new u8(tl);
196
+ var clt = new u8(19);
197
+ for (var i2 = 0;i2 < hcLen; ++i2) {
198
+ clt[clim[i2]] = bits(dat, pos + i2 * 3, 7);
199
+ }
200
+ pos += hcLen * 3;
201
+ var clb = max(clt), clbmsk = (1 << clb) - 1;
202
+ var clm = hMap(clt, clb, 1);
203
+ for (var i2 = 0;i2 < tl; ) {
204
+ var r = clm[bits(dat, pos, clbmsk)];
205
+ pos += r & 15;
206
+ var s = r >> 4;
207
+ if (s < 16) {
208
+ ldt[i2++] = s;
209
+ } else {
210
+ var c = 0, n = 0;
211
+ if (s == 16)
212
+ n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i2 - 1];
213
+ else if (s == 17)
214
+ n = 3 + bits(dat, pos, 7), pos += 3;
215
+ else if (s == 18)
216
+ n = 11 + bits(dat, pos, 127), pos += 7;
217
+ while (n--)
218
+ ldt[i2++] = c;
219
+ }
220
+ }
221
+ var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
222
+ lbt = max(lt);
223
+ dbt = max(dt);
224
+ lm = hMap(lt, lbt, 1);
225
+ dm = hMap(dt, dbt, 1);
226
+ } else
227
+ err(1);
228
+ if (pos > tbts) {
229
+ if (noSt)
230
+ err(0);
231
+ break;
232
+ }
233
+ }
234
+ if (resize)
235
+ cbuf(bt + 131072);
236
+ var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
237
+ var lpos = pos;
238
+ for (;; lpos = pos) {
239
+ var c = lm[bits16(dat, pos) & lms], sym = c >> 4;
240
+ pos += c & 15;
241
+ if (pos > tbts) {
242
+ if (noSt)
243
+ err(0);
244
+ break;
245
+ }
246
+ if (!c)
247
+ err(2);
248
+ if (sym < 256)
249
+ buf[bt++] = sym;
250
+ else if (sym == 256) {
251
+ lpos = pos, lm = null;
252
+ break;
253
+ } else {
254
+ var add = sym - 254;
255
+ if (sym > 264) {
256
+ var i2 = sym - 257, b = fleb[i2];
257
+ add = bits(dat, pos, (1 << b) - 1) + fl[i2];
258
+ pos += b;
259
+ }
260
+ var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
261
+ if (!d)
262
+ err(3);
263
+ pos += d & 15;
264
+ var dt = fd[dsym];
265
+ if (dsym > 3) {
266
+ var b = fdeb[dsym];
267
+ dt += bits16(dat, pos) & (1 << b) - 1, pos += b;
268
+ }
269
+ if (pos > tbts) {
270
+ if (noSt)
271
+ err(0);
272
+ break;
273
+ }
274
+ if (resize)
275
+ cbuf(bt + 131072);
276
+ var end = bt + add;
277
+ if (bt < dt) {
278
+ var shift = dl - dt, dend = Math.min(dt, end);
279
+ if (shift + bt < 0)
280
+ err(3);
281
+ for (;bt < dend; ++bt)
282
+ buf[bt] = dict[shift + bt];
283
+ }
284
+ for (;bt < end; ++bt)
285
+ buf[bt] = buf[bt - dt];
286
+ }
287
+ }
288
+ st.l = lm, st.p = lpos, st.b = bt, st.f = final;
289
+ if (lm)
290
+ final = 1, st.m = lbt, st.d = dm, st.n = dbt;
291
+ } while (!final);
292
+ return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
293
+ };
294
+ var wbits = function(d, p, v) {
295
+ v <<= p & 7;
296
+ var o = p / 8 | 0;
297
+ d[o] |= v;
298
+ d[o + 1] |= v >> 8;
299
+ };
300
+ var wbits16 = function(d, p, v) {
301
+ v <<= p & 7;
302
+ var o = p / 8 | 0;
303
+ d[o] |= v;
304
+ d[o + 1] |= v >> 8;
305
+ d[o + 2] |= v >> 16;
306
+ };
307
+ var hTree = function(d, mb) {
308
+ var t = [];
309
+ for (var i2 = 0;i2 < d.length; ++i2) {
310
+ if (d[i2])
311
+ t.push({ s: i2, f: d[i2] });
312
+ }
313
+ var s = t.length;
314
+ var t2 = t.slice();
315
+ if (!s)
316
+ return { t: et, l: 0 };
317
+ if (s == 1) {
318
+ var v = new u8(t[0].s + 1);
319
+ v[t[0].s] = 1;
320
+ return { t: v, l: 1 };
321
+ }
322
+ t.sort(function(a, b) {
323
+ return a.f - b.f;
324
+ });
325
+ t.push({ s: -1, f: 25001 });
326
+ var l = t[0], r = t[1], i0 = 0, i1 = 1, i22 = 2;
327
+ t[0] = { s: -1, f: l.f + r.f, l, r };
328
+ while (i1 != s - 1) {
329
+ l = t[t[i0].f < t[i22].f ? i0++ : i22++];
330
+ r = t[i0 != i1 && t[i0].f < t[i22].f ? i0++ : i22++];
331
+ t[i1++] = { s: -1, f: l.f + r.f, l, r };
332
+ }
333
+ var maxSym = t2[0].s;
334
+ for (var i2 = 1;i2 < s; ++i2) {
335
+ if (t2[i2].s > maxSym)
336
+ maxSym = t2[i2].s;
337
+ }
338
+ var tr = new u16(maxSym + 1);
339
+ var mbt = ln(t[i1 - 1], tr, 0);
340
+ if (mbt > mb) {
341
+ var i2 = 0, dt = 0;
342
+ var lft = mbt - mb, cst = 1 << lft;
343
+ t2.sort(function(a, b) {
344
+ return tr[b.s] - tr[a.s] || a.f - b.f;
345
+ });
346
+ for (;i2 < s; ++i2) {
347
+ var i2_1 = t2[i2].s;
348
+ if (tr[i2_1] > mb) {
349
+ dt += cst - (1 << mbt - tr[i2_1]);
350
+ tr[i2_1] = mb;
351
+ } else
352
+ break;
353
+ }
354
+ dt >>= lft;
355
+ while (dt > 0) {
356
+ var i2_2 = t2[i2].s;
357
+ if (tr[i2_2] < mb)
358
+ dt -= 1 << mb - tr[i2_2]++ - 1;
359
+ else
360
+ ++i2;
361
+ }
362
+ for (;i2 >= 0 && dt; --i2) {
363
+ var i2_3 = t2[i2].s;
364
+ if (tr[i2_3] == mb) {
365
+ --tr[i2_3];
366
+ ++dt;
367
+ }
368
+ }
369
+ mbt = mb;
370
+ }
371
+ return { t: new u8(tr), l: mbt };
372
+ };
373
+ var ln = function(n, l, d) {
374
+ return n.s == -1 ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) : l[n.s] = d;
375
+ };
376
+ var lc = function(c) {
377
+ var s = c.length;
378
+ while (s && !c[--s])
379
+ ;
380
+ var cl = new u16(++s);
381
+ var cli = 0, cln = c[0], cls = 1;
382
+ var w = function(v) {
383
+ cl[cli++] = v;
384
+ };
385
+ for (var i2 = 1;i2 <= s; ++i2) {
386
+ if (c[i2] == cln && i2 != s)
387
+ ++cls;
388
+ else {
389
+ if (!cln && cls > 2) {
390
+ for (;cls > 138; cls -= 138)
391
+ w(32754);
392
+ if (cls > 2) {
393
+ w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);
394
+ cls = 0;
395
+ }
396
+ } else if (cls > 3) {
397
+ w(cln), --cls;
398
+ for (;cls > 6; cls -= 6)
399
+ w(8304);
400
+ if (cls > 2)
401
+ w(cls - 3 << 5 | 8208), cls = 0;
402
+ }
403
+ while (cls--)
404
+ w(cln);
405
+ cls = 1;
406
+ cln = c[i2];
407
+ }
408
+ }
409
+ return { c: cl.subarray(0, cli), n: s };
410
+ };
411
+ var clen = function(cf, cl) {
412
+ var l = 0;
413
+ for (var i2 = 0;i2 < cl.length; ++i2)
414
+ l += cf[i2] * cl[i2];
415
+ return l;
416
+ };
417
+ var wfblk = function(out, pos, dat) {
418
+ var s = dat.length;
419
+ var o = shft(pos + 2);
420
+ out[o] = s & 255;
421
+ out[o + 1] = s >> 8;
422
+ out[o + 2] = out[o] ^ 255;
423
+ out[o + 3] = out[o + 1] ^ 255;
424
+ for (var i2 = 0;i2 < s; ++i2)
425
+ out[o + i2 + 4] = dat[i2];
426
+ return (o + 4 + s) * 8;
427
+ };
428
+ var wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {
429
+ wbits(out, p++, final);
430
+ ++lf[256];
431
+ var _a2 = hTree(lf, 15), dlt = _a2.t, mlb = _a2.l;
432
+ var _b2 = hTree(df, 15), ddt = _b2.t, mdb = _b2.l;
433
+ var _c = lc(dlt), lclt = _c.c, nlc = _c.n;
434
+ var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;
435
+ var lcfreq = new u16(19);
436
+ for (var i2 = 0;i2 < lclt.length; ++i2)
437
+ ++lcfreq[lclt[i2] & 31];
438
+ for (var i2 = 0;i2 < lcdt.length; ++i2)
439
+ ++lcfreq[lcdt[i2] & 31];
440
+ var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;
441
+ var nlcc = 19;
442
+ for (;nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)
443
+ ;
444
+ var flen = bl + 5 << 3;
445
+ var ftlen = clen(lf, flt) + clen(df, fdt) + eb;
446
+ var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];
447
+ if (bs >= 0 && flen <= ftlen && flen <= dtlen)
448
+ return wfblk(out, p, dat.subarray(bs, bs + bl));
449
+ var lm, ll, dm, dl;
450
+ wbits(out, p, 1 + (dtlen < ftlen)), p += 2;
451
+ if (dtlen < ftlen) {
452
+ lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;
453
+ var llm = hMap(lct, mlcb, 0);
454
+ wbits(out, p, nlc - 257);
455
+ wbits(out, p + 5, ndc - 1);
456
+ wbits(out, p + 10, nlcc - 4);
457
+ p += 14;
458
+ for (var i2 = 0;i2 < nlcc; ++i2)
459
+ wbits(out, p + 3 * i2, lct[clim[i2]]);
460
+ p += 3 * nlcc;
461
+ var lcts = [lclt, lcdt];
462
+ for (var it = 0;it < 2; ++it) {
463
+ var clct = lcts[it];
464
+ for (var i2 = 0;i2 < clct.length; ++i2) {
465
+ var len = clct[i2] & 31;
466
+ wbits(out, p, llm[len]), p += lct[len];
467
+ if (len > 15)
468
+ wbits(out, p, clct[i2] >> 5 & 127), p += clct[i2] >> 12;
469
+ }
470
+ }
471
+ } else {
472
+ lm = flm, ll = flt, dm = fdm, dl = fdt;
473
+ }
474
+ for (var i2 = 0;i2 < li; ++i2) {
475
+ var sym = syms[i2];
476
+ if (sym > 255) {
477
+ var len = sym >> 18 & 31;
478
+ wbits16(out, p, lm[len + 257]), p += ll[len + 257];
479
+ if (len > 7)
480
+ wbits(out, p, sym >> 23 & 31), p += fleb[len];
481
+ var dst = sym & 31;
482
+ wbits16(out, p, dm[dst]), p += dl[dst];
483
+ if (dst > 3)
484
+ wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];
485
+ } else {
486
+ wbits16(out, p, lm[sym]), p += ll[sym];
487
+ }
488
+ }
489
+ wbits16(out, p, lm[256]);
490
+ return p + ll[256];
491
+ };
492
+ var deo = /* @__PURE__ */ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
493
+ var et = /* @__PURE__ */ new u8(0);
494
+ var dflt = function(dat, lvl, plvl, pre, post, st) {
495
+ var s = st.z || dat.length;
496
+ var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);
497
+ var w = o.subarray(pre, o.length - post);
498
+ var lst = st.l;
499
+ var pos = (st.r || 0) & 7;
500
+ if (lvl) {
501
+ if (pos)
502
+ w[0] = st.r >> 3;
503
+ var opt = deo[lvl - 1];
504
+ var n = opt >> 13, c = opt & 8191;
505
+ var msk_1 = (1 << plvl) - 1;
506
+ var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);
507
+ var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
508
+ var hsh = function(i3) {
509
+ return (dat[i3] ^ dat[i3 + 1] << bs1_1 ^ dat[i3 + 2] << bs2_1) & msk_1;
510
+ };
511
+ var syms = new i32(25000);
512
+ var lf = new u16(288), df = new u16(32);
513
+ var lc_1 = 0, eb = 0, i2 = st.i || 0, li = 0, wi = st.w || 0, bs = 0;
514
+ for (;i2 + 2 < s; ++i2) {
515
+ var hv = hsh(i2);
516
+ var imod = i2 & 32767, pimod = head[hv];
517
+ prev[imod] = pimod;
518
+ head[hv] = imod;
519
+ if (wi <= i2) {
520
+ var rem = s - i2;
521
+ if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) {
522
+ pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i2 - bs, pos);
523
+ li = lc_1 = eb = 0, bs = i2;
524
+ for (var j = 0;j < 286; ++j)
525
+ lf[j] = 0;
526
+ for (var j = 0;j < 30; ++j)
527
+ df[j] = 0;
528
+ }
529
+ var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;
530
+ if (rem > 2 && hv == hsh(i2 - dif)) {
531
+ var maxn = Math.min(n, rem) - 1;
532
+ var maxd = Math.min(32767, i2);
533
+ var ml = Math.min(258, rem);
534
+ while (dif <= maxd && --ch_1 && imod != pimod) {
535
+ if (dat[i2 + l] == dat[i2 + l - dif]) {
536
+ var nl = 0;
537
+ for (;nl < ml && dat[i2 + nl] == dat[i2 + nl - dif]; ++nl)
538
+ ;
539
+ if (nl > l) {
540
+ l = nl, d = dif;
541
+ if (nl > maxn)
542
+ break;
543
+ var mmd = Math.min(dif, nl - 2);
544
+ var md = 0;
545
+ for (var j = 0;j < mmd; ++j) {
546
+ var ti = i2 - dif + j & 32767;
547
+ var pti = prev[ti];
548
+ var cd = ti - pti & 32767;
549
+ if (cd > md)
550
+ md = cd, pimod = ti;
551
+ }
552
+ }
553
+ }
554
+ imod = pimod, pimod = prev[imod];
555
+ dif += imod - pimod & 32767;
556
+ }
557
+ }
558
+ if (d) {
559
+ syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];
560
+ var lin = revfl[l] & 31, din = revfd[d] & 31;
561
+ eb += fleb[lin] + fdeb[din];
562
+ ++lf[257 + lin];
563
+ ++df[din];
564
+ wi = i2 + l;
565
+ ++lc_1;
566
+ } else {
567
+ syms[li++] = dat[i2];
568
+ ++lf[dat[i2]];
569
+ }
570
+ }
571
+ }
572
+ for (i2 = Math.max(i2, wi);i2 < s; ++i2) {
573
+ syms[li++] = dat[i2];
574
+ ++lf[dat[i2]];
575
+ }
576
+ pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i2 - bs, pos);
577
+ if (!lst) {
578
+ st.r = pos & 7 | w[pos / 8 | 0] << 3;
579
+ pos -= 7;
580
+ st.h = head, st.p = prev, st.i = i2, st.w = wi;
581
+ }
582
+ } else {
583
+ for (var i2 = st.w || 0;i2 < s + lst; i2 += 65535) {
584
+ var e = i2 + 65535;
585
+ if (e >= s) {
586
+ w[pos / 8 | 0] = lst;
587
+ e = s;
588
+ }
589
+ pos = wfblk(w, pos + 1, dat.subarray(i2, e));
590
+ }
591
+ st.i = s;
592
+ }
593
+ return slc(o, 0, pre + shft(pos) + post);
594
+ };
595
+ var crct = /* @__PURE__ */ function() {
596
+ var t = new Int32Array(256);
597
+ for (var i2 = 0;i2 < 256; ++i2) {
598
+ var c = i2, k = 9;
599
+ while (--k)
600
+ c = (c & 1 && -306674912) ^ c >>> 1;
601
+ t[i2] = c;
602
+ }
603
+ return t;
604
+ }();
605
+ var crc = function() {
606
+ var c = -1;
607
+ return {
608
+ p: function(d) {
609
+ var cr = c;
610
+ for (var i2 = 0;i2 < d.length; ++i2)
611
+ cr = crct[cr & 255 ^ d[i2]] ^ cr >>> 8;
612
+ c = cr;
613
+ },
614
+ d: function() {
615
+ return ~c;
616
+ }
617
+ };
618
+ };
619
+ var dopt = function(dat, opt, pre, post, st) {
620
+ if (!st) {
621
+ st = { l: 1 };
622
+ if (opt.dictionary) {
623
+ var dict = opt.dictionary.subarray(-32768);
624
+ var newDat = new u8(dict.length + dat.length);
625
+ newDat.set(dict);
626
+ newDat.set(dat, dict.length);
627
+ dat = newDat;
628
+ st.w = dict.length;
629
+ }
630
+ }
631
+ 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);
632
+ };
633
+ var mrg = function(a, b) {
634
+ var o = {};
635
+ for (var k in a)
636
+ o[k] = a[k];
637
+ for (var k in b)
638
+ o[k] = b[k];
639
+ return o;
640
+ };
641
+ var b2 = function(d, b) {
642
+ return d[b] | d[b + 1] << 8;
643
+ };
644
+ var b4 = function(d, b) {
645
+ return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0;
646
+ };
647
+ var b8 = function(d, b) {
648
+ return b4(d, b) + b4(d, b + 4) * 4294967296;
649
+ };
650
+ var wbytes = function(d, b, v) {
651
+ for (;v; ++b)
652
+ d[b] = v, v >>>= 8;
653
+ };
654
+ function deflateSync(data, opts) {
655
+ return dopt(data, opts || {}, 0, 0);
656
+ }
657
+ function inflateSync(data, opts) {
658
+ return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);
659
+ }
660
+ var fltn = function(d, p, t, o) {
661
+ for (var k in d) {
662
+ var val = d[k], n = p + k, op = o;
663
+ if (Array.isArray(val))
664
+ op = mrg(o, val[1]), val = val[0];
665
+ if (ArrayBuffer.isView(val))
666
+ t[n] = [val, op];
667
+ else {
668
+ t[n += "/"] = [new u8(0), op];
669
+ fltn(val, n, t, o);
670
+ }
671
+ }
672
+ };
673
+ var te = typeof TextEncoder != "undefined" && /* @__PURE__ */ new TextEncoder;
674
+ var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder;
675
+ var tds = 0;
676
+ try {
677
+ td.decode(et, { stream: true });
678
+ tds = 1;
679
+ } catch (e) {}
680
+ var dutf8 = function(d) {
681
+ for (var r = "", i2 = 0;; ) {
682
+ var c = d[i2++];
683
+ var eb = (c > 127) + (c > 223) + (c > 239);
684
+ if (i2 + eb > d.length)
685
+ return { s: r, r: slc(d, i2 - 1) };
686
+ if (!eb)
687
+ r += String.fromCharCode(c);
688
+ else if (eb == 3) {
689
+ c = ((c & 15) << 18 | (d[i2++] & 63) << 12 | (d[i2++] & 63) << 6 | d[i2++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);
690
+ } else if (eb & 1)
691
+ r += String.fromCharCode((c & 31) << 6 | d[i2++] & 63);
692
+ else
693
+ r += String.fromCharCode((c & 15) << 12 | (d[i2++] & 63) << 6 | d[i2++] & 63);
694
+ }
695
+ };
696
+ function strToU8(str, latin1) {
697
+ if (latin1) {
698
+ var ar_1 = new u8(str.length);
699
+ for (var i2 = 0;i2 < str.length; ++i2)
700
+ ar_1[i2] = str.charCodeAt(i2);
701
+ return ar_1;
702
+ }
703
+ if (te)
704
+ return te.encode(str);
705
+ var l = str.length;
706
+ var ar = new u8(str.length + (str.length >> 1));
707
+ var ai = 0;
708
+ var w = function(v) {
709
+ ar[ai++] = v;
710
+ };
711
+ for (var i2 = 0;i2 < l; ++i2) {
712
+ if (ai + 5 > ar.length) {
713
+ var n = new u8(ai + 8 + (l - i2 << 1));
714
+ n.set(ar);
715
+ ar = n;
716
+ }
717
+ var c = str.charCodeAt(i2);
718
+ if (c < 128 || latin1)
719
+ w(c);
720
+ else if (c < 2048)
721
+ w(192 | c >> 6), w(128 | c & 63);
722
+ else if (c > 55295 && c < 57344)
723
+ 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);
724
+ else
725
+ w(224 | c >> 12), w(128 | c >> 6 & 63), w(128 | c & 63);
726
+ }
727
+ return slc(ar, 0, ai);
728
+ }
729
+ function strFromU8(dat, latin1) {
730
+ if (latin1) {
731
+ var r = "";
732
+ for (var i2 = 0;i2 < dat.length; i2 += 16384)
733
+ r += String.fromCharCode.apply(null, dat.subarray(i2, i2 + 16384));
734
+ return r;
735
+ } else if (td) {
736
+ return td.decode(dat);
737
+ } else {
738
+ var _a2 = dutf8(dat), s = _a2.s, r = _a2.r;
739
+ if (r.length)
740
+ err(8);
741
+ return s;
742
+ }
743
+ }
744
+ var slzh = function(d, b) {
745
+ return b + 30 + b2(d, b + 26) + b2(d, b + 28);
746
+ };
747
+ var zh = function(d, b, z) {
748
+ var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;
749
+ var _a2 = z64hs(d, es, efl, z, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a2[0], su = _a2[1], off = _a2[2];
750
+ return [b2(d, b + 10), sc, su, fn, es + efl + b2(d, b + 32), off];
751
+ };
752
+ var z64hs = function(d, b, l, z, sc, su, off) {
753
+ var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;
754
+ var nf = nsc + nsu + noff;
755
+ if (z && nf) {
756
+ for (;b + 4 < e; b += 4 + b2(d, b + 2)) {
757
+ if (b2(d, b) == 1) {
758
+ return [
759
+ nsc ? b8(d, b + 4 + 8 * nsu) : sc,
760
+ nsu ? b8(d, b + 4) : su,
761
+ noff ? b8(d, b + 4 + 8 * (nsu + nsc)) : off,
762
+ 1
763
+ ];
764
+ }
765
+ }
766
+ if (z < 2)
767
+ err(13);
768
+ }
769
+ return [sc, su, off, 0];
770
+ };
771
+ var exfl = function(ex) {
772
+ var le = 0;
773
+ if (ex) {
774
+ for (var k in ex) {
775
+ var l = ex[k].length;
776
+ if (l > 65535)
777
+ err(9);
778
+ le += l + 4;
779
+ }
780
+ }
781
+ return le;
782
+ };
783
+ var wzh = function(d, b, f, fn, u, c, ce, co) {
784
+ var fl2 = fn.length, ex = f.extra, col = co && co.length;
785
+ var exl = exfl(ex);
786
+ wbytes(d, b, ce != null ? 33639248 : 67324752), b += 4;
787
+ if (ce != null)
788
+ d[b++] = 20, d[b++] = f.os;
789
+ d[b] = 20, b += 2;
790
+ d[b++] = f.flag << 1 | (c < 0 && 8), d[b++] = u && 8;
791
+ d[b++] = f.compression & 255, d[b++] = f.compression >> 8;
792
+ var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;
793
+ if (y < 0 || y > 119)
794
+ err(10);
795
+ wbytes(d, b, y << 25 | dt.getMonth() + 1 << 21 | dt.getDate() << 16 | dt.getHours() << 11 | dt.getMinutes() << 5 | dt.getSeconds() >> 1), b += 4;
796
+ if (c != -1) {
797
+ wbytes(d, b, f.crc);
798
+ wbytes(d, b + 4, c < 0 ? -c - 2 : c);
799
+ wbytes(d, b + 8, f.size);
800
+ }
801
+ wbytes(d, b + 12, fl2);
802
+ wbytes(d, b + 14, exl), b += 16;
803
+ if (ce != null) {
804
+ wbytes(d, b, col);
805
+ wbytes(d, b + 6, f.attrs);
806
+ wbytes(d, b + 10, ce), b += 14;
807
+ }
808
+ d.set(fn, b);
809
+ b += fl2;
810
+ if (exl) {
811
+ for (var k in ex) {
812
+ var exf = ex[k], l = exf.length;
813
+ wbytes(d, b, +k);
814
+ wbytes(d, b + 2, l);
815
+ d.set(exf, b + 4), b += 4 + l;
816
+ }
817
+ }
818
+ if (col)
819
+ d.set(co, b), b += col;
820
+ return b;
821
+ };
822
+ var wzf = function(o, b, c, d, e) {
823
+ wbytes(o, b, 101010256);
824
+ wbytes(o, b + 8, c);
825
+ wbytes(o, b + 10, c);
826
+ wbytes(o, b + 12, d);
827
+ wbytes(o, b + 16, e);
828
+ };
829
+ function zipSync(data, opts) {
830
+ if (!opts)
831
+ opts = {};
832
+ var r = {};
833
+ var files = [];
834
+ fltn(data, "", r, opts);
835
+ var o = 0;
836
+ var tot = 0;
837
+ for (var fn in r) {
838
+ var _a2 = r[fn], file = _a2[0], p = _a2[1];
839
+ var compression = p.level == 0 ? 0 : 8;
840
+ var f = strToU8(fn), s = f.length;
841
+ var com = p.comment, m = com && strToU8(com), ms = m && m.length;
842
+ var exl = exfl(p.extra);
843
+ if (s > 65535)
844
+ err(11);
845
+ var d = compression ? deflateSync(file, p) : file, l = d.length;
846
+ var c = crc();
847
+ c.p(file);
848
+ files.push(mrg(p, {
849
+ size: file.length,
850
+ crc: c.d(),
851
+ c: d,
852
+ f,
853
+ m,
854
+ u: s != fn.length || m && com.length != ms,
855
+ o,
856
+ compression
857
+ }));
858
+ o += 30 + s + exl + l;
859
+ tot += 76 + 2 * (s + exl) + (ms || 0) + l;
860
+ }
861
+ var out = new u8(tot + 22), oe = o, cdl = tot - o;
862
+ for (var i2 = 0;i2 < files.length; ++i2) {
863
+ var f = files[i2];
864
+ wzh(out, f.o, f, f.f, f.u, f.c.length);
865
+ var badd = 30 + f.f.length + exfl(f.extra);
866
+ out.set(f.c, f.o + badd);
867
+ wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);
868
+ }
869
+ wzf(out, o, files.length, cdl, oe);
870
+ return out;
871
+ }
872
+ function unzipSync(data, opts) {
873
+ var files = {};
874
+ var e = data.length - 22;
875
+ for (;b4(data, e) != 101010256; --e) {
876
+ if (!e || data.length - e > 65558)
877
+ err(13);
878
+ }
879
+ var c = b2(data, e + 8);
880
+ if (!c)
881
+ return {};
882
+ var o = b4(data, e + 16);
883
+ var z = b4(data, e - 20) == 117853008;
884
+ if (z) {
885
+ var ze = b4(data, e - 12);
886
+ z = b4(data, ze) == 101075792;
887
+ if (z) {
888
+ c = b4(data, ze + 32);
889
+ o = b4(data, ze + 48);
890
+ }
891
+ }
892
+ var fltr = opts && opts.filter;
893
+ for (var i2 = 0;i2 < c; ++i2) {
894
+ var _a2 = zh(data, o, z), c_2 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off);
895
+ o = no;
896
+ if (!fltr || fltr({
897
+ name: fn,
898
+ size: sc,
899
+ originalSize: su,
900
+ compression: c_2
901
+ })) {
902
+ if (!c_2)
903
+ files[fn] = slc(data, b, b + sc);
904
+ else if (c_2 == 8)
905
+ files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) });
906
+ else
907
+ err(14, "unknown compression type " + c_2);
908
+ }
909
+ }
910
+ return files;
911
+ }
912
+
913
+ // ../packager/packager-core/dist/index.js
914
+ class Path {
915
+ static normalize(path) {
916
+ return path.replace(/\\/g, "/").replace(/\/+/g, "/");
917
+ }
918
+ static join(...segments) {
919
+ return Path.normalize(segments.filter((s) => s.length > 0).join("/"));
920
+ }
921
+ static dirname(path) {
922
+ const normalized = Path.normalize(path).replace(/\/$/, "");
923
+ if (normalized === "")
924
+ return ".";
925
+ const lastSlash = normalized.lastIndexOf("/");
926
+ if (lastSlash === -1)
927
+ return ".";
928
+ if (lastSlash === 0)
929
+ return "/";
930
+ return normalized.substring(0, lastSlash);
931
+ }
932
+ static basename(path) {
933
+ const normalized = Path.normalize(path).replace(/\/$/, "");
934
+ if (normalized === "")
935
+ return "";
936
+ const lastSlash = normalized.lastIndexOf("/");
937
+ return lastSlash >= 0 ? normalized.substring(lastSlash + 1) : normalized;
938
+ }
939
+ static extname(path) {
940
+ const base = Path.basename(path);
941
+ const lastDot = base.lastIndexOf(".");
942
+ if (lastDot === -1 || lastDot === 0 || lastDot === base.length - 1) {
943
+ return "";
944
+ }
945
+ return base.substring(lastDot);
946
+ }
947
+ static async walkDirectory(fs, rootPath, currentRelativePath = "") {
948
+ const entries = [];
949
+ const absolutePath = currentRelativePath ? Path.join(rootPath, currentRelativePath) : rootPath;
950
+ const items = await fs.readdir(absolutePath);
951
+ for (const item of items) {
952
+ const itemRelativePath = currentRelativePath ? Path.join(currentRelativePath, item) : item;
953
+ const itemAbsolutePath = Path.join(rootPath, itemRelativePath);
954
+ const stat = await fs.stat(itemAbsolutePath);
955
+ if (stat?.isDirectory()) {
956
+ const subEntries = await Path.walkDirectory(fs, rootPath, itemRelativePath);
957
+ entries.push(...subEntries);
958
+ } else if (stat?.isFile()) {
959
+ entries.push({
960
+ relativePath: Path.normalize(itemRelativePath),
961
+ absolutePath: Path.normalize(itemAbsolutePath)
962
+ });
963
+ }
964
+ }
965
+ return entries;
966
+ }
967
+ }
968
+
969
+ class TemporaryStorageService {
970
+ fileSystem;
971
+ _tempFolderPath = null;
972
+ constructor(fileSystem) {
973
+ this.fileSystem = fileSystem;
974
+ }
975
+ async getTempFolderPath() {
976
+ if (!this._tempFolderPath) {
977
+ const systemTempDir = await this.fileSystem.getTempDir();
978
+ const uniqueFolderName = this.generateUniqueFolderName();
979
+ this._tempFolderPath = Path.join(systemTempDir, uniqueFolderName);
980
+ await this.fileSystem.mkdir(this._tempFolderPath);
981
+ }
982
+ return this._tempFolderPath;
983
+ }
984
+ generateUniqueFolderName() {
985
+ const timestamp = Date.now();
986
+ const random = Math.random().toString(36).substring(2, 10);
987
+ return `tool-temp-${timestamp}-${random}`;
988
+ }
989
+ async getTempSubfolderPathAsync(subfolder) {
990
+ const tempFolderPath = await this.getTempFolderPath();
991
+ const inputPath = Path.join(tempFolderPath, subfolder);
992
+ await this.fileSystem.mkdir(inputPath);
993
+ return inputPath;
994
+ }
995
+ async cleanup() {
996
+ try {
997
+ if (!this._tempFolderPath) {
998
+ return;
999
+ }
1000
+ try {
1001
+ const stats = await this.fileSystem.stat(this._tempFolderPath);
1002
+ if (!stats) {
1003
+ return;
1004
+ }
1005
+ } catch {
1006
+ return;
1007
+ }
1008
+ const _pathToCleanup = this._tempFolderPath;
1009
+ await this.fileSystem.rm(this._tempFolderPath);
1010
+ this._tempFolderPath = null;
1011
+ } catch {}
1012
+ }
1013
+ }
1014
+
1015
+ class ZipService {
1016
+ fileSystem;
1017
+ constructor(fileSystem) {
1018
+ this.fileSystem = fileSystem;
1019
+ }
1020
+ async extractAsync(zipData, targetPath) {
1021
+ const normalizedTarget = targetPath.replace(/\/$/, "");
1022
+ const files = unzipSync(zipData);
1023
+ const dirsToCreate = new Set([normalizedTarget]);
1024
+ const filesToWrite = [];
1025
+ const extractedPaths = [];
1026
+ for (const [relativePath, data] of Object.entries(files)) {
1027
+ if (relativePath.endsWith("/") || data.length === 0) {
1028
+ const dirPath = `${normalizedTarget}/${relativePath.replace(/\/$/, "")}`;
1029
+ if (!dirPath.startsWith(`${normalizedTarget}/`)) {
1030
+ throw new Error(`Zip-slip detected: entry "${relativePath}" escapes extraction directory`);
1031
+ }
1032
+ dirsToCreate.add(dirPath);
1033
+ continue;
1034
+ }
1035
+ const fullPath = `${normalizedTarget}/${relativePath}`;
1036
+ if (!fullPath.startsWith(`${normalizedTarget}/`)) {
1037
+ throw new Error(`Zip-slip detected: entry "${relativePath}" escapes extraction directory`);
1038
+ }
1039
+ const parentDir = fullPath.split("/").slice(0, -1).join("/");
1040
+ if (parentDir) {
1041
+ dirsToCreate.add(parentDir);
1042
+ }
1043
+ filesToWrite.push({ path: fullPath, data });
1044
+ extractedPaths.push(fullPath);
1045
+ }
1046
+ await Promise.all(Array.from(dirsToCreate, (dir) => this.fileSystem.mkdir(dir)));
1047
+ await Promise.all(filesToWrite.map(({ path, data }) => this.fileSystem.writeFile(path, data)));
1048
+ return extractedPaths;
1049
+ }
1050
+ async compressAsync(sourcePath) {
1051
+ const normalizedSource = sourcePath.replace(/\/$/, "");
1052
+ const entries = await Path.walkDirectory(this.fileSystem, normalizedSource);
1053
+ const fileContents = await Promise.all(entries.map(async (entry) => ({
1054
+ relativePath: entry.relativePath,
1055
+ data: await this.fileSystem.readFile(entry.absolutePath)
1056
+ })));
1057
+ const zippable = {};
1058
+ for (const { relativePath, data } of fileContents) {
1059
+ if (data) {
1060
+ zippable[relativePath] = data;
1061
+ }
1062
+ }
1063
+ const zipData = zipSync(zippable, {
1064
+ level: 6
1065
+ });
1066
+ return zipData;
1067
+ }
1068
+ }
1069
+ function isPluralForm(value) {
1070
+ return typeof value === "object" && value !== null && "other" in value;
1071
+ }
1072
+ function selectPluralForm(forms, count) {
1073
+ if (count === 0 && forms.zero !== undefined) {
1074
+ return forms.zero;
1075
+ }
1076
+ if (count === 1 && forms.one !== undefined) {
1077
+ return forms.one;
1078
+ }
1079
+ if (count === 2 && forms.two !== undefined) {
1080
+ return forms.two;
1081
+ }
1082
+ if (forms.few !== undefined) {
1083
+ const mod10 = count % 10;
1084
+ const mod100 = count % 100;
1085
+ if (mod10 >= 2 && mod10 <= 4 && (mod100 < 10 || mod100 >= 20)) {
1086
+ return forms.few;
1087
+ }
1088
+ }
1089
+ if (forms.many !== undefined) {
1090
+ const mod10 = count % 10;
1091
+ const mod100 = count % 100;
1092
+ if (count === 0 || mod10 === 0 && mod100 !== 0 || mod10 >= 5 && mod10 <= 9 || mod100 >= 11 && mod100 <= 14) {
1093
+ return forms.many;
1094
+ }
1095
+ }
1096
+ return forms.other;
1097
+ }
1098
+
1099
+ class I18nManager {
1100
+ static translations = {};
1101
+ static currentLocale = "en";
1102
+ static fallbackLocale = "en";
1103
+ static registerTranslations(locale, catalog) {
1104
+ if (!I18nManager.translations[locale]) {
1105
+ I18nManager.translations[locale] = {};
1106
+ }
1107
+ I18nManager.translations[locale] = I18nManager.deepMerge(I18nManager.translations[locale], catalog);
1108
+ }
1109
+ static setLocale(locale) {
1110
+ const normalized = I18nManager.normalizeLocale(locale);
1111
+ if (I18nManager.translations[normalized]) {
1112
+ I18nManager.currentLocale = normalized;
1113
+ return normalized;
1114
+ }
1115
+ const baseLocale = normalized.split("-")[0];
1116
+ if (baseLocale !== normalized && I18nManager.translations[baseLocale]) {
1117
+ I18nManager.currentLocale = baseLocale;
1118
+ return baseLocale;
1119
+ }
1120
+ return I18nManager.currentLocale;
1121
+ }
1122
+ static getLocale() {
1123
+ return I18nManager.currentLocale;
1124
+ }
1125
+ static setFallbackLocale(locale) {
1126
+ I18nManager.fallbackLocale = I18nManager.normalizeLocale(locale);
1127
+ }
1128
+ static t(key, params, locale) {
1129
+ const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
1130
+ let value = I18nManager.getTranslationValue(key, targetLocale);
1131
+ if (value === undefined && targetLocale !== I18nManager.fallbackLocale) {
1132
+ value = I18nManager.getTranslationValue(key, I18nManager.fallbackLocale);
1133
+ }
1134
+ if (value === undefined) {
1135
+ return key;
1136
+ }
1137
+ if (isPluralForm(value) && params && "count" in params) {
1138
+ const count = typeof params.count === "number" ? params.count : Number(params.count);
1139
+ value = selectPluralForm(value, count);
1140
+ } else if (isPluralForm(value)) {
1141
+ value = value.other;
1142
+ }
1143
+ if (typeof value !== "string") {
1144
+ return key;
1145
+ }
1146
+ return params ? I18nManager.interpolate(value, params) : value;
1147
+ }
1148
+ static has(key, locale) {
1149
+ const targetLocale = locale ? I18nManager.normalizeLocale(locale) : I18nManager.currentLocale;
1150
+ const value = I18nManager.getTranslationValue(key, targetLocale);
1151
+ if (value !== undefined) {
1152
+ return true;
1153
+ }
1154
+ if (targetLocale !== I18nManager.fallbackLocale) {
1155
+ return I18nManager.getTranslationValue(key, I18nManager.fallbackLocale) !== undefined;
1156
+ }
1157
+ return false;
1158
+ }
1159
+ static getAvailableLocales() {
1160
+ return Object.keys(I18nManager.translations);
1161
+ }
1162
+ static clearTranslations() {
1163
+ I18nManager.translations = {};
1164
+ I18nManager.currentLocale = "en";
1165
+ }
1166
+ static getTranslationValue(key, locale) {
1167
+ const catalog = I18nManager.translations[locale];
1168
+ if (!catalog) {
1169
+ return;
1170
+ }
1171
+ const keys = key.split(".");
1172
+ let value = catalog;
1173
+ for (const k of keys) {
1174
+ if (value && typeof value === "object" && k in value) {
1175
+ value = value[k];
1176
+ } else {
1177
+ return;
1178
+ }
1179
+ }
1180
+ return value;
1181
+ }
1182
+ static interpolate(template, params) {
1183
+ return template.replace(/\{(\w+)\}/g, (_, key) => {
1184
+ const value = params[key];
1185
+ return value !== undefined ? String(value) : `{${key}}`;
1186
+ });
1187
+ }
1188
+ static normalizeLocale(locale) {
1189
+ const normalized = locale.toLowerCase().replace(/_/g, "-");
1190
+ const specialLocales = ["es-mx", "pt-br", "zh-cn", "zh-tw"];
1191
+ if (specialLocales.includes(normalized)) {
1192
+ return normalized;
1193
+ }
1194
+ return normalized.split("-")[0];
1195
+ }
1196
+ static deepMerge(target, source) {
1197
+ const result = { ...target };
1198
+ for (const key of Object.keys(source)) {
1199
+ const sourceValue = source[key];
1200
+ const targetValue = result[key];
1201
+ if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) {
1202
+ result[key] = I18nManager.deepMerge(targetValue, sourceValue);
1203
+ } else {
1204
+ result[key] = sourceValue;
1205
+ }
1206
+ }
1207
+ return result;
1208
+ }
1209
+ }
1210
+ var de = {
1211
+ toolCore: {
1212
+ errors: {
1213
+ internal: "Internal error: {message}",
1214
+ fileNotFound: "File not found: {path}",
1215
+ fileReadFailed: "Failed to read file: {path}",
1216
+ fileWriteFailed: "Failed to write file: {path}",
1217
+ directoryNotFound: "Directory not found: {path}",
1218
+ invalidPath: "{path} is not a valid path",
1219
+ operationCanceled: "Operation was canceled",
1220
+ invalidParameter: "Invalid parameter: {parameter}"
1221
+ },
1222
+ progress: {
1223
+ copying: "Copying files...",
1224
+ building: "Building project...",
1225
+ packaging: "Creating package...",
1226
+ validating: "Validating...",
1227
+ analyzing: "Analyzing...",
1228
+ restoring: "Restoring dependencies..."
1229
+ },
1230
+ validation: {
1231
+ requiredField: "{field} is required",
1232
+ invalidValue: "Invalid value for {field}",
1233
+ pathNotFound: "Path not found: {path}",
1234
+ fileRequired: "File is required: {path}",
1235
+ directoryRequired: "Directory is required: {path}"
1236
+ },
1237
+ warnings: {
1238
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1239
+ },
1240
+ info: {
1241
+ operationComplete: "Operation completed successfully",
1242
+ filesProcessed: {
1243
+ zero: "No files processed",
1244
+ one: "{count} file processed",
1245
+ other: "{count} files processed"
1246
+ }
1247
+ }
1248
+ }
1249
+ };
1250
+ var en = {
1251
+ toolCore: {
1252
+ errors: {
1253
+ internal: "Internal error: {message}",
1254
+ fileNotFound: "File not found: {path}",
1255
+ fileReadFailed: "Failed to read file: {path}",
1256
+ fileWriteFailed: "Failed to write file: {path}",
1257
+ directoryNotFound: "Directory not found: {path}",
1258
+ invalidPath: "{path} is not a valid path",
1259
+ operationCanceled: "Operation was canceled",
1260
+ invalidParameter: "Invalid parameter: {parameter}"
1261
+ },
1262
+ progress: {
1263
+ copying: "Copying files...",
1264
+ building: "Building project...",
1265
+ packaging: "Creating package...",
1266
+ validating: "Validating...",
1267
+ analyzing: "Analyzing...",
1268
+ restoring: "Restoring dependencies..."
1269
+ },
1270
+ validation: {
1271
+ requiredField: "{field} is required",
1272
+ invalidValue: "Invalid value for {field}",
1273
+ pathNotFound: "Path not found: {path}",
1274
+ fileRequired: "File is required: {path}",
1275
+ directoryRequired: "Directory is required: {path}"
1276
+ },
1277
+ warnings: {
1278
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1279
+ },
1280
+ info: {
1281
+ operationComplete: "Operation completed successfully",
1282
+ filesProcessed: {
1283
+ zero: "No files processed",
1284
+ one: "{count} file processed",
1285
+ other: "{count} files processed"
1286
+ }
1287
+ }
1288
+ }
1289
+ };
1290
+ var es = {
1291
+ toolCore: {
1292
+ errors: {
1293
+ internal: "Internal error: {message}",
1294
+ fileNotFound: "File not found: {path}",
1295
+ fileReadFailed: "Failed to read file: {path}",
1296
+ fileWriteFailed: "Failed to write file: {path}",
1297
+ directoryNotFound: "Directory not found: {path}",
1298
+ invalidPath: "{path} is not a valid path",
1299
+ operationCanceled: "Operation was canceled",
1300
+ invalidParameter: "Invalid parameter: {parameter}"
1301
+ },
1302
+ progress: {
1303
+ copying: "Copying files...",
1304
+ building: "Building project...",
1305
+ packaging: "Creating package...",
1306
+ validating: "Validating...",
1307
+ analyzing: "Analyzing...",
1308
+ restoring: "Restoring dependencies..."
1309
+ },
1310
+ validation: {
1311
+ requiredField: "{field} is required",
1312
+ invalidValue: "Invalid value for {field}",
1313
+ pathNotFound: "Path not found: {path}",
1314
+ fileRequired: "File is required: {path}",
1315
+ directoryRequired: "Directory is required: {path}"
1316
+ },
1317
+ warnings: {
1318
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1319
+ },
1320
+ info: {
1321
+ operationComplete: "Operation completed successfully",
1322
+ filesProcessed: {
1323
+ zero: "No files processed",
1324
+ one: "{count} file processed",
1325
+ other: "{count} files processed"
1326
+ }
1327
+ }
1328
+ }
1329
+ };
1330
+ var es_MX = {
1331
+ toolCore: {
1332
+ errors: {
1333
+ internal: "Internal error: {message}",
1334
+ fileNotFound: "File not found: {path}",
1335
+ fileReadFailed: "Failed to read file: {path}",
1336
+ fileWriteFailed: "Failed to write file: {path}",
1337
+ directoryNotFound: "Directory not found: {path}",
1338
+ invalidPath: "{path} is not a valid path",
1339
+ operationCanceled: "Operation was canceled",
1340
+ invalidParameter: "Invalid parameter: {parameter}"
1341
+ },
1342
+ progress: {
1343
+ copying: "Copying files...",
1344
+ building: "Building project...",
1345
+ packaging: "Creating package...",
1346
+ validating: "Validating...",
1347
+ analyzing: "Analyzing...",
1348
+ restoring: "Restoring dependencies..."
1349
+ },
1350
+ validation: {
1351
+ requiredField: "{field} is required",
1352
+ invalidValue: "Invalid value for {field}",
1353
+ pathNotFound: "Path not found: {path}",
1354
+ fileRequired: "File is required: {path}",
1355
+ directoryRequired: "Directory is required: {path}"
1356
+ },
1357
+ warnings: {
1358
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1359
+ },
1360
+ info: {
1361
+ operationComplete: "Operation completed successfully",
1362
+ filesProcessed: {
1363
+ zero: "No files processed",
1364
+ one: "{count} file processed",
1365
+ other: "{count} files processed"
1366
+ }
1367
+ }
1368
+ }
1369
+ };
1370
+ var fr = {
1371
+ toolCore: {
1372
+ errors: {
1373
+ internal: "Internal error: {message}",
1374
+ fileNotFound: "File not found: {path}",
1375
+ fileReadFailed: "Failed to read file: {path}",
1376
+ fileWriteFailed: "Failed to write file: {path}",
1377
+ directoryNotFound: "Directory not found: {path}",
1378
+ invalidPath: "{path} is not a valid path",
1379
+ operationCanceled: "Operation was canceled",
1380
+ invalidParameter: "Invalid parameter: {parameter}"
1381
+ },
1382
+ progress: {
1383
+ copying: "Copying files...",
1384
+ building: "Building project...",
1385
+ packaging: "Creating package...",
1386
+ validating: "Validating...",
1387
+ analyzing: "Analyzing...",
1388
+ restoring: "Restoring dependencies..."
1389
+ },
1390
+ validation: {
1391
+ requiredField: "{field} is required",
1392
+ invalidValue: "Invalid value for {field}",
1393
+ pathNotFound: "Path not found: {path}",
1394
+ fileRequired: "File is required: {path}",
1395
+ directoryRequired: "Directory is required: {path}"
1396
+ },
1397
+ warnings: {
1398
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1399
+ },
1400
+ info: {
1401
+ operationComplete: "Operation completed successfully",
1402
+ filesProcessed: {
1403
+ zero: "No files processed",
1404
+ one: "{count} file processed",
1405
+ other: "{count} files processed"
1406
+ }
1407
+ }
1408
+ }
1409
+ };
1410
+ var ja = {
1411
+ toolCore: {
1412
+ errors: {
1413
+ internal: "Internal error: {message}",
1414
+ fileNotFound: "File not found: {path}",
1415
+ fileReadFailed: "Failed to read file: {path}",
1416
+ fileWriteFailed: "Failed to write file: {path}",
1417
+ directoryNotFound: "Directory not found: {path}",
1418
+ invalidPath: "{path} is not a valid path",
1419
+ operationCanceled: "Operation was canceled",
1420
+ invalidParameter: "Invalid parameter: {parameter}"
1421
+ },
1422
+ progress: {
1423
+ copying: "Copying files...",
1424
+ building: "Building project...",
1425
+ packaging: "Creating package...",
1426
+ validating: "Validating...",
1427
+ analyzing: "Analyzing...",
1428
+ restoring: "Restoring dependencies..."
1429
+ },
1430
+ validation: {
1431
+ requiredField: "{field} is required",
1432
+ invalidValue: "Invalid value for {field}",
1433
+ pathNotFound: "Path not found: {path}",
1434
+ fileRequired: "File is required: {path}",
1435
+ directoryRequired: "Directory is required: {path}"
1436
+ },
1437
+ warnings: {
1438
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1439
+ },
1440
+ info: {
1441
+ operationComplete: "Operation completed successfully",
1442
+ filesProcessed: {
1443
+ zero: "No files processed",
1444
+ one: "{count} file processed",
1445
+ other: "{count} files processed"
1446
+ }
1447
+ }
1448
+ }
1449
+ };
1450
+ var ko = {
1451
+ toolCore: {
1452
+ errors: {
1453
+ internal: "Internal error: {message}",
1454
+ fileNotFound: "File not found: {path}",
1455
+ fileReadFailed: "Failed to read file: {path}",
1456
+ fileWriteFailed: "Failed to write file: {path}",
1457
+ directoryNotFound: "Directory not found: {path}",
1458
+ invalidPath: "{path} is not a valid path",
1459
+ operationCanceled: "Operation was canceled",
1460
+ invalidParameter: "Invalid parameter: {parameter}"
1461
+ },
1462
+ progress: {
1463
+ copying: "Copying files...",
1464
+ building: "Building project...",
1465
+ packaging: "Creating package...",
1466
+ validating: "Validating...",
1467
+ analyzing: "Analyzing...",
1468
+ restoring: "Restoring dependencies..."
1469
+ },
1470
+ validation: {
1471
+ requiredField: "{field} is required",
1472
+ invalidValue: "Invalid value for {field}",
1473
+ pathNotFound: "Path not found: {path}",
1474
+ fileRequired: "File is required: {path}",
1475
+ directoryRequired: "Directory is required: {path}"
1476
+ },
1477
+ warnings: {
1478
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1479
+ },
1480
+ info: {
1481
+ operationComplete: "Operation completed successfully",
1482
+ filesProcessed: {
1483
+ zero: "No files processed",
1484
+ one: "{count} file processed",
1485
+ other: "{count} files processed"
1486
+ }
1487
+ }
1488
+ }
1489
+ };
1490
+ var pt = {
1491
+ toolCore: {
1492
+ errors: {
1493
+ internal: "Internal error: {message}",
1494
+ fileNotFound: "File not found: {path}",
1495
+ fileReadFailed: "Failed to read file: {path}",
1496
+ fileWriteFailed: "Failed to write file: {path}",
1497
+ directoryNotFound: "Directory not found: {path}",
1498
+ invalidPath: "{path} is not a valid path",
1499
+ operationCanceled: "Operation was canceled",
1500
+ invalidParameter: "Invalid parameter: {parameter}"
1501
+ },
1502
+ progress: {
1503
+ copying: "Copying files...",
1504
+ building: "Building project...",
1505
+ packaging: "Creating package...",
1506
+ validating: "Validating...",
1507
+ analyzing: "Analyzing...",
1508
+ restoring: "Restoring dependencies..."
1509
+ },
1510
+ validation: {
1511
+ requiredField: "{field} is required",
1512
+ invalidValue: "Invalid value for {field}",
1513
+ pathNotFound: "Path not found: {path}",
1514
+ fileRequired: "File is required: {path}",
1515
+ directoryRequired: "Directory is required: {path}"
1516
+ },
1517
+ warnings: {
1518
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1519
+ },
1520
+ info: {
1521
+ operationComplete: "Operation completed successfully",
1522
+ filesProcessed: {
1523
+ zero: "No files processed",
1524
+ one: "{count} file processed",
1525
+ other: "{count} files processed"
1526
+ }
1527
+ }
1528
+ }
1529
+ };
1530
+ var pt_BR = {
1531
+ toolCore: {
1532
+ errors: {
1533
+ internal: "Internal error: {message}",
1534
+ fileNotFound: "File not found: {path}",
1535
+ fileReadFailed: "Failed to read file: {path}",
1536
+ fileWriteFailed: "Failed to write file: {path}",
1537
+ directoryNotFound: "Directory not found: {path}",
1538
+ invalidPath: "{path} is not a valid path",
1539
+ operationCanceled: "Operation was canceled",
1540
+ invalidParameter: "Invalid parameter: {parameter}"
1541
+ },
1542
+ progress: {
1543
+ copying: "Copying files...",
1544
+ building: "Building project...",
1545
+ packaging: "Creating package...",
1546
+ validating: "Validating...",
1547
+ analyzing: "Analyzing...",
1548
+ restoring: "Restoring dependencies..."
1549
+ },
1550
+ validation: {
1551
+ requiredField: "{field} is required",
1552
+ invalidValue: "Invalid value for {field}",
1553
+ pathNotFound: "Path not found: {path}",
1554
+ fileRequired: "File is required: {path}",
1555
+ directoryRequired: "Directory is required: {path}"
1556
+ },
1557
+ warnings: {
1558
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1559
+ },
1560
+ info: {
1561
+ operationComplete: "Operation completed successfully",
1562
+ filesProcessed: {
1563
+ zero: "No files processed",
1564
+ one: "{count} file processed",
1565
+ other: "{count} files processed"
1566
+ }
1567
+ }
1568
+ }
1569
+ };
1570
+ var ro = {
1571
+ toolCore: {
1572
+ errors: {
1573
+ internal: "Internal error: {message}",
1574
+ fileNotFound: "File not found: {path}",
1575
+ fileReadFailed: "Failed to read file: {path}",
1576
+ fileWriteFailed: "Failed to write file: {path}",
1577
+ directoryNotFound: "Directory not found: {path}",
1578
+ invalidPath: "{path} is not a valid path",
1579
+ operationCanceled: "Operation was canceled",
1580
+ invalidParameter: "Invalid parameter: {parameter}"
1581
+ },
1582
+ progress: {
1583
+ copying: "Copying files...",
1584
+ building: "Building project...",
1585
+ packaging: "Creating package...",
1586
+ validating: "Validating...",
1587
+ analyzing: "Analyzing...",
1588
+ restoring: "Restoring dependencies..."
1589
+ },
1590
+ validation: {
1591
+ requiredField: "{field} is required",
1592
+ invalidValue: "Invalid value for {field}",
1593
+ pathNotFound: "Path not found: {path}",
1594
+ fileRequired: "File is required: {path}",
1595
+ directoryRequired: "Directory is required: {path}"
1596
+ },
1597
+ warnings: {
1598
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1599
+ },
1600
+ info: {
1601
+ operationComplete: "Operation completed successfully",
1602
+ filesProcessed: {
1603
+ zero: "No files processed",
1604
+ one: "{count} file processed",
1605
+ other: "{count} files processed"
1606
+ }
1607
+ }
1608
+ }
1609
+ };
1610
+ var ru = {
1611
+ toolCore: {
1612
+ errors: {
1613
+ internal: "Internal error: {message}",
1614
+ fileNotFound: "File not found: {path}",
1615
+ fileReadFailed: "Failed to read file: {path}",
1616
+ fileWriteFailed: "Failed to write file: {path}",
1617
+ directoryNotFound: "Directory not found: {path}",
1618
+ invalidPath: "{path} is not a valid path",
1619
+ operationCanceled: "Operation was canceled",
1620
+ invalidParameter: "Invalid parameter: {parameter}"
1621
+ },
1622
+ progress: {
1623
+ copying: "Copying files...",
1624
+ building: "Building project...",
1625
+ packaging: "Creating package...",
1626
+ validating: "Validating...",
1627
+ analyzing: "Analyzing...",
1628
+ restoring: "Restoring dependencies..."
1629
+ },
1630
+ validation: {
1631
+ requiredField: "{field} is required",
1632
+ invalidValue: "Invalid value for {field}",
1633
+ pathNotFound: "Path not found: {path}",
1634
+ fileRequired: "File is required: {path}",
1635
+ directoryRequired: "Directory is required: {path}"
1636
+ },
1637
+ warnings: {
1638
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1639
+ },
1640
+ info: {
1641
+ operationComplete: "Operation completed successfully",
1642
+ filesProcessed: {
1643
+ zero: "No files processed",
1644
+ one: "{count} file processed",
1645
+ other: "{count} files processed"
1646
+ }
1647
+ }
1648
+ }
1649
+ };
1650
+ var tr = {
1651
+ toolCore: {
1652
+ errors: {
1653
+ internal: "Internal error: {message}",
1654
+ fileNotFound: "File not found: {path}",
1655
+ fileReadFailed: "Failed to read file: {path}",
1656
+ fileWriteFailed: "Failed to write file: {path}",
1657
+ directoryNotFound: "Directory not found: {path}",
1658
+ invalidPath: "{path} is not a valid path",
1659
+ operationCanceled: "Operation was canceled",
1660
+ invalidParameter: "Invalid parameter: {parameter}"
1661
+ },
1662
+ progress: {
1663
+ copying: "Copying files...",
1664
+ building: "Building project...",
1665
+ packaging: "Creating package...",
1666
+ validating: "Validating...",
1667
+ analyzing: "Analyzing...",
1668
+ restoring: "Restoring dependencies..."
1669
+ },
1670
+ validation: {
1671
+ requiredField: "{field} is required",
1672
+ invalidValue: "Invalid value for {field}",
1673
+ pathNotFound: "Path not found: {path}",
1674
+ fileRequired: "File is required: {path}",
1675
+ directoryRequired: "Directory is required: {path}"
1676
+ },
1677
+ warnings: {
1678
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1679
+ },
1680
+ info: {
1681
+ operationComplete: "Operation completed successfully",
1682
+ filesProcessed: {
1683
+ zero: "No files processed",
1684
+ one: "{count} file processed",
1685
+ other: "{count} files processed"
1686
+ }
1687
+ }
1688
+ }
1689
+ };
1690
+ var zh_CN = {
1691
+ toolCore: {
1692
+ errors: {
1693
+ internal: "Internal error: {message}",
1694
+ fileNotFound: "File not found: {path}",
1695
+ fileReadFailed: "Failed to read file: {path}",
1696
+ fileWriteFailed: "Failed to write file: {path}",
1697
+ directoryNotFound: "Directory not found: {path}",
1698
+ invalidPath: "{path} is not a valid path",
1699
+ operationCanceled: "Operation was canceled",
1700
+ invalidParameter: "Invalid parameter: {parameter}"
1701
+ },
1702
+ progress: {
1703
+ copying: "Copying files...",
1704
+ building: "Building project...",
1705
+ packaging: "Creating package...",
1706
+ validating: "Validating...",
1707
+ analyzing: "Analyzing...",
1708
+ restoring: "Restoring dependencies..."
1709
+ },
1710
+ validation: {
1711
+ requiredField: "{field} is required",
1712
+ invalidValue: "Invalid value for {field}",
1713
+ pathNotFound: "Path not found: {path}",
1714
+ fileRequired: "File is required: {path}",
1715
+ directoryRequired: "Directory is required: {path}"
1716
+ },
1717
+ warnings: {
1718
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1719
+ },
1720
+ info: {
1721
+ operationComplete: "Operation completed successfully",
1722
+ filesProcessed: {
1723
+ zero: "No files processed",
1724
+ one: "{count} file processed",
1725
+ other: "{count} files processed"
1726
+ }
1727
+ }
1728
+ }
1729
+ };
1730
+ var zh_TW = {
1731
+ toolCore: {
1732
+ errors: {
1733
+ internal: "Internal error: {message}",
1734
+ fileNotFound: "File not found: {path}",
1735
+ fileReadFailed: "Failed to read file: {path}",
1736
+ fileWriteFailed: "Failed to write file: {path}",
1737
+ directoryNotFound: "Directory not found: {path}",
1738
+ invalidPath: "{path} is not a valid path",
1739
+ operationCanceled: "Operation was canceled",
1740
+ invalidParameter: "Invalid parameter: {parameter}"
1741
+ },
1742
+ progress: {
1743
+ copying: "Copying files...",
1744
+ building: "Building project...",
1745
+ packaging: "Creating package...",
1746
+ validating: "Validating...",
1747
+ analyzing: "Analyzing...",
1748
+ restoring: "Restoring dependencies..."
1749
+ },
1750
+ validation: {
1751
+ requiredField: "{field} is required",
1752
+ invalidValue: "Invalid value for {field}",
1753
+ pathNotFound: "Path not found: {path}",
1754
+ fileRequired: "File is required: {path}",
1755
+ directoryRequired: "Directory is required: {path}"
1756
+ },
1757
+ warnings: {
1758
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1759
+ },
1760
+ info: {
1761
+ operationComplete: "Operation completed successfully",
1762
+ filesProcessed: {
1763
+ zero: "No files processed",
1764
+ one: "{count} file processed",
1765
+ other: "{count} files processed"
1766
+ }
1767
+ }
1768
+ }
1769
+ };
1770
+ var zu = {
1771
+ toolCore: {
1772
+ errors: {
1773
+ internal: "Internal error: {message}",
1774
+ fileNotFound: "File not found: {path}",
1775
+ fileReadFailed: "Failed to read file: {path}",
1776
+ fileWriteFailed: "Failed to write file: {path}",
1777
+ directoryNotFound: "Directory not found: {path}",
1778
+ invalidPath: "{path} is not a valid path",
1779
+ operationCanceled: "Operation was canceled",
1780
+ invalidParameter: "Invalid parameter: {parameter}"
1781
+ },
1782
+ progress: {
1783
+ copying: "Copying files...",
1784
+ building: "Building project...",
1785
+ packaging: "Creating package...",
1786
+ validating: "Validating...",
1787
+ analyzing: "Analyzing...",
1788
+ restoring: "Restoring dependencies..."
1789
+ },
1790
+ validation: {
1791
+ requiredField: "{field} is required",
1792
+ invalidValue: "Invalid value for {field}",
1793
+ pathNotFound: "Path not found: {path}",
1794
+ fileRequired: "File is required: {path}",
1795
+ directoryRequired: "Directory is required: {path}"
1796
+ },
1797
+ warnings: {
1798
+ factoryAlreadyRegistered: "A factory is already registered for project type '{type}'. Skipping duplicate registration."
1799
+ },
1800
+ info: {
1801
+ operationComplete: "Operation completed successfully",
1802
+ filesProcessed: {
1803
+ zero: "No files processed",
1804
+ one: "{count} file processed",
1805
+ other: "{count} files processed"
1806
+ }
1807
+ }
1808
+ }
1809
+ };
1810
+
1811
+ class TranslationService {
1812
+ static instance;
1813
+ currentLocale = "en";
1814
+ constructor() {}
1815
+ static getInstance() {
1816
+ if (!TranslationService.instance) {
1817
+ TranslationService.instance = new TranslationService;
1818
+ }
1819
+ return TranslationService.instance;
1820
+ }
1821
+ setLocale(locale) {
1822
+ this.currentLocale = I18nManager.setLocale(locale);
1823
+ }
1824
+ getLocale() {
1825
+ return this.currentLocale;
1826
+ }
1827
+ t(key, params) {
1828
+ return I18nManager.t(key, params, this.currentLocale);
1829
+ }
1830
+ tLocale(key, locale, params) {
1831
+ return I18nManager.t(key, params, locale);
1832
+ }
1833
+ has(key) {
1834
+ return I18nManager.has(key, this.currentLocale);
1835
+ }
1836
+ getAvailableLocales() {
1837
+ return I18nManager.getAvailableLocales();
1838
+ }
1839
+ }
1840
+ var translate = TranslationService.getInstance();
1841
+ I18nManager.registerTranslations("en", en);
1842
+ I18nManager.registerTranslations("de", de);
1843
+ I18nManager.registerTranslations("es", es);
1844
+ I18nManager.registerTranslations("es-mx", es_MX);
1845
+ I18nManager.registerTranslations("fr", fr);
1846
+ I18nManager.registerTranslations("ja", ja);
1847
+ I18nManager.registerTranslations("ko", ko);
1848
+ I18nManager.registerTranslations("pt", pt);
1849
+ I18nManager.registerTranslations("pt-br", pt_BR);
1850
+ I18nManager.registerTranslations("ro", ro);
1851
+ I18nManager.registerTranslations("ru", ru);
1852
+ I18nManager.registerTranslations("tr", tr);
1853
+ I18nManager.registerTranslations("zh-cn", zh_CN);
1854
+ I18nManager.registerTranslations("zh-tw", zh_TW);
1855
+ I18nManager.registerTranslations("zu", zu);
1856
+ I18nManager.setLocale("en");
1857
+ var BuildConfiguration;
1858
+ ((BuildConfiguration2) => {
1859
+ BuildConfiguration2["Debug"] = "Debug";
1860
+ BuildConfiguration2["Release"] = "Release";
1861
+ })(BuildConfiguration ||= {});
1862
+ var LogLevel;
1863
+ ((LogLevel2) => {
1864
+ LogLevel2["Debug"] = "Debug";
1865
+ LogLevel2["Info"] = "Information";
1866
+ LogLevel2["Warn"] = "Warning";
1867
+ LogLevel2["Error"] = "Error";
1868
+ })(LogLevel ||= {});
1869
+
1870
+ class LogMessage {
1871
+ message;
1872
+ logLevel;
1873
+ source;
1874
+ sourceTarget;
1875
+ progress;
1876
+ code;
1877
+ filePath;
1878
+ line;
1879
+ id;
1880
+ timestamp;
1881
+ constructor(message, logLevel, options, timestamp) {
1882
+ this.message = message;
1883
+ this.logLevel = LogMessage.toLogLevel(logLevel);
1884
+ this.source = options?.source;
1885
+ this.sourceTarget = options?.sourceTarget;
1886
+ this.progress = options?.progress;
1887
+ this.code = options?.code;
1888
+ this.filePath = options?.filePath;
1889
+ this.line = options?.line;
1890
+ this.id = options?.id;
1891
+ this.timestamp = LogMessage.resolveTimestamp(timestamp);
1892
+ }
1893
+ static resolveTimestamp(timestamp) {
1894
+ if (timestamp instanceof Date) {
1895
+ return timestamp;
1896
+ }
1897
+ if (timestamp === undefined || timestamp === null) {
1898
+ return new Date;
1899
+ }
1900
+ const parsed = new Date(timestamp);
1901
+ if (Number.isNaN(parsed.getTime())) {
1902
+ console.error(`[LogMessage] invalid timestamp "${timestamp}", defaulting to now`);
1903
+ return new Date;
1904
+ }
1905
+ return parsed;
1906
+ }
1907
+ static toLogLevel(level) {
1908
+ switch (level) {
1909
+ case "Verbose":
1910
+ case "Trace":
1911
+ case "Debug":
1912
+ return "Debug";
1913
+ case "Warn":
1914
+ case "Warning":
1915
+ return "Warning";
1916
+ case "Error":
1917
+ case "Critical":
1918
+ return "Error";
1919
+ default:
1920
+ return "Information";
1921
+ }
1922
+ }
1923
+ toFormattedString() {
1924
+ const parts = [];
1925
+ parts.push(`[${this.timestamp.toISOString()}]`);
1926
+ parts.push(`[${String(this.logLevel).toUpperCase()}]`);
1927
+ if (this.source) {
1928
+ parts.push(`[${this.source}]`);
1929
+ }
1930
+ if (this.sourceTarget) {
1931
+ parts.push(`[${this.sourceTarget}]`);
1932
+ }
1933
+ const locationParts = [];
1934
+ if (this.filePath) {
1935
+ locationParts.push(this.filePath);
1936
+ }
1937
+ if (this.line) {
1938
+ locationParts.push(`Line:${this.line}`);
1939
+ }
1940
+ if (this.id) {
1941
+ locationParts.push(`Id:${this.id}`);
1942
+ }
1943
+ if (locationParts.length > 0) {
1944
+ parts.push(`(${locationParts.join("")})`);
1945
+ }
1946
+ if (this.code) {
1947
+ parts.push(`[${this.code}]`);
1948
+ }
1949
+ if (this.progress || this.progress === 0) {
1950
+ parts.push(`${this.progress}%`);
1951
+ }
1952
+ parts.push(this.message);
1953
+ return parts.join(" ");
1954
+ }
1955
+ }
1956
+ var NugetConstants = {
1957
+ OutputFolderName: "bundle",
1958
+ ContentFolderName: "content",
1959
+ OperateFileName: "operate.json",
1960
+ EntryPointsFileName: "entry-points.json",
1961
+ PackageDescriptorFileName: "package-descriptor.json",
1962
+ BindingsV2FileName: "bindings_v2.json",
1963
+ BindingsFileId: "bindings.json"
1964
+ };
1965
+ var PackJobTargetKind;
1966
+ ((PackJobTargetKind2) => {
1967
+ PackJobTargetKind2["Serverless"] = "Serverless";
1968
+ PackJobTargetKind2["LocalRobot"] = "LocalRobot";
1969
+ })(PackJobTargetKind ||= {});
1970
+ var ProjectTypes;
1971
+ ((ProjectTypes2) => {
1972
+ ProjectTypes2["Agent"] = "Agent";
1973
+ ProjectTypes2["Api"] = "Api";
1974
+ ProjectTypes2["Connector"] = "Connector";
1975
+ ProjectTypes2["CaseManagement"] = "CaseManagement";
1976
+ ProjectTypes2["Flow"] = "Flow";
1977
+ ProjectTypes2["Function"] = "Function";
1978
+ ProjectTypes2["ProcessOrchestration"] = "ProcessOrchestration";
1979
+ ProjectTypes2["Process"] = "Process";
1980
+ ProjectTypes2["Library"] = "Library";
1981
+ ProjectTypes2["WebApp"] = "WebApp";
1982
+ ProjectTypes2["Tests"] = "Tests";
1983
+ ProjectTypes2["AppV2"] = "AppV2";
1984
+ })(ProjectTypes ||= {});
1985
+ var TargetFramework;
1986
+ ((TargetFramework2) => {
1987
+ TargetFramework2["Portable"] = "Portable";
1988
+ TargetFramework2["Windows"] = "Windows";
1989
+ })(TargetFramework ||= {});
1990
+ var ToolErrorCodes;
1991
+ ((ToolErrorCodes2) => {
1992
+ ToolErrorCodes2["Success"] = "SUCCESS";
1993
+ ToolErrorCodes2["InternalError"] = "INTERNAL_ERROR";
1994
+ ToolErrorCodes2["Canceled"] = "CANCELED";
1995
+ })(ToolErrorCodes ||= {});
1996
+
1997
+ class ToolResult {
1998
+ errorCode;
1999
+ message;
2000
+ packages;
2001
+ details;
2002
+ instructions;
2003
+ constructor(errorCode, message, packages = [], instructions) {
2004
+ this.errorCode = errorCode;
2005
+ this.message = message;
2006
+ this.packages = packages;
2007
+ this.instructions = instructions;
2008
+ }
2009
+ get isSuccess() {
2010
+ return this.errorCode === "SUCCESS";
2011
+ }
2012
+ static success() {
2013
+ return new ToolResult("SUCCESS");
2014
+ }
2015
+ static error(errorCode, message, instructions) {
2016
+ return new ToolResult(errorCode, message, [], instructions);
2017
+ }
2018
+ }
2019
+ var OPERATE_FILE = "operate.json";
2020
+ var PROJECT_FILE = "project.json";
2021
+ function isNonEmptyString(value) {
2022
+ return typeof value === "string" && value.length > 0;
2023
+ }
2024
+ async function readJsonObject(fs, filePath) {
2025
+ let content;
2026
+ try {
2027
+ content = await fs.readFile(filePath, "utf-8");
2028
+ } catch {
2029
+ return;
2030
+ }
2031
+ if (content === null) {
2032
+ return;
2033
+ }
2034
+ try {
2035
+ const parsed = JSON.parse(content);
2036
+ if (parsed === null || typeof parsed !== "object") {
2037
+ return;
2038
+ }
2039
+ return parsed;
2040
+ } catch {
2041
+ return;
2042
+ }
2043
+ }
2044
+ async function writeJsonObject(fs, filePath, data) {
2045
+ await fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
2046
+ `);
2047
+ }
2048
+ async function ensureProjectId(projectPath, fs) {
2049
+ const operatePath = Path.join(projectPath, OPERATE_FILE);
2050
+ const operateExists = await fs.exists(operatePath);
2051
+ if (operateExists) {
2052
+ const operate = await readJsonObject(fs, operatePath);
2053
+ if (operate && isNonEmptyString(operate.projectId)) {
2054
+ return operate.projectId;
2055
+ }
2056
+ if (operate) {
2057
+ const id = crypto.randomUUID();
2058
+ await writeJsonObject(fs, operatePath, {
2059
+ ...operate,
2060
+ projectId: id
2061
+ });
2062
+ return id;
2063
+ }
2064
+ return crypto.randomUUID();
2065
+ }
2066
+ const projectFilePath = Path.join(projectPath, PROJECT_FILE);
2067
+ const projectFileExists = await fs.exists(projectFilePath);
2068
+ if (projectFileExists) {
2069
+ const projectFile = await readJsonObject(fs, projectFilePath);
2070
+ if (projectFile && isNonEmptyString(projectFile.projectId)) {
2071
+ return projectFile.projectId;
2072
+ }
2073
+ if (projectFile) {
2074
+ const id = crypto.randomUUID();
2075
+ await writeJsonObject(fs, projectFilePath, {
2076
+ ...projectFile,
2077
+ projectId: id
2078
+ });
2079
+ return id;
2080
+ }
2081
+ return crypto.randomUUID();
2082
+ }
2083
+ return crypto.randomUUID();
2084
+ }
2085
+ async function ensureProjectIdInOperateFile(operateFilePath, fallbackProjectId, fs) {
2086
+ if (!await fs.exists(operateFilePath)) {
2087
+ return;
2088
+ }
2089
+ const parsed = await readJsonObject(fs, operateFilePath);
2090
+ if (!parsed) {
2091
+ return;
2092
+ }
2093
+ if (isNonEmptyString(parsed.projectId)) {
2094
+ return;
2095
+ }
2096
+ await writeJsonObject(fs, operateFilePath, {
2097
+ ...parsed,
2098
+ projectId: fallbackProjectId
2099
+ });
2100
+ }
2101
+ async function writeOrBackfillOperateProjectId(operateFilePath, projectId, fs, createIfMissing) {
2102
+ if (await fs.exists(operateFilePath)) {
2103
+ await ensureProjectIdInOperateFile(operateFilePath, projectId, fs);
2104
+ return;
2105
+ }
2106
+ await createIfMissing();
2107
+ }
2108
+ var OPERATE_SCHEMA = "https://cloud.uipath.com/draft/2024-12/operate";
2109
+ async function resolveEntryPointMain(fs, sourceFolder) {
2110
+ const entryPointsFilePath = Path.join(sourceFolder, NugetConstants.EntryPointsFileName);
2111
+ if (!await fs.exists(entryPointsFilePath)) {
2112
+ return "";
2113
+ }
2114
+ const content = await fs.readFile(entryPointsFilePath);
2115
+ if (!content) {
2116
+ return "";
2117
+ }
2118
+ try {
2119
+ const parsed = JSON.parse(new TextDecoder().decode(content));
2120
+ return parsed.entryPoints?.[0]?.filePath ?? "";
2121
+ } catch {
2122
+ return "";
2123
+ }
2124
+ }
2125
+ async function writeContentOperateFile(fs, params) {
2126
+ const operateFilePath = Path.join(params.contentFolder, NugetConstants.OperateFileName);
2127
+ await writeOrBackfillOperateProjectId(operateFilePath, params.projectId, fs, async () => {
2128
+ const main = await resolveEntryPointMain(fs, params.contentFolder);
2129
+ const operateFileModel = {
2130
+ $schema: OPERATE_SCHEMA,
2131
+ contentType: params.contentType,
2132
+ projectId: params.projectId,
2133
+ main,
2134
+ targetFramework: "Portable",
2135
+ runtimeOptions: {
2136
+ isAttended: false,
2137
+ requiresUserInteraction: false
2138
+ }
2139
+ };
2140
+ await fs.writeFile(operateFilePath, JSON.stringify(operateFileModel, null, 2));
2141
+ });
2142
+ }
2143
+ async function ensureContentOperateFile(fs, params) {
2144
+ const projectId = params.projectStorageId ?? await ensureProjectId(params.projectPath, fs);
2145
+ await writeContentOperateFile(fs, {
2146
+ contentFolder: params.contentFolder,
2147
+ projectId,
2148
+ contentType: params.contentType
2149
+ });
2150
+ }
2151
+ function escapeXml(str) {
2152
+ if (str === null || str === undefined) {
2153
+ return "";
2154
+ }
2155
+ return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
2156
+ }
2157
+ function optionalElement(name, value) {
2158
+ if (value === undefined || value === "")
2159
+ return "";
2160
+ return ` <${name}>${escapeXml(value)}</${name}>
2161
+ `;
2162
+ }
2163
+ function generateDependenciesXml(dependencies) {
2164
+ if (!dependencies || dependencies.length === 0)
2165
+ return "";
2166
+ const deps = dependencies.map((d) => ` <dependency id="${escapeXml(d.id)}" version="${escapeXml(d.version)}" />`).join(`
2167
+ `);
2168
+ return ` <dependencies>
2169
+ ${deps}
2170
+ </dependencies>
2171
+ `;
2172
+ }
2173
+ function generateRepositoryXml(packageInfo) {
2174
+ if (!packageInfo.repositoryType || !packageInfo.repositoryUrl)
2175
+ return "";
2176
+ let repoXml = ` <repository type="${escapeXml(packageInfo.repositoryType)}" url="${escapeXml(packageInfo.repositoryUrl)}"`;
2177
+ if (packageInfo.repositoryBranch) {
2178
+ repoXml += ` branch="${escapeXml(packageInfo.repositoryBranch)}"`;
2179
+ }
2180
+ if (packageInfo.repositoryCommit) {
2181
+ repoXml += ` commit="${escapeXml(packageInfo.repositoryCommit)}"`;
2182
+ }
2183
+ repoXml += ` />
2184
+ `;
2185
+ return repoXml;
2186
+ }
2187
+ function generateNuspecXml(packageInfo) {
2188
+ const author = packageInfo.author?.trim() || "UiPath";
2189
+ const description = packageInfo.description?.trim() || "Created by UiPath";
2190
+ const title = packageInfo.title?.trim() || packageInfo.id;
2191
+ const requireLicenseAcceptance = packageInfo.requireLicenseAcceptance === true ? "true" : "false";
2192
+ const releaseNotes = packageInfo.releaseNotes ?? "";
2193
+ const xml = `\uFEFF<?xml version="1.0" encoding="utf-8"?>
2194
+ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
2195
+ <metadata>
2196
+ <id>${escapeXml(packageInfo.id)}</id>
2197
+ <version>${escapeXml(packageInfo.version)}</version>
2198
+ <title>${escapeXml(title)}</title>
2199
+ <authors>${escapeXml(author)}</authors>
2200
+ <requireLicenseAcceptance>${requireLicenseAcceptance}</requireLicenseAcceptance>
2201
+ <description>${escapeXml(description)}</description>
2202
+ <releaseNotes>${escapeXml(releaseNotes)}</releaseNotes>
2203
+ ${optionalElement("tags", packageInfo.tags)}${optionalElement("iconUrl", packageInfo.iconUrl)}${optionalElement("projectUrl", packageInfo.projectUrl)}${optionalElement("licenseUrl", packageInfo.licenseUrl)}${optionalElement("copyright", packageInfo.copyright)}${generateRepositoryXml(packageInfo)}${generateDependenciesXml(packageInfo.dependencies)} </metadata>
2204
+ </package>
2205
+ `;
2206
+ return xml;
2207
+ }
2208
+ function generatePsmdcpXml(packageInfo) {
2209
+ const author = packageInfo.author?.trim() || "UiPath";
2210
+ const description = packageInfo.description?.trim() || "Created by UiPath";
2211
+ return `<?xml version="1.0" encoding="utf-8"?>
2212
+ <coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties">
2213
+ <dc:creator>${escapeXml(author)}</dc:creator>
2214
+ <dc:description>${escapeXml(description)}</dc:description>
2215
+ <dc:identifier>${escapeXml(packageInfo.id)}</dc:identifier>
2216
+ <version>${escapeXml(packageInfo.version)}</version>
2217
+ <keywords></keywords>
2218
+ <lastModifiedBy>NuGet.Packaging, Version=6.12.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35;.NET 5.0</lastModifiedBy>
2219
+ </coreProperties>`;
2220
+ }
2221
+
2222
+ class NugetPackager {
2223
+ fileSystem;
2224
+ constructor(fileSystem) {
2225
+ this.fileSystem = fileSystem;
2226
+ }
2227
+ async packAsync(rootPath, packageInfo, outputPath) {
2228
+ const normalizedOutputPath = Path.normalize(outputPath);
2229
+ const nuspecXml = generateNuspecXml(packageInfo);
2230
+ const nuspecFileName = `${packageInfo.id}.nuspec`;
2231
+ const fileEntries = await Path.walkDirectory(this.fileSystem, rootPath);
2232
+ const zipContents = {};
2233
+ const encoder = new TextEncoder;
2234
+ const psmdcpId = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967296).toString(16).padStart(8, "0")).join("");
2235
+ const psmdcpFileName = `${psmdcpId}.psmdcp`;
2236
+ const psmdcpPath = `package/services/metadata/core-properties/${psmdcpFileName}`;
2237
+ const contentTypesXml = `<?xml version="1.0" encoding="utf-8"?>
2238
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
2239
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
2240
+ <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
2241
+ <Default Extension="uiproj" ContentType="application/octet" />
2242
+ <Default Extension="json" ContentType="application/octet" />
2243
+ <Default Extension="nuspec" ContentType="application/octet" />
2244
+ </Types>`;
2245
+ zipContents["[Content_Types].xml"] = encoder.encode(contentTypesXml);
2246
+ const manifestRelId = `R${Date.now().toString(16).toUpperCase()}`;
2247
+ const corePropsRelId = `R${(Date.now() + 1).toString(16).toUpperCase()}`;
2248
+ const relsXml = `<?xml version="1.0" encoding="utf-8"?>
2249
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
2250
+ <Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${nuspecFileName}" Id="${manifestRelId}" />
2251
+ <Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/${psmdcpPath}" Id="${corePropsRelId}" />
2252
+ </Relationships>`;
2253
+ zipContents["_rels/.rels"] = encoder.encode(relsXml);
2254
+ zipContents[psmdcpPath] = encoder.encode(generatePsmdcpXml(packageInfo));
2255
+ zipContents[nuspecFileName] = encoder.encode(nuspecXml);
2256
+ for (const entry of fileEntries) {
2257
+ const content = await this.fileSystem.readFile(entry.absolutePath);
2258
+ if (content !== null) {
2259
+ zipContents[entry.relativePath] = content;
2260
+ }
2261
+ }
2262
+ const zippedData = zipSync(zipContents);
2263
+ await this.fileSystem.writeFile(normalizedOutputPath, zippedData);
2264
+ return {
2265
+ outputPath: normalizedOutputPath
2266
+ };
2267
+ }
2268
+ }
2269
+
2270
+ class ProjectTool {
2271
+ fileSystem;
2272
+ logger;
2273
+ static ProjectFileName = "project.uiproj";
2274
+ constructor(fileSystem, logger) {
2275
+ this.fileSystem = fileSystem;
2276
+ this.logger = logger;
2277
+ }
2278
+ async restoreAsync(_options, _cancellationToken) {
2279
+ this.logger.info("Restore operation is a noop");
2280
+ return ToolResult.success();
2281
+ }
2282
+ async validateAsync(_options, _cancellationToken) {
2283
+ this.logger.info("Validate operation is a noop");
2284
+ return ToolResult.success();
2285
+ }
2286
+ async buildAsync(_options, _cancellationToken) {
2287
+ this.logger.info("Build operation is a noop");
2288
+ return ToolResult.success();
2289
+ }
2290
+ async packAsync(_options, _cancellationToken) {
2291
+ this.logger.info("Pack operation is a noop");
2292
+ return ToolResult.success();
2293
+ }
2294
+ async cleanupAsync(_options, _cancellationToken) {
2295
+ this.logger.info("Cleanup operation is a noop");
2296
+ return ToolResult.success();
2297
+ }
2298
+ async getUiProjectAsync(projectPath) {
2299
+ const filePath = Path.join(projectPath, ProjectTool.ProjectFileName);
2300
+ if (!await this.fileSystem.exists(filePath)) {
2301
+ return;
2302
+ }
2303
+ const raw = await this.fileSystem.readFile(filePath);
2304
+ if (!raw) {
2305
+ return;
2306
+ }
2307
+ const json = typeof raw === "string" ? raw : new TextDecoder("utf-8").decode(raw);
2308
+ return JSON.parse(json);
2309
+ }
2310
+ async dispose() {}
2311
+ }
2312
+ class ToolsFactoryRepository {
2313
+ projectFactoryMap = new Map;
2314
+ solutionFactory = null;
2315
+ registerProjectToolFactory(factory) {
2316
+ for (const type of factory.supportedTypes) {
2317
+ const existing = this.projectFactoryMap.get(type);
2318
+ if (existing) {
2319
+ if (existing.constructor?.name !== factory.constructor?.name) {
2320
+ console.warn(`Tool factory conflict for project type '${type}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
2321
+ }
2322
+ continue;
2323
+ }
2324
+ this.projectFactoryMap.set(type, factory);
2325
+ }
2326
+ }
2327
+ registerSolutionToolFactory(factory) {
2328
+ this.solutionFactory = factory;
2329
+ }
2330
+ getSolutionToolFactory() {
2331
+ if (!this.solutionFactory) {
2332
+ throw new Error("No solution tool factory is registered");
2333
+ }
2334
+ return this.solutionFactory;
2335
+ }
2336
+ canHandleProject(projectType) {
2337
+ return this.projectFactoryMap.has(projectType);
2338
+ }
2339
+ getProjectToolFactory(projectType) {
2340
+ const factory = this.projectFactoryMap.get(projectType);
2341
+ if (!factory) {
2342
+ throw new Error(`No tool factory found for project type '${projectType}'`);
2343
+ }
2344
+ return factory;
2345
+ }
2346
+ reset() {
2347
+ this.projectFactoryMap.clear();
2348
+ this.solutionFactory = null;
2349
+ }
2350
+ }
2351
+ var REGISTRY_KEY = Symbol.for("@uipath/solutionpackager-tool-core/toolsFactoryRepository");
2352
+ var _global = globalThis;
2353
+ if (!_global[REGISTRY_KEY]) {
2354
+ _global[REGISTRY_KEY] = new ToolsFactoryRepository;
2355
+ }
2356
+ var toolsFactoryRepository = _global[REGISTRY_KEY];
2357
+
2358
+ export { Path, TemporaryStorageService, ZipService, I18nManager, translate, LogLevel, LogMessage, NugetConstants, ProjectTypes, TargetFramework, ToolErrorCodes, ToolResult, ensureContentOperateFile, NugetPackager, ProjectTool, toolsFactoryRepository };
2359
+
2360
+ //# debugId=8E529B60EA33139264756E2164756E21