netra-sdk 1.0.5 → 1.1.0-beta

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.
@@ -1,2511 +1,6 @@
1
- import { __commonJS, __export, __esm, __require, __toCommonJS, require_decamelize, require_camelcase, init_esm_node, esm_node_exports, __toESM, __publicField, v4_default } from './chunk-OY22X7BX.js';
2
- import process2 from 'process';
3
- import os from 'os';
4
- import tty from 'tty';
5
- import { context, diag, trace, metrics, SpanKind, SpanStatusCode } from '@opentelemetry/api';
6
- import * as path2 from 'path';
7
- import { types } from 'util';
8
- import { readFileSync } from 'fs';
9
-
10
- // node_modules/ms/index.js
11
- var require_ms = __commonJS({
12
- "node_modules/ms/index.js"(exports$1, module) {
13
- var s = 1e3;
14
- var m = s * 60;
15
- var h = m * 60;
16
- var d = h * 24;
17
- var w = d * 7;
18
- var y = d * 365.25;
19
- module.exports = function(val, options) {
20
- options = options || {};
21
- var type = typeof val;
22
- if (type === "string" && val.length > 0) {
23
- return parse2(val);
24
- } else if (type === "number" && isFinite(val)) {
25
- return options.long ? fmtLong(val) : fmtShort(val);
26
- }
27
- throw new Error(
28
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
29
- );
30
- };
31
- function parse2(str) {
32
- str = String(str);
33
- if (str.length > 100) {
34
- return;
35
- }
36
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
37
- str
38
- );
39
- if (!match) {
40
- return;
41
- }
42
- var n = parseFloat(match[1]);
43
- var type = (match[2] || "ms").toLowerCase();
44
- switch (type) {
45
- case "years":
46
- case "year":
47
- case "yrs":
48
- case "yr":
49
- case "y":
50
- return n * y;
51
- case "weeks":
52
- case "week":
53
- case "w":
54
- return n * w;
55
- case "days":
56
- case "day":
57
- case "d":
58
- return n * d;
59
- case "hours":
60
- case "hour":
61
- case "hrs":
62
- case "hr":
63
- case "h":
64
- return n * h;
65
- case "minutes":
66
- case "minute":
67
- case "mins":
68
- case "min":
69
- case "m":
70
- return n * m;
71
- case "seconds":
72
- case "second":
73
- case "secs":
74
- case "sec":
75
- case "s":
76
- return n * s;
77
- case "milliseconds":
78
- case "millisecond":
79
- case "msecs":
80
- case "msec":
81
- case "ms":
82
- return n;
83
- default:
84
- return void 0;
85
- }
86
- }
87
- function fmtShort(ms) {
88
- var msAbs = Math.abs(ms);
89
- if (msAbs >= d) {
90
- return Math.round(ms / d) + "d";
91
- }
92
- if (msAbs >= h) {
93
- return Math.round(ms / h) + "h";
94
- }
95
- if (msAbs >= m) {
96
- return Math.round(ms / m) + "m";
97
- }
98
- if (msAbs >= s) {
99
- return Math.round(ms / s) + "s";
100
- }
101
- return ms + "ms";
102
- }
103
- function fmtLong(ms) {
104
- var msAbs = Math.abs(ms);
105
- if (msAbs >= d) {
106
- return plural(ms, msAbs, d, "day");
107
- }
108
- if (msAbs >= h) {
109
- return plural(ms, msAbs, h, "hour");
110
- }
111
- if (msAbs >= m) {
112
- return plural(ms, msAbs, m, "minute");
113
- }
114
- if (msAbs >= s) {
115
- return plural(ms, msAbs, s, "second");
116
- }
117
- return ms + " ms";
118
- }
119
- function plural(ms, msAbs, n, name) {
120
- var isPlural = msAbs >= n * 1.5;
121
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
122
- }
123
- }
124
- });
125
-
126
- // node_modules/debug/src/common.js
127
- var require_common = __commonJS({
128
- "node_modules/debug/src/common.js"(exports$1, module) {
129
- function setup(env2) {
130
- createDebug.debug = createDebug;
131
- createDebug.default = createDebug;
132
- createDebug.coerce = coerce;
133
- createDebug.disable = disable;
134
- createDebug.enable = enable;
135
- createDebug.enabled = enabled;
136
- createDebug.humanize = require_ms();
137
- createDebug.destroy = destroy;
138
- Object.keys(env2).forEach((key) => {
139
- createDebug[key] = env2[key];
140
- });
141
- createDebug.names = [];
142
- createDebug.skips = [];
143
- createDebug.formatters = {};
144
- function selectColor(namespace) {
145
- let hash = 0;
146
- for (let i = 0; i < namespace.length; i++) {
147
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
148
- hash |= 0;
149
- }
150
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
151
- }
152
- createDebug.selectColor = selectColor;
153
- function createDebug(namespace) {
154
- let prevTime;
155
- let enableOverride = null;
156
- let namespacesCache;
157
- let enabledCache;
158
- function debug(...args) {
159
- if (!debug.enabled) {
160
- return;
161
- }
162
- const self = debug;
163
- const curr = Number(/* @__PURE__ */ new Date());
164
- const ms = curr - (prevTime || curr);
165
- self.diff = ms;
166
- self.prev = prevTime;
167
- self.curr = curr;
168
- prevTime = curr;
169
- args[0] = createDebug.coerce(args[0]);
170
- if (typeof args[0] !== "string") {
171
- args.unshift("%O");
172
- }
173
- let index = 0;
174
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
175
- if (match === "%%") {
176
- return "%";
177
- }
178
- index++;
179
- const formatter = createDebug.formatters[format];
180
- if (typeof formatter === "function") {
181
- const val = args[index];
182
- match = formatter.call(self, val);
183
- args.splice(index, 1);
184
- index--;
185
- }
186
- return match;
187
- });
188
- createDebug.formatArgs.call(self, args);
189
- const logFn = self.log || createDebug.log;
190
- logFn.apply(self, args);
191
- }
192
- debug.namespace = namespace;
193
- debug.useColors = createDebug.useColors();
194
- debug.color = createDebug.selectColor(namespace);
195
- debug.extend = extend;
196
- debug.destroy = createDebug.destroy;
197
- Object.defineProperty(debug, "enabled", {
198
- enumerable: true,
199
- configurable: false,
200
- get: () => {
201
- if (enableOverride !== null) {
202
- return enableOverride;
203
- }
204
- if (namespacesCache !== createDebug.namespaces) {
205
- namespacesCache = createDebug.namespaces;
206
- enabledCache = createDebug.enabled(namespace);
207
- }
208
- return enabledCache;
209
- },
210
- set: (v) => {
211
- enableOverride = v;
212
- }
213
- });
214
- if (typeof createDebug.init === "function") {
215
- createDebug.init(debug);
216
- }
217
- return debug;
218
- }
219
- function extend(namespace, delimiter) {
220
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
221
- newDebug.log = this.log;
222
- return newDebug;
223
- }
224
- function enable(namespaces) {
225
- createDebug.save(namespaces);
226
- createDebug.namespaces = namespaces;
227
- createDebug.names = [];
228
- createDebug.skips = [];
229
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
230
- for (const ns of split) {
231
- if (ns[0] === "-") {
232
- createDebug.skips.push(ns.slice(1));
233
- } else {
234
- createDebug.names.push(ns);
235
- }
236
- }
237
- }
238
- function matchesTemplate(search, template) {
239
- let searchIndex = 0;
240
- let templateIndex = 0;
241
- let starIndex = -1;
242
- let matchIndex = 0;
243
- while (searchIndex < search.length) {
244
- if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
245
- if (template[templateIndex] === "*") {
246
- starIndex = templateIndex;
247
- matchIndex = searchIndex;
248
- templateIndex++;
249
- } else {
250
- searchIndex++;
251
- templateIndex++;
252
- }
253
- } else if (starIndex !== -1) {
254
- templateIndex = starIndex + 1;
255
- matchIndex++;
256
- searchIndex = matchIndex;
257
- } else {
258
- return false;
259
- }
260
- }
261
- while (templateIndex < template.length && template[templateIndex] === "*") {
262
- templateIndex++;
263
- }
264
- return templateIndex === template.length;
265
- }
266
- function disable() {
267
- const namespaces = [
268
- ...createDebug.names,
269
- ...createDebug.skips.map((namespace) => "-" + namespace)
270
- ].join(",");
271
- createDebug.enable("");
272
- return namespaces;
273
- }
274
- function enabled(name) {
275
- for (const skip of createDebug.skips) {
276
- if (matchesTemplate(name, skip)) {
277
- return false;
278
- }
279
- }
280
- for (const ns of createDebug.names) {
281
- if (matchesTemplate(name, ns)) {
282
- return true;
283
- }
284
- }
285
- return false;
286
- }
287
- function coerce(val) {
288
- if (val instanceof Error) {
289
- return val.stack || val.message;
290
- }
291
- return val;
292
- }
293
- function destroy() {
294
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
295
- }
296
- createDebug.enable(createDebug.load());
297
- return createDebug;
298
- }
299
- module.exports = setup;
300
- }
301
- });
302
-
303
- // node_modules/debug/src/browser.js
304
- var require_browser = __commonJS({
305
- "node_modules/debug/src/browser.js"(exports$1, module) {
306
- exports$1.formatArgs = formatArgs;
307
- exports$1.save = save;
308
- exports$1.load = load;
309
- exports$1.useColors = useColors;
310
- exports$1.storage = localstorage();
311
- exports$1.destroy = /* @__PURE__ */ (() => {
312
- let warned = false;
313
- return () => {
314
- if (!warned) {
315
- warned = true;
316
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
317
- }
318
- };
319
- })();
320
- exports$1.colors = [
321
- "#0000CC",
322
- "#0000FF",
323
- "#0033CC",
324
- "#0033FF",
325
- "#0066CC",
326
- "#0066FF",
327
- "#0099CC",
328
- "#0099FF",
329
- "#00CC00",
330
- "#00CC33",
331
- "#00CC66",
332
- "#00CC99",
333
- "#00CCCC",
334
- "#00CCFF",
335
- "#3300CC",
336
- "#3300FF",
337
- "#3333CC",
338
- "#3333FF",
339
- "#3366CC",
340
- "#3366FF",
341
- "#3399CC",
342
- "#3399FF",
343
- "#33CC00",
344
- "#33CC33",
345
- "#33CC66",
346
- "#33CC99",
347
- "#33CCCC",
348
- "#33CCFF",
349
- "#6600CC",
350
- "#6600FF",
351
- "#6633CC",
352
- "#6633FF",
353
- "#66CC00",
354
- "#66CC33",
355
- "#9900CC",
356
- "#9900FF",
357
- "#9933CC",
358
- "#9933FF",
359
- "#99CC00",
360
- "#99CC33",
361
- "#CC0000",
362
- "#CC0033",
363
- "#CC0066",
364
- "#CC0099",
365
- "#CC00CC",
366
- "#CC00FF",
367
- "#CC3300",
368
- "#CC3333",
369
- "#CC3366",
370
- "#CC3399",
371
- "#CC33CC",
372
- "#CC33FF",
373
- "#CC6600",
374
- "#CC6633",
375
- "#CC9900",
376
- "#CC9933",
377
- "#CCCC00",
378
- "#CCCC33",
379
- "#FF0000",
380
- "#FF0033",
381
- "#FF0066",
382
- "#FF0099",
383
- "#FF00CC",
384
- "#FF00FF",
385
- "#FF3300",
386
- "#FF3333",
387
- "#FF3366",
388
- "#FF3399",
389
- "#FF33CC",
390
- "#FF33FF",
391
- "#FF6600",
392
- "#FF6633",
393
- "#FF9900",
394
- "#FF9933",
395
- "#FFCC00",
396
- "#FFCC33"
397
- ];
398
- function useColors() {
399
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
400
- return true;
401
- }
402
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
403
- return false;
404
- }
405
- let m;
406
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
407
- typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
408
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
409
- typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
410
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
411
- }
412
- function formatArgs(args) {
413
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
414
- if (!this.useColors) {
415
- return;
416
- }
417
- const c = "color: " + this.color;
418
- args.splice(1, 0, c, "color: inherit");
419
- let index = 0;
420
- let lastC = 0;
421
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
422
- if (match === "%%") {
423
- return;
424
- }
425
- index++;
426
- if (match === "%c") {
427
- lastC = index;
428
- }
429
- });
430
- args.splice(lastC, 0, c);
431
- }
432
- exports$1.log = console.debug || console.log || (() => {
433
- });
434
- function save(namespaces) {
435
- try {
436
- if (namespaces) {
437
- exports$1.storage.setItem("debug", namespaces);
438
- } else {
439
- exports$1.storage.removeItem("debug");
440
- }
441
- } catch (error) {
442
- }
443
- }
444
- function load() {
445
- let r;
446
- try {
447
- r = exports$1.storage.getItem("debug") || exports$1.storage.getItem("DEBUG");
448
- } catch (error) {
449
- }
450
- if (!r && typeof process !== "undefined" && "env" in process) {
451
- r = process.env.DEBUG;
452
- }
453
- return r;
454
- }
455
- function localstorage() {
456
- try {
457
- return localStorage;
458
- } catch (error) {
459
- }
460
- }
461
- module.exports = require_common()(exports$1);
462
- var { formatters } = module.exports;
463
- formatters.j = function(v) {
464
- try {
465
- return JSON.stringify(v);
466
- } catch (error) {
467
- return "[UnexpectedJSONParseError]: " + error.message;
468
- }
469
- };
470
- }
471
- });
472
-
473
- // node_modules/supports-color/index.js
474
- var supports_color_exports = {};
475
- __export(supports_color_exports, {
476
- createSupportsColor: () => createSupportsColor,
477
- default: () => supports_color_default
478
- });
479
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
480
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
481
- const position = argv.indexOf(prefix + flag);
482
- const terminatorPosition = argv.indexOf("--");
483
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
484
- }
485
- function envForceColor() {
486
- if (!("FORCE_COLOR" in env)) {
487
- return;
488
- }
489
- if (env.FORCE_COLOR === "true") {
490
- return 1;
491
- }
492
- if (env.FORCE_COLOR === "false") {
493
- return 0;
494
- }
495
- if (env.FORCE_COLOR.length === 0) {
496
- return 1;
497
- }
498
- const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
499
- if (![0, 1, 2, 3].includes(level)) {
500
- return;
501
- }
502
- return level;
503
- }
504
- function translateLevel(level) {
505
- if (level === 0) {
506
- return false;
507
- }
508
- return {
509
- level,
510
- hasBasic: true,
511
- has256: level >= 2,
512
- has16m: level >= 3
513
- };
514
- }
515
- function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
516
- const noFlagForceColor = envForceColor();
517
- if (noFlagForceColor !== void 0) {
518
- flagForceColor = noFlagForceColor;
519
- }
520
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
521
- if (forceColor === 0) {
522
- return 0;
523
- }
524
- if (sniffFlags) {
525
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
526
- return 3;
527
- }
528
- if (hasFlag("color=256")) {
529
- return 2;
530
- }
531
- }
532
- if ("TF_BUILD" in env && "AGENT_NAME" in env) {
533
- return 1;
534
- }
535
- if (haveStream && !streamIsTTY && forceColor === void 0) {
536
- return 0;
537
- }
538
- const min = forceColor || 0;
539
- if (env.TERM === "dumb") {
540
- return min;
541
- }
542
- if (process2.platform === "win32") {
543
- const osRelease = os.release().split(".");
544
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
545
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
546
- }
547
- return 1;
548
- }
549
- if ("CI" in env) {
550
- if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
551
- return 3;
552
- }
553
- if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
554
- return 1;
555
- }
556
- return min;
557
- }
558
- if ("TEAMCITY_VERSION" in env) {
559
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
560
- }
561
- if (env.COLORTERM === "truecolor") {
562
- return 3;
563
- }
564
- if (env.TERM === "xterm-kitty") {
565
- return 3;
566
- }
567
- if (env.TERM === "xterm-ghostty") {
568
- return 3;
569
- }
570
- if (env.TERM === "wezterm") {
571
- return 3;
572
- }
573
- if ("TERM_PROGRAM" in env) {
574
- const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
575
- switch (env.TERM_PROGRAM) {
576
- case "iTerm.app": {
577
- return version2 >= 3 ? 3 : 2;
578
- }
579
- case "Apple_Terminal": {
580
- return 2;
581
- }
582
- }
583
- }
584
- if (/-256(color)?$/i.test(env.TERM)) {
585
- return 2;
586
- }
587
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
588
- return 1;
589
- }
590
- if ("COLORTERM" in env) {
591
- return 1;
592
- }
593
- return min;
594
- }
595
- function createSupportsColor(stream, options = {}) {
596
- const level = _supportsColor(stream, {
597
- streamIsTTY: stream && stream.isTTY,
598
- ...options
599
- });
600
- return translateLevel(level);
601
- }
602
- var env, flagForceColor, supportsColor, supports_color_default;
603
- var init_supports_color = __esm({
604
- "node_modules/supports-color/index.js"() {
605
- ({ env } = process2);
606
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
607
- flagForceColor = 0;
608
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
609
- flagForceColor = 1;
610
- }
611
- supportsColor = {
612
- stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
613
- stderr: createSupportsColor({ isTTY: tty.isatty(2) })
614
- };
615
- supports_color_default = supportsColor;
616
- }
617
- });
618
-
619
- // node_modules/debug/src/node.js
620
- var require_node = __commonJS({
621
- "node_modules/debug/src/node.js"(exports$1, module) {
622
- var tty2 = __require("tty");
623
- var util = __require("util");
624
- exports$1.init = init;
625
- exports$1.log = log;
626
- exports$1.formatArgs = formatArgs;
627
- exports$1.save = save;
628
- exports$1.load = load;
629
- exports$1.useColors = useColors;
630
- exports$1.destroy = util.deprecate(
631
- () => {
632
- },
633
- "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
634
- );
635
- exports$1.colors = [6, 2, 3, 4, 5, 1];
636
- try {
637
- const supportsColor2 = (init_supports_color(), __toCommonJS(supports_color_exports));
638
- if (supportsColor2 && (supportsColor2.stderr || supportsColor2).level >= 2) {
639
- exports$1.colors = [
640
- 20,
641
- 21,
642
- 26,
643
- 27,
644
- 32,
645
- 33,
646
- 38,
647
- 39,
648
- 40,
649
- 41,
650
- 42,
651
- 43,
652
- 44,
653
- 45,
654
- 56,
655
- 57,
656
- 62,
657
- 63,
658
- 68,
659
- 69,
660
- 74,
661
- 75,
662
- 76,
663
- 77,
664
- 78,
665
- 79,
666
- 80,
667
- 81,
668
- 92,
669
- 93,
670
- 98,
671
- 99,
672
- 112,
673
- 113,
674
- 128,
675
- 129,
676
- 134,
677
- 135,
678
- 148,
679
- 149,
680
- 160,
681
- 161,
682
- 162,
683
- 163,
684
- 164,
685
- 165,
686
- 166,
687
- 167,
688
- 168,
689
- 169,
690
- 170,
691
- 171,
692
- 172,
693
- 173,
694
- 178,
695
- 179,
696
- 184,
697
- 185,
698
- 196,
699
- 197,
700
- 198,
701
- 199,
702
- 200,
703
- 201,
704
- 202,
705
- 203,
706
- 204,
707
- 205,
708
- 206,
709
- 207,
710
- 208,
711
- 209,
712
- 214,
713
- 215,
714
- 220,
715
- 221
716
- ];
717
- }
718
- } catch (error) {
719
- }
720
- exports$1.inspectOpts = Object.keys(process.env).filter((key) => {
721
- return /^debug_/i.test(key);
722
- }).reduce((obj, key) => {
723
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
724
- return k.toUpperCase();
725
- });
726
- let val = process.env[key];
727
- if (/^(yes|on|true|enabled)$/i.test(val)) {
728
- val = true;
729
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
730
- val = false;
731
- } else if (val === "null") {
732
- val = null;
733
- } else {
734
- val = Number(val);
735
- }
736
- obj[prop] = val;
737
- return obj;
738
- }, {});
739
- function useColors() {
740
- return "colors" in exports$1.inspectOpts ? Boolean(exports$1.inspectOpts.colors) : tty2.isatty(process.stderr.fd);
741
- }
742
- function formatArgs(args) {
743
- const { namespace: name, useColors: useColors2 } = this;
744
- if (useColors2) {
745
- const c = this.color;
746
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
747
- const prefix = ` ${colorCode};1m${name} \x1B[0m`;
748
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
749
- args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
750
- } else {
751
- args[0] = getDate() + name + " " + args[0];
752
- }
753
- }
754
- function getDate() {
755
- if (exports$1.inspectOpts.hideDate) {
756
- return "";
757
- }
758
- return (/* @__PURE__ */ new Date()).toISOString() + " ";
759
- }
760
- function log(...args) {
761
- return process.stderr.write(util.formatWithOptions(exports$1.inspectOpts, ...args) + "\n");
762
- }
763
- function save(namespaces) {
764
- if (namespaces) {
765
- process.env.DEBUG = namespaces;
766
- } else {
767
- delete process.env.DEBUG;
768
- }
769
- }
770
- function load() {
771
- return process.env.DEBUG;
772
- }
773
- function init(debug) {
774
- debug.inspectOpts = {};
775
- const keys = Object.keys(exports$1.inspectOpts);
776
- for (let i = 0; i < keys.length; i++) {
777
- debug.inspectOpts[keys[i]] = exports$1.inspectOpts[keys[i]];
778
- }
779
- }
780
- module.exports = require_common()(exports$1);
781
- var { formatters } = module.exports;
782
- formatters.o = function(v) {
783
- this.inspectOpts.colors = this.useColors;
784
- return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
785
- };
786
- formatters.O = function(v) {
787
- this.inspectOpts.colors = this.useColors;
788
- return util.inspect(v, this.inspectOpts);
789
- };
790
- }
791
- });
792
-
793
- // node_modules/debug/src/index.js
794
- var require_src = __commonJS({
795
- "node_modules/debug/src/index.js"(exports$1, module) {
796
- if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
797
- module.exports = require_browser();
798
- } else {
799
- module.exports = require_node();
800
- }
801
- }
802
- });
803
-
804
- // node_modules/module-details-from-path/index.js
805
- var require_module_details_from_path = __commonJS({
806
- "node_modules/module-details-from-path/index.js"(exports$1, module) {
807
- var sep2 = __require("path").sep;
808
- module.exports = function(file) {
809
- var segments = file.split(sep2);
810
- var index = segments.lastIndexOf("node_modules");
811
- if (index === -1) return;
812
- if (!segments[index + 1]) return;
813
- var scoped = segments[index + 1][0] === "@";
814
- var name = scoped ? segments[index + 1] + "/" + segments[index + 2] : segments[index + 1];
815
- var offset = scoped ? 3 : 2;
816
- var basedir = "";
817
- var lastBaseDirSegmentIndex = index + offset - 1;
818
- for (var i = 0; i <= lastBaseDirSegmentIndex; i++) {
819
- if (i === lastBaseDirSegmentIndex) {
820
- basedir += segments[i];
821
- } else {
822
- basedir += segments[i] + sep2;
823
- }
824
- }
825
- var path3 = "";
826
- var lastSegmentIndex = segments.length - 1;
827
- for (var i2 = index + offset; i2 <= lastSegmentIndex; i2++) {
828
- if (i2 === lastSegmentIndex) {
829
- path3 += segments[i2];
830
- } else {
831
- path3 += segments[i2] + sep2;
832
- }
833
- }
834
- return {
835
- name,
836
- basedir,
837
- path: path3
838
- };
839
- };
840
- }
841
- });
842
-
843
- // node_modules/resolve/lib/homedir.js
844
- var require_homedir = __commonJS({
845
- "node_modules/resolve/lib/homedir.js"(exports$1, module) {
846
- var os2 = __require("os");
847
- module.exports = os2.homedir || function homedir() {
848
- var home = process.env.HOME;
849
- var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
850
- if (process.platform === "win32") {
851
- return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
852
- }
853
- if (process.platform === "darwin") {
854
- return home || (user ? "/Users/" + user : null);
855
- }
856
- if (process.platform === "linux") {
857
- return home || (process.getuid() === 0 ? "/root" : user ? "/home/" + user : null);
858
- }
859
- return home || null;
860
- };
861
- }
862
- });
863
-
864
- // node_modules/resolve/lib/caller.js
865
- var require_caller = __commonJS({
866
- "node_modules/resolve/lib/caller.js"(exports$1, module) {
867
- module.exports = function() {
868
- var origPrepareStackTrace = Error.prepareStackTrace;
869
- Error.prepareStackTrace = function(_, stack2) {
870
- return stack2;
871
- };
872
- var stack = new Error().stack;
873
- Error.prepareStackTrace = origPrepareStackTrace;
874
- return stack[2].getFileName();
875
- };
876
- }
877
- });
878
-
879
- // node_modules/path-parse/index.js
880
- var require_path_parse = __commonJS({
881
- "node_modules/path-parse/index.js"(exports$1, module) {
882
- var isWindows = process.platform === "win32";
883
- var splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
884
- var win32 = {};
885
- function win32SplitPath(filename) {
886
- return splitWindowsRe.exec(filename).slice(1);
887
- }
888
- win32.parse = function(pathString) {
889
- if (typeof pathString !== "string") {
890
- throw new TypeError(
891
- "Parameter 'pathString' must be a string, not " + typeof pathString
892
- );
893
- }
894
- var allParts = win32SplitPath(pathString);
895
- if (!allParts || allParts.length !== 5) {
896
- throw new TypeError("Invalid path '" + pathString + "'");
897
- }
898
- return {
899
- root: allParts[1],
900
- dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
901
- base: allParts[2],
902
- ext: allParts[4],
903
- name: allParts[3]
904
- };
905
- };
906
- var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
907
- var posix = {};
908
- function posixSplitPath(filename) {
909
- return splitPathRe.exec(filename).slice(1);
910
- }
911
- posix.parse = function(pathString) {
912
- if (typeof pathString !== "string") {
913
- throw new TypeError(
914
- "Parameter 'pathString' must be a string, not " + typeof pathString
915
- );
916
- }
917
- var allParts = posixSplitPath(pathString);
918
- if (!allParts || allParts.length !== 5) {
919
- throw new TypeError("Invalid path '" + pathString + "'");
920
- }
921
- return {
922
- root: allParts[1],
923
- dir: allParts[0].slice(0, -1),
924
- base: allParts[2],
925
- ext: allParts[4],
926
- name: allParts[3]
927
- };
928
- };
929
- if (isWindows)
930
- module.exports = win32.parse;
931
- else
932
- module.exports = posix.parse;
933
- module.exports.posix = posix.parse;
934
- module.exports.win32 = win32.parse;
935
- }
936
- });
937
-
938
- // node_modules/resolve/lib/node-modules-paths.js
939
- var require_node_modules_paths = __commonJS({
940
- "node_modules/resolve/lib/node-modules-paths.js"(exports$1, module) {
941
- var path3 = __require("path");
942
- var parse2 = path3.parse || require_path_parse();
943
- var driveLetterRegex = /^([A-Za-z]:)/;
944
- var uncPathRegex = /^\\\\/;
945
- var getNodeModulesDirs = function getNodeModulesDirs2(absoluteStart, modules) {
946
- var prefix = "/";
947
- if (driveLetterRegex.test(absoluteStart)) {
948
- prefix = "";
949
- } else if (uncPathRegex.test(absoluteStart)) {
950
- prefix = "\\\\";
951
- }
952
- var paths = [absoluteStart];
953
- var parsed = parse2(absoluteStart);
954
- while (parsed.dir !== paths[paths.length - 1]) {
955
- paths.push(parsed.dir);
956
- parsed = parse2(parsed.dir);
957
- }
958
- return paths.reduce(function(dirs, aPath) {
959
- return dirs.concat(modules.map(function(moduleDir) {
960
- return path3.resolve(prefix, aPath, moduleDir);
961
- }));
962
- }, []);
963
- };
964
- module.exports = function nodeModulesPaths(start, opts, request) {
965
- var modules = opts && opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ["node_modules"];
966
- if (opts && typeof opts.paths === "function") {
967
- return opts.paths(
968
- request,
969
- start,
970
- function() {
971
- return getNodeModulesDirs(start, modules);
972
- },
973
- opts
974
- );
975
- }
976
- var dirs = getNodeModulesDirs(start, modules);
977
- return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
978
- };
979
- }
980
- });
981
-
982
- // node_modules/resolve/lib/normalize-options.js
983
- var require_normalize_options = __commonJS({
984
- "node_modules/resolve/lib/normalize-options.js"(exports$1, module) {
985
- module.exports = function(x, opts) {
986
- return opts || {};
987
- };
988
- }
989
- });
990
-
991
- // node_modules/function-bind/implementation.js
992
- var require_implementation = __commonJS({
993
- "node_modules/function-bind/implementation.js"(exports$1, module) {
994
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
995
- var toStr = Object.prototype.toString;
996
- var max = Math.max;
997
- var funcType = "[object Function]";
998
- var concatty = function concatty2(a, b) {
999
- var arr = [];
1000
- for (var i = 0; i < a.length; i += 1) {
1001
- arr[i] = a[i];
1002
- }
1003
- for (var j = 0; j < b.length; j += 1) {
1004
- arr[j + a.length] = b[j];
1005
- }
1006
- return arr;
1007
- };
1008
- var slicy = function slicy2(arrLike, offset) {
1009
- var arr = [];
1010
- for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
1011
- arr[j] = arrLike[i];
1012
- }
1013
- return arr;
1014
- };
1015
- var joiny = function(arr, joiner) {
1016
- var str = "";
1017
- for (var i = 0; i < arr.length; i += 1) {
1018
- str += arr[i];
1019
- if (i + 1 < arr.length) {
1020
- str += joiner;
1021
- }
1022
- }
1023
- return str;
1024
- };
1025
- module.exports = function bind(that) {
1026
- var target = this;
1027
- if (typeof target !== "function" || toStr.apply(target) !== funcType) {
1028
- throw new TypeError(ERROR_MESSAGE + target);
1029
- }
1030
- var args = slicy(arguments, 1);
1031
- var bound;
1032
- var binder = function() {
1033
- if (this instanceof bound) {
1034
- var result = target.apply(
1035
- this,
1036
- concatty(args, arguments)
1037
- );
1038
- if (Object(result) === result) {
1039
- return result;
1040
- }
1041
- return this;
1042
- }
1043
- return target.apply(
1044
- that,
1045
- concatty(args, arguments)
1046
- );
1047
- };
1048
- var boundLength = max(0, target.length - args.length);
1049
- var boundArgs = [];
1050
- for (var i = 0; i < boundLength; i++) {
1051
- boundArgs[i] = "$" + i;
1052
- }
1053
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
1054
- if (target.prototype) {
1055
- var Empty = function Empty2() {
1056
- };
1057
- Empty.prototype = target.prototype;
1058
- bound.prototype = new Empty();
1059
- Empty.prototype = null;
1060
- }
1061
- return bound;
1062
- };
1063
- }
1064
- });
1065
-
1066
- // node_modules/function-bind/index.js
1067
- var require_function_bind = __commonJS({
1068
- "node_modules/function-bind/index.js"(exports$1, module) {
1069
- var implementation = require_implementation();
1070
- module.exports = Function.prototype.bind || implementation;
1071
- }
1072
- });
1073
-
1074
- // node_modules/hasown/index.js
1075
- var require_hasown = __commonJS({
1076
- "node_modules/hasown/index.js"(exports$1, module) {
1077
- var call = Function.prototype.call;
1078
- var $hasOwn = Object.prototype.hasOwnProperty;
1079
- var bind = require_function_bind();
1080
- module.exports = bind.call(call, $hasOwn);
1081
- }
1082
- });
1083
-
1084
- // node_modules/is-core-module/core.json
1085
- var require_core = __commonJS({
1086
- "node_modules/is-core-module/core.json"(exports$1, module) {
1087
- module.exports = {
1088
- assert: true,
1089
- "node:assert": [">= 14.18 && < 15", ">= 16"],
1090
- "assert/strict": ">= 15",
1091
- "node:assert/strict": ">= 16",
1092
- async_hooks: ">= 8",
1093
- "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
1094
- buffer_ieee754: ">= 0.5 && < 0.9.7",
1095
- buffer: true,
1096
- "node:buffer": [">= 14.18 && < 15", ">= 16"],
1097
- child_process: true,
1098
- "node:child_process": [">= 14.18 && < 15", ">= 16"],
1099
- cluster: ">= 0.5",
1100
- "node:cluster": [">= 14.18 && < 15", ">= 16"],
1101
- console: true,
1102
- "node:console": [">= 14.18 && < 15", ">= 16"],
1103
- constants: true,
1104
- "node:constants": [">= 14.18 && < 15", ">= 16"],
1105
- crypto: true,
1106
- "node:crypto": [">= 14.18 && < 15", ">= 16"],
1107
- _debug_agent: ">= 1 && < 8",
1108
- _debugger: "< 8",
1109
- dgram: true,
1110
- "node:dgram": [">= 14.18 && < 15", ">= 16"],
1111
- diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
1112
- "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
1113
- dns: true,
1114
- "node:dns": [">= 14.18 && < 15", ">= 16"],
1115
- "dns/promises": ">= 15",
1116
- "node:dns/promises": ">= 16",
1117
- domain: ">= 0.7.12",
1118
- "node:domain": [">= 14.18 && < 15", ">= 16"],
1119
- events: true,
1120
- "node:events": [">= 14.18 && < 15", ">= 16"],
1121
- freelist: "< 6",
1122
- fs: true,
1123
- "node:fs": [">= 14.18 && < 15", ">= 16"],
1124
- "fs/promises": [">= 10 && < 10.1", ">= 14"],
1125
- "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
1126
- _http_agent: ">= 0.11.1",
1127
- "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
1128
- _http_client: ">= 0.11.1",
1129
- "node:_http_client": [">= 14.18 && < 15", ">= 16"],
1130
- _http_common: ">= 0.11.1",
1131
- "node:_http_common": [">= 14.18 && < 15", ">= 16"],
1132
- _http_incoming: ">= 0.11.1",
1133
- "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
1134
- _http_outgoing: ">= 0.11.1",
1135
- "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
1136
- _http_server: ">= 0.11.1",
1137
- "node:_http_server": [">= 14.18 && < 15", ">= 16"],
1138
- http: true,
1139
- "node:http": [">= 14.18 && < 15", ">= 16"],
1140
- http2: ">= 8.8",
1141
- "node:http2": [">= 14.18 && < 15", ">= 16"],
1142
- https: true,
1143
- "node:https": [">= 14.18 && < 15", ">= 16"],
1144
- inspector: ">= 8",
1145
- "node:inspector": [">= 14.18 && < 15", ">= 16"],
1146
- "inspector/promises": [">= 19"],
1147
- "node:inspector/promises": [">= 19"],
1148
- _linklist: "< 8",
1149
- module: true,
1150
- "node:module": [">= 14.18 && < 15", ">= 16"],
1151
- net: true,
1152
- "node:net": [">= 14.18 && < 15", ">= 16"],
1153
- "node-inspect/lib/_inspect": ">= 7.6 && < 12",
1154
- "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
1155
- "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
1156
- os: true,
1157
- "node:os": [">= 14.18 && < 15", ">= 16"],
1158
- path: true,
1159
- "node:path": [">= 14.18 && < 15", ">= 16"],
1160
- "path/posix": ">= 15.3",
1161
- "node:path/posix": ">= 16",
1162
- "path/win32": ">= 15.3",
1163
- "node:path/win32": ">= 16",
1164
- perf_hooks: ">= 8.5",
1165
- "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
1166
- process: ">= 1",
1167
- "node:process": [">= 14.18 && < 15", ">= 16"],
1168
- punycode: ">= 0.5",
1169
- "node:punycode": [">= 14.18 && < 15", ">= 16"],
1170
- querystring: true,
1171
- "node:querystring": [">= 14.18 && < 15", ">= 16"],
1172
- readline: true,
1173
- "node:readline": [">= 14.18 && < 15", ">= 16"],
1174
- "readline/promises": ">= 17",
1175
- "node:readline/promises": ">= 17",
1176
- repl: true,
1177
- "node:repl": [">= 14.18 && < 15", ">= 16"],
1178
- "node:sea": [">= 20.12 && < 21", ">= 21.7"],
1179
- smalloc: ">= 0.11.5 && < 3",
1180
- "node:sqlite": [">= 22.13 && < 23", ">= 23.4"],
1181
- _stream_duplex: ">= 0.9.4",
1182
- "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
1183
- _stream_transform: ">= 0.9.4",
1184
- "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
1185
- _stream_wrap: ">= 1.4.1",
1186
- "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
1187
- _stream_passthrough: ">= 0.9.4",
1188
- "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
1189
- _stream_readable: ">= 0.9.4",
1190
- "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
1191
- _stream_writable: ">= 0.9.4",
1192
- "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
1193
- stream: true,
1194
- "node:stream": [">= 14.18 && < 15", ">= 16"],
1195
- "stream/consumers": ">= 16.7",
1196
- "node:stream/consumers": ">= 16.7",
1197
- "stream/promises": ">= 15",
1198
- "node:stream/promises": ">= 16",
1199
- "stream/web": ">= 16.5",
1200
- "node:stream/web": ">= 16.5",
1201
- string_decoder: true,
1202
- "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
1203
- sys: [">= 0.4 && < 0.7", ">= 0.8"],
1204
- "node:sys": [">= 14.18 && < 15", ">= 16"],
1205
- "test/reporters": ">= 19.9 && < 20.2",
1206
- "node:test/reporters": [">= 18.17 && < 19", ">= 19.9", ">= 20"],
1207
- "test/mock_loader": ">= 22.3 && < 22.7",
1208
- "node:test/mock_loader": ">= 22.3 && < 22.7",
1209
- "node:test": [">= 16.17 && < 17", ">= 18"],
1210
- timers: true,
1211
- "node:timers": [">= 14.18 && < 15", ">= 16"],
1212
- "timers/promises": ">= 15",
1213
- "node:timers/promises": ">= 16",
1214
- _tls_common: ">= 0.11.13",
1215
- "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
1216
- _tls_legacy: ">= 0.11.3 && < 10",
1217
- _tls_wrap: ">= 0.11.3",
1218
- "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
1219
- tls: true,
1220
- "node:tls": [">= 14.18 && < 15", ">= 16"],
1221
- trace_events: ">= 10",
1222
- "node:trace_events": [">= 14.18 && < 15", ">= 16"],
1223
- tty: true,
1224
- "node:tty": [">= 14.18 && < 15", ">= 16"],
1225
- url: true,
1226
- "node:url": [">= 14.18 && < 15", ">= 16"],
1227
- util: true,
1228
- "node:util": [">= 14.18 && < 15", ">= 16"],
1229
- "util/types": ">= 15.3",
1230
- "node:util/types": ">= 16",
1231
- "v8/tools/arguments": ">= 10 && < 12",
1232
- "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1233
- "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1234
- "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1235
- "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1236
- "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1237
- "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1238
- v8: ">= 1",
1239
- "node:v8": [">= 14.18 && < 15", ">= 16"],
1240
- vm: true,
1241
- "node:vm": [">= 14.18 && < 15", ">= 16"],
1242
- wasi: [">= 13.4 && < 13.5", ">= 18.17 && < 19", ">= 20"],
1243
- "node:wasi": [">= 18.17 && < 19", ">= 20"],
1244
- worker_threads: ">= 11.7",
1245
- "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
1246
- zlib: ">= 0.5",
1247
- "node:zlib": [">= 14.18 && < 15", ">= 16"]
1248
- };
1249
- }
1250
- });
1251
-
1252
- // node_modules/is-core-module/index.js
1253
- var require_is_core_module = __commonJS({
1254
- "node_modules/is-core-module/index.js"(exports$1, module) {
1255
- var hasOwn = require_hasown();
1256
- function specifierIncluded(current, specifier) {
1257
- var nodeParts = current.split(".");
1258
- var parts = specifier.split(" ");
1259
- var op = parts.length > 1 ? parts[0] : "=";
1260
- var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
1261
- for (var i = 0; i < 3; ++i) {
1262
- var cur = parseInt(nodeParts[i] || 0, 10);
1263
- var ver = parseInt(versionParts[i] || 0, 10);
1264
- if (cur === ver) {
1265
- continue;
1266
- }
1267
- if (op === "<") {
1268
- return cur < ver;
1269
- }
1270
- if (op === ">=") {
1271
- return cur >= ver;
1272
- }
1273
- return false;
1274
- }
1275
- return op === ">=";
1276
- }
1277
- function matchesRange(current, range) {
1278
- var specifiers = range.split(/ ?&& ?/);
1279
- if (specifiers.length === 0) {
1280
- return false;
1281
- }
1282
- for (var i = 0; i < specifiers.length; ++i) {
1283
- if (!specifierIncluded(current, specifiers[i])) {
1284
- return false;
1285
- }
1286
- }
1287
- return true;
1288
- }
1289
- function versionIncluded(nodeVersion, specifierValue) {
1290
- if (typeof specifierValue === "boolean") {
1291
- return specifierValue;
1292
- }
1293
- var current = typeof nodeVersion === "undefined" ? process.versions && process.versions.node : nodeVersion;
1294
- if (typeof current !== "string") {
1295
- throw new TypeError(typeof nodeVersion === "undefined" ? "Unable to determine current node version" : "If provided, a valid node version is required");
1296
- }
1297
- if (specifierValue && typeof specifierValue === "object") {
1298
- for (var i = 0; i < specifierValue.length; ++i) {
1299
- if (matchesRange(current, specifierValue[i])) {
1300
- return true;
1301
- }
1302
- }
1303
- return false;
1304
- }
1305
- return matchesRange(current, specifierValue);
1306
- }
1307
- var data = require_core();
1308
- module.exports = function isCore(x, nodeVersion) {
1309
- return hasOwn(data, x) && versionIncluded(nodeVersion, data[x]);
1310
- };
1311
- }
1312
- });
1313
-
1314
- // node_modules/resolve/lib/async.js
1315
- var require_async = __commonJS({
1316
- "node_modules/resolve/lib/async.js"(exports$1, module) {
1317
- var fs = __require("fs");
1318
- var getHomedir = require_homedir();
1319
- var path3 = __require("path");
1320
- var caller = require_caller();
1321
- var nodeModulesPaths = require_node_modules_paths();
1322
- var normalizeOptions = require_normalize_options();
1323
- var isCore = require_is_core_module();
1324
- var realpathFS = process.platform !== "win32" && fs.realpath && typeof fs.realpath.native === "function" ? fs.realpath.native : fs.realpath;
1325
- var relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/;
1326
- var windowsDriveRegex = /^\w:[/\\]*$/;
1327
- var nodeModulesRegex = /[/\\]node_modules[/\\]*$/;
1328
- var homedir = getHomedir();
1329
- var defaultPaths = function() {
1330
- return [
1331
- path3.join(homedir, ".node_modules"),
1332
- path3.join(homedir, ".node_libraries")
1333
- ];
1334
- };
1335
- var defaultIsFile = function isFile(file, cb) {
1336
- fs.stat(file, function(err, stat) {
1337
- if (!err) {
1338
- return cb(null, stat.isFile() || stat.isFIFO());
1339
- }
1340
- if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb(null, false);
1341
- return cb(err);
1342
- });
1343
- };
1344
- var defaultIsDir = function isDirectory(dir, cb) {
1345
- fs.stat(dir, function(err, stat) {
1346
- if (!err) {
1347
- return cb(null, stat.isDirectory());
1348
- }
1349
- if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb(null, false);
1350
- return cb(err);
1351
- });
1352
- };
1353
- var defaultRealpath = function realpath(x, cb) {
1354
- realpathFS(x, function(realpathErr, realPath) {
1355
- if (realpathErr && realpathErr.code !== "ENOENT") cb(realpathErr);
1356
- else cb(null, realpathErr ? x : realPath);
1357
- });
1358
- };
1359
- var maybeRealpath = function maybeRealpath2(realpath, x, opts, cb) {
1360
- if (opts && opts.preserveSymlinks === false) {
1361
- realpath(x, cb);
1362
- } else {
1363
- cb(null, x);
1364
- }
1365
- };
1366
- var defaultReadPackage = function defaultReadPackage2(readFile, pkgfile, cb) {
1367
- readFile(pkgfile, function(readFileErr, body) {
1368
- if (readFileErr) cb(readFileErr);
1369
- else {
1370
- try {
1371
- var pkg = JSON.parse(body);
1372
- cb(null, pkg);
1373
- } catch (jsonErr) {
1374
- cb(null);
1375
- }
1376
- }
1377
- });
1378
- };
1379
- var getPackageCandidates = function getPackageCandidates2(x, start, opts) {
1380
- var dirs = nodeModulesPaths(start, opts, x);
1381
- for (var i = 0; i < dirs.length; i++) {
1382
- dirs[i] = path3.join(dirs[i], x);
1383
- }
1384
- return dirs;
1385
- };
1386
- module.exports = function resolve(x, options, callback) {
1387
- var cb = callback;
1388
- var opts = options;
1389
- if (typeof options === "function") {
1390
- cb = opts;
1391
- opts = {};
1392
- }
1393
- if (typeof x !== "string") {
1394
- var err = new TypeError("Path must be a string.");
1395
- return process.nextTick(function() {
1396
- cb(err);
1397
- });
1398
- }
1399
- opts = normalizeOptions(x, opts);
1400
- var isFile = opts.isFile || defaultIsFile;
1401
- var isDirectory = opts.isDirectory || defaultIsDir;
1402
- var readFile = opts.readFile || fs.readFile;
1403
- var realpath = opts.realpath || defaultRealpath;
1404
- var readPackage = opts.readPackage || defaultReadPackage;
1405
- if (opts.readFile && opts.readPackage) {
1406
- var conflictErr = new TypeError("`readFile` and `readPackage` are mutually exclusive.");
1407
- return process.nextTick(function() {
1408
- cb(conflictErr);
1409
- });
1410
- }
1411
- var packageIterator = opts.packageIterator;
1412
- var extensions = opts.extensions || [".js"];
1413
- var includeCoreModules = opts.includeCoreModules !== false;
1414
- var basedir = opts.basedir || path3.dirname(caller());
1415
- var parent = opts.filename || basedir;
1416
- opts.paths = opts.paths || defaultPaths();
1417
- var absoluteStart = path3.resolve(basedir);
1418
- maybeRealpath(
1419
- realpath,
1420
- absoluteStart,
1421
- opts,
1422
- function(err2, realStart) {
1423
- if (err2) cb(err2);
1424
- else init(realStart);
1425
- }
1426
- );
1427
- var res;
1428
- function init(basedir2) {
1429
- if (relativePathRegex.test(x)) {
1430
- res = path3.resolve(basedir2, x);
1431
- if (x === "." || x === ".." || x.slice(-1) === "/") res += "/";
1432
- if (x.slice(-1) === "/" && res === basedir2) {
1433
- loadAsDirectory(res, opts.package, onfile);
1434
- } else loadAsFile(res, opts.package, onfile);
1435
- } else if (includeCoreModules && isCore(x)) {
1436
- return cb(null, x);
1437
- } else loadNodeModules(x, basedir2, function(err2, n, pkg) {
1438
- if (err2) cb(err2);
1439
- else if (n) {
1440
- return maybeRealpath(realpath, n, opts, function(err3, realN) {
1441
- if (err3) {
1442
- cb(err3);
1443
- } else {
1444
- cb(null, realN, pkg);
1445
- }
1446
- });
1447
- } else {
1448
- var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
1449
- moduleError.code = "MODULE_NOT_FOUND";
1450
- cb(moduleError);
1451
- }
1452
- });
1453
- }
1454
- function onfile(err2, m, pkg) {
1455
- if (err2) cb(err2);
1456
- else if (m) cb(null, m, pkg);
1457
- else loadAsDirectory(res, function(err3, d, pkg2) {
1458
- if (err3) cb(err3);
1459
- else if (d) {
1460
- maybeRealpath(realpath, d, opts, function(err4, realD) {
1461
- if (err4) {
1462
- cb(err4);
1463
- } else {
1464
- cb(null, realD, pkg2);
1465
- }
1466
- });
1467
- } else {
1468
- var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
1469
- moduleError.code = "MODULE_NOT_FOUND";
1470
- cb(moduleError);
1471
- }
1472
- });
1473
- }
1474
- function loadAsFile(x2, thePackage, callback2) {
1475
- var loadAsFilePackage = thePackage;
1476
- var cb2 = callback2;
1477
- if (typeof loadAsFilePackage === "function") {
1478
- cb2 = loadAsFilePackage;
1479
- loadAsFilePackage = void 0;
1480
- }
1481
- var exts = [""].concat(extensions);
1482
- load(exts, x2, loadAsFilePackage);
1483
- function load(exts2, x3, loadPackage) {
1484
- if (exts2.length === 0) return cb2(null, void 0, loadPackage);
1485
- var file = x3 + exts2[0];
1486
- var pkg = loadPackage;
1487
- if (pkg) onpkg(null, pkg);
1488
- else loadpkg(path3.dirname(file), onpkg);
1489
- function onpkg(err2, pkg_, dir) {
1490
- pkg = pkg_;
1491
- if (err2) return cb2(err2);
1492
- if (dir && pkg && opts.pathFilter) {
1493
- var rfile = path3.relative(dir, file);
1494
- var rel = rfile.slice(0, rfile.length - exts2[0].length);
1495
- var r = opts.pathFilter(pkg, x3, rel);
1496
- if (r) return load(
1497
- [""].concat(extensions.slice()),
1498
- path3.resolve(dir, r),
1499
- pkg
1500
- );
1501
- }
1502
- isFile(file, onex);
1503
- }
1504
- function onex(err2, ex) {
1505
- if (err2) return cb2(err2);
1506
- if (ex) return cb2(null, file, pkg);
1507
- load(exts2.slice(1), x3, pkg);
1508
- }
1509
- }
1510
- }
1511
- function loadpkg(dir, cb2) {
1512
- if (dir === "" || dir === "/") return cb2(null);
1513
- if (process.platform === "win32" && windowsDriveRegex.test(dir)) {
1514
- return cb2(null);
1515
- }
1516
- if (nodeModulesRegex.test(dir)) return cb2(null);
1517
- maybeRealpath(realpath, dir, opts, function(unwrapErr, pkgdir) {
1518
- if (unwrapErr) return loadpkg(path3.dirname(dir), cb2);
1519
- var pkgfile = path3.join(pkgdir, "package.json");
1520
- isFile(pkgfile, function(err2, ex) {
1521
- if (!ex) return loadpkg(path3.dirname(dir), cb2);
1522
- readPackage(readFile, pkgfile, function(err3, pkgParam) {
1523
- if (err3) cb2(err3);
1524
- var pkg = pkgParam;
1525
- if (pkg && opts.packageFilter) {
1526
- pkg = opts.packageFilter(pkg, pkgfile);
1527
- }
1528
- cb2(null, pkg, dir);
1529
- });
1530
- });
1531
- });
1532
- }
1533
- function loadAsDirectory(x2, loadAsDirectoryPackage, callback2) {
1534
- var cb2 = callback2;
1535
- var fpkg = loadAsDirectoryPackage;
1536
- if (typeof fpkg === "function") {
1537
- cb2 = fpkg;
1538
- fpkg = opts.package;
1539
- }
1540
- maybeRealpath(realpath, x2, opts, function(unwrapErr, pkgdir) {
1541
- if (unwrapErr) return cb2(unwrapErr);
1542
- var pkgfile = path3.join(pkgdir, "package.json");
1543
- isFile(pkgfile, function(err2, ex) {
1544
- if (err2) return cb2(err2);
1545
- if (!ex) return loadAsFile(path3.join(x2, "index"), fpkg, cb2);
1546
- readPackage(readFile, pkgfile, function(err3, pkgParam) {
1547
- if (err3) return cb2(err3);
1548
- var pkg = pkgParam;
1549
- if (pkg && opts.packageFilter) {
1550
- pkg = opts.packageFilter(pkg, pkgfile);
1551
- }
1552
- if (pkg && pkg.main) {
1553
- if (typeof pkg.main !== "string") {
1554
- var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
1555
- mainError.code = "INVALID_PACKAGE_MAIN";
1556
- return cb2(mainError);
1557
- }
1558
- if (pkg.main === "." || pkg.main === "./") {
1559
- pkg.main = "index";
1560
- }
1561
- loadAsFile(path3.resolve(x2, pkg.main), pkg, function(err4, m, pkg2) {
1562
- if (err4) return cb2(err4);
1563
- if (m) return cb2(null, m, pkg2);
1564
- if (!pkg2) return loadAsFile(path3.join(x2, "index"), pkg2, cb2);
1565
- var dir = path3.resolve(x2, pkg2.main);
1566
- loadAsDirectory(dir, pkg2, function(err5, n, pkg3) {
1567
- if (err5) return cb2(err5);
1568
- if (n) return cb2(null, n, pkg3);
1569
- loadAsFile(path3.join(x2, "index"), pkg3, cb2);
1570
- });
1571
- });
1572
- return;
1573
- }
1574
- loadAsFile(path3.join(x2, "/index"), pkg, cb2);
1575
- });
1576
- });
1577
- });
1578
- }
1579
- function processDirs(cb2, dirs) {
1580
- if (dirs.length === 0) return cb2(null, void 0);
1581
- var dir = dirs[0];
1582
- isDirectory(path3.dirname(dir), isdir);
1583
- function isdir(err2, isdir2) {
1584
- if (err2) return cb2(err2);
1585
- if (!isdir2) return processDirs(cb2, dirs.slice(1));
1586
- loadAsFile(dir, opts.package, onfile2);
1587
- }
1588
- function onfile2(err2, m, pkg) {
1589
- if (err2) return cb2(err2);
1590
- if (m) return cb2(null, m, pkg);
1591
- loadAsDirectory(dir, opts.package, ondir);
1592
- }
1593
- function ondir(err2, n, pkg) {
1594
- if (err2) return cb2(err2);
1595
- if (n) return cb2(null, n, pkg);
1596
- processDirs(cb2, dirs.slice(1));
1597
- }
1598
- }
1599
- function loadNodeModules(x2, start, cb2) {
1600
- var thunk = function() {
1601
- return getPackageCandidates(x2, start, opts);
1602
- };
1603
- processDirs(
1604
- cb2,
1605
- packageIterator ? packageIterator(x2, start, thunk, opts) : thunk()
1606
- );
1607
- }
1608
- };
1609
- }
1610
- });
1611
-
1612
- // node_modules/resolve/lib/core.json
1613
- var require_core2 = __commonJS({
1614
- "node_modules/resolve/lib/core.json"(exports$1, module) {
1615
- module.exports = {
1616
- assert: true,
1617
- "node:assert": [">= 14.18 && < 15", ">= 16"],
1618
- "assert/strict": ">= 15",
1619
- "node:assert/strict": ">= 16",
1620
- async_hooks: ">= 8",
1621
- "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
1622
- buffer_ieee754: ">= 0.5 && < 0.9.7",
1623
- buffer: true,
1624
- "node:buffer": [">= 14.18 && < 15", ">= 16"],
1625
- child_process: true,
1626
- "node:child_process": [">= 14.18 && < 15", ">= 16"],
1627
- cluster: ">= 0.5",
1628
- "node:cluster": [">= 14.18 && < 15", ">= 16"],
1629
- console: true,
1630
- "node:console": [">= 14.18 && < 15", ">= 16"],
1631
- constants: true,
1632
- "node:constants": [">= 14.18 && < 15", ">= 16"],
1633
- crypto: true,
1634
- "node:crypto": [">= 14.18 && < 15", ">= 16"],
1635
- _debug_agent: ">= 1 && < 8",
1636
- _debugger: "< 8",
1637
- dgram: true,
1638
- "node:dgram": [">= 14.18 && < 15", ">= 16"],
1639
- diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
1640
- "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
1641
- dns: true,
1642
- "node:dns": [">= 14.18 && < 15", ">= 16"],
1643
- "dns/promises": ">= 15",
1644
- "node:dns/promises": ">= 16",
1645
- domain: ">= 0.7.12",
1646
- "node:domain": [">= 14.18 && < 15", ">= 16"],
1647
- events: true,
1648
- "node:events": [">= 14.18 && < 15", ">= 16"],
1649
- freelist: "< 6",
1650
- fs: true,
1651
- "node:fs": [">= 14.18 && < 15", ">= 16"],
1652
- "fs/promises": [">= 10 && < 10.1", ">= 14"],
1653
- "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
1654
- _http_agent: ">= 0.11.1",
1655
- "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
1656
- _http_client: ">= 0.11.1",
1657
- "node:_http_client": [">= 14.18 && < 15", ">= 16"],
1658
- _http_common: ">= 0.11.1",
1659
- "node:_http_common": [">= 14.18 && < 15", ">= 16"],
1660
- _http_incoming: ">= 0.11.1",
1661
- "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
1662
- _http_outgoing: ">= 0.11.1",
1663
- "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
1664
- _http_server: ">= 0.11.1",
1665
- "node:_http_server": [">= 14.18 && < 15", ">= 16"],
1666
- http: true,
1667
- "node:http": [">= 14.18 && < 15", ">= 16"],
1668
- http2: ">= 8.8",
1669
- "node:http2": [">= 14.18 && < 15", ">= 16"],
1670
- https: true,
1671
- "node:https": [">= 14.18 && < 15", ">= 16"],
1672
- inspector: ">= 8",
1673
- "node:inspector": [">= 14.18 && < 15", ">= 16"],
1674
- "inspector/promises": [">= 19"],
1675
- "node:inspector/promises": [">= 19"],
1676
- _linklist: "< 8",
1677
- module: true,
1678
- "node:module": [">= 14.18 && < 15", ">= 16"],
1679
- net: true,
1680
- "node:net": [">= 14.18 && < 15", ">= 16"],
1681
- "node-inspect/lib/_inspect": ">= 7.6 && < 12",
1682
- "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
1683
- "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
1684
- os: true,
1685
- "node:os": [">= 14.18 && < 15", ">= 16"],
1686
- path: true,
1687
- "node:path": [">= 14.18 && < 15", ">= 16"],
1688
- "path/posix": ">= 15.3",
1689
- "node:path/posix": ">= 16",
1690
- "path/win32": ">= 15.3",
1691
- "node:path/win32": ">= 16",
1692
- perf_hooks: ">= 8.5",
1693
- "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
1694
- process: ">= 1",
1695
- "node:process": [">= 14.18 && < 15", ">= 16"],
1696
- punycode: ">= 0.5",
1697
- "node:punycode": [">= 14.18 && < 15", ">= 16"],
1698
- querystring: true,
1699
- "node:querystring": [">= 14.18 && < 15", ">= 16"],
1700
- readline: true,
1701
- "node:readline": [">= 14.18 && < 15", ">= 16"],
1702
- "readline/promises": ">= 17",
1703
- "node:readline/promises": ">= 17",
1704
- repl: true,
1705
- "node:repl": [">= 14.18 && < 15", ">= 16"],
1706
- "node:sea": [">= 20.12 && < 21", ">= 21.7"],
1707
- smalloc: ">= 0.11.5 && < 3",
1708
- "node:sqlite": [">= 22.13 && < 23", ">= 23.4"],
1709
- _stream_duplex: ">= 0.9.4",
1710
- "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
1711
- _stream_transform: ">= 0.9.4",
1712
- "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
1713
- _stream_wrap: ">= 1.4.1",
1714
- "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
1715
- _stream_passthrough: ">= 0.9.4",
1716
- "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
1717
- _stream_readable: ">= 0.9.4",
1718
- "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
1719
- _stream_writable: ">= 0.9.4",
1720
- "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
1721
- stream: true,
1722
- "node:stream": [">= 14.18 && < 15", ">= 16"],
1723
- "stream/consumers": ">= 16.7",
1724
- "node:stream/consumers": ">= 16.7",
1725
- "stream/promises": ">= 15",
1726
- "node:stream/promises": ">= 16",
1727
- "stream/web": ">= 16.5",
1728
- "node:stream/web": ">= 16.5",
1729
- string_decoder: true,
1730
- "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
1731
- sys: [">= 0.4 && < 0.7", ">= 0.8"],
1732
- "node:sys": [">= 14.18 && < 15", ">= 16"],
1733
- "test/reporters": ">= 19.9 && < 20.2",
1734
- "node:test/reporters": [">= 18.17 && < 19", ">= 19.9", ">= 20"],
1735
- "test/mock_loader": ">= 22.3 && < 22.7",
1736
- "node:test/mock_loader": ">= 22.3 && < 22.7",
1737
- "node:test": [">= 16.17 && < 17", ">= 18"],
1738
- timers: true,
1739
- "node:timers": [">= 14.18 && < 15", ">= 16"],
1740
- "timers/promises": ">= 15",
1741
- "node:timers/promises": ">= 16",
1742
- _tls_common: ">= 0.11.13",
1743
- "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
1744
- _tls_legacy: ">= 0.11.3 && < 10",
1745
- _tls_wrap: ">= 0.11.3",
1746
- "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
1747
- tls: true,
1748
- "node:tls": [">= 14.18 && < 15", ">= 16"],
1749
- trace_events: ">= 10",
1750
- "node:trace_events": [">= 14.18 && < 15", ">= 16"],
1751
- tty: true,
1752
- "node:tty": [">= 14.18 && < 15", ">= 16"],
1753
- url: true,
1754
- "node:url": [">= 14.18 && < 15", ">= 16"],
1755
- util: true,
1756
- "node:util": [">= 14.18 && < 15", ">= 16"],
1757
- "util/types": ">= 15.3",
1758
- "node:util/types": ">= 16",
1759
- "v8/tools/arguments": ">= 10 && < 12",
1760
- "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1761
- "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1762
- "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1763
- "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1764
- "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1765
- "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
1766
- v8: ">= 1",
1767
- "node:v8": [">= 14.18 && < 15", ">= 16"],
1768
- vm: true,
1769
- "node:vm": [">= 14.18 && < 15", ">= 16"],
1770
- wasi: [">= 13.4 && < 13.5", ">= 18.17 && < 19", ">= 20"],
1771
- "node:wasi": [">= 18.17 && < 19", ">= 20"],
1772
- worker_threads: ">= 11.7",
1773
- "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
1774
- zlib: ">= 0.5",
1775
- "node:zlib": [">= 14.18 && < 15", ">= 16"]
1776
- };
1777
- }
1778
- });
1779
-
1780
- // node_modules/resolve/lib/core.js
1781
- var require_core3 = __commonJS({
1782
- "node_modules/resolve/lib/core.js"(exports$1, module) {
1783
- var isCoreModule = require_is_core_module();
1784
- var data = require_core2();
1785
- var core = {};
1786
- for (mod in data) {
1787
- if (Object.prototype.hasOwnProperty.call(data, mod)) {
1788
- core[mod] = isCoreModule(mod);
1789
- }
1790
- }
1791
- var mod;
1792
- module.exports = core;
1793
- }
1794
- });
1795
-
1796
- // node_modules/resolve/lib/is-core.js
1797
- var require_is_core = __commonJS({
1798
- "node_modules/resolve/lib/is-core.js"(exports$1, module) {
1799
- var isCoreModule = require_is_core_module();
1800
- module.exports = function isCore(x) {
1801
- return isCoreModule(x);
1802
- };
1803
- }
1804
- });
1805
-
1806
- // node_modules/resolve/lib/sync.js
1807
- var require_sync = __commonJS({
1808
- "node_modules/resolve/lib/sync.js"(exports$1, module) {
1809
- var isCore = require_is_core_module();
1810
- var fs = __require("fs");
1811
- var path3 = __require("path");
1812
- var getHomedir = require_homedir();
1813
- var caller = require_caller();
1814
- var nodeModulesPaths = require_node_modules_paths();
1815
- var normalizeOptions = require_normalize_options();
1816
- var realpathFS = process.platform !== "win32" && fs.realpathSync && typeof fs.realpathSync.native === "function" ? fs.realpathSync.native : fs.realpathSync;
1817
- var relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/;
1818
- var windowsDriveRegex = /^\w:[/\\]*$/;
1819
- var nodeModulesRegex = /[/\\]node_modules[/\\]*$/;
1820
- var homedir = getHomedir();
1821
- var defaultPaths = function() {
1822
- return [
1823
- path3.join(homedir, ".node_modules"),
1824
- path3.join(homedir, ".node_libraries")
1825
- ];
1826
- };
1827
- var defaultIsFile = function isFile(file) {
1828
- try {
1829
- var stat = fs.statSync(file, { throwIfNoEntry: false });
1830
- } catch (e) {
1831
- if (e && (e.code === "ENOENT" || e.code === "ENOTDIR")) return false;
1832
- throw e;
1833
- }
1834
- return !!stat && (stat.isFile() || stat.isFIFO());
1835
- };
1836
- var defaultIsDir = function isDirectory(dir) {
1837
- try {
1838
- var stat = fs.statSync(dir, { throwIfNoEntry: false });
1839
- } catch (e) {
1840
- if (e && (e.code === "ENOENT" || e.code === "ENOTDIR")) return false;
1841
- throw e;
1842
- }
1843
- return !!stat && stat.isDirectory();
1844
- };
1845
- var defaultRealpathSync = function realpathSync(x) {
1846
- try {
1847
- return realpathFS(x);
1848
- } catch (realpathErr) {
1849
- if (realpathErr.code !== "ENOENT") {
1850
- throw realpathErr;
1851
- }
1852
- }
1853
- return x;
1854
- };
1855
- var maybeRealpathSync = function maybeRealpathSync2(realpathSync, x, opts) {
1856
- if (opts && opts.preserveSymlinks === false) {
1857
- return realpathSync(x);
1858
- }
1859
- return x;
1860
- };
1861
- var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync2, pkgfile) {
1862
- var body = readFileSync2(pkgfile);
1863
- try {
1864
- var pkg = JSON.parse(body);
1865
- return pkg;
1866
- } catch (jsonErr) {
1867
- }
1868
- };
1869
- var getPackageCandidates = function getPackageCandidates2(x, start, opts) {
1870
- var dirs = nodeModulesPaths(start, opts, x);
1871
- for (var i = 0; i < dirs.length; i++) {
1872
- dirs[i] = path3.join(dirs[i], x);
1873
- }
1874
- return dirs;
1875
- };
1876
- module.exports = function resolveSync(x, options) {
1877
- if (typeof x !== "string") {
1878
- throw new TypeError("Path must be a string.");
1879
- }
1880
- var opts = normalizeOptions(x, options);
1881
- var isFile = opts.isFile || defaultIsFile;
1882
- var readFileSync2 = opts.readFileSync || fs.readFileSync;
1883
- var isDirectory = opts.isDirectory || defaultIsDir;
1884
- var realpathSync = opts.realpathSync || defaultRealpathSync;
1885
- var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
1886
- if (opts.readFileSync && opts.readPackageSync) {
1887
- throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
1888
- }
1889
- var packageIterator = opts.packageIterator;
1890
- var extensions = opts.extensions || [".js"];
1891
- var includeCoreModules = opts.includeCoreModules !== false;
1892
- var basedir = opts.basedir || path3.dirname(caller());
1893
- var parent = opts.filename || basedir;
1894
- opts.paths = opts.paths || defaultPaths();
1895
- var absoluteStart = maybeRealpathSync(realpathSync, path3.resolve(basedir), opts);
1896
- if (relativePathRegex.test(x)) {
1897
- var res = path3.resolve(absoluteStart, x);
1898
- if (x === "." || x === ".." || x.slice(-1) === "/") res += "/";
1899
- var m = loadAsFileSync(res) || loadAsDirectorySync(res);
1900
- if (m) return maybeRealpathSync(realpathSync, m, opts);
1901
- } else if (includeCoreModules && isCore(x)) {
1902
- return x;
1903
- } else {
1904
- var n = loadNodeModulesSync(x, absoluteStart);
1905
- if (n) return maybeRealpathSync(realpathSync, n, opts);
1906
- }
1907
- var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
1908
- err.code = "MODULE_NOT_FOUND";
1909
- throw err;
1910
- function loadAsFileSync(x2) {
1911
- var pkg = loadpkg(path3.dirname(x2));
1912
- if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
1913
- var rfile = path3.relative(pkg.dir, x2);
1914
- var r = opts.pathFilter(pkg.pkg, x2, rfile);
1915
- if (r) {
1916
- x2 = path3.resolve(pkg.dir, r);
1917
- }
1918
- }
1919
- if (isFile(x2)) {
1920
- return x2;
1921
- }
1922
- for (var i = 0; i < extensions.length; i++) {
1923
- var file = x2 + extensions[i];
1924
- if (isFile(file)) {
1925
- return file;
1926
- }
1927
- }
1928
- }
1929
- function loadpkg(dir) {
1930
- if (dir === "" || dir === "/") return;
1931
- if (process.platform === "win32" && windowsDriveRegex.test(dir)) {
1932
- return;
1933
- }
1934
- if (nodeModulesRegex.test(dir)) return;
1935
- var pkgfile = path3.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
1936
- if (!isFile(pkgfile)) {
1937
- return loadpkg(path3.dirname(dir));
1938
- }
1939
- var pkg = readPackageSync(readFileSync2, pkgfile);
1940
- if (pkg && opts.packageFilter) {
1941
- pkg = opts.packageFilter(
1942
- pkg,
1943
- /*pkgfile,*/
1944
- dir
1945
- );
1946
- }
1947
- return { pkg, dir };
1948
- }
1949
- function loadAsDirectorySync(x2) {
1950
- var pkgfile = path3.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
1951
- if (isFile(pkgfile)) {
1952
- try {
1953
- var pkg = readPackageSync(readFileSync2, pkgfile);
1954
- } catch (e) {
1955
- }
1956
- if (pkg && opts.packageFilter) {
1957
- pkg = opts.packageFilter(
1958
- pkg,
1959
- /*pkgfile,*/
1960
- x2
1961
- );
1962
- }
1963
- if (pkg && pkg.main) {
1964
- if (typeof pkg.main !== "string") {
1965
- var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
1966
- mainError.code = "INVALID_PACKAGE_MAIN";
1967
- throw mainError;
1968
- }
1969
- if (pkg.main === "." || pkg.main === "./") {
1970
- pkg.main = "index";
1971
- }
1972
- try {
1973
- var m2 = loadAsFileSync(path3.resolve(x2, pkg.main));
1974
- if (m2) return m2;
1975
- var n2 = loadAsDirectorySync(path3.resolve(x2, pkg.main));
1976
- if (n2) return n2;
1977
- } catch (e) {
1978
- }
1979
- }
1980
- }
1981
- return loadAsFileSync(path3.join(x2, "/index"));
1982
- }
1983
- function loadNodeModulesSync(x2, start) {
1984
- var thunk = function() {
1985
- return getPackageCandidates(x2, start, opts);
1986
- };
1987
- var dirs = packageIterator ? packageIterator(x2, start, thunk, opts) : thunk();
1988
- for (var i = 0; i < dirs.length; i++) {
1989
- var dir = dirs[i];
1990
- if (isDirectory(path3.dirname(dir))) {
1991
- var m2 = loadAsFileSync(dir);
1992
- if (m2) return m2;
1993
- var n2 = loadAsDirectorySync(dir);
1994
- if (n2) return n2;
1995
- }
1996
- }
1997
- }
1998
- };
1999
- }
2000
- });
2001
-
2002
- // node_modules/resolve/index.js
2003
- var require_resolve = __commonJS({
2004
- "node_modules/resolve/index.js"(exports$1, module) {
2005
- var async = require_async();
2006
- async.core = require_core3();
2007
- async.isCore = require_is_core();
2008
- async.sync = require_sync();
2009
- module.exports = async;
2010
- }
2011
- });
2012
-
2013
- // node_modules/require-in-the-middle/package.json
2014
- var require_package = __commonJS({
2015
- "node_modules/require-in-the-middle/package.json"(exports$1, module) {
2016
- module.exports = {
2017
- name: "require-in-the-middle",
2018
- version: "7.5.2",
2019
- description: "Module to hook into the Node.js require function",
2020
- main: "index.js",
2021
- types: "types/index.d.ts",
2022
- dependencies: {
2023
- debug: "^4.3.5",
2024
- "module-details-from-path": "^1.0.3",
2025
- resolve: "^1.22.8"
2026
- },
2027
- devDependencies: {
2028
- "@babel/core": "^7.9.0",
2029
- "@babel/preset-env": "^7.9.5",
2030
- "@babel/preset-typescript": "^7.9.0",
2031
- "@babel/register": "^7.9.0",
2032
- "ipp-printer": "^1.0.0",
2033
- patterns: "^1.0.3",
2034
- roundround: "^0.2.0",
2035
- semver: "^6.3.0",
2036
- standard: "^14.3.1",
2037
- tape: "^4.11.0"
2038
- },
2039
- scripts: {
2040
- test: "npm run test:lint && npm run test:tape && npm run test:babel",
2041
- "test:lint": "standard",
2042
- "test:tape": "tape test/*.js",
2043
- "test:babel": "node test/babel/babel-register.js"
2044
- },
2045
- repository: {
2046
- type: "git",
2047
- url: "git+https://github.com/nodejs/require-in-the-middle.git"
2048
- },
2049
- keywords: [
2050
- "require",
2051
- "hook",
2052
- "shim",
2053
- "shimmer",
2054
- "shimming",
2055
- "patch",
2056
- "monkey",
2057
- "monkeypatch",
2058
- "module",
2059
- "load"
2060
- ],
2061
- files: [
2062
- "types"
2063
- ],
2064
- author: "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
2065
- license: "MIT",
2066
- bugs: {
2067
- url: "https://github.com/nodejs/require-in-the-middle/issues"
2068
- },
2069
- homepage: "https://github.com/nodejs/require-in-the-middle#readme",
2070
- engines: {
2071
- node: ">=8.6.0"
2072
- }
2073
- };
2074
- }
2075
- });
2076
-
2077
- // node_modules/require-in-the-middle/index.js
2078
- var require_require_in_the_middle = __commonJS({
2079
- "node_modules/require-in-the-middle/index.js"(exports$1, module) {
2080
- var path3 = __require("path");
2081
- var Module = __require("module");
2082
- var debug = require_src()("require-in-the-middle");
2083
- var moduleDetailsFromPath = require_module_details_from_path();
2084
- module.exports = Hook2;
2085
- module.exports.Hook = Hook2;
2086
- var builtinModules;
2087
- var isCore;
2088
- if (Module.isBuiltin) {
2089
- isCore = Module.isBuiltin;
2090
- } else if (Module.builtinModules) {
2091
- isCore = (moduleName) => {
2092
- if (moduleName.startsWith("node:")) {
2093
- return true;
2094
- }
2095
- if (builtinModules === void 0) {
2096
- builtinModules = new Set(Module.builtinModules);
2097
- }
2098
- return builtinModules.has(moduleName);
2099
- };
2100
- } else {
2101
- const _resolve2 = require_resolve();
2102
- const [major, minor] = process.versions.node.split(".").map(Number);
2103
- if (major === 8 && minor < 8) {
2104
- isCore = (moduleName) => {
2105
- if (moduleName === "http2") {
2106
- return true;
2107
- }
2108
- return !!_resolve2.core[moduleName];
2109
- };
2110
- } else {
2111
- isCore = (moduleName) => {
2112
- return !!_resolve2.core[moduleName];
2113
- };
2114
- }
2115
- }
2116
- var _resolve;
2117
- function resolve(moduleName, basedir) {
2118
- if (!_resolve) {
2119
- if (__require.resolve && __require.resolve.paths) {
2120
- _resolve = function(moduleName2, basedir2) {
2121
- return __require.resolve(moduleName2, { paths: [basedir2] });
2122
- };
2123
- } else {
2124
- const resolve2 = require_resolve();
2125
- _resolve = function(moduleName2, basedir2) {
2126
- return resolve2.sync(moduleName2, { basedir: basedir2 });
2127
- };
2128
- }
2129
- }
2130
- return _resolve(moduleName, basedir);
2131
- }
2132
- var normalize3 = /([/\\]index)?(\.js)?$/;
2133
- var ExportsCache = class {
2134
- constructor() {
2135
- this._localCache = /* @__PURE__ */ new Map();
2136
- this._kRitmExports = /* @__PURE__ */ Symbol("RitmExports");
2137
- }
2138
- has(filename, isBuiltin) {
2139
- if (this._localCache.has(filename)) {
2140
- return true;
2141
- } else if (!isBuiltin) {
2142
- const mod = __require.cache[filename];
2143
- return !!(mod && this._kRitmExports in mod);
2144
- } else {
2145
- return false;
2146
- }
2147
- }
2148
- get(filename, isBuiltin) {
2149
- const cachedExports = this._localCache.get(filename);
2150
- if (cachedExports !== void 0) {
2151
- return cachedExports;
2152
- } else if (!isBuiltin) {
2153
- const mod = __require.cache[filename];
2154
- return mod && mod[this._kRitmExports];
2155
- }
2156
- }
2157
- set(filename, exports2, isBuiltin) {
2158
- if (isBuiltin) {
2159
- this._localCache.set(filename, exports2);
2160
- } else if (filename in __require.cache) {
2161
- __require.cache[filename][this._kRitmExports] = exports2;
2162
- } else {
2163
- debug('non-core module is unexpectedly not in require.cache: "%s"', filename);
2164
- this._localCache.set(filename, exports2);
2165
- }
2166
- }
2167
- };
2168
- function Hook2(modules, options, onrequire) {
2169
- if (this instanceof Hook2 === false) return new Hook2(modules, options, onrequire);
2170
- if (typeof modules === "function") {
2171
- onrequire = modules;
2172
- modules = null;
2173
- options = null;
2174
- } else if (typeof options === "function") {
2175
- onrequire = options;
2176
- options = null;
2177
- }
2178
- if (typeof Module._resolveFilename !== "function") {
2179
- console.error("Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!", typeof Module._resolveFilename);
2180
- console.error("Please report this error as an issue related to Node.js %s at %s", process.version, require_package().bugs.url);
2181
- return;
2182
- }
2183
- this._cache = new ExportsCache();
2184
- this._unhooked = false;
2185
- this._origRequire = Module.prototype.require;
2186
- const self = this;
2187
- const patching = /* @__PURE__ */ new Set();
2188
- const internals = options ? options.internals === true : false;
2189
- const hasWhitelist = Array.isArray(modules);
2190
- debug("registering require hook");
2191
- this._require = Module.prototype.require = function(id) {
2192
- if (self._unhooked === true) {
2193
- debug("ignoring require call - module is soft-unhooked");
2194
- return self._origRequire.apply(this, arguments);
2195
- }
2196
- return patchedRequire.call(this, arguments, false);
2197
- };
2198
- if (typeof process.getBuiltinModule === "function") {
2199
- this._origGetBuiltinModule = process.getBuiltinModule;
2200
- this._getBuiltinModule = process.getBuiltinModule = function(id) {
2201
- if (self._unhooked === true) {
2202
- debug("ignoring process.getBuiltinModule call - module is soft-unhooked");
2203
- return self._origGetBuiltinModule.apply(this, arguments);
2204
- }
2205
- return patchedRequire.call(this, arguments, true);
2206
- };
2207
- }
2208
- function patchedRequire(args, coreOnly) {
2209
- const id = args[0];
2210
- const core = isCore(id);
2211
- let filename;
2212
- if (core) {
2213
- filename = id;
2214
- if (id.startsWith("node:")) {
2215
- const idWithoutPrefix = id.slice(5);
2216
- if (isCore(idWithoutPrefix)) {
2217
- filename = idWithoutPrefix;
2218
- }
2219
- }
2220
- } else if (coreOnly) {
2221
- debug("call to process.getBuiltinModule with unknown built-in id");
2222
- return self._origGetBuiltinModule.apply(this, args);
2223
- } else {
2224
- try {
2225
- filename = Module._resolveFilename(id, this);
2226
- } catch (resolveErr) {
2227
- debug('Module._resolveFilename("%s") threw %j, calling original Module.require', id, resolveErr.message);
2228
- return self._origRequire.apply(this, args);
2229
- }
2230
- }
2231
- let moduleName, basedir;
2232
- debug("processing %s module require('%s'): %s", core === true ? "core" : "non-core", id, filename);
2233
- if (self._cache.has(filename, core) === true) {
2234
- debug("returning already patched cached module: %s", filename);
2235
- return self._cache.get(filename, core);
2236
- }
2237
- const isPatching = patching.has(filename);
2238
- if (isPatching === false) {
2239
- patching.add(filename);
2240
- }
2241
- const exports2 = coreOnly ? self._origGetBuiltinModule.apply(this, args) : self._origRequire.apply(this, args);
2242
- if (isPatching === true) {
2243
- debug("module is in the process of being patched already - ignoring: %s", filename);
2244
- return exports2;
2245
- }
2246
- patching.delete(filename);
2247
- if (core === true) {
2248
- if (hasWhitelist === true && modules.includes(filename) === false) {
2249
- debug("ignoring core module not on whitelist: %s", filename);
2250
- return exports2;
2251
- }
2252
- moduleName = filename;
2253
- } else if (hasWhitelist === true && modules.includes(filename)) {
2254
- const parsedPath = path3.parse(filename);
2255
- moduleName = parsedPath.name;
2256
- basedir = parsedPath.dir;
2257
- } else {
2258
- const stat = moduleDetailsFromPath(filename);
2259
- if (stat === void 0) {
2260
- debug("could not parse filename: %s", filename);
2261
- return exports2;
2262
- }
2263
- moduleName = stat.name;
2264
- basedir = stat.basedir;
2265
- const fullModuleName = resolveModuleName(stat);
2266
- debug("resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)", moduleName, id, fullModuleName, basedir);
2267
- let matchFound = false;
2268
- if (hasWhitelist) {
2269
- if (!id.startsWith(".") && modules.includes(id)) {
2270
- moduleName = id;
2271
- matchFound = true;
2272
- }
2273
- if (!modules.includes(moduleName) && !modules.includes(fullModuleName)) {
2274
- return exports2;
2275
- }
2276
- if (modules.includes(fullModuleName) && fullModuleName !== moduleName) {
2277
- moduleName = fullModuleName;
2278
- matchFound = true;
2279
- }
2280
- }
2281
- if (!matchFound) {
2282
- let res;
2283
- try {
2284
- res = resolve(moduleName, basedir);
2285
- } catch (e) {
2286
- debug("could not resolve module: %s", moduleName);
2287
- self._cache.set(filename, exports2, core);
2288
- return exports2;
2289
- }
2290
- if (res !== filename) {
2291
- if (internals === true) {
2292
- moduleName = moduleName + path3.sep + path3.relative(basedir, filename);
2293
- debug("preparing to process require of internal file: %s", moduleName);
2294
- } else {
2295
- debug("ignoring require of non-main module file: %s", res);
2296
- self._cache.set(filename, exports2, core);
2297
- return exports2;
2298
- }
2299
- }
2300
- }
2301
- }
2302
- self._cache.set(filename, exports2, core);
2303
- debug("calling require hook: %s", moduleName);
2304
- const patchedExports = onrequire(exports2, moduleName, basedir);
2305
- self._cache.set(filename, patchedExports, core);
2306
- debug("returning module: %s", moduleName);
2307
- return patchedExports;
2308
- }
2309
- }
2310
- Hook2.prototype.unhook = function() {
2311
- this._unhooked = true;
2312
- if (this._require === Module.prototype.require) {
2313
- Module.prototype.require = this._origRequire;
2314
- debug("require unhook successful");
2315
- } else {
2316
- debug("require unhook unsuccessful");
2317
- }
2318
- if (process.getBuiltinModule !== void 0) {
2319
- if (this._getBuiltinModule === process.getBuiltinModule) {
2320
- process.getBuiltinModule = this._origGetBuiltinModule;
2321
- debug("process.getBuiltinModule unhook successful");
2322
- } else {
2323
- debug("process.getBuiltinModule unhook unsuccessful");
2324
- }
2325
- }
2326
- };
2327
- function resolveModuleName(stat) {
2328
- const normalizedPath = path3.sep !== "/" ? stat.path.split(path3.sep).join("/") : stat.path;
2329
- return path3.posix.join(stat.name, normalizedPath).replace(normalize3, "");
2330
- }
2331
- }
2332
- });
2333
-
2334
- // node_modules/import-in-the-middle/lib/register.js
2335
- var require_register = __commonJS({
2336
- "node_modules/import-in-the-middle/lib/register.js"(exports$1) {
2337
- var importHooks = [];
2338
- var setters = /* @__PURE__ */ new WeakMap();
2339
- var getters = /* @__PURE__ */ new WeakMap();
2340
- var specifiers = /* @__PURE__ */ new Map();
2341
- var toHook = [];
2342
- var proxyHandler = {
2343
- set(target, name, value) {
2344
- return setters.get(target)[name](value);
2345
- },
2346
- get(target, name) {
2347
- if (name === Symbol.toStringTag) {
2348
- return "Module";
2349
- }
2350
- const getter = getters.get(target)[name];
2351
- if (typeof getter === "function") {
2352
- return getter();
2353
- }
2354
- },
2355
- defineProperty(target, property, descriptor) {
2356
- if (!("value" in descriptor)) {
2357
- throw new Error("Getters/setters are not supported for exports property descriptors.");
2358
- }
2359
- return setters.get(target)[property](descriptor.value);
2360
- }
2361
- };
2362
- function register(name, namespace, set, get, specifier) {
2363
- specifiers.set(name, specifier);
2364
- setters.set(namespace, set);
2365
- getters.set(namespace, get);
2366
- const proxy = new Proxy(namespace, proxyHandler);
2367
- importHooks.forEach((hook) => hook(name, proxy));
2368
- toHook.push([name, proxy]);
2369
- }
2370
- var experimentalPatchInternals = false;
2371
- function getExperimentalPatchInternals() {
2372
- return experimentalPatchInternals;
2373
- }
2374
- function setExperimentalPatchInternals(value) {
2375
- experimentalPatchInternals = value;
2376
- }
2377
- exports$1.register = register;
2378
- exports$1.importHooks = importHooks;
2379
- exports$1.specifiers = specifiers;
2380
- exports$1.toHook = toHook;
2381
- exports$1.getExperimentalPatchInternals = getExperimentalPatchInternals;
2382
- exports$1.setExperimentalPatchInternals = setExperimentalPatchInternals;
2383
- }
2384
- });
2385
-
2386
- // node_modules/import-in-the-middle/index.js
2387
- var require_import_in_the_middle = __commonJS({
2388
- "node_modules/import-in-the-middle/index.js"(exports$1, module) {
2389
- var path3 = __require("path");
2390
- var parse2 = require_module_details_from_path();
2391
- var { fileURLToPath } = __require("url");
2392
- var { MessageChannel } = __require("worker_threads");
2393
- var {
2394
- importHooks,
2395
- specifiers,
2396
- toHook,
2397
- getExperimentalPatchInternals
2398
- } = require_register();
2399
- function addHook(hook) {
2400
- importHooks.push(hook);
2401
- toHook.forEach(([name, namespace]) => hook(name, namespace));
2402
- }
2403
- function removeHook(hook) {
2404
- const index = importHooks.indexOf(hook);
2405
- if (index > -1) {
2406
- importHooks.splice(index, 1);
2407
- }
2408
- }
2409
- function callHookFn(hookFn, namespace, name, baseDir) {
2410
- const newDefault = hookFn(namespace, name, baseDir);
2411
- if (newDefault && newDefault !== namespace) {
2412
- namespace.default = newDefault;
2413
- }
2414
- }
2415
- var sendModulesToLoader;
2416
- function createAddHookMessageChannel() {
2417
- const { port1, port2 } = new MessageChannel();
2418
- let pendingAckCount = 0;
2419
- let resolveFn;
2420
- sendModulesToLoader = (modules) => {
2421
- pendingAckCount++;
2422
- port1.postMessage(modules);
2423
- };
2424
- port1.on("message", () => {
2425
- pendingAckCount--;
2426
- if (resolveFn && pendingAckCount <= 0) {
2427
- resolveFn();
2428
- }
2429
- }).unref();
2430
- function waitForAllMessagesAcknowledged() {
2431
- const timer = setInterval(() => {
2432
- }, 1e3);
2433
- const promise = new Promise((resolve) => {
2434
- resolveFn = resolve;
2435
- }).then(() => {
2436
- clearInterval(timer);
2437
- });
2438
- if (pendingAckCount === 0) {
2439
- resolveFn();
2440
- }
2441
- return promise;
2442
- }
2443
- const addHookMessagePort = port2;
2444
- const registerOptions = { data: { addHookMessagePort, include: [] }, transferList: [addHookMessagePort] };
2445
- return { registerOptions, addHookMessagePort, waitForAllMessagesAcknowledged };
2446
- }
2447
- function Hook2(modules, options, hookFn) {
2448
- if (this instanceof Hook2 === false) return new Hook2(modules, options, hookFn);
2449
- if (typeof modules === "function") {
2450
- hookFn = modules;
2451
- modules = null;
2452
- options = null;
2453
- } else if (typeof options === "function") {
2454
- hookFn = options;
2455
- options = null;
2456
- }
2457
- const internals = options ? options.internals === true : false;
2458
- if (sendModulesToLoader && Array.isArray(modules)) {
2459
- sendModulesToLoader(modules);
2460
- }
2461
- this._iitmHook = (name, namespace) => {
2462
- const filename = name;
2463
- const isBuiltin = name.startsWith("node:");
2464
- let baseDir;
2465
- if (isBuiltin) {
2466
- name = name.replace(/^node:/, "");
2467
- } else {
2468
- if (name.startsWith("file://")) {
2469
- try {
2470
- name = fileURLToPath(name);
2471
- } catch (e) {
2472
- }
2473
- }
2474
- const details = parse2(name);
2475
- if (details) {
2476
- name = details.name;
2477
- baseDir = details.basedir;
2478
- }
2479
- }
2480
- if (modules) {
2481
- for (const moduleName of modules) {
2482
- if (moduleName === name) {
2483
- if (baseDir) {
2484
- if (internals) {
2485
- name = name + path3.sep + path3.relative(baseDir, fileURLToPath(filename));
2486
- } else {
2487
- if (!getExperimentalPatchInternals() && !baseDir.endsWith(specifiers.get(filename))) continue;
2488
- }
2489
- }
2490
- callHookFn(hookFn, namespace, name, baseDir);
2491
- }
2492
- }
2493
- } else {
2494
- callHookFn(hookFn, namespace, name, baseDir);
2495
- }
2496
- };
2497
- addHook(this._iitmHook);
2498
- }
2499
- Hook2.prototype.unhook = function() {
2500
- removeHook(this._iitmHook);
2501
- };
2502
- module.exports = Hook2;
2503
- module.exports.Hook = Hook2;
2504
- module.exports.addHook = addHook;
2505
- module.exports.removeHook = removeHook;
2506
- module.exports.createAddHookMessageChannel = createAddHookMessageChannel;
2507
- }
2508
- });
1
+ import { __commonJS, __require, require_decamelize, require_camelcase, __toCommonJS, init_esm_node, esm_node_exports, __toESM, v4_default } from './chunk-WMQRYJGR.js';
2
+ import { context, SpanKind, SpanStatusCode } from '@opentelemetry/api';
3
+ import { InstrumentationBase } from '@opentelemetry/instrumentation';
2509
4
 
2510
5
  // node_modules/@traceloop/ai-semantic-conventions/dist/src/SemanticAttributes.js
2511
6
  var require_SemanticAttributes = __commonJS({
@@ -2602,7 +97,7 @@ var require_SemanticAttributes = __commonJS({
2602
97
  });
2603
98
 
2604
99
  // node_modules/@traceloop/ai-semantic-conventions/dist/src/index.js
2605
- var require_src2 = __commonJS({
100
+ var require_src = __commonJS({
2606
101
  "node_modules/@traceloop/ai-semantic-conventions/dist/src/index.js"(exports$1) {
2607
102
  var __createBinding = exports$1 && exports$1.__createBinding || (Object.create ? (function(o, m, k, k2) {
2608
103
  if (k2 === void 0) k2 = k;
@@ -2792,8 +287,8 @@ var require_serializable = __commonJS({
2792
287
  }
2793
288
  function replaceSecrets2(root, secretsMap) {
2794
289
  const result = shallowCopy2(root);
2795
- for (const [path3, secretId] of Object.entries(secretsMap)) {
2796
- const [last, ...partsReverse] = path3.split(".").reverse();
290
+ for (const [path, secretId] of Object.entries(secretsMap)) {
291
+ const [last, ...partsReverse] = path.split(".").reverse();
2797
292
  let current = result;
2798
293
  for (const part of partsReverse.reverse()) {
2799
294
  if (current[part] === void 0) {
@@ -2978,21 +473,21 @@ var require_env = __commonJS({
2978
473
  var isNode = () => typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined" && !(0, exports$1.isDeno)();
2979
474
  exports$1.isNode = isNode;
2980
475
  var getEnv = () => {
2981
- let env2;
476
+ let env;
2982
477
  if ((0, exports$1.isBrowser)()) {
2983
- env2 = "browser";
478
+ env = "browser";
2984
479
  } else if ((0, exports$1.isNode)()) {
2985
- env2 = "node";
480
+ env = "node";
2986
481
  } else if ((0, exports$1.isWebWorker)()) {
2987
- env2 = "webworker";
482
+ env = "webworker";
2988
483
  } else if ((0, exports$1.isJsDom)()) {
2989
- env2 = "jsdom";
484
+ env = "jsdom";
2990
485
  } else if ((0, exports$1.isDeno)()) {
2991
- env2 = "deno";
486
+ env = "deno";
2992
487
  } else {
2993
- env2 = "other";
488
+ env = "other";
2994
489
  }
2995
- return env2;
490
+ return env;
2996
491
  };
2997
492
  exports$1.getEnv = getEnv;
2998
493
  var runtimeEnvironment;
@@ -3001,10 +496,10 @@ var require_env = __commonJS({
3001
496
  }
3002
497
  function getRuntimeEnvironmentSync() {
3003
498
  if (runtimeEnvironment === void 0) {
3004
- const env2 = (0, exports$1.getEnv)();
499
+ const env = (0, exports$1.getEnv)();
3005
500
  runtimeEnvironment = {
3006
501
  library: "langchain-js",
3007
- runtime: env2
502
+ runtime: env
3008
503
  };
3009
504
  }
3010
505
  return runtimeEnvironment;
@@ -3618,11 +1113,11 @@ var require_env2 = __commonJS({
3618
1113
  var runtimeEnvironment;
3619
1114
  function getRuntimeEnvironment() {
3620
1115
  if (runtimeEnvironment === void 0) {
3621
- const env2 = (0, exports$1.getEnv)();
1116
+ const env = (0, exports$1.getEnv)();
3622
1117
  const releaseEnv = getShas();
3623
1118
  runtimeEnvironment = {
3624
1119
  library: "langsmith",
3625
- runtime: env2,
1120
+ runtime: env,
3626
1121
  sdk: "langsmith-js",
3627
1122
  sdk_version: index_js_1.__version__,
3628
1123
  ...releaseEnv
@@ -3719,10 +1214,10 @@ var require_env2 = __commonJS({
3719
1214
  "BUILDKITE_COMMIT"
3720
1215
  ];
3721
1216
  const shas = {};
3722
- for (const env2 of common_release_envs) {
3723
- const envVar = getEnvironmentVariable2(env2);
1217
+ for (const env of common_release_envs) {
1218
+ const envVar = getEnvironmentVariable2(env);
3724
1219
  if (envVar !== void 0) {
3725
- shas[env2] = envVar;
1220
+ shas[env] = envVar;
3726
1221
  }
3727
1222
  }
3728
1223
  cachedCommitSHAs = shas;
@@ -5262,11 +2757,11 @@ var require_re = __commonJS({
5262
2757
  var safeSrc = exports$1.safeSrc = [];
5263
2758
  var t = exports$1.t = {};
5264
2759
  var R = 0;
5265
- var LETTERDASHNUMBER2 = "[a-zA-Z0-9-]";
2760
+ var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
5266
2761
  var safeRegexReplacements = [
5267
2762
  ["\\s", 1],
5268
2763
  ["\\d", MAX_LENGTH],
5269
- [LETTERDASHNUMBER2, MAX_SAFE_BUILD_LENGTH]
2764
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
5270
2765
  ];
5271
2766
  var makeSafeRegex = (value) => {
5272
2767
  for (const [token, max] of safeRegexReplacements) {
@@ -5286,14 +2781,14 @@ var require_re = __commonJS({
5286
2781
  };
5287
2782
  createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
5288
2783
  createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
5289
- createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER2}*`);
2784
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
5290
2785
  createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
5291
2786
  createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
5292
2787
  createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
5293
2788
  createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
5294
2789
  createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
5295
2790
  createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
5296
- createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER2}+`);
2791
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
5297
2792
  createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
5298
2793
  createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
5299
2794
  createToken("FULL", `^${src[t.FULLPLAIN]}$`);
@@ -5657,7 +3152,7 @@ var require_semver = __commonJS({
5657
3152
  var require_parse = __commonJS({
5658
3153
  "node_modules/semver/functions/parse.js"(exports$1, module) {
5659
3154
  var SemVer = require_semver();
5660
- var parse2 = (version2, options, throwErrors = false) => {
3155
+ var parse = (version2, options, throwErrors = false) => {
5661
3156
  if (version2 instanceof SemVer) {
5662
3157
  return version2;
5663
3158
  }
@@ -5670,16 +3165,16 @@ var require_parse = __commonJS({
5670
3165
  throw er;
5671
3166
  }
5672
3167
  };
5673
- module.exports = parse2;
3168
+ module.exports = parse;
5674
3169
  }
5675
3170
  });
5676
3171
 
5677
3172
  // node_modules/semver/functions/valid.js
5678
3173
  var require_valid = __commonJS({
5679
3174
  "node_modules/semver/functions/valid.js"(exports$1, module) {
5680
- var parse2 = require_parse();
3175
+ var parse = require_parse();
5681
3176
  var valid = (version2, options) => {
5682
- const v = parse2(version2, options);
3177
+ const v = parse(version2, options);
5683
3178
  return v ? v.version : null;
5684
3179
  };
5685
3180
  module.exports = valid;
@@ -5689,9 +3184,9 @@ var require_valid = __commonJS({
5689
3184
  // node_modules/semver/functions/clean.js
5690
3185
  var require_clean = __commonJS({
5691
3186
  "node_modules/semver/functions/clean.js"(exports$1, module) {
5692
- var parse2 = require_parse();
3187
+ var parse = require_parse();
5693
3188
  var clean = (version2, options) => {
5694
- const s = parse2(version2.trim().replace(/^[=v]+/, ""), options);
3189
+ const s = parse(version2.trim().replace(/^[=v]+/, ""), options);
5695
3190
  return s ? s.version : null;
5696
3191
  };
5697
3192
  module.exports = clean;
@@ -5724,10 +3219,10 @@ var require_inc = __commonJS({
5724
3219
  // node_modules/semver/functions/diff.js
5725
3220
  var require_diff = __commonJS({
5726
3221
  "node_modules/semver/functions/diff.js"(exports$1, module) {
5727
- var parse2 = require_parse();
3222
+ var parse = require_parse();
5728
3223
  var diff = (version1, version2) => {
5729
- const v1 = parse2(version1, null, true);
5730
- const v2 = parse2(version2, null, true);
3224
+ const v1 = parse(version1, null, true);
3225
+ const v2 = parse(version2, null, true);
5731
3226
  const comparison = v1.compare(v2);
5732
3227
  if (comparison === 0) {
5733
3228
  return null;
@@ -5794,9 +3289,9 @@ var require_patch = __commonJS({
5794
3289
  // node_modules/semver/functions/prerelease.js
5795
3290
  var require_prerelease = __commonJS({
5796
3291
  "node_modules/semver/functions/prerelease.js"(exports$1, module) {
5797
- var parse2 = require_parse();
3292
+ var parse = require_parse();
5798
3293
  var prerelease = (version2, options) => {
5799
- const parsed = parse2(version2, options);
3294
+ const parsed = parse(version2, options);
5800
3295
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
5801
3296
  };
5802
3297
  module.exports = prerelease;
@@ -5968,7 +3463,7 @@ var require_cmp = __commonJS({
5968
3463
  var require_coerce = __commonJS({
5969
3464
  "node_modules/semver/functions/coerce.js"(exports$1, module) {
5970
3465
  var SemVer = require_semver();
5971
- var parse2 = require_parse();
3466
+ var parse = require_parse();
5972
3467
  var { safeRe: re, t } = require_re();
5973
3468
  var coerce = (version2, options) => {
5974
3469
  if (version2 instanceof SemVer) {
@@ -6003,7 +3498,7 @@ var require_coerce = __commonJS({
6003
3498
  const patch = match[4] || "0";
6004
3499
  const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
6005
3500
  const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
6006
- return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options);
3501
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
6007
3502
  };
6008
3503
  module.exports = coerce;
6009
3504
  }
@@ -6230,20 +3725,20 @@ var require_range = __commonJS({
6230
3725
  debug("stars", comp);
6231
3726
  return comp;
6232
3727
  };
6233
- var isX2 = (id) => !id || id.toLowerCase() === "x" || id === "*";
3728
+ var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
6234
3729
  var replaceTildes = (comp, options) => {
6235
- return comp.trim().split(/\s+/).map((c) => replaceTilde2(c, options)).join(" ");
3730
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
6236
3731
  };
6237
- var replaceTilde2 = (comp, options) => {
3732
+ var replaceTilde = (comp, options) => {
6238
3733
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
6239
3734
  return comp.replace(r, (_, M, m, p, pr) => {
6240
3735
  debug("tilde", comp, _, M, m, p, pr);
6241
3736
  let ret;
6242
- if (isX2(M)) {
3737
+ if (isX(M)) {
6243
3738
  ret = "";
6244
- } else if (isX2(m)) {
3739
+ } else if (isX(m)) {
6245
3740
  ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
6246
- } else if (isX2(p)) {
3741
+ } else if (isX(p)) {
6247
3742
  ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
6248
3743
  } else if (pr) {
6249
3744
  debug("replaceTilde pr", pr);
@@ -6256,20 +3751,20 @@ var require_range = __commonJS({
6256
3751
  });
6257
3752
  };
6258
3753
  var replaceCarets = (comp, options) => {
6259
- return comp.trim().split(/\s+/).map((c) => replaceCaret2(c, options)).join(" ");
3754
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
6260
3755
  };
6261
- var replaceCaret2 = (comp, options) => {
3756
+ var replaceCaret = (comp, options) => {
6262
3757
  debug("caret", comp, options);
6263
3758
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
6264
3759
  const z = options.includePrerelease ? "-0" : "";
6265
3760
  return comp.replace(r, (_, M, m, p, pr) => {
6266
3761
  debug("caret", comp, _, M, m, p, pr);
6267
3762
  let ret;
6268
- if (isX2(M)) {
3763
+ if (isX(M)) {
6269
3764
  ret = "";
6270
- } else if (isX2(m)) {
3765
+ } else if (isX(m)) {
6271
3766
  ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
6272
- } else if (isX2(p)) {
3767
+ } else if (isX(p)) {
6273
3768
  if (M === "0") {
6274
3769
  ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
6275
3770
  } else {
@@ -6304,16 +3799,16 @@ var require_range = __commonJS({
6304
3799
  };
6305
3800
  var replaceXRanges = (comp, options) => {
6306
3801
  debug("replaceXRanges", comp, options);
6307
- return comp.split(/\s+/).map((c) => replaceXRange2(c, options)).join(" ");
3802
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
6308
3803
  };
6309
- var replaceXRange2 = (comp, options) => {
3804
+ var replaceXRange = (comp, options) => {
6310
3805
  comp = comp.trim();
6311
3806
  const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
6312
3807
  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
6313
3808
  debug("xRange", comp, ret, gtlt, M, m, p, pr);
6314
- const xM = isX2(M);
6315
- const xm = xM || isX2(m);
6316
- const xp = xm || isX2(p);
3809
+ const xM = isX(M);
3810
+ const xm = xM || isX(m);
3811
+ const xp = xm || isX(p);
6317
3812
  const anyX = xp;
6318
3813
  if (gtlt === "=" && anyX) {
6319
3814
  gtlt = "";
@@ -6370,22 +3865,22 @@ var require_range = __commonJS({
6370
3865
  return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
6371
3866
  };
6372
3867
  var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
6373
- if (isX2(fM)) {
3868
+ if (isX(fM)) {
6374
3869
  from = "";
6375
- } else if (isX2(fm)) {
3870
+ } else if (isX(fm)) {
6376
3871
  from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
6377
- } else if (isX2(fp)) {
3872
+ } else if (isX(fp)) {
6378
3873
  from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
6379
3874
  } else if (fpr) {
6380
3875
  from = `>=${from}`;
6381
3876
  } else {
6382
3877
  from = `>=${from}${incPr ? "-0" : ""}`;
6383
3878
  }
6384
- if (isX2(tM)) {
3879
+ if (isX(tM)) {
6385
3880
  to = "";
6386
- } else if (isX2(tm)) {
3881
+ } else if (isX(tm)) {
6387
3882
  to = `<${+tM + 1}.0.0-0`;
6388
- } else if (isX2(tp)) {
3883
+ } else if (isX(tp)) {
6389
3884
  to = `<${tM}.${+tm + 1}.0-0`;
6390
3885
  } else if (tpr) {
6391
3886
  to = `<=${tM}.${tm}.${tp}-${tpr}`;
@@ -6538,7 +4033,7 @@ var require_comparator = __commonJS({
6538
4033
  var require_satisfies = __commonJS({
6539
4034
  "node_modules/semver/functions/satisfies.js"(exports$1, module) {
6540
4035
  var Range = require_range();
6541
- var satisfies2 = (version2, range, options) => {
4036
+ var satisfies = (version2, range, options) => {
6542
4037
  try {
6543
4038
  range = new Range(range, options);
6544
4039
  } catch (er) {
@@ -6546,7 +4041,7 @@ var require_satisfies = __commonJS({
6546
4041
  }
6547
4042
  return range.test(version2);
6548
4043
  };
6549
- module.exports = satisfies2;
4044
+ module.exports = satisfies;
6550
4045
  }
6551
4046
  });
6552
4047
 
@@ -6695,7 +4190,7 @@ var require_outside = __commonJS({
6695
4190
  var Comparator = require_comparator();
6696
4191
  var { ANY } = Comparator;
6697
4192
  var Range = require_range();
6698
- var satisfies2 = require_satisfies();
4193
+ var satisfies = require_satisfies();
6699
4194
  var gt = require_gt();
6700
4195
  var lt = require_lt();
6701
4196
  var lte = require_lte();
@@ -6722,7 +4217,7 @@ var require_outside = __commonJS({
6722
4217
  default:
6723
4218
  throw new TypeError('Must provide a hilo val of "<" or ">"');
6724
4219
  }
6725
- if (satisfies2(version2, range, options)) {
4220
+ if (satisfies(version2, range, options)) {
6726
4221
  return false;
6727
4222
  }
6728
4223
  for (let i = 0; i < range.set.length; ++i) {
@@ -6790,7 +4285,7 @@ var require_intersects = __commonJS({
6790
4285
  // node_modules/semver/ranges/simplify.js
6791
4286
  var require_simplify = __commonJS({
6792
4287
  "node_modules/semver/ranges/simplify.js"(exports$1, module) {
6793
- var satisfies2 = require_satisfies();
4288
+ var satisfies = require_satisfies();
6794
4289
  var compare = require_compare();
6795
4290
  module.exports = (versions, range, options) => {
6796
4291
  const set = [];
@@ -6798,7 +4293,7 @@ var require_simplify = __commonJS({
6798
4293
  let prev = null;
6799
4294
  const v = versions.sort((a, b) => compare(a, b, options));
6800
4295
  for (const version2 of v) {
6801
- const included = satisfies2(version2, range, options);
4296
+ const included = satisfies(version2, range, options);
6802
4297
  if (included) {
6803
4298
  prev = version2;
6804
4299
  if (!first) {
@@ -6842,7 +4337,7 @@ var require_subset = __commonJS({
6842
4337
  var Range = require_range();
6843
4338
  var Comparator = require_comparator();
6844
4339
  var { ANY } = Comparator;
6845
- var satisfies2 = require_satisfies();
4340
+ var satisfies = require_satisfies();
6846
4341
  var compare = require_compare();
6847
4342
  var subset = (sub, dom, options = {}) => {
6848
4343
  if (sub === dom) {
@@ -6911,14 +4406,14 @@ var require_subset = __commonJS({
6911
4406
  }
6912
4407
  }
6913
4408
  for (const eq of eqSet) {
6914
- if (gt && !satisfies2(eq, String(gt), options)) {
4409
+ if (gt && !satisfies(eq, String(gt), options)) {
6915
4410
  return null;
6916
4411
  }
6917
- if (lt && !satisfies2(eq, String(lt), options)) {
4412
+ if (lt && !satisfies(eq, String(lt), options)) {
6918
4413
  return null;
6919
4414
  }
6920
4415
  for (const c of dom) {
6921
- if (!satisfies2(eq, String(c), options)) {
4416
+ if (!satisfies(eq, String(c), options)) {
6922
4417
  return false;
6923
4418
  }
6924
4419
  }
@@ -6945,7 +4440,7 @@ var require_subset = __commonJS({
6945
4440
  if (higher === c && higher !== gt) {
6946
4441
  return false;
6947
4442
  }
6948
- } else if (gt.operator === ">=" && !satisfies2(gt.semver, String(c), options)) {
4443
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
6949
4444
  return false;
6950
4445
  }
6951
4446
  }
@@ -6960,7 +4455,7 @@ var require_subset = __commonJS({
6960
4455
  if (lower === c && lower !== lt) {
6961
4456
  return false;
6962
4457
  }
6963
- } else if (lt.operator === "<=" && !satisfies2(lt.semver, String(c), options)) {
4458
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
6964
4459
  return false;
6965
4460
  }
6966
4461
  }
@@ -7004,7 +4499,7 @@ var require_semver2 = __commonJS({
7004
4499
  var constants = require_constants2();
7005
4500
  var SemVer = require_semver();
7006
4501
  var identifiers = require_identifiers();
7007
- var parse2 = require_parse();
4502
+ var parse = require_parse();
7008
4503
  var valid = require_valid();
7009
4504
  var clean = require_clean();
7010
4505
  var inc = require_inc();
@@ -7029,7 +4524,7 @@ var require_semver2 = __commonJS({
7029
4524
  var coerce = require_coerce();
7030
4525
  var Comparator = require_comparator();
7031
4526
  var Range = require_range();
7032
- var satisfies2 = require_satisfies();
4527
+ var satisfies = require_satisfies();
7033
4528
  var toComparators = require_to_comparators();
7034
4529
  var maxSatisfying = require_max_satisfying();
7035
4530
  var minSatisfying = require_min_satisfying();
@@ -7042,7 +4537,7 @@ var require_semver2 = __commonJS({
7042
4537
  var simplifyRange = require_simplify();
7043
4538
  var subset = require_subset();
7044
4539
  module.exports = {
7045
- parse: parse2,
4540
+ parse,
7046
4541
  valid,
7047
4542
  clean,
7048
4543
  inc,
@@ -7067,7 +4562,7 @@ var require_semver2 = __commonJS({
7067
4562
  coerce,
7068
4563
  Comparator,
7069
4564
  Range,
7070
- satisfies: satisfies2,
4565
+ satisfies,
7071
4566
  toComparators,
7072
4567
  maxSatisfying,
7073
4568
  minSatisfying,
@@ -7890,9 +5385,9 @@ var require_client = __commonJS({
7890
5385
  }
7891
5386
  return headers;
7892
5387
  }
7893
- _getPlatformEndpointPath(path3) {
5388
+ _getPlatformEndpointPath(path) {
7894
5389
  const needsV1Prefix = this.apiUrl.slice(-3) !== "/v1" && this.apiUrl.slice(-4) !== "/v1/";
7895
- return needsV1Prefix ? `/v1/platform/${path3}` : `/platform/${path3}`;
5390
+ return needsV1Prefix ? `/v1/platform/${path}` : `/platform/${path}`;
7896
5391
  }
7897
5392
  async processInputs(inputs) {
7898
5393
  if (this.hideInputs === false) {
@@ -7928,9 +5423,9 @@ var require_client = __commonJS({
7928
5423
  }
7929
5424
  return runParams;
7930
5425
  }
7931
- async _getResponse(path3, queryParams) {
5426
+ async _getResponse(path, queryParams) {
7932
5427
  const paramsString = queryParams?.toString() ?? "";
7933
- const url = `${this.apiUrl}${path3}?${paramsString}`;
5428
+ const url = `${this.apiUrl}${path}?${paramsString}`;
7934
5429
  const response = await this.caller.call(async () => {
7935
5430
  const res = await this._fetch(url, {
7936
5431
  method: "GET",
@@ -7938,22 +5433,22 @@ var require_client = __commonJS({
7938
5433
  signal: AbortSignal.timeout(this.timeout_ms),
7939
5434
  ...this.fetchOptions
7940
5435
  });
7941
- await (0, error_js_1.raiseForStatus)(res, `fetch ${path3}`);
5436
+ await (0, error_js_1.raiseForStatus)(res, `fetch ${path}`);
7942
5437
  return res;
7943
5438
  });
7944
5439
  return response;
7945
5440
  }
7946
- async _get(path3, queryParams) {
7947
- const response = await this._getResponse(path3, queryParams);
5441
+ async _get(path, queryParams) {
5442
+ const response = await this._getResponse(path, queryParams);
7948
5443
  return response.json();
7949
5444
  }
7950
- async *_getPaginated(path3, queryParams = new URLSearchParams(), transform) {
5445
+ async *_getPaginated(path, queryParams = new URLSearchParams(), transform) {
7951
5446
  let offset = Number(queryParams.get("offset")) || 0;
7952
5447
  const limit = Number(queryParams.get("limit")) || 100;
7953
5448
  while (true) {
7954
5449
  queryParams.set("offset", String(offset));
7955
5450
  queryParams.set("limit", String(limit));
7956
- const url = `${this.apiUrl}${path3}?${queryParams}`;
5451
+ const url = `${this.apiUrl}${path}?${queryParams}`;
7957
5452
  const response = await this.caller.call(async () => {
7958
5453
  const res = await this._fetch(url, {
7959
5454
  method: "GET",
@@ -7961,7 +5456,7 @@ var require_client = __commonJS({
7961
5456
  signal: AbortSignal.timeout(this.timeout_ms),
7962
5457
  ...this.fetchOptions
7963
5458
  });
7964
- await (0, error_js_1.raiseForStatus)(res, `fetch ${path3}`);
5459
+ await (0, error_js_1.raiseForStatus)(res, `fetch ${path}`);
7965
5460
  return res;
7966
5461
  });
7967
5462
  const items = transform ? transform(await response.json()) : await response.json();
@@ -7975,19 +5470,19 @@ var require_client = __commonJS({
7975
5470
  offset += items.length;
7976
5471
  }
7977
5472
  }
7978
- async *_getCursorPaginatedList(path3, body = null, requestMethod = "POST", dataKey = "runs") {
5473
+ async *_getCursorPaginatedList(path, body = null, requestMethod = "POST", dataKey = "runs") {
7979
5474
  const bodyParams = body ? { ...body } : {};
7980
5475
  while (true) {
7981
5476
  const body2 = JSON.stringify(bodyParams);
7982
5477
  const response = await this.caller.call(async () => {
7983
- const res = await this._fetch(`${this.apiUrl}${path3}`, {
5478
+ const res = await this._fetch(`${this.apiUrl}${path}`, {
7984
5479
  method: requestMethod,
7985
5480
  headers: { ...this.headers, "Content-Type": "application/json" },
7986
5481
  signal: AbortSignal.timeout(this.timeout_ms),
7987
5482
  ...this.fetchOptions,
7988
5483
  body: body2
7989
5484
  });
7990
- await (0, error_js_1.raiseForStatus)(res, `fetch ${path3}`);
5485
+ await (0, error_js_1.raiseForStatus)(res, `fetch ${path}`);
7991
5486
  return res;
7992
5487
  });
7993
5488
  const responseBody = await response.json();
@@ -8900,8 +6395,8 @@ Context: ${context2}`);
8900
6395
  limit: Number(limit) || 100
8901
6396
  };
8902
6397
  let currentOffset = Number(offset) || 0;
8903
- const path3 = "/runs/group";
8904
- const url = `${this.apiUrl}${path3}`;
6398
+ const path = "/runs/group";
6399
+ const url = `${this.apiUrl}${path}`;
8905
6400
  while (true) {
8906
6401
  const currentBody = {
8907
6402
  ...baseBody,
@@ -8917,7 +6412,7 @@ Context: ${context2}`);
8917
6412
  ...this.fetchOptions,
8918
6413
  body
8919
6414
  });
8920
- await (0, error_js_1.raiseForStatus)(res, `Failed to fetch ${path3}`);
6415
+ await (0, error_js_1.raiseForStatus)(res, `Failed to fetch ${path}`);
8921
6416
  return res;
8922
6417
  });
8923
6418
  const items = await response.json();
@@ -8934,7 +6429,7 @@ Context: ${context2}`);
8934
6429
  }
8935
6430
  }
8936
6431
  }
8937
- async getRunStats({ id, trace: trace2, parentRun, runType, projectNames, projectIds, referenceExampleIds, startTime, endTime, error, query, filter, traceFilter, treeFilter, isRoot, dataSourceType }) {
6432
+ async getRunStats({ id, trace, parentRun, runType, projectNames, projectIds, referenceExampleIds, startTime, endTime, error, query, filter, traceFilter, treeFilter, isRoot, dataSourceType }) {
8938
6433
  let projectIds_ = projectIds || [];
8939
6434
  if (projectNames) {
8940
6435
  projectIds_ = [
@@ -8944,7 +6439,7 @@ Context: ${context2}`);
8944
6439
  }
8945
6440
  const payload = {
8946
6441
  id,
8947
- trace: trace2,
6442
+ trace,
8948
6443
  parent_run: parentRun,
8949
6444
  run_type: runType,
8950
6445
  session: projectIds_,
@@ -9234,20 +6729,20 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9234
6729
  return result;
9235
6730
  }
9236
6731
  async hasProject({ projectId, projectName }) {
9237
- let path3 = "/sessions";
6732
+ let path = "/sessions";
9238
6733
  const params = new URLSearchParams();
9239
6734
  if (projectId !== void 0 && projectName !== void 0) {
9240
6735
  throw new Error("Must provide either projectName or projectId, not both");
9241
6736
  } else if (projectId !== void 0) {
9242
6737
  (0, _uuid_js_1.assertUuid)(projectId);
9243
- path3 += `/${projectId}`;
6738
+ path += `/${projectId}`;
9244
6739
  } else if (projectName !== void 0) {
9245
6740
  params.append("name", projectName);
9246
6741
  } else {
9247
6742
  throw new Error("Must provide projectName or projectId");
9248
6743
  }
9249
6744
  const response = await this.caller.call(async () => {
9250
- const res = await this._fetch(`${this.apiUrl}${path3}?${params}`, {
6745
+ const res = await this._fetch(`${this.apiUrl}${path}?${params}`, {
9251
6746
  method: "GET",
9252
6747
  headers: this.headers,
9253
6748
  signal: AbortSignal.timeout(this.timeout_ms),
@@ -9270,13 +6765,13 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9270
6765
  }
9271
6766
  }
9272
6767
  async readProject({ projectId, projectName, includeStats }) {
9273
- let path3 = "/sessions";
6768
+ let path = "/sessions";
9274
6769
  const params = new URLSearchParams();
9275
6770
  if (projectId !== void 0 && projectName !== void 0) {
9276
6771
  throw new Error("Must provide either projectName or projectId, not both");
9277
6772
  } else if (projectId !== void 0) {
9278
6773
  (0, _uuid_js_1.assertUuid)(projectId);
9279
- path3 += `/${projectId}`;
6774
+ path += `/${projectId}`;
9280
6775
  } else if (projectName !== void 0) {
9281
6776
  params.append("name", projectName);
9282
6777
  } else {
@@ -9285,7 +6780,7 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9285
6780
  if (includeStats !== void 0) {
9286
6781
  params.append("include_stats", includeStats.toString());
9287
6782
  }
9288
- const response = await this._get(path3, params);
6783
+ const response = await this._get(path, params);
9289
6784
  let result;
9290
6785
  if (Array.isArray(response)) {
9291
6786
  if (response.length === 0) {
@@ -9448,19 +6943,19 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9448
6943
  return result;
9449
6944
  }
9450
6945
  async readDataset({ datasetId, datasetName }) {
9451
- let path3 = "/datasets";
6946
+ let path = "/datasets";
9452
6947
  const params = new URLSearchParams({ limit: "1" });
9453
6948
  if (datasetId && datasetName) {
9454
6949
  throw new Error("Must provide either datasetName or datasetId, not both");
9455
6950
  } else if (datasetId) {
9456
6951
  (0, _uuid_js_1.assertUuid)(datasetId);
9457
- path3 += `/${datasetId}`;
6952
+ path += `/${datasetId}`;
9458
6953
  } else if (datasetName) {
9459
6954
  params.append("name", datasetName);
9460
6955
  } else {
9461
6956
  throw new Error("Must provide datasetName or datasetId");
9462
6957
  }
9463
- const response = await this._get(path3, params);
6958
+ const response = await this._get(path, params);
9464
6959
  let result;
9465
6960
  if (Array.isArray(response)) {
9466
6961
  if (response.length === 0) {
@@ -9504,19 +6999,19 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9504
6999
  return response;
9505
7000
  }
9506
7001
  async readDatasetOpenaiFinetuning({ datasetId, datasetName }) {
9507
- const path3 = "/datasets";
7002
+ const path = "/datasets";
9508
7003
  if (datasetId !== void 0) ; else if (datasetName !== void 0) {
9509
7004
  datasetId = (await this.readDataset({ datasetName })).id;
9510
7005
  } else {
9511
7006
  throw new Error("Must provide either datasetName or datasetId");
9512
7007
  }
9513
- const response = await this._getResponse(`${path3}/${datasetId}/openai_ft`);
7008
+ const response = await this._getResponse(`${path}/${datasetId}/openai_ft`);
9514
7009
  const datasetText = await response.text();
9515
7010
  const dataset = datasetText.trim().split("\n").map((line) => JSON.parse(line));
9516
7011
  return dataset;
9517
7012
  }
9518
7013
  async *listDatasets({ limit = 100, offset = 0, datasetIds, datasetName, datasetNameContains, metadata } = {}) {
9519
- const path3 = "/datasets";
7014
+ const path = "/datasets";
9520
7015
  const params = new URLSearchParams({
9521
7016
  limit: limit.toString(),
9522
7017
  offset: offset.toString()
@@ -9535,7 +7030,7 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9535
7030
  if (metadata !== void 0) {
9536
7031
  params.append("metadata", JSON.stringify(metadata));
9537
7032
  }
9538
- for await (const datasets of this._getPaginated(path3, params)) {
7033
+ for await (const datasets of this._getPaginated(path, params)) {
9539
7034
  yield* datasets;
9540
7035
  }
9541
7036
  }
@@ -9604,7 +7099,7 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9604
7099
  });
9605
7100
  }
9606
7101
  async deleteDataset({ datasetId, datasetName }) {
9607
- let path3 = "/datasets";
7102
+ let path = "/datasets";
9608
7103
  let datasetId_ = datasetId;
9609
7104
  if (datasetId !== void 0 && datasetName !== void 0) {
9610
7105
  throw new Error("Must provide either datasetName or datasetId, not both");
@@ -9614,18 +7109,18 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9614
7109
  }
9615
7110
  if (datasetId_ !== void 0) {
9616
7111
  (0, _uuid_js_1.assertUuid)(datasetId_);
9617
- path3 += `/${datasetId_}`;
7112
+ path += `/${datasetId_}`;
9618
7113
  } else {
9619
7114
  throw new Error("Must provide datasetName or datasetId");
9620
7115
  }
9621
7116
  await this.caller.call(async () => {
9622
- const res = await this._fetch(this.apiUrl + path3, {
7117
+ const res = await this._fetch(this.apiUrl + path, {
9623
7118
  method: "DELETE",
9624
7119
  headers: this.headers,
9625
7120
  signal: AbortSignal.timeout(this.timeout_ms),
9626
7121
  ...this.fetchOptions
9627
7122
  });
9628
- await (0, error_js_1.raiseForStatus)(res, `delete ${path3}`, true);
7123
+ await (0, error_js_1.raiseForStatus)(res, `delete ${path}`, true);
9629
7124
  return res;
9630
7125
  });
9631
7126
  }
@@ -9816,8 +7311,8 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9816
7311
  }
9817
7312
  async readExample(exampleId) {
9818
7313
  (0, _uuid_js_1.assertUuid)(exampleId);
9819
- const path3 = `/examples/${exampleId}`;
9820
- const rawExample = await this._get(path3);
7314
+ const path = `/examples/${exampleId}`;
7315
+ const rawExample = await this._get(path);
9821
7316
  const { attachment_urls, ...rest } = rawExample;
9822
7317
  const example = rest;
9823
7318
  if (attachment_urls) {
@@ -9900,15 +7395,15 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9900
7395
  }
9901
7396
  async deleteExample(exampleId) {
9902
7397
  (0, _uuid_js_1.assertUuid)(exampleId);
9903
- const path3 = `/examples/${exampleId}`;
7398
+ const path = `/examples/${exampleId}`;
9904
7399
  await this.caller.call(async () => {
9905
- const res = await this._fetch(this.apiUrl + path3, {
7400
+ const res = await this._fetch(this.apiUrl + path, {
9906
7401
  method: "DELETE",
9907
7402
  headers: this.headers,
9908
7403
  signal: AbortSignal.timeout(this.timeout_ms),
9909
7404
  ...this.fetchOptions
9910
7405
  });
9911
- await (0, error_js_1.raiseForStatus)(res, `delete ${path3}`, true);
7406
+ await (0, error_js_1.raiseForStatus)(res, `delete ${path}`, true);
9912
7407
  return res;
9913
7408
  });
9914
7409
  }
@@ -9921,9 +7416,9 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
9921
7416
  async deleteExamples(exampleIds, options) {
9922
7417
  exampleIds.forEach((id) => (0, _uuid_js_1.assertUuid)(id));
9923
7418
  if (options?.hardDelete) {
9924
- const path3 = this._getPlatformEndpointPath("datasets/examples/delete");
7419
+ const path = this._getPlatformEndpointPath("datasets/examples/delete");
9925
7420
  await this.caller.call(async () => {
9926
- const res = await this._fetch(`${this.apiUrl}${path3}`, {
7421
+ const res = await this._fetch(`${this.apiUrl}${path}`, {
9927
7422
  method: "POST",
9928
7423
  headers: { ...this.headers, "Content-Type": "application/json" },
9929
7424
  body: JSON.stringify({
@@ -10177,21 +7672,21 @@ Message: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecifie
10177
7672
  }
10178
7673
  async readFeedback(feedbackId) {
10179
7674
  (0, _uuid_js_1.assertUuid)(feedbackId);
10180
- const path3 = `/feedback/${feedbackId}`;
10181
- const response = await this._get(path3);
7675
+ const path = `/feedback/${feedbackId}`;
7676
+ const response = await this._get(path);
10182
7677
  return response;
10183
7678
  }
10184
7679
  async deleteFeedback(feedbackId) {
10185
7680
  (0, _uuid_js_1.assertUuid)(feedbackId);
10186
- const path3 = `/feedback/${feedbackId}`;
7681
+ const path = `/feedback/${feedbackId}`;
10187
7682
  await this.caller.call(async () => {
10188
- const res = await this._fetch(this.apiUrl + path3, {
7683
+ const res = await this._fetch(this.apiUrl + path, {
10189
7684
  method: "DELETE",
10190
7685
  headers: this.headers,
10191
7686
  signal: AbortSignal.timeout(this.timeout_ms),
10192
7687
  ...this.fetchOptions
10193
7688
  });
10194
- await (0, error_js_1.raiseForStatus)(res, `delete ${path3}`, true);
7689
+ await (0, error_js_1.raiseForStatus)(res, `delete ${path}`, true);
10195
7690
  return res;
10196
7691
  });
10197
7692
  }
@@ -12565,7 +10060,7 @@ var require_console = __commonJS({
12565
10060
  exports$1.ConsoleCallbackHandler = void 0;
12566
10061
  var ansi_styles_1 = __importDefault(require_ansi_styles());
12567
10062
  var base_js_1 = require_base2();
12568
- function wrap2(style, text) {
10063
+ function wrap(style, text) {
12569
10064
  return `${style.open}${text}${style.close}`;
12570
10065
  }
12571
10066
  function tryJsonStringify(obj, fallback) {
@@ -12643,9 +10138,9 @@ var require_console = __commonJS({
12643
10138
  const parents = this.getParents(run).reverse();
12644
10139
  const string = [...parents, run].map((parent, i, arr) => {
12645
10140
  const name = `${parent.execution_order}:${parent.run_type}:${parent.name}`;
12646
- return i === arr.length - 1 ? wrap2(ansi_styles_1.default.bold, name) : name;
10141
+ return i === arr.length - 1 ? wrap(ansi_styles_1.default.bold, name) : name;
12647
10142
  }).join(" > ");
12648
- return wrap2(color.grey, string);
10143
+ return wrap(color.grey, string);
12649
10144
  }
12650
10145
  // logging methods
12651
10146
  /**
@@ -12655,7 +10150,7 @@ var require_console = __commonJS({
12655
10150
  */
12656
10151
  onChainStart(run) {
12657
10152
  const crumbs = this.getBreadcrumbs(run);
12658
- console.log(`${wrap2(color.green, "[chain/start]")} [${crumbs}] Entering Chain run with input: ${tryJsonStringify(run.inputs, "[inputs]")}`);
10153
+ console.log(`${wrap(color.green, "[chain/start]")} [${crumbs}] Entering Chain run with input: ${tryJsonStringify(run.inputs, "[inputs]")}`);
12659
10154
  }
12660
10155
  /**
12661
10156
  * Method used to log the end of a chain run.
@@ -12664,7 +10159,7 @@ var require_console = __commonJS({
12664
10159
  */
12665
10160
  onChainEnd(run) {
12666
10161
  const crumbs = this.getBreadcrumbs(run);
12667
- console.log(`${wrap2(color.cyan, "[chain/end]")} [${crumbs}] [${elapsed(run)}] Exiting Chain run with output: ${tryJsonStringify(run.outputs, "[outputs]")}`);
10162
+ console.log(`${wrap(color.cyan, "[chain/end]")} [${crumbs}] [${elapsed(run)}] Exiting Chain run with output: ${tryJsonStringify(run.outputs, "[outputs]")}`);
12668
10163
  }
12669
10164
  /**
12670
10165
  * Method used to log any errors of a chain run.
@@ -12673,7 +10168,7 @@ var require_console = __commonJS({
12673
10168
  */
12674
10169
  onChainError(run) {
12675
10170
  const crumbs = this.getBreadcrumbs(run);
12676
- console.log(`${wrap2(color.red, "[chain/error]")} [${crumbs}] [${elapsed(run)}] Chain run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
10171
+ console.log(`${wrap(color.red, "[chain/error]")} [${crumbs}] [${elapsed(run)}] Chain run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
12677
10172
  }
12678
10173
  /**
12679
10174
  * Method used to log the start of an LLM run.
@@ -12683,7 +10178,7 @@ var require_console = __commonJS({
12683
10178
  onLLMStart(run) {
12684
10179
  const crumbs = this.getBreadcrumbs(run);
12685
10180
  const inputs = "prompts" in run.inputs ? { prompts: run.inputs.prompts.map((p) => p.trim()) } : run.inputs;
12686
- console.log(`${wrap2(color.green, "[llm/start]")} [${crumbs}] Entering LLM run with input: ${tryJsonStringify(inputs, "[inputs]")}`);
10181
+ console.log(`${wrap(color.green, "[llm/start]")} [${crumbs}] Entering LLM run with input: ${tryJsonStringify(inputs, "[inputs]")}`);
12687
10182
  }
12688
10183
  /**
12689
10184
  * Method used to log the end of an LLM run.
@@ -12692,7 +10187,7 @@ var require_console = __commonJS({
12692
10187
  */
12693
10188
  onLLMEnd(run) {
12694
10189
  const crumbs = this.getBreadcrumbs(run);
12695
- console.log(`${wrap2(color.cyan, "[llm/end]")} [${crumbs}] [${elapsed(run)}] Exiting LLM run with output: ${tryJsonStringify(run.outputs, "[response]")}`);
10190
+ console.log(`${wrap(color.cyan, "[llm/end]")} [${crumbs}] [${elapsed(run)}] Exiting LLM run with output: ${tryJsonStringify(run.outputs, "[response]")}`);
12696
10191
  }
12697
10192
  /**
12698
10193
  * Method used to log any errors of an LLM run.
@@ -12701,7 +10196,7 @@ var require_console = __commonJS({
12701
10196
  */
12702
10197
  onLLMError(run) {
12703
10198
  const crumbs = this.getBreadcrumbs(run);
12704
- console.log(`${wrap2(color.red, "[llm/error]")} [${crumbs}] [${elapsed(run)}] LLM run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
10199
+ console.log(`${wrap(color.red, "[llm/error]")} [${crumbs}] [${elapsed(run)}] LLM run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
12705
10200
  }
12706
10201
  /**
12707
10202
  * Method used to log the start of a tool run.
@@ -12710,7 +10205,7 @@ var require_console = __commonJS({
12710
10205
  */
12711
10206
  onToolStart(run) {
12712
10207
  const crumbs = this.getBreadcrumbs(run);
12713
- console.log(`${wrap2(color.green, "[tool/start]")} [${crumbs}] Entering Tool run with input: "${formatKVMapItem(run.inputs.input)}"`);
10208
+ console.log(`${wrap(color.green, "[tool/start]")} [${crumbs}] Entering Tool run with input: "${formatKVMapItem(run.inputs.input)}"`);
12714
10209
  }
12715
10210
  /**
12716
10211
  * Method used to log the end of a tool run.
@@ -12719,7 +10214,7 @@ var require_console = __commonJS({
12719
10214
  */
12720
10215
  onToolEnd(run) {
12721
10216
  const crumbs = this.getBreadcrumbs(run);
12722
- console.log(`${wrap2(color.cyan, "[tool/end]")} [${crumbs}] [${elapsed(run)}] Exiting Tool run with output: "${formatKVMapItem(run.outputs?.output)}"`);
10217
+ console.log(`${wrap(color.cyan, "[tool/end]")} [${crumbs}] [${elapsed(run)}] Exiting Tool run with output: "${formatKVMapItem(run.outputs?.output)}"`);
12723
10218
  }
12724
10219
  /**
12725
10220
  * Method used to log any errors of a tool run.
@@ -12728,7 +10223,7 @@ var require_console = __commonJS({
12728
10223
  */
12729
10224
  onToolError(run) {
12730
10225
  const crumbs = this.getBreadcrumbs(run);
12731
- console.log(`${wrap2(color.red, "[tool/error]")} [${crumbs}] [${elapsed(run)}] Tool run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
10226
+ console.log(`${wrap(color.red, "[tool/error]")} [${crumbs}] [${elapsed(run)}] Tool run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
12732
10227
  }
12733
10228
  /**
12734
10229
  * Method used to log the start of a retriever run.
@@ -12737,7 +10232,7 @@ var require_console = __commonJS({
12737
10232
  */
12738
10233
  onRetrieverStart(run) {
12739
10234
  const crumbs = this.getBreadcrumbs(run);
12740
- console.log(`${wrap2(color.green, "[retriever/start]")} [${crumbs}] Entering Retriever run with input: ${tryJsonStringify(run.inputs, "[inputs]")}`);
10235
+ console.log(`${wrap(color.green, "[retriever/start]")} [${crumbs}] Entering Retriever run with input: ${tryJsonStringify(run.inputs, "[inputs]")}`);
12741
10236
  }
12742
10237
  /**
12743
10238
  * Method used to log the end of a retriever run.
@@ -12746,7 +10241,7 @@ var require_console = __commonJS({
12746
10241
  */
12747
10242
  onRetrieverEnd(run) {
12748
10243
  const crumbs = this.getBreadcrumbs(run);
12749
- console.log(`${wrap2(color.cyan, "[retriever/end]")} [${crumbs}] [${elapsed(run)}] Exiting Retriever run with output: ${tryJsonStringify(run.outputs, "[outputs]")}`);
10244
+ console.log(`${wrap(color.cyan, "[retriever/end]")} [${crumbs}] [${elapsed(run)}] Exiting Retriever run with output: ${tryJsonStringify(run.outputs, "[outputs]")}`);
12750
10245
  }
12751
10246
  /**
12752
10247
  * Method used to log any errors of a retriever run.
@@ -12755,7 +10250,7 @@ var require_console = __commonJS({
12755
10250
  */
12756
10251
  onRetrieverError(run) {
12757
10252
  const crumbs = this.getBreadcrumbs(run);
12758
- console.log(`${wrap2(color.red, "[retriever/error]")} [${crumbs}] [${elapsed(run)}] Retriever run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
10253
+ console.log(`${wrap(color.red, "[retriever/error]")} [${crumbs}] [${elapsed(run)}] Retriever run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
12759
10254
  }
12760
10255
  /**
12761
10256
  * Method used to log the action selected by the agent.
@@ -12765,7 +10260,7 @@ var require_console = __commonJS({
12765
10260
  onAgentAction(run) {
12766
10261
  const agentRun = run;
12767
10262
  const crumbs = this.getBreadcrumbs(run);
12768
- console.log(`${wrap2(color.blue, "[agent/action]")} [${crumbs}] Agent selected action: ${tryJsonStringify(agentRun.actions[agentRun.actions.length - 1], "[action]")}`);
10263
+ console.log(`${wrap(color.blue, "[agent/action]")} [${crumbs}] Agent selected action: ${tryJsonStringify(agentRun.actions[agentRun.actions.length - 1], "[action]")}`);
12769
10264
  }
12770
10265
  };
12771
10266
  exports$1.ConsoleCallbackHandler = ConsoleCallbackHandler;
@@ -15319,1188 +12814,122 @@ var require_manager = __commonJS({
15319
12814
  let handler;
15320
12815
  const contextVarValue = contextVar !== void 0 ? (0, context_js_1.getContextVariable)(contextVar) : void 0;
15321
12816
  if (contextVarValue && (0, base_js_1.isBaseCallbackHandler)(contextVarValue)) {
15322
- handler = contextVarValue;
15323
- } else if (createIfNotInContext) {
15324
- handler = new handlerClass({});
15325
- }
15326
- if (handler !== void 0) {
15327
- if (!callbackManager) {
15328
- callbackManager = new _CallbackManager();
15329
- }
15330
- if (!callbackManager.handlers.some((h) => h.name === handler.name)) {
15331
- callbackManager.addHandler(handler, inheritable);
15332
- }
15333
- }
15334
- }
15335
- if (inheritableTags || localTags) {
15336
- if (callbackManager) {
15337
- callbackManager.addTags(inheritableTags ?? []);
15338
- callbackManager.addTags(localTags ?? [], false);
15339
- }
15340
- }
15341
- if (inheritableMetadata || localMetadata) {
15342
- if (callbackManager) {
15343
- callbackManager.addMetadata(inheritableMetadata ?? {});
15344
- callbackManager.addMetadata(localMetadata ?? {}, false);
15345
- }
15346
- }
15347
- return callbackManager;
15348
- }
15349
- };
15350
- exports$1.CallbackManager = CallbackManager;
15351
- function ensureHandler(handler) {
15352
- if ("name" in handler) {
15353
- return handler;
15354
- }
15355
- return base_js_1.BaseCallbackHandler.fromMethods(handler);
15356
- }
15357
- var TraceGroup = class {
15358
- constructor(groupName, options) {
15359
- Object.defineProperty(this, "groupName", {
15360
- enumerable: true,
15361
- configurable: true,
15362
- writable: true,
15363
- value: groupName
15364
- });
15365
- Object.defineProperty(this, "options", {
15366
- enumerable: true,
15367
- configurable: true,
15368
- writable: true,
15369
- value: options
15370
- });
15371
- Object.defineProperty(this, "runManager", {
15372
- enumerable: true,
15373
- configurable: true,
15374
- writable: true,
15375
- value: void 0
15376
- });
15377
- }
15378
- async getTraceGroupCallbackManager(group_name, inputs, options) {
15379
- const cb = new tracer_langchain_js_1.LangChainTracer(options);
15380
- const cm = await CallbackManager.configure([cb]);
15381
- const runManager = await cm?.handleChainStart({
15382
- lc: 1,
15383
- type: "not_implemented",
15384
- id: ["langchain", "callbacks", "groups", group_name]
15385
- }, inputs ?? {});
15386
- if (!runManager) {
15387
- throw new Error("Failed to create run group callback manager.");
15388
- }
15389
- return runManager;
15390
- }
15391
- async start(inputs) {
15392
- if (!this.runManager) {
15393
- this.runManager = await this.getTraceGroupCallbackManager(this.groupName, inputs, this.options);
15394
- }
15395
- return this.runManager.getChild();
15396
- }
15397
- async error(err) {
15398
- if (this.runManager) {
15399
- await this.runManager.handleChainError(err);
15400
- this.runManager = void 0;
15401
- }
15402
- }
15403
- async end(output) {
15404
- if (this.runManager) {
15405
- await this.runManager.handleChainEnd(output ?? {});
15406
- this.runManager = void 0;
15407
- }
15408
- }
15409
- };
15410
- exports$1.TraceGroup = TraceGroup;
15411
- function _coerceToDict(value, defaultKey) {
15412
- return value && !Array.isArray(value) && typeof value === "object" ? value : { [defaultKey]: value };
15413
- }
15414
- async function traceAsGroup(groupOptions, enclosedCode, ...args) {
15415
- const traceGroup = new TraceGroup(groupOptions.name, groupOptions);
15416
- const callbackManager = await traceGroup.start({ ...args });
15417
- try {
15418
- const result = await enclosedCode(callbackManager, ...args);
15419
- await traceGroup.end(_coerceToDict(result, "output"));
15420
- return result;
15421
- } catch (err) {
15422
- await traceGroup.error(err);
15423
- throw err;
15424
- }
15425
- }
15426
- }
15427
- });
15428
-
15429
- // node_modules/@traceloop/instrumentation-langchain/node_modules/@langchain/core/callbacks/manager.cjs
15430
- var require_manager2 = __commonJS({
15431
- "node_modules/@traceloop/instrumentation-langchain/node_modules/@langchain/core/callbacks/manager.cjs"(exports$1, module) {
15432
- module.exports = require_manager();
15433
- }
15434
- });
15435
-
15436
- // node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js
15437
- var NoopLogger = class {
15438
- emit(_logRecord) {
15439
- }
15440
- };
15441
- var NOOP_LOGGER = new NoopLogger();
15442
-
15443
- // node_modules/@opentelemetry/api-logs/build/esm/NoopLoggerProvider.js
15444
- var NoopLoggerProvider = class {
15445
- getLogger(_name, _version, _options) {
15446
- return new NoopLogger();
15447
- }
15448
- };
15449
- var NOOP_LOGGER_PROVIDER = new NoopLoggerProvider();
15450
-
15451
- // node_modules/@opentelemetry/api-logs/build/esm/ProxyLogger.js
15452
- var ProxyLogger = class {
15453
- constructor(_provider, name, version2, options) {
15454
- this._provider = _provider;
15455
- this.name = name;
15456
- this.version = version2;
15457
- this.options = options;
15458
- }
15459
- /**
15460
- * Emit a log record. This method should only be used by log appenders.
15461
- *
15462
- * @param logRecord
15463
- */
15464
- emit(logRecord) {
15465
- this._getLogger().emit(logRecord);
15466
- }
15467
- /**
15468
- * Try to get a logger from the proxy logger provider.
15469
- * If the proxy logger provider has no delegate, return a noop logger.
15470
- */
15471
- _getLogger() {
15472
- if (this._delegate) {
15473
- return this._delegate;
15474
- }
15475
- const logger2 = this._provider.getDelegateLogger(this.name, this.version, this.options);
15476
- if (!logger2) {
15477
- return NOOP_LOGGER;
15478
- }
15479
- this._delegate = logger2;
15480
- return this._delegate;
15481
- }
15482
- };
15483
-
15484
- // node_modules/@opentelemetry/api-logs/build/esm/ProxyLoggerProvider.js
15485
- var ProxyLoggerProvider = class {
15486
- getLogger(name, version2, options) {
15487
- var _a;
15488
- return (_a = this.getDelegateLogger(name, version2, options)) !== null && _a !== void 0 ? _a : new ProxyLogger(this, name, version2, options);
15489
- }
15490
- getDelegate() {
15491
- var _a;
15492
- return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_LOGGER_PROVIDER;
15493
- }
15494
- /**
15495
- * Set the delegate logger provider
15496
- */
15497
- setDelegate(delegate) {
15498
- this._delegate = delegate;
15499
- }
15500
- getDelegateLogger(name, version2, options) {
15501
- var _a;
15502
- return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getLogger(name, version2, options);
15503
- }
15504
- };
15505
-
15506
- // node_modules/@opentelemetry/api-logs/build/esm/platform/node/globalThis.js
15507
- var _globalThis = typeof globalThis === "object" ? globalThis : global;
15508
-
15509
- // node_modules/@opentelemetry/api-logs/build/esm/internal/global-utils.js
15510
- var GLOBAL_LOGS_API_KEY = /* @__PURE__ */ Symbol.for("io.opentelemetry.js.api.logs");
15511
- var _global = _globalThis;
15512
- function makeGetter(requiredVersion, instance, fallback) {
15513
- return (version2) => version2 === requiredVersion ? instance : fallback;
15514
- }
15515
- var API_BACKWARDS_COMPATIBILITY_VERSION = 1;
15516
-
15517
- // node_modules/@opentelemetry/api-logs/build/esm/api/logs.js
15518
- var LogsAPI = class _LogsAPI {
15519
- constructor() {
15520
- this._proxyLoggerProvider = new ProxyLoggerProvider();
15521
- }
15522
- static getInstance() {
15523
- if (!this._instance) {
15524
- this._instance = new _LogsAPI();
15525
- }
15526
- return this._instance;
15527
- }
15528
- setGlobalLoggerProvider(provider) {
15529
- if (_global[GLOBAL_LOGS_API_KEY]) {
15530
- return this.getLoggerProvider();
15531
- }
15532
- _global[GLOBAL_LOGS_API_KEY] = makeGetter(API_BACKWARDS_COMPATIBILITY_VERSION, provider, NOOP_LOGGER_PROVIDER);
15533
- this._proxyLoggerProvider.setDelegate(provider);
15534
- return provider;
15535
- }
15536
- /**
15537
- * Returns the global logger provider.
15538
- *
15539
- * @returns LoggerProvider
15540
- */
15541
- getLoggerProvider() {
15542
- var _a, _b;
15543
- return (_b = (_a = _global[GLOBAL_LOGS_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(_global, API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : this._proxyLoggerProvider;
15544
- }
15545
- /**
15546
- * Returns a logger from the global logger provider.
15547
- *
15548
- * @returns Logger
15549
- */
15550
- getLogger(name, version2, options) {
15551
- return this.getLoggerProvider().getLogger(name, version2, options);
15552
- }
15553
- /** Remove the global logger provider */
15554
- disable() {
15555
- delete _global[GLOBAL_LOGS_API_KEY];
15556
- this._proxyLoggerProvider = new ProxyLoggerProvider();
15557
- }
15558
- };
15559
-
15560
- // node_modules/@opentelemetry/api-logs/build/esm/index.js
15561
- var logs = LogsAPI.getInstance();
15562
- var VERSION_REGEXP = /^(?:v)?(?<version>(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*))(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
15563
- var RANGE_REGEXP = /^(?<op><|>|=|==|<=|>=|~|\^|~>)?\s*(?:v)?(?<version>(?<major>x|X|\*|0|[1-9]\d*)(?:\.(?<minor>x|X|\*|0|[1-9]\d*))?(?:\.(?<patch>x|X|\*|0|[1-9]\d*))?)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<build>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
15564
- var operatorResMap = {
15565
- ">": [1],
15566
- ">=": [0, 1],
15567
- "=": [0],
15568
- "<=": [-1, 0],
15569
- "<": [-1],
15570
- "!=": [-1, 1]
15571
- };
15572
- function satisfies(version2, range, options) {
15573
- if (!_validateVersion(version2)) {
15574
- diag.error(`Invalid version: ${version2}`);
15575
- return false;
15576
- }
15577
- if (!range) {
15578
- return true;
15579
- }
15580
- range = range.replace(/([<>=~^]+)\s+/g, "$1");
15581
- const parsedVersion = _parseVersion(version2);
15582
- if (!parsedVersion) {
15583
- return false;
15584
- }
15585
- const allParsedRanges = [];
15586
- const checkResult = _doSatisfies(parsedVersion, range, allParsedRanges, options);
15587
- if (checkResult && !options?.includePrerelease) {
15588
- return _doPreleaseCheck(parsedVersion, allParsedRanges);
15589
- }
15590
- return checkResult;
15591
- }
15592
- function _validateVersion(version2) {
15593
- return typeof version2 === "string" && VERSION_REGEXP.test(version2);
15594
- }
15595
- function _doSatisfies(parsedVersion, range, allParsedRanges, options) {
15596
- if (range.includes("||")) {
15597
- const ranges = range.trim().split("||");
15598
- for (const r of ranges) {
15599
- if (_checkRange(parsedVersion, r, allParsedRanges, options)) {
15600
- return true;
15601
- }
15602
- }
15603
- return false;
15604
- } else if (range.includes(" - ")) {
15605
- range = replaceHyphen(range, options);
15606
- } else if (range.includes(" ")) {
15607
- const ranges = range.trim().replace(/\s{2,}/g, " ").split(" ");
15608
- for (const r of ranges) {
15609
- if (!_checkRange(parsedVersion, r, allParsedRanges, options)) {
15610
- return false;
15611
- }
15612
- }
15613
- return true;
15614
- }
15615
- return _checkRange(parsedVersion, range, allParsedRanges, options);
15616
- }
15617
- function _checkRange(parsedVersion, range, allParsedRanges, options) {
15618
- range = _normalizeRange(range, options);
15619
- if (range.includes(" ")) {
15620
- return _doSatisfies(parsedVersion, range, allParsedRanges, options);
15621
- } else {
15622
- const parsedRange = _parseRange(range);
15623
- allParsedRanges.push(parsedRange);
15624
- return _satisfies(parsedVersion, parsedRange);
15625
- }
15626
- }
15627
- function _satisfies(parsedVersion, parsedRange) {
15628
- if (parsedRange.invalid) {
15629
- return false;
15630
- }
15631
- if (!parsedRange.version || _isWildcard(parsedRange.version)) {
15632
- return true;
15633
- }
15634
- let comparisonResult = _compareVersionSegments(parsedVersion.versionSegments || [], parsedRange.versionSegments || []);
15635
- if (comparisonResult === 0) {
15636
- const versionPrereleaseSegments = parsedVersion.prereleaseSegments || [];
15637
- const rangePrereleaseSegments = parsedRange.prereleaseSegments || [];
15638
- if (!versionPrereleaseSegments.length && !rangePrereleaseSegments.length) {
15639
- comparisonResult = 0;
15640
- } else if (!versionPrereleaseSegments.length && rangePrereleaseSegments.length) {
15641
- comparisonResult = 1;
15642
- } else if (versionPrereleaseSegments.length && !rangePrereleaseSegments.length) {
15643
- comparisonResult = -1;
15644
- } else {
15645
- comparisonResult = _compareVersionSegments(versionPrereleaseSegments, rangePrereleaseSegments);
15646
- }
15647
- }
15648
- return operatorResMap[parsedRange.op]?.includes(comparisonResult);
15649
- }
15650
- function _doPreleaseCheck(parsedVersion, allParsedRanges) {
15651
- if (parsedVersion.prerelease) {
15652
- return allParsedRanges.some((r) => r.prerelease && r.version === parsedVersion.version);
15653
- }
15654
- return true;
15655
- }
15656
- function _normalizeRange(range, options) {
15657
- range = range.trim();
15658
- range = replaceCaret(range, options);
15659
- range = replaceTilde(range);
15660
- range = replaceXRange(range, options);
15661
- range = range.trim();
15662
- return range;
15663
- }
15664
- function isX(id) {
15665
- return !id || id.toLowerCase() === "x" || id === "*";
15666
- }
15667
- function _parseVersion(versionString) {
15668
- const match = versionString.match(VERSION_REGEXP);
15669
- if (!match) {
15670
- diag.error(`Invalid version: ${versionString}`);
15671
- return void 0;
15672
- }
15673
- const version2 = match.groups.version;
15674
- const prerelease = match.groups.prerelease;
15675
- const build = match.groups.build;
15676
- const versionSegments = version2.split(".");
15677
- const prereleaseSegments = prerelease?.split(".");
15678
- return {
15679
- op: void 0,
15680
- version: version2,
15681
- versionSegments,
15682
- versionSegmentCount: versionSegments.length,
15683
- prerelease,
15684
- prereleaseSegments,
15685
- prereleaseSegmentCount: prereleaseSegments ? prereleaseSegments.length : 0,
15686
- build
15687
- };
15688
- }
15689
- function _parseRange(rangeString) {
15690
- if (!rangeString) {
15691
- return {};
15692
- }
15693
- const match = rangeString.match(RANGE_REGEXP);
15694
- if (!match) {
15695
- diag.error(`Invalid range: ${rangeString}`);
15696
- return {
15697
- invalid: true
15698
- };
15699
- }
15700
- let op = match.groups.op;
15701
- const version2 = match.groups.version;
15702
- const prerelease = match.groups.prerelease;
15703
- const build = match.groups.build;
15704
- const versionSegments = version2.split(".");
15705
- const prereleaseSegments = prerelease?.split(".");
15706
- if (op === "==") {
15707
- op = "=";
15708
- }
15709
- return {
15710
- op: op || "=",
15711
- version: version2,
15712
- versionSegments,
15713
- versionSegmentCount: versionSegments.length,
15714
- prerelease,
15715
- prereleaseSegments,
15716
- prereleaseSegmentCount: prereleaseSegments ? prereleaseSegments.length : 0,
15717
- build
15718
- };
15719
- }
15720
- function _isWildcard(s) {
15721
- return s === "*" || s === "x" || s === "X";
15722
- }
15723
- function _parseVersionString(v) {
15724
- const n = parseInt(v, 10);
15725
- return isNaN(n) ? v : n;
15726
- }
15727
- function _normalizeVersionType(a, b) {
15728
- if (typeof a === typeof b) {
15729
- if (typeof a === "number") {
15730
- return [a, b];
15731
- } else if (typeof a === "string") {
15732
- return [a, b];
15733
- } else {
15734
- throw new Error("Version segments can only be strings or numbers");
15735
- }
15736
- } else {
15737
- return [String(a), String(b)];
15738
- }
15739
- }
15740
- function _compareVersionStrings(v1, v2) {
15741
- if (_isWildcard(v1) || _isWildcard(v2)) {
15742
- return 0;
15743
- }
15744
- const [parsedV1, parsedV2] = _normalizeVersionType(_parseVersionString(v1), _parseVersionString(v2));
15745
- if (parsedV1 > parsedV2) {
15746
- return 1;
15747
- } else if (parsedV1 < parsedV2) {
15748
- return -1;
15749
- }
15750
- return 0;
15751
- }
15752
- function _compareVersionSegments(v1, v2) {
15753
- for (let i = 0; i < Math.max(v1.length, v2.length); i++) {
15754
- const res = _compareVersionStrings(v1[i] || "0", v2[i] || "0");
15755
- if (res !== 0) {
15756
- return res;
15757
- }
15758
- }
15759
- return 0;
15760
- }
15761
- var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
15762
- var NUMERICIDENTIFIER = "0|[1-9]\\d*";
15763
- var NONNUMERICIDENTIFIER = `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`;
15764
- var GTLT = "((?:<|>)?=?)";
15765
- var PRERELEASEIDENTIFIER = `(?:${NUMERICIDENTIFIER}|${NONNUMERICIDENTIFIER})`;
15766
- var PRERELEASE = `(?:-(${PRERELEASEIDENTIFIER}(?:\\.${PRERELEASEIDENTIFIER})*))`;
15767
- var BUILDIDENTIFIER = `${LETTERDASHNUMBER}+`;
15768
- var BUILD = `(?:\\+(${BUILDIDENTIFIER}(?:\\.${BUILDIDENTIFIER})*))`;
15769
- var XRANGEIDENTIFIER = `${NUMERICIDENTIFIER}|x|X|\\*`;
15770
- var XRANGEPLAIN = `[v=\\s]*(${XRANGEIDENTIFIER})(?:\\.(${XRANGEIDENTIFIER})(?:\\.(${XRANGEIDENTIFIER})(?:${PRERELEASE})?${BUILD}?)?)?`;
15771
- var XRANGE = `^${GTLT}\\s*${XRANGEPLAIN}$`;
15772
- var XRANGE_REGEXP = new RegExp(XRANGE);
15773
- var HYPHENRANGE = `^\\s*(${XRANGEPLAIN})\\s+-\\s+(${XRANGEPLAIN})\\s*$`;
15774
- var HYPHENRANGE_REGEXP = new RegExp(HYPHENRANGE);
15775
- var LONETILDE = "(?:~>?)";
15776
- var TILDE = `^${LONETILDE}${XRANGEPLAIN}$`;
15777
- var TILDE_REGEXP = new RegExp(TILDE);
15778
- var LONECARET = "(?:\\^)";
15779
- var CARET = `^${LONECARET}${XRANGEPLAIN}$`;
15780
- var CARET_REGEXP = new RegExp(CARET);
15781
- function replaceTilde(comp) {
15782
- const r = TILDE_REGEXP;
15783
- return comp.replace(r, (_, M, m, p, pr) => {
15784
- let ret;
15785
- if (isX(M)) {
15786
- ret = "";
15787
- } else if (isX(m)) {
15788
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
15789
- } else if (isX(p)) {
15790
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
15791
- } else if (pr) {
15792
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
15793
- } else {
15794
- ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
15795
- }
15796
- return ret;
15797
- });
15798
- }
15799
- function replaceCaret(comp, options) {
15800
- const r = CARET_REGEXP;
15801
- const z = options?.includePrerelease ? "-0" : "";
15802
- return comp.replace(r, (_, M, m, p, pr) => {
15803
- let ret;
15804
- if (isX(M)) {
15805
- ret = "";
15806
- } else if (isX(m)) {
15807
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
15808
- } else if (isX(p)) {
15809
- if (M === "0") {
15810
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
15811
- } else {
15812
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
15813
- }
15814
- } else if (pr) {
15815
- if (M === "0") {
15816
- if (m === "0") {
15817
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
15818
- } else {
15819
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
15820
- }
15821
- } else {
15822
- ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
15823
- }
15824
- } else {
15825
- if (M === "0") {
15826
- if (m === "0") {
15827
- ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
15828
- } else {
15829
- ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
12817
+ handler = contextVarValue;
12818
+ } else if (createIfNotInContext) {
12819
+ handler = new handlerClass({});
12820
+ }
12821
+ if (handler !== void 0) {
12822
+ if (!callbackManager) {
12823
+ callbackManager = new _CallbackManager();
12824
+ }
12825
+ if (!callbackManager.handlers.some((h) => h.name === handler.name)) {
12826
+ callbackManager.addHandler(handler, inheritable);
12827
+ }
12828
+ }
15830
12829
  }
15831
- } else {
15832
- ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
15833
- }
15834
- }
15835
- return ret;
15836
- });
15837
- }
15838
- function replaceXRange(comp, options) {
15839
- const r = XRANGE_REGEXP;
15840
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
15841
- const xM = isX(M);
15842
- const xm = xM || isX(m);
15843
- const xp = xm || isX(p);
15844
- const anyX = xp;
15845
- if (gtlt === "=" && anyX) {
15846
- gtlt = "";
15847
- }
15848
- pr = options?.includePrerelease ? "-0" : "";
15849
- if (xM) {
15850
- if (gtlt === ">" || gtlt === "<") {
15851
- ret = "<0.0.0-0";
15852
- } else {
15853
- ret = "*";
15854
- }
15855
- } else if (gtlt && anyX) {
15856
- if (xm) {
15857
- m = 0;
15858
- }
15859
- p = 0;
15860
- if (gtlt === ">") {
15861
- gtlt = ">=";
15862
- if (xm) {
15863
- M = +M + 1;
15864
- m = 0;
15865
- p = 0;
15866
- } else {
15867
- m = +m + 1;
15868
- p = 0;
12830
+ if (inheritableTags || localTags) {
12831
+ if (callbackManager) {
12832
+ callbackManager.addTags(inheritableTags ?? []);
12833
+ callbackManager.addTags(localTags ?? [], false);
12834
+ }
15869
12835
  }
15870
- } else if (gtlt === "<=") {
15871
- gtlt = "<";
15872
- if (xm) {
15873
- M = +M + 1;
15874
- } else {
15875
- m = +m + 1;
12836
+ if (inheritableMetadata || localMetadata) {
12837
+ if (callbackManager) {
12838
+ callbackManager.addMetadata(inheritableMetadata ?? {});
12839
+ callbackManager.addMetadata(localMetadata ?? {}, false);
12840
+ }
15876
12841
  }
12842
+ return callbackManager;
15877
12843
  }
15878
- if (gtlt === "<") {
15879
- pr = "-0";
15880
- }
15881
- ret = `${gtlt + M}.${m}.${p}${pr}`;
15882
- } else if (xm) {
15883
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
15884
- } else if (xp) {
15885
- ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
15886
- }
15887
- return ret;
15888
- });
15889
- }
15890
- function replaceHyphen(comp, options) {
15891
- const r = HYPHENRANGE_REGEXP;
15892
- return comp.replace(r, (_, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
15893
- if (isX(fM)) {
15894
- from = "";
15895
- } else if (isX(fm)) {
15896
- from = `>=${fM}.0.0${options?.includePrerelease ? "-0" : ""}`;
15897
- } else if (isX(fp)) {
15898
- from = `>=${fM}.${fm}.0${options?.includePrerelease ? "-0" : ""}`;
15899
- } else if (fpr) {
15900
- from = `>=${from}`;
15901
- } else {
15902
- from = `>=${from}${options?.includePrerelease ? "-0" : ""}`;
15903
- }
15904
- if (isX(tM)) {
15905
- to = "";
15906
- } else if (isX(tm)) {
15907
- to = `<${+tM + 1}.0.0-0`;
15908
- } else if (isX(tp)) {
15909
- to = `<${tM}.${+tm + 1}.0-0`;
15910
- } else if (tpr) {
15911
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
15912
- } else if (options?.includePrerelease) {
15913
- to = `<${tM}.${tm}.${+tp + 1}-0`;
15914
- } else {
15915
- to = `<=${to}`;
15916
- }
15917
- return `${from} ${to}`.trim();
15918
- });
15919
- }
15920
-
15921
- // node_modules/@opentelemetry/instrumentation/build/esm/shimmer.js
15922
- var logger = console.error.bind(console);
15923
- function defineProperty(obj, name, value) {
15924
- const enumerable = !!obj[name] && Object.prototype.propertyIsEnumerable.call(obj, name);
15925
- Object.defineProperty(obj, name, {
15926
- configurable: true,
15927
- enumerable,
15928
- writable: true,
15929
- value
15930
- });
15931
- }
15932
- var wrap = (nodule, name, wrapper) => {
15933
- if (!nodule || !nodule[name]) {
15934
- logger("no original function " + String(name) + " to wrap");
15935
- return;
15936
- }
15937
- if (!wrapper) {
15938
- logger("no wrapper function");
15939
- logger(new Error().stack);
15940
- return;
15941
- }
15942
- const original = nodule[name];
15943
- if (typeof original !== "function" || typeof wrapper !== "function") {
15944
- logger("original object and wrapper must be functions");
15945
- return;
15946
- }
15947
- const wrapped = wrapper(original, name);
15948
- defineProperty(wrapped, "__original", original);
15949
- defineProperty(wrapped, "__unwrap", () => {
15950
- if (nodule[name] === wrapped) {
15951
- defineProperty(nodule, name, original);
15952
- }
15953
- });
15954
- defineProperty(wrapped, "__wrapped", true);
15955
- defineProperty(nodule, name, wrapped);
15956
- return wrapped;
15957
- };
15958
- var massWrap = (nodules, names, wrapper) => {
15959
- if (!nodules) {
15960
- logger("must provide one or more modules to patch");
15961
- logger(new Error().stack);
15962
- return;
15963
- } else if (!Array.isArray(nodules)) {
15964
- nodules = [nodules];
15965
- }
15966
- if (!(names && Array.isArray(names))) {
15967
- logger("must provide one or more functions to wrap on modules");
15968
- return;
15969
- }
15970
- nodules.forEach((nodule) => {
15971
- names.forEach((name) => {
15972
- wrap(nodule, name, wrapper);
15973
- });
15974
- });
15975
- };
15976
- var unwrap = (nodule, name) => {
15977
- if (!nodule || !nodule[name]) {
15978
- logger("no function to unwrap.");
15979
- logger(new Error().stack);
15980
- return;
15981
- }
15982
- const wrapped = nodule[name];
15983
- if (!wrapped.__unwrap) {
15984
- logger("no original to unwrap to -- has " + String(name) + " already been unwrapped?");
15985
- } else {
15986
- wrapped.__unwrap();
15987
- return;
15988
- }
15989
- };
15990
- var massUnwrap = (nodules, names) => {
15991
- if (!nodules) {
15992
- logger("must provide one or more modules to patch");
15993
- logger(new Error().stack);
15994
- return;
15995
- } else if (!Array.isArray(nodules)) {
15996
- nodules = [nodules];
15997
- }
15998
- if (!(names && Array.isArray(names))) {
15999
- logger("must provide one or more functions to unwrap on modules");
16000
- return;
16001
- }
16002
- nodules.forEach((nodule) => {
16003
- names.forEach((name) => {
16004
- unwrap(nodule, name);
16005
- });
16006
- });
16007
- };
16008
- var InstrumentationAbstract = class {
16009
- constructor(instrumentationName, instrumentationVersion, config) {
16010
- __publicField(this, "instrumentationName");
16011
- __publicField(this, "instrumentationVersion");
16012
- __publicField(this, "_config", {});
16013
- __publicField(this, "_tracer");
16014
- __publicField(this, "_meter");
16015
- __publicField(this, "_logger");
16016
- __publicField(this, "_diag");
16017
- /* Api to wrap instrumented method */
16018
- __publicField(this, "_wrap", wrap);
16019
- /* Api to unwrap instrumented methods */
16020
- __publicField(this, "_unwrap", unwrap);
16021
- /* Api to mass wrap instrumented method */
16022
- __publicField(this, "_massWrap", massWrap);
16023
- /* Api to mass unwrap instrumented methods */
16024
- __publicField(this, "_massUnwrap", massUnwrap);
16025
- this.instrumentationName = instrumentationName;
16026
- this.instrumentationVersion = instrumentationVersion;
16027
- this.setConfig(config);
16028
- this._diag = diag.createComponentLogger({
16029
- namespace: instrumentationName
16030
- });
16031
- this._tracer = trace.getTracer(instrumentationName, instrumentationVersion);
16032
- this._meter = metrics.getMeter(instrumentationName, instrumentationVersion);
16033
- this._logger = logs.getLogger(instrumentationName, instrumentationVersion);
16034
- this._updateMetricInstruments();
16035
- }
16036
- /* Returns meter */
16037
- get meter() {
16038
- return this._meter;
16039
- }
16040
- /**
16041
- * Sets MeterProvider to this plugin
16042
- * @param meterProvider
16043
- */
16044
- setMeterProvider(meterProvider) {
16045
- this._meter = meterProvider.getMeter(this.instrumentationName, this.instrumentationVersion);
16046
- this._updateMetricInstruments();
16047
- }
16048
- /* Returns logger */
16049
- get logger() {
16050
- return this._logger;
16051
- }
16052
- /**
16053
- * Sets LoggerProvider to this plugin
16054
- * @param loggerProvider
16055
- */
16056
- setLoggerProvider(loggerProvider) {
16057
- this._logger = loggerProvider.getLogger(this.instrumentationName, this.instrumentationVersion);
16058
- }
16059
- /**
16060
- * @experimental
16061
- *
16062
- * Get module definitions defined by {@link init}.
16063
- * This can be used for experimental compile-time instrumentation.
16064
- *
16065
- * @returns an array of {@link InstrumentationModuleDefinition}
16066
- */
16067
- getModuleDefinitions() {
16068
- const initResult = this.init() ?? [];
16069
- if (!Array.isArray(initResult)) {
16070
- return [initResult];
16071
- }
16072
- return initResult;
16073
- }
16074
- /**
16075
- * Sets the new metric instruments with the current Meter.
16076
- */
16077
- _updateMetricInstruments() {
16078
- return;
16079
- }
16080
- /* Returns InstrumentationConfig */
16081
- getConfig() {
16082
- return this._config;
16083
- }
16084
- /**
16085
- * Sets InstrumentationConfig to this plugin
16086
- * @param config
16087
- */
16088
- setConfig(config) {
16089
- this._config = {
16090
- enabled: true,
16091
- ...config
16092
12844
  };
16093
- }
16094
- /**
16095
- * Sets TraceProvider to this plugin
16096
- * @param tracerProvider
16097
- */
16098
- setTracerProvider(tracerProvider) {
16099
- this._tracer = tracerProvider.getTracer(this.instrumentationName, this.instrumentationVersion);
16100
- }
16101
- /* Returns tracer */
16102
- get tracer() {
16103
- return this._tracer;
16104
- }
16105
- /**
16106
- * Execute span customization hook, if configured, and log any errors.
16107
- * Any semantics of the trigger and info are defined by the specific instrumentation.
16108
- * @param hookHandler The optional hook handler which the user has configured via instrumentation config
16109
- * @param triggerName The name of the trigger for executing the hook for logging purposes
16110
- * @param span The span to which the hook should be applied
16111
- * @param info The info object to be passed to the hook, with useful data the hook may use
16112
- */
16113
- _runSpanCustomizationHook(hookHandler, triggerName, span, info) {
16114
- if (!hookHandler) {
16115
- return;
16116
- }
16117
- try {
16118
- hookHandler(span, info);
16119
- } catch (e) {
16120
- this._diag.error(`Error running span customization hook due to exception in handler`, { triggerName }, e);
16121
- }
16122
- }
16123
- };
16124
-
16125
- // node_modules/@opentelemetry/instrumentation/build/esm/platform/node/RequireInTheMiddleSingleton.js
16126
- var import_require_in_the_middle = __toESM(require_require_in_the_middle());
16127
-
16128
- // node_modules/@opentelemetry/instrumentation/build/esm/platform/node/ModuleNameTrie.js
16129
- var ModuleNameSeparator = "/";
16130
- var ModuleNameTrieNode = class {
16131
- constructor() {
16132
- __publicField(this, "hooks", []);
16133
- __publicField(this, "children", /* @__PURE__ */ new Map());
16134
- }
16135
- };
16136
- var ModuleNameTrie = class {
16137
- constructor() {
16138
- __publicField(this, "_trie", new ModuleNameTrieNode());
16139
- __publicField(this, "_counter", 0);
16140
- }
16141
- /**
16142
- * Insert a module hook into the trie
16143
- *
16144
- * @param {Hooked} hook Hook
16145
- */
16146
- insert(hook) {
16147
- let trieNode = this._trie;
16148
- for (const moduleNamePart of hook.moduleName.split(ModuleNameSeparator)) {
16149
- let nextNode = trieNode.children.get(moduleNamePart);
16150
- if (!nextNode) {
16151
- nextNode = new ModuleNameTrieNode();
16152
- trieNode.children.set(moduleNamePart, nextNode);
16153
- }
16154
- trieNode = nextNode;
16155
- }
16156
- trieNode.hooks.push({ hook, insertedId: this._counter++ });
16157
- }
16158
- /**
16159
- * Search for matching hooks in the trie
16160
- *
16161
- * @param {string} moduleName Module name
16162
- * @param {boolean} maintainInsertionOrder Whether to return the results in insertion order
16163
- * @param {boolean} fullOnly Whether to return only full matches
16164
- * @returns {Hooked[]} Matching hooks
16165
- */
16166
- search(moduleName, { maintainInsertionOrder, fullOnly } = {}) {
16167
- let trieNode = this._trie;
16168
- const results = [];
16169
- let foundFull = true;
16170
- for (const moduleNamePart of moduleName.split(ModuleNameSeparator)) {
16171
- const nextNode = trieNode.children.get(moduleNamePart);
16172
- if (!nextNode) {
16173
- foundFull = false;
16174
- break;
16175
- }
16176
- if (!fullOnly) {
16177
- results.push(...nextNode.hooks);
12845
+ exports$1.CallbackManager = CallbackManager;
12846
+ function ensureHandler(handler) {
12847
+ if ("name" in handler) {
12848
+ return handler;
16178
12849
  }
16179
- trieNode = nextNode;
16180
- }
16181
- if (fullOnly && foundFull) {
16182
- results.push(...trieNode.hooks);
16183
- }
16184
- if (results.length === 0) {
16185
- return [];
16186
- }
16187
- if (results.length === 1) {
16188
- return [results[0].hook];
16189
- }
16190
- if (maintainInsertionOrder) {
16191
- results.sort((a, b) => a.insertedId - b.insertedId);
12850
+ return base_js_1.BaseCallbackHandler.fromMethods(handler);
16192
12851
  }
16193
- return results.map(({ hook }) => hook);
16194
- }
16195
- };
16196
-
16197
- // node_modules/@opentelemetry/instrumentation/build/esm/platform/node/RequireInTheMiddleSingleton.js
16198
- var isMocha = [
16199
- "afterEach",
16200
- "after",
16201
- "beforeEach",
16202
- "before",
16203
- "describe",
16204
- "it"
16205
- ].every((fn) => {
16206
- return typeof global[fn] === "function";
16207
- });
16208
- var _RequireInTheMiddleSingleton = class _RequireInTheMiddleSingleton {
16209
- constructor() {
16210
- __publicField(this, "_moduleNameTrie", new ModuleNameTrie());
16211
- this._initialize();
16212
- }
16213
- _initialize() {
16214
- new import_require_in_the_middle.Hook(
16215
- // Intercept all `require` calls; we will filter the matching ones below
16216
- null,
16217
- { internals: true },
16218
- (exports$1, name, basedir) => {
16219
- const normalizedModuleName = normalizePathSeparators(name);
16220
- const matches = this._moduleNameTrie.search(normalizedModuleName, {
16221
- maintainInsertionOrder: true,
16222
- // For core modules (e.g. `fs`), do not match on sub-paths (e.g. `fs/promises').
16223
- // This matches the behavior of `require-in-the-middle`.
16224
- // `basedir` is always `undefined` for core modules.
16225
- fullOnly: basedir === void 0
16226
- });
16227
- for (const { onRequire } of matches) {
16228
- exports$1 = onRequire(exports$1, name, basedir);
16229
- }
16230
- return exports$1;
16231
- }
16232
- );
16233
- }
16234
- /**
16235
- * Register a hook with `require-in-the-middle`
16236
- *
16237
- * @param {string} moduleName Module name
16238
- * @param {OnRequireFn} onRequire Hook function
16239
- * @returns {Hooked} Registered hook
16240
- */
16241
- register(moduleName, onRequire) {
16242
- const hooked = { moduleName, onRequire };
16243
- this._moduleNameTrie.insert(hooked);
16244
- return hooked;
16245
- }
16246
- /**
16247
- * Get the `RequireInTheMiddleSingleton` singleton
16248
- *
16249
- * @returns {RequireInTheMiddleSingleton} Singleton of `RequireInTheMiddleSingleton`
16250
- */
16251
- static getInstance() {
16252
- if (isMocha)
16253
- return new _RequireInTheMiddleSingleton();
16254
- return this._instance = this._instance ?? new _RequireInTheMiddleSingleton();
16255
- }
16256
- };
16257
- __publicField(_RequireInTheMiddleSingleton, "_instance");
16258
- var RequireInTheMiddleSingleton = _RequireInTheMiddleSingleton;
16259
- function normalizePathSeparators(moduleNameOrPath) {
16260
- return path2.sep !== ModuleNameSeparator ? moduleNameOrPath.split(path2.sep).join(ModuleNameSeparator) : moduleNameOrPath;
16261
- }
16262
-
16263
- // node_modules/@opentelemetry/instrumentation/build/esm/platform/node/instrumentation.js
16264
- var import_import_in_the_middle = __toESM(require_import_in_the_middle());
16265
- var import_require_in_the_middle2 = __toESM(require_require_in_the_middle());
16266
-
16267
- // node_modules/@opentelemetry/instrumentation/build/esm/utils.js
16268
- function isWrapped(func) {
16269
- return typeof func === "function" && typeof func.__original === "function" && typeof func.__unwrap === "function" && func.__wrapped === true;
16270
- }
16271
-
16272
- // node_modules/@opentelemetry/instrumentation/build/esm/platform/node/instrumentation.js
16273
- var InstrumentationBase = class extends InstrumentationAbstract {
16274
- constructor(instrumentationName, instrumentationVersion, config) {
16275
- super(instrumentationName, instrumentationVersion, config);
16276
- __publicField(this, "_modules");
16277
- __publicField(this, "_hooks", []);
16278
- __publicField(this, "_requireInTheMiddleSingleton", RequireInTheMiddleSingleton.getInstance());
16279
- __publicField(this, "_enabled", false);
16280
- __publicField(this, "_wrap", (moduleExports, name, wrapper) => {
16281
- if (isWrapped(moduleExports[name])) {
16282
- this._unwrap(moduleExports, name);
16283
- }
16284
- if (!types.isProxy(moduleExports)) {
16285
- return wrap(moduleExports, name, wrapper);
16286
- } else {
16287
- const wrapped = wrap(Object.assign({}, moduleExports), name, wrapper);
16288
- Object.defineProperty(moduleExports, name, {
16289
- value: wrapped
12852
+ var TraceGroup = class {
12853
+ constructor(groupName, options) {
12854
+ Object.defineProperty(this, "groupName", {
12855
+ enumerable: true,
12856
+ configurable: true,
12857
+ writable: true,
12858
+ value: groupName
16290
12859
  });
16291
- return wrapped;
16292
- }
16293
- });
16294
- __publicField(this, "_unwrap", (moduleExports, name) => {
16295
- if (!types.isProxy(moduleExports)) {
16296
- return unwrap(moduleExports, name);
16297
- } else {
16298
- return Object.defineProperty(moduleExports, name, {
16299
- value: moduleExports[name]
12860
+ Object.defineProperty(this, "options", {
12861
+ enumerable: true,
12862
+ configurable: true,
12863
+ writable: true,
12864
+ value: options
16300
12865
  });
16301
- }
16302
- });
16303
- __publicField(this, "_massWrap", (moduleExportsArray, names, wrapper) => {
16304
- if (!moduleExportsArray) {
16305
- diag.error("must provide one or more modules to patch");
16306
- return;
16307
- } else if (!Array.isArray(moduleExportsArray)) {
16308
- moduleExportsArray = [moduleExportsArray];
16309
- }
16310
- if (!(names && Array.isArray(names))) {
16311
- diag.error("must provide one or more functions to wrap on modules");
16312
- return;
16313
- }
16314
- moduleExportsArray.forEach((moduleExports) => {
16315
- names.forEach((name) => {
16316
- this._wrap(moduleExports, name, wrapper);
12866
+ Object.defineProperty(this, "runManager", {
12867
+ enumerable: true,
12868
+ configurable: true,
12869
+ writable: true,
12870
+ value: void 0
16317
12871
  });
16318
- });
16319
- });
16320
- __publicField(this, "_massUnwrap", (moduleExportsArray, names) => {
16321
- if (!moduleExportsArray) {
16322
- diag.error("must provide one or more modules to patch");
16323
- return;
16324
- } else if (!Array.isArray(moduleExportsArray)) {
16325
- moduleExportsArray = [moduleExportsArray];
16326
- }
16327
- if (!(names && Array.isArray(names))) {
16328
- diag.error("must provide one or more functions to wrap on modules");
16329
- return;
16330
12872
  }
16331
- moduleExportsArray.forEach((moduleExports) => {
16332
- names.forEach((name) => {
16333
- this._unwrap(moduleExports, name);
16334
- });
16335
- });
16336
- });
16337
- let modules = this.init();
16338
- if (modules && !Array.isArray(modules)) {
16339
- modules = [modules];
16340
- }
16341
- this._modules = modules || [];
16342
- if (this._config.enabled) {
16343
- this.enable();
16344
- }
16345
- }
16346
- _warnOnPreloadedModules() {
16347
- this._modules.forEach((module) => {
16348
- const { name } = module;
16349
- try {
16350
- const resolvedModule = __require.resolve(name);
16351
- if (__require.cache[resolvedModule]) {
16352
- this._diag.warn(`Module ${name} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${name}`);
12873
+ async getTraceGroupCallbackManager(group_name, inputs, options) {
12874
+ const cb = new tracer_langchain_js_1.LangChainTracer(options);
12875
+ const cm = await CallbackManager.configure([cb]);
12876
+ const runManager = await cm?.handleChainStart({
12877
+ lc: 1,
12878
+ type: "not_implemented",
12879
+ id: ["langchain", "callbacks", "groups", group_name]
12880
+ }, inputs ?? {});
12881
+ if (!runManager) {
12882
+ throw new Error("Failed to create run group callback manager.");
16353
12883
  }
16354
- } catch {
12884
+ return runManager;
16355
12885
  }
16356
- });
16357
- }
16358
- _extractPackageVersion(baseDir) {
16359
- try {
16360
- const json = readFileSync(path2.join(baseDir, "package.json"), {
16361
- encoding: "utf8"
16362
- });
16363
- const version2 = JSON.parse(json).version;
16364
- return typeof version2 === "string" ? version2 : void 0;
16365
- } catch {
16366
- diag.warn("Failed extracting version", baseDir);
16367
- }
16368
- return void 0;
16369
- }
16370
- _onRequire(module, exports$1, name, baseDir) {
16371
- if (!baseDir) {
16372
- if (typeof module.patch === "function") {
16373
- module.moduleExports = exports$1;
16374
- if (this._enabled) {
16375
- this._diag.debug("Applying instrumentation patch for nodejs core module on require hook", {
16376
- module: module.name
16377
- });
16378
- return module.patch(exports$1);
12886
+ async start(inputs) {
12887
+ if (!this.runManager) {
12888
+ this.runManager = await this.getTraceGroupCallbackManager(this.groupName, inputs, this.options);
16379
12889
  }
12890
+ return this.runManager.getChild();
16380
12891
  }
16381
- return exports$1;
16382
- }
16383
- const version2 = this._extractPackageVersion(baseDir);
16384
- module.moduleVersion = version2;
16385
- if (module.name === name) {
16386
- if (isSupported(module.supportedVersions, version2, module.includePrerelease)) {
16387
- if (typeof module.patch === "function") {
16388
- module.moduleExports = exports$1;
16389
- if (this._enabled) {
16390
- this._diag.debug("Applying instrumentation patch for module on require hook", {
16391
- module: module.name,
16392
- version: module.moduleVersion,
16393
- baseDir
16394
- });
16395
- return module.patch(exports$1, module.moduleVersion);
16396
- }
12892
+ async error(err) {
12893
+ if (this.runManager) {
12894
+ await this.runManager.handleChainError(err);
12895
+ this.runManager = void 0;
16397
12896
  }
16398
12897
  }
16399
- return exports$1;
16400
- }
16401
- const files = module.files ?? [];
16402
- const normalizedName = path2.normalize(name);
16403
- const supportedFileInstrumentations = files.filter((f) => f.name === normalizedName).filter((f) => isSupported(f.supportedVersions, version2, module.includePrerelease));
16404
- return supportedFileInstrumentations.reduce((patchedExports, file) => {
16405
- file.moduleExports = patchedExports;
16406
- if (this._enabled) {
16407
- this._diag.debug("Applying instrumentation patch for nodejs module file on require hook", {
16408
- module: module.name,
16409
- version: module.moduleVersion,
16410
- fileName: file.name,
16411
- baseDir
16412
- });
16413
- return file.patch(patchedExports, module.moduleVersion);
16414
- }
16415
- return patchedExports;
16416
- }, exports$1);
16417
- }
16418
- enable() {
16419
- if (this._enabled) {
16420
- return;
16421
- }
16422
- this._enabled = true;
16423
- if (this._hooks.length > 0) {
16424
- for (const module of this._modules) {
16425
- if (typeof module.patch === "function" && module.moduleExports) {
16426
- this._diag.debug("Applying instrumentation patch for nodejs module on instrumentation enabled", {
16427
- module: module.name,
16428
- version: module.moduleVersion
16429
- });
16430
- module.patch(module.moduleExports, module.moduleVersion);
16431
- }
16432
- for (const file of module.files) {
16433
- if (file.moduleExports) {
16434
- this._diag.debug("Applying instrumentation patch for nodejs module file on instrumentation enabled", {
16435
- module: module.name,
16436
- version: module.moduleVersion,
16437
- fileName: file.name
16438
- });
16439
- file.patch(file.moduleExports, module.moduleVersion);
16440
- }
12898
+ async end(output) {
12899
+ if (this.runManager) {
12900
+ await this.runManager.handleChainEnd(output ?? {});
12901
+ this.runManager = void 0;
16441
12902
  }
16442
12903
  }
16443
- return;
16444
- }
16445
- this._warnOnPreloadedModules();
16446
- for (const module of this._modules) {
16447
- const hookFn = (exports$1, name, baseDir) => {
16448
- if (!baseDir && path2.isAbsolute(name)) {
16449
- const parsedPath = path2.parse(name);
16450
- name = parsedPath.name;
16451
- baseDir = parsedPath.dir;
16452
- }
16453
- return this._onRequire(module, exports$1, name, baseDir);
16454
- };
16455
- const onRequire = (exports$1, name, baseDir) => {
16456
- return this._onRequire(module, exports$1, name, baseDir);
16457
- };
16458
- const hook = path2.isAbsolute(module.name) ? new import_require_in_the_middle2.Hook([module.name], { internals: true }, onRequire) : this._requireInTheMiddleSingleton.register(module.name, onRequire);
16459
- this._hooks.push(hook);
16460
- const esmHook = new import_import_in_the_middle.Hook([module.name], { internals: false }, hookFn);
16461
- this._hooks.push(esmHook);
16462
- }
16463
- }
16464
- disable() {
16465
- if (!this._enabled) {
16466
- return;
12904
+ };
12905
+ exports$1.TraceGroup = TraceGroup;
12906
+ function _coerceToDict(value, defaultKey) {
12907
+ return value && !Array.isArray(value) && typeof value === "object" ? value : { [defaultKey]: value };
16467
12908
  }
16468
- this._enabled = false;
16469
- for (const module of this._modules) {
16470
- if (typeof module.unpatch === "function" && module.moduleExports) {
16471
- this._diag.debug("Removing instrumentation patch for nodejs module on instrumentation disabled", {
16472
- module: module.name,
16473
- version: module.moduleVersion
16474
- });
16475
- module.unpatch(module.moduleExports, module.moduleVersion);
16476
- }
16477
- for (const file of module.files) {
16478
- if (file.moduleExports) {
16479
- this._diag.debug("Removing instrumentation patch for nodejs module file on instrumentation disabled", {
16480
- module: module.name,
16481
- version: module.moduleVersion,
16482
- fileName: file.name
16483
- });
16484
- file.unpatch(file.moduleExports, module.moduleVersion);
16485
- }
12909
+ async function traceAsGroup(groupOptions, enclosedCode, ...args) {
12910
+ const traceGroup = new TraceGroup(groupOptions.name, groupOptions);
12911
+ const callbackManager = await traceGroup.start({ ...args });
12912
+ try {
12913
+ const result = await enclosedCode(callbackManager, ...args);
12914
+ await traceGroup.end(_coerceToDict(result, "output"));
12915
+ return result;
12916
+ } catch (err) {
12917
+ await traceGroup.error(err);
12918
+ throw err;
16486
12919
  }
16487
12920
  }
16488
12921
  }
16489
- isEnabled() {
16490
- return this._enabled;
16491
- }
16492
- };
16493
- function isSupported(supportedVersions, version2, includePrerelease) {
16494
- if (typeof version2 === "undefined") {
16495
- return supportedVersions.includes("*");
12922
+ });
12923
+
12924
+ // node_modules/@traceloop/instrumentation-langchain/node_modules/@langchain/core/callbacks/manager.cjs
12925
+ var require_manager2 = __commonJS({
12926
+ "node_modules/@traceloop/instrumentation-langchain/node_modules/@langchain/core/callbacks/manager.cjs"(exports$1, module) {
12927
+ module.exports = require_manager();
16496
12928
  }
16497
- return supportedVersions.some((supportedVersion) => {
16498
- return satisfies(version2, supportedVersion, { includePrerelease });
16499
- });
16500
- }
12929
+ });
16501
12930
 
16502
12931
  // node_modules/@traceloop/instrumentation-langchain/dist/index.mjs
16503
- var import_ai_semantic_conventions = __toESM(require_src2(), 1);
12932
+ var import_ai_semantic_conventions = __toESM(require_src(), 1);
16504
12933
 
16505
12934
  // node_modules/tslib/tslib.es6.mjs
16506
12935
  function __awaiter(thisArg, _arguments, P, generator) {
@@ -16588,8 +13017,8 @@ function shallowCopy(obj) {
16588
13017
  }
16589
13018
  function replaceSecrets(root, secretsMap) {
16590
13019
  const result = shallowCopy(root);
16591
- for (const [path3, secretId] of Object.entries(secretsMap)) {
16592
- const [last, ...partsReverse] = path3.split(".").reverse();
13020
+ for (const [path, secretId] of Object.entries(secretsMap)) {
13021
+ const [last, ...partsReverse] = path.split(".").reverse();
16593
13022
  let current = result;
16594
13023
  for (const part of partsReverse.reverse()) {
16595
13024
  if (current[part] === void 0) {
@@ -17271,5 +13700,5 @@ var LangChainInstrumentation = class extends InstrumentationBase {
17271
13700
  };
17272
13701
 
17273
13702
  export { LangChainInstrumentation, TraceloopCallbackHandler };
17274
- //# sourceMappingURL=dist-7XG2FAEZ.js.map
17275
- //# sourceMappingURL=dist-7XG2FAEZ.js.map
13703
+ //# sourceMappingURL=dist-GIPRCO2C.js.map
13704
+ //# sourceMappingURL=dist-GIPRCO2C.js.map