@uipath/function-tool 1.200.0-preview.118

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