@react-grab/ami 0.0.77 → 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 +1795 -484
- package/dist/client.global.js +25 -20
- package/dist/client.js +1795 -484
- package/package.json +3 -3
package/dist/client.js
CHANGED
|
@@ -1,9 +1,168 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __esm = (fn, res) => function __init() {
|
|
4
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
+
};
|
|
2
6
|
var __export = (target, all) => {
|
|
3
7
|
for (var name16 in all)
|
|
4
8
|
__defProp(target, name16, { get: all[name16], enumerable: true });
|
|
5
9
|
};
|
|
6
10
|
|
|
11
|
+
// ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js
|
|
12
|
+
var urlAlphabet;
|
|
13
|
+
var init_url_alphabet = __esm({
|
|
14
|
+
"../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js"() {
|
|
15
|
+
urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.browser.js
|
|
20
|
+
var nanoid;
|
|
21
|
+
var init_index_browser = __esm({
|
|
22
|
+
"../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.browser.js"() {
|
|
23
|
+
init_url_alphabet();
|
|
24
|
+
nanoid = (size = 21) => {
|
|
25
|
+
let id = "";
|
|
26
|
+
let bytes = crypto.getRandomValues(new Uint8Array(size |= 0));
|
|
27
|
+
while (size--) {
|
|
28
|
+
id += urlAlphabet[bytes[size] & 63];
|
|
29
|
+
}
|
|
30
|
+
return id;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// ../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/chunk-PXASDCYU.js
|
|
36
|
+
var t, s, i, n, r, o, c, a, d, h;
|
|
37
|
+
var init_chunk_PXASDCYU = __esm({
|
|
38
|
+
"../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/chunk-PXASDCYU.js"() {
|
|
39
|
+
init_index_browser();
|
|
40
|
+
t = "wss://bridge.ami.dev/api/v1/user-streams";
|
|
41
|
+
s = class {
|
|
42
|
+
promise;
|
|
43
|
+
rawResolve = () => null;
|
|
44
|
+
rawReject = () => null;
|
|
45
|
+
isSettled = false;
|
|
46
|
+
isResolved = false;
|
|
47
|
+
timeoutId = null;
|
|
48
|
+
constructor() {
|
|
49
|
+
this.promise = new Promise((e, t2) => {
|
|
50
|
+
this.rawResolve = e, this.rawReject = t2;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
timeout(e) {
|
|
54
|
+
this.timeoutId && clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => {
|
|
55
|
+
this.isSettled || this.reject(new Error("Connection timeout"));
|
|
56
|
+
}, e);
|
|
57
|
+
}
|
|
58
|
+
resolve(e) {
|
|
59
|
+
this.isSettled || (this.isSettled = true, this.isResolved = true, this.timeoutId && clearTimeout(this.timeoutId), this.rawResolve(e));
|
|
60
|
+
}
|
|
61
|
+
reject(e) {
|
|
62
|
+
this.isSettled || (this.isSettled = true, this.timeoutId && clearTimeout(this.timeoutId), this.rawReject(e));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
i = class {
|
|
66
|
+
ws = null;
|
|
67
|
+
pendingRequests = /* @__PURE__ */ new Map();
|
|
68
|
+
isConnecting = false;
|
|
69
|
+
connectionPromise = null;
|
|
70
|
+
config;
|
|
71
|
+
ready = new s();
|
|
72
|
+
isAuthenticated = new s();
|
|
73
|
+
constructor(e) {
|
|
74
|
+
this.config = e;
|
|
75
|
+
}
|
|
76
|
+
async rpc(t2, s2, i3) {
|
|
77
|
+
await this.ensureConnected();
|
|
78
|
+
const n2 = nanoid(), r2 = new Promise((e, t3) => {
|
|
79
|
+
this.pendingRequests.set(n2, { resolve: (t4) => e(t4), reject: t3 }), setTimeout(() => {
|
|
80
|
+
this.pendingRequests.has(n2) && (this.pendingRequests.delete(n2), t3(new Error("RPC request timeout")));
|
|
81
|
+
}, 3e4);
|
|
82
|
+
});
|
|
83
|
+
return this.ws?.send(JSON.stringify({ _tag: "rpc_call", requestId: n2, method: t2, input: s2, ...i3 ? { target: i3 } : {} })), r2;
|
|
84
|
+
}
|
|
85
|
+
disconnect() {
|
|
86
|
+
this.ws?.close(), this.ws = null, this.pendingRequests.clear(), this.ready = new s(), this.isAuthenticated = new s();
|
|
87
|
+
}
|
|
88
|
+
isConnected() {
|
|
89
|
+
return this.ws?.readyState === WebSocket.OPEN;
|
|
90
|
+
}
|
|
91
|
+
async connect() {
|
|
92
|
+
const e = this.config.bridgeWsUrl ?? t, i3 = new URL(e);
|
|
93
|
+
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", () => {
|
|
94
|
+
this.ready.resolve(true);
|
|
95
|
+
}), this.ws.addEventListener("message", (e2) => {
|
|
96
|
+
const t2 = JSON.parse(e2.data);
|
|
97
|
+
if ("auth_required" !== t2._tag) if ("auth_success" !== t2._tag) if ("auth_failed" !== t2._tag) {
|
|
98
|
+
if ("rpc_result" === t2._tag) {
|
|
99
|
+
const e3 = this.pendingRequests.get(t2.requestId);
|
|
100
|
+
e3 && (e3.resolve(t2.data), this.pendingRequests.delete(t2.requestId));
|
|
101
|
+
} else if ("rpc_error" === t2._tag) {
|
|
102
|
+
const e3 = this.pendingRequests.get(t2.requestId);
|
|
103
|
+
if (e3) {
|
|
104
|
+
const s2 = new Error(t2.message);
|
|
105
|
+
e3.reject(s2), this.pendingRequests.delete(t2.requestId);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} else this.isAuthenticated.reject(new Error("Authentication failed"));
|
|
109
|
+
else this.isAuthenticated.resolve(true);
|
|
110
|
+
else this.ws?.send(JSON.stringify({ _tag: "auth", token: this.config.bridgeToken, type: "client" }));
|
|
111
|
+
}), this.ws.addEventListener("error", (e2) => {
|
|
112
|
+
console.error("WebSocket error:", e2), this.ready.isSettled || this.ready.reject(new Error("WebSocket connection failed"));
|
|
113
|
+
}), this.ws.addEventListener("close", () => {
|
|
114
|
+
this.ready.isSettled || this.ready.reject(new Error("WebSocket closed"));
|
|
115
|
+
}), this.ready.timeout(1e4), this.isAuthenticated.timeout(1e4), await this.ready.promise, await this.isAuthenticated.promise;
|
|
116
|
+
}
|
|
117
|
+
async ensureConnected() {
|
|
118
|
+
if (this.ws?.readyState !== WebSocket.OPEN || !this.isAuthenticated.isResolved) {
|
|
119
|
+
if (this.isConnecting && this.connectionPromise) return this.connectionPromise;
|
|
120
|
+
this.isConnecting = true, this.connectionPromise = this.connect();
|
|
121
|
+
try {
|
|
122
|
+
await this.connectionPromise;
|
|
123
|
+
} finally {
|
|
124
|
+
this.isConnecting = false, this.connectionPromise = null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
n = null;
|
|
130
|
+
r = (e) => n = new i(e);
|
|
131
|
+
o = () => n;
|
|
132
|
+
c = async (e, t2, s2) => {
|
|
133
|
+
if (!n) throw new Error("CLI RPC client not initialized. Call initCliRpc() first with your bridgeToken and userId.");
|
|
134
|
+
return n.rpc(e, t2, s2);
|
|
135
|
+
};
|
|
136
|
+
a = async (e) => {
|
|
137
|
+
const t2 = e.patches.map((e2) => ({ filepath: e2.filePath, patch: e2.patch, deleted: e2.deleted }));
|
|
138
|
+
return c("fs:apply_diffs", { cwd: e.cwd, patches: t2 });
|
|
139
|
+
};
|
|
140
|
+
d = async (e) => c("daemon:get_environment", { _tag: "ProjectId", projectId: e });
|
|
141
|
+
h = async (e) => c("daemon:get_environment", { _tag: "Port", port: e });
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// ../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/cli-rpc-TXHB6KVB.js
|
|
146
|
+
var cli_rpc_TXHB6KVB_exports = {};
|
|
147
|
+
__export(cli_rpc_TXHB6KVB_exports, {
|
|
148
|
+
AMI_BRIDGE_WS_URL: () => t,
|
|
149
|
+
CliRpcClient: () => i,
|
|
150
|
+
applyRevertPatchesViaCli: () => a,
|
|
151
|
+
cliRpc: () => c,
|
|
152
|
+
getCliRpcClient: () => o,
|
|
153
|
+
getEnvironmentFromPort: () => h,
|
|
154
|
+
getEnvironmentFromProjectId: () => d,
|
|
155
|
+
initCliRpc: () => r
|
|
156
|
+
});
|
|
157
|
+
var init_cli_rpc_TXHB6KVB = __esm({
|
|
158
|
+
"../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/cli-rpc-TXHB6KVB.js"() {
|
|
159
|
+
init_chunk_PXASDCYU();
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// ../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/index.js
|
|
164
|
+
init_chunk_PXASDCYU();
|
|
165
|
+
|
|
7
166
|
// ../../node_modules/.pnpm/@ai-sdk+provider@2.0.0/node_modules/@ai-sdk/provider/dist/index.mjs
|
|
8
167
|
var marker = "vercel.ai.error";
|
|
9
168
|
var symbol = Symbol.for(marker);
|
|
@@ -419,7 +578,7 @@ __export(external_exports, {
|
|
|
419
578
|
minSize: () => _minSize,
|
|
420
579
|
multipleOf: () => _multipleOf,
|
|
421
580
|
nan: () => nan,
|
|
422
|
-
nanoid: () =>
|
|
581
|
+
nanoid: () => nanoid3,
|
|
423
582
|
nativeEnum: () => nativeEnum,
|
|
424
583
|
negative: () => _negative,
|
|
425
584
|
never: () => never,
|
|
@@ -773,7 +932,7 @@ function $constructor(name16, initializer3, params) {
|
|
|
773
932
|
Object.defineProperty(inst, "_zod", {
|
|
774
933
|
value: {
|
|
775
934
|
def,
|
|
776
|
-
constr:
|
|
935
|
+
constr: _2,
|
|
777
936
|
traits: /* @__PURE__ */ new Set()
|
|
778
937
|
},
|
|
779
938
|
enumerable: false
|
|
@@ -784,10 +943,10 @@ function $constructor(name16, initializer3, params) {
|
|
|
784
943
|
}
|
|
785
944
|
inst._zod.traits.add(name16);
|
|
786
945
|
initializer3(inst, def);
|
|
787
|
-
const proto =
|
|
946
|
+
const proto = _2.prototype;
|
|
788
947
|
const keys = Object.keys(proto);
|
|
789
|
-
for (let
|
|
790
|
-
const k2 = keys[
|
|
948
|
+
for (let i3 = 0; i3 < keys.length; i3++) {
|
|
949
|
+
const k2 = keys[i3];
|
|
791
950
|
if (!(k2 in inst)) {
|
|
792
951
|
inst[k2] = proto[k2].bind(inst);
|
|
793
952
|
}
|
|
@@ -797,7 +956,7 @@ function $constructor(name16, initializer3, params) {
|
|
|
797
956
|
class Definition extends Parent {
|
|
798
957
|
}
|
|
799
958
|
Object.defineProperty(Definition, "name", { value: name16 });
|
|
800
|
-
function
|
|
959
|
+
function _2(def) {
|
|
801
960
|
var _a17;
|
|
802
961
|
const inst = params?.Parent ? new Definition() : this;
|
|
803
962
|
init(inst, def);
|
|
@@ -807,16 +966,16 @@ function $constructor(name16, initializer3, params) {
|
|
|
807
966
|
}
|
|
808
967
|
return inst;
|
|
809
968
|
}
|
|
810
|
-
Object.defineProperty(
|
|
811
|
-
Object.defineProperty(
|
|
969
|
+
Object.defineProperty(_2, "init", { value: init });
|
|
970
|
+
Object.defineProperty(_2, Symbol.hasInstance, {
|
|
812
971
|
value: (inst) => {
|
|
813
972
|
if (params?.Parent && inst instanceof params.Parent)
|
|
814
973
|
return true;
|
|
815
974
|
return inst?._zod?.traits?.has(name16);
|
|
816
975
|
}
|
|
817
976
|
});
|
|
818
|
-
Object.defineProperty(
|
|
819
|
-
return
|
|
977
|
+
Object.defineProperty(_2, "name", { value: name16 });
|
|
978
|
+
return _2;
|
|
820
979
|
}
|
|
821
980
|
var $brand = Symbol("zod_brand");
|
|
822
981
|
var $ZodAsyncError = class extends Error {
|
|
@@ -913,17 +1072,17 @@ function assertIs(_arg) {
|
|
|
913
1072
|
function assertNever(_x) {
|
|
914
1073
|
throw new Error();
|
|
915
1074
|
}
|
|
916
|
-
function assert(
|
|
1075
|
+
function assert(_2) {
|
|
917
1076
|
}
|
|
918
1077
|
function getEnumValues(entries) {
|
|
919
1078
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
920
|
-
const values = Object.entries(entries).filter(([k2,
|
|
1079
|
+
const values = Object.entries(entries).filter(([k2, _2]) => numericValues.indexOf(+k2) === -1).map(([_2, v]) => v);
|
|
921
1080
|
return values;
|
|
922
1081
|
}
|
|
923
1082
|
function joinValues(array2, separator = "|") {
|
|
924
1083
|
return array2.map((val) => stringifyPrimitive(val)).join(separator);
|
|
925
1084
|
}
|
|
926
|
-
function jsonStringifyReplacer(
|
|
1085
|
+
function jsonStringifyReplacer(_2, value) {
|
|
927
1086
|
if (typeof value === "bigint")
|
|
928
1087
|
return value.toString();
|
|
929
1088
|
return value;
|
|
@@ -1017,8 +1176,8 @@ function promiseAllObject(promisesObj) {
|
|
|
1017
1176
|
const promises = keys.map((key) => promisesObj[key]);
|
|
1018
1177
|
return Promise.all(promises).then((results) => {
|
|
1019
1178
|
const resolvedObj = {};
|
|
1020
|
-
for (let
|
|
1021
|
-
resolvedObj[keys[
|
|
1179
|
+
for (let i3 = 0; i3 < keys.length; i3++) {
|
|
1180
|
+
resolvedObj[keys[i3]] = results[i3];
|
|
1022
1181
|
}
|
|
1023
1182
|
return resolvedObj;
|
|
1024
1183
|
});
|
|
@@ -1026,7 +1185,7 @@ function promiseAllObject(promisesObj) {
|
|
|
1026
1185
|
function randomString(length = 10) {
|
|
1027
1186
|
const chars = "abcdefghijklmnopqrstuvwxyz";
|
|
1028
1187
|
let str = "";
|
|
1029
|
-
for (let
|
|
1188
|
+
for (let i3 = 0; i3 < length; i3++) {
|
|
1030
1189
|
str += chars[Math.floor(Math.random() * chars.length)];
|
|
1031
1190
|
}
|
|
1032
1191
|
return str;
|
|
@@ -1050,14 +1209,14 @@ var allowsEval = cached(() => {
|
|
|
1050
1209
|
const F = Function;
|
|
1051
1210
|
new F("");
|
|
1052
1211
|
return true;
|
|
1053
|
-
} catch (
|
|
1212
|
+
} catch (_2) {
|
|
1054
1213
|
return false;
|
|
1055
1214
|
}
|
|
1056
1215
|
});
|
|
1057
|
-
function isPlainObject(
|
|
1058
|
-
if (isObject(
|
|
1216
|
+
function isPlainObject(o2) {
|
|
1217
|
+
if (isObject(o2) === false)
|
|
1059
1218
|
return false;
|
|
1060
|
-
const ctor =
|
|
1219
|
+
const ctor = o2.constructor;
|
|
1061
1220
|
if (ctor === void 0)
|
|
1062
1221
|
return true;
|
|
1063
1222
|
if (typeof ctor !== "function")
|
|
@@ -1070,12 +1229,12 @@ function isPlainObject(o) {
|
|
|
1070
1229
|
}
|
|
1071
1230
|
return true;
|
|
1072
1231
|
}
|
|
1073
|
-
function shallowClone(
|
|
1074
|
-
if (isPlainObject(
|
|
1075
|
-
return { ...
|
|
1076
|
-
if (Array.isArray(
|
|
1077
|
-
return [...
|
|
1078
|
-
return
|
|
1232
|
+
function shallowClone(o2) {
|
|
1233
|
+
if (isPlainObject(o2))
|
|
1234
|
+
return { ...o2 };
|
|
1235
|
+
if (Array.isArray(o2))
|
|
1236
|
+
return [...o2];
|
|
1237
|
+
return o2;
|
|
1079
1238
|
}
|
|
1080
1239
|
function numKeys(data) {
|
|
1081
1240
|
let keyCount = 0;
|
|
@@ -1087,8 +1246,8 @@ function numKeys(data) {
|
|
|
1087
1246
|
return keyCount;
|
|
1088
1247
|
}
|
|
1089
1248
|
var getParsedType = (data) => {
|
|
1090
|
-
const
|
|
1091
|
-
switch (
|
|
1249
|
+
const t2 = typeof data;
|
|
1250
|
+
switch (t2) {
|
|
1092
1251
|
case "undefined":
|
|
1093
1252
|
return "undefined";
|
|
1094
1253
|
case "string":
|
|
@@ -1127,7 +1286,7 @@ var getParsedType = (data) => {
|
|
|
1127
1286
|
}
|
|
1128
1287
|
return "object";
|
|
1129
1288
|
default:
|
|
1130
|
-
throw new Error(`Unknown data type: ${
|
|
1289
|
+
throw new Error(`Unknown data type: ${t2}`);
|
|
1131
1290
|
}
|
|
1132
1291
|
};
|
|
1133
1292
|
var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
@@ -1160,31 +1319,31 @@ function normalizeParams(_params) {
|
|
|
1160
1319
|
function createTransparentProxy(getter) {
|
|
1161
1320
|
let target;
|
|
1162
1321
|
return new Proxy({}, {
|
|
1163
|
-
get(
|
|
1322
|
+
get(_2, prop, receiver) {
|
|
1164
1323
|
target ?? (target = getter());
|
|
1165
1324
|
return Reflect.get(target, prop, receiver);
|
|
1166
1325
|
},
|
|
1167
|
-
set(
|
|
1326
|
+
set(_2, prop, value, receiver) {
|
|
1168
1327
|
target ?? (target = getter());
|
|
1169
1328
|
return Reflect.set(target, prop, value, receiver);
|
|
1170
1329
|
},
|
|
1171
|
-
has(
|
|
1330
|
+
has(_2, prop) {
|
|
1172
1331
|
target ?? (target = getter());
|
|
1173
1332
|
return Reflect.has(target, prop);
|
|
1174
1333
|
},
|
|
1175
|
-
deleteProperty(
|
|
1334
|
+
deleteProperty(_2, prop) {
|
|
1176
1335
|
target ?? (target = getter());
|
|
1177
1336
|
return Reflect.deleteProperty(target, prop);
|
|
1178
1337
|
},
|
|
1179
|
-
ownKeys(
|
|
1338
|
+
ownKeys(_2) {
|
|
1180
1339
|
target ?? (target = getter());
|
|
1181
1340
|
return Reflect.ownKeys(target);
|
|
1182
1341
|
},
|
|
1183
|
-
getOwnPropertyDescriptor(
|
|
1342
|
+
getOwnPropertyDescriptor(_2, prop) {
|
|
1184
1343
|
target ?? (target = getter());
|
|
1185
1344
|
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
1186
1345
|
},
|
|
1187
|
-
defineProperty(
|
|
1346
|
+
defineProperty(_2, prop, descriptor) {
|
|
1188
1347
|
target ?? (target = getter());
|
|
1189
1348
|
return Reflect.defineProperty(target, prop, descriptor);
|
|
1190
1349
|
}
|
|
@@ -1366,11 +1525,11 @@ function required(Class2, schema, mask) {
|
|
|
1366
1525
|
});
|
|
1367
1526
|
return clone(schema, def);
|
|
1368
1527
|
}
|
|
1369
|
-
function aborted(
|
|
1370
|
-
if (
|
|
1528
|
+
function aborted(x2, startIndex = 0) {
|
|
1529
|
+
if (x2.aborted === true)
|
|
1371
1530
|
return true;
|
|
1372
|
-
for (let
|
|
1373
|
-
if (
|
|
1531
|
+
for (let i3 = startIndex; i3 < x2.issues.length; i3++) {
|
|
1532
|
+
if (x2.issues[i3]?.continue !== true) {
|
|
1374
1533
|
return true;
|
|
1375
1534
|
}
|
|
1376
1535
|
}
|
|
@@ -1429,22 +1588,22 @@ function issue(...args) {
|
|
|
1429
1588
|
return { ...iss };
|
|
1430
1589
|
}
|
|
1431
1590
|
function cleanEnum(obj) {
|
|
1432
|
-
return Object.entries(obj).filter(([k2,
|
|
1591
|
+
return Object.entries(obj).filter(([k2, _2]) => {
|
|
1433
1592
|
return Number.isNaN(Number.parseInt(k2, 10));
|
|
1434
1593
|
}).map((el) => el[1]);
|
|
1435
1594
|
}
|
|
1436
1595
|
function base64ToUint8Array(base643) {
|
|
1437
1596
|
const binaryString = atob(base643);
|
|
1438
1597
|
const bytes = new Uint8Array(binaryString.length);
|
|
1439
|
-
for (let
|
|
1440
|
-
bytes[
|
|
1598
|
+
for (let i3 = 0; i3 < binaryString.length; i3++) {
|
|
1599
|
+
bytes[i3] = binaryString.charCodeAt(i3);
|
|
1441
1600
|
}
|
|
1442
1601
|
return bytes;
|
|
1443
1602
|
}
|
|
1444
1603
|
function uint8ArrayToBase64(bytes) {
|
|
1445
1604
|
let binaryString = "";
|
|
1446
|
-
for (let
|
|
1447
|
-
binaryString += String.fromCharCode(bytes[
|
|
1605
|
+
for (let i3 = 0; i3 < bytes.length; i3++) {
|
|
1606
|
+
binaryString += String.fromCharCode(bytes[i3]);
|
|
1448
1607
|
}
|
|
1449
1608
|
return btoa(binaryString);
|
|
1450
1609
|
}
|
|
@@ -1462,8 +1621,8 @@ function hexToUint8Array(hex3) {
|
|
|
1462
1621
|
throw new Error("Invalid hex string length");
|
|
1463
1622
|
}
|
|
1464
1623
|
const bytes = new Uint8Array(cleanHex.length / 2);
|
|
1465
|
-
for (let
|
|
1466
|
-
bytes[
|
|
1624
|
+
for (let i3 = 0; i3 < cleanHex.length; i3 += 2) {
|
|
1625
|
+
bytes[i3 / 2] = Number.parseInt(cleanHex.slice(i3, i3 + 2), 16);
|
|
1467
1626
|
}
|
|
1468
1627
|
return bytes;
|
|
1469
1628
|
}
|
|
@@ -1521,10 +1680,10 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
|
|
|
1521
1680
|
fieldErrors._errors.push(mapper(issue2));
|
|
1522
1681
|
} else {
|
|
1523
1682
|
let curr = fieldErrors;
|
|
1524
|
-
let
|
|
1525
|
-
while (
|
|
1526
|
-
const el = issue2.path[
|
|
1527
|
-
const terminal =
|
|
1683
|
+
let i3 = 0;
|
|
1684
|
+
while (i3 < issue2.path.length) {
|
|
1685
|
+
const el = issue2.path[i3];
|
|
1686
|
+
const terminal = i3 === issue2.path.length - 1;
|
|
1528
1687
|
if (!terminal) {
|
|
1529
1688
|
curr[el] = curr[el] || { _errors: [] };
|
|
1530
1689
|
} else {
|
|
@@ -1532,7 +1691,7 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
|
|
|
1532
1691
|
curr[el]._errors.push(mapper(issue2));
|
|
1533
1692
|
}
|
|
1534
1693
|
curr = curr[el];
|
|
1535
|
-
|
|
1694
|
+
i3++;
|
|
1536
1695
|
}
|
|
1537
1696
|
}
|
|
1538
1697
|
}
|
|
@@ -1558,10 +1717,10 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
|
|
|
1558
1717
|
continue;
|
|
1559
1718
|
}
|
|
1560
1719
|
let curr = result;
|
|
1561
|
-
let
|
|
1562
|
-
while (
|
|
1563
|
-
const el = fullpath[
|
|
1564
|
-
const terminal =
|
|
1720
|
+
let i3 = 0;
|
|
1721
|
+
while (i3 < fullpath.length) {
|
|
1722
|
+
const el = fullpath[i3];
|
|
1723
|
+
const terminal = i3 === fullpath.length - 1;
|
|
1565
1724
|
if (typeof el === "string") {
|
|
1566
1725
|
curr.properties ?? (curr.properties = {});
|
|
1567
1726
|
(_a17 = curr.properties)[el] ?? (_a17[el] = { errors: [] });
|
|
@@ -1574,7 +1733,7 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
|
|
|
1574
1733
|
if (terminal) {
|
|
1575
1734
|
curr.errors.push(mapper(issue2));
|
|
1576
1735
|
}
|
|
1577
|
-
|
|
1736
|
+
i3++;
|
|
1578
1737
|
}
|
|
1579
1738
|
}
|
|
1580
1739
|
}
|
|
@@ -1733,7 +1892,7 @@ __export(regexes_exports, {
|
|
|
1733
1892
|
md5_base64: () => md5_base64,
|
|
1734
1893
|
md5_base64url: () => md5_base64url,
|
|
1735
1894
|
md5_hex: () => md5_hex,
|
|
1736
|
-
nanoid: () =>
|
|
1895
|
+
nanoid: () => nanoid2,
|
|
1737
1896
|
null: () => _null,
|
|
1738
1897
|
number: () => number,
|
|
1739
1898
|
rfc5322Email: () => rfc5322Email,
|
|
@@ -1766,7 +1925,7 @@ var cuid2 = /^[0-9a-z]+$/;
|
|
|
1766
1925
|
var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
1767
1926
|
var xid = /^[0-9a-vA-V]{20}$/;
|
|
1768
1927
|
var ksuid = /^[A-Za-z0-9]{27}$/;
|
|
1769
|
-
var
|
|
1928
|
+
var nanoid2 = /^[a-zA-Z0-9_-]{21}$/;
|
|
1770
1929
|
var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
1771
1930
|
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)?)??$/;
|
|
1772
1931
|
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})$/;
|
|
@@ -2418,9 +2577,9 @@ var Doc = class {
|
|
|
2418
2577
|
return;
|
|
2419
2578
|
}
|
|
2420
2579
|
const content = arg;
|
|
2421
|
-
const lines = content.split("\n").filter((
|
|
2422
|
-
const minIndent = Math.min(...lines.map((
|
|
2423
|
-
const dedented = lines.map((
|
|
2580
|
+
const lines = content.split("\n").filter((x2) => x2);
|
|
2581
|
+
const minIndent = Math.min(...lines.map((x2) => x2.length - x2.trimStart().length));
|
|
2582
|
+
const dedented = lines.map((x2) => x2.slice(minIndent)).map((x2) => " ".repeat(this.indent * 2) + x2);
|
|
2424
2583
|
for (const line of dedented) {
|
|
2425
2584
|
this.content.push(line);
|
|
2426
2585
|
}
|
|
@@ -2429,7 +2588,7 @@ var Doc = class {
|
|
|
2429
2588
|
const F = Function;
|
|
2430
2589
|
const args = this?.args;
|
|
2431
2590
|
const content = this?.content ?? [``];
|
|
2432
|
-
const lines = [...content.map((
|
|
2591
|
+
const lines = [...content.map((x2) => ` ${x2}`)];
|
|
2433
2592
|
return new F(...args, lines.join("\n"));
|
|
2434
2593
|
}
|
|
2435
2594
|
};
|
|
@@ -2475,13 +2634,13 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
2475
2634
|
continue;
|
|
2476
2635
|
}
|
|
2477
2636
|
const currLen = payload.issues.length;
|
|
2478
|
-
const
|
|
2479
|
-
if (
|
|
2637
|
+
const _2 = ch._zod.check(payload);
|
|
2638
|
+
if (_2 instanceof Promise && ctx?.async === false) {
|
|
2480
2639
|
throw new $ZodAsyncError();
|
|
2481
2640
|
}
|
|
2482
|
-
if (asyncResult ||
|
|
2641
|
+
if (asyncResult || _2 instanceof Promise) {
|
|
2483
2642
|
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
2484
|
-
await
|
|
2643
|
+
await _2;
|
|
2485
2644
|
const nextLen = payload.issues.length;
|
|
2486
2645
|
if (nextLen === currLen)
|
|
2487
2646
|
return;
|
|
@@ -2541,10 +2700,10 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
2541
2700
|
inst["~standard"] = {
|
|
2542
2701
|
validate: (value) => {
|
|
2543
2702
|
try {
|
|
2544
|
-
const
|
|
2545
|
-
return
|
|
2546
|
-
} catch (
|
|
2547
|
-
return safeParseAsync(inst, value).then((
|
|
2703
|
+
const r2 = safeParse(inst, value);
|
|
2704
|
+
return r2.success ? { value: r2.data } : { issues: r2.error?.issues };
|
|
2705
|
+
} catch (_2) {
|
|
2706
|
+
return safeParseAsync(inst, value).then((r2) => r2.success ? { value: r2.data } : { issues: r2.error?.issues });
|
|
2548
2707
|
}
|
|
2549
2708
|
},
|
|
2550
2709
|
vendor: "zod",
|
|
@@ -2554,11 +2713,11 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
2554
2713
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
2555
2714
|
$ZodType.init(inst, def);
|
|
2556
2715
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
2557
|
-
inst._zod.parse = (payload,
|
|
2716
|
+
inst._zod.parse = (payload, _2) => {
|
|
2558
2717
|
if (def.coerce)
|
|
2559
2718
|
try {
|
|
2560
2719
|
payload.value = String(payload.value);
|
|
2561
|
-
} catch (
|
|
2720
|
+
} catch (_3) {
|
|
2562
2721
|
}
|
|
2563
2722
|
if (typeof payload.value === "string")
|
|
2564
2723
|
return payload;
|
|
@@ -2643,7 +2802,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
2643
2802
|
payload.value = trimmed;
|
|
2644
2803
|
}
|
|
2645
2804
|
return;
|
|
2646
|
-
} catch (
|
|
2805
|
+
} catch (_2) {
|
|
2647
2806
|
payload.issues.push({
|
|
2648
2807
|
code: "invalid_format",
|
|
2649
2808
|
format: "url",
|
|
@@ -2659,7 +2818,7 @@ var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
|
2659
2818
|
$ZodStringFormat.init(inst, def);
|
|
2660
2819
|
});
|
|
2661
2820
|
var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
2662
|
-
def.pattern ?? (def.pattern =
|
|
2821
|
+
def.pattern ?? (def.pattern = nanoid2);
|
|
2663
2822
|
$ZodStringFormat.init(inst, def);
|
|
2664
2823
|
});
|
|
2665
2824
|
var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
@@ -2789,7 +2948,7 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
2789
2948
|
function isValidBase64URL(data) {
|
|
2790
2949
|
if (!base64url.test(data))
|
|
2791
2950
|
return false;
|
|
2792
|
-
const base643 = data.replace(/[-_]/g, (
|
|
2951
|
+
const base643 = data.replace(/[-_]/g, (c2) => c2 === "-" ? "+" : "/");
|
|
2793
2952
|
const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
|
|
2794
2953
|
return isValidBase64(padded);
|
|
2795
2954
|
}
|
|
@@ -2868,7 +3027,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
2868
3027
|
if (def.coerce)
|
|
2869
3028
|
try {
|
|
2870
3029
|
payload.value = Number(payload.value);
|
|
2871
|
-
} catch (
|
|
3030
|
+
} catch (_2) {
|
|
2872
3031
|
}
|
|
2873
3032
|
const input = payload.value;
|
|
2874
3033
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
@@ -2896,7 +3055,7 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
2896
3055
|
if (def.coerce)
|
|
2897
3056
|
try {
|
|
2898
3057
|
payload.value = Boolean(payload.value);
|
|
2899
|
-
} catch (
|
|
3058
|
+
} catch (_2) {
|
|
2900
3059
|
}
|
|
2901
3060
|
const input = payload.value;
|
|
2902
3061
|
if (typeof input === "boolean")
|
|
@@ -2917,7 +3076,7 @@ var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
|
|
|
2917
3076
|
if (def.coerce)
|
|
2918
3077
|
try {
|
|
2919
3078
|
payload.value = BigInt(payload.value);
|
|
2920
|
-
} catch (
|
|
3079
|
+
} catch (_2) {
|
|
2921
3080
|
}
|
|
2922
3081
|
if (typeof payload.value === "bigint")
|
|
2923
3082
|
return payload;
|
|
@@ -3065,16 +3224,16 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
3065
3224
|
}
|
|
3066
3225
|
payload.value = Array(input.length);
|
|
3067
3226
|
const proms = [];
|
|
3068
|
-
for (let
|
|
3069
|
-
const item = input[
|
|
3227
|
+
for (let i3 = 0; i3 < input.length; i3++) {
|
|
3228
|
+
const item = input[i3];
|
|
3070
3229
|
const result = def.element._zod.run({
|
|
3071
3230
|
value: item,
|
|
3072
3231
|
issues: []
|
|
3073
3232
|
}, ctx);
|
|
3074
3233
|
if (result instanceof Promise) {
|
|
3075
|
-
proms.push(result.then((result2) => handleArrayResult(result2, payload,
|
|
3234
|
+
proms.push(result.then((result2) => handleArrayResult(result2, payload, i3)));
|
|
3076
3235
|
} else {
|
|
3077
|
-
handleArrayResult(result, payload,
|
|
3236
|
+
handleArrayResult(result, payload, i3);
|
|
3078
3237
|
}
|
|
3079
3238
|
}
|
|
3080
3239
|
if (proms.length) {
|
|
@@ -3115,19 +3274,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
3115
3274
|
const unrecognized = [];
|
|
3116
3275
|
const keySet = def.keySet;
|
|
3117
3276
|
const _catchall = def.catchall._zod;
|
|
3118
|
-
const
|
|
3277
|
+
const t2 = _catchall.def.type;
|
|
3119
3278
|
for (const key in input) {
|
|
3120
3279
|
if (keySet.has(key))
|
|
3121
3280
|
continue;
|
|
3122
|
-
if (
|
|
3281
|
+
if (t2 === "never") {
|
|
3123
3282
|
unrecognized.push(key);
|
|
3124
3283
|
continue;
|
|
3125
3284
|
}
|
|
3126
|
-
const
|
|
3127
|
-
if (
|
|
3128
|
-
proms.push(
|
|
3285
|
+
const r2 = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
3286
|
+
if (r2 instanceof Promise) {
|
|
3287
|
+
proms.push(r2.then((r3) => handlePropertyResult(r3, payload, key, input)));
|
|
3129
3288
|
} else {
|
|
3130
|
-
handlePropertyResult(
|
|
3289
|
+
handlePropertyResult(r2, payload, key, input);
|
|
3131
3290
|
}
|
|
3132
3291
|
}
|
|
3133
3292
|
if (unrecognized.length) {
|
|
@@ -3193,11 +3352,11 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3193
3352
|
const shape = value.shape;
|
|
3194
3353
|
for (const key of value.keys) {
|
|
3195
3354
|
const el = shape[key];
|
|
3196
|
-
const
|
|
3197
|
-
if (
|
|
3198
|
-
proms.push(
|
|
3355
|
+
const r2 = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
3356
|
+
if (r2 instanceof Promise) {
|
|
3357
|
+
proms.push(r2.then((r3) => handlePropertyResult(r3, payload, key, input)));
|
|
3199
3358
|
} else {
|
|
3200
|
-
handlePropertyResult(
|
|
3359
|
+
handlePropertyResult(r2, payload, key, input);
|
|
3201
3360
|
}
|
|
3202
3361
|
}
|
|
3203
3362
|
if (!catchall) {
|
|
@@ -3289,7 +3448,7 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
3289
3448
|
return final;
|
|
3290
3449
|
}
|
|
3291
3450
|
}
|
|
3292
|
-
const nonaborted = results.filter((
|
|
3451
|
+
const nonaborted = results.filter((r2) => !aborted(r2));
|
|
3293
3452
|
if (nonaborted.length === 1) {
|
|
3294
3453
|
final.value = nonaborted[0].value;
|
|
3295
3454
|
return nonaborted[0];
|
|
@@ -3304,18 +3463,18 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
3304
3463
|
}
|
|
3305
3464
|
var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
3306
3465
|
$ZodType.init(inst, def);
|
|
3307
|
-
defineLazy(inst._zod, "optin", () => def.options.some((
|
|
3308
|
-
defineLazy(inst._zod, "optout", () => def.options.some((
|
|
3466
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o2) => o2._zod.optin === "optional") ? "optional" : void 0);
|
|
3467
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o2) => o2._zod.optout === "optional") ? "optional" : void 0);
|
|
3309
3468
|
defineLazy(inst._zod, "values", () => {
|
|
3310
|
-
if (def.options.every((
|
|
3469
|
+
if (def.options.every((o2) => o2._zod.values)) {
|
|
3311
3470
|
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
3312
3471
|
}
|
|
3313
3472
|
return void 0;
|
|
3314
3473
|
});
|
|
3315
3474
|
defineLazy(inst._zod, "pattern", () => {
|
|
3316
|
-
if (def.options.every((
|
|
3317
|
-
const patterns = def.options.map((
|
|
3318
|
-
return new RegExp(`^(${patterns.map((
|
|
3475
|
+
if (def.options.every((o2) => o2._zod.pattern)) {
|
|
3476
|
+
const patterns = def.options.map((o2) => o2._zod.pattern);
|
|
3477
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
3319
3478
|
}
|
|
3320
3479
|
return void 0;
|
|
3321
3480
|
});
|
|
@@ -3370,15 +3529,15 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3370
3529
|
const disc = cached(() => {
|
|
3371
3530
|
const opts = def.options;
|
|
3372
3531
|
const map2 = /* @__PURE__ */ new Map();
|
|
3373
|
-
for (const
|
|
3374
|
-
const values =
|
|
3532
|
+
for (const o2 of opts) {
|
|
3533
|
+
const values = o2._zod.propValues?.[def.discriminator];
|
|
3375
3534
|
if (!values || values.size === 0)
|
|
3376
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(
|
|
3535
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o2)}"`);
|
|
3377
3536
|
for (const v of values) {
|
|
3378
3537
|
if (map2.has(v)) {
|
|
3379
3538
|
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
3380
3539
|
}
|
|
3381
|
-
map2.set(v,
|
|
3540
|
+
map2.set(v, o2);
|
|
3382
3541
|
}
|
|
3383
3542
|
}
|
|
3384
3543
|
return map2;
|
|
@@ -3519,35 +3678,35 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
3519
3678
|
return payload;
|
|
3520
3679
|
}
|
|
3521
3680
|
}
|
|
3522
|
-
let
|
|
3681
|
+
let i3 = -1;
|
|
3523
3682
|
for (const item of items) {
|
|
3524
|
-
|
|
3525
|
-
if (
|
|
3526
|
-
if (
|
|
3683
|
+
i3++;
|
|
3684
|
+
if (i3 >= input.length) {
|
|
3685
|
+
if (i3 >= optStart)
|
|
3527
3686
|
continue;
|
|
3528
3687
|
}
|
|
3529
3688
|
const result = item._zod.run({
|
|
3530
|
-
value: input[
|
|
3689
|
+
value: input[i3],
|
|
3531
3690
|
issues: []
|
|
3532
3691
|
}, ctx);
|
|
3533
3692
|
if (result instanceof Promise) {
|
|
3534
|
-
proms.push(result.then((result2) => handleTupleResult(result2, payload,
|
|
3693
|
+
proms.push(result.then((result2) => handleTupleResult(result2, payload, i3)));
|
|
3535
3694
|
} else {
|
|
3536
|
-
handleTupleResult(result, payload,
|
|
3695
|
+
handleTupleResult(result, payload, i3);
|
|
3537
3696
|
}
|
|
3538
3697
|
}
|
|
3539
3698
|
if (def.rest) {
|
|
3540
3699
|
const rest = input.slice(items.length);
|
|
3541
3700
|
for (const el of rest) {
|
|
3542
|
-
|
|
3701
|
+
i3++;
|
|
3543
3702
|
const result = def.rest._zod.run({
|
|
3544
3703
|
value: el,
|
|
3545
3704
|
issues: []
|
|
3546
3705
|
}, ctx);
|
|
3547
3706
|
if (result instanceof Promise) {
|
|
3548
|
-
proms.push(result.then((result2) => handleTupleResult(result2, payload,
|
|
3707
|
+
proms.push(result.then((result2) => handleTupleResult(result2, payload, i3)));
|
|
3549
3708
|
} else {
|
|
3550
|
-
handleTupleResult(result, payload,
|
|
3709
|
+
handleTupleResult(result, payload, i3);
|
|
3551
3710
|
}
|
|
3552
3711
|
}
|
|
3553
3712
|
}
|
|
@@ -3756,7 +3915,7 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
3756
3915
|
const values = getEnumValues(def.entries);
|
|
3757
3916
|
const valuesSet = new Set(values);
|
|
3758
3917
|
inst._zod.values = valuesSet;
|
|
3759
|
-
inst._zod.pattern = new RegExp(`^(${values.filter((k2) => propertyKeyTypes.has(typeof k2)).map((
|
|
3918
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k2) => propertyKeyTypes.has(typeof k2)).map((o2) => typeof o2 === "string" ? escapeRegex(o2) : o2.toString()).join("|")})$`);
|
|
3760
3919
|
inst._zod.parse = (payload, _ctx) => {
|
|
3761
3920
|
const input = payload.value;
|
|
3762
3921
|
if (valuesSet.has(input)) {
|
|
@@ -3778,7 +3937,7 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
3778
3937
|
}
|
|
3779
3938
|
const values = new Set(def.values);
|
|
3780
3939
|
inst._zod.values = values;
|
|
3781
|
-
inst._zod.pattern = new RegExp(`^(${def.values.map((
|
|
3940
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o2) => typeof o2 === "string" ? escapeRegex(o2) : o2 ? escapeRegex(o2.toString()) : String(o2)).join("|")})$`);
|
|
3782
3941
|
inst._zod.parse = (payload, _ctx) => {
|
|
3783
3942
|
const input = payload.value;
|
|
3784
3943
|
if (values.has(input)) {
|
|
@@ -3850,7 +4009,7 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
3850
4009
|
if (def.innerType._zod.optin === "optional") {
|
|
3851
4010
|
const result = def.innerType._zod.run(payload, ctx);
|
|
3852
4011
|
if (result instanceof Promise)
|
|
3853
|
-
return result.then((
|
|
4012
|
+
return result.then((r2) => handleOptionalResult(r2, payload.value));
|
|
3854
4013
|
return handleOptionalResult(result, payload.value);
|
|
3855
4014
|
}
|
|
3856
4015
|
if (payload.value === void 0) {
|
|
@@ -3919,7 +4078,7 @@ var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def
|
|
|
3919
4078
|
$ZodType.init(inst, def);
|
|
3920
4079
|
defineLazy(inst._zod, "values", () => {
|
|
3921
4080
|
const v = def.innerType._zod.values;
|
|
3922
|
-
return v ? new Set([...v].filter((
|
|
4081
|
+
return v ? new Set([...v].filter((x2) => x2 !== void 0)) : void 0;
|
|
3923
4082
|
});
|
|
3924
4083
|
inst._zod.parse = (payload, ctx) => {
|
|
3925
4084
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -4254,16 +4413,16 @@ var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
|
|
|
4254
4413
|
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
4255
4414
|
$ZodCheck.init(inst, def);
|
|
4256
4415
|
$ZodType.init(inst, def);
|
|
4257
|
-
inst._zod.parse = (payload,
|
|
4416
|
+
inst._zod.parse = (payload, _2) => {
|
|
4258
4417
|
return payload;
|
|
4259
4418
|
};
|
|
4260
4419
|
inst._zod.check = (payload) => {
|
|
4261
4420
|
const input = payload.value;
|
|
4262
|
-
const
|
|
4263
|
-
if (
|
|
4264
|
-
return
|
|
4421
|
+
const r2 = def.fn(input);
|
|
4422
|
+
if (r2 instanceof Promise) {
|
|
4423
|
+
return r2.then((r3) => handleRefineResult(r3, payload, input, inst));
|
|
4265
4424
|
}
|
|
4266
|
-
handleRefineResult(
|
|
4425
|
+
handleRefineResult(r2, payload, input, inst);
|
|
4267
4426
|
return;
|
|
4268
4427
|
};
|
|
4269
4428
|
});
|
|
@@ -4349,8 +4508,8 @@ var error = () => {
|
|
|
4349
4508
|
return Sizable[origin] ?? null;
|
|
4350
4509
|
}
|
|
4351
4510
|
const parsedType8 = (data) => {
|
|
4352
|
-
const
|
|
4353
|
-
switch (
|
|
4511
|
+
const t2 = typeof data;
|
|
4512
|
+
switch (t2) {
|
|
4354
4513
|
case "number": {
|
|
4355
4514
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
4356
4515
|
}
|
|
@@ -4366,7 +4525,7 @@ var error = () => {
|
|
|
4366
4525
|
}
|
|
4367
4526
|
}
|
|
4368
4527
|
}
|
|
4369
|
-
return
|
|
4528
|
+
return t2;
|
|
4370
4529
|
};
|
|
4371
4530
|
const Nouns = {
|
|
4372
4531
|
regex: "\u0645\u062F\u062E\u0644",
|
|
@@ -4466,8 +4625,8 @@ var error2 = () => {
|
|
|
4466
4625
|
return Sizable[origin] ?? null;
|
|
4467
4626
|
}
|
|
4468
4627
|
const parsedType8 = (data) => {
|
|
4469
|
-
const
|
|
4470
|
-
switch (
|
|
4628
|
+
const t2 = typeof data;
|
|
4629
|
+
switch (t2) {
|
|
4471
4630
|
case "number": {
|
|
4472
4631
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
4473
4632
|
}
|
|
@@ -4483,7 +4642,7 @@ var error2 = () => {
|
|
|
4483
4642
|
}
|
|
4484
4643
|
}
|
|
4485
4644
|
}
|
|
4486
|
-
return
|
|
4645
|
+
return t2;
|
|
4487
4646
|
};
|
|
4488
4647
|
const Nouns = {
|
|
4489
4648
|
regex: "input",
|
|
@@ -4625,8 +4784,8 @@ var error3 = () => {
|
|
|
4625
4784
|
return Sizable[origin] ?? null;
|
|
4626
4785
|
}
|
|
4627
4786
|
const parsedType8 = (data) => {
|
|
4628
|
-
const
|
|
4629
|
-
switch (
|
|
4787
|
+
const t2 = typeof data;
|
|
4788
|
+
switch (t2) {
|
|
4630
4789
|
case "number": {
|
|
4631
4790
|
return Number.isNaN(data) ? "NaN" : "\u043B\u0456\u043A";
|
|
4632
4791
|
}
|
|
@@ -4642,7 +4801,7 @@ var error3 = () => {
|
|
|
4642
4801
|
}
|
|
4643
4802
|
}
|
|
4644
4803
|
}
|
|
4645
|
-
return
|
|
4804
|
+
return t2;
|
|
4646
4805
|
};
|
|
4647
4806
|
const Nouns = {
|
|
4648
4807
|
regex: "\u0443\u0432\u043E\u0434",
|
|
@@ -4737,8 +4896,8 @@ function be_default() {
|
|
|
4737
4896
|
|
|
4738
4897
|
// ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/bg.js
|
|
4739
4898
|
var parsedType = (data) => {
|
|
4740
|
-
const
|
|
4741
|
-
switch (
|
|
4899
|
+
const t2 = typeof data;
|
|
4900
|
+
switch (t2) {
|
|
4742
4901
|
case "number": {
|
|
4743
4902
|
return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
|
|
4744
4903
|
}
|
|
@@ -4754,7 +4913,7 @@ var parsedType = (data) => {
|
|
|
4754
4913
|
}
|
|
4755
4914
|
}
|
|
4756
4915
|
}
|
|
4757
|
-
return
|
|
4916
|
+
return t2;
|
|
4758
4917
|
};
|
|
4759
4918
|
var error4 = () => {
|
|
4760
4919
|
const Sizable = {
|
|
@@ -4876,8 +5035,8 @@ var error5 = () => {
|
|
|
4876
5035
|
return Sizable[origin] ?? null;
|
|
4877
5036
|
}
|
|
4878
5037
|
const parsedType8 = (data) => {
|
|
4879
|
-
const
|
|
4880
|
-
switch (
|
|
5038
|
+
const t2 = typeof data;
|
|
5039
|
+
switch (t2) {
|
|
4881
5040
|
case "number": {
|
|
4882
5041
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
4883
5042
|
}
|
|
@@ -4893,7 +5052,7 @@ var error5 = () => {
|
|
|
4893
5052
|
}
|
|
4894
5053
|
}
|
|
4895
5054
|
}
|
|
4896
|
-
return
|
|
5055
|
+
return t2;
|
|
4897
5056
|
};
|
|
4898
5057
|
const Nouns = {
|
|
4899
5058
|
regex: "entrada",
|
|
@@ -4996,8 +5155,8 @@ var error6 = () => {
|
|
|
4996
5155
|
return Sizable[origin] ?? null;
|
|
4997
5156
|
}
|
|
4998
5157
|
const parsedType8 = (data) => {
|
|
4999
|
-
const
|
|
5000
|
-
switch (
|
|
5158
|
+
const t2 = typeof data;
|
|
5159
|
+
switch (t2) {
|
|
5001
5160
|
case "number": {
|
|
5002
5161
|
return Number.isNaN(data) ? "NaN" : "\u010D\xEDslo";
|
|
5003
5162
|
}
|
|
@@ -5031,7 +5190,7 @@ var error6 = () => {
|
|
|
5031
5190
|
}
|
|
5032
5191
|
}
|
|
5033
5192
|
}
|
|
5034
|
-
return
|
|
5193
|
+
return t2;
|
|
5035
5194
|
};
|
|
5036
5195
|
const Nouns = {
|
|
5037
5196
|
regex: "regul\xE1rn\xED v\xFDraz",
|
|
@@ -5144,8 +5303,8 @@ var error7 = () => {
|
|
|
5144
5303
|
return TypeNames[type] ?? type;
|
|
5145
5304
|
}
|
|
5146
5305
|
const parsedType8 = (data) => {
|
|
5147
|
-
const
|
|
5148
|
-
switch (
|
|
5306
|
+
const t2 = typeof data;
|
|
5307
|
+
switch (t2) {
|
|
5149
5308
|
case "number": {
|
|
5150
5309
|
return Number.isNaN(data) ? "NaN" : "tal";
|
|
5151
5310
|
}
|
|
@@ -5162,7 +5321,7 @@ var error7 = () => {
|
|
|
5162
5321
|
return "objekt";
|
|
5163
5322
|
}
|
|
5164
5323
|
}
|
|
5165
|
-
return
|
|
5324
|
+
return t2;
|
|
5166
5325
|
};
|
|
5167
5326
|
const Nouns = {
|
|
5168
5327
|
regex: "input",
|
|
@@ -5264,8 +5423,8 @@ var error8 = () => {
|
|
|
5264
5423
|
return Sizable[origin] ?? null;
|
|
5265
5424
|
}
|
|
5266
5425
|
const parsedType8 = (data) => {
|
|
5267
|
-
const
|
|
5268
|
-
switch (
|
|
5426
|
+
const t2 = typeof data;
|
|
5427
|
+
switch (t2) {
|
|
5269
5428
|
case "number": {
|
|
5270
5429
|
return Number.isNaN(data) ? "NaN" : "Zahl";
|
|
5271
5430
|
}
|
|
@@ -5281,7 +5440,7 @@ var error8 = () => {
|
|
|
5281
5440
|
}
|
|
5282
5441
|
}
|
|
5283
5442
|
}
|
|
5284
|
-
return
|
|
5443
|
+
return t2;
|
|
5285
5444
|
};
|
|
5286
5445
|
const Nouns = {
|
|
5287
5446
|
regex: "Eingabe",
|
|
@@ -5371,8 +5530,8 @@ function de_default() {
|
|
|
5371
5530
|
|
|
5372
5531
|
// ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/en.js
|
|
5373
5532
|
var parsedType2 = (data) => {
|
|
5374
|
-
const
|
|
5375
|
-
switch (
|
|
5533
|
+
const t2 = typeof data;
|
|
5534
|
+
switch (t2) {
|
|
5376
5535
|
case "number": {
|
|
5377
5536
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
5378
5537
|
}
|
|
@@ -5388,7 +5547,7 @@ var parsedType2 = (data) => {
|
|
|
5388
5547
|
}
|
|
5389
5548
|
}
|
|
5390
5549
|
}
|
|
5391
|
-
return
|
|
5550
|
+
return t2;
|
|
5392
5551
|
};
|
|
5393
5552
|
var error9 = () => {
|
|
5394
5553
|
const Sizable = {
|
|
@@ -5490,8 +5649,8 @@ function en_default() {
|
|
|
5490
5649
|
|
|
5491
5650
|
// ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/eo.js
|
|
5492
5651
|
var parsedType3 = (data) => {
|
|
5493
|
-
const
|
|
5494
|
-
switch (
|
|
5652
|
+
const t2 = typeof data;
|
|
5653
|
+
switch (t2) {
|
|
5495
5654
|
case "number": {
|
|
5496
5655
|
return Number.isNaN(data) ? "NaN" : "nombro";
|
|
5497
5656
|
}
|
|
@@ -5507,7 +5666,7 @@ var parsedType3 = (data) => {
|
|
|
5507
5666
|
}
|
|
5508
5667
|
}
|
|
5509
5668
|
}
|
|
5510
|
-
return
|
|
5669
|
+
return t2;
|
|
5511
5670
|
};
|
|
5512
5671
|
var error10 = () => {
|
|
5513
5672
|
const Sizable = {
|
|
@@ -5646,8 +5805,8 @@ var error11 = () => {
|
|
|
5646
5805
|
return TypeNames[type] ?? type;
|
|
5647
5806
|
}
|
|
5648
5807
|
const parsedType8 = (data) => {
|
|
5649
|
-
const
|
|
5650
|
-
switch (
|
|
5808
|
+
const t2 = typeof data;
|
|
5809
|
+
switch (t2) {
|
|
5651
5810
|
case "number": {
|
|
5652
5811
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
5653
5812
|
}
|
|
@@ -5664,7 +5823,7 @@ var error11 = () => {
|
|
|
5664
5823
|
return "object";
|
|
5665
5824
|
}
|
|
5666
5825
|
}
|
|
5667
|
-
return
|
|
5826
|
+
return t2;
|
|
5668
5827
|
};
|
|
5669
5828
|
const Nouns = {
|
|
5670
5829
|
regex: "entrada",
|
|
@@ -5767,8 +5926,8 @@ var error12 = () => {
|
|
|
5767
5926
|
return Sizable[origin] ?? null;
|
|
5768
5927
|
}
|
|
5769
5928
|
const parsedType8 = (data) => {
|
|
5770
|
-
const
|
|
5771
|
-
switch (
|
|
5929
|
+
const t2 = typeof data;
|
|
5930
|
+
switch (t2) {
|
|
5772
5931
|
case "number": {
|
|
5773
5932
|
return Number.isNaN(data) ? "NaN" : "\u0639\u062F\u062F";
|
|
5774
5933
|
}
|
|
@@ -5784,7 +5943,7 @@ var error12 = () => {
|
|
|
5784
5943
|
}
|
|
5785
5944
|
}
|
|
5786
5945
|
}
|
|
5787
|
-
return
|
|
5946
|
+
return t2;
|
|
5788
5947
|
};
|
|
5789
5948
|
const Nouns = {
|
|
5790
5949
|
regex: "\u0648\u0631\u0648\u062F\u06CC",
|
|
@@ -5894,8 +6053,8 @@ var error13 = () => {
|
|
|
5894
6053
|
return Sizable[origin] ?? null;
|
|
5895
6054
|
}
|
|
5896
6055
|
const parsedType8 = (data) => {
|
|
5897
|
-
const
|
|
5898
|
-
switch (
|
|
6056
|
+
const t2 = typeof data;
|
|
6057
|
+
switch (t2) {
|
|
5899
6058
|
case "number": {
|
|
5900
6059
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
5901
6060
|
}
|
|
@@ -5911,7 +6070,7 @@ var error13 = () => {
|
|
|
5911
6070
|
}
|
|
5912
6071
|
}
|
|
5913
6072
|
}
|
|
5914
|
-
return
|
|
6073
|
+
return t2;
|
|
5915
6074
|
};
|
|
5916
6075
|
const Nouns = {
|
|
5917
6076
|
regex: "s\xE4\xE4nn\xF6llinen lauseke",
|
|
@@ -6013,8 +6172,8 @@ var error14 = () => {
|
|
|
6013
6172
|
return Sizable[origin] ?? null;
|
|
6014
6173
|
}
|
|
6015
6174
|
const parsedType8 = (data) => {
|
|
6016
|
-
const
|
|
6017
|
-
switch (
|
|
6175
|
+
const t2 = typeof data;
|
|
6176
|
+
switch (t2) {
|
|
6018
6177
|
case "number": {
|
|
6019
6178
|
return Number.isNaN(data) ? "NaN" : "nombre";
|
|
6020
6179
|
}
|
|
@@ -6030,7 +6189,7 @@ var error14 = () => {
|
|
|
6030
6189
|
}
|
|
6031
6190
|
}
|
|
6032
6191
|
}
|
|
6033
|
-
return
|
|
6192
|
+
return t2;
|
|
6034
6193
|
};
|
|
6035
6194
|
const Nouns = {
|
|
6036
6195
|
regex: "entr\xE9e",
|
|
@@ -6130,8 +6289,8 @@ var error15 = () => {
|
|
|
6130
6289
|
return Sizable[origin] ?? null;
|
|
6131
6290
|
}
|
|
6132
6291
|
const parsedType8 = (data) => {
|
|
6133
|
-
const
|
|
6134
|
-
switch (
|
|
6292
|
+
const t2 = typeof data;
|
|
6293
|
+
switch (t2) {
|
|
6135
6294
|
case "number": {
|
|
6136
6295
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
6137
6296
|
}
|
|
@@ -6147,7 +6306,7 @@ var error15 = () => {
|
|
|
6147
6306
|
}
|
|
6148
6307
|
}
|
|
6149
6308
|
}
|
|
6150
|
-
return
|
|
6309
|
+
return t2;
|
|
6151
6310
|
};
|
|
6152
6311
|
const Nouns = {
|
|
6153
6312
|
regex: "entr\xE9e",
|
|
@@ -6266,16 +6425,16 @@ var error16 = () => {
|
|
|
6266
6425
|
number: { unit: "", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" }
|
|
6267
6426
|
// no unit
|
|
6268
6427
|
};
|
|
6269
|
-
const typeEntry = (
|
|
6270
|
-
const typeLabel = (
|
|
6271
|
-
const e = typeEntry(
|
|
6428
|
+
const typeEntry = (t2) => t2 ? TypeNames[t2] : void 0;
|
|
6429
|
+
const typeLabel = (t2) => {
|
|
6430
|
+
const e = typeEntry(t2);
|
|
6272
6431
|
if (e)
|
|
6273
6432
|
return e.label;
|
|
6274
|
-
return
|
|
6433
|
+
return t2 ?? TypeNames.unknown.label;
|
|
6275
6434
|
};
|
|
6276
|
-
const withDefinite = (
|
|
6277
|
-
const verbFor = (
|
|
6278
|
-
const e = typeEntry(
|
|
6435
|
+
const withDefinite = (t2) => `\u05D4${typeLabel(t2)}`;
|
|
6436
|
+
const verbFor = (t2) => {
|
|
6437
|
+
const e = typeEntry(t2);
|
|
6279
6438
|
const gender = e?.gender ?? "m";
|
|
6280
6439
|
return gender === "f" ? "\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA" : "\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA";
|
|
6281
6440
|
};
|
|
@@ -6285,8 +6444,8 @@ var error16 = () => {
|
|
|
6285
6444
|
return Sizable[origin] ?? null;
|
|
6286
6445
|
};
|
|
6287
6446
|
const parsedType8 = (data) => {
|
|
6288
|
-
const
|
|
6289
|
-
switch (
|
|
6447
|
+
const t2 = typeof data;
|
|
6448
|
+
switch (t2) {
|
|
6290
6449
|
case "number":
|
|
6291
6450
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
6292
6451
|
case "object": {
|
|
@@ -6300,7 +6459,7 @@ var error16 = () => {
|
|
|
6300
6459
|
return "object";
|
|
6301
6460
|
}
|
|
6302
6461
|
default:
|
|
6303
|
-
return
|
|
6462
|
+
return t2;
|
|
6304
6463
|
}
|
|
6305
6464
|
};
|
|
6306
6465
|
const Nouns = {
|
|
@@ -6456,8 +6615,8 @@ var error17 = () => {
|
|
|
6456
6615
|
return Sizable[origin] ?? null;
|
|
6457
6616
|
}
|
|
6458
6617
|
const parsedType8 = (data) => {
|
|
6459
|
-
const
|
|
6460
|
-
switch (
|
|
6618
|
+
const t2 = typeof data;
|
|
6619
|
+
switch (t2) {
|
|
6461
6620
|
case "number": {
|
|
6462
6621
|
return Number.isNaN(data) ? "NaN" : "sz\xE1m";
|
|
6463
6622
|
}
|
|
@@ -6473,7 +6632,7 @@ var error17 = () => {
|
|
|
6473
6632
|
}
|
|
6474
6633
|
}
|
|
6475
6634
|
}
|
|
6476
|
-
return
|
|
6635
|
+
return t2;
|
|
6477
6636
|
};
|
|
6478
6637
|
const Nouns = {
|
|
6479
6638
|
regex: "bemenet",
|
|
@@ -6574,8 +6733,8 @@ var error18 = () => {
|
|
|
6574
6733
|
return Sizable[origin] ?? null;
|
|
6575
6734
|
}
|
|
6576
6735
|
const parsedType8 = (data) => {
|
|
6577
|
-
const
|
|
6578
|
-
switch (
|
|
6736
|
+
const t2 = typeof data;
|
|
6737
|
+
switch (t2) {
|
|
6579
6738
|
case "number": {
|
|
6580
6739
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
6581
6740
|
}
|
|
@@ -6591,7 +6750,7 @@ var error18 = () => {
|
|
|
6591
6750
|
}
|
|
6592
6751
|
}
|
|
6593
6752
|
}
|
|
6594
|
-
return
|
|
6753
|
+
return t2;
|
|
6595
6754
|
};
|
|
6596
6755
|
const Nouns = {
|
|
6597
6756
|
regex: "input",
|
|
@@ -6681,8 +6840,8 @@ function id_default() {
|
|
|
6681
6840
|
|
|
6682
6841
|
// ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/is.js
|
|
6683
6842
|
var parsedType4 = (data) => {
|
|
6684
|
-
const
|
|
6685
|
-
switch (
|
|
6843
|
+
const t2 = typeof data;
|
|
6844
|
+
switch (t2) {
|
|
6686
6845
|
case "number": {
|
|
6687
6846
|
return Number.isNaN(data) ? "NaN" : "n\xFAmer";
|
|
6688
6847
|
}
|
|
@@ -6698,7 +6857,7 @@ var parsedType4 = (data) => {
|
|
|
6698
6857
|
}
|
|
6699
6858
|
}
|
|
6700
6859
|
}
|
|
6701
|
-
return
|
|
6860
|
+
return t2;
|
|
6702
6861
|
};
|
|
6703
6862
|
var error19 = () => {
|
|
6704
6863
|
const Sizable = {
|
|
@@ -6809,8 +6968,8 @@ var error20 = () => {
|
|
|
6809
6968
|
return Sizable[origin] ?? null;
|
|
6810
6969
|
}
|
|
6811
6970
|
const parsedType8 = (data) => {
|
|
6812
|
-
const
|
|
6813
|
-
switch (
|
|
6971
|
+
const t2 = typeof data;
|
|
6972
|
+
switch (t2) {
|
|
6814
6973
|
case "number": {
|
|
6815
6974
|
return Number.isNaN(data) ? "NaN" : "numero";
|
|
6816
6975
|
}
|
|
@@ -6826,7 +6985,7 @@ var error20 = () => {
|
|
|
6826
6985
|
}
|
|
6827
6986
|
}
|
|
6828
6987
|
}
|
|
6829
|
-
return
|
|
6988
|
+
return t2;
|
|
6830
6989
|
};
|
|
6831
6990
|
const Nouns = {
|
|
6832
6991
|
regex: "input",
|
|
@@ -6927,8 +7086,8 @@ var error21 = () => {
|
|
|
6927
7086
|
return Sizable[origin] ?? null;
|
|
6928
7087
|
}
|
|
6929
7088
|
const parsedType8 = (data) => {
|
|
6930
|
-
const
|
|
6931
|
-
switch (
|
|
7089
|
+
const t2 = typeof data;
|
|
7090
|
+
switch (t2) {
|
|
6932
7091
|
case "number": {
|
|
6933
7092
|
return Number.isNaN(data) ? "NaN" : "\u6570\u5024";
|
|
6934
7093
|
}
|
|
@@ -6944,7 +7103,7 @@ var error21 = () => {
|
|
|
6944
7103
|
}
|
|
6945
7104
|
}
|
|
6946
7105
|
}
|
|
6947
|
-
return
|
|
7106
|
+
return t2;
|
|
6948
7107
|
};
|
|
6949
7108
|
const Nouns = {
|
|
6950
7109
|
regex: "\u5165\u529B\u5024",
|
|
@@ -7033,8 +7192,8 @@ function ja_default() {
|
|
|
7033
7192
|
|
|
7034
7193
|
// ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/ka.js
|
|
7035
7194
|
var parsedType5 = (data) => {
|
|
7036
|
-
const
|
|
7037
|
-
switch (
|
|
7195
|
+
const t2 = typeof data;
|
|
7196
|
+
switch (t2) {
|
|
7038
7197
|
case "number": {
|
|
7039
7198
|
return Number.isNaN(data) ? "NaN" : "\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";
|
|
7040
7199
|
}
|
|
@@ -7058,7 +7217,7 @@ var parsedType5 = (data) => {
|
|
|
7058
7217
|
symbol: "symbol",
|
|
7059
7218
|
function: "\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0"
|
|
7060
7219
|
};
|
|
7061
|
-
return typeMap[
|
|
7220
|
+
return typeMap[t2] ?? t2;
|
|
7062
7221
|
};
|
|
7063
7222
|
var error22 = () => {
|
|
7064
7223
|
const Sizable = {
|
|
@@ -7169,8 +7328,8 @@ var error23 = () => {
|
|
|
7169
7328
|
return Sizable[origin] ?? null;
|
|
7170
7329
|
}
|
|
7171
7330
|
const parsedType8 = (data) => {
|
|
7172
|
-
const
|
|
7173
|
-
switch (
|
|
7331
|
+
const t2 = typeof data;
|
|
7332
|
+
switch (t2) {
|
|
7174
7333
|
case "number": {
|
|
7175
7334
|
return Number.isNaN(data) ? "\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)" : "\u179B\u17C1\u1781";
|
|
7176
7335
|
}
|
|
@@ -7186,7 +7345,7 @@ var error23 = () => {
|
|
|
7186
7345
|
}
|
|
7187
7346
|
}
|
|
7188
7347
|
}
|
|
7189
|
-
return
|
|
7348
|
+
return t2;
|
|
7190
7349
|
};
|
|
7191
7350
|
const Nouns = {
|
|
7192
7351
|
regex: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",
|
|
@@ -7292,8 +7451,8 @@ var error24 = () => {
|
|
|
7292
7451
|
return Sizable[origin] ?? null;
|
|
7293
7452
|
}
|
|
7294
7453
|
const parsedType8 = (data) => {
|
|
7295
|
-
const
|
|
7296
|
-
switch (
|
|
7454
|
+
const t2 = typeof data;
|
|
7455
|
+
switch (t2) {
|
|
7297
7456
|
case "number": {
|
|
7298
7457
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
7299
7458
|
}
|
|
@@ -7309,7 +7468,7 @@ var error24 = () => {
|
|
|
7309
7468
|
}
|
|
7310
7469
|
}
|
|
7311
7470
|
}
|
|
7312
|
-
return
|
|
7471
|
+
return t2;
|
|
7313
7472
|
};
|
|
7314
7473
|
const Nouns = {
|
|
7315
7474
|
regex: "\uC785\uB825",
|
|
@@ -7404,11 +7563,11 @@ function ko_default() {
|
|
|
7404
7563
|
|
|
7405
7564
|
// ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/lt.js
|
|
7406
7565
|
var parsedType6 = (data) => {
|
|
7407
|
-
const
|
|
7408
|
-
return parsedTypeFromType(
|
|
7566
|
+
const t2 = typeof data;
|
|
7567
|
+
return parsedTypeFromType(t2, data);
|
|
7409
7568
|
};
|
|
7410
|
-
var parsedTypeFromType = (
|
|
7411
|
-
switch (
|
|
7569
|
+
var parsedTypeFromType = (t2, data = void 0) => {
|
|
7570
|
+
switch (t2) {
|
|
7412
7571
|
case "number": {
|
|
7413
7572
|
return Number.isNaN(data) ? "NaN" : "skai\u010Dius";
|
|
7414
7573
|
}
|
|
@@ -7448,7 +7607,7 @@ var parsedTypeFromType = (t, data = void 0) => {
|
|
|
7448
7607
|
return "nulin\u0117 reik\u0161m\u0117";
|
|
7449
7608
|
}
|
|
7450
7609
|
}
|
|
7451
|
-
return
|
|
7610
|
+
return t2;
|
|
7452
7611
|
};
|
|
7453
7612
|
var capitalizeFirstCharacter = (text2) => {
|
|
7454
7613
|
return text2.charAt(0).toUpperCase() + text2.slice(1);
|
|
@@ -7645,8 +7804,8 @@ var error26 = () => {
|
|
|
7645
7804
|
return Sizable[origin] ?? null;
|
|
7646
7805
|
}
|
|
7647
7806
|
const parsedType8 = (data) => {
|
|
7648
|
-
const
|
|
7649
|
-
switch (
|
|
7807
|
+
const t2 = typeof data;
|
|
7808
|
+
switch (t2) {
|
|
7650
7809
|
case "number": {
|
|
7651
7810
|
return Number.isNaN(data) ? "NaN" : "\u0431\u0440\u043E\u0458";
|
|
7652
7811
|
}
|
|
@@ -7662,7 +7821,7 @@ var error26 = () => {
|
|
|
7662
7821
|
}
|
|
7663
7822
|
}
|
|
7664
7823
|
}
|
|
7665
|
-
return
|
|
7824
|
+
return t2;
|
|
7666
7825
|
};
|
|
7667
7826
|
const Nouns = {
|
|
7668
7827
|
regex: "\u0432\u043D\u0435\u0441",
|
|
@@ -7764,8 +7923,8 @@ var error27 = () => {
|
|
|
7764
7923
|
return Sizable[origin] ?? null;
|
|
7765
7924
|
}
|
|
7766
7925
|
const parsedType8 = (data) => {
|
|
7767
|
-
const
|
|
7768
|
-
switch (
|
|
7926
|
+
const t2 = typeof data;
|
|
7927
|
+
switch (t2) {
|
|
7769
7928
|
case "number": {
|
|
7770
7929
|
return Number.isNaN(data) ? "NaN" : "nombor";
|
|
7771
7930
|
}
|
|
@@ -7781,7 +7940,7 @@ var error27 = () => {
|
|
|
7781
7940
|
}
|
|
7782
7941
|
}
|
|
7783
7942
|
}
|
|
7784
|
-
return
|
|
7943
|
+
return t2;
|
|
7785
7944
|
};
|
|
7786
7945
|
const Nouns = {
|
|
7787
7946
|
regex: "input",
|
|
@@ -7881,8 +8040,8 @@ var error28 = () => {
|
|
|
7881
8040
|
return Sizable[origin] ?? null;
|
|
7882
8041
|
}
|
|
7883
8042
|
const parsedType8 = (data) => {
|
|
7884
|
-
const
|
|
7885
|
-
switch (
|
|
8043
|
+
const t2 = typeof data;
|
|
8044
|
+
switch (t2) {
|
|
7886
8045
|
case "number": {
|
|
7887
8046
|
return Number.isNaN(data) ? "NaN" : "getal";
|
|
7888
8047
|
}
|
|
@@ -7898,7 +8057,7 @@ var error28 = () => {
|
|
|
7898
8057
|
}
|
|
7899
8058
|
}
|
|
7900
8059
|
}
|
|
7901
|
-
return
|
|
8060
|
+
return t2;
|
|
7902
8061
|
};
|
|
7903
8062
|
const Nouns = {
|
|
7904
8063
|
regex: "invoer",
|
|
@@ -7999,8 +8158,8 @@ var error29 = () => {
|
|
|
7999
8158
|
return Sizable[origin] ?? null;
|
|
8000
8159
|
}
|
|
8001
8160
|
const parsedType8 = (data) => {
|
|
8002
|
-
const
|
|
8003
|
-
switch (
|
|
8161
|
+
const t2 = typeof data;
|
|
8162
|
+
switch (t2) {
|
|
8004
8163
|
case "number": {
|
|
8005
8164
|
return Number.isNaN(data) ? "NaN" : "tall";
|
|
8006
8165
|
}
|
|
@@ -8016,7 +8175,7 @@ var error29 = () => {
|
|
|
8016
8175
|
}
|
|
8017
8176
|
}
|
|
8018
8177
|
}
|
|
8019
|
-
return
|
|
8178
|
+
return t2;
|
|
8020
8179
|
};
|
|
8021
8180
|
const Nouns = {
|
|
8022
8181
|
regex: "input",
|
|
@@ -8116,8 +8275,8 @@ var error30 = () => {
|
|
|
8116
8275
|
return Sizable[origin] ?? null;
|
|
8117
8276
|
}
|
|
8118
8277
|
const parsedType8 = (data) => {
|
|
8119
|
-
const
|
|
8120
|
-
switch (
|
|
8278
|
+
const t2 = typeof data;
|
|
8279
|
+
switch (t2) {
|
|
8121
8280
|
case "number": {
|
|
8122
8281
|
return Number.isNaN(data) ? "NaN" : "numara";
|
|
8123
8282
|
}
|
|
@@ -8133,7 +8292,7 @@ var error30 = () => {
|
|
|
8133
8292
|
}
|
|
8134
8293
|
}
|
|
8135
8294
|
}
|
|
8136
|
-
return
|
|
8295
|
+
return t2;
|
|
8137
8296
|
};
|
|
8138
8297
|
const Nouns = {
|
|
8139
8298
|
regex: "giren",
|
|
@@ -8234,8 +8393,8 @@ var error31 = () => {
|
|
|
8234
8393
|
return Sizable[origin] ?? null;
|
|
8235
8394
|
}
|
|
8236
8395
|
const parsedType8 = (data) => {
|
|
8237
|
-
const
|
|
8238
|
-
switch (
|
|
8396
|
+
const t2 = typeof data;
|
|
8397
|
+
switch (t2) {
|
|
8239
8398
|
case "number": {
|
|
8240
8399
|
return Number.isNaN(data) ? "NaN" : "\u0639\u062F\u062F";
|
|
8241
8400
|
}
|
|
@@ -8251,7 +8410,7 @@ var error31 = () => {
|
|
|
8251
8410
|
}
|
|
8252
8411
|
}
|
|
8253
8412
|
}
|
|
8254
|
-
return
|
|
8413
|
+
return t2;
|
|
8255
8414
|
};
|
|
8256
8415
|
const Nouns = {
|
|
8257
8416
|
regex: "\u0648\u0631\u0648\u062F\u064A",
|
|
@@ -8357,8 +8516,8 @@ var error32 = () => {
|
|
|
8357
8516
|
return Sizable[origin] ?? null;
|
|
8358
8517
|
}
|
|
8359
8518
|
const parsedType8 = (data) => {
|
|
8360
|
-
const
|
|
8361
|
-
switch (
|
|
8519
|
+
const t2 = typeof data;
|
|
8520
|
+
switch (t2) {
|
|
8362
8521
|
case "number": {
|
|
8363
8522
|
return Number.isNaN(data) ? "NaN" : "liczba";
|
|
8364
8523
|
}
|
|
@@ -8374,7 +8533,7 @@ var error32 = () => {
|
|
|
8374
8533
|
}
|
|
8375
8534
|
}
|
|
8376
8535
|
}
|
|
8377
|
-
return
|
|
8536
|
+
return t2;
|
|
8378
8537
|
};
|
|
8379
8538
|
const Nouns = {
|
|
8380
8539
|
regex: "wyra\u017Cenie",
|
|
@@ -8475,8 +8634,8 @@ var error33 = () => {
|
|
|
8475
8634
|
return Sizable[origin] ?? null;
|
|
8476
8635
|
}
|
|
8477
8636
|
const parsedType8 = (data) => {
|
|
8478
|
-
const
|
|
8479
|
-
switch (
|
|
8637
|
+
const t2 = typeof data;
|
|
8638
|
+
switch (t2) {
|
|
8480
8639
|
case "number": {
|
|
8481
8640
|
return Number.isNaN(data) ? "NaN" : "n\xFAmero";
|
|
8482
8641
|
}
|
|
@@ -8492,7 +8651,7 @@ var error33 = () => {
|
|
|
8492
8651
|
}
|
|
8493
8652
|
}
|
|
8494
8653
|
}
|
|
8495
|
-
return
|
|
8654
|
+
return t2;
|
|
8496
8655
|
};
|
|
8497
8656
|
const Nouns = {
|
|
8498
8657
|
regex: "padr\xE3o",
|
|
@@ -8635,8 +8794,8 @@ var error34 = () => {
|
|
|
8635
8794
|
return Sizable[origin] ?? null;
|
|
8636
8795
|
}
|
|
8637
8796
|
const parsedType8 = (data) => {
|
|
8638
|
-
const
|
|
8639
|
-
switch (
|
|
8797
|
+
const t2 = typeof data;
|
|
8798
|
+
switch (t2) {
|
|
8640
8799
|
case "number": {
|
|
8641
8800
|
return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
|
|
8642
8801
|
}
|
|
@@ -8652,7 +8811,7 @@ var error34 = () => {
|
|
|
8652
8811
|
}
|
|
8653
8812
|
}
|
|
8654
8813
|
}
|
|
8655
|
-
return
|
|
8814
|
+
return t2;
|
|
8656
8815
|
};
|
|
8657
8816
|
const Nouns = {
|
|
8658
8817
|
regex: "\u0432\u0432\u043E\u0434",
|
|
@@ -8757,8 +8916,8 @@ var error35 = () => {
|
|
|
8757
8916
|
return Sizable[origin] ?? null;
|
|
8758
8917
|
}
|
|
8759
8918
|
const parsedType8 = (data) => {
|
|
8760
|
-
const
|
|
8761
|
-
switch (
|
|
8919
|
+
const t2 = typeof data;
|
|
8920
|
+
switch (t2) {
|
|
8762
8921
|
case "number": {
|
|
8763
8922
|
return Number.isNaN(data) ? "NaN" : "\u0161tevilo";
|
|
8764
8923
|
}
|
|
@@ -8774,7 +8933,7 @@ var error35 = () => {
|
|
|
8774
8933
|
}
|
|
8775
8934
|
}
|
|
8776
8935
|
}
|
|
8777
|
-
return
|
|
8936
|
+
return t2;
|
|
8778
8937
|
};
|
|
8779
8938
|
const Nouns = {
|
|
8780
8939
|
regex: "vnos",
|
|
@@ -8875,8 +9034,8 @@ var error36 = () => {
|
|
|
8875
9034
|
return Sizable[origin] ?? null;
|
|
8876
9035
|
}
|
|
8877
9036
|
const parsedType8 = (data) => {
|
|
8878
|
-
const
|
|
8879
|
-
switch (
|
|
9037
|
+
const t2 = typeof data;
|
|
9038
|
+
switch (t2) {
|
|
8880
9039
|
case "number": {
|
|
8881
9040
|
return Number.isNaN(data) ? "NaN" : "antal";
|
|
8882
9041
|
}
|
|
@@ -8892,7 +9051,7 @@ var error36 = () => {
|
|
|
8892
9051
|
}
|
|
8893
9052
|
}
|
|
8894
9053
|
}
|
|
8895
|
-
return
|
|
9054
|
+
return t2;
|
|
8896
9055
|
};
|
|
8897
9056
|
const Nouns = {
|
|
8898
9057
|
regex: "regulj\xE4rt uttryck",
|
|
@@ -8994,8 +9153,8 @@ var error37 = () => {
|
|
|
8994
9153
|
return Sizable[origin] ?? null;
|
|
8995
9154
|
}
|
|
8996
9155
|
const parsedType8 = (data) => {
|
|
8997
|
-
const
|
|
8998
|
-
switch (
|
|
9156
|
+
const t2 = typeof data;
|
|
9157
|
+
switch (t2) {
|
|
8999
9158
|
case "number": {
|
|
9000
9159
|
return Number.isNaN(data) ? "\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1" : "\u0B8E\u0BA3\u0BCD";
|
|
9001
9160
|
}
|
|
@@ -9011,7 +9170,7 @@ var error37 = () => {
|
|
|
9011
9170
|
}
|
|
9012
9171
|
}
|
|
9013
9172
|
}
|
|
9014
|
-
return
|
|
9173
|
+
return t2;
|
|
9015
9174
|
};
|
|
9016
9175
|
const Nouns = {
|
|
9017
9176
|
regex: "\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",
|
|
@@ -9112,8 +9271,8 @@ var error38 = () => {
|
|
|
9112
9271
|
return Sizable[origin] ?? null;
|
|
9113
9272
|
}
|
|
9114
9273
|
const parsedType8 = (data) => {
|
|
9115
|
-
const
|
|
9116
|
-
switch (
|
|
9274
|
+
const t2 = typeof data;
|
|
9275
|
+
switch (t2) {
|
|
9117
9276
|
case "number": {
|
|
9118
9277
|
return Number.isNaN(data) ? "\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)" : "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";
|
|
9119
9278
|
}
|
|
@@ -9129,7 +9288,7 @@ var error38 = () => {
|
|
|
9129
9288
|
}
|
|
9130
9289
|
}
|
|
9131
9290
|
}
|
|
9132
|
-
return
|
|
9291
|
+
return t2;
|
|
9133
9292
|
};
|
|
9134
9293
|
const Nouns = {
|
|
9135
9294
|
regex: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",
|
|
@@ -9220,8 +9379,8 @@ function th_default() {
|
|
|
9220
9379
|
|
|
9221
9380
|
// ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/locales/tr.js
|
|
9222
9381
|
var parsedType7 = (data) => {
|
|
9223
|
-
const
|
|
9224
|
-
switch (
|
|
9382
|
+
const t2 = typeof data;
|
|
9383
|
+
switch (t2) {
|
|
9225
9384
|
case "number": {
|
|
9226
9385
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
9227
9386
|
}
|
|
@@ -9237,7 +9396,7 @@ var parsedType7 = (data) => {
|
|
|
9237
9396
|
}
|
|
9238
9397
|
}
|
|
9239
9398
|
}
|
|
9240
|
-
return
|
|
9399
|
+
return t2;
|
|
9241
9400
|
};
|
|
9242
9401
|
var error39 = () => {
|
|
9243
9402
|
const Sizable = {
|
|
@@ -9346,8 +9505,8 @@ var error40 = () => {
|
|
|
9346
9505
|
return Sizable[origin] ?? null;
|
|
9347
9506
|
}
|
|
9348
9507
|
const parsedType8 = (data) => {
|
|
9349
|
-
const
|
|
9350
|
-
switch (
|
|
9508
|
+
const t2 = typeof data;
|
|
9509
|
+
switch (t2) {
|
|
9351
9510
|
case "number": {
|
|
9352
9511
|
return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
|
|
9353
9512
|
}
|
|
@@ -9363,7 +9522,7 @@ var error40 = () => {
|
|
|
9363
9522
|
}
|
|
9364
9523
|
}
|
|
9365
9524
|
}
|
|
9366
|
-
return
|
|
9525
|
+
return t2;
|
|
9367
9526
|
};
|
|
9368
9527
|
const Nouns = {
|
|
9369
9528
|
regex: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",
|
|
@@ -9469,8 +9628,8 @@ var error41 = () => {
|
|
|
9469
9628
|
return Sizable[origin] ?? null;
|
|
9470
9629
|
}
|
|
9471
9630
|
const parsedType8 = (data) => {
|
|
9472
|
-
const
|
|
9473
|
-
switch (
|
|
9631
|
+
const t2 = typeof data;
|
|
9632
|
+
switch (t2) {
|
|
9474
9633
|
case "number": {
|
|
9475
9634
|
return Number.isNaN(data) ? "NaN" : "\u0646\u0645\u0628\u0631";
|
|
9476
9635
|
}
|
|
@@ -9486,7 +9645,7 @@ var error41 = () => {
|
|
|
9486
9645
|
}
|
|
9487
9646
|
}
|
|
9488
9647
|
}
|
|
9489
|
-
return
|
|
9648
|
+
return t2;
|
|
9490
9649
|
};
|
|
9491
9650
|
const Nouns = {
|
|
9492
9651
|
regex: "\u0627\u0646 \u067E\u0679",
|
|
@@ -9587,8 +9746,8 @@ var error42 = () => {
|
|
|
9587
9746
|
return Sizable[origin] ?? null;
|
|
9588
9747
|
}
|
|
9589
9748
|
const parsedType8 = (data) => {
|
|
9590
|
-
const
|
|
9591
|
-
switch (
|
|
9749
|
+
const t2 = typeof data;
|
|
9750
|
+
switch (t2) {
|
|
9592
9751
|
case "number": {
|
|
9593
9752
|
return Number.isNaN(data) ? "NaN" : "s\u1ED1";
|
|
9594
9753
|
}
|
|
@@ -9604,7 +9763,7 @@ var error42 = () => {
|
|
|
9604
9763
|
}
|
|
9605
9764
|
}
|
|
9606
9765
|
}
|
|
9607
|
-
return
|
|
9766
|
+
return t2;
|
|
9608
9767
|
};
|
|
9609
9768
|
const Nouns = {
|
|
9610
9769
|
regex: "\u0111\u1EA7u v\xE0o",
|
|
@@ -9704,8 +9863,8 @@ var error43 = () => {
|
|
|
9704
9863
|
return Sizable[origin] ?? null;
|
|
9705
9864
|
}
|
|
9706
9865
|
const parsedType8 = (data) => {
|
|
9707
|
-
const
|
|
9708
|
-
switch (
|
|
9866
|
+
const t2 = typeof data;
|
|
9867
|
+
switch (t2) {
|
|
9709
9868
|
case "number": {
|
|
9710
9869
|
return Number.isNaN(data) ? "\u975E\u6570\u5B57(NaN)" : "\u6570\u5B57";
|
|
9711
9870
|
}
|
|
@@ -9721,7 +9880,7 @@ var error43 = () => {
|
|
|
9721
9880
|
}
|
|
9722
9881
|
}
|
|
9723
9882
|
}
|
|
9724
|
-
return
|
|
9883
|
+
return t2;
|
|
9725
9884
|
};
|
|
9726
9885
|
const Nouns = {
|
|
9727
9886
|
regex: "\u8F93\u5165",
|
|
@@ -9821,8 +9980,8 @@ var error44 = () => {
|
|
|
9821
9980
|
return Sizable[origin] ?? null;
|
|
9822
9981
|
}
|
|
9823
9982
|
const parsedType8 = (data) => {
|
|
9824
|
-
const
|
|
9825
|
-
switch (
|
|
9983
|
+
const t2 = typeof data;
|
|
9984
|
+
switch (t2) {
|
|
9826
9985
|
case "number": {
|
|
9827
9986
|
return Number.isNaN(data) ? "NaN" : "number";
|
|
9828
9987
|
}
|
|
@@ -9838,7 +9997,7 @@ var error44 = () => {
|
|
|
9838
9997
|
}
|
|
9839
9998
|
}
|
|
9840
9999
|
}
|
|
9841
|
-
return
|
|
10000
|
+
return t2;
|
|
9842
10001
|
};
|
|
9843
10002
|
const Nouns = {
|
|
9844
10003
|
regex: "\u8F38\u5165",
|
|
@@ -9939,8 +10098,8 @@ var error45 = () => {
|
|
|
9939
10098
|
return Sizable[origin] ?? null;
|
|
9940
10099
|
}
|
|
9941
10100
|
const parsedType8 = (data) => {
|
|
9942
|
-
const
|
|
9943
|
-
switch (
|
|
10101
|
+
const t2 = typeof data;
|
|
10102
|
+
switch (t2) {
|
|
9944
10103
|
case "number": {
|
|
9945
10104
|
return Number.isNaN(data) ? "NaN" : "n\u1ECD\u0301mb\xE0";
|
|
9946
10105
|
}
|
|
@@ -9956,7 +10115,7 @@ var error45 = () => {
|
|
|
9956
10115
|
}
|
|
9957
10116
|
}
|
|
9958
10117
|
}
|
|
9959
|
-
return
|
|
10118
|
+
return t2;
|
|
9960
10119
|
};
|
|
9961
10120
|
const Nouns = {
|
|
9962
10121
|
regex: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",
|
|
@@ -10077,9 +10236,9 @@ var $ZodRegistry = class {
|
|
|
10077
10236
|
return this;
|
|
10078
10237
|
}
|
|
10079
10238
|
get(schema) {
|
|
10080
|
-
const
|
|
10081
|
-
if (
|
|
10082
|
-
const pm = { ...this.get(
|
|
10239
|
+
const p = schema._zod.parent;
|
|
10240
|
+
if (p) {
|
|
10241
|
+
const pm = { ...this.get(p) ?? {} };
|
|
10083
10242
|
delete pm.id;
|
|
10084
10243
|
const f2 = { ...pm, ...this._map.get(schema) };
|
|
10085
10244
|
return Object.keys(f2).length ? f2 : void 0;
|
|
@@ -10997,13 +11156,13 @@ function _stringbool(Classes, _params) {
|
|
|
10997
11156
|
});
|
|
10998
11157
|
return codec2;
|
|
10999
11158
|
}
|
|
11000
|
-
function _stringFormat(Class2,
|
|
11159
|
+
function _stringFormat(Class2, format2, fnOrRegex, _params = {}) {
|
|
11001
11160
|
const params = normalizeParams(_params);
|
|
11002
11161
|
const def = {
|
|
11003
11162
|
...normalizeParams(_params),
|
|
11004
11163
|
check: "string_format",
|
|
11005
11164
|
type: "string",
|
|
11006
|
-
format,
|
|
11165
|
+
format: format2,
|
|
11007
11166
|
fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
|
|
11008
11167
|
...params
|
|
11009
11168
|
};
|
|
@@ -11068,13 +11227,13 @@ var JSONSchemaGenerator = class {
|
|
|
11068
11227
|
case "string": {
|
|
11069
11228
|
const json2 = _json;
|
|
11070
11229
|
json2.type = "string";
|
|
11071
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
11230
|
+
const { minimum, maximum, format: format2, patterns, contentEncoding } = schema._zod.bag;
|
|
11072
11231
|
if (typeof minimum === "number")
|
|
11073
11232
|
json2.minLength = minimum;
|
|
11074
11233
|
if (typeof maximum === "number")
|
|
11075
11234
|
json2.maxLength = maximum;
|
|
11076
|
-
if (
|
|
11077
|
-
json2.format = formatMap[
|
|
11235
|
+
if (format2) {
|
|
11236
|
+
json2.format = formatMap[format2] ?? format2;
|
|
11078
11237
|
if (json2.format === "")
|
|
11079
11238
|
delete json2.format;
|
|
11080
11239
|
}
|
|
@@ -11097,8 +11256,8 @@ var JSONSchemaGenerator = class {
|
|
|
11097
11256
|
}
|
|
11098
11257
|
case "number": {
|
|
11099
11258
|
const json2 = _json;
|
|
11100
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
11101
|
-
if (typeof
|
|
11259
|
+
const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
11260
|
+
if (typeof format2 === "string" && format2.includes("int"))
|
|
11102
11261
|
json2.type = "integer";
|
|
11103
11262
|
else
|
|
11104
11263
|
json2.type = "number";
|
|
@@ -11244,9 +11403,9 @@ var JSONSchemaGenerator = class {
|
|
|
11244
11403
|
case "union": {
|
|
11245
11404
|
const json2 = _json;
|
|
11246
11405
|
const isDiscriminated = def.discriminator !== void 0;
|
|
11247
|
-
const options = def.options.map((
|
|
11406
|
+
const options = def.options.map((x2, i3) => this.process(x2, {
|
|
11248
11407
|
...params,
|
|
11249
|
-
path: [...params.path, isDiscriminated ? "oneOf" : "anyOf",
|
|
11408
|
+
path: [...params.path, isDiscriminated ? "oneOf" : "anyOf", i3]
|
|
11250
11409
|
}));
|
|
11251
11410
|
if (isDiscriminated) {
|
|
11252
11411
|
json2.oneOf = options;
|
|
@@ -11278,9 +11437,9 @@ var JSONSchemaGenerator = class {
|
|
|
11278
11437
|
json2.type = "array";
|
|
11279
11438
|
const prefixPath = this.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
11280
11439
|
const restPath = this.target === "draft-2020-12" ? "items" : this.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
11281
|
-
const prefixItems = def.items.map((
|
|
11440
|
+
const prefixItems = def.items.map((x2, i3) => this.process(x2, {
|
|
11282
11441
|
...params,
|
|
11283
|
-
path: [...params.path, prefixPath,
|
|
11442
|
+
path: [...params.path, prefixPath, i3]
|
|
11284
11443
|
}));
|
|
11285
11444
|
const rest = def.rest ? this.process(def.rest, {
|
|
11286
11445
|
...params,
|
|
@@ -11701,7 +11860,7 @@ function toJSONSchema(input, _params) {
|
|
|
11701
11860
|
const gen2 = new JSONSchemaGenerator(_params);
|
|
11702
11861
|
const defs = {};
|
|
11703
11862
|
for (const entry of input._idmap.entries()) {
|
|
11704
|
-
const [
|
|
11863
|
+
const [_2, schema] = entry;
|
|
11705
11864
|
gen2.process(schema);
|
|
11706
11865
|
}
|
|
11707
11866
|
const schemas = {};
|
|
@@ -12067,7 +12226,7 @@ var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
|
|
|
12067
12226
|
$ZodNanoID.init(inst, def);
|
|
12068
12227
|
ZodStringFormat.init(inst, def);
|
|
12069
12228
|
});
|
|
12070
|
-
function
|
|
12229
|
+
function nanoid3(params) {
|
|
12071
12230
|
return _nanoid(ZodNanoID, params);
|
|
12072
12231
|
}
|
|
12073
12232
|
var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
|
|
@@ -12172,8 +12331,8 @@ var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat"
|
|
|
12172
12331
|
$ZodCustomStringFormat.init(inst, def);
|
|
12173
12332
|
ZodStringFormat.init(inst, def);
|
|
12174
12333
|
});
|
|
12175
|
-
function stringFormat(
|
|
12176
|
-
return _stringFormat(ZodCustomStringFormat,
|
|
12334
|
+
function stringFormat(format2, fnOrRegex, _params = {}) {
|
|
12335
|
+
return _stringFormat(ZodCustomStringFormat, format2, fnOrRegex, _params);
|
|
12177
12336
|
}
|
|
12178
12337
|
function hostname2(_params) {
|
|
12179
12338
|
return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
|
|
@@ -12183,11 +12342,11 @@ function hex2(_params) {
|
|
|
12183
12342
|
}
|
|
12184
12343
|
function hash(alg, params) {
|
|
12185
12344
|
const enc = params?.enc ?? "hex";
|
|
12186
|
-
const
|
|
12187
|
-
const regex = regexes_exports[
|
|
12345
|
+
const format2 = `${alg}_${enc}`;
|
|
12346
|
+
const regex = regexes_exports[format2];
|
|
12188
12347
|
if (!regex)
|
|
12189
|
-
throw new Error(`Unrecognized hash format: ${
|
|
12190
|
-
return _stringFormat(ZodCustomStringFormat,
|
|
12348
|
+
throw new Error(`Unrecognized hash format: ${format2}`);
|
|
12349
|
+
return _stringFormat(ZodCustomStringFormat, format2, regex, params);
|
|
12191
12350
|
}
|
|
12192
12351
|
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
12193
12352
|
$ZodNumber.init(inst, def);
|
|
@@ -12331,9 +12490,9 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
|
12331
12490
|
ZodType.init(inst, def);
|
|
12332
12491
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
12333
12492
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
12334
|
-
const
|
|
12335
|
-
inst.minDate =
|
|
12336
|
-
inst.maxDate =
|
|
12493
|
+
const c2 = inst._zod.bag;
|
|
12494
|
+
inst.minDate = c2.minimum ? new Date(c2.minimum) : null;
|
|
12495
|
+
inst.maxDate = c2.maximum ? new Date(c2.maximum) : null;
|
|
12337
12496
|
});
|
|
12338
12497
|
function date3(params) {
|
|
12339
12498
|
return _date(ZodDate, params);
|
|
@@ -12916,7 +13075,7 @@ config(en_default());
|
|
|
12916
13075
|
// ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v3/helpers/util.js
|
|
12917
13076
|
var util;
|
|
12918
13077
|
(function(util2) {
|
|
12919
|
-
util2.assertEqual = (
|
|
13078
|
+
util2.assertEqual = (_2) => {
|
|
12920
13079
|
};
|
|
12921
13080
|
function assertIs2(_arg) {
|
|
12922
13081
|
}
|
|
@@ -12966,7 +13125,7 @@ var util;
|
|
|
12966
13125
|
return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
12967
13126
|
}
|
|
12968
13127
|
util2.joinValues = joinValues2;
|
|
12969
|
-
util2.jsonStringifyReplacer = (
|
|
13128
|
+
util2.jsonStringifyReplacer = (_2, value) => {
|
|
12970
13129
|
if (typeof value === "bigint") {
|
|
12971
13130
|
return value.toString();
|
|
12972
13131
|
}
|
|
@@ -13064,10 +13223,10 @@ var ZodError2 = class _ZodError extends Error {
|
|
|
13064
13223
|
fieldErrors._errors.push(mapper(issue2));
|
|
13065
13224
|
} else {
|
|
13066
13225
|
let curr = fieldErrors;
|
|
13067
|
-
let
|
|
13068
|
-
while (
|
|
13069
|
-
const el = issue2.path[
|
|
13070
|
-
const terminal =
|
|
13226
|
+
let i3 = 0;
|
|
13227
|
+
while (i3 < issue2.path.length) {
|
|
13228
|
+
const el = issue2.path[i3];
|
|
13229
|
+
const terminal = i3 === issue2.path.length - 1;
|
|
13071
13230
|
if (!terminal) {
|
|
13072
13231
|
curr[el] = curr[el] || { _errors: [] };
|
|
13073
13232
|
} else {
|
|
@@ -13075,7 +13234,7 @@ var ZodError2 = class _ZodError extends Error {
|
|
|
13075
13234
|
curr[el]._errors.push(mapper(issue2));
|
|
13076
13235
|
}
|
|
13077
13236
|
curr = curr[el];
|
|
13078
|
-
|
|
13237
|
+
i3++;
|
|
13079
13238
|
}
|
|
13080
13239
|
}
|
|
13081
13240
|
}
|
|
@@ -13176,8 +13335,8 @@ var createIdGenerator = ({
|
|
|
13176
13335
|
const generator = () => {
|
|
13177
13336
|
const alphabetLength = alphabet.length;
|
|
13178
13337
|
const chars = new Array(size);
|
|
13179
|
-
for (let
|
|
13180
|
-
chars[
|
|
13338
|
+
for (let i3 = 0; i3 < size; i3++) {
|
|
13339
|
+
chars[i3] = alphabet[Math.random() * alphabetLength | 0];
|
|
13181
13340
|
}
|
|
13182
13341
|
return chars.join("");
|
|
13183
13342
|
};
|
|
@@ -13393,11 +13552,11 @@ async function resolve(value) {
|
|
|
13393
13552
|
return Promise.resolve(value);
|
|
13394
13553
|
}
|
|
13395
13554
|
var getRelativePath = (pathA, pathB) => {
|
|
13396
|
-
let
|
|
13397
|
-
for (;
|
|
13398
|
-
if (pathA[
|
|
13555
|
+
let i3 = 0;
|
|
13556
|
+
for (; i3 < pathA.length && i3 < pathB.length; i3++) {
|
|
13557
|
+
if (pathA[i3] !== pathB[i3]) break;
|
|
13399
13558
|
}
|
|
13400
|
-
return [(pathA.length -
|
|
13559
|
+
return [(pathA.length - i3).toString(), ...pathB.slice(i3)].join("/");
|
|
13401
13560
|
};
|
|
13402
13561
|
var ignoreOverride = Symbol(
|
|
13403
13562
|
"Let zodToJsonSchema decide on which parser to use"
|
|
@@ -13498,7 +13657,7 @@ function parseDateDef(def, refs, overrideDateStrategy) {
|
|
|
13498
13657
|
const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
|
|
13499
13658
|
if (Array.isArray(strategy)) {
|
|
13500
13659
|
return {
|
|
13501
|
-
anyOf: strategy.map((item,
|
|
13660
|
+
anyOf: strategy.map((item, i3) => parseDateDef(def, refs, item))
|
|
13502
13661
|
};
|
|
13503
13662
|
}
|
|
13504
13663
|
switch (strategy) {
|
|
@@ -13563,7 +13722,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
13563
13722
|
...refs,
|
|
13564
13723
|
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
13565
13724
|
})
|
|
13566
|
-
].filter((
|
|
13725
|
+
].filter((x2) => !!x2);
|
|
13567
13726
|
const mergedAllOf = [];
|
|
13568
13727
|
allOf.forEach((schema) => {
|
|
13569
13728
|
if (isJsonSchema7AllOfType(schema)) {
|
|
@@ -13788,17 +13947,17 @@ var ALPHA_NUMERIC = new Set(
|
|
|
13788
13947
|
);
|
|
13789
13948
|
function escapeNonAlphaNumeric(source) {
|
|
13790
13949
|
let result = "";
|
|
13791
|
-
for (let
|
|
13792
|
-
if (!ALPHA_NUMERIC.has(source[
|
|
13950
|
+
for (let i3 = 0; i3 < source.length; i3++) {
|
|
13951
|
+
if (!ALPHA_NUMERIC.has(source[i3])) {
|
|
13793
13952
|
result += "\\";
|
|
13794
13953
|
}
|
|
13795
|
-
result += source[
|
|
13954
|
+
result += source[i3];
|
|
13796
13955
|
}
|
|
13797
13956
|
return result;
|
|
13798
13957
|
}
|
|
13799
13958
|
function addFormat(schema, value, message, refs) {
|
|
13800
13959
|
var _a17;
|
|
13801
|
-
if (schema.format || ((_a17 = schema.anyOf) == null ? void 0 : _a17.some((
|
|
13960
|
+
if (schema.format || ((_a17 = schema.anyOf) == null ? void 0 : _a17.some((x2) => x2.format))) {
|
|
13802
13961
|
if (!schema.anyOf) {
|
|
13803
13962
|
schema.anyOf = [];
|
|
13804
13963
|
}
|
|
@@ -13818,7 +13977,7 @@ function addFormat(schema, value, message, refs) {
|
|
|
13818
13977
|
}
|
|
13819
13978
|
function addPattern(schema, regex, message, refs) {
|
|
13820
13979
|
var _a17;
|
|
13821
|
-
if (schema.pattern || ((_a17 = schema.allOf) == null ? void 0 : _a17.some((
|
|
13980
|
+
if (schema.pattern || ((_a17 = schema.allOf) == null ? void 0 : _a17.some((x2) => x2.pattern))) {
|
|
13822
13981
|
if (!schema.allOf) {
|
|
13823
13982
|
schema.allOf = [];
|
|
13824
13983
|
}
|
|
@@ -13854,55 +14013,55 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
13854
14013
|
let isEscaped = false;
|
|
13855
14014
|
let inCharGroup = false;
|
|
13856
14015
|
let inCharRange = false;
|
|
13857
|
-
for (let
|
|
14016
|
+
for (let i3 = 0; i3 < source.length; i3++) {
|
|
13858
14017
|
if (isEscaped) {
|
|
13859
|
-
pattern += source[
|
|
14018
|
+
pattern += source[i3];
|
|
13860
14019
|
isEscaped = false;
|
|
13861
14020
|
continue;
|
|
13862
14021
|
}
|
|
13863
14022
|
if (flags.i) {
|
|
13864
14023
|
if (inCharGroup) {
|
|
13865
|
-
if (source[
|
|
14024
|
+
if (source[i3].match(/[a-z]/)) {
|
|
13866
14025
|
if (inCharRange) {
|
|
13867
|
-
pattern += source[
|
|
13868
|
-
pattern += `${source[
|
|
14026
|
+
pattern += source[i3];
|
|
14027
|
+
pattern += `${source[i3 - 2]}-${source[i3]}`.toUpperCase();
|
|
13869
14028
|
inCharRange = false;
|
|
13870
|
-
} else if (source[
|
|
13871
|
-
pattern += source[
|
|
14029
|
+
} else if (source[i3 + 1] === "-" && ((_a17 = source[i3 + 2]) == null ? void 0 : _a17.match(/[a-z]/))) {
|
|
14030
|
+
pattern += source[i3];
|
|
13872
14031
|
inCharRange = true;
|
|
13873
14032
|
} else {
|
|
13874
|
-
pattern += `${source[
|
|
14033
|
+
pattern += `${source[i3]}${source[i3].toUpperCase()}`;
|
|
13875
14034
|
}
|
|
13876
14035
|
continue;
|
|
13877
14036
|
}
|
|
13878
|
-
} else if (source[
|
|
13879
|
-
pattern += `[${source[
|
|
14037
|
+
} else if (source[i3].match(/[a-z]/)) {
|
|
14038
|
+
pattern += `[${source[i3]}${source[i3].toUpperCase()}]`;
|
|
13880
14039
|
continue;
|
|
13881
14040
|
}
|
|
13882
14041
|
}
|
|
13883
14042
|
if (flags.m) {
|
|
13884
|
-
if (source[
|
|
14043
|
+
if (source[i3] === "^") {
|
|
13885
14044
|
pattern += `(^|(?<=[\r
|
|
13886
14045
|
]))`;
|
|
13887
14046
|
continue;
|
|
13888
|
-
} else if (source[
|
|
14047
|
+
} else if (source[i3] === "$") {
|
|
13889
14048
|
pattern += `($|(?=[\r
|
|
13890
14049
|
]))`;
|
|
13891
14050
|
continue;
|
|
13892
14051
|
}
|
|
13893
14052
|
}
|
|
13894
|
-
if (flags.s && source[
|
|
13895
|
-
pattern += inCharGroup ? `${source[
|
|
13896
|
-
` : `[${source[
|
|
14053
|
+
if (flags.s && source[i3] === ".") {
|
|
14054
|
+
pattern += inCharGroup ? `${source[i3]}\r
|
|
14055
|
+
` : `[${source[i3]}\r
|
|
13897
14056
|
]`;
|
|
13898
14057
|
continue;
|
|
13899
14058
|
}
|
|
13900
|
-
pattern += source[
|
|
13901
|
-
if (source[
|
|
14059
|
+
pattern += source[i3];
|
|
14060
|
+
if (source[i3] === "\\") {
|
|
13902
14061
|
isEscaped = true;
|
|
13903
|
-
} else if (inCharGroup && source[
|
|
14062
|
+
} else if (inCharGroup && source[i3] === "]") {
|
|
13904
14063
|
inCharGroup = false;
|
|
13905
|
-
} else if (!inCharGroup && source[
|
|
14064
|
+
} else if (!inCharGroup && source[i3] === "[") {
|
|
13906
14065
|
inCharGroup = true;
|
|
13907
14066
|
}
|
|
13908
14067
|
}
|
|
@@ -14007,19 +14166,19 @@ var primitiveMappings = {
|
|
|
14007
14166
|
function parseUnionDef(def, refs) {
|
|
14008
14167
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
14009
14168
|
if (options.every(
|
|
14010
|
-
(
|
|
14169
|
+
(x2) => x2._def.typeName in primitiveMappings && (!x2._def.checks || !x2._def.checks.length)
|
|
14011
14170
|
)) {
|
|
14012
|
-
const types = options.reduce((types2,
|
|
14013
|
-
const type = primitiveMappings[
|
|
14171
|
+
const types = options.reduce((types2, x2) => {
|
|
14172
|
+
const type = primitiveMappings[x2._def.typeName];
|
|
14014
14173
|
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
14015
14174
|
}, []);
|
|
14016
14175
|
return {
|
|
14017
14176
|
type: types.length > 1 ? types : types[0]
|
|
14018
14177
|
};
|
|
14019
|
-
} else if (options.every((
|
|
14178
|
+
} else if (options.every((x2) => x2._def.typeName === "ZodLiteral" && !x2.description)) {
|
|
14020
14179
|
const types = options.reduce(
|
|
14021
|
-
(acc,
|
|
14022
|
-
const type = typeof
|
|
14180
|
+
(acc, x2) => {
|
|
14181
|
+
const type = typeof x2._def.value;
|
|
14023
14182
|
switch (type) {
|
|
14024
14183
|
case "string":
|
|
14025
14184
|
case "number":
|
|
@@ -14028,7 +14187,7 @@ function parseUnionDef(def, refs) {
|
|
|
14028
14187
|
case "bigint":
|
|
14029
14188
|
return [...acc, "integer"];
|
|
14030
14189
|
case "object":
|
|
14031
|
-
if (
|
|
14190
|
+
if (x2._def.value === null) return [...acc, "null"];
|
|
14032
14191
|
case "symbol":
|
|
14033
14192
|
case "undefined":
|
|
14034
14193
|
case "function":
|
|
@@ -14039,24 +14198,24 @@ function parseUnionDef(def, refs) {
|
|
|
14039
14198
|
[]
|
|
14040
14199
|
);
|
|
14041
14200
|
if (types.length === options.length) {
|
|
14042
|
-
const uniqueTypes = types.filter((
|
|
14201
|
+
const uniqueTypes = types.filter((x2, i3, a2) => a2.indexOf(x2) === i3);
|
|
14043
14202
|
return {
|
|
14044
14203
|
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
14045
14204
|
enum: options.reduce(
|
|
14046
|
-
(acc,
|
|
14047
|
-
return acc.includes(
|
|
14205
|
+
(acc, x2) => {
|
|
14206
|
+
return acc.includes(x2._def.value) ? acc : [...acc, x2._def.value];
|
|
14048
14207
|
},
|
|
14049
14208
|
[]
|
|
14050
14209
|
)
|
|
14051
14210
|
};
|
|
14052
14211
|
}
|
|
14053
|
-
} else if (options.every((
|
|
14212
|
+
} else if (options.every((x2) => x2._def.typeName === "ZodEnum")) {
|
|
14054
14213
|
return {
|
|
14055
14214
|
type: "string",
|
|
14056
14215
|
enum: options.reduce(
|
|
14057
|
-
(acc,
|
|
14216
|
+
(acc, x2) => [
|
|
14058
14217
|
...acc,
|
|
14059
|
-
...
|
|
14218
|
+
...x2._def.values.filter((x22) => !acc.includes(x22))
|
|
14060
14219
|
],
|
|
14061
14220
|
[]
|
|
14062
14221
|
)
|
|
@@ -14066,12 +14225,12 @@ function parseUnionDef(def, refs) {
|
|
|
14066
14225
|
}
|
|
14067
14226
|
var asAnyOf = (def, refs) => {
|
|
14068
14227
|
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
|
|
14069
|
-
(
|
|
14228
|
+
(x2, i3) => parseDef(x2._def, {
|
|
14070
14229
|
...refs,
|
|
14071
|
-
currentPath: [...refs.currentPath, "anyOf", `${
|
|
14230
|
+
currentPath: [...refs.currentPath, "anyOf", `${i3}`]
|
|
14072
14231
|
})
|
|
14073
14232
|
).filter(
|
|
14074
|
-
(
|
|
14233
|
+
(x2) => !!x2 && (!refs.strictUnions || typeof x2 === "object" && Object.keys(x2).length > 0)
|
|
14075
14234
|
);
|
|
14076
14235
|
return anyOf.length ? { anyOf } : void 0;
|
|
14077
14236
|
};
|
|
@@ -14207,7 +14366,7 @@ var parsePipelineDef = (def, refs) => {
|
|
|
14207
14366
|
currentPath: [...refs.currentPath, "allOf", a2 ? "1" : "0"]
|
|
14208
14367
|
});
|
|
14209
14368
|
return {
|
|
14210
|
-
allOf: [a2, b2].filter((
|
|
14369
|
+
allOf: [a2, b2].filter((x2) => x2 !== void 0)
|
|
14211
14370
|
};
|
|
14212
14371
|
};
|
|
14213
14372
|
function parsePromiseDef(def, refs) {
|
|
@@ -14237,12 +14396,12 @@ function parseTupleDef(def, refs) {
|
|
|
14237
14396
|
type: "array",
|
|
14238
14397
|
minItems: def.items.length,
|
|
14239
14398
|
items: def.items.map(
|
|
14240
|
-
(
|
|
14399
|
+
(x2, i3) => parseDef(x2._def, {
|
|
14241
14400
|
...refs,
|
|
14242
|
-
currentPath: [...refs.currentPath, "items", `${
|
|
14401
|
+
currentPath: [...refs.currentPath, "items", `${i3}`]
|
|
14243
14402
|
})
|
|
14244
14403
|
).reduce(
|
|
14245
|
-
(acc,
|
|
14404
|
+
(acc, x2) => x2 === void 0 ? acc : [...acc, x2],
|
|
14246
14405
|
[]
|
|
14247
14406
|
),
|
|
14248
14407
|
additionalItems: parseDef(def.rest._def, {
|
|
@@ -14256,12 +14415,12 @@ function parseTupleDef(def, refs) {
|
|
|
14256
14415
|
minItems: def.items.length,
|
|
14257
14416
|
maxItems: def.items.length,
|
|
14258
14417
|
items: def.items.map(
|
|
14259
|
-
(
|
|
14418
|
+
(x2, i3) => parseDef(x2._def, {
|
|
14260
14419
|
...refs,
|
|
14261
|
-
currentPath: [...refs.currentPath, "items", `${
|
|
14420
|
+
currentPath: [...refs.currentPath, "items", `${i3}`]
|
|
14262
14421
|
})
|
|
14263
14422
|
).reduce(
|
|
14264
|
-
(acc,
|
|
14423
|
+
(acc, x2) => x2 === void 0 ? acc : [...acc, x2],
|
|
14265
14424
|
[]
|
|
14266
14425
|
)
|
|
14267
14426
|
};
|
|
@@ -14349,7 +14508,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
14349
14508
|
case ZodFirstPartyTypeKind2.ZodSymbol:
|
|
14350
14509
|
return void 0;
|
|
14351
14510
|
default:
|
|
14352
|
-
return /* @__PURE__ */ ((
|
|
14511
|
+
return /* @__PURE__ */ ((_2) => void 0)();
|
|
14353
14512
|
}
|
|
14354
14513
|
};
|
|
14355
14514
|
function parseDef(def, refs, forceResolution = false) {
|
|
@@ -14557,7 +14716,7 @@ function asSchema(schema) {
|
|
|
14557
14716
|
}) : isSchema(schema) ? schema : typeof schema === "function" ? schema() : zodSchema(schema);
|
|
14558
14717
|
}
|
|
14559
14718
|
|
|
14560
|
-
// ../../node_modules/.pnpm/ai@5.0.
|
|
14719
|
+
// ../../node_modules/.pnpm/ai@5.0.108_zod@4.1.13/node_modules/ai/dist/index.mjs
|
|
14561
14720
|
var __defProp2 = Object.defineProperty;
|
|
14562
14721
|
var __export2 = (target, all) => {
|
|
14563
14722
|
for (var name16 in all)
|
|
@@ -14588,7 +14747,7 @@ var NoObjectGeneratedError = class extends AISDKError {
|
|
|
14588
14747
|
}
|
|
14589
14748
|
};
|
|
14590
14749
|
_a62 = symbol62;
|
|
14591
|
-
var VERSION = "5.0.
|
|
14750
|
+
var VERSION = "5.0.108" ;
|
|
14592
14751
|
var dataContentSchema = external_exports.union([
|
|
14593
14752
|
external_exports.string(),
|
|
14594
14753
|
external_exports.instanceof(Uint8Array),
|
|
@@ -14935,11 +15094,11 @@ function fixJson(input) {
|
|
|
14935
15094
|
const stack = ["ROOT"];
|
|
14936
15095
|
let lastValidIndex = -1;
|
|
14937
15096
|
let literalStart = null;
|
|
14938
|
-
function processValueStart(char,
|
|
15097
|
+
function processValueStart(char, i3, swapState) {
|
|
14939
15098
|
{
|
|
14940
15099
|
switch (char) {
|
|
14941
15100
|
case '"': {
|
|
14942
|
-
lastValidIndex =
|
|
15101
|
+
lastValidIndex = i3;
|
|
14943
15102
|
stack.pop();
|
|
14944
15103
|
stack.push(swapState);
|
|
14945
15104
|
stack.push("INSIDE_STRING");
|
|
@@ -14948,8 +15107,8 @@ function fixJson(input) {
|
|
|
14948
15107
|
case "f":
|
|
14949
15108
|
case "t":
|
|
14950
15109
|
case "n": {
|
|
14951
|
-
lastValidIndex =
|
|
14952
|
-
literalStart =
|
|
15110
|
+
lastValidIndex = i3;
|
|
15111
|
+
literalStart = i3;
|
|
14953
15112
|
stack.pop();
|
|
14954
15113
|
stack.push(swapState);
|
|
14955
15114
|
stack.push("INSIDE_LITERAL");
|
|
@@ -14971,21 +15130,21 @@ function fixJson(input) {
|
|
|
14971
15130
|
case "7":
|
|
14972
15131
|
case "8":
|
|
14973
15132
|
case "9": {
|
|
14974
|
-
lastValidIndex =
|
|
15133
|
+
lastValidIndex = i3;
|
|
14975
15134
|
stack.pop();
|
|
14976
15135
|
stack.push(swapState);
|
|
14977
15136
|
stack.push("INSIDE_NUMBER");
|
|
14978
15137
|
break;
|
|
14979
15138
|
}
|
|
14980
15139
|
case "{": {
|
|
14981
|
-
lastValidIndex =
|
|
15140
|
+
lastValidIndex = i3;
|
|
14982
15141
|
stack.pop();
|
|
14983
15142
|
stack.push(swapState);
|
|
14984
15143
|
stack.push("INSIDE_OBJECT_START");
|
|
14985
15144
|
break;
|
|
14986
15145
|
}
|
|
14987
15146
|
case "[": {
|
|
14988
|
-
lastValidIndex =
|
|
15147
|
+
lastValidIndex = i3;
|
|
14989
15148
|
stack.pop();
|
|
14990
15149
|
stack.push(swapState);
|
|
14991
15150
|
stack.push("INSIDE_ARRAY_START");
|
|
@@ -14994,7 +15153,7 @@ function fixJson(input) {
|
|
|
14994
15153
|
}
|
|
14995
15154
|
}
|
|
14996
15155
|
}
|
|
14997
|
-
function processAfterObjectValue(char,
|
|
15156
|
+
function processAfterObjectValue(char, i3) {
|
|
14998
15157
|
switch (char) {
|
|
14999
15158
|
case ",": {
|
|
15000
15159
|
stack.pop();
|
|
@@ -15002,13 +15161,13 @@ function fixJson(input) {
|
|
|
15002
15161
|
break;
|
|
15003
15162
|
}
|
|
15004
15163
|
case "}": {
|
|
15005
|
-
lastValidIndex =
|
|
15164
|
+
lastValidIndex = i3;
|
|
15006
15165
|
stack.pop();
|
|
15007
15166
|
break;
|
|
15008
15167
|
}
|
|
15009
15168
|
}
|
|
15010
15169
|
}
|
|
15011
|
-
function processAfterArrayValue(char,
|
|
15170
|
+
function processAfterArrayValue(char, i3) {
|
|
15012
15171
|
switch (char) {
|
|
15013
15172
|
case ",": {
|
|
15014
15173
|
stack.pop();
|
|
@@ -15016,18 +15175,18 @@ function fixJson(input) {
|
|
|
15016
15175
|
break;
|
|
15017
15176
|
}
|
|
15018
15177
|
case "]": {
|
|
15019
|
-
lastValidIndex =
|
|
15178
|
+
lastValidIndex = i3;
|
|
15020
15179
|
stack.pop();
|
|
15021
15180
|
break;
|
|
15022
15181
|
}
|
|
15023
15182
|
}
|
|
15024
15183
|
}
|
|
15025
|
-
for (let
|
|
15026
|
-
const char = input[
|
|
15184
|
+
for (let i3 = 0; i3 < input.length; i3++) {
|
|
15185
|
+
const char = input[i3];
|
|
15027
15186
|
const currentState = stack[stack.length - 1];
|
|
15028
15187
|
switch (currentState) {
|
|
15029
15188
|
case "ROOT":
|
|
15030
|
-
processValueStart(char,
|
|
15189
|
+
processValueStart(char, i3, "FINISH");
|
|
15031
15190
|
break;
|
|
15032
15191
|
case "INSIDE_OBJECT_START": {
|
|
15033
15192
|
switch (char) {
|
|
@@ -15037,7 +15196,7 @@ function fixJson(input) {
|
|
|
15037
15196
|
break;
|
|
15038
15197
|
}
|
|
15039
15198
|
case "}": {
|
|
15040
|
-
lastValidIndex =
|
|
15199
|
+
lastValidIndex = i3;
|
|
15041
15200
|
stack.pop();
|
|
15042
15201
|
break;
|
|
15043
15202
|
}
|
|
@@ -15075,18 +15234,18 @@ function fixJson(input) {
|
|
|
15075
15234
|
break;
|
|
15076
15235
|
}
|
|
15077
15236
|
case "INSIDE_OBJECT_BEFORE_VALUE": {
|
|
15078
|
-
processValueStart(char,
|
|
15237
|
+
processValueStart(char, i3, "INSIDE_OBJECT_AFTER_VALUE");
|
|
15079
15238
|
break;
|
|
15080
15239
|
}
|
|
15081
15240
|
case "INSIDE_OBJECT_AFTER_VALUE": {
|
|
15082
|
-
processAfterObjectValue(char,
|
|
15241
|
+
processAfterObjectValue(char, i3);
|
|
15083
15242
|
break;
|
|
15084
15243
|
}
|
|
15085
15244
|
case "INSIDE_STRING": {
|
|
15086
15245
|
switch (char) {
|
|
15087
15246
|
case '"': {
|
|
15088
15247
|
stack.pop();
|
|
15089
|
-
lastValidIndex =
|
|
15248
|
+
lastValidIndex = i3;
|
|
15090
15249
|
break;
|
|
15091
15250
|
}
|
|
15092
15251
|
case "\\": {
|
|
@@ -15094,7 +15253,7 @@ function fixJson(input) {
|
|
|
15094
15253
|
break;
|
|
15095
15254
|
}
|
|
15096
15255
|
default: {
|
|
15097
|
-
lastValidIndex =
|
|
15256
|
+
lastValidIndex = i3;
|
|
15098
15257
|
}
|
|
15099
15258
|
}
|
|
15100
15259
|
break;
|
|
@@ -15102,13 +15261,13 @@ function fixJson(input) {
|
|
|
15102
15261
|
case "INSIDE_ARRAY_START": {
|
|
15103
15262
|
switch (char) {
|
|
15104
15263
|
case "]": {
|
|
15105
|
-
lastValidIndex =
|
|
15264
|
+
lastValidIndex = i3;
|
|
15106
15265
|
stack.pop();
|
|
15107
15266
|
break;
|
|
15108
15267
|
}
|
|
15109
15268
|
default: {
|
|
15110
|
-
lastValidIndex =
|
|
15111
|
-
processValueStart(char,
|
|
15269
|
+
lastValidIndex = i3;
|
|
15270
|
+
processValueStart(char, i3, "INSIDE_ARRAY_AFTER_VALUE");
|
|
15112
15271
|
break;
|
|
15113
15272
|
}
|
|
15114
15273
|
}
|
|
@@ -15122,24 +15281,24 @@ function fixJson(input) {
|
|
|
15122
15281
|
break;
|
|
15123
15282
|
}
|
|
15124
15283
|
case "]": {
|
|
15125
|
-
lastValidIndex =
|
|
15284
|
+
lastValidIndex = i3;
|
|
15126
15285
|
stack.pop();
|
|
15127
15286
|
break;
|
|
15128
15287
|
}
|
|
15129
15288
|
default: {
|
|
15130
|
-
lastValidIndex =
|
|
15289
|
+
lastValidIndex = i3;
|
|
15131
15290
|
break;
|
|
15132
15291
|
}
|
|
15133
15292
|
}
|
|
15134
15293
|
break;
|
|
15135
15294
|
}
|
|
15136
15295
|
case "INSIDE_ARRAY_AFTER_COMMA": {
|
|
15137
|
-
processValueStart(char,
|
|
15296
|
+
processValueStart(char, i3, "INSIDE_ARRAY_AFTER_VALUE");
|
|
15138
15297
|
break;
|
|
15139
15298
|
}
|
|
15140
15299
|
case "INSIDE_STRING_ESCAPE": {
|
|
15141
15300
|
stack.pop();
|
|
15142
|
-
lastValidIndex =
|
|
15301
|
+
lastValidIndex = i3;
|
|
15143
15302
|
break;
|
|
15144
15303
|
}
|
|
15145
15304
|
case "INSIDE_NUMBER": {
|
|
@@ -15154,7 +15313,7 @@ function fixJson(input) {
|
|
|
15154
15313
|
case "7":
|
|
15155
15314
|
case "8":
|
|
15156
15315
|
case "9": {
|
|
15157
|
-
lastValidIndex =
|
|
15316
|
+
lastValidIndex = i3;
|
|
15158
15317
|
break;
|
|
15159
15318
|
}
|
|
15160
15319
|
case "e":
|
|
@@ -15166,24 +15325,24 @@ function fixJson(input) {
|
|
|
15166
15325
|
case ",": {
|
|
15167
15326
|
stack.pop();
|
|
15168
15327
|
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
15169
|
-
processAfterArrayValue(char,
|
|
15328
|
+
processAfterArrayValue(char, i3);
|
|
15170
15329
|
}
|
|
15171
15330
|
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
15172
|
-
processAfterObjectValue(char,
|
|
15331
|
+
processAfterObjectValue(char, i3);
|
|
15173
15332
|
}
|
|
15174
15333
|
break;
|
|
15175
15334
|
}
|
|
15176
15335
|
case "}": {
|
|
15177
15336
|
stack.pop();
|
|
15178
15337
|
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
15179
|
-
processAfterObjectValue(char,
|
|
15338
|
+
processAfterObjectValue(char, i3);
|
|
15180
15339
|
}
|
|
15181
15340
|
break;
|
|
15182
15341
|
}
|
|
15183
15342
|
case "]": {
|
|
15184
15343
|
stack.pop();
|
|
15185
15344
|
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
15186
|
-
processAfterArrayValue(char,
|
|
15345
|
+
processAfterArrayValue(char, i3);
|
|
15187
15346
|
}
|
|
15188
15347
|
break;
|
|
15189
15348
|
}
|
|
@@ -15195,24 +15354,24 @@ function fixJson(input) {
|
|
|
15195
15354
|
break;
|
|
15196
15355
|
}
|
|
15197
15356
|
case "INSIDE_LITERAL": {
|
|
15198
|
-
const partialLiteral = input.substring(literalStart,
|
|
15357
|
+
const partialLiteral = input.substring(literalStart, i3 + 1);
|
|
15199
15358
|
if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
|
|
15200
15359
|
stack.pop();
|
|
15201
15360
|
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
15202
|
-
processAfterObjectValue(char,
|
|
15361
|
+
processAfterObjectValue(char, i3);
|
|
15203
15362
|
} else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
15204
|
-
processAfterArrayValue(char,
|
|
15363
|
+
processAfterArrayValue(char, i3);
|
|
15205
15364
|
}
|
|
15206
15365
|
} else {
|
|
15207
|
-
lastValidIndex =
|
|
15366
|
+
lastValidIndex = i3;
|
|
15208
15367
|
}
|
|
15209
15368
|
break;
|
|
15210
15369
|
}
|
|
15211
15370
|
}
|
|
15212
15371
|
}
|
|
15213
15372
|
let result = input.slice(0, lastValidIndex + 1);
|
|
15214
|
-
for (let
|
|
15215
|
-
const state = stack[
|
|
15373
|
+
for (let i3 = stack.length - 1; i3 >= 0; i3--) {
|
|
15374
|
+
const state = stack[i3];
|
|
15216
15375
|
switch (state) {
|
|
15217
15376
|
case "INSIDE_STRING": {
|
|
15218
15377
|
result += '"';
|
|
@@ -16065,102 +16224,1193 @@ function readUIMessageStream({
|
|
|
16065
16224
|
return createAsyncIterableStream(outputStream);
|
|
16066
16225
|
}
|
|
16067
16226
|
|
|
16068
|
-
// ../../node_modules/.pnpm/ami-sdk@0.0.
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
|
|
16227
|
+
// ../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/index.js
|
|
16228
|
+
init_index_browser();
|
|
16229
|
+
|
|
16230
|
+
// ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.mjs
|
|
16231
|
+
function Diff() {
|
|
16232
|
+
}
|
|
16233
|
+
Diff.prototype = {
|
|
16234
|
+
diff: function diff(oldString, newString) {
|
|
16235
|
+
var _options$timeout;
|
|
16236
|
+
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
16237
|
+
var callback = options.callback;
|
|
16238
|
+
if (typeof options === "function") {
|
|
16239
|
+
callback = options;
|
|
16240
|
+
options = {};
|
|
16241
|
+
}
|
|
16242
|
+
var self = this;
|
|
16243
|
+
function done(value) {
|
|
16244
|
+
value = self.postProcess(value, options);
|
|
16245
|
+
if (callback) {
|
|
16246
|
+
setTimeout(function() {
|
|
16247
|
+
callback(value);
|
|
16248
|
+
}, 0);
|
|
16249
|
+
return true;
|
|
16250
|
+
} else {
|
|
16251
|
+
return value;
|
|
16252
|
+
}
|
|
16253
|
+
}
|
|
16254
|
+
oldString = this.castInput(oldString, options);
|
|
16255
|
+
newString = this.castInput(newString, options);
|
|
16256
|
+
oldString = this.removeEmpty(this.tokenize(oldString, options));
|
|
16257
|
+
newString = this.removeEmpty(this.tokenize(newString, options));
|
|
16258
|
+
var newLen = newString.length, oldLen = oldString.length;
|
|
16259
|
+
var editLength = 1;
|
|
16260
|
+
var maxEditLength = newLen + oldLen;
|
|
16261
|
+
if (options.maxEditLength != null) {
|
|
16262
|
+
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
|
16263
|
+
}
|
|
16264
|
+
var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
|
|
16265
|
+
var abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
16266
|
+
var bestPath = [{
|
|
16267
|
+
oldPos: -1,
|
|
16268
|
+
lastComponent: void 0
|
|
16269
|
+
}];
|
|
16270
|
+
var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options);
|
|
16271
|
+
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
16272
|
+
return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken));
|
|
16273
|
+
}
|
|
16274
|
+
var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
|
16275
|
+
function execEditLength() {
|
|
16276
|
+
for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
|
16277
|
+
var basePath = void 0;
|
|
16278
|
+
var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
|
16279
|
+
if (removePath) {
|
|
16280
|
+
bestPath[diagonalPath - 1] = void 0;
|
|
16281
|
+
}
|
|
16282
|
+
var canAdd = false;
|
|
16283
|
+
if (addPath) {
|
|
16284
|
+
var addPathNewPos = addPath.oldPos - diagonalPath;
|
|
16285
|
+
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
|
16286
|
+
}
|
|
16287
|
+
var canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
|
16288
|
+
if (!canAdd && !canRemove) {
|
|
16289
|
+
bestPath[diagonalPath] = void 0;
|
|
16290
|
+
continue;
|
|
16291
|
+
}
|
|
16292
|
+
if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
|
|
16293
|
+
basePath = self.addToPath(addPath, true, false, 0, options);
|
|
16294
|
+
} else {
|
|
16295
|
+
basePath = self.addToPath(removePath, false, true, 1, options);
|
|
16296
|
+
}
|
|
16297
|
+
newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options);
|
|
16298
|
+
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
16299
|
+
return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
|
|
16300
|
+
} else {
|
|
16301
|
+
bestPath[diagonalPath] = basePath;
|
|
16302
|
+
if (basePath.oldPos + 1 >= oldLen) {
|
|
16303
|
+
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
|
16304
|
+
}
|
|
16305
|
+
if (newPos + 1 >= newLen) {
|
|
16306
|
+
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
|
16307
|
+
}
|
|
16308
|
+
}
|
|
16309
|
+
}
|
|
16310
|
+
editLength++;
|
|
16311
|
+
}
|
|
16312
|
+
if (callback) {
|
|
16313
|
+
(function exec() {
|
|
16314
|
+
setTimeout(function() {
|
|
16315
|
+
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
16316
|
+
return callback();
|
|
16317
|
+
}
|
|
16318
|
+
if (!execEditLength()) {
|
|
16319
|
+
exec();
|
|
16320
|
+
}
|
|
16321
|
+
}, 0);
|
|
16322
|
+
})();
|
|
16323
|
+
} else {
|
|
16324
|
+
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
|
16325
|
+
var ret = execEditLength();
|
|
16326
|
+
if (ret) {
|
|
16327
|
+
return ret;
|
|
16328
|
+
}
|
|
16329
|
+
}
|
|
16330
|
+
}
|
|
16331
|
+
},
|
|
16332
|
+
addToPath: function addToPath(path, added, removed, oldPosInc, options) {
|
|
16333
|
+
var last = path.lastComponent;
|
|
16334
|
+
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
16335
|
+
return {
|
|
16336
|
+
oldPos: path.oldPos + oldPosInc,
|
|
16337
|
+
lastComponent: {
|
|
16338
|
+
count: last.count + 1,
|
|
16339
|
+
added,
|
|
16340
|
+
removed,
|
|
16341
|
+
previousComponent: last.previousComponent
|
|
16342
|
+
}
|
|
16343
|
+
};
|
|
16344
|
+
} else {
|
|
16345
|
+
return {
|
|
16346
|
+
oldPos: path.oldPos + oldPosInc,
|
|
16347
|
+
lastComponent: {
|
|
16348
|
+
count: 1,
|
|
16349
|
+
added,
|
|
16350
|
+
removed,
|
|
16351
|
+
previousComponent: last
|
|
16352
|
+
}
|
|
16353
|
+
};
|
|
16354
|
+
}
|
|
16355
|
+
},
|
|
16356
|
+
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) {
|
|
16357
|
+
var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
16358
|
+
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) {
|
|
16359
|
+
newPos++;
|
|
16360
|
+
oldPos++;
|
|
16361
|
+
commonCount++;
|
|
16362
|
+
if (options.oneChangePerToken) {
|
|
16363
|
+
basePath.lastComponent = {
|
|
16364
|
+
count: 1,
|
|
16365
|
+
previousComponent: basePath.lastComponent,
|
|
16366
|
+
added: false,
|
|
16367
|
+
removed: false
|
|
16368
|
+
};
|
|
16369
|
+
}
|
|
16370
|
+
}
|
|
16371
|
+
if (commonCount && !options.oneChangePerToken) {
|
|
16372
|
+
basePath.lastComponent = {
|
|
16373
|
+
count: commonCount,
|
|
16374
|
+
previousComponent: basePath.lastComponent,
|
|
16375
|
+
added: false,
|
|
16376
|
+
removed: false
|
|
16377
|
+
};
|
|
16378
|
+
}
|
|
16379
|
+
basePath.oldPos = oldPos;
|
|
16380
|
+
return newPos;
|
|
16381
|
+
},
|
|
16382
|
+
equals: function equals(left, right, options) {
|
|
16383
|
+
if (options.comparator) {
|
|
16384
|
+
return options.comparator(left, right);
|
|
16385
|
+
} else {
|
|
16386
|
+
return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
16387
|
+
}
|
|
16388
|
+
},
|
|
16389
|
+
removeEmpty: function removeEmpty(array2) {
|
|
16390
|
+
var ret = [];
|
|
16391
|
+
for (var i3 = 0; i3 < array2.length; i3++) {
|
|
16392
|
+
if (array2[i3]) {
|
|
16393
|
+
ret.push(array2[i3]);
|
|
16394
|
+
}
|
|
16395
|
+
}
|
|
16396
|
+
return ret;
|
|
16397
|
+
},
|
|
16398
|
+
castInput: function castInput(value) {
|
|
16399
|
+
return value;
|
|
16400
|
+
},
|
|
16401
|
+
tokenize: function tokenize(value) {
|
|
16402
|
+
return Array.from(value);
|
|
16403
|
+
},
|
|
16404
|
+
join: function join(chars) {
|
|
16405
|
+
return chars.join("");
|
|
16406
|
+
},
|
|
16407
|
+
postProcess: function postProcess(changeObjects) {
|
|
16408
|
+
return changeObjects;
|
|
16409
|
+
}
|
|
16410
|
+
};
|
|
16411
|
+
function buildValues(diff2, lastComponent, newString, oldString, useLongestToken) {
|
|
16412
|
+
var components = [];
|
|
16413
|
+
var nextComponent;
|
|
16414
|
+
while (lastComponent) {
|
|
16415
|
+
components.push(lastComponent);
|
|
16416
|
+
nextComponent = lastComponent.previousComponent;
|
|
16417
|
+
delete lastComponent.previousComponent;
|
|
16418
|
+
lastComponent = nextComponent;
|
|
16419
|
+
}
|
|
16420
|
+
components.reverse();
|
|
16421
|
+
var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
|
|
16422
|
+
for (; componentPos < componentLen; componentPos++) {
|
|
16423
|
+
var component = components[componentPos];
|
|
16424
|
+
if (!component.removed) {
|
|
16425
|
+
if (!component.added && useLongestToken) {
|
|
16426
|
+
var value = newString.slice(newPos, newPos + component.count);
|
|
16427
|
+
value = value.map(function(value2, i3) {
|
|
16428
|
+
var oldValue = oldString[oldPos + i3];
|
|
16429
|
+
return oldValue.length > value2.length ? oldValue : value2;
|
|
16430
|
+
});
|
|
16431
|
+
component.value = diff2.join(value);
|
|
16432
|
+
} else {
|
|
16433
|
+
component.value = diff2.join(newString.slice(newPos, newPos + component.count));
|
|
16434
|
+
}
|
|
16435
|
+
newPos += component.count;
|
|
16436
|
+
if (!component.added) {
|
|
16437
|
+
oldPos += component.count;
|
|
16438
|
+
}
|
|
16439
|
+
} else {
|
|
16440
|
+
component.value = diff2.join(oldString.slice(oldPos, oldPos + component.count));
|
|
16441
|
+
oldPos += component.count;
|
|
16442
|
+
}
|
|
16443
|
+
}
|
|
16444
|
+
return components;
|
|
16445
|
+
}
|
|
16446
|
+
function longestCommonPrefix(str1, str2) {
|
|
16447
|
+
var i3;
|
|
16448
|
+
for (i3 = 0; i3 < str1.length && i3 < str2.length; i3++) {
|
|
16449
|
+
if (str1[i3] != str2[i3]) {
|
|
16450
|
+
return str1.slice(0, i3);
|
|
16451
|
+
}
|
|
16452
|
+
}
|
|
16453
|
+
return str1.slice(0, i3);
|
|
16454
|
+
}
|
|
16455
|
+
function longestCommonSuffix(str1, str2) {
|
|
16456
|
+
var i3;
|
|
16457
|
+
if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
|
|
16458
|
+
return "";
|
|
16459
|
+
}
|
|
16460
|
+
for (i3 = 0; i3 < str1.length && i3 < str2.length; i3++) {
|
|
16461
|
+
if (str1[str1.length - (i3 + 1)] != str2[str2.length - (i3 + 1)]) {
|
|
16462
|
+
return str1.slice(-i3);
|
|
16463
|
+
}
|
|
16464
|
+
}
|
|
16465
|
+
return str1.slice(-i3);
|
|
16466
|
+
}
|
|
16467
|
+
function replacePrefix(string4, oldPrefix, newPrefix) {
|
|
16468
|
+
if (string4.slice(0, oldPrefix.length) != oldPrefix) {
|
|
16469
|
+
throw Error("string ".concat(JSON.stringify(string4), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug"));
|
|
16470
|
+
}
|
|
16471
|
+
return newPrefix + string4.slice(oldPrefix.length);
|
|
16472
|
+
}
|
|
16473
|
+
function replaceSuffix(string4, oldSuffix, newSuffix) {
|
|
16474
|
+
if (!oldSuffix) {
|
|
16475
|
+
return string4 + newSuffix;
|
|
16476
|
+
}
|
|
16477
|
+
if (string4.slice(-oldSuffix.length) != oldSuffix) {
|
|
16478
|
+
throw Error("string ".concat(JSON.stringify(string4), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug"));
|
|
16479
|
+
}
|
|
16480
|
+
return string4.slice(0, -oldSuffix.length) + newSuffix;
|
|
16481
|
+
}
|
|
16482
|
+
function removePrefix(string4, oldPrefix) {
|
|
16483
|
+
return replacePrefix(string4, oldPrefix, "");
|
|
16484
|
+
}
|
|
16485
|
+
function removeSuffix(string4, oldSuffix) {
|
|
16486
|
+
return replaceSuffix(string4, oldSuffix, "");
|
|
16487
|
+
}
|
|
16488
|
+
function maximumOverlap(string1, string22) {
|
|
16489
|
+
return string22.slice(0, overlapCount(string1, string22));
|
|
16490
|
+
}
|
|
16491
|
+
function overlapCount(a2, b2) {
|
|
16492
|
+
var startA = 0;
|
|
16493
|
+
if (a2.length > b2.length) {
|
|
16494
|
+
startA = a2.length - b2.length;
|
|
16495
|
+
}
|
|
16496
|
+
var endB = b2.length;
|
|
16497
|
+
if (a2.length < b2.length) {
|
|
16498
|
+
endB = a2.length;
|
|
16499
|
+
}
|
|
16500
|
+
var map2 = Array(endB);
|
|
16501
|
+
var k2 = 0;
|
|
16502
|
+
map2[0] = 0;
|
|
16503
|
+
for (var j2 = 1; j2 < endB; j2++) {
|
|
16504
|
+
if (b2[j2] == b2[k2]) {
|
|
16505
|
+
map2[j2] = map2[k2];
|
|
16506
|
+
} else {
|
|
16507
|
+
map2[j2] = k2;
|
|
16508
|
+
}
|
|
16509
|
+
while (k2 > 0 && b2[j2] != b2[k2]) {
|
|
16510
|
+
k2 = map2[k2];
|
|
16511
|
+
}
|
|
16512
|
+
if (b2[j2] == b2[k2]) {
|
|
16513
|
+
k2++;
|
|
16514
|
+
}
|
|
16515
|
+
}
|
|
16516
|
+
k2 = 0;
|
|
16517
|
+
for (var i3 = startA; i3 < a2.length; i3++) {
|
|
16518
|
+
while (k2 > 0 && a2[i3] != b2[k2]) {
|
|
16519
|
+
k2 = map2[k2];
|
|
16520
|
+
}
|
|
16521
|
+
if (a2[i3] == b2[k2]) {
|
|
16522
|
+
k2++;
|
|
16523
|
+
}
|
|
16524
|
+
}
|
|
16525
|
+
return k2;
|
|
16526
|
+
}
|
|
16527
|
+
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}";
|
|
16528
|
+
var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), "ug");
|
|
16529
|
+
var wordDiff = new Diff();
|
|
16530
|
+
wordDiff.equals = function(left, right, options) {
|
|
16531
|
+
if (options.ignoreCase) {
|
|
16532
|
+
left = left.toLowerCase();
|
|
16533
|
+
right = right.toLowerCase();
|
|
16534
|
+
}
|
|
16535
|
+
return left.trim() === right.trim();
|
|
16536
|
+
};
|
|
16537
|
+
wordDiff.tokenize = function(value) {
|
|
16538
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
16539
|
+
var parts;
|
|
16540
|
+
if (options.intlSegmenter) {
|
|
16541
|
+
if (options.intlSegmenter.resolvedOptions().granularity != "word") {
|
|
16542
|
+
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
16543
|
+
}
|
|
16544
|
+
parts = Array.from(options.intlSegmenter.segment(value), function(segment) {
|
|
16545
|
+
return segment.segment;
|
|
16546
|
+
});
|
|
16547
|
+
} else {
|
|
16548
|
+
parts = value.match(tokenizeIncludingWhitespace) || [];
|
|
16549
|
+
}
|
|
16550
|
+
var tokens = [];
|
|
16551
|
+
var prevPart = null;
|
|
16552
|
+
parts.forEach(function(part) {
|
|
16553
|
+
if (/\s/.test(part)) {
|
|
16554
|
+
if (prevPart == null) {
|
|
16555
|
+
tokens.push(part);
|
|
16556
|
+
} else {
|
|
16557
|
+
tokens.push(tokens.pop() + part);
|
|
16558
|
+
}
|
|
16559
|
+
} else if (/\s/.test(prevPart)) {
|
|
16560
|
+
if (tokens[tokens.length - 1] == prevPart) {
|
|
16561
|
+
tokens.push(tokens.pop() + part);
|
|
16562
|
+
} else {
|
|
16563
|
+
tokens.push(prevPart + part);
|
|
16564
|
+
}
|
|
16565
|
+
} else {
|
|
16566
|
+
tokens.push(part);
|
|
16567
|
+
}
|
|
16568
|
+
prevPart = part;
|
|
16569
|
+
});
|
|
16570
|
+
return tokens;
|
|
16571
|
+
};
|
|
16572
|
+
wordDiff.join = function(tokens) {
|
|
16573
|
+
return tokens.map(function(token, i3) {
|
|
16574
|
+
if (i3 == 0) {
|
|
16575
|
+
return token;
|
|
16576
|
+
} else {
|
|
16577
|
+
return token.replace(/^\s+/, "");
|
|
16578
|
+
}
|
|
16579
|
+
}).join("");
|
|
16580
|
+
};
|
|
16581
|
+
wordDiff.postProcess = function(changes, options) {
|
|
16582
|
+
if (!changes || options.oneChangePerToken) {
|
|
16583
|
+
return changes;
|
|
16584
|
+
}
|
|
16585
|
+
var lastKeep = null;
|
|
16586
|
+
var insertion = null;
|
|
16587
|
+
var deletion = null;
|
|
16588
|
+
changes.forEach(function(change) {
|
|
16589
|
+
if (change.added) {
|
|
16590
|
+
insertion = change;
|
|
16591
|
+
} else if (change.removed) {
|
|
16592
|
+
deletion = change;
|
|
16593
|
+
} else {
|
|
16594
|
+
if (insertion || deletion) {
|
|
16595
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
|
|
16596
|
+
}
|
|
16597
|
+
lastKeep = change;
|
|
16598
|
+
insertion = null;
|
|
16599
|
+
deletion = null;
|
|
16600
|
+
}
|
|
16601
|
+
});
|
|
16602
|
+
if (insertion || deletion) {
|
|
16603
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
|
|
16604
|
+
}
|
|
16605
|
+
return changes;
|
|
16606
|
+
};
|
|
16607
|
+
function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
|
|
16608
|
+
if (deletion && insertion) {
|
|
16609
|
+
var oldWsPrefix = deletion.value.match(/^\s*/)[0];
|
|
16610
|
+
var oldWsSuffix = deletion.value.match(/\s*$/)[0];
|
|
16611
|
+
var newWsPrefix = insertion.value.match(/^\s*/)[0];
|
|
16612
|
+
var newWsSuffix = insertion.value.match(/\s*$/)[0];
|
|
16613
|
+
if (startKeep) {
|
|
16614
|
+
var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
|
|
16615
|
+
startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
|
|
16616
|
+
deletion.value = removePrefix(deletion.value, commonWsPrefix);
|
|
16617
|
+
insertion.value = removePrefix(insertion.value, commonWsPrefix);
|
|
16618
|
+
}
|
|
16619
|
+
if (endKeep) {
|
|
16620
|
+
var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
|
|
16621
|
+
endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
|
|
16622
|
+
deletion.value = removeSuffix(deletion.value, commonWsSuffix);
|
|
16623
|
+
insertion.value = removeSuffix(insertion.value, commonWsSuffix);
|
|
16624
|
+
}
|
|
16625
|
+
} else if (insertion) {
|
|
16626
|
+
if (startKeep) {
|
|
16627
|
+
insertion.value = insertion.value.replace(/^\s*/, "");
|
|
16628
|
+
}
|
|
16629
|
+
if (endKeep) {
|
|
16630
|
+
endKeep.value = endKeep.value.replace(/^\s*/, "");
|
|
16631
|
+
}
|
|
16632
|
+
} else if (startKeep && endKeep) {
|
|
16633
|
+
var newWsFull = endKeep.value.match(/^\s*/)[0], delWsStart = deletion.value.match(/^\s*/)[0], delWsEnd = deletion.value.match(/\s*$/)[0];
|
|
16634
|
+
var newWsStart = longestCommonPrefix(newWsFull, delWsStart);
|
|
16635
|
+
deletion.value = removePrefix(deletion.value, newWsStart);
|
|
16636
|
+
var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
|
|
16637
|
+
deletion.value = removeSuffix(deletion.value, newWsEnd);
|
|
16638
|
+
endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
|
|
16639
|
+
startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
|
|
16640
|
+
} else if (endKeep) {
|
|
16641
|
+
var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0];
|
|
16642
|
+
var deletionWsSuffix = deletion.value.match(/\s*$/)[0];
|
|
16643
|
+
var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
|
|
16644
|
+
deletion.value = removeSuffix(deletion.value, overlap);
|
|
16645
|
+
} else if (startKeep) {
|
|
16646
|
+
var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0];
|
|
16647
|
+
var deletionWsPrefix = deletion.value.match(/^\s*/)[0];
|
|
16648
|
+
var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
|
|
16649
|
+
deletion.value = removePrefix(deletion.value, _overlap);
|
|
16650
|
+
}
|
|
16651
|
+
}
|
|
16652
|
+
var wordWithSpaceDiff = new Diff();
|
|
16653
|
+
wordWithSpaceDiff.tokenize = function(value) {
|
|
16654
|
+
var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
|
|
16655
|
+
return value.match(regex) || [];
|
|
16656
|
+
};
|
|
16657
|
+
var lineDiff = new Diff();
|
|
16658
|
+
lineDiff.tokenize = function(value, options) {
|
|
16659
|
+
if (options.stripTrailingCr) {
|
|
16660
|
+
value = value.replace(/\r\n/g, "\n");
|
|
16661
|
+
}
|
|
16662
|
+
var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
16663
|
+
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
16664
|
+
linesAndNewlines.pop();
|
|
16665
|
+
}
|
|
16666
|
+
for (var i3 = 0; i3 < linesAndNewlines.length; i3++) {
|
|
16667
|
+
var line = linesAndNewlines[i3];
|
|
16668
|
+
if (i3 % 2 && !options.newlineIsToken) {
|
|
16669
|
+
retLines[retLines.length - 1] += line;
|
|
16670
|
+
} else {
|
|
16671
|
+
retLines.push(line);
|
|
16672
|
+
}
|
|
16673
|
+
}
|
|
16674
|
+
return retLines;
|
|
16675
|
+
};
|
|
16676
|
+
lineDiff.equals = function(left, right, options) {
|
|
16677
|
+
if (options.ignoreWhitespace) {
|
|
16678
|
+
if (!options.newlineIsToken || !left.includes("\n")) {
|
|
16679
|
+
left = left.trim();
|
|
16680
|
+
}
|
|
16681
|
+
if (!options.newlineIsToken || !right.includes("\n")) {
|
|
16682
|
+
right = right.trim();
|
|
16683
|
+
}
|
|
16684
|
+
} else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
|
|
16685
|
+
if (left.endsWith("\n")) {
|
|
16686
|
+
left = left.slice(0, -1);
|
|
16687
|
+
}
|
|
16688
|
+
if (right.endsWith("\n")) {
|
|
16689
|
+
right = right.slice(0, -1);
|
|
16690
|
+
}
|
|
16691
|
+
}
|
|
16692
|
+
return Diff.prototype.equals.call(this, left, right, options);
|
|
16693
|
+
};
|
|
16694
|
+
var sentenceDiff = new Diff();
|
|
16695
|
+
sentenceDiff.tokenize = function(value) {
|
|
16696
|
+
return value.split(/(\S.+?[.!?])(?=\s+|$)/);
|
|
16697
|
+
};
|
|
16698
|
+
var cssDiff = new Diff();
|
|
16699
|
+
cssDiff.tokenize = function(value) {
|
|
16700
|
+
return value.split(/([{}:;,]|\s+)/);
|
|
16701
|
+
};
|
|
16702
|
+
function ownKeys(e, r2) {
|
|
16703
|
+
var t2 = Object.keys(e);
|
|
16704
|
+
if (Object.getOwnPropertySymbols) {
|
|
16705
|
+
var o2 = Object.getOwnPropertySymbols(e);
|
|
16706
|
+
r2 && (o2 = o2.filter(function(r3) {
|
|
16707
|
+
return Object.getOwnPropertyDescriptor(e, r3).enumerable;
|
|
16708
|
+
})), t2.push.apply(t2, o2);
|
|
16709
|
+
}
|
|
16710
|
+
return t2;
|
|
16711
|
+
}
|
|
16712
|
+
function _objectSpread2(e) {
|
|
16713
|
+
for (var r2 = 1; r2 < arguments.length; r2++) {
|
|
16714
|
+
var t2 = null != arguments[r2] ? arguments[r2] : {};
|
|
16715
|
+
r2 % 2 ? ownKeys(Object(t2), true).forEach(function(r3) {
|
|
16716
|
+
_defineProperty(e, r3, t2[r3]);
|
|
16717
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r3) {
|
|
16718
|
+
Object.defineProperty(e, r3, Object.getOwnPropertyDescriptor(t2, r3));
|
|
16719
|
+
});
|
|
16720
|
+
}
|
|
16721
|
+
return e;
|
|
16722
|
+
}
|
|
16723
|
+
function _toPrimitive(t2, r2) {
|
|
16724
|
+
if ("object" != typeof t2 || !t2) return t2;
|
|
16725
|
+
var e = t2[Symbol.toPrimitive];
|
|
16726
|
+
if (void 0 !== e) {
|
|
16727
|
+
var i3 = e.call(t2, r2);
|
|
16728
|
+
if ("object" != typeof i3) return i3;
|
|
16729
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
16730
|
+
}
|
|
16731
|
+
return ("string" === r2 ? String : Number)(t2);
|
|
16732
|
+
}
|
|
16733
|
+
function _toPropertyKey(t2) {
|
|
16734
|
+
var i3 = _toPrimitive(t2, "string");
|
|
16735
|
+
return "symbol" == typeof i3 ? i3 : i3 + "";
|
|
16736
|
+
}
|
|
16737
|
+
function _typeof(o2) {
|
|
16738
|
+
"@babel/helpers - typeof";
|
|
16739
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
|
|
16740
|
+
return typeof o3;
|
|
16741
|
+
} : function(o3) {
|
|
16742
|
+
return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
|
|
16743
|
+
}, _typeof(o2);
|
|
16744
|
+
}
|
|
16745
|
+
function _defineProperty(obj, key, value) {
|
|
16746
|
+
key = _toPropertyKey(key);
|
|
16747
|
+
if (key in obj) {
|
|
16748
|
+
Object.defineProperty(obj, key, {
|
|
16749
|
+
value,
|
|
16750
|
+
enumerable: true,
|
|
16751
|
+
configurable: true,
|
|
16752
|
+
writable: true
|
|
16753
|
+
});
|
|
16754
|
+
} else {
|
|
16755
|
+
obj[key] = value;
|
|
16756
|
+
}
|
|
16757
|
+
return obj;
|
|
16758
|
+
}
|
|
16759
|
+
var jsonDiff = new Diff();
|
|
16760
|
+
jsonDiff.useLongestToken = true;
|
|
16761
|
+
jsonDiff.tokenize = lineDiff.tokenize;
|
|
16762
|
+
jsonDiff.castInput = function(value, options) {
|
|
16763
|
+
var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === void 0 ? function(k2, v) {
|
|
16764
|
+
return typeof v === "undefined" ? undefinedReplacement : v;
|
|
16765
|
+
} : _options$stringifyRep;
|
|
16766
|
+
return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
|
|
16767
|
+
};
|
|
16768
|
+
jsonDiff.equals = function(left, right, options) {
|
|
16769
|
+
return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
|
|
16770
|
+
};
|
|
16771
|
+
function canonicalize(obj, stack, replacementStack, replacer, key) {
|
|
16772
|
+
stack = stack || [];
|
|
16773
|
+
replacementStack = replacementStack || [];
|
|
16774
|
+
if (replacer) {
|
|
16775
|
+
obj = replacer(key, obj);
|
|
16776
|
+
}
|
|
16777
|
+
var i3;
|
|
16778
|
+
for (i3 = 0; i3 < stack.length; i3 += 1) {
|
|
16779
|
+
if (stack[i3] === obj) {
|
|
16780
|
+
return replacementStack[i3];
|
|
16781
|
+
}
|
|
16782
|
+
}
|
|
16783
|
+
var canonicalizedObj;
|
|
16784
|
+
if ("[object Array]" === Object.prototype.toString.call(obj)) {
|
|
16785
|
+
stack.push(obj);
|
|
16786
|
+
canonicalizedObj = new Array(obj.length);
|
|
16787
|
+
replacementStack.push(canonicalizedObj);
|
|
16788
|
+
for (i3 = 0; i3 < obj.length; i3 += 1) {
|
|
16789
|
+
canonicalizedObj[i3] = canonicalize(obj[i3], stack, replacementStack, replacer, key);
|
|
16790
|
+
}
|
|
16791
|
+
stack.pop();
|
|
16792
|
+
replacementStack.pop();
|
|
16793
|
+
return canonicalizedObj;
|
|
16794
|
+
}
|
|
16795
|
+
if (obj && obj.toJSON) {
|
|
16796
|
+
obj = obj.toJSON();
|
|
16797
|
+
}
|
|
16798
|
+
if (_typeof(obj) === "object" && obj !== null) {
|
|
16799
|
+
stack.push(obj);
|
|
16800
|
+
canonicalizedObj = {};
|
|
16801
|
+
replacementStack.push(canonicalizedObj);
|
|
16802
|
+
var sortedKeys = [], _key;
|
|
16803
|
+
for (_key in obj) {
|
|
16804
|
+
if (Object.prototype.hasOwnProperty.call(obj, _key)) {
|
|
16805
|
+
sortedKeys.push(_key);
|
|
16806
|
+
}
|
|
16807
|
+
}
|
|
16808
|
+
sortedKeys.sort();
|
|
16809
|
+
for (i3 = 0; i3 < sortedKeys.length; i3 += 1) {
|
|
16810
|
+
_key = sortedKeys[i3];
|
|
16811
|
+
canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
|
|
16812
|
+
}
|
|
16813
|
+
stack.pop();
|
|
16814
|
+
replacementStack.pop();
|
|
16815
|
+
} else {
|
|
16816
|
+
canonicalizedObj = obj;
|
|
16817
|
+
}
|
|
16818
|
+
return canonicalizedObj;
|
|
16819
|
+
}
|
|
16820
|
+
var arrayDiff = new Diff();
|
|
16821
|
+
arrayDiff.tokenize = function(value) {
|
|
16822
|
+
return value.slice();
|
|
16823
|
+
};
|
|
16824
|
+
arrayDiff.join = arrayDiff.removeEmpty = function(value) {
|
|
16825
|
+
return value;
|
|
16826
|
+
};
|
|
16827
|
+
function parsePatch(uniDiff) {
|
|
16828
|
+
var diffstr = uniDiff.split(/\n/), list = [], i3 = 0;
|
|
16829
|
+
function parseIndex() {
|
|
16830
|
+
var index = {};
|
|
16831
|
+
list.push(index);
|
|
16832
|
+
while (i3 < diffstr.length) {
|
|
16833
|
+
var line = diffstr[i3];
|
|
16834
|
+
if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
|
|
16835
|
+
break;
|
|
16836
|
+
}
|
|
16837
|
+
var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
|
|
16838
|
+
if (header) {
|
|
16839
|
+
index.index = header[1];
|
|
16840
|
+
}
|
|
16841
|
+
i3++;
|
|
16842
|
+
}
|
|
16843
|
+
parseFileHeader(index);
|
|
16844
|
+
parseFileHeader(index);
|
|
16845
|
+
index.hunks = [];
|
|
16846
|
+
while (i3 < diffstr.length) {
|
|
16847
|
+
var _line = diffstr[i3];
|
|
16848
|
+
if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) {
|
|
16849
|
+
break;
|
|
16850
|
+
} else if (/^@@/.test(_line)) {
|
|
16851
|
+
index.hunks.push(parseHunk());
|
|
16852
|
+
} else if (_line) {
|
|
16853
|
+
throw new Error("Unknown line " + (i3 + 1) + " " + JSON.stringify(_line));
|
|
16854
|
+
} else {
|
|
16855
|
+
i3++;
|
|
16856
|
+
}
|
|
16857
|
+
}
|
|
16858
|
+
}
|
|
16859
|
+
function parseFileHeader(index) {
|
|
16860
|
+
var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i3]);
|
|
16861
|
+
if (fileHeader) {
|
|
16862
|
+
var keyPrefix = fileHeader[1] === "---" ? "old" : "new";
|
|
16863
|
+
var data = fileHeader[2].split(" ", 2);
|
|
16864
|
+
var fileName = data[0].replace(/\\\\/g, "\\");
|
|
16865
|
+
if (/^".*"$/.test(fileName)) {
|
|
16866
|
+
fileName = fileName.substr(1, fileName.length - 2);
|
|
16867
|
+
}
|
|
16868
|
+
index[keyPrefix + "FileName"] = fileName;
|
|
16869
|
+
index[keyPrefix + "Header"] = (data[1] || "").trim();
|
|
16870
|
+
i3++;
|
|
16871
|
+
}
|
|
16872
|
+
}
|
|
16873
|
+
function parseHunk() {
|
|
16874
|
+
var chunkHeaderIndex = i3, chunkHeaderLine = diffstr[i3++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
|
|
16875
|
+
var hunk = {
|
|
16876
|
+
oldStart: +chunkHeader[1],
|
|
16877
|
+
oldLines: typeof chunkHeader[2] === "undefined" ? 1 : +chunkHeader[2],
|
|
16878
|
+
newStart: +chunkHeader[3],
|
|
16879
|
+
newLines: typeof chunkHeader[4] === "undefined" ? 1 : +chunkHeader[4],
|
|
16880
|
+
lines: []
|
|
16881
|
+
};
|
|
16882
|
+
if (hunk.oldLines === 0) {
|
|
16883
|
+
hunk.oldStart += 1;
|
|
16884
|
+
}
|
|
16885
|
+
if (hunk.newLines === 0) {
|
|
16886
|
+
hunk.newStart += 1;
|
|
16887
|
+
}
|
|
16888
|
+
var addCount = 0, removeCount = 0;
|
|
16889
|
+
for (; i3 < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || (_diffstr$i = diffstr[i3]) !== null && _diffstr$i !== void 0 && _diffstr$i.startsWith("\\")); i3++) {
|
|
16890
|
+
var _diffstr$i;
|
|
16891
|
+
var operation = diffstr[i3].length == 0 && i3 != diffstr.length - 1 ? " " : diffstr[i3][0];
|
|
16892
|
+
if (operation === "+" || operation === "-" || operation === " " || operation === "\\") {
|
|
16893
|
+
hunk.lines.push(diffstr[i3]);
|
|
16894
|
+
if (operation === "+") {
|
|
16895
|
+
addCount++;
|
|
16896
|
+
} else if (operation === "-") {
|
|
16897
|
+
removeCount++;
|
|
16898
|
+
} else if (operation === " ") {
|
|
16899
|
+
addCount++;
|
|
16900
|
+
removeCount++;
|
|
16901
|
+
}
|
|
16902
|
+
} else {
|
|
16903
|
+
throw new Error("Hunk at line ".concat(chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i3]));
|
|
16904
|
+
}
|
|
16905
|
+
}
|
|
16906
|
+
if (!addCount && hunk.newLines === 1) {
|
|
16907
|
+
hunk.newLines = 0;
|
|
16908
|
+
}
|
|
16909
|
+
if (!removeCount && hunk.oldLines === 1) {
|
|
16910
|
+
hunk.oldLines = 0;
|
|
16911
|
+
}
|
|
16912
|
+
if (addCount !== hunk.newLines) {
|
|
16913
|
+
throw new Error("Added line count did not match for hunk at line " + (chunkHeaderIndex + 1));
|
|
16914
|
+
}
|
|
16915
|
+
if (removeCount !== hunk.oldLines) {
|
|
16916
|
+
throw new Error("Removed line count did not match for hunk at line " + (chunkHeaderIndex + 1));
|
|
16917
|
+
}
|
|
16918
|
+
return hunk;
|
|
16919
|
+
}
|
|
16920
|
+
while (i3 < diffstr.length) {
|
|
16921
|
+
parseIndex();
|
|
16922
|
+
}
|
|
16923
|
+
return list;
|
|
16924
|
+
}
|
|
16925
|
+
function reversePatch(structuredPatch) {
|
|
16926
|
+
if (Array.isArray(structuredPatch)) {
|
|
16927
|
+
return structuredPatch.map(reversePatch).reverse();
|
|
16928
|
+
}
|
|
16929
|
+
return _objectSpread2(_objectSpread2({}, structuredPatch), {}, {
|
|
16930
|
+
oldFileName: structuredPatch.newFileName,
|
|
16931
|
+
oldHeader: structuredPatch.newHeader,
|
|
16932
|
+
newFileName: structuredPatch.oldFileName,
|
|
16933
|
+
newHeader: structuredPatch.oldHeader,
|
|
16934
|
+
hunks: structuredPatch.hunks.map(function(hunk) {
|
|
16935
|
+
return {
|
|
16936
|
+
oldLines: hunk.newLines,
|
|
16937
|
+
oldStart: hunk.newStart,
|
|
16938
|
+
newLines: hunk.oldLines,
|
|
16939
|
+
newStart: hunk.oldStart,
|
|
16940
|
+
lines: hunk.lines.map(function(l2) {
|
|
16941
|
+
if (l2.startsWith("-")) {
|
|
16942
|
+
return "+".concat(l2.slice(1));
|
|
16943
|
+
}
|
|
16944
|
+
if (l2.startsWith("+")) {
|
|
16945
|
+
return "-".concat(l2.slice(1));
|
|
16946
|
+
}
|
|
16947
|
+
return l2;
|
|
16948
|
+
})
|
|
16949
|
+
};
|
|
16950
|
+
})
|
|
16951
|
+
});
|
|
16952
|
+
}
|
|
16953
|
+
|
|
16954
|
+
// ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
16955
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
16956
|
+
function normalizeWindowsPath(input = "") {
|
|
16957
|
+
if (!input) {
|
|
16958
|
+
return input;
|
|
16959
|
+
}
|
|
16960
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r2) => r2.toUpperCase());
|
|
16961
|
+
}
|
|
16962
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
16963
|
+
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
16964
|
+
function cwd() {
|
|
16965
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
16966
|
+
return process.cwd().replace(/\\/g, "/");
|
|
16967
|
+
}
|
|
16968
|
+
return "/";
|
|
16969
|
+
}
|
|
16970
|
+
var resolve2 = function(...arguments_) {
|
|
16971
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
16972
|
+
let resolvedPath = "";
|
|
16973
|
+
let resolvedAbsolute = false;
|
|
16974
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
16975
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
16976
|
+
if (!path || path.length === 0) {
|
|
16977
|
+
continue;
|
|
16978
|
+
}
|
|
16979
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
16980
|
+
resolvedAbsolute = isAbsolute(path);
|
|
16981
|
+
}
|
|
16982
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
16983
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
16984
|
+
return `/${resolvedPath}`;
|
|
16985
|
+
}
|
|
16986
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
16987
|
+
};
|
|
16988
|
+
function normalizeString(path, allowAboveRoot) {
|
|
16989
|
+
let res = "";
|
|
16990
|
+
let lastSegmentLength = 0;
|
|
16991
|
+
let lastSlash = -1;
|
|
16992
|
+
let dots = 0;
|
|
16993
|
+
let char = null;
|
|
16994
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
16995
|
+
if (index < path.length) {
|
|
16996
|
+
char = path[index];
|
|
16997
|
+
} else if (char === "/") {
|
|
16998
|
+
break;
|
|
16999
|
+
} else {
|
|
17000
|
+
char = "/";
|
|
17001
|
+
}
|
|
17002
|
+
if (char === "/") {
|
|
17003
|
+
if (lastSlash === index - 1 || dots === 1) ;
|
|
17004
|
+
else if (dots === 2) {
|
|
17005
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
17006
|
+
if (res.length > 2) {
|
|
17007
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
17008
|
+
if (lastSlashIndex === -1) {
|
|
17009
|
+
res = "";
|
|
17010
|
+
lastSegmentLength = 0;
|
|
17011
|
+
} else {
|
|
17012
|
+
res = res.slice(0, lastSlashIndex);
|
|
17013
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
17014
|
+
}
|
|
17015
|
+
lastSlash = index;
|
|
17016
|
+
dots = 0;
|
|
17017
|
+
continue;
|
|
17018
|
+
} else if (res.length > 0) {
|
|
17019
|
+
res = "";
|
|
17020
|
+
lastSegmentLength = 0;
|
|
17021
|
+
lastSlash = index;
|
|
17022
|
+
dots = 0;
|
|
17023
|
+
continue;
|
|
17024
|
+
}
|
|
17025
|
+
}
|
|
17026
|
+
if (allowAboveRoot) {
|
|
17027
|
+
res += res.length > 0 ? "/.." : "..";
|
|
17028
|
+
lastSegmentLength = 2;
|
|
17029
|
+
}
|
|
17030
|
+
} else {
|
|
17031
|
+
if (res.length > 0) {
|
|
17032
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
17033
|
+
} else {
|
|
17034
|
+
res = path.slice(lastSlash + 1, index);
|
|
17035
|
+
}
|
|
17036
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
17037
|
+
}
|
|
17038
|
+
lastSlash = index;
|
|
17039
|
+
dots = 0;
|
|
17040
|
+
} else if (char === "." && dots !== -1) {
|
|
17041
|
+
++dots;
|
|
17042
|
+
} else {
|
|
17043
|
+
dots = -1;
|
|
17044
|
+
}
|
|
17045
|
+
}
|
|
17046
|
+
return res;
|
|
17047
|
+
}
|
|
17048
|
+
var isAbsolute = function(p) {
|
|
17049
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
17050
|
+
};
|
|
17051
|
+
var relative = function(from, to) {
|
|
17052
|
+
const _from = resolve2(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
17053
|
+
const _to = resolve2(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
17054
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
17055
|
+
return _to.join("/");
|
|
17056
|
+
}
|
|
17057
|
+
const _fromCopy = [..._from];
|
|
17058
|
+
for (const segment of _fromCopy) {
|
|
17059
|
+
if (_to[0] !== segment) {
|
|
17060
|
+
break;
|
|
17061
|
+
}
|
|
17062
|
+
_from.shift();
|
|
17063
|
+
_to.shift();
|
|
17064
|
+
}
|
|
17065
|
+
return [..._from.map(() => ".."), ..._to].join("/");
|
|
17066
|
+
};
|
|
17067
|
+
|
|
17068
|
+
// ../../node_modules/.pnpm/ami-sdk@0.0.6/node_modules/ami-sdk/dist/index.js
|
|
17069
|
+
var i2 = "https://app.ami.dev";
|
|
17070
|
+
var l = "https://bridge.ami.dev";
|
|
17071
|
+
var d2 = `${i2}/api/v1/trpc`;
|
|
17072
|
+
var f = async (t2) => {
|
|
17073
|
+
let o2 = "completed";
|
|
17074
|
+
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);
|
|
17075
|
+
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.`);
|
|
17076
|
+
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) {
|
|
17077
|
+
l2.push(e), t3.enqueue(e), "data-lifecycle" === e.type && (o2 = e.data.status);
|
|
16078
17078
|
} })), terminateOnError: true });
|
|
16079
|
-
for await (const e of
|
|
16080
|
-
if (
|
|
16081
|
-
await
|
|
17079
|
+
for await (const e of u) {
|
|
17080
|
+
if (r2.signal.aborted) break;
|
|
17081
|
+
await t2.upsertMessage(e);
|
|
16082
17082
|
}
|
|
16083
|
-
return
|
|
17083
|
+
return { status: o2, chatId: s2 };
|
|
16084
17084
|
};
|
|
16085
|
-
var
|
|
16086
|
-
var
|
|
16087
|
-
var
|
|
16088
|
-
const
|
|
16089
|
-
|
|
17085
|
+
var h2 = () => nanoid();
|
|
17086
|
+
var _ = (e) => ({ id: e.id, role: e.role, parts: [{ type: "text", text: e.content }], createdAt: /* @__PURE__ */ new Date() });
|
|
17087
|
+
var R = async (e) => {
|
|
17088
|
+
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 }) });
|
|
17089
|
+
if (!t2.ok) {
|
|
17090
|
+
const e2 = await t2.text();
|
|
17091
|
+
throw new Error(`Failed to create chat: ${t2.status} ${t2.statusText}${e2 ? ` - ${e2}` : ""}`);
|
|
17092
|
+
}
|
|
17093
|
+
return (await t2.json()).result.data;
|
|
16090
17094
|
};
|
|
16091
17095
|
var g = class extends DefaultChatTransport {
|
|
16092
17096
|
parseStream(e) {
|
|
16093
17097
|
return this.processResponseStream(e);
|
|
16094
17098
|
}
|
|
16095
17099
|
};
|
|
16096
|
-
|
|
16097
|
-
var
|
|
16098
|
-
var w =
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
|
|
17100
|
+
new TextEncoder();
|
|
17101
|
+
var m = new TextDecoder();
|
|
17102
|
+
var w = class extends Error {
|
|
17103
|
+
constructor(e, t2) {
|
|
17104
|
+
super(e, t2), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, Error.captureStackTrace?.(this, this.constructor);
|
|
17105
|
+
}
|
|
17106
|
+
};
|
|
17107
|
+
w.code = "ERR_JOSE_GENERIC";
|
|
17108
|
+
(class extends w {
|
|
17109
|
+
constructor(e, t2, o2 = "unspecified", r2 = "unspecified") {
|
|
17110
|
+
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;
|
|
17111
|
+
}
|
|
17112
|
+
}).code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
17113
|
+
(class extends w {
|
|
17114
|
+
constructor(e, t2, o2 = "unspecified", r2 = "unspecified") {
|
|
17115
|
+
super(e, { cause: { claim: o2, reason: r2, payload: t2 } }), this.code = "ERR_JWT_EXPIRED", this.claim = o2, this.reason = r2, this.payload = t2;
|
|
17116
|
+
}
|
|
17117
|
+
}).code = "ERR_JWT_EXPIRED";
|
|
17118
|
+
(class extends w {
|
|
17119
|
+
constructor() {
|
|
17120
|
+
super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
17121
|
+
}
|
|
17122
|
+
}).code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
17123
|
+
(class extends w {
|
|
17124
|
+
constructor() {
|
|
17125
|
+
super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
|
|
17126
|
+
}
|
|
17127
|
+
}).code = "ERR_JOSE_NOT_SUPPORTED";
|
|
17128
|
+
(class extends w {
|
|
17129
|
+
constructor(e = "decryption operation failed", t2) {
|
|
17130
|
+
super(e, t2), this.code = "ERR_JWE_DECRYPTION_FAILED";
|
|
17131
|
+
}
|
|
17132
|
+
}).code = "ERR_JWE_DECRYPTION_FAILED";
|
|
17133
|
+
(class extends w {
|
|
17134
|
+
constructor() {
|
|
17135
|
+
super(...arguments), this.code = "ERR_JWE_INVALID";
|
|
17136
|
+
}
|
|
17137
|
+
}).code = "ERR_JWE_INVALID";
|
|
17138
|
+
(class extends w {
|
|
17139
|
+
constructor() {
|
|
17140
|
+
super(...arguments), this.code = "ERR_JWS_INVALID";
|
|
17141
|
+
}
|
|
17142
|
+
}).code = "ERR_JWS_INVALID";
|
|
17143
|
+
var I = class extends w {
|
|
17144
|
+
constructor() {
|
|
17145
|
+
super(...arguments), this.code = "ERR_JWT_INVALID";
|
|
17146
|
+
}
|
|
17147
|
+
};
|
|
17148
|
+
I.code = "ERR_JWT_INVALID";
|
|
17149
|
+
(class extends w {
|
|
17150
|
+
constructor() {
|
|
17151
|
+
super(...arguments), this.code = "ERR_JWK_INVALID";
|
|
17152
|
+
}
|
|
17153
|
+
}).code = "ERR_JWK_INVALID";
|
|
17154
|
+
(class extends w {
|
|
17155
|
+
constructor() {
|
|
17156
|
+
super(...arguments), this.code = "ERR_JWKS_INVALID";
|
|
17157
|
+
}
|
|
17158
|
+
}).code = "ERR_JWKS_INVALID";
|
|
17159
|
+
(class extends w {
|
|
17160
|
+
constructor(e = "no applicable key found in the JSON Web Key Set", t2) {
|
|
17161
|
+
super(e, t2), this.code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
17162
|
+
}
|
|
17163
|
+
}).code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
17164
|
+
(class extends w {
|
|
17165
|
+
constructor(e = "multiple matching keys found in the JSON Web Key Set", t2) {
|
|
17166
|
+
super(e, t2), this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
17167
|
+
}
|
|
17168
|
+
}).code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
17169
|
+
(class extends w {
|
|
17170
|
+
constructor(e = "request timed out", t2) {
|
|
17171
|
+
super(e, t2), this.code = "ERR_JWKS_TIMEOUT";
|
|
17172
|
+
}
|
|
17173
|
+
}).code = "ERR_JWKS_TIMEOUT";
|
|
17174
|
+
(class extends w {
|
|
17175
|
+
constructor(e = "signature verification failed", t2) {
|
|
17176
|
+
super(e, t2), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
17177
|
+
}
|
|
17178
|
+
}).code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
17179
|
+
var y = (e) => {
|
|
17180
|
+
let t2 = e;
|
|
17181
|
+
t2 instanceof Uint8Array && (t2 = m.decode(t2)), t2 = t2.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
17182
|
+
try {
|
|
17183
|
+
return ((e2) => {
|
|
17184
|
+
const t3 = atob(e2), o2 = new Uint8Array(t3.length);
|
|
17185
|
+
for (let e3 = 0; e3 < t3.length; e3++) o2[e3] = t3.charCodeAt(e3);
|
|
17186
|
+
return o2;
|
|
17187
|
+
})(t2);
|
|
17188
|
+
} catch {
|
|
17189
|
+
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
17190
|
+
}
|
|
17191
|
+
};
|
|
17192
|
+
function T(e) {
|
|
17193
|
+
if ("string" != typeof e) throw new I("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
17194
|
+
const { 1: t2, length: o2 } = e.split(".");
|
|
17195
|
+
if (5 === o2) throw new I("Only JWTs using Compact JWS serialization can be decoded");
|
|
17196
|
+
if (3 !== o2) throw new I("Invalid JWT");
|
|
17197
|
+
if (!t2) throw new I("JWTs must contain a payload");
|
|
17198
|
+
let r2, s2;
|
|
17199
|
+
try {
|
|
17200
|
+
r2 = y(t2);
|
|
17201
|
+
} catch {
|
|
17202
|
+
throw new I("Failed to base64url decode the payload");
|
|
17203
|
+
}
|
|
17204
|
+
try {
|
|
17205
|
+
s2 = JSON.parse(m.decode(r2));
|
|
17206
|
+
} catch {
|
|
17207
|
+
throw new I("Failed to parse the decoded payload as JSON");
|
|
17208
|
+
}
|
|
17209
|
+
if (!(function(e2) {
|
|
17210
|
+
if ("object" != typeof (t3 = e2) || null === t3 || "[object Object]" !== Object.prototype.toString.call(e2)) return false;
|
|
17211
|
+
var t3;
|
|
17212
|
+
if (null === Object.getPrototypeOf(e2)) return true;
|
|
17213
|
+
let o3 = e2;
|
|
17214
|
+
for (; null !== Object.getPrototypeOf(o3); ) o3 = Object.getPrototypeOf(o3);
|
|
17215
|
+
return Object.getPrototypeOf(e2) === o3;
|
|
17216
|
+
})(s2)) throw new I("Invalid JWT Claims Set");
|
|
17217
|
+
return s2;
|
|
17218
|
+
}
|
|
17219
|
+
var b = (e) => external_exports.object({ result: external_exports.object({ data: e }) });
|
|
17220
|
+
var A = b(external_exports.object({ token: external_exports.string() }));
|
|
17221
|
+
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() }));
|
|
17222
|
+
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() });
|
|
17223
|
+
var O = b(external_exports.object({ hasMore: external_exports.boolean(), nextCursor: external_exports.number().optional(), projects: external_exports.array(k) }));
|
|
17224
|
+
b(k);
|
|
17225
|
+
var C = (e) => new Promise((t2) => setTimeout(t2, e));
|
|
17226
|
+
var N = async () => {
|
|
17227
|
+
const e = await fetch(`${d2}/user.token.registerDaemonToken`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
|
|
16105
17228
|
if (!e.ok) throw new Error(`Failed to create exchange token: ${e.status}`);
|
|
16106
|
-
const
|
|
16107
|
-
return
|
|
17229
|
+
const t2 = await e.json();
|
|
17230
|
+
return A.parse(t2).result.data.token;
|
|
16108
17231
|
};
|
|
16109
17232
|
var j = async (e) => {
|
|
16110
|
-
const
|
|
16111
|
-
if (!
|
|
16112
|
-
const
|
|
16113
|
-
return
|
|
17233
|
+
const t2 = new URLSearchParams({ input: JSON.stringify({ token: e }) }), o2 = await fetch(`${d2}/user.token.checkIfVerified?${t2}`, { method: "GET", headers: { "Content-Type": "application/json" } });
|
|
17234
|
+
if (!o2.ok) throw new Error(`Failed to check verification: ${o2.status}`);
|
|
17235
|
+
const r2 = await o2.json();
|
|
17236
|
+
return S.parse(r2).result.data;
|
|
16114
17237
|
};
|
|
16115
|
-
var
|
|
16116
|
-
var
|
|
16117
|
-
for (let
|
|
16118
|
-
await
|
|
17238
|
+
var W = (e) => `${i2}/daemon/auth?token=${e}`;
|
|
17239
|
+
var D = async (e, t2, o2 = 60) => {
|
|
17240
|
+
for (let r2 = 0; r2 < o2; r2++) {
|
|
17241
|
+
await C(1e3);
|
|
16119
17242
|
try {
|
|
16120
|
-
const
|
|
16121
|
-
if (
|
|
16122
|
-
if (
|
|
17243
|
+
const o3 = await j(e);
|
|
17244
|
+
if (o3.expired) return t2("expired"), { success: false };
|
|
17245
|
+
if (o3.verified) return t2("success"), { success: true, token: o3.token, bridgeToken: o3.bridge_token };
|
|
16123
17246
|
} catch {
|
|
16124
17247
|
}
|
|
16125
17248
|
}
|
|
16126
17249
|
return { success: false };
|
|
16127
17250
|
};
|
|
17251
|
+
var x = (e) => T(e);
|
|
17252
|
+
var L = (e) => T(e);
|
|
17253
|
+
var P = (e) => L(e).userId;
|
|
17254
|
+
var $ = async (e) => {
|
|
17255
|
+
const t2 = await N(), o2 = W(t2);
|
|
17256
|
+
window.open(o2, "_blank");
|
|
17257
|
+
const r2 = await D(t2, e ?? (() => {
|
|
17258
|
+
}));
|
|
17259
|
+
if (r2.success && r2.token && r2.bridgeToken) {
|
|
17260
|
+
const e2 = x(r2.token), t3 = L(r2.bridgeToken), o3 = new Date(1e3 * e2.exp);
|
|
17261
|
+
return { success: true, token: r2.token, bridgeToken: r2.bridgeToken, userId: t3.userId, email: e2.email, expiresAt: o3 };
|
|
17262
|
+
}
|
|
17263
|
+
return { success: false };
|
|
17264
|
+
};
|
|
17265
|
+
var U = async (e) => {
|
|
17266
|
+
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}` } });
|
|
17267
|
+
if (!o2.ok) throw new Error(`Failed to list projects: ${o2.status}`);
|
|
17268
|
+
const r2 = await o2.json();
|
|
17269
|
+
return O.parse(r2).result.data;
|
|
17270
|
+
};
|
|
17271
|
+
var K = (e) => e.type.startsWith("tool-");
|
|
17272
|
+
var G = (e, t2) => {
|
|
17273
|
+
const o2 = [];
|
|
17274
|
+
if (!K(e)) return [];
|
|
17275
|
+
const r2 = e;
|
|
17276
|
+
if ("tool-Edit_041125" === r2.type && r2.input) {
|
|
17277
|
+
const e2 = r2.input.file_path, s2 = r2.output;
|
|
17278
|
+
if (e2 && s2 && "success" === s2.type) {
|
|
17279
|
+
const n2 = s2.result.diff, c2 = isAbsolute(e2) ? relative(t2, e2) : e2;
|
|
17280
|
+
o2.push({ toolId: r2.toolCallId, diff: n2, filePath: c2, deleted: false, beforeContent: s2.result.$metadata?.beforeContent ?? null });
|
|
17281
|
+
}
|
|
17282
|
+
} else if ("tool-Edit_021025" === r2.type && r2.input) {
|
|
17283
|
+
const e2 = r2.input.relative_file_path, s2 = r2.output;
|
|
17284
|
+
if (e2 && s2 && "success" === s2.type) {
|
|
17285
|
+
const n2 = s2.result.diff, c2 = isAbsolute(e2) ? relative(t2, e2) : e2;
|
|
17286
|
+
o2.push({ toolId: r2.toolCallId, diff: n2, filePath: c2, deleted: false, beforeContent: s2.result.$metadata?.beforeContent ?? null });
|
|
17287
|
+
}
|
|
17288
|
+
} else if ("tool-Write_021025" === r2.type) {
|
|
17289
|
+
const e2 = r2.output;
|
|
17290
|
+
if ("success" === e2?.type) {
|
|
17291
|
+
const s2 = e2.result.diff, n2 = e2.result.filePath, c2 = "create" === e2.result.type;
|
|
17292
|
+
if (n2) {
|
|
17293
|
+
const i3 = isAbsolute(n2) ? relative(t2, n2) : n2;
|
|
17294
|
+
o2.push({ toolId: r2.toolCallId, diff: s2, filePath: i3, deleted: c2, beforeContent: e2.result.$metadata?.beforeContent ?? null });
|
|
17295
|
+
}
|
|
17296
|
+
}
|
|
17297
|
+
}
|
|
17298
|
+
return o2;
|
|
17299
|
+
};
|
|
17300
|
+
var M = (e, t2, o2) => {
|
|
17301
|
+
const r2 = [];
|
|
17302
|
+
if (o2) for (const e2 of o2) {
|
|
17303
|
+
const o3 = G(e2, t2);
|
|
17304
|
+
o3 && r2.push(...o3);
|
|
17305
|
+
}
|
|
17306
|
+
else for (const o3 of e) for (const e2 of o3.parts) {
|
|
17307
|
+
const o4 = G(e2, t2);
|
|
17308
|
+
o4 && r2.push(...o4);
|
|
17309
|
+
}
|
|
17310
|
+
const a2 = r2.filter((e2, t3, o3) => t3 === o3.findIndex((t4) => t4.filePath === e2.filePath && t4.deleted === e2.deleted && t4.diff === e2.diff)), c2 = [];
|
|
17311
|
+
for (const { diff: e2, filePath: t3, deleted: o3 } of a2) {
|
|
17312
|
+
if ("[DELETED]" === e2) continue;
|
|
17313
|
+
const r3 = parsePatch(e2);
|
|
17314
|
+
for (const e3 of r3) {
|
|
17315
|
+
const r4 = reversePatch(e3);
|
|
17316
|
+
c2.push({ filePath: t3, patch: r4, deleted: o3 });
|
|
17317
|
+
}
|
|
17318
|
+
}
|
|
17319
|
+
return c2;
|
|
17320
|
+
};
|
|
17321
|
+
var B = (e) => {
|
|
17322
|
+
try {
|
|
17323
|
+
let t2;
|
|
17324
|
+
if (e.toolCallId) {
|
|
17325
|
+
let o2 = null;
|
|
17326
|
+
for (const t3 of e.messages) {
|
|
17327
|
+
for (const r2 of t3.parts) if (K(r2)) {
|
|
17328
|
+
if (r2.toolCallId === e.toolCallId) {
|
|
17329
|
+
o2 = r2;
|
|
17330
|
+
break;
|
|
17331
|
+
}
|
|
17332
|
+
}
|
|
17333
|
+
if (o2) break;
|
|
17334
|
+
}
|
|
17335
|
+
if (!o2) return { success: false, patches: [], error: "Tool call not found" };
|
|
17336
|
+
t2 = M(e.messages, e.cwd, [o2]);
|
|
17337
|
+
} else {
|
|
17338
|
+
let o2 = null;
|
|
17339
|
+
for (let t3 = e.messages.length - 1; t3 >= 0; t3--) {
|
|
17340
|
+
const r2 = e.messages[t3];
|
|
17341
|
+
if (r2 && "assistant" === r2.role) {
|
|
17342
|
+
o2 = r2;
|
|
17343
|
+
break;
|
|
17344
|
+
}
|
|
17345
|
+
}
|
|
17346
|
+
if (!o2) return { success: false, patches: [], error: "No assistant message found" };
|
|
17347
|
+
t2 = M([o2], e.cwd);
|
|
17348
|
+
}
|
|
17349
|
+
return 0 === t2.length ? { success: false, patches: [], error: "No file changes to revert" } : { success: true, patches: t2 };
|
|
17350
|
+
} catch (e2) {
|
|
17351
|
+
return { success: false, patches: [], error: e2 instanceof Error ? e2.message : "Unknown error" };
|
|
17352
|
+
}
|
|
17353
|
+
};
|
|
17354
|
+
var X = async (e) => {
|
|
17355
|
+
const { applyRevertPatchesViaCli: t2 } = await Promise.resolve().then(() => (init_cli_rpc_TXHB6KVB(), cli_rpc_TXHB6KVB_exports)), o2 = await t2(e);
|
|
17356
|
+
return { success: o2.success ?? false, error: o2.error };
|
|
17357
|
+
};
|
|
17358
|
+
var q = async (e) => {
|
|
17359
|
+
const t2 = B(e);
|
|
17360
|
+
if (!t2.success) return t2;
|
|
17361
|
+
const o2 = await X({ patches: t2.patches, cwd: e.cwd });
|
|
17362
|
+
return { success: o2.success, patches: t2.patches, error: o2.error };
|
|
17363
|
+
};
|
|
16128
17364
|
|
|
16129
17365
|
// src/client.ts
|
|
16130
17366
|
var STORAGE_KEY = "react-grab:agent-sessions";
|
|
16131
17367
|
var TOKEN_STORAGE_KEY = "react-grab:ami-token";
|
|
16132
|
-
var
|
|
16133
|
-
var
|
|
17368
|
+
var BRIDGE_TOKEN_STORAGE_KEY = "react-grab:ami-bridge-token";
|
|
17369
|
+
var loadCachedAuth = () => {
|
|
16134
17370
|
try {
|
|
16135
|
-
|
|
17371
|
+
const token = sessionStorage.getItem(TOKEN_STORAGE_KEY);
|
|
17372
|
+
const bridgeToken = sessionStorage.getItem(BRIDGE_TOKEN_STORAGE_KEY);
|
|
17373
|
+
if (!token || !bridgeToken) return null;
|
|
17374
|
+
const userId = P(bridgeToken);
|
|
17375
|
+
return { token, bridgeToken, userId };
|
|
16136
17376
|
} catch {
|
|
16137
17377
|
return null;
|
|
16138
17378
|
}
|
|
16139
17379
|
};
|
|
16140
|
-
var
|
|
17380
|
+
var saveCachedAuth = (auth) => {
|
|
16141
17381
|
try {
|
|
16142
|
-
|
|
17382
|
+
sessionStorage.setItem(TOKEN_STORAGE_KEY, auth.token);
|
|
17383
|
+
sessionStorage.setItem(BRIDGE_TOKEN_STORAGE_KEY, auth.bridgeToken);
|
|
16143
17384
|
} catch {
|
|
16144
17385
|
}
|
|
16145
17386
|
};
|
|
16146
|
-
var
|
|
16147
|
-
const
|
|
16148
|
-
|
|
16149
|
-
window.open(authUrl, "_blank");
|
|
16150
|
-
const result = await T(exchangeToken, () => {
|
|
16151
|
-
});
|
|
16152
|
-
if (!result.success || !result.token) {
|
|
17387
|
+
var performAuthentication = async () => {
|
|
17388
|
+
const result = await $();
|
|
17389
|
+
if (!result.success || !result.token || !result.bridgeToken) {
|
|
16153
17390
|
throw new Error("Authentication failed");
|
|
16154
17391
|
}
|
|
16155
|
-
|
|
16156
|
-
|
|
17392
|
+
const auth = {
|
|
17393
|
+
token: result.token,
|
|
17394
|
+
bridgeToken: result.bridgeToken,
|
|
17395
|
+
userId: result.userId
|
|
17396
|
+
};
|
|
17397
|
+
saveCachedAuth(auth);
|
|
17398
|
+
r({
|
|
17399
|
+
bridgeToken: auth.bridgeToken,
|
|
17400
|
+
userId: auth.userId
|
|
17401
|
+
});
|
|
17402
|
+
return auth;
|
|
16157
17403
|
};
|
|
16158
|
-
var
|
|
16159
|
-
const
|
|
16160
|
-
if (
|
|
16161
|
-
|
|
17404
|
+
var getOrCreateAuth = async () => {
|
|
17405
|
+
const cachedAuth = loadCachedAuth();
|
|
17406
|
+
if (cachedAuth) {
|
|
17407
|
+
r({
|
|
17408
|
+
bridgeToken: cachedAuth.bridgeToken,
|
|
17409
|
+
userId: cachedAuth.userId
|
|
17410
|
+
});
|
|
17411
|
+
return cachedAuth;
|
|
16162
17412
|
}
|
|
16163
|
-
return
|
|
17413
|
+
return performAuthentication();
|
|
16164
17414
|
};
|
|
16165
17415
|
var isToolPart = (part) => {
|
|
16166
17416
|
return part.type.startsWith("tool-");
|
|
@@ -16184,19 +17434,19 @@ var sanitizeMessages = (messages) => {
|
|
|
16184
17434
|
}
|
|
16185
17435
|
return sanitized;
|
|
16186
17436
|
};
|
|
16187
|
-
var runAgent = async (context, token, projectId, onStatus) => {
|
|
16188
|
-
const
|
|
17437
|
+
var runAgent = async (context, token, projectId, onStatus, existingMessages, existingChatId) => {
|
|
17438
|
+
const isFollowUp = Boolean(existingMessages && existingMessages.length > 0);
|
|
17439
|
+
const userMessageContent = isFollowUp ? context.prompt : `${context.prompt}
|
|
16189
17440
|
|
|
16190
17441
|
${context.content}`;
|
|
16191
|
-
const messages = [
|
|
16192
|
-
|
|
16193
|
-
|
|
17442
|
+
const messages = existingMessages ? [...existingMessages] : [];
|
|
17443
|
+
messages.push(
|
|
17444
|
+
_({
|
|
17445
|
+
id: h2(),
|
|
16194
17446
|
role: "user",
|
|
16195
|
-
content:
|
|
17447
|
+
content: userMessageContent
|
|
16196
17448
|
})
|
|
16197
|
-
|
|
16198
|
-
const chatId = d();
|
|
16199
|
-
const environment = u(window.location.href);
|
|
17449
|
+
);
|
|
16200
17450
|
const upsertMessage = async (message) => {
|
|
16201
17451
|
const existingIndex = messages.findIndex((m2) => m2.id === message.id);
|
|
16202
17452
|
if (existingIndex >= 0) {
|
|
@@ -16211,28 +17461,50 @@ ${context.content}`;
|
|
|
16211
17461
|
}
|
|
16212
17462
|
}
|
|
16213
17463
|
};
|
|
16214
|
-
const
|
|
17464
|
+
const environmentResult = await d(projectId);
|
|
17465
|
+
if (environmentResult._tag !== "Success") {
|
|
17466
|
+
throw new Error("Failed to get environment");
|
|
17467
|
+
}
|
|
17468
|
+
const { status, chatId } = await f({
|
|
16215
17469
|
messages: sanitizeMessages(messages),
|
|
16216
17470
|
context: {
|
|
16217
|
-
environment,
|
|
17471
|
+
environment: environmentResult.environment,
|
|
16218
17472
|
systemContext: [],
|
|
16219
17473
|
attachments: []
|
|
16220
17474
|
},
|
|
16221
|
-
url: `${
|
|
16222
|
-
chatId,
|
|
17475
|
+
url: `${l}/api/v1/agent-proxy`,
|
|
17476
|
+
chatId: existingChatId,
|
|
16223
17477
|
projectId,
|
|
16224
17478
|
token,
|
|
16225
17479
|
upsertMessage,
|
|
16226
17480
|
getMessages: () => sanitizeMessages(messages)
|
|
16227
17481
|
});
|
|
16228
|
-
|
|
17482
|
+
switch (status) {
|
|
17483
|
+
case "error":
|
|
17484
|
+
throw new Error("Failed to complete task");
|
|
17485
|
+
case "aborted":
|
|
17486
|
+
throw new Error("User aborted task");
|
|
17487
|
+
default:
|
|
17488
|
+
return { status: "Completed successfully", messages, chatId };
|
|
17489
|
+
}
|
|
16229
17490
|
};
|
|
16230
17491
|
var CONNECTION_CHECK_TTL_MS = 5e3;
|
|
16231
|
-
var createAmiAgentProvider = (projectId
|
|
17492
|
+
var createAmiAgentProvider = (projectId) => {
|
|
16232
17493
|
let connectionCache = null;
|
|
17494
|
+
let lastAgentMessages = null;
|
|
17495
|
+
const sessionData = /* @__PURE__ */ new Map();
|
|
17496
|
+
const getLatestProjectId = async (token) => {
|
|
17497
|
+
const projects = await U({ token, limit: 1 });
|
|
17498
|
+
const latestProject = projects.projects[0];
|
|
17499
|
+
return latestProject?.id;
|
|
17500
|
+
};
|
|
16233
17501
|
return {
|
|
16234
17502
|
send: async function* (context, signal) {
|
|
16235
|
-
const
|
|
17503
|
+
const auth = await getOrCreateAuth();
|
|
17504
|
+
projectId = await getLatestProjectId(auth.token);
|
|
17505
|
+
if (!projectId) {
|
|
17506
|
+
throw new Error("No project found");
|
|
17507
|
+
}
|
|
16236
17508
|
yield "Thinking...";
|
|
16237
17509
|
const statusQueue = [];
|
|
16238
17510
|
let resolveWait = null;
|
|
@@ -16253,12 +17525,27 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
|
|
|
16253
17525
|
resolveWait = null;
|
|
16254
17526
|
}
|
|
16255
17527
|
};
|
|
16256
|
-
const
|
|
17528
|
+
const existingData = context.sessionId ? sessionData.get(context.sessionId) : void 0;
|
|
17529
|
+
const agentPromise = runAgent(
|
|
17530
|
+
context,
|
|
17531
|
+
auth.token,
|
|
17532
|
+
projectId,
|
|
17533
|
+
onStatus,
|
|
17534
|
+
existingData?.messages,
|
|
17535
|
+
existingData?.chatId
|
|
17536
|
+
);
|
|
16257
17537
|
let done = false;
|
|
16258
17538
|
let caughtError = null;
|
|
16259
|
-
agentPromise.then((
|
|
17539
|
+
agentPromise.then((result) => {
|
|
16260
17540
|
if (aborted2) return;
|
|
16261
|
-
|
|
17541
|
+
lastAgentMessages = result.messages;
|
|
17542
|
+
if (context.sessionId) {
|
|
17543
|
+
sessionData.set(context.sessionId, {
|
|
17544
|
+
messages: result.messages,
|
|
17545
|
+
chatId: result.chatId
|
|
17546
|
+
});
|
|
17547
|
+
}
|
|
17548
|
+
statusQueue.push(result.status);
|
|
16262
17549
|
done = true;
|
|
16263
17550
|
if (resolveWait) {
|
|
16264
17551
|
resolveWait();
|
|
@@ -16281,8 +17568,8 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
|
|
|
16281
17568
|
if (statusQueue.length > 0) {
|
|
16282
17569
|
yield statusQueue.shift();
|
|
16283
17570
|
} else {
|
|
16284
|
-
await new Promise((
|
|
16285
|
-
resolveWait =
|
|
17571
|
+
await new Promise((resolve3) => {
|
|
17572
|
+
resolveWait = resolve3;
|
|
16286
17573
|
});
|
|
16287
17574
|
}
|
|
16288
17575
|
}
|
|
@@ -16310,7 +17597,7 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
|
|
|
16310
17597
|
throw new Error(`Session ${sessionId} not found`);
|
|
16311
17598
|
}
|
|
16312
17599
|
const context = session.context;
|
|
16313
|
-
const
|
|
17600
|
+
const auth = await getOrCreateAuth();
|
|
16314
17601
|
yield "Resuming...";
|
|
16315
17602
|
const statusQueue = [];
|
|
16316
17603
|
let resolveWait = null;
|
|
@@ -16331,12 +17618,17 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
|
|
|
16331
17618
|
resolveWait = null;
|
|
16332
17619
|
}
|
|
16333
17620
|
};
|
|
16334
|
-
|
|
17621
|
+
projectId = await getLatestProjectId(auth.token);
|
|
17622
|
+
if (!projectId) {
|
|
17623
|
+
throw new Error("No project found");
|
|
17624
|
+
}
|
|
17625
|
+
const agentPromise = runAgent(context, auth.token, projectId, onStatus);
|
|
16335
17626
|
let done = false;
|
|
16336
17627
|
let caughtError = null;
|
|
16337
|
-
agentPromise.then((
|
|
17628
|
+
agentPromise.then((result) => {
|
|
16338
17629
|
if (aborted2) return;
|
|
16339
|
-
|
|
17630
|
+
lastAgentMessages = result.messages;
|
|
17631
|
+
statusQueue.push(result.status);
|
|
16340
17632
|
done = true;
|
|
16341
17633
|
if (resolveWait) {
|
|
16342
17634
|
resolveWait();
|
|
@@ -16359,8 +17651,8 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
|
|
|
16359
17651
|
if (statusQueue.length > 0) {
|
|
16360
17652
|
yield statusQueue.shift();
|
|
16361
17653
|
} else {
|
|
16362
|
-
await new Promise((
|
|
16363
|
-
resolveWait =
|
|
17654
|
+
await new Promise((resolve3) => {
|
|
17655
|
+
resolveWait = resolve3;
|
|
16364
17656
|
});
|
|
16365
17657
|
}
|
|
16366
17658
|
}
|
|
@@ -16378,13 +17670,14 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
|
|
|
16378
17670
|
}
|
|
16379
17671
|
},
|
|
16380
17672
|
supportsResume: true,
|
|
17673
|
+
supportsFollowUp: true,
|
|
16381
17674
|
checkConnection: async () => {
|
|
16382
17675
|
const now = Date.now();
|
|
16383
17676
|
if (connectionCache && now - connectionCache.timestamp < CONNECTION_CHECK_TTL_MS) {
|
|
16384
17677
|
return connectionCache.result;
|
|
16385
17678
|
}
|
|
16386
17679
|
try {
|
|
16387
|
-
const response = await fetch(
|
|
17680
|
+
const response = await fetch(l, { method: "HEAD" });
|
|
16388
17681
|
const result = response.ok;
|
|
16389
17682
|
connectionCache = { result, timestamp: now };
|
|
16390
17683
|
return result;
|
|
@@ -16392,25 +17685,43 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
|
|
|
16392
17685
|
connectionCache = { result: false, timestamp: now };
|
|
16393
17686
|
return false;
|
|
16394
17687
|
}
|
|
17688
|
+
},
|
|
17689
|
+
undo: async () => {
|
|
17690
|
+
if (!lastAgentMessages) return;
|
|
17691
|
+
try {
|
|
17692
|
+
await q({
|
|
17693
|
+
messages: lastAgentMessages,
|
|
17694
|
+
cwd: window.location.href
|
|
17695
|
+
});
|
|
17696
|
+
lastAgentMessages = null;
|
|
17697
|
+
} catch {
|
|
17698
|
+
}
|
|
16395
17699
|
}
|
|
16396
17700
|
};
|
|
16397
17701
|
};
|
|
16398
17702
|
var attachAgent = async () => {
|
|
16399
17703
|
if (typeof window === "undefined") return;
|
|
16400
17704
|
const provider = createAmiAgentProvider();
|
|
17705
|
+
const attach = (api2) => {
|
|
17706
|
+
api2.setAgent({ provider, storage: sessionStorage });
|
|
17707
|
+
};
|
|
16401
17708
|
const api = window.__REACT_GRAB__;
|
|
16402
17709
|
if (api) {
|
|
16403
|
-
api
|
|
17710
|
+
attach(api);
|
|
16404
17711
|
return;
|
|
16405
17712
|
}
|
|
16406
17713
|
window.addEventListener(
|
|
16407
17714
|
"react-grab:init",
|
|
16408
17715
|
(event) => {
|
|
16409
17716
|
const customEvent = event;
|
|
16410
|
-
customEvent.detail
|
|
17717
|
+
attach(customEvent.detail);
|
|
16411
17718
|
},
|
|
16412
17719
|
{ once: true }
|
|
16413
17720
|
);
|
|
17721
|
+
const apiAfterListener = window.__REACT_GRAB__;
|
|
17722
|
+
if (apiAfterListener) {
|
|
17723
|
+
attach(apiAfterListener);
|
|
17724
|
+
}
|
|
16414
17725
|
};
|
|
16415
17726
|
attachAgent();
|
|
16416
17727
|
|