@probelabs/probe 0.6.0-rc324 → 0.6.0-rc329

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.
@@ -16451,6 +16451,70 @@ function convertUint8ArrayToBase64(array2) {
16451
16451
  function convertToBase64(value) {
16452
16452
  return value instanceof Uint8Array ? convertUint8ArrayToBase64(value) : value;
16453
16453
  }
16454
+ async function cancelResponseBody(response) {
16455
+ var _a22;
16456
+ try {
16457
+ await ((_a22 = response.body) == null ? void 0 : _a22.cancel());
16458
+ } catch (e) {
16459
+ }
16460
+ }
16461
+ function isNodeDefaultFetch(fetch2) {
16462
+ const source = Function.prototype.toString.call(fetch2);
16463
+ return source.includes("internal/deps/undici") || source.includes("lazy loading of undici");
16464
+ }
16465
+ async function readResponseWithSizeLimit({
16466
+ response,
16467
+ url: url2,
16468
+ maxBytes = DEFAULT_MAX_DOWNLOAD_SIZE
16469
+ }) {
16470
+ const contentLength = response.headers.get("content-length");
16471
+ if (contentLength != null) {
16472
+ const length = parseInt(contentLength, 10);
16473
+ if (!isNaN(length) && length > maxBytes) {
16474
+ await cancelResponseBody(response);
16475
+ throw new DownloadError({
16476
+ url: url2,
16477
+ message: `Download of ${url2} exceeded maximum size of ${maxBytes} bytes (Content-Length: ${length}).`
16478
+ });
16479
+ }
16480
+ }
16481
+ const body = response.body;
16482
+ if (body == null) {
16483
+ return new Uint8Array(0);
16484
+ }
16485
+ const reader = body.getReader();
16486
+ const chunks = [];
16487
+ let totalBytes = 0;
16488
+ try {
16489
+ while (true) {
16490
+ const { done, value } = await reader.read();
16491
+ if (done) {
16492
+ break;
16493
+ }
16494
+ totalBytes += value.length;
16495
+ if (totalBytes > maxBytes) {
16496
+ throw new DownloadError({
16497
+ url: url2,
16498
+ message: `Download of ${url2} exceeded maximum size of ${maxBytes} bytes.`
16499
+ });
16500
+ }
16501
+ chunks.push(value);
16502
+ }
16503
+ } finally {
16504
+ try {
16505
+ await reader.cancel();
16506
+ } finally {
16507
+ reader.releaseLock();
16508
+ }
16509
+ }
16510
+ const result = new Uint8Array(totalBytes);
16511
+ let offset2 = 0;
16512
+ for (const chunk of chunks) {
16513
+ result.set(chunk, offset2);
16514
+ offset2 += chunk.length;
16515
+ }
16516
+ return result;
16517
+ }
16454
16518
  function isAbortError(error40) {
16455
16519
  return (error40 instanceof Error || error40 instanceof DOMException) && (error40.name === "AbortError" || error40.name === "ResponseAborted" || // Next.js
16456
16520
  error40.name === "TimeoutError");
@@ -16543,6 +16607,40 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
16543
16607
  );
16544
16608
  return Object.fromEntries(normalizedHeaders.entries());
16545
16609
  }
16610
+ function injectJsonInstruction({
16611
+ prompt,
16612
+ schema,
16613
+ schemaPrefix = schema != null ? DEFAULT_SCHEMA_PREFIX : void 0,
16614
+ schemaSuffix = schema != null ? DEFAULT_SCHEMA_SUFFIX : DEFAULT_GENERIC_SUFFIX
16615
+ }) {
16616
+ return [
16617
+ prompt != null && prompt.length > 0 ? prompt : void 0,
16618
+ prompt != null && prompt.length > 0 ? "" : void 0,
16619
+ // add a newline if prompt is not null
16620
+ schemaPrefix,
16621
+ schema != null ? JSON.stringify(schema) : void 0,
16622
+ schemaSuffix
16623
+ ].filter((line) => line != null).join("\n");
16624
+ }
16625
+ function injectJsonInstructionIntoMessages({
16626
+ messages,
16627
+ schema,
16628
+ schemaPrefix,
16629
+ schemaSuffix
16630
+ }) {
16631
+ var _a22, _b22;
16632
+ const systemMessage = ((_a22 = messages[0]) == null ? void 0 : _a22.role) === "system" ? { ...messages[0] } : { role: "system", content: "" };
16633
+ systemMessage.content = injectJsonInstruction({
16634
+ prompt: systemMessage.content,
16635
+ schema,
16636
+ schemaPrefix,
16637
+ schemaSuffix
16638
+ });
16639
+ return [
16640
+ systemMessage,
16641
+ ...((_b22 = messages[0]) == null ? void 0 : _b22.role) === "system" ? messages.slice(1) : messages
16642
+ ];
16643
+ }
16546
16644
  function loadOptionalSetting({
16547
16645
  settingValue,
16548
16646
  environmentVariableName
@@ -17462,15 +17560,26 @@ function isSchema(value) {
17462
17560
  return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;
17463
17561
  }
17464
17562
  function asSchema(schema) {
17465
- return schema == null ? jsonSchema({ properties: {}, additionalProperties: false }) : isSchema(schema) ? schema : "~standard" in schema ? schema["~standard"].vendor === "zod" ? zodSchema(schema) : standardSchema(schema) : schema();
17563
+ return schema == null ? jsonSchema({
17564
+ type: "object",
17565
+ properties: {},
17566
+ additionalProperties: false
17567
+ }) : isSchema(schema) ? schema : "~standard" in schema ? schema["~standard"].vendor === "zod" ? zodSchema(schema) : standardSchema(schema) : schema();
17466
17568
  }
17467
17569
  function standardSchema(standardSchema2) {
17468
17570
  return jsonSchema(
17469
- () => addAdditionalPropertiesToJsonSchema(
17470
- standardSchema2["~standard"].jsonSchema.input({
17471
- target: "draft-07"
17472
- })
17473
- ),
17571
+ () => {
17572
+ if (!hasStandardJsonSchema(standardSchema2)) {
17573
+ throw new Error(
17574
+ `Standard schema vendor '${standardSchema2["~standard"].vendor}' does not support JSON Schema conversion.`
17575
+ );
17576
+ }
17577
+ return addAdditionalPropertiesToJsonSchema(
17578
+ standardSchema2["~standard"].jsonSchema.input({
17579
+ target: "draft-07"
17580
+ })
17581
+ );
17582
+ },
17474
17583
  {
17475
17584
  validate: async (value) => {
17476
17585
  const result = await standardSchema2["~standard"].validate(value);
@@ -17485,6 +17594,9 @@ function standardSchema(standardSchema2) {
17485
17594
  }
17486
17595
  );
17487
17596
  }
17597
+ function hasStandardJsonSchema(schema) {
17598
+ return schema["~standard"].jsonSchema != null;
17599
+ }
17488
17600
  function zod3Schema(zodSchema2, options) {
17489
17601
  var _a22;
17490
17602
  const useReferences = (_a22 = options == null ? void 0 : options.useReferences) != null ? _a22 : false;
@@ -17631,6 +17743,17 @@ async function resolve(value) {
17631
17743
  }
17632
17744
  return Promise.resolve(value);
17633
17745
  }
17746
+ async function readResponseBodyAsText({
17747
+ response,
17748
+ url: url2
17749
+ }) {
17750
+ return textDecoder.decode(
17751
+ await readResponseWithSizeLimit({
17752
+ response,
17753
+ url: url2
17754
+ })
17755
+ );
17756
+ }
17634
17757
  function stripFileExtension(filename) {
17635
17758
  const firstDotIndex = filename.indexOf(".");
17636
17759
  return firstDotIndex === -1 ? filename : filename.slice(0, firstDotIndex);
@@ -17638,7 +17761,7 @@ function stripFileExtension(filename) {
17638
17761
  function withoutTrailingSlash(url2) {
17639
17762
  return url2 == null ? void 0 : url2.replace(/\/$/, "");
17640
17763
  }
17641
- var btoa2, atob2, name14, marker15, symbol16, _a15, _b15, DownloadError, DEFAULT_MAX_DOWNLOAD_SIZE, createIdGenerator, generateId, FETCH_FAILED_ERROR_MESSAGES, BUN_ERROR_CODES, VERSION, suspectProtoRx, suspectConstructorRx, ignoreOverride, defaultOptions, getDefaultOptions, parseCatchDef, integerDateParser, isJsonSchema7AllOfType, emojiRegex2, zodPatterns, ALPHA_NUMERIC, primitiveMappings, asAnyOf, parseOptionalDef, parsePipelineDef, parseReadonlyDef, selectParser, getRelativePath, get$ref, addMeta, getRefs, zod3ToJsonSchema, schemaSymbol, getOriginalFetch2, postJsonToApi, postToApi, createJsonErrorResponseHandler, createJsonResponseHandler;
17764
+ var btoa2, atob2, name14, marker15, symbol16, _a15, _b15, DownloadError, initialGlobalFetch, initialGlobalFetchIsNodeDefault, DEFAULT_MAX_DOWNLOAD_SIZE, createIdGenerator, generateId, FETCH_FAILED_ERROR_MESSAGES, BUN_ERROR_CODES, VERSION, DEFAULT_SCHEMA_PREFIX, DEFAULT_SCHEMA_SUFFIX, DEFAULT_GENERIC_SUFFIX, suspectProtoRx, suspectConstructorRx, ignoreOverride, defaultOptions, getDefaultOptions, parseCatchDef, integerDateParser, isJsonSchema7AllOfType, emojiRegex2, zodPatterns, ALPHA_NUMERIC, primitiveMappings, asAnyOf, parseOptionalDef, parsePipelineDef, parseReadonlyDef, selectParser, getRelativePath, get$ref, addMeta, getRefs, zod3ToJsonSchema, schemaSymbol, getOriginalFetch2, postJsonToApi, postToApi, textDecoder, createJsonErrorResponseHandler, createJsonResponseHandler;
17642
17765
  var init_dist2 = __esm({
17643
17766
  "node_modules/@ai-sdk/provider-utils/dist/index.mjs"() {
17644
17767
  init_dist();
@@ -17677,6 +17800,8 @@ var init_dist2 = __esm({
17677
17800
  return AISDKError.hasMarker(error40, marker15);
17678
17801
  }
17679
17802
  };
17803
+ initialGlobalFetch = globalThis.fetch;
17804
+ initialGlobalFetchIsNodeDefault = isNodeDefaultFetch(initialGlobalFetch);
17680
17805
  DEFAULT_MAX_DOWNLOAD_SIZE = 2 * 1024 * 1024 * 1024;
17681
17806
  createIdGenerator = ({
17682
17807
  prefix,
@@ -17714,7 +17839,10 @@ var init_dist2 = __esm({
17714
17839
  "ETIMEDOUT",
17715
17840
  "EPIPE"
17716
17841
  ];
17717
- VERSION = true ? "4.0.27" : "0.0.0-test";
17842
+ VERSION = true ? "4.0.41" : "0.0.0-test";
17843
+ DEFAULT_SCHEMA_PREFIX = "JSON schema:";
17844
+ DEFAULT_SCHEMA_SUFFIX = "You MUST answer with a JSON object that matches the JSON schema above.";
17845
+ DEFAULT_GENERIC_SUFFIX = "You MUST answer with JSON.";
17718
17846
  suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
17719
17847
  suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
17720
17848
  ignoreOverride = /* @__PURE__ */ Symbol(
@@ -18147,12 +18275,13 @@ var init_dist2 = __esm({
18147
18275
  throw handleFetchError({ error: error40, url: url2, requestBodyValues: body.values });
18148
18276
  }
18149
18277
  };
18278
+ textDecoder = new TextDecoder();
18150
18279
  createJsonErrorResponseHandler = ({
18151
18280
  errorSchema,
18152
18281
  errorToMessage,
18153
18282
  isRetryable
18154
18283
  }) => async ({ response, url: url2, requestBodyValues }) => {
18155
- const responseBody = await response.text();
18284
+ const responseBody = await readResponseBodyAsText({ response, url: url2 });
18156
18285
  const responseHeaders = extractResponseHeaders(response);
18157
18286
  if (responseBody.trim() === "") {
18158
18287
  return {
@@ -18202,7 +18331,7 @@ var init_dist2 = __esm({
18202
18331
  }
18203
18332
  };
18204
18333
  createJsonResponseHandler = (responseSchema) => async ({ response, url: url2, requestBodyValues }) => {
18205
- const responseBody = await response.text();
18334
+ const responseBody = await readResponseBodyAsText({ response, url: url2 });
18206
18335
  const parsedResult = await safeParseJSON({
18207
18336
  text: responseBody,
18208
18337
  schema: responseSchema
@@ -18228,1111 +18357,6 @@ var init_dist2 = __esm({
18228
18357
  }
18229
18358
  });
18230
18359
 
18231
- // node_modules/tslib/tslib.es6.mjs
18232
- var tslib_es6_exports = {};
18233
- __export(tslib_es6_exports, {
18234
- __addDisposableResource: () => __addDisposableResource,
18235
- __assign: () => __assign,
18236
- __asyncDelegator: () => __asyncDelegator,
18237
- __asyncGenerator: () => __asyncGenerator,
18238
- __asyncValues: () => __asyncValues,
18239
- __await: () => __await,
18240
- __awaiter: () => __awaiter,
18241
- __classPrivateFieldGet: () => __classPrivateFieldGet,
18242
- __classPrivateFieldIn: () => __classPrivateFieldIn,
18243
- __classPrivateFieldSet: () => __classPrivateFieldSet,
18244
- __createBinding: () => __createBinding,
18245
- __decorate: () => __decorate,
18246
- __disposeResources: () => __disposeResources,
18247
- __esDecorate: () => __esDecorate,
18248
- __exportStar: () => __exportStar,
18249
- __extends: () => __extends,
18250
- __generator: () => __generator,
18251
- __importDefault: () => __importDefault,
18252
- __importStar: () => __importStar,
18253
- __makeTemplateObject: () => __makeTemplateObject,
18254
- __metadata: () => __metadata,
18255
- __param: () => __param,
18256
- __propKey: () => __propKey,
18257
- __read: () => __read,
18258
- __rest: () => __rest,
18259
- __rewriteRelativeImportExtension: () => __rewriteRelativeImportExtension,
18260
- __runInitializers: () => __runInitializers,
18261
- __setFunctionName: () => __setFunctionName,
18262
- __spread: () => __spread,
18263
- __spreadArray: () => __spreadArray,
18264
- __spreadArrays: () => __spreadArrays,
18265
- __values: () => __values,
18266
- default: () => tslib_es6_default
18267
- });
18268
- function __extends(d, b) {
18269
- if (typeof b !== "function" && b !== null)
18270
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18271
- extendStatics(d, b);
18272
- function __() {
18273
- this.constructor = d;
18274
- }
18275
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
18276
- }
18277
- function __rest(s, e) {
18278
- var t = {};
18279
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
18280
- t[p] = s[p];
18281
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18282
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18283
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18284
- t[p[i]] = s[p[i]];
18285
- }
18286
- return t;
18287
- }
18288
- function __decorate(decorators, target, key, desc) {
18289
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18290
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
18291
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18292
- return c > 3 && r && Object.defineProperty(target, key, r), r;
18293
- }
18294
- function __param(paramIndex, decorator) {
18295
- return function(target, key) {
18296
- decorator(target, key, paramIndex);
18297
- };
18298
- }
18299
- function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
18300
- function accept(f) {
18301
- if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
18302
- return f;
18303
- }
18304
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
18305
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
18306
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
18307
- var _, done = false;
18308
- for (var i = decorators.length - 1; i >= 0; i--) {
18309
- var context = {};
18310
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18311
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
18312
- context.addInitializer = function(f) {
18313
- if (done) throw new TypeError("Cannot add initializers after decoration has completed");
18314
- extraInitializers.push(accept(f || null));
18315
- };
18316
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
18317
- if (kind === "accessor") {
18318
- if (result === void 0) continue;
18319
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
18320
- if (_ = accept(result.get)) descriptor.get = _;
18321
- if (_ = accept(result.set)) descriptor.set = _;
18322
- if (_ = accept(result.init)) initializers.unshift(_);
18323
- } else if (_ = accept(result)) {
18324
- if (kind === "field") initializers.unshift(_);
18325
- else descriptor[key] = _;
18326
- }
18327
- }
18328
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
18329
- done = true;
18330
- }
18331
- function __runInitializers(thisArg, initializers, value) {
18332
- var useValue = arguments.length > 2;
18333
- for (var i = 0; i < initializers.length; i++) {
18334
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
18335
- }
18336
- return useValue ? value : void 0;
18337
- }
18338
- function __propKey(x) {
18339
- return typeof x === "symbol" ? x : "".concat(x);
18340
- }
18341
- function __setFunctionName(f, name15, prefix) {
18342
- if (typeof name15 === "symbol") name15 = name15.description ? "[".concat(name15.description, "]") : "";
18343
- return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name15) : name15 });
18344
- }
18345
- function __metadata(metadataKey, metadataValue) {
18346
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
18347
- }
18348
- function __awaiter(thisArg, _arguments, P, generator) {
18349
- function adopt(value) {
18350
- return value instanceof P ? value : new P(function(resolve9) {
18351
- resolve9(value);
18352
- });
18353
- }
18354
- return new (P || (P = Promise))(function(resolve9, reject2) {
18355
- function fulfilled(value) {
18356
- try {
18357
- step(generator.next(value));
18358
- } catch (e) {
18359
- reject2(e);
18360
- }
18361
- }
18362
- function rejected(value) {
18363
- try {
18364
- step(generator["throw"](value));
18365
- } catch (e) {
18366
- reject2(e);
18367
- }
18368
- }
18369
- function step(result) {
18370
- result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
18371
- }
18372
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18373
- });
18374
- }
18375
- function __generator(thisArg, body) {
18376
- var _ = { label: 0, sent: function() {
18377
- if (t[0] & 1) throw t[1];
18378
- return t[1];
18379
- }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
18380
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
18381
- return this;
18382
- }), g;
18383
- function verb(n) {
18384
- return function(v) {
18385
- return step([n, v]);
18386
- };
18387
- }
18388
- function step(op) {
18389
- if (f) throw new TypeError("Generator is already executing.");
18390
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18391
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18392
- if (y = 0, t) op = [op[0] & 2, t.value];
18393
- switch (op[0]) {
18394
- case 0:
18395
- case 1:
18396
- t = op;
18397
- break;
18398
- case 4:
18399
- _.label++;
18400
- return { value: op[1], done: false };
18401
- case 5:
18402
- _.label++;
18403
- y = op[1];
18404
- op = [0];
18405
- continue;
18406
- case 7:
18407
- op = _.ops.pop();
18408
- _.trys.pop();
18409
- continue;
18410
- default:
18411
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
18412
- _ = 0;
18413
- continue;
18414
- }
18415
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
18416
- _.label = op[1];
18417
- break;
18418
- }
18419
- if (op[0] === 6 && _.label < t[1]) {
18420
- _.label = t[1];
18421
- t = op;
18422
- break;
18423
- }
18424
- if (t && _.label < t[2]) {
18425
- _.label = t[2];
18426
- _.ops.push(op);
18427
- break;
18428
- }
18429
- if (t[2]) _.ops.pop();
18430
- _.trys.pop();
18431
- continue;
18432
- }
18433
- op = body.call(thisArg, _);
18434
- } catch (e) {
18435
- op = [6, e];
18436
- y = 0;
18437
- } finally {
18438
- f = t = 0;
18439
- }
18440
- if (op[0] & 5) throw op[1];
18441
- return { value: op[0] ? op[1] : void 0, done: true };
18442
- }
18443
- }
18444
- function __exportStar(m, o) {
18445
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
18446
- }
18447
- function __values(o) {
18448
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
18449
- if (m) return m.call(o);
18450
- if (o && typeof o.length === "number") return {
18451
- next: function() {
18452
- if (o && i >= o.length) o = void 0;
18453
- return { value: o && o[i++], done: !o };
18454
- }
18455
- };
18456
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
18457
- }
18458
- function __read(o, n) {
18459
- var m = typeof Symbol === "function" && o[Symbol.iterator];
18460
- if (!m) return o;
18461
- var i = m.call(o), r, ar = [], e;
18462
- try {
18463
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18464
- } catch (error40) {
18465
- e = { error: error40 };
18466
- } finally {
18467
- try {
18468
- if (r && !r.done && (m = i["return"])) m.call(i);
18469
- } finally {
18470
- if (e) throw e.error;
18471
- }
18472
- }
18473
- return ar;
18474
- }
18475
- function __spread() {
18476
- for (var ar = [], i = 0; i < arguments.length; i++)
18477
- ar = ar.concat(__read(arguments[i]));
18478
- return ar;
18479
- }
18480
- function __spreadArrays() {
18481
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
18482
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
18483
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
18484
- r[k] = a[j];
18485
- return r;
18486
- }
18487
- function __spreadArray(to, from, pack) {
18488
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
18489
- if (ar || !(i in from)) {
18490
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
18491
- ar[i] = from[i];
18492
- }
18493
- }
18494
- return to.concat(ar || Array.prototype.slice.call(from));
18495
- }
18496
- function __await(v) {
18497
- return this instanceof __await ? (this.v = v, this) : new __await(v);
18498
- }
18499
- function __asyncGenerator(thisArg, _arguments, generator) {
18500
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
18501
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
18502
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
18503
- return this;
18504
- }, i;
18505
- function awaitReturn(f) {
18506
- return function(v) {
18507
- return Promise.resolve(v).then(f, reject2);
18508
- };
18509
- }
18510
- function verb(n, f) {
18511
- if (g[n]) {
18512
- i[n] = function(v) {
18513
- return new Promise(function(a, b) {
18514
- q.push([n, v, a, b]) > 1 || resume(n, v);
18515
- });
18516
- };
18517
- if (f) i[n] = f(i[n]);
18518
- }
18519
- }
18520
- function resume(n, v) {
18521
- try {
18522
- step(g[n](v));
18523
- } catch (e) {
18524
- settle(q[0][3], e);
18525
- }
18526
- }
18527
- function step(r) {
18528
- r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject2) : settle(q[0][2], r);
18529
- }
18530
- function fulfill(value) {
18531
- resume("next", value);
18532
- }
18533
- function reject2(value) {
18534
- resume("throw", value);
18535
- }
18536
- function settle(f, v) {
18537
- if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
18538
- }
18539
- }
18540
- function __asyncDelegator(o) {
18541
- var i, p;
18542
- return i = {}, verb("next"), verb("throw", function(e) {
18543
- throw e;
18544
- }), verb("return"), i[Symbol.iterator] = function() {
18545
- return this;
18546
- }, i;
18547
- function verb(n, f) {
18548
- i[n] = o[n] ? function(v) {
18549
- return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v;
18550
- } : f;
18551
- }
18552
- }
18553
- function __asyncValues(o) {
18554
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
18555
- var m = o[Symbol.asyncIterator], i;
18556
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
18557
- return this;
18558
- }, i);
18559
- function verb(n) {
18560
- i[n] = o[n] && function(v) {
18561
- return new Promise(function(resolve9, reject2) {
18562
- v = o[n](v), settle(resolve9, reject2, v.done, v.value);
18563
- });
18564
- };
18565
- }
18566
- function settle(resolve9, reject2, d, v) {
18567
- Promise.resolve(v).then(function(v2) {
18568
- resolve9({ value: v2, done: d });
18569
- }, reject2);
18570
- }
18571
- }
18572
- function __makeTemplateObject(cooked, raw) {
18573
- if (Object.defineProperty) {
18574
- Object.defineProperty(cooked, "raw", { value: raw });
18575
- } else {
18576
- cooked.raw = raw;
18577
- }
18578
- return cooked;
18579
- }
18580
- function __importStar(mod) {
18581
- if (mod && mod.__esModule) return mod;
18582
- var result = {};
18583
- if (mod != null) {
18584
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
18585
- }
18586
- __setModuleDefault(result, mod);
18587
- return result;
18588
- }
18589
- function __importDefault(mod) {
18590
- return mod && mod.__esModule ? mod : { default: mod };
18591
- }
18592
- function __classPrivateFieldGet(receiver, state, kind, f) {
18593
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
18594
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
18595
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
18596
- }
18597
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
18598
- if (kind === "m") throw new TypeError("Private method is not writable");
18599
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
18600
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
18601
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
18602
- }
18603
- function __classPrivateFieldIn(state, receiver) {
18604
- if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object");
18605
- return typeof state === "function" ? receiver === state : state.has(receiver);
18606
- }
18607
- function __addDisposableResource(env, value, async) {
18608
- if (value !== null && value !== void 0) {
18609
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
18610
- var dispose, inner;
18611
- if (async) {
18612
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
18613
- dispose = value[Symbol.asyncDispose];
18614
- }
18615
- if (dispose === void 0) {
18616
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
18617
- dispose = value[Symbol.dispose];
18618
- if (async) inner = dispose;
18619
- }
18620
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
18621
- if (inner) dispose = function() {
18622
- try {
18623
- inner.call(this);
18624
- } catch (e) {
18625
- return Promise.reject(e);
18626
- }
18627
- };
18628
- env.stack.push({ value, dispose, async });
18629
- } else if (async) {
18630
- env.stack.push({ async: true });
18631
- }
18632
- return value;
18633
- }
18634
- function __disposeResources(env) {
18635
- function fail(e) {
18636
- env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
18637
- env.hasError = true;
18638
- }
18639
- var r, s = 0;
18640
- function next() {
18641
- while (r = env.stack.pop()) {
18642
- try {
18643
- if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
18644
- if (r.dispose) {
18645
- var result = r.dispose.call(r.value);
18646
- if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
18647
- fail(e);
18648
- return next();
18649
- });
18650
- } else s |= 1;
18651
- } catch (e) {
18652
- fail(e);
18653
- }
18654
- }
18655
- if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
18656
- if (env.hasError) throw env.error;
18657
- }
18658
- return next();
18659
- }
18660
- function __rewriteRelativeImportExtension(path9, preserveJsx) {
18661
- if (typeof path9 === "string" && /^\.\.?\//.test(path9)) {
18662
- return path9.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext2, cm) {
18663
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext2 || !cm) ? m : d + ext2 + "." + cm.toLowerCase() + "js";
18664
- });
18665
- }
18666
- return path9;
18667
- }
18668
- var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
18669
- var init_tslib_es6 = __esm({
18670
- "node_modules/tslib/tslib.es6.mjs"() {
18671
- extendStatics = function(d, b) {
18672
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
18673
- d2.__proto__ = b2;
18674
- } || function(d2, b2) {
18675
- for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
18676
- };
18677
- return extendStatics(d, b);
18678
- };
18679
- __assign = function() {
18680
- __assign = Object.assign || function __assign2(t) {
18681
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18682
- s = arguments[i];
18683
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
18684
- }
18685
- return t;
18686
- };
18687
- return __assign.apply(this, arguments);
18688
- };
18689
- __createBinding = Object.create ? (function(o, m, k, k2) {
18690
- if (k2 === void 0) k2 = k;
18691
- var desc = Object.getOwnPropertyDescriptor(m, k);
18692
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18693
- desc = { enumerable: true, get: function() {
18694
- return m[k];
18695
- } };
18696
- }
18697
- Object.defineProperty(o, k2, desc);
18698
- }) : (function(o, m, k, k2) {
18699
- if (k2 === void 0) k2 = k;
18700
- o[k2] = m[k];
18701
- });
18702
- __setModuleDefault = Object.create ? (function(o, v) {
18703
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18704
- }) : function(o, v) {
18705
- o["default"] = v;
18706
- };
18707
- ownKeys = function(o) {
18708
- ownKeys = Object.getOwnPropertyNames || function(o2) {
18709
- var ar = [];
18710
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
18711
- return ar;
18712
- };
18713
- return ownKeys(o);
18714
- };
18715
- _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error40, suppressed, message) {
18716
- var e = new Error(message);
18717
- return e.name = "SuppressedError", e.error = error40, e.suppressed = suppressed, e;
18718
- };
18719
- tslib_es6_default = {
18720
- __extends,
18721
- __assign,
18722
- __rest,
18723
- __decorate,
18724
- __param,
18725
- __esDecorate,
18726
- __runInitializers,
18727
- __propKey,
18728
- __setFunctionName,
18729
- __metadata,
18730
- __awaiter,
18731
- __generator,
18732
- __createBinding,
18733
- __exportStar,
18734
- __values,
18735
- __read,
18736
- __spread,
18737
- __spreadArrays,
18738
- __spreadArray,
18739
- __await,
18740
- __asyncGenerator,
18741
- __asyncDelegator,
18742
- __asyncValues,
18743
- __makeTemplateObject,
18744
- __importStar,
18745
- __importDefault,
18746
- __classPrivateFieldGet,
18747
- __classPrivateFieldSet,
18748
- __classPrivateFieldIn,
18749
- __addDisposableResource,
18750
- __disposeResources,
18751
- __rewriteRelativeImportExtension
18752
- };
18753
- }
18754
- });
18755
-
18756
- // node_modules/@smithy/is-array-buffer/dist-cjs/index.js
18757
- var require_dist_cjs = __commonJS({
18758
- "node_modules/@smithy/is-array-buffer/dist-cjs/index.js"(exports2, module2) {
18759
- var __defProp2 = Object.defineProperty;
18760
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
18761
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
18762
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
18763
- var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
18764
- var __export2 = (target, all) => {
18765
- for (var name15 in all)
18766
- __defProp2(target, name15, { get: all[name15], enumerable: true });
18767
- };
18768
- var __copyProps2 = (to, from, except, desc) => {
18769
- if (from && typeof from === "object" || typeof from === "function") {
18770
- for (let key of __getOwnPropNames2(from))
18771
- if (!__hasOwnProp2.call(to, key) && key !== except)
18772
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
18773
- }
18774
- return to;
18775
- };
18776
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
18777
- var src_exports = {};
18778
- __export2(src_exports, {
18779
- isArrayBuffer: () => isArrayBuffer2
18780
- });
18781
- module2.exports = __toCommonJS2(src_exports);
18782
- var isArrayBuffer2 = /* @__PURE__ */ __name((arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]", "isArrayBuffer");
18783
- }
18784
- });
18785
-
18786
- // node_modules/@smithy/util-buffer-from/dist-cjs/index.js
18787
- var require_dist_cjs2 = __commonJS({
18788
- "node_modules/@smithy/util-buffer-from/dist-cjs/index.js"(exports2, module2) {
18789
- var __defProp2 = Object.defineProperty;
18790
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
18791
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
18792
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
18793
- var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
18794
- var __export2 = (target, all) => {
18795
- for (var name15 in all)
18796
- __defProp2(target, name15, { get: all[name15], enumerable: true });
18797
- };
18798
- var __copyProps2 = (to, from, except, desc) => {
18799
- if (from && typeof from === "object" || typeof from === "function") {
18800
- for (let key of __getOwnPropNames2(from))
18801
- if (!__hasOwnProp2.call(to, key) && key !== except)
18802
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
18803
- }
18804
- return to;
18805
- };
18806
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
18807
- var src_exports = {};
18808
- __export2(src_exports, {
18809
- fromArrayBuffer: () => fromArrayBuffer2,
18810
- fromString: () => fromString2
18811
- });
18812
- module2.exports = __toCommonJS2(src_exports);
18813
- var import_is_array_buffer3 = require_dist_cjs();
18814
- var import_buffer = require("buffer");
18815
- var fromArrayBuffer2 = /* @__PURE__ */ __name((input, offset2 = 0, length = input.byteLength - offset2) => {
18816
- if (!(0, import_is_array_buffer3.isArrayBuffer)(input)) {
18817
- throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`);
18818
- }
18819
- return import_buffer.Buffer.from(input, offset2, length);
18820
- }, "fromArrayBuffer");
18821
- var fromString2 = /* @__PURE__ */ __name((input, encoding) => {
18822
- if (typeof input !== "string") {
18823
- throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`);
18824
- }
18825
- return encoding ? import_buffer.Buffer.from(input, encoding) : import_buffer.Buffer.from(input);
18826
- }, "fromString");
18827
- }
18828
- });
18829
-
18830
- // node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8/dist-cjs/index.js
18831
- var require_dist_cjs3 = __commonJS({
18832
- "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8/dist-cjs/index.js"(exports2, module2) {
18833
- var __defProp2 = Object.defineProperty;
18834
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
18835
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
18836
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
18837
- var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
18838
- var __export2 = (target, all) => {
18839
- for (var name15 in all)
18840
- __defProp2(target, name15, { get: all[name15], enumerable: true });
18841
- };
18842
- var __copyProps2 = (to, from, except, desc) => {
18843
- if (from && typeof from === "object" || typeof from === "function") {
18844
- for (let key of __getOwnPropNames2(from))
18845
- if (!__hasOwnProp2.call(to, key) && key !== except)
18846
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
18847
- }
18848
- return to;
18849
- };
18850
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
18851
- var src_exports = {};
18852
- __export2(src_exports, {
18853
- fromUtf8: () => fromUtf84,
18854
- toUint8Array: () => toUint8Array2,
18855
- toUtf8: () => toUtf84
18856
- });
18857
- module2.exports = __toCommonJS2(src_exports);
18858
- var import_util_buffer_from = require_dist_cjs2();
18859
- var fromUtf84 = /* @__PURE__ */ __name((input) => {
18860
- const buf = (0, import_util_buffer_from.fromString)(input, "utf8");
18861
- return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
18862
- }, "fromUtf8");
18863
- var toUint8Array2 = /* @__PURE__ */ __name((data2) => {
18864
- if (typeof data2 === "string") {
18865
- return fromUtf84(data2);
18866
- }
18867
- if (ArrayBuffer.isView(data2)) {
18868
- return new Uint8Array(data2.buffer, data2.byteOffset, data2.byteLength / Uint8Array.BYTES_PER_ELEMENT);
18869
- }
18870
- return new Uint8Array(data2);
18871
- }, "toUint8Array");
18872
- var toUtf84 = /* @__PURE__ */ __name((input) => {
18873
- if (typeof input === "string") {
18874
- return input;
18875
- }
18876
- if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
18877
- throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
18878
- }
18879
- return (0, import_util_buffer_from.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
18880
- }, "toUtf8");
18881
- }
18882
- });
18883
-
18884
- // node_modules/@aws-crypto/util/build/main/convertToBuffer.js
18885
- var require_convertToBuffer = __commonJS({
18886
- "node_modules/@aws-crypto/util/build/main/convertToBuffer.js"(exports2) {
18887
- "use strict";
18888
- Object.defineProperty(exports2, "__esModule", { value: true });
18889
- exports2.convertToBuffer = void 0;
18890
- var util_utf8_1 = require_dist_cjs3();
18891
- var fromUtf84 = typeof Buffer !== "undefined" && Buffer.from ? function(input) {
18892
- return Buffer.from(input, "utf8");
18893
- } : util_utf8_1.fromUtf8;
18894
- function convertToBuffer(data2) {
18895
- if (data2 instanceof Uint8Array)
18896
- return data2;
18897
- if (typeof data2 === "string") {
18898
- return fromUtf84(data2);
18899
- }
18900
- if (ArrayBuffer.isView(data2)) {
18901
- return new Uint8Array(data2.buffer, data2.byteOffset, data2.byteLength / Uint8Array.BYTES_PER_ELEMENT);
18902
- }
18903
- return new Uint8Array(data2);
18904
- }
18905
- exports2.convertToBuffer = convertToBuffer;
18906
- }
18907
- });
18908
-
18909
- // node_modules/@aws-crypto/util/build/main/isEmptyData.js
18910
- var require_isEmptyData = __commonJS({
18911
- "node_modules/@aws-crypto/util/build/main/isEmptyData.js"(exports2) {
18912
- "use strict";
18913
- Object.defineProperty(exports2, "__esModule", { value: true });
18914
- exports2.isEmptyData = void 0;
18915
- function isEmptyData(data2) {
18916
- if (typeof data2 === "string") {
18917
- return data2.length === 0;
18918
- }
18919
- return data2.byteLength === 0;
18920
- }
18921
- exports2.isEmptyData = isEmptyData;
18922
- }
18923
- });
18924
-
18925
- // node_modules/@aws-crypto/util/build/main/numToUint8.js
18926
- var require_numToUint8 = __commonJS({
18927
- "node_modules/@aws-crypto/util/build/main/numToUint8.js"(exports2) {
18928
- "use strict";
18929
- Object.defineProperty(exports2, "__esModule", { value: true });
18930
- exports2.numToUint8 = void 0;
18931
- function numToUint8(num) {
18932
- return new Uint8Array([
18933
- (num & 4278190080) >> 24,
18934
- (num & 16711680) >> 16,
18935
- (num & 65280) >> 8,
18936
- num & 255
18937
- ]);
18938
- }
18939
- exports2.numToUint8 = numToUint8;
18940
- }
18941
- });
18942
-
18943
- // node_modules/@aws-crypto/util/build/main/uint32ArrayFrom.js
18944
- var require_uint32ArrayFrom = __commonJS({
18945
- "node_modules/@aws-crypto/util/build/main/uint32ArrayFrom.js"(exports2) {
18946
- "use strict";
18947
- Object.defineProperty(exports2, "__esModule", { value: true });
18948
- exports2.uint32ArrayFrom = void 0;
18949
- function uint32ArrayFrom(a_lookUpTable) {
18950
- if (!Uint32Array.from) {
18951
- var return_array = new Uint32Array(a_lookUpTable.length);
18952
- var a_index = 0;
18953
- while (a_index < a_lookUpTable.length) {
18954
- return_array[a_index] = a_lookUpTable[a_index];
18955
- a_index += 1;
18956
- }
18957
- return return_array;
18958
- }
18959
- return Uint32Array.from(a_lookUpTable);
18960
- }
18961
- exports2.uint32ArrayFrom = uint32ArrayFrom;
18962
- }
18963
- });
18964
-
18965
- // node_modules/@aws-crypto/util/build/main/index.js
18966
- var require_main2 = __commonJS({
18967
- "node_modules/@aws-crypto/util/build/main/index.js"(exports2) {
18968
- "use strict";
18969
- Object.defineProperty(exports2, "__esModule", { value: true });
18970
- exports2.uint32ArrayFrom = exports2.numToUint8 = exports2.isEmptyData = exports2.convertToBuffer = void 0;
18971
- var convertToBuffer_1 = require_convertToBuffer();
18972
- Object.defineProperty(exports2, "convertToBuffer", { enumerable: true, get: function() {
18973
- return convertToBuffer_1.convertToBuffer;
18974
- } });
18975
- var isEmptyData_1 = require_isEmptyData();
18976
- Object.defineProperty(exports2, "isEmptyData", { enumerable: true, get: function() {
18977
- return isEmptyData_1.isEmptyData;
18978
- } });
18979
- var numToUint8_1 = require_numToUint8();
18980
- Object.defineProperty(exports2, "numToUint8", { enumerable: true, get: function() {
18981
- return numToUint8_1.numToUint8;
18982
- } });
18983
- var uint32ArrayFrom_1 = require_uint32ArrayFrom();
18984
- Object.defineProperty(exports2, "uint32ArrayFrom", { enumerable: true, get: function() {
18985
- return uint32ArrayFrom_1.uint32ArrayFrom;
18986
- } });
18987
- }
18988
- });
18989
-
18990
- // node_modules/@aws-crypto/crc32/build/main/aws_crc32.js
18991
- var require_aws_crc32 = __commonJS({
18992
- "node_modules/@aws-crypto/crc32/build/main/aws_crc32.js"(exports2) {
18993
- "use strict";
18994
- Object.defineProperty(exports2, "__esModule", { value: true });
18995
- exports2.AwsCrc32 = void 0;
18996
- var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
18997
- var util_1 = require_main2();
18998
- var index_1 = require_main3();
18999
- var AwsCrc32 = (
19000
- /** @class */
19001
- (function() {
19002
- function AwsCrc322() {
19003
- this.crc32 = new index_1.Crc32();
19004
- }
19005
- AwsCrc322.prototype.update = function(toHash) {
19006
- if ((0, util_1.isEmptyData)(toHash))
19007
- return;
19008
- this.crc32.update((0, util_1.convertToBuffer)(toHash));
19009
- };
19010
- AwsCrc322.prototype.digest = function() {
19011
- return tslib_1.__awaiter(this, void 0, void 0, function() {
19012
- return tslib_1.__generator(this, function(_a17) {
19013
- return [2, (0, util_1.numToUint8)(this.crc32.digest())];
19014
- });
19015
- });
19016
- };
19017
- AwsCrc322.prototype.reset = function() {
19018
- this.crc32 = new index_1.Crc32();
19019
- };
19020
- return AwsCrc322;
19021
- })()
19022
- );
19023
- exports2.AwsCrc32 = AwsCrc32;
19024
- }
19025
- });
19026
-
19027
- // node_modules/@aws-crypto/crc32/build/main/index.js
19028
- var require_main3 = __commonJS({
19029
- "node_modules/@aws-crypto/crc32/build/main/index.js"(exports2) {
19030
- "use strict";
19031
- Object.defineProperty(exports2, "__esModule", { value: true });
19032
- exports2.AwsCrc32 = exports2.Crc32 = exports2.crc32 = void 0;
19033
- var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
19034
- var util_1 = require_main2();
19035
- function crc32(data2) {
19036
- return new Crc323().update(data2).digest();
19037
- }
19038
- exports2.crc32 = crc32;
19039
- var Crc323 = (
19040
- /** @class */
19041
- (function() {
19042
- function Crc324() {
19043
- this.checksum = 4294967295;
19044
- }
19045
- Crc324.prototype.update = function(data2) {
19046
- var e_1, _a17;
19047
- try {
19048
- for (var data_1 = tslib_1.__values(data2), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
19049
- var byte = data_1_1.value;
19050
- this.checksum = this.checksum >>> 8 ^ lookupTable[(this.checksum ^ byte) & 255];
19051
- }
19052
- } catch (e_1_1) {
19053
- e_1 = { error: e_1_1 };
19054
- } finally {
19055
- try {
19056
- if (data_1_1 && !data_1_1.done && (_a17 = data_1.return)) _a17.call(data_1);
19057
- } finally {
19058
- if (e_1) throw e_1.error;
19059
- }
19060
- }
19061
- return this;
19062
- };
19063
- Crc324.prototype.digest = function() {
19064
- return (this.checksum ^ 4294967295) >>> 0;
19065
- };
19066
- return Crc324;
19067
- })()
19068
- );
19069
- exports2.Crc32 = Crc323;
19070
- var a_lookUpTable = [
19071
- 0,
19072
- 1996959894,
19073
- 3993919788,
19074
- 2567524794,
19075
- 124634137,
19076
- 1886057615,
19077
- 3915621685,
19078
- 2657392035,
19079
- 249268274,
19080
- 2044508324,
19081
- 3772115230,
19082
- 2547177864,
19083
- 162941995,
19084
- 2125561021,
19085
- 3887607047,
19086
- 2428444049,
19087
- 498536548,
19088
- 1789927666,
19089
- 4089016648,
19090
- 2227061214,
19091
- 450548861,
19092
- 1843258603,
19093
- 4107580753,
19094
- 2211677639,
19095
- 325883990,
19096
- 1684777152,
19097
- 4251122042,
19098
- 2321926636,
19099
- 335633487,
19100
- 1661365465,
19101
- 4195302755,
19102
- 2366115317,
19103
- 997073096,
19104
- 1281953886,
19105
- 3579855332,
19106
- 2724688242,
19107
- 1006888145,
19108
- 1258607687,
19109
- 3524101629,
19110
- 2768942443,
19111
- 901097722,
19112
- 1119000684,
19113
- 3686517206,
19114
- 2898065728,
19115
- 853044451,
19116
- 1172266101,
19117
- 3705015759,
19118
- 2882616665,
19119
- 651767980,
19120
- 1373503546,
19121
- 3369554304,
19122
- 3218104598,
19123
- 565507253,
19124
- 1454621731,
19125
- 3485111705,
19126
- 3099436303,
19127
- 671266974,
19128
- 1594198024,
19129
- 3322730930,
19130
- 2970347812,
19131
- 795835527,
19132
- 1483230225,
19133
- 3244367275,
19134
- 3060149565,
19135
- 1994146192,
19136
- 31158534,
19137
- 2563907772,
19138
- 4023717930,
19139
- 1907459465,
19140
- 112637215,
19141
- 2680153253,
19142
- 3904427059,
19143
- 2013776290,
19144
- 251722036,
19145
- 2517215374,
19146
- 3775830040,
19147
- 2137656763,
19148
- 141376813,
19149
- 2439277719,
19150
- 3865271297,
19151
- 1802195444,
19152
- 476864866,
19153
- 2238001368,
19154
- 4066508878,
19155
- 1812370925,
19156
- 453092731,
19157
- 2181625025,
19158
- 4111451223,
19159
- 1706088902,
19160
- 314042704,
19161
- 2344532202,
19162
- 4240017532,
19163
- 1658658271,
19164
- 366619977,
19165
- 2362670323,
19166
- 4224994405,
19167
- 1303535960,
19168
- 984961486,
19169
- 2747007092,
19170
- 3569037538,
19171
- 1256170817,
19172
- 1037604311,
19173
- 2765210733,
19174
- 3554079995,
19175
- 1131014506,
19176
- 879679996,
19177
- 2909243462,
19178
- 3663771856,
19179
- 1141124467,
19180
- 855842277,
19181
- 2852801631,
19182
- 3708648649,
19183
- 1342533948,
19184
- 654459306,
19185
- 3188396048,
19186
- 3373015174,
19187
- 1466479909,
19188
- 544179635,
19189
- 3110523913,
19190
- 3462522015,
19191
- 1591671054,
19192
- 702138776,
19193
- 2966460450,
19194
- 3352799412,
19195
- 1504918807,
19196
- 783551873,
19197
- 3082640443,
19198
- 3233442989,
19199
- 3988292384,
19200
- 2596254646,
19201
- 62317068,
19202
- 1957810842,
19203
- 3939845945,
19204
- 2647816111,
19205
- 81470997,
19206
- 1943803523,
19207
- 3814918930,
19208
- 2489596804,
19209
- 225274430,
19210
- 2053790376,
19211
- 3826175755,
19212
- 2466906013,
19213
- 167816743,
19214
- 2097651377,
19215
- 4027552580,
19216
- 2265490386,
19217
- 503444072,
19218
- 1762050814,
19219
- 4150417245,
19220
- 2154129355,
19221
- 426522225,
19222
- 1852507879,
19223
- 4275313526,
19224
- 2312317920,
19225
- 282753626,
19226
- 1742555852,
19227
- 4189708143,
19228
- 2394877945,
19229
- 397917763,
19230
- 1622183637,
19231
- 3604390888,
19232
- 2714866558,
19233
- 953729732,
19234
- 1340076626,
19235
- 3518719985,
19236
- 2797360999,
19237
- 1068828381,
19238
- 1219638859,
19239
- 3624741850,
19240
- 2936675148,
19241
- 906185462,
19242
- 1090812512,
19243
- 3747672003,
19244
- 2825379669,
19245
- 829329135,
19246
- 1181335161,
19247
- 3412177804,
19248
- 3160834842,
19249
- 628085408,
19250
- 1382605366,
19251
- 3423369109,
19252
- 3138078467,
19253
- 570562233,
19254
- 1426400815,
19255
- 3317316542,
19256
- 2998733608,
19257
- 733239954,
19258
- 1555261956,
19259
- 3268935591,
19260
- 3050360625,
19261
- 752459403,
19262
- 1541320221,
19263
- 2607071920,
19264
- 3965973030,
19265
- 1969922972,
19266
- 40735498,
19267
- 2617837225,
19268
- 3943577151,
19269
- 1913087877,
19270
- 83908371,
19271
- 2512341634,
19272
- 3803740692,
19273
- 2075208622,
19274
- 213261112,
19275
- 2463272603,
19276
- 3855990285,
19277
- 2094854071,
19278
- 198958881,
19279
- 2262029012,
19280
- 4057260610,
19281
- 1759359992,
19282
- 534414190,
19283
- 2176718541,
19284
- 4139329115,
19285
- 1873836001,
19286
- 414664567,
19287
- 2282248934,
19288
- 4279200368,
19289
- 1711684554,
19290
- 285281116,
19291
- 2405801727,
19292
- 4167216745,
19293
- 1634467795,
19294
- 376229701,
19295
- 2685067896,
19296
- 3608007406,
19297
- 1308918612,
19298
- 956543938,
19299
- 2808555105,
19300
- 3495958263,
19301
- 1231636301,
19302
- 1047427035,
19303
- 2932959818,
19304
- 3654703836,
19305
- 1088359270,
19306
- 936918e3,
19307
- 2847714899,
19308
- 3736837829,
19309
- 1202900863,
19310
- 817233897,
19311
- 3183342108,
19312
- 3401237130,
19313
- 1404277552,
19314
- 615818150,
19315
- 3134207493,
19316
- 3453421203,
19317
- 1423857449,
19318
- 601450431,
19319
- 3009837614,
19320
- 3294710456,
19321
- 1567103746,
19322
- 711928724,
19323
- 3020668471,
19324
- 3272380065,
19325
- 1510334235,
19326
- 755167117
19327
- ];
19328
- var lookupTable = (0, util_1.uint32ArrayFrom)(a_lookUpTable);
19329
- var aws_crc32_1 = require_aws_crc32();
19330
- Object.defineProperty(exports2, "AwsCrc32", { enumerable: true, get: function() {
19331
- return aws_crc32_1.AwsCrc32;
19332
- } });
19333
- }
19334
- });
19335
-
19336
18360
  // node_modules/@smithy/core/dist-es/submodules/serde/is-array-buffer/is-array-buffer.js
19337
18361
  var isArrayBuffer;
19338
18362
  var init_is_array_buffer = __esm({
@@ -19414,12 +18438,12 @@ var init_toBase64 = __esm({
19414
18438
  });
19415
18439
 
19416
18440
  // node_modules/@smithy/core/dist-es/submodules/serde/util-stream/blob/Uint8ArrayBlobAdapter.js
19417
- function bindUint8ArrayBlobAdapter(toUtf84, fromUtf84, toBase643, fromBase643) {
18441
+ function bindUint8ArrayBlobAdapter(toUtf84, fromUtf84, toBase643, fromBase642) {
19418
18442
  return class Uint8ArrayBlobAdapter2 extends Uint8Array {
19419
18443
  static fromString(source, encoding = "utf-8") {
19420
18444
  if (typeof source === "string") {
19421
18445
  if (encoding === "base64") {
19422
- return Uint8ArrayBlobAdapter2.mutate(fromBase643(source));
18446
+ return Uint8ArrayBlobAdapter2.mutate(fromBase642(source));
19423
18447
  }
19424
18448
  return Uint8ArrayBlobAdapter2.mutate(fromUtf84(source));
19425
18449
  }
@@ -19483,7 +18507,7 @@ var init_v42 = __esm({
19483
18507
  var copyDocumentWithTransform;
19484
18508
  var init_copyDocumentWithTransform = __esm({
19485
18509
  "node_modules/@smithy/core/dist-es/submodules/serde/copyDocumentWithTransform.js"() {
19486
- copyDocumentWithTransform = (source, schemaRef, transform2 = (_) => _) => source;
18510
+ copyDocumentWithTransform = (source, _schemaRef, _transform2 = (_) => _) => source;
19487
18511
  }
19488
18512
  });
19489
18513
 
@@ -19762,7 +18786,7 @@ var init_date_utils = __esm({
19762
18786
  const day = parseDateValue(dayStr, "day", 1, 31);
19763
18787
  return buildDate(year2, month, day, { hours, minutes, seconds, fractionalMilliseconds });
19764
18788
  };
19765
- RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
18789
+ RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/);
19766
18790
  parseRfc3339DateTimeWithOffset = (value) => {
19767
18791
  if (value === null || value === void 0) {
19768
18792
  return void 0;
@@ -20144,7 +19168,7 @@ function nv(input) {
20144
19168
  var format, NumericValue;
20145
19169
  var init_NumericValue = __esm({
20146
19170
  "node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js"() {
20147
- format = /^-?\d*(\.\d+)?$/;
19171
+ format = /^-?((0|[1-9]\d*)(\.\d+)?|\.\d+)([eE][+-]?\d+)?$/;
20148
19172
  NumericValue = class _NumericValue {
20149
19173
  string;
20150
19174
  type;
@@ -20152,7 +19176,7 @@ var init_NumericValue = __esm({
20152
19176
  this.string = string4;
20153
19177
  this.type = type;
20154
19178
  if (!format.test(string4)) {
20155
- throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`);
19179
+ throw new Error(`@smithy/core/serde - NumericValue string must conform to the Smithy bigDecimal format. Received: "${string4}"`);
20156
19180
  }
20157
19181
  }
20158
19182
  toString() {
@@ -20243,6 +19267,9 @@ var init_toUint8Array = __esm({
20243
19267
  "node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/toUint8Array.js"() {
20244
19268
  init_fromUtf8();
20245
19269
  toUint8Array = (data2) => {
19270
+ if (data2 instanceof Uint8Array) {
19271
+ return data2;
19272
+ }
20246
19273
  if (typeof data2 === "string") {
20247
19274
  return fromUtf8(data2);
20248
19275
  }
@@ -20254,44 +19281,64 @@ var init_toUint8Array = __esm({
20254
19281
  }
20255
19282
  });
20256
19283
 
19284
+ // node_modules/@smithy/core/dist-es/submodules/serde/concatBytes.js
19285
+ function concatBytes(arrays, length) {
19286
+ if (length === void 0) {
19287
+ length = 0;
19288
+ for (const bytes of arrays) {
19289
+ length += bytes.byteLength;
19290
+ }
19291
+ }
19292
+ const result = new Uint8Array(length);
19293
+ let offset2 = 0;
19294
+ for (const buf of arrays) {
19295
+ result.set(buf, offset2);
19296
+ offset2 += buf.byteLength;
19297
+ }
19298
+ return result;
19299
+ }
19300
+ var init_concatBytes = __esm({
19301
+ "node_modules/@smithy/core/dist-es/submodules/serde/concatBytes.js"() {
19302
+ }
19303
+ });
19304
+
20257
19305
  // node_modules/@smithy/types/dist-cjs/index.js
20258
- var require_dist_cjs4 = __commonJS({
19306
+ var require_dist_cjs = __commonJS({
20259
19307
  "node_modules/@smithy/types/dist-cjs/index.js"(exports2) {
20260
- "use strict";
20261
- exports2.HttpAuthLocation = void 0;
20262
- (function(HttpAuthLocation) {
20263
- HttpAuthLocation["HEADER"] = "header";
20264
- HttpAuthLocation["QUERY"] = "query";
20265
- })(exports2.HttpAuthLocation || (exports2.HttpAuthLocation = {}));
20266
- exports2.HttpApiKeyAuthLocation = void 0;
20267
- (function(HttpApiKeyAuthLocation) {
20268
- HttpApiKeyAuthLocation["HEADER"] = "header";
20269
- HttpApiKeyAuthLocation["QUERY"] = "query";
20270
- })(exports2.HttpApiKeyAuthLocation || (exports2.HttpApiKeyAuthLocation = {}));
20271
- exports2.EndpointURLScheme = void 0;
20272
- (function(EndpointURLScheme) {
20273
- EndpointURLScheme["HTTP"] = "http";
20274
- EndpointURLScheme["HTTPS"] = "https";
20275
- })(exports2.EndpointURLScheme || (exports2.EndpointURLScheme = {}));
20276
- exports2.AlgorithmId = void 0;
20277
- (function(AlgorithmId) {
20278
- AlgorithmId["MD5"] = "md5";
20279
- AlgorithmId["CRC32"] = "crc32";
20280
- AlgorithmId["CRC32C"] = "crc32c";
20281
- AlgorithmId["SHA1"] = "sha1";
20282
- AlgorithmId["SHA256"] = "sha256";
20283
- })(exports2.AlgorithmId || (exports2.AlgorithmId = {}));
19308
+ var HttpAuthLocation;
19309
+ (function(HttpAuthLocation2) {
19310
+ HttpAuthLocation2["HEADER"] = "header";
19311
+ HttpAuthLocation2["QUERY"] = "query";
19312
+ })(HttpAuthLocation || (HttpAuthLocation = {}));
19313
+ var HttpApiKeyAuthLocation;
19314
+ (function(HttpApiKeyAuthLocation2) {
19315
+ HttpApiKeyAuthLocation2["HEADER"] = "header";
19316
+ HttpApiKeyAuthLocation2["QUERY"] = "query";
19317
+ })(HttpApiKeyAuthLocation || (HttpApiKeyAuthLocation = {}));
19318
+ var EndpointURLScheme;
19319
+ (function(EndpointURLScheme2) {
19320
+ EndpointURLScheme2["HTTP"] = "http";
19321
+ EndpointURLScheme2["HTTPS"] = "https";
19322
+ })(EndpointURLScheme || (EndpointURLScheme = {}));
19323
+ var AlgorithmId;
19324
+ (function(AlgorithmId2) {
19325
+ AlgorithmId2["MD5"] = "md5";
19326
+ AlgorithmId2["CRC32"] = "crc32";
19327
+ AlgorithmId2["CRC32C"] = "crc32c";
19328
+ AlgorithmId2["SHA1"] = "sha1";
19329
+ AlgorithmId2["SHA256"] = "sha256";
19330
+ })(AlgorithmId || (AlgorithmId = {}));
20284
19331
  var getChecksumConfiguration = (runtimeConfig) => {
20285
19332
  const checksumAlgorithms = [];
20286
19333
  if (runtimeConfig.sha256 !== void 0) {
20287
19334
  checksumAlgorithms.push({
20288
- algorithmId: () => exports2.AlgorithmId.SHA256,
19335
+ algorithmId: () => AlgorithmId.SHA256,
20289
19336
  checksumConstructor: () => runtimeConfig.sha256
20290
19337
  });
20291
19338
  }
20292
19339
  if (runtimeConfig.md5 != void 0) {
20293
19340
  checksumAlgorithms.push({
20294
- algorithmId: () => exports2.AlgorithmId.MD5,
19341
+ algorithmId: () => AlgorithmId.MD5,
20295
19342
  checksumConstructor: () => runtimeConfig.md5
20296
19343
  });
20297
19344
  }
@@ -20317,24 +19364,31 @@ var require_dist_cjs4 = __commonJS({
20317
19364
  var resolveDefaultRuntimeConfig = (config2) => {
20318
19365
  return resolveChecksumRuntimeConfig(config2);
20319
19366
  };
20320
- exports2.FieldPosition = void 0;
20321
- (function(FieldPosition) {
20322
- FieldPosition[FieldPosition["HEADER"] = 0] = "HEADER";
20323
- FieldPosition[FieldPosition["TRAILER"] = 1] = "TRAILER";
20324
- })(exports2.FieldPosition || (exports2.FieldPosition = {}));
19367
+ var FieldPosition;
19368
+ (function(FieldPosition2) {
19369
+ FieldPosition2[FieldPosition2["HEADER"] = 0] = "HEADER";
19370
+ FieldPosition2[FieldPosition2["TRAILER"] = 1] = "TRAILER";
19371
+ })(FieldPosition || (FieldPosition = {}));
20325
19372
  var SMITHY_CONTEXT_KEY2 = "__smithy_context";
20326
- exports2.IniSectionType = void 0;
20327
- (function(IniSectionType3) {
20328
- IniSectionType3["PROFILE"] = "profile";
20329
- IniSectionType3["SSO_SESSION"] = "sso-session";
20330
- IniSectionType3["SERVICES"] = "services";
20331
- })(exports2.IniSectionType || (exports2.IniSectionType = {}));
20332
- exports2.RequestHandlerProtocol = void 0;
20333
- (function(RequestHandlerProtocol) {
20334
- RequestHandlerProtocol["HTTP_0_9"] = "http/0.9";
20335
- RequestHandlerProtocol["HTTP_1_0"] = "http/1.0";
20336
- RequestHandlerProtocol["TDS_8_0"] = "tds/8.0";
20337
- })(exports2.RequestHandlerProtocol || (exports2.RequestHandlerProtocol = {}));
19373
+ var IniSectionType3;
19374
+ (function(IniSectionType4) {
19375
+ IniSectionType4["PROFILE"] = "profile";
19376
+ IniSectionType4["SSO_SESSION"] = "sso-session";
19377
+ IniSectionType4["SERVICES"] = "services";
19378
+ })(IniSectionType3 || (IniSectionType3 = {}));
19379
+ var RequestHandlerProtocol;
19380
+ (function(RequestHandlerProtocol2) {
19381
+ RequestHandlerProtocol2["HTTP_0_9"] = "http/0.9";
19382
+ RequestHandlerProtocol2["HTTP_1_0"] = "http/1.0";
19383
+ RequestHandlerProtocol2["TDS_8_0"] = "tds/8.0";
19384
+ })(RequestHandlerProtocol || (RequestHandlerProtocol = {}));
19385
+ exports2.AlgorithmId = AlgorithmId;
19386
+ exports2.EndpointURLScheme = EndpointURLScheme;
19387
+ exports2.FieldPosition = FieldPosition;
19388
+ exports2.HttpApiKeyAuthLocation = HttpApiKeyAuthLocation;
19389
+ exports2.HttpAuthLocation = HttpAuthLocation;
19390
+ exports2.IniSectionType = IniSectionType3;
19391
+ exports2.RequestHandlerProtocol = RequestHandlerProtocol;
20338
19392
  exports2.SMITHY_CONTEXT_KEY = SMITHY_CONTEXT_KEY2;
20339
19393
  exports2.getDefaultClientConfiguration = getDefaultClientConfiguration;
20340
19394
  exports2.resolveDefaultRuntimeConfig = resolveDefaultRuntimeConfig;
@@ -20345,7 +19399,7 @@ var require_dist_cjs4 = __commonJS({
20345
19399
  var import_types, getSmithyContext;
20346
19400
  var init_getSmithyContext = __esm({
20347
19401
  "node_modules/@smithy/core/dist-es/submodules/transport/getSmithyContext.js"() {
20348
- import_types = __toESM(require_dist_cjs4());
19402
+ import_types = __toESM(require_dist_cjs());
20349
19403
  getSmithyContext = (context) => context[import_types.SMITHY_CONTEXT_KEY] || (context[import_types.SMITHY_CONTEXT_KEY] = {});
20350
19404
  }
20351
19405
  });
@@ -20498,7 +19552,7 @@ var init_deserializerMiddleware = __esm({
20498
19552
  const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
20499
19553
  try {
20500
19554
  error40.message += "\n " + hint;
20501
- } catch (e) {
19555
+ } catch (ignored) {
20502
19556
  if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
20503
19557
  console.warn(hint);
20504
19558
  } else {
@@ -20521,7 +19575,7 @@ var init_deserializerMiddleware = __esm({
20521
19575
  cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
20522
19576
  };
20523
19577
  }
20524
- } catch (e) {
19578
+ } catch (ignored) {
20525
19579
  }
20526
19580
  }
20527
19581
  throw error40;
@@ -20665,6 +19719,33 @@ var init_memoize = __esm({
20665
19719
  }
20666
19720
  });
20667
19721
 
19722
+ // node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/booleanSelector.js
19723
+ var booleanSelector;
19724
+ var init_booleanSelector = __esm({
19725
+ "node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/booleanSelector.js"() {
19726
+ booleanSelector = (obj, key, type) => {
19727
+ if (!(key in obj))
19728
+ return void 0;
19729
+ if (obj[key] === "true")
19730
+ return true;
19731
+ if (obj[key] === "false")
19732
+ return false;
19733
+ throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
19734
+ };
19735
+ }
19736
+ });
19737
+
19738
+ // node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/types.js
19739
+ var SelectorType;
19740
+ var init_types2 = __esm({
19741
+ "node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/types.js"() {
19742
+ (function(SelectorType2) {
19743
+ SelectorType2["ENV"] = "env";
19744
+ SelectorType2["CONFIG"] = "shared config entry";
19745
+ })(SelectorType || (SelectorType = {}));
19746
+ }
19747
+ });
19748
+
20668
19749
  // node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js
20669
19750
  var import_node_os, import_node_path, homeDirCache, getHomeDirCacheKey, getHomeDir;
20670
19751
  var init_getHomeDir = __esm({
@@ -20716,7 +19797,7 @@ var init_constants = __esm({
20716
19797
  var import_types2, getConfigData;
20717
19798
  var init_getConfigData = __esm({
20718
19799
  "node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigData.js"() {
20719
- import_types2 = __toESM(require_dist_cjs4());
19800
+ import_types2 = __toESM(require_dist_cjs());
20720
19801
  init_constants();
20721
19802
  getConfigData = (data2) => Object.entries(data2).filter(([key]) => {
20722
19803
  const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
@@ -20761,9 +19842,9 @@ var init_getCredentialsFilepath = __esm({
20761
19842
  var import_types3, prefixKeyRegex, profileNameBlockList, parseIni;
20762
19843
  var init_parseIni = __esm({
20763
19844
  "node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/parseIni.js"() {
20764
- import_types3 = __toESM(require_dist_cjs4());
19845
+ import_types3 = __toESM(require_dist_cjs());
20765
19846
  init_constants();
20766
- prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
19847
+ prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/;
20767
19848
  profileNameBlockList = ["__proto__", "profile __proto__"];
20768
19849
  parseIni = (iniData) => {
20769
19850
  const map3 = {};
@@ -20880,7 +19961,7 @@ function getSelectorName(functionString) {
20880
19961
  constants.delete("CONFIG_PREFIX_SEPARATOR");
20881
19962
  constants.delete("ENV");
20882
19963
  return [...constants].join(", ");
20883
- } catch (e) {
19964
+ } catch (ignored) {
20884
19965
  return functionString;
20885
19966
  }
20886
19967
  }
@@ -20964,16 +20045,126 @@ var init_configLoader = __esm({
20964
20045
  }
20965
20046
  });
20966
20047
 
20967
- // node_modules/@smithy/core/dist-es/submodules/client/index.js
20968
- var init_client = __esm({
20969
- "node_modules/@smithy/core/dist-es/submodules/client/index.js"() {
20970
- init_transport();
20048
+ // node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js
20049
+ var TypeRegistry;
20050
+ var init_TypeRegistry = __esm({
20051
+ "node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js"() {
20052
+ TypeRegistry = class _TypeRegistry {
20053
+ namespace;
20054
+ schemas;
20055
+ exceptions;
20056
+ static registries = /* @__PURE__ */ new Map();
20057
+ constructor(namespace, schemas = /* @__PURE__ */ new Map(), exceptions = /* @__PURE__ */ new Map()) {
20058
+ this.namespace = namespace;
20059
+ this.schemas = schemas;
20060
+ this.exceptions = exceptions;
20061
+ }
20062
+ static for(namespace) {
20063
+ if (!_TypeRegistry.registries.has(namespace)) {
20064
+ _TypeRegistry.registries.set(namespace, new _TypeRegistry(namespace));
20065
+ }
20066
+ return _TypeRegistry.registries.get(namespace);
20067
+ }
20068
+ copyFrom(other) {
20069
+ const { schemas, exceptions } = this;
20070
+ for (const [k, v] of other.schemas) {
20071
+ if (!schemas.has(k)) {
20072
+ schemas.set(k, v);
20073
+ }
20074
+ }
20075
+ for (const [k, v] of other.exceptions) {
20076
+ if (!exceptions.has(k)) {
20077
+ exceptions.set(k, v);
20078
+ }
20079
+ }
20080
+ }
20081
+ register(shapeId, schema) {
20082
+ const qualifiedName = this.normalizeShapeId(shapeId);
20083
+ for (const r of [this, _TypeRegistry.for(qualifiedName.split("#")[0])]) {
20084
+ r.schemas.set(qualifiedName, schema);
20085
+ }
20086
+ }
20087
+ getSchema(shapeId) {
20088
+ const id = this.normalizeShapeId(shapeId);
20089
+ if (!this.schemas.has(id)) {
20090
+ if (!shapeId.includes("#")) {
20091
+ const suffix = "#" + shapeId;
20092
+ const candidates = [];
20093
+ for (const [shapeId2, schema] of this.schemas.entries()) {
20094
+ if (shapeId2.endsWith(suffix)) {
20095
+ candidates.push(schema);
20096
+ }
20097
+ }
20098
+ if (candidates.length === 1) {
20099
+ return candidates[0];
20100
+ }
20101
+ }
20102
+ throw new Error(`@smithy/core/schema - schema not found for ${id}`);
20103
+ }
20104
+ return this.schemas.get(id);
20105
+ }
20106
+ registerError(es, ctor) {
20107
+ const $error = es;
20108
+ const ns = $error[1];
20109
+ for (const r of [this, _TypeRegistry.for(ns)]) {
20110
+ r.schemas.set(ns + "#" + $error[2], $error);
20111
+ r.exceptions.set($error, ctor);
20112
+ }
20113
+ }
20114
+ getErrorCtor(es) {
20115
+ const $error = es;
20116
+ if (this.exceptions.has($error)) {
20117
+ return this.exceptions.get($error);
20118
+ }
20119
+ const registry2 = _TypeRegistry.for($error[1]);
20120
+ return registry2.exceptions.get($error);
20121
+ }
20122
+ getBaseException() {
20123
+ for (const exceptionKey of this.exceptions.keys()) {
20124
+ if (Array.isArray(exceptionKey)) {
20125
+ const [, ns, name15] = exceptionKey;
20126
+ const id = ns + "#" + name15;
20127
+ if (id.startsWith("smithy.ts.sdk.synthetic.") && id.endsWith("ServiceException")) {
20128
+ return exceptionKey;
20129
+ }
20130
+ }
20131
+ }
20132
+ return void 0;
20133
+ }
20134
+ find(predicate) {
20135
+ for (const schema of this.schemas.values()) {
20136
+ if (predicate(schema)) {
20137
+ return schema;
20138
+ }
20139
+ }
20140
+ return void 0;
20141
+ }
20142
+ clear() {
20143
+ this.schemas.clear();
20144
+ this.exceptions.clear();
20145
+ }
20146
+ normalizeShapeId(shapeId) {
20147
+ if (shapeId.includes("#")) {
20148
+ return shapeId;
20149
+ }
20150
+ return this.namespace + "#" + shapeId;
20151
+ }
20152
+ };
20153
+ }
20154
+ });
20155
+
20156
+ // node_modules/@smithy/core/dist-es/submodules/schema/index.js
20157
+ var init_schema = __esm({
20158
+ "node_modules/@smithy/core/dist-es/submodules/schema/index.js"() {
20159
+ init_TypeRegistry();
20971
20160
  }
20972
20161
  });
20973
20162
 
20974
20163
  // node_modules/@smithy/core/dist-es/submodules/config/index.js
20975
20164
  var init_config = __esm({
20976
20165
  "node_modules/@smithy/core/dist-es/submodules/config/index.js"() {
20166
+ init_booleanSelector();
20167
+ init_types2();
20977
20168
  init_constants();
20978
20169
  init_configLoader();
20979
20170
  }
@@ -20998,14 +20189,16 @@ var init_getEndpointUrlConfig = __esm({
20998
20189
  return void 0;
20999
20190
  },
21000
20191
  configFileSelector: (profile, config2) => {
21001
- if (config2 && profile.services) {
21002
- const servicesSection = config2[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)];
21003
- if (servicesSection) {
21004
- const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
21005
- const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
21006
- if (endpointUrl2)
21007
- return endpointUrl2;
20192
+ if (profile.services) {
20193
+ const servicesSectionKey = ["services", profile.services].join(CONFIG_PREFIX_SEPARATOR);
20194
+ if (!config2 || !config2[servicesSectionKey]) {
20195
+ throw new Error(`The services section "${profile.services}" specified in the profile is not present in the shared configuration file.`);
21008
20196
  }
20197
+ const servicesSection = config2[servicesSectionKey];
20198
+ const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
20199
+ const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
20200
+ if (endpointUrl2)
20201
+ return endpointUrl2;
21009
20202
  }
21010
20203
  const endpointUrl = profile[CONFIG_ENDPOINT_URL];
21011
20204
  if (endpointUrl)
@@ -21017,13 +20210,35 @@ var init_getEndpointUrlConfig = __esm({
21017
20210
  }
21018
20211
  });
21019
20212
 
20213
+ // node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getIgnoreConfiguredEndpointUrls.js
20214
+ var ENV_IGNORE_CONFIGURED_ENDPOINT_URLS, CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS, ignoreConfiguredEndpointUrlsConfigSelectors;
20215
+ var init_getIgnoreConfiguredEndpointUrls = __esm({
20216
+ "node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getIgnoreConfiguredEndpointUrls.js"() {
20217
+ init_config();
20218
+ ENV_IGNORE_CONFIGURED_ENDPOINT_URLS = "AWS_IGNORE_CONFIGURED_ENDPOINT_URLS";
20219
+ CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS = "ignore_configured_endpoint_urls";
20220
+ ignoreConfiguredEndpointUrlsConfigSelectors = {
20221
+ environmentVariableSelector: (env) => booleanSelector(env, ENV_IGNORE_CONFIGURED_ENDPOINT_URLS, SelectorType.ENV),
20222
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS, SelectorType.CONFIG),
20223
+ default: false
20224
+ };
20225
+ }
20226
+ });
20227
+
21020
20228
  // node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromConfig.js
21021
20229
  var getEndpointFromConfig;
21022
20230
  var init_getEndpointFromConfig = __esm({
21023
20231
  "node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromConfig.js"() {
21024
20232
  init_config();
21025
20233
  init_getEndpointUrlConfig();
21026
- getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
20234
+ init_getIgnoreConfiguredEndpointUrls();
20235
+ getEndpointFromConfig = async (serviceId) => {
20236
+ const ignore2 = await loadConfig(ignoreConfiguredEndpointUrlsConfigSelectors)();
20237
+ if (ignore2) {
20238
+ return void 0;
20239
+ }
20240
+ return loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
20241
+ };
21027
20242
  }
21028
20243
  });
21029
20244
 
@@ -21049,7 +20264,7 @@ var init_s3 = __esm({
21049
20264
  }
21050
20265
  return endpointParams;
21051
20266
  };
21052
- DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
20267
+ DOMAIN_PATTERN = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;
21053
20268
  IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
21054
20269
  DOTS_PATTERN = /\.\./;
21055
20270
  isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
@@ -21138,7 +20353,7 @@ var init_toEndpointV12 = __esm({
21138
20353
  // node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromInstructions.js
21139
20354
  function bindGetEndpointFromInstructions(getEndpointFromConfig2) {
21140
20355
  return async (commandInput, instructionsSupplier, clientConfig, context) => {
21141
- if (!clientConfig.isCustomEndpoint) {
20356
+ if (!clientConfig.isCustomEndpoint && !clientConfig.ignoreConfiguredEndpointUrls) {
21142
20357
  let endpointFromConfig;
21143
20358
  if (clientConfig.serviceConfiguredEndpoint) {
21144
20359
  endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
@@ -21148,6 +20363,7 @@ function bindGetEndpointFromInstructions(getEndpointFromConfig2) {
21148
20363
  if (endpointFromConfig) {
21149
20364
  clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
21150
20365
  clientConfig.isCustomEndpoint = true;
20366
+ context?.logger?.debug?.(`@smithy/core/endpoints - resolved endpoint from config: ${endpointFromConfig}`);
21151
20367
  }
21152
20368
  }
21153
20369
  const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
@@ -21253,7 +20469,7 @@ function bindEndpointMiddleware(getEndpointFromConfig2) {
21253
20469
  }
21254
20470
  var init_endpointMiddleware = __esm({
21255
20471
  "node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js"() {
21256
- init_client();
20472
+ init_transport();
21257
20473
  init_getEndpointFromInstructions();
21258
20474
  }
21259
20475
  });
@@ -21303,7 +20519,8 @@ function bindResolveEndpointConfig(getEndpointFromConfig2) {
21303
20519
  tls,
21304
20520
  isCustomEndpoint,
21305
20521
  useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false),
21306
- useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false)
20522
+ useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false),
20523
+ ignoreConfiguredEndpointUrls: !!input.ignoreConfiguredEndpointUrls
21307
20524
  });
21308
20525
  let configuredEndpointPromise = void 0;
21309
20526
  resolvedConfig.serviceConfiguredEndpoint = async () => {
@@ -21322,61 +20539,6 @@ var init_resolveEndpointConfig = __esm({
21322
20539
  }
21323
20540
  });
21324
20541
 
21325
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointError.js
21326
- var init_EndpointError = __esm({
21327
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointError.js"() {
21328
- }
21329
- });
21330
-
21331
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointFunctions.js
21332
- var init_EndpointFunctions = __esm({
21333
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointFunctions.js"() {
21334
- }
21335
- });
21336
-
21337
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointRuleObject.js
21338
- var init_EndpointRuleObject = __esm({
21339
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointRuleObject.js"() {
21340
- }
21341
- });
21342
-
21343
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/ErrorRuleObject.js
21344
- var init_ErrorRuleObject = __esm({
21345
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/ErrorRuleObject.js"() {
21346
- }
21347
- });
21348
-
21349
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/RuleSetObject.js
21350
- var init_RuleSetObject = __esm({
21351
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/RuleSetObject.js"() {
21352
- }
21353
- });
21354
-
21355
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/TreeRuleObject.js
21356
- var init_TreeRuleObject = __esm({
21357
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/TreeRuleObject.js"() {
21358
- }
21359
- });
21360
-
21361
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/shared.js
21362
- var init_shared = __esm({
21363
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/shared.js"() {
21364
- }
21365
- });
21366
-
21367
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/index.js
21368
- var init_types2 = __esm({
21369
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/index.js"() {
21370
- init_EndpointError();
21371
- init_EndpointFunctions();
21372
- init_EndpointRuleObject();
21373
- init_ErrorRuleObject();
21374
- init_RuleSetObject();
21375
- init_TreeRuleObject();
21376
- init_shared();
21377
- }
21378
- });
21379
-
21380
20542
  // node_modules/@smithy/core/dist-es/submodules/endpoints/index.js
21381
20543
  var getEndpointFromInstructions, resolveEndpointConfig, endpointMiddleware, getEndpointPlugin;
21382
20544
  var init_endpoints = __esm({
@@ -21387,7 +20549,6 @@ var init_endpoints = __esm({
21387
20549
  init_getEndpointPlugin();
21388
20550
  init_resolveEndpointConfig();
21389
20551
  init_transport();
21390
- init_types2();
21391
20552
  getEndpointFromInstructions = bindGetEndpointFromInstructions(getEndpointFromConfig);
21392
20553
  resolveEndpointConfig = bindResolveEndpointConfig(getEndpointFromConfig);
21393
20554
  endpointMiddleware = bindEndpointMiddleware(getEndpointFromConfig);
@@ -21491,58 +20652,77 @@ var init_ChecksumStream = __esm({
21491
20652
  "node_modules/@smithy/core/dist-es/submodules/serde/util-stream/checksum/ChecksumStream.js"() {
21492
20653
  import_node_stream = require("node:stream");
21493
20654
  init_toBase64();
21494
- ChecksumStream = class extends import_node_stream.Duplex {
20655
+ ChecksumStream = class extends import_node_stream.Readable {
21495
20656
  expectedChecksum;
21496
20657
  checksumSourceLocation;
21497
20658
  checksum;
21498
20659
  source;
21499
20660
  base64Encoder;
21500
- pendingCallback = null;
21501
20661
  constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder }) {
21502
20662
  super();
21503
- if (typeof source.pipe === "function") {
21504
- this.source = source;
21505
- } else {
20663
+ if (typeof source.pipe !== "function") {
21506
20664
  throw new Error(`@smithy/util-stream: unsupported source type ${source?.constructor?.name ?? source} in ChecksumStream.`);
21507
20665
  }
20666
+ this.source = source;
21508
20667
  this.base64Encoder = base64Encoder ?? toBase64;
21509
20668
  this.expectedChecksum = expectedChecksum;
21510
20669
  this.checksum = checksum;
21511
20670
  this.checksumSourceLocation = checksumSourceLocation;
21512
- this.source.pipe(this);
21513
- }
21514
- _read(size) {
21515
- if (this.pendingCallback) {
21516
- const callback = this.pendingCallback;
21517
- this.pendingCallback = null;
21518
- callback();
20671
+ this.source.on("data", this.onSourceData);
20672
+ this.source.on("end", this.onSourceEnd);
20673
+ this.source.on("error", this.onSourceError);
20674
+ this.source.on("close", this.onSourceClose);
20675
+ this.source.pause();
20676
+ }
20677
+ onSourceData = (chunk) => {
20678
+ if (this.destroyed) {
20679
+ return;
21519
20680
  }
21520
- }
21521
- _write(chunk, encoding, callback) {
21522
20681
  try {
21523
20682
  this.checksum.update(chunk);
21524
- const canPushMore = this.push(chunk);
21525
- if (!canPushMore) {
21526
- this.pendingCallback = callback;
21527
- return;
21528
- }
21529
20683
  } catch (e) {
21530
- return callback(e);
20684
+ this.destroy(e);
20685
+ return;
20686
+ }
20687
+ if (!this.push(chunk)) {
20688
+ this.source.pause();
20689
+ }
20690
+ };
20691
+ onSourceEnd = async () => {
20692
+ if (this.destroyed) {
20693
+ return;
21531
20694
  }
21532
- return callback();
21533
- }
21534
- async _final(callback) {
21535
20695
  try {
21536
20696
  const digest = await this.checksum.digest();
21537
20697
  const received = this.base64Encoder(digest);
21538
20698
  if (this.expectedChecksum !== received) {
21539
- return callback(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}" in response header "${this.checksumSourceLocation}".`));
20699
+ this.destroy(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}" in response header "${this.checksumSourceLocation}".`));
20700
+ return;
21540
20701
  }
21541
20702
  } catch (e) {
21542
- return callback(e);
20703
+ this.destroy(e);
20704
+ return;
21543
20705
  }
21544
20706
  this.push(null);
21545
- return callback();
20707
+ };
20708
+ onSourceError = (error40) => {
20709
+ this.destroy(error40);
20710
+ };
20711
+ onSourceClose = () => {
20712
+ if (!this.destroyed && !this.source.readableEnded) {
20713
+ this.destroy(new Error("Connection lost or stream closed before all data was received."));
20714
+ }
20715
+ };
20716
+ _read(_size2) {
20717
+ this.source.resume();
20718
+ }
20719
+ _destroy(error40, callback) {
20720
+ this.source?.removeListener("data", this.onSourceData);
20721
+ this.source?.removeListener("end", this.onSourceEnd);
20722
+ this.source?.removeListener("error", this.onSourceError);
20723
+ this.source?.removeListener("close", this.onSourceClose);
20724
+ this.source?.destroy();
20725
+ callback(error40);
21546
20726
  }
21547
20727
  };
21548
20728
  }
@@ -22010,6 +21190,7 @@ var import_node_stream4, headStream2, Collector;
22010
21190
  var init_headStream = __esm({
22011
21191
  "node_modules/@smithy/core/dist-es/submodules/serde/util-stream/headStream.js"() {
22012
21192
  import_node_stream4 = require("node:stream");
21193
+ init_concatBytes();
22013
21194
  init_headStream_browser();
22014
21195
  init_stream_type_check();
22015
21196
  headStream2 = (stream2, bytes) => {
@@ -22026,7 +21207,7 @@ var init_headStream = __esm({
22026
21207
  });
22027
21208
  collector.on("error", reject2);
22028
21209
  collector.on("finish", function() {
22029
- const bytes2 = new Uint8Array(Buffer.concat(this.buffers));
21210
+ const bytes2 = concatBytes(this.buffers);
22030
21211
  resolve9(bytes2);
22031
21212
  });
22032
21213
  });
@@ -22066,103 +21247,36 @@ var init_toUtf8_browser = __esm({
22066
21247
  }
22067
21248
  });
22068
21249
 
22069
- // node_modules/@smithy/core/dist-es/submodules/serde/util-base64/fromBase64.browser.js
22070
- var fromBase642;
22071
- var init_fromBase64_browser = __esm({
22072
- "node_modules/@smithy/core/dist-es/submodules/serde/util-base64/fromBase64.browser.js"() {
22073
- init_constants_for_browser();
22074
- fromBase642 = (input) => {
22075
- let totalByteLength = input.length / 4 * 3;
22076
- if (input.slice(-2) === "==") {
22077
- totalByteLength -= 2;
22078
- } else if (input.slice(-1) === "=") {
22079
- totalByteLength--;
22080
- }
22081
- const out = new ArrayBuffer(totalByteLength);
22082
- const dataView = new DataView(out);
22083
- for (let i = 0; i < input.length; i += 4) {
22084
- let bits = 0;
22085
- let bitLength = 0;
22086
- for (let j = i, limit = i + 3; j <= limit; j++) {
22087
- if (input[j] !== "=") {
22088
- if (!(input[j] in alphabetByEncoding)) {
22089
- throw new TypeError(`Invalid character ${input[j]} in base64 string.`);
22090
- }
22091
- bits |= alphabetByEncoding[input[j]] << (limit - j) * bitsPerLetter;
22092
- bitLength += bitsPerLetter;
22093
- } else {
22094
- bits >>= bitsPerLetter;
22095
- }
22096
- }
22097
- const chunkOffset = i / 4 * 3;
22098
- bits >>= bitLength % bitsPerByte;
22099
- const byteLength = Math.floor(bitLength / bitsPerByte);
22100
- for (let k = 0; k < byteLength; k++) {
22101
- const offset2 = (byteLength - k - 1) * bitsPerByte;
22102
- dataView.setUint8(chunkOffset + k, (bits & 255 << offset2) >> offset2);
22103
- }
22104
- }
22105
- return new Uint8Array(out);
22106
- };
22107
- }
22108
- });
22109
-
22110
21250
  // node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.browser.js
22111
21251
  async function collectBlob(blob) {
22112
- const base643 = await readToBase64(blob);
22113
- const arrayBuffer = fromBase642(base643);
22114
- return new Uint8Array(arrayBuffer);
21252
+ return blob.arrayBuffer().then((ab) => new Uint8Array(ab));
22115
21253
  }
22116
- async function collectStream(stream2) {
21254
+ async function collectReadableStream(stream2) {
22117
21255
  const chunks = [];
22118
21256
  const reader = stream2.getReader();
22119
- let isDone = false;
22120
21257
  let length = 0;
22121
- while (!isDone) {
21258
+ while (true) {
22122
21259
  const { done, value } = await reader.read();
22123
21260
  if (value) {
22124
21261
  chunks.push(value);
22125
21262
  length += value.length;
22126
21263
  }
22127
- isDone = done;
22128
- }
22129
- const collected = new Uint8Array(length);
22130
- let offset2 = 0;
22131
- for (const chunk of chunks) {
22132
- collected.set(chunk, offset2);
22133
- offset2 += chunk.length;
21264
+ if (done) {
21265
+ break;
21266
+ }
22134
21267
  }
22135
- return collected;
22136
- }
22137
- function readToBase64(blob) {
22138
- return new Promise((resolve9, reject2) => {
22139
- const reader = new FileReader();
22140
- reader.onloadend = () => {
22141
- if (reader.readyState !== 2) {
22142
- return reject2(new Error("Reader aborted too early"));
22143
- }
22144
- const result = reader.result ?? "";
22145
- const commaIndex = result.indexOf(",");
22146
- const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
22147
- resolve9(result.substring(dataOffset));
22148
- };
22149
- reader.onabort = () => reject2(new Error("Read aborted"));
22150
- reader.onerror = () => reject2(reader.error);
22151
- reader.readAsDataURL(blob);
22152
- });
21268
+ return concatBytes(chunks, length);
22153
21269
  }
22154
21270
  var streamCollector;
22155
21271
  var init_stream_collector_browser = __esm({
22156
21272
  "node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.browser.js"() {
22157
- init_fromBase64_browser();
21273
+ init_concatBytes();
21274
+ init_stream_type_check();
22158
21275
  streamCollector = async (stream2) => {
22159
- if (typeof Blob === "function" && stream2 instanceof Blob || stream2.constructor?.name === "Blob") {
22160
- if (Blob.prototype.arrayBuffer !== void 0) {
22161
- return new Uint8Array(await stream2.arrayBuffer());
22162
- }
21276
+ if (isBlob(stream2)) {
22163
21277
  return collectBlob(stream2);
22164
21278
  }
22165
- return collectStream(stream2);
21279
+ return collectReadableStream(stream2);
22166
21280
  };
22167
21281
  }
22168
21282
  });
@@ -22232,57 +21346,42 @@ var init_sdk_stream_mixin_browser = __esm({
22232
21346
  });
22233
21347
 
22234
21348
  // node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.js
22235
- async function collectReadableStream(stream2) {
22236
- const chunks = [];
22237
- const reader = stream2.getReader();
22238
- let isDone = false;
22239
- let length = 0;
22240
- while (!isDone) {
22241
- const { done, value } = await reader.read();
22242
- if (value) {
22243
- chunks.push(value);
22244
- length += value.length;
22245
- }
22246
- isDone = done;
22247
- }
22248
- const collected = new Uint8Array(length);
22249
- let offset2 = 0;
22250
- for (const chunk of chunks) {
22251
- collected.set(chunk, offset2);
22252
- offset2 += chunk.length;
22253
- }
22254
- return collected;
22255
- }
22256
- var import_node_stream5, Collector2, isReadableStreamInstance, streamCollector2;
21349
+ var import_node_stream5, streamCollector2, Collector2;
22257
21350
  var init_stream_collector = __esm({
22258
21351
  "node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.js"() {
22259
21352
  import_node_stream5 = require("node:stream");
22260
- Collector2 = class extends import_node_stream5.Writable {
22261
- bufferedBytes = [];
22262
- _write(chunk, encoding, callback) {
22263
- this.bufferedBytes.push(chunk);
22264
- callback();
22265
- }
22266
- };
22267
- isReadableStreamInstance = (stream2) => typeof ReadableStream === "function" && stream2 instanceof ReadableStream;
21353
+ init_concatBytes();
21354
+ init_stream_collector_browser();
21355
+ init_stream_type_check();
22268
21356
  streamCollector2 = (stream2) => {
22269
- if (isReadableStreamInstance(stream2)) {
21357
+ if (isBlob(stream2)) {
21358
+ return collectBlob(stream2);
21359
+ }
21360
+ if (isReadableStream(stream2)) {
22270
21361
  return collectReadableStream(stream2);
22271
21362
  }
22272
21363
  return new Promise((resolve9, reject2) => {
22273
21364
  const collector = new Collector2();
22274
- stream2.pipe(collector);
22275
- stream2.on("error", (err) => {
21365
+ const nodeStream = stream2;
21366
+ nodeStream.pipe(collector);
21367
+ nodeStream.on("error", (err) => {
22276
21368
  collector.end();
22277
21369
  reject2(err);
22278
21370
  });
22279
21371
  collector.on("error", reject2);
22280
21372
  collector.on("finish", function() {
22281
- const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
21373
+ const bytes = concatBytes(this.bufferedBytes);
22282
21374
  resolve9(bytes);
22283
21375
  });
22284
21376
  });
22285
21377
  };
21378
+ Collector2 = class extends import_node_stream5.Writable {
21379
+ bufferedBytes = [];
21380
+ _write(chunk, encoding, callback) {
21381
+ this.bufferedBytes.push(chunk);
21382
+ callback();
21383
+ }
21384
+ };
22286
21385
  }
22287
21386
  });
22288
21387
 
@@ -22299,7 +21398,7 @@ var init_sdk_stream_mixin = __esm({
22299
21398
  if (!(stream2 instanceof import_node_stream6.Readable)) {
22300
21399
  try {
22301
21400
  return sdkStreamMixin(stream2);
22302
- } catch (e) {
21401
+ } catch (ignored) {
22303
21402
  const name15 = stream2?.__proto__?.constructor?.name || stream2;
22304
21403
  throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name15}`);
22305
21404
  }
@@ -22386,6 +21485,7 @@ __export(serde_exports, {
22386
21485
  _parseRfc3339DateTimeWithOffset: () => _parseRfc3339DateTimeWithOffset,
22387
21486
  _parseRfc7231DateTime: () => _parseRfc7231DateTime,
22388
21487
  calculateBodyLength: () => calculateBodyLength,
21488
+ concatBytes: () => concatBytes,
22389
21489
  copyDocumentWithTransform: () => copyDocumentWithTransform,
22390
21490
  createBufferedReadable: () => createBufferedReadable,
22391
21491
  createChecksumStream: () => createChecksumStream2,
@@ -22434,6 +21534,7 @@ __export(serde_exports, {
22434
21534
  splitEvery: () => splitEvery,
22435
21535
  splitHeader: () => splitHeader,
22436
21536
  splitStream: () => splitStream2,
21537
+ streamCollector: () => streamCollector2,
22437
21538
  strictParseByte: () => strictParseByte,
22438
21539
  strictParseDouble: () => strictParseDouble,
22439
21540
  strictParseFloat: () => strictParseFloat,
@@ -22470,6 +21571,7 @@ var init_serde = __esm({
22470
21571
  init_hex_encoding();
22471
21572
  init_calculateBodyLength();
22472
21573
  init_toUint8Array();
21574
+ init_concatBytes();
22473
21575
  init_buffer_from();
22474
21576
  init_is_array_buffer();
22475
21577
  init_deserializerMiddleware();
@@ -22484,6 +21586,7 @@ var init_serde = __esm({
22484
21586
  init_sdk_stream_mixin();
22485
21587
  init_splitStream();
22486
21588
  init_stream_type_check();
21589
+ init_stream_collector();
22487
21590
  Uint8ArrayBlobAdapter = class extends bindUint8ArrayBlobAdapter(toUtf8, fromUtf8, toBase64, fromBase64) {
22488
21591
  };
22489
21592
  _getRandomValues = import_node_crypto2.getRandomValues;
@@ -22492,6 +21595,81 @@ var init_serde = __esm({
22492
21595
  }
22493
21596
  });
22494
21597
 
21598
+ // node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Js.js
21599
+ var CRC32_TABLE, ONES, Crc32Js;
21600
+ var init_Crc32Js = __esm({
21601
+ "node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Js.js"() {
21602
+ CRC32_TABLE = new Uint32Array(256);
21603
+ for (let i = 0; i < 256; ++i) {
21604
+ let c = i;
21605
+ for (let j = 0; j < 8; ++j) {
21606
+ c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
21607
+ }
21608
+ CRC32_TABLE[i] = c >>> 0;
21609
+ }
21610
+ ONES = 4294967295;
21611
+ Crc32Js = class {
21612
+ digestLength = 4;
21613
+ checksum = ONES;
21614
+ update(data2) {
21615
+ for (let i = 0; i < data2.length; ++i) {
21616
+ this.checksum = this.checksum >>> 8 ^ CRC32_TABLE[(this.checksum ^ data2[i]) & 255];
21617
+ }
21618
+ }
21619
+ digestSync() {
21620
+ return (this.checksum ^ ONES) >>> 0;
21621
+ }
21622
+ async digest() {
21623
+ const value = this.digestSync();
21624
+ const out = new Uint8Array(4);
21625
+ new DataView(out.buffer).setUint32(0, value, false);
21626
+ return out;
21627
+ }
21628
+ reset() {
21629
+ this.checksum = ONES;
21630
+ }
21631
+ };
21632
+ }
21633
+ });
21634
+
21635
+ // node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Node.js
21636
+ function buildNativeClass(nativeCrc32) {
21637
+ return class Crc32Node {
21638
+ digestLength = 4;
21639
+ value = 0;
21640
+ update(data2) {
21641
+ this.value = nativeCrc32(data2, this.value);
21642
+ }
21643
+ digestSync() {
21644
+ return this.value >>> 0;
21645
+ }
21646
+ async digest() {
21647
+ const out = new Uint8Array(4);
21648
+ new DataView(out.buffer).setUint32(0, this.digestSync(), false);
21649
+ return out;
21650
+ }
21651
+ reset() {
21652
+ this.value = 0;
21653
+ }
21654
+ };
21655
+ }
21656
+ var zlib, zlibCrc32, Crc32Node;
21657
+ var init_Crc32Node = __esm({
21658
+ "node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Node.js"() {
21659
+ zlib = __toESM(require("node:zlib"));
21660
+ init_Crc32Js();
21661
+ zlibCrc32 = typeof zlib.crc32 === "function" ? zlib.crc32 : void 0;
21662
+ Crc32Node = zlibCrc32 ? buildNativeClass(zlibCrc32) : Crc32Js;
21663
+ }
21664
+ });
21665
+
21666
+ // node_modules/@smithy/core/dist-es/submodules/checksum/index.js
21667
+ var init_checksum = __esm({
21668
+ "node_modules/@smithy/core/dist-es/submodules/checksum/index.js"() {
21669
+ init_Crc32Node();
21670
+ }
21671
+ });
21672
+
22495
21673
  // node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/Int64.js
22496
21674
  function negate(bytes) {
22497
21675
  for (let i = 0; i < 8; i++) {
@@ -22573,27 +21751,27 @@ var init_HeaderMarshaller = __esm({
22573
21751
  formatHeaderValue(header) {
22574
21752
  switch (header.type) {
22575
21753
  case "boolean":
22576
- return Uint8Array.from([header.value ? 0 : 1]);
21754
+ return Uint8Array.from([header.value ? HEADER_VALUE_TYPE.boolTrue : HEADER_VALUE_TYPE.boolFalse]);
22577
21755
  case "byte":
22578
- return Uint8Array.from([2, header.value]);
21756
+ return Uint8Array.from([HEADER_VALUE_TYPE.byte, header.value]);
22579
21757
  case "short":
22580
21758
  const shortView = new DataView(new ArrayBuffer(3));
22581
- shortView.setUint8(0, 3);
21759
+ shortView.setUint8(0, HEADER_VALUE_TYPE.short);
22582
21760
  shortView.setInt16(1, header.value, false);
22583
21761
  return new Uint8Array(shortView.buffer);
22584
21762
  case "integer":
22585
21763
  const intView = new DataView(new ArrayBuffer(5));
22586
- intView.setUint8(0, 4);
21764
+ intView.setUint8(0, HEADER_VALUE_TYPE.integer);
22587
21765
  intView.setInt32(1, header.value, false);
22588
21766
  return new Uint8Array(intView.buffer);
22589
21767
  case "long":
22590
21768
  const longBytes = new Uint8Array(9);
22591
- longBytes[0] = 5;
21769
+ longBytes[0] = HEADER_VALUE_TYPE.long;
22592
21770
  longBytes.set(header.value.bytes, 1);
22593
21771
  return longBytes;
22594
21772
  case "binary":
22595
21773
  const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
22596
- binView.setUint8(0, 6);
21774
+ binView.setUint8(0, HEADER_VALUE_TYPE.byteArray);
22597
21775
  binView.setUint16(1, header.value.byteLength, false);
22598
21776
  const binBytes = new Uint8Array(binView.buffer);
22599
21777
  binBytes.set(header.value, 3);
@@ -22601,14 +21779,14 @@ var init_HeaderMarshaller = __esm({
22601
21779
  case "string":
22602
21780
  const utf8Bytes = this.fromUtf8(header.value);
22603
21781
  const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
22604
- strView.setUint8(0, 7);
21782
+ strView.setUint8(0, HEADER_VALUE_TYPE.string);
22605
21783
  strView.setUint16(1, utf8Bytes.byteLength, false);
22606
21784
  const strBytes = new Uint8Array(strView.buffer);
22607
21785
  strBytes.set(utf8Bytes, 3);
22608
21786
  return strBytes;
22609
21787
  case "timestamp":
22610
21788
  const tsBytes = new Uint8Array(9);
22611
- tsBytes[0] = 8;
21789
+ tsBytes[0] = HEADER_VALUE_TYPE.timestamp;
22612
21790
  tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
22613
21791
  return tsBytes;
22614
21792
  case "uuid":
@@ -22616,8 +21794,8 @@ var init_HeaderMarshaller = __esm({
22616
21794
  throw new Error(`Invalid UUID received: ${header.value}`);
22617
21795
  }
22618
21796
  const uuidBytes = new Uint8Array(17);
22619
- uuidBytes[0] = 9;
22620
- uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
21797
+ uuidBytes[0] = HEADER_VALUE_TYPE.uuid;
21798
+ uuidBytes.set(fromHex(header.value.replace(/-/g, "")), 1);
22621
21799
  return uuidBytes;
22622
21800
  }
22623
21801
  }
@@ -22629,46 +21807,46 @@ var init_HeaderMarshaller = __esm({
22629
21807
  const name15 = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));
22630
21808
  position += nameLength;
22631
21809
  switch (headers.getUint8(position++)) {
22632
- case 0:
21810
+ case HEADER_VALUE_TYPE.boolTrue:
22633
21811
  out[name15] = {
22634
21812
  type: BOOLEAN_TAG,
22635
21813
  value: true
22636
21814
  };
22637
21815
  break;
22638
- case 1:
21816
+ case HEADER_VALUE_TYPE.boolFalse:
22639
21817
  out[name15] = {
22640
21818
  type: BOOLEAN_TAG,
22641
21819
  value: false
22642
21820
  };
22643
21821
  break;
22644
- case 2:
21822
+ case HEADER_VALUE_TYPE.byte:
22645
21823
  out[name15] = {
22646
21824
  type: BYTE_TAG,
22647
21825
  value: headers.getInt8(position++)
22648
21826
  };
22649
21827
  break;
22650
- case 3:
21828
+ case HEADER_VALUE_TYPE.short:
22651
21829
  out[name15] = {
22652
21830
  type: SHORT_TAG,
22653
21831
  value: headers.getInt16(position, false)
22654
21832
  };
22655
21833
  position += 2;
22656
21834
  break;
22657
- case 4:
21835
+ case HEADER_VALUE_TYPE.integer:
22658
21836
  out[name15] = {
22659
21837
  type: INT_TAG,
22660
21838
  value: headers.getInt32(position, false)
22661
21839
  };
22662
21840
  position += 4;
22663
21841
  break;
22664
- case 5:
21842
+ case HEADER_VALUE_TYPE.long:
22665
21843
  out[name15] = {
22666
21844
  type: LONG_TAG,
22667
21845
  value: new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8))
22668
21846
  };
22669
21847
  position += 8;
22670
21848
  break;
22671
- case 6:
21849
+ case HEADER_VALUE_TYPE.byteArray:
22672
21850
  const binaryLength = headers.getUint16(position, false);
22673
21851
  position += 2;
22674
21852
  out[name15] = {
@@ -22677,7 +21855,7 @@ var init_HeaderMarshaller = __esm({
22677
21855
  };
22678
21856
  position += binaryLength;
22679
21857
  break;
22680
- case 7:
21858
+ case HEADER_VALUE_TYPE.string:
22681
21859
  const stringLength = headers.getUint16(position, false);
22682
21860
  position += 2;
22683
21861
  out[name15] = {
@@ -22686,14 +21864,14 @@ var init_HeaderMarshaller = __esm({
22686
21864
  };
22687
21865
  position += stringLength;
22688
21866
  break;
22689
- case 8:
21867
+ case HEADER_VALUE_TYPE.timestamp:
22690
21868
  out[name15] = {
22691
21869
  type: TIMESTAMP_TAG,
22692
21870
  value: new Date(new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf())
22693
21871
  };
22694
21872
  position += 8;
22695
21873
  break;
22696
- case 9:
21874
+ case HEADER_VALUE_TYPE.uuid:
22697
21875
  const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);
22698
21876
  position += 16;
22699
21877
  out[name15] = {
@@ -22746,23 +21924,24 @@ function splitMessage({ byteLength, byteOffset, buffer }) {
22746
21924
  const headerLength = view.getUint32(PRELUDE_MEMBER_LENGTH, false);
22747
21925
  const expectedPreludeChecksum = view.getUint32(PRELUDE_LENGTH, false);
22748
21926
  const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH, false);
22749
- const checksummer = new import_crc32.Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH));
22750
- if (expectedPreludeChecksum !== checksummer.digest()) {
22751
- throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digest()})`);
21927
+ const checksummer = new Crc32Node();
21928
+ checksummer.update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH));
21929
+ if (expectedPreludeChecksum !== checksummer.digestSync()) {
21930
+ throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digestSync()})`);
22752
21931
  }
22753
21932
  checksummer.update(new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH, byteLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH)));
22754
- if (expectedMessageChecksum !== checksummer.digest()) {
22755
- throw new Error(`The message checksum (${checksummer.digest()}) did not match the expected value of ${expectedMessageChecksum}`);
21933
+ if (expectedMessageChecksum !== checksummer.digestSync()) {
21934
+ throw new Error(`The message checksum (${checksummer.digestSync()}) did not match the expected value of ${expectedMessageChecksum}`);
22756
21935
  }
22757
21936
  return {
22758
21937
  headers: new DataView(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH, headerLength),
22759
21938
  body: new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH + headerLength, messageLength - headerLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH + CHECKSUM_LENGTH))
22760
21939
  };
22761
21940
  }
22762
- var import_crc32, PRELUDE_MEMBER_LENGTH, PRELUDE_LENGTH, CHECKSUM_LENGTH, MINIMUM_MESSAGE_LENGTH;
21941
+ var PRELUDE_MEMBER_LENGTH, PRELUDE_LENGTH, CHECKSUM_LENGTH, MINIMUM_MESSAGE_LENGTH;
22763
21942
  var init_splitMessage = __esm({
22764
21943
  "node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/splitMessage.js"() {
22765
- import_crc32 = __toESM(require_main3());
21944
+ init_checksum();
22766
21945
  PRELUDE_MEMBER_LENGTH = 4;
22767
21946
  PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
22768
21947
  CHECKSUM_LENGTH = 4;
@@ -22771,10 +21950,10 @@ var init_splitMessage = __esm({
22771
21950
  });
22772
21951
 
22773
21952
  // node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/EventStreamCodec.js
22774
- var import_crc322, EventStreamCodec;
21953
+ var EventStreamCodec;
22775
21954
  var init_EventStreamCodec = __esm({
22776
21955
  "node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/EventStreamCodec.js"() {
22777
- import_crc322 = __toESM(require_main3());
21956
+ init_checksum();
22778
21957
  init_HeaderMarshaller();
22779
21958
  init_splitMessage();
22780
21959
  EventStreamCodec = class {
@@ -22822,13 +22001,15 @@ var init_EventStreamCodec = __esm({
22822
22001
  const length = headers.byteLength + body.byteLength + 16;
22823
22002
  const out = new Uint8Array(length);
22824
22003
  const view = new DataView(out.buffer, out.byteOffset, out.byteLength);
22825
- const checksum = new import_crc322.Crc32();
22004
+ const checksum = new Crc32Node();
22826
22005
  view.setUint32(0, length, false);
22827
22006
  view.setUint32(4, headers.byteLength, false);
22828
- view.setUint32(8, checksum.update(out.subarray(0, 8)).digest(), false);
22007
+ checksum.update(out.subarray(0, 8));
22008
+ view.setUint32(8, checksum.digestSync(), false);
22829
22009
  out.set(headers, 12);
22830
22010
  out.set(body, headers.byteLength + 12);
22831
- view.setUint32(length - 4, checksum.update(out.subarray(8, length - 4)).digest(), false);
22011
+ checksum.update(out.subarray(8, length - 4));
22012
+ view.setUint32(length - 4, checksum.digestSync(), false);
22832
22013
  return out;
22833
22014
  }
22834
22015
  decode(message) {
@@ -23192,6 +22373,7 @@ var init_EventStreamSerdeConfig = __esm({
23192
22373
  var EventStreamSerde;
23193
22374
  var init_EventStreamSerde = __esm({
23194
22375
  "node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js"() {
22376
+ init_schema();
23195
22377
  init_serde();
23196
22378
  EventStreamSerde = class {
23197
22379
  marshaller;
@@ -23199,12 +22381,14 @@ var init_EventStreamSerde = __esm({
23199
22381
  deserializer;
23200
22382
  serdeContext;
23201
22383
  defaultContentType;
23202
- constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType }) {
22384
+ compositeErrorRegistry;
22385
+ constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType, compositeErrorRegistry }) {
23203
22386
  this.marshaller = marshaller;
23204
22387
  this.serializer = serializer;
23205
22388
  this.deserializer = deserializer;
23206
22389
  this.serdeContext = serdeContext;
23207
22390
  this.defaultContentType = defaultContentType;
22391
+ this.compositeErrorRegistry = compositeErrorRegistry;
23208
22392
  }
23209
22393
  async serializeEventStream({ eventStream, requestSchema, initialRequest }) {
23210
22394
  const marshaller = this.marshaller;
@@ -23314,16 +22498,9 @@ var init_EventStreamSerde = __esm({
23314
22498
  }
23315
22499
  }
23316
22500
  }
23317
- if (hasBindings) {
23318
- return {
23319
- [unionMember]: out
23320
- };
23321
- }
23322
- if (body.byteLength === 0) {
23323
- return {
23324
- [unionMember]: {}
23325
- };
23326
- }
22501
+ return {
22502
+ [unionMember]: await this.readEventMember(eventStreamSchema, body, hasBindings, out)
22503
+ };
23327
22504
  }
23328
22505
  return {
23329
22506
  [unionMember]: await this.deserializer.read(eventStreamSchema, body)
@@ -23362,6 +22539,29 @@ var init_EventStreamSerde = __esm({
23362
22539
  }
23363
22540
  };
23364
22541
  }
22542
+ async readEventMember(eventStreamSchema, body, hasBindings, out) {
22543
+ let ErrCtor;
22544
+ const staticStructuralSchema = eventStreamSchema.getSchema();
22545
+ if (Array.isArray(staticStructuralSchema) && staticStructuralSchema[0] === -3) {
22546
+ const namespace = staticStructuralSchema[1];
22547
+ const nsRegistry = TypeRegistry.for(namespace);
22548
+ this.compositeErrorRegistry?.copyFrom(nsRegistry);
22549
+ ErrCtor = (this.compositeErrorRegistry ?? nsRegistry)?.getErrorCtor(staticStructuralSchema);
22550
+ }
22551
+ const dataObject = hasBindings ? out : body.byteLength === 0 ? {} : await this.deserializer.read(eventStreamSchema, body);
22552
+ if (ErrCtor) {
22553
+ const message = dataObject.message ?? dataObject.Message ?? "Unknown";
22554
+ const metadata = {};
22555
+ const $fault = eventStreamSchema.getMergedTraits().error;
22556
+ if ($fault) {
22557
+ metadata.$fault = $fault;
22558
+ }
22559
+ return Object.assign(new ErrCtor({}), metadata, {
22560
+ message
22561
+ }, dataObject);
22562
+ }
22563
+ return dataObject;
22564
+ }
23365
22565
  writeEventBody(unionMember, unionSchema, event) {
23366
22566
  const serializer = this.serializer;
23367
22567
  let eventType = unionMember;
@@ -23480,7 +22680,7 @@ var init_event_streams = __esm({
23480
22680
  });
23481
22681
 
23482
22682
  // node_modules/@smithy/eventstream-codec/dist-cjs/index.js
23483
- var require_dist_cjs5 = __commonJS({
22683
+ var require_dist_cjs2 = __commonJS({
23484
22684
  "node_modules/@smithy/eventstream-codec/dist-cjs/index.js"(exports2) {
23485
22685
  "use strict";
23486
22686
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -23511,7 +22711,7 @@ var require_dist_cjs5 = __commonJS({
23511
22711
  });
23512
22712
 
23513
22713
  // node_modules/@smithy/util-utf8/dist-cjs/index.js
23514
- var require_dist_cjs6 = __commonJS({
22714
+ var require_dist_cjs3 = __commonJS({
23515
22715
  "node_modules/@smithy/util-utf8/dist-cjs/index.js"(exports2) {
23516
22716
  "use strict";
23517
22717
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -23765,10 +22965,21 @@ var init_aws4fetch_esm = __esm({
23765
22965
  });
23766
22966
 
23767
22967
  // node_modules/@ai-sdk/amazon-bedrock/dist/index.mjs
22968
+ function supportsStrictTools(modelId) {
22969
+ return !rejectsNewerSchemaFields(modelId);
22970
+ }
22971
+ function supportsNativeStructuredOutput(modelId) {
22972
+ return !rejectsNewerSchemaFields(modelId);
22973
+ }
22974
+ function rejectsNewerSchemaFields(modelId) {
22975
+ return MODELS_REJECTING_NEWER_SCHEMA_FIELDS.some(
22976
+ (model) => modelId.includes(model)
22977
+ );
22978
+ }
23768
22979
  function createBedrockEventStreamDecoder(body, processEvent) {
23769
22980
  const codec = new import_eventstream_codec.EventStreamCodec(import_util_utf8.toUtf8, import_util_utf8.fromUtf8);
23770
22981
  let buffer = new Uint8Array(0);
23771
- const textDecoder2 = new TextDecoder();
22982
+ const textDecoder3 = new TextDecoder();
23772
22983
  return body.pipeThrough(
23773
22984
  new TransformStream({
23774
22985
  async transform(chunk, controller) {
@@ -23792,7 +23003,7 @@ function createBedrockEventStreamDecoder(body, processEvent) {
23792
23003
  buffer = buffer.slice(totalLength);
23793
23004
  const messageType = (_a17 = decoded.headers[":message-type"]) == null ? void 0 : _a17.value;
23794
23005
  const eventType = (_b16 = decoded.headers[":event-type"]) == null ? void 0 : _b16.value;
23795
- const data2 = textDecoder2.decode(decoded.body);
23006
+ const data2 = textDecoder3.decode(decoded.body);
23796
23007
  await processEvent({ messageType, eventType, data: data2 }, controller);
23797
23008
  } catch (e) {
23798
23009
  break;
@@ -23848,7 +23059,7 @@ async function prepareTools({
23848
23059
  toolChoice: preparedAnthropicToolChoice,
23849
23060
  toolWarnings: anthropicToolWarnings,
23850
23061
  betas: anthropicBetas
23851
- } = await (0, import_internal2.prepareTools)({
23062
+ } = await (0, import_internal3.prepareTools)({
23852
23063
  tools: ProviderTools,
23853
23064
  toolChoice,
23854
23065
  supportsStructuredOutput: false,
@@ -23862,7 +23073,7 @@ async function prepareTools({
23862
23073
  };
23863
23074
  }
23864
23075
  for (const tool6 of ProviderTools) {
23865
- const toolFactory = Object.values(import_internal2.anthropicTools).find((factory) => {
23076
+ const toolFactory = Object.values(import_internal3.anthropicTools).find((factory) => {
23866
23077
  const instance = factory({});
23867
23078
  return instance.id === tool6.id;
23868
23079
  });
@@ -23886,12 +23097,13 @@ async function prepareTools({
23886
23097
  }
23887
23098
  }
23888
23099
  const filteredFunctionTools = (toolChoice == null ? void 0 : toolChoice.type) === "tool" ? functionTools.filter((t) => t.name === toolChoice.toolName) : functionTools;
23100
+ const supportsStrictOnTools = supportsStrictTools(modelId);
23889
23101
  for (const tool6 of filteredFunctionTools) {
23890
23102
  bedrockTools.push({
23891
23103
  toolSpec: {
23892
23104
  name: tool6.name,
23893
23105
  ...((_a17 = tool6.description) == null ? void 0 : _a17.trim()) !== "" ? { description: tool6.description } : {},
23894
- ...tool6.strict != null ? { strict: tool6.strict } : {},
23106
+ ...tool6.strict != null && supportsStrictOnTools ? { strict: tool6.strict } : {},
23895
23107
  inputSchema: {
23896
23108
  json: tool6.inputSchema
23897
23109
  }
@@ -23992,6 +23204,32 @@ function pushCachePoint(content, providerMetadata) {
23992
23204
  content.push(cachePoint);
23993
23205
  }
23994
23206
  }
23207
+ function sanitizeToolName(toolName) {
23208
+ return toolName.replace(/[^a-zA-Z0-9_-]/g, "") || "_";
23209
+ }
23210
+ function getBedrockImageSource({
23211
+ data: data2,
23212
+ functionality
23213
+ }) {
23214
+ if (data2 instanceof URL) {
23215
+ if (data2.protocol !== "s3:") {
23216
+ throw new UnsupportedFunctionalityError({ functionality });
23217
+ }
23218
+ return {
23219
+ s3Location: {
23220
+ uri: data2.toString()
23221
+ }
23222
+ };
23223
+ }
23224
+ return { bytes: convertToBase64(data2) };
23225
+ }
23226
+ function getBedrockImageFormatFromUrl(url2) {
23227
+ var _a17;
23228
+ const extension = (_a17 = url2.pathname.split(".").pop()) == null ? void 0 : _a17.toLowerCase();
23229
+ return getBedrockImageFormat(
23230
+ `image/${extension === "jpg" ? "jpeg" : extension}`
23231
+ );
23232
+ }
23995
23233
  async function shouldEnableCitations(providerMetadata) {
23996
23234
  var _a17, _b16;
23997
23235
  const bedrockOptions = await parseProviderOptions({
@@ -24044,19 +23282,22 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
24044
23282
  break;
24045
23283
  }
24046
23284
  case "file": {
24047
- if (part.data instanceof URL) {
24048
- throw new UnsupportedFunctionalityError({
24049
- functionality: "File URL data"
24050
- });
24051
- }
24052
23285
  if (part.mediaType.startsWith("image/")) {
24053
23286
  bedrockContent.push({
24054
23287
  image: {
24055
23288
  format: getBedrockImageFormat(part.mediaType),
24056
- source: { bytes: convertToBase64(part.data) }
23289
+ source: getBedrockImageSource({
23290
+ data: part.data,
23291
+ functionality: "File URL data"
23292
+ })
24057
23293
  }
24058
23294
  });
24059
23295
  } else {
23296
+ if (part.data instanceof URL) {
23297
+ throw new UnsupportedFunctionalityError({
23298
+ functionality: "File URL data"
23299
+ });
23300
+ }
24060
23301
  if (!part.mediaType) {
24061
23302
  throw new UnsupportedFunctionalityError({
24062
23303
  functionality: "file without mime type",
@@ -24110,6 +23351,18 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
24110
23351
  }
24111
23352
  };
24112
23353
  }
23354
+ case "image-url": {
23355
+ const url2 = new URL(contentPart.url);
23356
+ return {
23357
+ image: {
23358
+ format: getBedrockImageFormatFromUrl(url2),
23359
+ source: getBedrockImageSource({
23360
+ data: url2,
23361
+ functionality: `tool result image URL "${contentPart.url}"`
23362
+ })
23363
+ }
23364
+ };
23365
+ }
24113
23366
  case "file-data": {
24114
23367
  if (!contentPart.mediaType.startsWith("image/")) {
24115
23368
  const enableCitations = await shouldEnableCitations(
@@ -24157,7 +23410,7 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
24157
23410
  break;
24158
23411
  case "execution-denied":
24159
23412
  toolResultContent = [
24160
- { text: (_a17 = output.reason) != null ? _a17 : "Tool execution denied." }
23413
+ { text: (_a17 = output.reason) != null ? _a17 : "Tool call execution denied." }
24161
23414
  ];
24162
23415
  break;
24163
23416
  case "json":
@@ -24250,7 +23503,7 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
24250
23503
  bedrockContent.push({
24251
23504
  toolUse: {
24252
23505
  toolUseId: normalizeToolCallId(part.toolCallId, isMistral),
24253
- name: part.toolName,
23506
+ name: sanitizeToolName(part.toolName),
24254
23507
  input: part.input
24255
23508
  }
24256
23509
  });
@@ -24363,6 +23616,12 @@ function mapBedrockFinishReason(finishReason, isJsonResponseFromTool) {
24363
23616
  return "other";
24364
23617
  }
24365
23618
  }
23619
+ function isCohereEmbeddingModel(modelId) {
23620
+ return modelId.includes("cohere.embed-");
23621
+ }
23622
+ function isNovaEmbeddingModel(modelId) {
23623
+ return modelId.startsWith("amazon.nova-") && modelId.includes("embed");
23624
+ }
24366
23625
  function getBase64Data(file2) {
24367
23626
  if (file2.type === "url") {
24368
23627
  throw new Error(
@@ -24597,22 +23856,23 @@ Original error: ${errorMessage}`
24597
23856
  provider.tools = import_internal.anthropicTools;
24598
23857
  return provider;
24599
23858
  }
24600
- var import_internal, import_eventstream_codec, import_util_utf8, import_internal2, BEDROCK_STOP_REASONS, BEDROCK_IMAGE_MIME_TYPES, BEDROCK_DOCUMENT_MIME_TYPES, bedrockFilePartProviderOptions, amazonBedrockLanguageModelOptions, BedrockErrorSchema, createBedrockEventStreamResponseHandler, bedrockReasoningMetadataSchema, BedrockChatLanguageModel, BedrockStopReasonSchema, BedrockAdditionalModelResponseFieldsSchema, BedrockToolUseSchema, BedrockReasoningTextSchema, BedrockRedactedReasoningSchema, BedrockResponseSchema, BedrockStreamSchema, amazonBedrockEmbeddingModelOptionsSchema, BedrockEmbeddingModel, BedrockEmbeddingResponseSchema, modelMaxImagesPerCall, BedrockImageModel, bedrockImageResponseSchema, VERSION2, bedrockRerankingResponseSchema, amazonBedrockRerankingModelOptionsSchema, BedrockRerankingModel, bedrock;
23859
+ var import_internal, import_internal2, import_eventstream_codec, import_util_utf8, import_internal3, BEDROCK_STOP_REASONS, BEDROCK_IMAGE_MIME_TYPES, BEDROCK_DOCUMENT_MIME_TYPES, bedrockFilePartProviderOptions, amazonBedrockLanguageModelOptions, MODELS_REJECTING_NEWER_SCHEMA_FIELDS, BedrockErrorSchema, createBedrockEventStreamResponseHandler, bedrockReasoningMetadataSchema, BedrockChatLanguageModel, JsonObjectTextExtractor, BedrockStopReasonSchema, BedrockAdditionalModelResponseFieldsSchema, BedrockToolUseSchema, BedrockReasoningTextSchema, BedrockRedactedReasoningSchema, BedrockResponseSchema, BedrockStreamSchema, amazonBedrockEmbeddingModelOptionsSchema, BedrockEmbeddingModel, BedrockEmbeddingResponseSchema, modelMaxImagesPerCall, BedrockImageModel, bedrockImageResponseSchema, VERSION2, bedrockRerankingResponseSchema, amazonBedrockRerankingModelOptionsSchema, BedrockRerankingModel, bedrock;
24601
23860
  var init_dist3 = __esm({
24602
23861
  "node_modules/@ai-sdk/amazon-bedrock/dist/index.mjs"() {
24603
23862
  import_internal = require("@ai-sdk/anthropic/internal");
24604
23863
  init_dist2();
24605
23864
  init_dist2();
23865
+ import_internal2 = require("@ai-sdk/anthropic/internal");
24606
23866
  init_v4();
24607
23867
  init_v4();
24608
23868
  init_v4();
24609
23869
  init_dist();
24610
23870
  init_dist2();
24611
- import_eventstream_codec = __toESM(require_dist_cjs5(), 1);
24612
- import_util_utf8 = __toESM(require_dist_cjs6(), 1);
23871
+ import_eventstream_codec = __toESM(require_dist_cjs2(), 1);
23872
+ import_util_utf8 = __toESM(require_dist_cjs3(), 1);
24613
23873
  init_dist();
24614
23874
  init_dist2();
24615
- import_internal2 = require("@ai-sdk/anthropic/internal");
23875
+ import_internal3 = require("@ai-sdk/anthropic/internal");
24616
23876
  init_dist();
24617
23877
  init_dist2();
24618
23878
  init_v4();
@@ -24702,6 +23962,13 @@ var init_dist3 = __esm({
24702
23962
  */
24703
23963
  serviceTier: external_exports.enum(["reserved", "priority", "default", "flex"]).optional()
24704
23964
  });
23965
+ MODELS_REJECTING_NEWER_SCHEMA_FIELDS = [
23966
+ "claude-opus-4-7",
23967
+ "claude-opus-4-8",
23968
+ "claude-opus-5",
23969
+ "claude-fable-5",
23970
+ "claude-sonnet-5"
23971
+ ];
24705
23972
  BedrockErrorSchema = external_exports.object({
24706
23973
  message: external_exports.string(),
24707
23974
  type: external_exports.string().nullish()
@@ -24755,7 +24022,7 @@ var init_dist3 = __esm({
24755
24022
  this.specificationVersion = "v3";
24756
24023
  this.provider = "amazon-bedrock";
24757
24024
  this.supportedUrls = {
24758
- // no supported urls for bedrock
24025
+ "image/*": [/^s3:\/\//]
24759
24026
  };
24760
24027
  }
24761
24028
  async getArgs({
@@ -24822,8 +24089,10 @@ var init_dist3 = __esm({
24822
24089
  }
24823
24090
  const isAnthropicModel = this.modelId.includes("anthropic");
24824
24091
  const isThinkingEnabled = ((_b16 = bedrockOptions.reasoningConfig) == null ? void 0 : _b16.type) === "enabled" || ((_c = bedrockOptions.reasoningConfig) == null ? void 0 : _c.type) === "adaptive";
24825
- const useNativeStructuredOutput = isAnthropicModel && isThinkingEnabled && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
24826
- const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useNativeStructuredOutput ? {
24092
+ const { supportsStructuredOutput: modelSupportsStructuredOutput } = (0, import_internal2.getModelCapabilities)(this.modelId);
24093
+ const useNativeStructuredOutput = isAnthropicModel && supportsNativeStructuredOutput(this.modelId) && (modelSupportsStructuredOutput || isThinkingEnabled) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
24094
+ const useJsonInstructionForStructuredOutput = isAnthropicModel && (this.modelId.includes("claude-opus-4-7") || this.modelId.includes("claude-opus-4-8")) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && tools2 != null && tools2.length > 0;
24095
+ const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useNativeStructuredOutput && !useJsonInstructionForStructuredOutput ? {
24827
24096
  type: "function",
24828
24097
  name: "json",
24829
24098
  description: "Respond with a JSON object.",
@@ -24933,7 +24202,7 @@ var init_dist3 = __esm({
24933
24202
  ...(_k = bedrockOptions.additionalModelRequestFields) == null ? void 0 : _k.output_config,
24934
24203
  format: {
24935
24204
  type: "json_schema",
24936
- schema: responseFormat.schema
24205
+ schema: (0, import_internal2.sanitizeJsonSchema)(responseFormat.schema)
24937
24206
  }
24938
24207
  }
24939
24208
  };
@@ -24988,6 +24257,13 @@ var init_dist3 = __esm({
24988
24257
  });
24989
24258
  }
24990
24259
  }
24260
+ if (useJsonInstructionForStructuredOutput) {
24261
+ filteredPrompt = injectJsonInstructionIntoMessages({
24262
+ messages: filteredPrompt,
24263
+ schema: responseFormat.schema,
24264
+ schemaSuffix: "You MUST answer with only a JSON object that matches the JSON schema above. Do not wrap it in markdown fences or include any other text."
24265
+ });
24266
+ }
24991
24267
  const isMistral = isMistralModel(this.modelId);
24992
24268
  const { system, messages } = await convertToBedrockChatMessages(
24993
24269
  filteredPrompt,
@@ -25020,6 +24296,7 @@ var init_dist3 = __esm({
25020
24296
  ...toolConfig.tools !== void 0 && toolConfig.tools.length > 0 ? { toolConfig } : {}
25021
24297
  },
25022
24298
  warnings,
24299
+ usesJsonInstruction: useJsonInstructionForStructuredOutput,
25023
24300
  usesJsonResponseTool: jsonResponseTool != null,
25024
24301
  betas
25025
24302
  };
@@ -25030,10 +24307,11 @@ var init_dist3 = __esm({
25030
24307
  return combineHeaders(await resolve(this.config.headers), headers);
25031
24308
  }
25032
24309
  async doGenerate(options) {
25033
- var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
24310
+ var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
25034
24311
  const {
25035
24312
  command: args,
25036
24313
  warnings,
24314
+ usesJsonInstruction,
25037
24315
  usesJsonResponseTool
25038
24316
  } = await this.getArgs(options);
25039
24317
  const url2 = `${this.getUrl(this.modelId)}/converse`;
@@ -25056,9 +24334,13 @@ var init_dist3 = __esm({
25056
24334
  });
25057
24335
  const content = [];
25058
24336
  let isJsonResponseFromTool = false;
24337
+ const jsonObjectTextExtractor = usesJsonInstruction ? new JsonObjectTextExtractor() : void 0;
25059
24338
  for (const part of response.output.message.content) {
25060
24339
  if (part.text != null) {
25061
- content.push({ type: "text", text: part.text });
24340
+ content.push({
24341
+ type: "text",
24342
+ text: (_a17 = jsonObjectTextExtractor == null ? void 0 : jsonObjectTextExtractor.process(part.text)) != null ? _a17 : part.text
24343
+ });
25062
24344
  }
25063
24345
  if (part.reasoningContent) {
25064
24346
  if ("reasoningText" in part.reasoningContent) {
@@ -25080,7 +24362,7 @@ var init_dist3 = __esm({
25080
24362
  text: "",
25081
24363
  providerMetadata: {
25082
24364
  bedrock: {
25083
- redactedData: (_a17 = part.reasoningContent.redactedReasoning.data) != null ? _a17 : ""
24365
+ redactedData: (_b16 = part.reasoningContent.redactedReasoning.data) != null ? _b16 : ""
25084
24366
  }
25085
24367
  }
25086
24368
  });
@@ -25096,17 +24378,17 @@ var init_dist3 = __esm({
25096
24378
  });
25097
24379
  } else {
25098
24380
  const isMistral = isMistralModel(this.modelId);
25099
- const rawToolCallId = (_c = (_b16 = part.toolUse) == null ? void 0 : _b16.toolUseId) != null ? _c : this.config.generateId();
24381
+ const rawToolCallId = (_d = (_c = part.toolUse) == null ? void 0 : _c.toolUseId) != null ? _d : this.config.generateId();
25100
24382
  content.push({
25101
24383
  type: "tool-call",
25102
24384
  toolCallId: normalizeToolCallId(rawToolCallId, isMistral),
25103
- toolName: (_e = (_d = part.toolUse) == null ? void 0 : _d.name) != null ? _e : `tool-${this.config.generateId()}`,
25104
- input: JSON.stringify((_g = (_f = part.toolUse) == null ? void 0 : _f.input) != null ? _g : {})
24385
+ toolName: (_f = (_e = part.toolUse) == null ? void 0 : _e.name) != null ? _f : `tool-${this.config.generateId()}`,
24386
+ input: JSON.stringify((_h = (_g = part.toolUse) == null ? void 0 : _g.input) != null ? _h : {})
25105
24387
  });
25106
24388
  }
25107
24389
  }
25108
24390
  }
25109
- const stopSequence = (_j = (_i = (_h = response.additionalModelResponseFields) == null ? void 0 : _h.delta) == null ? void 0 : _i.stop_sequence) != null ? _j : null;
24391
+ const stopSequence = (_k = (_j = (_i = response.additionalModelResponseFields) == null ? void 0 : _i.delta) == null ? void 0 : _j.stop_sequence) != null ? _k : null;
25110
24392
  const providerMetadata = response.trace || response.usage || response.performanceConfig || response.serviceTier || isJsonResponseFromTool || stopSequence ? {
25111
24393
  bedrock: {
25112
24394
  ...response.trace && typeof response.trace === "object" ? { trace: response.trace } : {},
@@ -25116,7 +24398,7 @@ var init_dist3 = __esm({
25116
24398
  ...response.serviceTier && {
25117
24399
  serviceTier: response.serviceTier
25118
24400
  },
25119
- ...(((_k = response.usage) == null ? void 0 : _k.cacheWriteInputTokens) != null || ((_l = response.usage) == null ? void 0 : _l.cacheDetails) != null) && {
24401
+ ...(((_l = response.usage) == null ? void 0 : _l.cacheWriteInputTokens) != null || ((_m = response.usage) == null ? void 0 : _m.cacheDetails) != null) && {
25120
24402
  usage: {
25121
24403
  ...response.usage.cacheWriteInputTokens != null && {
25122
24404
  cacheWriteInputTokens: response.usage.cacheWriteInputTokens
@@ -25137,16 +24419,17 @@ var init_dist3 = __esm({
25137
24419
  response.stopReason,
25138
24420
  isJsonResponseFromTool
25139
24421
  ),
25140
- raw: (_m = response.stopReason) != null ? _m : void 0
24422
+ raw: (_n = response.stopReason) != null ? _n : void 0
25141
24423
  },
25142
24424
  usage: convertBedrockUsage(response.usage),
25143
24425
  response: {
25144
- id: (_n = responseHeaders == null ? void 0 : responseHeaders["x-amzn-requestid"]) != null ? _n : void 0,
24426
+ id: (_o = responseHeaders == null ? void 0 : responseHeaders["x-amzn-requestid"]) != null ? _o : void 0,
25145
24427
  timestamp: (responseHeaders == null ? void 0 : responseHeaders["date"]) != null ? new Date(responseHeaders["date"]) : void 0,
25146
24428
  modelId: this.modelId,
25147
24429
  headers: responseHeaders
25148
24430
  },
25149
24431
  warnings,
24432
+ request: { body: args },
25150
24433
  ...providerMetadata && { providerMetadata }
25151
24434
  };
25152
24435
  }
@@ -25154,6 +24437,7 @@ var init_dist3 = __esm({
25154
24437
  const {
25155
24438
  command: args,
25156
24439
  warnings,
24440
+ usesJsonInstruction,
25157
24441
  usesJsonResponseTool
25158
24442
  } = await this.getArgs(options);
25159
24443
  const modelId = this.modelId;
@@ -25179,6 +24463,7 @@ var init_dist3 = __esm({
25179
24463
  let providerMetadata = void 0;
25180
24464
  let isJsonResponseFromTool = false;
25181
24465
  let stopSequence = null;
24466
+ const jsonObjectTextExtractor = usesJsonInstruction ? new JsonObjectTextExtractor() : void 0;
25182
24467
  const contentBlocks = {};
25183
24468
  return {
25184
24469
  stream: response.pipeThrough(
@@ -25194,7 +24479,7 @@ var init_dist3 = __esm({
25194
24479
  });
25195
24480
  },
25196
24481
  transform(chunk, controller) {
25197
- var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
24482
+ var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
25198
24483
  function enqueueError(bedrockError) {
25199
24484
  finishReason = { unified: "error", raw: void 0 };
25200
24485
  controller.enqueue({ type: "error", error: bedrockError });
@@ -25282,13 +24567,18 @@ var init_dist3 = __esm({
25282
24567
  id: String(blockIndex)
25283
24568
  });
25284
24569
  }
25285
- controller.enqueue({
25286
- type: "text-delta",
25287
- id: String(blockIndex),
25288
- delta: value.contentBlockDelta.delta.text
25289
- });
24570
+ const textDelta = (_m = jsonObjectTextExtractor == null ? void 0 : jsonObjectTextExtractor.process(
24571
+ value.contentBlockDelta.delta.text
24572
+ )) != null ? _m : value.contentBlockDelta.delta.text;
24573
+ if (textDelta.length > 0) {
24574
+ controller.enqueue({
24575
+ type: "text-delta",
24576
+ id: String(blockIndex),
24577
+ delta: textDelta
24578
+ });
24579
+ }
25290
24580
  }
25291
- if (((_m = value.contentBlockStop) == null ? void 0 : _m.contentBlockIndex) != null) {
24581
+ if (((_n = value.contentBlockStop) == null ? void 0 : _n.contentBlockIndex) != null) {
25292
24582
  const blockIndex = value.contentBlockStop.contentBlockIndex;
25293
24583
  const contentBlock = contentBlocks[blockIndex];
25294
24584
  if (contentBlock != null) {
@@ -25334,7 +24624,7 @@ var init_dist3 = __esm({
25334
24624
  delete contentBlocks[blockIndex];
25335
24625
  }
25336
24626
  }
25337
- if (((_n = value.contentBlockDelta) == null ? void 0 : _n.delta) && "reasoningContent" in value.contentBlockDelta.delta && value.contentBlockDelta.delta.reasoningContent) {
24627
+ if (((_o = value.contentBlockDelta) == null ? void 0 : _o.delta) && "reasoningContent" in value.contentBlockDelta.delta && value.contentBlockDelta.delta.reasoningContent) {
25338
24628
  const blockIndex = value.contentBlockDelta.contentBlockIndex || 0;
25339
24629
  const reasoningContent = value.contentBlockDelta.delta.reasoningContent;
25340
24630
  if ("text" in reasoningContent && reasoningContent.text) {
@@ -25389,7 +24679,7 @@ var init_dist3 = __esm({
25389
24679
  }
25390
24680
  }
25391
24681
  const contentBlockStart = value.contentBlockStart;
25392
- if (((_o = contentBlockStart == null ? void 0 : contentBlockStart.start) == null ? void 0 : _o.toolUse) != null) {
24682
+ if (((_p = contentBlockStart == null ? void 0 : contentBlockStart.start) == null ? void 0 : _p.toolUse) != null) {
25393
24683
  const toolUse = contentBlockStart.start.toolUse;
25394
24684
  const blockIndex = contentBlockStart.contentBlockIndex;
25395
24685
  const isJsonResponseTool = usesJsonResponseTool && toolUse.name === "json";
@@ -25417,7 +24707,7 @@ var init_dist3 = __esm({
25417
24707
  const blockIndex = contentBlockDelta.contentBlockIndex;
25418
24708
  const contentBlock = contentBlocks[blockIndex];
25419
24709
  if ((contentBlock == null ? void 0 : contentBlock.type) === "tool-call") {
25420
- const delta = (_p = contentBlockDelta.delta.toolUse.input) != null ? _p : "";
24710
+ const delta = (_q = contentBlockDelta.delta.toolUse.input) != null ? _q : "";
25421
24711
  if (!contentBlock.isJsonResponseTool) {
25422
24712
  controller.enqueue({
25423
24713
  type: "tool-input-delta",
@@ -25459,13 +24749,63 @@ var init_dist3 = __esm({
25459
24749
  }
25460
24750
  })
25461
24751
  ),
25462
- // TODO request?
24752
+ request: { body: args },
25463
24753
  response: { headers: responseHeaders }
25464
24754
  };
25465
24755
  }
25466
24756
  getUrl(modelId) {
25467
- const encodedModelId = encodeURIComponent(modelId);
25468
- return `${this.config.baseUrl()}/model/${encodedModelId}`;
24757
+ return `${this.config.baseUrl()}/model/${encodeURIComponent(modelId)}`;
24758
+ }
24759
+ };
24760
+ JsonObjectTextExtractor = class {
24761
+ constructor() {
24762
+ this.started = false;
24763
+ this.completed = false;
24764
+ this.depth = 0;
24765
+ this.inString = false;
24766
+ this.escaped = false;
24767
+ }
24768
+ process(text) {
24769
+ let result = "";
24770
+ for (const character of text) {
24771
+ if (this.completed) {
24772
+ break;
24773
+ }
24774
+ if (!this.started) {
24775
+ if (character !== "{") {
24776
+ continue;
24777
+ }
24778
+ this.started = true;
24779
+ this.depth = 1;
24780
+ result += character;
24781
+ continue;
24782
+ }
24783
+ result += character;
24784
+ if (this.escaped) {
24785
+ this.escaped = false;
24786
+ continue;
24787
+ }
24788
+ if (character === "\\" && this.inString) {
24789
+ this.escaped = true;
24790
+ continue;
24791
+ }
24792
+ if (character === '"') {
24793
+ this.inString = !this.inString;
24794
+ continue;
24795
+ }
24796
+ if (this.inString) {
24797
+ continue;
24798
+ }
24799
+ if (character === "{") {
24800
+ this.depth++;
24801
+ } else if (character === "}") {
24802
+ this.depth--;
24803
+ if (this.depth === 0) {
24804
+ this.completed = true;
24805
+ }
24806
+ }
24807
+ }
24808
+ return result;
25469
24809
  }
25470
24810
  };
25471
24811
  BedrockStopReasonSchema = external_exports.union([
@@ -25630,9 +24970,11 @@ var init_dist3 = __esm({
25630
24970
  this.config = config2;
25631
24971
  this.specificationVersion = "v3";
25632
24972
  this.provider = "amazon-bedrock";
25633
- this.maxEmbeddingsPerCall = 1;
25634
24973
  this.supportsParallelCalls = true;
25635
24974
  }
24975
+ get maxEmbeddingsPerCall() {
24976
+ return isCohereEmbeddingModel(this.modelId) ? 96 : 1;
24977
+ }
25636
24978
  getUrl(modelId) {
25637
24979
  const encodedModelId = encodeURIComponent(modelId);
25638
24980
  return `${this.config.baseUrl()}/model/${encodedModelId}/invoke`;
@@ -25657,8 +24999,8 @@ var init_dist3 = __esm({
25657
24999
  providerOptions,
25658
25000
  schema: amazonBedrockEmbeddingModelOptionsSchema
25659
25001
  })) != null ? _a17 : {};
25660
- const isNovaModel = this.modelId.startsWith("amazon.nova-") && this.modelId.includes("embed");
25661
- const isCohereModel = this.modelId.startsWith("cohere.embed-");
25002
+ const isNovaModel = isNovaEmbeddingModel(this.modelId);
25003
+ const isCohereModel = isCohereEmbeddingModel(this.modelId);
25662
25004
  const args = isNovaModel ? {
25663
25005
  taskType: "SINGLE_EMBEDDING",
25664
25006
  singleEmbeddingParams: {
@@ -25673,7 +25015,7 @@ var init_dist3 = __esm({
25673
25015
  // Cohere embedding models on Bedrock require `input_type`.
25674
25016
  // Without it, the service attempts other schema branches and rejects the request.
25675
25017
  input_type: (_e = bedrockOptions.inputType) != null ? _e : "search_query",
25676
- texts: [values2[0]],
25018
+ texts: values2,
25677
25019
  truncate: bedrockOptions.truncate,
25678
25020
  output_dimension: bedrockOptions.outputDimension
25679
25021
  } : {
@@ -25682,7 +25024,7 @@ var init_dist3 = __esm({
25682
25024
  normalize: bedrockOptions.normalize
25683
25025
  };
25684
25026
  const url2 = this.getUrl(this.modelId);
25685
- const { value: response } = await postJsonToApi({
25027
+ const { value: response, responseHeaders } = await postJsonToApi({
25686
25028
  url: url2,
25687
25029
  headers: await resolve(
25688
25030
  combineHeaders(await resolve(this.config.headers), headers)
@@ -25698,22 +25040,25 @@ var init_dist3 = __esm({
25698
25040
  fetch: this.config.fetch,
25699
25041
  abortSignal
25700
25042
  });
25701
- let embedding;
25043
+ let embeddings;
25702
25044
  if ("embedding" in response) {
25703
- embedding = response.embedding;
25045
+ embeddings = [response.embedding];
25704
25046
  } else if (Array.isArray(response.embeddings)) {
25705
25047
  const firstEmbedding = response.embeddings[0];
25706
25048
  if (typeof firstEmbedding === "object" && firstEmbedding !== null && "embeddingType" in firstEmbedding) {
25707
- embedding = firstEmbedding.embedding;
25049
+ embeddings = [firstEmbedding.embedding];
25708
25050
  } else {
25709
- embedding = firstEmbedding;
25051
+ embeddings = response.embeddings;
25710
25052
  }
25711
25053
  } else {
25712
- embedding = response.embeddings.float[0];
25054
+ embeddings = response.embeddings.float;
25713
25055
  }
25714
- const tokens = "inputTextTokenCount" in response ? response.inputTextTokenCount : "inputTokenCount" in response ? (_f = response.inputTokenCount) != null ? _f : 0 : NaN;
25056
+ const headerTokenCount = Number(
25057
+ responseHeaders == null ? void 0 : responseHeaders["x-amzn-bedrock-input-token-count"]
25058
+ );
25059
+ const tokens = "inputTextTokenCount" in response ? response.inputTextTokenCount : "inputTokenCount" in response ? (_f = response.inputTokenCount) != null ? _f : 0 : headerTokenCount;
25715
25060
  return {
25716
- embeddings: [embedding],
25061
+ embeddings,
25717
25062
  usage: { tokens },
25718
25063
  warnings: []
25719
25064
  };
@@ -25934,7 +25279,7 @@ var init_dist3 = __esm({
25934
25279
  details: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
25935
25280
  preview: external_exports.unknown().optional()
25936
25281
  });
25937
- VERSION2 = true ? "4.0.112" : "0.0.0-test";
25282
+ VERSION2 = true ? "4.0.144" : "0.0.0-test";
25938
25283
  bedrockRerankingResponseSchema = lazySchema(
25939
25284
  () => zodSchema(
25940
25285
  external_exports.object({
@@ -26239,7 +25584,7 @@ function tryConvertToString(arr) {
26239
25584
  if (!isValidUTF8(arr)) {
26240
25585
  return void 0;
26241
25586
  }
26242
- return textDecoder.decode(arr);
25587
+ return textDecoder2.decode(arr);
26243
25588
  }
26244
25589
  function compareUint8Arrays(a, b) {
26245
25590
  const len = Math.min(a.length, b.length);
@@ -26250,13 +25595,13 @@ function compareUint8Arrays(a, b) {
26250
25595
  }
26251
25596
  return a.length - b.length;
26252
25597
  }
26253
- var isAscii, HIGH_SURROGATE_START, HIGH_SURROGATE_END, textDecoder;
25598
+ var isAscii, HIGH_SURROGATE_START, HIGH_SURROGATE_END, textDecoder2;
26254
25599
  var init_utfUtil = __esm({
26255
25600
  "node_modules/gpt-tokenizer/esm/utfUtil.js"() {
26256
25601
  isAscii = (codePoint) => codePoint <= 127;
26257
25602
  HIGH_SURROGATE_START = 55296;
26258
25603
  HIGH_SURROGATE_END = 56319;
26259
- textDecoder = new TextDecoder("utf8", { fatal: false });
25604
+ textDecoder2 = new TextDecoder("utf8", { fatal: false });
26260
25605
  }
26261
25606
  });
26262
25607
 
@@ -37092,16 +36437,38 @@ var require_executor = __commonJS({
37092
36437
  });
37093
36438
  addOps(39, (exec6, done, ticks, a, b, obj, context, scope, bobj, inLoopOrSwitch) => {
37094
36439
  const [exception, catchBody, finallyBody] = b;
37095
- executeTreeWithDone(exec6, (err, res) => {
37096
- executeTreeWithDone(exec6, (e) => {
37097
- if (e)
37098
- done(e);
37099
- else if (err) {
37100
- executeTreeWithDone(exec6, done, ticks, context, catchBody, [new utils.Scope(scope)], inLoopOrSwitch);
36440
+ executeTreeWithDone(exec6, (tryErr, tryRes) => {
36441
+ const afterTryCatch = (resultErr, resultRes) => {
36442
+ executeTreeWithDone(exec6, (finallyErr) => {
36443
+ if (finallyErr)
36444
+ done(finallyErr);
36445
+ else if (resultErr)
36446
+ done(resultErr);
36447
+ else if (resultRes instanceof ExecReturn && (resultRes.returned || resultRes.breakLoop || resultRes.continueLoop)) {
36448
+ done(void 0, resultRes);
36449
+ } else {
36450
+ done();
36451
+ }
36452
+ }, ticks, context, finallyBody, [new utils.Scope(scope, {})]);
36453
+ };
36454
+ if (tryErr) {
36455
+ if (catchBody) {
36456
+ const sc = {};
36457
+ if (exception)
36458
+ sc[exception] = tryErr;
36459
+ executeTreeWithDone(exec6, (catchErr, catchRes) => {
36460
+ if (catchErr) {
36461
+ afterTryCatch(catchErr, void 0);
36462
+ } else {
36463
+ afterTryCatch(void 0, catchRes);
36464
+ }
36465
+ }, ticks, context, catchBody, [new utils.Scope(scope, sc)], inLoopOrSwitch);
37101
36466
  } else {
37102
- done(void 0, res);
36467
+ afterTryCatch(tryErr, void 0);
37103
36468
  }
37104
- }, ticks, context, finallyBody, [new utils.Scope(scope, {})]);
36469
+ } else {
36470
+ afterTryCatch(void 0, tryRes);
36471
+ }
37105
36472
  }, ticks, context, a, [new utils.Scope(scope)], inLoopOrSwitch);
37106
36473
  });
37107
36474
  addOps(88, (exec6, done) => {
@@ -38490,7 +37857,7 @@ var require_parser = __commonJS({
38490
37857
  let offset2 = 0;
38491
37858
  if (catchRes[1].startsWith("catch")) {
38492
37859
  catchRes = catchReg.exec(part.substring(res[0].length + body.length + 1).toString());
38493
- exception = catchRes[2];
37860
+ exception = catchRes[3] || "";
38494
37861
  catchBody = restOfExp(constants, part.substring(res[0].length + body.length + 1 + catchRes[0].length), [], "{");
38495
37862
  offset2 = res[0].length + body.length + 1 + catchRes[0].length + catchBody.length + 1;
38496
37863
  if ((catchRes = catchReg.exec(part.substring(offset2).toString())) && catchRes[1].startsWith("finally")) {
@@ -38501,7 +37868,7 @@ var require_parser = __commonJS({
38501
37868
  }
38502
37869
  const b = [
38503
37870
  exception,
38504
- lispifyBlock(insertSemicolons(constants, catchBody || emptyString), constants),
37871
+ catchBody !== void 0 ? lispifyBlock(insertSemicolons(constants, catchBody || emptyString), constants) : null,
38505
37872
  lispifyBlock(insertSemicolons(constants, finallyBody || emptyString), constants)
38506
37873
  ];
38507
37874
  ctx.lispTree = createLisp({
@@ -39679,6 +39046,9 @@ var init_acorn = __esm({
39679
39046
  // Can be either `"script"`, `"module"` or `"commonjs"`. This influences global
39680
39047
  // strict mode and parsing of `import` and `export` declarations.
39681
39048
  sourceType: "script",
39049
+ // When set to true, enable strict parsing mode even if `sourceType`
39050
+ // is `"script"`.
39051
+ strict: false,
39682
39052
  // `onInsertedSemicolon` can be a callback that will be called when
39683
39053
  // a semicolon is automatically inserted. It will be passed the
39684
39054
  // position of the inserted semicolon as an offset, and if
@@ -39720,6 +39090,11 @@ var init_acorn = __esm({
39720
39090
  // line being 1-based and column 0-based) will be attached to the
39721
39091
  // nodes.
39722
39092
  locations: false,
39093
+ // Pass an optional `{line, column}` object to use for the start of
39094
+ // the parse. This is mostly useful when using `parseExpressionAt`
39095
+ // with `locations: true`, to prevent the parser from having to
39096
+ // determine the line position at the start position.
39097
+ startLocation: null,
39723
39098
  // A function can be passed as `onToken` option, which will
39724
39099
  // cause Acorn to call that function with object in the same
39725
39100
  // format as tokens returned from `tokenizer().getToken()`. Note
@@ -39800,13 +39175,18 @@ var init_acorn = __esm({
39800
39175
  this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
39801
39176
  this.input = String(input);
39802
39177
  this.containsEsc = false;
39803
- if (startPos) {
39804
- this.pos = startPos;
39178
+ this.pos = startPos || 0;
39179
+ this.curLine = 1;
39180
+ if (options.startLocation) {
39181
+ this.lineStart = this.pos - options.startLocation.column;
39182
+ this.curLine = options.startLocation.line;
39183
+ } else if (startPos) {
39805
39184
  this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
39806
- this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
39185
+ if (this.options.locations) {
39186
+ this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
39187
+ }
39807
39188
  } else {
39808
- this.pos = this.lineStart = 0;
39809
- this.curLine = 1;
39189
+ this.lineStart = 0;
39810
39190
  }
39811
39191
  this.type = types$1.eof;
39812
39192
  this.value = null;
@@ -39817,7 +39197,7 @@ var init_acorn = __esm({
39817
39197
  this.context = this.initialContext();
39818
39198
  this.exprAllowed = true;
39819
39199
  this.inModule = options.sourceType === "module";
39820
- this.strict = this.inModule || this.strictDirective(this.pos);
39200
+ this.strict = this.inModule || options.strict === true || this.strictDirective(this.pos);
39821
39201
  this.potentialArrowAt = -1;
39822
39202
  this.potentialArrowInForAwait = false;
39823
39203
  this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
@@ -39835,9 +39215,12 @@ var init_acorn = __esm({
39835
39215
  };
39836
39216
  prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowReturn: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, allowUsing: { configurable: true }, inClassStaticBlock: { configurable: true } };
39837
39217
  Parser.prototype.parse = function parse3() {
39218
+ var this$1$1 = this;
39838
39219
  var node = this.options.program || this.startNode();
39839
39220
  this.nextToken();
39840
- return this.parseTopLevel(node);
39221
+ return this.catchStackOverflow(function() {
39222
+ return this$1$1.parseTopLevel(node);
39223
+ });
39841
39224
  };
39842
39225
  prototypeAccessors.inFunction.get = function() {
39843
39226
  return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0;
@@ -39971,6 +39354,17 @@ var init_acorn = __esm({
39971
39354
  this.next();
39972
39355
  return true;
39973
39356
  };
39357
+ pp$9.catchStackOverflow = function(f) {
39358
+ try {
39359
+ return f();
39360
+ } catch (e) {
39361
+ if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message))) {
39362
+ this.raise(this.start, "Not enough stack space to parse input");
39363
+ } else {
39364
+ throw e;
39365
+ }
39366
+ }
39367
+ };
39974
39368
  pp$9.expectContextual = function(name15) {
39975
39369
  if (!this.eatContextual(name15)) {
39976
39370
  this.unexpected();
@@ -40056,12 +39450,12 @@ var init_acorn = __esm({
40056
39450
  };
40057
39451
  pp$8 = Parser.prototype;
40058
39452
  pp$8.parseTopLevel = function(node) {
40059
- var exports2 = /* @__PURE__ */ Object.create(null);
39453
+ var exports$1 = /* @__PURE__ */ Object.create(null);
40060
39454
  if (!node.body) {
40061
39455
  node.body = [];
40062
39456
  }
40063
39457
  while (this.type !== types$1.eof) {
40064
- var stmt = this.parseStatement(null, true, exports2);
39458
+ var stmt = this.parseStatement(null, true, exports$1);
40065
39459
  node.body.push(stmt);
40066
39460
  }
40067
39461
  if (this.inModule) {
@@ -40151,9 +39545,18 @@ var init_acorn = __esm({
40151
39545
  return true;
40152
39546
  }
40153
39547
  var id = this.input.slice(idStart, next);
40154
- if (keywordRelationalOperator.test(id) || isFor && id === "of") {
39548
+ if (keywordRelationalOperator.test(id)) {
40155
39549
  return false;
40156
39550
  }
39551
+ if (isFor && !isAwaitUsing && id === "of") {
39552
+ skipWhiteSpace.lastIndex = next;
39553
+ var skipAfterOf = skipWhiteSpace.exec(this.input);
39554
+ next = next + skipAfterOf[0].length;
39555
+ if (this.input.charCodeAt(next) !== 61 || // Check for ==, === and => operators
39556
+ (ch = this.input.charCodeAt(next + 1)) === 61 || ch === 62) {
39557
+ return false;
39558
+ }
39559
+ }
40157
39560
  return true;
40158
39561
  };
40159
39562
  pp$8.isAwaitUsing = function(isFor) {
@@ -40162,7 +39565,7 @@ var init_acorn = __esm({
40162
39565
  pp$8.isUsing = function(isFor) {
40163
39566
  return this.isUsingKeyword(false, isFor);
40164
39567
  };
40165
- pp$8.parseStatement = function(context, topLevel, exports2) {
39568
+ pp$8.parseStatement = function(context, topLevel, exports$1) {
40166
39569
  var starttype = this.type, node = this.startNode(), kind;
40167
39570
  if (this.isLet(context)) {
40168
39571
  starttype = types$1._var;
@@ -40231,7 +39634,7 @@ var init_acorn = __esm({
40231
39634
  this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
40232
39635
  }
40233
39636
  }
40234
- return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports2);
39637
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1);
40235
39638
  // If the statement does not start with a statement keyword or a
40236
39639
  // brace, it's an ExpressionStatement or LabeledStatement. We
40237
39640
  // simply start parsing an expression, and afterwards, if the
@@ -40250,6 +39653,9 @@ var init_acorn = __esm({
40250
39653
  if (!this.allowUsing) {
40251
39654
  this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");
40252
39655
  }
39656
+ if (context) {
39657
+ this.raise(this.start, "Using declaration is not allowed in single-statement positions");
39658
+ }
40253
39659
  if (usingKind === "await using") {
40254
39660
  if (!this.canAwait) {
40255
39661
  this.raise(this.start, "Await using cannot appear outside of async function");
@@ -40384,14 +39790,15 @@ var init_acorn = __esm({
40384
39790
  };
40385
39791
  pp$8.parseForAfterInit = function(node, init, awaitAt) {
40386
39792
  if ((this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init.declarations.length === 1) {
40387
- if (this.options.ecmaVersion >= 9) {
40388
- if (this.type === types$1._in) {
40389
- if (awaitAt > -1) {
40390
- this.unexpected(awaitAt);
40391
- }
40392
- } else {
40393
- node.await = awaitAt > -1;
39793
+ if (this.type === types$1._in) {
39794
+ if ((init.kind === "using" || init.kind === "await using") && !init.declarations[0].init) {
39795
+ this.raise(this.start, "Using declaration is not allowed in for-in loops");
39796
+ }
39797
+ if (this.options.ecmaVersion >= 9 && awaitAt > -1) {
39798
+ this.unexpected(awaitAt);
40394
39799
  }
39800
+ } else if (this.options.ecmaVersion >= 9) {
39801
+ node.await = awaitAt > -1;
40395
39802
  }
40396
39803
  return this.parseForIn(node, init);
40397
39804
  }
@@ -40887,11 +40294,11 @@ var init_acorn = __esm({
40887
40294
  }
40888
40295
  }
40889
40296
  };
40890
- pp$8.parseExportAllDeclaration = function(node, exports2) {
40297
+ pp$8.parseExportAllDeclaration = function(node, exports$1) {
40891
40298
  if (this.options.ecmaVersion >= 11) {
40892
40299
  if (this.eatContextual("as")) {
40893
40300
  node.exported = this.parseModuleExportName();
40894
- this.checkExport(exports2, node.exported, this.lastTokStart);
40301
+ this.checkExport(exports$1, node.exported, this.lastTokStart);
40895
40302
  } else {
40896
40303
  node.exported = null;
40897
40304
  }
@@ -40907,22 +40314,22 @@ var init_acorn = __esm({
40907
40314
  this.semicolon();
40908
40315
  return this.finishNode(node, "ExportAllDeclaration");
40909
40316
  };
40910
- pp$8.parseExport = function(node, exports2) {
40317
+ pp$8.parseExport = function(node, exports$1) {
40911
40318
  this.next();
40912
40319
  if (this.eat(types$1.star)) {
40913
- return this.parseExportAllDeclaration(node, exports2);
40320
+ return this.parseExportAllDeclaration(node, exports$1);
40914
40321
  }
40915
40322
  if (this.eat(types$1._default)) {
40916
- this.checkExport(exports2, "default", this.lastTokStart);
40323
+ this.checkExport(exports$1, "default", this.lastTokStart);
40917
40324
  node.declaration = this.parseExportDefaultDeclaration();
40918
40325
  return this.finishNode(node, "ExportDefaultDeclaration");
40919
40326
  }
40920
40327
  if (this.shouldParseExportStatement()) {
40921
40328
  node.declaration = this.parseExportDeclaration(node);
40922
40329
  if (node.declaration.type === "VariableDeclaration") {
40923
- this.checkVariableExport(exports2, node.declaration.declarations);
40330
+ this.checkVariableExport(exports$1, node.declaration.declarations);
40924
40331
  } else {
40925
- this.checkExport(exports2, node.declaration.id, node.declaration.id.start);
40332
+ this.checkExport(exports$1, node.declaration.id, node.declaration.id.start);
40926
40333
  }
40927
40334
  node.specifiers = [];
40928
40335
  node.source = null;
@@ -40931,7 +40338,7 @@ var init_acorn = __esm({
40931
40338
  }
40932
40339
  } else {
40933
40340
  node.declaration = null;
40934
- node.specifiers = this.parseExportSpecifiers(exports2);
40341
+ node.specifiers = this.parseExportSpecifiers(exports$1);
40935
40342
  if (this.eatContextual("from")) {
40936
40343
  if (this.type !== types$1.string) {
40937
40344
  this.unexpected();
@@ -40979,66 +40386,66 @@ var init_acorn = __esm({
40979
40386
  return declaration;
40980
40387
  }
40981
40388
  };
40982
- pp$8.checkExport = function(exports2, name15, pos) {
40983
- if (!exports2) {
40389
+ pp$8.checkExport = function(exports$1, name15, pos) {
40390
+ if (!exports$1) {
40984
40391
  return;
40985
40392
  }
40986
40393
  if (typeof name15 !== "string") {
40987
40394
  name15 = name15.type === "Identifier" ? name15.name : name15.value;
40988
40395
  }
40989
- if (hasOwn(exports2, name15)) {
40396
+ if (hasOwn(exports$1, name15)) {
40990
40397
  this.raiseRecoverable(pos, "Duplicate export '" + name15 + "'");
40991
40398
  }
40992
- exports2[name15] = true;
40399
+ exports$1[name15] = true;
40993
40400
  };
40994
- pp$8.checkPatternExport = function(exports2, pat) {
40401
+ pp$8.checkPatternExport = function(exports$1, pat) {
40995
40402
  var type = pat.type;
40996
40403
  if (type === "Identifier") {
40997
- this.checkExport(exports2, pat, pat.start);
40404
+ this.checkExport(exports$1, pat, pat.start);
40998
40405
  } else if (type === "ObjectPattern") {
40999
40406
  for (var i = 0, list = pat.properties; i < list.length; i += 1) {
41000
40407
  var prop = list[i];
41001
- this.checkPatternExport(exports2, prop);
40408
+ this.checkPatternExport(exports$1, prop);
41002
40409
  }
41003
40410
  } else if (type === "ArrayPattern") {
41004
40411
  for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
41005
40412
  var elt = list$1[i$1];
41006
40413
  if (elt) {
41007
- this.checkPatternExport(exports2, elt);
40414
+ this.checkPatternExport(exports$1, elt);
41008
40415
  }
41009
40416
  }
41010
40417
  } else if (type === "Property") {
41011
- this.checkPatternExport(exports2, pat.value);
40418
+ this.checkPatternExport(exports$1, pat.value);
41012
40419
  } else if (type === "AssignmentPattern") {
41013
- this.checkPatternExport(exports2, pat.left);
40420
+ this.checkPatternExport(exports$1, pat.left);
41014
40421
  } else if (type === "RestElement") {
41015
- this.checkPatternExport(exports2, pat.argument);
40422
+ this.checkPatternExport(exports$1, pat.argument);
41016
40423
  }
41017
40424
  };
41018
- pp$8.checkVariableExport = function(exports2, decls) {
41019
- if (!exports2) {
40425
+ pp$8.checkVariableExport = function(exports$1, decls) {
40426
+ if (!exports$1) {
41020
40427
  return;
41021
40428
  }
41022
40429
  for (var i = 0, list = decls; i < list.length; i += 1) {
41023
40430
  var decl = list[i];
41024
- this.checkPatternExport(exports2, decl.id);
40431
+ this.checkPatternExport(exports$1, decl.id);
41025
40432
  }
41026
40433
  };
41027
40434
  pp$8.shouldParseExportStatement = function() {
41028
40435
  return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
41029
40436
  };
41030
- pp$8.parseExportSpecifier = function(exports2) {
40437
+ pp$8.parseExportSpecifier = function(exports$1) {
41031
40438
  var node = this.startNode();
41032
40439
  node.local = this.parseModuleExportName();
41033
40440
  node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
41034
40441
  this.checkExport(
41035
- exports2,
40442
+ exports$1,
41036
40443
  node.exported,
41037
40444
  node.exported.start
41038
40445
  );
41039
40446
  return this.finishNode(node, "ExportSpecifier");
41040
40447
  };
41041
- pp$8.parseExportSpecifiers = function(exports2) {
40448
+ pp$8.parseExportSpecifiers = function(exports$1) {
41042
40449
  var nodes = [], first2 = true;
41043
40450
  this.expect(types$1.braceL);
41044
40451
  while (!this.eat(types$1.braceR)) {
@@ -41050,7 +40457,7 @@ var init_acorn = __esm({
41050
40457
  } else {
41051
40458
  first2 = false;
41052
40459
  }
41053
- nodes.push(this.parseExportSpecifier(exports2));
40460
+ nodes.push(this.parseExportSpecifier(exports$1));
41054
40461
  }
41055
40462
  return nodes;
41056
40463
  };
@@ -41618,17 +41025,20 @@ var init_acorn = __esm({
41618
41025
  other[kind] = true;
41619
41026
  };
41620
41027
  pp$5.parseExpression = function(forInit, refDestructuringErrors) {
41621
- var startPos = this.start, startLoc = this.startLoc;
41622
- var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
41623
- if (this.type === types$1.comma) {
41624
- var node = this.startNodeAt(startPos, startLoc);
41625
- node.expressions = [expr];
41626
- while (this.eat(types$1.comma)) {
41627
- node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors));
41028
+ var this$1$1 = this;
41029
+ return this.catchStackOverflow(function() {
41030
+ var startPos = this$1$1.start, startLoc = this$1$1.startLoc;
41031
+ var expr = this$1$1.parseMaybeAssign(forInit, refDestructuringErrors);
41032
+ if (this$1$1.type === types$1.comma) {
41033
+ var node = this$1$1.startNodeAt(startPos, startLoc);
41034
+ node.expressions = [expr];
41035
+ while (this$1$1.eat(types$1.comma)) {
41036
+ node.expressions.push(this$1$1.parseMaybeAssign(forInit, refDestructuringErrors));
41037
+ }
41038
+ return this$1$1.finishNode(node, "SequenceExpression");
41628
41039
  }
41629
- return this.finishNode(node, "SequenceExpression");
41630
- }
41631
- return expr;
41040
+ return expr;
41041
+ });
41632
41042
  };
41633
41043
  pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
41634
41044
  if (this.isContextual("yield")) {
@@ -41700,7 +41110,7 @@ var init_acorn = __esm({
41700
41110
  if (this.checkExpressionErrors(refDestructuringErrors)) {
41701
41111
  return expr;
41702
41112
  }
41703
- if (this.eat(types$1.question)) {
41113
+ if (!(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.question)) {
41704
41114
  var node = this.startNodeAt(startPos, startLoc);
41705
41115
  node.test = expr;
41706
41116
  node.consequent = this.parseMaybeAssign();
@@ -41795,7 +41205,7 @@ var init_acorn = __esm({
41795
41205
  expr = this.finishNode(node$1, "UpdateExpression");
41796
41206
  }
41797
41207
  }
41798
- if (!incDec && this.eat(types$1.starstar)) {
41208
+ if (!incDec && !(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.starstar)) {
41799
41209
  if (sawUnary) {
41800
41210
  this.unexpected(this.lastTokStart);
41801
41211
  } else {
@@ -42193,6 +41603,9 @@ var init_acorn = __esm({
42193
41603
  }
42194
41604
  var startPos = this.start, startLoc = this.startLoc;
42195
41605
  node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
41606
+ if (node.callee.type === "Super") {
41607
+ this.raiseRecoverable(startPos, "Invalid use of 'super'");
41608
+ }
42196
41609
  if (this.eat(types$1.parenL)) {
42197
41610
  node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false);
42198
41611
  } else {
@@ -44845,7 +44258,7 @@ var init_acorn = __esm({
44845
44258
  }
44846
44259
  return this.finishToken(type, word);
44847
44260
  };
44848
- version2 = "8.16.0";
44261
+ version2 = "8.18.0";
44849
44262
  Parser.acorn = {
44850
44263
  Parser,
44851
44264
  version: version2,
@@ -46083,6 +45496,8 @@ var require_brace_expansion = __commonJS({
46083
45496
  var escClose = "\0CLOSE" + Math.random() + "\0";
46084
45497
  var escComma = "\0COMMA" + Math.random() + "\0";
46085
45498
  var escPeriod = "\0PERIOD" + Math.random() + "\0";
45499
+ var EXPANSION_MAX = 1e5;
45500
+ var EXPANSION_MAX_LENGTH = 4e6;
46086
45501
  function numeric(str) {
46087
45502
  return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
46088
45503
  }
@@ -46116,11 +45531,12 @@ var require_brace_expansion = __commonJS({
46116
45531
  if (!str)
46117
45532
  return [];
46118
45533
  options = options || {};
46119
- var max = options.max == null ? Infinity : options.max;
45534
+ var max = options.max == null ? EXPANSION_MAX : options.max;
45535
+ var maxLength = options.maxLength == null ? EXPANSION_MAX_LENGTH : options.maxLength;
46120
45536
  if (str.substr(0, 2) === "{}") {
46121
45537
  str = "\\{\\}" + str.substr(2);
46122
45538
  }
46123
- return expand2(escapeBraces(str), max, true).map(unescapeBraces);
45539
+ return expand2(escapeBraces(str), max, maxLength, true).map(unescapeBraces);
46124
45540
  }
46125
45541
  function embrace(str) {
46126
45542
  return "{" + str + "}";
@@ -46134,18 +45550,90 @@ var require_brace_expansion = __commonJS({
46134
45550
  function gte(i, y) {
46135
45551
  return i >= y;
46136
45552
  }
46137
- function expand2(str, max, isTop) {
46138
- var expansions = [];
46139
- var m = balanced("{", "}", str);
46140
- if (!m) return [str];
46141
- var pre = m.pre;
46142
- var post = m.post.length ? expand2(m.post, max, false) : [""];
46143
- if (/\$$/.test(m.pre)) {
46144
- for (var k = 0; k < post.length && k < max; k++) {
46145
- var expansion = pre + "{" + m.body + "}" + post[k];
46146
- expansions.push(expansion);
45553
+ function combine(acc, pre, values2, max, maxLength, dropEmpties) {
45554
+ var out = [];
45555
+ var length = 0;
45556
+ for (var a = 0; a < acc.length; a++) {
45557
+ for (var v = 0; v < values2.length; v++) {
45558
+ if (out.length >= max) return out;
45559
+ var expansion = acc[a] + pre + values2[v];
45560
+ if (dropEmpties && !expansion) continue;
45561
+ if (length + expansion.length > maxLength) return out;
45562
+ out.push(expansion);
45563
+ length += expansion.length;
45564
+ }
45565
+ }
45566
+ return out;
45567
+ }
45568
+ function expandSequence(body, isAlphaSequence, max, maxLength) {
45569
+ var n = body.split(/\.\./);
45570
+ var N = [];
45571
+ if (n[0] === void 0 || n[1] === void 0) {
45572
+ return N;
45573
+ }
45574
+ var x = numeric(n[0]);
45575
+ var y = numeric(n[1]);
45576
+ var width = Math.max(n[0].length, n[1].length);
45577
+ var incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
45578
+ var test = lte;
45579
+ var reverse = y < x;
45580
+ if (reverse) {
45581
+ incr *= -1;
45582
+ test = gte;
45583
+ }
45584
+ var pad = n.some(isPadded);
45585
+ var length = 0;
45586
+ for (var i = x; test(i, y) && N.length < max; i += incr) {
45587
+ var c;
45588
+ if (isAlphaSequence) {
45589
+ c = String.fromCharCode(i);
45590
+ if (c === "\\") {
45591
+ c = "";
45592
+ }
45593
+ } else {
45594
+ c = String(i);
45595
+ if (pad) {
45596
+ var need = width - c.length;
45597
+ if (need > 0) {
45598
+ var z = new Array(need + 1).join("0");
45599
+ if (i < 0) {
45600
+ c = "-" + z + c.slice(1);
45601
+ } else {
45602
+ c = z + c;
45603
+ }
45604
+ }
45605
+ }
45606
+ }
45607
+ if (length + c.length > maxLength) break;
45608
+ N.push(c);
45609
+ length += c.length;
45610
+ }
45611
+ return N;
45612
+ }
45613
+ function expand2(str, max, maxLength, isTop) {
45614
+ var acc = [""];
45615
+ var dropEmpties = false;
45616
+ var firstGroup = true;
45617
+ for (; ; ) {
45618
+ const m = balanced("{", "}", str);
45619
+ if (!m) {
45620
+ return combine(acc, str, [""], max, maxLength, dropEmpties);
45621
+ }
45622
+ const pre = m.pre;
45623
+ if (/\$$/.test(pre)) {
45624
+ acc = combine(
45625
+ acc,
45626
+ pre + "{" + m.body + "}",
45627
+ [""],
45628
+ max,
45629
+ maxLength,
45630
+ dropEmpties && !m.post.length
45631
+ );
45632
+ firstGroup = false;
45633
+ if (!m.post.length) break;
45634
+ str = m.post;
45635
+ continue;
46147
45636
  }
46148
- } else {
46149
45637
  var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
46150
45638
  var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
46151
45639
  var isSequence = isNumericSequence || isAlphaSequence;
@@ -46153,74 +45641,69 @@ var require_brace_expansion = __commonJS({
46153
45641
  if (!isSequence && !isOptions) {
46154
45642
  if (m.post.match(/,(?!,).*\}/)) {
46155
45643
  str = m.pre + "{" + m.body + escClose + m.post;
46156
- return expand2(str, max, true);
45644
+ isTop = true;
45645
+ continue;
46157
45646
  }
46158
- return [str];
45647
+ return combine(
45648
+ acc,
45649
+ pre + "{" + m.body + "}" + m.post,
45650
+ [""],
45651
+ max,
45652
+ maxLength,
45653
+ dropEmpties
45654
+ );
45655
+ }
45656
+ if (firstGroup) {
45657
+ dropEmpties = isTop && !isSequence;
45658
+ firstGroup = false;
46159
45659
  }
46160
- var n;
45660
+ var values2;
46161
45661
  if (isSequence) {
46162
- n = m.body.split(/\.\./);
45662
+ values2 = expandSequence(m.body, isAlphaSequence, max, maxLength);
46163
45663
  } else {
46164
- n = parseCommaParts(m.body);
46165
- if (n.length === 1) {
46166
- n = expand2(n[0], max, false).map(embrace);
45664
+ var n = parseCommaParts(m.body);
45665
+ if (n.length === 1 && n[0] !== void 0) {
45666
+ n = expand2(n[0], max, maxLength, false).map(embrace);
46167
45667
  if (n.length === 1) {
46168
- return post.map(function(p) {
46169
- return m.pre + n[0] + p;
46170
- });
45668
+ acc = combine(
45669
+ acc,
45670
+ pre + n[0],
45671
+ [""],
45672
+ max,
45673
+ maxLength,
45674
+ dropEmpties && !m.post.length
45675
+ );
45676
+ if (!m.post.length) break;
45677
+ str = m.post;
45678
+ continue;
46171
45679
  }
46172
45680
  }
46173
- }
46174
- var N;
46175
- if (isSequence) {
46176
- var x = numeric(n[0]);
46177
- var y = numeric(n[1]);
46178
- var width = Math.max(n[0].length, n[1].length);
46179
- var incr = n.length == 3 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
46180
- var test = lte;
46181
- var reverse = y < x;
46182
- if (reverse) {
46183
- incr *= -1;
46184
- test = gte;
46185
- }
46186
- var pad = n.some(isPadded);
46187
- N = [];
46188
- for (var i = x; test(i, y) && N.length < max; i += incr) {
46189
- var c;
46190
- if (isAlphaSequence) {
46191
- c = String.fromCharCode(i);
46192
- if (c === "\\")
46193
- c = "";
46194
- } else {
46195
- c = String(i);
46196
- if (pad) {
46197
- var need = width - c.length;
46198
- if (need > 0) {
46199
- var z = new Array(need + 1).join("0");
46200
- if (i < 0)
46201
- c = "-" + z + c.slice(1);
46202
- else
46203
- c = z + c;
46204
- }
46205
- }
45681
+ var dropsEmpties = dropEmpties && !m.post.length && !pre;
45682
+ for (var d = 0; dropsEmpties && d < acc.length; d++) {
45683
+ if (acc[d]) {
45684
+ dropsEmpties = false;
46206
45685
  }
46207
- N.push(c);
46208
- }
46209
- } else {
46210
- N = [];
46211
- for (var j = 0; j < n.length; j++) {
46212
- N.push.apply(N, expand2(n[j], max, false));
46213
45686
  }
46214
- }
46215
- for (var j = 0; j < N.length; j++) {
46216
- for (var k = 0; k < post.length && expansions.length < max; k++) {
46217
- var expansion = pre + N[j] + post[k];
46218
- if (!isTop || isSequence || expansion)
46219
- expansions.push(expansion);
45687
+ values2 = [];
45688
+ var valuesLength = 0;
45689
+ outer: for (var j = 0; j < n.length; j++) {
45690
+ var expanded = expand2(n[j], max, maxLength, false);
45691
+ for (var k = 0; k < expanded.length; k++) {
45692
+ var v = expanded[k];
45693
+ if (dropsEmpties && !v) continue;
45694
+ if (values2.length >= max || valuesLength + v.length > maxLength) {
45695
+ break outer;
45696
+ }
45697
+ values2.push(v);
45698
+ valuesLength += v.length;
45699
+ }
46220
45700
  }
46221
45701
  }
45702
+ acc = combine(acc, pre, values2, max, maxLength, dropEmpties && !m.post.length);
45703
+ if (!m.post.length) break;
45704
+ str = m.post;
46222
45705
  }
46223
- return expansions;
45706
+ return acc;
46224
45707
  }
46225
45708
  }
46226
45709
  });
@@ -89688,6 +89171,7 @@ var require_fast_uri = __commonJS({
89688
89171
  return uriTokens.join("");
89689
89172
  }
89690
89173
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
89174
+ var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
89691
89175
  function getParseError(parsed, matches) {
89692
89176
  if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
89693
89177
  return 'URI path must start with "/" when authority is present.';
@@ -89717,6 +89201,11 @@ var require_fast_uri = __commonJS({
89717
89201
  uri = "//" + uri;
89718
89202
  }
89719
89203
  }
89204
+ const authorityMatch = uri.match(AUTHORITY_PREFIX);
89205
+ if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
89206
+ parsed.error = "URI authority must not contain a literal backslash.";
89207
+ malformedAuthorityOrPort = true;
89208
+ }
89720
89209
  const matches = uri.match(URI_PARSE);
89721
89210
  if (matches) {
89722
89211
  parsed.scheme = matches[1];
@@ -89760,7 +89249,7 @@ var require_fast_uri = __commonJS({
89760
89249
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
89761
89250
  if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
89762
89251
  try {
89763
- parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
89252
+ parsed.host = new URL("http://" + parsed.host).hostname;
89764
89253
  } catch (e) {
89765
89254
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
89766
89255
  }
@@ -94486,11 +93975,11 @@ function createHttpTransport(url2) {
94486
93975
  }
94487
93976
  };
94488
93977
  }
94489
- var import_client2, import_stdio, import_sse, import_websocket, MCPClientManager;
94490
- var init_client2 = __esm({
93978
+ var import_client, import_stdio, import_sse, import_websocket, MCPClientManager;
93979
+ var init_client = __esm({
94491
93980
  "src/agent/mcp/client.js"() {
94492
93981
  "use strict";
94493
- import_client2 = require("@modelcontextprotocol/sdk/client/index.js");
93982
+ import_client = require("@modelcontextprotocol/sdk/client/index.js");
94494
93983
  import_stdio = require("@modelcontextprotocol/sdk/client/stdio.js");
94495
93984
  import_sse = require("@modelcontextprotocol/sdk/client/sse.js");
94496
93985
  import_websocket = require("@modelcontextprotocol/sdk/client/websocket.js");
@@ -94601,7 +94090,7 @@ var init_client2 = __esm({
94601
94090
  console.error(`[MCP DEBUG] Connecting to ${name15} via ${serverConfig.transport}...`);
94602
94091
  }
94603
94092
  const transport = createTransport(serverConfig);
94604
- const client = new import_client2.Client(
94093
+ const client = new import_client.Client(
94605
94094
  {
94606
94095
  name: `probe-client-${name15}`,
94607
94096
  version: "1.0.0"
@@ -94984,7 +94473,7 @@ var MCPXmlBridge;
94984
94473
  var init_xmlBridge = __esm({
94985
94474
  "src/agent/mcp/xmlBridge.js"() {
94986
94475
  "use strict";
94987
- init_client2();
94476
+ init_client();
94988
94477
  init_config2();
94989
94478
  MCPXmlBridge = class {
94990
94479
  constructor(options = {}) {
@@ -95111,10 +94600,10 @@ var init_xmlBridge = __esm({
95111
94600
  var init_mcp = __esm({
95112
94601
  "src/agent/mcp/index.js"() {
95113
94602
  "use strict";
95114
- init_client2();
94603
+ init_client();
95115
94604
  init_config2();
95116
94605
  init_xmlBridge();
95117
- init_client2();
94606
+ init_client();
95118
94607
  init_config2();
95119
94608
  init_xmlBridge();
95120
94609
  }
@@ -102838,12 +102327,13 @@ function isRetryableError(error40, retryableErrors = DEFAULT_RETRYABLE_ERRORS) {
102838
102327
  if (!error40) return false;
102839
102328
  const errorString = error40.toString().toLowerCase();
102840
102329
  const errorMessage = (error40.message || "").toLowerCase();
102330
+ const errorName = (error40.name || error40.constructor?.name || "").toLowerCase();
102841
102331
  const errorCode = (error40.code || "").toLowerCase();
102842
102332
  const errorType = (error40.type || "").toLowerCase();
102843
102333
  const statusCode = error40.statusCode || error40.status;
102844
102334
  for (const pattern of retryableErrors) {
102845
102335
  const lowerPattern = pattern.toLowerCase();
102846
- if (errorString.includes(lowerPattern) || errorMessage.includes(lowerPattern) || errorCode.includes(lowerPattern) || errorType.includes(lowerPattern) || statusCode?.toString() === pattern) {
102336
+ if (errorString.includes(lowerPattern) || errorMessage.includes(lowerPattern) || errorName.includes(lowerPattern) || errorCode.includes(lowerPattern) || errorType.includes(lowerPattern) || statusCode?.toString() === pattern) {
102847
102337
  return true;
102848
102338
  }
102849
102339
  }
@@ -102880,7 +102370,9 @@ var init_RetryManager = __esm({
102880
102370
  "ECONNRESET",
102881
102371
  "ETIMEDOUT",
102882
102372
  "ENOTFOUND",
102883
- "api_error"
102373
+ "api_error",
102374
+ "No output generated",
102375
+ "AI_NoOutputGeneratedError"
102884
102376
  ];
102885
102377
  RetryManager = class {
102886
102378
  /**
@@ -102900,7 +102392,7 @@ var init_RetryManager = __esm({
102900
102392
  this.backoffFactor = this._validateNumber(options.backoffFactor, 2, "backoffFactor", 1, 10);
102901
102393
  this.retryableErrors = options.retryableErrors || DEFAULT_RETRYABLE_ERRORS;
102902
102394
  this.debug = options.debug ?? false;
102903
- this.jitter = options.jitter ?? true;
102395
+ this.jitter = typeof options.jitter === "boolean" ? options.jitter : true;
102904
102396
  if (this.maxDelay < this.initialDelay) {
102905
102397
  throw new Error("maxDelay must be greater than or equal to initialDelay");
102906
102398
  }
@@ -103667,7 +103159,7 @@ var init_outputTruncator = __esm({
103667
103159
  });
103668
103160
 
103669
103161
  // src/agent/mcp/built-in-server.js
103670
- var import_http, import_events2, import_crypto6, import_server, import_sse2, import_streamableHttp, import_types4, InMemoryEventStore, BuiltInMCPServer;
103162
+ var import_http, import_events2, import_crypto6, import_server, import_sse2, import_streamableHttp, import_types5, InMemoryEventStore, BuiltInMCPServer;
103671
103163
  var init_built_in_server = __esm({
103672
103164
  "src/agent/mcp/built-in-server.js"() {
103673
103165
  "use strict";
@@ -103677,7 +103169,7 @@ var init_built_in_server = __esm({
103677
103169
  import_server = require("@modelcontextprotocol/sdk/server/index.js");
103678
103170
  import_sse2 = require("@modelcontextprotocol/sdk/server/sse.js");
103679
103171
  import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
103680
- import_types4 = require("@modelcontextprotocol/sdk/types.js");
103172
+ import_types5 = require("@modelcontextprotocol/sdk/types.js");
103681
103173
  InMemoryEventStore = class {
103682
103174
  constructor() {
103683
103175
  this.events = /* @__PURE__ */ new Map();
@@ -103911,7 +103403,7 @@ var init_built_in_server = __esm({
103911
103403
  if (this.debug) {
103912
103404
  console.log(`[MCP] Reusing existing transport for session: ${sessionId}`);
103913
103405
  }
103914
- } else if (!sessionId && method === "POST" && body && (0, import_types4.isInitializeRequest)(body)) {
103406
+ } else if (!sessionId && method === "POST" && body && (0, import_types5.isInitializeRequest)(body)) {
103915
103407
  if (this.debug) {
103916
103408
  console.log("[MCP] Creating new Streamable HTTP transport for initialization");
103917
103409
  }
@@ -104123,10 +103615,10 @@ var init_built_in_server = __esm({
104123
103615
  * Register MCP protocol handlers
104124
103616
  */
104125
103617
  registerHandlers() {
104126
- this.mcpServer.setRequestHandler(import_types4.ListToolsRequestSchema, async () => {
103618
+ this.mcpServer.setRequestHandler(import_types5.ListToolsRequestSchema, async () => {
104127
103619
  return this.handleListTools();
104128
103620
  });
104129
- this.mcpServer.setRequestHandler(import_types4.CallToolRequestSchema, async (request) => {
103621
+ this.mcpServer.setRequestHandler(import_types5.CallToolRequestSchema, async (request) => {
104130
103622
  return this.handleCallTool(request.params);
104131
103623
  });
104132
103624
  }
@@ -106272,27 +105764,41 @@ var init_ProbeAgent = __esm({
106272
105764
  timeoutState
106273
105765
  );
106274
105766
  }
105767
+ /**
105768
+ * Create a RetryManager from the agent's retry configuration.
105769
+ * @param {Object} [overrides={}] - Retry option overrides
105770
+ * @returns {RetryManager}
105771
+ * @private
105772
+ */
105773
+ _createRetryManager(overrides = {}) {
105774
+ return new RetryManager({
105775
+ maxRetries: overrides.maxRetries ?? this.retryConfig.maxRetries ?? 3,
105776
+ initialDelay: overrides.initialDelay ?? this.retryConfig.initialDelay ?? 1e3,
105777
+ maxDelay: overrides.maxDelay ?? this.retryConfig.maxDelay ?? 3e4,
105778
+ backoffFactor: overrides.backoffFactor ?? this.retryConfig.backoffFactor ?? 2,
105779
+ retryableErrors: overrides.retryableErrors ?? this.retryConfig.retryableErrors,
105780
+ jitter: overrides.jitter ?? this.retryConfig.jitter,
105781
+ debug: overrides.debug ?? this.debug
105782
+ });
105783
+ }
106275
105784
  /**
106276
105785
  * Execute streamText with Vercel AI SDK using retry/fallback logic
106277
105786
  * @param {Object} options - streamText options
106278
105787
  * @param {AbortController} controller - Abort controller for the operation
105788
+ * @param {Function} [consumeResult] - Optional callback to consume the stream result inside the same retry budget
106279
105789
  * @returns {Promise<Object>} - Stream result
106280
105790
  * @private
106281
105791
  */
106282
- async _executeWithVercelProvider(options, controller) {
105792
+ async _executeWithVercelProvider(options, controller, consumeResult) {
106283
105793
  if (!this.retryManager) {
106284
- this.retryManager = new RetryManager({
106285
- maxRetries: this.retryConfig.maxRetries ?? 3,
106286
- initialDelay: this.retryConfig.initialDelay ?? 1e3,
106287
- maxDelay: this.retryConfig.maxDelay ?? 3e4,
106288
- backoffFactor: this.retryConfig.backoffFactor ?? 2,
106289
- retryableErrors: this.retryConfig.retryableErrors,
106290
- debug: this.debug
106291
- });
105794
+ this.retryManager = this._createRetryManager();
106292
105795
  }
106293
105796
  if (!this.fallbackManager) {
106294
105797
  return await this.retryManager.executeWithRetry(
106295
- () => (0, import_ai6.streamText)({ ...options, abortSignal: controller.signal }),
105798
+ async () => {
105799
+ const result = (0, import_ai6.streamText)({ ...options, abortSignal: controller.signal });
105800
+ return consumeResult ? await consumeResult(result) : result;
105801
+ },
106296
105802
  {
106297
105803
  provider: this.apiType,
106298
105804
  model: this.model,
@@ -106317,16 +105823,14 @@ var init_ProbeAgent = __esm({
106317
105823
  console.error(`[DEBUG] Stripped Gemini built-in tools for fallback to ${config2.provider} provider`);
106318
105824
  }
106319
105825
  }
106320
- const providerRetryManager = new RetryManager({
106321
- maxRetries: config2.maxRetries ?? this.retryConfig.maxRetries ?? 3,
106322
- initialDelay: this.retryConfig.initialDelay ?? 1e3,
106323
- maxDelay: this.retryConfig.maxDelay ?? 3e4,
106324
- backoffFactor: this.retryConfig.backoffFactor ?? 2,
106325
- retryableErrors: this.retryConfig.retryableErrors,
106326
- debug: this.debug
105826
+ const providerRetryManager = this._createRetryManager({
105827
+ maxRetries: config2.maxRetries ?? this.retryConfig.maxRetries
106327
105828
  });
106328
105829
  return await providerRetryManager.executeWithRetry(
106329
- () => (0, import_ai6.streamText)(fallbackOptions),
105830
+ async () => {
105831
+ const result = (0, import_ai6.streamText)(fallbackOptions);
105832
+ return consumeResult ? await consumeResult(result) : result;
105833
+ },
106330
105834
  {
106331
105835
  provider: config2.provider,
106332
105836
  model,
@@ -106465,10 +105969,11 @@ var init_ProbeAgent = __esm({
106465
105969
  /**
106466
105970
  * Execute streamText with retry and fallback support
106467
105971
  * @param {Object} options - streamText options
106468
- * @returns {Promise<Object>} - streamText result
105972
+ * @param {Function} [consumeResult] - Optional callback to consume the result inside the same retry attempt
105973
+ * @returns {Promise<Object>} - streamText result or consumer result
106469
105974
  * @private
106470
105975
  */
106471
- async streamTextWithRetryAndFallback(options) {
105976
+ async streamTextWithRetryAndFallback(options, consumeResult) {
106472
105977
  const limiter = this.concurrencyLimiter;
106473
105978
  if (limiter && options.model) {
106474
105979
  options = { ...options, model: _ProbeAgent._wrapModelWithLimiter(options.model, limiter, this.debug) };
@@ -106500,6 +106005,7 @@ var init_ProbeAgent = __esm({
106500
106005
  const useClaudeCode = this.clientApiProvider === "claude-code" || process.env.USE_CLAUDE_CODE === "true";
106501
106006
  const useCodex = this.clientApiProvider === "codex" || process.env.USE_CODEX === "true";
106502
106007
  let result;
106008
+ let usedVercelProvider = false;
106503
106009
  if (useClaudeCode || useCodex) {
106504
106010
  try {
106505
106011
  result = await this._tryEngineStreamPath(options, controller, timeoutState);
@@ -106514,7 +106020,11 @@ var init_ProbeAgent = __esm({
106514
106020
  }
106515
106021
  }
106516
106022
  if (!result) {
106517
- result = await this._executeWithVercelProvider(options, controller);
106023
+ usedVercelProvider = true;
106024
+ result = await this._executeWithVercelProvider(options, controller, consumeResult);
106025
+ }
106026
+ if (!usedVercelProvider && result && consumeResult) {
106027
+ return await consumeResult(result);
106518
106028
  }
106519
106029
  return result;
106520
106030
  } finally {
@@ -108158,7 +107668,6 @@ You are working with a workspace. Available paths: ${workspaceDesc}
108158
107668
  activeTools.delete(key);
108159
107669
  }
108160
107670
  };
108161
- this.events.on("toolCall", onToolCall);
108162
107671
  const runTimeoutObserver = async () => {
108163
107672
  if (negotiatedTimeoutState.observerRunning) return;
108164
107673
  negotiatedTimeoutState.observerRunning = true;
@@ -108719,60 +108228,68 @@ Double-check your response based on the criteria above. If everything looks good
108719
108228
  streamOptions.providerOptions = providerOpts;
108720
108229
  }
108721
108230
  const executeAIRequest = async () => {
108722
- const result = await this.streamTextWithRetryAndFallback(streamOptions);
108723
- let gracefulTimeoutId = null;
108724
- let hardAbortTimeoutId = null;
108725
- if (this.timeoutBehavior === "graceful" && gracefulTimeoutState && this.maxOperationTimeout > 0) {
108726
- gracefulTimeoutId = setTimeout(() => {
108727
- gracefulTimeoutState.triggered = true;
108728
- if (this.debug) {
108729
- console.log(`[DEBUG] Soft timeout after ${this.maxOperationTimeout}ms \u2014 entering wind-down mode (${gracefulTimeoutState.bonusStepsMax} bonus steps)`);
108730
- }
108731
- hardAbortTimeoutId = setTimeout(() => {
108732
- if (this._abortController) {
108733
- this._abortController.abort();
108231
+ return await this.streamTextWithRetryAndFallback(streamOptions, async (result) => {
108232
+ this.events.on("toolCall", onToolCall);
108233
+ let gracefulTimeoutId = null;
108234
+ let hardAbortTimeoutId = null;
108235
+ if (this.timeoutBehavior === "graceful" && gracefulTimeoutState && this.maxOperationTimeout > 0) {
108236
+ gracefulTimeoutId = setTimeout(() => {
108237
+ gracefulTimeoutState.triggered = true;
108238
+ if (this.debug) {
108239
+ console.log(`[DEBUG] Soft timeout after ${this.maxOperationTimeout}ms \u2014 entering wind-down mode (${gracefulTimeoutState.bonusStepsMax} bonus steps)`);
108734
108240
  }
108241
+ hardAbortTimeoutId = setTimeout(() => {
108242
+ if (this._abortController) {
108243
+ this._abortController.abort();
108244
+ }
108245
+ if (this.debug) {
108246
+ console.log(`[DEBUG] Hard abort \u2014 wind-down safety net expired after 60s`);
108247
+ }
108248
+ }, 6e4);
108249
+ }, this.maxOperationTimeout);
108250
+ }
108251
+ if (this.timeoutBehavior === "negotiated" && this.maxOperationTimeout > 0) {
108252
+ negotiatedTimeoutState.softTimeoutId = setTimeout(() => {
108735
108253
  if (this.debug) {
108736
- console.log(`[DEBUG] Hard abort \u2014 wind-down safety net expired after 60s`);
108254
+ console.log(`[DEBUG] Soft timeout after ${this.maxOperationTimeout}ms \u2014 invoking timeout observer`);
108737
108255
  }
108738
- }, 6e4);
108739
- }, this.maxOperationTimeout);
108740
- }
108741
- if (this.timeoutBehavior === "negotiated" && this.maxOperationTimeout > 0) {
108742
- negotiatedTimeoutState.softTimeoutId = setTimeout(() => {
108256
+ runTimeoutObserver();
108257
+ }, this.maxOperationTimeout);
108258
+ }
108259
+ try {
108260
+ const steps = await result.steps;
108261
+ let finalText;
108262
+ if (steps && steps.length > 1) {
108263
+ const lastStepText = steps[steps.length - 1].text;
108264
+ finalText = lastStepText || await result.text;
108265
+ } else {
108266
+ finalText = await result.text;
108267
+ }
108268
+ if (!options.schema && (!steps || steps.length === 0) && (!finalText || !finalText.trim())) {
108269
+ throw Object.assign(
108270
+ new Error("No output generated. Check the stream for errors."),
108271
+ { name: "AI_NoOutputGeneratedError" }
108272
+ );
108273
+ }
108743
108274
  if (this.debug) {
108744
- console.log(`[DEBUG] Soft timeout after ${this.maxOperationTimeout}ms \u2014 invoking timeout observer`);
108275
+ console.log(`[DEBUG] streamText completed: ${steps?.length || 0} steps, finalText=${finalText?.length || 0} chars`);
108745
108276
  }
108746
- runTimeoutObserver();
108747
- }, this.maxOperationTimeout);
108748
- }
108749
- try {
108750
- const steps = await result.steps;
108751
- let finalText;
108752
- if (steps && steps.length > 1) {
108753
- const lastStepText = steps[steps.length - 1].text;
108754
- finalText = lastStepText || await result.text;
108755
- } else {
108756
- finalText = await result.text;
108757
- }
108758
- if (this.debug) {
108759
- console.log(`[DEBUG] streamText completed: ${steps?.length || 0} steps, finalText=${finalText?.length || 0} chars`);
108760
- }
108761
- const usage = await result.usage;
108762
- if (usage) {
108763
- this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
108764
- }
108765
- return { finalText, result };
108766
- } finally {
108767
- if (gracefulTimeoutId) clearTimeout(gracefulTimeoutId);
108768
- if (hardAbortTimeoutId) clearTimeout(hardAbortTimeoutId);
108769
- if (negotiatedTimeoutState.softTimeoutId) clearTimeout(negotiatedTimeoutState.softTimeoutId);
108770
- if (this._gracefulStopHardAbortId) {
108771
- clearTimeout(this._gracefulStopHardAbortId);
108772
- this._gracefulStopHardAbortId = null;
108277
+ const usage = await result.usage;
108278
+ if (usage) {
108279
+ this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
108280
+ }
108281
+ return { finalText, result };
108282
+ } finally {
108283
+ if (gracefulTimeoutId) clearTimeout(gracefulTimeoutId);
108284
+ if (hardAbortTimeoutId) clearTimeout(hardAbortTimeoutId);
108285
+ if (negotiatedTimeoutState.softTimeoutId) clearTimeout(negotiatedTimeoutState.softTimeoutId);
108286
+ if (this._gracefulStopHardAbortId) {
108287
+ clearTimeout(this._gracefulStopHardAbortId);
108288
+ this._gracefulStopHardAbortId = null;
108289
+ }
108290
+ this.events.removeListener("toolCall", onToolCall);
108773
108291
  }
108774
- this.events.removeListener("toolCall", onToolCall);
108775
- }
108292
+ });
108776
108293
  };
108777
108294
  let aiResult;
108778
108295
  if (this.tracer) {