@react-grab/ami 0.0.78 → 0.0.80

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
@@ -1,11 +1,170 @@
1
1
  'use strict';
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __esm = (fn, res) => function __init() {
6
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
+ };
4
8
  var __export = (target, all) => {
5
9
  for (var name16 in all)
6
10
  __defProp(target, name16, { get: all[name16], enumerable: true });
7
11
  };
8
12
 
13
+ // ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js
14
+ var urlAlphabet;
15
+ var init_url_alphabet = __esm({
16
+ "../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js"() {
17
+ urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
18
+ }
19
+ });
20
+
21
+ // ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.browser.js
22
+ var nanoid;
23
+ var init_index_browser = __esm({
24
+ "../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.browser.js"() {
25
+ init_url_alphabet();
26
+ nanoid = (size = 21) => {
27
+ let id = "";
28
+ let bytes = crypto.getRandomValues(new Uint8Array(size |= 0));
29
+ while (size--) {
30
+ id += urlAlphabet[bytes[size] & 63];
31
+ }
32
+ return id;
33
+ };
34
+ }
35
+ });
36
+
37
+ // ../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/chunk-PXASDCYU.js
38
+ var t, s, i, n, r, o, c, a, d, h;
39
+ var init_chunk_PXASDCYU = __esm({
40
+ "../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/chunk-PXASDCYU.js"() {
41
+ init_index_browser();
42
+ t = "wss://bridge.ami.dev/api/v1/user-streams";
43
+ s = class {
44
+ promise;
45
+ rawResolve = () => null;
46
+ rawReject = () => null;
47
+ isSettled = false;
48
+ isResolved = false;
49
+ timeoutId = null;
50
+ constructor() {
51
+ this.promise = new Promise((e, t2) => {
52
+ this.rawResolve = e, this.rawReject = t2;
53
+ });
54
+ }
55
+ timeout(e) {
56
+ this.timeoutId && clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => {
57
+ this.isSettled || this.reject(new Error("Connection timeout"));
58
+ }, e);
59
+ }
60
+ resolve(e) {
61
+ this.isSettled || (this.isSettled = true, this.isResolved = true, this.timeoutId && clearTimeout(this.timeoutId), this.rawResolve(e));
62
+ }
63
+ reject(e) {
64
+ this.isSettled || (this.isSettled = true, this.timeoutId && clearTimeout(this.timeoutId), this.rawReject(e));
65
+ }
66
+ };
67
+ i = class {
68
+ ws = null;
69
+ pendingRequests = /* @__PURE__ */ new Map();
70
+ isConnecting = false;
71
+ connectionPromise = null;
72
+ config;
73
+ ready = new s();
74
+ isAuthenticated = new s();
75
+ constructor(e) {
76
+ this.config = e;
77
+ }
78
+ async rpc(t2, s2, i3) {
79
+ await this.ensureConnected();
80
+ const n2 = nanoid(), r2 = new Promise((e, t3) => {
81
+ this.pendingRequests.set(n2, { resolve: (t4) => e(t4), reject: t3 }), setTimeout(() => {
82
+ this.pendingRequests.has(n2) && (this.pendingRequests.delete(n2), t3(new Error("RPC request timeout")));
83
+ }, 3e4);
84
+ });
85
+ return this.ws?.send(JSON.stringify({ _tag: "rpc_call", requestId: n2, method: t2, input: s2, ...i3 ? { target: i3 } : {} })), r2;
86
+ }
87
+ disconnect() {
88
+ this.ws?.close(), this.ws = null, this.pendingRequests.clear(), this.ready = new s(), this.isAuthenticated = new s();
89
+ }
90
+ isConnected() {
91
+ return this.ws?.readyState === WebSocket.OPEN;
92
+ }
93
+ async connect() {
94
+ const e = this.config.bridgeWsUrl ?? t, i3 = new URL(e);
95
+ i3.searchParams.set("userId", this.config.userId), this.ready = new s(), this.isAuthenticated = new s(), this.ws = new WebSocket(i3.toString()), this.ws.addEventListener("open", () => {
96
+ this.ready.resolve(true);
97
+ }), this.ws.addEventListener("message", (e2) => {
98
+ const t2 = JSON.parse(e2.data);
99
+ if ("auth_required" !== t2._tag) if ("auth_success" !== t2._tag) if ("auth_failed" !== t2._tag) {
100
+ if ("rpc_result" === t2._tag) {
101
+ const e3 = this.pendingRequests.get(t2.requestId);
102
+ e3 && (e3.resolve(t2.data), this.pendingRequests.delete(t2.requestId));
103
+ } else if ("rpc_error" === t2._tag) {
104
+ const e3 = this.pendingRequests.get(t2.requestId);
105
+ if (e3) {
106
+ const s2 = new Error(t2.message);
107
+ e3.reject(s2), this.pendingRequests.delete(t2.requestId);
108
+ }
109
+ }
110
+ } else this.isAuthenticated.reject(new Error("Authentication failed"));
111
+ else this.isAuthenticated.resolve(true);
112
+ else this.ws?.send(JSON.stringify({ _tag: "auth", token: this.config.bridgeToken, type: "client" }));
113
+ }), this.ws.addEventListener("error", (e2) => {
114
+ console.error("WebSocket error:", e2), this.ready.isSettled || this.ready.reject(new Error("WebSocket connection failed"));
115
+ }), this.ws.addEventListener("close", () => {
116
+ this.ready.isSettled || this.ready.reject(new Error("WebSocket closed"));
117
+ }), this.ready.timeout(1e4), this.isAuthenticated.timeout(1e4), await this.ready.promise, await this.isAuthenticated.promise;
118
+ }
119
+ async ensureConnected() {
120
+ if (this.ws?.readyState !== WebSocket.OPEN || !this.isAuthenticated.isResolved) {
121
+ if (this.isConnecting && this.connectionPromise) return this.connectionPromise;
122
+ this.isConnecting = true, this.connectionPromise = this.connect();
123
+ try {
124
+ await this.connectionPromise;
125
+ } finally {
126
+ this.isConnecting = false, this.connectionPromise = null;
127
+ }
128
+ }
129
+ }
130
+ };
131
+ n = null;
132
+ r = (e) => n = new i(e);
133
+ o = () => n;
134
+ c = async (e, t2, s2) => {
135
+ if (!n) throw new Error("CLI RPC client not initialized. Call initCliRpc() first with your bridgeToken and userId.");
136
+ return n.rpc(e, t2, s2);
137
+ };
138
+ a = async (e) => {
139
+ const t2 = e.patches.map((e2) => ({ filepath: e2.filePath, patch: e2.patch, deleted: e2.deleted }));
140
+ return c("fs:apply_diffs", { cwd: e.cwd, patches: t2 });
141
+ };
142
+ d = async (e) => c("daemon:get_environment", { _tag: "ProjectId", projectId: e });
143
+ h = async (e) => c("daemon:get_environment", { _tag: "Port", port: e });
144
+ }
145
+ });
146
+
147
+ // ../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/cli-rpc-TXHB6KVB.js
148
+ var cli_rpc_TXHB6KVB_exports = {};
149
+ __export(cli_rpc_TXHB6KVB_exports, {
150
+ AMI_BRIDGE_WS_URL: () => t,
151
+ CliRpcClient: () => i,
152
+ applyRevertPatchesViaCli: () => a,
153
+ cliRpc: () => c,
154
+ getCliRpcClient: () => o,
155
+ getEnvironmentFromPort: () => h,
156
+ getEnvironmentFromProjectId: () => d,
157
+ initCliRpc: () => r
158
+ });
159
+ var init_cli_rpc_TXHB6KVB = __esm({
160
+ "../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/cli-rpc-TXHB6KVB.js"() {
161
+ init_chunk_PXASDCYU();
162
+ }
163
+ });
164
+
165
+ // ../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/index.js
166
+ init_chunk_PXASDCYU();
167
+
9
168
  // ../../node_modules/.pnpm/@ai-sdk+provider@2.0.0/node_modules/@ai-sdk/provider/dist/index.mjs
10
169
  var marker = "vercel.ai.error";
11
170
  var symbol = Symbol.for(marker);
@@ -421,7 +580,7 @@ __export(external_exports, {
421
580
  minSize: () => _minSize,
422
581
  multipleOf: () => _multipleOf,
423
582
  nan: () => nan,
424
- nanoid: () => nanoid2,
583
+ nanoid: () => nanoid3,
425
584
  nativeEnum: () => nativeEnum,
426
585
  negative: () => _negative,
427
586
  never: () => never,
@@ -775,7 +934,7 @@ function $constructor(name16, initializer3, params) {
775
934
  Object.defineProperty(inst, "_zod", {
776
935
  value: {
777
936
  def,
778
- constr: _,
937
+ constr: _2,
779
938
  traits: /* @__PURE__ */ new Set()
780
939
  },
781
940
  enumerable: false
@@ -786,10 +945,10 @@ function $constructor(name16, initializer3, params) {
786
945
  }
787
946
  inst._zod.traits.add(name16);
788
947
  initializer3(inst, def);
789
- const proto = _.prototype;
948
+ const proto = _2.prototype;
790
949
  const keys = Object.keys(proto);
791
- for (let i2 = 0; i2 < keys.length; i2++) {
792
- const k2 = keys[i2];
950
+ for (let i3 = 0; i3 < keys.length; i3++) {
951
+ const k2 = keys[i3];
793
952
  if (!(k2 in inst)) {
794
953
  inst[k2] = proto[k2].bind(inst);
795
954
  }
@@ -799,7 +958,7 @@ function $constructor(name16, initializer3, params) {
799
958
  class Definition extends Parent {
800
959
  }
801
960
  Object.defineProperty(Definition, "name", { value: name16 });
802
- function _(def) {
961
+ function _2(def) {
803
962
  var _a17;
804
963
  const inst = params?.Parent ? new Definition() : this;
805
964
  init(inst, def);
@@ -809,16 +968,16 @@ function $constructor(name16, initializer3, params) {
809
968
  }
810
969
  return inst;
811
970
  }
812
- Object.defineProperty(_, "init", { value: init });
813
- Object.defineProperty(_, Symbol.hasInstance, {
971
+ Object.defineProperty(_2, "init", { value: init });
972
+ Object.defineProperty(_2, Symbol.hasInstance, {
814
973
  value: (inst) => {
815
974
  if (params?.Parent && inst instanceof params.Parent)
816
975
  return true;
817
976
  return inst?._zod?.traits?.has(name16);
818
977
  }
819
978
  });
820
- Object.defineProperty(_, "name", { value: name16 });
821
- return _;
979
+ Object.defineProperty(_2, "name", { value: name16 });
980
+ return _2;
822
981
  }
823
982
  var $brand = Symbol("zod_brand");
824
983
  var $ZodAsyncError = class extends Error {
@@ -915,17 +1074,17 @@ function assertIs(_arg) {
915
1074
  function assertNever(_x) {
916
1075
  throw new Error();
917
1076
  }
918
- function assert(_) {
1077
+ function assert(_2) {
919
1078
  }
920
1079
  function getEnumValues(entries) {
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);
1080
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
1081
+ const values = Object.entries(entries).filter(([k2, _2]) => numericValues.indexOf(+k2) === -1).map(([_2, v]) => v);
923
1082
  return values;
924
1083
  }
925
1084
  function joinValues(array2, separator = "|") {
926
1085
  return array2.map((val) => stringifyPrimitive(val)).join(separator);
927
1086
  }
928
- function jsonStringifyReplacer(_, value) {
1087
+ function jsonStringifyReplacer(_2, value) {
929
1088
  if (typeof value === "bigint")
930
1089
  return value.toString();
931
1090
  return value;
@@ -978,9 +1137,9 @@ function defineLazy(object3, key, getter) {
978
1137
  }
979
1138
  return value;
980
1139
  },
981
- set(v2) {
1140
+ set(v) {
982
1141
  Object.defineProperty(object3, key, {
983
- value: v2
1142
+ value: v
984
1143
  // configurable: true,
985
1144
  });
986
1145
  },
@@ -1019,8 +1178,8 @@ function promiseAllObject(promisesObj) {
1019
1178
  const promises = keys.map((key) => promisesObj[key]);
1020
1179
  return Promise.all(promises).then((results) => {
1021
1180
  const resolvedObj = {};
1022
- for (let i2 = 0; i2 < keys.length; i2++) {
1023
- resolvedObj[keys[i2]] = results[i2];
1181
+ for (let i3 = 0; i3 < keys.length; i3++) {
1182
+ resolvedObj[keys[i3]] = results[i3];
1024
1183
  }
1025
1184
  return resolvedObj;
1026
1185
  });
@@ -1028,7 +1187,7 @@ function promiseAllObject(promisesObj) {
1028
1187
  function randomString(length = 10) {
1029
1188
  const chars = "abcdefghijklmnopqrstuvwxyz";
1030
1189
  let str = "";
1031
- for (let i2 = 0; i2 < length; i2++) {
1190
+ for (let i3 = 0; i3 < length; i3++) {
1032
1191
  str += chars[Math.floor(Math.random() * chars.length)];
1033
1192
  }
1034
1193
  return str;
@@ -1052,14 +1211,14 @@ var allowsEval = cached(() => {
1052
1211
  const F = Function;
1053
1212
  new F("");
1054
1213
  return true;
1055
- } catch (_) {
1214
+ } catch (_2) {
1056
1215
  return false;
1057
1216
  }
1058
1217
  });
1059
- function isPlainObject(o) {
1060
- if (isObject(o) === false)
1218
+ function isPlainObject(o2) {
1219
+ if (isObject(o2) === false)
1061
1220
  return false;
1062
- const ctor = o.constructor;
1221
+ const ctor = o2.constructor;
1063
1222
  if (ctor === void 0)
1064
1223
  return true;
1065
1224
  if (typeof ctor !== "function")
@@ -1072,12 +1231,12 @@ function isPlainObject(o) {
1072
1231
  }
1073
1232
  return true;
1074
1233
  }
1075
- function shallowClone(o) {
1076
- if (isPlainObject(o))
1077
- return { ...o };
1078
- if (Array.isArray(o))
1079
- return [...o];
1080
- return o;
1234
+ function shallowClone(o2) {
1235
+ if (isPlainObject(o2))
1236
+ return { ...o2 };
1237
+ if (Array.isArray(o2))
1238
+ return [...o2];
1239
+ return o2;
1081
1240
  }
1082
1241
  function numKeys(data) {
1083
1242
  let keyCount = 0;
@@ -1089,8 +1248,8 @@ function numKeys(data) {
1089
1248
  return keyCount;
1090
1249
  }
1091
1250
  var getParsedType = (data) => {
1092
- const t = typeof data;
1093
- switch (t) {
1251
+ const t2 = typeof data;
1252
+ switch (t2) {
1094
1253
  case "undefined":
1095
1254
  return "undefined";
1096
1255
  case "string":
@@ -1129,7 +1288,7 @@ var getParsedType = (data) => {
1129
1288
  }
1130
1289
  return "object";
1131
1290
  default:
1132
- throw new Error(`Unknown data type: ${t}`);
1291
+ throw new Error(`Unknown data type: ${t2}`);
1133
1292
  }
1134
1293
  };
1135
1294
  var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
@@ -1162,31 +1321,31 @@ function normalizeParams(_params) {
1162
1321
  function createTransparentProxy(getter) {
1163
1322
  let target;
1164
1323
  return new Proxy({}, {
1165
- get(_, prop, receiver) {
1324
+ get(_2, prop, receiver) {
1166
1325
  target ?? (target = getter());
1167
1326
  return Reflect.get(target, prop, receiver);
1168
1327
  },
1169
- set(_, prop, value, receiver) {
1328
+ set(_2, prop, value, receiver) {
1170
1329
  target ?? (target = getter());
1171
1330
  return Reflect.set(target, prop, value, receiver);
1172
1331
  },
1173
- has(_, prop) {
1332
+ has(_2, prop) {
1174
1333
  target ?? (target = getter());
1175
1334
  return Reflect.has(target, prop);
1176
1335
  },
1177
- deleteProperty(_, prop) {
1336
+ deleteProperty(_2, prop) {
1178
1337
  target ?? (target = getter());
1179
1338
  return Reflect.deleteProperty(target, prop);
1180
1339
  },
1181
- ownKeys(_) {
1340
+ ownKeys(_2) {
1182
1341
  target ?? (target = getter());
1183
1342
  return Reflect.ownKeys(target);
1184
1343
  },
1185
- getOwnPropertyDescriptor(_, prop) {
1344
+ getOwnPropertyDescriptor(_2, prop) {
1186
1345
  target ?? (target = getter());
1187
1346
  return Reflect.getOwnPropertyDescriptor(target, prop);
1188
1347
  },
1189
- defineProperty(_, prop, descriptor) {
1348
+ defineProperty(_2, prop, descriptor) {
1190
1349
  target ?? (target = getter());
1191
1350
  return Reflect.defineProperty(target, prop, descriptor);
1192
1351
  }
@@ -1371,8 +1530,8 @@ function required(Class2, schema, mask) {
1371
1530
  function aborted(x2, startIndex = 0) {
1372
1531
  if (x2.aborted === true)
1373
1532
  return true;
1374
- for (let i2 = startIndex; i2 < x2.issues.length; i2++) {
1375
- if (x2.issues[i2]?.continue !== true) {
1533
+ for (let i3 = startIndex; i3 < x2.issues.length; i3++) {
1534
+ if (x2.issues[i3]?.continue !== true) {
1376
1535
  return true;
1377
1536
  }
1378
1537
  }
@@ -1431,22 +1590,22 @@ function issue(...args) {
1431
1590
  return { ...iss };
1432
1591
  }
1433
1592
  function cleanEnum(obj) {
1434
- return Object.entries(obj).filter(([k2, _]) => {
1593
+ return Object.entries(obj).filter(([k2, _2]) => {
1435
1594
  return Number.isNaN(Number.parseInt(k2, 10));
1436
1595
  }).map((el) => el[1]);
1437
1596
  }
1438
1597
  function base64ToUint8Array(base643) {
1439
1598
  const binaryString = atob(base643);
1440
1599
  const bytes = new Uint8Array(binaryString.length);
1441
- for (let i2 = 0; i2 < binaryString.length; i2++) {
1442
- bytes[i2] = binaryString.charCodeAt(i2);
1600
+ for (let i3 = 0; i3 < binaryString.length; i3++) {
1601
+ bytes[i3] = binaryString.charCodeAt(i3);
1443
1602
  }
1444
1603
  return bytes;
1445
1604
  }
1446
1605
  function uint8ArrayToBase64(bytes) {
1447
1606
  let binaryString = "";
1448
- for (let i2 = 0; i2 < bytes.length; i2++) {
1449
- binaryString += String.fromCharCode(bytes[i2]);
1607
+ for (let i3 = 0; i3 < bytes.length; i3++) {
1608
+ binaryString += String.fromCharCode(bytes[i3]);
1450
1609
  }
1451
1610
  return btoa(binaryString);
1452
1611
  }
@@ -1464,8 +1623,8 @@ function hexToUint8Array(hex3) {
1464
1623
  throw new Error("Invalid hex string length");
1465
1624
  }
1466
1625
  const bytes = new Uint8Array(cleanHex.length / 2);
1467
- for (let i2 = 0; i2 < cleanHex.length; i2 += 2) {
1468
- bytes[i2 / 2] = Number.parseInt(cleanHex.slice(i2, i2 + 2), 16);
1626
+ for (let i3 = 0; i3 < cleanHex.length; i3 += 2) {
1627
+ bytes[i3 / 2] = Number.parseInt(cleanHex.slice(i3, i3 + 2), 16);
1469
1628
  }
1470
1629
  return bytes;
1471
1630
  }
@@ -1523,10 +1682,10 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
1523
1682
  fieldErrors._errors.push(mapper(issue2));
1524
1683
  } else {
1525
1684
  let curr = fieldErrors;
1526
- let i2 = 0;
1527
- while (i2 < issue2.path.length) {
1528
- const el = issue2.path[i2];
1529
- const terminal = i2 === issue2.path.length - 1;
1685
+ let i3 = 0;
1686
+ while (i3 < issue2.path.length) {
1687
+ const el = issue2.path[i3];
1688
+ const terminal = i3 === issue2.path.length - 1;
1530
1689
  if (!terminal) {
1531
1690
  curr[el] = curr[el] || { _errors: [] };
1532
1691
  } else {
@@ -1534,7 +1693,7 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
1534
1693
  curr[el]._errors.push(mapper(issue2));
1535
1694
  }
1536
1695
  curr = curr[el];
1537
- i2++;
1696
+ i3++;
1538
1697
  }
1539
1698
  }
1540
1699
  }
@@ -1560,10 +1719,10 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
1560
1719
  continue;
1561
1720
  }
1562
1721
  let curr = result;
1563
- let i2 = 0;
1564
- while (i2 < fullpath.length) {
1565
- const el = fullpath[i2];
1566
- const terminal = i2 === fullpath.length - 1;
1722
+ let i3 = 0;
1723
+ while (i3 < fullpath.length) {
1724
+ const el = fullpath[i3];
1725
+ const terminal = i3 === fullpath.length - 1;
1567
1726
  if (typeof el === "string") {
1568
1727
  curr.properties ?? (curr.properties = {});
1569
1728
  (_a17 = curr.properties)[el] ?? (_a17[el] = { errors: [] });
@@ -1576,7 +1735,7 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
1576
1735
  if (terminal) {
1577
1736
  curr.errors.push(mapper(issue2));
1578
1737
  }
1579
- i2++;
1738
+ i3++;
1580
1739
  }
1581
1740
  }
1582
1741
  }
@@ -1735,7 +1894,7 @@ __export(regexes_exports, {
1735
1894
  md5_base64: () => md5_base64,
1736
1895
  md5_base64url: () => md5_base64url,
1737
1896
  md5_hex: () => md5_hex,
1738
- nanoid: () => nanoid,
1897
+ nanoid: () => nanoid2,
1739
1898
  null: () => _null,
1740
1899
  number: () => number,
1741
1900
  rfc5322Email: () => rfc5322Email,
@@ -1768,7 +1927,7 @@ var cuid2 = /^[0-9a-z]+$/;
1768
1927
  var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
1769
1928
  var xid = /^[0-9a-vA-V]{20}$/;
1770
1929
  var ksuid = /^[A-Za-z0-9]{27}$/;
1771
- var nanoid = /^[a-zA-Z0-9_-]{21}$/;
1930
+ var nanoid2 = /^[a-zA-Z0-9_-]{21}$/;
1772
1931
  var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
1773
1932
  var extendedDuration = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
1774
1933
  var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
@@ -2477,13 +2636,13 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2477
2636
  continue;
2478
2637
  }
2479
2638
  const currLen = payload.issues.length;
2480
- const _ = ch._zod.check(payload);
2481
- if (_ instanceof Promise && ctx?.async === false) {
2639
+ const _2 = ch._zod.check(payload);
2640
+ if (_2 instanceof Promise && ctx?.async === false) {
2482
2641
  throw new $ZodAsyncError();
2483
2642
  }
2484
- if (asyncResult || _ instanceof Promise) {
2643
+ if (asyncResult || _2 instanceof Promise) {
2485
2644
  asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
2486
- await _;
2645
+ await _2;
2487
2646
  const nextLen = payload.issues.length;
2488
2647
  if (nextLen === currLen)
2489
2648
  return;
@@ -2543,10 +2702,10 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2543
2702
  inst["~standard"] = {
2544
2703
  validate: (value) => {
2545
2704
  try {
2546
- const r = safeParse(inst, value);
2547
- return r.success ? { value: r.data } : { issues: r.error?.issues };
2548
- } catch (_) {
2549
- return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
2705
+ const r2 = safeParse(inst, value);
2706
+ return r2.success ? { value: r2.data } : { issues: r2.error?.issues };
2707
+ } catch (_2) {
2708
+ return safeParseAsync(inst, value).then((r2) => r2.success ? { value: r2.data } : { issues: r2.error?.issues });
2550
2709
  }
2551
2710
  },
2552
2711
  vendor: "zod",
@@ -2556,11 +2715,11 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2556
2715
  var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
2557
2716
  $ZodType.init(inst, def);
2558
2717
  inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
2559
- inst._zod.parse = (payload, _) => {
2718
+ inst._zod.parse = (payload, _2) => {
2560
2719
  if (def.coerce)
2561
2720
  try {
2562
2721
  payload.value = String(payload.value);
2563
- } catch (_2) {
2722
+ } catch (_3) {
2564
2723
  }
2565
2724
  if (typeof payload.value === "string")
2566
2725
  return payload;
@@ -2593,10 +2752,10 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
2593
2752
  v7: 7,
2594
2753
  v8: 8
2595
2754
  };
2596
- const v2 = versionMap[def.version];
2597
- if (v2 === void 0)
2755
+ const v = versionMap[def.version];
2756
+ if (v === void 0)
2598
2757
  throw new Error(`Invalid UUID version: "${def.version}"`);
2599
- def.pattern ?? (def.pattern = uuid(v2));
2758
+ def.pattern ?? (def.pattern = uuid(v));
2600
2759
  } else
2601
2760
  def.pattern ?? (def.pattern = uuid());
2602
2761
  $ZodStringFormat.init(inst, def);
@@ -2645,7 +2804,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
2645
2804
  payload.value = trimmed;
2646
2805
  }
2647
2806
  return;
2648
- } catch (_) {
2807
+ } catch (_2) {
2649
2808
  payload.issues.push({
2650
2809
  code: "invalid_format",
2651
2810
  format: "url",
@@ -2661,7 +2820,7 @@ var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
2661
2820
  $ZodStringFormat.init(inst, def);
2662
2821
  });
2663
2822
  var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
2664
- def.pattern ?? (def.pattern = nanoid);
2823
+ def.pattern ?? (def.pattern = nanoid2);
2665
2824
  $ZodStringFormat.init(inst, def);
2666
2825
  });
2667
2826
  var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
@@ -2791,7 +2950,7 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
2791
2950
  function isValidBase64URL(data) {
2792
2951
  if (!base64url.test(data))
2793
2952
  return false;
2794
- const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
2953
+ const base643 = data.replace(/[-_]/g, (c2) => c2 === "-" ? "+" : "/");
2795
2954
  const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
2796
2955
  return isValidBase64(padded);
2797
2956
  }
@@ -2870,7 +3029,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
2870
3029
  if (def.coerce)
2871
3030
  try {
2872
3031
  payload.value = Number(payload.value);
2873
- } catch (_) {
3032
+ } catch (_2) {
2874
3033
  }
2875
3034
  const input = payload.value;
2876
3035
  if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
@@ -2898,7 +3057,7 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
2898
3057
  if (def.coerce)
2899
3058
  try {
2900
3059
  payload.value = Boolean(payload.value);
2901
- } catch (_) {
3060
+ } catch (_2) {
2902
3061
  }
2903
3062
  const input = payload.value;
2904
3063
  if (typeof input === "boolean")
@@ -2919,7 +3078,7 @@ var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
2919
3078
  if (def.coerce)
2920
3079
  try {
2921
3080
  payload.value = BigInt(payload.value);
2922
- } catch (_) {
3081
+ } catch (_2) {
2923
3082
  }
2924
3083
  if (typeof payload.value === "bigint")
2925
3084
  return payload;
@@ -3067,16 +3226,16 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3067
3226
  }
3068
3227
  payload.value = Array(input.length);
3069
3228
  const proms = [];
3070
- for (let i2 = 0; i2 < input.length; i2++) {
3071
- const item = input[i2];
3229
+ for (let i3 = 0; i3 < input.length; i3++) {
3230
+ const item = input[i3];
3072
3231
  const result = def.element._zod.run({
3073
3232
  value: item,
3074
3233
  issues: []
3075
3234
  }, ctx);
3076
3235
  if (result instanceof Promise) {
3077
- proms.push(result.then((result2) => handleArrayResult(result2, payload, i2)));
3236
+ proms.push(result.then((result2) => handleArrayResult(result2, payload, i3)));
3078
3237
  } else {
3079
- handleArrayResult(result, payload, i2);
3238
+ handleArrayResult(result, payload, i3);
3080
3239
  }
3081
3240
  }
3082
3241
  if (proms.length) {
@@ -3117,19 +3276,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
3117
3276
  const unrecognized = [];
3118
3277
  const keySet = def.keySet;
3119
3278
  const _catchall = def.catchall._zod;
3120
- const t = _catchall.def.type;
3279
+ const t2 = _catchall.def.type;
3121
3280
  for (const key in input) {
3122
3281
  if (keySet.has(key))
3123
3282
  continue;
3124
- if (t === "never") {
3283
+ if (t2 === "never") {
3125
3284
  unrecognized.push(key);
3126
3285
  continue;
3127
3286
  }
3128
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
3129
- if (r instanceof Promise) {
3130
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input)));
3287
+ const r2 = _catchall.run({ value: input[key], issues: [] }, ctx);
3288
+ if (r2 instanceof Promise) {
3289
+ proms.push(r2.then((r3) => handlePropertyResult(r3, payload, key, input)));
3131
3290
  } else {
3132
- handlePropertyResult(r, payload, key, input);
3291
+ handlePropertyResult(r2, payload, key, input);
3133
3292
  }
3134
3293
  }
3135
3294
  if (unrecognized.length) {
@@ -3169,8 +3328,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3169
3328
  const field = shape[key]._zod;
3170
3329
  if (field.values) {
3171
3330
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3172
- for (const v2 of field.values)
3173
- propValues[key].add(v2);
3331
+ for (const v of field.values)
3332
+ propValues[key].add(v);
3174
3333
  }
3175
3334
  }
3176
3335
  return propValues;
@@ -3195,11 +3354,11 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3195
3354
  const shape = value.shape;
3196
3355
  for (const key of value.keys) {
3197
3356
  const el = shape[key];
3198
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
3199
- if (r instanceof Promise) {
3200
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input)));
3357
+ const r2 = el._zod.run({ value: input[key], issues: [] }, ctx);
3358
+ if (r2 instanceof Promise) {
3359
+ proms.push(r2.then((r3) => handlePropertyResult(r3, payload, key, input)));
3201
3360
  } else {
3202
- handlePropertyResult(r, payload, key, input);
3361
+ handlePropertyResult(r2, payload, key, input);
3203
3362
  }
3204
3363
  }
3205
3364
  if (!catchall) {
@@ -3291,7 +3450,7 @@ function handleUnionResults(results, final, inst, ctx) {
3291
3450
  return final;
3292
3451
  }
3293
3452
  }
3294
- const nonaborted = results.filter((r) => !aborted(r));
3453
+ const nonaborted = results.filter((r2) => !aborted(r2));
3295
3454
  if (nonaborted.length === 1) {
3296
3455
  final.value = nonaborted[0].value;
3297
3456
  return nonaborted[0];
@@ -3306,18 +3465,18 @@ function handleUnionResults(results, final, inst, ctx) {
3306
3465
  }
3307
3466
  var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
3308
3467
  $ZodType.init(inst, def);
3309
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
3310
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
3468
+ defineLazy(inst._zod, "optin", () => def.options.some((o2) => o2._zod.optin === "optional") ? "optional" : void 0);
3469
+ defineLazy(inst._zod, "optout", () => def.options.some((o2) => o2._zod.optout === "optional") ? "optional" : void 0);
3311
3470
  defineLazy(inst._zod, "values", () => {
3312
- if (def.options.every((o) => o._zod.values)) {
3471
+ if (def.options.every((o2) => o2._zod.values)) {
3313
3472
  return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
3314
3473
  }
3315
3474
  return void 0;
3316
3475
  });
3317
3476
  defineLazy(inst._zod, "pattern", () => {
3318
- if (def.options.every((o) => o._zod.pattern)) {
3319
- const patterns = def.options.map((o) => o._zod.pattern);
3320
- return new RegExp(`^(${patterns.map((p2) => cleanRegex(p2.source)).join("|")})$`);
3477
+ if (def.options.every((o2) => o2._zod.pattern)) {
3478
+ const patterns = def.options.map((o2) => o2._zod.pattern);
3479
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
3321
3480
  }
3322
3481
  return void 0;
3323
3482
  });
@@ -3359,10 +3518,10 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3359
3518
  const pv = option._zod.propValues;
3360
3519
  if (!pv || Object.keys(pv).length === 0)
3361
3520
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
3362
- for (const [k2, v2] of Object.entries(pv)) {
3521
+ for (const [k2, v] of Object.entries(pv)) {
3363
3522
  if (!propValues[k2])
3364
3523
  propValues[k2] = /* @__PURE__ */ new Set();
3365
- for (const val of v2) {
3524
+ for (const val of v) {
3366
3525
  propValues[k2].add(val);
3367
3526
  }
3368
3527
  }
@@ -3372,15 +3531,15 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3372
3531
  const disc = cached(() => {
3373
3532
  const opts = def.options;
3374
3533
  const map2 = /* @__PURE__ */ new Map();
3375
- for (const o of opts) {
3376
- const values = o._zod.propValues?.[def.discriminator];
3534
+ for (const o2 of opts) {
3535
+ const values = o2._zod.propValues?.[def.discriminator];
3377
3536
  if (!values || values.size === 0)
3378
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
3379
- for (const v2 of values) {
3380
- if (map2.has(v2)) {
3381
- throw new Error(`Duplicate discriminator value "${String(v2)}"`);
3537
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o2)}"`);
3538
+ for (const v of values) {
3539
+ if (map2.has(v)) {
3540
+ throw new Error(`Duplicate discriminator value "${String(v)}"`);
3382
3541
  }
3383
- map2.set(v2, o);
3542
+ map2.set(v, o2);
3384
3543
  }
3385
3544
  }
3386
3545
  return map2;
@@ -3521,35 +3680,35 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3521
3680
  return payload;
3522
3681
  }
3523
3682
  }
3524
- let i2 = -1;
3683
+ let i3 = -1;
3525
3684
  for (const item of items) {
3526
- i2++;
3527
- if (i2 >= input.length) {
3528
- if (i2 >= optStart)
3685
+ i3++;
3686
+ if (i3 >= input.length) {
3687
+ if (i3 >= optStart)
3529
3688
  continue;
3530
3689
  }
3531
3690
  const result = item._zod.run({
3532
- value: input[i2],
3691
+ value: input[i3],
3533
3692
  issues: []
3534
3693
  }, ctx);
3535
3694
  if (result instanceof Promise) {
3536
- proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
3695
+ proms.push(result.then((result2) => handleTupleResult(result2, payload, i3)));
3537
3696
  } else {
3538
- handleTupleResult(result, payload, i2);
3697
+ handleTupleResult(result, payload, i3);
3539
3698
  }
3540
3699
  }
3541
3700
  if (def.rest) {
3542
3701
  const rest = input.slice(items.length);
3543
3702
  for (const el of rest) {
3544
- i2++;
3703
+ i3++;
3545
3704
  const result = def.rest._zod.run({
3546
3705
  value: el,
3547
3706
  issues: []
3548
3707
  }, ctx);
3549
3708
  if (result instanceof Promise) {
3550
- proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
3709
+ proms.push(result.then((result2) => handleTupleResult(result2, payload, i3)));
3551
3710
  } else {
3552
- handleTupleResult(result, payload, i2);
3711
+ handleTupleResult(result, payload, i3);
3553
3712
  }
3554
3713
  }
3555
3714
  }
@@ -3758,7 +3917,7 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
3758
3917
  const values = getEnumValues(def.entries);
3759
3918
  const valuesSet = new Set(values);
3760
3919
  inst._zod.values = valuesSet;
3761
- inst._zod.pattern = new RegExp(`^(${values.filter((k2) => propertyKeyTypes.has(typeof k2)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
3920
+ inst._zod.pattern = new RegExp(`^(${values.filter((k2) => propertyKeyTypes.has(typeof k2)).map((o2) => typeof o2 === "string" ? escapeRegex(o2) : o2.toString()).join("|")})$`);
3762
3921
  inst._zod.parse = (payload, _ctx) => {
3763
3922
  const input = payload.value;
3764
3923
  if (valuesSet.has(input)) {
@@ -3780,7 +3939,7 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
3780
3939
  }
3781
3940
  const values = new Set(def.values);
3782
3941
  inst._zod.values = values;
3783
- inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
3942
+ inst._zod.pattern = new RegExp(`^(${def.values.map((o2) => typeof o2 === "string" ? escapeRegex(o2) : o2 ? escapeRegex(o2.toString()) : String(o2)).join("|")})$`);
3784
3943
  inst._zod.parse = (payload, _ctx) => {
3785
3944
  const input = payload.value;
3786
3945
  if (values.has(input)) {
@@ -3852,7 +4011,7 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
3852
4011
  if (def.innerType._zod.optin === "optional") {
3853
4012
  const result = def.innerType._zod.run(payload, ctx);
3854
4013
  if (result instanceof Promise)
3855
- return result.then((r) => handleOptionalResult(r, payload.value));
4014
+ return result.then((r2) => handleOptionalResult(r2, payload.value));
3856
4015
  return handleOptionalResult(result, payload.value);
3857
4016
  }
3858
4017
  if (payload.value === void 0) {
@@ -3920,8 +4079,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
3920
4079
  var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
3921
4080
  $ZodType.init(inst, def);
3922
4081
  defineLazy(inst._zod, "values", () => {
3923
- const v2 = def.innerType._zod.values;
3924
- return v2 ? new Set([...v2].filter((x2) => x2 !== void 0)) : void 0;
4082
+ const v = def.innerType._zod.values;
4083
+ return v ? new Set([...v].filter((x2) => x2 !== void 0)) : void 0;
3925
4084
  });
3926
4085
  inst._zod.parse = (payload, ctx) => {
3927
4086
  const result = def.innerType._zod.run(payload, ctx);
@@ -4256,16 +4415,16 @@ var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
4256
4415
  var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
4257
4416
  $ZodCheck.init(inst, def);
4258
4417
  $ZodType.init(inst, def);
4259
- inst._zod.parse = (payload, _) => {
4418
+ inst._zod.parse = (payload, _2) => {
4260
4419
  return payload;
4261
4420
  };
4262
4421
  inst._zod.check = (payload) => {
4263
4422
  const input = payload.value;
4264
- const r = def.fn(input);
4265
- if (r instanceof Promise) {
4266
- return r.then((r2) => handleRefineResult(r2, payload, input, inst));
4423
+ const r2 = def.fn(input);
4424
+ if (r2 instanceof Promise) {
4425
+ return r2.then((r3) => handleRefineResult(r3, payload, input, inst));
4267
4426
  }
4268
- handleRefineResult(r, payload, input, inst);
4427
+ handleRefineResult(r2, payload, input, inst);
4269
4428
  return;
4270
4429
  };
4271
4430
  });
@@ -4351,8 +4510,8 @@ var error = () => {
4351
4510
  return Sizable[origin] ?? null;
4352
4511
  }
4353
4512
  const parsedType8 = (data) => {
4354
- const t = typeof data;
4355
- switch (t) {
4513
+ const t2 = typeof data;
4514
+ switch (t2) {
4356
4515
  case "number": {
4357
4516
  return Number.isNaN(data) ? "NaN" : "number";
4358
4517
  }
@@ -4368,7 +4527,7 @@ var error = () => {
4368
4527
  }
4369
4528
  }
4370
4529
  }
4371
- return t;
4530
+ return t2;
4372
4531
  };
4373
4532
  const Nouns = {
4374
4533
  regex: "\u0645\u062F\u062E\u0644",
@@ -4468,8 +4627,8 @@ var error2 = () => {
4468
4627
  return Sizable[origin] ?? null;
4469
4628
  }
4470
4629
  const parsedType8 = (data) => {
4471
- const t = typeof data;
4472
- switch (t) {
4630
+ const t2 = typeof data;
4631
+ switch (t2) {
4473
4632
  case "number": {
4474
4633
  return Number.isNaN(data) ? "NaN" : "number";
4475
4634
  }
@@ -4485,7 +4644,7 @@ var error2 = () => {
4485
4644
  }
4486
4645
  }
4487
4646
  }
4488
- return t;
4647
+ return t2;
4489
4648
  };
4490
4649
  const Nouns = {
4491
4650
  regex: "input",
@@ -4627,8 +4786,8 @@ var error3 = () => {
4627
4786
  return Sizable[origin] ?? null;
4628
4787
  }
4629
4788
  const parsedType8 = (data) => {
4630
- const t = typeof data;
4631
- switch (t) {
4789
+ const t2 = typeof data;
4790
+ switch (t2) {
4632
4791
  case "number": {
4633
4792
  return Number.isNaN(data) ? "NaN" : "\u043B\u0456\u043A";
4634
4793
  }
@@ -4644,7 +4803,7 @@ var error3 = () => {
4644
4803
  }
4645
4804
  }
4646
4805
  }
4647
- return t;
4806
+ return t2;
4648
4807
  };
4649
4808
  const Nouns = {
4650
4809
  regex: "\u0443\u0432\u043E\u0434",
@@ -4739,8 +4898,8 @@ function be_default() {
4739
4898
 
4740
4899
  // ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/bg.js
4741
4900
  var parsedType = (data) => {
4742
- const t = typeof data;
4743
- switch (t) {
4901
+ const t2 = typeof data;
4902
+ switch (t2) {
4744
4903
  case "number": {
4745
4904
  return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
4746
4905
  }
@@ -4756,7 +4915,7 @@ var parsedType = (data) => {
4756
4915
  }
4757
4916
  }
4758
4917
  }
4759
- return t;
4918
+ return t2;
4760
4919
  };
4761
4920
  var error4 = () => {
4762
4921
  const Sizable = {
@@ -4878,8 +5037,8 @@ var error5 = () => {
4878
5037
  return Sizable[origin] ?? null;
4879
5038
  }
4880
5039
  const parsedType8 = (data) => {
4881
- const t = typeof data;
4882
- switch (t) {
5040
+ const t2 = typeof data;
5041
+ switch (t2) {
4883
5042
  case "number": {
4884
5043
  return Number.isNaN(data) ? "NaN" : "number";
4885
5044
  }
@@ -4895,7 +5054,7 @@ var error5 = () => {
4895
5054
  }
4896
5055
  }
4897
5056
  }
4898
- return t;
5057
+ return t2;
4899
5058
  };
4900
5059
  const Nouns = {
4901
5060
  regex: "entrada",
@@ -4998,8 +5157,8 @@ var error6 = () => {
4998
5157
  return Sizable[origin] ?? null;
4999
5158
  }
5000
5159
  const parsedType8 = (data) => {
5001
- const t = typeof data;
5002
- switch (t) {
5160
+ const t2 = typeof data;
5161
+ switch (t2) {
5003
5162
  case "number": {
5004
5163
  return Number.isNaN(data) ? "NaN" : "\u010D\xEDslo";
5005
5164
  }
@@ -5033,7 +5192,7 @@ var error6 = () => {
5033
5192
  }
5034
5193
  }
5035
5194
  }
5036
- return t;
5195
+ return t2;
5037
5196
  };
5038
5197
  const Nouns = {
5039
5198
  regex: "regul\xE1rn\xED v\xFDraz",
@@ -5146,8 +5305,8 @@ var error7 = () => {
5146
5305
  return TypeNames[type] ?? type;
5147
5306
  }
5148
5307
  const parsedType8 = (data) => {
5149
- const t = typeof data;
5150
- switch (t) {
5308
+ const t2 = typeof data;
5309
+ switch (t2) {
5151
5310
  case "number": {
5152
5311
  return Number.isNaN(data) ? "NaN" : "tal";
5153
5312
  }
@@ -5164,7 +5323,7 @@ var error7 = () => {
5164
5323
  return "objekt";
5165
5324
  }
5166
5325
  }
5167
- return t;
5326
+ return t2;
5168
5327
  };
5169
5328
  const Nouns = {
5170
5329
  regex: "input",
@@ -5266,8 +5425,8 @@ var error8 = () => {
5266
5425
  return Sizable[origin] ?? null;
5267
5426
  }
5268
5427
  const parsedType8 = (data) => {
5269
- const t = typeof data;
5270
- switch (t) {
5428
+ const t2 = typeof data;
5429
+ switch (t2) {
5271
5430
  case "number": {
5272
5431
  return Number.isNaN(data) ? "NaN" : "Zahl";
5273
5432
  }
@@ -5283,7 +5442,7 @@ var error8 = () => {
5283
5442
  }
5284
5443
  }
5285
5444
  }
5286
- return t;
5445
+ return t2;
5287
5446
  };
5288
5447
  const Nouns = {
5289
5448
  regex: "Eingabe",
@@ -5373,8 +5532,8 @@ function de_default() {
5373
5532
 
5374
5533
  // ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/en.js
5375
5534
  var parsedType2 = (data) => {
5376
- const t = typeof data;
5377
- switch (t) {
5535
+ const t2 = typeof data;
5536
+ switch (t2) {
5378
5537
  case "number": {
5379
5538
  return Number.isNaN(data) ? "NaN" : "number";
5380
5539
  }
@@ -5390,7 +5549,7 @@ var parsedType2 = (data) => {
5390
5549
  }
5391
5550
  }
5392
5551
  }
5393
- return t;
5552
+ return t2;
5394
5553
  };
5395
5554
  var error9 = () => {
5396
5555
  const Sizable = {
@@ -5492,8 +5651,8 @@ function en_default() {
5492
5651
 
5493
5652
  // ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/eo.js
5494
5653
  var parsedType3 = (data) => {
5495
- const t = typeof data;
5496
- switch (t) {
5654
+ const t2 = typeof data;
5655
+ switch (t2) {
5497
5656
  case "number": {
5498
5657
  return Number.isNaN(data) ? "NaN" : "nombro";
5499
5658
  }
@@ -5509,7 +5668,7 @@ var parsedType3 = (data) => {
5509
5668
  }
5510
5669
  }
5511
5670
  }
5512
- return t;
5671
+ return t2;
5513
5672
  };
5514
5673
  var error10 = () => {
5515
5674
  const Sizable = {
@@ -5648,8 +5807,8 @@ var error11 = () => {
5648
5807
  return TypeNames[type] ?? type;
5649
5808
  }
5650
5809
  const parsedType8 = (data) => {
5651
- const t = typeof data;
5652
- switch (t) {
5810
+ const t2 = typeof data;
5811
+ switch (t2) {
5653
5812
  case "number": {
5654
5813
  return Number.isNaN(data) ? "NaN" : "number";
5655
5814
  }
@@ -5666,7 +5825,7 @@ var error11 = () => {
5666
5825
  return "object";
5667
5826
  }
5668
5827
  }
5669
- return t;
5828
+ return t2;
5670
5829
  };
5671
5830
  const Nouns = {
5672
5831
  regex: "entrada",
@@ -5769,8 +5928,8 @@ var error12 = () => {
5769
5928
  return Sizable[origin] ?? null;
5770
5929
  }
5771
5930
  const parsedType8 = (data) => {
5772
- const t = typeof data;
5773
- switch (t) {
5931
+ const t2 = typeof data;
5932
+ switch (t2) {
5774
5933
  case "number": {
5775
5934
  return Number.isNaN(data) ? "NaN" : "\u0639\u062F\u062F";
5776
5935
  }
@@ -5786,7 +5945,7 @@ var error12 = () => {
5786
5945
  }
5787
5946
  }
5788
5947
  }
5789
- return t;
5948
+ return t2;
5790
5949
  };
5791
5950
  const Nouns = {
5792
5951
  regex: "\u0648\u0631\u0648\u062F\u06CC",
@@ -5896,8 +6055,8 @@ var error13 = () => {
5896
6055
  return Sizable[origin] ?? null;
5897
6056
  }
5898
6057
  const parsedType8 = (data) => {
5899
- const t = typeof data;
5900
- switch (t) {
6058
+ const t2 = typeof data;
6059
+ switch (t2) {
5901
6060
  case "number": {
5902
6061
  return Number.isNaN(data) ? "NaN" : "number";
5903
6062
  }
@@ -5913,7 +6072,7 @@ var error13 = () => {
5913
6072
  }
5914
6073
  }
5915
6074
  }
5916
- return t;
6075
+ return t2;
5917
6076
  };
5918
6077
  const Nouns = {
5919
6078
  regex: "s\xE4\xE4nn\xF6llinen lauseke",
@@ -6015,8 +6174,8 @@ var error14 = () => {
6015
6174
  return Sizable[origin] ?? null;
6016
6175
  }
6017
6176
  const parsedType8 = (data) => {
6018
- const t = typeof data;
6019
- switch (t) {
6177
+ const t2 = typeof data;
6178
+ switch (t2) {
6020
6179
  case "number": {
6021
6180
  return Number.isNaN(data) ? "NaN" : "nombre";
6022
6181
  }
@@ -6032,7 +6191,7 @@ var error14 = () => {
6032
6191
  }
6033
6192
  }
6034
6193
  }
6035
- return t;
6194
+ return t2;
6036
6195
  };
6037
6196
  const Nouns = {
6038
6197
  regex: "entr\xE9e",
@@ -6132,8 +6291,8 @@ var error15 = () => {
6132
6291
  return Sizable[origin] ?? null;
6133
6292
  }
6134
6293
  const parsedType8 = (data) => {
6135
- const t = typeof data;
6136
- switch (t) {
6294
+ const t2 = typeof data;
6295
+ switch (t2) {
6137
6296
  case "number": {
6138
6297
  return Number.isNaN(data) ? "NaN" : "number";
6139
6298
  }
@@ -6149,7 +6308,7 @@ var error15 = () => {
6149
6308
  }
6150
6309
  }
6151
6310
  }
6152
- return t;
6311
+ return t2;
6153
6312
  };
6154
6313
  const Nouns = {
6155
6314
  regex: "entr\xE9e",
@@ -6268,16 +6427,16 @@ var error16 = () => {
6268
6427
  number: { unit: "", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" }
6269
6428
  // no unit
6270
6429
  };
6271
- const typeEntry = (t) => t ? TypeNames[t] : void 0;
6272
- const typeLabel = (t) => {
6273
- const e = typeEntry(t);
6430
+ const typeEntry = (t2) => t2 ? TypeNames[t2] : void 0;
6431
+ const typeLabel = (t2) => {
6432
+ const e = typeEntry(t2);
6274
6433
  if (e)
6275
6434
  return e.label;
6276
- return t ?? TypeNames.unknown.label;
6435
+ return t2 ?? TypeNames.unknown.label;
6277
6436
  };
6278
- const withDefinite = (t) => `\u05D4${typeLabel(t)}`;
6279
- const verbFor = (t) => {
6280
- const e = typeEntry(t);
6437
+ const withDefinite = (t2) => `\u05D4${typeLabel(t2)}`;
6438
+ const verbFor = (t2) => {
6439
+ const e = typeEntry(t2);
6281
6440
  const gender = e?.gender ?? "m";
6282
6441
  return gender === "f" ? "\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA" : "\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA";
6283
6442
  };
@@ -6287,8 +6446,8 @@ var error16 = () => {
6287
6446
  return Sizable[origin] ?? null;
6288
6447
  };
6289
6448
  const parsedType8 = (data) => {
6290
- const t = typeof data;
6291
- switch (t) {
6449
+ const t2 = typeof data;
6450
+ switch (t2) {
6292
6451
  case "number":
6293
6452
  return Number.isNaN(data) ? "NaN" : "number";
6294
6453
  case "object": {
@@ -6302,7 +6461,7 @@ var error16 = () => {
6302
6461
  return "object";
6303
6462
  }
6304
6463
  default:
6305
- return t;
6464
+ return t2;
6306
6465
  }
6307
6466
  };
6308
6467
  const Nouns = {
@@ -6350,7 +6509,7 @@ var error16 = () => {
6350
6509
  if (issue2.values.length === 1) {
6351
6510
  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
6511
  }
6353
- const stringified = issue2.values.map((v2) => stringifyPrimitive(v2));
6512
+ const stringified = issue2.values.map((v) => stringifyPrimitive(v));
6354
6513
  if (issue2.values.length === 2) {
6355
6514
  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
6515
  }
@@ -6458,8 +6617,8 @@ var error17 = () => {
6458
6617
  return Sizable[origin] ?? null;
6459
6618
  }
6460
6619
  const parsedType8 = (data) => {
6461
- const t = typeof data;
6462
- switch (t) {
6620
+ const t2 = typeof data;
6621
+ switch (t2) {
6463
6622
  case "number": {
6464
6623
  return Number.isNaN(data) ? "NaN" : "sz\xE1m";
6465
6624
  }
@@ -6475,7 +6634,7 @@ var error17 = () => {
6475
6634
  }
6476
6635
  }
6477
6636
  }
6478
- return t;
6637
+ return t2;
6479
6638
  };
6480
6639
  const Nouns = {
6481
6640
  regex: "bemenet",
@@ -6576,8 +6735,8 @@ var error18 = () => {
6576
6735
  return Sizable[origin] ?? null;
6577
6736
  }
6578
6737
  const parsedType8 = (data) => {
6579
- const t = typeof data;
6580
- switch (t) {
6738
+ const t2 = typeof data;
6739
+ switch (t2) {
6581
6740
  case "number": {
6582
6741
  return Number.isNaN(data) ? "NaN" : "number";
6583
6742
  }
@@ -6593,7 +6752,7 @@ var error18 = () => {
6593
6752
  }
6594
6753
  }
6595
6754
  }
6596
- return t;
6755
+ return t2;
6597
6756
  };
6598
6757
  const Nouns = {
6599
6758
  regex: "input",
@@ -6683,8 +6842,8 @@ function id_default() {
6683
6842
 
6684
6843
  // ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/is.js
6685
6844
  var parsedType4 = (data) => {
6686
- const t = typeof data;
6687
- switch (t) {
6845
+ const t2 = typeof data;
6846
+ switch (t2) {
6688
6847
  case "number": {
6689
6848
  return Number.isNaN(data) ? "NaN" : "n\xFAmer";
6690
6849
  }
@@ -6700,7 +6859,7 @@ var parsedType4 = (data) => {
6700
6859
  }
6701
6860
  }
6702
6861
  }
6703
- return t;
6862
+ return t2;
6704
6863
  };
6705
6864
  var error19 = () => {
6706
6865
  const Sizable = {
@@ -6811,8 +6970,8 @@ var error20 = () => {
6811
6970
  return Sizable[origin] ?? null;
6812
6971
  }
6813
6972
  const parsedType8 = (data) => {
6814
- const t = typeof data;
6815
- switch (t) {
6973
+ const t2 = typeof data;
6974
+ switch (t2) {
6816
6975
  case "number": {
6817
6976
  return Number.isNaN(data) ? "NaN" : "numero";
6818
6977
  }
@@ -6828,7 +6987,7 @@ var error20 = () => {
6828
6987
  }
6829
6988
  }
6830
6989
  }
6831
- return t;
6990
+ return t2;
6832
6991
  };
6833
6992
  const Nouns = {
6834
6993
  regex: "input",
@@ -6929,8 +7088,8 @@ var error21 = () => {
6929
7088
  return Sizable[origin] ?? null;
6930
7089
  }
6931
7090
  const parsedType8 = (data) => {
6932
- const t = typeof data;
6933
- switch (t) {
7091
+ const t2 = typeof data;
7092
+ switch (t2) {
6934
7093
  case "number": {
6935
7094
  return Number.isNaN(data) ? "NaN" : "\u6570\u5024";
6936
7095
  }
@@ -6946,7 +7105,7 @@ var error21 = () => {
6946
7105
  }
6947
7106
  }
6948
7107
  }
6949
- return t;
7108
+ return t2;
6950
7109
  };
6951
7110
  const Nouns = {
6952
7111
  regex: "\u5165\u529B\u5024",
@@ -7035,8 +7194,8 @@ function ja_default() {
7035
7194
 
7036
7195
  // ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/ka.js
7037
7196
  var parsedType5 = (data) => {
7038
- const t = typeof data;
7039
- switch (t) {
7197
+ const t2 = typeof data;
7198
+ switch (t2) {
7040
7199
  case "number": {
7041
7200
  return Number.isNaN(data) ? "NaN" : "\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";
7042
7201
  }
@@ -7060,7 +7219,7 @@ var parsedType5 = (data) => {
7060
7219
  symbol: "symbol",
7061
7220
  function: "\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0"
7062
7221
  };
7063
- return typeMap[t] ?? t;
7222
+ return typeMap[t2] ?? t2;
7064
7223
  };
7065
7224
  var error22 = () => {
7066
7225
  const Sizable = {
@@ -7171,8 +7330,8 @@ var error23 = () => {
7171
7330
  return Sizable[origin] ?? null;
7172
7331
  }
7173
7332
  const parsedType8 = (data) => {
7174
- const t = typeof data;
7175
- switch (t) {
7333
+ const t2 = typeof data;
7334
+ switch (t2) {
7176
7335
  case "number": {
7177
7336
  return Number.isNaN(data) ? "\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)" : "\u179B\u17C1\u1781";
7178
7337
  }
@@ -7188,7 +7347,7 @@ var error23 = () => {
7188
7347
  }
7189
7348
  }
7190
7349
  }
7191
- return t;
7350
+ return t2;
7192
7351
  };
7193
7352
  const Nouns = {
7194
7353
  regex: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",
@@ -7294,8 +7453,8 @@ var error24 = () => {
7294
7453
  return Sizable[origin] ?? null;
7295
7454
  }
7296
7455
  const parsedType8 = (data) => {
7297
- const t = typeof data;
7298
- switch (t) {
7456
+ const t2 = typeof data;
7457
+ switch (t2) {
7299
7458
  case "number": {
7300
7459
  return Number.isNaN(data) ? "NaN" : "number";
7301
7460
  }
@@ -7311,7 +7470,7 @@ var error24 = () => {
7311
7470
  }
7312
7471
  }
7313
7472
  }
7314
- return t;
7473
+ return t2;
7315
7474
  };
7316
7475
  const Nouns = {
7317
7476
  regex: "\uC785\uB825",
@@ -7406,11 +7565,11 @@ function ko_default() {
7406
7565
 
7407
7566
  // ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/lt.js
7408
7567
  var parsedType6 = (data) => {
7409
- const t = typeof data;
7410
- return parsedTypeFromType(t, data);
7568
+ const t2 = typeof data;
7569
+ return parsedTypeFromType(t2, data);
7411
7570
  };
7412
- var parsedTypeFromType = (t, data = void 0) => {
7413
- switch (t) {
7571
+ var parsedTypeFromType = (t2, data = void 0) => {
7572
+ switch (t2) {
7414
7573
  case "number": {
7415
7574
  return Number.isNaN(data) ? "NaN" : "skai\u010Dius";
7416
7575
  }
@@ -7450,7 +7609,7 @@ var parsedTypeFromType = (t, data = void 0) => {
7450
7609
  return "nulin\u0117 reik\u0161m\u0117";
7451
7610
  }
7452
7611
  }
7453
- return t;
7612
+ return t2;
7454
7613
  };
7455
7614
  var capitalizeFirstCharacter = (text2) => {
7456
7615
  return text2.charAt(0).toUpperCase() + text2.slice(1);
@@ -7647,8 +7806,8 @@ var error26 = () => {
7647
7806
  return Sizable[origin] ?? null;
7648
7807
  }
7649
7808
  const parsedType8 = (data) => {
7650
- const t = typeof data;
7651
- switch (t) {
7809
+ const t2 = typeof data;
7810
+ switch (t2) {
7652
7811
  case "number": {
7653
7812
  return Number.isNaN(data) ? "NaN" : "\u0431\u0440\u043E\u0458";
7654
7813
  }
@@ -7664,7 +7823,7 @@ var error26 = () => {
7664
7823
  }
7665
7824
  }
7666
7825
  }
7667
- return t;
7826
+ return t2;
7668
7827
  };
7669
7828
  const Nouns = {
7670
7829
  regex: "\u0432\u043D\u0435\u0441",
@@ -7766,8 +7925,8 @@ var error27 = () => {
7766
7925
  return Sizable[origin] ?? null;
7767
7926
  }
7768
7927
  const parsedType8 = (data) => {
7769
- const t = typeof data;
7770
- switch (t) {
7928
+ const t2 = typeof data;
7929
+ switch (t2) {
7771
7930
  case "number": {
7772
7931
  return Number.isNaN(data) ? "NaN" : "nombor";
7773
7932
  }
@@ -7783,7 +7942,7 @@ var error27 = () => {
7783
7942
  }
7784
7943
  }
7785
7944
  }
7786
- return t;
7945
+ return t2;
7787
7946
  };
7788
7947
  const Nouns = {
7789
7948
  regex: "input",
@@ -7883,8 +8042,8 @@ var error28 = () => {
7883
8042
  return Sizable[origin] ?? null;
7884
8043
  }
7885
8044
  const parsedType8 = (data) => {
7886
- const t = typeof data;
7887
- switch (t) {
8045
+ const t2 = typeof data;
8046
+ switch (t2) {
7888
8047
  case "number": {
7889
8048
  return Number.isNaN(data) ? "NaN" : "getal";
7890
8049
  }
@@ -7900,7 +8059,7 @@ var error28 = () => {
7900
8059
  }
7901
8060
  }
7902
8061
  }
7903
- return t;
8062
+ return t2;
7904
8063
  };
7905
8064
  const Nouns = {
7906
8065
  regex: "invoer",
@@ -8001,8 +8160,8 @@ var error29 = () => {
8001
8160
  return Sizable[origin] ?? null;
8002
8161
  }
8003
8162
  const parsedType8 = (data) => {
8004
- const t = typeof data;
8005
- switch (t) {
8163
+ const t2 = typeof data;
8164
+ switch (t2) {
8006
8165
  case "number": {
8007
8166
  return Number.isNaN(data) ? "NaN" : "tall";
8008
8167
  }
@@ -8018,7 +8177,7 @@ var error29 = () => {
8018
8177
  }
8019
8178
  }
8020
8179
  }
8021
- return t;
8180
+ return t2;
8022
8181
  };
8023
8182
  const Nouns = {
8024
8183
  regex: "input",
@@ -8118,8 +8277,8 @@ var error30 = () => {
8118
8277
  return Sizable[origin] ?? null;
8119
8278
  }
8120
8279
  const parsedType8 = (data) => {
8121
- const t = typeof data;
8122
- switch (t) {
8280
+ const t2 = typeof data;
8281
+ switch (t2) {
8123
8282
  case "number": {
8124
8283
  return Number.isNaN(data) ? "NaN" : "numara";
8125
8284
  }
@@ -8135,7 +8294,7 @@ var error30 = () => {
8135
8294
  }
8136
8295
  }
8137
8296
  }
8138
- return t;
8297
+ return t2;
8139
8298
  };
8140
8299
  const Nouns = {
8141
8300
  regex: "giren",
@@ -8236,8 +8395,8 @@ var error31 = () => {
8236
8395
  return Sizable[origin] ?? null;
8237
8396
  }
8238
8397
  const parsedType8 = (data) => {
8239
- const t = typeof data;
8240
- switch (t) {
8398
+ const t2 = typeof data;
8399
+ switch (t2) {
8241
8400
  case "number": {
8242
8401
  return Number.isNaN(data) ? "NaN" : "\u0639\u062F\u062F";
8243
8402
  }
@@ -8253,7 +8412,7 @@ var error31 = () => {
8253
8412
  }
8254
8413
  }
8255
8414
  }
8256
- return t;
8415
+ return t2;
8257
8416
  };
8258
8417
  const Nouns = {
8259
8418
  regex: "\u0648\u0631\u0648\u062F\u064A",
@@ -8359,8 +8518,8 @@ var error32 = () => {
8359
8518
  return Sizable[origin] ?? null;
8360
8519
  }
8361
8520
  const parsedType8 = (data) => {
8362
- const t = typeof data;
8363
- switch (t) {
8521
+ const t2 = typeof data;
8522
+ switch (t2) {
8364
8523
  case "number": {
8365
8524
  return Number.isNaN(data) ? "NaN" : "liczba";
8366
8525
  }
@@ -8376,7 +8535,7 @@ var error32 = () => {
8376
8535
  }
8377
8536
  }
8378
8537
  }
8379
- return t;
8538
+ return t2;
8380
8539
  };
8381
8540
  const Nouns = {
8382
8541
  regex: "wyra\u017Cenie",
@@ -8477,8 +8636,8 @@ var error33 = () => {
8477
8636
  return Sizable[origin] ?? null;
8478
8637
  }
8479
8638
  const parsedType8 = (data) => {
8480
- const t = typeof data;
8481
- switch (t) {
8639
+ const t2 = typeof data;
8640
+ switch (t2) {
8482
8641
  case "number": {
8483
8642
  return Number.isNaN(data) ? "NaN" : "n\xFAmero";
8484
8643
  }
@@ -8494,7 +8653,7 @@ var error33 = () => {
8494
8653
  }
8495
8654
  }
8496
8655
  }
8497
- return t;
8656
+ return t2;
8498
8657
  };
8499
8658
  const Nouns = {
8500
8659
  regex: "padr\xE3o",
@@ -8637,8 +8796,8 @@ var error34 = () => {
8637
8796
  return Sizable[origin] ?? null;
8638
8797
  }
8639
8798
  const parsedType8 = (data) => {
8640
- const t = typeof data;
8641
- switch (t) {
8799
+ const t2 = typeof data;
8800
+ switch (t2) {
8642
8801
  case "number": {
8643
8802
  return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
8644
8803
  }
@@ -8654,7 +8813,7 @@ var error34 = () => {
8654
8813
  }
8655
8814
  }
8656
8815
  }
8657
- return t;
8816
+ return t2;
8658
8817
  };
8659
8818
  const Nouns = {
8660
8819
  regex: "\u0432\u0432\u043E\u0434",
@@ -8759,8 +8918,8 @@ var error35 = () => {
8759
8918
  return Sizable[origin] ?? null;
8760
8919
  }
8761
8920
  const parsedType8 = (data) => {
8762
- const t = typeof data;
8763
- switch (t) {
8921
+ const t2 = typeof data;
8922
+ switch (t2) {
8764
8923
  case "number": {
8765
8924
  return Number.isNaN(data) ? "NaN" : "\u0161tevilo";
8766
8925
  }
@@ -8776,7 +8935,7 @@ var error35 = () => {
8776
8935
  }
8777
8936
  }
8778
8937
  }
8779
- return t;
8938
+ return t2;
8780
8939
  };
8781
8940
  const Nouns = {
8782
8941
  regex: "vnos",
@@ -8877,8 +9036,8 @@ var error36 = () => {
8877
9036
  return Sizable[origin] ?? null;
8878
9037
  }
8879
9038
  const parsedType8 = (data) => {
8880
- const t = typeof data;
8881
- switch (t) {
9039
+ const t2 = typeof data;
9040
+ switch (t2) {
8882
9041
  case "number": {
8883
9042
  return Number.isNaN(data) ? "NaN" : "antal";
8884
9043
  }
@@ -8894,7 +9053,7 @@ var error36 = () => {
8894
9053
  }
8895
9054
  }
8896
9055
  }
8897
- return t;
9056
+ return t2;
8898
9057
  };
8899
9058
  const Nouns = {
8900
9059
  regex: "regulj\xE4rt uttryck",
@@ -8996,8 +9155,8 @@ var error37 = () => {
8996
9155
  return Sizable[origin] ?? null;
8997
9156
  }
8998
9157
  const parsedType8 = (data) => {
8999
- const t = typeof data;
9000
- switch (t) {
9158
+ const t2 = typeof data;
9159
+ switch (t2) {
9001
9160
  case "number": {
9002
9161
  return Number.isNaN(data) ? "\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1" : "\u0B8E\u0BA3\u0BCD";
9003
9162
  }
@@ -9013,7 +9172,7 @@ var error37 = () => {
9013
9172
  }
9014
9173
  }
9015
9174
  }
9016
- return t;
9175
+ return t2;
9017
9176
  };
9018
9177
  const Nouns = {
9019
9178
  regex: "\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",
@@ -9114,8 +9273,8 @@ var error38 = () => {
9114
9273
  return Sizable[origin] ?? null;
9115
9274
  }
9116
9275
  const parsedType8 = (data) => {
9117
- const t = typeof data;
9118
- switch (t) {
9276
+ const t2 = typeof data;
9277
+ switch (t2) {
9119
9278
  case "number": {
9120
9279
  return Number.isNaN(data) ? "\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)" : "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";
9121
9280
  }
@@ -9131,7 +9290,7 @@ var error38 = () => {
9131
9290
  }
9132
9291
  }
9133
9292
  }
9134
- return t;
9293
+ return t2;
9135
9294
  };
9136
9295
  const Nouns = {
9137
9296
  regex: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",
@@ -9222,8 +9381,8 @@ function th_default() {
9222
9381
 
9223
9382
  // ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/tr.js
9224
9383
  var parsedType7 = (data) => {
9225
- const t = typeof data;
9226
- switch (t) {
9384
+ const t2 = typeof data;
9385
+ switch (t2) {
9227
9386
  case "number": {
9228
9387
  return Number.isNaN(data) ? "NaN" : "number";
9229
9388
  }
@@ -9239,7 +9398,7 @@ var parsedType7 = (data) => {
9239
9398
  }
9240
9399
  }
9241
9400
  }
9242
- return t;
9401
+ return t2;
9243
9402
  };
9244
9403
  var error39 = () => {
9245
9404
  const Sizable = {
@@ -9348,8 +9507,8 @@ var error40 = () => {
9348
9507
  return Sizable[origin] ?? null;
9349
9508
  }
9350
9509
  const parsedType8 = (data) => {
9351
- const t = typeof data;
9352
- switch (t) {
9510
+ const t2 = typeof data;
9511
+ switch (t2) {
9353
9512
  case "number": {
9354
9513
  return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
9355
9514
  }
@@ -9365,7 +9524,7 @@ var error40 = () => {
9365
9524
  }
9366
9525
  }
9367
9526
  }
9368
- return t;
9527
+ return t2;
9369
9528
  };
9370
9529
  const Nouns = {
9371
9530
  regex: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",
@@ -9471,8 +9630,8 @@ var error41 = () => {
9471
9630
  return Sizable[origin] ?? null;
9472
9631
  }
9473
9632
  const parsedType8 = (data) => {
9474
- const t = typeof data;
9475
- switch (t) {
9633
+ const t2 = typeof data;
9634
+ switch (t2) {
9476
9635
  case "number": {
9477
9636
  return Number.isNaN(data) ? "NaN" : "\u0646\u0645\u0628\u0631";
9478
9637
  }
@@ -9488,7 +9647,7 @@ var error41 = () => {
9488
9647
  }
9489
9648
  }
9490
9649
  }
9491
- return t;
9650
+ return t2;
9492
9651
  };
9493
9652
  const Nouns = {
9494
9653
  regex: "\u0627\u0646 \u067E\u0679",
@@ -9589,8 +9748,8 @@ var error42 = () => {
9589
9748
  return Sizable[origin] ?? null;
9590
9749
  }
9591
9750
  const parsedType8 = (data) => {
9592
- const t = typeof data;
9593
- switch (t) {
9751
+ const t2 = typeof data;
9752
+ switch (t2) {
9594
9753
  case "number": {
9595
9754
  return Number.isNaN(data) ? "NaN" : "s\u1ED1";
9596
9755
  }
@@ -9606,7 +9765,7 @@ var error42 = () => {
9606
9765
  }
9607
9766
  }
9608
9767
  }
9609
- return t;
9768
+ return t2;
9610
9769
  };
9611
9770
  const Nouns = {
9612
9771
  regex: "\u0111\u1EA7u v\xE0o",
@@ -9706,8 +9865,8 @@ var error43 = () => {
9706
9865
  return Sizable[origin] ?? null;
9707
9866
  }
9708
9867
  const parsedType8 = (data) => {
9709
- const t = typeof data;
9710
- switch (t) {
9868
+ const t2 = typeof data;
9869
+ switch (t2) {
9711
9870
  case "number": {
9712
9871
  return Number.isNaN(data) ? "\u975E\u6570\u5B57(NaN)" : "\u6570\u5B57";
9713
9872
  }
@@ -9723,7 +9882,7 @@ var error43 = () => {
9723
9882
  }
9724
9883
  }
9725
9884
  }
9726
- return t;
9885
+ return t2;
9727
9886
  };
9728
9887
  const Nouns = {
9729
9888
  regex: "\u8F93\u5165",
@@ -9823,8 +9982,8 @@ var error44 = () => {
9823
9982
  return Sizable[origin] ?? null;
9824
9983
  }
9825
9984
  const parsedType8 = (data) => {
9826
- const t = typeof data;
9827
- switch (t) {
9985
+ const t2 = typeof data;
9986
+ switch (t2) {
9828
9987
  case "number": {
9829
9988
  return Number.isNaN(data) ? "NaN" : "number";
9830
9989
  }
@@ -9840,7 +9999,7 @@ var error44 = () => {
9840
9999
  }
9841
10000
  }
9842
10001
  }
9843
- return t;
10002
+ return t2;
9844
10003
  };
9845
10004
  const Nouns = {
9846
10005
  regex: "\u8F38\u5165",
@@ -9941,8 +10100,8 @@ var error45 = () => {
9941
10100
  return Sizable[origin] ?? null;
9942
10101
  }
9943
10102
  const parsedType8 = (data) => {
9944
- const t = typeof data;
9945
- switch (t) {
10103
+ const t2 = typeof data;
10104
+ switch (t2) {
9946
10105
  case "number": {
9947
10106
  return Number.isNaN(data) ? "NaN" : "n\u1ECD\u0301mb\xE0";
9948
10107
  }
@@ -9958,7 +10117,7 @@ var error45 = () => {
9958
10117
  }
9959
10118
  }
9960
10119
  }
9961
- return t;
10120
+ return t2;
9962
10121
  };
9963
10122
  const Nouns = {
9964
10123
  regex: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",
@@ -10079,9 +10238,9 @@ var $ZodRegistry = class {
10079
10238
  return this;
10080
10239
  }
10081
10240
  get(schema) {
10082
- const p2 = schema._zod.parent;
10083
- if (p2) {
10084
- const pm = { ...this.get(p2) ?? {} };
10241
+ const p = schema._zod.parent;
10242
+ if (p) {
10243
+ const pm = { ...this.get(p) ?? {} };
10085
10244
  delete pm.id;
10086
10245
  const f2 = { ...pm, ...this._map.get(schema) };
10087
10246
  return Object.keys(f2).length ? f2 : void 0;
@@ -10771,7 +10930,7 @@ function _set(Class2, valueType, params) {
10771
10930
  });
10772
10931
  }
10773
10932
  function _enum(Class2, values, params) {
10774
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
10933
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
10775
10934
  return new Class2({
10776
10935
  type: "enum",
10777
10936
  entries,
@@ -10954,8 +11113,8 @@ function _stringbool(Classes, _params) {
10954
11113
  let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
10955
11114
  let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
10956
11115
  if (params.case !== "sensitive") {
10957
- truthyArray = truthyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
10958
- falsyArray = falsyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
11116
+ truthyArray = truthyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
11117
+ falsyArray = falsyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
10959
11118
  }
10960
11119
  const truthySet = new Set(truthyArray);
10961
11120
  const falsySet = new Set(falsyArray);
@@ -10999,13 +11158,13 @@ function _stringbool(Classes, _params) {
10999
11158
  });
11000
11159
  return codec2;
11001
11160
  }
11002
- function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
11161
+ function _stringFormat(Class2, format2, fnOrRegex, _params = {}) {
11003
11162
  const params = normalizeParams(_params);
11004
11163
  const def = {
11005
11164
  ...normalizeParams(_params),
11006
11165
  check: "string_format",
11007
11166
  type: "string",
11008
- format,
11167
+ format: format2,
11009
11168
  fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
11010
11169
  ...params
11011
11170
  };
@@ -11070,13 +11229,13 @@ var JSONSchemaGenerator = class {
11070
11229
  case "string": {
11071
11230
  const json2 = _json;
11072
11231
  json2.type = "string";
11073
- const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
11232
+ const { minimum, maximum, format: format2, patterns, contentEncoding } = schema._zod.bag;
11074
11233
  if (typeof minimum === "number")
11075
11234
  json2.minLength = minimum;
11076
11235
  if (typeof maximum === "number")
11077
11236
  json2.maxLength = maximum;
11078
- if (format) {
11079
- json2.format = formatMap[format] ?? format;
11237
+ if (format2) {
11238
+ json2.format = formatMap[format2] ?? format2;
11080
11239
  if (json2.format === "")
11081
11240
  delete json2.format;
11082
11241
  }
@@ -11099,8 +11258,8 @@ var JSONSchemaGenerator = class {
11099
11258
  }
11100
11259
  case "number": {
11101
11260
  const json2 = _json;
11102
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
11103
- if (typeof format === "string" && format.includes("int"))
11261
+ const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
11262
+ if (typeof format2 === "string" && format2.includes("int"))
11104
11263
  json2.type = "integer";
11105
11264
  else
11106
11265
  json2.type = "number";
@@ -11220,11 +11379,11 @@ var JSONSchemaGenerator = class {
11220
11379
  }
11221
11380
  const allKeys = new Set(Object.keys(shape));
11222
11381
  const requiredKeys = new Set([...allKeys].filter((key) => {
11223
- const v2 = def.shape[key]._zod;
11382
+ const v = def.shape[key]._zod;
11224
11383
  if (this.io === "input") {
11225
- return v2.optin === void 0;
11384
+ return v.optin === void 0;
11226
11385
  } else {
11227
- return v2.optout === void 0;
11386
+ return v.optout === void 0;
11228
11387
  }
11229
11388
  }));
11230
11389
  if (requiredKeys.size > 0) {
@@ -11246,9 +11405,9 @@ var JSONSchemaGenerator = class {
11246
11405
  case "union": {
11247
11406
  const json2 = _json;
11248
11407
  const isDiscriminated = def.discriminator !== void 0;
11249
- const options = def.options.map((x2, i2) => this.process(x2, {
11408
+ const options = def.options.map((x2, i3) => this.process(x2, {
11250
11409
  ...params,
11251
- path: [...params.path, isDiscriminated ? "oneOf" : "anyOf", i2]
11410
+ path: [...params.path, isDiscriminated ? "oneOf" : "anyOf", i3]
11252
11411
  }));
11253
11412
  if (isDiscriminated) {
11254
11413
  json2.oneOf = options;
@@ -11280,9 +11439,9 @@ var JSONSchemaGenerator = class {
11280
11439
  json2.type = "array";
11281
11440
  const prefixPath = this.target === "draft-2020-12" ? "prefixItems" : "items";
11282
11441
  const restPath = this.target === "draft-2020-12" ? "items" : this.target === "openapi-3.0" ? "items" : "additionalItems";
11283
- const prefixItems = def.items.map((x2, i2) => this.process(x2, {
11442
+ const prefixItems = def.items.map((x2, i3) => this.process(x2, {
11284
11443
  ...params,
11285
- path: [...params.path, prefixPath, i2]
11444
+ path: [...params.path, prefixPath, i3]
11286
11445
  }));
11287
11446
  const rest = def.rest ? this.process(def.rest, {
11288
11447
  ...params,
@@ -11347,9 +11506,9 @@ var JSONSchemaGenerator = class {
11347
11506
  case "enum": {
11348
11507
  const json2 = _json;
11349
11508
  const values = getEnumValues(def.entries);
11350
- if (values.every((v2) => typeof v2 === "number"))
11509
+ if (values.every((v) => typeof v === "number"))
11351
11510
  json2.type = "number";
11352
- if (values.every((v2) => typeof v2 === "string"))
11511
+ if (values.every((v) => typeof v === "string"))
11353
11512
  json2.type = "string";
11354
11513
  json2.enum = values;
11355
11514
  break;
@@ -11381,13 +11540,13 @@ var JSONSchemaGenerator = class {
11381
11540
  json2.const = val;
11382
11541
  }
11383
11542
  } else {
11384
- if (vals.every((v2) => typeof v2 === "number"))
11543
+ if (vals.every((v) => typeof v === "number"))
11385
11544
  json2.type = "number";
11386
- if (vals.every((v2) => typeof v2 === "string"))
11545
+ if (vals.every((v) => typeof v === "string"))
11387
11546
  json2.type = "string";
11388
- if (vals.every((v2) => typeof v2 === "boolean"))
11547
+ if (vals.every((v) => typeof v === "boolean"))
11389
11548
  json2.type = "string";
11390
- if (vals.every((v2) => v2 === null))
11549
+ if (vals.every((v) => v === null))
11391
11550
  json2.type = "null";
11392
11551
  json2.enum = vals;
11393
11552
  }
@@ -11703,7 +11862,7 @@ function toJSONSchema(input, _params) {
11703
11862
  const gen2 = new JSONSchemaGenerator(_params);
11704
11863
  const defs = {};
11705
11864
  for (const entry of input._idmap.entries()) {
11706
- const [_, schema] = entry;
11865
+ const [_2, schema] = entry;
11707
11866
  gen2.process(schema);
11708
11867
  }
11709
11868
  const schemas = {};
@@ -12069,7 +12228,7 @@ var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
12069
12228
  $ZodNanoID.init(inst, def);
12070
12229
  ZodStringFormat.init(inst, def);
12071
12230
  });
12072
- function nanoid2(params) {
12231
+ function nanoid3(params) {
12073
12232
  return _nanoid(ZodNanoID, params);
12074
12233
  }
12075
12234
  var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
@@ -12174,8 +12333,8 @@ var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat"
12174
12333
  $ZodCustomStringFormat.init(inst, def);
12175
12334
  ZodStringFormat.init(inst, def);
12176
12335
  });
12177
- function stringFormat(format, fnOrRegex, _params = {}) {
12178
- return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
12336
+ function stringFormat(format2, fnOrRegex, _params = {}) {
12337
+ return _stringFormat(ZodCustomStringFormat, format2, fnOrRegex, _params);
12179
12338
  }
12180
12339
  function hostname2(_params) {
12181
12340
  return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
@@ -12185,11 +12344,11 @@ function hex2(_params) {
12185
12344
  }
12186
12345
  function hash(alg, params) {
12187
12346
  const enc = params?.enc ?? "hex";
12188
- const format = `${alg}_${enc}`;
12189
- const regex = regexes_exports[format];
12347
+ const format2 = `${alg}_${enc}`;
12348
+ const regex = regexes_exports[format2];
12190
12349
  if (!regex)
12191
- throw new Error(`Unrecognized hash format: ${format}`);
12192
- return _stringFormat(ZodCustomStringFormat, format, regex, params);
12350
+ throw new Error(`Unrecognized hash format: ${format2}`);
12351
+ return _stringFormat(ZodCustomStringFormat, format2, regex, params);
12193
12352
  }
12194
12353
  var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
12195
12354
  $ZodNumber.init(inst, def);
@@ -12333,9 +12492,9 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
12333
12492
  ZodType.init(inst, def);
12334
12493
  inst.min = (value, params) => inst.check(_gte(value, params));
12335
12494
  inst.max = (value, params) => inst.check(_lte(value, params));
12336
- const c = inst._zod.bag;
12337
- inst.minDate = c.minimum ? new Date(c.minimum) : null;
12338
- inst.maxDate = c.maximum ? new Date(c.maximum) : null;
12495
+ const c2 = inst._zod.bag;
12496
+ inst.minDate = c2.minimum ? new Date(c2.minimum) : null;
12497
+ inst.maxDate = c2.maximum ? new Date(c2.maximum) : null;
12339
12498
  });
12340
12499
  function date3(params) {
12341
12500
  return _date(ZodDate, params);
@@ -12550,7 +12709,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
12550
12709
  };
12551
12710
  });
12552
12711
  function _enum2(values, params) {
12553
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
12712
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
12554
12713
  return new ZodEnum({
12555
12714
  type: "enum",
12556
12715
  entries,
@@ -12918,7 +13077,7 @@ config(en_default());
12918
13077
  // ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v3/helpers/util.js
12919
13078
  var util;
12920
13079
  (function(util2) {
12921
- util2.assertEqual = (_) => {
13080
+ util2.assertEqual = (_2) => {
12922
13081
  };
12923
13082
  function assertIs2(_arg) {
12924
13083
  }
@@ -12968,7 +13127,7 @@ var util;
12968
13127
  return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
12969
13128
  }
12970
13129
  util2.joinValues = joinValues2;
12971
- util2.jsonStringifyReplacer = (_, value) => {
13130
+ util2.jsonStringifyReplacer = (_2, value) => {
12972
13131
  if (typeof value === "bigint") {
12973
13132
  return value.toString();
12974
13133
  }
@@ -13066,10 +13225,10 @@ var ZodError2 = class _ZodError extends Error {
13066
13225
  fieldErrors._errors.push(mapper(issue2));
13067
13226
  } else {
13068
13227
  let curr = fieldErrors;
13069
- let i2 = 0;
13070
- while (i2 < issue2.path.length) {
13071
- const el = issue2.path[i2];
13072
- const terminal = i2 === issue2.path.length - 1;
13228
+ let i3 = 0;
13229
+ while (i3 < issue2.path.length) {
13230
+ const el = issue2.path[i3];
13231
+ const terminal = i3 === issue2.path.length - 1;
13073
13232
  if (!terminal) {
13074
13233
  curr[el] = curr[el] || { _errors: [] };
13075
13234
  } else {
@@ -13077,7 +13236,7 @@ var ZodError2 = class _ZodError extends Error {
13077
13236
  curr[el]._errors.push(mapper(issue2));
13078
13237
  }
13079
13238
  curr = curr[el];
13080
- i2++;
13239
+ i3++;
13081
13240
  }
13082
13241
  }
13083
13242
  }
@@ -13178,8 +13337,8 @@ var createIdGenerator = ({
13178
13337
  const generator = () => {
13179
13338
  const alphabetLength = alphabet.length;
13180
13339
  const chars = new Array(size);
13181
- for (let i2 = 0; i2 < size; i2++) {
13182
- chars[i2] = alphabet[Math.random() * alphabetLength | 0];
13340
+ for (let i3 = 0; i3 < size; i3++) {
13341
+ chars[i3] = alphabet[Math.random() * alphabetLength | 0];
13183
13342
  }
13184
13343
  return chars.join("");
13185
13344
  };
@@ -13395,11 +13554,11 @@ async function resolve(value) {
13395
13554
  return Promise.resolve(value);
13396
13555
  }
13397
13556
  var getRelativePath = (pathA, pathB) => {
13398
- let i2 = 0;
13399
- for (; i2 < pathA.length && i2 < pathB.length; i2++) {
13400
- if (pathA[i2] !== pathB[i2]) break;
13557
+ let i3 = 0;
13558
+ for (; i3 < pathA.length && i3 < pathB.length; i3++) {
13559
+ if (pathA[i3] !== pathB[i3]) break;
13401
13560
  }
13402
- return [(pathA.length - i2).toString(), ...pathB.slice(i2)].join("/");
13561
+ return [(pathA.length - i3).toString(), ...pathB.slice(i3)].join("/");
13403
13562
  };
13404
13563
  var ignoreOverride = Symbol(
13405
13564
  "Let zodToJsonSchema decide on which parser to use"
@@ -13500,7 +13659,7 @@ function parseDateDef(def, refs, overrideDateStrategy) {
13500
13659
  const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
13501
13660
  if (Array.isArray(strategy)) {
13502
13661
  return {
13503
- anyOf: strategy.map((item, i2) => parseDateDef(def, refs, item))
13662
+ anyOf: strategy.map((item, i3) => parseDateDef(def, refs, item))
13504
13663
  };
13505
13664
  }
13506
13665
  switch (strategy) {
@@ -13790,11 +13949,11 @@ var ALPHA_NUMERIC = new Set(
13790
13949
  );
13791
13950
  function escapeNonAlphaNumeric(source) {
13792
13951
  let result = "";
13793
- for (let i2 = 0; i2 < source.length; i2++) {
13794
- if (!ALPHA_NUMERIC.has(source[i2])) {
13952
+ for (let i3 = 0; i3 < source.length; i3++) {
13953
+ if (!ALPHA_NUMERIC.has(source[i3])) {
13795
13954
  result += "\\";
13796
13955
  }
13797
- result += source[i2];
13956
+ result += source[i3];
13798
13957
  }
13799
13958
  return result;
13800
13959
  }
@@ -13856,55 +14015,55 @@ function stringifyRegExpWithFlags(regex, refs) {
13856
14015
  let isEscaped = false;
13857
14016
  let inCharGroup = false;
13858
14017
  let inCharRange = false;
13859
- for (let i2 = 0; i2 < source.length; i2++) {
14018
+ for (let i3 = 0; i3 < source.length; i3++) {
13860
14019
  if (isEscaped) {
13861
- pattern += source[i2];
14020
+ pattern += source[i3];
13862
14021
  isEscaped = false;
13863
14022
  continue;
13864
14023
  }
13865
14024
  if (flags.i) {
13866
14025
  if (inCharGroup) {
13867
- if (source[i2].match(/[a-z]/)) {
14026
+ if (source[i3].match(/[a-z]/)) {
13868
14027
  if (inCharRange) {
13869
- pattern += source[i2];
13870
- pattern += `${source[i2 - 2]}-${source[i2]}`.toUpperCase();
14028
+ pattern += source[i3];
14029
+ pattern += `${source[i3 - 2]}-${source[i3]}`.toUpperCase();
13871
14030
  inCharRange = false;
13872
- } else if (source[i2 + 1] === "-" && ((_a17 = source[i2 + 2]) == null ? void 0 : _a17.match(/[a-z]/))) {
13873
- pattern += source[i2];
14031
+ } else if (source[i3 + 1] === "-" && ((_a17 = source[i3 + 2]) == null ? void 0 : _a17.match(/[a-z]/))) {
14032
+ pattern += source[i3];
13874
14033
  inCharRange = true;
13875
14034
  } else {
13876
- pattern += `${source[i2]}${source[i2].toUpperCase()}`;
14035
+ pattern += `${source[i3]}${source[i3].toUpperCase()}`;
13877
14036
  }
13878
14037
  continue;
13879
14038
  }
13880
- } else if (source[i2].match(/[a-z]/)) {
13881
- pattern += `[${source[i2]}${source[i2].toUpperCase()}]`;
14039
+ } else if (source[i3].match(/[a-z]/)) {
14040
+ pattern += `[${source[i3]}${source[i3].toUpperCase()}]`;
13882
14041
  continue;
13883
14042
  }
13884
14043
  }
13885
14044
  if (flags.m) {
13886
- if (source[i2] === "^") {
14045
+ if (source[i3] === "^") {
13887
14046
  pattern += `(^|(?<=[\r
13888
14047
  ]))`;
13889
14048
  continue;
13890
- } else if (source[i2] === "$") {
14049
+ } else if (source[i3] === "$") {
13891
14050
  pattern += `($|(?=[\r
13892
14051
  ]))`;
13893
14052
  continue;
13894
14053
  }
13895
14054
  }
13896
- if (flags.s && source[i2] === ".") {
13897
- pattern += inCharGroup ? `${source[i2]}\r
13898
- ` : `[${source[i2]}\r
14055
+ if (flags.s && source[i3] === ".") {
14056
+ pattern += inCharGroup ? `${source[i3]}\r
14057
+ ` : `[${source[i3]}\r
13899
14058
  ]`;
13900
14059
  continue;
13901
14060
  }
13902
- pattern += source[i2];
13903
- if (source[i2] === "\\") {
14061
+ pattern += source[i3];
14062
+ if (source[i3] === "\\") {
13904
14063
  isEscaped = true;
13905
- } else if (inCharGroup && source[i2] === "]") {
14064
+ } else if (inCharGroup && source[i3] === "]") {
13906
14065
  inCharGroup = false;
13907
- } else if (!inCharGroup && source[i2] === "[") {
14066
+ } else if (!inCharGroup && source[i3] === "[") {
13908
14067
  inCharGroup = true;
13909
14068
  }
13910
14069
  }
@@ -14041,7 +14200,7 @@ function parseUnionDef(def, refs) {
14041
14200
  []
14042
14201
  );
14043
14202
  if (types.length === options.length) {
14044
- const uniqueTypes = types.filter((x2, i2, a2) => a2.indexOf(x2) === i2);
14203
+ const uniqueTypes = types.filter((x2, i3, a2) => a2.indexOf(x2) === i3);
14045
14204
  return {
14046
14205
  type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
14047
14206
  enum: options.reduce(
@@ -14068,9 +14227,9 @@ function parseUnionDef(def, refs) {
14068
14227
  }
14069
14228
  var asAnyOf = (def, refs) => {
14070
14229
  const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
14071
- (x2, i2) => parseDef(x2._def, {
14230
+ (x2, i3) => parseDef(x2._def, {
14072
14231
  ...refs,
14073
- currentPath: [...refs.currentPath, "anyOf", `${i2}`]
14232
+ currentPath: [...refs.currentPath, "anyOf", `${i3}`]
14074
14233
  })
14075
14234
  ).filter(
14076
14235
  (x2) => !!x2 && (!refs.strictUnions || typeof x2 === "object" && Object.keys(x2).length > 0)
@@ -14239,9 +14398,9 @@ function parseTupleDef(def, refs) {
14239
14398
  type: "array",
14240
14399
  minItems: def.items.length,
14241
14400
  items: def.items.map(
14242
- (x2, i2) => parseDef(x2._def, {
14401
+ (x2, i3) => parseDef(x2._def, {
14243
14402
  ...refs,
14244
- currentPath: [...refs.currentPath, "items", `${i2}`]
14403
+ currentPath: [...refs.currentPath, "items", `${i3}`]
14245
14404
  })
14246
14405
  ).reduce(
14247
14406
  (acc, x2) => x2 === void 0 ? acc : [...acc, x2],
@@ -14258,9 +14417,9 @@ function parseTupleDef(def, refs) {
14258
14417
  minItems: def.items.length,
14259
14418
  maxItems: def.items.length,
14260
14419
  items: def.items.map(
14261
- (x2, i2) => parseDef(x2._def, {
14420
+ (x2, i3) => parseDef(x2._def, {
14262
14421
  ...refs,
14263
- currentPath: [...refs.currentPath, "items", `${i2}`]
14422
+ currentPath: [...refs.currentPath, "items", `${i3}`]
14264
14423
  })
14265
14424
  ).reduce(
14266
14425
  (acc, x2) => x2 === void 0 ? acc : [...acc, x2],
@@ -14351,7 +14510,7 @@ var selectParser = (def, typeName, refs) => {
14351
14510
  case ZodFirstPartyTypeKind2.ZodSymbol:
14352
14511
  return void 0;
14353
14512
  default:
14354
- return /* @__PURE__ */ ((_) => void 0)();
14513
+ return /* @__PURE__ */ ((_2) => void 0)();
14355
14514
  }
14356
14515
  };
14357
14516
  function parseDef(def, refs, forceResolution = false) {
@@ -14937,11 +15096,11 @@ function fixJson(input) {
14937
15096
  const stack = ["ROOT"];
14938
15097
  let lastValidIndex = -1;
14939
15098
  let literalStart = null;
14940
- function processValueStart(char, i2, swapState) {
15099
+ function processValueStart(char, i3, swapState) {
14941
15100
  {
14942
15101
  switch (char) {
14943
15102
  case '"': {
14944
- lastValidIndex = i2;
15103
+ lastValidIndex = i3;
14945
15104
  stack.pop();
14946
15105
  stack.push(swapState);
14947
15106
  stack.push("INSIDE_STRING");
@@ -14950,8 +15109,8 @@ function fixJson(input) {
14950
15109
  case "f":
14951
15110
  case "t":
14952
15111
  case "n": {
14953
- lastValidIndex = i2;
14954
- literalStart = i2;
15112
+ lastValidIndex = i3;
15113
+ literalStart = i3;
14955
15114
  stack.pop();
14956
15115
  stack.push(swapState);
14957
15116
  stack.push("INSIDE_LITERAL");
@@ -14973,21 +15132,21 @@ function fixJson(input) {
14973
15132
  case "7":
14974
15133
  case "8":
14975
15134
  case "9": {
14976
- lastValidIndex = i2;
15135
+ lastValidIndex = i3;
14977
15136
  stack.pop();
14978
15137
  stack.push(swapState);
14979
15138
  stack.push("INSIDE_NUMBER");
14980
15139
  break;
14981
15140
  }
14982
15141
  case "{": {
14983
- lastValidIndex = i2;
15142
+ lastValidIndex = i3;
14984
15143
  stack.pop();
14985
15144
  stack.push(swapState);
14986
15145
  stack.push("INSIDE_OBJECT_START");
14987
15146
  break;
14988
15147
  }
14989
15148
  case "[": {
14990
- lastValidIndex = i2;
15149
+ lastValidIndex = i3;
14991
15150
  stack.pop();
14992
15151
  stack.push(swapState);
14993
15152
  stack.push("INSIDE_ARRAY_START");
@@ -14996,7 +15155,7 @@ function fixJson(input) {
14996
15155
  }
14997
15156
  }
14998
15157
  }
14999
- function processAfterObjectValue(char, i2) {
15158
+ function processAfterObjectValue(char, i3) {
15000
15159
  switch (char) {
15001
15160
  case ",": {
15002
15161
  stack.pop();
@@ -15004,13 +15163,13 @@ function fixJson(input) {
15004
15163
  break;
15005
15164
  }
15006
15165
  case "}": {
15007
- lastValidIndex = i2;
15166
+ lastValidIndex = i3;
15008
15167
  stack.pop();
15009
15168
  break;
15010
15169
  }
15011
15170
  }
15012
15171
  }
15013
- function processAfterArrayValue(char, i2) {
15172
+ function processAfterArrayValue(char, i3) {
15014
15173
  switch (char) {
15015
15174
  case ",": {
15016
15175
  stack.pop();
@@ -15018,18 +15177,18 @@ function fixJson(input) {
15018
15177
  break;
15019
15178
  }
15020
15179
  case "]": {
15021
- lastValidIndex = i2;
15180
+ lastValidIndex = i3;
15022
15181
  stack.pop();
15023
15182
  break;
15024
15183
  }
15025
15184
  }
15026
15185
  }
15027
- for (let i2 = 0; i2 < input.length; i2++) {
15028
- const char = input[i2];
15186
+ for (let i3 = 0; i3 < input.length; i3++) {
15187
+ const char = input[i3];
15029
15188
  const currentState = stack[stack.length - 1];
15030
15189
  switch (currentState) {
15031
15190
  case "ROOT":
15032
- processValueStart(char, i2, "FINISH");
15191
+ processValueStart(char, i3, "FINISH");
15033
15192
  break;
15034
15193
  case "INSIDE_OBJECT_START": {
15035
15194
  switch (char) {
@@ -15039,7 +15198,7 @@ function fixJson(input) {
15039
15198
  break;
15040
15199
  }
15041
15200
  case "}": {
15042
- lastValidIndex = i2;
15201
+ lastValidIndex = i3;
15043
15202
  stack.pop();
15044
15203
  break;
15045
15204
  }
@@ -15077,18 +15236,18 @@ function fixJson(input) {
15077
15236
  break;
15078
15237
  }
15079
15238
  case "INSIDE_OBJECT_BEFORE_VALUE": {
15080
- processValueStart(char, i2, "INSIDE_OBJECT_AFTER_VALUE");
15239
+ processValueStart(char, i3, "INSIDE_OBJECT_AFTER_VALUE");
15081
15240
  break;
15082
15241
  }
15083
15242
  case "INSIDE_OBJECT_AFTER_VALUE": {
15084
- processAfterObjectValue(char, i2);
15243
+ processAfterObjectValue(char, i3);
15085
15244
  break;
15086
15245
  }
15087
15246
  case "INSIDE_STRING": {
15088
15247
  switch (char) {
15089
15248
  case '"': {
15090
15249
  stack.pop();
15091
- lastValidIndex = i2;
15250
+ lastValidIndex = i3;
15092
15251
  break;
15093
15252
  }
15094
15253
  case "\\": {
@@ -15096,7 +15255,7 @@ function fixJson(input) {
15096
15255
  break;
15097
15256
  }
15098
15257
  default: {
15099
- lastValidIndex = i2;
15258
+ lastValidIndex = i3;
15100
15259
  }
15101
15260
  }
15102
15261
  break;
@@ -15104,13 +15263,13 @@ function fixJson(input) {
15104
15263
  case "INSIDE_ARRAY_START": {
15105
15264
  switch (char) {
15106
15265
  case "]": {
15107
- lastValidIndex = i2;
15266
+ lastValidIndex = i3;
15108
15267
  stack.pop();
15109
15268
  break;
15110
15269
  }
15111
15270
  default: {
15112
- lastValidIndex = i2;
15113
- processValueStart(char, i2, "INSIDE_ARRAY_AFTER_VALUE");
15271
+ lastValidIndex = i3;
15272
+ processValueStart(char, i3, "INSIDE_ARRAY_AFTER_VALUE");
15114
15273
  break;
15115
15274
  }
15116
15275
  }
@@ -15124,24 +15283,24 @@ function fixJson(input) {
15124
15283
  break;
15125
15284
  }
15126
15285
  case "]": {
15127
- lastValidIndex = i2;
15286
+ lastValidIndex = i3;
15128
15287
  stack.pop();
15129
15288
  break;
15130
15289
  }
15131
15290
  default: {
15132
- lastValidIndex = i2;
15291
+ lastValidIndex = i3;
15133
15292
  break;
15134
15293
  }
15135
15294
  }
15136
15295
  break;
15137
15296
  }
15138
15297
  case "INSIDE_ARRAY_AFTER_COMMA": {
15139
- processValueStart(char, i2, "INSIDE_ARRAY_AFTER_VALUE");
15298
+ processValueStart(char, i3, "INSIDE_ARRAY_AFTER_VALUE");
15140
15299
  break;
15141
15300
  }
15142
15301
  case "INSIDE_STRING_ESCAPE": {
15143
15302
  stack.pop();
15144
- lastValidIndex = i2;
15303
+ lastValidIndex = i3;
15145
15304
  break;
15146
15305
  }
15147
15306
  case "INSIDE_NUMBER": {
@@ -15156,7 +15315,7 @@ function fixJson(input) {
15156
15315
  case "7":
15157
15316
  case "8":
15158
15317
  case "9": {
15159
- lastValidIndex = i2;
15318
+ lastValidIndex = i3;
15160
15319
  break;
15161
15320
  }
15162
15321
  case "e":
@@ -15168,24 +15327,24 @@ function fixJson(input) {
15168
15327
  case ",": {
15169
15328
  stack.pop();
15170
15329
  if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
15171
- processAfterArrayValue(char, i2);
15330
+ processAfterArrayValue(char, i3);
15172
15331
  }
15173
15332
  if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
15174
- processAfterObjectValue(char, i2);
15333
+ processAfterObjectValue(char, i3);
15175
15334
  }
15176
15335
  break;
15177
15336
  }
15178
15337
  case "}": {
15179
15338
  stack.pop();
15180
15339
  if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
15181
- processAfterObjectValue(char, i2);
15340
+ processAfterObjectValue(char, i3);
15182
15341
  }
15183
15342
  break;
15184
15343
  }
15185
15344
  case "]": {
15186
15345
  stack.pop();
15187
15346
  if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
15188
- processAfterArrayValue(char, i2);
15347
+ processAfterArrayValue(char, i3);
15189
15348
  }
15190
15349
  break;
15191
15350
  }
@@ -15197,24 +15356,24 @@ function fixJson(input) {
15197
15356
  break;
15198
15357
  }
15199
15358
  case "INSIDE_LITERAL": {
15200
- const partialLiteral = input.substring(literalStart, i2 + 1);
15359
+ const partialLiteral = input.substring(literalStart, i3 + 1);
15201
15360
  if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
15202
15361
  stack.pop();
15203
15362
  if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
15204
- processAfterObjectValue(char, i2);
15363
+ processAfterObjectValue(char, i3);
15205
15364
  } else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
15206
- processAfterArrayValue(char, i2);
15365
+ processAfterArrayValue(char, i3);
15207
15366
  }
15208
15367
  } else {
15209
- lastValidIndex = i2;
15368
+ lastValidIndex = i3;
15210
15369
  }
15211
15370
  break;
15212
15371
  }
15213
15372
  }
15214
15373
  }
15215
15374
  let result = input.slice(0, lastValidIndex + 1);
15216
- for (let i2 = stack.length - 1; i2 >= 0; i2--) {
15217
- const state = stack[i2];
15375
+ for (let i3 = stack.length - 1; i3 >= 0; i3--) {
15376
+ const state = stack[i3];
15218
15377
  switch (state) {
15219
15378
  case "INSIDE_STRING": {
15220
15379
  result += '"';
@@ -16067,123 +16226,1193 @@ function readUIMessageStream({
16067
16226
  return createAsyncIterableStream(outputStream);
16068
16227
  }
16069
16228
 
16070
- // ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js
16071
- var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
16229
+ // ../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/index.js
16230
+ init_index_browser();
16072
16231
 
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];
16232
+ // ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.mjs
16233
+ function Diff() {
16234
+ }
16235
+ Diff.prototype = {
16236
+ diff: function diff(oldString, newString) {
16237
+ var _options$timeout;
16238
+ var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
16239
+ var callback = options.callback;
16240
+ if (typeof options === "function") {
16241
+ callback = options;
16242
+ options = {};
16243
+ }
16244
+ var self = this;
16245
+ function done(value) {
16246
+ value = self.postProcess(value, options);
16247
+ if (callback) {
16248
+ setTimeout(function() {
16249
+ callback(value);
16250
+ }, 0);
16251
+ return true;
16252
+ } else {
16253
+ return value;
16254
+ }
16255
+ }
16256
+ oldString = this.castInput(oldString, options);
16257
+ newString = this.castInput(newString, options);
16258
+ oldString = this.removeEmpty(this.tokenize(oldString, options));
16259
+ newString = this.removeEmpty(this.tokenize(newString, options));
16260
+ var newLen = newString.length, oldLen = oldString.length;
16261
+ var editLength = 1;
16262
+ var maxEditLength = newLen + oldLen;
16263
+ if (options.maxEditLength != null) {
16264
+ maxEditLength = Math.min(maxEditLength, options.maxEditLength);
16265
+ }
16266
+ var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
16267
+ var abortAfterTimestamp = Date.now() + maxExecutionTime;
16268
+ var bestPath = [{
16269
+ oldPos: -1,
16270
+ lastComponent: void 0
16271
+ }];
16272
+ var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options);
16273
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
16274
+ return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken));
16275
+ }
16276
+ var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
16277
+ function execEditLength() {
16278
+ for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
16279
+ var basePath = void 0;
16280
+ var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
16281
+ if (removePath) {
16282
+ bestPath[diagonalPath - 1] = void 0;
16283
+ }
16284
+ var canAdd = false;
16285
+ if (addPath) {
16286
+ var addPathNewPos = addPath.oldPos - diagonalPath;
16287
+ canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
16288
+ }
16289
+ var canRemove = removePath && removePath.oldPos + 1 < oldLen;
16290
+ if (!canAdd && !canRemove) {
16291
+ bestPath[diagonalPath] = void 0;
16292
+ continue;
16293
+ }
16294
+ if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
16295
+ basePath = self.addToPath(addPath, true, false, 0, options);
16296
+ } else {
16297
+ basePath = self.addToPath(removePath, false, true, 1, options);
16298
+ }
16299
+ newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options);
16300
+ if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
16301
+ return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
16302
+ } else {
16303
+ bestPath[diagonalPath] = basePath;
16304
+ if (basePath.oldPos + 1 >= oldLen) {
16305
+ maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
16306
+ }
16307
+ if (newPos + 1 >= newLen) {
16308
+ minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
16309
+ }
16310
+ }
16311
+ }
16312
+ editLength++;
16313
+ }
16314
+ if (callback) {
16315
+ (function exec() {
16316
+ setTimeout(function() {
16317
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
16318
+ return callback();
16319
+ }
16320
+ if (!execEditLength()) {
16321
+ exec();
16322
+ }
16323
+ }, 0);
16324
+ })();
16325
+ } else {
16326
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
16327
+ var ret = execEditLength();
16328
+ if (ret) {
16329
+ return ret;
16330
+ }
16331
+ }
16332
+ }
16333
+ },
16334
+ addToPath: function addToPath(path, added, removed, oldPosInc, options) {
16335
+ var last = path.lastComponent;
16336
+ if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
16337
+ return {
16338
+ oldPos: path.oldPos + oldPosInc,
16339
+ lastComponent: {
16340
+ count: last.count + 1,
16341
+ added,
16342
+ removed,
16343
+ previousComponent: last.previousComponent
16344
+ }
16345
+ };
16346
+ } else {
16347
+ return {
16348
+ oldPos: path.oldPos + oldPosInc,
16349
+ lastComponent: {
16350
+ count: 1,
16351
+ added,
16352
+ removed,
16353
+ previousComponent: last
16354
+ }
16355
+ };
16356
+ }
16357
+ },
16358
+ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) {
16359
+ var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
16360
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) {
16361
+ newPos++;
16362
+ oldPos++;
16363
+ commonCount++;
16364
+ if (options.oneChangePerToken) {
16365
+ basePath.lastComponent = {
16366
+ count: 1,
16367
+ previousComponent: basePath.lastComponent,
16368
+ added: false,
16369
+ removed: false
16370
+ };
16371
+ }
16372
+ }
16373
+ if (commonCount && !options.oneChangePerToken) {
16374
+ basePath.lastComponent = {
16375
+ count: commonCount,
16376
+ previousComponent: basePath.lastComponent,
16377
+ added: false,
16378
+ removed: false
16379
+ };
16380
+ }
16381
+ basePath.oldPos = oldPos;
16382
+ return newPos;
16383
+ },
16384
+ equals: function equals(left, right, options) {
16385
+ if (options.comparator) {
16386
+ return options.comparator(left, right);
16387
+ } else {
16388
+ return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase();
16389
+ }
16390
+ },
16391
+ removeEmpty: function removeEmpty(array2) {
16392
+ var ret = [];
16393
+ for (var i3 = 0; i3 < array2.length; i3++) {
16394
+ if (array2[i3]) {
16395
+ ret.push(array2[i3]);
16396
+ }
16397
+ }
16398
+ return ret;
16399
+ },
16400
+ castInput: function castInput(value) {
16401
+ return value;
16402
+ },
16403
+ tokenize: function tokenize(value) {
16404
+ return Array.from(value);
16405
+ },
16406
+ join: function join(chars) {
16407
+ return chars.join("");
16408
+ },
16409
+ postProcess: function postProcess(changeObjects) {
16410
+ return changeObjects;
16411
+ }
16412
+ };
16413
+ function buildValues(diff2, lastComponent, newString, oldString, useLongestToken) {
16414
+ var components = [];
16415
+ var nextComponent;
16416
+ while (lastComponent) {
16417
+ components.push(lastComponent);
16418
+ nextComponent = lastComponent.previousComponent;
16419
+ delete lastComponent.previousComponent;
16420
+ lastComponent = nextComponent;
16421
+ }
16422
+ components.reverse();
16423
+ var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
16424
+ for (; componentPos < componentLen; componentPos++) {
16425
+ var component = components[componentPos];
16426
+ if (!component.removed) {
16427
+ if (!component.added && useLongestToken) {
16428
+ var value = newString.slice(newPos, newPos + component.count);
16429
+ value = value.map(function(value2, i3) {
16430
+ var oldValue = oldString[oldPos + i3];
16431
+ return oldValue.length > value2.length ? oldValue : value2;
16432
+ });
16433
+ component.value = diff2.join(value);
16434
+ } else {
16435
+ component.value = diff2.join(newString.slice(newPos, newPos + component.count));
16436
+ }
16437
+ newPos += component.count;
16438
+ if (!component.added) {
16439
+ oldPos += component.count;
16440
+ }
16441
+ } else {
16442
+ component.value = diff2.join(oldString.slice(oldPos, oldPos + component.count));
16443
+ oldPos += component.count;
16444
+ }
16445
+ }
16446
+ return components;
16447
+ }
16448
+ function longestCommonPrefix(str1, str2) {
16449
+ var i3;
16450
+ for (i3 = 0; i3 < str1.length && i3 < str2.length; i3++) {
16451
+ if (str1[i3] != str2[i3]) {
16452
+ return str1.slice(0, i3);
16453
+ }
16454
+ }
16455
+ return str1.slice(0, i3);
16456
+ }
16457
+ function longestCommonSuffix(str1, str2) {
16458
+ var i3;
16459
+ if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
16460
+ return "";
16461
+ }
16462
+ for (i3 = 0; i3 < str1.length && i3 < str2.length; i3++) {
16463
+ if (str1[str1.length - (i3 + 1)] != str2[str2.length - (i3 + 1)]) {
16464
+ return str1.slice(-i3);
16465
+ }
16466
+ }
16467
+ return str1.slice(-i3);
16468
+ }
16469
+ function replacePrefix(string4, oldPrefix, newPrefix) {
16470
+ if (string4.slice(0, oldPrefix.length) != oldPrefix) {
16471
+ throw Error("string ".concat(JSON.stringify(string4), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug"));
16472
+ }
16473
+ return newPrefix + string4.slice(oldPrefix.length);
16474
+ }
16475
+ function replaceSuffix(string4, oldSuffix, newSuffix) {
16476
+ if (!oldSuffix) {
16477
+ return string4 + newSuffix;
16478
+ }
16479
+ if (string4.slice(-oldSuffix.length) != oldSuffix) {
16480
+ throw Error("string ".concat(JSON.stringify(string4), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug"));
16481
+ }
16482
+ return string4.slice(0, -oldSuffix.length) + newSuffix;
16483
+ }
16484
+ function removePrefix(string4, oldPrefix) {
16485
+ return replacePrefix(string4, oldPrefix, "");
16486
+ }
16487
+ function removeSuffix(string4, oldSuffix) {
16488
+ return replaceSuffix(string4, oldSuffix, "");
16489
+ }
16490
+ function maximumOverlap(string1, string22) {
16491
+ return string22.slice(0, overlapCount(string1, string22));
16492
+ }
16493
+ function overlapCount(a2, b2) {
16494
+ var startA = 0;
16495
+ if (a2.length > b2.length) {
16496
+ startA = a2.length - b2.length;
16497
+ }
16498
+ var endB = b2.length;
16499
+ if (a2.length < b2.length) {
16500
+ endB = a2.length;
16501
+ }
16502
+ var map2 = Array(endB);
16503
+ var k2 = 0;
16504
+ map2[0] = 0;
16505
+ for (var j2 = 1; j2 < endB; j2++) {
16506
+ if (b2[j2] == b2[k2]) {
16507
+ map2[j2] = map2[k2];
16508
+ } else {
16509
+ map2[j2] = k2;
16510
+ }
16511
+ while (k2 > 0 && b2[j2] != b2[k2]) {
16512
+ k2 = map2[k2];
16513
+ }
16514
+ if (b2[j2] == b2[k2]) {
16515
+ k2++;
16516
+ }
16517
+ }
16518
+ k2 = 0;
16519
+ for (var i3 = startA; i3 < a2.length; i3++) {
16520
+ while (k2 > 0 && a2[i3] != b2[k2]) {
16521
+ k2 = map2[k2];
16522
+ }
16523
+ if (a2[i3] == b2[k2]) {
16524
+ k2++;
16525
+ }
16526
+ }
16527
+ return k2;
16528
+ }
16529
+ var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";
16530
+ var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), "ug");
16531
+ var wordDiff = new Diff();
16532
+ wordDiff.equals = function(left, right, options) {
16533
+ if (options.ignoreCase) {
16534
+ left = left.toLowerCase();
16535
+ right = right.toLowerCase();
16536
+ }
16537
+ return left.trim() === right.trim();
16538
+ };
16539
+ wordDiff.tokenize = function(value) {
16540
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
16541
+ var parts;
16542
+ if (options.intlSegmenter) {
16543
+ if (options.intlSegmenter.resolvedOptions().granularity != "word") {
16544
+ throw new Error('The segmenter passed must have a granularity of "word"');
16545
+ }
16546
+ parts = Array.from(options.intlSegmenter.segment(value), function(segment) {
16547
+ return segment.segment;
16548
+ });
16549
+ } else {
16550
+ parts = value.match(tokenizeIncludingWhitespace) || [];
16551
+ }
16552
+ var tokens = [];
16553
+ var prevPart = null;
16554
+ parts.forEach(function(part) {
16555
+ if (/\s/.test(part)) {
16556
+ if (prevPart == null) {
16557
+ tokens.push(part);
16558
+ } else {
16559
+ tokens.push(tokens.pop() + part);
16560
+ }
16561
+ } else if (/\s/.test(prevPart)) {
16562
+ if (tokens[tokens.length - 1] == prevPart) {
16563
+ tokens.push(tokens.pop() + part);
16564
+ } else {
16565
+ tokens.push(prevPart + part);
16566
+ }
16567
+ } else {
16568
+ tokens.push(part);
16569
+ }
16570
+ prevPart = part;
16571
+ });
16572
+ return tokens;
16573
+ };
16574
+ wordDiff.join = function(tokens) {
16575
+ return tokens.map(function(token, i3) {
16576
+ if (i3 == 0) {
16577
+ return token;
16578
+ } else {
16579
+ return token.replace(/^\s+/, "");
16580
+ }
16581
+ }).join("");
16582
+ };
16583
+ wordDiff.postProcess = function(changes, options) {
16584
+ if (!changes || options.oneChangePerToken) {
16585
+ return changes;
16586
+ }
16587
+ var lastKeep = null;
16588
+ var insertion = null;
16589
+ var deletion = null;
16590
+ changes.forEach(function(change) {
16591
+ if (change.added) {
16592
+ insertion = change;
16593
+ } else if (change.removed) {
16594
+ deletion = change;
16595
+ } else {
16596
+ if (insertion || deletion) {
16597
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
16598
+ }
16599
+ lastKeep = change;
16600
+ insertion = null;
16601
+ deletion = null;
16602
+ }
16603
+ });
16604
+ if (insertion || deletion) {
16605
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
16606
+ }
16607
+ return changes;
16608
+ };
16609
+ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
16610
+ if (deletion && insertion) {
16611
+ var oldWsPrefix = deletion.value.match(/^\s*/)[0];
16612
+ var oldWsSuffix = deletion.value.match(/\s*$/)[0];
16613
+ var newWsPrefix = insertion.value.match(/^\s*/)[0];
16614
+ var newWsSuffix = insertion.value.match(/\s*$/)[0];
16615
+ if (startKeep) {
16616
+ var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
16617
+ startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
16618
+ deletion.value = removePrefix(deletion.value, commonWsPrefix);
16619
+ insertion.value = removePrefix(insertion.value, commonWsPrefix);
16620
+ }
16621
+ if (endKeep) {
16622
+ var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
16623
+ endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
16624
+ deletion.value = removeSuffix(deletion.value, commonWsSuffix);
16625
+ insertion.value = removeSuffix(insertion.value, commonWsSuffix);
16626
+ }
16627
+ } else if (insertion) {
16628
+ if (startKeep) {
16629
+ insertion.value = insertion.value.replace(/^\s*/, "");
16630
+ }
16631
+ if (endKeep) {
16632
+ endKeep.value = endKeep.value.replace(/^\s*/, "");
16633
+ }
16634
+ } else if (startKeep && endKeep) {
16635
+ var newWsFull = endKeep.value.match(/^\s*/)[0], delWsStart = deletion.value.match(/^\s*/)[0], delWsEnd = deletion.value.match(/\s*$/)[0];
16636
+ var newWsStart = longestCommonPrefix(newWsFull, delWsStart);
16637
+ deletion.value = removePrefix(deletion.value, newWsStart);
16638
+ var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
16639
+ deletion.value = removeSuffix(deletion.value, newWsEnd);
16640
+ endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
16641
+ startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
16642
+ } else if (endKeep) {
16643
+ var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0];
16644
+ var deletionWsSuffix = deletion.value.match(/\s*$/)[0];
16645
+ var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
16646
+ deletion.value = removeSuffix(deletion.value, overlap);
16647
+ } else if (startKeep) {
16648
+ var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0];
16649
+ var deletionWsPrefix = deletion.value.match(/^\s*/)[0];
16650
+ var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
16651
+ deletion.value = removePrefix(deletion.value, _overlap);
16652
+ }
16653
+ }
16654
+ var wordWithSpaceDiff = new Diff();
16655
+ wordWithSpaceDiff.tokenize = function(value) {
16656
+ var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
16657
+ return value.match(regex) || [];
16658
+ };
16659
+ var lineDiff = new Diff();
16660
+ lineDiff.tokenize = function(value, options) {
16661
+ if (options.stripTrailingCr) {
16662
+ value = value.replace(/\r\n/g, "\n");
16663
+ }
16664
+ var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
16665
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
16666
+ linesAndNewlines.pop();
16667
+ }
16668
+ for (var i3 = 0; i3 < linesAndNewlines.length; i3++) {
16669
+ var line = linesAndNewlines[i3];
16670
+ if (i3 % 2 && !options.newlineIsToken) {
16671
+ retLines[retLines.length - 1] += line;
16672
+ } else {
16673
+ retLines.push(line);
16674
+ }
16675
+ }
16676
+ return retLines;
16677
+ };
16678
+ lineDiff.equals = function(left, right, options) {
16679
+ if (options.ignoreWhitespace) {
16680
+ if (!options.newlineIsToken || !left.includes("\n")) {
16681
+ left = left.trim();
16682
+ }
16683
+ if (!options.newlineIsToken || !right.includes("\n")) {
16684
+ right = right.trim();
16685
+ }
16686
+ } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
16687
+ if (left.endsWith("\n")) {
16688
+ left = left.slice(0, -1);
16689
+ }
16690
+ if (right.endsWith("\n")) {
16691
+ right = right.slice(0, -1);
16692
+ }
16693
+ }
16694
+ return Diff.prototype.equals.call(this, left, right, options);
16695
+ };
16696
+ var sentenceDiff = new Diff();
16697
+ sentenceDiff.tokenize = function(value) {
16698
+ return value.split(/(\S.+?[.!?])(?=\s+|$)/);
16699
+ };
16700
+ var cssDiff = new Diff();
16701
+ cssDiff.tokenize = function(value) {
16702
+ return value.split(/([{}:;,]|\s+)/);
16703
+ };
16704
+ function ownKeys(e, r2) {
16705
+ var t2 = Object.keys(e);
16706
+ if (Object.getOwnPropertySymbols) {
16707
+ var o2 = Object.getOwnPropertySymbols(e);
16708
+ r2 && (o2 = o2.filter(function(r3) {
16709
+ return Object.getOwnPropertyDescriptor(e, r3).enumerable;
16710
+ })), t2.push.apply(t2, o2);
16711
+ }
16712
+ return t2;
16713
+ }
16714
+ function _objectSpread2(e) {
16715
+ for (var r2 = 1; r2 < arguments.length; r2++) {
16716
+ var t2 = null != arguments[r2] ? arguments[r2] : {};
16717
+ r2 % 2 ? ownKeys(Object(t2), true).forEach(function(r3) {
16718
+ _defineProperty(e, r3, t2[r3]);
16719
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r3) {
16720
+ Object.defineProperty(e, r3, Object.getOwnPropertyDescriptor(t2, r3));
16721
+ });
16722
+ }
16723
+ return e;
16724
+ }
16725
+ function _toPrimitive(t2, r2) {
16726
+ if ("object" != typeof t2 || !t2) return t2;
16727
+ var e = t2[Symbol.toPrimitive];
16728
+ if (void 0 !== e) {
16729
+ var i3 = e.call(t2, r2);
16730
+ if ("object" != typeof i3) return i3;
16731
+ throw new TypeError("@@toPrimitive must return a primitive value.");
16732
+ }
16733
+ return ("string" === r2 ? String : Number)(t2);
16734
+ }
16735
+ function _toPropertyKey(t2) {
16736
+ var i3 = _toPrimitive(t2, "string");
16737
+ return "symbol" == typeof i3 ? i3 : i3 + "";
16738
+ }
16739
+ function _typeof(o2) {
16740
+ "@babel/helpers - typeof";
16741
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
16742
+ return typeof o3;
16743
+ } : function(o3) {
16744
+ return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
16745
+ }, _typeof(o2);
16746
+ }
16747
+ function _defineProperty(obj, key, value) {
16748
+ key = _toPropertyKey(key);
16749
+ if (key in obj) {
16750
+ Object.defineProperty(obj, key, {
16751
+ value,
16752
+ enumerable: true,
16753
+ configurable: true,
16754
+ writable: true
16755
+ });
16756
+ } else {
16757
+ obj[key] = value;
16758
+ }
16759
+ return obj;
16760
+ }
16761
+ var jsonDiff = new Diff();
16762
+ jsonDiff.useLongestToken = true;
16763
+ jsonDiff.tokenize = lineDiff.tokenize;
16764
+ jsonDiff.castInput = function(value, options) {
16765
+ var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === void 0 ? function(k2, v) {
16766
+ return typeof v === "undefined" ? undefinedReplacement : v;
16767
+ } : _options$stringifyRep;
16768
+ return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
16769
+ };
16770
+ jsonDiff.equals = function(left, right, options) {
16771
+ return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
16772
+ };
16773
+ function canonicalize(obj, stack, replacementStack, replacer, key) {
16774
+ stack = stack || [];
16775
+ replacementStack = replacementStack || [];
16776
+ if (replacer) {
16777
+ obj = replacer(key, obj);
16778
+ }
16779
+ var i3;
16780
+ for (i3 = 0; i3 < stack.length; i3 += 1) {
16781
+ if (stack[i3] === obj) {
16782
+ return replacementStack[i3];
16783
+ }
16784
+ }
16785
+ var canonicalizedObj;
16786
+ if ("[object Array]" === Object.prototype.toString.call(obj)) {
16787
+ stack.push(obj);
16788
+ canonicalizedObj = new Array(obj.length);
16789
+ replacementStack.push(canonicalizedObj);
16790
+ for (i3 = 0; i3 < obj.length; i3 += 1) {
16791
+ canonicalizedObj[i3] = canonicalize(obj[i3], stack, replacementStack, replacer, key);
16792
+ }
16793
+ stack.pop();
16794
+ replacementStack.pop();
16795
+ return canonicalizedObj;
16796
+ }
16797
+ if (obj && obj.toJSON) {
16798
+ obj = obj.toJSON();
16799
+ }
16800
+ if (_typeof(obj) === "object" && obj !== null) {
16801
+ stack.push(obj);
16802
+ canonicalizedObj = {};
16803
+ replacementStack.push(canonicalizedObj);
16804
+ var sortedKeys = [], _key;
16805
+ for (_key in obj) {
16806
+ if (Object.prototype.hasOwnProperty.call(obj, _key)) {
16807
+ sortedKeys.push(_key);
16808
+ }
16809
+ }
16810
+ sortedKeys.sort();
16811
+ for (i3 = 0; i3 < sortedKeys.length; i3 += 1) {
16812
+ _key = sortedKeys[i3];
16813
+ canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
16814
+ }
16815
+ stack.pop();
16816
+ replacementStack.pop();
16817
+ } else {
16818
+ canonicalizedObj = obj;
16819
+ }
16820
+ return canonicalizedObj;
16821
+ }
16822
+ var arrayDiff = new Diff();
16823
+ arrayDiff.tokenize = function(value) {
16824
+ return value.slice();
16825
+ };
16826
+ arrayDiff.join = arrayDiff.removeEmpty = function(value) {
16827
+ return value;
16828
+ };
16829
+ function parsePatch(uniDiff) {
16830
+ var diffstr = uniDiff.split(/\n/), list = [], i3 = 0;
16831
+ function parseIndex() {
16832
+ var index = {};
16833
+ list.push(index);
16834
+ while (i3 < diffstr.length) {
16835
+ var line = diffstr[i3];
16836
+ if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
16837
+ break;
16838
+ }
16839
+ var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
16840
+ if (header) {
16841
+ index.index = header[1];
16842
+ }
16843
+ i3++;
16844
+ }
16845
+ parseFileHeader(index);
16846
+ parseFileHeader(index);
16847
+ index.hunks = [];
16848
+ while (i3 < diffstr.length) {
16849
+ var _line = diffstr[i3];
16850
+ if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) {
16851
+ break;
16852
+ } else if (/^@@/.test(_line)) {
16853
+ index.hunks.push(parseHunk());
16854
+ } else if (_line) {
16855
+ throw new Error("Unknown line " + (i3 + 1) + " " + JSON.stringify(_line));
16856
+ } else {
16857
+ i3++;
16858
+ }
16859
+ }
16860
+ }
16861
+ function parseFileHeader(index) {
16862
+ var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i3]);
16863
+ if (fileHeader) {
16864
+ var keyPrefix = fileHeader[1] === "---" ? "old" : "new";
16865
+ var data = fileHeader[2].split(" ", 2);
16866
+ var fileName = data[0].replace(/\\\\/g, "\\");
16867
+ if (/^".*"$/.test(fileName)) {
16868
+ fileName = fileName.substr(1, fileName.length - 2);
16869
+ }
16870
+ index[keyPrefix + "FileName"] = fileName;
16871
+ index[keyPrefix + "Header"] = (data[1] || "").trim();
16872
+ i3++;
16873
+ }
16874
+ }
16875
+ function parseHunk() {
16876
+ var chunkHeaderIndex = i3, chunkHeaderLine = diffstr[i3++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
16877
+ var hunk = {
16878
+ oldStart: +chunkHeader[1],
16879
+ oldLines: typeof chunkHeader[2] === "undefined" ? 1 : +chunkHeader[2],
16880
+ newStart: +chunkHeader[3],
16881
+ newLines: typeof chunkHeader[4] === "undefined" ? 1 : +chunkHeader[4],
16882
+ lines: []
16883
+ };
16884
+ if (hunk.oldLines === 0) {
16885
+ hunk.oldStart += 1;
16886
+ }
16887
+ if (hunk.newLines === 0) {
16888
+ hunk.newStart += 1;
16889
+ }
16890
+ var addCount = 0, removeCount = 0;
16891
+ for (; i3 < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || (_diffstr$i = diffstr[i3]) !== null && _diffstr$i !== void 0 && _diffstr$i.startsWith("\\")); i3++) {
16892
+ var _diffstr$i;
16893
+ var operation = diffstr[i3].length == 0 && i3 != diffstr.length - 1 ? " " : diffstr[i3][0];
16894
+ if (operation === "+" || operation === "-" || operation === " " || operation === "\\") {
16895
+ hunk.lines.push(diffstr[i3]);
16896
+ if (operation === "+") {
16897
+ addCount++;
16898
+ } else if (operation === "-") {
16899
+ removeCount++;
16900
+ } else if (operation === " ") {
16901
+ addCount++;
16902
+ removeCount++;
16903
+ }
16904
+ } else {
16905
+ throw new Error("Hunk at line ".concat(chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i3]));
16906
+ }
16907
+ }
16908
+ if (!addCount && hunk.newLines === 1) {
16909
+ hunk.newLines = 0;
16910
+ }
16911
+ if (!removeCount && hunk.oldLines === 1) {
16912
+ hunk.oldLines = 0;
16913
+ }
16914
+ if (addCount !== hunk.newLines) {
16915
+ throw new Error("Added line count did not match for hunk at line " + (chunkHeaderIndex + 1));
16916
+ }
16917
+ if (removeCount !== hunk.oldLines) {
16918
+ throw new Error("Removed line count did not match for hunk at line " + (chunkHeaderIndex + 1));
16919
+ }
16920
+ return hunk;
16921
+ }
16922
+ while (i3 < diffstr.length) {
16923
+ parseIndex();
16924
+ }
16925
+ return list;
16926
+ }
16927
+ function reversePatch(structuredPatch) {
16928
+ if (Array.isArray(structuredPatch)) {
16929
+ return structuredPatch.map(reversePatch).reverse();
16930
+ }
16931
+ return _objectSpread2(_objectSpread2({}, structuredPatch), {}, {
16932
+ oldFileName: structuredPatch.newFileName,
16933
+ oldHeader: structuredPatch.newHeader,
16934
+ newFileName: structuredPatch.oldFileName,
16935
+ newHeader: structuredPatch.oldHeader,
16936
+ hunks: structuredPatch.hunks.map(function(hunk) {
16937
+ return {
16938
+ oldLines: hunk.newLines,
16939
+ oldStart: hunk.newStart,
16940
+ newLines: hunk.oldLines,
16941
+ newStart: hunk.oldStart,
16942
+ lines: hunk.lines.map(function(l2) {
16943
+ if (l2.startsWith("-")) {
16944
+ return "+".concat(l2.slice(1));
16945
+ }
16946
+ if (l2.startsWith("+")) {
16947
+ return "-".concat(l2.slice(1));
16948
+ }
16949
+ return l2;
16950
+ })
16951
+ };
16952
+ })
16953
+ });
16954
+ }
16955
+
16956
+ // ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
16957
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
16958
+ function normalizeWindowsPath(input = "") {
16959
+ if (!input) {
16960
+ return input;
16961
+ }
16962
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r2) => r2.toUpperCase());
16963
+ }
16964
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
16965
+ var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
16966
+ function cwd() {
16967
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
16968
+ return process.cwd().replace(/\\/g, "/");
16969
+ }
16970
+ return "/";
16971
+ }
16972
+ var resolve2 = function(...arguments_) {
16973
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
16974
+ let resolvedPath = "";
16975
+ let resolvedAbsolute = false;
16976
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
16977
+ const path = index >= 0 ? arguments_[index] : cwd();
16978
+ if (!path || path.length === 0) {
16979
+ continue;
16980
+ }
16981
+ resolvedPath = `${path}/${resolvedPath}`;
16982
+ resolvedAbsolute = isAbsolute(path);
16983
+ }
16984
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
16985
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
16986
+ return `/${resolvedPath}`;
16987
+ }
16988
+ return resolvedPath.length > 0 ? resolvedPath : ".";
16989
+ };
16990
+ function normalizeString(path, allowAboveRoot) {
16991
+ let res = "";
16992
+ let lastSegmentLength = 0;
16993
+ let lastSlash = -1;
16994
+ let dots = 0;
16995
+ let char = null;
16996
+ for (let index = 0; index <= path.length; ++index) {
16997
+ if (index < path.length) {
16998
+ char = path[index];
16999
+ } else if (char === "/") {
17000
+ break;
17001
+ } else {
17002
+ char = "/";
17003
+ }
17004
+ if (char === "/") {
17005
+ if (lastSlash === index - 1 || dots === 1) ;
17006
+ else if (dots === 2) {
17007
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
17008
+ if (res.length > 2) {
17009
+ const lastSlashIndex = res.lastIndexOf("/");
17010
+ if (lastSlashIndex === -1) {
17011
+ res = "";
17012
+ lastSegmentLength = 0;
17013
+ } else {
17014
+ res = res.slice(0, lastSlashIndex);
17015
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
17016
+ }
17017
+ lastSlash = index;
17018
+ dots = 0;
17019
+ continue;
17020
+ } else if (res.length > 0) {
17021
+ res = "";
17022
+ lastSegmentLength = 0;
17023
+ lastSlash = index;
17024
+ dots = 0;
17025
+ continue;
17026
+ }
17027
+ }
17028
+ if (allowAboveRoot) {
17029
+ res += res.length > 0 ? "/.." : "..";
17030
+ lastSegmentLength = 2;
17031
+ }
17032
+ } else {
17033
+ if (res.length > 0) {
17034
+ res += `/${path.slice(lastSlash + 1, index)}`;
17035
+ } else {
17036
+ res = path.slice(lastSlash + 1, index);
17037
+ }
17038
+ lastSegmentLength = index - lastSlash - 1;
17039
+ }
17040
+ lastSlash = index;
17041
+ dots = 0;
17042
+ } else if (char === "." && dots !== -1) {
17043
+ ++dots;
17044
+ } else {
17045
+ dots = -1;
17046
+ }
17047
+ }
17048
+ return res;
17049
+ }
17050
+ var isAbsolute = function(p) {
17051
+ return _IS_ABSOLUTE_RE.test(p);
17052
+ };
17053
+ var relative = function(from, to) {
17054
+ const _from = resolve2(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
17055
+ const _to = resolve2(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
17056
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
17057
+ return _to.join("/");
17058
+ }
17059
+ const _fromCopy = [..._from];
17060
+ for (const segment of _fromCopy) {
17061
+ if (_to[0] !== segment) {
17062
+ break;
17063
+ }
17064
+ _from.shift();
17065
+ _to.shift();
16079
17066
  }
16080
- return id;
17067
+ return [..._from.map(() => ".."), ..._to].join("/");
16081
17068
  };
16082
17069
 
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) => {
16088
- let r = "completed";
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);
17070
+ // ../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/index.js
17071
+ var i2 = "https://app.ami.dev";
17072
+ var l = "https://bridge.ami.dev";
17073
+ var d2 = `${i2}/api/v1/trpc`;
17074
+ var f = async (t2) => {
17075
+ let o2 = "completed";
17076
+ const r2 = new AbortController(), s2 = t2.chatId ?? await R({ token: t2.token, projectId: t2.projectId }), n2 = t2.getMessages(), a2 = await fetch(t2.url, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${t2.token}` }, body: JSON.stringify({ id: h2(), chatId: s2, projectId: t2.projectId, agentUrl: i2, cwd: t2.context.environment.cwd, messages: n2, context: t2.context }) }).then((e) => e.body ?? null);
17077
+ if (!a2) throw new Error(`Agent response stream was not received from ${t2.url}. Possible causes: network error, server did not return a response body, or agent endpoint misconfiguration.`);
17078
+ const c2 = new g().parseStream(a2), l2 = new Array(), d3 = t2.messages.at(-1), u = readUIMessageStream({ message: d3, stream: c2.pipeThrough(new TransformStream({ transform(e, t3) {
17079
+ l2.push(e), t3.enqueue(e), "data-lifecycle" === e.type && (o2 = e.data.status);
16093
17080
  } })), terminateOnError: true });
16094
- for await (const t of u2) {
16095
- if (o.signal.aborted) break;
16096
- await e.upsertMessage(t);
17081
+ for await (const e of u) {
17082
+ if (r2.signal.aborted) break;
17083
+ await t2.upsertMessage(e);
16097
17084
  }
16098
- return { status: r, chatId: n };
17085
+ return { status: o2, chatId: s2 };
16099
17086
  };
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 } };
17087
+ var h2 = () => nanoid();
17088
+ var _ = (e) => ({ id: e.id, role: e.role, parts: [{ type: "text", text: e.content }], createdAt: /* @__PURE__ */ new Date() });
17089
+ var R = async (e) => {
17090
+ const t2 = await fetch(`${d2}/chats.create`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` }, body: JSON.stringify({ projectId: e.projectId, hasBackgroundAgent: e.hasBackgroundAgent ?? false }) });
17091
+ if (!t2.ok) {
17092
+ const e2 = await t2.text();
17093
+ throw new Error(`Failed to create chat: ${t2.status} ${t2.statusText}${e2 ? ` - ${e2}` : ""}`);
17094
+ }
17095
+ return (await t2.json()).result.data;
16105
17096
  };
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}` : ""}`);
17097
+ var g = class extends DefaultChatTransport {
17098
+ parseStream(e) {
17099
+ return this.processResponseStream(e);
17100
+ }
17101
+ };
17102
+ new TextEncoder();
17103
+ var m = new TextDecoder();
17104
+ var w = class extends Error {
17105
+ constructor(e, t2) {
17106
+ super(e, t2), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, Error.captureStackTrace?.(this, this.constructor);
17107
+ }
17108
+ };
17109
+ w.code = "ERR_JOSE_GENERIC";
17110
+ (class extends w {
17111
+ constructor(e, t2, o2 = "unspecified", r2 = "unspecified") {
17112
+ super(e, { cause: { claim: o2, reason: r2, payload: t2 } }), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = o2, this.reason = r2, this.payload = t2;
17113
+ }
17114
+ }).code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
17115
+ (class extends w {
17116
+ constructor(e, t2, o2 = "unspecified", r2 = "unspecified") {
17117
+ super(e, { cause: { claim: o2, reason: r2, payload: t2 } }), this.code = "ERR_JWT_EXPIRED", this.claim = o2, this.reason = r2, this.payload = t2;
17118
+ }
17119
+ }).code = "ERR_JWT_EXPIRED";
17120
+ (class extends w {
17121
+ constructor() {
17122
+ super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
17123
+ }
17124
+ }).code = "ERR_JOSE_ALG_NOT_ALLOWED";
17125
+ (class extends w {
17126
+ constructor() {
17127
+ super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
17128
+ }
17129
+ }).code = "ERR_JOSE_NOT_SUPPORTED";
17130
+ (class extends w {
17131
+ constructor(e = "decryption operation failed", t2) {
17132
+ super(e, t2), this.code = "ERR_JWE_DECRYPTION_FAILED";
17133
+ }
17134
+ }).code = "ERR_JWE_DECRYPTION_FAILED";
17135
+ (class extends w {
17136
+ constructor() {
17137
+ super(...arguments), this.code = "ERR_JWE_INVALID";
17138
+ }
17139
+ }).code = "ERR_JWE_INVALID";
17140
+ (class extends w {
17141
+ constructor() {
17142
+ super(...arguments), this.code = "ERR_JWS_INVALID";
17143
+ }
17144
+ }).code = "ERR_JWS_INVALID";
17145
+ var I = class extends w {
17146
+ constructor() {
17147
+ super(...arguments), this.code = "ERR_JWT_INVALID";
16111
17148
  }
16112
- return (await e.json()).result.data;
16113
17149
  };
16114
- var w = class extends DefaultChatTransport {
16115
- parseStream(t) {
16116
- return this.processResponseStream(t);
17150
+ I.code = "ERR_JWT_INVALID";
17151
+ (class extends w {
17152
+ constructor() {
17153
+ super(...arguments), this.code = "ERR_JWK_INVALID";
17154
+ }
17155
+ }).code = "ERR_JWK_INVALID";
17156
+ (class extends w {
17157
+ constructor() {
17158
+ super(...arguments), this.code = "ERR_JWKS_INVALID";
17159
+ }
17160
+ }).code = "ERR_JWKS_INVALID";
17161
+ (class extends w {
17162
+ constructor(e = "no applicable key found in the JSON Web Key Set", t2) {
17163
+ super(e, t2), this.code = "ERR_JWKS_NO_MATCHING_KEY";
17164
+ }
17165
+ }).code = "ERR_JWKS_NO_MATCHING_KEY";
17166
+ (class extends w {
17167
+ constructor(e = "multiple matching keys found in the JSON Web Key Set", t2) {
17168
+ super(e, t2), this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
17169
+ }
17170
+ }).code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
17171
+ (class extends w {
17172
+ constructor(e = "request timed out", t2) {
17173
+ super(e, t2), this.code = "ERR_JWKS_TIMEOUT";
17174
+ }
17175
+ }).code = "ERR_JWKS_TIMEOUT";
17176
+ (class extends w {
17177
+ constructor(e = "signature verification failed", t2) {
17178
+ super(e, t2), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
17179
+ }
17180
+ }).code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
17181
+ var y = (e) => {
17182
+ let t2 = e;
17183
+ t2 instanceof Uint8Array && (t2 = m.decode(t2)), t2 = t2.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
17184
+ try {
17185
+ return ((e2) => {
17186
+ const t3 = atob(e2), o2 = new Uint8Array(t3.length);
17187
+ for (let e3 = 0; e3 < t3.length; e3++) o2[e3] = t3.charCodeAt(e3);
17188
+ return o2;
17189
+ })(t2);
17190
+ } catch {
17191
+ throw new TypeError("The input to be decoded is not correctly encoded.");
16117
17192
  }
16118
17193
  };
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() }));
17194
+ function T(e) {
17195
+ if ("string" != typeof e) throw new I("JWTs must use Compact JWS serialization, JWT must be a string");
17196
+ const { 1: t2, length: o2 } = e.split(".");
17197
+ if (5 === o2) throw new I("Only JWTs using Compact JWS serialization can be decoded");
17198
+ if (3 !== o2) throw new I("Invalid JWT");
17199
+ if (!t2) throw new I("JWTs must contain a payload");
17200
+ let r2, s2;
17201
+ try {
17202
+ r2 = y(t2);
17203
+ } catch {
17204
+ throw new I("Failed to base64url decode the payload");
17205
+ }
17206
+ try {
17207
+ s2 = JSON.parse(m.decode(r2));
17208
+ } catch {
17209
+ throw new I("Failed to parse the decoded payload as JSON");
17210
+ }
17211
+ if (!(function(e2) {
17212
+ if ("object" != typeof (t3 = e2) || null === t3 || "[object Object]" !== Object.prototype.toString.call(e2)) return false;
17213
+ var t3;
17214
+ if (null === Object.getPrototypeOf(e2)) return true;
17215
+ let o3 = e2;
17216
+ for (; null !== Object.getPrototypeOf(o3); ) o3 = Object.getPrototypeOf(o3);
17217
+ return Object.getPrototypeOf(e2) === o3;
17218
+ })(s2)) throw new I("Invalid JWT Claims Set");
17219
+ return s2;
17220
+ }
17221
+ var b = (e) => external_exports.object({ result: external_exports.object({ data: e }) });
17222
+ var A = b(external_exports.object({ token: external_exports.string() }));
17223
+ var S = b(external_exports.object({ verified: external_exports.boolean(), expired: external_exports.boolean(), token: external_exports.string().optional(), bridge_token: external_exports.string().optional() }));
16122
17224
  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;
17225
+ var O = b(external_exports.object({ hasMore: external_exports.boolean(), nextCursor: external_exports.number().optional(), projects: external_exports.array(k) }));
17226
+ b(k);
17227
+ var C = (e) => new Promise((t2) => setTimeout(t2, e));
17228
+ var N = async () => {
17229
+ const e = await fetch(`${d2}/user.token.registerDaemonToken`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
17230
+ if (!e.ok) throw new Error(`Failed to create exchange token: ${e.status}`);
17231
+ const t2 = await e.json();
17232
+ return A.parse(t2).result.data.token;
16131
17233
  };
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" } });
16134
- if (!r.ok) throw new Error(`Failed to check verification: ${r.status}`);
16135
- const o = await r.json();
16136
- return y.parse(o).result.data;
17234
+ var j = async (e) => {
17235
+ const t2 = new URLSearchParams({ input: JSON.stringify({ token: e }) }), o2 = await fetch(`${d2}/user.token.checkIfVerified?${t2}`, { method: "GET", headers: { "Content-Type": "application/json" } });
17236
+ if (!o2.ok) throw new Error(`Failed to check verification: ${o2.status}`);
17237
+ const r2 = await o2.json();
17238
+ return S.parse(r2).result.data;
16137
17239
  };
16138
- var x = (t) => `${a}/daemon/auth?token=${t}`;
16139
- var v = async (t, e, r = 60) => {
16140
- for (let o = 0; o < r; o++) {
16141
- await b(1e3);
17240
+ var W = (e) => `${i2}/daemon/auth?token=${e}`;
17241
+ var D = async (e, t2, o2 = 60) => {
17242
+ for (let r2 = 0; r2 < o2; r2++) {
17243
+ await C(1e3);
16142
17244
  try {
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 };
17245
+ const o3 = await j(e);
17246
+ if (o3.expired) return t2("expired"), { success: false };
17247
+ if (o3.verified) return t2("success"), { success: true, token: o3.token, bridgeToken: o3.bridge_token };
16146
17248
  } catch {
16147
17249
  }
16148
17250
  }
16149
17251
  return { success: false };
16150
17252
  };
17253
+ var x = (e) => T(e);
17254
+ var L = (e) => T(e);
17255
+ var P = (e) => L(e).userId;
17256
+ var $ = async (e) => {
17257
+ const t2 = await N(), o2 = W(t2);
17258
+ window.open(o2, "_blank");
17259
+ const r2 = await D(t2, e ?? (() => {
17260
+ }));
17261
+ if (r2.success && r2.token && r2.bridgeToken) {
17262
+ const e2 = x(r2.token), t3 = L(r2.bridgeToken), o3 = new Date(1e3 * e2.exp);
17263
+ return { success: true, token: r2.token, bridgeToken: r2.bridgeToken, userId: t3.userId, email: e2.email, expiresAt: o3 };
17264
+ }
17265
+ return { success: false };
17266
+ };
17267
+ var U = async (e) => {
17268
+ const t2 = new URLSearchParams({ input: JSON.stringify({ cursor: e.cursor ?? 0, limit: e.limit ?? 100 }) }), o2 = await fetch(`${d2}/projects.list?${t2}`, { method: "GET", headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` } });
17269
+ if (!o2.ok) throw new Error(`Failed to list projects: ${o2.status}`);
17270
+ const r2 = await o2.json();
17271
+ return O.parse(r2).result.data;
17272
+ };
17273
+ var K = (e) => e.type.startsWith("tool-");
17274
+ var G = (e, t2) => {
17275
+ const o2 = [];
17276
+ if (!K(e)) return [];
17277
+ const r2 = e;
17278
+ if ("tool-Edit_041125" === r2.type && r2.input) {
17279
+ const e2 = r2.input.file_path, s2 = r2.output;
17280
+ if (e2 && s2 && "success" === s2.type) {
17281
+ const n2 = s2.result.diff, c2 = isAbsolute(e2) ? relative(t2, e2) : e2;
17282
+ o2.push({ toolId: r2.toolCallId, diff: n2, filePath: c2, deleted: false, beforeContent: s2.result.$metadata?.beforeContent ?? null });
17283
+ }
17284
+ } else if ("tool-Edit_021025" === r2.type && r2.input) {
17285
+ const e2 = r2.input.relative_file_path, s2 = r2.output;
17286
+ if (e2 && s2 && "success" === s2.type) {
17287
+ const n2 = s2.result.diff, c2 = isAbsolute(e2) ? relative(t2, e2) : e2;
17288
+ o2.push({ toolId: r2.toolCallId, diff: n2, filePath: c2, deleted: false, beforeContent: s2.result.$metadata?.beforeContent ?? null });
17289
+ }
17290
+ } else if ("tool-Write_021025" === r2.type) {
17291
+ const e2 = r2.output;
17292
+ if ("success" === e2?.type) {
17293
+ const s2 = e2.result.diff, n2 = e2.result.filePath, c2 = "create" === e2.result.type;
17294
+ if (n2) {
17295
+ const i3 = isAbsolute(n2) ? relative(t2, n2) : n2;
17296
+ o2.push({ toolId: r2.toolCallId, diff: s2, filePath: i3, deleted: c2, beforeContent: e2.result.$metadata?.beforeContent ?? null });
17297
+ }
17298
+ }
17299
+ }
17300
+ return o2;
17301
+ };
17302
+ var M = (e, t2, o2) => {
17303
+ const r2 = [];
17304
+ if (o2) for (const e2 of o2) {
17305
+ const o3 = G(e2, t2);
17306
+ o3 && r2.push(...o3);
17307
+ }
17308
+ else for (const o3 of e) for (const e2 of o3.parts) {
17309
+ const o4 = G(e2, t2);
17310
+ o4 && r2.push(...o4);
17311
+ }
17312
+ const a2 = r2.filter((e2, t3, o3) => t3 === o3.findIndex((t4) => t4.filePath === e2.filePath && t4.deleted === e2.deleted && t4.diff === e2.diff)), c2 = [];
17313
+ for (const { diff: e2, filePath: t3, deleted: o3 } of a2) {
17314
+ if ("[DELETED]" === e2) continue;
17315
+ const r3 = parsePatch(e2);
17316
+ for (const e3 of r3) {
17317
+ const r4 = reversePatch(e3);
17318
+ c2.push({ filePath: t3, patch: r4, deleted: o3 });
17319
+ }
17320
+ }
17321
+ return c2;
17322
+ };
17323
+ var B = (e) => {
17324
+ try {
17325
+ let t2;
17326
+ if (e.toolCallId) {
17327
+ let o2 = null;
17328
+ for (const t3 of e.messages) {
17329
+ for (const r2 of t3.parts) if (K(r2)) {
17330
+ if (r2.toolCallId === e.toolCallId) {
17331
+ o2 = r2;
17332
+ break;
17333
+ }
17334
+ }
17335
+ if (o2) break;
17336
+ }
17337
+ if (!o2) return { success: false, patches: [], error: "Tool call not found" };
17338
+ t2 = M(e.messages, e.cwd, [o2]);
17339
+ } else {
17340
+ let o2 = null;
17341
+ for (let t3 = e.messages.length - 1; t3 >= 0; t3--) {
17342
+ const r2 = e.messages[t3];
17343
+ if (r2 && "assistant" === r2.role) {
17344
+ o2 = r2;
17345
+ break;
17346
+ }
17347
+ }
17348
+ if (!o2) return { success: false, patches: [], error: "No assistant message found" };
17349
+ t2 = M([o2], e.cwd);
17350
+ }
17351
+ return 0 === t2.length ? { success: false, patches: [], error: "No file changes to revert" } : { success: true, patches: t2 };
17352
+ } catch (e2) {
17353
+ return { success: false, patches: [], error: e2 instanceof Error ? e2.message : "Unknown error" };
17354
+ }
17355
+ };
17356
+ var X = async (e) => {
17357
+ const { applyRevertPatchesViaCli: t2 } = await Promise.resolve().then(() => (init_cli_rpc_TXHB6KVB(), cli_rpc_TXHB6KVB_exports)), o2 = await t2(e);
17358
+ return { success: o2.success ?? false, error: o2.error };
17359
+ };
17360
+ var q = async (e) => {
17361
+ const t2 = B(e);
17362
+ if (!t2.success) return t2;
17363
+ const o2 = await X({ patches: t2.patches, cwd: e.cwd });
17364
+ return { success: o2.success, patches: t2.patches, error: o2.error };
17365
+ };
16151
17366
 
16152
17367
  // src/client.ts
16153
17368
  var STORAGE_KEY = "react-grab:agent-sessions";
16154
17369
  var TOKEN_STORAGE_KEY = "react-grab:ami-token";
16155
- var DEFAULT_PROJECT_ID = "react-grab-agent";
16156
- var loadCachedToken = () => {
17370
+ var BRIDGE_TOKEN_STORAGE_KEY = "react-grab:ami-bridge-token";
17371
+ var loadCachedAuth = () => {
16157
17372
  try {
16158
- return localStorage.getItem(TOKEN_STORAGE_KEY);
17373
+ const token = sessionStorage.getItem(TOKEN_STORAGE_KEY);
17374
+ const bridgeToken = sessionStorage.getItem(BRIDGE_TOKEN_STORAGE_KEY);
17375
+ if (!token || !bridgeToken) return null;
17376
+ const userId = P(bridgeToken);
17377
+ return { token, bridgeToken, userId };
16159
17378
  } catch {
16160
17379
  return null;
16161
17380
  }
16162
17381
  };
16163
- var saveCachedToken = (token) => {
17382
+ var saveCachedAuth = (auth) => {
16164
17383
  try {
16165
- localStorage.setItem(TOKEN_STORAGE_KEY, token);
17384
+ sessionStorage.setItem(TOKEN_STORAGE_KEY, auth.token);
17385
+ sessionStorage.setItem(BRIDGE_TOKEN_STORAGE_KEY, auth.bridgeToken);
16166
17386
  } catch {
16167
17387
  }
16168
17388
  };
16169
- var authenticate = async () => {
16170
- const exchangeToken = await S();
16171
- const authUrl = x(exchangeToken);
16172
- window.open(authUrl, "_blank");
16173
- const result = await v(exchangeToken, () => {
16174
- });
16175
- if (!result.success || !result.token) {
17389
+ var performAuthentication = async () => {
17390
+ const result = await $();
17391
+ if (!result.success || !result.token || !result.bridgeToken) {
16176
17392
  throw new Error("Authentication failed");
16177
17393
  }
16178
- saveCachedToken(result.token);
16179
- return result.token;
17394
+ const auth = {
17395
+ token: result.token,
17396
+ bridgeToken: result.bridgeToken,
17397
+ userId: result.userId
17398
+ };
17399
+ saveCachedAuth(auth);
17400
+ r({
17401
+ bridgeToken: auth.bridgeToken,
17402
+ userId: auth.userId
17403
+ });
17404
+ return auth;
16180
17405
  };
16181
- var getOrCreateToken = async () => {
16182
- const cachedToken = loadCachedToken();
16183
- if (cachedToken) {
16184
- return cachedToken;
17406
+ var getOrCreateAuth = async () => {
17407
+ const cachedAuth = loadCachedAuth();
17408
+ if (cachedAuth) {
17409
+ r({
17410
+ bridgeToken: cachedAuth.bridgeToken,
17411
+ userId: cachedAuth.userId
17412
+ });
17413
+ return cachedAuth;
16185
17414
  }
16186
- return authenticate();
17415
+ return performAuthentication();
16187
17416
  };
16188
17417
  var isToolPart = (part) => {
16189
17418
  return part.type.startsWith("tool-");
@@ -16207,19 +17436,19 @@ var sanitizeMessages = (messages) => {
16207
17436
  }
16208
17437
  return sanitized;
16209
17438
  };
16210
- var runAgent = async (context, token, projectId, onStatus) => {
16211
- const fullPrompt = `${context.prompt}
17439
+ var runAgent = async (context, token, projectId, onStatus, existingMessages, existingChatId) => {
17440
+ const isFollowUp = Boolean(existingMessages && existingMessages.length > 0);
17441
+ const userMessageContent = isFollowUp ? context.prompt : `${context.prompt}
16212
17442
 
16213
17443
  ${context.content}`;
16214
- const messages = [
16215
- u({
16216
- id: p(),
17444
+ const messages = existingMessages ? [...existingMessages] : [];
17445
+ messages.push(
17446
+ _({
17447
+ id: h2(),
16217
17448
  role: "user",
16218
- content: fullPrompt
17449
+ content: userMessageContent
16219
17450
  })
16220
- ];
16221
- const chatId = p();
16222
- const environment = h(window.location.href);
17451
+ );
16223
17452
  const upsertMessage = async (message) => {
16224
17453
  const existingIndex = messages.findIndex((m2) => m2.id === message.id);
16225
17454
  if (existingIndex >= 0) {
@@ -16234,15 +17463,19 @@ ${context.content}`;
16234
17463
  }
16235
17464
  }
16236
17465
  };
16237
- const { status } = await l({
17466
+ const environmentResult = await d(projectId);
17467
+ if (environmentResult._tag !== "Success") {
17468
+ throw new Error("Failed to get environment");
17469
+ }
17470
+ const { status, chatId } = await f({
16238
17471
  messages: sanitizeMessages(messages),
16239
17472
  context: {
16240
- environment,
17473
+ environment: environmentResult.environment,
16241
17474
  systemContext: [],
16242
17475
  attachments: []
16243
17476
  },
16244
- url: `${s}/api/v1/agent-proxy`,
16245
- chatId,
17477
+ url: `${l}/api/v1/agent-proxy`,
17478
+ chatId: existingChatId,
16246
17479
  projectId,
16247
17480
  token,
16248
17481
  upsertMessage,
@@ -16254,15 +17487,26 @@ ${context.content}`;
16254
17487
  case "aborted":
16255
17488
  throw new Error("User aborted task");
16256
17489
  default:
16257
- return "Completed successfully";
17490
+ return { status: "Completed successfully", messages, chatId };
16258
17491
  }
16259
17492
  };
16260
17493
  var CONNECTION_CHECK_TTL_MS = 5e3;
16261
- var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
17494
+ var createAmiAgentProvider = (projectId) => {
16262
17495
  let connectionCache = null;
17496
+ let lastAgentMessages = null;
17497
+ const sessionData = /* @__PURE__ */ new Map();
17498
+ const getLatestProjectId = async (token) => {
17499
+ const projects = await U({ token, limit: 1 });
17500
+ const latestProject = projects.projects[0];
17501
+ return latestProject?.id;
17502
+ };
16263
17503
  return {
16264
17504
  send: async function* (context, signal) {
16265
- const token = await getOrCreateToken();
17505
+ const auth = await getOrCreateAuth();
17506
+ projectId = await getLatestProjectId(auth.token);
17507
+ if (!projectId) {
17508
+ throw new Error("No project found");
17509
+ }
16266
17510
  yield "Thinking...";
16267
17511
  const statusQueue = [];
16268
17512
  let resolveWait = null;
@@ -16283,12 +17527,27 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16283
17527
  resolveWait = null;
16284
17528
  }
16285
17529
  };
16286
- const agentPromise = runAgent(context, token, projectId, onStatus);
17530
+ const existingData = context.sessionId ? sessionData.get(context.sessionId) : void 0;
17531
+ const agentPromise = runAgent(
17532
+ context,
17533
+ auth.token,
17534
+ projectId,
17535
+ onStatus,
17536
+ existingData?.messages,
17537
+ existingData?.chatId
17538
+ );
16287
17539
  let done = false;
16288
17540
  let caughtError = null;
16289
- agentPromise.then((finalStatus) => {
17541
+ agentPromise.then((result) => {
16290
17542
  if (aborted2) return;
16291
- statusQueue.push(finalStatus);
17543
+ lastAgentMessages = result.messages;
17544
+ if (context.sessionId) {
17545
+ sessionData.set(context.sessionId, {
17546
+ messages: result.messages,
17547
+ chatId: result.chatId
17548
+ });
17549
+ }
17550
+ statusQueue.push(result.status);
16292
17551
  done = true;
16293
17552
  if (resolveWait) {
16294
17553
  resolveWait();
@@ -16311,8 +17570,8 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16311
17570
  if (statusQueue.length > 0) {
16312
17571
  yield statusQueue.shift();
16313
17572
  } else {
16314
- await new Promise((resolve2) => {
16315
- resolveWait = resolve2;
17573
+ await new Promise((resolve3) => {
17574
+ resolveWait = resolve3;
16316
17575
  });
16317
17576
  }
16318
17577
  }
@@ -16340,7 +17599,7 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16340
17599
  throw new Error(`Session ${sessionId} not found`);
16341
17600
  }
16342
17601
  const context = session.context;
16343
- const token = await getOrCreateToken();
17602
+ const auth = await getOrCreateAuth();
16344
17603
  yield "Resuming...";
16345
17604
  const statusQueue = [];
16346
17605
  let resolveWait = null;
@@ -16361,17 +17620,17 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16361
17620
  resolveWait = null;
16362
17621
  }
16363
17622
  };
16364
- const agentPromise = runAgent(
16365
- context,
16366
- token,
16367
- DEFAULT_PROJECT_ID,
16368
- onStatus
16369
- );
17623
+ projectId = await getLatestProjectId(auth.token);
17624
+ if (!projectId) {
17625
+ throw new Error("No project found");
17626
+ }
17627
+ const agentPromise = runAgent(context, auth.token, projectId, onStatus);
16370
17628
  let done = false;
16371
17629
  let caughtError = null;
16372
- agentPromise.then((finalStatus) => {
17630
+ agentPromise.then((result) => {
16373
17631
  if (aborted2) return;
16374
- statusQueue.push(finalStatus);
17632
+ lastAgentMessages = result.messages;
17633
+ statusQueue.push(result.status);
16375
17634
  done = true;
16376
17635
  if (resolveWait) {
16377
17636
  resolveWait();
@@ -16394,8 +17653,8 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16394
17653
  if (statusQueue.length > 0) {
16395
17654
  yield statusQueue.shift();
16396
17655
  } else {
16397
- await new Promise((resolve2) => {
16398
- resolveWait = resolve2;
17656
+ await new Promise((resolve3) => {
17657
+ resolveWait = resolve3;
16399
17658
  });
16400
17659
  }
16401
17660
  }
@@ -16413,13 +17672,14 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16413
17672
  }
16414
17673
  },
16415
17674
  supportsResume: true,
17675
+ supportsFollowUp: true,
16416
17676
  checkConnection: async () => {
16417
17677
  const now = Date.now();
16418
17678
  if (connectionCache && now - connectionCache.timestamp < CONNECTION_CHECK_TTL_MS) {
16419
17679
  return connectionCache.result;
16420
17680
  }
16421
17681
  try {
16422
- const response = await fetch(s, { method: "HEAD" });
17682
+ const response = await fetch(l, { method: "HEAD" });
16423
17683
  const result = response.ok;
16424
17684
  connectionCache = { result, timestamp: now };
16425
17685
  return result;
@@ -16427,25 +17687,43 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16427
17687
  connectionCache = { result: false, timestamp: now };
16428
17688
  return false;
16429
17689
  }
17690
+ },
17691
+ undo: async () => {
17692
+ if (!lastAgentMessages) return;
17693
+ try {
17694
+ await q({
17695
+ messages: lastAgentMessages,
17696
+ cwd: window.location.href
17697
+ });
17698
+ lastAgentMessages = null;
17699
+ } catch {
17700
+ }
16430
17701
  }
16431
17702
  };
16432
17703
  };
16433
17704
  var attachAgent = async () => {
16434
17705
  if (typeof window === "undefined") return;
16435
17706
  const provider = createAmiAgentProvider();
17707
+ const attach = (api2) => {
17708
+ api2.setAgent({ provider, storage: sessionStorage });
17709
+ };
16436
17710
  const api = window.__REACT_GRAB__;
16437
17711
  if (api) {
16438
- api.setAgent({ provider });
17712
+ attach(api);
16439
17713
  return;
16440
17714
  }
16441
17715
  window.addEventListener(
16442
17716
  "react-grab:init",
16443
17717
  (event) => {
16444
17718
  const customEvent = event;
16445
- customEvent.detail.setAgent({ provider });
17719
+ attach(customEvent.detail);
16446
17720
  },
16447
17721
  { once: true }
16448
17722
  );
17723
+ const apiAfterListener = window.__REACT_GRAB__;
17724
+ if (apiAfterListener) {
17725
+ attach(apiAfterListener);
17726
+ }
16449
17727
  };
16450
17728
  attachAgent();
16451
17729