@antdv-next/x-sdk 0.0.1 → 0.0.2

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.
Files changed (54) hide show
  1. package/dist/_util/resolveMaybeRef.d.ts +2 -0
  2. package/dist/_util/resolveMaybeRef.js +7 -0
  3. package/dist/_util/types.js +0 -0
  4. package/dist/chat-providers/AbstractChatProvider.d.ts +2 -2
  5. package/dist/chat-providers/AbstractChatProvider.js +42 -0
  6. package/dist/chat-providers/DeepSeekChatProvider.d.ts +2 -2
  7. package/dist/chat-providers/DeepSeekChatProvider.js +59 -0
  8. package/dist/chat-providers/DefaultChatProvider.d.ts +2 -2
  9. package/dist/chat-providers/DefaultChatProvider.js +26 -0
  10. package/dist/chat-providers/OpenAIChatProvider.d.ts +2 -2
  11. package/dist/chat-providers/OpenAIChatProvider.js +49 -0
  12. package/dist/chat-providers/index.js +4 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +7 -3
  15. package/dist/node_modules/vitest/dist/@vitest/expect/index.js +1456 -0
  16. package/dist/node_modules/vitest/dist/@vitest/pretty-format/index.js +884 -0
  17. package/dist/node_modules/vitest/dist/@vitest/runner/chunk-artifact.js +1543 -0
  18. package/dist/node_modules/vitest/dist/@vitest/snapshot/index.js +660 -0
  19. package/dist/node_modules/vitest/dist/@vitest/spy/index.js +384 -0
  20. package/dist/node_modules/vitest/dist/@vitest/utils/chunk-pathe.M-eThtNZ.js +80 -0
  21. package/dist/node_modules/vitest/dist/@vitest/utils/diff.js +1304 -0
  22. package/dist/node_modules/vitest/dist/@vitest/utils/display.js +556 -0
  23. package/dist/node_modules/vitest/dist/@vitest/utils/error.js +27 -0
  24. package/dist/node_modules/vitest/dist/@vitest/utils/helpers.js +179 -0
  25. package/dist/node_modules/vitest/dist/@vitest/utils/offset.js +25 -0
  26. package/dist/node_modules/vitest/dist/@vitest/utils/serialize.js +75 -0
  27. package/dist/node_modules/vitest/dist/@vitest/utils/source-map.js +371 -0
  28. package/dist/node_modules/vitest/dist/@vitest/utils/timers.js +35 -0
  29. package/dist/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +4 -0
  30. package/dist/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js +50 -0
  31. package/dist/node_modules/vitest/dist/chunks/test.CBQUpOM3.js +2640 -0
  32. package/dist/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js +42 -0
  33. package/dist/node_modules/vitest/dist/vendor/chai.js +2872 -0
  34. package/dist/node_modules/vitest/dist/vendor/magic-string.js +1009 -0
  35. package/dist/node_modules/vitest/dist/vendor/tinyrainbow.js +84 -0
  36. package/dist/x-chat/__tests__/index.test.d.ts +1 -0
  37. package/dist/x-chat/__tests__/index.test.js +257 -0
  38. package/dist/x-chat/index.d.ts +14 -23
  39. package/dist/x-chat/index.js +83 -66
  40. package/dist/x-chat/store.d.ts +2 -0
  41. package/dist/{store-C1diHqNH.js → x-chat/store.js} +15 -9
  42. package/dist/x-conversations/__tests__/index.test.d.ts +1 -0
  43. package/dist/x-conversations/__tests__/index.test.js +36 -0
  44. package/dist/x-conversations/index.d.ts +4 -4
  45. package/dist/x-conversations/index.js +37 -1
  46. package/dist/{x-conversations-BrKWhj5r.js → x-conversations/store.js} +2 -31
  47. package/dist/x-request/__tests__/index.test.d.ts +1 -0
  48. package/dist/x-request/__tests__/index.test.js +90 -0
  49. package/dist/x-request/index.d.ts +36 -11
  50. package/dist/x-request/index.js +246 -1
  51. package/dist/x-request/x-fetch.js +18 -0
  52. package/package.json +1 -1
  53. package/dist/chat-providers-5x9Va7p5.js +0 -167
  54. package/dist/x-request-BSFGaKND.js +0 -234
@@ -0,0 +1,179 @@
1
+ //#region ../../node_modules/vitest/dist/@vitest/utils/helpers.js
2
+ /**
3
+ * Get original stacktrace without source map support the most performant way.
4
+ * - Create only 1 stack frame.
5
+ * - Rewrite prepareStackTrace to bypass "support-stack-trace" (usually takes ~250ms).
6
+ */
7
+ function createSimpleStackTrace(options) {
8
+ const { message = "$$stack trace error", stackTraceLimit = 1 } = options || {};
9
+ const limit = Error.stackTraceLimit;
10
+ const prepareStackTrace = Error.prepareStackTrace;
11
+ Error.stackTraceLimit = stackTraceLimit;
12
+ Error.prepareStackTrace = (e) => e.stack;
13
+ const stackTrace = new Error(message).stack || "";
14
+ Error.prepareStackTrace = prepareStackTrace;
15
+ Error.stackTraceLimit = limit;
16
+ return stackTrace;
17
+ }
18
+ function notNullish(v) {
19
+ return v != null;
20
+ }
21
+ function assertTypes(value, name, types) {
22
+ const receivedType = typeof value;
23
+ if (!types.includes(receivedType)) throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
24
+ }
25
+ function isPrimitive(value) {
26
+ return value === null || typeof value !== "function" && typeof value !== "object";
27
+ }
28
+ function filterOutComments(s) {
29
+ const result = [];
30
+ let commentState = "none";
31
+ for (let i = 0; i < s.length; ++i) if (commentState === "singleline") {
32
+ if (s[i] === "\n") commentState = "none";
33
+ } else if (commentState === "multiline") {
34
+ if (s[i - 1] === "*" && s[i] === "/") commentState = "none";
35
+ } else if (commentState === "none") if (s[i] === "/" && s[i + 1] === "/") commentState = "singleline";
36
+ else if (s[i] === "/" && s[i + 1] === "*") {
37
+ commentState = "multiline";
38
+ i += 2;
39
+ } else result.push(s[i]);
40
+ return result.join("");
41
+ }
42
+ function toArray(array) {
43
+ if (array === null || array === void 0) array = [];
44
+ if (Array.isArray(array)) return array;
45
+ return [array];
46
+ }
47
+ function isObject(item) {
48
+ return item != null && typeof item === "object" && !Array.isArray(item);
49
+ }
50
+ function isFinalObj(obj) {
51
+ return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
52
+ }
53
+ function getType(value) {
54
+ return Object.prototype.toString.apply(value).slice(8, -1);
55
+ }
56
+ function collectOwnProperties(obj, collector) {
57
+ const collect = typeof collector === "function" ? collector : (key) => collector.add(key);
58
+ Object.getOwnPropertyNames(obj).forEach(collect);
59
+ Object.getOwnPropertySymbols(obj).forEach(collect);
60
+ }
61
+ function getOwnProperties(obj) {
62
+ const ownProps = /* @__PURE__ */ new Set();
63
+ if (isFinalObj(obj)) return [];
64
+ collectOwnProperties(obj, ownProps);
65
+ return Array.from(ownProps);
66
+ }
67
+ var defaultCloneOptions = { forceWritable: false };
68
+ function deepClone(val, options = defaultCloneOptions) {
69
+ return clone(val, /* @__PURE__ */ new WeakMap(), options);
70
+ }
71
+ function clone(val, seen, options = defaultCloneOptions) {
72
+ let k, out;
73
+ if (seen.has(val)) return seen.get(val);
74
+ if (Array.isArray(val)) {
75
+ out = Array.from({ length: k = val.length });
76
+ seen.set(val, out);
77
+ while (k--) out[k] = clone(val[k], seen, options);
78
+ return out;
79
+ }
80
+ if (Object.prototype.toString.call(val) === "[object Object]") {
81
+ out = Object.create(Object.getPrototypeOf(val));
82
+ seen.set(val, out);
83
+ const props = getOwnProperties(val);
84
+ for (const k of props) {
85
+ const descriptor = Object.getOwnPropertyDescriptor(val, k);
86
+ if (!descriptor) continue;
87
+ const cloned = clone(val[k], seen, options);
88
+ if (options.forceWritable) Object.defineProperty(out, k, {
89
+ enumerable: descriptor.enumerable,
90
+ configurable: true,
91
+ writable: true,
92
+ value: cloned
93
+ });
94
+ else if ("get" in descriptor) Object.defineProperty(out, k, {
95
+ ...descriptor,
96
+ get() {
97
+ return cloned;
98
+ }
99
+ });
100
+ else Object.defineProperty(out, k, {
101
+ ...descriptor,
102
+ value: cloned
103
+ });
104
+ }
105
+ return out;
106
+ }
107
+ return val;
108
+ }
109
+ function noop() {}
110
+ function objectAttr(source, path, defaultValue = void 0) {
111
+ const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
112
+ let result = source;
113
+ for (const p of paths) {
114
+ result = new Object(result)[p];
115
+ if (result === void 0) return defaultValue;
116
+ }
117
+ return result;
118
+ }
119
+ function createDefer() {
120
+ let resolve = null;
121
+ let reject = null;
122
+ const p = new Promise((_resolve, _reject) => {
123
+ resolve = _resolve;
124
+ reject = _reject;
125
+ });
126
+ p.resolve = resolve;
127
+ p.reject = reject;
128
+ return p;
129
+ }
130
+ /**
131
+ * If code starts with a function call, will return its last index, respecting arguments.
132
+ * This will return 25 - last ending character of toMatch ")"
133
+ * Also works with callbacks
134
+ * ```
135
+ * toMatch({ test: '123' });
136
+ * toBeAliased('123')
137
+ * ```
138
+ */
139
+ function getCallLastIndex(code) {
140
+ let charIndex = -1;
141
+ let inString = null;
142
+ let startedBracers = 0;
143
+ let endedBracers = 0;
144
+ let beforeChar = null;
145
+ while (charIndex <= code.length) {
146
+ beforeChar = code[charIndex];
147
+ charIndex++;
148
+ const char = code[charIndex];
149
+ if ((char === "\"" || char === "'" || char === "`") && beforeChar !== "\\") {
150
+ if (inString === char) inString = null;
151
+ else if (!inString) inString = char;
152
+ }
153
+ if (!inString) {
154
+ if (char === "(") startedBracers++;
155
+ if (char === ")") endedBracers++;
156
+ }
157
+ if (startedBracers && endedBracers && startedBracers === endedBracers) return charIndex;
158
+ }
159
+ return null;
160
+ }
161
+ function isNegativeNaN(val) {
162
+ if (!Number.isNaN(val)) return false;
163
+ const f64 = new Float64Array(1);
164
+ f64[0] = val;
165
+ return new Uint32Array(f64.buffer)[1] >>> 31 === 1;
166
+ }
167
+ function ordinal(i) {
168
+ const j = i % 10;
169
+ const k = i % 100;
170
+ if (j === 1 && k !== 11) return `${i}st`;
171
+ if (j === 2 && k !== 12) return `${i}nd`;
172
+ if (j === 3 && k !== 13) return `${i}rd`;
173
+ return `${i}th`;
174
+ }
175
+ function unique(array) {
176
+ return Array.from(new Set(array));
177
+ }
178
+ //#endregion
179
+ export { assertTypes, createDefer, createSimpleStackTrace, deepClone, filterOutComments, getCallLastIndex, getOwnProperties, getType, isNegativeNaN, isObject, isPrimitive, noop, notNullish, objectAttr, ordinal, toArray, unique };
@@ -0,0 +1,25 @@
1
+ //#region ../../node_modules/vitest/dist/@vitest/utils/offset.js
2
+ var lineSplitRE = /\r?\n/;
3
+ function positionToOffset(source, lineNumber, columnNumber) {
4
+ const lines = source.split(lineSplitRE);
5
+ const nl = /\r\n/.test(source) ? 2 : 1;
6
+ let start = 0;
7
+ if (lineNumber > lines.length) return source.length;
8
+ for (let i = 0; i < lineNumber - 1; i++) start += lines[i].length + nl;
9
+ return start + columnNumber;
10
+ }
11
+ function offsetToLineNumber(source, offset) {
12
+ if (offset > source.length) throw new Error(`offset is longer than source length! offset ${offset} > length ${source.length}`);
13
+ const lines = source.split(lineSplitRE);
14
+ const nl = /\r\n/.test(source) ? 2 : 1;
15
+ let counted = 0;
16
+ let line = 0;
17
+ for (; line < lines.length; line++) {
18
+ const lineLength = lines[line].length + nl;
19
+ if (counted + lineLength >= offset) break;
20
+ counted += lineLength;
21
+ }
22
+ return line + 1;
23
+ }
24
+ //#endregion
25
+ export { lineSplitRE, offsetToLineNumber, positionToOffset };
@@ -0,0 +1,75 @@
1
+ //#region ../../node_modules/vitest/dist/@vitest/utils/serialize.js
2
+ var IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
3
+ var IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
4
+ function isImmutable(v) {
5
+ return v && (v[IS_COLLECTION_SYMBOL] || v[IS_RECORD_SYMBOL]);
6
+ }
7
+ var OBJECT_PROTO = Object.getPrototypeOf({});
8
+ function getUnserializableMessage(err) {
9
+ if (err instanceof Error) return `<unserializable>: ${err.message}`;
10
+ if (typeof err === "string") return `<unserializable>: ${err}`;
11
+ return "<unserializable>";
12
+ }
13
+ function serializeValue(val, seen = /* @__PURE__ */ new WeakMap()) {
14
+ if (!val || typeof val === "string") return val;
15
+ if (val instanceof Error && "toJSON" in val && typeof val.toJSON === "function") {
16
+ const jsonValue = val.toJSON();
17
+ if (jsonValue && jsonValue !== val && typeof jsonValue === "object") {
18
+ if (typeof val.message === "string") safe(() => jsonValue.message ??= normalizeErrorMessage(val.message));
19
+ if (typeof val.stack === "string") safe(() => jsonValue.stack ??= val.stack);
20
+ if (typeof val.name === "string") safe(() => jsonValue.name ??= val.name);
21
+ if (val.cause != null) safe(() => jsonValue.cause ??= serializeValue(val.cause, seen));
22
+ }
23
+ return serializeValue(jsonValue, seen);
24
+ }
25
+ if (typeof val === "function") return `Function<${val.name || "anonymous"}>`;
26
+ if (typeof val === "symbol") return val.toString();
27
+ if (typeof val !== "object") return val;
28
+ if (typeof Buffer !== "undefined" && val instanceof Buffer) return `<Buffer(${val.length}) ...>`;
29
+ if (typeof Uint8Array !== "undefined" && val instanceof Uint8Array) return `<Uint8Array(${val.length}) ...>`;
30
+ if (isImmutable(val)) return serializeValue(val.toJSON(), seen);
31
+ if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction") return "Promise";
32
+ if (typeof Element !== "undefined" && val instanceof Element) return val.tagName;
33
+ if (typeof val.toJSON === "function") return serializeValue(val.toJSON(), seen);
34
+ if (seen.has(val)) return seen.get(val);
35
+ if (Array.isArray(val)) {
36
+ const clone = new Array(val.length);
37
+ seen.set(val, clone);
38
+ val.forEach((e, i) => {
39
+ try {
40
+ clone[i] = serializeValue(e, seen);
41
+ } catch (err) {
42
+ clone[i] = getUnserializableMessage(err);
43
+ }
44
+ });
45
+ return clone;
46
+ } else {
47
+ const clone = Object.create(null);
48
+ seen.set(val, clone);
49
+ let obj = val;
50
+ while (obj && obj !== OBJECT_PROTO) {
51
+ Object.getOwnPropertyNames(obj).forEach((key) => {
52
+ if (key in clone) return;
53
+ try {
54
+ clone[key] = serializeValue(val[key], seen);
55
+ } catch (err) {
56
+ delete clone[key];
57
+ clone[key] = getUnserializableMessage(err);
58
+ }
59
+ });
60
+ obj = Object.getPrototypeOf(obj);
61
+ }
62
+ if (val instanceof Error) safe(() => clone.message = normalizeErrorMessage(val.message));
63
+ return clone;
64
+ }
65
+ }
66
+ function safe(fn) {
67
+ try {
68
+ return fn();
69
+ } catch {}
70
+ }
71
+ function normalizeErrorMessage(message) {
72
+ return message.replace(/\(0\s?,\s?__vite_ssr_import_\d+__.(\w+)\)/g, "$1").replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "").replace(/getByTestId('__vitest_\d+__')/g, "page");
73
+ }
74
+ //#endregion
75
+ export { serializeValue };
@@ -0,0 +1,371 @@
1
+ import { isPrimitive, notNullish } from "./helpers.js";
2
+ import { resolve } from "./chunk-pathe.M-eThtNZ.js";
3
+ //#region ../../node_modules/vitest/dist/@vitest/utils/source-map.js
4
+ var comma = ",".charCodeAt(0);
5
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
+ var intToChar = new Uint8Array(64);
7
+ var charToInt = new Uint8Array(128);
8
+ for (let i = 0; i < chars.length; i++) {
9
+ const c = chars.charCodeAt(i);
10
+ intToChar[i] = c;
11
+ charToInt[c] = i;
12
+ }
13
+ function decodeInteger(reader, relative) {
14
+ let value = 0;
15
+ let shift = 0;
16
+ let integer = 0;
17
+ do {
18
+ integer = charToInt[reader.next()];
19
+ value |= (integer & 31) << shift;
20
+ shift += 5;
21
+ } while (integer & 32);
22
+ const shouldNegate = value & 1;
23
+ value >>>= 1;
24
+ if (shouldNegate) value = -2147483648 | -value;
25
+ return relative + value;
26
+ }
27
+ function hasMoreVlq(reader, max) {
28
+ if (reader.pos >= max) return false;
29
+ return reader.peek() !== comma;
30
+ }
31
+ var StringReader = class {
32
+ constructor(buffer) {
33
+ this.pos = 0;
34
+ this.buffer = buffer;
35
+ }
36
+ next() {
37
+ return this.buffer.charCodeAt(this.pos++);
38
+ }
39
+ peek() {
40
+ return this.buffer.charCodeAt(this.pos);
41
+ }
42
+ indexOf(char) {
43
+ const { buffer, pos } = this;
44
+ const idx = buffer.indexOf(char, pos);
45
+ return idx === -1 ? buffer.length : idx;
46
+ }
47
+ };
48
+ function decode(mappings) {
49
+ const { length } = mappings;
50
+ const reader = new StringReader(mappings);
51
+ const decoded = [];
52
+ let genColumn = 0;
53
+ let sourcesIndex = 0;
54
+ let sourceLine = 0;
55
+ let sourceColumn = 0;
56
+ let namesIndex = 0;
57
+ do {
58
+ const semi = reader.indexOf(";");
59
+ const line = [];
60
+ let sorted = true;
61
+ let lastCol = 0;
62
+ genColumn = 0;
63
+ while (reader.pos < semi) {
64
+ let seg;
65
+ genColumn = decodeInteger(reader, genColumn);
66
+ if (genColumn < lastCol) sorted = false;
67
+ lastCol = genColumn;
68
+ if (hasMoreVlq(reader, semi)) {
69
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
70
+ sourceLine = decodeInteger(reader, sourceLine);
71
+ sourceColumn = decodeInteger(reader, sourceColumn);
72
+ if (hasMoreVlq(reader, semi)) {
73
+ namesIndex = decodeInteger(reader, namesIndex);
74
+ seg = [
75
+ genColumn,
76
+ sourcesIndex,
77
+ sourceLine,
78
+ sourceColumn,
79
+ namesIndex
80
+ ];
81
+ } else seg = [
82
+ genColumn,
83
+ sourcesIndex,
84
+ sourceLine,
85
+ sourceColumn
86
+ ];
87
+ } else seg = [genColumn];
88
+ line.push(seg);
89
+ reader.pos++;
90
+ }
91
+ if (!sorted) sort(line);
92
+ decoded.push(line);
93
+ reader.pos = semi + 1;
94
+ } while (reader.pos <= length);
95
+ return decoded;
96
+ }
97
+ function sort(line) {
98
+ line.sort(sortComparator);
99
+ }
100
+ function sortComparator(a, b) {
101
+ return a[0] - b[0];
102
+ }
103
+ var COLUMN = 0;
104
+ var SOURCES_INDEX = 1;
105
+ var SOURCE_LINE = 2;
106
+ var SOURCE_COLUMN = 3;
107
+ var NAMES_INDEX = 4;
108
+ var found = false;
109
+ function binarySearch(haystack, needle, low, high) {
110
+ while (low <= high) {
111
+ const mid = low + (high - low >> 1);
112
+ const cmp = haystack[mid][COLUMN] - needle;
113
+ if (cmp === 0) {
114
+ found = true;
115
+ return mid;
116
+ }
117
+ if (cmp < 0) low = mid + 1;
118
+ else high = mid - 1;
119
+ }
120
+ found = false;
121
+ return low - 1;
122
+ }
123
+ function upperBound(haystack, needle, index) {
124
+ for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
125
+ return index;
126
+ }
127
+ function lowerBound(haystack, needle, index) {
128
+ for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
129
+ return index;
130
+ }
131
+ function memoizedBinarySearch(haystack, needle, state, key) {
132
+ const { lastKey, lastNeedle, lastIndex } = state;
133
+ let low = 0;
134
+ let high = haystack.length - 1;
135
+ if (key === lastKey) {
136
+ if (needle === lastNeedle) {
137
+ found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
138
+ return lastIndex;
139
+ }
140
+ if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
141
+ else high = lastIndex;
142
+ }
143
+ state.lastKey = key;
144
+ state.lastNeedle = needle;
145
+ return state.lastIndex = binarySearch(haystack, needle, low, high);
146
+ }
147
+ var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
148
+ var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
149
+ var LEAST_UPPER_BOUND = -1;
150
+ var GREATEST_LOWER_BOUND = 1;
151
+ function cast(map) {
152
+ return map;
153
+ }
154
+ function decodedMappings(map) {
155
+ var _a;
156
+ return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
157
+ }
158
+ function originalPositionFor(map, needle) {
159
+ let { line, column, bias } = needle;
160
+ line--;
161
+ if (line < 0) throw new Error(LINE_GTR_ZERO);
162
+ if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
163
+ const decoded = decodedMappings(map);
164
+ if (line >= decoded.length) return OMapping(null, null, null, null);
165
+ const segments = decoded[line];
166
+ const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
167
+ if (index === -1) return OMapping(null, null, null, null);
168
+ const segment = segments[index];
169
+ if (segment.length === 1) return OMapping(null, null, null, null);
170
+ const { names, resolvedSources } = map;
171
+ return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
172
+ }
173
+ function OMapping(source, line, column, name) {
174
+ return {
175
+ source,
176
+ line,
177
+ column,
178
+ name
179
+ };
180
+ }
181
+ function traceSegmentInternal(segments, memo, line, column, bias) {
182
+ let index = memoizedBinarySearch(segments, column, memo, line);
183
+ if (found) index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
184
+ else if (bias === LEAST_UPPER_BOUND) index++;
185
+ if (index === -1 || index === segments.length) return -1;
186
+ return index;
187
+ }
188
+ var CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m;
189
+ var SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/;
190
+ var stackIgnorePatterns = [
191
+ "node:internal",
192
+ /\/packages\/\w+\/dist\//,
193
+ /\/@vitest\/\w+\/dist\//,
194
+ "/vitest/dist/",
195
+ "/vitest/src/",
196
+ "/node_modules/chai/",
197
+ "/node_modules/tinyspy/",
198
+ "/vite/dist/node/module-runner",
199
+ "/rolldown-vite/dist/node/module-runner",
200
+ "/deps/chunk-",
201
+ "/deps/@vitest",
202
+ "/deps/loupe",
203
+ "/deps/chai",
204
+ "/browser-playwright/dist/locators.js",
205
+ "/browser-webdriverio/dist/locators.js",
206
+ "/browser-preview/dist/locators.js",
207
+ /node:\w+/,
208
+ /__vitest_test__/,
209
+ /__vitest_browser__/,
210
+ "/@id/__x00__vitest/browser",
211
+ /\/deps\/vitest_/
212
+ ];
213
+ var NOW_LENGTH = Date.now().toString().length;
214
+ var REGEXP_VITEST = new RegExp(`vitest=\\d{${NOW_LENGTH}}`);
215
+ function extractLocation(urlLike) {
216
+ if (!urlLike.includes(":")) return [urlLike];
217
+ const parts = /(.+?)(?::(\d+))?(?::(\d+))?$/.exec(urlLike.replace(/^\(|\)$/g, ""));
218
+ if (!parts) return [urlLike];
219
+ let url = parts[1];
220
+ if (url.startsWith("async ")) url = url.slice(6);
221
+ if (url.startsWith("http:") || url.startsWith("https:")) {
222
+ const urlObj = new URL(url);
223
+ urlObj.searchParams.delete("import");
224
+ urlObj.searchParams.delete("browserv");
225
+ url = urlObj.pathname + urlObj.hash + urlObj.search;
226
+ }
227
+ if (url.startsWith("/@fs/")) {
228
+ const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
229
+ url = url.slice(isWindows ? 5 : 4);
230
+ }
231
+ if (url.includes("vitest=")) url = url.replace(REGEXP_VITEST, "").replace(/[?&]$/, "");
232
+ return [
233
+ url,
234
+ parts[2] || void 0,
235
+ parts[3] || void 0
236
+ ];
237
+ }
238
+ function parseSingleFFOrSafariStack(raw) {
239
+ let line = raw.trim();
240
+ if (SAFARI_NATIVE_CODE_REGEXP.test(line)) return null;
241
+ if (line.includes(" > eval")) line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
242
+ if (!line.includes("@")) return null;
243
+ let atIndex = -1;
244
+ let locationPart = "";
245
+ let functionName;
246
+ for (let i = 0; i < line.length; i++) if (line[i] === "@") {
247
+ const candidateLocation = line.slice(i + 1);
248
+ if (candidateLocation.includes(":") && candidateLocation.length >= 3) {
249
+ atIndex = i;
250
+ locationPart = candidateLocation;
251
+ functionName = i > 0 ? line.slice(0, i) : void 0;
252
+ break;
253
+ }
254
+ }
255
+ if (atIndex === -1 || !locationPart.includes(":") || locationPart.length < 3) return null;
256
+ const [url, lineNumber, columnNumber] = extractLocation(locationPart);
257
+ if (!url || !lineNumber || !columnNumber) return null;
258
+ return {
259
+ file: url,
260
+ method: functionName || "",
261
+ line: Number.parseInt(lineNumber),
262
+ column: Number.parseInt(columnNumber)
263
+ };
264
+ }
265
+ function parseSingleStack(raw) {
266
+ const line = raw.trim();
267
+ if (!CHROME_IE_STACK_REGEXP.test(line)) return parseSingleFFOrSafariStack(line);
268
+ return parseSingleV8Stack(line);
269
+ }
270
+ function parseSingleV8Stack(raw) {
271
+ let line = raw.trim();
272
+ if (!CHROME_IE_STACK_REGEXP.test(line)) return null;
273
+ if (line.includes("(eval ")) line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
274
+ let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
275
+ const location = sanitizedLine.match(/ (\(.+\)$)/);
276
+ sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
277
+ const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine);
278
+ let method = location && sanitizedLine || "";
279
+ let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
280
+ if (!file || !lineNumber || !columnNumber) return null;
281
+ if (method.startsWith("async ")) method = method.slice(6);
282
+ if (file.startsWith("file://")) file = file.slice(7);
283
+ file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file);
284
+ if (method) method = method.replace(/\(0\s?,\s?__vite_ssr_import_\d+__.(\w+)\)/g, "$1").replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, "");
285
+ return {
286
+ method,
287
+ file,
288
+ line: Number.parseInt(lineNumber),
289
+ column: Number.parseInt(columnNumber)
290
+ };
291
+ }
292
+ function parseStacktrace(stack, options = {}) {
293
+ const { ignoreStackEntries = stackIgnorePatterns } = options;
294
+ let stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
295
+ const helperIndex = stacks.findLastIndex((s) => s.method === "__VITEST_HELPER__" || s.method === "async*__VITEST_HELPER__");
296
+ if (helperIndex >= 0) stacks = stacks.slice(helperIndex + 1);
297
+ return stacks.map((stack) => {
298
+ if (options.getUrlId) stack.file = options.getUrlId(stack.file);
299
+ const map = options.getSourceMap?.(stack.file);
300
+ if (!map || typeof map !== "object" || !map.version) return shouldFilter(ignoreStackEntries, stack.file) ? null : stack;
301
+ const position = getOriginalPosition(new DecodedMap(map, stack.file), stack);
302
+ if (!position) return stack;
303
+ const { line, column, source, name } = position;
304
+ let file = source || stack.file;
305
+ if (file.match(/\/\w:\//)) file = file.slice(1);
306
+ if (shouldFilter(ignoreStackEntries, file)) return null;
307
+ if (line != null && column != null) return {
308
+ line,
309
+ column,
310
+ file,
311
+ method: name || stack.method
312
+ };
313
+ return stack;
314
+ }).filter((s) => s != null);
315
+ }
316
+ function shouldFilter(ignoreStackEntries, file) {
317
+ return ignoreStackEntries.some((p) => file.match(p));
318
+ }
319
+ function parseFFOrSafariStackTrace(stack) {
320
+ return stack.split("\n").map((line) => parseSingleFFOrSafariStack(line)).filter(notNullish);
321
+ }
322
+ function parseV8Stacktrace(stack) {
323
+ return stack.split("\n").map((line) => parseSingleV8Stack(line)).filter(notNullish);
324
+ }
325
+ function parseErrorStacktrace(e, options = {}) {
326
+ if (!e || isPrimitive(e)) return [];
327
+ if ("stacks" in e && e.stacks) return e.stacks;
328
+ const stackStr = e.stack || "";
329
+ let stackFrames = typeof stackStr === "string" ? parseStacktrace(stackStr, options) : [];
330
+ if (!stackFrames.length) {
331
+ const e_ = e;
332
+ if (e_.fileName != null && e_.lineNumber != null && e_.columnNumber != null) stackFrames = parseStacktrace(`${e_.fileName}:${e_.lineNumber}:${e_.columnNumber}`, options);
333
+ if (e_.sourceURL != null && e_.line != null && e_._column != null) stackFrames = parseStacktrace(`${e_.sourceURL}:${e_.line}:${e_.column}`, options);
334
+ }
335
+ if (options.frameFilter) stackFrames = stackFrames.filter((f) => options.frameFilter(e, f) !== false);
336
+ e.stacks = stackFrames;
337
+ return stackFrames;
338
+ }
339
+ var DecodedMap = class {
340
+ _encoded;
341
+ _decoded;
342
+ _decodedMemo;
343
+ url;
344
+ version;
345
+ names = [];
346
+ resolvedSources;
347
+ constructor(map, from) {
348
+ this.map = map;
349
+ const { mappings, names, sources } = map;
350
+ this.version = map.version;
351
+ this.names = names || [];
352
+ this._encoded = mappings || "";
353
+ this._decodedMemo = memoizedState();
354
+ this.url = from;
355
+ this.resolvedSources = (sources || []).map((s) => resolve(from, "..", s || ""));
356
+ }
357
+ };
358
+ function memoizedState() {
359
+ return {
360
+ lastKey: -1,
361
+ lastNeedle: -1,
362
+ lastIndex: -1
363
+ };
364
+ }
365
+ function getOriginalPosition(map, needle) {
366
+ const result = originalPositionFor(map, needle);
367
+ if (result.column == null) return null;
368
+ return result;
369
+ }
370
+ //#endregion
371
+ export { parseErrorStacktrace, parseSingleStack };
@@ -0,0 +1,35 @@
1
+ //#region ../../node_modules/vitest/dist/@vitest/utils/timers.js
2
+ var SAFE_TIMERS_SYMBOL = Symbol("vitest:SAFE_TIMERS");
3
+ function getSafeTimers() {
4
+ const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
5
+ const { nextTick: safeNextTick } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis.process || {};
6
+ return {
7
+ nextTick: safeNextTick,
8
+ setTimeout: safeSetTimeout,
9
+ setInterval: safeSetInterval,
10
+ clearInterval: safeClearInterval,
11
+ clearTimeout: safeClearTimeout,
12
+ setImmediate: safeSetImmediate,
13
+ clearImmediate: safeClearImmediate,
14
+ queueMicrotask: safeQueueMicrotask
15
+ };
16
+ }
17
+ /**
18
+ * Returns a promise that resolves after the specified duration.
19
+ *
20
+ * @param timeout - Delay in milliseconds
21
+ * @param scheduler - Timer function to use, defaults to `setTimeout`. Useful for mocked timers.
22
+ *
23
+ * @example
24
+ * await delay(100)
25
+ *
26
+ * @example
27
+ * // With mocked timers
28
+ * const { setTimeout } = getSafeTimers()
29
+ * await delay(100, setTimeout)
30
+ */
31
+ function delay(timeout, scheduler = setTimeout) {
32
+ return new Promise((resolve) => scheduler(resolve, timeout));
33
+ }
34
+ //#endregion
35
+ export { delay, getSafeTimers };
@@ -0,0 +1,4 @@
1
+ //#region ../../node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js
2
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
3
+ //#endregion
4
+ export { commonjsGlobal };