@dinanathdash/envault-sdk 1.0.2

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,4314 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn2, res) => function __init() {
9
+ return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res;
10
+ };
11
+ var __commonJS = (cb, mod) => function __require() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
+ };
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
+ mod
33
+ ));
34
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
+
36
+ // ../../../node_modules/shellwords/lib/shellwords.js
37
+ var require_shellwords = __commonJS({
38
+ "../../../node_modules/shellwords/lib/shellwords.js"(exports2) {
39
+ "use strict";
40
+ (function() {
41
+ var scan;
42
+ scan = function(string, pattern, callback) {
43
+ var match, result;
44
+ result = "";
45
+ while (string.length > 0) {
46
+ match = string.match(pattern);
47
+ if (match) {
48
+ result += string.slice(0, match.index);
49
+ result += callback(match);
50
+ string = string.slice(match.index + match[0].length);
51
+ } else {
52
+ result += string;
53
+ string = "";
54
+ }
55
+ }
56
+ return result;
57
+ };
58
+ exports2.split = function(line) {
59
+ var field, words;
60
+ if (line == null) {
61
+ line = "";
62
+ }
63
+ words = [];
64
+ field = "";
65
+ scan(line, /\s*(?:([^\s\\\'\"]+)|'((?:[^\'\\]|\\.)*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|$)?/, function(match) {
66
+ var dq, escape, garbage, raw, seperator, sq, word;
67
+ raw = match[0], word = match[1], sq = match[2], dq = match[3], escape = match[4], garbage = match[5], seperator = match[6];
68
+ if (garbage != null) {
69
+ throw new Error("Unmatched quote");
70
+ }
71
+ field += word || (sq || dq || escape).replace(/\\(?=.)/, "");
72
+ if (seperator != null) {
73
+ words.push(field);
74
+ return field = "";
75
+ }
76
+ });
77
+ if (field) {
78
+ words.push(field);
79
+ }
80
+ return words;
81
+ };
82
+ exports2.escape = function(str) {
83
+ if (str == null) {
84
+ str = "";
85
+ }
86
+ if (str == null) {
87
+ return "''";
88
+ }
89
+ return str.replace(/([^A-Za-z0-9_\-.,:\/@\n])/g, "\\$1").replace(/\n/g, "'\n'");
90
+ };
91
+ }).call(exports2);
92
+ }
93
+ });
94
+
95
+ // ../../../node_modules/node-notifier/node_modules/semver/internal/constants.js
96
+ var require_constants = __commonJS({
97
+ "../../../node_modules/node-notifier/node_modules/semver/internal/constants.js"(exports2, module2) {
98
+ "use strict";
99
+ var SEMVER_SPEC_VERSION = "2.0.0";
100
+ var MAX_LENGTH = 256;
101
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
102
+ 9007199254740991;
103
+ var MAX_SAFE_COMPONENT_LENGTH = 16;
104
+ var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
105
+ var RELEASE_TYPES = [
106
+ "major",
107
+ "premajor",
108
+ "minor",
109
+ "preminor",
110
+ "patch",
111
+ "prepatch",
112
+ "prerelease"
113
+ ];
114
+ module2.exports = {
115
+ MAX_LENGTH,
116
+ MAX_SAFE_COMPONENT_LENGTH,
117
+ MAX_SAFE_BUILD_LENGTH,
118
+ MAX_SAFE_INTEGER,
119
+ RELEASE_TYPES,
120
+ SEMVER_SPEC_VERSION,
121
+ FLAG_INCLUDE_PRERELEASE: 1,
122
+ FLAG_LOOSE: 2
123
+ };
124
+ }
125
+ });
126
+
127
+ // ../../../node_modules/node-notifier/node_modules/semver/internal/debug.js
128
+ var require_debug = __commonJS({
129
+ "../../../node_modules/node-notifier/node_modules/semver/internal/debug.js"(exports2, module2) {
130
+ "use strict";
131
+ var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
132
+ };
133
+ module2.exports = debug;
134
+ }
135
+ });
136
+
137
+ // ../../../node_modules/node-notifier/node_modules/semver/internal/re.js
138
+ var require_re = __commonJS({
139
+ "../../../node_modules/node-notifier/node_modules/semver/internal/re.js"(exports2, module2) {
140
+ "use strict";
141
+ var {
142
+ MAX_SAFE_COMPONENT_LENGTH,
143
+ MAX_SAFE_BUILD_LENGTH,
144
+ MAX_LENGTH
145
+ } = require_constants();
146
+ var debug = require_debug();
147
+ exports2 = module2.exports = {};
148
+ var re = exports2.re = [];
149
+ var safeRe = exports2.safeRe = [];
150
+ var src = exports2.src = [];
151
+ var safeSrc = exports2.safeSrc = [];
152
+ var t = exports2.t = {};
153
+ var R = 0;
154
+ var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
155
+ var safeRegexReplacements = [
156
+ ["\\s", 1],
157
+ ["\\d", MAX_LENGTH],
158
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
159
+ ];
160
+ var makeSafeRegex = (value) => {
161
+ for (const [token, max] of safeRegexReplacements) {
162
+ value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
163
+ }
164
+ return value;
165
+ };
166
+ var createToken = (name, value, isGlobal) => {
167
+ const safe = makeSafeRegex(value);
168
+ const index = R++;
169
+ debug(name, index, value);
170
+ t[name] = index;
171
+ src[index] = value;
172
+ safeSrc[index] = safe;
173
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
174
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
175
+ };
176
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
177
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
178
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
179
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
180
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
181
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
182
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
183
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
184
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
185
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
186
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
187
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
188
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
189
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
190
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
191
+ createToken("GTLT", "((?:<|>)?=?)");
192
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
193
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
194
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
195
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
196
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
197
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
198
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
199
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
200
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
201
+ createToken("COERCERTL", src[t.COERCE], true);
202
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
203
+ createToken("LONETILDE", "(?:~>?)");
204
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
205
+ exports2.tildeTrimReplace = "$1~";
206
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
207
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
208
+ createToken("LONECARET", "(?:\\^)");
209
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
210
+ exports2.caretTrimReplace = "$1^";
211
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
212
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
213
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
214
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
215
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
216
+ exports2.comparatorTrimReplace = "$1$2$3";
217
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
218
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
219
+ createToken("STAR", "(<|>)?=?\\s*\\*");
220
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
221
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
222
+ }
223
+ });
224
+
225
+ // ../../../node_modules/node-notifier/node_modules/semver/internal/parse-options.js
226
+ var require_parse_options = __commonJS({
227
+ "../../../node_modules/node-notifier/node_modules/semver/internal/parse-options.js"(exports2, module2) {
228
+ "use strict";
229
+ var looseOption = Object.freeze({ loose: true });
230
+ var emptyOpts = Object.freeze({});
231
+ var parseOptions = (options) => {
232
+ if (!options) {
233
+ return emptyOpts;
234
+ }
235
+ if (typeof options !== "object") {
236
+ return looseOption;
237
+ }
238
+ return options;
239
+ };
240
+ module2.exports = parseOptions;
241
+ }
242
+ });
243
+
244
+ // ../../../node_modules/node-notifier/node_modules/semver/internal/identifiers.js
245
+ var require_identifiers = __commonJS({
246
+ "../../../node_modules/node-notifier/node_modules/semver/internal/identifiers.js"(exports2, module2) {
247
+ "use strict";
248
+ var numeric = /^[0-9]+$/;
249
+ var compareIdentifiers = (a, b) => {
250
+ if (typeof a === "number" && typeof b === "number") {
251
+ return a === b ? 0 : a < b ? -1 : 1;
252
+ }
253
+ const anum = numeric.test(a);
254
+ const bnum = numeric.test(b);
255
+ if (anum && bnum) {
256
+ a = +a;
257
+ b = +b;
258
+ }
259
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
260
+ };
261
+ var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
262
+ module2.exports = {
263
+ compareIdentifiers,
264
+ rcompareIdentifiers
265
+ };
266
+ }
267
+ });
268
+
269
+ // ../../../node_modules/node-notifier/node_modules/semver/classes/semver.js
270
+ var require_semver = __commonJS({
271
+ "../../../node_modules/node-notifier/node_modules/semver/classes/semver.js"(exports2, module2) {
272
+ "use strict";
273
+ var debug = require_debug();
274
+ var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
275
+ var { safeRe: re, t } = require_re();
276
+ var parseOptions = require_parse_options();
277
+ var { compareIdentifiers } = require_identifiers();
278
+ var SemVer = class _SemVer {
279
+ constructor(version2, options) {
280
+ options = parseOptions(options);
281
+ if (version2 instanceof _SemVer) {
282
+ if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
283
+ return version2;
284
+ } else {
285
+ version2 = version2.version;
286
+ }
287
+ } else if (typeof version2 !== "string") {
288
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`);
289
+ }
290
+ if (version2.length > MAX_LENGTH) {
291
+ throw new TypeError(
292
+ `version is longer than ${MAX_LENGTH} characters`
293
+ );
294
+ }
295
+ debug("SemVer", version2, options);
296
+ this.options = options;
297
+ this.loose = !!options.loose;
298
+ this.includePrerelease = !!options.includePrerelease;
299
+ const m = version2.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
300
+ if (!m) {
301
+ throw new TypeError(`Invalid Version: ${version2}`);
302
+ }
303
+ this.raw = version2;
304
+ this.major = +m[1];
305
+ this.minor = +m[2];
306
+ this.patch = +m[3];
307
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
308
+ throw new TypeError("Invalid major version");
309
+ }
310
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
311
+ throw new TypeError("Invalid minor version");
312
+ }
313
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
314
+ throw new TypeError("Invalid patch version");
315
+ }
316
+ if (!m[4]) {
317
+ this.prerelease = [];
318
+ } else {
319
+ this.prerelease = m[4].split(".").map((id) => {
320
+ if (/^[0-9]+$/.test(id)) {
321
+ const num = +id;
322
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
323
+ return num;
324
+ }
325
+ }
326
+ return id;
327
+ });
328
+ }
329
+ this.build = m[5] ? m[5].split(".") : [];
330
+ this.format();
331
+ }
332
+ format() {
333
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
334
+ if (this.prerelease.length) {
335
+ this.version += `-${this.prerelease.join(".")}`;
336
+ }
337
+ return this.version;
338
+ }
339
+ toString() {
340
+ return this.version;
341
+ }
342
+ compare(other) {
343
+ debug("SemVer.compare", this.version, this.options, other);
344
+ if (!(other instanceof _SemVer)) {
345
+ if (typeof other === "string" && other === this.version) {
346
+ return 0;
347
+ }
348
+ other = new _SemVer(other, this.options);
349
+ }
350
+ if (other.version === this.version) {
351
+ return 0;
352
+ }
353
+ return this.compareMain(other) || this.comparePre(other);
354
+ }
355
+ compareMain(other) {
356
+ if (!(other instanceof _SemVer)) {
357
+ other = new _SemVer(other, this.options);
358
+ }
359
+ if (this.major < other.major) {
360
+ return -1;
361
+ }
362
+ if (this.major > other.major) {
363
+ return 1;
364
+ }
365
+ if (this.minor < other.minor) {
366
+ return -1;
367
+ }
368
+ if (this.minor > other.minor) {
369
+ return 1;
370
+ }
371
+ if (this.patch < other.patch) {
372
+ return -1;
373
+ }
374
+ if (this.patch > other.patch) {
375
+ return 1;
376
+ }
377
+ return 0;
378
+ }
379
+ comparePre(other) {
380
+ if (!(other instanceof _SemVer)) {
381
+ other = new _SemVer(other, this.options);
382
+ }
383
+ if (this.prerelease.length && !other.prerelease.length) {
384
+ return -1;
385
+ } else if (!this.prerelease.length && other.prerelease.length) {
386
+ return 1;
387
+ } else if (!this.prerelease.length && !other.prerelease.length) {
388
+ return 0;
389
+ }
390
+ let i = 0;
391
+ do {
392
+ const a = this.prerelease[i];
393
+ const b = other.prerelease[i];
394
+ debug("prerelease compare", i, a, b);
395
+ if (a === void 0 && b === void 0) {
396
+ return 0;
397
+ } else if (b === void 0) {
398
+ return 1;
399
+ } else if (a === void 0) {
400
+ return -1;
401
+ } else if (a === b) {
402
+ continue;
403
+ } else {
404
+ return compareIdentifiers(a, b);
405
+ }
406
+ } while (++i);
407
+ }
408
+ compareBuild(other) {
409
+ if (!(other instanceof _SemVer)) {
410
+ other = new _SemVer(other, this.options);
411
+ }
412
+ let i = 0;
413
+ do {
414
+ const a = this.build[i];
415
+ const b = other.build[i];
416
+ debug("build compare", i, a, b);
417
+ if (a === void 0 && b === void 0) {
418
+ return 0;
419
+ } else if (b === void 0) {
420
+ return 1;
421
+ } else if (a === void 0) {
422
+ return -1;
423
+ } else if (a === b) {
424
+ continue;
425
+ } else {
426
+ return compareIdentifiers(a, b);
427
+ }
428
+ } while (++i);
429
+ }
430
+ // preminor will bump the version up to the next minor release, and immediately
431
+ // down to pre-release. premajor and prepatch work the same way.
432
+ inc(release, identifier, identifierBase) {
433
+ if (release.startsWith("pre")) {
434
+ if (!identifier && identifierBase === false) {
435
+ throw new Error("invalid increment argument: identifier is empty");
436
+ }
437
+ if (identifier) {
438
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
439
+ if (!match || match[1] !== identifier) {
440
+ throw new Error(`invalid identifier: ${identifier}`);
441
+ }
442
+ }
443
+ }
444
+ switch (release) {
445
+ case "premajor":
446
+ this.prerelease.length = 0;
447
+ this.patch = 0;
448
+ this.minor = 0;
449
+ this.major++;
450
+ this.inc("pre", identifier, identifierBase);
451
+ break;
452
+ case "preminor":
453
+ this.prerelease.length = 0;
454
+ this.patch = 0;
455
+ this.minor++;
456
+ this.inc("pre", identifier, identifierBase);
457
+ break;
458
+ case "prepatch":
459
+ this.prerelease.length = 0;
460
+ this.inc("patch", identifier, identifierBase);
461
+ this.inc("pre", identifier, identifierBase);
462
+ break;
463
+ // If the input is a non-prerelease version, this acts the same as
464
+ // prepatch.
465
+ case "prerelease":
466
+ if (this.prerelease.length === 0) {
467
+ this.inc("patch", identifier, identifierBase);
468
+ }
469
+ this.inc("pre", identifier, identifierBase);
470
+ break;
471
+ case "release":
472
+ if (this.prerelease.length === 0) {
473
+ throw new Error(`version ${this.raw} is not a prerelease`);
474
+ }
475
+ this.prerelease.length = 0;
476
+ break;
477
+ case "major":
478
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
479
+ this.major++;
480
+ }
481
+ this.minor = 0;
482
+ this.patch = 0;
483
+ this.prerelease = [];
484
+ break;
485
+ case "minor":
486
+ if (this.patch !== 0 || this.prerelease.length === 0) {
487
+ this.minor++;
488
+ }
489
+ this.patch = 0;
490
+ this.prerelease = [];
491
+ break;
492
+ case "patch":
493
+ if (this.prerelease.length === 0) {
494
+ this.patch++;
495
+ }
496
+ this.prerelease = [];
497
+ break;
498
+ // This probably shouldn't be used publicly.
499
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
500
+ case "pre": {
501
+ const base = Number(identifierBase) ? 1 : 0;
502
+ if (this.prerelease.length === 0) {
503
+ this.prerelease = [base];
504
+ } else {
505
+ let i = this.prerelease.length;
506
+ while (--i >= 0) {
507
+ if (typeof this.prerelease[i] === "number") {
508
+ this.prerelease[i]++;
509
+ i = -2;
510
+ }
511
+ }
512
+ if (i === -1) {
513
+ if (identifier === this.prerelease.join(".") && identifierBase === false) {
514
+ throw new Error("invalid increment argument: identifier already exists");
515
+ }
516
+ this.prerelease.push(base);
517
+ }
518
+ }
519
+ if (identifier) {
520
+ let prerelease = [identifier, base];
521
+ if (identifierBase === false) {
522
+ prerelease = [identifier];
523
+ }
524
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
525
+ if (isNaN(this.prerelease[1])) {
526
+ this.prerelease = prerelease;
527
+ }
528
+ } else {
529
+ this.prerelease = prerelease;
530
+ }
531
+ }
532
+ break;
533
+ }
534
+ default:
535
+ throw new Error(`invalid increment argument: ${release}`);
536
+ }
537
+ this.raw = this.format();
538
+ if (this.build.length) {
539
+ this.raw += `+${this.build.join(".")}`;
540
+ }
541
+ return this;
542
+ }
543
+ };
544
+ module2.exports = SemVer;
545
+ }
546
+ });
547
+
548
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/parse.js
549
+ var require_parse = __commonJS({
550
+ "../../../node_modules/node-notifier/node_modules/semver/functions/parse.js"(exports2, module2) {
551
+ "use strict";
552
+ var SemVer = require_semver();
553
+ var parse2 = (version2, options, throwErrors = false) => {
554
+ if (version2 instanceof SemVer) {
555
+ return version2;
556
+ }
557
+ try {
558
+ return new SemVer(version2, options);
559
+ } catch (er) {
560
+ if (!throwErrors) {
561
+ return null;
562
+ }
563
+ throw er;
564
+ }
565
+ };
566
+ module2.exports = parse2;
567
+ }
568
+ });
569
+
570
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/valid.js
571
+ var require_valid = __commonJS({
572
+ "../../../node_modules/node-notifier/node_modules/semver/functions/valid.js"(exports2, module2) {
573
+ "use strict";
574
+ var parse2 = require_parse();
575
+ var valid = (version2, options) => {
576
+ const v = parse2(version2, options);
577
+ return v ? v.version : null;
578
+ };
579
+ module2.exports = valid;
580
+ }
581
+ });
582
+
583
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/clean.js
584
+ var require_clean = __commonJS({
585
+ "../../../node_modules/node-notifier/node_modules/semver/functions/clean.js"(exports2, module2) {
586
+ "use strict";
587
+ var parse2 = require_parse();
588
+ var clean = (version2, options) => {
589
+ const s = parse2(version2.trim().replace(/^[=v]+/, ""), options);
590
+ return s ? s.version : null;
591
+ };
592
+ module2.exports = clean;
593
+ }
594
+ });
595
+
596
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/inc.js
597
+ var require_inc = __commonJS({
598
+ "../../../node_modules/node-notifier/node_modules/semver/functions/inc.js"(exports2, module2) {
599
+ "use strict";
600
+ var SemVer = require_semver();
601
+ var inc = (version2, release, options, identifier, identifierBase) => {
602
+ if (typeof options === "string") {
603
+ identifierBase = identifier;
604
+ identifier = options;
605
+ options = void 0;
606
+ }
607
+ try {
608
+ return new SemVer(
609
+ version2 instanceof SemVer ? version2.version : version2,
610
+ options
611
+ ).inc(release, identifier, identifierBase).version;
612
+ } catch (er) {
613
+ return null;
614
+ }
615
+ };
616
+ module2.exports = inc;
617
+ }
618
+ });
619
+
620
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/diff.js
621
+ var require_diff = __commonJS({
622
+ "../../../node_modules/node-notifier/node_modules/semver/functions/diff.js"(exports2, module2) {
623
+ "use strict";
624
+ var parse2 = require_parse();
625
+ var diff = (version1, version2) => {
626
+ const v12 = parse2(version1, null, true);
627
+ const v2 = parse2(version2, null, true);
628
+ const comparison = v12.compare(v2);
629
+ if (comparison === 0) {
630
+ return null;
631
+ }
632
+ const v1Higher = comparison > 0;
633
+ const highVersion = v1Higher ? v12 : v2;
634
+ const lowVersion = v1Higher ? v2 : v12;
635
+ const highHasPre = !!highVersion.prerelease.length;
636
+ const lowHasPre = !!lowVersion.prerelease.length;
637
+ if (lowHasPre && !highHasPre) {
638
+ if (!lowVersion.patch && !lowVersion.minor) {
639
+ return "major";
640
+ }
641
+ if (lowVersion.compareMain(highVersion) === 0) {
642
+ if (lowVersion.minor && !lowVersion.patch) {
643
+ return "minor";
644
+ }
645
+ return "patch";
646
+ }
647
+ }
648
+ const prefix = highHasPre ? "pre" : "";
649
+ if (v12.major !== v2.major) {
650
+ return prefix + "major";
651
+ }
652
+ if (v12.minor !== v2.minor) {
653
+ return prefix + "minor";
654
+ }
655
+ if (v12.patch !== v2.patch) {
656
+ return prefix + "patch";
657
+ }
658
+ return "prerelease";
659
+ };
660
+ module2.exports = diff;
661
+ }
662
+ });
663
+
664
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/major.js
665
+ var require_major = __commonJS({
666
+ "../../../node_modules/node-notifier/node_modules/semver/functions/major.js"(exports2, module2) {
667
+ "use strict";
668
+ var SemVer = require_semver();
669
+ var major = (a, loose) => new SemVer(a, loose).major;
670
+ module2.exports = major;
671
+ }
672
+ });
673
+
674
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/minor.js
675
+ var require_minor = __commonJS({
676
+ "../../../node_modules/node-notifier/node_modules/semver/functions/minor.js"(exports2, module2) {
677
+ "use strict";
678
+ var SemVer = require_semver();
679
+ var minor = (a, loose) => new SemVer(a, loose).minor;
680
+ module2.exports = minor;
681
+ }
682
+ });
683
+
684
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/patch.js
685
+ var require_patch = __commonJS({
686
+ "../../../node_modules/node-notifier/node_modules/semver/functions/patch.js"(exports2, module2) {
687
+ "use strict";
688
+ var SemVer = require_semver();
689
+ var patch = (a, loose) => new SemVer(a, loose).patch;
690
+ module2.exports = patch;
691
+ }
692
+ });
693
+
694
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/prerelease.js
695
+ var require_prerelease = __commonJS({
696
+ "../../../node_modules/node-notifier/node_modules/semver/functions/prerelease.js"(exports2, module2) {
697
+ "use strict";
698
+ var parse2 = require_parse();
699
+ var prerelease = (version2, options) => {
700
+ const parsed = parse2(version2, options);
701
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
702
+ };
703
+ module2.exports = prerelease;
704
+ }
705
+ });
706
+
707
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/compare.js
708
+ var require_compare = __commonJS({
709
+ "../../../node_modules/node-notifier/node_modules/semver/functions/compare.js"(exports2, module2) {
710
+ "use strict";
711
+ var SemVer = require_semver();
712
+ var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
713
+ module2.exports = compare;
714
+ }
715
+ });
716
+
717
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/rcompare.js
718
+ var require_rcompare = __commonJS({
719
+ "../../../node_modules/node-notifier/node_modules/semver/functions/rcompare.js"(exports2, module2) {
720
+ "use strict";
721
+ var compare = require_compare();
722
+ var rcompare = (a, b, loose) => compare(b, a, loose);
723
+ module2.exports = rcompare;
724
+ }
725
+ });
726
+
727
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/compare-loose.js
728
+ var require_compare_loose = __commonJS({
729
+ "../../../node_modules/node-notifier/node_modules/semver/functions/compare-loose.js"(exports2, module2) {
730
+ "use strict";
731
+ var compare = require_compare();
732
+ var compareLoose = (a, b) => compare(a, b, true);
733
+ module2.exports = compareLoose;
734
+ }
735
+ });
736
+
737
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/compare-build.js
738
+ var require_compare_build = __commonJS({
739
+ "../../../node_modules/node-notifier/node_modules/semver/functions/compare-build.js"(exports2, module2) {
740
+ "use strict";
741
+ var SemVer = require_semver();
742
+ var compareBuild = (a, b, loose) => {
743
+ const versionA = new SemVer(a, loose);
744
+ const versionB = new SemVer(b, loose);
745
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
746
+ };
747
+ module2.exports = compareBuild;
748
+ }
749
+ });
750
+
751
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/sort.js
752
+ var require_sort = __commonJS({
753
+ "../../../node_modules/node-notifier/node_modules/semver/functions/sort.js"(exports2, module2) {
754
+ "use strict";
755
+ var compareBuild = require_compare_build();
756
+ var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
757
+ module2.exports = sort;
758
+ }
759
+ });
760
+
761
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/rsort.js
762
+ var require_rsort = __commonJS({
763
+ "../../../node_modules/node-notifier/node_modules/semver/functions/rsort.js"(exports2, module2) {
764
+ "use strict";
765
+ var compareBuild = require_compare_build();
766
+ var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
767
+ module2.exports = rsort;
768
+ }
769
+ });
770
+
771
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/gt.js
772
+ var require_gt = __commonJS({
773
+ "../../../node_modules/node-notifier/node_modules/semver/functions/gt.js"(exports2, module2) {
774
+ "use strict";
775
+ var compare = require_compare();
776
+ var gt = (a, b, loose) => compare(a, b, loose) > 0;
777
+ module2.exports = gt;
778
+ }
779
+ });
780
+
781
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/lt.js
782
+ var require_lt = __commonJS({
783
+ "../../../node_modules/node-notifier/node_modules/semver/functions/lt.js"(exports2, module2) {
784
+ "use strict";
785
+ var compare = require_compare();
786
+ var lt = (a, b, loose) => compare(a, b, loose) < 0;
787
+ module2.exports = lt;
788
+ }
789
+ });
790
+
791
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/eq.js
792
+ var require_eq = __commonJS({
793
+ "../../../node_modules/node-notifier/node_modules/semver/functions/eq.js"(exports2, module2) {
794
+ "use strict";
795
+ var compare = require_compare();
796
+ var eq = (a, b, loose) => compare(a, b, loose) === 0;
797
+ module2.exports = eq;
798
+ }
799
+ });
800
+
801
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/neq.js
802
+ var require_neq = __commonJS({
803
+ "../../../node_modules/node-notifier/node_modules/semver/functions/neq.js"(exports2, module2) {
804
+ "use strict";
805
+ var compare = require_compare();
806
+ var neq = (a, b, loose) => compare(a, b, loose) !== 0;
807
+ module2.exports = neq;
808
+ }
809
+ });
810
+
811
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/gte.js
812
+ var require_gte = __commonJS({
813
+ "../../../node_modules/node-notifier/node_modules/semver/functions/gte.js"(exports2, module2) {
814
+ "use strict";
815
+ var compare = require_compare();
816
+ var gte = (a, b, loose) => compare(a, b, loose) >= 0;
817
+ module2.exports = gte;
818
+ }
819
+ });
820
+
821
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/lte.js
822
+ var require_lte = __commonJS({
823
+ "../../../node_modules/node-notifier/node_modules/semver/functions/lte.js"(exports2, module2) {
824
+ "use strict";
825
+ var compare = require_compare();
826
+ var lte = (a, b, loose) => compare(a, b, loose) <= 0;
827
+ module2.exports = lte;
828
+ }
829
+ });
830
+
831
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/cmp.js
832
+ var require_cmp = __commonJS({
833
+ "../../../node_modules/node-notifier/node_modules/semver/functions/cmp.js"(exports2, module2) {
834
+ "use strict";
835
+ var eq = require_eq();
836
+ var neq = require_neq();
837
+ var gt = require_gt();
838
+ var gte = require_gte();
839
+ var lt = require_lt();
840
+ var lte = require_lte();
841
+ var cmp = (a, op, b, loose) => {
842
+ switch (op) {
843
+ case "===":
844
+ if (typeof a === "object") {
845
+ a = a.version;
846
+ }
847
+ if (typeof b === "object") {
848
+ b = b.version;
849
+ }
850
+ return a === b;
851
+ case "!==":
852
+ if (typeof a === "object") {
853
+ a = a.version;
854
+ }
855
+ if (typeof b === "object") {
856
+ b = b.version;
857
+ }
858
+ return a !== b;
859
+ case "":
860
+ case "=":
861
+ case "==":
862
+ return eq(a, b, loose);
863
+ case "!=":
864
+ return neq(a, b, loose);
865
+ case ">":
866
+ return gt(a, b, loose);
867
+ case ">=":
868
+ return gte(a, b, loose);
869
+ case "<":
870
+ return lt(a, b, loose);
871
+ case "<=":
872
+ return lte(a, b, loose);
873
+ default:
874
+ throw new TypeError(`Invalid operator: ${op}`);
875
+ }
876
+ };
877
+ module2.exports = cmp;
878
+ }
879
+ });
880
+
881
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/coerce.js
882
+ var require_coerce = __commonJS({
883
+ "../../../node_modules/node-notifier/node_modules/semver/functions/coerce.js"(exports2, module2) {
884
+ "use strict";
885
+ var SemVer = require_semver();
886
+ var parse2 = require_parse();
887
+ var { safeRe: re, t } = require_re();
888
+ var coerce = (version2, options) => {
889
+ if (version2 instanceof SemVer) {
890
+ return version2;
891
+ }
892
+ if (typeof version2 === "number") {
893
+ version2 = String(version2);
894
+ }
895
+ if (typeof version2 !== "string") {
896
+ return null;
897
+ }
898
+ options = options || {};
899
+ let match = null;
900
+ if (!options.rtl) {
901
+ match = version2.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
902
+ } else {
903
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
904
+ let next;
905
+ while ((next = coerceRtlRegex.exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
906
+ if (!match || next.index + next[0].length !== match.index + match[0].length) {
907
+ match = next;
908
+ }
909
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
910
+ }
911
+ coerceRtlRegex.lastIndex = -1;
912
+ }
913
+ if (match === null) {
914
+ return null;
915
+ }
916
+ const major = match[2];
917
+ const minor = match[3] || "0";
918
+ const patch = match[4] || "0";
919
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
920
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
921
+ return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options);
922
+ };
923
+ module2.exports = coerce;
924
+ }
925
+ });
926
+
927
+ // ../../../node_modules/node-notifier/node_modules/semver/internal/lrucache.js
928
+ var require_lrucache = __commonJS({
929
+ "../../../node_modules/node-notifier/node_modules/semver/internal/lrucache.js"(exports2, module2) {
930
+ "use strict";
931
+ var LRUCache = class {
932
+ constructor() {
933
+ this.max = 1e3;
934
+ this.map = /* @__PURE__ */ new Map();
935
+ }
936
+ get(key) {
937
+ const value = this.map.get(key);
938
+ if (value === void 0) {
939
+ return void 0;
940
+ } else {
941
+ this.map.delete(key);
942
+ this.map.set(key, value);
943
+ return value;
944
+ }
945
+ }
946
+ delete(key) {
947
+ return this.map.delete(key);
948
+ }
949
+ set(key, value) {
950
+ const deleted = this.delete(key);
951
+ if (!deleted && value !== void 0) {
952
+ if (this.map.size >= this.max) {
953
+ const firstKey = this.map.keys().next().value;
954
+ this.delete(firstKey);
955
+ }
956
+ this.map.set(key, value);
957
+ }
958
+ return this;
959
+ }
960
+ };
961
+ module2.exports = LRUCache;
962
+ }
963
+ });
964
+
965
+ // ../../../node_modules/node-notifier/node_modules/semver/classes/range.js
966
+ var require_range = __commonJS({
967
+ "../../../node_modules/node-notifier/node_modules/semver/classes/range.js"(exports2, module2) {
968
+ "use strict";
969
+ var SPACE_CHARACTERS = /\s+/g;
970
+ var Range = class _Range {
971
+ constructor(range, options) {
972
+ options = parseOptions(options);
973
+ if (range instanceof _Range) {
974
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
975
+ return range;
976
+ } else {
977
+ return new _Range(range.raw, options);
978
+ }
979
+ }
980
+ if (range instanceof Comparator) {
981
+ this.raw = range.value;
982
+ this.set = [[range]];
983
+ this.formatted = void 0;
984
+ return this;
985
+ }
986
+ this.options = options;
987
+ this.loose = !!options.loose;
988
+ this.includePrerelease = !!options.includePrerelease;
989
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
990
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
991
+ if (!this.set.length) {
992
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
993
+ }
994
+ if (this.set.length > 1) {
995
+ const first = this.set[0];
996
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
997
+ if (this.set.length === 0) {
998
+ this.set = [first];
999
+ } else if (this.set.length > 1) {
1000
+ for (const c of this.set) {
1001
+ if (c.length === 1 && isAny(c[0])) {
1002
+ this.set = [c];
1003
+ break;
1004
+ }
1005
+ }
1006
+ }
1007
+ }
1008
+ this.formatted = void 0;
1009
+ }
1010
+ get range() {
1011
+ if (this.formatted === void 0) {
1012
+ this.formatted = "";
1013
+ for (let i = 0; i < this.set.length; i++) {
1014
+ if (i > 0) {
1015
+ this.formatted += "||";
1016
+ }
1017
+ const comps = this.set[i];
1018
+ for (let k = 0; k < comps.length; k++) {
1019
+ if (k > 0) {
1020
+ this.formatted += " ";
1021
+ }
1022
+ this.formatted += comps[k].toString().trim();
1023
+ }
1024
+ }
1025
+ }
1026
+ return this.formatted;
1027
+ }
1028
+ format() {
1029
+ return this.range;
1030
+ }
1031
+ toString() {
1032
+ return this.range;
1033
+ }
1034
+ parseRange(range) {
1035
+ const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
1036
+ const memoKey = memoOpts + ":" + range;
1037
+ const cached = cache.get(memoKey);
1038
+ if (cached) {
1039
+ return cached;
1040
+ }
1041
+ const loose = this.options.loose;
1042
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1043
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1044
+ debug("hyphen replace", range);
1045
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1046
+ debug("comparator trim", range);
1047
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1048
+ debug("tilde trim", range);
1049
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1050
+ debug("caret trim", range);
1051
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
1052
+ if (loose) {
1053
+ rangeList = rangeList.filter((comp) => {
1054
+ debug("loose invalid filter", comp, this.options);
1055
+ return !!comp.match(re[t.COMPARATORLOOSE]);
1056
+ });
1057
+ }
1058
+ debug("range list", rangeList);
1059
+ const rangeMap = /* @__PURE__ */ new Map();
1060
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
1061
+ for (const comp of comparators) {
1062
+ if (isNullSet(comp)) {
1063
+ return [comp];
1064
+ }
1065
+ rangeMap.set(comp.value, comp);
1066
+ }
1067
+ if (rangeMap.size > 1 && rangeMap.has("")) {
1068
+ rangeMap.delete("");
1069
+ }
1070
+ const result = [...rangeMap.values()];
1071
+ cache.set(memoKey, result);
1072
+ return result;
1073
+ }
1074
+ intersects(range, options) {
1075
+ if (!(range instanceof _Range)) {
1076
+ throw new TypeError("a Range is required");
1077
+ }
1078
+ return this.set.some((thisComparators) => {
1079
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
1080
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
1081
+ return rangeComparators.every((rangeComparator) => {
1082
+ return thisComparator.intersects(rangeComparator, options);
1083
+ });
1084
+ });
1085
+ });
1086
+ });
1087
+ }
1088
+ // if ANY of the sets match ALL of its comparators, then pass
1089
+ test(version2) {
1090
+ if (!version2) {
1091
+ return false;
1092
+ }
1093
+ if (typeof version2 === "string") {
1094
+ try {
1095
+ version2 = new SemVer(version2, this.options);
1096
+ } catch (er) {
1097
+ return false;
1098
+ }
1099
+ }
1100
+ for (let i = 0; i < this.set.length; i++) {
1101
+ if (testSet(this.set[i], version2, this.options)) {
1102
+ return true;
1103
+ }
1104
+ }
1105
+ return false;
1106
+ }
1107
+ };
1108
+ module2.exports = Range;
1109
+ var LRU = require_lrucache();
1110
+ var cache = new LRU();
1111
+ var parseOptions = require_parse_options();
1112
+ var Comparator = require_comparator();
1113
+ var debug = require_debug();
1114
+ var SemVer = require_semver();
1115
+ var {
1116
+ safeRe: re,
1117
+ t,
1118
+ comparatorTrimReplace,
1119
+ tildeTrimReplace,
1120
+ caretTrimReplace
1121
+ } = require_re();
1122
+ var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
1123
+ var isNullSet = (c) => c.value === "<0.0.0-0";
1124
+ var isAny = (c) => c.value === "";
1125
+ var isSatisfiable = (comparators, options) => {
1126
+ let result = true;
1127
+ const remainingComparators = comparators.slice();
1128
+ let testComparator = remainingComparators.pop();
1129
+ while (result && remainingComparators.length) {
1130
+ result = remainingComparators.every((otherComparator) => {
1131
+ return testComparator.intersects(otherComparator, options);
1132
+ });
1133
+ testComparator = remainingComparators.pop();
1134
+ }
1135
+ return result;
1136
+ };
1137
+ var parseComparator = (comp, options) => {
1138
+ comp = comp.replace(re[t.BUILD], "");
1139
+ debug("comp", comp, options);
1140
+ comp = replaceCarets(comp, options);
1141
+ debug("caret", comp);
1142
+ comp = replaceTildes(comp, options);
1143
+ debug("tildes", comp);
1144
+ comp = replaceXRanges(comp, options);
1145
+ debug("xrange", comp);
1146
+ comp = replaceStars(comp, options);
1147
+ debug("stars", comp);
1148
+ return comp;
1149
+ };
1150
+ var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1151
+ var replaceTildes = (comp, options) => {
1152
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
1153
+ };
1154
+ var replaceTilde = (comp, options) => {
1155
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1156
+ return comp.replace(r, (_, M, m, p, pr) => {
1157
+ debug("tilde", comp, _, M, m, p, pr);
1158
+ let ret;
1159
+ if (isX(M)) {
1160
+ ret = "";
1161
+ } else if (isX(m)) {
1162
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1163
+ } else if (isX(p)) {
1164
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1165
+ } else if (pr) {
1166
+ debug("replaceTilde pr", pr);
1167
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1168
+ } else {
1169
+ ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1170
+ }
1171
+ debug("tilde return", ret);
1172
+ return ret;
1173
+ });
1174
+ };
1175
+ var replaceCarets = (comp, options) => {
1176
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
1177
+ };
1178
+ var replaceCaret = (comp, options) => {
1179
+ debug("caret", comp, options);
1180
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1181
+ const z = options.includePrerelease ? "-0" : "";
1182
+ return comp.replace(r, (_, M, m, p, pr) => {
1183
+ debug("caret", comp, _, M, m, p, pr);
1184
+ let ret;
1185
+ if (isX(M)) {
1186
+ ret = "";
1187
+ } else if (isX(m)) {
1188
+ ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1189
+ } else if (isX(p)) {
1190
+ if (M === "0") {
1191
+ ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1192
+ } else {
1193
+ ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1194
+ }
1195
+ } else if (pr) {
1196
+ debug("replaceCaret pr", pr);
1197
+ if (M === "0") {
1198
+ if (m === "0") {
1199
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
1200
+ } else {
1201
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1202
+ }
1203
+ } else {
1204
+ ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1205
+ }
1206
+ } else {
1207
+ debug("no pr");
1208
+ if (M === "0") {
1209
+ if (m === "0") {
1210
+ ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
1211
+ } else {
1212
+ ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
1213
+ }
1214
+ } else {
1215
+ ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1216
+ }
1217
+ }
1218
+ debug("caret return", ret);
1219
+ return ret;
1220
+ });
1221
+ };
1222
+ var replaceXRanges = (comp, options) => {
1223
+ debug("replaceXRanges", comp, options);
1224
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
1225
+ };
1226
+ var replaceXRange = (comp, options) => {
1227
+ comp = comp.trim();
1228
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1229
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1230
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
1231
+ const xM = isX(M);
1232
+ const xm = xM || isX(m);
1233
+ const xp = xm || isX(p);
1234
+ const anyX = xp;
1235
+ if (gtlt === "=" && anyX) {
1236
+ gtlt = "";
1237
+ }
1238
+ pr = options.includePrerelease ? "-0" : "";
1239
+ if (xM) {
1240
+ if (gtlt === ">" || gtlt === "<") {
1241
+ ret = "<0.0.0-0";
1242
+ } else {
1243
+ ret = "*";
1244
+ }
1245
+ } else if (gtlt && anyX) {
1246
+ if (xm) {
1247
+ m = 0;
1248
+ }
1249
+ p = 0;
1250
+ if (gtlt === ">") {
1251
+ gtlt = ">=";
1252
+ if (xm) {
1253
+ M = +M + 1;
1254
+ m = 0;
1255
+ p = 0;
1256
+ } else {
1257
+ m = +m + 1;
1258
+ p = 0;
1259
+ }
1260
+ } else if (gtlt === "<=") {
1261
+ gtlt = "<";
1262
+ if (xm) {
1263
+ M = +M + 1;
1264
+ } else {
1265
+ m = +m + 1;
1266
+ }
1267
+ }
1268
+ if (gtlt === "<") {
1269
+ pr = "-0";
1270
+ }
1271
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
1272
+ } else if (xm) {
1273
+ ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1274
+ } else if (xp) {
1275
+ ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
1276
+ }
1277
+ debug("xRange return", ret);
1278
+ return ret;
1279
+ });
1280
+ };
1281
+ var replaceStars = (comp, options) => {
1282
+ debug("replaceStars", comp, options);
1283
+ return comp.trim().replace(re[t.STAR], "");
1284
+ };
1285
+ var replaceGTE0 = (comp, options) => {
1286
+ debug("replaceGTE0", comp, options);
1287
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1288
+ };
1289
+ var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
1290
+ if (isX(fM)) {
1291
+ from = "";
1292
+ } else if (isX(fm)) {
1293
+ from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
1294
+ } else if (isX(fp)) {
1295
+ from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
1296
+ } else if (fpr) {
1297
+ from = `>=${from}`;
1298
+ } else {
1299
+ from = `>=${from}${incPr ? "-0" : ""}`;
1300
+ }
1301
+ if (isX(tM)) {
1302
+ to = "";
1303
+ } else if (isX(tm)) {
1304
+ to = `<${+tM + 1}.0.0-0`;
1305
+ } else if (isX(tp)) {
1306
+ to = `<${tM}.${+tm + 1}.0-0`;
1307
+ } else if (tpr) {
1308
+ to = `<=${tM}.${tm}.${tp}-${tpr}`;
1309
+ } else if (incPr) {
1310
+ to = `<${tM}.${tm}.${+tp + 1}-0`;
1311
+ } else {
1312
+ to = `<=${to}`;
1313
+ }
1314
+ return `${from} ${to}`.trim();
1315
+ };
1316
+ var testSet = (set, version2, options) => {
1317
+ for (let i = 0; i < set.length; i++) {
1318
+ if (!set[i].test(version2)) {
1319
+ return false;
1320
+ }
1321
+ }
1322
+ if (version2.prerelease.length && !options.includePrerelease) {
1323
+ for (let i = 0; i < set.length; i++) {
1324
+ debug(set[i].semver);
1325
+ if (set[i].semver === Comparator.ANY) {
1326
+ continue;
1327
+ }
1328
+ if (set[i].semver.prerelease.length > 0) {
1329
+ const allowed = set[i].semver;
1330
+ if (allowed.major === version2.major && allowed.minor === version2.minor && allowed.patch === version2.patch) {
1331
+ return true;
1332
+ }
1333
+ }
1334
+ }
1335
+ return false;
1336
+ }
1337
+ return true;
1338
+ };
1339
+ }
1340
+ });
1341
+
1342
+ // ../../../node_modules/node-notifier/node_modules/semver/classes/comparator.js
1343
+ var require_comparator = __commonJS({
1344
+ "../../../node_modules/node-notifier/node_modules/semver/classes/comparator.js"(exports2, module2) {
1345
+ "use strict";
1346
+ var ANY = /* @__PURE__ */ Symbol("SemVer ANY");
1347
+ var Comparator = class _Comparator {
1348
+ static get ANY() {
1349
+ return ANY;
1350
+ }
1351
+ constructor(comp, options) {
1352
+ options = parseOptions(options);
1353
+ if (comp instanceof _Comparator) {
1354
+ if (comp.loose === !!options.loose) {
1355
+ return comp;
1356
+ } else {
1357
+ comp = comp.value;
1358
+ }
1359
+ }
1360
+ comp = comp.trim().split(/\s+/).join(" ");
1361
+ debug("comparator", comp, options);
1362
+ this.options = options;
1363
+ this.loose = !!options.loose;
1364
+ this.parse(comp);
1365
+ if (this.semver === ANY) {
1366
+ this.value = "";
1367
+ } else {
1368
+ this.value = this.operator + this.semver.version;
1369
+ }
1370
+ debug("comp", this);
1371
+ }
1372
+ parse(comp) {
1373
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1374
+ const m = comp.match(r);
1375
+ if (!m) {
1376
+ throw new TypeError(`Invalid comparator: ${comp}`);
1377
+ }
1378
+ this.operator = m[1] !== void 0 ? m[1] : "";
1379
+ if (this.operator === "=") {
1380
+ this.operator = "";
1381
+ }
1382
+ if (!m[2]) {
1383
+ this.semver = ANY;
1384
+ } else {
1385
+ this.semver = new SemVer(m[2], this.options.loose);
1386
+ }
1387
+ }
1388
+ toString() {
1389
+ return this.value;
1390
+ }
1391
+ test(version2) {
1392
+ debug("Comparator.test", version2, this.options.loose);
1393
+ if (this.semver === ANY || version2 === ANY) {
1394
+ return true;
1395
+ }
1396
+ if (typeof version2 === "string") {
1397
+ try {
1398
+ version2 = new SemVer(version2, this.options);
1399
+ } catch (er) {
1400
+ return false;
1401
+ }
1402
+ }
1403
+ return cmp(version2, this.operator, this.semver, this.options);
1404
+ }
1405
+ intersects(comp, options) {
1406
+ if (!(comp instanceof _Comparator)) {
1407
+ throw new TypeError("a Comparator is required");
1408
+ }
1409
+ if (this.operator === "") {
1410
+ if (this.value === "") {
1411
+ return true;
1412
+ }
1413
+ return new Range(comp.value, options).test(this.value);
1414
+ } else if (comp.operator === "") {
1415
+ if (comp.value === "") {
1416
+ return true;
1417
+ }
1418
+ return new Range(this.value, options).test(comp.semver);
1419
+ }
1420
+ options = parseOptions(options);
1421
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
1422
+ return false;
1423
+ }
1424
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
1425
+ return false;
1426
+ }
1427
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
1428
+ return true;
1429
+ }
1430
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
1431
+ return true;
1432
+ }
1433
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
1434
+ return true;
1435
+ }
1436
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
1437
+ return true;
1438
+ }
1439
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
1440
+ return true;
1441
+ }
1442
+ return false;
1443
+ }
1444
+ };
1445
+ module2.exports = Comparator;
1446
+ var parseOptions = require_parse_options();
1447
+ var { safeRe: re, t } = require_re();
1448
+ var cmp = require_cmp();
1449
+ var debug = require_debug();
1450
+ var SemVer = require_semver();
1451
+ var Range = require_range();
1452
+ }
1453
+ });
1454
+
1455
+ // ../../../node_modules/node-notifier/node_modules/semver/functions/satisfies.js
1456
+ var require_satisfies = __commonJS({
1457
+ "../../../node_modules/node-notifier/node_modules/semver/functions/satisfies.js"(exports2, module2) {
1458
+ "use strict";
1459
+ var Range = require_range();
1460
+ var satisfies = (version2, range, options) => {
1461
+ try {
1462
+ range = new Range(range, options);
1463
+ } catch (er) {
1464
+ return false;
1465
+ }
1466
+ return range.test(version2);
1467
+ };
1468
+ module2.exports = satisfies;
1469
+ }
1470
+ });
1471
+
1472
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/to-comparators.js
1473
+ var require_to_comparators = __commonJS({
1474
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/to-comparators.js"(exports2, module2) {
1475
+ "use strict";
1476
+ var Range = require_range();
1477
+ var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
1478
+ module2.exports = toComparators;
1479
+ }
1480
+ });
1481
+
1482
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/max-satisfying.js
1483
+ var require_max_satisfying = __commonJS({
1484
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
1485
+ "use strict";
1486
+ var SemVer = require_semver();
1487
+ var Range = require_range();
1488
+ var maxSatisfying = (versions, range, options) => {
1489
+ let max = null;
1490
+ let maxSV = null;
1491
+ let rangeObj = null;
1492
+ try {
1493
+ rangeObj = new Range(range, options);
1494
+ } catch (er) {
1495
+ return null;
1496
+ }
1497
+ versions.forEach((v) => {
1498
+ if (rangeObj.test(v)) {
1499
+ if (!max || maxSV.compare(v) === -1) {
1500
+ max = v;
1501
+ maxSV = new SemVer(max, options);
1502
+ }
1503
+ }
1504
+ });
1505
+ return max;
1506
+ };
1507
+ module2.exports = maxSatisfying;
1508
+ }
1509
+ });
1510
+
1511
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/min-satisfying.js
1512
+ var require_min_satisfying = __commonJS({
1513
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
1514
+ "use strict";
1515
+ var SemVer = require_semver();
1516
+ var Range = require_range();
1517
+ var minSatisfying = (versions, range, options) => {
1518
+ let min = null;
1519
+ let minSV = null;
1520
+ let rangeObj = null;
1521
+ try {
1522
+ rangeObj = new Range(range, options);
1523
+ } catch (er) {
1524
+ return null;
1525
+ }
1526
+ versions.forEach((v) => {
1527
+ if (rangeObj.test(v)) {
1528
+ if (!min || minSV.compare(v) === 1) {
1529
+ min = v;
1530
+ minSV = new SemVer(min, options);
1531
+ }
1532
+ }
1533
+ });
1534
+ return min;
1535
+ };
1536
+ module2.exports = minSatisfying;
1537
+ }
1538
+ });
1539
+
1540
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/min-version.js
1541
+ var require_min_version = __commonJS({
1542
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/min-version.js"(exports2, module2) {
1543
+ "use strict";
1544
+ var SemVer = require_semver();
1545
+ var Range = require_range();
1546
+ var gt = require_gt();
1547
+ var minVersion = (range, loose) => {
1548
+ range = new Range(range, loose);
1549
+ let minver = new SemVer("0.0.0");
1550
+ if (range.test(minver)) {
1551
+ return minver;
1552
+ }
1553
+ minver = new SemVer("0.0.0-0");
1554
+ if (range.test(minver)) {
1555
+ return minver;
1556
+ }
1557
+ minver = null;
1558
+ for (let i = 0; i < range.set.length; ++i) {
1559
+ const comparators = range.set[i];
1560
+ let setMin = null;
1561
+ comparators.forEach((comparator) => {
1562
+ const compver = new SemVer(comparator.semver.version);
1563
+ switch (comparator.operator) {
1564
+ case ">":
1565
+ if (compver.prerelease.length === 0) {
1566
+ compver.patch++;
1567
+ } else {
1568
+ compver.prerelease.push(0);
1569
+ }
1570
+ compver.raw = compver.format();
1571
+ /* fallthrough */
1572
+ case "":
1573
+ case ">=":
1574
+ if (!setMin || gt(compver, setMin)) {
1575
+ setMin = compver;
1576
+ }
1577
+ break;
1578
+ case "<":
1579
+ case "<=":
1580
+ break;
1581
+ /* istanbul ignore next */
1582
+ default:
1583
+ throw new Error(`Unexpected operation: ${comparator.operator}`);
1584
+ }
1585
+ });
1586
+ if (setMin && (!minver || gt(minver, setMin))) {
1587
+ minver = setMin;
1588
+ }
1589
+ }
1590
+ if (minver && range.test(minver)) {
1591
+ return minver;
1592
+ }
1593
+ return null;
1594
+ };
1595
+ module2.exports = minVersion;
1596
+ }
1597
+ });
1598
+
1599
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/valid.js
1600
+ var require_valid2 = __commonJS({
1601
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/valid.js"(exports2, module2) {
1602
+ "use strict";
1603
+ var Range = require_range();
1604
+ var validRange = (range, options) => {
1605
+ try {
1606
+ return new Range(range, options).range || "*";
1607
+ } catch (er) {
1608
+ return null;
1609
+ }
1610
+ };
1611
+ module2.exports = validRange;
1612
+ }
1613
+ });
1614
+
1615
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/outside.js
1616
+ var require_outside = __commonJS({
1617
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/outside.js"(exports2, module2) {
1618
+ "use strict";
1619
+ var SemVer = require_semver();
1620
+ var Comparator = require_comparator();
1621
+ var { ANY } = Comparator;
1622
+ var Range = require_range();
1623
+ var satisfies = require_satisfies();
1624
+ var gt = require_gt();
1625
+ var lt = require_lt();
1626
+ var lte = require_lte();
1627
+ var gte = require_gte();
1628
+ var outside = (version2, range, hilo, options) => {
1629
+ version2 = new SemVer(version2, options);
1630
+ range = new Range(range, options);
1631
+ let gtfn, ltefn, ltfn, comp, ecomp;
1632
+ switch (hilo) {
1633
+ case ">":
1634
+ gtfn = gt;
1635
+ ltefn = lte;
1636
+ ltfn = lt;
1637
+ comp = ">";
1638
+ ecomp = ">=";
1639
+ break;
1640
+ case "<":
1641
+ gtfn = lt;
1642
+ ltefn = gte;
1643
+ ltfn = gt;
1644
+ comp = "<";
1645
+ ecomp = "<=";
1646
+ break;
1647
+ default:
1648
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
1649
+ }
1650
+ if (satisfies(version2, range, options)) {
1651
+ return false;
1652
+ }
1653
+ for (let i = 0; i < range.set.length; ++i) {
1654
+ const comparators = range.set[i];
1655
+ let high = null;
1656
+ let low = null;
1657
+ comparators.forEach((comparator) => {
1658
+ if (comparator.semver === ANY) {
1659
+ comparator = new Comparator(">=0.0.0");
1660
+ }
1661
+ high = high || comparator;
1662
+ low = low || comparator;
1663
+ if (gtfn(comparator.semver, high.semver, options)) {
1664
+ high = comparator;
1665
+ } else if (ltfn(comparator.semver, low.semver, options)) {
1666
+ low = comparator;
1667
+ }
1668
+ });
1669
+ if (high.operator === comp || high.operator === ecomp) {
1670
+ return false;
1671
+ }
1672
+ if ((!low.operator || low.operator === comp) && ltefn(version2, low.semver)) {
1673
+ return false;
1674
+ } else if (low.operator === ecomp && ltfn(version2, low.semver)) {
1675
+ return false;
1676
+ }
1677
+ }
1678
+ return true;
1679
+ };
1680
+ module2.exports = outside;
1681
+ }
1682
+ });
1683
+
1684
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/gtr.js
1685
+ var require_gtr = __commonJS({
1686
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/gtr.js"(exports2, module2) {
1687
+ "use strict";
1688
+ var outside = require_outside();
1689
+ var gtr = (version2, range, options) => outside(version2, range, ">", options);
1690
+ module2.exports = gtr;
1691
+ }
1692
+ });
1693
+
1694
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/ltr.js
1695
+ var require_ltr = __commonJS({
1696
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/ltr.js"(exports2, module2) {
1697
+ "use strict";
1698
+ var outside = require_outside();
1699
+ var ltr = (version2, range, options) => outside(version2, range, "<", options);
1700
+ module2.exports = ltr;
1701
+ }
1702
+ });
1703
+
1704
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/intersects.js
1705
+ var require_intersects = __commonJS({
1706
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/intersects.js"(exports2, module2) {
1707
+ "use strict";
1708
+ var Range = require_range();
1709
+ var intersects = (r1, r2, options) => {
1710
+ r1 = new Range(r1, options);
1711
+ r2 = new Range(r2, options);
1712
+ return r1.intersects(r2, options);
1713
+ };
1714
+ module2.exports = intersects;
1715
+ }
1716
+ });
1717
+
1718
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/simplify.js
1719
+ var require_simplify = __commonJS({
1720
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/simplify.js"(exports2, module2) {
1721
+ "use strict";
1722
+ var satisfies = require_satisfies();
1723
+ var compare = require_compare();
1724
+ module2.exports = (versions, range, options) => {
1725
+ const set = [];
1726
+ let first = null;
1727
+ let prev = null;
1728
+ const v = versions.sort((a, b) => compare(a, b, options));
1729
+ for (const version2 of v) {
1730
+ const included = satisfies(version2, range, options);
1731
+ if (included) {
1732
+ prev = version2;
1733
+ if (!first) {
1734
+ first = version2;
1735
+ }
1736
+ } else {
1737
+ if (prev) {
1738
+ set.push([first, prev]);
1739
+ }
1740
+ prev = null;
1741
+ first = null;
1742
+ }
1743
+ }
1744
+ if (first) {
1745
+ set.push([first, null]);
1746
+ }
1747
+ const ranges = [];
1748
+ for (const [min, max] of set) {
1749
+ if (min === max) {
1750
+ ranges.push(min);
1751
+ } else if (!max && min === v[0]) {
1752
+ ranges.push("*");
1753
+ } else if (!max) {
1754
+ ranges.push(`>=${min}`);
1755
+ } else if (min === v[0]) {
1756
+ ranges.push(`<=${max}`);
1757
+ } else {
1758
+ ranges.push(`${min} - ${max}`);
1759
+ }
1760
+ }
1761
+ const simplified = ranges.join(" || ");
1762
+ const original = typeof range.raw === "string" ? range.raw : String(range);
1763
+ return simplified.length < original.length ? simplified : range;
1764
+ };
1765
+ }
1766
+ });
1767
+
1768
+ // ../../../node_modules/node-notifier/node_modules/semver/ranges/subset.js
1769
+ var require_subset = __commonJS({
1770
+ "../../../node_modules/node-notifier/node_modules/semver/ranges/subset.js"(exports2, module2) {
1771
+ "use strict";
1772
+ var Range = require_range();
1773
+ var Comparator = require_comparator();
1774
+ var { ANY } = Comparator;
1775
+ var satisfies = require_satisfies();
1776
+ var compare = require_compare();
1777
+ var subset = (sub, dom, options = {}) => {
1778
+ if (sub === dom) {
1779
+ return true;
1780
+ }
1781
+ sub = new Range(sub, options);
1782
+ dom = new Range(dom, options);
1783
+ let sawNonNull = false;
1784
+ OUTER: for (const simpleSub of sub.set) {
1785
+ for (const simpleDom of dom.set) {
1786
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
1787
+ sawNonNull = sawNonNull || isSub !== null;
1788
+ if (isSub) {
1789
+ continue OUTER;
1790
+ }
1791
+ }
1792
+ if (sawNonNull) {
1793
+ return false;
1794
+ }
1795
+ }
1796
+ return true;
1797
+ };
1798
+ var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
1799
+ var minimumVersion = [new Comparator(">=0.0.0")];
1800
+ var simpleSubset = (sub, dom, options) => {
1801
+ if (sub === dom) {
1802
+ return true;
1803
+ }
1804
+ if (sub.length === 1 && sub[0].semver === ANY) {
1805
+ if (dom.length === 1 && dom[0].semver === ANY) {
1806
+ return true;
1807
+ } else if (options.includePrerelease) {
1808
+ sub = minimumVersionWithPreRelease;
1809
+ } else {
1810
+ sub = minimumVersion;
1811
+ }
1812
+ }
1813
+ if (dom.length === 1 && dom[0].semver === ANY) {
1814
+ if (options.includePrerelease) {
1815
+ return true;
1816
+ } else {
1817
+ dom = minimumVersion;
1818
+ }
1819
+ }
1820
+ const eqSet = /* @__PURE__ */ new Set();
1821
+ let gt, lt;
1822
+ for (const c of sub) {
1823
+ if (c.operator === ">" || c.operator === ">=") {
1824
+ gt = higherGT(gt, c, options);
1825
+ } else if (c.operator === "<" || c.operator === "<=") {
1826
+ lt = lowerLT(lt, c, options);
1827
+ } else {
1828
+ eqSet.add(c.semver);
1829
+ }
1830
+ }
1831
+ if (eqSet.size > 1) {
1832
+ return null;
1833
+ }
1834
+ let gtltComp;
1835
+ if (gt && lt) {
1836
+ gtltComp = compare(gt.semver, lt.semver, options);
1837
+ if (gtltComp > 0) {
1838
+ return null;
1839
+ } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
1840
+ return null;
1841
+ }
1842
+ }
1843
+ for (const eq of eqSet) {
1844
+ if (gt && !satisfies(eq, String(gt), options)) {
1845
+ return null;
1846
+ }
1847
+ if (lt && !satisfies(eq, String(lt), options)) {
1848
+ return null;
1849
+ }
1850
+ for (const c of dom) {
1851
+ if (!satisfies(eq, String(c), options)) {
1852
+ return false;
1853
+ }
1854
+ }
1855
+ return true;
1856
+ }
1857
+ let higher, lower;
1858
+ let hasDomLT, hasDomGT;
1859
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
1860
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
1861
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
1862
+ needDomLTPre = false;
1863
+ }
1864
+ for (const c of dom) {
1865
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
1866
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
1867
+ if (gt) {
1868
+ if (needDomGTPre) {
1869
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
1870
+ needDomGTPre = false;
1871
+ }
1872
+ }
1873
+ if (c.operator === ">" || c.operator === ">=") {
1874
+ higher = higherGT(gt, c, options);
1875
+ if (higher === c && higher !== gt) {
1876
+ return false;
1877
+ }
1878
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
1879
+ return false;
1880
+ }
1881
+ }
1882
+ if (lt) {
1883
+ if (needDomLTPre) {
1884
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
1885
+ needDomLTPre = false;
1886
+ }
1887
+ }
1888
+ if (c.operator === "<" || c.operator === "<=") {
1889
+ lower = lowerLT(lt, c, options);
1890
+ if (lower === c && lower !== lt) {
1891
+ return false;
1892
+ }
1893
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
1894
+ return false;
1895
+ }
1896
+ }
1897
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
1898
+ return false;
1899
+ }
1900
+ }
1901
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
1902
+ return false;
1903
+ }
1904
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
1905
+ return false;
1906
+ }
1907
+ if (needDomGTPre || needDomLTPre) {
1908
+ return false;
1909
+ }
1910
+ return true;
1911
+ };
1912
+ var higherGT = (a, b, options) => {
1913
+ if (!a) {
1914
+ return b;
1915
+ }
1916
+ const comp = compare(a.semver, b.semver, options);
1917
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
1918
+ };
1919
+ var lowerLT = (a, b, options) => {
1920
+ if (!a) {
1921
+ return b;
1922
+ }
1923
+ const comp = compare(a.semver, b.semver, options);
1924
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
1925
+ };
1926
+ module2.exports = subset;
1927
+ }
1928
+ });
1929
+
1930
+ // ../../../node_modules/node-notifier/node_modules/semver/index.js
1931
+ var require_semver2 = __commonJS({
1932
+ "../../../node_modules/node-notifier/node_modules/semver/index.js"(exports2, module2) {
1933
+ "use strict";
1934
+ var internalRe = require_re();
1935
+ var constants = require_constants();
1936
+ var SemVer = require_semver();
1937
+ var identifiers = require_identifiers();
1938
+ var parse2 = require_parse();
1939
+ var valid = require_valid();
1940
+ var clean = require_clean();
1941
+ var inc = require_inc();
1942
+ var diff = require_diff();
1943
+ var major = require_major();
1944
+ var minor = require_minor();
1945
+ var patch = require_patch();
1946
+ var prerelease = require_prerelease();
1947
+ var compare = require_compare();
1948
+ var rcompare = require_rcompare();
1949
+ var compareLoose = require_compare_loose();
1950
+ var compareBuild = require_compare_build();
1951
+ var sort = require_sort();
1952
+ var rsort = require_rsort();
1953
+ var gt = require_gt();
1954
+ var lt = require_lt();
1955
+ var eq = require_eq();
1956
+ var neq = require_neq();
1957
+ var gte = require_gte();
1958
+ var lte = require_lte();
1959
+ var cmp = require_cmp();
1960
+ var coerce = require_coerce();
1961
+ var Comparator = require_comparator();
1962
+ var Range = require_range();
1963
+ var satisfies = require_satisfies();
1964
+ var toComparators = require_to_comparators();
1965
+ var maxSatisfying = require_max_satisfying();
1966
+ var minSatisfying = require_min_satisfying();
1967
+ var minVersion = require_min_version();
1968
+ var validRange = require_valid2();
1969
+ var outside = require_outside();
1970
+ var gtr = require_gtr();
1971
+ var ltr = require_ltr();
1972
+ var intersects = require_intersects();
1973
+ var simplifyRange = require_simplify();
1974
+ var subset = require_subset();
1975
+ module2.exports = {
1976
+ parse: parse2,
1977
+ valid,
1978
+ clean,
1979
+ inc,
1980
+ diff,
1981
+ major,
1982
+ minor,
1983
+ patch,
1984
+ prerelease,
1985
+ compare,
1986
+ rcompare,
1987
+ compareLoose,
1988
+ compareBuild,
1989
+ sort,
1990
+ rsort,
1991
+ gt,
1992
+ lt,
1993
+ eq,
1994
+ neq,
1995
+ gte,
1996
+ lte,
1997
+ cmp,
1998
+ coerce,
1999
+ Comparator,
2000
+ Range,
2001
+ satisfies,
2002
+ toComparators,
2003
+ maxSatisfying,
2004
+ minSatisfying,
2005
+ minVersion,
2006
+ validRange,
2007
+ outside,
2008
+ gtr,
2009
+ ltr,
2010
+ intersects,
2011
+ simplifyRange,
2012
+ subset,
2013
+ SemVer,
2014
+ re: internalRe.re,
2015
+ src: internalRe.src,
2016
+ tokens: internalRe.t,
2017
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
2018
+ RELEASE_TYPES: constants.RELEASE_TYPES,
2019
+ compareIdentifiers: identifiers.compareIdentifiers,
2020
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
2021
+ };
2022
+ }
2023
+ });
2024
+
2025
+ // ../../../node_modules/is-docker/index.js
2026
+ var require_is_docker = __commonJS({
2027
+ "../../../node_modules/is-docker/index.js"(exports2, module2) {
2028
+ "use strict";
2029
+ var fs = require("fs");
2030
+ var isDocker;
2031
+ function hasDockerEnv() {
2032
+ try {
2033
+ fs.statSync("/.dockerenv");
2034
+ return true;
2035
+ } catch (_) {
2036
+ return false;
2037
+ }
2038
+ }
2039
+ function hasDockerCGroup() {
2040
+ try {
2041
+ return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
2042
+ } catch (_) {
2043
+ return false;
2044
+ }
2045
+ }
2046
+ module2.exports = () => {
2047
+ if (isDocker === void 0) {
2048
+ isDocker = hasDockerEnv() || hasDockerCGroup();
2049
+ }
2050
+ return isDocker;
2051
+ };
2052
+ }
2053
+ });
2054
+
2055
+ // ../../../node_modules/is-wsl/index.js
2056
+ var require_is_wsl = __commonJS({
2057
+ "../../../node_modules/is-wsl/index.js"(exports2, module2) {
2058
+ "use strict";
2059
+ var os = require("os");
2060
+ var fs = require("fs");
2061
+ var isDocker = require_is_docker();
2062
+ var isWsl = () => {
2063
+ if (process.platform !== "linux") {
2064
+ return false;
2065
+ }
2066
+ if (os.release().toLowerCase().includes("microsoft")) {
2067
+ if (isDocker()) {
2068
+ return false;
2069
+ }
2070
+ return true;
2071
+ }
2072
+ try {
2073
+ return fs.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
2074
+ } catch (_) {
2075
+ return false;
2076
+ }
2077
+ };
2078
+ if (process.env.__IS_WSL_TEST__) {
2079
+ module2.exports = isWsl;
2080
+ } else {
2081
+ module2.exports = isWsl();
2082
+ }
2083
+ }
2084
+ });
2085
+
2086
+ // ../../../node_modules/node-notifier/lib/utils.js
2087
+ var require_utils = __commonJS({
2088
+ "../../../node_modules/node-notifier/lib/utils.js"(exports2, module2) {
2089
+ "use strict";
2090
+ var shellwords = require_shellwords();
2091
+ var cp = require("child_process");
2092
+ var semver = require_semver2();
2093
+ var isWSL = require_is_wsl();
2094
+ var path2 = require("path");
2095
+ var url = require("url");
2096
+ var os = require("os");
2097
+ var fs = require("fs");
2098
+ var net = require("net");
2099
+ var BUFFER_SIZE = 1024;
2100
+ function clone(obj) {
2101
+ return JSON.parse(JSON.stringify(obj));
2102
+ }
2103
+ module2.exports.clone = clone;
2104
+ var escapeQuotes = function(str) {
2105
+ if (typeof str === "string") {
2106
+ return str.replace(/(["$`\\])/g, "\\$1");
2107
+ } else {
2108
+ return str;
2109
+ }
2110
+ };
2111
+ var inArray = function(arr, val) {
2112
+ return arr.indexOf(val) !== -1;
2113
+ };
2114
+ var notifySendFlags = {
2115
+ u: "urgency",
2116
+ urgency: "urgency",
2117
+ t: "expire-time",
2118
+ time: "expire-time",
2119
+ timeout: "expire-time",
2120
+ e: "expire-time",
2121
+ expire: "expire-time",
2122
+ "expire-time": "expire-time",
2123
+ i: "icon",
2124
+ icon: "icon",
2125
+ c: "category",
2126
+ category: "category",
2127
+ subtitle: "category",
2128
+ h: "hint",
2129
+ hint: "hint",
2130
+ a: "app-name",
2131
+ "app-name": "app-name"
2132
+ };
2133
+ module2.exports.command = function(notifier, options, cb) {
2134
+ notifier = shellwords.escape(notifier);
2135
+ if (process.env.DEBUG && process.env.DEBUG.indexOf("notifier") !== -1) {
2136
+ console.info("node-notifier debug info (command):");
2137
+ console.info("[notifier path]", notifier);
2138
+ console.info("[notifier options]", options.join(" "));
2139
+ }
2140
+ return cp.exec(notifier + " " + options.join(" "), function(error, stdout, stderr) {
2141
+ if (error) return cb(error);
2142
+ cb(stderr, stdout);
2143
+ });
2144
+ };
2145
+ module2.exports.fileCommand = function(notifier, options, cb) {
2146
+ if (process.env.DEBUG && process.env.DEBUG.indexOf("notifier") !== -1) {
2147
+ console.info("node-notifier debug info (fileCommand):");
2148
+ console.info("[notifier path]", notifier);
2149
+ console.info("[notifier options]", options.join(" "));
2150
+ }
2151
+ return cp.execFile(notifier, options, function(error, stdout, stderr) {
2152
+ if (error) return cb(error, stdout);
2153
+ cb(stderr, stdout);
2154
+ });
2155
+ };
2156
+ module2.exports.fileCommandJson = function(notifier, options, cb) {
2157
+ if (process.env.DEBUG && process.env.DEBUG.indexOf("notifier") !== -1) {
2158
+ console.info("node-notifier debug info (fileCommandJson):");
2159
+ console.info("[notifier path]", notifier);
2160
+ console.info("[notifier options]", options.join(" "));
2161
+ }
2162
+ return cp.execFile(notifier, options, function(error, stdout, stderr) {
2163
+ if (error) return cb(error, stdout);
2164
+ if (!stdout) return cb(error, {});
2165
+ try {
2166
+ const data = JSON.parse(stdout);
2167
+ cb(!stderr ? null : stderr, data);
2168
+ } catch (e) {
2169
+ cb(e, stdout);
2170
+ }
2171
+ });
2172
+ };
2173
+ module2.exports.immediateFileCommand = function(notifier, options, cb) {
2174
+ if (process.env.DEBUG && process.env.DEBUG.indexOf("notifier") !== -1) {
2175
+ console.info("node-notifier debug info (notifier):");
2176
+ console.info("[notifier path]", notifier);
2177
+ }
2178
+ notifierExists(notifier, function(_, exists) {
2179
+ if (!exists) {
2180
+ return cb(new Error("Notifier (" + notifier + ") not found on system."));
2181
+ }
2182
+ cp.execFile(notifier, options);
2183
+ cb();
2184
+ });
2185
+ };
2186
+ function notifierExists(notifier, cb) {
2187
+ return fs.stat(notifier, function(err, stat) {
2188
+ if (!err) return cb(err, stat.isFile());
2189
+ if (path2.extname(notifier)) {
2190
+ return cb(err, false);
2191
+ }
2192
+ return fs.stat(notifier + ".exe", function(err2, stat2) {
2193
+ if (err2) return cb(err2, false);
2194
+ cb(err2, stat2.isFile());
2195
+ });
2196
+ });
2197
+ }
2198
+ var mapAppIcon = function(options) {
2199
+ if (options.appIcon) {
2200
+ options.icon = options.appIcon;
2201
+ delete options.appIcon;
2202
+ }
2203
+ return options;
2204
+ };
2205
+ var mapText = function(options) {
2206
+ if (options.text) {
2207
+ options.message = options.text;
2208
+ delete options.text;
2209
+ }
2210
+ return options;
2211
+ };
2212
+ var mapIconShorthand = function(options) {
2213
+ if (options.i) {
2214
+ options.icon = options.i;
2215
+ delete options.i;
2216
+ }
2217
+ return options;
2218
+ };
2219
+ module2.exports.mapToNotifySend = function(options) {
2220
+ options = mapAppIcon(options);
2221
+ options = mapText(options);
2222
+ if (options.timeout === false) {
2223
+ delete options.timeout;
2224
+ }
2225
+ if (options.wait === true) {
2226
+ options["expire-time"] = 5;
2227
+ }
2228
+ for (const key in options) {
2229
+ if (key === "message" || key === "title") continue;
2230
+ if (options.hasOwnProperty(key) && notifySendFlags[key] !== key) {
2231
+ options[notifySendFlags[key]] = options[key];
2232
+ delete options[key];
2233
+ }
2234
+ }
2235
+ if (typeof options["expire-time"] === "undefined") {
2236
+ options["expire-time"] = 10 * 1e3;
2237
+ } else if (typeof options["expire-time"] === "number") {
2238
+ options["expire-time"] = options["expire-time"] * 1e3;
2239
+ }
2240
+ return options;
2241
+ };
2242
+ module2.exports.mapToGrowl = function(options) {
2243
+ options = mapAppIcon(options);
2244
+ options = mapIconShorthand(options);
2245
+ options = mapText(options);
2246
+ if (options.icon && !Buffer.isBuffer(options.icon)) {
2247
+ try {
2248
+ options.icon = fs.readFileSync(options.icon);
2249
+ } catch (ex) {
2250
+ }
2251
+ }
2252
+ return options;
2253
+ };
2254
+ module2.exports.mapToMac = function(options) {
2255
+ options = mapIconShorthand(options);
2256
+ options = mapText(options);
2257
+ if (options.icon) {
2258
+ options.appIcon = options.icon;
2259
+ delete options.icon;
2260
+ }
2261
+ if (options.sound === true) {
2262
+ options.sound = "Bottle";
2263
+ }
2264
+ if (options.sound === false) {
2265
+ delete options.sound;
2266
+ }
2267
+ if (options.sound && options.sound.indexOf("Notification.") === 0) {
2268
+ options.sound = "Bottle";
2269
+ }
2270
+ if (options.wait === true) {
2271
+ if (!options.timeout) {
2272
+ options.timeout = 5;
2273
+ }
2274
+ delete options.wait;
2275
+ }
2276
+ if (!options.wait && !options.timeout) {
2277
+ if (options.timeout === false) {
2278
+ delete options.timeout;
2279
+ } else {
2280
+ options.timeout = 10;
2281
+ }
2282
+ }
2283
+ options.json = true;
2284
+ return options;
2285
+ };
2286
+ function isArray(arr) {
2287
+ return Object.prototype.toString.call(arr) === "[object Array]";
2288
+ }
2289
+ module2.exports.isArray = isArray;
2290
+ function noop() {
2291
+ }
2292
+ module2.exports.actionJackerDecorator = function(emitter, options, fn2, mapper) {
2293
+ options = clone(options);
2294
+ fn2 = fn2 || noop;
2295
+ if (typeof fn2 !== "function") {
2296
+ throw new TypeError(
2297
+ "The second argument must be a function callback. You have passed " + typeof fn2
2298
+ );
2299
+ }
2300
+ return function(err, data) {
2301
+ let resultantData = data;
2302
+ let metadata = {};
2303
+ if (resultantData && typeof resultantData === "object") {
2304
+ metadata = resultantData;
2305
+ resultantData = resultantData.activationType;
2306
+ }
2307
+ if (resultantData) {
2308
+ resultantData = resultantData.toLowerCase().trim();
2309
+ if (resultantData.match(/^activate|clicked$/)) {
2310
+ resultantData = "activate";
2311
+ }
2312
+ if (resultantData.match(/^timedout$/)) {
2313
+ resultantData = "timeout";
2314
+ }
2315
+ }
2316
+ fn2.apply(emitter, [err, resultantData, metadata]);
2317
+ if (!mapper || !resultantData) return;
2318
+ const key = mapper(resultantData);
2319
+ if (!key) return;
2320
+ emitter.emit(key, emitter, options, metadata);
2321
+ };
2322
+ };
2323
+ module2.exports.constructArgumentList = function(options, extra) {
2324
+ const args = [];
2325
+ extra = extra || {};
2326
+ const initial = extra.initial || [];
2327
+ const keyExtra = extra.keyExtra || "";
2328
+ const allowedArguments = extra.allowedArguments || [];
2329
+ const noEscape = extra.noEscape !== void 0;
2330
+ const checkForAllowed = extra.allowedArguments !== void 0;
2331
+ const explicitTrue = !!extra.explicitTrue;
2332
+ const keepNewlines = !!extra.keepNewlines;
2333
+ const wrapper = extra.wrapper === void 0 ? '"' : extra.wrapper;
2334
+ const escapeFn = function escapeFn2(arg) {
2335
+ if (isArray(arg)) {
2336
+ return removeNewLines(arg.map(escapeFn2).join(","));
2337
+ }
2338
+ if (!noEscape) {
2339
+ arg = escapeQuotes(arg);
2340
+ }
2341
+ if (typeof arg === "string" && !keepNewlines) {
2342
+ arg = removeNewLines(arg);
2343
+ }
2344
+ return wrapper + arg + wrapper;
2345
+ };
2346
+ initial.forEach(function(val) {
2347
+ args.push(escapeFn(val));
2348
+ });
2349
+ for (const key in options) {
2350
+ if (options.hasOwnProperty(key) && (!checkForAllowed || inArray(allowedArguments, key))) {
2351
+ if (explicitTrue && options[key] === true) {
2352
+ args.push("-" + keyExtra + key);
2353
+ } else if (explicitTrue && options[key] === false) continue;
2354
+ else args.push("-" + keyExtra + key, escapeFn(options[key]));
2355
+ }
2356
+ }
2357
+ return args;
2358
+ };
2359
+ function removeNewLines(str) {
2360
+ const excapedNewline = process.platform === "win32" ? "\\r\\n" : "\\n";
2361
+ return str.replace(/\r?\n/g, excapedNewline);
2362
+ }
2363
+ var allowedToasterFlags = [
2364
+ "t",
2365
+ "m",
2366
+ "b",
2367
+ "tb",
2368
+ "p",
2369
+ "id",
2370
+ "s",
2371
+ "silent",
2372
+ "appID",
2373
+ "pid",
2374
+ "pipeName",
2375
+ "close",
2376
+ "install"
2377
+ ];
2378
+ var toasterSoundPrefix = "Notification.";
2379
+ var toasterDefaultSound = "Notification.Default";
2380
+ module2.exports.mapToWin8 = function(options) {
2381
+ options = mapAppIcon(options);
2382
+ options = mapText(options);
2383
+ if (options.icon) {
2384
+ if (/^file:\/+/.test(options.icon)) {
2385
+ options.p = new url.URL(options.icon).pathname.replace(/^\/(\w:\/)/, "$1").replace(/\//g, "\\");
2386
+ } else {
2387
+ options.p = options.icon;
2388
+ }
2389
+ delete options.icon;
2390
+ }
2391
+ if (options.message) {
2392
+ options.m = options.message.replace(/\x1b/g, "");
2393
+ delete options.message;
2394
+ }
2395
+ if (options.title) {
2396
+ options.t = options.title;
2397
+ delete options.title;
2398
+ }
2399
+ if (options.appName) {
2400
+ options.appID = options.appName;
2401
+ delete options.appName;
2402
+ }
2403
+ if (typeof options.remove !== "undefined") {
2404
+ options.close = options.remove;
2405
+ delete options.remove;
2406
+ }
2407
+ if (options.quiet || options.silent) {
2408
+ options.silent = options.quiet || options.silent;
2409
+ delete options.quiet;
2410
+ }
2411
+ if (typeof options.sound !== "undefined") {
2412
+ options.s = options.sound;
2413
+ delete options.sound;
2414
+ }
2415
+ if (options.s === false) {
2416
+ options.silent = true;
2417
+ delete options.s;
2418
+ }
2419
+ if (options.s && options.silent) {
2420
+ delete options.s;
2421
+ }
2422
+ if (options.s === true) {
2423
+ options.s = toasterDefaultSound;
2424
+ }
2425
+ if (options.s && options.s.indexOf(toasterSoundPrefix) !== 0) {
2426
+ options.s = toasterDefaultSound;
2427
+ }
2428
+ if (options.actions && isArray(options.actions)) {
2429
+ options.b = options.actions.join(";");
2430
+ delete options.actions;
2431
+ }
2432
+ for (const key in options) {
2433
+ if (options.hasOwnProperty(key) && allowedToasterFlags.indexOf(key) === -1) {
2434
+ delete options[key];
2435
+ }
2436
+ }
2437
+ return options;
2438
+ };
2439
+ module2.exports.mapToNotifu = function(options) {
2440
+ options = mapAppIcon(options);
2441
+ options = mapText(options);
2442
+ if (options.icon) {
2443
+ options.i = options.icon;
2444
+ delete options.icon;
2445
+ }
2446
+ if (options.message) {
2447
+ options.m = options.message;
2448
+ delete options.message;
2449
+ }
2450
+ if (options.title) {
2451
+ options.p = options.title;
2452
+ delete options.title;
2453
+ }
2454
+ if (options.time) {
2455
+ options.d = options.time;
2456
+ delete options.time;
2457
+ }
2458
+ if (options.q !== false) {
2459
+ options.q = true;
2460
+ } else {
2461
+ delete options.q;
2462
+ }
2463
+ if (options.quiet === false) {
2464
+ delete options.q;
2465
+ delete options.quiet;
2466
+ }
2467
+ if (options.sound) {
2468
+ delete options.q;
2469
+ delete options.sound;
2470
+ }
2471
+ if (options.t) {
2472
+ options.d = options.t;
2473
+ delete options.t;
2474
+ }
2475
+ if (options.type) {
2476
+ options.t = sanitizeNotifuTypeArgument(options.type);
2477
+ delete options.type;
2478
+ }
2479
+ return options;
2480
+ };
2481
+ module2.exports.isMac = function() {
2482
+ return os.type() === "Darwin";
2483
+ };
2484
+ module2.exports.isMountainLion = function() {
2485
+ return os.type() === "Darwin" && semver.satisfies(garanteeSemverFormat(os.release()), ">=12.0.0");
2486
+ };
2487
+ module2.exports.isWin8 = function() {
2488
+ return os.type() === "Windows_NT" && semver.satisfies(garanteeSemverFormat(os.release()), ">=6.2.9200");
2489
+ };
2490
+ module2.exports.isWSL = function() {
2491
+ return isWSL;
2492
+ };
2493
+ module2.exports.isLessThanWin8 = function() {
2494
+ return os.type() === "Windows_NT" && semver.satisfies(garanteeSemverFormat(os.release()), "<6.2.9200");
2495
+ };
2496
+ function garanteeSemverFormat(version2) {
2497
+ if (version2.split(".").length === 2) {
2498
+ version2 += ".0";
2499
+ }
2500
+ return version2;
2501
+ }
2502
+ function sanitizeNotifuTypeArgument(type) {
2503
+ if (typeof type === "string" || type instanceof String) {
2504
+ if (type.toLowerCase() === "info") return "info";
2505
+ if (type.toLowerCase() === "warn") return "warn";
2506
+ if (type.toLowerCase() === "error") return "error";
2507
+ }
2508
+ return "info";
2509
+ }
2510
+ module2.exports.createNamedPipe = (server) => {
2511
+ const buf = Buffer.alloc(BUFFER_SIZE);
2512
+ return new Promise((resolve) => {
2513
+ server.instance = net.createServer((stream) => {
2514
+ stream.on("data", (c) => {
2515
+ buf.write(c.toString());
2516
+ });
2517
+ stream.on("end", () => {
2518
+ server.instance.close();
2519
+ });
2520
+ });
2521
+ server.instance.listen(server.namedPipe, () => {
2522
+ resolve(buf);
2523
+ });
2524
+ });
2525
+ };
2526
+ }
2527
+ });
2528
+
2529
+ // ../../../node_modules/isexe/windows.js
2530
+ var require_windows = __commonJS({
2531
+ "../../../node_modules/isexe/windows.js"(exports2, module2) {
2532
+ "use strict";
2533
+ module2.exports = isexe;
2534
+ isexe.sync = sync;
2535
+ var fs = require("fs");
2536
+ function checkPathExt(path2, options) {
2537
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
2538
+ if (!pathext) {
2539
+ return true;
2540
+ }
2541
+ pathext = pathext.split(";");
2542
+ if (pathext.indexOf("") !== -1) {
2543
+ return true;
2544
+ }
2545
+ for (var i = 0; i < pathext.length; i++) {
2546
+ var p = pathext[i].toLowerCase();
2547
+ if (p && path2.substr(-p.length).toLowerCase() === p) {
2548
+ return true;
2549
+ }
2550
+ }
2551
+ return false;
2552
+ }
2553
+ function checkStat(stat, path2, options) {
2554
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
2555
+ return false;
2556
+ }
2557
+ return checkPathExt(path2, options);
2558
+ }
2559
+ function isexe(path2, options, cb) {
2560
+ fs.stat(path2, function(er, stat) {
2561
+ cb(er, er ? false : checkStat(stat, path2, options));
2562
+ });
2563
+ }
2564
+ function sync(path2, options) {
2565
+ return checkStat(fs.statSync(path2), path2, options);
2566
+ }
2567
+ }
2568
+ });
2569
+
2570
+ // ../../../node_modules/isexe/mode.js
2571
+ var require_mode = __commonJS({
2572
+ "../../../node_modules/isexe/mode.js"(exports2, module2) {
2573
+ "use strict";
2574
+ module2.exports = isexe;
2575
+ isexe.sync = sync;
2576
+ var fs = require("fs");
2577
+ function isexe(path2, options, cb) {
2578
+ fs.stat(path2, function(er, stat) {
2579
+ cb(er, er ? false : checkStat(stat, options));
2580
+ });
2581
+ }
2582
+ function sync(path2, options) {
2583
+ return checkStat(fs.statSync(path2), options);
2584
+ }
2585
+ function checkStat(stat, options) {
2586
+ return stat.isFile() && checkMode(stat, options);
2587
+ }
2588
+ function checkMode(stat, options) {
2589
+ var mod = stat.mode;
2590
+ var uid = stat.uid;
2591
+ var gid = stat.gid;
2592
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
2593
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
2594
+ var u = parseInt("100", 8);
2595
+ var g = parseInt("010", 8);
2596
+ var o = parseInt("001", 8);
2597
+ var ug = u | g;
2598
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
2599
+ return ret;
2600
+ }
2601
+ }
2602
+ });
2603
+
2604
+ // ../../../node_modules/isexe/index.js
2605
+ var require_isexe = __commonJS({
2606
+ "../../../node_modules/isexe/index.js"(exports2, module2) {
2607
+ "use strict";
2608
+ var fs = require("fs");
2609
+ var core;
2610
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
2611
+ core = require_windows();
2612
+ } else {
2613
+ core = require_mode();
2614
+ }
2615
+ module2.exports = isexe;
2616
+ isexe.sync = sync;
2617
+ function isexe(path2, options, cb) {
2618
+ if (typeof options === "function") {
2619
+ cb = options;
2620
+ options = {};
2621
+ }
2622
+ if (!cb) {
2623
+ if (typeof Promise !== "function") {
2624
+ throw new TypeError("callback not provided");
2625
+ }
2626
+ return new Promise(function(resolve, reject) {
2627
+ isexe(path2, options || {}, function(er, is) {
2628
+ if (er) {
2629
+ reject(er);
2630
+ } else {
2631
+ resolve(is);
2632
+ }
2633
+ });
2634
+ });
2635
+ }
2636
+ core(path2, options || {}, function(er, is) {
2637
+ if (er) {
2638
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
2639
+ er = null;
2640
+ is = false;
2641
+ }
2642
+ }
2643
+ cb(er, is);
2644
+ });
2645
+ }
2646
+ function sync(path2, options) {
2647
+ try {
2648
+ return core.sync(path2, options || {});
2649
+ } catch (er) {
2650
+ if (options && options.ignoreErrors || er.code === "EACCES") {
2651
+ return false;
2652
+ } else {
2653
+ throw er;
2654
+ }
2655
+ }
2656
+ }
2657
+ }
2658
+ });
2659
+
2660
+ // ../../../node_modules/which/which.js
2661
+ var require_which = __commonJS({
2662
+ "../../../node_modules/which/which.js"(exports2, module2) {
2663
+ "use strict";
2664
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
2665
+ var path2 = require("path");
2666
+ var COLON = isWindows ? ";" : ":";
2667
+ var isexe = require_isexe();
2668
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
2669
+ var getPathInfo = (cmd, opt) => {
2670
+ const colon = opt.colon || COLON;
2671
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
2672
+ // windows always checks the cwd first
2673
+ ...isWindows ? [process.cwd()] : [],
2674
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
2675
+ "").split(colon)
2676
+ ];
2677
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
2678
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
2679
+ if (isWindows) {
2680
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
2681
+ pathExt.unshift("");
2682
+ }
2683
+ return {
2684
+ pathEnv,
2685
+ pathExt,
2686
+ pathExtExe
2687
+ };
2688
+ };
2689
+ var which = (cmd, opt, cb) => {
2690
+ if (typeof opt === "function") {
2691
+ cb = opt;
2692
+ opt = {};
2693
+ }
2694
+ if (!opt)
2695
+ opt = {};
2696
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
2697
+ const found = [];
2698
+ const step = (i) => new Promise((resolve, reject) => {
2699
+ if (i === pathEnv.length)
2700
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
2701
+ const ppRaw = pathEnv[i];
2702
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
2703
+ const pCmd = path2.join(pathPart, cmd);
2704
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
2705
+ resolve(subStep(p, i, 0));
2706
+ });
2707
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
2708
+ if (ii === pathExt.length)
2709
+ return resolve(step(i + 1));
2710
+ const ext = pathExt[ii];
2711
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
2712
+ if (!er && is) {
2713
+ if (opt.all)
2714
+ found.push(p + ext);
2715
+ else
2716
+ return resolve(p + ext);
2717
+ }
2718
+ return resolve(subStep(p, i, ii + 1));
2719
+ });
2720
+ });
2721
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
2722
+ };
2723
+ var whichSync = (cmd, opt) => {
2724
+ opt = opt || {};
2725
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
2726
+ const found = [];
2727
+ for (let i = 0; i < pathEnv.length; i++) {
2728
+ const ppRaw = pathEnv[i];
2729
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
2730
+ const pCmd = path2.join(pathPart, cmd);
2731
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
2732
+ for (let j = 0; j < pathExt.length; j++) {
2733
+ const cur = p + pathExt[j];
2734
+ try {
2735
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
2736
+ if (is) {
2737
+ if (opt.all)
2738
+ found.push(cur);
2739
+ else
2740
+ return cur;
2741
+ }
2742
+ } catch (ex) {
2743
+ }
2744
+ }
2745
+ }
2746
+ if (opt.all && found.length)
2747
+ return found;
2748
+ if (opt.nothrow)
2749
+ return null;
2750
+ throw getNotFoundError(cmd);
2751
+ };
2752
+ module2.exports = which;
2753
+ which.sync = whichSync;
2754
+ }
2755
+ });
2756
+
2757
+ // ../../../node_modules/node-notifier/notifiers/notifysend.js
2758
+ var require_notifysend = __commonJS({
2759
+ "../../../node_modules/node-notifier/notifiers/notifysend.js"(exports2, module2) {
2760
+ "use strict";
2761
+ var os = require("os");
2762
+ var which = require_which();
2763
+ var utils = require_utils();
2764
+ var EventEmitter = require("events").EventEmitter;
2765
+ var util = require("util");
2766
+ var notifier = "notify-send";
2767
+ var hasNotifier;
2768
+ module2.exports = NotifySend;
2769
+ function NotifySend(options) {
2770
+ options = utils.clone(options || {});
2771
+ if (!(this instanceof NotifySend)) {
2772
+ return new NotifySend(options);
2773
+ }
2774
+ this.options = options;
2775
+ EventEmitter.call(this);
2776
+ }
2777
+ util.inherits(NotifySend, EventEmitter);
2778
+ function noop() {
2779
+ }
2780
+ function notifyRaw(options, callback) {
2781
+ options = utils.clone(options || {});
2782
+ callback = callback || noop;
2783
+ if (typeof callback !== "function") {
2784
+ throw new TypeError(
2785
+ "The second argument must be a function callback. You have passed " + typeof callback
2786
+ );
2787
+ }
2788
+ if (typeof options === "string") {
2789
+ options = { title: "node-notifier", message: options };
2790
+ }
2791
+ if (!options.message) {
2792
+ callback(new Error("Message is required."));
2793
+ return this;
2794
+ }
2795
+ if (os.type() !== "Linux" && !os.type().match(/BSD$/)) {
2796
+ callback(new Error("Only supported on Linux and *BSD systems"));
2797
+ return this;
2798
+ }
2799
+ if (hasNotifier === false) {
2800
+ callback(new Error("notify-send must be installed on the system."));
2801
+ return this;
2802
+ }
2803
+ if (hasNotifier || !!this.options.suppressOsdCheck) {
2804
+ doNotification(options, callback);
2805
+ return this;
2806
+ }
2807
+ try {
2808
+ hasNotifier = !!which.sync(notifier);
2809
+ doNotification(options, callback);
2810
+ } catch (err) {
2811
+ hasNotifier = false;
2812
+ return callback(err);
2813
+ }
2814
+ return this;
2815
+ }
2816
+ Object.defineProperty(NotifySend.prototype, "notify", {
2817
+ get: function() {
2818
+ if (!this._notify) this._notify = notifyRaw.bind(this);
2819
+ return this._notify;
2820
+ }
2821
+ });
2822
+ var allowedArguments = ["urgency", "expire-time", "icon", "category", "hint", "app-name"];
2823
+ function doNotification(options, callback) {
2824
+ options = utils.mapToNotifySend(options);
2825
+ options.title = options.title || "Node Notification:";
2826
+ const initial = [options.title, options.message];
2827
+ delete options.title;
2828
+ delete options.message;
2829
+ const argsList = utils.constructArgumentList(options, {
2830
+ initial,
2831
+ keyExtra: "-",
2832
+ allowedArguments
2833
+ });
2834
+ utils.command(notifier, argsList, callback);
2835
+ }
2836
+ }
2837
+ });
2838
+
2839
+ // ../../../node_modules/node-notifier/lib/checkGrowl.js
2840
+ var require_checkGrowl = __commonJS({
2841
+ "../../../node_modules/node-notifier/lib/checkGrowl.js"(exports2, module2) {
2842
+ "use strict";
2843
+ var net = require("net");
2844
+ var hasGrowl = false;
2845
+ module2.exports = function(growlConfig, cb) {
2846
+ if (typeof cb === "undefined") {
2847
+ cb = growlConfig;
2848
+ growlConfig = {};
2849
+ }
2850
+ if (hasGrowl) return cb(null, hasGrowl);
2851
+ const port = growlConfig.port || 23053;
2852
+ const host = growlConfig.host || "localhost";
2853
+ const socket = net.connect(port, host);
2854
+ socket.setTimeout(100);
2855
+ socket.once("connect", function() {
2856
+ socket.end();
2857
+ cb(null, true);
2858
+ });
2859
+ socket.once("error", function() {
2860
+ socket.end();
2861
+ cb(null, false);
2862
+ });
2863
+ };
2864
+ }
2865
+ });
2866
+
2867
+ // ../../../node_modules/growly/lib/gntp.js
2868
+ var require_gntp = __commonJS({
2869
+ "../../../node_modules/growly/lib/gntp.js"(exports2, module2) {
2870
+ "use strict";
2871
+ var net = require("net");
2872
+ var crypto5 = require("crypto");
2873
+ var format = require("util").format;
2874
+ var fs = require("fs");
2875
+ var nl = "\r\n";
2876
+ function GNTP(type, opts) {
2877
+ opts = opts || {};
2878
+ this.type = type;
2879
+ this.host = opts.host || "localhost";
2880
+ this.port = opts.port || 23053;
2881
+ this.request = "GNTP/1.0 " + type + " NONE" + nl;
2882
+ this.resources = [];
2883
+ this.attempts = 0;
2884
+ this.maxAttempts = 5;
2885
+ }
2886
+ GNTP.prototype.parseResp = function(resp) {
2887
+ var parsed = {}, head, body;
2888
+ resp = resp.slice(0, resp.indexOf(nl + nl)).split(nl);
2889
+ head = resp[0];
2890
+ body = resp.slice(1);
2891
+ parsed.state = head.match(/-(OK|ERROR|CALLBACK)/)[0].slice(1);
2892
+ body.forEach(function(ln) {
2893
+ ln = ln.split(": ");
2894
+ parsed[ln[0]] = ln[1];
2895
+ });
2896
+ return parsed;
2897
+ };
2898
+ GNTP.prototype.retry = function() {
2899
+ var self = this, args = arguments;
2900
+ setTimeout(function() {
2901
+ self.send.apply(self, args);
2902
+ }, 750);
2903
+ };
2904
+ GNTP.prototype.addResource = function(file) {
2905
+ var id = crypto5.createHash("md5").update(file).digest("hex"), header = "Identifier: " + id + nl + "Length: " + file.length + nl + nl;
2906
+ this.resources.push({ header, file });
2907
+ return "x-growl-resource://" + id;
2908
+ };
2909
+ GNTP.prototype.add = function(name, val) {
2910
+ if (val === void 0)
2911
+ return;
2912
+ if (/-Icon/.test(name) && !/^https?:\/\//.test(val)) {
2913
+ if (/\.(png|gif|jpe?g)$/.test(val))
2914
+ val = this.addResource(fs.readFileSync(val));
2915
+ else if (val instanceof Buffer)
2916
+ val = this.addResource(val);
2917
+ }
2918
+ this.request += name + ": " + val + nl;
2919
+ };
2920
+ GNTP.prototype.newline = function() {
2921
+ this.request += nl;
2922
+ };
2923
+ GNTP.prototype.send = function(callback) {
2924
+ var self = this, socket = net.connect(this.port, this.host), resp = "";
2925
+ callback = callback || function() {
2926
+ };
2927
+ this.attempts += 1;
2928
+ socket.on("connect", function() {
2929
+ socket.write(self.request);
2930
+ self.resources.forEach(function(res) {
2931
+ socket.write(res.header);
2932
+ socket.write(res.file);
2933
+ socket.write(nl + nl);
2934
+ });
2935
+ });
2936
+ socket.on("data", function(data) {
2937
+ resp += data.toString();
2938
+ if (resp.slice(resp.length - 4) !== nl + nl) return;
2939
+ resp = self.parseResp(resp);
2940
+ if (resp.state === "ERROR" || resp.state === "CALLBACK")
2941
+ socket.end();
2942
+ else
2943
+ resp = "";
2944
+ });
2945
+ socket.on("end", function() {
2946
+ if (["200", "401", "402"].indexOf(resp["Error-Code"]) >= 0) {
2947
+ if (self.attempts <= self.maxAttempts) {
2948
+ self.retry(callback);
2949
+ } else {
2950
+ var msg = 'GNTP request to "%s:%d" failed with error code %s (%s)';
2951
+ callback(new Error(format(msg, self.host, self.port, resp["Error-Code"], resp["Error-Description"])));
2952
+ }
2953
+ } else {
2954
+ callback(void 0, resp);
2955
+ }
2956
+ });
2957
+ socket.on("error", function() {
2958
+ callback(new Error(format('Error while sending GNTP request to "%s:%d"', self.host, self.port)));
2959
+ socket.destroy();
2960
+ });
2961
+ };
2962
+ module2.exports = GNTP;
2963
+ }
2964
+ });
2965
+
2966
+ // ../../../node_modules/growly/lib/growly.js
2967
+ var require_growly = __commonJS({
2968
+ "../../../node_modules/growly/lib/growly.js"(exports2, module2) {
2969
+ "use strict";
2970
+ var GNTP = require_gntp();
2971
+ function Growly() {
2972
+ this.appname = "Growly";
2973
+ this.notifications = void 0;
2974
+ this.labels = void 0;
2975
+ this.count = 0;
2976
+ this.registered = false;
2977
+ this.host = void 0;
2978
+ this.port = void 0;
2979
+ }
2980
+ Growly.prototype.getLabels = function() {
2981
+ return this.notifications.map(function(notif) {
2982
+ return notif.label;
2983
+ });
2984
+ };
2985
+ Growly.prototype.setHost = function(host, port) {
2986
+ this.host = host;
2987
+ this.port = port;
2988
+ };
2989
+ Growly.prototype.register = function(appname, appicon, notifications, callback) {
2990
+ var gntp;
2991
+ if (typeof appicon === "object") {
2992
+ notifications = appicon;
2993
+ appicon = void 0;
2994
+ }
2995
+ if (notifications === void 0 || !notifications.length) {
2996
+ notifications = [{ label: "default", dispname: "Default Notification", enabled: true }];
2997
+ }
2998
+ if (typeof arguments[arguments.length - 1] === "function") {
2999
+ callback = arguments[arguments.length - 1];
3000
+ } else {
3001
+ callback = function() {
3002
+ };
3003
+ }
3004
+ this.appname = appname;
3005
+ this.notifications = notifications;
3006
+ this.labels = this.getLabels();
3007
+ this.registered = true;
3008
+ gntp = new GNTP("REGISTER", { host: this.host, port: this.port });
3009
+ gntp.add("Application-Name", appname);
3010
+ gntp.add("Application-Icon", appicon);
3011
+ gntp.add("Notifications-Count", notifications.length);
3012
+ gntp.newline();
3013
+ notifications.forEach(function(notif) {
3014
+ if (notif.enabled === void 0) notif.enabled = true;
3015
+ gntp.add("Notification-Name", notif.label);
3016
+ gntp.add("Notification-Display-Name", notif.dispname);
3017
+ gntp.add("Notification-Enabled", notif.enabled ? "True" : "False");
3018
+ gntp.add("Notification-Icon", notif.icon);
3019
+ gntp.newline();
3020
+ });
3021
+ gntp.send(callback);
3022
+ };
3023
+ Growly.prototype.notify = function(text, opts, callback) {
3024
+ var self = this, gntp;
3025
+ if (!this.registered) {
3026
+ this.register(this.appname, function(err) {
3027
+ if (err) console.log(err);
3028
+ self.notify.call(self, text, opts, callback);
3029
+ });
3030
+ return;
3031
+ }
3032
+ opts = opts || {};
3033
+ if (typeof opts === "function") {
3034
+ callback = opts;
3035
+ opts = {};
3036
+ }
3037
+ gntp = new GNTP("NOTIFY", { host: this.host, port: this.port });
3038
+ gntp.add("Application-Name", this.appname);
3039
+ gntp.add("Notification-Name", opts.label || this.labels[0]);
3040
+ gntp.add("Notification-ID", ++this.count);
3041
+ gntp.add("Notification-Title", opts.title);
3042
+ gntp.add("Notification-Text", text);
3043
+ gntp.add("Notification-Sticky", opts.sticky ? "True" : "False");
3044
+ gntp.add("Notification-Priority", opts.priority);
3045
+ gntp.add("Notification-Icon", opts.icon);
3046
+ gntp.add("Notification-Coalescing-ID", opts.coalescingId || void 0);
3047
+ gntp.add("Notification-Callback-Context", callback ? "context" : void 0);
3048
+ gntp.add("Notification-Callback-Context-Type", callback ? "string" : void 0);
3049
+ gntp.add("Notification-Callback-Target", void 0);
3050
+ gntp.newline();
3051
+ gntp.send(function(err, resp) {
3052
+ if (callback && err) {
3053
+ callback(err);
3054
+ } else if (callback && resp.state === "CALLBACK") {
3055
+ callback(void 0, resp["Notification-Callback-Result"].toLowerCase());
3056
+ }
3057
+ });
3058
+ };
3059
+ module2.exports = new Growly();
3060
+ }
3061
+ });
3062
+
3063
+ // ../../../node_modules/node-notifier/notifiers/growl.js
3064
+ var require_growl = __commonJS({
3065
+ "../../../node_modules/node-notifier/notifiers/growl.js"(exports2, module2) {
3066
+ "use strict";
3067
+ var checkGrowl = require_checkGrowl();
3068
+ var utils = require_utils();
3069
+ var growly = require_growly();
3070
+ var EventEmitter = require("events").EventEmitter;
3071
+ var util = require("util");
3072
+ var errorMessageNotFound = "Couldn't connect to growl (might be used as a fallback). Make sure it is running";
3073
+ module2.exports = Growl;
3074
+ var hasGrowl;
3075
+ function Growl(options) {
3076
+ options = utils.clone(options || {});
3077
+ if (!(this instanceof Growl)) {
3078
+ return new Growl(options);
3079
+ }
3080
+ growly.appname = options.name || "Node";
3081
+ this.options = options;
3082
+ EventEmitter.call(this);
3083
+ }
3084
+ util.inherits(Growl, EventEmitter);
3085
+ function notifyRaw(options, callback) {
3086
+ growly.setHost(this.options.host, this.options.port);
3087
+ options = utils.clone(options || {});
3088
+ if (typeof options === "string") {
3089
+ options = { title: "node-notifier", message: options };
3090
+ }
3091
+ callback = utils.actionJackerDecorator(this, options, callback, function(data) {
3092
+ if (data === "click") {
3093
+ return "click";
3094
+ }
3095
+ if (data === "timedout") {
3096
+ return "timeout";
3097
+ }
3098
+ return false;
3099
+ });
3100
+ options = utils.mapToGrowl(options);
3101
+ if (!options.message) {
3102
+ callback(new Error("Message is required."));
3103
+ return this;
3104
+ }
3105
+ options.title = options.title || "Node Notification:";
3106
+ if (hasGrowl || !!options.wait) {
3107
+ const localCallback = options.wait ? callback : noop;
3108
+ growly.notify(options.message, options, localCallback);
3109
+ if (!options.wait) callback();
3110
+ return this;
3111
+ }
3112
+ checkGrowl(growly, function(_, didHaveGrowl) {
3113
+ hasGrowl = didHaveGrowl;
3114
+ if (!didHaveGrowl) return callback(new Error(errorMessageNotFound));
3115
+ growly.notify(options.message, options);
3116
+ callback();
3117
+ });
3118
+ return this;
3119
+ }
3120
+ Object.defineProperty(Growl.prototype, "notify", {
3121
+ get: function() {
3122
+ if (!this._notify) this._notify = notifyRaw.bind(this);
3123
+ return this._notify;
3124
+ }
3125
+ });
3126
+ function noop() {
3127
+ }
3128
+ }
3129
+ });
3130
+
3131
+ // ../../../node_modules/node-notifier/notifiers/notificationcenter.js
3132
+ var require_notificationcenter = __commonJS({
3133
+ "../../../node_modules/node-notifier/notifiers/notificationcenter.js"(exports2, module2) {
3134
+ "use strict";
3135
+ var utils = require_utils();
3136
+ var Growl = require_growl();
3137
+ var path2 = require("path");
3138
+ var notifier = path2.join(
3139
+ __dirname,
3140
+ "../vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier"
3141
+ );
3142
+ var EventEmitter = require("events").EventEmitter;
3143
+ var util = require("util");
3144
+ var errorMessageOsX = "You need Mac OS X 10.8 or above to use NotificationCenter, or use Growl fallback with constructor option {withFallback: true}.";
3145
+ module2.exports = NotificationCenter;
3146
+ function NotificationCenter(options) {
3147
+ options = utils.clone(options || {});
3148
+ if (!(this instanceof NotificationCenter)) {
3149
+ return new NotificationCenter(options);
3150
+ }
3151
+ this.options = options;
3152
+ EventEmitter.call(this);
3153
+ }
3154
+ util.inherits(NotificationCenter, EventEmitter);
3155
+ var activeId = null;
3156
+ function noop() {
3157
+ }
3158
+ function notifyRaw(options, callback) {
3159
+ let fallbackNotifier;
3160
+ const id = identificator();
3161
+ options = utils.clone(options || {});
3162
+ activeId = id;
3163
+ if (typeof options === "string") {
3164
+ options = { title: "node-notifier", message: options };
3165
+ }
3166
+ callback = callback || noop;
3167
+ if (typeof callback !== "function") {
3168
+ throw new TypeError(
3169
+ "The second argument must be a function callback. You have passed " + typeof fn
3170
+ );
3171
+ }
3172
+ const actionJackedCallback = utils.actionJackerDecorator(
3173
+ this,
3174
+ options,
3175
+ callback,
3176
+ function(data) {
3177
+ if (activeId !== id) return false;
3178
+ if (data === "activate") {
3179
+ return "click";
3180
+ }
3181
+ if (data === "timeout") {
3182
+ return "timeout";
3183
+ }
3184
+ if (data === "replied") {
3185
+ return "replied";
3186
+ }
3187
+ return false;
3188
+ }
3189
+ );
3190
+ options = utils.mapToMac(options);
3191
+ if (!options.message && !options.group && !options.list && !options.remove) {
3192
+ callback(new Error("Message, group, remove or list property is required."));
3193
+ return this;
3194
+ }
3195
+ const argsList = utils.constructArgumentList(options);
3196
+ if (utils.isMountainLion()) {
3197
+ utils.fileCommandJson(
3198
+ this.options.customPath || notifier,
3199
+ argsList,
3200
+ actionJackedCallback
3201
+ );
3202
+ return this;
3203
+ }
3204
+ if (fallbackNotifier || !!this.options.withFallback) {
3205
+ fallbackNotifier = fallbackNotifier || new Growl(this.options);
3206
+ return fallbackNotifier.notify(options, callback);
3207
+ }
3208
+ callback(new Error(errorMessageOsX));
3209
+ return this;
3210
+ }
3211
+ Object.defineProperty(NotificationCenter.prototype, "notify", {
3212
+ get: function() {
3213
+ if (!this._notify) this._notify = notifyRaw.bind(this);
3214
+ return this._notify;
3215
+ }
3216
+ });
3217
+ function identificator() {
3218
+ return { _ref: "val" };
3219
+ }
3220
+ }
3221
+ });
3222
+
3223
+ // ../../../node_modules/node-notifier/notifiers/balloon.js
3224
+ var require_balloon = __commonJS({
3225
+ "../../../node_modules/node-notifier/notifiers/balloon.js"(exports2, module2) {
3226
+ "use strict";
3227
+ var path2 = require("path");
3228
+ var notifier = path2.resolve(__dirname, "../vendor/notifu/notifu");
3229
+ var checkGrowl = require_checkGrowl();
3230
+ var utils = require_utils();
3231
+ var Toaster = require_toaster();
3232
+ var Growl = require_growl();
3233
+ var os = require("os");
3234
+ var EventEmitter = require("events").EventEmitter;
3235
+ var util = require("util");
3236
+ var hasGrowl;
3237
+ module2.exports = WindowsBalloon;
3238
+ function WindowsBalloon(options) {
3239
+ options = utils.clone(options || {});
3240
+ if (!(this instanceof WindowsBalloon)) {
3241
+ return new WindowsBalloon(options);
3242
+ }
3243
+ this.options = options;
3244
+ EventEmitter.call(this);
3245
+ }
3246
+ util.inherits(WindowsBalloon, EventEmitter);
3247
+ function noop() {
3248
+ }
3249
+ function notifyRaw(options, callback) {
3250
+ let fallback;
3251
+ const notifierOptions = this.options;
3252
+ options = utils.clone(options || {});
3253
+ callback = callback || noop;
3254
+ if (typeof options === "string") {
3255
+ options = { title: "node-notifier", message: options };
3256
+ }
3257
+ const actionJackedCallback = utils.actionJackerDecorator(
3258
+ this,
3259
+ options,
3260
+ callback,
3261
+ function(data) {
3262
+ if (data === "activate") {
3263
+ return "click";
3264
+ }
3265
+ if (data === "timeout") {
3266
+ return "timeout";
3267
+ }
3268
+ return false;
3269
+ }
3270
+ );
3271
+ if (!!this.options.withFallback && utils.isWin8()) {
3272
+ fallback = fallback || new Toaster(notifierOptions);
3273
+ return fallback.notify(options, callback);
3274
+ }
3275
+ if (!!this.options.withFallback && (!utils.isLessThanWin8() || hasGrowl === true)) {
3276
+ fallback = fallback || new Growl(notifierOptions);
3277
+ return fallback.notify(options, callback);
3278
+ }
3279
+ if (!this.options.withFallback || hasGrowl === false) {
3280
+ doNotification(options, notifierOptions, actionJackedCallback);
3281
+ return this;
3282
+ }
3283
+ checkGrowl(notifierOptions, function(_, hasGrowlResult) {
3284
+ hasGrowl = hasGrowlResult;
3285
+ if (hasGrowl) {
3286
+ fallback = fallback || new Growl(notifierOptions);
3287
+ return fallback.notify(options, callback);
3288
+ }
3289
+ doNotification(options, notifierOptions, actionJackedCallback);
3290
+ });
3291
+ return this;
3292
+ }
3293
+ Object.defineProperty(WindowsBalloon.prototype, "notify", {
3294
+ get: function() {
3295
+ if (!this._notify) this._notify = notifyRaw.bind(this);
3296
+ return this._notify;
3297
+ }
3298
+ });
3299
+ var allowedArguments = ["t", "d", "p", "m", "i", "e", "q", "w", "xp"];
3300
+ function doNotification(options, notifierOptions, callback) {
3301
+ const is64Bit = os.arch() === "x64";
3302
+ options = options || {};
3303
+ options = utils.mapToNotifu(options);
3304
+ options.p = options.p || "Node Notification:";
3305
+ const fullNotifierPath = notifier + (is64Bit ? "64" : "") + ".exe";
3306
+ const localNotifier = notifierOptions.customPath || fullNotifierPath;
3307
+ if (!options.m) {
3308
+ callback(new Error("Message is required."));
3309
+ return this;
3310
+ }
3311
+ const argsList = utils.constructArgumentList(options, {
3312
+ wrapper: "",
3313
+ noEscape: true,
3314
+ explicitTrue: true,
3315
+ allowedArguments
3316
+ });
3317
+ if (options.wait) {
3318
+ return utils.fileCommand(localNotifier, argsList, function(error, data) {
3319
+ const action = fromErrorCodeToAction(error.code);
3320
+ if (action === "error") return callback(error, data);
3321
+ return callback(null, action);
3322
+ });
3323
+ }
3324
+ utils.immediateFileCommand(localNotifier, argsList, callback);
3325
+ }
3326
+ function fromErrorCodeToAction(errorCode) {
3327
+ switch (errorCode) {
3328
+ case 2:
3329
+ return "timeout";
3330
+ case 3:
3331
+ case 6:
3332
+ case 7:
3333
+ return "activate";
3334
+ case 4:
3335
+ return "close";
3336
+ default:
3337
+ return "error";
3338
+ }
3339
+ }
3340
+ }
3341
+ });
3342
+
3343
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/rng.js
3344
+ function rng() {
3345
+ if (poolPtr > rnds8Pool.length - 16) {
3346
+ import_crypto.default.randomFillSync(rnds8Pool);
3347
+ poolPtr = 0;
3348
+ }
3349
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
3350
+ }
3351
+ var import_crypto, rnds8Pool, poolPtr;
3352
+ var init_rng = __esm({
3353
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/rng.js"() {
3354
+ "use strict";
3355
+ import_crypto = __toESM(require("crypto"));
3356
+ rnds8Pool = new Uint8Array(256);
3357
+ poolPtr = rnds8Pool.length;
3358
+ }
3359
+ });
3360
+
3361
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/regex.js
3362
+ var regex_default;
3363
+ var init_regex = __esm({
3364
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/regex.js"() {
3365
+ "use strict";
3366
+ regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
3367
+ }
3368
+ });
3369
+
3370
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/validate.js
3371
+ function validate(uuid) {
3372
+ return typeof uuid === "string" && regex_default.test(uuid);
3373
+ }
3374
+ var validate_default;
3375
+ var init_validate = __esm({
3376
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/validate.js"() {
3377
+ "use strict";
3378
+ init_regex();
3379
+ validate_default = validate;
3380
+ }
3381
+ });
3382
+
3383
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/stringify.js
3384
+ function stringify(arr, offset = 0) {
3385
+ const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
3386
+ if (!validate_default(uuid)) {
3387
+ throw TypeError("Stringified UUID is invalid");
3388
+ }
3389
+ return uuid;
3390
+ }
3391
+ var byteToHex, stringify_default;
3392
+ var init_stringify = __esm({
3393
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/stringify.js"() {
3394
+ "use strict";
3395
+ init_validate();
3396
+ byteToHex = [];
3397
+ for (let i = 0; i < 256; ++i) {
3398
+ byteToHex.push((i + 256).toString(16).substr(1));
3399
+ }
3400
+ stringify_default = stringify;
3401
+ }
3402
+ });
3403
+
3404
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/v1.js
3405
+ function v1(options, buf, offset) {
3406
+ let i = buf && offset || 0;
3407
+ const b = buf || new Array(16);
3408
+ options = options || {};
3409
+ let node = options.node || _nodeId;
3410
+ let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq;
3411
+ if (node == null || clockseq == null) {
3412
+ const seedBytes = options.random || (options.rng || rng)();
3413
+ if (node == null) {
3414
+ node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
3415
+ }
3416
+ if (clockseq == null) {
3417
+ clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383;
3418
+ }
3419
+ }
3420
+ let msecs = options.msecs !== void 0 ? options.msecs : Date.now();
3421
+ let nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1;
3422
+ const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4;
3423
+ if (dt < 0 && options.clockseq === void 0) {
3424
+ clockseq = clockseq + 1 & 16383;
3425
+ }
3426
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) {
3427
+ nsecs = 0;
3428
+ }
3429
+ if (nsecs >= 1e4) {
3430
+ throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
3431
+ }
3432
+ _lastMSecs = msecs;
3433
+ _lastNSecs = nsecs;
3434
+ _clockseq = clockseq;
3435
+ msecs += 122192928e5;
3436
+ const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296;
3437
+ b[i++] = tl >>> 24 & 255;
3438
+ b[i++] = tl >>> 16 & 255;
3439
+ b[i++] = tl >>> 8 & 255;
3440
+ b[i++] = tl & 255;
3441
+ const tmh = msecs / 4294967296 * 1e4 & 268435455;
3442
+ b[i++] = tmh >>> 8 & 255;
3443
+ b[i++] = tmh & 255;
3444
+ b[i++] = tmh >>> 24 & 15 | 16;
3445
+ b[i++] = tmh >>> 16 & 255;
3446
+ b[i++] = clockseq >>> 8 | 128;
3447
+ b[i++] = clockseq & 255;
3448
+ for (let n = 0; n < 6; ++n) {
3449
+ b[i + n] = node[n];
3450
+ }
3451
+ return buf || stringify_default(b);
3452
+ }
3453
+ var _nodeId, _clockseq, _lastMSecs, _lastNSecs, v1_default;
3454
+ var init_v1 = __esm({
3455
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/v1.js"() {
3456
+ "use strict";
3457
+ init_rng();
3458
+ init_stringify();
3459
+ _lastMSecs = 0;
3460
+ _lastNSecs = 0;
3461
+ v1_default = v1;
3462
+ }
3463
+ });
3464
+
3465
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/parse.js
3466
+ function parse(uuid) {
3467
+ if (!validate_default(uuid)) {
3468
+ throw TypeError("Invalid UUID");
3469
+ }
3470
+ let v;
3471
+ const arr = new Uint8Array(16);
3472
+ arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
3473
+ arr[1] = v >>> 16 & 255;
3474
+ arr[2] = v >>> 8 & 255;
3475
+ arr[3] = v & 255;
3476
+ arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
3477
+ arr[5] = v & 255;
3478
+ arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
3479
+ arr[7] = v & 255;
3480
+ arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
3481
+ arr[9] = v & 255;
3482
+ arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255;
3483
+ arr[11] = v / 4294967296 & 255;
3484
+ arr[12] = v >>> 24 & 255;
3485
+ arr[13] = v >>> 16 & 255;
3486
+ arr[14] = v >>> 8 & 255;
3487
+ arr[15] = v & 255;
3488
+ return arr;
3489
+ }
3490
+ var parse_default;
3491
+ var init_parse = __esm({
3492
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/parse.js"() {
3493
+ "use strict";
3494
+ init_validate();
3495
+ parse_default = parse;
3496
+ }
3497
+ });
3498
+
3499
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/v35.js
3500
+ function stringToBytes(str) {
3501
+ str = unescape(encodeURIComponent(str));
3502
+ const bytes = [];
3503
+ for (let i = 0; i < str.length; ++i) {
3504
+ bytes.push(str.charCodeAt(i));
3505
+ }
3506
+ return bytes;
3507
+ }
3508
+ function v35_default(name, version2, hashfunc) {
3509
+ function generateUUID(value, namespace, buf, offset) {
3510
+ if (typeof value === "string") {
3511
+ value = stringToBytes(value);
3512
+ }
3513
+ if (typeof namespace === "string") {
3514
+ namespace = parse_default(namespace);
3515
+ }
3516
+ if (namespace.length !== 16) {
3517
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
3518
+ }
3519
+ let bytes = new Uint8Array(16 + value.length);
3520
+ bytes.set(namespace);
3521
+ bytes.set(value, namespace.length);
3522
+ bytes = hashfunc(bytes);
3523
+ bytes[6] = bytes[6] & 15 | version2;
3524
+ bytes[8] = bytes[8] & 63 | 128;
3525
+ if (buf) {
3526
+ offset = offset || 0;
3527
+ for (let i = 0; i < 16; ++i) {
3528
+ buf[offset + i] = bytes[i];
3529
+ }
3530
+ return buf;
3531
+ }
3532
+ return stringify_default(bytes);
3533
+ }
3534
+ try {
3535
+ generateUUID.name = name;
3536
+ } catch (err) {
3537
+ }
3538
+ generateUUID.DNS = DNS;
3539
+ generateUUID.URL = URL2;
3540
+ return generateUUID;
3541
+ }
3542
+ var DNS, URL2;
3543
+ var init_v35 = __esm({
3544
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/v35.js"() {
3545
+ "use strict";
3546
+ init_stringify();
3547
+ init_parse();
3548
+ DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
3549
+ URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
3550
+ }
3551
+ });
3552
+
3553
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/md5.js
3554
+ function md5(bytes) {
3555
+ if (Array.isArray(bytes)) {
3556
+ bytes = Buffer.from(bytes);
3557
+ } else if (typeof bytes === "string") {
3558
+ bytes = Buffer.from(bytes, "utf8");
3559
+ }
3560
+ return import_crypto2.default.createHash("md5").update(bytes).digest();
3561
+ }
3562
+ var import_crypto2, md5_default;
3563
+ var init_md5 = __esm({
3564
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/md5.js"() {
3565
+ "use strict";
3566
+ import_crypto2 = __toESM(require("crypto"));
3567
+ md5_default = md5;
3568
+ }
3569
+ });
3570
+
3571
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/v3.js
3572
+ var v3, v3_default;
3573
+ var init_v3 = __esm({
3574
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/v3.js"() {
3575
+ "use strict";
3576
+ init_v35();
3577
+ init_md5();
3578
+ v3 = v35_default("v3", 48, md5_default);
3579
+ v3_default = v3;
3580
+ }
3581
+ });
3582
+
3583
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/v4.js
3584
+ function v4(options, buf, offset) {
3585
+ options = options || {};
3586
+ const rnds = options.random || (options.rng || rng)();
3587
+ rnds[6] = rnds[6] & 15 | 64;
3588
+ rnds[8] = rnds[8] & 63 | 128;
3589
+ if (buf) {
3590
+ offset = offset || 0;
3591
+ for (let i = 0; i < 16; ++i) {
3592
+ buf[offset + i] = rnds[i];
3593
+ }
3594
+ return buf;
3595
+ }
3596
+ return stringify_default(rnds);
3597
+ }
3598
+ var v4_default;
3599
+ var init_v4 = __esm({
3600
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/v4.js"() {
3601
+ "use strict";
3602
+ init_rng();
3603
+ init_stringify();
3604
+ v4_default = v4;
3605
+ }
3606
+ });
3607
+
3608
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/sha1.js
3609
+ function sha1(bytes) {
3610
+ if (Array.isArray(bytes)) {
3611
+ bytes = Buffer.from(bytes);
3612
+ } else if (typeof bytes === "string") {
3613
+ bytes = Buffer.from(bytes, "utf8");
3614
+ }
3615
+ return import_crypto3.default.createHash("sha1").update(bytes).digest();
3616
+ }
3617
+ var import_crypto3, sha1_default;
3618
+ var init_sha1 = __esm({
3619
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/sha1.js"() {
3620
+ "use strict";
3621
+ import_crypto3 = __toESM(require("crypto"));
3622
+ sha1_default = sha1;
3623
+ }
3624
+ });
3625
+
3626
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/v5.js
3627
+ var v5, v5_default;
3628
+ var init_v5 = __esm({
3629
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/v5.js"() {
3630
+ "use strict";
3631
+ init_v35();
3632
+ init_sha1();
3633
+ v5 = v35_default("v5", 80, sha1_default);
3634
+ v5_default = v5;
3635
+ }
3636
+ });
3637
+
3638
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/nil.js
3639
+ var nil_default;
3640
+ var init_nil = __esm({
3641
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/nil.js"() {
3642
+ "use strict";
3643
+ nil_default = "00000000-0000-0000-0000-000000000000";
3644
+ }
3645
+ });
3646
+
3647
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/version.js
3648
+ function version(uuid) {
3649
+ if (!validate_default(uuid)) {
3650
+ throw TypeError("Invalid UUID");
3651
+ }
3652
+ return parseInt(uuid.substr(14, 1), 16);
3653
+ }
3654
+ var version_default;
3655
+ var init_version = __esm({
3656
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/version.js"() {
3657
+ "use strict";
3658
+ init_validate();
3659
+ version_default = version;
3660
+ }
3661
+ });
3662
+
3663
+ // ../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/index.js
3664
+ var esm_node_exports = {};
3665
+ __export(esm_node_exports, {
3666
+ NIL: () => nil_default,
3667
+ parse: () => parse_default,
3668
+ stringify: () => stringify_default,
3669
+ v1: () => v1_default,
3670
+ v3: () => v3_default,
3671
+ v4: () => v4_default,
3672
+ v5: () => v5_default,
3673
+ validate: () => validate_default,
3674
+ version: () => version_default
3675
+ });
3676
+ var init_esm_node = __esm({
3677
+ "../../../node_modules/node-notifier/node_modules/uuid/dist/esm-node/index.js"() {
3678
+ "use strict";
3679
+ init_v1();
3680
+ init_v3();
3681
+ init_v4();
3682
+ init_v5();
3683
+ init_nil();
3684
+ init_version();
3685
+ init_validate();
3686
+ init_stringify();
3687
+ init_parse();
3688
+ }
3689
+ });
3690
+
3691
+ // ../../../node_modules/node-notifier/notifiers/toaster.js
3692
+ var require_toaster = __commonJS({
3693
+ "../../../node_modules/node-notifier/notifiers/toaster.js"(exports2, module2) {
3694
+ "use strict";
3695
+ var path2 = require("path");
3696
+ var notifier = path2.resolve(__dirname, "../vendor/snoreToast/snoretoast");
3697
+ var utils = require_utils();
3698
+ var Balloon = require_balloon();
3699
+ var os = require("os");
3700
+ var { v4: uuid } = (init_esm_node(), __toCommonJS(esm_node_exports));
3701
+ var EventEmitter = require("events").EventEmitter;
3702
+ var util = require("util");
3703
+ var fallback;
3704
+ var PIPE_NAME = "notifierPipe";
3705
+ var PIPE_PATH_PREFIX = "\\\\.\\pipe\\";
3706
+ var PIPE_PATH_PREFIX_WSL = "/tmp/";
3707
+ module2.exports = WindowsToaster;
3708
+ function WindowsToaster(options) {
3709
+ options = utils.clone(options || {});
3710
+ if (!(this instanceof WindowsToaster)) {
3711
+ return new WindowsToaster(options);
3712
+ }
3713
+ this.options = options;
3714
+ EventEmitter.call(this);
3715
+ }
3716
+ util.inherits(WindowsToaster, EventEmitter);
3717
+ function noop() {
3718
+ }
3719
+ function parseResult(data) {
3720
+ if (!data) {
3721
+ return {};
3722
+ }
3723
+ return data.split(";").reduce((acc, cur) => {
3724
+ const split = cur.split("=");
3725
+ if (split && split.length === 2) {
3726
+ acc[split[0]] = split[1];
3727
+ }
3728
+ return acc;
3729
+ }, {});
3730
+ }
3731
+ function getPipeName() {
3732
+ const pathPrefix = utils.isWSL() ? PIPE_PATH_PREFIX_WSL : PIPE_PATH_PREFIX;
3733
+ return `${pathPrefix}${PIPE_NAME}-${uuid()}`;
3734
+ }
3735
+ function notifyRaw(options, callback) {
3736
+ options = utils.clone(options || {});
3737
+ callback = callback || noop;
3738
+ const is64Bit = os.arch() === "x64";
3739
+ let resultBuffer;
3740
+ const server = {
3741
+ namedPipe: getPipeName()
3742
+ };
3743
+ if (typeof options === "string") {
3744
+ options = { title: "node-notifier", message: options };
3745
+ }
3746
+ if (typeof callback !== "function") {
3747
+ throw new TypeError(
3748
+ "The second argument must be a function callback. You have passed " + typeof fn
3749
+ );
3750
+ }
3751
+ const snoreToastResultParser = (err, callback2) => {
3752
+ const result = parseResult(
3753
+ resultBuffer && resultBuffer.toString("utf16le")
3754
+ );
3755
+ if (result.action === "buttonClicked" && result.button) {
3756
+ result.activationType = result.button;
3757
+ } else if (result.action) {
3758
+ result.activationType = result.action;
3759
+ }
3760
+ if (err && err.code === -1) {
3761
+ callback2(err, result);
3762
+ }
3763
+ callback2(null, result);
3764
+ server.instance && server.instance.close();
3765
+ };
3766
+ const actionJackedCallback = (err) => snoreToastResultParser(
3767
+ err,
3768
+ utils.actionJackerDecorator(
3769
+ this,
3770
+ options,
3771
+ callback,
3772
+ (data) => data === "activate" ? "click" : data || false
3773
+ )
3774
+ );
3775
+ options.title = options.title || "Node Notification:";
3776
+ if (typeof options.message === "undefined" && typeof options.close === "undefined") {
3777
+ callback(new Error("Message or ID to close is required."));
3778
+ return this;
3779
+ }
3780
+ if (!utils.isWin8() && !utils.isWSL() && !!this.options.withFallback) {
3781
+ fallback = fallback || new Balloon(this.options);
3782
+ return fallback.notify(options, callback);
3783
+ }
3784
+ utils.createNamedPipe(server).then((out) => {
3785
+ resultBuffer = out;
3786
+ options.pipeName = server.namedPipe;
3787
+ const localNotifier = options.customPath || this.options.customPath || notifier + "-x" + (is64Bit ? "64" : "86") + ".exe";
3788
+ options = utils.mapToWin8(options);
3789
+ const argsList = utils.constructArgumentList(options, {
3790
+ explicitTrue: true,
3791
+ wrapper: "",
3792
+ keepNewlines: true,
3793
+ noEscape: true
3794
+ });
3795
+ utils.fileCommand(
3796
+ localNotifier,
3797
+ argsList,
3798
+ actionJackedCallback
3799
+ );
3800
+ });
3801
+ return this;
3802
+ }
3803
+ Object.defineProperty(WindowsToaster.prototype, "notify", {
3804
+ get: function() {
3805
+ if (!this._notify) this._notify = notifyRaw.bind(this);
3806
+ return this._notify;
3807
+ }
3808
+ });
3809
+ }
3810
+ });
3811
+
3812
+ // ../../../node_modules/node-notifier/index.js
3813
+ var require_node_notifier = __commonJS({
3814
+ "../../../node_modules/node-notifier/index.js"(exports2, module2) {
3815
+ "use strict";
3816
+ var os = require("os");
3817
+ var utils = require_utils();
3818
+ var NotifySend = require_notifysend();
3819
+ var NotificationCenter = require_notificationcenter();
3820
+ var WindowsToaster = require_toaster();
3821
+ var Growl = require_growl();
3822
+ var WindowsBalloon = require_balloon();
3823
+ var options = { withFallback: true };
3824
+ var osType = utils.isWSL() ? "WSL" : os.type();
3825
+ switch (osType) {
3826
+ case "Linux":
3827
+ module2.exports = new NotifySend(options);
3828
+ module2.exports.Notification = NotifySend;
3829
+ break;
3830
+ case "Darwin":
3831
+ module2.exports = new NotificationCenter(options);
3832
+ module2.exports.Notification = NotificationCenter;
3833
+ break;
3834
+ case "Windows_NT":
3835
+ if (utils.isLessThanWin8()) {
3836
+ module2.exports = new WindowsBalloon(options);
3837
+ module2.exports.Notification = WindowsBalloon;
3838
+ } else {
3839
+ module2.exports = new WindowsToaster(options);
3840
+ module2.exports.Notification = WindowsToaster;
3841
+ }
3842
+ break;
3843
+ case "WSL":
3844
+ module2.exports = new WindowsToaster(options);
3845
+ module2.exports.Notification = WindowsToaster;
3846
+ break;
3847
+ default:
3848
+ if (os.type().match(/BSD$/)) {
3849
+ module2.exports = new NotifySend(options);
3850
+ module2.exports.Notification = NotifySend;
3851
+ } else {
3852
+ module2.exports = new Growl(options);
3853
+ module2.exports.Notification = Growl;
3854
+ }
3855
+ }
3856
+ module2.exports.NotifySend = NotifySend;
3857
+ module2.exports.NotificationCenter = NotificationCenter;
3858
+ module2.exports.WindowsToaster = WindowsToaster;
3859
+ module2.exports.WindowsBalloon = WindowsBalloon;
3860
+ module2.exports.Growl = Growl;
3861
+ }
3862
+ });
3863
+
3864
+ // agent-interceptor.ts
3865
+ var agent_interceptor_exports = {};
3866
+ __export(agent_interceptor_exports, {
3867
+ EnvaultAgentClient: () => EnvaultAgentClient
3868
+ });
3869
+ module.exports = __toCommonJS(agent_interceptor_exports);
3870
+ var import_child_process = require("child_process");
3871
+ var import_node_fs = require("fs");
3872
+ var import_node_crypto = __toESM(require("crypto"), 1);
3873
+ var import_node_path = __toESM(require("path"), 1);
3874
+ var import_node_url = require("url");
3875
+
3876
+ // version.ts
3877
+ var SDK_VERSION = "1.0.1";
3878
+
3879
+ // agent-interceptor.ts
3880
+ var EnvaultAgentClient = class {
3881
+ constructor(endpoint, token, projectId) {
3882
+ this.originalSecrets = {};
3883
+ this.endpoint = endpoint;
3884
+ this.token = token;
3885
+ this.projectIdHint = projectId;
3886
+ this.compatibilityCheckPromise = this.checkSdkCompatibility();
3887
+ }
3888
+ isUuid(value) {
3889
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
3890
+ value
3891
+ );
3892
+ }
3893
+ resolveProjectIdFromEnvaultJson() {
3894
+ const configPath = import_node_path.default.join(process.cwd(), "envault.json");
3895
+ if (!(0, import_node_fs.existsSync)(configPath)) {
3896
+ return null;
3897
+ }
3898
+ try {
3899
+ const parsed = JSON.parse((0, import_node_fs.readFileSync)(configPath, "utf-8"));
3900
+ if (typeof parsed.projectId === "string" && this.isUuid(parsed.projectId.trim())) {
3901
+ return parsed.projectId.trim();
3902
+ }
3903
+ } catch {
3904
+ }
3905
+ return null;
3906
+ }
3907
+ resolveProjectId() {
3908
+ if (this.resolvedProjectId) {
3909
+ return this.resolvedProjectId;
3910
+ }
3911
+ const fromHint = (this.projectIdHint || "").trim();
3912
+ if (this.isUuid(fromHint)) {
3913
+ this.resolvedProjectId = fromHint;
3914
+ return fromHint;
3915
+ }
3916
+ const fromConfigFile = this.resolveProjectIdFromEnvaultJson();
3917
+ if (fromConfigFile) {
3918
+ this.resolvedProjectId = fromConfigFile;
3919
+ return fromConfigFile;
3920
+ }
3921
+ const fromEnv = (process.env.ENVAULT_PROJECT_ID || "").trim();
3922
+ if (this.isUuid(fromEnv)) {
3923
+ this.resolvedProjectId = fromEnv;
3924
+ return fromEnv;
3925
+ }
3926
+ throw new Error(
3927
+ "Unable to resolve project context. Run `envault init` in this directory or set ENVAULT_PROJECT_ID."
3928
+ );
3929
+ }
3930
+ compareVersions(a, b) {
3931
+ const parse2 = (value) => {
3932
+ return value.trim().replace(/^v/i, "").split(".").map((segment) => Number.parseInt(segment.replace(/[^0-9].*$/, ""), 10) || 0);
3933
+ };
3934
+ const left = parse2(a);
3935
+ const right = parse2(b);
3936
+ const maxLength = Math.max(left.length, right.length);
3937
+ for (let index = 0; index < maxLength; index += 1) {
3938
+ const l = left[index] ?? 0;
3939
+ const r = right[index] ?? 0;
3940
+ if (l > r) return 1;
3941
+ if (l < r) return -1;
3942
+ }
3943
+ return 0;
3944
+ }
3945
+ async checkSdkCompatibility() {
3946
+ try {
3947
+ const response = await fetch(`${this.endpoint}/api/sdk-version`, {
3948
+ headers: {
3949
+ "X-SDK-Version": SDK_VERSION
3950
+ }
3951
+ });
3952
+ if (!response.ok) {
3953
+ return;
3954
+ }
3955
+ const data = await response.json();
3956
+ const latestVersion = typeof data.latest_version === "string" && data.latest_version.trim().length > 0 ? data.latest_version.trim() : null;
3957
+ const minSupportedVersion = typeof data.min_supported_version === "string" && data.min_supported_version.trim().length > 0 ? data.min_supported_version.trim() : null;
3958
+ if (minSupportedVersion && this.compareVersions(SDK_VERSION, minSupportedVersion) < 0) {
3959
+ throw new Error(
3960
+ `Envault SDK ${SDK_VERSION} is below minimum supported version ${minSupportedVersion}. Please upgrade before continuing.`
3961
+ );
3962
+ }
3963
+ if (latestVersion && this.compareVersions(SDK_VERSION, latestVersion) < 0) {
3964
+ console.warn(
3965
+ `[Envault SDK] A newer SDK version (${latestVersion}) is available. You are running ${SDK_VERSION}.`
3966
+ );
3967
+ }
3968
+ } catch (error) {
3969
+ if (error instanceof Error && error.message.includes("minimum supported version")) {
3970
+ throw error;
3971
+ }
3972
+ }
3973
+ }
3974
+ resolveAppBaseUrl() {
3975
+ const LOCAL_APP_URL = "https://envault.localhost:1355";
3976
+ const PROD_APP_URL = "https://envault.tech";
3977
+ const normalize = (value) => {
3978
+ try {
3979
+ return new URL(value).origin.replace(/\/$/, "");
3980
+ } catch {
3981
+ return null;
3982
+ }
3983
+ };
3984
+ const configuredCandidates = [
3985
+ process.env.BASE_URL,
3986
+ process.env.NEXT_PUBLIC_APP_URL
3987
+ ];
3988
+ for (const configured of configuredCandidates) {
3989
+ if (!configured) continue;
3990
+ const origin = normalize(configured);
3991
+ if (!origin) continue;
3992
+ if (origin === LOCAL_APP_URL) return LOCAL_APP_URL;
3993
+ if (origin === PROD_APP_URL) return PROD_APP_URL;
3994
+ }
3995
+ try {
3996
+ const parsedEndpoint = new URL(this.endpoint);
3997
+ if (parsedEndpoint.hostname === "localhost" || parsedEndpoint.hostname === "127.0.0.1" || parsedEndpoint.hostname.endsWith(".localhost")) {
3998
+ return LOCAL_APP_URL;
3999
+ }
4000
+ return PROD_APP_URL;
4001
+ } catch {
4002
+ return PROD_APP_URL;
4003
+ }
4004
+ }
4005
+ /**
4006
+ * Generates a repeatable Idempotency-Key
4007
+ */
4008
+ generateIdempotencyKey() {
4009
+ return import_node_crypto.default.randomUUID();
4010
+ }
4011
+ /**
4012
+ * Exposes a native OS Notification for local setups.
4013
+ * Uses a layered fallback so IDE and system alerts still surface when one path fails.
4014
+ */
4015
+ async triggerOsNotification(message, approvalUrl) {
4016
+ const title = "Envault Agent Security";
4017
+ const notificationIcon = this.resolveNotificationIconPath();
4018
+ const allowOsaFallback = process.env.ENVAULT_ALLOW_OSASCRIPT_NOTIFIER === "true";
4019
+ const emitTerminalAttention = () => {
4020
+ process.stdout.write("\x07");
4021
+ };
4022
+ const tryNodeNotifier = async () => {
4023
+ try {
4024
+ const notifierModule = await Promise.resolve().then(() => __toESM(require_node_notifier(), 1));
4025
+ const notify = notifierModule.default?.notify || notifierModule.notify;
4026
+ if (!notify) {
4027
+ return false;
4028
+ }
4029
+ notify({
4030
+ title,
4031
+ message,
4032
+ open: approvalUrl,
4033
+ sound: true,
4034
+ wait: false,
4035
+ timeout: 8,
4036
+ icon: notificationIcon || void 0
4037
+ });
4038
+ return true;
4039
+ } catch {
4040
+ return false;
4041
+ }
4042
+ };
4043
+ try {
4044
+ emitTerminalAttention();
4045
+ if (await tryNodeNotifier()) {
4046
+ return;
4047
+ }
4048
+ if (process.platform === "darwin") {
4049
+ const terminalNotifierPath = this.resolveTerminalNotifierPath();
4050
+ try {
4051
+ if (terminalNotifierPath) {
4052
+ const args = ["-title", title, "-message", message, "-sound", "default"];
4053
+ if (approvalUrl) {
4054
+ args.push("-open", approvalUrl);
4055
+ }
4056
+ if (notificationIcon) {
4057
+ const iconUrl = (0, import_node_url.pathToFileURL)(notificationIcon).toString();
4058
+ args.push("-appIcon", iconUrl);
4059
+ }
4060
+ (0, import_child_process.execFileSync)(terminalNotifierPath, args, { stdio: "ignore" });
4061
+ return;
4062
+ }
4063
+ } catch {
4064
+ }
4065
+ if (allowOsaFallback) {
4066
+ try {
4067
+ const appleScript = `display notification "${message.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}" with title "${title.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}" sound name "default"`;
4068
+ (0, import_child_process.execFileSync)("osascript", ["-e", appleScript], { stdio: "ignore" });
4069
+ return;
4070
+ } catch {
4071
+ }
4072
+ }
4073
+ console.error(`[Envault Agent] Notification unavailable: ${message}`);
4074
+ console.error("[Envault Agent] Install terminal-notifier (brew install terminal-notifier) to enable native macOS notifications.");
4075
+ if (approvalUrl) {
4076
+ console.error(`[Envault Agent] Approval URL: ${approvalUrl}`);
4077
+ }
4078
+ return;
4079
+ } else if (process.platform === "linux") {
4080
+ const iconArg = notificationIcon ? ` --icon="${notificationIcon.replace(/"/g, '\\"')}"` : "";
4081
+ (0, import_child_process.execSync)(
4082
+ `notify-send "Envault Agent Security" "${message.replace(/"/g, "'")}"${iconArg}`,
4083
+ {
4084
+ stdio: "ignore"
4085
+ }
4086
+ );
4087
+ return;
4088
+ }
4089
+ } catch {
4090
+ }
4091
+ }
4092
+ resolveNotificationIconPath() {
4093
+ const candidate = import_node_path.default.join(process.cwd(), "public", "favicon.png");
4094
+ return (0, import_node_fs.existsSync)(candidate) ? candidate : null;
4095
+ }
4096
+ resolveTerminalNotifierPath() {
4097
+ const candidates = [
4098
+ "/opt/homebrew/bin/terminal-notifier",
4099
+ "/usr/local/bin/terminal-notifier"
4100
+ ];
4101
+ for (const candidate of candidates) {
4102
+ if ((0, import_node_fs.existsSync)(candidate)) {
4103
+ return candidate;
4104
+ }
4105
+ }
4106
+ try {
4107
+ const commandPath = (0, import_child_process.execSync)("command -v terminal-notifier", {
4108
+ encoding: "utf-8",
4109
+ stdio: ["ignore", "pipe", "ignore"]
4110
+ }).trim();
4111
+ return commandPath || null;
4112
+ } catch {
4113
+ return null;
4114
+ }
4115
+ }
4116
+ /**
4117
+ * Pre-execution routine: Ensure Zero-Trust LLM Context
4118
+ * Redacts actual secret values from strings intended for the Chat UI LLM.
4119
+ */
4120
+ prepareLlmContext(fetchedEnv) {
4121
+ this.originalSecrets = { ...fetchedEnv };
4122
+ const redacted = {};
4123
+ for (const [key] of Object.entries(fetchedEnv)) {
4124
+ redacted[key] = `[REDACTED_SECRET_${key}]`;
4125
+ }
4126
+ return redacted;
4127
+ }
4128
+ restoreLlmContext(payload) {
4129
+ const restore = (value) => {
4130
+ if (typeof value === "string") {
4131
+ return value.replace(/\[REDACTED_SECRET_([^\]]+)\]/g, (match, key) => {
4132
+ return Object.prototype.hasOwnProperty.call(this.originalSecrets, key) ? this.originalSecrets[key] : match;
4133
+ });
4134
+ }
4135
+ if (Array.isArray(value)) {
4136
+ return value.map((item) => restore(item));
4137
+ }
4138
+ if (value && typeof value === "object") {
4139
+ const obj = value;
4140
+ const restored = {};
4141
+ for (const [k, v] of Object.entries(obj)) {
4142
+ restored[k] = restore(v);
4143
+ }
4144
+ return restored;
4145
+ }
4146
+ return value;
4147
+ };
4148
+ return restore(payload);
4149
+ }
4150
+ /**
4151
+ * The core 202 Polling Loop for executing mutations.
4152
+ * Split-Routing ensures the Chat UI handles the "why" and terminal handles "how".
4153
+ */
4154
+ async executeMutation(payload, options) {
4155
+ await this.compatibilityCheckPromise;
4156
+ const resolvedProjectId = this.resolveProjectId();
4157
+ const idempotencyKey = this.generateIdempotencyKey();
4158
+ const restoredPayload = this.restoreLlmContext(payload);
4159
+ const selectedEnvironment = (options?.environment || restoredPayload.environment || restoredPayload.environmentSlug || "").toString().trim();
4160
+ const payloadForApi = {
4161
+ ...restoredPayload,
4162
+ ...selectedEnvironment ? {
4163
+ environment: selectedEnvironment,
4164
+ environmentSlug: selectedEnvironment
4165
+ } : {}
4166
+ };
4167
+ const response = await fetch(`${this.endpoint}/api/sdk/secrets`, {
4168
+ method: "POST",
4169
+ headers: {
4170
+ Authorization: `Bearer ${this.token}`,
4171
+ "Content-Type": "application/json",
4172
+ "Idempotency-Key": idempotencyKey,
4173
+ "X-SDK-Version": SDK_VERSION
4174
+ },
4175
+ body: JSON.stringify({
4176
+ projectId: resolvedProjectId,
4177
+ payload: payloadForApi,
4178
+ action: "update"
4179
+ })
4180
+ });
4181
+ if (response.status === 429) {
4182
+ console.error("[Envault SDK] Rate limit hit. Terminal execution halted.");
4183
+ throw new Error("Too Many Requests");
4184
+ }
4185
+ if (!response.ok && response.status !== 202) {
4186
+ throw new Error(`API Error: ${response.status} ${await response.text()}`);
4187
+ }
4188
+ const data = await response.json();
4189
+ if (response.status === 202 || data.status === "pending") {
4190
+ const approvalId = typeof data.approval_id === "string" ? data.approval_id : "";
4191
+ if (!approvalId) {
4192
+ throw new Error("Approval response missing approval_id");
4193
+ }
4194
+ const approvalUrl = typeof data.approval_url === "string" && data.approval_url.length > 0 ? data.approval_url : `${this.resolveAppBaseUrl()}/approve/${approvalId}`;
4195
+ const pendingResult = {
4196
+ status: "pending_approval",
4197
+ approval_id: approvalId,
4198
+ approval_url: approvalUrl,
4199
+ project_id: resolvedProjectId,
4200
+ approve_command: `envault approve ${approvalId}`
4201
+ };
4202
+ process.stdout.write(
4203
+ `
4204
+ \x1B[33m[Envault SDK] Action paused. Human approval required.\x1B[0m`
4205
+ );
4206
+ process.stdout.write(
4207
+ `
4208
+ \x1B[36mApprove inline with: ${pendingResult.approve_command}\x1B[0m
4209
+ `
4210
+ );
4211
+ void this.triggerOsNotification(
4212
+ `Envault Agent requires approval for [${resolvedProjectId}].`,
4213
+ approvalUrl
4214
+ );
4215
+ if (!options?.waitForApproval) {
4216
+ return pendingResult;
4217
+ }
4218
+ try {
4219
+ const approvedPayload = await this.pollForApproval(approvalId);
4220
+ return {
4221
+ status: "approved",
4222
+ approval_id: approvalId,
4223
+ payload: approvedPayload
4224
+ };
4225
+ } catch (error) {
4226
+ if (error instanceof Error && error.message === "HitlApprovalRejected") {
4227
+ throw new Error("Mutation rejected by project administrator.");
4228
+ }
4229
+ throw error;
4230
+ }
4231
+ }
4232
+ return data;
4233
+ }
4234
+ /**
4235
+ * 3-second polling loop handling the One-Time Read Burn mechanics
4236
+ */
4237
+ async pollForApproval(approvalId) {
4238
+ return new Promise((resolve, reject) => {
4239
+ process.stdout.write("Polling status");
4240
+ let finished = false;
4241
+ const finish = (fn2) => {
4242
+ if (finished) return;
4243
+ finished = true;
4244
+ clearInterval(interval);
4245
+ clearTimeout(timeoutHandle);
4246
+ fn2();
4247
+ };
4248
+ const interval = setInterval(async () => {
4249
+ try {
4250
+ process.stdout.write(".");
4251
+ const res = await fetch(
4252
+ `${this.endpoint}/api/sdk/approvals/${approvalId}/status`,
4253
+ {
4254
+ headers: {
4255
+ Authorization: `Bearer ${this.token}`,
4256
+ "X-SDK-Version": SDK_VERSION
4257
+ }
4258
+ }
4259
+ );
4260
+ if (res.status === 410) {
4261
+ return finish(() => {
4262
+ console.log(
4263
+ "\n\x1B[31m[Envault SDK] Resource Gone (Approval expired or already consumed by a replay attack).\x1B[0m"
4264
+ );
4265
+ reject(new Error("HitlApprovalGone"));
4266
+ });
4267
+ }
4268
+ if (res.status === 403) {
4269
+ try {
4270
+ await res.json();
4271
+ } catch {
4272
+ }
4273
+ return finish(() => {
4274
+ console.log(
4275
+ "\n\x1B[31m[Envault SDK] Action Rejected by Human.\x1B[0m"
4276
+ );
4277
+ reject(new Error("HitlApprovalRejected"));
4278
+ });
4279
+ }
4280
+ if (res.status === 200) {
4281
+ const result = await res.json();
4282
+ if (result?.status === "rejected") {
4283
+ return finish(() => {
4284
+ console.log(
4285
+ "\n\x1B[31m[Envault SDK] Action Rejected by Human.\x1B[0m"
4286
+ );
4287
+ reject(new Error("HitlApprovalRejected"));
4288
+ });
4289
+ }
4290
+ return finish(() => {
4291
+ console.log(
4292
+ "\n\x1B[32m[Envault SDK] Approved. Resuming execution.\x1B[0m\n"
4293
+ );
4294
+ resolve(result.payload);
4295
+ });
4296
+ }
4297
+ } catch {
4298
+ process.stdout.write("x");
4299
+ }
4300
+ }, 3e3);
4301
+ const timeoutHandle = setTimeout(() => {
4302
+ finish(() => {
4303
+ console.log("\n\x1B[31m[Envault SDK] Polling timeout (15m).\x1B[0m");
4304
+ reject(new Error("HitlApprovalTimeout"));
4305
+ });
4306
+ }, 15 * 60 * 1e3);
4307
+ });
4308
+ }
4309
+ };
4310
+ // Annotate the CommonJS export names for ESM import in node:
4311
+ 0 && (module.exports = {
4312
+ EnvaultAgentClient
4313
+ });
4314
+ //# sourceMappingURL=agent-interceptor.cjs.map