@tiktool/live 2.5.1 → 2.6.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 +10 -7
- package/dist/index.d.mts +581 -3
- package/dist/index.d.ts +581 -3
- package/dist/index.js +84 -1283
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -1312
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
8
|
var __export = (target, all) => {
|
|
12
9
|
for (var name in all)
|
|
13
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,1246 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
27
|
));
|
|
31
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
29
|
|
|
33
|
-
// ../node_modules/ms/index.js
|
|
34
|
-
var require_ms = __commonJS({
|
|
35
|
-
"../node_modules/ms/index.js"(exports2, module2) {
|
|
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
|
-
module2.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"(exports2, module2) {
|
|
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
|
-
module2.exports = setup;
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
// ../node_modules/debug/src/browser.js
|
|
329
|
-
var require_browser = __commonJS({
|
|
330
|
-
"../node_modules/debug/src/browser.js"(exports2, module2) {
|
|
331
|
-
"use strict";
|
|
332
|
-
exports2.formatArgs = formatArgs;
|
|
333
|
-
exports2.save = save;
|
|
334
|
-
exports2.load = load;
|
|
335
|
-
exports2.useColors = useColors;
|
|
336
|
-
exports2.storage = localstorage();
|
|
337
|
-
exports2.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
|
-
exports2.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 " : " ") + "+" + module2.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
|
-
exports2.log = console.debug || console.log || (() => {
|
|
459
|
-
});
|
|
460
|
-
function save(namespaces) {
|
|
461
|
-
try {
|
|
462
|
-
if (namespaces) {
|
|
463
|
-
exports2.storage.setItem("debug", namespaces);
|
|
464
|
-
} else {
|
|
465
|
-
exports2.storage.removeItem("debug");
|
|
466
|
-
}
|
|
467
|
-
} catch (error) {
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
function load() {
|
|
471
|
-
let r;
|
|
472
|
-
try {
|
|
473
|
-
r = exports2.storage.getItem("debug") || exports2.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
|
-
module2.exports = require_common()(exports2);
|
|
488
|
-
var { formatters } = module2.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"(exports2, module2) {
|
|
502
|
-
"use strict";
|
|
503
|
-
module2.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"(exports2, module2) {
|
|
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
|
-
module2.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"(exports2, module2) {
|
|
617
|
-
"use strict";
|
|
618
|
-
var tty = require("tty");
|
|
619
|
-
var util = require("util");
|
|
620
|
-
exports2.init = init;
|
|
621
|
-
exports2.log = log;
|
|
622
|
-
exports2.formatArgs = formatArgs;
|
|
623
|
-
exports2.save = save;
|
|
624
|
-
exports2.load = load;
|
|
625
|
-
exports2.useColors = useColors;
|
|
626
|
-
exports2.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
|
-
exports2.colors = [6, 2, 3, 4, 5, 1];
|
|
632
|
-
try {
|
|
633
|
-
const supportsColor = require_supports_color();
|
|
634
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
635
|
-
exports2.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
|
-
exports2.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 exports2.inspectOpts ? Boolean(exports2.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+" + module2.exports.humanize(this.diff) + "\x1B[0m");
|
|
746
|
-
} else {
|
|
747
|
-
args[0] = getDate() + name + " " + args[0];
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
function getDate() {
|
|
751
|
-
if (exports2.inspectOpts.hideDate) {
|
|
752
|
-
return "";
|
|
753
|
-
}
|
|
754
|
-
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
755
|
-
}
|
|
756
|
-
function log(...args) {
|
|
757
|
-
return process.stderr.write(util.formatWithOptions(exports2.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(exports2.inspectOpts);
|
|
772
|
-
for (let i = 0; i < keys.length; i++) {
|
|
773
|
-
debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]];
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
module2.exports = require_common()(exports2);
|
|
777
|
-
var { formatters } = module2.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"(exports2, module2) {
|
|
792
|
-
"use strict";
|
|
793
|
-
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
794
|
-
module2.exports = require_browser();
|
|
795
|
-
} else {
|
|
796
|
-
module2.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"(exports2) {
|
|
804
|
-
"use strict";
|
|
805
|
-
var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__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 = exports2 && exports2.__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(exports2, "__esModule", { value: true });
|
|
833
|
-
exports2.req = exports2.json = exports2.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
|
-
exports2.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
|
-
exports2.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
|
-
exports2.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"(exports2) {
|
|
874
|
-
"use strict";
|
|
875
|
-
var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__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 = exports2 && exports2.__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 = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
903
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
904
|
-
};
|
|
905
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
906
|
-
exports2.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(), exports2);
|
|
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
|
-
exports2.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"(exports2) {
|
|
1030
|
-
"use strict";
|
|
1031
|
-
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
1032
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1033
|
-
};
|
|
1034
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1035
|
-
exports2.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
|
-
exports2.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"(exports2) {
|
|
1126
|
-
"use strict";
|
|
1127
|
-
var __createBinding = exports2 && exports2.__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 = exports2 && exports2.__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 = exports2 && exports2.__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 = exports2 && exports2.__importDefault || function(mod) {
|
|
1155
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1156
|
-
};
|
|
1157
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1158
|
-
exports2.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
|
-
exports2.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
|
-
|
|
1273
30
|
// src/index.ts
|
|
1274
31
|
var index_exports = {};
|
|
1275
32
|
__export(index_exports, {
|
|
@@ -1286,7 +43,6 @@ var https = __toESM(require("https"));
|
|
|
1286
43
|
var zlib = __toESM(require("zlib"));
|
|
1287
44
|
var import_url = require("url");
|
|
1288
45
|
var import_ws = __toESM(require("ws"));
|
|
1289
|
-
var import_https_proxy_agent = __toESM(require_dist2());
|
|
1290
46
|
|
|
1291
47
|
// src/proto.ts
|
|
1292
48
|
var encoder = new TextEncoder();
|
|
@@ -1528,10 +284,24 @@ function parseUser(data) {
|
|
|
1528
284
|
}
|
|
1529
285
|
}
|
|
1530
286
|
const badges = [];
|
|
1531
|
-
|
|
1532
|
-
|
|
287
|
+
let payGrade;
|
|
288
|
+
const badgeBufs = getAllBytes(f, 64);
|
|
289
|
+
for (const badgeBuf of badgeBufs) {
|
|
1533
290
|
try {
|
|
1534
291
|
const badgeFields = decodeProto(badgeBuf);
|
|
292
|
+
const badgeCategory = getInt(badgeFields, 2);
|
|
293
|
+
const badgeSubCat = getInt(badgeFields, 3);
|
|
294
|
+
if (badgeCategory === 20 && badgeSubCat === 8 && !payGrade) {
|
|
295
|
+
const privBuf = getBytes(badgeFields, 12);
|
|
296
|
+
if (privBuf) {
|
|
297
|
+
const privFields = decodeProto(privBuf);
|
|
298
|
+
const levelStr = getStr(privFields, 5);
|
|
299
|
+
if (levelStr) {
|
|
300
|
+
const level = parseInt(levelStr, 10);
|
|
301
|
+
if (level > 0) payGrade = level;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
1535
305
|
const badgeItems = getAllBytes(badgeFields, 21);
|
|
1536
306
|
for (const bi of badgeItems) {
|
|
1537
307
|
const bf = decodeProto(bi);
|
|
@@ -1546,7 +316,8 @@ function parseUser(data) {
|
|
|
1546
316
|
nickname,
|
|
1547
317
|
uniqueId: uniqueId || nickname || id,
|
|
1548
318
|
profilePictureUrl: profilePicture,
|
|
1549
|
-
badges: badges.length > 0 ? badges : void 0
|
|
319
|
+
badges: badges.length > 0 ? badges : void 0,
|
|
320
|
+
payGrade
|
|
1550
321
|
};
|
|
1551
322
|
}
|
|
1552
323
|
function parseBattleTeamFromArmies(itemBuf) {
|
|
@@ -1796,9 +567,27 @@ function parseWebcastMessage(method, payload) {
|
|
|
1796
567
|
return { ...base, type: "battle", battleId, status, battleDuration, teams, battleSettings };
|
|
1797
568
|
}
|
|
1798
569
|
case "WebcastLinkMicArmies": {
|
|
1799
|
-
const battleId = getIntStr(f, 1) || "";
|
|
570
|
+
const battleId = getIntStr(f, 2) || getIntStr(f, 1) || "";
|
|
1800
571
|
const battleStatus = getInt(f, 7);
|
|
1801
572
|
const teams = [];
|
|
573
|
+
let battleSettings;
|
|
574
|
+
const settingsBuf18 = getBytes(f, 18);
|
|
575
|
+
if (settingsBuf18) {
|
|
576
|
+
try {
|
|
577
|
+
const sf = decodeProto(settingsBuf18);
|
|
578
|
+
const startTimeMs = getInt(sf, 2);
|
|
579
|
+
const duration = getInt(sf, 3);
|
|
580
|
+
const endTimeMs = getInt(sf, 10);
|
|
581
|
+
battleSettings = {
|
|
582
|
+
startTimeMs: startTimeMs || void 0,
|
|
583
|
+
duration: duration || void 0,
|
|
584
|
+
endTimeMs: endTimeMs || void 0
|
|
585
|
+
};
|
|
586
|
+
} catch {
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
const scoreUpdateTime = getInt(f, 5);
|
|
590
|
+
const giftSentTime = getInt(f, 6);
|
|
1802
591
|
const itemBufs = getAllBytes(f, 3);
|
|
1803
592
|
for (const ib of itemBufs) {
|
|
1804
593
|
try {
|
|
@@ -1811,7 +600,10 @@ function parseWebcastMessage(method, payload) {
|
|
|
1811
600
|
type: "battleArmies",
|
|
1812
601
|
battleId,
|
|
1813
602
|
teams,
|
|
1814
|
-
status: battleStatus
|
|
603
|
+
status: battleStatus,
|
|
604
|
+
battleSettings,
|
|
605
|
+
scoreUpdateTime,
|
|
606
|
+
giftSentTime
|
|
1815
607
|
};
|
|
1816
608
|
}
|
|
1817
609
|
case "WebcastSubNotifyMessage": {
|
|
@@ -2110,6 +902,8 @@ var TikTokLive = class extends import_events.EventEmitter {
|
|
|
2110
902
|
_sessionId;
|
|
2111
903
|
_ttTargetIdc;
|
|
2112
904
|
proxyAgent;
|
|
905
|
+
_presetRoomId;
|
|
906
|
+
_presetTtwid;
|
|
2113
907
|
constructor(options) {
|
|
2114
908
|
super();
|
|
2115
909
|
this.uniqueId = options.uniqueId.replace(/^@/, "");
|
|
@@ -2122,48 +916,54 @@ var TikTokLive = class extends import_events.EventEmitter {
|
|
|
2122
916
|
this.debug = options.debug ?? false;
|
|
2123
917
|
this._sessionId = options.sessionId;
|
|
2124
918
|
this._ttTargetIdc = options.ttTargetIdc;
|
|
2125
|
-
if (options.
|
|
2126
|
-
this.proxyAgent =
|
|
919
|
+
if (options.agent) {
|
|
920
|
+
this.proxyAgent = options.agent;
|
|
2127
921
|
}
|
|
922
|
+
this._presetRoomId = options.roomId;
|
|
923
|
+
this._presetTtwid = options.ttwid;
|
|
2128
924
|
}
|
|
2129
925
|
async connect() {
|
|
2130
926
|
this.intentionalClose = false;
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
2134
|
-
"Accept-Encoding": "gzip, deflate, br",
|
|
2135
|
-
"Accept-Language": "en-US,en;q=0.9"
|
|
2136
|
-
}, this.proxyAgent);
|
|
2137
|
-
let ttwid = "";
|
|
2138
|
-
for (const sc of [resp.headers["set-cookie"] || []].flat()) {
|
|
2139
|
-
if (typeof sc === "string" && sc.startsWith("ttwid=")) {
|
|
2140
|
-
ttwid = sc.split(";")[0].split("=").slice(1).join("=");
|
|
2141
|
-
break;
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
if (!ttwid) throw new Error("Failed to obtain session cookie");
|
|
2145
|
-
const html = resp.body.toString();
|
|
2146
|
-
let roomId = "";
|
|
927
|
+
let ttwid = this._presetTtwid || "";
|
|
928
|
+
let roomId = this._presetRoomId || "";
|
|
2147
929
|
let ownerUserId = "";
|
|
2148
|
-
|
|
2149
|
-
if (
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
930
|
+
let clusterRegion = "";
|
|
931
|
+
if (!roomId || !ttwid) {
|
|
932
|
+
const targetUrl = `https://www.tiktok.com/@${this.uniqueId}/live`;
|
|
933
|
+
const resp = await httpGet(targetUrl, {
|
|
934
|
+
"User-Agent": DEFAULT_UA,
|
|
935
|
+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
936
|
+
"Accept-Encoding": "gzip, deflate, br",
|
|
937
|
+
"Accept-Language": "en-US,en;q=0.9"
|
|
938
|
+
}, this.proxyAgent);
|
|
939
|
+
for (const sc of [resp.headers["set-cookie"] || []].flat()) {
|
|
940
|
+
if (typeof sc === "string" && sc.startsWith("ttwid=")) {
|
|
941
|
+
ttwid = sc.split(";")[0].split("=").slice(1).join("=");
|
|
942
|
+
break;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
if (!ttwid) throw new Error("Failed to obtain session cookie");
|
|
946
|
+
const html = resp.body.toString();
|
|
947
|
+
const sigiMatch = html.match(/id="SIGI_STATE"[^>]*>([^<]+)/);
|
|
948
|
+
if (sigiMatch) {
|
|
949
|
+
try {
|
|
950
|
+
const json = JSON.parse(sigiMatch[1]);
|
|
951
|
+
const jsonStr = JSON.stringify(json);
|
|
952
|
+
const m = jsonStr.match(/"roomId"\s*:\s*"(\d+)"/);
|
|
953
|
+
if (m) roomId = m[1];
|
|
954
|
+
const ownerUser = json?.LiveRoom?.liveRoomUserInfo?.user;
|
|
955
|
+
if (ownerUser?.id) {
|
|
956
|
+
ownerUserId = String(ownerUser.id);
|
|
957
|
+
}
|
|
958
|
+
} catch {
|
|
2158
959
|
}
|
|
2159
|
-
} catch {
|
|
2160
960
|
}
|
|
961
|
+
if (!roomId) throw new Error(`User @${this.uniqueId} is not currently live`);
|
|
962
|
+
const crMatch = html.match(/"clusterRegion"\s*:\s*"([^"]+)"/);
|
|
963
|
+
clusterRegion = crMatch ? crMatch[1] : "";
|
|
2161
964
|
}
|
|
2162
|
-
if (!roomId) throw new Error(`User @${this.uniqueId} is not currently live`);
|
|
2163
965
|
this._roomId = roomId;
|
|
2164
966
|
this._ownerUserId = ownerUserId;
|
|
2165
|
-
const crMatch = html.match(/"clusterRegion"\s*:\s*"([^"]+)"/);
|
|
2166
|
-
const clusterRegion = crMatch ? crMatch[1] : "";
|
|
2167
967
|
const wsHost = getWsHost(clusterRegion);
|
|
2168
968
|
const wsParams = new URLSearchParams({
|
|
2169
969
|
version_code: "270000",
|
|
@@ -2217,9 +1017,10 @@ var TikTokLive = class extends import_events.EventEmitter {
|
|
|
2217
1017
|
wsUrl = rawWsUrl.replace(/^https:\/\//, "wss://");
|
|
2218
1018
|
}
|
|
2219
1019
|
return new Promise((resolve, reject) => {
|
|
2220
|
-
let cookieHeader = `ttwid=${ttwid}
|
|
1020
|
+
let cookieHeader = ttwid ? `ttwid=${ttwid}` : "";
|
|
2221
1021
|
if (this._sessionId) {
|
|
2222
|
-
|
|
1022
|
+
const sessionCookies = `sessionid=${this._sessionId}; sessionid_ss=${this._sessionId}; sid_tt=${this._sessionId}`;
|
|
1023
|
+
cookieHeader = cookieHeader ? `${cookieHeader}; ${sessionCookies}` : sessionCookies;
|
|
2223
1024
|
if (this._ttTargetIdc) {
|
|
2224
1025
|
cookieHeader += `; tt-target-idc=${this._ttTargetIdc}`;
|
|
2225
1026
|
}
|