linkque-cli-v2 1.4.5 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/linkquejs.js CHANGED
@@ -13060,7 +13060,37 @@ function initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength) {
13060
13060
  ready: new Promise((resolve2) => aesCrypto.resolveReady = resolve2),
13061
13061
  password: encodePassword(password, rawPassword),
13062
13062
  strength: encryptionStrength - 1,
13063
- pendingInput: EMPTY_UINT8_ARRAY
13063
+ pendingInput: EMPTY_UINT8_ARRAY,
13064
+ discarded: false
13065
+ });
13066
+ }
13067
+ function setDisposingReadable(stream, aesCrypto) {
13068
+ const reader = stream.readable.getReader();
13069
+ const readable = new ReadableStream({
13070
+ async pull(controller) {
13071
+ try {
13072
+ const { value, done } = await reader.read();
13073
+ if (done) {
13074
+ controller.close();
13075
+ } else {
13076
+ controller.enqueue(value);
13077
+ }
13078
+ } catch (error2) {
13079
+ disposeEngine(aesCrypto);
13080
+ reader.cancel(error2).catch(() => {
13081
+ });
13082
+ throw error2;
13083
+ }
13084
+ },
13085
+ cancel(reason) {
13086
+ disposeEngine(aesCrypto);
13087
+ return reader.cancel(reason);
13088
+ }
13089
+ });
13090
+ Object.defineProperty(stream, "readable", {
13091
+ get() {
13092
+ return readable;
13093
+ }
13064
13094
  });
13065
13095
  }
13066
13096
  function append(aesCrypto, input, output, paddingStart, paddingEnd, decrypt2) {
@@ -13090,7 +13120,9 @@ async function createDecryptionKeys(decrypt2, strength, password, preamble) {
13090
13120
  throw new Error(ERR_INVALID_PASSWORD);
13091
13121
  }
13092
13122
  }
13093
- function disposeEngine({ engine }) {
13123
+ function disposeEngine(aesCrypto) {
13124
+ const { engine } = aesCrypto;
13125
+ aesCrypto.discarded = true;
13094
13126
  if (engine && engine.dispose) {
13095
13127
  engine.dispose();
13096
13128
  }
@@ -13105,6 +13137,9 @@ async function createKeys(aesCrypto, strength, password, salt) {
13105
13137
  const keyLength = KEY_LENGTH[strength];
13106
13138
  const compositeKey = await deriveKey(password, salt, keyLength * 2 + PASSWORD_VERIFICATION_LENGTH);
13107
13139
  aesCrypto.engine = createEngine2(subarray(compositeKey, 0, keyLength), subarray(compositeKey, keyLength, keyLength * 2));
13140
+ if (aesCrypto.discarded) {
13141
+ disposeEngine(aesCrypto);
13142
+ }
13108
13143
  return subarray(compositeKey, keyLength * 2);
13109
13144
  }
13110
13145
  async function deriveKey(password, salt, length) {
@@ -13164,12 +13199,12 @@ var init_aes_crypto_stream = __esm({
13164
13199
  createEngine2 = createEngine;
13165
13200
  AESDecryptionStream = class extends TransformStream {
13166
13201
  constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly, checkAuthenticationCode = true }) {
13202
+ const aesCrypto = {};
13167
13203
  super({
13168
13204
  start() {
13169
- initAesCrypto(this, password, rawPassword, encryptionStrength);
13205
+ initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength);
13170
13206
  },
13171
13207
  async transform(chunk, controller) {
13172
- const aesCrypto = this;
13173
13208
  const {
13174
13209
  password: password2,
13175
13210
  strength,
@@ -13188,6 +13223,9 @@ var init_aes_crypto_stream = __esm({
13188
13223
  } else {
13189
13224
  await ready;
13190
13225
  }
13226
+ if (aesCrypto.discarded) {
13227
+ return;
13228
+ }
13191
13229
  const output = new Uint8Array(chunk.length - AUTHENTICATION_CODE_LENGTH - (chunk.length - AUTHENTICATION_CODE_LENGTH) % BLOCK_LENGTH2);
13192
13230
  controller.enqueue(append(aesCrypto, chunk, output, 0, AUTHENTICATION_CODE_LENGTH, true));
13193
13231
  },
@@ -13196,9 +13234,12 @@ var init_aes_crypto_stream = __esm({
13196
13234
  engine,
13197
13235
  pendingInput,
13198
13236
  ready
13199
- } = this;
13237
+ } = aesCrypto;
13200
13238
  if (engine) {
13201
13239
  await ready;
13240
+ if (aesCrypto.discarded) {
13241
+ return;
13242
+ }
13202
13243
  const originalAuthenticationCode = subarray(pendingInput, pendingInput.length - AUTHENTICATION_CODE_LENGTH);
13203
13244
  const decryptedChunkArray = new Uint8Array(subarray(pendingInput, 0, pendingInput.length - AUTHENTICATION_CODE_LENGTH));
13204
13245
  engine.process(decryptedChunkArray, true);
@@ -13208,25 +13249,24 @@ var init_aes_crypto_stream = __esm({
13208
13249
  invalidAuthenticationCode |= authenticationCode[indexByte] ^ originalAuthenticationCode[indexByte];
13209
13250
  }
13210
13251
  if (invalidAuthenticationCode && checkAuthenticationCode) {
13211
- throw new Error(ERR_INVALID_AUTHENTICATION_CODE);
13252
+ controller.error(new Error(ERR_INVALID_AUTHENTICATION_CODE));
13253
+ return;
13212
13254
  }
13213
13255
  controller.enqueue(decryptedChunkArray);
13214
13256
  }
13215
- },
13216
- cancel() {
13217
- disposeEngine(this);
13218
13257
  }
13219
13258
  });
13259
+ setDisposingReadable(this, aesCrypto);
13220
13260
  }
13221
13261
  };
13222
13262
  AESEncryptionStream = class extends TransformStream {
13223
13263
  constructor({ password, rawPassword, encryptionStrength }) {
13264
+ const aesCrypto = {};
13224
13265
  super({
13225
13266
  start() {
13226
- initAesCrypto(this, password, rawPassword, encryptionStrength);
13267
+ initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength);
13227
13268
  },
13228
13269
  async transform(chunk, controller) {
13229
- const aesCrypto = this;
13230
13270
  const {
13231
13271
  password: password2,
13232
13272
  strength,
@@ -13240,6 +13280,9 @@ var init_aes_crypto_stream = __esm({
13240
13280
  } else {
13241
13281
  await ready;
13242
13282
  }
13283
+ if (aesCrypto.discarded) {
13284
+ return;
13285
+ }
13243
13286
  const output = new Uint8Array(preamble.length + chunk.length - chunk.length % BLOCK_LENGTH2);
13244
13287
  output.set(preamble, 0);
13245
13288
  controller.enqueue(append(aesCrypto, chunk, output, preamble.length, 0, false));
@@ -13249,19 +13292,20 @@ var init_aes_crypto_stream = __esm({
13249
13292
  engine,
13250
13293
  pendingInput,
13251
13294
  ready
13252
- } = this;
13295
+ } = aesCrypto;
13253
13296
  if (engine) {
13254
13297
  await ready;
13298
+ if (aesCrypto.discarded) {
13299
+ return;
13300
+ }
13255
13301
  const encryptedChunkArray = new Uint8Array(pendingInput);
13256
13302
  engine.process(encryptedChunkArray, false);
13257
13303
  const authenticationCode = subarray(engine.digest(), 0, AUTHENTICATION_CODE_LENGTH);
13258
13304
  controller.enqueue(concat(encryptedChunkArray, authenticationCode));
13259
13305
  }
13260
- },
13261
- cancel() {
13262
- disposeEngine(this);
13263
13306
  }
13264
13307
  });
13308
+ setDisposingReadable(this, aesCrypto);
13265
13309
  }
13266
13310
  };
13267
13311
  }
@@ -13293,11 +13337,11 @@ function encrypt(target, input) {
13293
13337
  return output;
13294
13338
  }
13295
13339
  function createKeys2(target, password, rawPassword) {
13296
- const keys = [305419896, 591751049, 878082192];
13340
+ const cryptoKeys = [305419896, 591751049, 878082192];
13297
13341
  Object.assign(target, {
13298
- keys,
13299
- crcKey0: new Crc32(keys[0]),
13300
- crcKey2: new Crc32(keys[2])
13342
+ cryptoKeys,
13343
+ crcKey0: new Crc32(cryptoKeys[0]),
13344
+ crcKey2: new Crc32(cryptoKeys[2])
13301
13345
  });
13302
13346
  if (rawPassword) {
13303
13347
  for (let index = 0; index < rawPassword.length; index++) {
@@ -13310,16 +13354,16 @@ function createKeys2(target, password, rawPassword) {
13310
13354
  }
13311
13355
  }
13312
13356
  function updateKeys(target, byte) {
13313
- let [, key1] = target.keys;
13357
+ let [, key1] = target.cryptoKeys;
13314
13358
  target.crcKey0.append([byte]);
13315
13359
  const key0 = ~target.crcKey0.get();
13316
13360
  key1 = getInt32(Math.imul(getInt32(key1 + getInt8(key0)), 134775813) + 1);
13317
13361
  target.crcKey2.append([key1 >>> 24]);
13318
13362
  const key2 = ~target.crcKey2.get();
13319
- target.keys = [key0, key1, key2];
13363
+ target.cryptoKeys = [key0, key1, key2];
13320
13364
  }
13321
13365
  function getByte(target) {
13322
- const temp = target.keys[2] | 2;
13366
+ const temp = target.cryptoKeys[2] | 2;
13323
13367
  return getInt8(Math.imul(temp, temp ^ 1) >>> 8);
13324
13368
  }
13325
13369
  function getInt8(number4) {
@@ -13397,11 +13441,17 @@ function toCompatibleReadable(readable) {
13397
13441
  const reader = readable.getReader();
13398
13442
  return new ReadableStream({
13399
13443
  async pull(controller) {
13400
- const { value, done } = await reader.read();
13401
- if (done) {
13402
- controller.close();
13403
- } else {
13404
- controller.enqueue(value);
13444
+ try {
13445
+ const { value, done } = await reader.read();
13446
+ if (done) {
13447
+ controller.close();
13448
+ } else {
13449
+ controller.enqueue(value);
13450
+ }
13451
+ } catch (error2) {
13452
+ reader.cancel(error2).catch(() => {
13453
+ });
13454
+ throw error2;
13405
13455
  }
13406
13456
  },
13407
13457
  cancel(reason) {
@@ -13483,71 +13533,117 @@ var init_codec_registry = __esm({
13483
13533
  });
13484
13534
 
13485
13535
  // ../../node_modules/@zip.js/zip.js/lib/core/streams/zip-entry-stream.js
13486
- function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32) {
13536
+ function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32, sourceErrors) {
13537
+ const writer = gzipStream.writable.getWriter();
13538
+ const reader = gzipStream.readable.getReader();
13539
+ const outputCrc32 = crc32 === UNDEFINED_VALUE ? new Crc32() : UNDEFINED_VALUE;
13487
13540
  let outputLength = 0;
13488
- let inputDone = false;
13489
- let watchdogTimeout;
13490
- let resolveTrailerReady, rejectTrailerReady;
13491
- const trailerReady = new Promise((resolve2, reject) => {
13492
- resolveTrailerReady = resolve2;
13493
- rejectTrailerReady = reject;
13494
- });
13495
- trailerReady.catch(() => {
13541
+ let trailerWritten = false;
13542
+ let settled = false;
13543
+ let resolvePull, controller;
13544
+ const output = new ReadableStream({
13545
+ start(streamController) {
13546
+ controller = streamController;
13547
+ },
13548
+ pull() {
13549
+ resumePump();
13550
+ },
13551
+ cancel(reason) {
13552
+ settled = true;
13553
+ resumePump();
13554
+ return reader.cancel(reason);
13555
+ }
13496
13556
  });
13497
- if (!outputSize) {
13498
- resolveTrailerReady();
13499
- }
13500
- const gzipWrapStream = new TransformStream({
13501
- start(controller) {
13557
+ pump();
13558
+ drain();
13559
+ return output;
13560
+ async function pump() {
13561
+ const inputReader = readable.getReader();
13562
+ try {
13502
13563
  const header = new Uint8Array(GZIP_HEADER_LENGTH);
13503
13564
  header.set(GZIP_HEADER_BYTES);
13504
- controller.enqueue(header);
13505
- },
13506
- transform(chunk, controller) {
13507
- controller.enqueue(chunk);
13508
- },
13509
- async flush(controller) {
13510
- inputDone = true;
13511
- startWatchdog();
13512
- try {
13513
- await trailerReady;
13514
- } finally {
13515
- stopWatchdog();
13565
+ await writer.write(header);
13566
+ for (; ; ) {
13567
+ await outputCapacity();
13568
+ await writer.ready;
13569
+ const { value, done } = await readSource(inputReader, sourceErrors);
13570
+ if (done) {
13571
+ break;
13572
+ }
13573
+ await writer.write(value);
13574
+ }
13575
+ if (outputCrc32) {
13576
+ await writer.write(new Uint8Array(0));
13516
13577
  }
13517
13578
  const trailer = new Uint8Array(GZIP_TRAILER_LENGTH);
13518
13579
  const dataView = getDataView(trailer);
13519
- dataView.setUint32(0, crc32.get(), true);
13580
+ dataView.setUint32(0, outputCrc32 ? outputCrc32.get() : crc32, true);
13520
13581
  dataView.setUint32(4, outputSize, true);
13521
- controller.enqueue(trailer);
13522
- },
13523
- cancel(reason) {
13524
- rejectTrailerReady(reason);
13582
+ trailerWritten = true;
13583
+ await writer.write(trailer);
13584
+ await writer.close();
13585
+ } catch (error2) {
13586
+ await abort(writer, error2);
13587
+ await cancel(inputReader, error2);
13525
13588
  }
13526
- });
13527
- const outputStream = new TransformStream({
13528
- transform(chunk, controller) {
13529
- crc32.append(chunk);
13530
- outputLength += chunk.length;
13531
- if (outputLength >= outputSize) {
13532
- resolveTrailerReady();
13533
- } else if (inputDone) {
13534
- startWatchdog();
13589
+ }
13590
+ async function drain() {
13591
+ try {
13592
+ for (; ; ) {
13593
+ const { value, done } = await read();
13594
+ if (done) {
13595
+ break;
13596
+ }
13597
+ outputLength += value.length;
13598
+ if (outputLength > outputSize) {
13599
+ throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
13600
+ }
13601
+ if (outputCrc32) {
13602
+ outputCrc32.append(value);
13603
+ }
13604
+ controller.enqueue(value);
13535
13605
  }
13536
- controller.enqueue(chunk);
13537
- },
13538
- cancel(reason) {
13539
- rejectTrailerReady(reason);
13606
+ if (!settled) {
13607
+ settled = true;
13608
+ controller.close();
13609
+ }
13610
+ } catch (error2) {
13611
+ fail(error2);
13612
+ await cancel(reader, error2);
13540
13613
  }
13541
- });
13542
- readable = pipeThrough(readable, gzipWrapStream);
13543
- readable = pipeThroughBackpressured(readable, gzipStream);
13544
- return pipeThrough(readable, outputStream);
13545
- function startWatchdog() {
13546
- stopWatchdog();
13547
- watchdogTimeout = setTimeout(() => rejectTrailerReady(new Error(ERR_INVALID_UNCOMPRESSED_SIZE)), GZIP_OUTPUT_STALL_TIMEOUT);
13548
13614
  }
13549
- function stopWatchdog() {
13550
- clearTimeout(watchdogTimeout);
13615
+ function read() {
13616
+ return reader.read().catch((error2) => {
13617
+ if (trailerWritten) {
13618
+ if (!outputCrc32) {
13619
+ throw mapError(error2, ERR_INVALID_CRC32);
13620
+ }
13621
+ if (outputLength != outputSize) {
13622
+ throw mapError(error2, ERR_INVALID_UNCOMPRESSED_SIZE);
13623
+ }
13624
+ return { done: true };
13625
+ }
13626
+ throw mapCodecError(error2, sourceErrors);
13627
+ });
13628
+ }
13629
+ function outputCapacity() {
13630
+ if (!settled && controller.desiredSize <= 0) {
13631
+ return new Promise((resolve2) => resolvePull = resolve2);
13632
+ }
13633
+ }
13634
+ function resumePump() {
13635
+ if (resolvePull) {
13636
+ const resolve2 = resolvePull;
13637
+ resolvePull = UNDEFINED_VALUE;
13638
+ resolve2();
13639
+ }
13640
+ }
13641
+ function fail(error2) {
13642
+ if (!settled) {
13643
+ settled = true;
13644
+ controller.error(error2);
13645
+ resumePump();
13646
+ }
13551
13647
  }
13552
13648
  }
13553
13649
  function supportsFormat(StreamClass, format) {
@@ -13591,14 +13687,14 @@ function createCodecStream(CodecStreamClass, format, options) {
13591
13687
  }
13592
13688
  return new CodecStreamClass(format, options);
13593
13689
  }
13594
- function getGzipCompressionStream(useCompressionStream, CompressionStreamNative, CompressionStreamFallback) {
13595
- if (useCompressionStream && CompressionStreamNative) {
13596
- return CompressionStreamNative;
13597
- } else if (CompressionStreamFallback && CompressionStreamFallback.requiresModule) {
13598
- return CompressionStreamFallback;
13690
+ function getGzipCodecStream(useCompressionStream, CodecStreamNative, CodecStreamFallback) {
13691
+ if (useCompressionStream && CodecStreamNative) {
13692
+ return CodecStreamNative;
13693
+ } else if (CodecStreamFallback && CodecStreamFallback.requiresModule) {
13694
+ return CodecStreamFallback;
13599
13695
  }
13600
13696
  }
13601
- function pipeThroughCompressionStream(readable, useCompressionStream, options, CompressionStreamNative, CompressionStreamFallback) {
13697
+ function pipeThroughCompressionStream(readable, useCompressionStream, options, CompressionStreamNative, CompressionStreamFallback, sourceErrors) {
13602
13698
  const Stream2 = useCompressionStream && CompressionStreamNative ? CompressionStreamNative : CompressionStreamFallback || CompressionStreamNative;
13603
13699
  const format = options.deflate64 ? FORMAT_DEFLATE64_RAW : FORMAT_DEFLATE_RAW;
13604
13700
  let codecStream;
@@ -13611,12 +13707,12 @@ function pipeThroughCompressionStream(readable, useCompressionStream, options, C
13611
13707
  throw error2;
13612
13708
  }
13613
13709
  }
13614
- return pipeThroughBackpressured(readable, codecStream);
13710
+ return pipeThroughBackpressured(readable, codecStream, sourceErrors);
13615
13711
  }
13616
13712
  function pipeThrough(readable, transformStream) {
13617
13713
  return toCompatibleReadable(readable).pipeThrough(transformStream);
13618
13714
  }
13619
- function pipeThroughBackpressured(readable, transformStream) {
13715
+ function pipeThroughBackpressured(readable, transformStream, sourceErrors) {
13620
13716
  const writer = transformStream.writable.getWriter();
13621
13717
  const reader = readable.getReader();
13622
13718
  pump();
@@ -13625,7 +13721,7 @@ function pipeThroughBackpressured(readable, transformStream) {
13625
13721
  try {
13626
13722
  for (; ; ) {
13627
13723
  await writer.ready;
13628
- const result = await reader.read();
13724
+ const result = await readSource(reader, sourceErrors);
13629
13725
  if (result.done) {
13630
13726
  await writer.close();
13631
13727
  break;
@@ -13650,26 +13746,44 @@ async function cancel(reader, error2) {
13650
13746
  } catch {
13651
13747
  }
13652
13748
  }
13653
- function mapInflateStreamError(readable) {
13749
+ function readSource(reader, sourceErrors) {
13750
+ const result = reader.read();
13751
+ return sourceErrors ? result.catch((error2) => {
13752
+ sourceErrors.add(error2);
13753
+ throw error2;
13754
+ }) : result;
13755
+ }
13756
+ function mapCodecError(error2, sourceErrors) {
13757
+ if (sourceErrors.has(error2)) {
13758
+ return error2;
13759
+ }
13760
+ return mapError(error2, isMemoryError(error2) ? ERR_CODEC_OUT_OF_MEMORY : ERR_INVALID_COMPRESSED_DATA);
13761
+ }
13762
+ function mapMemoryError(error2) {
13763
+ return isMemoryError(error2) ? mapError(error2, ERR_CODEC_OUT_OF_MEMORY) : error2;
13764
+ }
13765
+ function isMemoryError(error2) {
13766
+ return isErrorObject(error2) && error2.code == Z_MEM_ERROR_CODE;
13767
+ }
13768
+ function mapError(error2, message) {
13769
+ const mappedError = new Error(message);
13770
+ mappedError.cause = error2;
13771
+ return mappedError;
13772
+ }
13773
+ function mapInflateStreamError(readable, sourceErrors) {
13654
13774
  const reader = readable.getReader();
13655
13775
  return new ReadableStream({
13656
13776
  async pull(controller) {
13657
- let result;
13658
13777
  try {
13659
- result = await reader.read();
13660
- } catch (error2) {
13661
- if (error2 && error2.message) {
13662
- throw error2;
13778
+ const { value, done } = await reader.read();
13779
+ if (done) {
13780
+ controller.close();
13781
+ } else {
13782
+ controller.enqueue(value);
13663
13783
  }
13664
- const mappedError = new Error(ERR_INVALID_COMPRESSED_DATA);
13665
- mappedError.cause = error2;
13666
- throw mappedError;
13667
- }
13668
- const { value, done } = result;
13669
- if (done) {
13670
- controller.close();
13671
- } else {
13672
- controller.enqueue(value);
13784
+ } catch (error2) {
13785
+ await cancel(reader, error2);
13786
+ throw mapCodecError(error2, sourceErrors);
13673
13787
  }
13674
13788
  },
13675
13789
  cancel(reason) {
@@ -13677,7 +13791,7 @@ function mapInflateStreamError(readable) {
13677
13791
  }
13678
13792
  });
13679
13793
  }
13680
- var ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_COMPRESSED_DATA, ERR_INVALID_CRC32, FORMAT_DEFLATE_RAW, FORMAT_DEFLATE64_RAW, FORMAT_GZIP, GZIP_HEADER_LENGTH, GZIP_TRAILER_LENGTH, GZIP_HEADER_BYTES, GZIP_OUTPUT_STALL_TIMEOUT, DeflateStream, GzipToRawDeflateStream, InflateStream, formatSupportByStream;
13794
+ var ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_COMPRESSED_DATA, ERR_CODEC_OUT_OF_MEMORY, ERR_INVALID_CRC32, Z_MEM_ERROR_CODE, FORMAT_DEFLATE_RAW, FORMAT_DEFLATE64_RAW, FORMAT_GZIP, GZIP_HEADER_LENGTH, GZIP_TRAILER_LENGTH, GZIP_HEADER_BYTES, DeflateStream, GzipToRawDeflateStream, InflateStream, formatSupportByStream;
13681
13795
  var init_zip_entry_stream = __esm({
13682
13796
  "../../node_modules/@zip.js/zip.js/lib/core/streams/zip-entry-stream.js"() {
13683
13797
  init_crc32();
@@ -13688,17 +13802,19 @@ var init_zip_entry_stream = __esm({
13688
13802
  init_constants();
13689
13803
  init_array();
13690
13804
  init_compatible_streams();
13805
+ init_error();
13691
13806
  init_codec_registry();
13692
13807
  ERR_INVALID_UNCOMPRESSED_SIZE = "Invalid uncompressed size";
13693
13808
  ERR_INVALID_COMPRESSED_DATA = "Invalid compressed data";
13809
+ ERR_CODEC_OUT_OF_MEMORY = "Codec out of memory";
13694
13810
  ERR_INVALID_CRC32 = "Invalid CRC32";
13811
+ Z_MEM_ERROR_CODE = "Z_MEM_ERROR";
13695
13812
  FORMAT_DEFLATE_RAW = "deflate-raw";
13696
13813
  FORMAT_DEFLATE64_RAW = "deflate64-raw";
13697
13814
  FORMAT_GZIP = "gzip";
13698
13815
  GZIP_HEADER_LENGTH = 10;
13699
13816
  GZIP_TRAILER_LENGTH = 8;
13700
13817
  GZIP_HEADER_BYTES = [31, 139, 8];
13701
- GZIP_OUTPUT_STALL_TIMEOUT = 5e3;
13702
13818
  DeflateStream = class extends TransformStream {
13703
13819
  constructor(options, { chunkSize, CompressionStreamFallback, CompressionStream: CompressionStream2 }) {
13704
13820
  super({});
@@ -13707,7 +13823,7 @@ var init_zip_entry_stream = __esm({
13707
13823
  let crc32Stream, encryptionStream, gzipCrc32Stream;
13708
13824
  let readable = super.readable;
13709
13825
  const codecStreams2 = format && getCodecStreams(format);
13710
- const GzipCompressionStream = getGzipCompressionStream(useCompressionStream, CompressionStream2, CompressionStreamFallback);
13826
+ const GzipCompressionStream = getGzipCodecStream(useCompressionStream, CompressionStream2, CompressionStreamFallback);
13711
13827
  const useGzipCrc32 = computeCrc32 && compressed && !deflate64 && !codecStreams2 && (!encrypted || zipCrypto) && Boolean(GzipCompressionStream);
13712
13828
  if ((!encrypted || zipCrypto) && computeCrc32 && !useGzipCrc32) {
13713
13829
  crc32Stream = new Crc32Stream();
@@ -13724,11 +13840,14 @@ var init_zip_entry_stream = __esm({
13724
13840
  try {
13725
13841
  readable = pipeThroughCompressionStream(readable, useCompressionStream, { level, chunkSize }, CompressionStream2, CompressionStreamFallback);
13726
13842
  } catch (error2) {
13843
+ if (!useCompressionStream && CompressionStreamFallback) {
13844
+ throw mapMemoryError(error2);
13845
+ }
13727
13846
  let gzipStream;
13728
13847
  try {
13729
13848
  gzipStream = new CompressionStream2(FORMAT_GZIP);
13730
13849
  } catch {
13731
- throw error2;
13850
+ throw mapMemoryError(error2);
13732
13851
  }
13733
13852
  readable = pipeThroughBackpressured(readable, gzipStream);
13734
13853
  readable = pipeThrough(readable, new GzipToRawDeflateStream());
@@ -13805,35 +13924,49 @@ var init_zip_entry_stream = __esm({
13805
13924
  }
13806
13925
  }
13807
13926
  if (compressed) {
13927
+ const sourceErrors = /* @__PURE__ */ new Set();
13808
13928
  const codecStreams2 = format && getCodecStreams(format);
13929
+ let gzipStream;
13809
13930
  if (codecStreams2) {
13810
- readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams2.DecompressionStream, format, { chunkSize, compressionMethod, rawBitFlag, uncompressedSize: outputSize }));
13931
+ readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams2.DecompressionStream, format, { chunkSize, compressionMethod, rawBitFlag, uncompressedSize: outputSize }), sourceErrors);
13811
13932
  } else {
13812
- try {
13813
- readable = pipeThroughCompressionStream(readable, useCompressionStream, { chunkSize, deflate64 }, DecompressionStream2, DecompressionStreamFallback);
13814
- } catch (error2) {
13815
- if (deflate64 || outputSize === UNDEFINED_VALUE) {
13816
- throw error2;
13817
- }
13818
- let gzipStream;
13933
+ const GzipDecompressionStream = getGzipCodecStream(useCompressionStream, DecompressionStream2, DecompressionStreamFallback);
13934
+ if (checkCrc32 && !deflate64 && crc32 !== UNDEFINED_VALUE && outputSize !== UNDEFINED_VALUE && GzipDecompressionStream) {
13819
13935
  try {
13820
- gzipStream = new DecompressionStream2(FORMAT_GZIP);
13936
+ gzipStream = new GzipDecompressionStream(FORMAT_GZIP, { chunkSize });
13821
13937
  } catch {
13822
- throw error2;
13938
+ gzipStream = UNDEFINED_VALUE;
13939
+ }
13940
+ }
13941
+ if (!gzipStream) {
13942
+ try {
13943
+ readable = pipeThroughCompressionStream(readable, useCompressionStream, { chunkSize, deflate64 }, DecompressionStream2, DecompressionStreamFallback, sourceErrors);
13944
+ } catch (error2) {
13945
+ if (deflate64 || outputSize === UNDEFINED_VALUE || !useCompressionStream && DecompressionStreamFallback) {
13946
+ throw mapMemoryError(error2);
13947
+ }
13948
+ try {
13949
+ gzipStream = new DecompressionStream2(FORMAT_GZIP);
13950
+ } catch {
13951
+ throw mapMemoryError(error2);
13952
+ }
13823
13953
  }
13824
- gzipCrc32 = new Crc32();
13825
- readable = pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, gzipCrc32);
13826
13954
  }
13827
13955
  }
13828
- readable = mapInflateStreamError(readable);
13956
+ if (gzipStream) {
13957
+ gzipCrc32 = true;
13958
+ readable = pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32, sourceErrors);
13959
+ } else {
13960
+ readable = mapInflateStreamError(readable, sourceErrors);
13961
+ }
13829
13962
  }
13830
13963
  if (checkCrc32 && !gzipCrc32) {
13831
13964
  crc32Stream = new Crc32Stream();
13832
13965
  readable = pipeThrough(readable, crc32Stream);
13833
13966
  }
13834
13967
  setReadable(this, readable, () => {
13835
- if (checkCrc32) {
13836
- const computedCrc32 = gzipCrc32 ? gzipCrc32.get() >>> 0 : new DataView(crc32Stream.value.buffer).getUint32(0, false);
13968
+ if (crc32Stream) {
13969
+ const computedCrc32 = new DataView(crc32Stream.value.buffer).getUint32(0, false);
13837
13970
  if (crc32 != computedCrc32) {
13838
13971
  throw new Error(ERR_INVALID_CRC32);
13839
13972
  }
@@ -14041,7 +14174,8 @@ async function runWorker({ options, readable, writable, onTaskFinished, workerOp
14041
14174
  }
14042
14175
  codecStream = new CodecStream(options, config3);
14043
14176
  chunkStream = new ChunkStream(getChunkSize(config3));
14044
- await readable.pipeThrough(codecStream).pipeThrough(chunkStream).pipeTo(writable, { preventClose: true, preventAbort: true });
14177
+ const { signal } = workerOptions.streamOptions;
14178
+ await readable.pipeThrough(codecStream).pipeThrough(chunkStream).pipeTo(writable, { preventClose: true, preventAbort: true, signal });
14045
14179
  const {
14046
14180
  crc32,
14047
14181
  inputSize,
@@ -14901,6 +15035,7 @@ __export(zip_reader_exports, {
14901
15035
  ERR_AMBIGUOUS_ARCHIVE: () => ERR_AMBIGUOUS_ARCHIVE,
14902
15036
  ERR_BAD_FORMAT: () => ERR_BAD_FORMAT,
14903
15037
  ERR_CENTRAL_DIRECTORY_NOT_FOUND: () => ERR_CENTRAL_DIRECTORY_NOT_FOUND,
15038
+ ERR_CODEC_OUT_OF_MEMORY: () => ERR_CODEC_OUT_OF_MEMORY,
14904
15039
  ERR_ENCRYPTED: () => ERR_ENCRYPTED,
14905
15040
  ERR_ENCRYPTED_CENTRAL_DIRECTORY: () => ERR_ENCRYPTED_CENTRAL_DIRECTORY,
14906
15041
  ERR_ENTRY_DATA_OUT_OF_BOUNDS: () => ERR_ENTRY_DATA_OUT_OF_BOUNDS,
@@ -15536,7 +15671,7 @@ function getMaxAppendedDataSize(maxAppendedDataSize, strictness) {
15536
15671
  async function findEndOfCentralDirectory(reader, rejectAmbiguous, maxAppendedDataSize) {
15537
15672
  const { size } = reader;
15538
15673
  const anchoredLength = Math.min(size, END_OF_CENTRAL_DIR_LENGTH + MAX_16_BITS);
15539
- const remoteProbeBudget = { count: MAX_END_OF_CENTRAL_DIR_PROBES };
15674
+ const remoteProbeBudget = { remaining: MAX_END_OF_CENTRAL_DIR_PROBES };
15540
15675
  let endOfDirectoryInfo;
15541
15676
  let plausibleEndOfDirectoryInfo;
15542
15677
  let endOfDirectoryReachingEndCount = 0;
@@ -15623,8 +15758,8 @@ async function readSignature(reader, view, anchoredOffset, signatureOffset, size
15623
15758
  if (signatureOffset >= anchoredOffset) {
15624
15759
  return getUint32(view, signatureOffset - anchoredOffset);
15625
15760
  }
15626
- if (remoteProbeBudget.count > 0) {
15627
- remoteProbeBudget.count--;
15761
+ if (remoteProbeBudget.remaining > 0) {
15762
+ remoteProbeBudget.remaining--;
15628
15763
  const signatureArray = await readUint8Array(reader, signatureOffset, 4);
15629
15764
  return getUint32(getDataView(signatureArray), 0);
15630
15765
  }
@@ -16260,8 +16395,8 @@ var init_zip_reader = __esm({
16260
16395
  const passThroughCompression = Boolean(passThrough);
16261
16396
  const passThroughEncryption = passThrough === true;
16262
16397
  checkPasswordOption(password, rawPassword);
16263
- password = password && password.length && password;
16264
- rawPassword = rawPassword && rawPassword.length && rawPassword;
16398
+ password = password && password.length ? password : UNDEFINED_VALUE;
16399
+ rawPassword = rawPassword && rawPassword.length ? rawPassword : UNDEFINED_VALUE;
16265
16400
  if (extraFieldAES) {
16266
16401
  if (extraFieldAES.originalCompressionMethod != COMPRESSION_METHOD_AES) {
16267
16402
  throw new Error(ERR_UNSUPPORTED_COMPRESSION);
@@ -16406,6 +16541,7 @@ var init_zip_reader = __esm({
16406
16541
  ({ writable } = writer);
16407
16542
  const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
16408
16543
  const { outputSize: writtenSize } = await runWorker2({ readable, writable }, workerOptions);
16544
+ throwIfAborted(signal);
16409
16545
  if (writtenSize != outputSize) {
16410
16546
  throw Object.assign(new Error(ERR_INVALID_UNCOMPRESSED_SIZE), { outputSize: writtenSize });
16411
16547
  }
@@ -20046,6 +20182,7 @@ var EHookExecutorName;
20046
20182
  EHookExecutorName2["LinkquegwEventHookExecutor"] = "LinkquegwEventHookExecutor";
20047
20183
  EHookExecutorName2["SecurityAnswerHookExecutor"] = "SecurityAnswerHookExecutor";
20048
20184
  EHookExecutorName2["ImageUnderstandingHookExecutor"] = "ImageUnderstandingHookExecutor";
20185
+ EHookExecutorName2["McpDiscoveryHookExecutor"] = "McpDiscoveryHookExecutor";
20049
20186
  })(EHookExecutorName || (EHookExecutorName = {}));
20050
20187
 
20051
20188
  // ../agent-a2ui-card-contract/dist/esm/protocol.js
@@ -23871,6 +24008,14 @@ var ETelemetryAttribute;
23871
24008
  ETelemetryAttribute2["HARNESS_MODEL_PURPOSE"] = "harness.model.purpose";
23872
24009
  ETelemetryAttribute2["HARNESS_MODEL_INVOCATION_COUNT"] = "harness.model.invocation_count";
23873
24010
  ETelemetryAttribute2["GEN_AI_TOOL_NAME"] = "gen_ai.tool.name";
24011
+ ETelemetryAttribute2["LINKQUE_TOOL_DISPLAY_NAME"] = "linkque.tool.display_name";
24012
+ ETelemetryAttribute2["LINKQUE_CARD_EXECUTION_ID"] = "linkque.card.execution_id";
24013
+ ETelemetryAttribute2["LINKQUE_CARD_REF"] = "linkque.card.ref";
24014
+ ETelemetryAttribute2["LINKQUE_CARD_REVISION"] = "linkque.card.revision";
24015
+ ETelemetryAttribute2["LINKQUE_CARD_DISPLAY_NAME"] = "linkque.card.display_name";
24016
+ ETelemetryAttribute2["LINKQUE_CARD_PHASE"] = "linkque.card.phase";
24017
+ ETelemetryAttribute2["LINKQUE_CARD_SOURCE_ID"] = "linkque.card.source_id";
24018
+ ETelemetryAttribute2["LINKQUE_CARD_DELIVERY"] = "linkque.card.delivery";
23874
24019
  ETelemetryAttribute2["GEN_AI_TOOL_CALL_ID"] = "gen_ai.tool.call.id";
23875
24020
  ETelemetryAttribute2["HARNESS_TOOL_RESULT_STATUS"] = "harness.tool.result.status";
23876
24021
  ETelemetryAttribute2["LINKQUE_TOOL_FAILURE_STAGE"] = "linkque.tool.failure_stage";
@@ -23906,6 +24051,7 @@ var ETelemetryEventPrefix;
23906
24051
  ETelemetryEventPrefix2["ADVANCE"] = "harness.advance";
23907
24052
  ETelemetryEventPrefix2["MODEL_INVOKE"] = "harness.model.invoke";
23908
24053
  ETelemetryEventPrefix2["MODEL_ATTEMPT"] = "harness.model.attempt";
24054
+ ETelemetryEventPrefix2["MODEL_REASONING"] = "harness.model.reasoning";
23909
24055
  ETelemetryEventPrefix2["TOOL_INVOKE"] = "harness.tool.invoke";
23910
24056
  ETelemetryEventPrefix2["TOOL_ATTEMPT"] = "harness.tool.attempt";
23911
24057
  ETelemetryEventPrefix2["HOOK_CHAIN"] = "harness.hook.chain";
@@ -23947,6 +24093,8 @@ var ETelemetryEventName;
23947
24093
  ETelemetryEventName2["MODEL_INVOKE_FINISHED"] = "harness.model.invoke.finished";
23948
24094
  ETelemetryEventName2["MODEL_ATTEMPT_STARTED"] = "harness.model.attempt.started";
23949
24095
  ETelemetryEventName2["MODEL_ATTEMPT_FINISHED"] = "harness.model.attempt.finished";
24096
+ ETelemetryEventName2["MODEL_REASONING_STARTED"] = "harness.model.reasoning.started";
24097
+ ETelemetryEventName2["MODEL_REASONING_FINISHED"] = "harness.model.reasoning.finished";
23950
24098
  ETelemetryEventName2["TOOL_INVOKE_STARTED"] = "harness.tool.invoke.started";
23951
24099
  ETelemetryEventName2["TOOL_INVOKE_FINISHED"] = "harness.tool.invoke.finished";
23952
24100
  ETelemetryEventName2["TOOL_ATTEMPT_STARTED"] = "harness.tool.attempt.started";
@@ -23964,11 +24112,17 @@ var ETelemetryEventName;
23964
24112
  ETelemetryEventName2["HOOK_DRAIN_STARTED"] = "linkque.hook.drain.started";
23965
24113
  ETelemetryEventName2["HOOK_DRAIN_FINISHED"] = "linkque.hook.drain.finished";
23966
24114
  ETelemetryEventName2["CONTENT_RECORDED"] = "linkque.content.recorded";
24115
+ ETelemetryEventName2["TOOL_CONTEXT"] = "linkque.tool.context";
23967
24116
  })(ETelemetryEventName || (ETelemetryEventName = {}));
23968
24117
  var ETelemetryContentSection;
23969
24118
  (function(ETelemetryContentSection2) {
23970
24119
  ETelemetryContentSection2["QUERY_INPUT"] = "query.input";
24120
+ ETelemetryContentSection2["MODEL_INPUT_DIGEST"] = "model.input.digest";
24121
+ ETelemetryContentSection2["MODEL_OUT_RAW"] = "model.out.raw";
23971
24122
  ETelemetryContentSection2["MODEL_OUTPUT"] = "model.output";
24123
+ ETelemetryContentSection2["MODEL_REASONING"] = "model.reasoning";
24124
+ ETelemetryContentSection2["FOLLOW_UP_QUESTION_INPUT"] = "follow_up_question.input";
24125
+ ETelemetryContentSection2["FOLLOW_UP_QUESTION_OUTPUT"] = "follow_up_question.output";
23972
24126
  ETelemetryContentSection2["MCP_ACTION_OUTPUT"] = "mcp_action.output";
23973
24127
  ETelemetryContentSection2["TOOL_INPUT"] = "tool.input";
23974
24128
  ETelemetryContentSection2["TOOL_OUTPUT"] = "tool.output";
@@ -23987,6 +24141,7 @@ var ETelemetryOperationName;
23987
24141
  ETelemetryOperationName2["ADVANCE"] = "harness.advance";
23988
24142
  ETelemetryOperationName2["MODEL_INVOKE"] = "harness.model.invoke";
23989
24143
  ETelemetryOperationName2["MODEL_ATTEMPT"] = "harness.model.attempt";
24144
+ ETelemetryOperationName2["MODEL_REASONING"] = "harness.model.reasoning";
23990
24145
  ETelemetryOperationName2["TOOL_ATTEMPT"] = "harness.tool.attempt";
23991
24146
  ETelemetryOperationName2["HOOK_CHAIN"] = "harness.hook.chain";
23992
24147
  ETelemetryOperationName2["MIDDLEWARE"] = "harness.middleware";
@@ -24122,6 +24277,7 @@ var ETelemetryTerminalSource;
24122
24277
  var ETelemetryModelPurpose;
24123
24278
  (function(ETelemetryModelPurpose2) {
24124
24279
  ETelemetryModelPurpose2["AGENT_LOOP"] = "agent_loop";
24280
+ ETelemetryModelPurpose2["FOLLOW_UP_QUESTION"] = "follow_up_question";
24125
24281
  })(ETelemetryModelPurpose || (ETelemetryModelPurpose = {}));
24126
24282
  var ETelemetryErrorType;
24127
24283
  (function(ETelemetryErrorType2) {
@@ -34531,6 +34687,14 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
34531
34687
  ETelemetryAttribute.HARNESS_MODEL_PURPOSE,
34532
34688
  ETelemetryAttribute.HARNESS_MODEL_INVOCATION_COUNT,
34533
34689
  ETelemetryAttribute.GEN_AI_TOOL_NAME,
34690
+ ETelemetryAttribute.LINKQUE_TOOL_DISPLAY_NAME,
34691
+ ETelemetryAttribute.LINKQUE_CARD_EXECUTION_ID,
34692
+ ETelemetryAttribute.LINKQUE_CARD_REF,
34693
+ ETelemetryAttribute.LINKQUE_CARD_REVISION,
34694
+ ETelemetryAttribute.LINKQUE_CARD_DISPLAY_NAME,
34695
+ ETelemetryAttribute.LINKQUE_CARD_PHASE,
34696
+ ETelemetryAttribute.LINKQUE_CARD_SOURCE_ID,
34697
+ ETelemetryAttribute.LINKQUE_CARD_DELIVERY,
34534
34698
  ETelemetryAttribute.GEN_AI_TOOL_CALL_ID,
34535
34699
  ETelemetryAttribute.HARNESS_TOOL_RESULT_STATUS,
34536
34700
  ETelemetryAttribute.LINKQUE_TOOL_FAILURE_STAGE,
@@ -36916,7 +37080,7 @@ t.fill(8, 0, 144), t.fill(9, 144, 256), t.fill(7, 256, 280), t.fill(8, 280, 288)
36916
37080
  var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
36917
37081
  var e = (t3) => t3({ workerURI: (t4) => {
36918
37082
  const e3 = "text/javascript";
36919
- let r2 = '!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:o,Error:r,Uint8Array:s,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:u,Promise:w,TextEncoder:l,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,z="undefined",b="function",k=new s,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,A,x,M,P,D,F,E]=C;class R{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let o=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),s=e-8;for(;o<=s;o+=8){const t=n^r.getInt32(o,!0),e=r.getInt32(o+4,!0);n=E[255&t]^F[t>>>8&255]^D[t>>>16&255]^P[t>>>24&255]^M[255&e]^x[e>>>8&255]^A[e>>>16&255]^I[e>>>24&255]}}for(;o<e;o++)n=n>>>8^I[255&(n^t[o])];this.o=n}get(){return~this.o}}class U extends d{constructor(){let t;const n=new R;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new s(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function B(t,n){const e=new s(t.length+n.length);return e.set(t),e.set(n,t.length),e}function T(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const V=64,W=20,j=new s([128]),K=new s(1),O=new a([1732584193,4023233417,2562383102,271733878,3285377520]),H=new s(256),L=new a(256),N=new a(256),q=new a(256),G=new a(256);let J=!1;function Q(t,n){!function(){if(!J){let t=1,n=1;do{t=255&(t^t<<1^(128&t?27:0)),n=255&(n^n<<1),n=255&(n^n<<2),n=255&(n^n<<4),128&n&&(n^=9),H[t]=255&(n^(n<<1|n>>7)^(n<<2|n>>6)^(n<<3|n>>5)^(n<<4|n>>4)^99)}while(1!=t);H[0]=99;for(let t=0;t<256;t++){const n=H[t],e=$(n),o=e<<24|n<<16|n<<8|e^n;L[t]=o,N[t]=o>>>8|o<<24,q[t]=o>>>16|o<<16,G[t]=o>>>24|o<<8}J=!0}}();const e=new a(60),o=function(t,n){const e=t.length>>2,o=e+6,r=4*(o+1);let s=1;for(let o=0;o<e;o++)n[o]=t[4*o]<<24|t[4*o+1]<<16|t[4*o+2]<<8|t[4*o+3];for(let t=e;t<r;t++){let o=n[t-1];t%e==0?(o=Y(o<<8|o>>>24)^s<<24,s=$(s)):e>6&&t%e==4&&(o=Y(o)),n[t]=n[t-e]^o}return o}(t,e),r=new a(4),s=X(n);let c=0,i=0,f=0,w=0;return{process(t,n){n&&s.update(t,0,t.length),function(t){const n=new u(t.buffer,t.byteOffset,t.byteLength),e=t.length;let o=0;for(;o+16<=e;o+=16)l(),n.setInt32(o,n.getInt32(o)^r[0]),n.setInt32(o+4,n.getInt32(o+4)^r[1]),n.setInt32(o+8,n.getInt32(o+8)^r[2]),n.setInt32(o+12,n.getInt32(o+12)^r[3]);if(o<e){l();for(let n=0;o<e;o++,n++)t[o]^=r[n>>2]>>>24-8*(3&n)}}(t),n||s.update(t,0,t.length)},digest:()=>s.digest()};function l(){c=c+1|0,c||(i=i+1|0,i||(f=f+1|0,f||(w=w+1|0)));let t=Z(c)^e[0],n=Z(i)^e[1],s=Z(f)^e[2],a=Z(w)^e[3],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[4],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[5],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[6],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[7];t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[8],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[9],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[10],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[11],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[12],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[13],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[14],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[15],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[16],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[17],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[18],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[19],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[20],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[21],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[22],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[23],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[24],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[25],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[26],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[27],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[28],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[29],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[30],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[31],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[32],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[33],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[34],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[35],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[36],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[37],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[38],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[39];let d=40;o>10&&(t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[40],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[41],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[42],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[43],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[44],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[45],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[46],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[47],d=48),o>12&&(t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[48],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[49],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[50],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[51],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[52],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[53],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[54],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[55],d=56),r[0]=(H[u>>>24]<<24|H[l>>>16&255]<<16|H[h>>>8&255]<<8|H[255&p])^e[d],r[1]=(H[l>>>24]<<24|H[h>>>16&255]<<16|H[p>>>8&255]<<8|H[255&u])^e[d+1],r[2]=(H[h>>>24]<<24|H[p>>>16&255]<<16|H[u>>>8&255]<<8|H[255&l])^e[d+2],r[3]=(H[p>>>24]<<24|H[u>>>16&255]<<16|H[l>>>8&255]<<8|H[255&h])^e[d+3]}}function X(t){const n=function(){const t=new a(O),n=new a(16),e=new s(V),r=new u(e.buffer),c=new s(8);let i=0,f=0;return{update:w,digest:function(){const n=8*f,e=o.floor(n/4294967296),r=n>>>0;for(w(j,0,1);56!=i;)w(K,0,1);c[0]=e>>>24,c[1]=e>>>16,c[2]=e>>>8,c[3]=e,c[4]=r>>>24,c[5]=r>>>16,c[6]=r>>>8,c[7]=r,w(c,0,8);const a=new s(W),l=new u(a.buffer);for(let n=0;n<t.length;n++)l.setInt32(4*n,t[n]);return t.set(O),i=0,f=0,a}};function w(t,n,o){const s=n+o;if(f+=o,i){for(;n<s&&i<V;)e[i++]=t[n++];i==V&&(l(r,0),i=0)}if(n+V<=s){const e=new u(t.buffer,t.byteOffset,t.byteLength);for(;n+V<=s;n+=V)l(e,n)}for(;n<s;)e[i++]=t[n++]}function l(e,o){for(let t=0;t<16;t++)n[t]=e.getInt32(o+4*t);let r,s=t[0],c=t[1],i=t[2],a=t[3],f=t[4];for(let t=0;t<15;t+=5)f=(s<<5|s>>>27)+((i^a)&c^a)+f+1518500249+n[t]|0,c=c<<30|c>>>2,a=(f<<5|f>>>27)+((c^i)&s^i)+a+1518500249+n[t+1]|0,s=s<<30|s>>>2,i=(a<<5|a>>>27)+((s^c)&f^c)+i+1518500249+n[t+2]|0,f=f<<30|f>>>2,c=(i<<5|i>>>27)+((f^s)&a^s)+c+1518500249+n[t+3]|0,a=a<<30|a>>>2,s=(c<<5|c>>>27)+((a^f)&i^f)+s+1518500249+n[t+4]|0,i=i<<30|i>>>2;f=(s<<5|s>>>27)+((i^a)&c^a)+f+1518500249+n[15]|0,c=c<<30|c>>>2,r=n[13]^n[8]^n[2]^n[0],r=r<<1|r>>>31,n[0]=r,a=(f<<5|f>>>27)+((c^i)&s^i)+a+1518500249+r|0,s=s<<30|s>>>2,r=n[14]^n[9]^n[3]^n[1],r=r<<1|r>>>31,n[1]=r,i=(a<<5|a>>>27)+((s^c)&f^c)+i+1518500249+r|0,f=f<<30|f>>>2,r=n[15]^n[10]^n[4]^n[2],r=r<<1|r>>>31,n[2]=r,c=(i<<5|i>>>27)+((f^s)&a^s)+c+1518500249+r|0,a=a<<30|a>>>2,r=n[0]^n[11]^n[5]^n[3],r=r<<1|r>>>31,n[3]=r,s=(c<<5|c>>>27)+((a^f)&i^f)+s+1518500249+r|0,i=i<<30|i>>>2;for(let t=20;t<40;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(s<<5|s>>>27)+(c^i^a)+f+1859775393+r|0,c=c<<30|c>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,a=(f<<5|f>>>27)+(s^c^i)+a+1859775393+r|0,s=s<<30|s>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,i=(a<<5|a>>>27)+(f^s^c)+i+1859775393+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,c=(i<<5|i>>>27)+(a^f^s)+c+1859775393+r|0,a=a<<30|a>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,s=(c<<5|c>>>27)+(i^a^f)+s+1859775393+r|0,i=i<<30|i>>>2;for(let t=40;t<60;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(s<<5|s>>>27)+(c&i|(c|i)&a)+f+2400959708+r|0,c=c<<30|c>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,a=(f<<5|f>>>27)+(s&c|(s|c)&i)+a+2400959708+r|0,s=s<<30|s>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,i=(a<<5|a>>>27)+(f&s|(f|s)&c)+i+2400959708+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,c=(i<<5|i>>>27)+(a&f|(a|f)&s)+c+2400959708+r|0,a=a<<30|a>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,s=(c<<5|c>>>27)+(i&a|(i|a)&f)+s+2400959708+r|0,i=i<<30|i>>>2;for(let t=60;t<80;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(s<<5|s>>>27)+(c^i^a)+f+3395469782+r|0,c=c<<30|c>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,a=(f<<5|f>>>27)+(s^c^i)+a+3395469782+r|0,s=s<<30|s>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,i=(a<<5|a>>>27)+(f^s^c)+i+3395469782+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,c=(i<<5|i>>>27)+(a^f^s)+c+3395469782+r|0,a=a<<30|a>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,s=(c<<5|c>>>27)+(i^a^f)+s+3395469782+r|0,i=i<<30|i>>>2;t[0]=t[0]+s|0,t[1]=t[1]+c|0,t[2]=t[2]+i|0,t[3]=t[3]+a|0,t[4]=t[4]+f|0}}(),e=new s(V),r=new s(V);t.length>V&&(n.update(t,0,t.length),t=n.digest());for(let n=0;n<V;n++){const o=n<t.length?t[n]:0;e[n]=54^o,r[n]=92^o}return n.update(e,0,V),{update(t,e,o){n.update(t,e,o)},digest(){const t=n.digest();n.update(r,0,V),n.update(t,0,W);const o=n.digest();return n.update(e,0,V),o}}}function Y(t){return H[t>>>24]<<24|H[t>>>16&255]<<16|H[t>>>8&255]<<8|H[255&t]}function Z(t){return t<<24|(65280&t)<<8|t>>>8&65280|t>>>24}function $(t){return 255&(t<<1^27*(t>>7))}const _=typeof h!=z&&typeof h.getRandomValues==b,tt="Invalid password",nt="zipjs-abort-check-password";function et(t){if(_)return h.getRandomValues(t);throw new r("Crypto API not supported")}const ot={name:"PBKDF2"},rt=n.assign({hash:{name:"HMAC"}},ot),st=n.assign({iterations:1e3,hash:{name:"SHA-1"}},ot),ct=["deriveBits"],it=[8,12,16],at=[16,24,32],ft=10,ut=typeof h!=z,wt=ut&&h.subtle;let lt=ut&&typeof wt!=z&&typeof wt.importKey==b&&typeof wt.deriveBits==b,ht=Q;class pt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:o,checkAuthenticationCode:c=!0}){super({start(){yt(this,t,n,e)},async transform(t,n){const e=this,{password:c,strength:i,l:a,ready:f}=e;c?(await async function(t,n,e,o){const s=await gt(t,n,e,zt(o,0,it[n])),c=zt(o,it[n]);if(s[0]!=c[0]||s[1]!=c[1])throw St(t),new r(tt)}(e,i,c,zt(t,0,it[i]+2)),t=zt(t,it[i]+2),o?(St(e),n.error(new r(nt))):a()):await f;const u=new s(t.length-ft-(t.length-ft)%16);n.enqueue(mt(e,t,u,0,ft,!0))},async flush(t){const{h:n,m:e,ready:o}=this;if(n){await o;const i=zt(e,e.length-ft),a=new s(zt(e,0,e.length-ft));n.process(a,!0);const f=n.digest();let u=e.length<ft?1:0;for(let t=0;t<ft;t++)u|=f[t]^i[t];if(u&&c)throw new r("Invalid authentication code");t.enqueue(a)}},cancel(){St(this)}})}}class dt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e}){super({start(){yt(this,t,n,e)},async transform(t,n){const e=this,{password:o,strength:r,l:c,ready:i}=e;let a=k;o?(a=await async function(t,n,e){const o=et(new s(it[n]));return B(o,await gt(t,n,e,o))}(e,r,o),c()):await i;const f=new s(a.length+t.length-t.length%16);f.set(a,0),n.enqueue(mt(e,t,f,a.length,0,!1))},async flush(t){const{h:n,m:e,ready:o}=this;if(n){await o;const r=new s(e);n.process(r,!1);const c=zt(n.digest(),0,ft);t.enqueue(B(r,c))}},cancel(){St(this)}})}}function yt(t,e,o,r){n.assign(t,{ready:new w(n=>t.l=n),password:vt(e,o),strength:r-1,m:k})}function mt(t,n,e,o,r,c){const{h:i,m:a}=t;a.length&&(n=B(a,n));const f=n.length-r,u=f-f%16;if(e=function(t,n){if(n&&n>t.length){const e=t;(t=new s(n)).set(e,0)}return t}(e,o+u),u){const t=zt(e,o,o+u);t.set(zt(n,0,u)),i.process(t,c)}return t.m=zt(n,u),e}function St({h:t}){t&&t.dispose&&t.dispose()}async function gt(t,e,r,c){t.password=null;const i=at[e],a=await async function(t,e,r){if(lt)try{const o=await wt.importKey("raw",t,rt,!1,ct);return new s(await wt.deriveBits(n.assign({salt:e},st),o,8*r))}catch{lt=!1}return function(t,n,e,r){const c=X(t),i=new s(r),a=new s(n.length+4),f=new u(a.buffer);a.set(n);for(let t=1,e=0;e<r;t++,e+=W){f.setUint32(n.length,t),c.update(a,0,a.length);let s=c.digest();const u=s.slice();for(let t=1;t<1e3;t++){c.update(s,0,W),s=c.digest();for(let t=0;t<W;t++)u[t]^=s[t]}i.set(u.subarray(0,o.min(W,r-e)),e)}return i}(t,e,0,r)}(r,c,2*i+2);return t.h=ht(zt(a,0,i),zt(a,i,2*i)),zt(a,2*i)}function vt(t,n){return n===v?function(t){if(typeof l==z){t=unescape(encodeURIComponent(t));const n=new s(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new l).encode(t)}(t):n}function zt(t,n,e){return t.subarray(n,e)}class bt extends d{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:o}){super({start(){Ct(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=It(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(tt);t=t.subarray(12)}o?n.error(new r(nt)):n.enqueue(It(e,t))}})}}class kt extends d{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){Ct(this,t,n,e)},transform(t,n){const e=this;let o,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=et(new s(12));n[11]=e.passwordVerification,o=new s(t.length+n.length),o.set(At(e,n),0),r=12}else o=new s(t.length),r=0;o.set(At(e,t),r),n.enqueue(o)}})}}function Ct(t,e,o,r){n.assign(t,{password:e,rawPassword:o,passwordVerification:r}),function(t,e,o){const r=[305419896,591751049,878082192];if(n.assign(t,{keys:r,S:new R(r[0]),v:new R(r[2])}),o)for(let n=0;n<o.length;n++)xt(t,o[n]);else for(let n=0;n<e.length;n++)xt(t,e.charCodeAt(n))}(t,e,o)}function It(t,n){const e=new s(n.length);for(let o=0;o<n.length;o++)e[o]=Mt(t)^n[o],xt(t,e[o]);return e}function At(t,n){const e=new s(n.length);for(let o=0;o<n.length;o++)e[o]=Mt(t)^n[o],xt(t,n[o]);return e}function xt(t,n){let[,e]=t.keys;t.S.append([n]);const r=~t.S.get();e=Dt(o.imul(Dt(e+Pt(r)),134775813)+1),t.v.append([e>>>24]);const s=~t.v.get();t.keys=[r,e,s]}function Mt(t){const n=2|t.keys[2];return Pt(o.imul(n,1^n)>>>8)}function Pt(t){return 255&t}function Dt(t){return 4294967295&t}function Ft(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){const{value:e,done:o}=await n.read();o?t.close():t.enqueue(e)},cancel:t=>n.cancel(t)})}const Et=new f;function Rt(t){return Et.get(t)}const Ut="Invalid uncompressed size",Bt="deflate-raw",Tt="gzip",Vt=[31,139,8];class Wt extends d{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:o}){super({});const{compressed:r,encrypted:s,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:w,format:l,compressionMethod:h,inputSize:p}=t,d=this;let y,m,S,g=super.readable;const v=l&&Rt(l),z=function(t,n,e){return t&&n?n:e&&e.C?e:void 0}(c,o,e),b=a&&r&&!w&&!v&&(!s||i)&&Boolean(z);if(s&&!i||!a||b||(y=new U,g=qt(g,y)),r)if(v)g=Gt(g,Lt(v.CompressionStream,l,{level:f,chunkSize:n,compressionMethod:h,uncompressedSize:p}));else if(b)S=new jt,g=Gt(g,new z(Tt,{level:f,chunkSize:n})),g=qt(g,S);else try{g=Nt(g,c,{level:f,chunkSize:n},o,e)}catch(t){let n;try{n=new o(Tt)}catch{throw t}g=Gt(g,n),g=qt(g,new jt)}s&&(i?g=qt(g,new kt(t)):(m=new dt(t),g=qt(g,m))),Ht(d,g,()=>{s&&!i||!a||(d.crc32=b?S.crc32:new u(y.value.buffer).getUint32(0))})}}class jt extends d{constructor(){let t,n=10,e=new s(0);super({transform(t,r){if(n){const e=o.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const s=e.length+t.length;if(s<=8)return void(e=B(e,t));const c=s-8,i=o.min(c,e.length);r.enqueue(B(e.subarray(0,i),t.subarray(0,c-i))),e=B(e.subarray(i),t.subarray(c-i))},flush(){const n=T(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Kt extends d{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:o}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:l,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:z}=t;let b,k,C,I=super.readable;if(i&&(c?I=qt(I,new bt(t)):(k=new pt(t),I=qt(I,k))),l){const t=m&&Rt(m);if(t)I=Gt(I,Lt(t.DecompressionStream,m,{chunkSize:n,compressionMethod:S,rawBitFlag:g,uncompressedSize:z}));else try{I=Nt(I,h,{chunkSize:n,deflate64:p},o,e)}catch(t){if(p||z===v)throw t;let n;try{n=new o(Tt)}catch{throw t}C=new R,I=function(t,n,e,o){let c,i,a,f=0,u=!1;const l=new w((t,n)=>{i=t,a=n});l.catch(()=>{}),e||i();const h=new d({start(t){const n=new s(10);n.set(Vt),t.enqueue(n)},transform(t,n){n.enqueue(t)},async flush(t){u=!0,y();try{await l}finally{m()}const n=new s(8),r=T(n);r.setUint32(0,o.get(),!0),r.setUint32(4,e,!0),t.enqueue(n)},cancel(t){a(t)}}),p=new d({transform(t,n){o.append(t),f+=t.length,f>=e?i():u&&y(),n.enqueue(t)},cancel(t){a(t)}});return t=qt(t,h),qt(t=Gt(t,n),p);function y(){m(),c=setTimeout(()=>a(new r(Ut)),5e3)}function m(){clearTimeout(c)}}(I,n,z,C)}I=function(t){const n=t.getReader();return new y({async pull(t){let e;try{e=await n.read()}catch(t){if(t&&t.message)throw t;const n=new r("Invalid compressed data");throw n.cause=t,n}const{value:o,done:s}=e;s?t.close():t.enqueue(o)},cancel:t=>n.cancel(t)})}(I)}a&&!C&&(b=new U,I=qt(I,b)),Ht(this,I,()=>{if(a){const t=C?C.get()>>>0:new u(b.value.buffer).getUint32(0,!1);if(f!=t)throw new r("Invalid CRC32")}})}}const Ot=new f;function Ht(t,e,o){e=qt(e,new d({flush:o})),n.defineProperty(t,"readable",{get:()=>e})}function Lt(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function Nt(t,n,e,o,r){const s=n&&o?o:r||o,c=e.deflate64?"deflate64-raw":Bt;let i;try{i=new s(c,e)}catch(t){if(!n||!r||s==r)throw t;i=new r(c,e)}return Gt(t,i)}function qt(t,n){return Ft(t).pipeThrough(n)}function Gt(t,n){const e=n.writable.getWriter(),o=t.getReader();return async function(){try{for(;;){await e.ready;const t=await o.read();if(t.done){await e.close();break}await e.write(t.value)}}catch(t){await async function(t,n){try{await t.abort(n)}catch{}}(e,t),await async function(t,n){try{await t.cancel(n)}catch{}}(o,t)}}(),n.readable}const Jt="data",Qt="deflate";class Xt extends d{constructor(t,e){super({});const o=this,{codecType:s}=t;let c;s.startsWith(Qt)?c=Wt:s.startsWith("inflate")&&(c=Kt),o.outputSize=0;let i=0;const a=new c(t,e),f=super.readable,u=new d({transform(t,n){t&&t.length&&(i+=t.length,n.enqueue(t))},flush(){n.assign(o,{inputSize:i})}}),w=new d({transform(n,e){if(n&&n.length&&(e.enqueue(n),o.outputSize+=n.length,t.outputSize!==v&&o.outputSize>t.outputSize))throw new r(Ut)},flush(){const{crc32:t}=a;n.assign(o,{crc32:t,inputSize:i})}});n.defineProperty(o,"readable",{get:()=>f.pipeThrough(u).pipeThrough(a).pipeThrough(w)})}}class Yt extends d{constructor(t){const o=[];let r=0,c=0;function i(){const n=new s(t);let e=0;for(;e<t;){const r=o[0],s=t-e;r.length<=s?(n.set(r,e),e+=r.length,o.shift()):(n.set(r.subarray(0,s),e),o[0]=r.subarray(s),e+=s)}return r-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(o.push(n),r+=n.length;r>t;)c+=t,e.enqueue(i())},flush(t){r&&(c+=r,t.enqueue(function(t,n){const e=new s(n);let o=0;for(const n of t)e.set(n,o),o+=n.length;return e}(o,r)))}}),n.defineProperty(this,"outputSize",{get:()=>c})}}let Zt=2;try{typeof navigator!=z&&navigator.hardwareConcurrency&&(Zt=navigator.hardwareConcurrency)}catch{}function $t(t){return Boolean(t)&&"object"==typeof t}const _t=new f,tn=new f,nn=function(){try{return structuredClone(new r)instanceof r}catch{return!1}}();let en=0;async function on(t){let n,s,c;try{const{options:i,config:a}=t;if(i.format)try{await async function(t,n){!Et.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:o}=n;if(typeof e!=b&&typeof o!=b)throw new r("Invalid codec module");Et.set(t,{CompressionStream:e,DecompressionStream:o})}(t,await(import(n)))}(i.format,i.codecURI)}catch(t){if($t(t))try{t.codecImportFailed=!0}catch{}throw t}if(a.CompressionStream=self.CompressionStream,a.DecompressionStream=self.DecompressionStream,i.compressed&&!i.format)if(i.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Ot.get(t);e||(e=new f,Ot.set(t,e));let o=e.get(n);if(o===v){try{new t(n),o=!0}catch{o=!1}e.set(n,o)}return o}(i.codecType.startsWith(Qt)?a.CompressionStream:a.DecompressionStream,Bt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{i.useCompressionStream=!0}if(i.encrypted&&!i.zipCrypto)try{await self.initModule(t.config)}catch{}!a.CompressionStreamFallback&&a.CompressionStreamZlib&&(a.CompressionStreamFallback=a.CompressionStreamZlib),!a.DecompressionStreamFallback&&a.DecompressionStreamZlib&&(a.DecompressionStreamFallback=a.DecompressionStreamZlib);const u={highWaterMark:1},l=t.readable?Ft(t.readable):new y({async pull(t){const n=new w(t=>_t.set(en,t));rn({type:"pull",messageId:en}),en=(en+1)%e.MAX_SAFE_INTEGER;const{value:o,done:r}=await n;t.enqueue(o),r&&t.close()}},u);c=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const o=new w(t=>n=t);tn.set(en,n),rn({type:Jt,value:t,messageId:en}),en=(en+1)%e.MAX_SAFE_INTEGER,await o}},u),n=new Xt(i,a),s=new Yt(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?o.max(r,64):65536;var n,r}(a)),await l.pipeThrough(n).pipeThrough(s).pipeTo(c,{preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=n;rn({type:"close",result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){const n=s?s.outputSize:0;if($t(t))try{t.outputSize=n}catch{}if(c&&!c.locked)try{await c.getWriter().close()}catch{}sn(t,n)}}function rn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new s(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function sn(t,n){const{message:e,stack:o,code:s,name:c,outputSize:i,cause:a,codecImportFailed:f}=function(t=new r("Unknown error")){return $t(t)?t:new r(String(t))}(t),u={message:e,stack:o,code:s,name:c,outputSize:i===v?n:i};if(a&&(u.cause={name:a.name,message:a.message}),f&&(u.codecImportFailed=!0),nn)try{return void p({error:u,errorValue:{value:t}})}catch{}p({error:u})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:o,done:r}=t;try{if("start"==n&&on(t),n==Jt){const t=_t.get(e);_t.delete(e),t({value:o||new s,done:r})}if("ack"==n){const t=tn.get(e);tn.delete(e),t()}}catch(t){sn(t)}}),p({type:"ready"});const cn="deflate",an="deflate-raw",fn="deflate64-raw",un="gzip";let wn,ln,hn,pn,dn;function yn(t,n,e={}){if(!wn){const t=new r("WASM module not loaded");throw t.cause=dn,t}const c="number"==typeof e.level?e.level:-1,i="number"==typeof e.outBuffer?e.outBuffer:65536,a="number"==typeof e.inBufferSize?e.inBufferSize:65536;return new d({start(){try{let e;if(this.I=ln(i),this.in=ln(a),this.inBufferSize=a,!this.I||!this.in)throw new r("allocation failed");if(t?(this.A=wn.deflate_process,this.M=wn.deflate_last_consumed,this.P=wn.deflate_end,this.D=wn.deflate_new(),e=n===un?wn.deflate_init_gzip(this.D,c):n===an?wn.deflate_init_raw(this.D,c):wn.deflate_init(this.D,c)):n===fn?(this.A=wn.inflate9_process,this.M=wn.inflate9_last_consumed,this.P=wn.inflate9_end,this.D=wn.inflate9_new(),e=wn.inflate9_init_raw(this.D)):(this.A=wn.inflate_process,this.M=wn.inflate_last_consumed,this.P=wn.inflate_end,this.D=wn.inflate_new(),e=n===an?wn.inflate_init_raw(this.D):n===un?wn.inflate_init_gzip(this.D):wn.inflate_init(this.D)),0!==e)throw new r("init failed:"+e)}catch(t){throw f(this),t}},transform(t,n){try{const e=t,c=new s(pn.buffer),a=this.A,f=this.M,u=this.I;let w=0;for(;w<e.length;){const t=o.min(e.length-w,32768);if((!this.in||this.inBufferSize<t)&&(this.in&&hn&&(hn(this.in),this.in=0),this.in=ln(t),this.inBufferSize=t,!this.in))throw new r("allocation failed");c.set(e.subarray(w,w+t),this.in);const s=a(this.D,this.in,t,u,i,0),l=s>>24&255,h=128&l?l-256:l;if(h<0)throw new r("process error:"+h);const p=16777215&s;p&&n.enqueue(c.slice(u,u+p));const d=f(this.D);if(0===d&&0===p)break;w+=d}}catch(t){f(this),n.error(t)}},flush(t){try{const n=new s(pn.buffer),e=this.A,o=this.I;for(;;){const s=e(this.D,0,0,o,i,4),c=s>>24&255,a=128&c?c-256:c;if(a<0)throw new r("process error:"+a);const f=16777215&s;if(f&&t.enqueue(n.slice(o,o+f)),1===c||0===f)break}}catch(n){t.error(n)}finally{const n=f(this);0!==n&&t.error(new r("end error:"+n))}},cancel(){f(this)}});function f(t){let n=0;return t.D&&t.P&&(n=t.P(t.D)),t.D=0,t.in&&hn&&hn(t.in),t.in=0,t.I&&hn&&hn(t.I),t.I=0,n}}class mn{constructor(t=cn,n){return yn(!0,t,n)}}class Sn{constructor(t=cn,n){return yn(!1,t,n)}}mn.C=!0,Sn.C=!0,mn.F=[cn,an,un],Sn.F=[cn,an,un,fn];const gn=65536;let vn,zn;function bn(t){return new s(t.memory.buffer)}let kn=!1;!function(t={}){const{init:n,R:e}=t,o=t.CompressionStreamFallback||t.CompressionStreamZlib,r=t.DecompressionStreamFallback||t.DecompressionStreamZlib;e&&(ht=e||Q),self.initModule=async t=>{n&&await n(t),o&&(t.CompressionStreamFallback=o),r&&(t.DecompressionStreamFallback=r)}}({CompressionStreamFallback:mn,DecompressionStreamFallback:Sn,R:function(t,n){const e=vn;let o=e?function(t,n,e){zn||(zn=t.malloc(gn));const o=zn?t.aes_hmac_new():0;if(o){const r=bn(t);if(r.set(n,zn),r.set(e,zn+n.length),t.aes_hmac_init(o,zn,n.length,zn+n.length,e.length))return t.aes_hmac_end(o,0),0}return o}(e,t,n):0;if(!o)return Q(t,n);const r=zn;return{process(t,n){for(let s=0;s<t.length;s+=gn){const c=t.subarray(s,s+gn),i=bn(e);i.set(c,r),e.aes_hmac_process(o,r,c.length,n?1:0),c.set(i.subarray(r,r+c.length))}},digest:()=>(e.aes_hmac_end(o,r),o=0,bn(e).slice(r,r+20)),dispose(){o&&(e.aes_hmac_end(o,0),o=0)}}},init:t=>async function(t,{baseURI:n}){if(!kn)try{await async function(t,n){let e,o;try{try{o=new URL(t,n)}catch{}const r=await fetch(o);e=await r.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),o=e.length,r=new s(o);for(let t=0;t<o;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}const c=await WebAssembly.instantiate(e);var i;(function(t){if(wn=t,({malloc:ln,free:hn,memory:pn}=wn),"function"!=typeof ln||"function"!=typeof hn||!pn)throw wn=ln=hn=pn=null,new r("Invalid WASM module")})(c.instance.exports),typeof(i=c.instance.exports).aes_hmac_new==b&&(vn=i,zn=0)}(t,n),kn=!0}catch(t){throw function(t){dn=t}(t),t}}(t.wasmURI,t)})});\n';
37083
+ let r2 = '!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:o,Error:r,Uint8Array:c,Uint16Array:s,Uint32Array:a,Int32Array:i,Map:f,DataView:u,Promise:w,TextEncoder:l,crypto:d,postMessage:p,TransformStream:h,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new c,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,M,A,E,R,x,P,D]=C;class F{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let o=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),c=e-8;for(;o<=c;o+=8){const t=n^r.getInt32(o,!0),e=r.getInt32(o+4,!0);n=D[255&t]^P[t>>>8&255]^x[t>>>16&255]^R[t>>>24&255]^E[255&e]^A[e>>>8&255]^M[e>>>16&255]^I[e>>>24&255]}}for(;o<e;o++)n=n>>>8^I[255&(n^t[o])];this.o=n}get(){return~this.o}}class U extends h{constructor(){let t;const n=new F;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new c(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function B(t,n){const e=new c(t.length+n.length);return e.set(t),e.set(n,t.length),e}function W(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const O=64,V=20,K=new c([128]),T=new c(1),_=new i([1732584193,4023233417,2562383102,271733878,3285377520]),j=new c(256),H=new i(256),L=new i(256),Z=new i(256),N=new i(256);let q=!1;function G(t,n){!function(){if(!q){let t=1,n=1;do{t=255&(t^t<<1^(128&t?27:0)),n=255&(n^n<<1),n=255&(n^n<<2),n=255&(n^n<<4),128&n&&(n^=9),j[t]=255&(n^(n<<1|n>>7)^(n<<2|n>>6)^(n<<3|n>>5)^(n<<4|n>>4)^99)}while(1!=t);j[0]=99;for(let t=0;t<256;t++){const n=j[t],e=Y(n),o=e<<24|n<<16|n<<8|e^n;H[t]=o,L[t]=o>>>8|o<<24,Z[t]=o>>>16|o<<16,N[t]=o>>>24|o<<8}q=!0}}();const e=new i(60),o=function(t,n){const e=t.length>>2,o=e+6,r=4*(o+1);let c=1;for(let o=0;o<e;o++)n[o]=t[4*o]<<24|t[4*o+1]<<16|t[4*o+2]<<8|t[4*o+3];for(let t=e;t<r;t++){let o=n[t-1];t%e==0?(o=Q(o<<8|o>>>24)^c<<24,c=Y(c)):e>6&&t%e==4&&(o=Q(o)),n[t]=n[t-e]^o}return o}(t,e),r=new i(4),c=J(n);let s=0,a=0,f=0,w=0;return{process(t,n){n&&c.update(t,0,t.length),function(t){const n=new u(t.buffer,t.byteOffset,t.byteLength),e=t.length;let o=0;for(;o+16<=e;o+=16)l(),n.setInt32(o,n.getInt32(o)^r[0]),n.setInt32(o+4,n.getInt32(o+4)^r[1]),n.setInt32(o+8,n.getInt32(o+8)^r[2]),n.setInt32(o+12,n.getInt32(o+12)^r[3]);if(o<e){l();for(let n=0;o<e;o++,n++)t[o]^=r[n>>2]>>>24-8*(3&n)}}(t),n||c.update(t,0,t.length)},digest:()=>c.digest()};function l(){s=s+1|0,s||(a=a+1|0,a||(f=f+1|0,f||(w=w+1|0)));let t=X(s)^e[0],n=X(a)^e[1],c=X(f)^e[2],i=X(w)^e[3],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[4],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[5],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[6],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[7];t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[8],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[9],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[10],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[11],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[12],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[13],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[14],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[15],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[16],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[17],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[18],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[19],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[20],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[21],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[22],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[23],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[24],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[25],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[26],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[27],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[28],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[29],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[30],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[31],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[32],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[33],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[34],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[35],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[36],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[37],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[38],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[39];let h=40;o>10&&(t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[40],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[41],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[42],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[43],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[44],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[45],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[46],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[47],h=48),o>12&&(t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[48],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[49],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[50],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[51],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[52],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[53],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[54],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[55],h=56),r[0]=(j[u>>>24]<<24|j[l>>>16&255]<<16|j[d>>>8&255]<<8|j[255&p])^e[h],r[1]=(j[l>>>24]<<24|j[d>>>16&255]<<16|j[p>>>8&255]<<8|j[255&u])^e[h+1],r[2]=(j[d>>>24]<<24|j[p>>>16&255]<<16|j[u>>>8&255]<<8|j[255&l])^e[h+2],r[3]=(j[p>>>24]<<24|j[u>>>16&255]<<16|j[l>>>8&255]<<8|j[255&d])^e[h+3]}}function J(t){const n=function(){const t=new i(_),n=new i(16),e=new c(O),r=new u(e.buffer),s=new c(8);let a=0,f=0;return{update:w,digest:function(){const n=8*f,e=o.floor(n/4294967296),r=n>>>0;for(w(K,0,1);56!=a;)w(T,0,1);s[0]=e>>>24,s[1]=e>>>16,s[2]=e>>>8,s[3]=e,s[4]=r>>>24,s[5]=r>>>16,s[6]=r>>>8,s[7]=r,w(s,0,8);const i=new c(V),l=new u(i.buffer);for(let n=0;n<t.length;n++)l.setInt32(4*n,t[n]);return t.set(_),a=0,f=0,i}};function w(t,n,o){const c=n+o;if(f+=o,a){for(;n<c&&a<O;)e[a++]=t[n++];a==O&&(l(r,0),a=0)}if(n+O<=c){const e=new u(t.buffer,t.byteOffset,t.byteLength);for(;n+O<=c;n+=O)l(e,n)}for(;n<c;)e[a++]=t[n++]}function l(e,o){for(let t=0;t<16;t++)n[t]=e.getInt32(o+4*t);let r,c=t[0],s=t[1],a=t[2],i=t[3],f=t[4];for(let t=0;t<15;t+=5)f=(c<<5|c>>>27)+((a^i)&s^i)+f+1518500249+n[t]|0,s=s<<30|s>>>2,i=(f<<5|f>>>27)+((s^a)&c^a)+i+1518500249+n[t+1]|0,c=c<<30|c>>>2,a=(i<<5|i>>>27)+((c^s)&f^s)+a+1518500249+n[t+2]|0,f=f<<30|f>>>2,s=(a<<5|a>>>27)+((f^c)&i^c)+s+1518500249+n[t+3]|0,i=i<<30|i>>>2,c=(s<<5|s>>>27)+((i^f)&a^f)+c+1518500249+n[t+4]|0,a=a<<30|a>>>2;f=(c<<5|c>>>27)+((a^i)&s^i)+f+1518500249+n[15]|0,s=s<<30|s>>>2,r=n[13]^n[8]^n[2]^n[0],r=r<<1|r>>>31,n[0]=r,i=(f<<5|f>>>27)+((s^a)&c^a)+i+1518500249+r|0,c=c<<30|c>>>2,r=n[14]^n[9]^n[3]^n[1],r=r<<1|r>>>31,n[1]=r,a=(i<<5|i>>>27)+((c^s)&f^s)+a+1518500249+r|0,f=f<<30|f>>>2,r=n[15]^n[10]^n[4]^n[2],r=r<<1|r>>>31,n[2]=r,s=(a<<5|a>>>27)+((f^c)&i^c)+s+1518500249+r|0,i=i<<30|i>>>2,r=n[0]^n[11]^n[5]^n[3],r=r<<1|r>>>31,n[3]=r,c=(s<<5|s>>>27)+((i^f)&a^f)+c+1518500249+r|0,a=a<<30|a>>>2;for(let t=20;t<40;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s^a^i)+f+1859775393+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c^s^a)+i+1859775393+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f^c^s)+a+1859775393+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i^f^c)+s+1859775393+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a^i^f)+c+1859775393+r|0,a=a<<30|a>>>2;for(let t=40;t<60;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s&a|(s|a)&i)+f+2400959708+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c&s|(c|s)&a)+i+2400959708+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f&c|(f|c)&s)+a+2400959708+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i&f|(i|f)&c)+s+2400959708+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a&i|(a|i)&f)+c+2400959708+r|0,a=a<<30|a>>>2;for(let t=60;t<80;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s^a^i)+f+3395469782+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c^s^a)+i+3395469782+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f^c^s)+a+3395469782+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i^f^c)+s+3395469782+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a^i^f)+c+3395469782+r|0,a=a<<30|a>>>2;t[0]=t[0]+c|0,t[1]=t[1]+s|0,t[2]=t[2]+a|0,t[3]=t[3]+i|0,t[4]=t[4]+f|0}}(),e=new c(O),r=new c(O);t.length>O&&(n.update(t,0,t.length),t=n.digest());for(let n=0;n<O;n++){const o=n<t.length?t[n]:0;e[n]=54^o,r[n]=92^o}return n.update(e,0,O),{update(t,e,o){n.update(t,e,o)},digest(){const t=n.digest();n.update(r,0,O),n.update(t,0,V);const o=n.digest();return n.update(e,0,O),o}}}function Q(t){return j[t>>>24]<<24|j[t>>>16&255]<<16|j[t>>>8&255]<<8|j[255&t]}function X(t){return t<<24|(65280&t)<<8|t>>>8&65280|t>>>24}function Y(t){return 255&(t<<1^27*(t>>7))}const $=typeof d!=b&&typeof d.getRandomValues==k,tt="Invalid password",nt="zipjs-abort-check-password";function et(t){if($)return d.getRandomValues(t);throw new r("Crypto API not supported")}const ot={name:"PBKDF2"},rt=n.assign({hash:{name:"HMAC"}},ot),ct=n.assign({iterations:1e3,hash:{name:"SHA-1"}},ot),st=["deriveBits"],at=[8,12,16],it=[16,24,32],ft=10,ut=typeof d!=b,wt=ut&&d.subtle;let lt=ut&&typeof wt!=b&&typeof wt.importKey==k&&typeof wt.deriveBits==k,dt=G;class pt extends h{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:o,checkAuthenticationCode:s=!0}){const a={};super({start(){yt(a,t,n,e)},async transform(t,n){const{password:e,strength:s,l:i,ready:f}=a;if(e?(await async function(t,n,e,o){const c=await vt(t,n,e,kt(o,0,at[n])),s=kt(o,at[n]);if(c[0]!=s[0]||c[1]!=s[1])throw gt(t),new r(tt)}(a,s,e,kt(t,0,at[s]+2)),t=kt(t,at[s]+2),o?(gt(a),n.error(new r(nt))):i()):await f,a.h)return;const u=new c(t.length-ft-(t.length-ft)%16);n.enqueue(St(a,t,u,0,ft,!0))},async flush(t){const{m:n,S:e,ready:o}=a;if(n){if(await o,a.h)return;const i=kt(e,e.length-ft),f=new c(kt(e,0,e.length-ft));n.process(f,!0);const u=n.digest();let w=e.length<ft?1:0;for(let t=0;t<ft;t++)w|=u[t]^i[t];if(w&&s)return void t.error(new r("Invalid authentication code"));t.enqueue(f)}}}),mt(this,a)}}class ht extends h{constructor({password:t,rawPassword:n,encryptionStrength:e}){const o={};super({start(){yt(o,t,n,e)},async transform(t,n){const{password:e,strength:r,l:s,ready:a}=o;let i=z;if(e?(i=await async function(t,n,e){const o=et(new c(at[n]));return B(o,await vt(t,n,e,o))}(o,r,e),s()):await a,o.h)return;const f=new c(i.length+t.length-t.length%16);f.set(i,0),n.enqueue(St(o,t,f,i.length,0,!1))},async flush(t){const{m:n,S:e,ready:r}=o;if(n){if(await r,o.h)return;const s=new c(e);n.process(s,!1);const a=kt(n.digest(),0,ft);t.enqueue(B(s,a))}}}),mt(this,o)}}function yt(t,e,o,r){n.assign(t,{ready:new w(n=>t.l=n),password:bt(e,o),strength:r-1,S:z,h:!1})}function mt(t,e){const o=t.readable.getReader(),r=new y({async pull(t){try{const{value:n,done:e}=await o.read();e?t.close():t.enqueue(n)}catch(t){throw gt(e),o.cancel(t).catch(()=>{}),t}},cancel:t=>(gt(e),o.cancel(t))});n.defineProperty(t,"readable",{get:()=>r})}function St(t,n,e,o,r,s){const{m:a,S:i}=t;i.length&&(n=B(i,n));const f=n.length-r,u=f-f%16;if(e=function(t,n){if(n&&n>t.length){const e=t;(t=new c(n)).set(e,0)}return t}(e,o+u),u){const t=kt(e,o,o+u);t.set(kt(n,0,u)),a.process(t,s)}return t.S=kt(n,u),e}function gt(t){const{m:n}=t;t.h=!0,n&&n.dispose&&n.dispose()}async function vt(t,e,r,s){t.password=null;const a=it[e],i=await async function(t,e,r){if(lt)try{const o=await wt.importKey("raw",t,rt,!1,st);return new c(await wt.deriveBits(n.assign({salt:e},ct),o,8*r))}catch{lt=!1}return function(t,n,e,r){const s=J(t),a=new c(r),i=new c(n.length+4),f=new u(i.buffer);i.set(n);for(let t=1,e=0;e<r;t++,e+=V){f.setUint32(n.length,t),s.update(i,0,i.length);let c=s.digest();const u=c.slice();for(let t=1;t<1e3;t++){s.update(c,0,V),c=s.digest();for(let t=0;t<V;t++)u[t]^=c[t]}a.set(u.subarray(0,o.min(V,r-e)),e)}return a}(t,e,0,r)}(r,s,2*a+2);return t.m=dt(kt(i,0,a),kt(i,a,2*a)),t.h&&gt(t),kt(i,2*a)}function bt(t,n){return n===v?function(t){if(typeof l==b){t=unescape(encodeURIComponent(t));const n=new c(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new l).encode(t)}(t):n}function kt(t,n,e){return t.subarray(n,e)}class zt extends h{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:o}){super({start(){It(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=Mt(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(tt);t=t.subarray(12)}o?n.error(new r(nt)):n.enqueue(Mt(e,t))}})}}class Ct extends h{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){It(this,t,n,e)},transform(t,n){const e=this;let o,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=et(new c(12));n[11]=e.passwordVerification,o=new c(t.length+n.length),o.set(At(e,n),0),r=12}else o=new c(t.length),r=0;o.set(At(e,t),r),n.enqueue(o)}})}}function It(t,e,o,r){n.assign(t,{password:e,rawPassword:o,passwordVerification:r}),function(t,e,o){const r=[305419896,591751049,878082192];if(n.assign(t,{v:r,C:new F(r[0]),I:new F(r[2])}),o)for(let n=0;n<o.length;n++)Et(t,o[n]);else for(let n=0;n<e.length;n++)Et(t,e.charCodeAt(n))}(t,e,o)}function Mt(t,n){const e=new c(n.length);for(let o=0;o<n.length;o++)e[o]=Rt(t)^n[o],Et(t,e[o]);return e}function At(t,n){const e=new c(n.length);for(let o=0;o<n.length;o++)e[o]=Rt(t)^n[o],Et(t,n[o]);return e}function Et(t,n){let[,e]=t.v;t.C.append([n]);const r=~t.C.get();e=Pt(o.imul(Pt(e+xt(r)),134775813)+1),t.I.append([e>>>24]);const c=~t.I.get();t.v=[r,e,c]}function Rt(t){const n=2|t.v[2];return xt(o.imul(n,1^n)>>>8)}function xt(t){return 255&t}function Pt(t){return 4294967295&t}function Dt(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){try{const{value:e,done:o}=await n.read();o?t.close():t.enqueue(e)}catch(t){throw n.cancel(t).catch(()=>{}),t}},cancel:t=>n.cancel(t)})}function Ft(t){return Boolean(t)&&"object"==typeof t}const Ut=new f;function Bt(t){return Ut.get(t)}const Wt="Invalid uncompressed size",Ot="Codec out of memory",Vt="Invalid CRC32",Kt="deflate-raw",Tt="gzip",_t=[31,139,8];class jt extends h{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:o}){super({});const{compressed:r,encrypted:c,useCompressionStream:s,zipCrypto:a,computeCrc32:i,level:f,deflate64:w,format:l,compressionMethod:d,inputSize:p}=t,h=this;let y,m,S,g=super.readable;const v=l&&Bt(l),b=Gt(s,o,e),k=i&&r&&!w&&!v&&(!c||a)&&Boolean(b);if(c&&!a||!i||k||(y=new U,g=Qt(g,y)),r)if(v)g=Xt(g,qt(v.CompressionStream,l,{level:f,chunkSize:n,compressionMethod:d,uncompressedSize:p}));else if(k)S=new Ht,g=Xt(g,new b(Tt,{level:f,chunkSize:n})),g=Qt(g,S);else try{g=Jt(g,s,{level:f,chunkSize:n},o,e)}catch(t){if(!s&&e)throw en(t);let n;try{n=new o(Tt)}catch{throw en(t)}g=Xt(g,n),g=Qt(g,new Ht)}c&&(a?g=Qt(g,new Ct(t)):(m=new ht(t),g=Qt(g,m))),Nt(h,g,()=>{c&&!a||!i||(h.crc32=k?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Ht extends h{constructor(){let t,n=10,e=new c(0);super({transform(t,r){if(n){const e=o.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const c=e.length+t.length;if(c<=8)return void(e=B(e,t));const s=c-8,a=o.min(s,e.length);r.enqueue(B(e.subarray(0,a),t.subarray(0,s-a))),e=B(e.subarray(a),t.subarray(s-a))},flush(){const n=W(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Lt extends h{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:o}){super({});const{zipCrypto:s,encrypted:a,checkCrc32:i,crc32:f,compressed:l,useCompressionStream:d,deflate64:p,format:h,compressionMethod:m,rawBitFlag:S,outputSize:g}=t;let b,k,z,C=super.readable;if(a&&(s?C=Qt(C,new zt(t)):(k=new pt(t),C=Qt(C,k))),l){const t=new Set,s=h&&Bt(h);let a;if(s)C=Xt(C,qt(s.DecompressionStream,h,{chunkSize:n,compressionMethod:m,rawBitFlag:S,uncompressedSize:g}),t);else{const r=Gt(d,o,e);if(i&&!p&&f!==v&&g!==v&&r)try{a=new r(Tt,{chunkSize:n})}catch{a=v}if(!a)try{C=Jt(C,d,{chunkSize:n,deflate64:p},o,e,t)}catch(t){if(p||g===v||!d&&e)throw en(t);try{a=new o(Tt)}catch{throw en(t)}}}a?(z=!0,C=function(t,n,e,o,s){const a=n.writable.getWriter(),i=n.readable.getReader(),f=o===v?new F:v;let u,l,d=0,p=!1,h=!1;const m=new y({start(t){l=t},pull(){b()},cancel:t=>(h=!0,b(),i.cancel(t))});return async function(){const n=t.getReader();try{const t=new c(10);for(t.set(_t),await a.write(t);;){await g(),await a.ready;const{value:t,done:e}=await tn(n,s);if(e)break;await a.write(t)}f&&await a.write(new c(0));const r=new c(8),i=W(r);i.setUint32(0,f?f.get():o,!0),i.setUint32(4,e,!0),p=!0,await a.write(r),await a.close()}catch(t){await Yt(a,t),await $t(n,t)}}(),async function(){try{for(;;){const{value:t,done:n}=await S();if(n)break;if(d+=t.length,d>e)throw new r(Wt);f&&f.append(t),l.enqueue(t)}h||(h=!0,l.close())}catch(t){!function(t){h||(h=!0,l.error(t),b())}(t),await $t(i,t)}}(),m;function S(){return i.read().catch(t=>{if(p){if(!f)throw rn(t,Vt);if(d!=e)throw rn(t,Wt);return{done:!0}}throw nn(t,s)})}function g(){if(!h&&l.desiredSize<=0)return new w(t=>u=t)}function b(){if(u){const t=u;u=v,t()}}}(C,a,g,f,t)):C=function(t,n){const e=t.getReader();return new y({async pull(t){try{const{value:n,done:o}=await e.read();o?t.close():t.enqueue(n)}catch(t){throw await $t(e,t),nn(t,n)}},cancel:t=>e.cancel(t)})}(C,t)}i&&!z&&(b=new U,C=Qt(C,b)),Nt(this,C,()=>{if(b){const t=new u(b.value.buffer).getUint32(0,!1);if(f!=t)throw new r(Vt)}})}}const Zt=new f;function Nt(t,e,o){e=Qt(e,new h({flush:o})),n.defineProperty(t,"readable",{get:()=>e})}function qt(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function Gt(t,n,e){return t&&n?n:e&&e.requiresModule?e:void 0}function Jt(t,n,e,o,r,c){const s=n&&o?o:r||o,a=e.deflate64?"deflate64-raw":Kt;let i;try{i=new s(a,e)}catch(t){if(!n||!r||s==r)throw t;i=new r(a,e)}return Xt(t,i,c)}function Qt(t,n){return Dt(t).pipeThrough(n)}function Xt(t,n,e){const o=n.writable.getWriter(),r=t.getReader();return async function(){try{for(;;){await o.ready;const t=await tn(r,e);if(t.done){await o.close();break}await o.write(t.value)}}catch(t){await Yt(o,t),await $t(r,t)}}(),n.readable}async function Yt(t,n){try{await t.abort(n)}catch{}}async function $t(t,n){try{await t.cancel(n)}catch{}}function tn(t,n){const e=t.read();return n?e.catch(t=>{throw n.add(t),t}):e}function nn(t,n){return n.has(t)?t:rn(t,on(t)?Ot:"Invalid compressed data")}function en(t){return on(t)?rn(t,Ot):t}function on(t){return Ft(t)&&"Z_MEM_ERROR"==t.code}function rn(t,n){const e=new r(n);return e.cause=t,e}const cn="data",sn="deflate";class an extends h{constructor(t,e){super({});const o=this,{codecType:c}=t;let s;c.startsWith(sn)?s=jt:c.startsWith("inflate")&&(s=Lt),o.outputSize=0;let a=0;const i=new s(t,e),f=super.readable,u=new h({transform(t,n){t&&t.length&&(a+=t.length,n.enqueue(t))},flush(){n.assign(o,{inputSize:a})}}),w=new h({transform(n,e){if(n&&n.length&&(e.enqueue(n),o.outputSize+=n.length,t.outputSize!==v&&o.outputSize>t.outputSize))throw new r(Wt)},flush(){const{crc32:t}=i;n.assign(o,{crc32:t,inputSize:a})}});n.defineProperty(o,"readable",{get:()=>f.pipeThrough(u).pipeThrough(i).pipeThrough(w)})}}class fn extends h{constructor(t){const o=[];let r=0,s=0;function a(){const n=new c(t);let e=0;for(;e<t;){const r=o[0],c=t-e;r.length<=c?(n.set(r,e),e+=r.length,o.shift()):(n.set(r.subarray(0,c),e),o[0]=r.subarray(c),e+=c)}return r-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(o.push(n),r+=n.length;r>t;)s+=t,e.enqueue(a())},flush(t){r&&(s+=r,t.enqueue(function(t,n){const e=new c(n);let o=0;for(const n of t)e.set(n,o),o+=n.length;return e}(o,r)))}}),n.defineProperty(this,"outputSize",{get:()=>s})}}let un=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(un=navigator.hardwareConcurrency)}catch{}const wn=new f,ln=new f,dn=function(){try{return structuredClone(new r)instanceof r}catch{return!1}}();let pn=0;async function hn(t){let n,c,s;try{const{options:a,config:i}=t;if(a.format)try{await async function(t,n){!Ut.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:o}=n;if(typeof e!=k&&typeof o!=k)throw new r("Invalid codec module");Ut.set(t,{CompressionStream:e,DecompressionStream:o})}(t,await(import(n)))}(a.format,a.codecURI)}catch(t){if(Ft(t))try{t.codecImportFailed=!0}catch{}throw t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,a.compressed&&!a.format)if(a.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Zt.get(t);e||(e=new f,Zt.set(t,e));let o=e.get(n);if(o===v){try{new t(n),o=!0}catch{o=!1}e.set(n,o)}return o}(a.codecType.startsWith(sn)?i.CompressionStream:i.DecompressionStream,Kt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{a.useCompressionStream=!0}if(a.encrypted&&!a.zipCrypto)try{await self.initModule(t.config)}catch{}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const u={highWaterMark:1},l=t.readable?Dt(t.readable):new y({async pull(t){const n=new w(t=>wn.set(pn,t));yn({type:"pull",messageId:pn}),pn=(pn+1)%e.MAX_SAFE_INTEGER;const{value:o,done:r}=await n;t.enqueue(o),r&&t.close()}},u);s=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const o=new w(t=>n=t);ln.set(pn,n),yn({type:cn,value:t,messageId:pn}),pn=(pn+1)%e.MAX_SAFE_INTEGER,await o}},u),n=new an(a,i),c=new fn(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?o.max(r,64):65536;var n,r}(i)),await l.pipeThrough(n).pipeThrough(c).pipeTo(s,{preventClose:!0,preventAbort:!0}),await s.getWriter().close();const{crc32:d,inputSize:p,outputSize:h}=n;yn({type:"close",result:{crc32:d,inputSize:p,outputSize:h}})}catch(t){const n=c?c.outputSize:0;if(Ft(t))try{t.outputSize=n}catch{}if(s&&!s.locked)try{await s.getWriter().close()}catch{}mn(t,n)}}function yn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new c(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function mn(t,n){const{message:e,stack:o,code:c,name:s,outputSize:a,cause:i,codecImportFailed:f}=function(t=new r("Unknown error")){return Ft(t)?t:new r(String(t))}(t),u={message:e,stack:o,code:c,name:s,outputSize:a===v?n:a};if(Ft(i)&&(u.cause={name:i.name,message:i.message}),f&&(u.codecImportFailed=!0),dn)try{return void p({error:u,errorValue:{value:t}})}catch{}p({error:u})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:o,done:r}=t;try{if("start"==n&&hn(t),n==cn){const t=wn.get(e);wn.delete(e),t({value:o||new c,done:r})}if("ack"==n){const t=ln.get(e);ln.delete(e),t()}}catch(t){mn(t)}}),p({type:"ready"});const Sn="deflate",gn="deflate-raw",vn="deflate64-raw",bn="gzip",kn=[Sn,gn,bn],zn=[Sn,gn,bn,vn];let Cn,In,Mn,An,En;function Rn(t,n){return-4===n&&(t.code="Z_MEM_ERROR"),t}function xn(t,n,e={}){if(!(t?kn:zn).includes(n))throw new TypeError("Unsupported format: "+n);if(!Cn){const t=new r("WASM module not loaded");throw t.cause=En,t}const s="number"==typeof e.level?e.level:-1,a="number"==typeof e.outBuffer?e.outBuffer:65536,i="number"==typeof e.inBufferSize?e.inBufferSize:65536,f={M:0,in:0,inBufferSize:0,A:0,R:!1};let u,l,d,p,h=!0,S=!1;return function(){try{let e;if(f.M=In(a),f.in=In(i),f.inBufferSize=i,!f.M||!f.in)throw Rn(new r("allocation failed"),-4);if(t?(f.P=Cn.deflate_process,f.D=Cn.deflate_last_consumed,f.F=Cn.deflate_end,f.A=Cn.deflate_new(),e=n===bn?Cn.deflate_init_gzip(f.A,s):n===gn?Cn.deflate_init_raw(f.A,s):Cn.deflate_init(f.A,s)):n===vn?(f.P=Cn.inflate9_process,f.D=Cn.inflate9_last_consumed,f.F=Cn.inflate9_end,f.A=Cn.inflate9_new(),e=Cn.inflate9_init_raw(f.A)):(f.P=Cn.inflate_process,f.D=Cn.inflate_last_consumed,f.F=Cn.inflate_end,f.A=Cn.inflate_new(),e=n===gn?Cn.inflate_init_raw(f.A):n===bn?Cn.inflate_init_gzip(f.A):Cn.inflate_init(f.A)),0!==e)throw Rn(new r("init failed:"+e),e)}catch(t){throw b(f),t}}(),{readable:new y({start(t){u=t},pull(){h=!1,v()},cancel(t){S=!0,p=t,b(f),l.error(t),v()}},{highWaterMark:0}),writable:new m({start(t){l=t},async write(t){if(h&&await new w(t=>d=t),S)throw p;try{!function(t){const n=new c(An.buffer),e=f.P,s=f.D,i=f.M;let u=0;for(;u<t.length;){if(f.R)throw new r("trailing data after the end of the stream");const c=o.min(t.length-u,32768);if((!f.in||f.inBufferSize<c)&&(f.in&&Mn&&(Mn(f.in),f.in=0),f.in=In(c),f.inBufferSize=c,!f.in))throw Rn(new r("allocation failed"),-4);n.set(t.subarray(u,u+c),f.in);const w=e(f.A,f.in,c,i,a,0),l=w>>24&255,d=128&l?l-256:l;if(d<0)throw Rn(new r("process error:"+d),d);const p=16777215&w;p&&g(n.slice(i,i+p));const h=s(f.A);if(1===l)f.R=!0;else if(0===h&&0===p)break;u+=h}}(t)}catch(t){throw b(f),u.error(t),t}},close(){if(S)return;try{!function(){const t=new c(An.buffer),n=f.P,e=f.M;for(;;){const o=n(f.A,0,0,e,a,4),c=o>>24&255,s=128&c?c-256:c;if(s<0)throw Rn(new r("process error:"+s),s);const i=16777215&o;if(i&&g(t.slice(e,e+i)),1===c||0===i)break}}()}catch(t){throw b(f),u.error(t),t}const t=b(f);if(0!==t){const n=Rn(new r("end error:"+t),t);throw u.error(n),n}u.close()},abort(t){b(f),u.error(t)}},{highWaterMark:1})};function g(t){h=!0,u.enqueue(t)}function v(){if(d){const t=d;d=null,t()}}function b(t){let n=0;return t.A&&t.F&&(n=t.F(t.A)),t.A=0,t.in&&Mn&&Mn(t.in),t.in=0,t.M&&Mn&&Mn(t.M),t.M=0,n}}class Pn{constructor(t=Sn,n){return xn(!0,t,n)}}class Dn{constructor(t=Sn,n){return xn(!1,t,n)}}Pn.requiresModule=!0,Dn.requiresModule=!0,Pn.supportedFormats=kn,Dn.supportedFormats=zn;const Fn=65536;let Un,Bn;function Wn(t){return new c(t.memory.buffer)}let On=!1;!function(t={}){const{init:n,U:e}=t,o=t.CompressionStreamFallback||t.CompressionStreamZlib,r=t.DecompressionStreamFallback||t.DecompressionStreamZlib;e&&(dt=e||G),self.initModule=async t=>{n&&await n(t),o&&(t.CompressionStreamFallback=o),r&&(t.DecompressionStreamFallback=r)}}({CompressionStreamFallback:Pn,DecompressionStreamFallback:Dn,U:function(t,n){const e=Un;let o=e?function(t,n,e){Bn||(Bn=t.malloc(Fn));const o=Bn?t.aes_hmac_new():0;if(o){const r=Wn(t);if(r.set(n,Bn),r.set(e,Bn+n.length),t.aes_hmac_init(o,Bn,n.length,Bn+n.length,e.length))return t.aes_hmac_end(o,0),0}return o}(e,t,n):0;if(!o)return G(t,n);const r=Bn;return{process(t,n){for(let c=0;c<t.length;c+=Fn){const s=t.subarray(c,c+Fn),a=Wn(e);a.set(s,r),e.aes_hmac_process(o,r,s.length,n?1:0),s.set(a.subarray(r,r+s.length))}},digest:()=>(e.aes_hmac_end(o,r),o=0,Wn(e).slice(r,r+20)),dispose(){o&&(e.aes_hmac_end(o,0),o=0)}}},init:t=>async function(t,{baseURI:n}){if(!On)try{await async function(t,n){let e,o;try{try{o=new URL(t,n)}catch{}const r=await fetch(o);e=await r.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),o=e.length,r=new c(o);for(let t=0;t<o;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}const s=await WebAssembly.instantiate(e);var a;(function(t){if(Cn=t,({malloc:In,free:Mn,memory:An}=Cn),"function"!=typeof In||"function"!=typeof Mn||!An)throw Cn=In=Mn=An=null,new r("Invalid WASM module")})(s.instance.exports),typeof(a=s.instance.exports).aes_hmac_new==k&&(Un=a,Bn=0)}(t,n),On=!0}catch(t){throw function(t){En=t}(t),t}}(t.wasmURI,t)})});\n';
36920
37084
  if ("string" == typeof r2 && (r2 = new TextEncoder().encode(r2)), t4) {
36921
37085
  const t5 = new Blob([r2], { type: e3 });
36922
37086
  return URL.createObjectURL(t5);
@@ -36924,17 +37088,17 @@ var e = (t3) => t3({ workerURI: (t4) => {
36924
37088
  return "data:" + e3 + ";base64," + function(t5) {
36925
37089
  let e4 = "";
36926
37090
  const r3 = t5.length;
36927
- let s4 = 0;
36928
- for (; s4 + 2 < r3; s4 += 3) {
36929
- const r4 = t5[s4] << 16 | t5[s4 + 1] << 8 | t5[s4 + 2];
37091
+ let o2 = 0;
37092
+ for (; o2 + 2 < r3; o2 += 3) {
37093
+ const r4 = t5[o2] << 16 | t5[o2 + 1] << 8 | t5[o2 + 2];
36930
37094
  e4 += n[r4 >> 18 & 63] + n[r4 >> 12 & 63] + n[r4 >> 6 & 63] + n[63 & r4];
36931
37095
  }
36932
- const o2 = r3 - s4;
36933
- if (1 === o2) {
36934
- const r4 = t5[s4] << 16;
37096
+ const s4 = r3 - o2;
37097
+ if (1 === s4) {
37098
+ const r4 = t5[o2] << 16;
36935
37099
  e4 += n[r4 >> 18 & 63] + n[r4 >> 12 & 63] + "==";
36936
- } else if (2 === o2) {
36937
- const r4 = t5[s4] << 16 | t5[s4 + 1] << 8;
37100
+ } else if (2 === s4) {
37101
+ const r4 = t5[o2] << 16 | t5[o2 + 1] << 8;
36938
37102
  e4 += n[r4 >> 18 & 63] + n[r4 >> 12 & 63] + n[r4 >> 6 & 63] + "=";
36939
37103
  }
36940
37104
  return e4;
@@ -36953,6 +37117,7 @@ init_codec_worker();
36953
37117
  var MODULE_WORKER_OPTIONS = { type: "module" };
36954
37118
  var ERROR_EVENT_TYPE = "error";
36955
37119
  var MESSAGE_ERROR_EVENT_TYPE = "messageerror";
37120
+ var ABORT_EVENT_TYPE = "abort";
36956
37121
  var webWorkerSource;
36957
37122
  var webWorkerURI;
36958
37123
  var webWorkerOptions;
@@ -37117,6 +37282,13 @@ function watchClosedStream(writableSource, workerData) {
37117
37282
  Object.assign(workerData, { destinationFailed: true, destinationError: error2 });
37118
37283
  }
37119
37284
  });
37285
+ const { signal } = workerData.workerOptions.streamOptions;
37286
+ if (signal) {
37287
+ const onAbort = () => abortController.abort(signal.reason);
37288
+ const removeAbortListener = () => signal.removeEventListener(ABORT_EVENT_TYPE, onAbort);
37289
+ signal.addEventListener(ABORT_EVENT_TYPE, onAbort);
37290
+ closed.then(removeAbortListener, removeAbortListener);
37291
+ }
37120
37292
  return {
37121
37293
  writable,
37122
37294
  closed,
@@ -37365,9 +37537,6 @@ function getResponseError(errorData, errorValue) {
37365
37537
  responseError = errorValue.value;
37366
37538
  } else {
37367
37539
  responseError = Object.assign(new Error(message), { stack, code, name });
37368
- if (cause) {
37369
- responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
37370
- }
37371
37540
  }
37372
37541
  if (isErrorObject(responseError)) {
37373
37542
  try {
@@ -37377,6 +37546,9 @@ function getResponseError(errorData, errorValue) {
37377
37546
  if (codecImportFailed) {
37378
37547
  responseError.codecImportFailed = true;
37379
37548
  }
37549
+ if (cause && !isErrorObject(responseError.cause)) {
37550
+ responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
37551
+ }
37380
37552
  if (errorValue) {
37381
37553
  if (responseError.name !== name) {
37382
37554
  responseError.name = name;
@@ -38051,9 +38223,11 @@ function resolveMetadata(zipWriter, name, options) {
38051
38223
  const passThrough = checkPassThroughOption(getOptionValue2(zipWriter, options, OPTION_PASS_THROUGH));
38052
38224
  const passThroughCompression = Boolean(passThrough);
38053
38225
  const passThroughEncryption = passThrough === true;
38054
- const password = getOptionValue2(zipWriter, options, OPTION_PASSWORD);
38055
- const rawPassword = getOptionValue2(zipWriter, options, OPTION_RAW_PASSWORD);
38226
+ let password = getOptionValue2(zipWriter, options, OPTION_PASSWORD);
38227
+ let rawPassword = getOptionValue2(zipWriter, options, OPTION_RAW_PASSWORD);
38056
38228
  checkPasswordOption(password, rawPassword);
38229
+ password = password && password.length ? password : UNDEFINED_VALUE;
38230
+ rawPassword = rawPassword && rawPassword.length ? rawPassword : UNDEFINED_VALUE;
38057
38231
  const encryptionStrength = getNumberOptionValue(zipWriter, options, OPTION_ENCRYPTION_STRENGTH, 3);
38058
38232
  const zipCrypto = getOptionValue2(zipWriter, options, PROPERTY_NAME_ZIPCRYPTO);
38059
38233
  const extendedTimestamp = getOptionValue2(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
@@ -38564,6 +38738,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
38564
38738
  const result = await runWorker2({ readable, writable }, workerOptions);
38565
38739
  compressedSize = result.outputSize;
38566
38740
  writer.size += compressedSize;
38741
+ throwIfAborted(signal);
38567
38742
  if (!passThroughCompression) {
38568
38743
  uncompressedSize = result.inputSize;
38569
38744
  if (!encrypted || zipCrypto) {
@@ -39729,6 +39904,10 @@ var FORMAT_DEFLATE = "deflate";
39729
39904
  var FORMAT_DEFLATE_RAW2 = "deflate-raw";
39730
39905
  var FORMAT_DEFLATE64_RAW2 = "deflate64-raw";
39731
39906
  var FORMAT_GZIP2 = "gzip";
39907
+ var Z_MEM_ERROR = -4;
39908
+ var Z_MEM_ERROR_CODE2 = "Z_MEM_ERROR";
39909
+ var COMPRESSION_FORMATS = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2];
39910
+ var DECOMPRESSION_FORMATS = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2, FORMAT_DEFLATE64_RAW2];
39732
39911
  var wasm;
39733
39912
  var malloc;
39734
39913
  var free;
@@ -39745,7 +39924,16 @@ function setWasmExports(wasmAPI) {
39745
39924
  function setInitError(error2) {
39746
39925
  initError = error2;
39747
39926
  }
39927
+ function setZlibCode(error2, result) {
39928
+ if (result === Z_MEM_ERROR) {
39929
+ error2.code = Z_MEM_ERROR_CODE2;
39930
+ }
39931
+ return error2;
39932
+ }
39748
39933
  function _make(isCompress, type, options = {}) {
39934
+ if (!(isCompress ? COMPRESSION_FORMATS : DECOMPRESSION_FORMATS).includes(type)) {
39935
+ throw new TypeError("Unsupported format: " + type);
39936
+ }
39749
39937
  if (!wasm) {
39750
39938
  const error2 = new Error("WASM module not loaded");
39751
39939
  error2.cause = initError;
@@ -39754,147 +39942,208 @@ function _make(isCompress, type, options = {}) {
39754
39942
  const level = typeof options.level === "number" ? options.level : -1;
39755
39943
  const outBufferSize = typeof options.outBuffer === "number" ? options.outBuffer : 64 * 1024;
39756
39944
  const inBufferSize = typeof options.inBufferSize === "number" ? options.inBufferSize : 64 * 1024;
39757
- return new TransformStream({
39758
- start() {
39945
+ const state = { out: 0, in: 0, inBufferSize: 0, streamHandle: 0, streamEnded: false };
39946
+ let readableController, writableController, resolveWrite, cancelReason;
39947
+ let backpressure = true;
39948
+ let cancelled = false;
39949
+ initStream2();
39950
+ const readable = new ReadableStream({
39951
+ start(controller) {
39952
+ readableController = controller;
39953
+ },
39954
+ pull() {
39955
+ backpressure = false;
39956
+ resumeWrite();
39957
+ },
39958
+ cancel(reason) {
39959
+ cancelled = true;
39960
+ cancelReason = reason;
39961
+ disposeStream(state);
39962
+ writableController.error(reason);
39963
+ resumeWrite();
39964
+ }
39965
+ }, { highWaterMark: 0 });
39966
+ const writable = new WritableStream({
39967
+ start(controller) {
39968
+ writableController = controller;
39969
+ },
39970
+ async write(chunk) {
39971
+ if (backpressure) {
39972
+ await new Promise((resolve2) => resolveWrite = resolve2);
39973
+ }
39974
+ if (cancelled) {
39975
+ throw cancelReason;
39976
+ }
39759
39977
  try {
39760
- let result;
39761
- this.out = malloc(outBufferSize);
39762
- this.in = malloc(inBufferSize);
39763
- this.inBufferSize = inBufferSize;
39764
- if (!this.out || !this.in) {
39765
- throw new Error("allocation failed");
39766
- }
39767
- if (isCompress) {
39768
- this._process = wasm.deflate_process;
39769
- this._last_consumed = wasm.deflate_last_consumed;
39770
- this._end = wasm.deflate_end;
39771
- this.streamHandle = wasm.deflate_new();
39772
- if (type === FORMAT_GZIP2) {
39773
- result = wasm.deflate_init_gzip(this.streamHandle, level);
39774
- } else if (type === FORMAT_DEFLATE_RAW2) {
39775
- result = wasm.deflate_init_raw(this.streamHandle, level);
39776
- } else {
39777
- result = wasm.deflate_init(this.streamHandle, level);
39778
- }
39779
- } else {
39780
- if (type === FORMAT_DEFLATE64_RAW2) {
39781
- this._process = wasm.inflate9_process;
39782
- this._last_consumed = wasm.inflate9_last_consumed;
39783
- this._end = wasm.inflate9_end;
39784
- this.streamHandle = wasm.inflate9_new();
39785
- result = wasm.inflate9_init_raw(this.streamHandle);
39786
- } else {
39787
- this._process = wasm.inflate_process;
39788
- this._last_consumed = wasm.inflate_last_consumed;
39789
- this._end = wasm.inflate_end;
39790
- this.streamHandle = wasm.inflate_new();
39791
- if (type === FORMAT_DEFLATE_RAW2) {
39792
- result = wasm.inflate_init_raw(this.streamHandle);
39793
- } else if (type === FORMAT_GZIP2) {
39794
- result = wasm.inflate_init_gzip(this.streamHandle);
39795
- } else {
39796
- result = wasm.inflate_init(this.streamHandle);
39797
- }
39798
- }
39799
- }
39800
- if (result !== 0) {
39801
- throw new Error("init failed:" + result);
39802
- }
39978
+ processChunk(chunk);
39803
39979
  } catch (error2) {
39804
- disposeStream(this);
39980
+ disposeStream(state);
39981
+ readableController.error(error2);
39805
39982
  throw error2;
39806
39983
  }
39807
39984
  },
39808
- transform(chunk, controller) {
39985
+ close() {
39986
+ if (cancelled) {
39987
+ return;
39988
+ }
39809
39989
  try {
39810
- const buffer2 = chunk;
39811
- const heap = new Uint8Array(memory.buffer);
39812
- const process2 = this._process;
39813
- const last_consumed = this._last_consumed;
39814
- const out = this.out;
39815
- let offset = 0;
39816
- while (offset < buffer2.length) {
39817
- const toRead = Math.min(buffer2.length - offset, 32 * 1024);
39818
- if (!this.in || this.inBufferSize < toRead) {
39819
- if (this.in && free) {
39820
- free(this.in);
39821
- this.in = 0;
39822
- }
39823
- this.in = malloc(toRead);
39824
- this.inBufferSize = toRead;
39825
- if (!this.in) {
39826
- throw new Error("allocation failed");
39827
- }
39828
- }
39829
- heap.set(buffer2.subarray(offset, offset + toRead), this.in);
39830
- const result = process2(this.streamHandle, this.in, toRead, out, outBufferSize, 0);
39831
- const code = result >> 24 & 255;
39832
- const signedCode = code & 128 ? code - 256 : code;
39833
- if (signedCode < 0) {
39834
- throw new Error("process error:" + signedCode);
39835
- }
39836
- const prod = result & 16777215;
39837
- if (prod) {
39838
- controller.enqueue(heap.slice(out, out + prod));
39839
- }
39840
- const consumed = last_consumed(this.streamHandle);
39841
- if (consumed === 0 && prod === 0) {
39842
- break;
39843
- }
39844
- offset += consumed;
39845
- }
39990
+ flushStream();
39846
39991
  } catch (error2) {
39847
- disposeStream(this);
39848
- controller.error(error2);
39992
+ disposeStream(state);
39993
+ readableController.error(error2);
39994
+ throw error2;
39995
+ }
39996
+ const result = disposeStream(state);
39997
+ if (result !== 0) {
39998
+ const error2 = setZlibCode(new Error("end error:" + result), result);
39999
+ readableController.error(error2);
40000
+ throw error2;
39849
40001
  }
40002
+ readableController.close();
39850
40003
  },
39851
- flush(controller) {
39852
- try {
39853
- const heap = new Uint8Array(memory.buffer);
39854
- const process2 = this._process;
39855
- const out = this.out;
39856
- while (true) {
39857
- const result = process2(this.streamHandle, 0, 0, out, outBufferSize, 4);
39858
- const code = result >> 24 & 255;
39859
- const signedCode = code & 128 ? code - 256 : code;
39860
- if (signedCode < 0) {
39861
- throw new Error("process error:" + signedCode);
39862
- }
39863
- const produced = result & 16777215;
39864
- if (produced) {
39865
- controller.enqueue(heap.slice(out, out + produced));
39866
- }
39867
- if (code === 1 || produced === 0) {
39868
- break;
39869
- }
40004
+ abort(reason) {
40005
+ disposeStream(state);
40006
+ readableController.error(reason);
40007
+ }
40008
+ }, { highWaterMark: 1 });
40009
+ return { readable, writable };
40010
+ function initStream2() {
40011
+ try {
40012
+ let result;
40013
+ state.out = malloc(outBufferSize);
40014
+ state.in = malloc(inBufferSize);
40015
+ state.inBufferSize = inBufferSize;
40016
+ if (!state.out || !state.in) {
40017
+ throw setZlibCode(new Error("allocation failed"), Z_MEM_ERROR);
40018
+ }
40019
+ if (isCompress) {
40020
+ state._process = wasm.deflate_process;
40021
+ state._last_consumed = wasm.deflate_last_consumed;
40022
+ state._end = wasm.deflate_end;
40023
+ state.streamHandle = wasm.deflate_new();
40024
+ if (type === FORMAT_GZIP2) {
40025
+ result = wasm.deflate_init_gzip(state.streamHandle, level);
40026
+ } else if (type === FORMAT_DEFLATE_RAW2) {
40027
+ result = wasm.deflate_init_raw(state.streamHandle, level);
40028
+ } else {
40029
+ result = wasm.deflate_init(state.streamHandle, level);
39870
40030
  }
39871
- } catch (error2) {
39872
- controller.error(error2);
39873
- } finally {
39874
- const result = disposeStream(this);
39875
- if (result !== 0) {
39876
- controller.error(new Error("end error:" + result));
40031
+ } else {
40032
+ if (type === FORMAT_DEFLATE64_RAW2) {
40033
+ state._process = wasm.inflate9_process;
40034
+ state._last_consumed = wasm.inflate9_last_consumed;
40035
+ state._end = wasm.inflate9_end;
40036
+ state.streamHandle = wasm.inflate9_new();
40037
+ result = wasm.inflate9_init_raw(state.streamHandle);
40038
+ } else {
40039
+ state._process = wasm.inflate_process;
40040
+ state._last_consumed = wasm.inflate_last_consumed;
40041
+ state._end = wasm.inflate_end;
40042
+ state.streamHandle = wasm.inflate_new();
40043
+ if (type === FORMAT_DEFLATE_RAW2) {
40044
+ result = wasm.inflate_init_raw(state.streamHandle);
40045
+ } else if (type === FORMAT_GZIP2) {
40046
+ result = wasm.inflate_init_gzip(state.streamHandle);
40047
+ } else {
40048
+ result = wasm.inflate_init(state.streamHandle);
40049
+ }
39877
40050
  }
39878
40051
  }
39879
- },
39880
- cancel() {
39881
- disposeStream(this);
40052
+ if (result !== 0) {
40053
+ throw setZlibCode(new Error("init failed:" + result), result);
40054
+ }
40055
+ } catch (error2) {
40056
+ disposeStream(state);
40057
+ throw error2;
39882
40058
  }
39883
- });
39884
- function disposeStream(state) {
40059
+ }
40060
+ function processChunk(chunk) {
40061
+ const heap = new Uint8Array(memory.buffer);
40062
+ const process2 = state._process;
40063
+ const last_consumed = state._last_consumed;
40064
+ const out = state.out;
40065
+ let offset = 0;
40066
+ while (offset < chunk.length) {
40067
+ if (state.streamEnded) {
40068
+ throw new Error("trailing data after the end of the stream");
40069
+ }
40070
+ const toRead = Math.min(chunk.length - offset, 32 * 1024);
40071
+ if (!state.in || state.inBufferSize < toRead) {
40072
+ if (state.in && free) {
40073
+ free(state.in);
40074
+ state.in = 0;
40075
+ }
40076
+ state.in = malloc(toRead);
40077
+ state.inBufferSize = toRead;
40078
+ if (!state.in) {
40079
+ throw setZlibCode(new Error("allocation failed"), Z_MEM_ERROR);
40080
+ }
40081
+ }
40082
+ heap.set(chunk.subarray(offset, offset + toRead), state.in);
40083
+ const result = process2(state.streamHandle, state.in, toRead, out, outBufferSize, 0);
40084
+ const code = result >> 24 & 255;
40085
+ const signedCode = code & 128 ? code - 256 : code;
40086
+ if (signedCode < 0) {
40087
+ throw setZlibCode(new Error("process error:" + signedCode), signedCode);
40088
+ }
40089
+ const prod = result & 16777215;
40090
+ if (prod) {
40091
+ enqueue(heap.slice(out, out + prod));
40092
+ }
40093
+ const consumed = last_consumed(state.streamHandle);
40094
+ if (code === 1) {
40095
+ state.streamEnded = true;
40096
+ } else if (consumed === 0 && prod === 0) {
40097
+ break;
40098
+ }
40099
+ offset += consumed;
40100
+ }
40101
+ }
40102
+ function flushStream() {
40103
+ const heap = new Uint8Array(memory.buffer);
40104
+ const process2 = state._process;
40105
+ const out = state.out;
40106
+ while (true) {
40107
+ const result = process2(state.streamHandle, 0, 0, out, outBufferSize, 4);
40108
+ const code = result >> 24 & 255;
40109
+ const signedCode = code & 128 ? code - 256 : code;
40110
+ if (signedCode < 0) {
40111
+ throw setZlibCode(new Error("process error:" + signedCode), signedCode);
40112
+ }
40113
+ const produced = result & 16777215;
40114
+ if (produced) {
40115
+ enqueue(heap.slice(out, out + produced));
40116
+ }
40117
+ if (code === 1 || produced === 0) {
40118
+ break;
40119
+ }
40120
+ }
40121
+ }
40122
+ function enqueue(chunk) {
40123
+ backpressure = true;
40124
+ readableController.enqueue(chunk);
40125
+ }
40126
+ function resumeWrite() {
40127
+ if (resolveWrite) {
40128
+ const resolve2 = resolveWrite;
40129
+ resolveWrite = null;
40130
+ resolve2();
40131
+ }
40132
+ }
40133
+ function disposeStream(state2) {
39885
40134
  let endResult = 0;
39886
- if (state.streamHandle && state._end) {
39887
- endResult = state._end(state.streamHandle);
40135
+ if (state2.streamHandle && state2._end) {
40136
+ endResult = state2._end(state2.streamHandle);
39888
40137
  }
39889
- state.streamHandle = 0;
39890
- if (state.in && free) {
39891
- free(state.in);
40138
+ state2.streamHandle = 0;
40139
+ if (state2.in && free) {
40140
+ free(state2.in);
39892
40141
  }
39893
- state.in = 0;
39894
- if (state.out && free) {
39895
- free(state.out);
40142
+ state2.in = 0;
40143
+ if (state2.out && free) {
40144
+ free(state2.out);
39896
40145
  }
39897
- state.out = 0;
40146
+ state2.out = 0;
39898
40147
  return endResult;
39899
40148
  }
39900
40149
  }
@@ -39910,8 +40159,8 @@ var DecompressionStreamZlib = class {
39910
40159
  };
39911
40160
  CompressionStreamZlib.requiresModule = true;
39912
40161
  DecompressionStreamZlib.requiresModule = true;
39913
- CompressionStreamZlib.supportedFormats = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2];
39914
- DecompressionStreamZlib.supportedFormats = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2, FORMAT_DEFLATE64_RAW2];
40162
+ CompressionStreamZlib.supportedFormats = COMPRESSION_FORMATS;
40163
+ DecompressionStreamZlib.supportedFormats = DECOMPRESSION_FORMATS;
39915
40164
 
39916
40165
  // ../../node_modules/@zip.js/zip.js/lib/core/streams/zlib-wasm/aes-hmac-sha1-wasm.js
39917
40166
  init_constants();
@@ -40056,6 +40305,7 @@ init_constants();
40056
40305
  init_array();
40057
40306
  init_compatible_streams();
40058
40307
  init_error();
40308
+ var EMPTY_RAW_PASSWORD = new Uint8Array(0);
40059
40309
 
40060
40310
  // ../../node_modules/@zip.js/zip.js/lib/zip-fs-wasm.js
40061
40311
  e(setDefaultConfiguration);
@@ -42149,33 +42399,60 @@ var unzipArchive = (cwd, input, output) => new SourceArchiveExtractor(cwd, input
42149
42399
 
42150
42400
  // ../linkque-agent-runtime-trace/dist/esm/utils.js
42151
42401
  var decodeAnyValue = (value) => {
42152
- if (!value)
42402
+ if (value === void 0 || value === null)
42153
42403
  return void 0;
42154
- if (value.stringValue !== void 0)
42404
+ if (typeof value !== "object" || Array.isArray(value))
42405
+ throw new TypeError("Invalid OTLP AnyValue");
42406
+ if (value.stringValue !== void 0) {
42407
+ if (typeof value.stringValue !== "string")
42408
+ throw new TypeError("Invalid OTLP string");
42155
42409
  return value.stringValue;
42156
- if (value.intValue !== void 0)
42157
- return Number(value.intValue);
42158
- if (value.doubleValue !== void 0)
42410
+ }
42411
+ if (value.intValue !== void 0) {
42412
+ if (!/^-?[0-9]+$/.test(String(value.intValue)))
42413
+ throw new TypeError("Invalid OTLP integer");
42414
+ const number4 = Number(value.intValue);
42415
+ if (!Number.isFinite(number4))
42416
+ throw new TypeError("Invalid OTLP integer");
42417
+ return number4;
42418
+ }
42419
+ if (value.doubleValue !== void 0) {
42420
+ if (typeof value.doubleValue !== "number" || !Number.isFinite(value.doubleValue))
42421
+ throw new TypeError("Invalid OTLP number");
42159
42422
  return value.doubleValue;
42160
- if (value.boolValue !== void 0)
42423
+ }
42424
+ if (value.boolValue !== void 0) {
42425
+ if (typeof value.boolValue !== "boolean")
42426
+ throw new TypeError("Invalid OTLP boolean");
42161
42427
  return value.boolValue;
42162
- if (value.bytesValue !== void 0)
42428
+ }
42429
+ if (value.bytesValue !== void 0) {
42430
+ if (typeof value.bytesValue !== "string")
42431
+ throw new TypeError("Invalid OTLP bytes");
42163
42432
  return { __otlpBytes: true, base64: value.bytesValue };
42433
+ }
42164
42434
  if (value.arrayValue)
42165
42435
  return value.arrayValue.values.map((child) => decodeAnyValue(child));
42166
42436
  if (value.kvlistValue) {
42167
- const record2 = {};
42168
- for (const { key, value: child } of value.kvlistValue.values)
42437
+ const record2 = /* @__PURE__ */ Object.create(null);
42438
+ for (const { key, value: child } of value.kvlistValue.values) {
42439
+ if (typeof key !== "string")
42440
+ throw new TypeError("Invalid OTLP key");
42169
42441
  record2[key] = decodeAnyValue(child);
42442
+ }
42170
42443
  return record2;
42171
42444
  }
42172
42445
  return void 0;
42173
42446
  };
42174
42447
  var decodeAttributes = (attrs) => {
42175
- const out = {};
42176
- if (!Array.isArray(attrs))
42448
+ const out = /* @__PURE__ */ Object.create(null);
42449
+ if (attrs === void 0 || attrs === null)
42177
42450
  return out;
42451
+ if (!Array.isArray(attrs))
42452
+ throw new TypeError("Invalid OTLP attributes");
42178
42453
  for (const { key, value } of attrs) {
42454
+ if (typeof key !== "string")
42455
+ throw new TypeError("Invalid OTLP attribute key");
42179
42456
  const decoded = decodeAnyValue(value);
42180
42457
  if (decoded !== void 0)
42181
42458
  out[key] = decoded;
@@ -42186,13 +42463,36 @@ var nanoToMs = (nano) => {
42186
42463
  if (!nano || !/^[0-9]+$/.test(nano))
42187
42464
  return void 0;
42188
42465
  try {
42189
- return Number(BigInt(nano) / 1000000n);
42466
+ const milliseconds = Number(BigInt(nano) / 1000000n);
42467
+ return Number.isSafeInteger(milliseconds) ? milliseconds : void 0;
42190
42468
  } catch {
42191
42469
  return void 0;
42192
42470
  }
42193
42471
  };
42194
42472
 
42195
42473
  // ../linkque-agent-runtime-trace/dist/esm/decode.js
42474
+ function validateMetadata(attrs) {
42475
+ for (const key of [
42476
+ ETelemetryAttribute.LINKQUE_OPERATION_NAME,
42477
+ ETelemetryAttribute.LINKQUE_OPERATION_PARENT_ID,
42478
+ "gen_ai.request.model"
42479
+ ]) {
42480
+ if (attrs[key] !== void 0 && typeof attrs[key] !== "string")
42481
+ throw new TypeError(`Invalid ${key}`);
42482
+ }
42483
+ for (const key of [
42484
+ "gen_ai.usage.input_tokens",
42485
+ "gen_ai.usage.output_tokens",
42486
+ "gen_ai.usage.total_tokens"
42487
+ ]) {
42488
+ const value = attrs[key];
42489
+ if (value !== void 0 && (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0))
42490
+ throw new TypeError(`Invalid ${key}`);
42491
+ }
42492
+ const reasons = attrs[ETelemetryAttribute.GEN_AI_RESPONSE_FINISH_REASONS];
42493
+ if (reasons !== void 0 && (!Array.isArray(reasons) || reasons.some((value) => typeof value !== "string")))
42494
+ throw new TypeError("Invalid finish reasons");
42495
+ }
42196
42496
  var strAttr = (attrs, key) => {
42197
42497
  const value = attrs[key];
42198
42498
  return typeof value === "string" && value !== "" ? value : void 0;
@@ -42212,12 +42512,26 @@ var identityFromAttributes = (source, attrs, span) => {
42212
42512
  };
42213
42513
  var decodeLogRecord = (source, record2, byteRange, push) => {
42214
42514
  const attributes = decodeAttributes(record2.attributes);
42515
+ validateMetadata(attributes);
42215
42516
  const rawName = record2.eventName ?? record2.name;
42216
42517
  const name = typeof rawName === "string" && rawName ? rawName : void 0;
42217
42518
  const identity = identityFromAttributes(source, attributes);
42218
42519
  const startedAt = nanoToMs(record2.timeUnixNano);
42219
42520
  const outcome = strAttr(attributes, ETelemetryAttribute.HARNESS_OPERATION_OUTCOME);
42220
42521
  const body = record2.body !== void 0 ? decodeAnyValue(record2.body) : void 0;
42522
+ if (name === "linkque.content.recorded") {
42523
+ if (!body || typeof body !== "object" || Array.isArray(body))
42524
+ throw new TypeError("Invalid content envelope");
42525
+ const content = body;
42526
+ if (typeof content.section !== "string" || !content.section)
42527
+ throw new TypeError("Invalid content section");
42528
+ if (content.valueJson !== void 0 && typeof content.valueJson !== "string")
42529
+ throw new TypeError("Invalid encoded content");
42530
+ if (content.chunkIndex !== void 0 && (typeof content.chunkIndex !== "number" || !Number.isSafeInteger(content.chunkIndex) || content.chunkIndex < 0))
42531
+ throw new TypeError("Invalid content chunk");
42532
+ if (content.final !== void 0 && typeof content.final !== "boolean")
42533
+ throw new TypeError("Invalid content terminal");
42534
+ }
42221
42535
  if (body && typeof body === "object" && "valueJson" in body) {
42222
42536
  const content = body;
42223
42537
  try {
@@ -42240,9 +42554,10 @@ var decodeLogRecord = (source, record2, byteRange, push) => {
42240
42554
  };
42241
42555
  var decodeSpan = (source, span, byteRange, push) => {
42242
42556
  const attributes = decodeAttributes(span.attributes);
42557
+ validateMetadata(attributes);
42243
42558
  const spanId = {
42244
- traceId: span.traceId,
42245
- spanId: span.spanId
42559
+ traceId: typeof span.traceId === "string" ? span.traceId : void 0,
42560
+ spanId: typeof span.spanId === "string" ? span.spanId : void 0
42246
42561
  };
42247
42562
  const identity = identityFromAttributes(source, attributes, spanId);
42248
42563
  const startedAt = nanoToMs(span.startTimeUnixNano);
@@ -42274,7 +42589,10 @@ var decodeSpan = (source, span, byteRange, push) => {
42274
42589
  const events = span.events;
42275
42590
  if (Array.isArray(events)) {
42276
42591
  for (const event of events) {
42592
+ if (!event || typeof event.name !== "string")
42593
+ throw new TypeError("Invalid span event");
42277
42594
  const eventAttributes = decodeAttributes(event.attributes);
42595
+ validateMetadata(eventAttributes);
42278
42596
  for (const key of [
42279
42597
  ETelemetryAttribute.HARNESS_ADVANCE_ID,
42280
42598
  ETelemetryAttribute.LINKQUE_CONVERSATION_ID,
@@ -42304,46 +42622,44 @@ function decodeOtlpLine(line, source, byteRange) {
42304
42622
  } catch {
42305
42623
  return { facts: [], warnings: ["json_parse_failed"] };
42306
42624
  }
42307
- if (!json || typeof json !== "object") {
42625
+ if (!json || typeof json !== "object" || Array.isArray(json)) {
42308
42626
  return { facts: [], warnings: ["not_an_object"] };
42309
42627
  }
42310
42628
  const root = json;
42311
42629
  const facts = [];
42312
- const push = (fact) => {
42313
- facts.push(fact);
42314
- };
42315
- if (source === "logs") {
42316
- const resourceLogs = root.resourceLogs;
42317
- if (Array.isArray(resourceLogs)) {
42318
- for (const entry of resourceLogs) {
42319
- if (!entry || typeof entry !== "object")
42320
- continue;
42321
- for (const scope of entry.scopeLogs ?? []) {
42322
- if (!scope || typeof scope !== "object")
42323
- continue;
42324
- for (const record2 of scope.logRecords ?? [])
42325
- decodeLogRecord(source, record2, byteRange, push);
42326
- }
42327
- }
42328
- } else {
42329
- warnings.push("logs_without_resourceLogs");
42630
+ const objects = (value, label) => {
42631
+ if (!Array.isArray(value)) {
42632
+ if (value !== void 0)
42633
+ warnings.push(`invalid_${label}`);
42634
+ return [];
42330
42635
  }
42636
+ return value.filter((item) => {
42637
+ if (item && typeof item === "object" && !Array.isArray(item))
42638
+ return true;
42639
+ warnings.push(`invalid_${label}_entry`);
42640
+ return false;
42641
+ });
42642
+ };
42643
+ const logs = source === "logs";
42644
+ const resourceKey = logs ? "resourceLogs" : "resourceSpans";
42645
+ const scopeKey = logs ? "scopeLogs" : "scopeSpans";
42646
+ const recordKey = logs ? "logRecords" : "spans";
42647
+ if (!Array.isArray(root[resourceKey])) {
42648
+ warnings.push(logs ? "logs_without_resourceLogs" : "traces_without_resourceSpans");
42331
42649
  return { facts, warnings };
42332
42650
  }
42333
- const resourceSpans = root.resourceSpans;
42334
- if (Array.isArray(resourceSpans)) {
42335
- for (const entry of resourceSpans) {
42336
- if (!entry || typeof entry !== "object")
42337
- continue;
42338
- for (const scope of entry.scopeSpans ?? []) {
42339
- if (!scope || typeof scope !== "object")
42340
- continue;
42341
- for (const span of scope.spans ?? [])
42342
- decodeSpan(source, span, byteRange, push);
42651
+ for (const resource of objects(root[resourceKey], resourceKey)) {
42652
+ for (const scope of objects(resource[scopeKey], scopeKey)) {
42653
+ for (const record2 of objects(scope[recordKey], recordKey)) {
42654
+ const decoded = [];
42655
+ try {
42656
+ (logs ? decodeLogRecord : decodeSpan)(source, record2, byteRange, (fact) => decoded.push(fact));
42657
+ facts.push(...decoded);
42658
+ } catch {
42659
+ warnings.push(`invalid_${recordKey}_record`);
42660
+ }
42343
42661
  }
42344
42662
  }
42345
- } else {
42346
- warnings.push("traces_without_resourceSpans");
42347
42663
  }
42348
42664
  return { facts, warnings };
42349
42665
  }
@@ -42380,7 +42696,7 @@ var buildOperations = (facts) => {
42380
42696
  const operations = [];
42381
42697
  const relations = [];
42382
42698
  for (const group of groups.values()) {
42383
- const attrs = {};
42699
+ const attrs = /* @__PURE__ */ Object.create(null);
42384
42700
  for (const fact of group)
42385
42701
  Object.assign(attrs, fact.attributes);
42386
42702
  const starts = group.filter((f3) => f3.kind === "span" || f3.name?.endsWith(".started")).map((f3) => f3.startedAt).filter((n3) => n3 !== void 0);
@@ -42410,7 +42726,10 @@ var buildOperations = (facts) => {
42410
42726
  relation: "parent"
42411
42727
  });
42412
42728
  }
42413
- const spanOperations = new Map(facts.filter((f3) => f3.kind === "span" && f3.identity.operationId).map((f3) => [`${f3.identity.traceId}:${f3.identity.spanId}`, f3.identity.operationId]));
42729
+ const spanOperations = new Map(facts.filter((f3) => f3.kind === "span" && f3.identity.operationId).map((f3) => [
42730
+ `${f3.identity.traceId}:${f3.identity.spanId}`,
42731
+ f3.identity.operationId
42732
+ ]));
42414
42733
  const linkKeys = /* @__PURE__ */ new Set();
42415
42734
  for (const fact of facts) {
42416
42735
  if (!fact.identity.operationId)
@@ -42423,7 +42742,11 @@ var buildOperations = (facts) => {
42423
42742
  if (linkKeys.has(key))
42424
42743
  continue;
42425
42744
  linkKeys.add(key);
42426
- relations.push({ fromOperationId: source, toOperationId: fact.identity.operationId, relation: link3.relation });
42745
+ relations.push({
42746
+ fromOperationId: source,
42747
+ toOperationId: fact.identity.operationId,
42748
+ relation: link3.relation
42749
+ });
42427
42750
  }
42428
42751
  }
42429
42752
  operations.sort((a, b3) => (a.startedAt ?? Infinity) - (b3.startedAt ?? Infinity) || a.operationId.localeCompare(b3.operationId));
@@ -42515,9 +42838,17 @@ ${body.section}`;
42515
42838
  ...operationId ? { operationId } : {},
42516
42839
  section: body.section,
42517
42840
  contentRef,
42841
+ ...body.reason === "content_limit" ? { reason: "content_limit" } : {},
42518
42842
  valueDigest: (0, import_node_crypto2.createHash)("sha256").update(JSON.stringify(body.value) ?? "").digest("hex"),
42519
42843
  ...body.value && typeof body.value === "object" && (body.section.endsWith(".output") || body.section === "knowledge.input") ? {
42520
- result: Object.fromEntries(Object.entries(body.value).filter(([key, value]) => ["status", "name", "isError", "action", "server", "knowledgeBaseId"].includes(key) && ["string", "boolean"].includes(typeof value)))
42844
+ result: Object.fromEntries(Object.entries(body.value).filter(([key, value]) => [
42845
+ "status",
42846
+ "name",
42847
+ "isError",
42848
+ "action",
42849
+ "server",
42850
+ "knowledgeBaseId"
42851
+ ].includes(key) && ["string", "boolean"].includes(typeof value)))
42521
42852
  } : {},
42522
42853
  availability: body.availability === "available" ? "available" : body.availability === "partial" ? "partial" : body.availability === "unavailable" ? "unavailable" : "not_recorded"
42523
42854
  });
@@ -42532,7 +42863,12 @@ ${body.section}`;
42532
42863
  byKey.set(key, {
42533
42864
  operationId,
42534
42865
  section: "model.output",
42535
- contentRef: { advanceId, operationId, section: "model.output", recordIds: chunks.map((chunk) => chunk.identity.recordId) },
42866
+ contentRef: {
42867
+ advanceId,
42868
+ operationId,
42869
+ section: "model.output",
42870
+ recordIds: chunks.map((chunk) => chunk.identity.recordId)
42871
+ },
42536
42872
  availability: complete ? "available" : "partial"
42537
42873
  });
42538
42874
  }
@@ -42592,7 +42928,10 @@ var parseDetailRef = (ref) => {
42592
42928
  return void 0;
42593
42929
  if (decoded.runId !== void 0 && typeof decoded.runId !== "string")
42594
42930
  return void 0;
42595
- if (decoded.readWindow !== void 0 && (!Array.isArray(decoded.readWindow) || decoded.readWindow.length > 8 || decoded.readWindow.some((entry) => !entry || !["logs", "traces"].includes(entry.source) || !Number.isSafeInteger(entry.bytes) || entry.bytes < 0 || !/^[a-f0-9]{64}$/.test(entry.digest)))) return void 0;
42931
+ if (decoded.readWindow !== void 0 && (!Array.isArray(decoded.readWindow) || decoded.readWindow.length > 8 || decoded.readWindow.some(
42932
+ (entry) => !entry || !["logs", "traces"].includes(entry.source) || !Number.isSafeInteger(entry.bytes) || entry.bytes < 0 || !/^[a-f0-9]{64}$/.test(entry.digest)
42933
+ )))
42934
+ return void 0;
42596
42935
  return {
42597
42936
  readWindow: decoded.readWindow,
42598
42937
  advanceId: decoded.advanceId,
@@ -42657,13 +42996,20 @@ async function scanRetainedLogs(cwd, pinned) {
42657
42996
  let complete = content.subarray(0, content.lastIndexOf(10) + 1);
42658
42997
  let window;
42659
42998
  if (pinned) {
42660
- window = [...remaining].find((entry) => entry.source === source && content.length >= entry.bytes && (0, import_node_crypto3.createHash)("sha256").update(content.subarray(0, entry.bytes)).digest("hex") === entry.digest);
42999
+ window = [...remaining].find(
43000
+ (entry) => entry.source === source && content.length >= entry.bytes && (0, import_node_crypto3.createHash)("sha256").update(content.subarray(0, entry.bytes)).digest("hex") === entry.digest
43001
+ );
42661
43002
  if (!window) continue;
42662
43003
  remaining.delete(window);
42663
43004
  complete = content.subarray(0, window.bytes);
42664
43005
  } else {
42665
- if (complete.length !== content.length) warnings.push("incomplete_tail");
42666
- window = { source, bytes: complete.length, digest: (0, import_node_crypto3.createHash)("sha256").update(complete).digest("hex") };
43006
+ if (complete.length !== content.length)
43007
+ warnings.push("incomplete_tail");
43008
+ window = {
43009
+ source,
43010
+ bytes: complete.length,
43011
+ digest: (0, import_node_crypto3.createHash)("sha256").update(complete).digest("hex")
43012
+ };
42667
43013
  }
42668
43014
  readWindow.push(window);
42669
43015
  const decoded = scanFile(complete.toString("utf8"), source);
@@ -42807,7 +43153,10 @@ ${g2.identity.runId ?? ""}` === latestRun.runKey
42807
43153
  var scanExecution = async (input) => {
42808
43154
  const identity = input.detailRef === void 0 ? void 0 : parseDetailRef(input.detailRef);
42809
43155
  if (input.detailRef !== void 0 && !identity) return null;
42810
- const { facts, warnings, readWindow } = await scanRetainedLogs(input.cwd, identity?.readWindow);
43156
+ const { facts, warnings, readWindow } = await scanRetainedLogs(
43157
+ input.cwd,
43158
+ identity?.readWindow
43159
+ );
42811
43160
  if (warnings.includes("read_window_expired")) return null;
42812
43161
  if (identity) {
42813
43162
  const filtered = facts.filter(
@@ -42815,13 +43164,22 @@ var scanExecution = async (input) => {
42815
43164
  );
42816
43165
  if (!filtered.length) return null;
42817
43166
  const { readWindow: _window, ...executionIdentity } = identity;
42818
- const snapshot2 = summarize({ identity: executionIdentity, facts: filtered, observation: { warnings } });
43167
+ const snapshot2 = summarize({
43168
+ identity: executionIdentity,
43169
+ facts: filtered,
43170
+ observation: { warnings }
43171
+ });
42819
43172
  return { ...snapshot2, detailRef: input.detailRef };
42820
43173
  }
42821
43174
  const selected = selectLatestAdvance(facts, input.threadId, input.runId);
42822
43175
  if (!selected) return null;
42823
43176
  const snapshot = summarize({ ...selected, observation: { warnings } });
42824
- return { ...snapshot, detailRef: Buffer.from(JSON.stringify({ ...selected.identity, readWindow })).toString("base64") };
43177
+ return {
43178
+ ...snapshot,
43179
+ detailRef: Buffer.from(
43180
+ JSON.stringify({ ...selected.identity, readWindow })
43181
+ ).toString("base64")
43182
+ };
42825
43183
  };
42826
43184
 
42827
43185
  // src/commands/runs/contentScanner.ts
@@ -42854,22 +43212,36 @@ var scanContent = async (input) => {
42854
43212
  if (value !== void 0 && (typeof value !== "string" || !value))
42855
43213
  return null;
42856
43214
  }
42857
- if (contentRef.recordIds !== void 0 && (!Array.isArray(contentRef.recordIds) || !contentRef.recordIds.length || contentRef.recordIds.length > 128 || contentRef.recordIds.some((id) => typeof id !== "string" || !id))) return null;
43215
+ if (contentRef.recordIds !== void 0 && (!Array.isArray(contentRef.recordIds) || !contentRef.recordIds.length || contentRef.recordIds.length > 128 || contentRef.recordIds.some((id) => typeof id !== "string" || !id)))
43216
+ return null;
42858
43217
  if (input.cursor !== void 0 && !/^(0|[1-9][0-9]*)$/.test(input.cursor))
42859
43218
  return null;
42860
43219
  if (input.maxBytes !== void 0 && (!Number.isSafeInteger(input.maxBytes) || input.maxBytes < 1))
42861
43220
  return null;
42862
- const { facts, warnings } = await scanRetainedLogs(input.cwd, identity.readWindow);
42863
- if (warnings.includes("read_window_expired")) return { availability: "unavailable" };
43221
+ const { facts, warnings } = await scanRetainedLogs(
43222
+ input.cwd,
43223
+ identity.readWindow
43224
+ );
43225
+ if (warnings.includes("read_window_expired"))
43226
+ return { availability: "unavailable" };
42864
43227
  let matched = facts.find(
42865
43228
  (f3) => f3.name === ETelemetryEventName.CONTENT_RECORDED && (!identity.threadId || f3.identity.threadId === identity.threadId) && (!identity.advanceId || f3.identity.advanceId === identity.advanceId) && (!identity.runId || f3.identity.runId === identity.runId) && matchContentRef(f3, contentRef)
42866
43229
  );
42867
43230
  if (contentRef.recordIds) {
42868
- const byRecord = new Map(facts.filter((f3) => f3.name === ETelemetryEventName.CONTENT_RECORDED && f3.identity.advanceId === identity.advanceId && (!identity.threadId || f3.identity.threadId === identity.threadId) && (!identity.runId || f3.identity.runId === identity.runId) && f3.identity.operationId === contentRef.operationId).map((f3) => [f3.identity.recordId, f3]));
43231
+ const byRecord = new Map(
43232
+ facts.filter(
43233
+ (f3) => f3.name === ETelemetryEventName.CONTENT_RECORDED && f3.identity.advanceId === identity.advanceId && (!identity.threadId || f3.identity.threadId === identity.threadId) && (!identity.runId || f3.identity.runId === identity.runId) && f3.identity.operationId === contentRef.operationId
43234
+ ).map((f3) => [f3.identity.recordId, f3])
43235
+ );
42869
43236
  const chunks = contentRef.recordIds.map((id) => byRecord.get(id));
42870
43237
  if (chunks.some((chunk) => !chunk)) return { availability: "unavailable" };
42871
- const values = chunks.map((chunk) => chunk.body);
42872
- if (values.some((value) => value.section !== "model.output" || typeof value.value !== "string")) return null;
43238
+ const values = chunks.map(
43239
+ (chunk) => chunk.body
43240
+ );
43241
+ if (values.some(
43242
+ (value) => value.section !== "model.output" || typeof value.value !== "string"
43243
+ ))
43244
+ return null;
42873
43245
  const prefix = [];
42874
43246
  for (const value of values) {
42875
43247
  if (value.chunkIndex !== prefix.length) break;
@@ -42877,7 +43249,13 @@ var scanContent = async (input) => {
42877
43249
  }
42878
43250
  if (!prefix.length) return { availability: "unavailable" };
42879
43251
  const complete = prefix.length === values.length && prefix.at(-1)?.final && prefix.at(-1)?.availability === "available";
42880
- matched = { ...chunks[0], body: { value: prefix.map((value) => value.value).join(""), availability: complete ? "available" : "partial" } };
43252
+ matched = {
43253
+ ...chunks[0],
43254
+ body: {
43255
+ value: prefix.map((value) => value.value).join(""),
43256
+ availability: complete ? "available" : "partial"
43257
+ }
43258
+ };
42881
43259
  }
42882
43260
  if (!matched) {
42883
43261
  return { availability: "unavailable" };