@mohak34/opencode-notifier 0.1.0

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