@react-grab/ami 0.0.77 → 0.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.cjs CHANGED
@@ -788,8 +788,8 @@ function $constructor(name16, initializer3, params) {
788
788
  initializer3(inst, def);
789
789
  const proto = _.prototype;
790
790
  const keys = Object.keys(proto);
791
- for (let i = 0; i < keys.length; i++) {
792
- const k2 = keys[i];
791
+ for (let i2 = 0; i2 < keys.length; i2++) {
792
+ const k2 = keys[i2];
793
793
  if (!(k2 in inst)) {
794
794
  inst[k2] = proto[k2].bind(inst);
795
795
  }
@@ -918,8 +918,8 @@ function assertNever(_x) {
918
918
  function assert(_) {
919
919
  }
920
920
  function getEnumValues(entries) {
921
- const numericValues = Object.values(entries).filter((v) => typeof v === "number");
922
- const values = Object.entries(entries).filter(([k2, _]) => numericValues.indexOf(+k2) === -1).map(([_, v]) => v);
921
+ const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
922
+ const values = Object.entries(entries).filter(([k2, _]) => numericValues.indexOf(+k2) === -1).map(([_, v2]) => v2);
923
923
  return values;
924
924
  }
925
925
  function joinValues(array2, separator = "|") {
@@ -978,9 +978,9 @@ function defineLazy(object3, key, getter) {
978
978
  }
979
979
  return value;
980
980
  },
981
- set(v) {
981
+ set(v2) {
982
982
  Object.defineProperty(object3, key, {
983
- value: v
983
+ value: v2
984
984
  // configurable: true,
985
985
  });
986
986
  },
@@ -1019,8 +1019,8 @@ function promiseAllObject(promisesObj) {
1019
1019
  const promises = keys.map((key) => promisesObj[key]);
1020
1020
  return Promise.all(promises).then((results) => {
1021
1021
  const resolvedObj = {};
1022
- for (let i = 0; i < keys.length; i++) {
1023
- resolvedObj[keys[i]] = results[i];
1022
+ for (let i2 = 0; i2 < keys.length; i2++) {
1023
+ resolvedObj[keys[i2]] = results[i2];
1024
1024
  }
1025
1025
  return resolvedObj;
1026
1026
  });
@@ -1028,7 +1028,7 @@ function promiseAllObject(promisesObj) {
1028
1028
  function randomString(length = 10) {
1029
1029
  const chars = "abcdefghijklmnopqrstuvwxyz";
1030
1030
  let str = "";
1031
- for (let i = 0; i < length; i++) {
1031
+ for (let i2 = 0; i2 < length; i2++) {
1032
1032
  str += chars[Math.floor(Math.random() * chars.length)];
1033
1033
  }
1034
1034
  return str;
@@ -1368,11 +1368,11 @@ function required(Class2, schema, mask) {
1368
1368
  });
1369
1369
  return clone(schema, def);
1370
1370
  }
1371
- function aborted(x, startIndex = 0) {
1372
- if (x.aborted === true)
1371
+ function aborted(x2, startIndex = 0) {
1372
+ if (x2.aborted === true)
1373
1373
  return true;
1374
- for (let i = startIndex; i < x.issues.length; i++) {
1375
- if (x.issues[i]?.continue !== true) {
1374
+ for (let i2 = startIndex; i2 < x2.issues.length; i2++) {
1375
+ if (x2.issues[i2]?.continue !== true) {
1376
1376
  return true;
1377
1377
  }
1378
1378
  }
@@ -1438,15 +1438,15 @@ function cleanEnum(obj) {
1438
1438
  function base64ToUint8Array(base643) {
1439
1439
  const binaryString = atob(base643);
1440
1440
  const bytes = new Uint8Array(binaryString.length);
1441
- for (let i = 0; i < binaryString.length; i++) {
1442
- bytes[i] = binaryString.charCodeAt(i);
1441
+ for (let i2 = 0; i2 < binaryString.length; i2++) {
1442
+ bytes[i2] = binaryString.charCodeAt(i2);
1443
1443
  }
1444
1444
  return bytes;
1445
1445
  }
1446
1446
  function uint8ArrayToBase64(bytes) {
1447
1447
  let binaryString = "";
1448
- for (let i = 0; i < bytes.length; i++) {
1449
- binaryString += String.fromCharCode(bytes[i]);
1448
+ for (let i2 = 0; i2 < bytes.length; i2++) {
1449
+ binaryString += String.fromCharCode(bytes[i2]);
1450
1450
  }
1451
1451
  return btoa(binaryString);
1452
1452
  }
@@ -1464,8 +1464,8 @@ function hexToUint8Array(hex3) {
1464
1464
  throw new Error("Invalid hex string length");
1465
1465
  }
1466
1466
  const bytes = new Uint8Array(cleanHex.length / 2);
1467
- for (let i = 0; i < cleanHex.length; i += 2) {
1468
- bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
1467
+ for (let i2 = 0; i2 < cleanHex.length; i2 += 2) {
1468
+ bytes[i2 / 2] = Number.parseInt(cleanHex.slice(i2, i2 + 2), 16);
1469
1469
  }
1470
1470
  return bytes;
1471
1471
  }
@@ -1523,10 +1523,10 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
1523
1523
  fieldErrors._errors.push(mapper(issue2));
1524
1524
  } else {
1525
1525
  let curr = fieldErrors;
1526
- let i = 0;
1527
- while (i < issue2.path.length) {
1528
- const el = issue2.path[i];
1529
- const terminal = i === issue2.path.length - 1;
1526
+ let i2 = 0;
1527
+ while (i2 < issue2.path.length) {
1528
+ const el = issue2.path[i2];
1529
+ const terminal = i2 === issue2.path.length - 1;
1530
1530
  if (!terminal) {
1531
1531
  curr[el] = curr[el] || { _errors: [] };
1532
1532
  } else {
@@ -1534,7 +1534,7 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
1534
1534
  curr[el]._errors.push(mapper(issue2));
1535
1535
  }
1536
1536
  curr = curr[el];
1537
- i++;
1537
+ i2++;
1538
1538
  }
1539
1539
  }
1540
1540
  }
@@ -1560,10 +1560,10 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
1560
1560
  continue;
1561
1561
  }
1562
1562
  let curr = result;
1563
- let i = 0;
1564
- while (i < fullpath.length) {
1565
- const el = fullpath[i];
1566
- const terminal = i === fullpath.length - 1;
1563
+ let i2 = 0;
1564
+ while (i2 < fullpath.length) {
1565
+ const el = fullpath[i2];
1566
+ const terminal = i2 === fullpath.length - 1;
1567
1567
  if (typeof el === "string") {
1568
1568
  curr.properties ?? (curr.properties = {});
1569
1569
  (_a17 = curr.properties)[el] ?? (_a17[el] = { errors: [] });
@@ -1576,7 +1576,7 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
1576
1576
  if (terminal) {
1577
1577
  curr.errors.push(mapper(issue2));
1578
1578
  }
1579
- i++;
1579
+ i2++;
1580
1580
  }
1581
1581
  }
1582
1582
  }
@@ -2420,9 +2420,9 @@ var Doc = class {
2420
2420
  return;
2421
2421
  }
2422
2422
  const content = arg;
2423
- const lines = content.split("\n").filter((x) => x);
2424
- const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
2425
- const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
2423
+ const lines = content.split("\n").filter((x2) => x2);
2424
+ const minIndent = Math.min(...lines.map((x2) => x2.length - x2.trimStart().length));
2425
+ const dedented = lines.map((x2) => x2.slice(minIndent)).map((x2) => " ".repeat(this.indent * 2) + x2);
2426
2426
  for (const line of dedented) {
2427
2427
  this.content.push(line);
2428
2428
  }
@@ -2431,7 +2431,7 @@ var Doc = class {
2431
2431
  const F = Function;
2432
2432
  const args = this?.args;
2433
2433
  const content = this?.content ?? [``];
2434
- const lines = [...content.map((x) => ` ${x}`)];
2434
+ const lines = [...content.map((x2) => ` ${x2}`)];
2435
2435
  return new F(...args, lines.join("\n"));
2436
2436
  }
2437
2437
  };
@@ -2593,10 +2593,10 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
2593
2593
  v7: 7,
2594
2594
  v8: 8
2595
2595
  };
2596
- const v = versionMap[def.version];
2597
- if (v === void 0)
2596
+ const v2 = versionMap[def.version];
2597
+ if (v2 === void 0)
2598
2598
  throw new Error(`Invalid UUID version: "${def.version}"`);
2599
- def.pattern ?? (def.pattern = uuid(v));
2599
+ def.pattern ?? (def.pattern = uuid(v2));
2600
2600
  } else
2601
2601
  def.pattern ?? (def.pattern = uuid());
2602
2602
  $ZodStringFormat.init(inst, def);
@@ -3067,16 +3067,16 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3067
3067
  }
3068
3068
  payload.value = Array(input.length);
3069
3069
  const proms = [];
3070
- for (let i = 0; i < input.length; i++) {
3071
- const item = input[i];
3070
+ for (let i2 = 0; i2 < input.length; i2++) {
3071
+ const item = input[i2];
3072
3072
  const result = def.element._zod.run({
3073
3073
  value: item,
3074
3074
  issues: []
3075
3075
  }, ctx);
3076
3076
  if (result instanceof Promise) {
3077
- proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
3077
+ proms.push(result.then((result2) => handleArrayResult(result2, payload, i2)));
3078
3078
  } else {
3079
- handleArrayResult(result, payload, i);
3079
+ handleArrayResult(result, payload, i2);
3080
3080
  }
3081
3081
  }
3082
3082
  if (proms.length) {
@@ -3169,8 +3169,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3169
3169
  const field = shape[key]._zod;
3170
3170
  if (field.values) {
3171
3171
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3172
- for (const v of field.values)
3173
- propValues[key].add(v);
3172
+ for (const v2 of field.values)
3173
+ propValues[key].add(v2);
3174
3174
  }
3175
3175
  }
3176
3176
  return propValues;
@@ -3359,10 +3359,10 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3359
3359
  const pv = option._zod.propValues;
3360
3360
  if (!pv || Object.keys(pv).length === 0)
3361
3361
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
3362
- for (const [k2, v] of Object.entries(pv)) {
3362
+ for (const [k2, v2] of Object.entries(pv)) {
3363
3363
  if (!propValues[k2])
3364
3364
  propValues[k2] = /* @__PURE__ */ new Set();
3365
- for (const val of v) {
3365
+ for (const val of v2) {
3366
3366
  propValues[k2].add(val);
3367
3367
  }
3368
3368
  }
@@ -3376,11 +3376,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3376
3376
  const values = o._zod.propValues?.[def.discriminator];
3377
3377
  if (!values || values.size === 0)
3378
3378
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
3379
- for (const v of values) {
3380
- if (map2.has(v)) {
3381
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
3379
+ for (const v2 of values) {
3380
+ if (map2.has(v2)) {
3381
+ throw new Error(`Duplicate discriminator value "${String(v2)}"`);
3382
3382
  }
3383
- map2.set(v, o);
3383
+ map2.set(v2, o);
3384
3384
  }
3385
3385
  }
3386
3386
  return map2;
@@ -3521,35 +3521,35 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3521
3521
  return payload;
3522
3522
  }
3523
3523
  }
3524
- let i = -1;
3524
+ let i2 = -1;
3525
3525
  for (const item of items) {
3526
- i++;
3527
- if (i >= input.length) {
3528
- if (i >= optStart)
3526
+ i2++;
3527
+ if (i2 >= input.length) {
3528
+ if (i2 >= optStart)
3529
3529
  continue;
3530
3530
  }
3531
3531
  const result = item._zod.run({
3532
- value: input[i],
3532
+ value: input[i2],
3533
3533
  issues: []
3534
3534
  }, ctx);
3535
3535
  if (result instanceof Promise) {
3536
- proms.push(result.then((result2) => handleTupleResult(result2, payload, i)));
3536
+ proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
3537
3537
  } else {
3538
- handleTupleResult(result, payload, i);
3538
+ handleTupleResult(result, payload, i2);
3539
3539
  }
3540
3540
  }
3541
3541
  if (def.rest) {
3542
3542
  const rest = input.slice(items.length);
3543
3543
  for (const el of rest) {
3544
- i++;
3544
+ i2++;
3545
3545
  const result = def.rest._zod.run({
3546
3546
  value: el,
3547
3547
  issues: []
3548
3548
  }, ctx);
3549
3549
  if (result instanceof Promise) {
3550
- proms.push(result.then((result2) => handleTupleResult(result2, payload, i)));
3550
+ proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
3551
3551
  } else {
3552
- handleTupleResult(result, payload, i);
3552
+ handleTupleResult(result, payload, i2);
3553
3553
  }
3554
3554
  }
3555
3555
  }
@@ -3920,8 +3920,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
3920
3920
  var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
3921
3921
  $ZodType.init(inst, def);
3922
3922
  defineLazy(inst._zod, "values", () => {
3923
- const v = def.innerType._zod.values;
3924
- return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
3923
+ const v2 = def.innerType._zod.values;
3924
+ return v2 ? new Set([...v2].filter((x2) => x2 !== void 0)) : void 0;
3925
3925
  });
3926
3926
  inst._zod.parse = (payload, ctx) => {
3927
3927
  const result = def.innerType._zod.run(payload, ctx);
@@ -6350,7 +6350,7 @@ var error16 = () => {
6350
6350
  if (issue2.values.length === 1) {
6351
6351
  return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${stringifyPrimitive(issue2.values[0])}`;
6352
6352
  }
6353
- const stringified = issue2.values.map((v) => stringifyPrimitive(v));
6353
+ const stringified = issue2.values.map((v2) => stringifyPrimitive(v2));
6354
6354
  if (issue2.values.length === 2) {
6355
6355
  return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${stringified[0]} \u05D0\u05D5 ${stringified[1]}`;
6356
6356
  }
@@ -10771,7 +10771,7 @@ function _set(Class2, valueType, params) {
10771
10771
  });
10772
10772
  }
10773
10773
  function _enum(Class2, values, params) {
10774
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
10774
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
10775
10775
  return new Class2({
10776
10776
  type: "enum",
10777
10777
  entries,
@@ -10954,8 +10954,8 @@ function _stringbool(Classes, _params) {
10954
10954
  let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
10955
10955
  let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
10956
10956
  if (params.case !== "sensitive") {
10957
- truthyArray = truthyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
10958
- falsyArray = falsyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
10957
+ truthyArray = truthyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
10958
+ falsyArray = falsyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
10959
10959
  }
10960
10960
  const truthySet = new Set(truthyArray);
10961
10961
  const falsySet = new Set(falsyArray);
@@ -11220,11 +11220,11 @@ var JSONSchemaGenerator = class {
11220
11220
  }
11221
11221
  const allKeys = new Set(Object.keys(shape));
11222
11222
  const requiredKeys = new Set([...allKeys].filter((key) => {
11223
- const v = def.shape[key]._zod;
11223
+ const v2 = def.shape[key]._zod;
11224
11224
  if (this.io === "input") {
11225
- return v.optin === void 0;
11225
+ return v2.optin === void 0;
11226
11226
  } else {
11227
- return v.optout === void 0;
11227
+ return v2.optout === void 0;
11228
11228
  }
11229
11229
  }));
11230
11230
  if (requiredKeys.size > 0) {
@@ -11246,9 +11246,9 @@ var JSONSchemaGenerator = class {
11246
11246
  case "union": {
11247
11247
  const json2 = _json;
11248
11248
  const isDiscriminated = def.discriminator !== void 0;
11249
- const options = def.options.map((x, i) => this.process(x, {
11249
+ const options = def.options.map((x2, i2) => this.process(x2, {
11250
11250
  ...params,
11251
- path: [...params.path, isDiscriminated ? "oneOf" : "anyOf", i]
11251
+ path: [...params.path, isDiscriminated ? "oneOf" : "anyOf", i2]
11252
11252
  }));
11253
11253
  if (isDiscriminated) {
11254
11254
  json2.oneOf = options;
@@ -11280,9 +11280,9 @@ var JSONSchemaGenerator = class {
11280
11280
  json2.type = "array";
11281
11281
  const prefixPath = this.target === "draft-2020-12" ? "prefixItems" : "items";
11282
11282
  const restPath = this.target === "draft-2020-12" ? "items" : this.target === "openapi-3.0" ? "items" : "additionalItems";
11283
- const prefixItems = def.items.map((x, i) => this.process(x, {
11283
+ const prefixItems = def.items.map((x2, i2) => this.process(x2, {
11284
11284
  ...params,
11285
- path: [...params.path, prefixPath, i]
11285
+ path: [...params.path, prefixPath, i2]
11286
11286
  }));
11287
11287
  const rest = def.rest ? this.process(def.rest, {
11288
11288
  ...params,
@@ -11347,9 +11347,9 @@ var JSONSchemaGenerator = class {
11347
11347
  case "enum": {
11348
11348
  const json2 = _json;
11349
11349
  const values = getEnumValues(def.entries);
11350
- if (values.every((v) => typeof v === "number"))
11350
+ if (values.every((v2) => typeof v2 === "number"))
11351
11351
  json2.type = "number";
11352
- if (values.every((v) => typeof v === "string"))
11352
+ if (values.every((v2) => typeof v2 === "string"))
11353
11353
  json2.type = "string";
11354
11354
  json2.enum = values;
11355
11355
  break;
@@ -11381,13 +11381,13 @@ var JSONSchemaGenerator = class {
11381
11381
  json2.const = val;
11382
11382
  }
11383
11383
  } else {
11384
- if (vals.every((v) => typeof v === "number"))
11384
+ if (vals.every((v2) => typeof v2 === "number"))
11385
11385
  json2.type = "number";
11386
- if (vals.every((v) => typeof v === "string"))
11386
+ if (vals.every((v2) => typeof v2 === "string"))
11387
11387
  json2.type = "string";
11388
- if (vals.every((v) => typeof v === "boolean"))
11388
+ if (vals.every((v2) => typeof v2 === "boolean"))
11389
11389
  json2.type = "string";
11390
- if (vals.every((v) => v === null))
11390
+ if (vals.every((v2) => v2 === null))
11391
11391
  json2.type = "null";
11392
11392
  json2.enum = vals;
11393
11393
  }
@@ -12550,7 +12550,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
12550
12550
  };
12551
12551
  });
12552
12552
  function _enum2(values, params) {
12553
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
12553
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
12554
12554
  return new ZodEnum({
12555
12555
  type: "enum",
12556
12556
  entries,
@@ -13066,10 +13066,10 @@ var ZodError2 = class _ZodError extends Error {
13066
13066
  fieldErrors._errors.push(mapper(issue2));
13067
13067
  } else {
13068
13068
  let curr = fieldErrors;
13069
- let i = 0;
13070
- while (i < issue2.path.length) {
13071
- const el = issue2.path[i];
13072
- const terminal = i === issue2.path.length - 1;
13069
+ let i2 = 0;
13070
+ while (i2 < issue2.path.length) {
13071
+ const el = issue2.path[i2];
13072
+ const terminal = i2 === issue2.path.length - 1;
13073
13073
  if (!terminal) {
13074
13074
  curr[el] = curr[el] || { _errors: [] };
13075
13075
  } else {
@@ -13077,7 +13077,7 @@ var ZodError2 = class _ZodError extends Error {
13077
13077
  curr[el]._errors.push(mapper(issue2));
13078
13078
  }
13079
13079
  curr = curr[el];
13080
- i++;
13080
+ i2++;
13081
13081
  }
13082
13082
  }
13083
13083
  }
@@ -13178,8 +13178,8 @@ var createIdGenerator = ({
13178
13178
  const generator = () => {
13179
13179
  const alphabetLength = alphabet.length;
13180
13180
  const chars = new Array(size);
13181
- for (let i = 0; i < size; i++) {
13182
- chars[i] = alphabet[Math.random() * alphabetLength | 0];
13181
+ for (let i2 = 0; i2 < size; i2++) {
13182
+ chars[i2] = alphabet[Math.random() * alphabetLength | 0];
13183
13183
  }
13184
13184
  return chars.join("");
13185
13185
  };
@@ -13395,11 +13395,11 @@ async function resolve(value) {
13395
13395
  return Promise.resolve(value);
13396
13396
  }
13397
13397
  var getRelativePath = (pathA, pathB) => {
13398
- let i = 0;
13399
- for (; i < pathA.length && i < pathB.length; i++) {
13400
- if (pathA[i] !== pathB[i]) break;
13398
+ let i2 = 0;
13399
+ for (; i2 < pathA.length && i2 < pathB.length; i2++) {
13400
+ if (pathA[i2] !== pathB[i2]) break;
13401
13401
  }
13402
- return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
13402
+ return [(pathA.length - i2).toString(), ...pathB.slice(i2)].join("/");
13403
13403
  };
13404
13404
  var ignoreOverride = Symbol(
13405
13405
  "Let zodToJsonSchema decide on which parser to use"
@@ -13500,7 +13500,7 @@ function parseDateDef(def, refs, overrideDateStrategy) {
13500
13500
  const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
13501
13501
  if (Array.isArray(strategy)) {
13502
13502
  return {
13503
- anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
13503
+ anyOf: strategy.map((item, i2) => parseDateDef(def, refs, item))
13504
13504
  };
13505
13505
  }
13506
13506
  switch (strategy) {
@@ -13565,7 +13565,7 @@ function parseIntersectionDef(def, refs) {
13565
13565
  ...refs,
13566
13566
  currentPath: [...refs.currentPath, "allOf", "1"]
13567
13567
  })
13568
- ].filter((x) => !!x);
13568
+ ].filter((x2) => !!x2);
13569
13569
  const mergedAllOf = [];
13570
13570
  allOf.forEach((schema) => {
13571
13571
  if (isJsonSchema7AllOfType(schema)) {
@@ -13790,17 +13790,17 @@ var ALPHA_NUMERIC = new Set(
13790
13790
  );
13791
13791
  function escapeNonAlphaNumeric(source) {
13792
13792
  let result = "";
13793
- for (let i = 0; i < source.length; i++) {
13794
- if (!ALPHA_NUMERIC.has(source[i])) {
13793
+ for (let i2 = 0; i2 < source.length; i2++) {
13794
+ if (!ALPHA_NUMERIC.has(source[i2])) {
13795
13795
  result += "\\";
13796
13796
  }
13797
- result += source[i];
13797
+ result += source[i2];
13798
13798
  }
13799
13799
  return result;
13800
13800
  }
13801
13801
  function addFormat(schema, value, message, refs) {
13802
13802
  var _a17;
13803
- if (schema.format || ((_a17 = schema.anyOf) == null ? void 0 : _a17.some((x) => x.format))) {
13803
+ if (schema.format || ((_a17 = schema.anyOf) == null ? void 0 : _a17.some((x2) => x2.format))) {
13804
13804
  if (!schema.anyOf) {
13805
13805
  schema.anyOf = [];
13806
13806
  }
@@ -13820,7 +13820,7 @@ function addFormat(schema, value, message, refs) {
13820
13820
  }
13821
13821
  function addPattern(schema, regex, message, refs) {
13822
13822
  var _a17;
13823
- if (schema.pattern || ((_a17 = schema.allOf) == null ? void 0 : _a17.some((x) => x.pattern))) {
13823
+ if (schema.pattern || ((_a17 = schema.allOf) == null ? void 0 : _a17.some((x2) => x2.pattern))) {
13824
13824
  if (!schema.allOf) {
13825
13825
  schema.allOf = [];
13826
13826
  }
@@ -13856,55 +13856,55 @@ function stringifyRegExpWithFlags(regex, refs) {
13856
13856
  let isEscaped = false;
13857
13857
  let inCharGroup = false;
13858
13858
  let inCharRange = false;
13859
- for (let i = 0; i < source.length; i++) {
13859
+ for (let i2 = 0; i2 < source.length; i2++) {
13860
13860
  if (isEscaped) {
13861
- pattern += source[i];
13861
+ pattern += source[i2];
13862
13862
  isEscaped = false;
13863
13863
  continue;
13864
13864
  }
13865
13865
  if (flags.i) {
13866
13866
  if (inCharGroup) {
13867
- if (source[i].match(/[a-z]/)) {
13867
+ if (source[i2].match(/[a-z]/)) {
13868
13868
  if (inCharRange) {
13869
- pattern += source[i];
13870
- pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
13869
+ pattern += source[i2];
13870
+ pattern += `${source[i2 - 2]}-${source[i2]}`.toUpperCase();
13871
13871
  inCharRange = false;
13872
- } else if (source[i + 1] === "-" && ((_a17 = source[i + 2]) == null ? void 0 : _a17.match(/[a-z]/))) {
13873
- pattern += source[i];
13872
+ } else if (source[i2 + 1] === "-" && ((_a17 = source[i2 + 2]) == null ? void 0 : _a17.match(/[a-z]/))) {
13873
+ pattern += source[i2];
13874
13874
  inCharRange = true;
13875
13875
  } else {
13876
- pattern += `${source[i]}${source[i].toUpperCase()}`;
13876
+ pattern += `${source[i2]}${source[i2].toUpperCase()}`;
13877
13877
  }
13878
13878
  continue;
13879
13879
  }
13880
- } else if (source[i].match(/[a-z]/)) {
13881
- pattern += `[${source[i]}${source[i].toUpperCase()}]`;
13880
+ } else if (source[i2].match(/[a-z]/)) {
13881
+ pattern += `[${source[i2]}${source[i2].toUpperCase()}]`;
13882
13882
  continue;
13883
13883
  }
13884
13884
  }
13885
13885
  if (flags.m) {
13886
- if (source[i] === "^") {
13886
+ if (source[i2] === "^") {
13887
13887
  pattern += `(^|(?<=[\r
13888
13888
  ]))`;
13889
13889
  continue;
13890
- } else if (source[i] === "$") {
13890
+ } else if (source[i2] === "$") {
13891
13891
  pattern += `($|(?=[\r
13892
13892
  ]))`;
13893
13893
  continue;
13894
13894
  }
13895
13895
  }
13896
- if (flags.s && source[i] === ".") {
13897
- pattern += inCharGroup ? `${source[i]}\r
13898
- ` : `[${source[i]}\r
13896
+ if (flags.s && source[i2] === ".") {
13897
+ pattern += inCharGroup ? `${source[i2]}\r
13898
+ ` : `[${source[i2]}\r
13899
13899
  ]`;
13900
13900
  continue;
13901
13901
  }
13902
- pattern += source[i];
13903
- if (source[i] === "\\") {
13902
+ pattern += source[i2];
13903
+ if (source[i2] === "\\") {
13904
13904
  isEscaped = true;
13905
- } else if (inCharGroup && source[i] === "]") {
13905
+ } else if (inCharGroup && source[i2] === "]") {
13906
13906
  inCharGroup = false;
13907
- } else if (!inCharGroup && source[i] === "[") {
13907
+ } else if (!inCharGroup && source[i2] === "[") {
13908
13908
  inCharGroup = true;
13909
13909
  }
13910
13910
  }
@@ -14009,19 +14009,19 @@ var primitiveMappings = {
14009
14009
  function parseUnionDef(def, refs) {
14010
14010
  const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
14011
14011
  if (options.every(
14012
- (x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length)
14012
+ (x2) => x2._def.typeName in primitiveMappings && (!x2._def.checks || !x2._def.checks.length)
14013
14013
  )) {
14014
- const types = options.reduce((types2, x) => {
14015
- const type = primitiveMappings[x._def.typeName];
14014
+ const types = options.reduce((types2, x2) => {
14015
+ const type = primitiveMappings[x2._def.typeName];
14016
14016
  return type && !types2.includes(type) ? [...types2, type] : types2;
14017
14017
  }, []);
14018
14018
  return {
14019
14019
  type: types.length > 1 ? types : types[0]
14020
14020
  };
14021
- } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
14021
+ } else if (options.every((x2) => x2._def.typeName === "ZodLiteral" && !x2.description)) {
14022
14022
  const types = options.reduce(
14023
- (acc, x) => {
14024
- const type = typeof x._def.value;
14023
+ (acc, x2) => {
14024
+ const type = typeof x2._def.value;
14025
14025
  switch (type) {
14026
14026
  case "string":
14027
14027
  case "number":
@@ -14030,7 +14030,7 @@ function parseUnionDef(def, refs) {
14030
14030
  case "bigint":
14031
14031
  return [...acc, "integer"];
14032
14032
  case "object":
14033
- if (x._def.value === null) return [...acc, "null"];
14033
+ if (x2._def.value === null) return [...acc, "null"];
14034
14034
  case "symbol":
14035
14035
  case "undefined":
14036
14036
  case "function":
@@ -14041,24 +14041,24 @@ function parseUnionDef(def, refs) {
14041
14041
  []
14042
14042
  );
14043
14043
  if (types.length === options.length) {
14044
- const uniqueTypes = types.filter((x, i, a2) => a2.indexOf(x) === i);
14044
+ const uniqueTypes = types.filter((x2, i2, a2) => a2.indexOf(x2) === i2);
14045
14045
  return {
14046
14046
  type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
14047
14047
  enum: options.reduce(
14048
- (acc, x) => {
14049
- return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
14048
+ (acc, x2) => {
14049
+ return acc.includes(x2._def.value) ? acc : [...acc, x2._def.value];
14050
14050
  },
14051
14051
  []
14052
14052
  )
14053
14053
  };
14054
14054
  }
14055
- } else if (options.every((x) => x._def.typeName === "ZodEnum")) {
14055
+ } else if (options.every((x2) => x2._def.typeName === "ZodEnum")) {
14056
14056
  return {
14057
14057
  type: "string",
14058
14058
  enum: options.reduce(
14059
- (acc, x) => [
14059
+ (acc, x2) => [
14060
14060
  ...acc,
14061
- ...x._def.values.filter((x2) => !acc.includes(x2))
14061
+ ...x2._def.values.filter((x22) => !acc.includes(x22))
14062
14062
  ],
14063
14063
  []
14064
14064
  )
@@ -14068,12 +14068,12 @@ function parseUnionDef(def, refs) {
14068
14068
  }
14069
14069
  var asAnyOf = (def, refs) => {
14070
14070
  const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
14071
- (x, i) => parseDef(x._def, {
14071
+ (x2, i2) => parseDef(x2._def, {
14072
14072
  ...refs,
14073
- currentPath: [...refs.currentPath, "anyOf", `${i}`]
14073
+ currentPath: [...refs.currentPath, "anyOf", `${i2}`]
14074
14074
  })
14075
14075
  ).filter(
14076
- (x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0)
14076
+ (x2) => !!x2 && (!refs.strictUnions || typeof x2 === "object" && Object.keys(x2).length > 0)
14077
14077
  );
14078
14078
  return anyOf.length ? { anyOf } : void 0;
14079
14079
  };
@@ -14209,7 +14209,7 @@ var parsePipelineDef = (def, refs) => {
14209
14209
  currentPath: [...refs.currentPath, "allOf", a2 ? "1" : "0"]
14210
14210
  });
14211
14211
  return {
14212
- allOf: [a2, b2].filter((x) => x !== void 0)
14212
+ allOf: [a2, b2].filter((x2) => x2 !== void 0)
14213
14213
  };
14214
14214
  };
14215
14215
  function parsePromiseDef(def, refs) {
@@ -14239,12 +14239,12 @@ function parseTupleDef(def, refs) {
14239
14239
  type: "array",
14240
14240
  minItems: def.items.length,
14241
14241
  items: def.items.map(
14242
- (x, i) => parseDef(x._def, {
14242
+ (x2, i2) => parseDef(x2._def, {
14243
14243
  ...refs,
14244
- currentPath: [...refs.currentPath, "items", `${i}`]
14244
+ currentPath: [...refs.currentPath, "items", `${i2}`]
14245
14245
  })
14246
14246
  ).reduce(
14247
- (acc, x) => x === void 0 ? acc : [...acc, x],
14247
+ (acc, x2) => x2 === void 0 ? acc : [...acc, x2],
14248
14248
  []
14249
14249
  ),
14250
14250
  additionalItems: parseDef(def.rest._def, {
@@ -14258,12 +14258,12 @@ function parseTupleDef(def, refs) {
14258
14258
  minItems: def.items.length,
14259
14259
  maxItems: def.items.length,
14260
14260
  items: def.items.map(
14261
- (x, i) => parseDef(x._def, {
14261
+ (x2, i2) => parseDef(x2._def, {
14262
14262
  ...refs,
14263
- currentPath: [...refs.currentPath, "items", `${i}`]
14263
+ currentPath: [...refs.currentPath, "items", `${i2}`]
14264
14264
  })
14265
14265
  ).reduce(
14266
- (acc, x) => x === void 0 ? acc : [...acc, x],
14266
+ (acc, x2) => x2 === void 0 ? acc : [...acc, x2],
14267
14267
  []
14268
14268
  )
14269
14269
  };
@@ -14559,7 +14559,7 @@ function asSchema(schema) {
14559
14559
  }) : isSchema(schema) ? schema : typeof schema === "function" ? schema() : zodSchema(schema);
14560
14560
  }
14561
14561
 
14562
- // ../../node_modules/.pnpm/ai@5.0.106_zod@4.1.13/node_modules/ai/dist/index.mjs
14562
+ // ../../node_modules/.pnpm/ai@5.0.108_zod@4.1.13/node_modules/ai/dist/index.mjs
14563
14563
  var __defProp2 = Object.defineProperty;
14564
14564
  var __export2 = (target, all) => {
14565
14565
  for (var name16 in all)
@@ -14590,7 +14590,7 @@ var NoObjectGeneratedError = class extends AISDKError {
14590
14590
  }
14591
14591
  };
14592
14592
  _a62 = symbol62;
14593
- var VERSION = "5.0.106" ;
14593
+ var VERSION = "5.0.108" ;
14594
14594
  var dataContentSchema = external_exports.union([
14595
14595
  external_exports.string(),
14596
14596
  external_exports.instanceof(Uint8Array),
@@ -14937,11 +14937,11 @@ function fixJson(input) {
14937
14937
  const stack = ["ROOT"];
14938
14938
  let lastValidIndex = -1;
14939
14939
  let literalStart = null;
14940
- function processValueStart(char, i, swapState) {
14940
+ function processValueStart(char, i2, swapState) {
14941
14941
  {
14942
14942
  switch (char) {
14943
14943
  case '"': {
14944
- lastValidIndex = i;
14944
+ lastValidIndex = i2;
14945
14945
  stack.pop();
14946
14946
  stack.push(swapState);
14947
14947
  stack.push("INSIDE_STRING");
@@ -14950,8 +14950,8 @@ function fixJson(input) {
14950
14950
  case "f":
14951
14951
  case "t":
14952
14952
  case "n": {
14953
- lastValidIndex = i;
14954
- literalStart = i;
14953
+ lastValidIndex = i2;
14954
+ literalStart = i2;
14955
14955
  stack.pop();
14956
14956
  stack.push(swapState);
14957
14957
  stack.push("INSIDE_LITERAL");
@@ -14973,21 +14973,21 @@ function fixJson(input) {
14973
14973
  case "7":
14974
14974
  case "8":
14975
14975
  case "9": {
14976
- lastValidIndex = i;
14976
+ lastValidIndex = i2;
14977
14977
  stack.pop();
14978
14978
  stack.push(swapState);
14979
14979
  stack.push("INSIDE_NUMBER");
14980
14980
  break;
14981
14981
  }
14982
14982
  case "{": {
14983
- lastValidIndex = i;
14983
+ lastValidIndex = i2;
14984
14984
  stack.pop();
14985
14985
  stack.push(swapState);
14986
14986
  stack.push("INSIDE_OBJECT_START");
14987
14987
  break;
14988
14988
  }
14989
14989
  case "[": {
14990
- lastValidIndex = i;
14990
+ lastValidIndex = i2;
14991
14991
  stack.pop();
14992
14992
  stack.push(swapState);
14993
14993
  stack.push("INSIDE_ARRAY_START");
@@ -14996,7 +14996,7 @@ function fixJson(input) {
14996
14996
  }
14997
14997
  }
14998
14998
  }
14999
- function processAfterObjectValue(char, i) {
14999
+ function processAfterObjectValue(char, i2) {
15000
15000
  switch (char) {
15001
15001
  case ",": {
15002
15002
  stack.pop();
@@ -15004,13 +15004,13 @@ function fixJson(input) {
15004
15004
  break;
15005
15005
  }
15006
15006
  case "}": {
15007
- lastValidIndex = i;
15007
+ lastValidIndex = i2;
15008
15008
  stack.pop();
15009
15009
  break;
15010
15010
  }
15011
15011
  }
15012
15012
  }
15013
- function processAfterArrayValue(char, i) {
15013
+ function processAfterArrayValue(char, i2) {
15014
15014
  switch (char) {
15015
15015
  case ",": {
15016
15016
  stack.pop();
@@ -15018,18 +15018,18 @@ function fixJson(input) {
15018
15018
  break;
15019
15019
  }
15020
15020
  case "]": {
15021
- lastValidIndex = i;
15021
+ lastValidIndex = i2;
15022
15022
  stack.pop();
15023
15023
  break;
15024
15024
  }
15025
15025
  }
15026
15026
  }
15027
- for (let i = 0; i < input.length; i++) {
15028
- const char = input[i];
15027
+ for (let i2 = 0; i2 < input.length; i2++) {
15028
+ const char = input[i2];
15029
15029
  const currentState = stack[stack.length - 1];
15030
15030
  switch (currentState) {
15031
15031
  case "ROOT":
15032
- processValueStart(char, i, "FINISH");
15032
+ processValueStart(char, i2, "FINISH");
15033
15033
  break;
15034
15034
  case "INSIDE_OBJECT_START": {
15035
15035
  switch (char) {
@@ -15039,7 +15039,7 @@ function fixJson(input) {
15039
15039
  break;
15040
15040
  }
15041
15041
  case "}": {
15042
- lastValidIndex = i;
15042
+ lastValidIndex = i2;
15043
15043
  stack.pop();
15044
15044
  break;
15045
15045
  }
@@ -15077,18 +15077,18 @@ function fixJson(input) {
15077
15077
  break;
15078
15078
  }
15079
15079
  case "INSIDE_OBJECT_BEFORE_VALUE": {
15080
- processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
15080
+ processValueStart(char, i2, "INSIDE_OBJECT_AFTER_VALUE");
15081
15081
  break;
15082
15082
  }
15083
15083
  case "INSIDE_OBJECT_AFTER_VALUE": {
15084
- processAfterObjectValue(char, i);
15084
+ processAfterObjectValue(char, i2);
15085
15085
  break;
15086
15086
  }
15087
15087
  case "INSIDE_STRING": {
15088
15088
  switch (char) {
15089
15089
  case '"': {
15090
15090
  stack.pop();
15091
- lastValidIndex = i;
15091
+ lastValidIndex = i2;
15092
15092
  break;
15093
15093
  }
15094
15094
  case "\\": {
@@ -15096,7 +15096,7 @@ function fixJson(input) {
15096
15096
  break;
15097
15097
  }
15098
15098
  default: {
15099
- lastValidIndex = i;
15099
+ lastValidIndex = i2;
15100
15100
  }
15101
15101
  }
15102
15102
  break;
@@ -15104,13 +15104,13 @@ function fixJson(input) {
15104
15104
  case "INSIDE_ARRAY_START": {
15105
15105
  switch (char) {
15106
15106
  case "]": {
15107
- lastValidIndex = i;
15107
+ lastValidIndex = i2;
15108
15108
  stack.pop();
15109
15109
  break;
15110
15110
  }
15111
15111
  default: {
15112
- lastValidIndex = i;
15113
- processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
15112
+ lastValidIndex = i2;
15113
+ processValueStart(char, i2, "INSIDE_ARRAY_AFTER_VALUE");
15114
15114
  break;
15115
15115
  }
15116
15116
  }
@@ -15124,24 +15124,24 @@ function fixJson(input) {
15124
15124
  break;
15125
15125
  }
15126
15126
  case "]": {
15127
- lastValidIndex = i;
15127
+ lastValidIndex = i2;
15128
15128
  stack.pop();
15129
15129
  break;
15130
15130
  }
15131
15131
  default: {
15132
- lastValidIndex = i;
15132
+ lastValidIndex = i2;
15133
15133
  break;
15134
15134
  }
15135
15135
  }
15136
15136
  break;
15137
15137
  }
15138
15138
  case "INSIDE_ARRAY_AFTER_COMMA": {
15139
- processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
15139
+ processValueStart(char, i2, "INSIDE_ARRAY_AFTER_VALUE");
15140
15140
  break;
15141
15141
  }
15142
15142
  case "INSIDE_STRING_ESCAPE": {
15143
15143
  stack.pop();
15144
- lastValidIndex = i;
15144
+ lastValidIndex = i2;
15145
15145
  break;
15146
15146
  }
15147
15147
  case "INSIDE_NUMBER": {
@@ -15156,7 +15156,7 @@ function fixJson(input) {
15156
15156
  case "7":
15157
15157
  case "8":
15158
15158
  case "9": {
15159
- lastValidIndex = i;
15159
+ lastValidIndex = i2;
15160
15160
  break;
15161
15161
  }
15162
15162
  case "e":
@@ -15168,24 +15168,24 @@ function fixJson(input) {
15168
15168
  case ",": {
15169
15169
  stack.pop();
15170
15170
  if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
15171
- processAfterArrayValue(char, i);
15171
+ processAfterArrayValue(char, i2);
15172
15172
  }
15173
15173
  if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
15174
- processAfterObjectValue(char, i);
15174
+ processAfterObjectValue(char, i2);
15175
15175
  }
15176
15176
  break;
15177
15177
  }
15178
15178
  case "}": {
15179
15179
  stack.pop();
15180
15180
  if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
15181
- processAfterObjectValue(char, i);
15181
+ processAfterObjectValue(char, i2);
15182
15182
  }
15183
15183
  break;
15184
15184
  }
15185
15185
  case "]": {
15186
15186
  stack.pop();
15187
15187
  if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
15188
- processAfterArrayValue(char, i);
15188
+ processAfterArrayValue(char, i2);
15189
15189
  }
15190
15190
  break;
15191
15191
  }
@@ -15197,24 +15197,24 @@ function fixJson(input) {
15197
15197
  break;
15198
15198
  }
15199
15199
  case "INSIDE_LITERAL": {
15200
- const partialLiteral = input.substring(literalStart, i + 1);
15200
+ const partialLiteral = input.substring(literalStart, i2 + 1);
15201
15201
  if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
15202
15202
  stack.pop();
15203
15203
  if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
15204
- processAfterObjectValue(char, i);
15204
+ processAfterObjectValue(char, i2);
15205
15205
  } else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
15206
- processAfterArrayValue(char, i);
15206
+ processAfterArrayValue(char, i2);
15207
15207
  }
15208
15208
  } else {
15209
- lastValidIndex = i;
15209
+ lastValidIndex = i2;
15210
15210
  }
15211
15211
  break;
15212
15212
  }
15213
15213
  }
15214
15214
  }
15215
15215
  let result = input.slice(0, lastValidIndex + 1);
15216
- for (let i = stack.length - 1; i >= 0; i--) {
15217
- const state = stack[i];
15216
+ for (let i2 = stack.length - 1; i2 >= 0; i2--) {
15217
+ const state = stack[i2];
15218
15218
  switch (state) {
15219
15219
  case "INSIDE_STRING": {
15220
15220
  result += '"';
@@ -16067,61 +16067,82 @@ function readUIMessageStream({
16067
16067
  return createAsyncIterableStream(outputStream);
16068
16068
  }
16069
16069
 
16070
- // ../../node_modules/.pnpm/ami-sdk@0.0.1/node_modules/ami-sdk/dist/index.js
16071
- var n = "https://app.ami.dev";
16072
- var a = "https://bridge.ami.dev";
16073
- var s = `${n}/api/v1/trpc`;
16074
- var l = async (t) => {
16070
+ // ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js
16071
+ var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
16072
+
16073
+ // ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.browser.js
16074
+ var nanoid3 = (size = 21) => {
16075
+ let id = "";
16076
+ let bytes = crypto.getRandomValues(new Uint8Array(size |= 0));
16077
+ while (size--) {
16078
+ id += urlAlphabet[bytes[size] & 63];
16079
+ }
16080
+ return id;
16081
+ };
16082
+
16083
+ // ../../node_modules/.pnpm/ami-sdk@0.0.2/node_modules/ami-sdk/dist/index.js
16084
+ var a = "https://app.ami.dev";
16085
+ var s = "https://bridge.ami.dev";
16086
+ var i = `${a}/api/v1/trpc`;
16087
+ var l = async (e) => {
16075
16088
  let r = "completed";
16076
- const o = new AbortController(), a2 = t.getMessages(), s2 = await fetch(t.url, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${t.token}` }, body: JSON.stringify({ id: d(), chatId: t.chatId, projectId: t.projectId, agentUrl: n, cwd: t.context.environment.cwd, messages: a2, context: t.context }) }).then((e) => e.body ?? null);
16077
- if (!s2) throw new Error(`Agent response stream was not received from ${t.url}. Possible causes: network error, server did not return a response body, or agent endpoint misconfiguration.`);
16078
- const i = new g().parseStream(s2), c = new Array(), l2 = t.messages.at(-1), p2 = readUIMessageStream({ message: l2, stream: i.pipeThrough(new TransformStream({ transform(e, t2) {
16079
- c.push(e), t2.enqueue(e), "data-lifecycle" === e.type && (r = e.data.status);
16089
+ const o = new AbortController(), n = e.chatId ?? await g({ token: e.token, projectId: e.projectId }), s2 = e.getMessages(), i2 = await fetch(e.url, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` }, body: JSON.stringify({ id: p(), chatId: n, projectId: e.projectId, agentUrl: a, cwd: e.context.environment.cwd, messages: s2, context: e.context }) }).then((t) => t.body ?? null);
16090
+ if (!i2) throw new Error(`Agent response stream was not received from ${e.url}. Possible causes: network error, server did not return a response body, or agent endpoint misconfiguration.`);
16091
+ const c = new w().parseStream(i2), d = new Array(), l2 = e.messages.at(-1), u2 = readUIMessageStream({ message: l2, stream: c.pipeThrough(new TransformStream({ transform(t, e2) {
16092
+ d.push(t), e2.enqueue(t), "data-lifecycle" === t.type && (r = t.data.status);
16080
16093
  } })), terminateOnError: true });
16081
- for await (const e of p2) {
16094
+ for await (const t of u2) {
16082
16095
  if (o.signal.aborted) break;
16083
- await t.upsertMessage(e);
16096
+ await e.upsertMessage(t);
16084
16097
  }
16085
- return r;
16098
+ return { status: r, chatId: n };
16099
+ };
16100
+ var p = () => nanoid3();
16101
+ var u = (t) => ({ id: t.id, role: t.role, parts: [{ type: "text", text: t.content }], createdAt: /* @__PURE__ */ new Date() });
16102
+ var h = (t) => {
16103
+ const e = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long", year: "numeric", month: "long", day: "numeric" });
16104
+ return { cwd: t, homeDir: "", workingDirectory: t, isGitRepo: false, platform: "undefined" != typeof navigator ? navigator.platform : "unknown", osVersion: "", today: e, isCodeServerAvailable: false, rules: { agents: null, claude: null, gemini: null, cursor: null } };
16086
16105
  };
16087
- var d = () => crypto.randomUUID();
16088
- var p = (e) => ({ id: e.id, role: e.role, parts: [{ type: "text", text: e.content }], createdAt: /* @__PURE__ */ new Date() });
16089
- var u = (e) => {
16090
- const t = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long", year: "numeric", month: "long", day: "numeric" });
16091
- return { cwd: e, homeDir: "", workingDirectory: e, isGitRepo: false, platform: "undefined" != typeof navigator ? navigator.platform : "unknown", osVersion: "", today: t, isCodeServerAvailable: false, rules: { agents: null, claude: null, gemini: null, cursor: null } };
16106
+ var g = async (t) => {
16107
+ const e = await fetch(`${i}/chats.create`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${t.token}` }, body: JSON.stringify({ projectId: t.projectId, hasBackgroundAgent: t.hasBackgroundAgent ?? false }) });
16108
+ if (!e.ok) {
16109
+ const t2 = await e.text();
16110
+ throw new Error(`Failed to create chat: ${e.status} ${e.statusText}${t2 ? ` - ${t2}` : ""}`);
16111
+ }
16112
+ return (await e.json()).result.data;
16092
16113
  };
16093
- var g = class extends DefaultChatTransport {
16094
- parseStream(e) {
16095
- return this.processResponseStream(e);
16114
+ var w = class extends DefaultChatTransport {
16115
+ parseStream(t) {
16116
+ return this.processResponseStream(t);
16096
16117
  }
16097
16118
  };
16098
- var m = (e) => external_exports.object({ result: external_exports.object({ data: e }) });
16099
- var h = m(external_exports.object({ token: external_exports.string() }));
16100
- var w = m(external_exports.object({ verified: external_exports.boolean(), expired: external_exports.boolean(), token: external_exports.string().optional(), bridge_token: external_exports.string().optional() }));
16101
- var f = external_exports.object({ id: external_exports.string(), authorId: external_exports.string(), color: external_exports.string().nullable(), gitRepo: external_exports.string().nullable(), title: external_exports.string().nullable(), archivedAt: external_exports.string().nullable(), createdAt: external_exports.string(), updatedAt: external_exports.string() });
16102
- m(external_exports.object({ hasMore: external_exports.boolean(), nextCursor: external_exports.number().optional(), projects: external_exports.array(f) }));
16103
- m(f);
16104
- var b = (e) => new Promise((t) => setTimeout(t, e));
16105
- var $ = async () => {
16106
- const e = await fetch(`${s}/user.token.registerDaemonToken`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
16107
- if (!e.ok) throw new Error(`Failed to create exchange token: ${e.status}`);
16108
- const t = await e.json();
16109
- return h.parse(t).result.data.token;
16119
+ var m = (t) => external_exports.object({ result: external_exports.object({ data: t }) });
16120
+ var f = m(external_exports.object({ token: external_exports.string() }));
16121
+ var y = m(external_exports.object({ verified: external_exports.boolean(), expired: external_exports.boolean(), token: external_exports.string().optional(), bridge_token: external_exports.string().optional() }));
16122
+ var k = external_exports.object({ id: external_exports.string(), authorId: external_exports.string(), color: external_exports.string().nullable(), gitRepo: external_exports.string().nullable(), title: external_exports.string().nullable(), archivedAt: external_exports.string().nullable(), createdAt: external_exports.string(), updatedAt: external_exports.string() });
16123
+ m(external_exports.object({ hasMore: external_exports.boolean(), nextCursor: external_exports.number().optional(), projects: external_exports.array(k) }));
16124
+ m(k);
16125
+ var b = (t) => new Promise((e) => setTimeout(e, t));
16126
+ var S = async () => {
16127
+ const t = await fetch(`${i}/user.token.registerDaemonToken`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
16128
+ if (!t.ok) throw new Error(`Failed to create exchange token: ${t.status}`);
16129
+ const e = await t.json();
16130
+ return f.parse(e).result.data.token;
16110
16131
  };
16111
- var j = async (e) => {
16112
- const t = new URLSearchParams({ input: JSON.stringify({ token: e }) }), r = await fetch(`${s}/user.token.checkIfVerified?${t}`, { method: "GET", headers: { "Content-Type": "application/json" } });
16132
+ var T = async (t) => {
16133
+ const e = new URLSearchParams({ input: JSON.stringify({ token: t }) }), r = await fetch(`${i}/user.token.checkIfVerified?${e}`, { method: "GET", headers: { "Content-Type": "application/json" } });
16113
16134
  if (!r.ok) throw new Error(`Failed to check verification: ${r.status}`);
16114
16135
  const o = await r.json();
16115
- return w.parse(o).result.data;
16136
+ return y.parse(o).result.data;
16116
16137
  };
16117
- var S = (e) => `${n}/daemon/auth?token=${e}`;
16118
- var T = async (e, t, r = 60) => {
16138
+ var x = (t) => `${a}/daemon/auth?token=${t}`;
16139
+ var v = async (t, e, r = 60) => {
16119
16140
  for (let o = 0; o < r; o++) {
16120
16141
  await b(1e3);
16121
16142
  try {
16122
- const r2 = await j(e);
16123
- if (r2.expired) return t("expired"), { success: false };
16124
- if (r2.verified) return t("success"), { success: true, token: r2.token, bridgeToken: r2.bridge_token };
16143
+ const r2 = await T(t);
16144
+ if (r2.expired) return e("expired"), { success: false };
16145
+ if (r2.verified) return e("success"), { success: true, token: r2.token, bridgeToken: r2.bridge_token };
16125
16146
  } catch {
16126
16147
  }
16127
16148
  }
@@ -16146,10 +16167,10 @@ var saveCachedToken = (token) => {
16146
16167
  }
16147
16168
  };
16148
16169
  var authenticate = async () => {
16149
- const exchangeToken = await $();
16150
- const authUrl = S(exchangeToken);
16170
+ const exchangeToken = await S();
16171
+ const authUrl = x(exchangeToken);
16151
16172
  window.open(authUrl, "_blank");
16152
- const result = await T(exchangeToken, () => {
16173
+ const result = await v(exchangeToken, () => {
16153
16174
  });
16154
16175
  if (!result.success || !result.token) {
16155
16176
  throw new Error("Authentication failed");
@@ -16191,14 +16212,14 @@ var runAgent = async (context, token, projectId, onStatus) => {
16191
16212
 
16192
16213
  ${context.content}`;
16193
16214
  const messages = [
16194
- p({
16195
- id: d(),
16215
+ u({
16216
+ id: p(),
16196
16217
  role: "user",
16197
16218
  content: fullPrompt
16198
16219
  })
16199
16220
  ];
16200
- const chatId = d();
16201
- const environment = u(window.location.href);
16221
+ const chatId = p();
16222
+ const environment = h(window.location.href);
16202
16223
  const upsertMessage = async (message) => {
16203
16224
  const existingIndex = messages.findIndex((m2) => m2.id === message.id);
16204
16225
  if (existingIndex >= 0) {
@@ -16213,21 +16234,28 @@ ${context.content}`;
16213
16234
  }
16214
16235
  }
16215
16236
  };
16216
- const status = await l({
16237
+ const { status } = await l({
16217
16238
  messages: sanitizeMessages(messages),
16218
16239
  context: {
16219
16240
  environment,
16220
16241
  systemContext: [],
16221
16242
  attachments: []
16222
16243
  },
16223
- url: `${a}/api/v1/agent-proxy`,
16244
+ url: `${s}/api/v1/agent-proxy`,
16224
16245
  chatId,
16225
16246
  projectId,
16226
16247
  token,
16227
16248
  upsertMessage,
16228
16249
  getMessages: () => sanitizeMessages(messages)
16229
16250
  });
16230
- return status === "completed" ? "Completed successfully" : `Task finished (${status})`;
16251
+ switch (status) {
16252
+ case "error":
16253
+ throw new Error("Failed to complete task");
16254
+ case "aborted":
16255
+ throw new Error("User aborted task");
16256
+ default:
16257
+ return "Completed successfully";
16258
+ }
16231
16259
  };
16232
16260
  var CONNECTION_CHECK_TTL_MS = 5e3;
16233
16261
  var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
@@ -16333,7 +16361,12 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16333
16361
  resolveWait = null;
16334
16362
  }
16335
16363
  };
16336
- const agentPromise = runAgent(context, token, DEFAULT_PROJECT_ID, onStatus);
16364
+ const agentPromise = runAgent(
16365
+ context,
16366
+ token,
16367
+ DEFAULT_PROJECT_ID,
16368
+ onStatus
16369
+ );
16337
16370
  let done = false;
16338
16371
  let caughtError = null;
16339
16372
  agentPromise.then((finalStatus) => {
@@ -16386,7 +16419,7 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16386
16419
  return connectionCache.result;
16387
16420
  }
16388
16421
  try {
16389
- const response = await fetch(a, { method: "HEAD" });
16422
+ const response = await fetch(s, { method: "HEAD" });
16390
16423
  const result = response.ok;
16391
16424
  connectionCache = { result, timestamp: now };
16392
16425
  return result;