@tiktool/live 2.4.8 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1
- package/dist/index.d.mts +3 -551
- package/dist/index.d.ts +3 -551
- package/dist/index.js +1256 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1285 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,1282 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
|
|
33
|
+
// ../node_modules/ms/index.js
|
|
34
|
+
var require_ms = __commonJS({
|
|
35
|
+
"../node_modules/ms/index.js"(exports, module) {
|
|
36
|
+
"use strict";
|
|
37
|
+
var s = 1e3;
|
|
38
|
+
var m = s * 60;
|
|
39
|
+
var h = m * 60;
|
|
40
|
+
var d = h * 24;
|
|
41
|
+
var w = d * 7;
|
|
42
|
+
var y = d * 365.25;
|
|
43
|
+
module.exports = function(val, options) {
|
|
44
|
+
options = options || {};
|
|
45
|
+
var type = typeof val;
|
|
46
|
+
if (type === "string" && val.length > 0) {
|
|
47
|
+
return parse(val);
|
|
48
|
+
} else if (type === "number" && isFinite(val)) {
|
|
49
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
50
|
+
}
|
|
51
|
+
throw new Error(
|
|
52
|
+
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
function parse(str) {
|
|
56
|
+
str = String(str);
|
|
57
|
+
if (str.length > 100) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
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(
|
|
61
|
+
str
|
|
62
|
+
);
|
|
63
|
+
if (!match) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
var n = parseFloat(match[1]);
|
|
67
|
+
var type = (match[2] || "ms").toLowerCase();
|
|
68
|
+
switch (type) {
|
|
69
|
+
case "years":
|
|
70
|
+
case "year":
|
|
71
|
+
case "yrs":
|
|
72
|
+
case "yr":
|
|
73
|
+
case "y":
|
|
74
|
+
return n * y;
|
|
75
|
+
case "weeks":
|
|
76
|
+
case "week":
|
|
77
|
+
case "w":
|
|
78
|
+
return n * w;
|
|
79
|
+
case "days":
|
|
80
|
+
case "day":
|
|
81
|
+
case "d":
|
|
82
|
+
return n * d;
|
|
83
|
+
case "hours":
|
|
84
|
+
case "hour":
|
|
85
|
+
case "hrs":
|
|
86
|
+
case "hr":
|
|
87
|
+
case "h":
|
|
88
|
+
return n * h;
|
|
89
|
+
case "minutes":
|
|
90
|
+
case "minute":
|
|
91
|
+
case "mins":
|
|
92
|
+
case "min":
|
|
93
|
+
case "m":
|
|
94
|
+
return n * m;
|
|
95
|
+
case "seconds":
|
|
96
|
+
case "second":
|
|
97
|
+
case "secs":
|
|
98
|
+
case "sec":
|
|
99
|
+
case "s":
|
|
100
|
+
return n * s;
|
|
101
|
+
case "milliseconds":
|
|
102
|
+
case "millisecond":
|
|
103
|
+
case "msecs":
|
|
104
|
+
case "msec":
|
|
105
|
+
case "ms":
|
|
106
|
+
return n;
|
|
107
|
+
default:
|
|
108
|
+
return void 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function fmtShort(ms) {
|
|
112
|
+
var msAbs = Math.abs(ms);
|
|
113
|
+
if (msAbs >= d) {
|
|
114
|
+
return Math.round(ms / d) + "d";
|
|
115
|
+
}
|
|
116
|
+
if (msAbs >= h) {
|
|
117
|
+
return Math.round(ms / h) + "h";
|
|
118
|
+
}
|
|
119
|
+
if (msAbs >= m) {
|
|
120
|
+
return Math.round(ms / m) + "m";
|
|
121
|
+
}
|
|
122
|
+
if (msAbs >= s) {
|
|
123
|
+
return Math.round(ms / s) + "s";
|
|
124
|
+
}
|
|
125
|
+
return ms + "ms";
|
|
126
|
+
}
|
|
127
|
+
function fmtLong(ms) {
|
|
128
|
+
var msAbs = Math.abs(ms);
|
|
129
|
+
if (msAbs >= d) {
|
|
130
|
+
return plural(ms, msAbs, d, "day");
|
|
131
|
+
}
|
|
132
|
+
if (msAbs >= h) {
|
|
133
|
+
return plural(ms, msAbs, h, "hour");
|
|
134
|
+
}
|
|
135
|
+
if (msAbs >= m) {
|
|
136
|
+
return plural(ms, msAbs, m, "minute");
|
|
137
|
+
}
|
|
138
|
+
if (msAbs >= s) {
|
|
139
|
+
return plural(ms, msAbs, s, "second");
|
|
140
|
+
}
|
|
141
|
+
return ms + " ms";
|
|
142
|
+
}
|
|
143
|
+
function plural(ms, msAbs, n, name) {
|
|
144
|
+
var isPlural = msAbs >= n * 1.5;
|
|
145
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// ../node_modules/debug/src/common.js
|
|
151
|
+
var require_common = __commonJS({
|
|
152
|
+
"../node_modules/debug/src/common.js"(exports, module) {
|
|
153
|
+
"use strict";
|
|
154
|
+
function setup(env) {
|
|
155
|
+
createDebug.debug = createDebug;
|
|
156
|
+
createDebug.default = createDebug;
|
|
157
|
+
createDebug.coerce = coerce;
|
|
158
|
+
createDebug.disable = disable;
|
|
159
|
+
createDebug.enable = enable;
|
|
160
|
+
createDebug.enabled = enabled;
|
|
161
|
+
createDebug.humanize = require_ms();
|
|
162
|
+
createDebug.destroy = destroy;
|
|
163
|
+
Object.keys(env).forEach((key) => {
|
|
164
|
+
createDebug[key] = env[key];
|
|
165
|
+
});
|
|
166
|
+
createDebug.names = [];
|
|
167
|
+
createDebug.skips = [];
|
|
168
|
+
createDebug.formatters = {};
|
|
169
|
+
function selectColor(namespace) {
|
|
170
|
+
let hash = 0;
|
|
171
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
172
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
173
|
+
hash |= 0;
|
|
174
|
+
}
|
|
175
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
176
|
+
}
|
|
177
|
+
createDebug.selectColor = selectColor;
|
|
178
|
+
function createDebug(namespace) {
|
|
179
|
+
let prevTime;
|
|
180
|
+
let enableOverride = null;
|
|
181
|
+
let namespacesCache;
|
|
182
|
+
let enabledCache;
|
|
183
|
+
function debug(...args) {
|
|
184
|
+
if (!debug.enabled) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const self = debug;
|
|
188
|
+
const curr = Number(/* @__PURE__ */ new Date());
|
|
189
|
+
const ms = curr - (prevTime || curr);
|
|
190
|
+
self.diff = ms;
|
|
191
|
+
self.prev = prevTime;
|
|
192
|
+
self.curr = curr;
|
|
193
|
+
prevTime = curr;
|
|
194
|
+
args[0] = createDebug.coerce(args[0]);
|
|
195
|
+
if (typeof args[0] !== "string") {
|
|
196
|
+
args.unshift("%O");
|
|
197
|
+
}
|
|
198
|
+
let index = 0;
|
|
199
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
200
|
+
if (match === "%%") {
|
|
201
|
+
return "%";
|
|
202
|
+
}
|
|
203
|
+
index++;
|
|
204
|
+
const formatter = createDebug.formatters[format];
|
|
205
|
+
if (typeof formatter === "function") {
|
|
206
|
+
const val = args[index];
|
|
207
|
+
match = formatter.call(self, val);
|
|
208
|
+
args.splice(index, 1);
|
|
209
|
+
index--;
|
|
210
|
+
}
|
|
211
|
+
return match;
|
|
212
|
+
});
|
|
213
|
+
createDebug.formatArgs.call(self, args);
|
|
214
|
+
const logFn = self.log || createDebug.log;
|
|
215
|
+
logFn.apply(self, args);
|
|
216
|
+
}
|
|
217
|
+
debug.namespace = namespace;
|
|
218
|
+
debug.useColors = createDebug.useColors();
|
|
219
|
+
debug.color = createDebug.selectColor(namespace);
|
|
220
|
+
debug.extend = extend;
|
|
221
|
+
debug.destroy = createDebug.destroy;
|
|
222
|
+
Object.defineProperty(debug, "enabled", {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
configurable: false,
|
|
225
|
+
get: () => {
|
|
226
|
+
if (enableOverride !== null) {
|
|
227
|
+
return enableOverride;
|
|
228
|
+
}
|
|
229
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
230
|
+
namespacesCache = createDebug.namespaces;
|
|
231
|
+
enabledCache = createDebug.enabled(namespace);
|
|
232
|
+
}
|
|
233
|
+
return enabledCache;
|
|
234
|
+
},
|
|
235
|
+
set: (v) => {
|
|
236
|
+
enableOverride = v;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
if (typeof createDebug.init === "function") {
|
|
240
|
+
createDebug.init(debug);
|
|
241
|
+
}
|
|
242
|
+
return debug;
|
|
243
|
+
}
|
|
244
|
+
function extend(namespace, delimiter) {
|
|
245
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
246
|
+
newDebug.log = this.log;
|
|
247
|
+
return newDebug;
|
|
248
|
+
}
|
|
249
|
+
function enable(namespaces) {
|
|
250
|
+
createDebug.save(namespaces);
|
|
251
|
+
createDebug.namespaces = namespaces;
|
|
252
|
+
createDebug.names = [];
|
|
253
|
+
createDebug.skips = [];
|
|
254
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
255
|
+
for (const ns of split) {
|
|
256
|
+
if (ns[0] === "-") {
|
|
257
|
+
createDebug.skips.push(ns.slice(1));
|
|
258
|
+
} else {
|
|
259
|
+
createDebug.names.push(ns);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function matchesTemplate(search, template) {
|
|
264
|
+
let searchIndex = 0;
|
|
265
|
+
let templateIndex = 0;
|
|
266
|
+
let starIndex = -1;
|
|
267
|
+
let matchIndex = 0;
|
|
268
|
+
while (searchIndex < search.length) {
|
|
269
|
+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
270
|
+
if (template[templateIndex] === "*") {
|
|
271
|
+
starIndex = templateIndex;
|
|
272
|
+
matchIndex = searchIndex;
|
|
273
|
+
templateIndex++;
|
|
274
|
+
} else {
|
|
275
|
+
searchIndex++;
|
|
276
|
+
templateIndex++;
|
|
277
|
+
}
|
|
278
|
+
} else if (starIndex !== -1) {
|
|
279
|
+
templateIndex = starIndex + 1;
|
|
280
|
+
matchIndex++;
|
|
281
|
+
searchIndex = matchIndex;
|
|
282
|
+
} else {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
287
|
+
templateIndex++;
|
|
288
|
+
}
|
|
289
|
+
return templateIndex === template.length;
|
|
290
|
+
}
|
|
291
|
+
function disable() {
|
|
292
|
+
const namespaces = [
|
|
293
|
+
...createDebug.names,
|
|
294
|
+
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
295
|
+
].join(",");
|
|
296
|
+
createDebug.enable("");
|
|
297
|
+
return namespaces;
|
|
298
|
+
}
|
|
299
|
+
function enabled(name) {
|
|
300
|
+
for (const skip of createDebug.skips) {
|
|
301
|
+
if (matchesTemplate(name, skip)) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
for (const ns of createDebug.names) {
|
|
306
|
+
if (matchesTemplate(name, ns)) {
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
function coerce(val) {
|
|
313
|
+
if (val instanceof Error) {
|
|
314
|
+
return val.stack || val.message;
|
|
315
|
+
}
|
|
316
|
+
return val;
|
|
317
|
+
}
|
|
318
|
+
function destroy() {
|
|
319
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
320
|
+
}
|
|
321
|
+
createDebug.enable(createDebug.load());
|
|
322
|
+
return createDebug;
|
|
323
|
+
}
|
|
324
|
+
module.exports = setup;
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
// ../node_modules/debug/src/browser.js
|
|
329
|
+
var require_browser = __commonJS({
|
|
330
|
+
"../node_modules/debug/src/browser.js"(exports, module) {
|
|
331
|
+
"use strict";
|
|
332
|
+
exports.formatArgs = formatArgs;
|
|
333
|
+
exports.save = save;
|
|
334
|
+
exports.load = load;
|
|
335
|
+
exports.useColors = useColors;
|
|
336
|
+
exports.storage = localstorage();
|
|
337
|
+
exports.destroy = /* @__PURE__ */ (() => {
|
|
338
|
+
let warned = false;
|
|
339
|
+
return () => {
|
|
340
|
+
if (!warned) {
|
|
341
|
+
warned = true;
|
|
342
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
})();
|
|
346
|
+
exports.colors = [
|
|
347
|
+
"#0000CC",
|
|
348
|
+
"#0000FF",
|
|
349
|
+
"#0033CC",
|
|
350
|
+
"#0033FF",
|
|
351
|
+
"#0066CC",
|
|
352
|
+
"#0066FF",
|
|
353
|
+
"#0099CC",
|
|
354
|
+
"#0099FF",
|
|
355
|
+
"#00CC00",
|
|
356
|
+
"#00CC33",
|
|
357
|
+
"#00CC66",
|
|
358
|
+
"#00CC99",
|
|
359
|
+
"#00CCCC",
|
|
360
|
+
"#00CCFF",
|
|
361
|
+
"#3300CC",
|
|
362
|
+
"#3300FF",
|
|
363
|
+
"#3333CC",
|
|
364
|
+
"#3333FF",
|
|
365
|
+
"#3366CC",
|
|
366
|
+
"#3366FF",
|
|
367
|
+
"#3399CC",
|
|
368
|
+
"#3399FF",
|
|
369
|
+
"#33CC00",
|
|
370
|
+
"#33CC33",
|
|
371
|
+
"#33CC66",
|
|
372
|
+
"#33CC99",
|
|
373
|
+
"#33CCCC",
|
|
374
|
+
"#33CCFF",
|
|
375
|
+
"#6600CC",
|
|
376
|
+
"#6600FF",
|
|
377
|
+
"#6633CC",
|
|
378
|
+
"#6633FF",
|
|
379
|
+
"#66CC00",
|
|
380
|
+
"#66CC33",
|
|
381
|
+
"#9900CC",
|
|
382
|
+
"#9900FF",
|
|
383
|
+
"#9933CC",
|
|
384
|
+
"#9933FF",
|
|
385
|
+
"#99CC00",
|
|
386
|
+
"#99CC33",
|
|
387
|
+
"#CC0000",
|
|
388
|
+
"#CC0033",
|
|
389
|
+
"#CC0066",
|
|
390
|
+
"#CC0099",
|
|
391
|
+
"#CC00CC",
|
|
392
|
+
"#CC00FF",
|
|
393
|
+
"#CC3300",
|
|
394
|
+
"#CC3333",
|
|
395
|
+
"#CC3366",
|
|
396
|
+
"#CC3399",
|
|
397
|
+
"#CC33CC",
|
|
398
|
+
"#CC33FF",
|
|
399
|
+
"#CC6600",
|
|
400
|
+
"#CC6633",
|
|
401
|
+
"#CC9900",
|
|
402
|
+
"#CC9933",
|
|
403
|
+
"#CCCC00",
|
|
404
|
+
"#CCCC33",
|
|
405
|
+
"#FF0000",
|
|
406
|
+
"#FF0033",
|
|
407
|
+
"#FF0066",
|
|
408
|
+
"#FF0099",
|
|
409
|
+
"#FF00CC",
|
|
410
|
+
"#FF00FF",
|
|
411
|
+
"#FF3300",
|
|
412
|
+
"#FF3333",
|
|
413
|
+
"#FF3366",
|
|
414
|
+
"#FF3399",
|
|
415
|
+
"#FF33CC",
|
|
416
|
+
"#FF33FF",
|
|
417
|
+
"#FF6600",
|
|
418
|
+
"#FF6633",
|
|
419
|
+
"#FF9900",
|
|
420
|
+
"#FF9933",
|
|
421
|
+
"#FFCC00",
|
|
422
|
+
"#FFCC33"
|
|
423
|
+
];
|
|
424
|
+
function useColors() {
|
|
425
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
426
|
+
return true;
|
|
427
|
+
}
|
|
428
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
let m;
|
|
432
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
433
|
+
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
434
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
435
|
+
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
|
|
436
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
437
|
+
}
|
|
438
|
+
function formatArgs(args) {
|
|
439
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
440
|
+
if (!this.useColors) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
const c = "color: " + this.color;
|
|
444
|
+
args.splice(1, 0, c, "color: inherit");
|
|
445
|
+
let index = 0;
|
|
446
|
+
let lastC = 0;
|
|
447
|
+
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
448
|
+
if (match === "%%") {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
index++;
|
|
452
|
+
if (match === "%c") {
|
|
453
|
+
lastC = index;
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
args.splice(lastC, 0, c);
|
|
457
|
+
}
|
|
458
|
+
exports.log = console.debug || console.log || (() => {
|
|
459
|
+
});
|
|
460
|
+
function save(namespaces) {
|
|
461
|
+
try {
|
|
462
|
+
if (namespaces) {
|
|
463
|
+
exports.storage.setItem("debug", namespaces);
|
|
464
|
+
} else {
|
|
465
|
+
exports.storage.removeItem("debug");
|
|
466
|
+
}
|
|
467
|
+
} catch (error) {
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
function load() {
|
|
471
|
+
let r;
|
|
472
|
+
try {
|
|
473
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
474
|
+
} catch (error) {
|
|
475
|
+
}
|
|
476
|
+
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
477
|
+
r = process.env.DEBUG;
|
|
478
|
+
}
|
|
479
|
+
return r;
|
|
480
|
+
}
|
|
481
|
+
function localstorage() {
|
|
482
|
+
try {
|
|
483
|
+
return localStorage;
|
|
484
|
+
} catch (error) {
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
module.exports = require_common()(exports);
|
|
488
|
+
var { formatters } = module.exports;
|
|
489
|
+
formatters.j = function(v) {
|
|
490
|
+
try {
|
|
491
|
+
return JSON.stringify(v);
|
|
492
|
+
} catch (error) {
|
|
493
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
// ../../node_modules/has-flag/index.js
|
|
500
|
+
var require_has_flag = __commonJS({
|
|
501
|
+
"../../node_modules/has-flag/index.js"(exports, module) {
|
|
502
|
+
"use strict";
|
|
503
|
+
module.exports = (flag, argv = process.argv) => {
|
|
504
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
505
|
+
const position = argv.indexOf(prefix + flag);
|
|
506
|
+
const terminatorPosition = argv.indexOf("--");
|
|
507
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
// ../../node_modules/supports-color/index.js
|
|
513
|
+
var require_supports_color = __commonJS({
|
|
514
|
+
"../../node_modules/supports-color/index.js"(exports, module) {
|
|
515
|
+
"use strict";
|
|
516
|
+
var os = __require("os");
|
|
517
|
+
var tty = __require("tty");
|
|
518
|
+
var hasFlag = require_has_flag();
|
|
519
|
+
var { env } = process;
|
|
520
|
+
var forceColor;
|
|
521
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
522
|
+
forceColor = 0;
|
|
523
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
524
|
+
forceColor = 1;
|
|
525
|
+
}
|
|
526
|
+
if ("FORCE_COLOR" in env) {
|
|
527
|
+
if (env.FORCE_COLOR === "true") {
|
|
528
|
+
forceColor = 1;
|
|
529
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
530
|
+
forceColor = 0;
|
|
531
|
+
} else {
|
|
532
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
function translateLevel(level) {
|
|
536
|
+
if (level === 0) {
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
return {
|
|
540
|
+
level,
|
|
541
|
+
hasBasic: true,
|
|
542
|
+
has256: level >= 2,
|
|
543
|
+
has16m: level >= 3
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
547
|
+
if (forceColor === 0) {
|
|
548
|
+
return 0;
|
|
549
|
+
}
|
|
550
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
551
|
+
return 3;
|
|
552
|
+
}
|
|
553
|
+
if (hasFlag("color=256")) {
|
|
554
|
+
return 2;
|
|
555
|
+
}
|
|
556
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
557
|
+
return 0;
|
|
558
|
+
}
|
|
559
|
+
const min = forceColor || 0;
|
|
560
|
+
if (env.TERM === "dumb") {
|
|
561
|
+
return min;
|
|
562
|
+
}
|
|
563
|
+
if (process.platform === "win32") {
|
|
564
|
+
const osRelease = os.release().split(".");
|
|
565
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
566
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
567
|
+
}
|
|
568
|
+
return 1;
|
|
569
|
+
}
|
|
570
|
+
if ("CI" in env) {
|
|
571
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
572
|
+
return 1;
|
|
573
|
+
}
|
|
574
|
+
return min;
|
|
575
|
+
}
|
|
576
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
577
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
578
|
+
}
|
|
579
|
+
if (env.COLORTERM === "truecolor") {
|
|
580
|
+
return 3;
|
|
581
|
+
}
|
|
582
|
+
if ("TERM_PROGRAM" in env) {
|
|
583
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
584
|
+
switch (env.TERM_PROGRAM) {
|
|
585
|
+
case "iTerm.app":
|
|
586
|
+
return version >= 3 ? 3 : 2;
|
|
587
|
+
case "Apple_Terminal":
|
|
588
|
+
return 2;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
592
|
+
return 2;
|
|
593
|
+
}
|
|
594
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
595
|
+
return 1;
|
|
596
|
+
}
|
|
597
|
+
if ("COLORTERM" in env) {
|
|
598
|
+
return 1;
|
|
599
|
+
}
|
|
600
|
+
return min;
|
|
601
|
+
}
|
|
602
|
+
function getSupportLevel(stream) {
|
|
603
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
604
|
+
return translateLevel(level);
|
|
605
|
+
}
|
|
606
|
+
module.exports = {
|
|
607
|
+
supportsColor: getSupportLevel,
|
|
608
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
609
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
// ../node_modules/debug/src/node.js
|
|
615
|
+
var require_node = __commonJS({
|
|
616
|
+
"../node_modules/debug/src/node.js"(exports, module) {
|
|
617
|
+
"use strict";
|
|
618
|
+
var tty = __require("tty");
|
|
619
|
+
var util = __require("util");
|
|
620
|
+
exports.init = init;
|
|
621
|
+
exports.log = log;
|
|
622
|
+
exports.formatArgs = formatArgs;
|
|
623
|
+
exports.save = save;
|
|
624
|
+
exports.load = load;
|
|
625
|
+
exports.useColors = useColors;
|
|
626
|
+
exports.destroy = util.deprecate(
|
|
627
|
+
() => {
|
|
628
|
+
},
|
|
629
|
+
"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
|
|
630
|
+
);
|
|
631
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
632
|
+
try {
|
|
633
|
+
const supportsColor = require_supports_color();
|
|
634
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
635
|
+
exports.colors = [
|
|
636
|
+
20,
|
|
637
|
+
21,
|
|
638
|
+
26,
|
|
639
|
+
27,
|
|
640
|
+
32,
|
|
641
|
+
33,
|
|
642
|
+
38,
|
|
643
|
+
39,
|
|
644
|
+
40,
|
|
645
|
+
41,
|
|
646
|
+
42,
|
|
647
|
+
43,
|
|
648
|
+
44,
|
|
649
|
+
45,
|
|
650
|
+
56,
|
|
651
|
+
57,
|
|
652
|
+
62,
|
|
653
|
+
63,
|
|
654
|
+
68,
|
|
655
|
+
69,
|
|
656
|
+
74,
|
|
657
|
+
75,
|
|
658
|
+
76,
|
|
659
|
+
77,
|
|
660
|
+
78,
|
|
661
|
+
79,
|
|
662
|
+
80,
|
|
663
|
+
81,
|
|
664
|
+
92,
|
|
665
|
+
93,
|
|
666
|
+
98,
|
|
667
|
+
99,
|
|
668
|
+
112,
|
|
669
|
+
113,
|
|
670
|
+
128,
|
|
671
|
+
129,
|
|
672
|
+
134,
|
|
673
|
+
135,
|
|
674
|
+
148,
|
|
675
|
+
149,
|
|
676
|
+
160,
|
|
677
|
+
161,
|
|
678
|
+
162,
|
|
679
|
+
163,
|
|
680
|
+
164,
|
|
681
|
+
165,
|
|
682
|
+
166,
|
|
683
|
+
167,
|
|
684
|
+
168,
|
|
685
|
+
169,
|
|
686
|
+
170,
|
|
687
|
+
171,
|
|
688
|
+
172,
|
|
689
|
+
173,
|
|
690
|
+
178,
|
|
691
|
+
179,
|
|
692
|
+
184,
|
|
693
|
+
185,
|
|
694
|
+
196,
|
|
695
|
+
197,
|
|
696
|
+
198,
|
|
697
|
+
199,
|
|
698
|
+
200,
|
|
699
|
+
201,
|
|
700
|
+
202,
|
|
701
|
+
203,
|
|
702
|
+
204,
|
|
703
|
+
205,
|
|
704
|
+
206,
|
|
705
|
+
207,
|
|
706
|
+
208,
|
|
707
|
+
209,
|
|
708
|
+
214,
|
|
709
|
+
215,
|
|
710
|
+
220,
|
|
711
|
+
221
|
|
712
|
+
];
|
|
713
|
+
}
|
|
714
|
+
} catch (error) {
|
|
715
|
+
}
|
|
716
|
+
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
717
|
+
return /^debug_/i.test(key);
|
|
718
|
+
}).reduce((obj, key) => {
|
|
719
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
720
|
+
return k.toUpperCase();
|
|
721
|
+
});
|
|
722
|
+
let val = process.env[key];
|
|
723
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
724
|
+
val = true;
|
|
725
|
+
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
726
|
+
val = false;
|
|
727
|
+
} else if (val === "null") {
|
|
728
|
+
val = null;
|
|
729
|
+
} else {
|
|
730
|
+
val = Number(val);
|
|
731
|
+
}
|
|
732
|
+
obj[prop] = val;
|
|
733
|
+
return obj;
|
|
734
|
+
}, {});
|
|
735
|
+
function useColors() {
|
|
736
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
737
|
+
}
|
|
738
|
+
function formatArgs(args) {
|
|
739
|
+
const { namespace: name, useColors: useColors2 } = this;
|
|
740
|
+
if (useColors2) {
|
|
741
|
+
const c = this.color;
|
|
742
|
+
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
743
|
+
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
744
|
+
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
745
|
+
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
746
|
+
} else {
|
|
747
|
+
args[0] = getDate() + name + " " + args[0];
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
function getDate() {
|
|
751
|
+
if (exports.inspectOpts.hideDate) {
|
|
752
|
+
return "";
|
|
753
|
+
}
|
|
754
|
+
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
755
|
+
}
|
|
756
|
+
function log(...args) {
|
|
757
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
758
|
+
}
|
|
759
|
+
function save(namespaces) {
|
|
760
|
+
if (namespaces) {
|
|
761
|
+
process.env.DEBUG = namespaces;
|
|
762
|
+
} else {
|
|
763
|
+
delete process.env.DEBUG;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
function load() {
|
|
767
|
+
return process.env.DEBUG;
|
|
768
|
+
}
|
|
769
|
+
function init(debug) {
|
|
770
|
+
debug.inspectOpts = {};
|
|
771
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
772
|
+
for (let i = 0; i < keys.length; i++) {
|
|
773
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
module.exports = require_common()(exports);
|
|
777
|
+
var { formatters } = module.exports;
|
|
778
|
+
formatters.o = function(v) {
|
|
779
|
+
this.inspectOpts.colors = this.useColors;
|
|
780
|
+
return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
781
|
+
};
|
|
782
|
+
formatters.O = function(v) {
|
|
783
|
+
this.inspectOpts.colors = this.useColors;
|
|
784
|
+
return util.inspect(v, this.inspectOpts);
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
// ../node_modules/debug/src/index.js
|
|
790
|
+
var require_src = __commonJS({
|
|
791
|
+
"../node_modules/debug/src/index.js"(exports, module) {
|
|
792
|
+
"use strict";
|
|
793
|
+
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
794
|
+
module.exports = require_browser();
|
|
795
|
+
} else {
|
|
796
|
+
module.exports = require_node();
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
// ../node_modules/agent-base/dist/helpers.js
|
|
802
|
+
var require_helpers = __commonJS({
|
|
803
|
+
"../node_modules/agent-base/dist/helpers.js"(exports) {
|
|
804
|
+
"use strict";
|
|
805
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
806
|
+
if (k2 === void 0) k2 = k;
|
|
807
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
808
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
809
|
+
desc = { enumerable: true, get: function() {
|
|
810
|
+
return m[k];
|
|
811
|
+
} };
|
|
812
|
+
}
|
|
813
|
+
Object.defineProperty(o, k2, desc);
|
|
814
|
+
}) : (function(o, m, k, k2) {
|
|
815
|
+
if (k2 === void 0) k2 = k;
|
|
816
|
+
o[k2] = m[k];
|
|
817
|
+
}));
|
|
818
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
819
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
820
|
+
}) : function(o, v) {
|
|
821
|
+
o["default"] = v;
|
|
822
|
+
});
|
|
823
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
824
|
+
if (mod && mod.__esModule) return mod;
|
|
825
|
+
var result = {};
|
|
826
|
+
if (mod != null) {
|
|
827
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
828
|
+
}
|
|
829
|
+
__setModuleDefault(result, mod);
|
|
830
|
+
return result;
|
|
831
|
+
};
|
|
832
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
833
|
+
exports.req = exports.json = exports.toBuffer = void 0;
|
|
834
|
+
var http2 = __importStar(__require("http"));
|
|
835
|
+
var https2 = __importStar(__require("https"));
|
|
836
|
+
async function toBuffer(stream) {
|
|
837
|
+
let length = 0;
|
|
838
|
+
const chunks = [];
|
|
839
|
+
for await (const chunk of stream) {
|
|
840
|
+
length += chunk.length;
|
|
841
|
+
chunks.push(chunk);
|
|
842
|
+
}
|
|
843
|
+
return Buffer.concat(chunks, length);
|
|
844
|
+
}
|
|
845
|
+
exports.toBuffer = toBuffer;
|
|
846
|
+
async function json(stream) {
|
|
847
|
+
const buf = await toBuffer(stream);
|
|
848
|
+
const str = buf.toString("utf8");
|
|
849
|
+
try {
|
|
850
|
+
return JSON.parse(str);
|
|
851
|
+
} catch (_err) {
|
|
852
|
+
const err = _err;
|
|
853
|
+
err.message += ` (input: ${str})`;
|
|
854
|
+
throw err;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
exports.json = json;
|
|
858
|
+
function req(url, opts = {}) {
|
|
859
|
+
const href = typeof url === "string" ? url : url.href;
|
|
860
|
+
const req2 = (href.startsWith("https:") ? https2 : http2).request(url, opts);
|
|
861
|
+
const promise = new Promise((resolve, reject) => {
|
|
862
|
+
req2.once("response", resolve).once("error", reject).end();
|
|
863
|
+
});
|
|
864
|
+
req2.then = promise.then.bind(promise);
|
|
865
|
+
return req2;
|
|
866
|
+
}
|
|
867
|
+
exports.req = req;
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
// ../node_modules/agent-base/dist/index.js
|
|
872
|
+
var require_dist = __commonJS({
|
|
873
|
+
"../node_modules/agent-base/dist/index.js"(exports) {
|
|
874
|
+
"use strict";
|
|
875
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
876
|
+
if (k2 === void 0) k2 = k;
|
|
877
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
878
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
879
|
+
desc = { enumerable: true, get: function() {
|
|
880
|
+
return m[k];
|
|
881
|
+
} };
|
|
882
|
+
}
|
|
883
|
+
Object.defineProperty(o, k2, desc);
|
|
884
|
+
}) : (function(o, m, k, k2) {
|
|
885
|
+
if (k2 === void 0) k2 = k;
|
|
886
|
+
o[k2] = m[k];
|
|
887
|
+
}));
|
|
888
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
889
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
890
|
+
}) : function(o, v) {
|
|
891
|
+
o["default"] = v;
|
|
892
|
+
});
|
|
893
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
894
|
+
if (mod && mod.__esModule) return mod;
|
|
895
|
+
var result = {};
|
|
896
|
+
if (mod != null) {
|
|
897
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
898
|
+
}
|
|
899
|
+
__setModuleDefault(result, mod);
|
|
900
|
+
return result;
|
|
901
|
+
};
|
|
902
|
+
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
903
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
|
904
|
+
};
|
|
905
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
906
|
+
exports.Agent = void 0;
|
|
907
|
+
var net = __importStar(__require("net"));
|
|
908
|
+
var http2 = __importStar(__require("http"));
|
|
909
|
+
var https_1 = __require("https");
|
|
910
|
+
__exportStar(require_helpers(), exports);
|
|
911
|
+
var INTERNAL = /* @__PURE__ */ Symbol("AgentBaseInternalState");
|
|
912
|
+
var Agent = class extends http2.Agent {
|
|
913
|
+
constructor(opts) {
|
|
914
|
+
super(opts);
|
|
915
|
+
this[INTERNAL] = {};
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Determine whether this is an `http` or `https` request.
|
|
919
|
+
*/
|
|
920
|
+
isSecureEndpoint(options) {
|
|
921
|
+
if (options) {
|
|
922
|
+
if (typeof options.secureEndpoint === "boolean") {
|
|
923
|
+
return options.secureEndpoint;
|
|
924
|
+
}
|
|
925
|
+
if (typeof options.protocol === "string") {
|
|
926
|
+
return options.protocol === "https:";
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
const { stack } = new Error();
|
|
930
|
+
if (typeof stack !== "string")
|
|
931
|
+
return false;
|
|
932
|
+
return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
|
|
933
|
+
}
|
|
934
|
+
// In order to support async signatures in `connect()` and Node's native
|
|
935
|
+
// connection pooling in `http.Agent`, the array of sockets for each origin
|
|
936
|
+
// has to be updated synchronously. This is so the length of the array is
|
|
937
|
+
// accurate when `addRequest()` is next called. We achieve this by creating a
|
|
938
|
+
// fake socket and adding it to `sockets[origin]` and incrementing
|
|
939
|
+
// `totalSocketCount`.
|
|
940
|
+
incrementSockets(name) {
|
|
941
|
+
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
|
|
942
|
+
return null;
|
|
943
|
+
}
|
|
944
|
+
if (!this.sockets[name]) {
|
|
945
|
+
this.sockets[name] = [];
|
|
946
|
+
}
|
|
947
|
+
const fakeSocket = new net.Socket({ writable: false });
|
|
948
|
+
this.sockets[name].push(fakeSocket);
|
|
949
|
+
this.totalSocketCount++;
|
|
950
|
+
return fakeSocket;
|
|
951
|
+
}
|
|
952
|
+
decrementSockets(name, socket) {
|
|
953
|
+
if (!this.sockets[name] || socket === null) {
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
const sockets = this.sockets[name];
|
|
957
|
+
const index = sockets.indexOf(socket);
|
|
958
|
+
if (index !== -1) {
|
|
959
|
+
sockets.splice(index, 1);
|
|
960
|
+
this.totalSocketCount--;
|
|
961
|
+
if (sockets.length === 0) {
|
|
962
|
+
delete this.sockets[name];
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
// In order to properly update the socket pool, we need to call `getName()` on
|
|
967
|
+
// the core `https.Agent` if it is a secureEndpoint.
|
|
968
|
+
getName(options) {
|
|
969
|
+
const secureEndpoint = this.isSecureEndpoint(options);
|
|
970
|
+
if (secureEndpoint) {
|
|
971
|
+
return https_1.Agent.prototype.getName.call(this, options);
|
|
972
|
+
}
|
|
973
|
+
return super.getName(options);
|
|
974
|
+
}
|
|
975
|
+
createSocket(req, options, cb) {
|
|
976
|
+
const connectOpts = {
|
|
977
|
+
...options,
|
|
978
|
+
secureEndpoint: this.isSecureEndpoint(options)
|
|
979
|
+
};
|
|
980
|
+
const name = this.getName(connectOpts);
|
|
981
|
+
const fakeSocket = this.incrementSockets(name);
|
|
982
|
+
Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
|
|
983
|
+
this.decrementSockets(name, fakeSocket);
|
|
984
|
+
if (socket instanceof http2.Agent) {
|
|
985
|
+
try {
|
|
986
|
+
return socket.addRequest(req, connectOpts);
|
|
987
|
+
} catch (err) {
|
|
988
|
+
return cb(err);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
this[INTERNAL].currentSocket = socket;
|
|
992
|
+
super.createSocket(req, options, cb);
|
|
993
|
+
}, (err) => {
|
|
994
|
+
this.decrementSockets(name, fakeSocket);
|
|
995
|
+
cb(err);
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
createConnection() {
|
|
999
|
+
const socket = this[INTERNAL].currentSocket;
|
|
1000
|
+
this[INTERNAL].currentSocket = void 0;
|
|
1001
|
+
if (!socket) {
|
|
1002
|
+
throw new Error("No socket was returned in the `connect()` function");
|
|
1003
|
+
}
|
|
1004
|
+
return socket;
|
|
1005
|
+
}
|
|
1006
|
+
get defaultPort() {
|
|
1007
|
+
return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
|
|
1008
|
+
}
|
|
1009
|
+
set defaultPort(v) {
|
|
1010
|
+
if (this[INTERNAL]) {
|
|
1011
|
+
this[INTERNAL].defaultPort = v;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
get protocol() {
|
|
1015
|
+
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
|
|
1016
|
+
}
|
|
1017
|
+
set protocol(v) {
|
|
1018
|
+
if (this[INTERNAL]) {
|
|
1019
|
+
this[INTERNAL].protocol = v;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
exports.Agent = Agent;
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
|
|
1027
|
+
// ../node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
1028
|
+
var require_parse_proxy_response = __commonJS({
|
|
1029
|
+
"../node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) {
|
|
1030
|
+
"use strict";
|
|
1031
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1032
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1033
|
+
};
|
|
1034
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1035
|
+
exports.parseProxyResponse = void 0;
|
|
1036
|
+
var debug_1 = __importDefault(require_src());
|
|
1037
|
+
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
1038
|
+
function parseProxyResponse(socket) {
|
|
1039
|
+
return new Promise((resolve, reject) => {
|
|
1040
|
+
let buffersLength = 0;
|
|
1041
|
+
const buffers = [];
|
|
1042
|
+
function read() {
|
|
1043
|
+
const b = socket.read();
|
|
1044
|
+
if (b)
|
|
1045
|
+
ondata(b);
|
|
1046
|
+
else
|
|
1047
|
+
socket.once("readable", read);
|
|
1048
|
+
}
|
|
1049
|
+
function cleanup() {
|
|
1050
|
+
socket.removeListener("end", onend);
|
|
1051
|
+
socket.removeListener("error", onerror);
|
|
1052
|
+
socket.removeListener("readable", read);
|
|
1053
|
+
}
|
|
1054
|
+
function onend() {
|
|
1055
|
+
cleanup();
|
|
1056
|
+
debug("onend");
|
|
1057
|
+
reject(new Error("Proxy connection ended before receiving CONNECT response"));
|
|
1058
|
+
}
|
|
1059
|
+
function onerror(err) {
|
|
1060
|
+
cleanup();
|
|
1061
|
+
debug("onerror %o", err);
|
|
1062
|
+
reject(err);
|
|
1063
|
+
}
|
|
1064
|
+
function ondata(b) {
|
|
1065
|
+
buffers.push(b);
|
|
1066
|
+
buffersLength += b.length;
|
|
1067
|
+
const buffered = Buffer.concat(buffers, buffersLength);
|
|
1068
|
+
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
1069
|
+
if (endOfHeaders === -1) {
|
|
1070
|
+
debug("have not received end of HTTP headers yet...");
|
|
1071
|
+
read();
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
|
|
1075
|
+
const firstLine = headerParts.shift();
|
|
1076
|
+
if (!firstLine) {
|
|
1077
|
+
socket.destroy();
|
|
1078
|
+
return reject(new Error("No header received from proxy CONNECT response"));
|
|
1079
|
+
}
|
|
1080
|
+
const firstLineParts = firstLine.split(" ");
|
|
1081
|
+
const statusCode = +firstLineParts[1];
|
|
1082
|
+
const statusText = firstLineParts.slice(2).join(" ");
|
|
1083
|
+
const headers = {};
|
|
1084
|
+
for (const header of headerParts) {
|
|
1085
|
+
if (!header)
|
|
1086
|
+
continue;
|
|
1087
|
+
const firstColon = header.indexOf(":");
|
|
1088
|
+
if (firstColon === -1) {
|
|
1089
|
+
socket.destroy();
|
|
1090
|
+
return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
1091
|
+
}
|
|
1092
|
+
const key = header.slice(0, firstColon).toLowerCase();
|
|
1093
|
+
const value = header.slice(firstColon + 1).trimStart();
|
|
1094
|
+
const current = headers[key];
|
|
1095
|
+
if (typeof current === "string") {
|
|
1096
|
+
headers[key] = [current, value];
|
|
1097
|
+
} else if (Array.isArray(current)) {
|
|
1098
|
+
current.push(value);
|
|
1099
|
+
} else {
|
|
1100
|
+
headers[key] = value;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
debug("got proxy server response: %o %o", firstLine, headers);
|
|
1104
|
+
cleanup();
|
|
1105
|
+
resolve({
|
|
1106
|
+
connect: {
|
|
1107
|
+
statusCode,
|
|
1108
|
+
statusText,
|
|
1109
|
+
headers
|
|
1110
|
+
},
|
|
1111
|
+
buffered
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
socket.on("error", onerror);
|
|
1115
|
+
socket.on("end", onend);
|
|
1116
|
+
read();
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
exports.parseProxyResponse = parseProxyResponse;
|
|
1120
|
+
}
|
|
1121
|
+
});
|
|
1122
|
+
|
|
1123
|
+
// ../node_modules/https-proxy-agent/dist/index.js
|
|
1124
|
+
var require_dist2 = __commonJS({
|
|
1125
|
+
"../node_modules/https-proxy-agent/dist/index.js"(exports) {
|
|
1126
|
+
"use strict";
|
|
1127
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1128
|
+
if (k2 === void 0) k2 = k;
|
|
1129
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1130
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1131
|
+
desc = { enumerable: true, get: function() {
|
|
1132
|
+
return m[k];
|
|
1133
|
+
} };
|
|
1134
|
+
}
|
|
1135
|
+
Object.defineProperty(o, k2, desc);
|
|
1136
|
+
}) : (function(o, m, k, k2) {
|
|
1137
|
+
if (k2 === void 0) k2 = k;
|
|
1138
|
+
o[k2] = m[k];
|
|
1139
|
+
}));
|
|
1140
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
1141
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1142
|
+
}) : function(o, v) {
|
|
1143
|
+
o["default"] = v;
|
|
1144
|
+
});
|
|
1145
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
1146
|
+
if (mod && mod.__esModule) return mod;
|
|
1147
|
+
var result = {};
|
|
1148
|
+
if (mod != null) {
|
|
1149
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1150
|
+
}
|
|
1151
|
+
__setModuleDefault(result, mod);
|
|
1152
|
+
return result;
|
|
1153
|
+
};
|
|
1154
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1155
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1156
|
+
};
|
|
1157
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1158
|
+
exports.HttpsProxyAgent = void 0;
|
|
1159
|
+
var net = __importStar(__require("net"));
|
|
1160
|
+
var tls = __importStar(__require("tls"));
|
|
1161
|
+
var assert_1 = __importDefault(__require("assert"));
|
|
1162
|
+
var debug_1 = __importDefault(require_src());
|
|
1163
|
+
var agent_base_1 = require_dist();
|
|
1164
|
+
var url_1 = __require("url");
|
|
1165
|
+
var parse_proxy_response_1 = require_parse_proxy_response();
|
|
1166
|
+
var debug = (0, debug_1.default)("https-proxy-agent");
|
|
1167
|
+
var setServernameFromNonIpHost = (options) => {
|
|
1168
|
+
if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
|
|
1169
|
+
return {
|
|
1170
|
+
...options,
|
|
1171
|
+
servername: options.host
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
return options;
|
|
1175
|
+
};
|
|
1176
|
+
var HttpsProxyAgent2 = class extends agent_base_1.Agent {
|
|
1177
|
+
constructor(proxy, opts) {
|
|
1178
|
+
super(opts);
|
|
1179
|
+
this.options = { path: void 0 };
|
|
1180
|
+
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
|
1181
|
+
this.proxyHeaders = opts?.headers ?? {};
|
|
1182
|
+
debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
|
1183
|
+
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
|
1184
|
+
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
|
1185
|
+
this.connectOpts = {
|
|
1186
|
+
// Attempt to negotiate http/1.1 for proxy servers that support http/2
|
|
1187
|
+
ALPNProtocols: ["http/1.1"],
|
|
1188
|
+
...opts ? omit(opts, "headers") : null,
|
|
1189
|
+
host,
|
|
1190
|
+
port
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Called when the node-core HTTP client library is creating a
|
|
1195
|
+
* new HTTP request.
|
|
1196
|
+
*/
|
|
1197
|
+
async connect(req, opts) {
|
|
1198
|
+
const { proxy } = this;
|
|
1199
|
+
if (!opts.host) {
|
|
1200
|
+
throw new TypeError('No "host" provided');
|
|
1201
|
+
}
|
|
1202
|
+
let socket;
|
|
1203
|
+
if (proxy.protocol === "https:") {
|
|
1204
|
+
debug("Creating `tls.Socket`: %o", this.connectOpts);
|
|
1205
|
+
socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
|
|
1206
|
+
} else {
|
|
1207
|
+
debug("Creating `net.Socket`: %o", this.connectOpts);
|
|
1208
|
+
socket = net.connect(this.connectOpts);
|
|
1209
|
+
}
|
|
1210
|
+
const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
|
|
1211
|
+
const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
1212
|
+
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
|
|
1213
|
+
`;
|
|
1214
|
+
if (proxy.username || proxy.password) {
|
|
1215
|
+
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
1216
|
+
headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
|
|
1217
|
+
}
|
|
1218
|
+
headers.Host = `${host}:${opts.port}`;
|
|
1219
|
+
if (!headers["Proxy-Connection"]) {
|
|
1220
|
+
headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
|
|
1221
|
+
}
|
|
1222
|
+
for (const name of Object.keys(headers)) {
|
|
1223
|
+
payload += `${name}: ${headers[name]}\r
|
|
1224
|
+
`;
|
|
1225
|
+
}
|
|
1226
|
+
const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
|
|
1227
|
+
socket.write(`${payload}\r
|
|
1228
|
+
`);
|
|
1229
|
+
const { connect, buffered } = await proxyResponsePromise;
|
|
1230
|
+
req.emit("proxyConnect", connect);
|
|
1231
|
+
this.emit("proxyConnect", connect, req);
|
|
1232
|
+
if (connect.statusCode === 200) {
|
|
1233
|
+
req.once("socket", resume);
|
|
1234
|
+
if (opts.secureEndpoint) {
|
|
1235
|
+
debug("Upgrading socket connection to TLS");
|
|
1236
|
+
return tls.connect({
|
|
1237
|
+
...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
|
|
1238
|
+
socket
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
return socket;
|
|
1242
|
+
}
|
|
1243
|
+
socket.destroy();
|
|
1244
|
+
const fakeSocket = new net.Socket({ writable: false });
|
|
1245
|
+
fakeSocket.readable = true;
|
|
1246
|
+
req.once("socket", (s) => {
|
|
1247
|
+
debug("Replaying proxy buffer for failed request");
|
|
1248
|
+
(0, assert_1.default)(s.listenerCount("data") > 0);
|
|
1249
|
+
s.push(buffered);
|
|
1250
|
+
s.push(null);
|
|
1251
|
+
});
|
|
1252
|
+
return fakeSocket;
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1255
|
+
HttpsProxyAgent2.protocols = ["http", "https"];
|
|
1256
|
+
exports.HttpsProxyAgent = HttpsProxyAgent2;
|
|
1257
|
+
function resume(socket) {
|
|
1258
|
+
socket.resume();
|
|
1259
|
+
}
|
|
1260
|
+
function omit(obj, ...keys) {
|
|
1261
|
+
const ret = {};
|
|
1262
|
+
let key;
|
|
1263
|
+
for (key in obj) {
|
|
1264
|
+
if (!keys.includes(key)) {
|
|
1265
|
+
ret[key] = obj[key];
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
return ret;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
|
|
1
1273
|
// src/client.ts
|
|
1274
|
+
var import_https_proxy_agent = __toESM(require_dist2());
|
|
2
1275
|
import { EventEmitter } from "events";
|
|
3
1276
|
import * as http from "http";
|
|
4
1277
|
import * as https from "https";
|
|
5
1278
|
import * as zlib from "zlib";
|
|
1279
|
+
import { URL } from "url";
|
|
6
1280
|
import WebSocket from "ws";
|
|
7
1281
|
|
|
8
1282
|
// src/proto.ts
|
|
@@ -713,8 +1987,6 @@ function parseWebcastMessage(method, payload) {
|
|
|
713
1987
|
};
|
|
714
1988
|
}
|
|
715
1989
|
case "WebcastBarrageMessage": {
|
|
716
|
-
const fieldSummary = f.map((x) => `fn=${x.fn} wt=${x.wt} val=${x.wt === 0 ? x.value : x.wt === 2 ? `[bytes:${x.value.length}]` : x.value}`).join(" | ");
|
|
717
|
-
console.log(`[proto] WebcastBarrageMessage fields: ${fieldSummary}`);
|
|
718
1990
|
const msgType = getInt(f, 3);
|
|
719
1991
|
const duration = getInt(f, 4);
|
|
720
1992
|
const displayType = getInt(f, 5);
|
|
@@ -744,7 +2016,6 @@ function parseWebcastMessage(method, payload) {
|
|
|
744
2016
|
if (!defaultPattern) {
|
|
745
2017
|
defaultPattern = getStr(f, 1) || "";
|
|
746
2018
|
}
|
|
747
|
-
console.log(`[proto] Barrage parsed: msgType=${msgType} subType=${subType} displayType=${displayType} duration=${duration} pattern="${defaultPattern}" content="${content}"`);
|
|
748
2019
|
return {
|
|
749
2020
|
...base,
|
|
750
2021
|
type: "barrage",
|
|
@@ -780,10 +2051,12 @@ function parseWebcastResponse(payload) {
|
|
|
780
2051
|
// src/client.ts
|
|
781
2052
|
var DEFAULT_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36";
|
|
782
2053
|
var DEFAULT_SIGN_SERVER = "https://api.tik.tools";
|
|
783
|
-
function httpGet(url, headers) {
|
|
2054
|
+
function httpGet(url, headers, agent) {
|
|
784
2055
|
return new Promise((resolve, reject) => {
|
|
785
2056
|
const mod = url.startsWith("https") ? https : http;
|
|
786
|
-
const
|
|
2057
|
+
const opts = { headers, agent };
|
|
2058
|
+
const parsed = new URL(url);
|
|
2059
|
+
const req = mod.get(parsed, opts, (res) => {
|
|
787
2060
|
const chunks = [];
|
|
788
2061
|
const enc = res.headers["content-encoding"];
|
|
789
2062
|
const stream = enc === "gzip" || enc === "br" ? res.pipe(enc === "br" ? zlib.createBrotliDecompress() : zlib.createGunzip()) : res;
|
|
@@ -827,6 +2100,7 @@ var TikTokLive = class extends EventEmitter {
|
|
|
827
2100
|
debug;
|
|
828
2101
|
_sessionId;
|
|
829
2102
|
_ttTargetIdc;
|
|
2103
|
+
proxyAgent;
|
|
830
2104
|
constructor(options) {
|
|
831
2105
|
super();
|
|
832
2106
|
this.uniqueId = options.uniqueId.replace(/^@/, "");
|
|
@@ -839,6 +2113,9 @@ var TikTokLive = class extends EventEmitter {
|
|
|
839
2113
|
this.debug = options.debug ?? false;
|
|
840
2114
|
this._sessionId = options.sessionId;
|
|
841
2115
|
this._ttTargetIdc = options.ttTargetIdc;
|
|
2116
|
+
if (options.proxyUrl) {
|
|
2117
|
+
this.proxyAgent = new import_https_proxy_agent.HttpsProxyAgent(options.proxyUrl);
|
|
2118
|
+
}
|
|
842
2119
|
}
|
|
843
2120
|
async connect() {
|
|
844
2121
|
this.intentionalClose = false;
|
|
@@ -847,7 +2124,7 @@ var TikTokLive = class extends EventEmitter {
|
|
|
847
2124
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
848
2125
|
"Accept-Encoding": "gzip, deflate, br",
|
|
849
2126
|
"Accept-Language": "en-US,en;q=0.9"
|
|
850
|
-
});
|
|
2127
|
+
}, this.proxyAgent);
|
|
851
2128
|
let ttwid = "";
|
|
852
2129
|
for (const sc of [resp.headers["set-cookie"] || []].flat()) {
|
|
853
2130
|
if (typeof sc === "string" && sc.startsWith("ttwid=")) {
|
|
@@ -943,7 +2220,8 @@ var TikTokLive = class extends EventEmitter {
|
|
|
943
2220
|
"User-Agent": DEFAULT_UA,
|
|
944
2221
|
"Cookie": cookieHeader,
|
|
945
2222
|
"Origin": "https://www.tiktok.com"
|
|
946
|
-
}
|
|
2223
|
+
},
|
|
2224
|
+
agent: this.proxyAgent
|
|
947
2225
|
});
|
|
948
2226
|
this.ws.on("open", () => {
|
|
949
2227
|
this._connected = true;
|