bililive-cli 3.10.0 → 3.10.1

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.
@@ -2,27 +2,27 @@
2
2
 
3
3
  var path$7 = require('node:path');
4
4
  var require$$2$1 = require('node:http');
5
- var require$$0$4 = require('node:url');
5
+ var require$$1$2 = require('node:url');
6
6
  var a = require('node:https');
7
- var index = require('./index-CPP-8XuA.cjs');
8
- var require$$0$5 = require('tty');
9
- var require$$1$2 = require('util');
10
- var require$$0$c = require('assert');
11
- var require$$0$7 = require('path');
12
- var require$$0$6 = require('buffer');
13
- var require$$0$8 = require('events');
14
- var require$$0$9 = require('fs');
15
- var require$$0$a = require('stream');
7
+ var index = require('./index-CuJEbURl.cjs');
8
+ var require$$0$4 = require('tty');
9
+ var require$$1$3 = require('util');
10
+ var require$$0$b = require('assert');
11
+ var require$$0$6 = require('path');
12
+ var require$$0$5 = require('buffer');
13
+ var require$$0$7 = require('events');
14
+ var require$$0$8 = require('fs');
15
+ var require$$0$9 = require('stream');
16
16
  var zlib$1 = require('zlib');
17
- var require$$0$b = require('url');
18
- var require$$1$3 = require('crypto');
17
+ var require$$0$a = require('url');
18
+ var require$$1$4 = require('crypto');
19
19
  var require$$3$1 = require('http');
20
- var require$$0$d = require('net');
20
+ var require$$0$c = require('net');
21
21
  var require$$5$1 = require('querystring');
22
22
  var require$$17 = require('async_hooks');
23
- var require$$1$4 = require('string_decoder');
23
+ var require$$1$5 = require('string_decoder');
24
24
  var os$1 = require('node:os');
25
- var require$$1$5 = require('os');
25
+ var require$$1$6 = require('os');
26
26
  var require$$1$1 = require('node:child_process');
27
27
  var fs$6 = require('node:fs');
28
28
  var EventEmitter$3 = require('node:events');
@@ -32,9 +32,9 @@ require('node:readline');
32
32
  require('@napi-rs/canvas');
33
33
  require('better-sqlite3');
34
34
  var musicSegmentDetector = require('music-segment-detector');
35
- var require$$0$e = require('child_process');
35
+ var require$$0$d = require('child_process');
36
36
  var shazamioCore = require('shazamio-core');
37
- var require$$1$6 = require('https');
37
+ var require$$1$7 = require('https');
38
38
  require('node:dns');
39
39
  require('constants');
40
40
  require('node:fs/promises');
@@ -1075,7 +1075,7 @@ class Alist extends index.TypedEmitter {
1075
1075
  this.emit("canceled", "上传已取消");
1076
1076
  },
1077
1077
  };
1078
- const url = new require$$0$4.URL(combineURLs(this.server, "/api/fs/put"));
1078
+ const url = new require$$1$2.URL(combineURLs(this.server, "/api/fs/put"));
1079
1079
  const httpModule = url.protocol === "https:" ? a : require$$2$1;
1080
1080
  try {
1081
1081
  await new Promise((resolve, reject) => {
@@ -2037,8 +2037,8 @@ function requireNode$1 () {
2037
2037
  if (hasRequiredNode$1) return node$1.exports;
2038
2038
  hasRequiredNode$1 = 1;
2039
2039
  (function (module, exports) {
2040
- const tty = require$$0$5;
2041
- const util = require$$1$2;
2040
+ const tty = require$$0$4;
2041
+ const util = require$$1$3;
2042
2042
 
2043
2043
  /**
2044
2044
  * This is the Node.js implementation of `debug()`.
@@ -2654,7 +2654,7 @@ var safeBuffer$2 = {exports: {}};
2654
2654
 
2655
2655
  (function (module, exports) {
2656
2656
  /* eslint-disable node/no-deprecated-api */
2657
- var buffer = require$$0$6;
2657
+ var buffer = require$$0$5;
2658
2658
  var Buffer = buffer.Buffer;
2659
2659
 
2660
2660
  // alternative to using Object.keys for old browsers
@@ -2740,7 +2740,7 @@ contentDisposition$1.exports.parse = parse$k;
2740
2740
  * @private
2741
2741
  */
2742
2742
 
2743
- var basename$2 = require$$0$7.basename;
2743
+ var basename$2 = require$$0$6.basename;
2744
2744
  var Buffer$2 = safeBufferExports.Buffer;
2745
2745
 
2746
2746
  /**
@@ -4115,9 +4115,9 @@ function status$1 (code) {
4115
4115
  * @private
4116
4116
  */
4117
4117
 
4118
- var EventEmitter$2 = require$$0$8.EventEmitter;
4119
- var ReadStream = require$$0$9.ReadStream;
4120
- var Stream$3 = require$$0$a;
4118
+ var EventEmitter$2 = require$$0$7.EventEmitter;
4119
+ var ReadStream = require$$0$8.ReadStream;
4120
+ var Stream$3 = require$$0$9;
4121
4121
  var Zlib = zlib$1;
4122
4122
 
4123
4123
  /**
@@ -4545,14 +4545,14 @@ function encodeUrl (url) {
4545
4545
  const typeis = typeIsExports.is;
4546
4546
  const statuses = statuses$2;
4547
4547
  const destroy = destroy_1$2;
4548
- const assert = require$$0$c;
4549
- const extname = require$$0$7.extname;
4548
+ const assert = require$$0$b;
4549
+ const extname = require$$0$6.extname;
4550
4550
  const vary = varyExports;
4551
4551
  const only = only$1;
4552
- const util = require$$1$2;
4552
+ const util = require$$1$3;
4553
4553
  const encodeUrl = encodeurl;
4554
- const Stream = require$$0$a;
4555
- const URL = require$$0$b.URL;
4554
+ const Stream = require$$0$9;
4555
+ const URL = require$$0$a.URL;
4556
4556
 
4557
4557
  /**
4558
4558
  * Prototype.
@@ -5335,7 +5335,7 @@ function requireEventListenerCount$1 () {
5335
5335
  * @private
5336
5336
  */
5337
5337
 
5338
- var EventEmitter = require$$0$8.EventEmitter;
5338
+ var EventEmitter = require$$0$7.EventEmitter;
5339
5339
 
5340
5340
  /**
5341
5341
  * Module exports.
@@ -5417,7 +5417,7 @@ var compatExports$1 = compat$1.exports;
5417
5417
 
5418
5418
  var callSiteToString$1 = compatExports$1.callSiteToString;
5419
5419
  var eventListenerCount$1 = compatExports$1.eventListenerCount;
5420
- var relative$2 = require$$0$7.relative;
5420
+ var relative$2 = require$$0$6.relative;
5421
5421
 
5422
5422
  /**
5423
5423
  * Module exports.
@@ -6436,7 +6436,7 @@ function requireEventListenerCount () {
6436
6436
  * @private
6437
6437
  */
6438
6438
 
6439
- var EventEmitter = require$$0$8.EventEmitter;
6439
+ var EventEmitter = require$$0$7.EventEmitter;
6440
6440
 
6441
6441
  /**
6442
6442
  * Module exports.
@@ -6518,7 +6518,7 @@ var compatExports = compat.exports;
6518
6518
 
6519
6519
  var callSiteToString = compatExports.callSiteToString;
6520
6520
  var eventListenerCount = compatExports.eventListenerCount;
6521
- var relative$1 = require$$0$7.relative;
6521
+ var relative$1 = require$$0$6.relative;
6522
6522
 
6523
6523
  /**
6524
6524
  * Module exports.
@@ -7644,7 +7644,7 @@ Delegator.prototype.fluent = function (name) {
7644
7644
  * Module dependencies.
7645
7645
  */
7646
7646
 
7647
- var relative = require$$0$7.relative;
7647
+ var relative = require$$0$6.relative;
7648
7648
 
7649
7649
  /**
7650
7650
  * Module exports.
@@ -8179,7 +8179,7 @@ function DeprecationError (namespace, message, stack) {
8179
8179
  // https://github.com/nodejs/node/issues/3043
8180
8180
  // https://github.com/nodejs/node/pull/3073
8181
8181
 
8182
- var crypto$3 = require$$1$3;
8182
+ var crypto$3 = require$$1$4;
8183
8183
 
8184
8184
  function bufferEqual(a, b) {
8185
8185
  if (a.length !== b.length) {
@@ -8217,7 +8217,7 @@ var lib$8 = timeSafeCompare;
8217
8217
  */
8218
8218
 
8219
8219
  var compare$c = lib$8;
8220
- var crypto$2 = require$$1$3;
8220
+ var crypto$2 = require$$1$4;
8221
8221
 
8222
8222
  function Keygrip$1(keys, algorithm, encoding) {
8223
8223
  if (!algorithm) algorithm = "sha1";
@@ -8555,7 +8555,7 @@ var cookies = Cookies;
8555
8555
  * Module dependencies.
8556
8556
  */
8557
8557
 
8558
- const util = require$$1$2;
8558
+ const util = require$$1$3;
8559
8559
  const createError = httpErrorsExports$2;
8560
8560
  const httpAssert$1 = httpAssert;
8561
8561
  const delegate = delegates;
@@ -10203,7 +10203,7 @@ var parseurl$1 = {exports: {}};
10203
10203
  * @private
10204
10204
  */
10205
10205
 
10206
- var url = require$$0$b;
10206
+ var url = require$$0$a;
10207
10207
  var parse$g = url.parse;
10208
10208
  var Url = url.Url;
10209
10209
 
@@ -10490,17 +10490,17 @@ function parseTokenList (str) {
10490
10490
  * Module dependencies.
10491
10491
  */
10492
10492
 
10493
- const URL = require$$0$b.URL;
10494
- const net = require$$0$d;
10493
+ const URL = require$$0$a.URL;
10494
+ const net = require$$0$c;
10495
10495
  const accepts$1 = accepts;
10496
10496
  const contentType$1 = contentType;
10497
- const stringify = require$$0$b.format;
10497
+ const stringify = require$$0$a.format;
10498
10498
  const parse = parseurlExports;
10499
10499
  const qs = require$$5$1;
10500
10500
  const typeis = typeIsExports;
10501
10501
  const fresh = fresh_1;
10502
10502
  const only = only$1;
10503
- const util = require$$1$2;
10503
+ const util = require$$1$3;
10504
10504
 
10505
10505
  const IP = Symbol('context#ip');
10506
10506
 
@@ -11561,15 +11561,15 @@ convert$1.back = function (mw) {
11561
11561
  const isGeneratorFunction = isGeneratorFunction$2;
11562
11562
  const debug$4 = srcExports('koa:application');
11563
11563
  const onFinished = onFinishedExports;
11564
- const assert = require$$0$c;
11564
+ const assert = require$$0$b;
11565
11565
  const response = responseExports;
11566
11566
  const compose$1 = koaCompose;
11567
11567
  const context = contextExports;
11568
11568
  const request = requestExports;
11569
11569
  const statuses$1 = statuses$2;
11570
- const Emitter = require$$0$8;
11571
- const util$2 = require$$1$2;
11572
- const Stream$2 = require$$0$a;
11570
+ const Emitter = require$$0$7;
11571
+ const util$2 = require$$1$3;
11572
+ const Stream$2 = require$$0$9;
11573
11573
  const http$1 = require$$3$1;
11574
11574
  const only = only$1;
11575
11575
  const convert = koaConvert;
@@ -12785,7 +12785,7 @@ function isNextNameSafe(token) {
12785
12785
  return !ID_CONTINUE.test(token.value[0]);
12786
12786
  }
12787
12787
 
12788
- const { parse: parseUrl, format: formatUrl } = require$$0$4;
12788
+ const { parse: parseUrl, format: formatUrl } = require$$1$2;
12789
12789
 
12790
12790
  const { pathToRegexp: pathToRegexp$1, compile, parse: parse$e } = dist$1;
12791
12791
 
@@ -14236,7 +14236,7 @@ var lib$7 = {exports: {}};
14236
14236
 
14237
14237
  /* eslint-disable node/no-deprecated-api */
14238
14238
 
14239
- var buffer$1 = require$$0$6;
14239
+ var buffer$1 = require$$0$5;
14240
14240
  var Buffer$1 = buffer$1.Buffer;
14241
14241
 
14242
14242
  var safer = {};
@@ -14417,7 +14417,7 @@ function requireInternal () {
14417
14417
  //------------------------------------------------------------------------------
14418
14418
 
14419
14419
  // We use node.js internal decoder. Its signature is the same as ours.
14420
- var StringDecoder = require$$1$4.StringDecoder;
14420
+ var StringDecoder = require$$1$5.StringDecoder;
14421
14421
 
14422
14422
  if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method.
14423
14423
  StringDecoder.prototype.end = function() {};
@@ -24818,8 +24818,8 @@ function requireStreams () {
24818
24818
  if (hasRequiredStreams) return streams;
24819
24819
  hasRequiredStreams = 1;
24820
24820
 
24821
- var Buffer = require$$0$6.Buffer,
24822
- Transform = require$$0$a.Transform;
24821
+ var Buffer = require$$0$5.Buffer,
24822
+ Transform = require$$0$9.Transform;
24823
24823
 
24824
24824
 
24825
24825
  // == Exports ==================================================================
@@ -24945,7 +24945,7 @@ var hasRequiredExtendNode;
24945
24945
  function requireExtendNode () {
24946
24946
  if (hasRequiredExtendNode) return extendNode;
24947
24947
  hasRequiredExtendNode = 1;
24948
- var Buffer = require$$0$6.Buffer;
24948
+ var Buffer = require$$0$5.Buffer;
24949
24949
  // Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer
24950
24950
 
24951
24951
  // == Extend Node primitives to use iconv-lite =================================
@@ -24978,7 +24978,7 @@ function requireExtendNode () {
24978
24978
  };
24979
24979
 
24980
24980
  // -- SlowBuffer -----------------------------------------------------------
24981
- var SlowBuffer = require$$0$6.SlowBuffer;
24981
+ var SlowBuffer = require$$0$5.SlowBuffer;
24982
24982
 
24983
24983
  original.SlowBufferToString = SlowBuffer.prototype.toString;
24984
24984
  SlowBuffer.prototype.toString = function(encoding, start, end) {
@@ -25118,7 +25118,7 @@ function requireExtendNode () {
25118
25118
 
25119
25119
  // -- Readable -------------------------------------------------------------
25120
25120
  if (iconv.supportsStreams) {
25121
- var Readable = require$$0$a.Readable;
25121
+ var Readable = require$$0$9.Readable;
25122
25122
 
25123
25123
  original.ReadableSetEncoding = Readable.prototype.setEncoding;
25124
25124
  Readable.prototype.setEncoding = function setEncoding(enc, options) {
@@ -25141,7 +25141,7 @@ function requireExtendNode () {
25141
25141
 
25142
25142
  delete Buffer.isNativeEncoding;
25143
25143
 
25144
- var SlowBuffer = require$$0$6.SlowBuffer;
25144
+ var SlowBuffer = require$$0$5.SlowBuffer;
25145
25145
 
25146
25146
  SlowBuffer.prototype.toString = original.SlowBufferToString;
25147
25147
  SlowBuffer.prototype.write = original.SlowBufferWrite;
@@ -25152,7 +25152,7 @@ function requireExtendNode () {
25152
25152
  Buffer.prototype.write = original.BufferWrite;
25153
25153
 
25154
25154
  if (iconv.supportsStreams) {
25155
- var Readable = require$$0$a.Readable;
25155
+ var Readable = require$$0$9.Readable;
25156
25156
 
25157
25157
  Readable.prototype.setEncoding = original.ReadableSetEncoding;
25158
25158
  delete Readable.prototype.collect;
@@ -26652,7 +26652,7 @@ var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
26652
26652
  return intrinsic;
26653
26653
  };
26654
26654
 
26655
- var util_inspect = require$$1$2.inspect;
26655
+ var util_inspect = require$$1$3.inspect;
26656
26656
 
26657
26657
  var hasMap = typeof Map === 'function' && Map.prototype;
26658
26658
  var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
@@ -31172,7 +31172,7 @@ var hasRequiredStream$1;
31172
31172
  function requireStream$1 () {
31173
31173
  if (hasRequiredStream$1) return stream$3;
31174
31174
  hasRequiredStream$1 = 1;
31175
- stream$3 = require$$0$a;
31175
+ stream$3 = require$$0$9;
31176
31176
  return stream$3;
31177
31177
  }
31178
31178
 
@@ -31186,7 +31186,7 @@ function requireSafeBuffer$1 () {
31186
31186
  if (hasRequiredSafeBuffer$1) return safeBuffer$1.exports;
31187
31187
  hasRequiredSafeBuffer$1 = 1;
31188
31188
  (function (module, exports) {
31189
- var buffer = require$$0$6;
31189
+ var buffer = require$$0$5;
31190
31190
  var Buffer = buffer.Buffer;
31191
31191
 
31192
31192
  // alternative to using Object.keys for old browsers
@@ -31360,7 +31360,7 @@ function requireUtil () {
31360
31360
  }
31361
31361
  util$1.isPrimitive = isPrimitive;
31362
31362
 
31363
- util$1.isBuffer = require$$0$6.Buffer.isBuffer;
31363
+ util$1.isBuffer = require$$0$5.Buffer.isBuffer;
31364
31364
 
31365
31365
  function objectToString(o) {
31366
31366
  return Object.prototype.toString.call(o);
@@ -31380,7 +31380,7 @@ function requireBufferList () {
31380
31380
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31381
31381
 
31382
31382
  var Buffer = requireSafeBuffer$1().Buffer;
31383
- var util = require$$1$2;
31383
+ var util = require$$1$3;
31384
31384
 
31385
31385
  function copyBuffer(src, target, offset) {
31386
31386
  src.copy(target, offset);
@@ -31559,7 +31559,7 @@ function requireNode () {
31559
31559
  * For Node.js, simply re-export the core `util.deprecate` function.
31560
31560
  */
31561
31561
 
31562
- node = require$$1$2.deprecate;
31562
+ node = require$$1$3.deprecate;
31563
31563
  return node;
31564
31564
  }
31565
31565
 
@@ -32348,7 +32348,7 @@ function requireSafeBuffer () {
32348
32348
  if (hasRequiredSafeBuffer) return safeBuffer.exports;
32349
32349
  hasRequiredSafeBuffer = 1;
32350
32350
  (function (module, exports) {
32351
- var buffer = require$$0$6;
32351
+ var buffer = require$$0$5;
32352
32352
  var Buffer = buffer.Buffer;
32353
32353
 
32354
32354
  // alternative to using Object.keys for old browsers
@@ -32719,7 +32719,7 @@ function require_stream_readable$1 () {
32719
32719
  Readable.ReadableState = ReadableState;
32720
32720
 
32721
32721
  /*<replacement>*/
32722
- require$$0$8.EventEmitter;
32722
+ require$$0$7.EventEmitter;
32723
32723
 
32724
32724
  var EElistenerCount = function (emitter, type) {
32725
32725
  return emitter.listeners(type).length;
@@ -32749,7 +32749,7 @@ function require_stream_readable$1 () {
32749
32749
  /*</replacement>*/
32750
32750
 
32751
32751
  /*<replacement>*/
32752
- var debugUtil = require$$1$2;
32752
+ var debugUtil = require$$1$3;
32753
32753
  var debug = void 0;
32754
32754
  if (debugUtil && debugUtil.debuglog) {
32755
32755
  debug = debugUtil.debuglog('stream');
@@ -33895,7 +33895,7 @@ function requireReadable () {
33895
33895
  if (hasRequiredReadable) return readable$1.exports;
33896
33896
  hasRequiredReadable = 1;
33897
33897
  (function (module, exports) {
33898
- var Stream = require$$0$a;
33898
+ var Stream = require$$0$9;
33899
33899
  if (process.env.READABLE_STREAM === 'disable' && Stream) {
33900
33900
  module.exports = Stream;
33901
33901
  exports = module.exports = Stream.Readable;
@@ -46271,7 +46271,7 @@ function matchNeedle(self, data, pos, len) {
46271
46271
 
46272
46272
  var sbmh = SBMH;
46273
46273
 
46274
- const { Readable: Readable$1, Writable: Writable$2 } = require$$0$a;
46274
+ const { Readable: Readable$1, Writable: Writable$2 } = require$$0$9;
46275
46275
 
46276
46276
  const StreamSearch = sbmh;
46277
46277
 
@@ -46921,7 +46921,7 @@ const FIELD_VCHAR = [
46921
46921
 
46922
46922
  var multipart = Multipart;
46923
46923
 
46924
- const { Writable: Writable$1 } = require$$0$a;
46924
+ const { Writable: Writable$1 } = require$$0$9;
46925
46925
 
46926
46926
  const { getDecoder } = utils$8;
46927
46927
 
@@ -47478,7 +47478,7 @@ function appendField$1 (store, key, value) {
47478
47478
 
47479
47479
  var appendField_1 = appendField$1;
47480
47480
 
47481
- var EventEmitter$1 = require$$0$8.EventEmitter;
47481
+ var EventEmitter$1 = require$$0$7.EventEmitter;
47482
47482
 
47483
47483
  function Counter$1 () {
47484
47484
  EventEmitter$1.call(this);
@@ -47507,7 +47507,7 @@ Counter$1.prototype.onceZero = function onceZero (fn) {
47507
47507
 
47508
47508
  var counter = Counter$1;
47509
47509
 
47510
- var util = require$$1$2;
47510
+ var util = require$$1$3;
47511
47511
 
47512
47512
  var errorMessages = {
47513
47513
  LIMIT_PART_COUNT: 'Too many parts',
@@ -47892,8 +47892,8 @@ function makeMiddleware$1 (setup) {
47892
47892
 
47893
47893
  var makeMiddleware_1 = makeMiddleware$1;
47894
47894
 
47895
- var path$6 = require$$0$7;
47896
- var fs$5 = require$$0$9;
47895
+ var path$6 = require$$0$6;
47896
+ var fs$5 = require$$0$8;
47897
47897
  var _0777 = parseInt('0777', 8);
47898
47898
 
47899
47899
  var mkdirp$1 = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
@@ -47995,10 +47995,10 @@ mkdirP.sync = function sync (p, opts, made) {
47995
47995
  return made;
47996
47996
  };
47997
47997
 
47998
- var fs$4 = require$$0$9;
47999
- var os = require$$1$5;
48000
- var path$5 = require$$0$7;
48001
- var crypto$1 = require$$1$3;
47998
+ var fs$4 = require$$0$8;
47999
+ var os = require$$1$6;
48000
+ var path$5 = require$$0$6;
48001
+ var crypto$1 = require$$1$4;
48002
48002
  var mkdirp = mkdirp$1;
48003
48003
 
48004
48004
  function getFilename (req, file, cb) {
@@ -50340,8 +50340,8 @@ class Ollama extends Ollama$1 {
50340
50340
  return Buffer.from(image).toString("base64");
50341
50341
  }
50342
50342
  try {
50343
- if (require$$0$9.existsSync(image)) {
50344
- const fileBuffer = await require$$0$9.promises.readFile(require$$0$7.resolve(image));
50343
+ if (require$$0$8.existsSync(image)) {
50344
+ const fileBuffer = await require$$0$8.promises.readFile(require$$0$6.resolve(image));
50345
50345
  return Buffer.from(fileBuffer).toString("base64");
50346
50346
  }
50347
50347
  } catch {
@@ -50380,9 +50380,9 @@ class Ollama extends Ollama$1 {
50380
50380
  */
50381
50381
  resolvePath(inputPath, mfDir) {
50382
50382
  if (inputPath.startsWith("~")) {
50383
- return require$$0$7.join(require$$1$5.homedir(), inputPath.slice(1));
50383
+ return require$$0$6.join(require$$1$6.homedir(), inputPath.slice(1));
50384
50384
  }
50385
- return require$$0$7.resolve(mfDir, inputPath);
50385
+ return require$$0$6.resolve(mfDir, inputPath);
50386
50386
  }
50387
50387
  /**
50388
50388
  * checks if a file exists
@@ -50392,7 +50392,7 @@ class Ollama extends Ollama$1 {
50392
50392
  */
50393
50393
  async fileExists(path) {
50394
50394
  try {
50395
- await require$$0$9.promises.access(path);
50395
+ await require$$0$8.promises.access(path);
50396
50396
  return true;
50397
50397
  } catch {
50398
50398
  return false;
@@ -50402,9 +50402,9 @@ class Ollama extends Ollama$1 {
50402
50402
  if (typeof ReadableStream === "undefined") {
50403
50403
  throw new Error("Streaming uploads are not supported in this environment.");
50404
50404
  }
50405
- const fileStream = require$$0$9.createReadStream(path);
50405
+ const fileStream = require$$0$8.createReadStream(path);
50406
50406
  const sha256sum = await new Promise((resolve2, reject) => {
50407
- const hash = require$$1$3.createHash("sha256");
50407
+ const hash = require$$1$4.createHash("sha256");
50408
50408
  fileStream.on("data", (data) => hash.update(data));
50409
50409
  fileStream.on("end", () => resolve2(hash.digest("hex")));
50410
50410
  fileStream.on("error", reject);
@@ -50441,10 +50441,10 @@ class Ollama extends Ollama$1 {
50441
50441
  async create(request) {
50442
50442
  let modelfileContent = "";
50443
50443
  if (request.path) {
50444
- modelfileContent = await require$$0$9.promises.readFile(request.path, { encoding: "utf8" });
50444
+ modelfileContent = await require$$0$8.promises.readFile(request.path, { encoding: "utf8" });
50445
50445
  modelfileContent = await this.parseModelfile(
50446
50446
  modelfileContent,
50447
- require$$0$7.dirname(request.path)
50447
+ require$$0$6.dirname(request.path)
50448
50448
  );
50449
50449
  } else if (request.modelfile) {
50450
50450
  modelfileContent = await this.parseModelfile(request.modelfile);
@@ -50573,7 +50573,7 @@ var hasRequiredStream;
50573
50573
  function requireStream () {
50574
50574
  if (hasRequiredStream) return stream$1;
50575
50575
  hasRequiredStream = 1;
50576
- stream$1 = require$$0$a;
50576
+ stream$1 = require$$0$9;
50577
50577
  return stream$1;
50578
50578
  }
50579
50579
 
@@ -50592,9 +50592,9 @@ function requireBuffer_list () {
50592
50592
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
50593
50593
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
50594
50594
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
50595
- var _require = require$$0$6,
50595
+ var _require = require$$0$5,
50596
50596
  Buffer = _require.Buffer;
50597
- var _require2 = require$$1$2,
50597
+ var _require2 = require$$1$3,
50598
50598
  inspect = _require2.inspect;
50599
50599
  var custom = inspect && inspect.custom || 'inspect';
50600
50600
  function copyBuffer(src, target, offset) {
@@ -51064,7 +51064,7 @@ function require_stream_writable () {
51064
51064
  var Stream = requireStream();
51065
51065
  /*</replacement>*/
51066
51066
 
51067
- var Buffer = require$$0$6.Buffer;
51067
+ var Buffer = require$$0$5.Buffer;
51068
51068
  var OurUint8Array = (typeof index.commonjsGlobal !== 'undefined' ? index.commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
51069
51069
  function _uint8ArrayToBuffer(chunk) {
51070
51070
  return Buffer.from(chunk);
@@ -52389,7 +52389,7 @@ function require_stream_readable () {
52389
52389
  Readable.ReadableState = ReadableState;
52390
52390
 
52391
52391
  /*<replacement>*/
52392
- require$$0$8.EventEmitter;
52392
+ require$$0$7.EventEmitter;
52393
52393
  var EElistenerCount = function EElistenerCount(emitter, type) {
52394
52394
  return emitter.listeners(type).length;
52395
52395
  };
@@ -52399,7 +52399,7 @@ function require_stream_readable () {
52399
52399
  var Stream = requireStream();
52400
52400
  /*</replacement>*/
52401
52401
 
52402
- var Buffer = require$$0$6.Buffer;
52402
+ var Buffer = require$$0$5.Buffer;
52403
52403
  var OurUint8Array = (typeof index.commonjsGlobal !== 'undefined' ? index.commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
52404
52404
  function _uint8ArrayToBuffer(chunk) {
52405
52405
  return Buffer.from(chunk);
@@ -52409,7 +52409,7 @@ function require_stream_readable () {
52409
52409
  }
52410
52410
 
52411
52411
  /*<replacement>*/
52412
- var debugUtil = require$$1$2;
52412
+ var debugUtil = require$$1$3;
52413
52413
  var debug;
52414
52414
  if (debugUtil && debugUtil.debuglog) {
52415
52415
  debug = debugUtil.debuglog('stream');
@@ -53634,7 +53634,7 @@ function requirePipeline () {
53634
53634
  }
53635
53635
 
53636
53636
  (function (module, exports) {
53637
- var Stream = require$$0$a;
53637
+ var Stream = require$$0$9;
53638
53638
  if (process.env.READABLE_STREAM === 'disable' && Stream) {
53639
53639
  module.exports = Stream.Readable;
53640
53640
  Object.assign(module.exports, Stream);
@@ -57038,7 +57038,7 @@ router$c.post("/get_cookie", async (ctx) => {
57038
57038
  return;
57039
57039
  }
57040
57040
  const secret = "r96gkr8ahc34fsrewr34";
57041
- const hash = require$$1$3.createHmac("sha256", secret).update(`${uid}${timestamp}`).digest("hex");
57041
+ const hash = require$$1$4.createHmac("sha256", secret).update(`${uid}${timestamp}`).digest("hex");
57042
57042
  if (hash !== signature) {
57043
57043
  ctx.status = 400;
57044
57044
  ctx.body = "签名无效";
@@ -57144,7 +57144,7 @@ var chokidar = {};
57144
57144
 
57145
57145
  var utils$7 = {};
57146
57146
 
57147
- const path$4 = require$$0$7;
57147
+ const path$4 = require$$0$6;
57148
57148
  const WIN_SLASH$1 = '\\\\/';
57149
57149
  const WIN_NO_SLASH$1 = `[^${WIN_SLASH$1}]`;
57150
57150
 
@@ -57324,7 +57324,7 @@ var constants$6 = {
57324
57324
 
57325
57325
  (function (exports) {
57326
57326
 
57327
- const path = require$$0$7;
57327
+ const path = require$$0$6;
57328
57328
  const win32 = process.platform === 'win32';
57329
57329
  const {
57330
57330
  REGEX_BACKSLASH,
@@ -58868,7 +58868,7 @@ parse$3.fastpaths = (input, options) => {
58868
58868
 
58869
58869
  var parse_1$1 = parse$3;
58870
58870
 
58871
- const path$3 = require$$0$7;
58871
+ const path$3 = require$$0$6;
58872
58872
  const scan$2 = scan_1$1;
58873
58873
  const parse$2 = parse_1$1;
58874
58874
  const utils$4 = utils$7;
@@ -59211,10 +59211,10 @@ var picomatch_1$1 = picomatch$5;
59211
59211
 
59212
59212
  var picomatch$4 = picomatch_1$1;
59213
59213
 
59214
- const fs$3 = require$$0$9;
59215
- const { Readable } = require$$0$a;
59216
- const sysPath$3 = require$$0$7;
59217
- const { promisify: promisify$3 } = require$$1$2;
59214
+ const fs$3 = require$$0$8;
59215
+ const { Readable } = require$$0$9;
59216
+ const sysPath$3 = require$$0$6;
59217
+ const { promisify: promisify$3 } = require$$1$3;
59218
59218
  const picomatch$3 = picomatch$4;
59219
59219
 
59220
59220
  const readdir$1 = promisify$3(fs$3.readdir);
@@ -59501,7 +59501,7 @@ var anymatch$2 = {exports: {}};
59501
59501
 
59502
59502
  var utils$3 = {};
59503
59503
 
59504
- const path$2 = require$$0$7;
59504
+ const path$2 = require$$0$6;
59505
59505
  const WIN_SLASH = '\\\\/';
59506
59506
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
59507
59507
 
@@ -59681,7 +59681,7 @@ var constants$3 = {
59681
59681
 
59682
59682
  (function (exports) {
59683
59683
 
59684
- const path = require$$0$7;
59684
+ const path = require$$0$6;
59685
59685
  const win32 = process.platform === 'win32';
59686
59686
  const {
59687
59687
  REGEX_BACKSLASH,
@@ -61225,7 +61225,7 @@ parse$1.fastpaths = (input, options) => {
61225
61225
 
61226
61226
  var parse_1 = parse$1;
61227
61227
 
61228
- const path$1 = require$$0$7;
61228
+ const path$1 = require$$0$6;
61229
61229
  const scan = scan_1;
61230
61230
  const parse = parse_1;
61231
61231
  const utils = utils$3;
@@ -61977,7 +61977,7 @@ var require$$0 = [
61977
61977
 
61978
61978
  var binaryExtensions$1 = require$$0;
61979
61979
 
61980
- const path = require$$0$7;
61980
+ const path = require$$0$6;
61981
61981
  const binaryExtensions = binaryExtensions$1;
61982
61982
 
61983
61983
  const extensions = new Set(binaryExtensions);
@@ -61988,9 +61988,9 @@ var constants = {};
61988
61988
 
61989
61989
  (function (exports) {
61990
61990
 
61991
- const {sep} = require$$0$7;
61991
+ const {sep} = require$$0$6;
61992
61992
  const {platform} = process;
61993
- const os = require$$1$5;
61993
+ const os = require$$1$6;
61994
61994
 
61995
61995
  exports.EV_ALL = 'all';
61996
61996
  exports.EV_READY = 'ready';
@@ -62054,9 +62054,9 @@ var constants = {};
62054
62054
  exports.isIBMi = os.type() === 'OS400';
62055
62055
  } (constants));
62056
62056
 
62057
- const fs$2 = require$$0$9;
62058
- const sysPath$2 = require$$0$7;
62059
- const { promisify: promisify$2 } = require$$1$2;
62057
+ const fs$2 = require$$0$8;
62058
+ const sysPath$2 = require$$0$6;
62059
+ const { promisify: promisify$2 } = require$$1$3;
62060
62060
  const isBinaryPath = isBinaryPath$1;
62061
62061
  const {
62062
62062
  isWindows: isWindows$1,
@@ -62705,9 +62705,9 @@ var nodefsHandler = NodeFsHandler$1;
62705
62705
 
62706
62706
  var fseventsHandler = {exports: {}};
62707
62707
 
62708
- const fs$1 = require$$0$9;
62709
- const sysPath$1 = require$$0$7;
62710
- const { promisify: promisify$1 } = require$$1$2;
62708
+ const fs$1 = require$$0$8;
62709
+ const sysPath$1 = require$$0$6;
62710
+ const { promisify: promisify$1 } = require$$1$3;
62711
62711
 
62712
62712
  let fsevents;
62713
62713
  try {
@@ -63232,10 +63232,10 @@ fseventsHandler.exports.canUse = canUse;
63232
63232
 
63233
63233
  var fseventsHandlerExports = fseventsHandler.exports;
63234
63234
 
63235
- const { EventEmitter } = require$$0$8;
63236
- const fs = require$$0$9;
63237
- const sysPath = require$$0$7;
63238
- const { promisify } = require$$1$2;
63235
+ const { EventEmitter } = require$$0$7;
63236
+ const fs = require$$0$8;
63237
+ const sysPath = require$$0$6;
63238
+ const { promisify } = require$$1$3;
63239
63239
  const readdirp = readdirp_1;
63240
63240
  const anymatch = anymatchExports.default;
63241
63241
  const globParent = index.globParent;
@@ -64204,7 +64204,7 @@ const watch = (paths, options) => {
64204
64204
 
64205
64205
  chokidar.watch = watch;
64206
64206
 
64207
- const stream = require$$0$a;
64207
+ const stream = require$$0$9;
64208
64208
  const Transform = stream.Transform;
64209
64209
 
64210
64210
 
@@ -64324,7 +64324,7 @@ SSETransform.defOpts = {
64324
64324
  var sse$1 = SSETransform;
64325
64325
 
64326
64326
  const SSE = sse$1;
64327
- const Stream$1 = require$$0$a;
64327
+ const Stream$1 = require$$0$9;
64328
64328
  const DEFAULT_OPTS = {
64329
64329
  maxClients: 10000,
64330
64330
  pingInterval: 60000,
@@ -64780,10 +64780,10 @@ class FFmpegWhisperASR {
64780
64780
  throw new Error(`音频文件不存在: ${filePath}`);
64781
64781
  }
64782
64782
  // 创建临时目录存放结果
64783
- const tempDir = require$$0$7.join(require$$1$5.tmpdir(), "whisper-asr");
64783
+ const tempDir = require$$0$6.join(require$$1$6.tmpdir(), "whisper-asr");
64784
64784
  await index.fs.ensureDir(tempDir);
64785
64785
  // 生成唯一的输出文件名
64786
- const outputFile = require$$0$7.join(tempDir, `${v4()}.json`);
64786
+ const outputFile = require$$0$6.join(tempDir, `${v4()}.json`);
64787
64787
  try {
64788
64788
  // 执行 ffmpeg 命令
64789
64789
  await this.executeFFmpeg(filePath, outputFile);
@@ -64842,7 +64842,7 @@ class FFmpegWhisperASR {
64842
64842
  ];
64843
64843
  this.options.logger.info(`执行 FFmpeg Whisper 命令: ${this.options.ffmpegPath} ${args.join(" ")}`);
64844
64844
  // 使用 spawn 执行命令
64845
- const process = require$$0$e.spawn(this.options.ffmpegPath, args);
64845
+ const process = require$$0$d.spawn(this.options.ffmpegPath, args);
64846
64846
  let stderr = "";
64847
64847
  // 收集标准错误输出(ffmpeg 的日志)
64848
64848
  process.stderr.on("data", (data) => {
@@ -71957,7 +71957,7 @@ class DecodedMessage {
71957
71957
  if (!uri.startsWith(DATA_URI_PREFIX)) {
71958
71958
  throw new Error('assert 4');
71959
71959
  }
71960
- return this.decodeFromBinary(require$$0$6.Buffer.from(uri.replace(DATA_URI_PREFIX, ''), 'base64'));
71960
+ return this.decodeFromBinary(require$$0$5.Buffer.from(uri.replace(DATA_URI_PREFIX, ''), 'base64'));
71961
71961
  }
71962
71962
  encodeToBinary() {
71963
71963
  const header = {
@@ -72008,7 +72008,7 @@ class DecodedMessage {
72008
72008
  }
72009
72009
  encodeToUri() {
72010
72010
  const bin = this.encodeToBinary();
72011
- return DATA_URI_PREFIX + require$$0$6.Buffer.from(bin).toString('base64');
72011
+ return DATA_URI_PREFIX + require$$0$5.Buffer.from(bin).toString('base64');
72012
72012
  }
72013
72013
  }
72014
72014
 
@@ -72848,7 +72848,7 @@ class Shazam {
72848
72848
  * @returns {ShazamRoot | null}
72849
72849
  */
72850
72850
  async recognise(path, language = "en-US", minimal = false) {
72851
- const signatures = shazamioCore.recognizeBytes(require$$0$9.readFileSync(path), 0, Number.MAX_SAFE_INTEGER);
72851
+ const signatures = shazamioCore.recognizeBytes(require$$0$8.readFileSync(path), 0, Number.MAX_SAFE_INTEGER);
72852
72852
  let response;
72853
72853
  for (let i = Math.floor(signatures.length / 2); i < signatures.length; i += 4) {
72854
72854
  const data = {
@@ -77686,10 +77686,10 @@ async function download$1(output, url, options) {
77686
77686
  const downloader = new index.M3U8Downloader(url, output, {
77687
77687
  convert2Mp4: true,
77688
77688
  ffmpegPath: ffmpegPath,
77689
- segmentsDir: require$$0$7.join(index.getTempPath(), index.uuid()),
77689
+ segmentsDir: require$$0$6.join(index.getTempPath(), index.uuid()),
77690
77690
  });
77691
77691
  const task = new index.KuaishouDownloadVideoTask(downloader, {
77692
- name: `下载任务:${require$$0$7.parse(output).name}`,
77692
+ name: `下载任务:${require$$0$6.parse(output).name}`,
77693
77693
  });
77694
77694
  index.taskQueue.addTask(task, true);
77695
77695
  return task;
@@ -77720,7 +77720,7 @@ var kuaishou = {
77720
77720
  var dist = {};
77721
77721
 
77722
77722
  (function (exports) {
77723
- Object.defineProperty(exports,'__esModule',{value:!0}),exports.DownloaderHelper=exports.DH_STATES=void 0;var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a},_createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c);}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_fs=require$$0$9,fs=_interopRequireWildcard(_fs),_url=require$$0$b,_path=require$$0$7,path=_interopRequireWildcard(_path),_http=require$$3$1,http=_interopRequireWildcard(_http),_https=require$$1$6,https=_interopRequireWildcard(_https),_events=require$$0$8;function _interopRequireWildcard(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b.default=a,b}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b);}var DH_STATES=exports.DH_STATES={IDLE:'IDLE',SKIPPED:'SKIPPED',STARTED:'STARTED',DOWNLOADING:'DOWNLOADING',RETRY:'RETRY',PAUSED:'PAUSED',RESUMED:'RESUMED',STOPPED:'STOPPED',FINISHED:'FINISHED',FAILED:'FAILED'};exports.DownloaderHelper=function(a){function b(a,c){var d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,b);var e=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,{captureRejections:!0}));return e.__validate(a,c)?(e.url=e.requestURL=a.trim(),e.state=DH_STATES.IDLE,e.__defaultOpts={body:null,retry:!1,method:'GET',headers:{},fileName:'',timeout:-1,metadata:null,override:!1,forceResume:!1,removeOnStop:!0,removeOnFail:!0,progressThrottle:1e3,httpRequestOptions:{},httpsRequestOptions:{},resumeOnIncomplete:!0,resumeIfFileExists:!1,resumeOnIncompleteMaxRetry:5},e.__opts=Object.assign({},e.__defaultOpts),e.__pipes=[],e.__total=0,e.__downloaded=0,e.__progress=0,e.__retryCount=0,e.__retryTimeout=null,e.__resumeRetryCount=0,e.__states=DH_STATES,e.__promise=null,e.__request=null,e.__response=null,e.__isAborted=!1,e.__isResumed=!1,e.__isResumable=!1,e.__isRedirected=!1,e.__destFolder=c,e.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0},e.__fileName='',e.__filePath='',e.updateOptions(d),e):_possibleConstructorReturn(e)}return _inherits(b,a),_createClass(b,[{key:'start',value:function c(){var a=this,b=function(){return new Promise(function(b,c){a.__promise={resolve:b,reject:c},a.__start();})};return this.__opts.resumeIfFileExists&&this.state!==this.__states.RESUMED?this.getTotalSize().then(function(c){var d=c.name,e=c.total,f=a.__opts.override;if(a.__opts.override=!0,a.__filePath=a.__getFilePath(d),a.__opts.override=f,a.__filePath&&fs.existsSync(a.__filePath)){var g=a.__getFilesizeInBytes(a.__filePath);return g===e?b():a.resumeFromFile(a.__filePath,{total:e,fileName:d})}return b()}):b()}},{key:'pause',value:function b(){var a=this;return this.state===this.__states.STOPPED?Promise.resolve(!0):(this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(a){return a.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return a.__setState(a.__states.PAUSED),a.emit('pause'),!0}))}},{key:'resume',value:function a(){return this.__promise?this.state===this.__states.STOPPED?Promise.resolve(!1):(this.__setState(this.__states.RESUMED),this.__isResumable&&(this.__isResumed=!0,this.__reqOptions.headers.range='bytes='+this.__downloaded+'-'),this.emit('resume',this.__isResumed),this.__start()):this.start()}},{key:'stop',value:function c(){var a=this;if(this.state===this.__states.STOPPED)return Promise.resolve(!0);var b=function(){return new Promise(function(b,c){fs.access(a.__filePath,function(d){return d?(a.__emitStop(),b(!0)):void fs.unlink(a.__filePath,function(d){return d?(a.__setState(a.__states.FAILED),a.emit('error',d),c(d)):void(a.__emitStop(),b(!0))})});})};return this.__requestAbort(),this.__closeFileStream().then(function(){return a.__opts.removeOnStop?b():(a.__emitStop(),Promise.resolve(!0))})}},{key:'pipe',value:function c(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.__pipes.push({stream:a,options:b}),a}},{key:'unpipe',value:function d(){var a=this,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=function(b){return a.__response?a.__response.unpipe(b):b.unpipe()};if(b){var e=this.__pipes.find(function(a){return a.stream===b});return void(e&&(c(b),this.__pipes=this.__pipes.filter(function(a){return a.stream!==b})))}this.__pipes.forEach(function(a){return c(a.stream)}),this.__pipes=[];}},{key:'getDownloadPath',value:function a(){return this.__filePath}},{key:'isResumable',value:function a(){return this.__isResumable}},{key:'updateOptions',value:function c(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'';this.__opts=Object.assign({},this.__opts,a),this.__headers=this.__opts.headers,-1<this.__opts.timeout&&(this.__opts.httpRequestOptions.timeout=this.__opts.timeout,this.__opts.httpsRequestOptions.timeout=this.__opts.timeout),('number'!=typeof this.__opts.progressThrottle||0>this.__opts.progressThrottle)&&(this.__opts.progressThrottle=this.__defaultOpts.progressThrottle),this.url=b||this.url,this.__reqOptions=this.__getReqOptions(this.__opts.method,this.url,this.__opts.headers),this.__initProtocol(this.url);}},{key:'getOptions',value:function a(){return this.__opts}},{key:'getMetadata',value:function a(){return this.__opts.metadata}},{key:'getStats',value:function a(){return {total:this.__total,name:this.__fileName,downloaded:this.__downloaded,progress:this.__progress,speed:this.__statsEstimate.bytes}}},{key:'getTotalSize',value:function b(){var a=this;return new Promise(function(b,c){var d=function(b){a.__initProtocol(b);var c=Object.assign({},a.__headers);c.hasOwnProperty('range')&&delete c.range;var d=a.__getReqOptions('HEAD',b,c);return Object.assign({},a.__reqOptions,d)},e=0,f=null,g=function(b,c){if(!a.__opts.retry||'object'!==_typeof(a.__opts.retry))return Promise.reject(b||new Error('wrong retry options'));f&&(clearTimeout(f),f=null);var g=a.__opts.retry,i=g.delay,j=void 0===i?0:i,k=g.maxRetries,l=void 0===k?999:k;return e>=l?Promise.reject(b||new Error('reached the maximum retries')):(e++,a.__setState(a.__states.RETRY),a.emit('retry',e,a.__opts.retry,b),new Promise(function(b){f=setTimeout(function(){a.__setState(a.__states.IDLE),h(c,d(c)),b();},j);}))},h=function(e,i){f&&(clearTimeout(f),f=null);var j=a.__protocol.request(i,function(f){if(a.__isRequireRedirect(f)){var i=/^https?:\/\//.test(f.headers.location)?f.headers.location:new _url.URL(f.headers.location,e).href;return a.emit('redirected',i,e),h(i,d(i))}if(200>f.statusCode||400<=f.statusCode){var j=new Error('Response status was '+f.statusCode);return a.__opts.retry&&500<=f.statusCode&&600>f.statusCode?g(j,e).catch(c):c(j)}b({name:a.__getFileNameFromHeaders(f.headers,f),total:parseInt(f.headers['content-length'])||null});});j.on('error',function(b){return a.__opts.retry?g(b,e).catch(c):void c(b)}),j.on('timeout',function(){return a.__opts.retry?g(new Error('timeout'),e).catch(c):void c(new Error('timeout'))}),j.on('uncaughtException',function(b){return a.__opts.retry?g(b,e).catch(c):void c(b)}),j.end();};h(a.url,d(a.url));})}},{key:'getResumeState',value:function a(){return {downloaded:this.__downloaded,filePath:this.__filePath,fileName:this.__fileName,total:this.__total}}},{key:'resumeFromFile',value:function d(a){var b=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return this.__opts.override=!0,this.__filePath=a,(c.total&&c.fileName?Promise.resolve({name:c.fileName,total:c.total}):this.getTotalSize()).then(function(a){var d=a.name,e=a.total;return b.__total=c.total||e,b.__fileName=c.fileName||d,b.__downloaded=c.downloaded||b.__getFilesizeInBytes(b.__filePath),b.__reqOptions.headers.range='bytes='+b.__downloaded+'-',b.__isResumed=!0,b.__isResumable=!0,b.__setState(b.__states.RESUMED),b.emit('resume',b.__isResumed),new Promise(function(a,c){b.__promise={resolve:a,reject:c},b.__start();})})}},{key:'__start',value:function a(){this.__isRedirected||this.state===this.__states.RESUMED||(this.emit('start'),this.__setState(this.__states.STARTED),this.__initProtocol(this.url)),this.__response=null,this.__isAborted=!1,this.__request&&!this.__request.destroyed&&this.__request.destroy(),this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__request=this.__downloadRequest(this.__promise.resolve,this.__promise.reject),this.__request.on('error',this.__onError(this.__promise.resolve,this.__promise.reject)),this.__request.on('timeout',this.__onTimeout(this.__promise.resolve,this.__promise.reject)),this.__request.on('uncaughtException',this.__onError(this.__promise.resolve,this.__promise.reject,!0)),this.__opts.body&&this.__request.write(this.__opts.body),this.__request.end();}},{key:'__resolvePending',value:function b(){if(this.__promise){var a=this.__promise.resolve;return this.__promise=null,a(!0)}}},{key:'__downloadRequest',value:function d(a,b){var c=this;return this.__protocol.request(this.__reqOptions,function(d){if(c.__response=d,c.__isResumed||(c.__total=parseInt(d.headers['content-length'])||null,c.__resetStats()),c.__isRequireRedirect(d)){var e=/^https?:\/\//.test(d.headers.location)?d.headers.location:new _url.URL(d.headers.location,c.url).href;return c.__isRedirected=!0,c.__initProtocol(e),c.emit('redirected',e,c.url),c.__start()}if(200>d.statusCode||400<=d.statusCode){var f=new Error('Response status was '+d.statusCode);return (f.status=d.statusCode||0,f.body=d.body||'',500<=d.statusCode&&600>d.statusCode)?c.__onError(a,b)(f):(c.__setState(c.__states.FAILED),c.emit('error',f),b(f))}c.__opts.forceResume?c.__isResumable=!0:d.headers.hasOwnProperty('accept-ranges')&&'none'!==d.headers['accept-ranges']&&(c.__isResumable=!0),c.__startDownload(d,a,b);})}},{key:'__startDownload',value:function h(a,b,c){var d=this,e=a;if(!this.__isResumed){var i=this.__getFileNameFromHeaders(a.headers);if(this.__filePath=this.__getFilePath(i),this.__fileName=this.__filePath.split(path.sep).pop(),fs.existsSync(this.__filePath)){var f=this.__getFilesizeInBytes(this.__filePath),g=this.__total?this.__total:0;if('object'===_typeof(this.__opts.override)&&this.__opts.override.skip&&(this.__opts.override.skipSmaller||f>=g))return this.emit('skip',{totalSize:this.__total,fileName:this.__fileName,filePath:this.__filePath,downloadedSize:f}),this.__setState(this.__states.SKIPPED),b(!0)}this.__fileStream=fs.createWriteStream(this.__filePath,{});}else this.__fileStream=fs.createWriteStream(this.__filePath,{flags:'a'});this.emit('download',{fileName:this.__fileName,filePath:this.__filePath,totalSize:this.__total,isResumed:this.__isResumed,downloadedSize:this.__downloaded}),this.__retryCount=0,this.__isResumed=!1,this.__isRedirected=!1,this.__setState(this.__states.DOWNLOADING),this.__statsEstimate.time=new Date,this.__statsEstimate.throttleTime=new Date,e.on('data',function(a){return d.__calculateStats(a.length)}),this.__pipes.forEach(function(a){e.pipe(a.stream,a.options),e=a.stream;}),e.pipe(this.__fileStream),e.on('error',this.__onError(b,c)),this.__fileStream.on('finish',this.__onFinished(b,c)),this.__fileStream.on('error',this.__onError(b,c));}},{key:'__hasFinished',value:function a(){return !this.__isAborted&&-1===[this.__states.PAUSED,this.__states.STOPPED,this.__states.RETRY,this.__states.FAILED,this.__states.RESUMED].indexOf(this.state)}},{key:'__isRequireRedirect',value:function b(a){return 300<a.statusCode&&400>a.statusCode&&a.headers.hasOwnProperty('location')&&a.headers.location}},{key:'__onFinished',value:function d(a,b){var c=this;return function(){c.__fileStream.close(function(d){if(d)return b(d);if(c.__hasFinished()){var e=!!c.__total&&c.__downloaded!==c.__total;if(e&&c.__isResumable&&c.__opts.resumeOnIncomplete&&c.__resumeRetryCount<=c.__opts.resumeOnIncompleteMaxRetry)return c.__resumeRetryCount++,c.emit('warning',new Error('uncomplete download, retrying')),c.resume();c.__setState(c.__states.FINISHED),c.__pipes=[],c.emit('end',{fileName:c.__fileName,filePath:c.__filePath,totalSize:c.__total,incomplete:e,onDiskSize:c.__getFilesizeInBytes(c.__filePath),downloadedSize:c.__downloaded});}return a(c.__downloaded===c.__total)});}}},{key:'__closeFileStream',value:function b(){var a=this;return this.__fileStream?new Promise(function(b,c){a.__fileStream.close(function(a){return a?c(a):b(!0)});}):Promise.resolve(!0)}},{key:'__onError',value:function e(a,b){var c=this,d=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];return function(a){return c.__pipes=[],d&&c.__requestAbort(),c.state===c.__states.STOPPED||c.state===c.__states.FAILED?void 0:c.__opts.retry?c.__retry(a).catch(function(d){c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('error',d?d:a),b(d?d:a);});}):c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('error',a),b(a);})}}},{key:'__retry',value:function h(){var a=this,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;if(!this.__opts.retry||'object'!==_typeof(this.__opts.retry))return Promise.reject(b||new Error('wrong retry options'));var c=this.__opts.retry,d=c.delay,e=void 0===d?0:d,f=c.maxRetries,g=void 0===f?999:f;return this.__retryCount>=g?Promise.reject(b||new Error('reached the maximum retries')):(this.__retryCount++,this.__setState(this.__states.RETRY),this.emit('retry',this.__retryCount,this.__opts.retry,b),this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(a){return a.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return new Promise(function(b){return a.__retryTimeout=setTimeout(function(){return b(0<a.__downloaded?a.resume():a.__start())},e)})}))}},{key:'__onTimeout',value:function d(a,b){var c=this;return function(){return c.__requestAbort(),c.__opts.retry?c.__retry(new Error('timeout')).catch(function(a){c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),a?b(a):(c.emit('timeout'),b(new Error('timeout')));});}):c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('timeout'),b(new Error('timeout'));})}}},{key:'__resetStats',value:function a(){this.__retryCount=0,this.__downloaded=0,this.__progress=0,this.__resumeRetryCount=0,this.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0};}},{key:'__getFileNameFromHeaders',value:function k(a,b){var c='',d=/.*filename\*=.*?'.*?'([^"].+?[^"])(?:(?:;)|$)/i,e=/.*filename="(.*?)";?/i,f=/.*filename=([^"].+?[^"])(?:(?:;)|$)/i,g=a.hasOwnProperty('content-disposition'),h=g?a['content-disposition'].match(d):null,i=!g||h?null:a['content-disposition'].match(e),j=!g||h||i?null:a['content-disposition'].match(f);return g&&(h||i||j)?(c=a['content-disposition'],c=c.trim(),h?c=h[1]:i?c=i[1]:j&&(c=j[1]),c=c.replace(/[/\\]/g,'')):0<path.basename(new _url.URL(this.requestURL).pathname).length?c=path.basename(new _url.URL(this.requestURL).pathname):c=new _url.URL(this.requestURL).hostname+'.html',this.__opts.fileName?this.__getFileNameFromOpts(c,b):c.replace(/\.*$/,'')}},{key:'__getFilePath',value:function d(a){var b=path.join(this.__destFolder,a),c=b;return this.__opts.override||this.state===this.__states.RESUMED||(c=this.__uniqFileNameSync(c),b!==c&&this.emit('renamed',{path:c,fileName:c.split(path.sep).pop(),prevPath:b,prevFileName:b.split(path.sep).pop()})),c}},{key:'__getFileNameFromOpts',value:function g(a,b){if(!this.__opts.fileName)return a;if('string'==typeof this.__opts.fileName)return this.__opts.fileName;if('function'==typeof this.__opts.fileName){var h=path.join(this.__destFolder,a);return b&&b.headers||this.__response&&this.__response.headers?this.__opts.fileName(a,h,(b?b:this.__response).headers['content-type']):this.__opts.fileName(a,h)}if('object'===_typeof(this.__opts.fileName)){var c=this.__opts.fileName,d=c.name,e=!!c.hasOwnProperty('ext')&&c.ext;if('string'==typeof e)return d+'.'+e;if('boolean'==typeof e){if(e)return d;var f=a.includes('.')?a.split('.').pop():'';return ''===f?d:d+'.'+f}}return a}},{key:'__calculateStats',value:function f(a){var b=new Date,c=b-this.__statsEstimate.time,d=b-this.__statsEstimate.throttleTime,e=this.__total||0;a&&(this.__downloaded+=a,this.__progress=0===e?0:100*(this.__downloaded/e),(this.__downloaded===e||1e3<c)&&(this.__statsEstimate.time=b,this.__statsEstimate.bytes=this.__downloaded-this.__statsEstimate.prevBytes,this.__statsEstimate.prevBytes=this.__downloaded),(this.__downloaded===e||d>this.__opts.progressThrottle)&&(this.__statsEstimate.throttleTime=b,this.emit('progress.throttled',this.getStats())),this.emit('progress',this.getStats()));}},{key:'__setState',value:function b(a){this.state=a,this.emit('stateChanged',this.state);}},{key:'__getReqOptions',value:function f(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},d=new _url.URL(b),e={protocol:d.protocol,host:d.hostname,port:d.port,path:d.pathname+d.search,method:a};return c&&(e.headers=c),e}},{key:'__getFilesizeInBytes',value:function d(a){try{var b=fs.statSync(a,{throwIfNoEntry:!1}),c=b.size||0;return c}catch(a){this.emit('warning',a);}return 0}},{key:'__validate',value:function d(a,b){if('string'!=typeof a)throw new Error('URL should be an string');if(''===a.trim())throw new Error('URL couldn\'t be empty');if('string'!=typeof b)throw new Error('Destination Folder should be an string');if(''===b.trim())throw new Error('Destination Folder couldn\'t be empty');if(!fs.existsSync(b))throw new Error('Destination Folder must exist');var c=fs.statSync(b);if(!c.isDirectory())throw new Error('Destination Folder must be a directory');try{fs.accessSync(b,fs.constants.W_OK);}catch(a){throw new Error('Destination Folder must be writable')}return !0}},{key:'__initProtocol',value:function c(a){var b=this.__getReqOptions(this.__opts.method,a,this.__headers);this.requestURL=a,-1<a.indexOf('https://')?(this.__protocol=https,b.agent=new https.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},b,this.__opts.httpsRequestOptions)):(this.__protocol=http,b.agent=new http.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},b,this.__opts.httpRequestOptions));}},{key:'__uniqFileNameSync',value:function f(a){if('string'!=typeof a||''===a)return a;try{fs.accessSync(a,fs.F_OK);var b=a.match(/(.*)(\([0-9]+\))(\..*)$/),c=b?b[1].trim():a,d=b?parseInt(b[2].replace(/\(|\)/,'')):0,e=a.split('.').pop();return e!==a&&0<e.length?(e='.'+e,c=c.replace(e,'')):e='',this.__uniqFileNameSync(c+' ('+ ++d+')'+e)}catch(b){return a}}},{key:'__removeFile',value:function b(){var a=this;return new Promise(function(b){return a.__fileStream?void a.__fileStream.close(function(c){return c&&a.emit('warning',c),a.__opts.removeOnFail?fs.access(a.__filePath,function(d){return d?b():void fs.unlink(a.__filePath,function(d){d&&a.emit('warning',c),b();})}):void b()}):b()})}},{key:'__requestAbort',value:function a(){this.__isAborted=!0,this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__response&&this.__response.destroy(),this.__request&&(this.__request.destroy?this.__request.destroy():this.__request.abort());}},{key:'__emitStop',value:function a(){this.__resolvePending(),this.__setState(this.__states.STOPPED),this.emit('stop');}}]),b}(_events.EventEmitter);
77723
+ Object.defineProperty(exports,'__esModule',{value:!0}),exports.DownloaderHelper=exports.DH_STATES=void 0;var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a},_createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c);}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_fs=require$$0$8,fs=_interopRequireWildcard(_fs),_url=require$$0$a,_path=require$$0$6,path=_interopRequireWildcard(_path),_http=require$$3$1,http=_interopRequireWildcard(_http),_https=require$$1$7,https=_interopRequireWildcard(_https),_events=require$$0$7;function _interopRequireWildcard(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b.default=a,b}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b);}var DH_STATES=exports.DH_STATES={IDLE:'IDLE',SKIPPED:'SKIPPED',STARTED:'STARTED',DOWNLOADING:'DOWNLOADING',RETRY:'RETRY',PAUSED:'PAUSED',RESUMED:'RESUMED',STOPPED:'STOPPED',FINISHED:'FINISHED',FAILED:'FAILED'};exports.DownloaderHelper=function(a){function b(a,c){var d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,b);var e=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,{captureRejections:!0}));return e.__validate(a,c)?(e.url=e.requestURL=a.trim(),e.state=DH_STATES.IDLE,e.__defaultOpts={body:null,retry:!1,method:'GET',headers:{},fileName:'',timeout:-1,metadata:null,override:!1,forceResume:!1,removeOnStop:!0,removeOnFail:!0,progressThrottle:1e3,httpRequestOptions:{},httpsRequestOptions:{},resumeOnIncomplete:!0,resumeIfFileExists:!1,resumeOnIncompleteMaxRetry:5},e.__opts=Object.assign({},e.__defaultOpts),e.__pipes=[],e.__total=0,e.__downloaded=0,e.__progress=0,e.__retryCount=0,e.__retryTimeout=null,e.__resumeRetryCount=0,e.__states=DH_STATES,e.__promise=null,e.__request=null,e.__response=null,e.__isAborted=!1,e.__isResumed=!1,e.__isResumable=!1,e.__isRedirected=!1,e.__destFolder=c,e.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0},e.__fileName='',e.__filePath='',e.updateOptions(d),e):_possibleConstructorReturn(e)}return _inherits(b,a),_createClass(b,[{key:'start',value:function c(){var a=this,b=function(){return new Promise(function(b,c){a.__promise={resolve:b,reject:c},a.__start();})};return this.__opts.resumeIfFileExists&&this.state!==this.__states.RESUMED?this.getTotalSize().then(function(c){var d=c.name,e=c.total,f=a.__opts.override;if(a.__opts.override=!0,a.__filePath=a.__getFilePath(d),a.__opts.override=f,a.__filePath&&fs.existsSync(a.__filePath)){var g=a.__getFilesizeInBytes(a.__filePath);return g===e?b():a.resumeFromFile(a.__filePath,{total:e,fileName:d})}return b()}):b()}},{key:'pause',value:function b(){var a=this;return this.state===this.__states.STOPPED?Promise.resolve(!0):(this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(a){return a.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return a.__setState(a.__states.PAUSED),a.emit('pause'),!0}))}},{key:'resume',value:function a(){return this.__promise?this.state===this.__states.STOPPED?Promise.resolve(!1):(this.__setState(this.__states.RESUMED),this.__isResumable&&(this.__isResumed=!0,this.__reqOptions.headers.range='bytes='+this.__downloaded+'-'),this.emit('resume',this.__isResumed),this.__start()):this.start()}},{key:'stop',value:function c(){var a=this;if(this.state===this.__states.STOPPED)return Promise.resolve(!0);var b=function(){return new Promise(function(b,c){fs.access(a.__filePath,function(d){return d?(a.__emitStop(),b(!0)):void fs.unlink(a.__filePath,function(d){return d?(a.__setState(a.__states.FAILED),a.emit('error',d),c(d)):void(a.__emitStop(),b(!0))})});})};return this.__requestAbort(),this.__closeFileStream().then(function(){return a.__opts.removeOnStop?b():(a.__emitStop(),Promise.resolve(!0))})}},{key:'pipe',value:function c(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.__pipes.push({stream:a,options:b}),a}},{key:'unpipe',value:function d(){var a=this,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=function(b){return a.__response?a.__response.unpipe(b):b.unpipe()};if(b){var e=this.__pipes.find(function(a){return a.stream===b});return void(e&&(c(b),this.__pipes=this.__pipes.filter(function(a){return a.stream!==b})))}this.__pipes.forEach(function(a){return c(a.stream)}),this.__pipes=[];}},{key:'getDownloadPath',value:function a(){return this.__filePath}},{key:'isResumable',value:function a(){return this.__isResumable}},{key:'updateOptions',value:function c(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'';this.__opts=Object.assign({},this.__opts,a),this.__headers=this.__opts.headers,-1<this.__opts.timeout&&(this.__opts.httpRequestOptions.timeout=this.__opts.timeout,this.__opts.httpsRequestOptions.timeout=this.__opts.timeout),('number'!=typeof this.__opts.progressThrottle||0>this.__opts.progressThrottle)&&(this.__opts.progressThrottle=this.__defaultOpts.progressThrottle),this.url=b||this.url,this.__reqOptions=this.__getReqOptions(this.__opts.method,this.url,this.__opts.headers),this.__initProtocol(this.url);}},{key:'getOptions',value:function a(){return this.__opts}},{key:'getMetadata',value:function a(){return this.__opts.metadata}},{key:'getStats',value:function a(){return {total:this.__total,name:this.__fileName,downloaded:this.__downloaded,progress:this.__progress,speed:this.__statsEstimate.bytes}}},{key:'getTotalSize',value:function b(){var a=this;return new Promise(function(b,c){var d=function(b){a.__initProtocol(b);var c=Object.assign({},a.__headers);c.hasOwnProperty('range')&&delete c.range;var d=a.__getReqOptions('HEAD',b,c);return Object.assign({},a.__reqOptions,d)},e=0,f=null,g=function(b,c){if(!a.__opts.retry||'object'!==_typeof(a.__opts.retry))return Promise.reject(b||new Error('wrong retry options'));f&&(clearTimeout(f),f=null);var g=a.__opts.retry,i=g.delay,j=void 0===i?0:i,k=g.maxRetries,l=void 0===k?999:k;return e>=l?Promise.reject(b||new Error('reached the maximum retries')):(e++,a.__setState(a.__states.RETRY),a.emit('retry',e,a.__opts.retry,b),new Promise(function(b){f=setTimeout(function(){a.__setState(a.__states.IDLE),h(c,d(c)),b();},j);}))},h=function(e,i){f&&(clearTimeout(f),f=null);var j=a.__protocol.request(i,function(f){if(a.__isRequireRedirect(f)){var i=/^https?:\/\//.test(f.headers.location)?f.headers.location:new _url.URL(f.headers.location,e).href;return a.emit('redirected',i,e),h(i,d(i))}if(200>f.statusCode||400<=f.statusCode){var j=new Error('Response status was '+f.statusCode);return a.__opts.retry&&500<=f.statusCode&&600>f.statusCode?g(j,e).catch(c):c(j)}b({name:a.__getFileNameFromHeaders(f.headers,f),total:parseInt(f.headers['content-length'])||null});});j.on('error',function(b){return a.__opts.retry?g(b,e).catch(c):void c(b)}),j.on('timeout',function(){return a.__opts.retry?g(new Error('timeout'),e).catch(c):void c(new Error('timeout'))}),j.on('uncaughtException',function(b){return a.__opts.retry?g(b,e).catch(c):void c(b)}),j.end();};h(a.url,d(a.url));})}},{key:'getResumeState',value:function a(){return {downloaded:this.__downloaded,filePath:this.__filePath,fileName:this.__fileName,total:this.__total}}},{key:'resumeFromFile',value:function d(a){var b=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return this.__opts.override=!0,this.__filePath=a,(c.total&&c.fileName?Promise.resolve({name:c.fileName,total:c.total}):this.getTotalSize()).then(function(a){var d=a.name,e=a.total;return b.__total=c.total||e,b.__fileName=c.fileName||d,b.__downloaded=c.downloaded||b.__getFilesizeInBytes(b.__filePath),b.__reqOptions.headers.range='bytes='+b.__downloaded+'-',b.__isResumed=!0,b.__isResumable=!0,b.__setState(b.__states.RESUMED),b.emit('resume',b.__isResumed),new Promise(function(a,c){b.__promise={resolve:a,reject:c},b.__start();})})}},{key:'__start',value:function a(){this.__isRedirected||this.state===this.__states.RESUMED||(this.emit('start'),this.__setState(this.__states.STARTED),this.__initProtocol(this.url)),this.__response=null,this.__isAborted=!1,this.__request&&!this.__request.destroyed&&this.__request.destroy(),this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__request=this.__downloadRequest(this.__promise.resolve,this.__promise.reject),this.__request.on('error',this.__onError(this.__promise.resolve,this.__promise.reject)),this.__request.on('timeout',this.__onTimeout(this.__promise.resolve,this.__promise.reject)),this.__request.on('uncaughtException',this.__onError(this.__promise.resolve,this.__promise.reject,!0)),this.__opts.body&&this.__request.write(this.__opts.body),this.__request.end();}},{key:'__resolvePending',value:function b(){if(this.__promise){var a=this.__promise.resolve;return this.__promise=null,a(!0)}}},{key:'__downloadRequest',value:function d(a,b){var c=this;return this.__protocol.request(this.__reqOptions,function(d){if(c.__response=d,c.__isResumed||(c.__total=parseInt(d.headers['content-length'])||null,c.__resetStats()),c.__isRequireRedirect(d)){var e=/^https?:\/\//.test(d.headers.location)?d.headers.location:new _url.URL(d.headers.location,c.url).href;return c.__isRedirected=!0,c.__initProtocol(e),c.emit('redirected',e,c.url),c.__start()}if(200>d.statusCode||400<=d.statusCode){var f=new Error('Response status was '+d.statusCode);return (f.status=d.statusCode||0,f.body=d.body||'',500<=d.statusCode&&600>d.statusCode)?c.__onError(a,b)(f):(c.__setState(c.__states.FAILED),c.emit('error',f),b(f))}c.__opts.forceResume?c.__isResumable=!0:d.headers.hasOwnProperty('accept-ranges')&&'none'!==d.headers['accept-ranges']&&(c.__isResumable=!0),c.__startDownload(d,a,b);})}},{key:'__startDownload',value:function h(a,b,c){var d=this,e=a;if(!this.__isResumed){var i=this.__getFileNameFromHeaders(a.headers);if(this.__filePath=this.__getFilePath(i),this.__fileName=this.__filePath.split(path.sep).pop(),fs.existsSync(this.__filePath)){var f=this.__getFilesizeInBytes(this.__filePath),g=this.__total?this.__total:0;if('object'===_typeof(this.__opts.override)&&this.__opts.override.skip&&(this.__opts.override.skipSmaller||f>=g))return this.emit('skip',{totalSize:this.__total,fileName:this.__fileName,filePath:this.__filePath,downloadedSize:f}),this.__setState(this.__states.SKIPPED),b(!0)}this.__fileStream=fs.createWriteStream(this.__filePath,{});}else this.__fileStream=fs.createWriteStream(this.__filePath,{flags:'a'});this.emit('download',{fileName:this.__fileName,filePath:this.__filePath,totalSize:this.__total,isResumed:this.__isResumed,downloadedSize:this.__downloaded}),this.__retryCount=0,this.__isResumed=!1,this.__isRedirected=!1,this.__setState(this.__states.DOWNLOADING),this.__statsEstimate.time=new Date,this.__statsEstimate.throttleTime=new Date,e.on('data',function(a){return d.__calculateStats(a.length)}),this.__pipes.forEach(function(a){e.pipe(a.stream,a.options),e=a.stream;}),e.pipe(this.__fileStream),e.on('error',this.__onError(b,c)),this.__fileStream.on('finish',this.__onFinished(b,c)),this.__fileStream.on('error',this.__onError(b,c));}},{key:'__hasFinished',value:function a(){return !this.__isAborted&&-1===[this.__states.PAUSED,this.__states.STOPPED,this.__states.RETRY,this.__states.FAILED,this.__states.RESUMED].indexOf(this.state)}},{key:'__isRequireRedirect',value:function b(a){return 300<a.statusCode&&400>a.statusCode&&a.headers.hasOwnProperty('location')&&a.headers.location}},{key:'__onFinished',value:function d(a,b){var c=this;return function(){c.__fileStream.close(function(d){if(d)return b(d);if(c.__hasFinished()){var e=!!c.__total&&c.__downloaded!==c.__total;if(e&&c.__isResumable&&c.__opts.resumeOnIncomplete&&c.__resumeRetryCount<=c.__opts.resumeOnIncompleteMaxRetry)return c.__resumeRetryCount++,c.emit('warning',new Error('uncomplete download, retrying')),c.resume();c.__setState(c.__states.FINISHED),c.__pipes=[],c.emit('end',{fileName:c.__fileName,filePath:c.__filePath,totalSize:c.__total,incomplete:e,onDiskSize:c.__getFilesizeInBytes(c.__filePath),downloadedSize:c.__downloaded});}return a(c.__downloaded===c.__total)});}}},{key:'__closeFileStream',value:function b(){var a=this;return this.__fileStream?new Promise(function(b,c){a.__fileStream.close(function(a){return a?c(a):b(!0)});}):Promise.resolve(!0)}},{key:'__onError',value:function e(a,b){var c=this,d=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];return function(a){return c.__pipes=[],d&&c.__requestAbort(),c.state===c.__states.STOPPED||c.state===c.__states.FAILED?void 0:c.__opts.retry?c.__retry(a).catch(function(d){c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('error',d?d:a),b(d?d:a);});}):c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('error',a),b(a);})}}},{key:'__retry',value:function h(){var a=this,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;if(!this.__opts.retry||'object'!==_typeof(this.__opts.retry))return Promise.reject(b||new Error('wrong retry options'));var c=this.__opts.retry,d=c.delay,e=void 0===d?0:d,f=c.maxRetries,g=void 0===f?999:f;return this.__retryCount>=g?Promise.reject(b||new Error('reached the maximum retries')):(this.__retryCount++,this.__setState(this.__states.RETRY),this.emit('retry',this.__retryCount,this.__opts.retry,b),this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(a){return a.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return new Promise(function(b){return a.__retryTimeout=setTimeout(function(){return b(0<a.__downloaded?a.resume():a.__start())},e)})}))}},{key:'__onTimeout',value:function d(a,b){var c=this;return function(){return c.__requestAbort(),c.__opts.retry?c.__retry(new Error('timeout')).catch(function(a){c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),a?b(a):(c.emit('timeout'),b(new Error('timeout')));});}):c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('timeout'),b(new Error('timeout'));})}}},{key:'__resetStats',value:function a(){this.__retryCount=0,this.__downloaded=0,this.__progress=0,this.__resumeRetryCount=0,this.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0};}},{key:'__getFileNameFromHeaders',value:function k(a,b){var c='',d=/.*filename\*=.*?'.*?'([^"].+?[^"])(?:(?:;)|$)/i,e=/.*filename="(.*?)";?/i,f=/.*filename=([^"].+?[^"])(?:(?:;)|$)/i,g=a.hasOwnProperty('content-disposition'),h=g?a['content-disposition'].match(d):null,i=!g||h?null:a['content-disposition'].match(e),j=!g||h||i?null:a['content-disposition'].match(f);return g&&(h||i||j)?(c=a['content-disposition'],c=c.trim(),h?c=h[1]:i?c=i[1]:j&&(c=j[1]),c=c.replace(/[/\\]/g,'')):0<path.basename(new _url.URL(this.requestURL).pathname).length?c=path.basename(new _url.URL(this.requestURL).pathname):c=new _url.URL(this.requestURL).hostname+'.html',this.__opts.fileName?this.__getFileNameFromOpts(c,b):c.replace(/\.*$/,'')}},{key:'__getFilePath',value:function d(a){var b=path.join(this.__destFolder,a),c=b;return this.__opts.override||this.state===this.__states.RESUMED||(c=this.__uniqFileNameSync(c),b!==c&&this.emit('renamed',{path:c,fileName:c.split(path.sep).pop(),prevPath:b,prevFileName:b.split(path.sep).pop()})),c}},{key:'__getFileNameFromOpts',value:function g(a,b){if(!this.__opts.fileName)return a;if('string'==typeof this.__opts.fileName)return this.__opts.fileName;if('function'==typeof this.__opts.fileName){var h=path.join(this.__destFolder,a);return b&&b.headers||this.__response&&this.__response.headers?this.__opts.fileName(a,h,(b?b:this.__response).headers['content-type']):this.__opts.fileName(a,h)}if('object'===_typeof(this.__opts.fileName)){var c=this.__opts.fileName,d=c.name,e=!!c.hasOwnProperty('ext')&&c.ext;if('string'==typeof e)return d+'.'+e;if('boolean'==typeof e){if(e)return d;var f=a.includes('.')?a.split('.').pop():'';return ''===f?d:d+'.'+f}}return a}},{key:'__calculateStats',value:function f(a){var b=new Date,c=b-this.__statsEstimate.time,d=b-this.__statsEstimate.throttleTime,e=this.__total||0;a&&(this.__downloaded+=a,this.__progress=0===e?0:100*(this.__downloaded/e),(this.__downloaded===e||1e3<c)&&(this.__statsEstimate.time=b,this.__statsEstimate.bytes=this.__downloaded-this.__statsEstimate.prevBytes,this.__statsEstimate.prevBytes=this.__downloaded),(this.__downloaded===e||d>this.__opts.progressThrottle)&&(this.__statsEstimate.throttleTime=b,this.emit('progress.throttled',this.getStats())),this.emit('progress',this.getStats()));}},{key:'__setState',value:function b(a){this.state=a,this.emit('stateChanged',this.state);}},{key:'__getReqOptions',value:function f(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},d=new _url.URL(b),e={protocol:d.protocol,host:d.hostname,port:d.port,path:d.pathname+d.search,method:a};return c&&(e.headers=c),e}},{key:'__getFilesizeInBytes',value:function d(a){try{var b=fs.statSync(a,{throwIfNoEntry:!1}),c=b.size||0;return c}catch(a){this.emit('warning',a);}return 0}},{key:'__validate',value:function d(a,b){if('string'!=typeof a)throw new Error('URL should be an string');if(''===a.trim())throw new Error('URL couldn\'t be empty');if('string'!=typeof b)throw new Error('Destination Folder should be an string');if(''===b.trim())throw new Error('Destination Folder couldn\'t be empty');if(!fs.existsSync(b))throw new Error('Destination Folder must exist');var c=fs.statSync(b);if(!c.isDirectory())throw new Error('Destination Folder must be a directory');try{fs.accessSync(b,fs.constants.W_OK);}catch(a){throw new Error('Destination Folder must be writable')}return !0}},{key:'__initProtocol',value:function c(a){var b=this.__getReqOptions(this.__opts.method,a,this.__headers);this.requestURL=a,-1<a.indexOf('https://')?(this.__protocol=https,b.agent=new https.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},b,this.__opts.httpsRequestOptions)):(this.__protocol=http,b.agent=new http.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},b,this.__opts.httpRequestOptions));}},{key:'__uniqFileNameSync',value:function f(a){if('string'!=typeof a||''===a)return a;try{fs.accessSync(a,fs.F_OK);var b=a.match(/(.*)(\([0-9]+\))(\..*)$/),c=b?b[1].trim():a,d=b?parseInt(b[2].replace(/\(|\)/,'')):0,e=a.split('.').pop();return e!==a&&0<e.length?(e='.'+e,c=c.replace(e,'')):e='',this.__uniqFileNameSync(c+' ('+ ++d+')'+e)}catch(b){return a}}},{key:'__removeFile',value:function b(){var a=this;return new Promise(function(b){return a.__fileStream?void a.__fileStream.close(function(c){return c&&a.emit('warning',c),a.__opts.removeOnFail?fs.access(a.__filePath,function(d){return d?b():void fs.unlink(a.__filePath,function(d){d&&a.emit('warning',c),b();})}):void b()}):b()})}},{key:'__requestAbort',value:function a(){this.__isAborted=!0,this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__response&&this.__response.destroy(),this.__request&&(this.__request.destroy?this.__request.destroy():this.__request.abort());}},{key:'__emitStop',value:function a(){this.__resolvePending(),this.__setState(this.__states.STOPPED),this.emit('stop');}}]),b}(_events.EventEmitter);
77724
77724
  } (dist));
77725
77725
 
77726
77726
  async function download(output, url, options) {
@@ -80993,7 +80993,7 @@ exports.handler = void 0;
80993
80993
  exports.appConfig = void 0;
80994
80994
  exports.container = void 0;
80995
80995
  const fileCache = createFileCache();
80996
- path$7.dirname(require$$0$4.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BEYQyxJU.cjs', document.baseURI).href))));
80996
+ path$7.dirname(require$$1$2.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-DOo0dewT.cjs', document.baseURI).href))));
80997
80997
  const authMiddleware = (passKey) => {
80998
80998
  return async (ctx, next) => {
80999
80999
  const authHeader = ctx.headers["authorization"] || ctx.request.query.auth;