@aiao/rxdb-adapter-sqliteai 0.0.26 → 0.0.28
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/README.md +18 -0
- package/dist/{RxDBAdapterSqliteai-Bebaerj4.js → RxDBAdapterSqliteai-DSoEdAS9.js} +12 -2
- package/dist/RxDBAdapterSqliteai.d.ts +6 -1
- package/dist/RxDBAdapterSqliteai.d.ts.map +1 -1
- package/dist/assets/sqlite3-opfs-async-proxy-jAvfsIBX.js +1 -0
- package/dist/assets/sqlite3-worker1-bundler-friendly-CIDbdn0f.js +5 -0
- package/dist/assets/sqliteai-test.worker-DhICqctS.js +32 -0
- package/dist/create_sqlite_client.d.ts +3 -2
- package/dist/create_sqlite_client.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/testing.js +2833 -297
- package/package.json +12 -7
- package/src/RxDBAdapterSqliteai.ts +11 -1
- package/src/create_sqlite_client.ts +5 -4
- package/dist/assets/sqlite3-opfs-async-proxy-CPArLPLU.js +0 -1
- package/dist/assets/sqlite3-worker1-bundler-friendly-C9ENWE60.js +0 -3
- package/dist/assets/sqliteai-test.worker-CTOPs2O0.js +0 -23
package/dist/testing.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { n as e, t } from "./RxDBAdapterSqliteai-
|
|
2
|
-
import { ENTITY_LOCAL_CREATE_EVENT as n,
|
|
3
|
-
import { BehaviorSubject as
|
|
4
|
-
import { isNil as
|
|
1
|
+
import { n as e, t } from "./RxDBAdapterSqliteai-DSoEdAS9.js";
|
|
2
|
+
import { ENTITY_LOCAL_CREATE_EVENT as n, Entity as r, EntityBase as i, MAIN_BRANCH_ID as a, MergeBranchBeginEvent as o, MergeBranchCommitEvent as s, MergeBranchFailedEvent as c, PropertyType as l, REPOSITORY_SYNC_COMPLETE_EVENT as u, RxDB as d, RxDBBranch as f, RxDBChange as p, RxDBError as m, RxDBPluginBase as h, RxDBSync as ee, SKIP_BRANCH_SWITCH_PREPARE as te, SwitchBranchBeginEvent as ne, SwitchBranchCommitEvent as re, SwitchBranchRollbackEvent as ie, SyncType as ae, TRANSACTION_BEGIN as oe, TRANSACTION_COMMIT as se, TRANSACTION_ROLLBACK as ce, TrustedWriteIntent as g, assertUsableBranchId as le, buildPushableRepositoryRules as ue, declareTrustedWrite as _, getCurrentBranch as de, getEntityMetadata as fe, getLocalSystemRepositories as pe, getRemoteSystemRepositories as me, getRxDBChangeKey as he, getRxDBEntityIdentityKey as ge, isAdapterShutdownError as _e, resolve_current_branch as ve, takeDeclaredWrite as ye } from "@aiao/rxdb";
|
|
3
|
+
import { BehaviorSubject as v, EMPTY as be, NEVER as xe, Observable as Se, ReplaySubject as Ce, Subject as we, catchError as Te, combineLatest as Ee, filter as De, firstValueFrom as y, map as b, shareReplay as x, switchMap as Oe, takeUntil as ke } from "rxjs";
|
|
4
|
+
import { isNil as Ae } from "@aiao/utils";
|
|
5
5
|
//#region \0rolldown/runtime.js
|
|
6
|
-
var
|
|
6
|
+
var je = Object.defineProperty, Me = (e, t) => {
|
|
7
7
|
let n = {};
|
|
8
|
-
for (var r in e)
|
|
8
|
+
for (var r in e) je(n, r, {
|
|
9
9
|
get: e[r],
|
|
10
10
|
enumerable: !0
|
|
11
11
|
});
|
|
12
|
-
return t ||
|
|
13
|
-
},
|
|
12
|
+
return t || je(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
13
|
+
}, Ne = async (e, t, n) => {
|
|
14
|
+
le(t);
|
|
14
15
|
let { branchRepository: r, adapter: i } = await e.getLocalRepositories();
|
|
15
16
|
if ((await r.find({
|
|
16
17
|
where: {
|
|
@@ -22,13 +23,13 @@ var M = Object.defineProperty, de = (e, t) => {
|
|
|
22
23
|
}]
|
|
23
24
|
},
|
|
24
25
|
limit: 1
|
|
25
|
-
})).length) throw new
|
|
26
|
+
})).length) throw new m(`Branch id (${t}) already exists`);
|
|
26
27
|
if (e.rxdb.config.sync?.remote?.adapter) {
|
|
27
28
|
let { adapter: n } = await e.getRemoteRepositories();
|
|
28
|
-
if (n.branchExists && await n.branchExists(t)) throw new
|
|
29
|
+
if (n.branchExists && await n.branchExists(t)) throw new m(`Branch id (${t}) already exists on remote`);
|
|
29
30
|
}
|
|
30
31
|
let a = await i.transaction(async (r) => {
|
|
31
|
-
let i = r.getRepository(
|
|
32
|
+
let i = r.getRepository(f), a = r.getRepository(p);
|
|
32
33
|
if ((await i.find({
|
|
33
34
|
where: {
|
|
34
35
|
combinator: "and",
|
|
@@ -65,14 +66,19 @@ var M = Object.defineProperty, de = (e, t) => {
|
|
|
65
66
|
},
|
|
66
67
|
limit: 1
|
|
67
68
|
}))[0];
|
|
68
|
-
} else o = await
|
|
69
|
+
} else o = await ve(i, e.rxdb), s = await Pe(a, o.id);
|
|
69
70
|
if (!o) return "Source branch not found";
|
|
70
|
-
let
|
|
71
|
-
|
|
71
|
+
let c = e.rxdb.entityManager.instantiate(f);
|
|
72
|
+
c.id = t, c.activated = !1, c.activeKey = null, c.local = !0, c.remote = !1, c.fromChangeId = s?.id ?? null, c.parentId = o.id, await i.create(c);
|
|
73
|
+
for (let n of e.rxdb.systemContributions) await n.writeBranchRows(e.rxdb.entityManager, {
|
|
74
|
+
executor: r,
|
|
75
|
+
branchId: t
|
|
76
|
+
});
|
|
77
|
+
return c;
|
|
72
78
|
});
|
|
73
|
-
if (typeof a == "string") throw new
|
|
79
|
+
if (typeof a == "string") throw new m(a);
|
|
74
80
|
return a;
|
|
75
|
-
},
|
|
81
|
+
}, Pe = async (e, t) => (await e.find({
|
|
76
82
|
where: {
|
|
77
83
|
combinator: "and",
|
|
78
84
|
rules: [t ? {
|
|
@@ -94,12 +100,12 @@ var M = Object.defineProperty, de = (e, t) => {
|
|
|
94
100
|
sort: "desc"
|
|
95
101
|
}],
|
|
96
102
|
limit: 1
|
|
97
|
-
}))[0],
|
|
103
|
+
}))[0], Fe = (e) => {
|
|
98
104
|
if (!e || typeof e != "object") return !1;
|
|
99
105
|
let t = "name" in e ? String(e.name) : "";
|
|
100
|
-
return ("errno" in e ? Number(e.errno) : void 0) === 44 || t === "AbortError" ||
|
|
106
|
+
return ("errno" in e ? Number(e.errno) : void 0) === 44 || t === "AbortError" || _e(e);
|
|
101
107
|
};
|
|
102
|
-
function
|
|
108
|
+
function Ie(e) {
|
|
103
109
|
if (e.length === 1) {
|
|
104
110
|
let t = e[0];
|
|
105
111
|
return `${t.type === "INSERT" ? "创建" : t.type === "UPDATE" ? "更新" : "删除"} ${t.entity}`;
|
|
@@ -112,12 +118,12 @@ function N(e) {
|
|
|
112
118
|
let n = [];
|
|
113
119
|
return t.insert && n.push(`创建${t.insert}条`), t.update && n.push(`更新${t.update}条`), t.delete && n.push(`删除${t.delete}条`), `事务: ${n.join(", ")}`;
|
|
114
120
|
}
|
|
115
|
-
function
|
|
121
|
+
function Le(e) {
|
|
116
122
|
let t = e[0], n = e.length, r = t.transactionId ?? null, i = t.createdAt, a = t.namespace, o = t.entity, s = r ? "TRANSACTION" : t.type, c = [
|
|
117
123
|
s,
|
|
118
|
-
|
|
124
|
+
ge(t.entityId),
|
|
119
125
|
i.getTime()
|
|
120
|
-
].join(":"), l = e.some((e) =>
|
|
126
|
+
].join(":"), l = e.some((e) => Ae(e.revertChangeId) === !1), u = e.some((e) => Ae(e.redoInvalidatedAt) === !1);
|
|
121
127
|
return {
|
|
122
128
|
transactionId: r,
|
|
123
129
|
changeId: e.reduce((e, t) => t.id > e ? t.id : e, e[0].id),
|
|
@@ -126,53 +132,53 @@ function P(e) {
|
|
|
126
132
|
type: s,
|
|
127
133
|
count: n,
|
|
128
134
|
createdAt: i,
|
|
129
|
-
description:
|
|
135
|
+
description: Ie(e),
|
|
130
136
|
namespace: a,
|
|
131
137
|
entity: o,
|
|
132
138
|
reverted: l,
|
|
133
139
|
redoInvalidated: u
|
|
134
140
|
};
|
|
135
141
|
}
|
|
136
|
-
function
|
|
142
|
+
function Re(e) {
|
|
137
143
|
let t = [], n = [], r;
|
|
138
144
|
return e.forEach((e) => {
|
|
139
|
-
e.transactionId && e.transactionId === r ? n.push(e) : (r = e.transactionId, n.length &&= (t.push(
|
|
140
|
-
}), n.length && t.push(
|
|
145
|
+
e.transactionId && e.transactionId === r ? n.push(e) : (r = e.transactionId, n.length &&= (t.push(Le([...n])), 0), e.transactionId ? n.push(e) : t.push(Le([e])));
|
|
146
|
+
}), n.length && t.push(Le([...n])), t;
|
|
141
147
|
}
|
|
142
|
-
var
|
|
143
|
-
function
|
|
148
|
+
var ze = (e) => `${e.namespace}:${e.entity}`;
|
|
149
|
+
function Be(e, t) {
|
|
144
150
|
let n = new Map(t);
|
|
145
151
|
for (let t of e) {
|
|
146
152
|
if (t.lastPushedChangeId === null) continue;
|
|
147
|
-
let e =
|
|
153
|
+
let e = ze(t), r = n.get(e);
|
|
148
154
|
r !== void 0 && r >= t.lastPushedChangeId || n.set(e, t.lastPushedChangeId);
|
|
149
155
|
}
|
|
150
156
|
return n;
|
|
151
157
|
}
|
|
152
|
-
function
|
|
158
|
+
function Ve(e, t) {
|
|
153
159
|
return t.type === "database" ? e : e.map((e) => {
|
|
154
160
|
let n = e.changes.filter((e) => t.type === "repository" ? e.namespace === t.namespace && e.entity === t.entity : e.namespace === t.namespace && e.entity === t.entity && e.entityId === t.entityId);
|
|
155
161
|
return n.length === 0 ? null : {
|
|
156
162
|
...e,
|
|
157
163
|
changes: n,
|
|
158
164
|
count: n.length,
|
|
159
|
-
description:
|
|
165
|
+
description: Ie(n)
|
|
160
166
|
};
|
|
161
167
|
}).filter((e) => e !== null);
|
|
162
168
|
}
|
|
163
|
-
function
|
|
169
|
+
function He(e, t, n = 0, r = null) {
|
|
164
170
|
return e.filter((e) => !e.reverted && e.changes.every((e) => {
|
|
165
|
-
let i = e.remoteId == null, a = t.get(
|
|
171
|
+
let i = e.remoteId == null, a = t.get(ze(e)), o = a == null || e.id > a, s = e.id > n, c = r === null || e.createdAt.getTime() > r.getTime();
|
|
166
172
|
return i && o && s && c;
|
|
167
173
|
}));
|
|
168
174
|
}
|
|
169
|
-
function
|
|
170
|
-
return e.type === "database" ? "database" : e.type === "repository" ? `${e.namespace}:${e.entity}` : `${e.namespace}:${e.entity}:${
|
|
175
|
+
function Ue(e) {
|
|
176
|
+
return e.type === "database" ? "database" : e.type === "repository" ? `${e.namespace}:${e.entity}` : `${e.namespace}:${e.entity}:${ge(e.entityId)}`;
|
|
171
177
|
}
|
|
172
|
-
function
|
|
178
|
+
function We(e) {
|
|
173
179
|
if (!e) return { type: "database" };
|
|
174
180
|
if (Object.getPrototypeOf(e) === Object.prototype && "type" in e) return e;
|
|
175
|
-
let t =
|
|
181
|
+
let t = fe(e), n = "id" in e ? e.id : void 0, r = typeof n == "string" || typeof n == "number" || typeof n == "bigint" ? n : void 0;
|
|
176
182
|
return r === void 0 ? {
|
|
177
183
|
type: "repository",
|
|
178
184
|
namespace: t.namespace,
|
|
@@ -184,8 +190,8 @@ function ge(e) {
|
|
|
184
190
|
entityId: r
|
|
185
191
|
};
|
|
186
192
|
}
|
|
187
|
-
function
|
|
188
|
-
let n =
|
|
193
|
+
function Ge(e, t) {
|
|
194
|
+
let n = We(t), r = Ue(n), i = e.history_cache.get(r);
|
|
189
195
|
if (i) return i;
|
|
190
196
|
let a = () => {
|
|
191
197
|
let t = (e.history_ref_counts.get(r) || 0) - 1;
|
|
@@ -193,28 +199,28 @@ function _e(e, t) {
|
|
|
193
199
|
}, o = () => {
|
|
194
200
|
let t = (e.history_ref_counts.get(r) || 0) + 1;
|
|
195
201
|
e.history_ref_counts.set(r, t), e.history_cache.set(r, h);
|
|
196
|
-
}, s = (e) => new
|
|
202
|
+
}, s = (e) => new Se((t) => {
|
|
197
203
|
o();
|
|
198
204
|
let n = e.subscribe(t);
|
|
199
205
|
return () => {
|
|
200
206
|
n.unsubscribe(), a();
|
|
201
207
|
};
|
|
202
|
-
}), c = e.histories$.pipe(
|
|
208
|
+
}), c = e.histories$.pipe(b((e) => Ve(e, n)), x({
|
|
203
209
|
bufferSize: 1,
|
|
204
210
|
refCount: !0
|
|
205
|
-
})), l = s(c), u = s(e.undoHistories$.pipe(
|
|
211
|
+
})), l = s(c), u = s(e.undoHistories$.pipe(b((e) => Ve(e, n)), x({
|
|
206
212
|
bufferSize: 1,
|
|
207
213
|
refCount: !0
|
|
208
|
-
}))), d = s(e.redoHistories$.pipe(
|
|
214
|
+
}))), d = s(e.redoHistories$.pipe(b((e) => Ve(e, n)), x({
|
|
209
215
|
bufferSize: 1,
|
|
210
216
|
refCount: !0
|
|
211
|
-
}))), f = s(c.pipe(
|
|
217
|
+
}))), f = s(c.pipe(b((e) => e.length), x({
|
|
212
218
|
bufferSize: 1,
|
|
213
219
|
refCount: !0
|
|
214
|
-
}))), p = s(u.pipe(
|
|
220
|
+
}))), p = s(u.pipe(b((e) => e.length), x({
|
|
215
221
|
bufferSize: 1,
|
|
216
222
|
refCount: !0
|
|
217
|
-
}))), m = s(d.pipe(
|
|
223
|
+
}))), m = s(d.pipe(b((e) => e.length), x({
|
|
218
224
|
bufferSize: 1,
|
|
219
225
|
refCount: !0
|
|
220
226
|
}))), h = {
|
|
@@ -230,28 +236,28 @@ function _e(e, t) {
|
|
|
230
236
|
if (r.state === "cleared") return;
|
|
231
237
|
let { histories: i, lastPushedMap: a } = await e.fetchLatestHistories(r.boundary);
|
|
232
238
|
if (!e.isUndoSessionCurrent(r)) return;
|
|
233
|
-
let o =
|
|
239
|
+
let o = He(i, a, r.boundary.changeId, r.boundary.createdAfter), s = e.selectWholeTransactions(o, n, t);
|
|
234
240
|
s.length !== 0 && await e.applyUndoRedoHistories("undo", s, r);
|
|
235
241
|
}),
|
|
236
242
|
redo: (t = 1) => e.runSerialized(async () => {
|
|
237
|
-
let r = await
|
|
243
|
+
let r = await y(e.redoHistories$), i = e.selectWholeTransactions(r, n, t);
|
|
238
244
|
i.length !== 0 && await e.applyUndoRedoHistories("redo", i);
|
|
239
245
|
})
|
|
240
246
|
};
|
|
241
247
|
return h;
|
|
242
248
|
}
|
|
243
|
-
var
|
|
249
|
+
var Ke = {
|
|
244
250
|
changeId: 0,
|
|
245
251
|
createdAfter: null
|
|
246
252
|
};
|
|
247
|
-
function
|
|
253
|
+
function qe(e, t) {
|
|
248
254
|
return e?.repositoryFilter !== void 0 && e.repositoryFilter.length > 0 ? !1 : !t.hasMore && t.failures.length === 0;
|
|
249
255
|
}
|
|
250
|
-
function
|
|
256
|
+
function Je(e, t) {
|
|
251
257
|
return t.complete && !t.concurrent ? 0 : Math.max(0, e - t.pulled);
|
|
252
258
|
}
|
|
253
|
-
var
|
|
254
|
-
#e = new
|
|
259
|
+
var Ye = 1e3, Xe = class {
|
|
260
|
+
#e = new v([]);
|
|
255
261
|
get items$() {
|
|
256
262
|
return this.#e.asObservable();
|
|
257
263
|
}
|
|
@@ -259,7 +265,7 @@ var be = 1e3, xe = class {
|
|
|
259
265
|
return this.#e.value;
|
|
260
266
|
}
|
|
261
267
|
push(e) {
|
|
262
|
-
let t = [...e, ...this.#e.value], n = t.length > 1e3 ? t.slice(0,
|
|
268
|
+
let t = [...e, ...this.#e.value], n = t.length > 1e3 ? t.slice(0, Ye) : t;
|
|
263
269
|
this.#e.next(n);
|
|
264
270
|
}
|
|
265
271
|
remove(e) {
|
|
@@ -270,35 +276,44 @@ var be = 1e3, xe = class {
|
|
|
270
276
|
this.#e.next([]);
|
|
271
277
|
}
|
|
272
278
|
};
|
|
273
|
-
function
|
|
279
|
+
function Ze(e, t) {
|
|
274
280
|
return t.type === "database" ? !0 : e.namespace !== t.namespace || e.entity !== t.entity ? !1 : t.type === "repository" || e.entityId === t.entityId;
|
|
275
281
|
}
|
|
276
|
-
function
|
|
277
|
-
return e.changes.some((e) =>
|
|
282
|
+
function Qe(e, t) {
|
|
283
|
+
return e.changes.some((e) => Ze(e, t));
|
|
278
284
|
}
|
|
279
|
-
function
|
|
280
|
-
return e.changes.every((e) =>
|
|
285
|
+
function $e(e, t) {
|
|
286
|
+
return e.changes.every((e) => Ze(e, t));
|
|
281
287
|
}
|
|
282
|
-
function
|
|
283
|
-
let r = e.filter((e) =>
|
|
284
|
-
for (let e of r)
|
|
288
|
+
function et(e, t, n) {
|
|
289
|
+
let r = e.filter((e) => Qe(e, t)).slice(0, Math.max(0, n)), i = [], a = [];
|
|
290
|
+
for (let e of r) $e(e, t) ? a.push(e) : i.push(e);
|
|
285
291
|
return {
|
|
286
292
|
crossScope: i,
|
|
287
293
|
selected: a
|
|
288
294
|
};
|
|
289
295
|
}
|
|
290
|
-
var
|
|
296
|
+
var tt = (e) => e.type === "database" ? "database" : e.type === "repository" ? `${e.namespace}:${e.entity}` : `${e.namespace}:${e.entity}#${String(e.entityId)}`, nt = (e, t) => {
|
|
291
297
|
let n = /* @__PURE__ */ new Set();
|
|
292
|
-
for (let r of e) for (let e of r.changes)
|
|
298
|
+
for (let r of e) for (let e of r.changes) Ze(e, t) || n.add(t.type === "entity" ? `${e.namespace}:${e.entity}#${String(e.entityId)}` : `${e.namespace}:${e.entity}`);
|
|
293
299
|
return [...n].join(", ");
|
|
294
|
-
},
|
|
300
|
+
}, rt = class e extends m {
|
|
295
301
|
scope;
|
|
296
302
|
histories;
|
|
297
303
|
constructor(t, n) {
|
|
298
|
-
super(`Scoped history operation would split a transaction: scope ${
|
|
304
|
+
super(`Scoped history operation would split a transaction: scope ${tt(t)} also changes ${nt(n, t)}. Use the database scope to apply the whole transaction.`), this.scope = t, this.histories = n, this.name = "RxDBCrossScopeTransactionError", Object.setPrototypeOf(this, e.prototype);
|
|
305
|
+
}
|
|
306
|
+
}, S = (e) => e.fromChangeId ?? 0, it = (e, t) => {
|
|
307
|
+
let n = [e], r = /* @__PURE__ */ new Set([e.id]), i = e;
|
|
308
|
+
for (; i.parentId;) {
|
|
309
|
+
if (r.has(i.parentId)) throw new m(`Branch history is corrupt: cycle detected at branch '${i.id}' (parentId '${i.parentId}' already visited)`);
|
|
310
|
+
let e = t.get(i.parentId);
|
|
311
|
+
if (!e) throw new m(`Branch history is corrupt: branch '${i.id}' references missing parent '${i.parentId}'`);
|
|
312
|
+
r.add(e.id), n.push(e), i = e;
|
|
299
313
|
}
|
|
300
|
-
|
|
301
|
-
|
|
314
|
+
return n;
|
|
315
|
+
}, at = (e) => {
|
|
316
|
+
let { branches: t, currentBranch: n, nextBranch: r } = e, i = e.currentChangeId ?? S(n), a = e.nextChangeId ?? S(r);
|
|
302
317
|
if (i === a) return [];
|
|
303
318
|
if (n.id === r.id) return [{
|
|
304
319
|
branch: n,
|
|
@@ -307,89 +322,80 @@ var Te = (e) => e.type === "database" ? "database" : e.type === "repository" ? `
|
|
|
307
322
|
}];
|
|
308
323
|
let o = /* @__PURE__ */ new Map();
|
|
309
324
|
for (let e of t) o.set(e.id, e);
|
|
310
|
-
let s = (
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
if (n.has(r.parentId)) throw new u(`Branch history is corrupt: cycle detected at branch '${r.id}' (parentId '${r.parentId}' already visited)`);
|
|
314
|
-
let e = o.get(r.parentId);
|
|
315
|
-
if (!e) throw new u(`Branch history is corrupt: branch '${r.id}' references missing parent '${r.parentId}'`);
|
|
316
|
-
n.add(e.id), t.push(e), r = e;
|
|
317
|
-
}
|
|
318
|
-
return t;
|
|
319
|
-
}, c = s(n), l = s(r), d = null, f = -1;
|
|
320
|
-
for (let e = 0; e < c.length; e++) if (l.findIndex((t) => t.id === c[e].id) !== -1) {
|
|
321
|
-
d = c[e], f = e;
|
|
325
|
+
let s = it(n, o), c = it(r, o), l = null, u = -1;
|
|
326
|
+
for (let e = 0; e < s.length; e++) if (c.findIndex((t) => t.id === s[e].id) !== -1) {
|
|
327
|
+
l = s[e], u = e;
|
|
322
328
|
break;
|
|
323
329
|
}
|
|
324
|
-
let
|
|
325
|
-
if (
|
|
326
|
-
for (let e = 0; e <
|
|
327
|
-
let t =
|
|
328
|
-
n !== r &&
|
|
330
|
+
let d = [];
|
|
331
|
+
if (l) {
|
|
332
|
+
for (let e = 0; e < u; e++) {
|
|
333
|
+
let t = s[e], n = e === 0 ? i : S(s[e - 1]), r = S(t);
|
|
334
|
+
n !== r && d.push({
|
|
329
335
|
branch: t,
|
|
330
336
|
fromChangeId: n,
|
|
331
337
|
toChangeId: r
|
|
332
338
|
});
|
|
333
339
|
}
|
|
334
|
-
let e =
|
|
340
|
+
let e = c.findIndex((e) => e.id === l.id);
|
|
335
341
|
if (e === 0) {
|
|
336
|
-
let e =
|
|
337
|
-
e !== t &&
|
|
338
|
-
branch:
|
|
342
|
+
let e = u === 0 ? i : S(s[u - 1]), t = a;
|
|
343
|
+
e !== t && d.push({
|
|
344
|
+
branch: l,
|
|
339
345
|
fromChangeId: e,
|
|
340
346
|
toChangeId: t
|
|
341
347
|
});
|
|
342
348
|
} else if (e > 0) {
|
|
343
|
-
let t =
|
|
344
|
-
t !== n &&
|
|
345
|
-
branch:
|
|
349
|
+
let t = u === 0 ? i : S(s[u - 1]), n = S(c[e - 1]);
|
|
350
|
+
t !== n && d.push({
|
|
351
|
+
branch: l,
|
|
346
352
|
fromChangeId: t,
|
|
347
353
|
toChangeId: n
|
|
348
354
|
});
|
|
349
355
|
}
|
|
350
|
-
let t =
|
|
356
|
+
let t = c.slice(0, e).reverse();
|
|
351
357
|
for (let e = 0; e < t.length; e++) {
|
|
352
|
-
let n = t[e], r =
|
|
353
|
-
r !== i &&
|
|
358
|
+
let n = t[e], r = S(n), i = e === t.length - 1 ? a : S(t[e + 1]);
|
|
359
|
+
r !== i && d.push({
|
|
354
360
|
branch: n,
|
|
355
361
|
fromChangeId: r,
|
|
356
362
|
toChangeId: i
|
|
357
363
|
});
|
|
358
364
|
}
|
|
359
365
|
} else {
|
|
360
|
-
for (let e = 0; e <
|
|
361
|
-
let t =
|
|
362
|
-
n !== r &&
|
|
366
|
+
for (let e = 0; e < s.length; e++) {
|
|
367
|
+
let t = s[e], n = e === 0 ? i : S(s[e - 1]), r = S(t);
|
|
368
|
+
n !== r && d.push({
|
|
363
369
|
branch: t,
|
|
364
370
|
fromChangeId: n,
|
|
365
371
|
toChangeId: r
|
|
366
372
|
});
|
|
367
373
|
}
|
|
368
|
-
let e =
|
|
369
|
-
t !== 0 &&
|
|
374
|
+
let e = s[s.length - 1], t = S(e);
|
|
375
|
+
t !== 0 && d.push({
|
|
370
376
|
branch: e,
|
|
371
377
|
fromChangeId: t,
|
|
372
378
|
toChangeId: 0
|
|
373
379
|
});
|
|
374
|
-
let n =
|
|
375
|
-
r !== 0 &&
|
|
380
|
+
let n = c[c.length - 1], r = c.length > 1 ? S(c[c.length - 2]) : a;
|
|
381
|
+
r !== 0 && d.push({
|
|
376
382
|
branch: n,
|
|
377
383
|
fromChangeId: 0,
|
|
378
384
|
toChangeId: r
|
|
379
385
|
});
|
|
380
|
-
let o =
|
|
386
|
+
let o = c.slice(0, c.length - 1).reverse();
|
|
381
387
|
for (let e = 0; e < o.length; e++) {
|
|
382
|
-
let t = o[e], n =
|
|
383
|
-
n !== r &&
|
|
388
|
+
let t = o[e], n = S(t), r = e === o.length - 1 ? a : S(o[e + 1]);
|
|
389
|
+
n !== r && d.push({
|
|
384
390
|
branch: t,
|
|
385
391
|
fromChangeId: n,
|
|
386
392
|
toChangeId: r
|
|
387
393
|
});
|
|
388
394
|
}
|
|
389
395
|
}
|
|
390
|
-
return
|
|
391
|
-
},
|
|
392
|
-
let { branchRepository: n, changeRepository: r } =
|
|
396
|
+
return d;
|
|
397
|
+
}, ot = async (e, t) => st(await e.getLocalRepositories(), t), st = async (e, t) => {
|
|
398
|
+
let { branchRepository: n, changeRepository: r } = e, i = (await n.find({
|
|
393
399
|
where: {
|
|
394
400
|
combinator: "and",
|
|
395
401
|
rules: [{
|
|
@@ -400,26 +406,26 @@ var Te = (e) => e.type === "database" ? "database" : e.type === "repository" ? `
|
|
|
400
406
|
},
|
|
401
407
|
limit: 1
|
|
402
408
|
}))[0];
|
|
403
|
-
if (!i) throw new
|
|
409
|
+
if (!i) throw new m("Current branch not found");
|
|
404
410
|
let a = await n.find({ where: {
|
|
405
411
|
combinator: "and",
|
|
406
412
|
rules: []
|
|
407
413
|
} }), o = a.find((e) => e.id === t);
|
|
408
|
-
if (!o) throw new
|
|
409
|
-
if (i.id === o.id) throw new
|
|
410
|
-
let s = await
|
|
414
|
+
if (!o) throw new m(`Branch (${t}) not found`);
|
|
415
|
+
if (i.id === o.id) throw new m("Cannot switch to the same branch");
|
|
416
|
+
let s = await ut(r, i.id), c = await ut(r, o.id), l = at({
|
|
411
417
|
branches: a,
|
|
412
418
|
currentBranch: i,
|
|
413
419
|
currentChangeId: s ? s.id : null,
|
|
414
420
|
nextBranch: o,
|
|
415
421
|
nextChangeId: c ? c.id : null
|
|
416
|
-
}),
|
|
422
|
+
}), u = {
|
|
417
423
|
deletes: /* @__PURE__ */ new Map(),
|
|
418
424
|
updates: /* @__PURE__ */ new Map(),
|
|
419
425
|
inserts: /* @__PURE__ */ new Map()
|
|
420
426
|
};
|
|
421
427
|
for (let e = 0; e < l.length; e++) {
|
|
422
|
-
let { branch: t, fromChangeId: n, toChangeId: i } = l[e], a = n < i, o = n > i, s = Math.min(n, i), c = Math.max(n, i),
|
|
428
|
+
let { branch: t, fromChangeId: n, toChangeId: i } = l[e], a = n < i, o = n > i, s = Math.min(n, i), c = Math.max(n, i), d = { where: {
|
|
423
429
|
combinator: "and",
|
|
424
430
|
rules: [
|
|
425
431
|
{
|
|
@@ -444,16 +450,16 @@ var Te = (e) => e.type === "database" ? "database" : e.type === "repository" ? `
|
|
|
444
450
|
}
|
|
445
451
|
]
|
|
446
452
|
} };
|
|
447
|
-
t.fromChangeId && s < t.fromChangeId &&
|
|
453
|
+
t.fromChangeId && s < t.fromChangeId && d.where.rules.push({
|
|
448
454
|
field: "id",
|
|
449
455
|
operator: ">",
|
|
450
456
|
value: t.fromChangeId
|
|
451
457
|
});
|
|
452
|
-
let f = await r.find(
|
|
453
|
-
o ?
|
|
458
|
+
let f = await r.find(d);
|
|
459
|
+
o ? lt(f, u) : a && ct(f, u);
|
|
454
460
|
}
|
|
455
|
-
return
|
|
456
|
-
},
|
|
461
|
+
return u;
|
|
462
|
+
}, ct = (e, t) => C(e, !0, t), lt = (e, t) => C(e, !1, t), C = (e, t, n = {
|
|
457
463
|
deletes: /* @__PURE__ */ new Map(),
|
|
458
464
|
updates: /* @__PURE__ */ new Map(),
|
|
459
465
|
inserts: /* @__PURE__ */ new Map()
|
|
@@ -461,7 +467,7 @@ var Te = (e) => e.type === "database" ? "database" : e.type === "repository" ? `
|
|
|
461
467
|
if (t) {
|
|
462
468
|
let t = [...e].sort((e, t) => e.id - t.id);
|
|
463
469
|
for (let e of t) {
|
|
464
|
-
let t =
|
|
470
|
+
let t = he(e);
|
|
465
471
|
switch (e.type) {
|
|
466
472
|
case "INSERT":
|
|
467
473
|
n.inserts.set(t, {
|
|
@@ -487,7 +493,7 @@ var Te = (e) => e.type === "database" ? "database" : e.type === "repository" ? `
|
|
|
487
493
|
} else {
|
|
488
494
|
let t = [...e].sort((e, t) => t.id - e.id);
|
|
489
495
|
for (let e of t) {
|
|
490
|
-
let t =
|
|
496
|
+
let t = he(e);
|
|
491
497
|
switch (e.type) {
|
|
492
498
|
case "INSERT":
|
|
493
499
|
n.deletes.set(t, {
|
|
@@ -512,7 +518,7 @@ var Te = (e) => e.type === "database" ? "database" : e.type === "repository" ? `
|
|
|
512
518
|
}
|
|
513
519
|
}
|
|
514
520
|
return n;
|
|
515
|
-
},
|
|
521
|
+
}, ut = async (e, t) => (await e.find({
|
|
516
522
|
where: {
|
|
517
523
|
combinator: "and",
|
|
518
524
|
rules: [{
|
|
@@ -530,8 +536,8 @@ var Te = (e) => e.type === "database" ? "database" : e.type === "repository" ? `
|
|
|
530
536
|
sort: "desc"
|
|
531
537
|
}],
|
|
532
538
|
limit: 1
|
|
533
|
-
}))[0],
|
|
534
|
-
async function
|
|
539
|
+
}))[0], dt = (e) => e.getRepository(ee);
|
|
540
|
+
async function ft(e, t) {
|
|
535
541
|
let { changeRepository: n, branchRepository: r } = await e.rxdb.versionManager.getLocalRepositories(), i = await r.find({ where: {
|
|
536
542
|
combinator: "and",
|
|
537
543
|
rules: [{
|
|
@@ -544,7 +550,7 @@ async function Me(e, t) {
|
|
|
544
550
|
histories: [],
|
|
545
551
|
lastPushedMap: /* @__PURE__ */ new Map()
|
|
546
552
|
};
|
|
547
|
-
let a = i[0], o =
|
|
553
|
+
let a = i[0], o = Be(await dt(await y(e.rxdb.localAdapter$)).find({ where: {
|
|
548
554
|
combinator: "and",
|
|
549
555
|
rules: [{
|
|
550
556
|
field: "branchId",
|
|
@@ -565,7 +571,7 @@ async function Me(e, t) {
|
|
|
565
571
|
operator: ">",
|
|
566
572
|
value: t.changeId
|
|
567
573
|
}), {
|
|
568
|
-
histories:
|
|
574
|
+
histories: Re(await n.find({
|
|
569
575
|
where: {
|
|
570
576
|
combinator: "and",
|
|
571
577
|
rules: s
|
|
@@ -578,10 +584,10 @@ async function Me(e, t) {
|
|
|
578
584
|
lastPushedMap: o
|
|
579
585
|
};
|
|
580
586
|
}
|
|
581
|
-
async function
|
|
587
|
+
async function pt(e, t, n, r) {
|
|
582
588
|
e.isUndoRedoInProgress = !0;
|
|
583
589
|
try {
|
|
584
|
-
let i = n.flatMap((e) => e.changes).sort((e, n) => t === "undo" ? n.id - e.id : e.id - n.id), a =
|
|
590
|
+
let i = n.flatMap((e) => e.changes).sort((e, n) => t === "undo" ? n.id - e.id : e.id - n.id), a = C(i, t === "redo"), o = e.getNextRevertStateUpdatedAt(i);
|
|
585
591
|
if (t === "undo") {
|
|
586
592
|
let { adapter: t } = await e.rxdb.versionManager.getLocalRepositories(), n = await t.getRxDBChangeSequence(), r = /* @__PURE__ */ new Date();
|
|
587
593
|
i.forEach((e, t) => {
|
|
@@ -615,21 +621,28 @@ async function Ne(e, t, n, r) {
|
|
|
615
621
|
});
|
|
616
622
|
let { adapter: s } = await e.rxdb.versionManager.getLocalRepositories();
|
|
617
623
|
if (t === "undo" && (r === void 0 || !e.isUndoSessionCurrent(r))) return;
|
|
618
|
-
|
|
624
|
+
_(s, {
|
|
625
|
+
file: "undo-redo-apply.ts",
|
|
626
|
+
symbol: "applyUndoRedoHistories",
|
|
627
|
+
intent: g.undo_redo
|
|
628
|
+
}), await s.switchBranch({
|
|
629
|
+
actions: a,
|
|
630
|
+
prepare: te
|
|
631
|
+
}), e.pushableCountTrigger$.next(Date.now()), e.setRevertStateWatermarks(i, t === "undo", o), t === "undo" ? e.pushToRedoStack(n) : e.removeFromRedoStack(n);
|
|
619
632
|
} finally {
|
|
620
633
|
e.isUndoRedoInProgress = !1;
|
|
621
634
|
}
|
|
622
635
|
}
|
|
623
|
-
async function
|
|
636
|
+
async function mt(e) {
|
|
624
637
|
let t = ++e.pushableGeneration, n = (n) => {
|
|
625
638
|
t === e.pushableGeneration && e.pushableCount$.next(n);
|
|
626
639
|
};
|
|
627
640
|
try {
|
|
628
|
-
if (!await
|
|
641
|
+
if (!await y(e.rxdb.connected$)) {
|
|
629
642
|
n(0);
|
|
630
643
|
return;
|
|
631
644
|
}
|
|
632
|
-
let t =
|
|
645
|
+
let t = dt(await y(e.rxdb.localAdapter$)), r = e.rxdb.entityManager.getRepository(p), i = await y(e.rxdb.entityManager.getRepository(f).findOne({ where: {
|
|
633
646
|
combinator: "and",
|
|
634
647
|
rules: [{
|
|
635
648
|
field: "activated",
|
|
@@ -648,12 +661,12 @@ async function Pe(e) {
|
|
|
648
661
|
operator: "=",
|
|
649
662
|
value: i.id
|
|
650
663
|
}]
|
|
651
|
-
} }), o =
|
|
664
|
+
} }), o = ue(e.rxdb.config.entities, e.rxdb.entitySync, a);
|
|
652
665
|
if (o.length === 0) {
|
|
653
666
|
n(0);
|
|
654
667
|
return;
|
|
655
668
|
}
|
|
656
|
-
n(await
|
|
669
|
+
n(await y(r.count({ where: {
|
|
657
670
|
combinator: "and",
|
|
658
671
|
rules: [
|
|
659
672
|
{
|
|
@@ -678,24 +691,24 @@ async function Pe(e) {
|
|
|
678
691
|
]
|
|
679
692
|
} })));
|
|
680
693
|
} catch (t) {
|
|
681
|
-
!e.destroyed && !
|
|
694
|
+
!e.destroyed && !_e(t) && (console.error("[#updatePushableCount] error", t), e.errors$.next(t instanceof Error ? t : Error(String(t)))), n(0);
|
|
682
695
|
}
|
|
683
696
|
}
|
|
684
|
-
var
|
|
697
|
+
var ht = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), gt = class {
|
|
685
698
|
rxdb;
|
|
686
699
|
#e = [];
|
|
687
700
|
#t = !1;
|
|
688
701
|
#n;
|
|
689
702
|
#r;
|
|
690
|
-
#i = new
|
|
703
|
+
#i = new Ce(1);
|
|
691
704
|
#a = Promise.resolve();
|
|
692
|
-
#o = new
|
|
705
|
+
#o = new v(0);
|
|
693
706
|
#s = 0;
|
|
694
|
-
#c = new
|
|
707
|
+
#c = new v(0);
|
|
695
708
|
#l = 0;
|
|
696
|
-
#u = new
|
|
709
|
+
#u = new v(0);
|
|
697
710
|
#d = /* @__PURE__ */ new Map();
|
|
698
|
-
#f = new
|
|
711
|
+
#f = new v(0);
|
|
699
712
|
#p = 0;
|
|
700
713
|
#m;
|
|
701
714
|
#h = null;
|
|
@@ -704,15 +717,15 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
704
717
|
#v = null;
|
|
705
718
|
#y = 0;
|
|
706
719
|
#b = null;
|
|
707
|
-
#x = new
|
|
720
|
+
#x = new v({
|
|
708
721
|
generation: 0,
|
|
709
722
|
state: "active",
|
|
710
|
-
boundary:
|
|
723
|
+
boundary: Ke
|
|
711
724
|
});
|
|
712
725
|
isUndoRedoInProgress = !1;
|
|
713
726
|
isInvalidatingRedo = !1;
|
|
714
727
|
syncDepth = 0;
|
|
715
|
-
redoStack = new
|
|
728
|
+
redoStack = new Xe();
|
|
716
729
|
history_cache = /* @__PURE__ */ new Map();
|
|
717
730
|
history_ref_counts = /* @__PURE__ */ new Map();
|
|
718
731
|
histories$;
|
|
@@ -720,7 +733,7 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
720
733
|
redoHistories$;
|
|
721
734
|
undoCount$;
|
|
722
735
|
redoCount$;
|
|
723
|
-
errors$ = new
|
|
736
|
+
errors$ = new we();
|
|
724
737
|
pushableCount$;
|
|
725
738
|
pullableCount$;
|
|
726
739
|
count$;
|
|
@@ -729,21 +742,21 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
729
742
|
}
|
|
730
743
|
constructor(e) {
|
|
731
744
|
this.rxdb = e, this.#n = this.#R(), this.#r = this.#z();
|
|
732
|
-
let t = e.entityManager.getRepository(
|
|
745
|
+
let t = e.entityManager.getRepository(f), n = e.entityManager.getRepository(p), r = this.rxdb.connected$.pipe(Oe((e) => e ? t.findOne({ where: {
|
|
733
746
|
combinator: "and",
|
|
734
747
|
rules: [{
|
|
735
748
|
field: "activated",
|
|
736
749
|
operator: "=",
|
|
737
750
|
value: !0
|
|
738
751
|
}]
|
|
739
|
-
} });
|
|
740
|
-
this.#e.push(r.pipe(
|
|
752
|
+
} }) : xe));
|
|
753
|
+
this.#e.push(r.pipe(ke(this.#i)).subscribe({
|
|
741
754
|
next: (e) => this.#E(e?.id ?? null),
|
|
742
755
|
error: (e) => this.#T("undo session 分支跟随的活跃分支流已中断", e)
|
|
743
|
-
})), this.#m =
|
|
756
|
+
})), this.#m = Ee({
|
|
744
757
|
connected: this.rxdb.connected$,
|
|
745
758
|
branch: r
|
|
746
|
-
}).pipe(
|
|
759
|
+
}).pipe(De(({ connected: e, branch: t }) => e && !!t), Oe(({ branch: e }) => {
|
|
747
760
|
let t = this.#M();
|
|
748
761
|
return n.findAll({
|
|
749
762
|
where: {
|
|
@@ -763,25 +776,25 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
763
776
|
sort: "desc"
|
|
764
777
|
}]
|
|
765
778
|
});
|
|
766
|
-
}),
|
|
767
|
-
let i = this.#m.pipe(
|
|
779
|
+
}), ke(this.#i));
|
|
780
|
+
let i = this.#m.pipe(b((e) => Re(e)), x({
|
|
768
781
|
bufferSize: 1,
|
|
769
782
|
refCount: !0
|
|
770
783
|
}));
|
|
771
|
-
this.histories$ =
|
|
784
|
+
this.histories$ = Ee([i, this.#f]).pipe(b(([e]) => this.#O(e)), x({
|
|
772
785
|
bufferSize: 1,
|
|
773
786
|
refCount: !0
|
|
774
|
-
})), this.count$ = this.histories$.pipe(
|
|
787
|
+
})), this.count$ = this.histories$.pipe(b((e) => e.length), x({
|
|
775
788
|
bufferSize: 1,
|
|
776
789
|
refCount: !0
|
|
777
|
-
})), this.undoHistories$ =
|
|
790
|
+
})), this.undoHistories$ = Ee({
|
|
778
791
|
histories: this.histories$,
|
|
779
792
|
undoSession: this.#x,
|
|
780
793
|
trigger: this.#u
|
|
781
|
-
}).pipe(
|
|
794
|
+
}).pipe(Oe(async ({ histories: e, undoSession: t }) => {
|
|
782
795
|
if (t.state === "cleared") return [];
|
|
783
796
|
try {
|
|
784
|
-
let n = await
|
|
797
|
+
let n = await y(this.rxdb.entityManager.getRepository(f).findOne({ where: {
|
|
785
798
|
combinator: "and",
|
|
786
799
|
rules: [{
|
|
787
800
|
field: "activated",
|
|
@@ -789,7 +802,7 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
789
802
|
value: !0
|
|
790
803
|
}]
|
|
791
804
|
} }));
|
|
792
|
-
return n ?
|
|
805
|
+
return n ? He(e, Be(await dt(await y(this.rxdb.localAdapter$)).find({ where: {
|
|
793
806
|
combinator: "and",
|
|
794
807
|
rules: [{
|
|
795
808
|
field: "branchId",
|
|
@@ -801,20 +814,20 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
801
814
|
let t = e instanceof Error ? e : Error(String(e));
|
|
802
815
|
return this.errors$.next(t), [];
|
|
803
816
|
}
|
|
804
|
-
}),
|
|
817
|
+
}), x({
|
|
805
818
|
bufferSize: 1,
|
|
806
819
|
refCount: !0
|
|
807
|
-
})), this.redoHistories$ = this.redoStack.items$, this.undoCount$ = this.undoHistories$.pipe(
|
|
820
|
+
})), this.redoHistories$ = this.redoStack.items$, this.undoCount$ = this.undoHistories$.pipe(b((e) => e.length), x({
|
|
808
821
|
bufferSize: 1,
|
|
809
822
|
refCount: !0
|
|
810
|
-
})), this.redoCount$ = this.redoHistories$.pipe(
|
|
823
|
+
})), this.redoCount$ = this.redoHistories$.pipe(b((e) => e.length), x({
|
|
811
824
|
bufferSize: 1,
|
|
812
825
|
refCount: !0
|
|
813
826
|
})), this.pushableCount$ = this.#c.asObservable(), this.pullableCount$ = this.#o.asObservable();
|
|
814
|
-
let a =
|
|
827
|
+
let a = Ee({
|
|
815
828
|
connected: this.rxdb.connected$,
|
|
816
829
|
branch: r
|
|
817
|
-
}).pipe(
|
|
830
|
+
}).pipe(De(({ connected: e, branch: t }) => e && !!t), Oe(({ branch: e }) => {
|
|
818
831
|
let t = [
|
|
819
832
|
{
|
|
820
833
|
field: "branchId",
|
|
@@ -830,24 +843,29 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
830
843
|
field: "remoteId",
|
|
831
844
|
operator: "=",
|
|
832
845
|
value: null
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
field: "rejectedAt",
|
|
849
|
+
operator: "=",
|
|
850
|
+
value: null
|
|
833
851
|
}
|
|
834
852
|
];
|
|
835
853
|
return n.count({ where: {
|
|
836
854
|
combinator: "and",
|
|
837
855
|
rules: t
|
|
838
|
-
} }).pipe(
|
|
856
|
+
} }).pipe(Te((e) => (this.#T("pushableCount 的变更计数查询", e), be)));
|
|
839
857
|
})).subscribe({
|
|
840
858
|
next: () => {
|
|
841
859
|
this.#L();
|
|
842
860
|
},
|
|
843
861
|
error: (e) => this.#T("pushableCount 重算的活跃分支流已中断", e)
|
|
844
862
|
});
|
|
845
|
-
this.#e.push(a), this.rxdb.addEventListener(
|
|
863
|
+
this.#e.push(a), this.rxdb.addEventListener(u, this.#F), this.#L();
|
|
846
864
|
}
|
|
847
865
|
destroy() {
|
|
848
866
|
this.#t = !0, this.#i.next(), this.#i.complete();
|
|
849
867
|
for (let e of this.#e) e.unsubscribe();
|
|
850
|
-
this.#e.length = 0, this.rxdb.removeEventListener(
|
|
868
|
+
this.#e.length = 0, this.rxdb.removeEventListener(u, this.#F), this.#d.clear(), this.errors$.complete();
|
|
851
869
|
}
|
|
852
870
|
incrementPullableCount(e) {
|
|
853
871
|
this.#s++;
|
|
@@ -865,7 +883,7 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
865
883
|
this.#o.next(n);
|
|
866
884
|
}
|
|
867
885
|
settlePullableCount(e, t) {
|
|
868
|
-
this.#o.next(
|
|
886
|
+
this.#o.next(Je(this.#o.value, {
|
|
869
887
|
complete: t.complete,
|
|
870
888
|
concurrent: e !== this.#s,
|
|
871
889
|
pulled: t.pulled
|
|
@@ -902,7 +920,7 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
902
920
|
this.#v = t(this.#v ?? {
|
|
903
921
|
generation: 0,
|
|
904
922
|
state: "active",
|
|
905
|
-
boundary:
|
|
923
|
+
boundary: Ke
|
|
906
924
|
});
|
|
907
925
|
let n = this.#b === null ? void 0 : this.#_.get(this.#b);
|
|
908
926
|
this.#x.next(n ?? this.#v), this.clearRedoStack();
|
|
@@ -913,7 +931,7 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
913
931
|
let r = e.filter((e) => Number.isSafeInteger(e) && e > 0);
|
|
914
932
|
if (t === void 0) {
|
|
915
933
|
if (r.length === 0) return;
|
|
916
|
-
let e =
|
|
934
|
+
let e = ht(r);
|
|
917
935
|
this.#w({
|
|
918
936
|
generation: n.generation,
|
|
919
937
|
state: "active",
|
|
@@ -925,7 +943,7 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
925
943
|
return;
|
|
926
944
|
}
|
|
927
945
|
if (!(t.generation === null ? t.recordAt !== null && Number.isFinite(t.recordAt.getTime()) && t.recordAt.getTime() > n.clearedAt.getTime() : t.generation === n.generation)) return;
|
|
928
|
-
let i = r.length > 0 ?
|
|
946
|
+
let i = r.length > 0 ? ht(r) : null, a = i === null && (n.boundary.createdAfter === null || n.boundary.createdAfter.getTime() < n.clearedAt.getTime()) ? n.clearedAt : n.boundary.createdAfter;
|
|
929
947
|
this.#w({
|
|
930
948
|
generation: n.generation,
|
|
931
949
|
state: "active",
|
|
@@ -948,19 +966,26 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
948
966
|
}
|
|
949
967
|
async invalidateRedoStack(e) {
|
|
950
968
|
return this.#j(async () => {
|
|
951
|
-
if (!(
|
|
969
|
+
if (!(e?.length && e.every((e) => e <= this.#p))) {
|
|
952
970
|
this.isInvalidatingRedo = !0;
|
|
953
971
|
try {
|
|
954
|
-
let e = await
|
|
972
|
+
let e = await y(this.redoHistories$);
|
|
955
973
|
if (e.length === 0) return;
|
|
956
|
-
let t = e.flatMap((e) => e.changes), n = /* @__PURE__ */ new Date(), r =
|
|
974
|
+
let t = e.flatMap((e) => e.changes), n = /* @__PURE__ */ new Date(), r = C([], !1), { adapter: i } = await this.rxdb.versionManager.getLocalRepositories();
|
|
957
975
|
t.forEach((e) => {
|
|
958
976
|
let t = `rxdb:RxDBChange:${e.id}`;
|
|
959
977
|
r.updates.set(t, {
|
|
960
978
|
patch: { redoInvalidatedAt: n },
|
|
961
979
|
inversePatch: { redoInvalidatedAt: null }
|
|
962
980
|
});
|
|
963
|
-
}),
|
|
981
|
+
}), _(i, {
|
|
982
|
+
file: "HistoryManager.ts",
|
|
983
|
+
symbol: "invalidateRedoStack",
|
|
984
|
+
intent: g.redo_invalidation
|
|
985
|
+
}), await i.switchBranch({
|
|
986
|
+
actions: r,
|
|
987
|
+
prepare: te
|
|
988
|
+
}), this.clearRedoStack();
|
|
964
989
|
} catch (e) {
|
|
965
990
|
throw console.error("[HistoryManager] Failed to invalidate redo stack:", e), e;
|
|
966
991
|
} finally {
|
|
@@ -970,11 +995,11 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
970
995
|
});
|
|
971
996
|
}
|
|
972
997
|
history(e) {
|
|
973
|
-
return
|
|
998
|
+
return Ge(this.#n, e);
|
|
974
999
|
}
|
|
975
1000
|
#S(e, t, n) {
|
|
976
|
-
let { crossScope: r, selected: i } =
|
|
977
|
-
if (r.length > 0) throw new
|
|
1001
|
+
let { crossScope: r, selected: i } = et(e, t, n);
|
|
1002
|
+
if (r.length > 0) throw new rt(t, r);
|
|
978
1003
|
return i;
|
|
979
1004
|
}
|
|
980
1005
|
#C() {
|
|
@@ -984,7 +1009,7 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
984
1009
|
this.#b !== null && this.#_.set(this.#b, e), this.#x.next(e);
|
|
985
1010
|
}
|
|
986
1011
|
#T(e, t) {
|
|
987
|
-
this.#t ||
|
|
1012
|
+
this.#t || _e(t) || (console.error(`[HistoryManager] ${e}:`, t), this.errors$.next(t instanceof Error ? t : Error(String(t))));
|
|
988
1013
|
}
|
|
989
1014
|
#E(e) {
|
|
990
1015
|
if (e === this.#b || (this.#b === null && e !== null && !this.#_.has(e) && this.#_.set(e, this.#x.value), this.#b = e, e === null)) return;
|
|
@@ -996,7 +1021,7 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
996
1021
|
return t === null ? {
|
|
997
1022
|
generation: e,
|
|
998
1023
|
state: "active",
|
|
999
|
-
boundary:
|
|
1024
|
+
boundary: Ke
|
|
1000
1025
|
} : {
|
|
1001
1026
|
...t,
|
|
1002
1027
|
generation: e
|
|
@@ -1044,16 +1069,16 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
1044
1069
|
return this.#x.value === e;
|
|
1045
1070
|
}
|
|
1046
1071
|
async #P(e) {
|
|
1047
|
-
return
|
|
1072
|
+
return ft(this.#r, e);
|
|
1048
1073
|
}
|
|
1049
1074
|
#F = () => {
|
|
1050
1075
|
this.#L(), this.#u.next(Date.now());
|
|
1051
1076
|
};
|
|
1052
1077
|
async #I(e, t, n) {
|
|
1053
|
-
return
|
|
1078
|
+
return pt(this.#r, e, t, n);
|
|
1054
1079
|
}
|
|
1055
1080
|
async #L() {
|
|
1056
|
-
return
|
|
1081
|
+
return mt(this.#r);
|
|
1057
1082
|
}
|
|
1058
1083
|
#R() {
|
|
1059
1084
|
let e = this;
|
|
@@ -1127,11 +1152,11 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
1127
1152
|
removeFromRedoStack: (t) => e.removeFromRedoStack(t)
|
|
1128
1153
|
};
|
|
1129
1154
|
}
|
|
1130
|
-
},
|
|
1155
|
+
}, _t = async (e, t) => {
|
|
1131
1156
|
let { adapter: n } = await e.getLocalRepositories();
|
|
1132
|
-
if (t ===
|
|
1133
|
-
let r = await n.transaction(async (
|
|
1134
|
-
let
|
|
1157
|
+
if (t === a) throw new m("Cannot remove main branch");
|
|
1158
|
+
let r = await n.transaction(async (n) => {
|
|
1159
|
+
let r = n.getRepository(f), i = n.getRepository(p), a = (await r.find({
|
|
1135
1160
|
where: {
|
|
1136
1161
|
combinator: "and",
|
|
1137
1162
|
rules: [{
|
|
@@ -1142,9 +1167,9 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
1142
1167
|
},
|
|
1143
1168
|
limit: 1
|
|
1144
1169
|
}))[0];
|
|
1145
|
-
if (!
|
|
1146
|
-
if (
|
|
1147
|
-
if ((await
|
|
1170
|
+
if (!a) return `Branch '${t}' not found`;
|
|
1171
|
+
if (a.activated) return `Cannot remove active branch '${t}'. Switch to another branch first.`;
|
|
1172
|
+
if ((await r.find({
|
|
1148
1173
|
where: {
|
|
1149
1174
|
combinator: "and",
|
|
1150
1175
|
rules: [{
|
|
@@ -1159,7 +1184,7 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
1159
1184
|
},
|
|
1160
1185
|
limit: 1
|
|
1161
1186
|
}))?.length) return `Cannot remove branch '${t}' because it has child branches`;
|
|
1162
|
-
let
|
|
1187
|
+
let o = await i.find({ where: {
|
|
1163
1188
|
combinator: "and",
|
|
1164
1189
|
rules: [{
|
|
1165
1190
|
field: "branchId",
|
|
@@ -1167,12 +1192,16 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
1167
1192
|
value: t
|
|
1168
1193
|
}]
|
|
1169
1194
|
} });
|
|
1170
|
-
|
|
1195
|
+
for (let r of e.rxdb.systemContributions) await r.removeBranchRows({
|
|
1196
|
+
executor: n,
|
|
1197
|
+
branchId: t
|
|
1198
|
+
});
|
|
1199
|
+
await n.removeMany([...o, a]);
|
|
1171
1200
|
});
|
|
1172
|
-
if (r) throw new
|
|
1173
|
-
},
|
|
1201
|
+
if (r) throw new m(r);
|
|
1202
|
+
}, vt = async (e, t, n, r) => {
|
|
1174
1203
|
let i = r?.strategy ?? "squash", a = r?.deleteSource ?? !1, { branchRepository: o, changeRepository: s, adapter: c } = await e.getLocalRepositories();
|
|
1175
|
-
if (t === n) throw new
|
|
1204
|
+
if (t === n) throw new m(`Cannot merge branch '${t}' into itself`);
|
|
1176
1205
|
let l = (await o.find({
|
|
1177
1206
|
where: {
|
|
1178
1207
|
combinator: "and",
|
|
@@ -1184,8 +1213,8 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
1184
1213
|
},
|
|
1185
1214
|
limit: 1
|
|
1186
1215
|
}))[0];
|
|
1187
|
-
if (!l) throw new
|
|
1188
|
-
let
|
|
1216
|
+
if (!l) throw new m(`Branch '${t}' not found`);
|
|
1217
|
+
let u = await s.find({
|
|
1189
1218
|
where: {
|
|
1190
1219
|
combinator: "and",
|
|
1191
1220
|
rules: [
|
|
@@ -1210,31 +1239,31 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
1210
1239
|
field: "id",
|
|
1211
1240
|
sort: "asc"
|
|
1212
1241
|
}]
|
|
1213
|
-
}),
|
|
1242
|
+
}), d = async () => {
|
|
1214
1243
|
if (!a) return { deleted: !1 };
|
|
1215
1244
|
try {
|
|
1216
|
-
return await
|
|
1245
|
+
return await _t(e, t), { deleted: !0 };
|
|
1217
1246
|
} catch (e) {
|
|
1218
1247
|
return {
|
|
1219
1248
|
deleted: !1,
|
|
1220
1249
|
error: e instanceof Error ? e : Error(String(e))
|
|
1221
1250
|
};
|
|
1222
1251
|
}
|
|
1223
|
-
},
|
|
1252
|
+
}, f = (e, t) => ({
|
|
1224
1253
|
merged: e,
|
|
1225
1254
|
strategy: i,
|
|
1226
1255
|
sourceDeleted: t.deleted,
|
|
1227
1256
|
...t.error ? { sourceDeleteError: t.error } : {}
|
|
1228
1257
|
});
|
|
1229
|
-
if (
|
|
1230
|
-
let
|
|
1258
|
+
if (u.length === 0) return f(0, await d());
|
|
1259
|
+
let p;
|
|
1231
1260
|
if (i === "normal") await c.transaction(async (e) => {
|
|
1232
|
-
for (let t of
|
|
1261
|
+
for (let t of u) {
|
|
1233
1262
|
let n = {
|
|
1234
1263
|
deletes: /* @__PURE__ */ new Map(),
|
|
1235
1264
|
updates: /* @__PURE__ */ new Map(),
|
|
1236
1265
|
inserts: /* @__PURE__ */ new Map()
|
|
1237
|
-
}, r =
|
|
1266
|
+
}, r = he(t);
|
|
1238
1267
|
t.type === "INSERT" ? n.inserts.set(r, {
|
|
1239
1268
|
patch: t.patch,
|
|
1240
1269
|
inversePatch: null
|
|
@@ -1244,17 +1273,27 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
1244
1273
|
}) : t.type === "DELETE" && n.deletes.set(r, {
|
|
1245
1274
|
patch: null,
|
|
1246
1275
|
inversePatch: t.inversePatch
|
|
1276
|
+
}), _(e, {
|
|
1277
|
+
file: "merge-branch.ts",
|
|
1278
|
+
symbol: "merge_branch",
|
|
1279
|
+
intent: g.merge_per_change
|
|
1247
1280
|
}), await e.mergeChanges(n, void 0, !1);
|
|
1248
1281
|
}
|
|
1249
|
-
}),
|
|
1282
|
+
}), p = u.length;
|
|
1250
1283
|
else {
|
|
1251
|
-
let e =
|
|
1284
|
+
let e = C(u, !0), t = new Set(u.filter((e) => e.type === "INSERT").map((e) => he(e)));
|
|
1252
1285
|
for (let n of t) e.deletes.has(n) && e.deletes.delete(n);
|
|
1253
|
-
if (
|
|
1254
|
-
await c.
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1286
|
+
if (p = e.inserts.size + e.updates.size + e.deletes.size, p === 0) return f(0, await d());
|
|
1287
|
+
await c.transaction(async (t) => {
|
|
1288
|
+
_(t, {
|
|
1289
|
+
file: "merge-branch.ts",
|
|
1290
|
+
symbol: "merge_branch",
|
|
1291
|
+
intent: g.merge_squash
|
|
1292
|
+
}), await t.mergeChanges(e, void 0, !1);
|
|
1293
|
+
}, !1);
|
|
1294
|
+
}
|
|
1295
|
+
return f(p, await d());
|
|
1296
|
+
}, yt = class {
|
|
1258
1297
|
#e = /* @__PURE__ */ new Map();
|
|
1259
1298
|
#t = 0;
|
|
1260
1299
|
session() {
|
|
@@ -1278,7 +1317,7 @@ var K = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), q = class {
|
|
|
1278
1317
|
return e;
|
|
1279
1318
|
}
|
|
1280
1319
|
};
|
|
1281
|
-
async function
|
|
1320
|
+
async function bt(e, t, n) {
|
|
1282
1321
|
let { changeRepository: r, adapter: i } = await e.getLocalRepositories(), a = await r.find({
|
|
1283
1322
|
where: {
|
|
1284
1323
|
combinator: "and",
|
|
@@ -1290,16 +1329,22 @@ async function Le(e, t, n) {
|
|
|
1290
1329
|
},
|
|
1291
1330
|
limit: 1
|
|
1292
1331
|
});
|
|
1293
|
-
if (a.length === 0) throw new
|
|
1332
|
+
if (a.length === 0) throw new m(`RxDBChange not found: ${n.changeId}`);
|
|
1294
1333
|
let o = a[0];
|
|
1295
|
-
if (o.type !== "DELETE") throw new
|
|
1296
|
-
if (!o.inversePatch) throw new
|
|
1297
|
-
let s = t.constructor, c =
|
|
1298
|
-
if (o.namespace !== c.namespace || o.entity !== c.name) throw new
|
|
1299
|
-
if (o.branchId != null && o.branchId !== l.id) throw new
|
|
1300
|
-
let
|
|
1301
|
-
await i.
|
|
1302
|
-
|
|
1334
|
+
if (o.type !== "DELETE") throw new m(`Cannot restore from non-DELETE change (type=${o.type})`);
|
|
1335
|
+
if (!o.inversePatch) throw new m(`RxDBChange ${n.changeId} has no inversePatch`);
|
|
1336
|
+
let s = t.constructor, c = fe(s), l = await e.getCurrentBranch();
|
|
1337
|
+
if (o.namespace !== c.namespace || o.entity !== c.name) throw new m(`RxDBChange ${n.changeId} belongs to ${o.namespace}:${o.entity}, not ${c.namespace}:${c.name}`);
|
|
1338
|
+
if (o.branchId != null && o.branchId !== l.id) throw new m(`RxDBChange ${n.changeId} belongs to branch '${o.branchId}', current branch is '${l.id}'`);
|
|
1339
|
+
let u = C([o], !1);
|
|
1340
|
+
await i.transaction(async (e) => {
|
|
1341
|
+
_(e, {
|
|
1342
|
+
file: "restore-entity.ts",
|
|
1343
|
+
symbol: "restore_entity",
|
|
1344
|
+
intent: g.restore_entity
|
|
1345
|
+
}), await e.mergeChanges(u, void 0, !1);
|
|
1346
|
+
}, !1);
|
|
1347
|
+
let d = await i.getRepository(s).find({
|
|
1303
1348
|
where: {
|
|
1304
1349
|
combinator: "and",
|
|
1305
1350
|
rules: [{
|
|
@@ -1310,16 +1355,16 @@ async function Le(e, t, n) {
|
|
|
1310
1355
|
},
|
|
1311
1356
|
limit: 1
|
|
1312
1357
|
});
|
|
1313
|
-
if (!
|
|
1314
|
-
return
|
|
1358
|
+
if (!d[0]) throw new m(`Restore produced no row for ${c.namespace}:${c.name} id=${String(o.entityId)}`);
|
|
1359
|
+
return d[0];
|
|
1315
1360
|
}
|
|
1316
|
-
var
|
|
1361
|
+
var xt = (e, t) => ({
|
|
1317
1362
|
pushInFlight: t,
|
|
1318
1363
|
syncing: (t) => e().syncing(t),
|
|
1319
1364
|
clearUndoHistory: () => e().clearUndoHistory(),
|
|
1320
1365
|
beginPullableSettlement: () => e().beginPullableSettlement(),
|
|
1321
1366
|
settlePull: (t, n, r) => e().settlePullableCount(t, {
|
|
1322
|
-
complete:
|
|
1367
|
+
complete: qe(n, r),
|
|
1323
1368
|
pulled: r.pulled
|
|
1324
1369
|
}),
|
|
1325
1370
|
settleAbortedPull: (t, n) => e().settlePullableCount(t, {
|
|
@@ -1328,14 +1373,14 @@ var Re = (e, t) => ({
|
|
|
1328
1373
|
}),
|
|
1329
1374
|
reconcilePullableCount: (t, n) => e().reconcilePullableCount(t, n),
|
|
1330
1375
|
incrementPullableCount: (t) => e().incrementPullableCount(t)
|
|
1331
|
-
}),
|
|
1332
|
-
let t =
|
|
1333
|
-
return t === null ? typeof e.patch != "object" || e.patch === null || !("id" in e.patch) ? null :
|
|
1334
|
-
},
|
|
1376
|
+
}), St = (e) => typeof e == "number" && Number.isSafeInteger(e) && e > 0 ? e : null, Ct = (e) => {
|
|
1377
|
+
let t = St(e.id);
|
|
1378
|
+
return t === null ? typeof e.patch != "object" || e.patch === null || !("id" in e.patch) ? null : St(e.patch.id) : t;
|
|
1379
|
+
}, wt = (e) => {
|
|
1335
1380
|
let t = null;
|
|
1336
1381
|
for (let n of e) n.recordAt instanceof Date && Number.isFinite(n.recordAt.getTime()) && (t === null || n.recordAt.getTime() < t.getTime()) && (t = n.recordAt);
|
|
1337
1382
|
return t;
|
|
1338
|
-
},
|
|
1383
|
+
}, Tt = class {
|
|
1339
1384
|
rxdb;
|
|
1340
1385
|
#e = [];
|
|
1341
1386
|
#t = 0;
|
|
@@ -1343,8 +1388,8 @@ var Re = (e, t) => ({
|
|
|
1343
1388
|
#r = !1;
|
|
1344
1389
|
#i = !1;
|
|
1345
1390
|
historyManager;
|
|
1346
|
-
pushInFlight = new
|
|
1347
|
-
syncBridge =
|
|
1391
|
+
pushInFlight = new yt();
|
|
1392
|
+
syncBridge = xt(() => this.historyManager, this.pushInFlight);
|
|
1348
1393
|
get pushableCount$() {
|
|
1349
1394
|
return this.historyManager.pushableCount$;
|
|
1350
1395
|
}
|
|
@@ -1352,10 +1397,10 @@ var Re = (e, t) => ({
|
|
|
1352
1397
|
return this.historyManager.pullableCount$;
|
|
1353
1398
|
}
|
|
1354
1399
|
constructor(e) {
|
|
1355
|
-
this.rxdb = e, this.historyManager = new
|
|
1400
|
+
this.rxdb = e, this.historyManager = new gt(this.rxdb);
|
|
1356
1401
|
}
|
|
1357
1402
|
init() {
|
|
1358
|
-
this.#i &&= (this.historyManager = new
|
|
1403
|
+
this.#i &&= (this.historyManager = new gt(this.rxdb), !1);
|
|
1359
1404
|
let e = () => {
|
|
1360
1405
|
if (!this.#r) {
|
|
1361
1406
|
this.#r = !0;
|
|
@@ -1368,20 +1413,20 @@ var Re = (e, t) => ({
|
|
|
1368
1413
|
}, t = () => {
|
|
1369
1414
|
this.#t = 0, this.#n = null;
|
|
1370
1415
|
};
|
|
1371
|
-
this.rxdb.addEventListener(
|
|
1416
|
+
this.rxdb.addEventListener(se, e), this.rxdb.addEventListener(ce, t), this.#e.push(() => this.rxdb.removeEventListener(se, e), () => this.rxdb.removeEventListener(ce, t));
|
|
1372
1417
|
}
|
|
1373
1418
|
this.#t === 0 && (this.#n = this.historyManager.undoSessionGeneration), this.#t += 1;
|
|
1374
1419
|
};
|
|
1375
|
-
this.rxdb.addEventListener(
|
|
1420
|
+
this.rxdb.addEventListener(oe, e), this.#e.push(() => this.rxdb.removeEventListener(oe, e));
|
|
1376
1421
|
let t = (e) => {
|
|
1377
1422
|
let t = e.entities?.filter((e) => e.namespace === "rxdb" && e.entity === "RxDBChange") ?? [];
|
|
1378
1423
|
if (t.length > 0 && !this.historyManager.isExecutingUndoRedo()) {
|
|
1379
1424
|
let e = t.flatMap((e) => {
|
|
1380
|
-
let t =
|
|
1425
|
+
let t = Ct(e);
|
|
1381
1426
|
return t === null ? [] : [t];
|
|
1382
1427
|
});
|
|
1383
|
-
this.#
|
|
1384
|
-
let n =
|
|
1428
|
+
this.#l(this.historyManager.invalidateRedoStack(e), "invalidateRedoStack");
|
|
1429
|
+
let n = wt(t);
|
|
1385
1430
|
this.#n !== null || n !== null ? this.historyManager.resetSyncCleared(e, {
|
|
1386
1431
|
generation: this.#n,
|
|
1387
1432
|
recordAt: n
|
|
@@ -1401,137 +1446,2628 @@ var Re = (e, t) => ({
|
|
|
1401
1446
|
this.historyManager.clearAllUndoHistory(), this.historyManager.resetPullableCount();
|
|
1402
1447
|
}
|
|
1403
1448
|
async createBranch(e, t) {
|
|
1404
|
-
return
|
|
1449
|
+
return Ne(this, e, t);
|
|
1405
1450
|
}
|
|
1406
1451
|
async removeBranch(e) {
|
|
1407
|
-
return
|
|
1452
|
+
return _t(this, e);
|
|
1408
1453
|
}
|
|
1409
|
-
async switchBranch(e) {
|
|
1410
|
-
|
|
1411
|
-
|
|
1454
|
+
async switchBranch(e, t) {
|
|
1455
|
+
let n = await this.getCurrentBranch();
|
|
1456
|
+
if (n?.id === e) return;
|
|
1457
|
+
let r = !1, i, a = !1;
|
|
1412
1458
|
try {
|
|
1413
|
-
this.rxdb.dispatchEvent(new
|
|
1414
|
-
|
|
1459
|
+
if (this.rxdb.dispatchEvent(new ne(e)), await this.#o(n?.id ?? null, e, t)) {
|
|
1460
|
+
r = !0, this.#a(e);
|
|
1461
|
+
return;
|
|
1462
|
+
}
|
|
1463
|
+
let { adapter: o } = await this.getLocalRepositories(), s = await ot(this, e);
|
|
1464
|
+
_(o, {
|
|
1465
|
+
file: "VersionManager.ts",
|
|
1466
|
+
symbol: "switchBranch",
|
|
1467
|
+
intent: g.branch_materialization
|
|
1468
|
+
}), i = o;
|
|
1469
|
+
let c = await o.switchBranch({
|
|
1415
1470
|
branchId: e,
|
|
1416
|
-
actions:
|
|
1471
|
+
actions: s,
|
|
1472
|
+
prepare: async ({ executor: e, targetBranchId: r }) => {
|
|
1473
|
+
a = !0, await this.#c(e, n?.id ?? null, r, t);
|
|
1474
|
+
}
|
|
1417
1475
|
});
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1476
|
+
if (r = !0, this.#a(e), !a) throw new m(`适配器 ${o.constructor.name} 的 switchBranch 没有调用 options.prepare:分支已经切到 ${e},但这次切换一条前置条件都没校验过。适配器必须在解析出目标分支之后、动第一行之前 await 它(见 rxdb-adapter.ts › SwitchBranchOptions.prepare)。`);
|
|
1477
|
+
return c;
|
|
1478
|
+
} catch (t) {
|
|
1479
|
+
throw i && ye(i), r || (this.rxdb.dispatchEvent(new ie(e)), await this.#s(n?.id ?? null, e, t)), t;
|
|
1421
1480
|
}
|
|
1422
1481
|
}
|
|
1423
1482
|
async mergeBranch(e, t) {
|
|
1424
1483
|
let n = await this.getCurrentBranch();
|
|
1425
|
-
if (!n) throw new
|
|
1426
|
-
let
|
|
1484
|
+
if (!n) throw new m("No active branch found");
|
|
1485
|
+
let r = n.id;
|
|
1427
1486
|
try {
|
|
1428
|
-
this.rxdb.dispatchEvent(new
|
|
1429
|
-
let n = await
|
|
1430
|
-
return n.merged > 0 && this.historyManager.clearUndoHistory(), this.rxdb.dispatchEvent(new
|
|
1487
|
+
this.rxdb.dispatchEvent(new o(e, r));
|
|
1488
|
+
let n = await vt(this, e, r, t);
|
|
1489
|
+
return n.merged > 0 && this.historyManager.clearUndoHistory(), this.rxdb.dispatchEvent(new s(e, r)), n;
|
|
1431
1490
|
} catch (t) {
|
|
1432
|
-
throw this.rxdb.dispatchEvent(new
|
|
1491
|
+
throw this.rxdb.dispatchEvent(new c(e, r)), t;
|
|
1433
1492
|
}
|
|
1434
1493
|
}
|
|
1435
1494
|
history(e) {
|
|
1436
1495
|
return this.historyManager.history(e);
|
|
1437
1496
|
}
|
|
1438
1497
|
async restoreEntity(e, t) {
|
|
1439
|
-
return
|
|
1498
|
+
return bt(this, e, t);
|
|
1440
1499
|
}
|
|
1441
1500
|
async getLocalRepositories() {
|
|
1442
|
-
return
|
|
1501
|
+
return pe(this.rxdb);
|
|
1443
1502
|
}
|
|
1444
1503
|
async getRemoteRepositories() {
|
|
1445
|
-
return
|
|
1504
|
+
return me(this.rxdb);
|
|
1446
1505
|
}
|
|
1447
1506
|
async getCurrentBranch() {
|
|
1448
|
-
return
|
|
1507
|
+
return de(this.rxdb);
|
|
1508
|
+
}
|
|
1509
|
+
#a(e) {
|
|
1510
|
+
this.historyManager.clearRedoStack(), this.historyManager.setUndoBranch(e), this.rxdb.dispatchEvent(new re(e));
|
|
1511
|
+
}
|
|
1512
|
+
async #o(e, t, n) {
|
|
1513
|
+
for (let r of this.rxdb.systemContributions) if (await r.takeOverBranchSwitch({
|
|
1514
|
+
currentBranchId: e,
|
|
1515
|
+
targetBranchId: t,
|
|
1516
|
+
preconditions: n
|
|
1517
|
+
}) === "switched") return !0;
|
|
1518
|
+
return !1;
|
|
1519
|
+
}
|
|
1520
|
+
async #s(e, t, n) {
|
|
1521
|
+
for (let r of this.rxdb.systemContributions) await r.settleBranchSwitchFailure({
|
|
1522
|
+
currentBranchId: e,
|
|
1523
|
+
targetBranchId: t,
|
|
1524
|
+
error: n
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
async #c(e, t, n, r) {
|
|
1528
|
+
for (let i of this.rxdb.systemContributions) await i.prepareBranchSwitch({
|
|
1529
|
+
executor: e,
|
|
1530
|
+
currentBranchId: t,
|
|
1531
|
+
targetBranchId: n,
|
|
1532
|
+
preconditions: r
|
|
1533
|
+
});
|
|
1449
1534
|
}
|
|
1450
|
-
#
|
|
1535
|
+
#l(e, t) {
|
|
1451
1536
|
e.catch((e) => {
|
|
1452
|
-
|
|
1537
|
+
Fe(e) || console.error(`[VersionManager] ${t} failed:`, e);
|
|
1453
1538
|
});
|
|
1454
1539
|
}
|
|
1455
|
-
},
|
|
1540
|
+
}, Et = class extends h {
|
|
1456
1541
|
lifecycle = "scoped";
|
|
1457
1542
|
name = "history";
|
|
1458
1543
|
install(e) {
|
|
1459
|
-
let t = new
|
|
1544
|
+
let t = new Tt(this.rxdb);
|
|
1460
1545
|
e.acquire(() => (Object.defineProperty(this.rxdb, "versionManager", {
|
|
1461
1546
|
value: t,
|
|
1462
1547
|
configurable: !0,
|
|
1463
1548
|
enumerable: !0
|
|
1464
1549
|
}), () => void Reflect.deleteProperty(this.rxdb, "versionManager")), "history:slot"), e.acquire(() => () => t.destroy(), "history:versionManager"), t.init(), e.acquire(() => this.rxdb.syncState.bindPushableCount(t.pushableCount$), "history:pushableCount");
|
|
1465
1550
|
}
|
|
1466
|
-
},
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1551
|
+
}, Dt = (e) => new Et(e);
|
|
1552
|
+
//#endregion
|
|
1553
|
+
//#region ../rxdb-test/dist/chunks/decorate-BJVyhdRd.js
|
|
1554
|
+
function w(e, t, n, r) {
|
|
1555
|
+
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
1556
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
1557
|
+
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
1558
|
+
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
1559
|
+
}
|
|
1560
|
+
//#endregion
|
|
1561
|
+
//#region ../../node_modules/.pnpm/tinyrainbow@3.1.1/node_modules/tinyrainbow/dist/index.js
|
|
1562
|
+
var Ot = {
|
|
1563
|
+
reset: [0, 0],
|
|
1564
|
+
bold: [
|
|
1565
|
+
1,
|
|
1566
|
+
22,
|
|
1567
|
+
"\x1B[22m\x1B[1m"
|
|
1568
|
+
],
|
|
1569
|
+
dim: [
|
|
1570
|
+
2,
|
|
1571
|
+
22,
|
|
1572
|
+
"\x1B[22m\x1B[2m"
|
|
1573
|
+
],
|
|
1574
|
+
italic: [3, 23],
|
|
1575
|
+
underline: [4, 24],
|
|
1576
|
+
inverse: [7, 27],
|
|
1577
|
+
hidden: [8, 28],
|
|
1578
|
+
strikethrough: [9, 29],
|
|
1579
|
+
black: [30, 39],
|
|
1580
|
+
red: [31, 39],
|
|
1581
|
+
green: [32, 39],
|
|
1582
|
+
yellow: [33, 39],
|
|
1583
|
+
blue: [34, 39],
|
|
1584
|
+
magenta: [35, 39],
|
|
1585
|
+
cyan: [36, 39],
|
|
1586
|
+
white: [37, 39],
|
|
1587
|
+
gray: [90, 39],
|
|
1588
|
+
bgBlack: [40, 49],
|
|
1589
|
+
bgRed: [41, 49],
|
|
1590
|
+
bgGreen: [42, 49],
|
|
1591
|
+
bgYellow: [43, 49],
|
|
1592
|
+
bgBlue: [44, 49],
|
|
1593
|
+
bgMagenta: [45, 49],
|
|
1594
|
+
bgCyan: [46, 49],
|
|
1595
|
+
bgWhite: [47, 49],
|
|
1596
|
+
blackBright: [90, 39],
|
|
1597
|
+
redBright: [91, 39],
|
|
1598
|
+
greenBright: [92, 39],
|
|
1599
|
+
yellowBright: [93, 39],
|
|
1600
|
+
blueBright: [94, 39],
|
|
1601
|
+
magentaBright: [95, 39],
|
|
1602
|
+
cyanBright: [96, 39],
|
|
1603
|
+
whiteBright: [97, 39],
|
|
1604
|
+
bgBlackBright: [100, 49],
|
|
1605
|
+
bgRedBright: [101, 49],
|
|
1606
|
+
bgGreenBright: [102, 49],
|
|
1607
|
+
bgYellowBright: [103, 49],
|
|
1608
|
+
bgBlueBright: [104, 49],
|
|
1609
|
+
bgMagentaBright: [105, 49],
|
|
1610
|
+
bgCyanBright: [106, 49],
|
|
1611
|
+
bgWhiteBright: [107, 49]
|
|
1612
|
+
};
|
|
1613
|
+
function kt(e) {
|
|
1614
|
+
return String(e);
|
|
1615
|
+
}
|
|
1616
|
+
kt.open = "", kt.close = "";
|
|
1617
|
+
function At() {
|
|
1618
|
+
let e = typeof process < "u" ? process : void 0, t = e?.env || {}, n = t.FORCE_TTY !== "false", r = e?.argv || [];
|
|
1619
|
+
return !("NO_COLOR" in t || r.includes("--no-color")) && ("FORCE_COLOR" in t || r.includes("--color") || e?.platform === "win32" || n && t.TERM !== "dumb" || "CI" in t) || typeof window < "u" && !!window.chrome;
|
|
1620
|
+
}
|
|
1621
|
+
function jt({ force: e } = {}) {
|
|
1622
|
+
let t = e || At(), n = (e, t, n, r) => {
|
|
1623
|
+
let i = "", a = 0;
|
|
1624
|
+
do
|
|
1625
|
+
i += e.substring(a, r) + n, a = r + t.length, r = e.indexOf(t, a);
|
|
1626
|
+
while (~r);
|
|
1627
|
+
return i + e.substring(a);
|
|
1628
|
+
}, r = (e, t, r = e) => {
|
|
1629
|
+
let i = (i) => {
|
|
1630
|
+
let a = String(i), o = a.indexOf(t, e.length);
|
|
1631
|
+
return ~o ? e + n(a, t, r, o) + t : e + a + t;
|
|
1632
|
+
};
|
|
1633
|
+
return i.open = e, i.close = t, i;
|
|
1634
|
+
}, i = { isColorSupported: t }, a = (e) => `\x1B[${e}m`;
|
|
1635
|
+
for (let e in Ot) {
|
|
1636
|
+
let n = Ot[e];
|
|
1637
|
+
i[e] = t ? r(a(n[0]), a(n[1]), n[2]) : kt;
|
|
1638
|
+
}
|
|
1639
|
+
return i;
|
|
1640
|
+
}
|
|
1641
|
+
var Mt = jt();
|
|
1642
|
+
//#endregion
|
|
1643
|
+
//#region ../../node_modules/.pnpm/@vitest+pretty-format@4.1.11/node_modules/@vitest/pretty-format/dist/index.js
|
|
1644
|
+
function Nt(e, t) {
|
|
1645
|
+
return t.forEach(function(t) {
|
|
1646
|
+
t && typeof t != "string" && !Array.isArray(t) && Object.keys(t).forEach(function(n) {
|
|
1647
|
+
if (n !== "default" && !(n in e)) {
|
|
1648
|
+
var r = Object.getOwnPropertyDescriptor(t, n);
|
|
1649
|
+
Object.defineProperty(e, n, r.get ? r : {
|
|
1650
|
+
enumerable: !0,
|
|
1651
|
+
get: function() {
|
|
1652
|
+
return t[n];
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
}), Object.freeze(e);
|
|
1658
|
+
}
|
|
1659
|
+
function Pt(e, t) {
|
|
1660
|
+
let n = Object.keys(e), r = t === null ? n : n.sort(t);
|
|
1661
|
+
if (Object.getOwnPropertySymbols) for (let t of Object.getOwnPropertySymbols(e)) Object.getOwnPropertyDescriptor(e, t).enumerable && r.push(t);
|
|
1662
|
+
return r;
|
|
1663
|
+
}
|
|
1664
|
+
function T(e, t, n, r, i, a, o = ": ") {
|
|
1665
|
+
let s = "", c = 0, l = e.next();
|
|
1666
|
+
if (!l.done) {
|
|
1667
|
+
s += t.spacingOuter;
|
|
1668
|
+
let u = n + t.indent;
|
|
1669
|
+
for (; !l.done;) {
|
|
1670
|
+
if (s += u, c++ === t.maxWidth) {
|
|
1671
|
+
s += "…";
|
|
1672
|
+
break;
|
|
1673
|
+
}
|
|
1674
|
+
let n = a(l.value[0], t, u, r, i), d = a(l.value[1], t, u, r, i);
|
|
1675
|
+
s += n + o + d, l = e.next(), l.done ? t.min || (s += ",") : s += `,${t.spacingInner}`;
|
|
1676
|
+
}
|
|
1677
|
+
s += t.spacingOuter + n;
|
|
1678
|
+
}
|
|
1679
|
+
return s;
|
|
1680
|
+
}
|
|
1681
|
+
function Ft(e, t, n, r, i, a) {
|
|
1682
|
+
let o = "", s = 0, c = e.next();
|
|
1683
|
+
if (!c.done) {
|
|
1684
|
+
o += t.spacingOuter;
|
|
1685
|
+
let l = n + t.indent;
|
|
1686
|
+
for (; !c.done;) {
|
|
1687
|
+
if (o += l, s++ === t.maxWidth) {
|
|
1688
|
+
o += "…";
|
|
1689
|
+
break;
|
|
1690
|
+
}
|
|
1691
|
+
o += a(c.value, t, l, r, i), c = e.next(), c.done ? t.min || (o += ",") : o += `,${t.spacingInner}`;
|
|
1692
|
+
}
|
|
1693
|
+
o += t.spacingOuter + n;
|
|
1694
|
+
}
|
|
1695
|
+
return o;
|
|
1696
|
+
}
|
|
1697
|
+
function It(e, t, n, r, i, a) {
|
|
1698
|
+
let o = "";
|
|
1699
|
+
e = e instanceof ArrayBuffer ? new DataView(e) : e;
|
|
1700
|
+
let s = (e) => e instanceof DataView, c = s(e) ? e.byteLength : e.length;
|
|
1701
|
+
if (c > 0) {
|
|
1702
|
+
o += t.spacingOuter;
|
|
1703
|
+
let l = n + t.indent;
|
|
1704
|
+
for (let n = 0; n < c; n++) {
|
|
1705
|
+
if (o += l, n === t.maxWidth) {
|
|
1706
|
+
o += "…";
|
|
1707
|
+
break;
|
|
1708
|
+
}
|
|
1709
|
+
(s(e) || n in e) && (o += a(s(e) ? e.getInt8(n) : e[n], t, l, r, i)), n < c - 1 ? o += `,${t.spacingInner}` : t.min || (o += ",");
|
|
1710
|
+
}
|
|
1711
|
+
o += t.spacingOuter + n;
|
|
1712
|
+
}
|
|
1713
|
+
return o;
|
|
1714
|
+
}
|
|
1715
|
+
function Lt(e, t, n, r, i, a) {
|
|
1716
|
+
let o = "", s = Pt(e, t.compareKeys);
|
|
1717
|
+
if (s.length > 0) {
|
|
1718
|
+
o += t.spacingOuter;
|
|
1719
|
+
let c = n + t.indent;
|
|
1720
|
+
for (let n = 0; n < s.length; n++) {
|
|
1721
|
+
let l = s[n], u = a(l, t, c, r, i), d = a(e[l], t, c, r, i);
|
|
1722
|
+
o += `${c + u}: ${d}`, n < s.length - 1 ? o += `,${t.spacingInner}` : t.min || (o += ",");
|
|
1723
|
+
}
|
|
1724
|
+
o += t.spacingOuter + n;
|
|
1725
|
+
}
|
|
1726
|
+
return o;
|
|
1727
|
+
}
|
|
1728
|
+
var Rt = typeof Symbol == "function" && Symbol.for ? Symbol.for("jest.asymmetricMatcher") : 1267621, zt = " ", Bt = {
|
|
1729
|
+
serialize: (e, t, n, r, i, a) => {
|
|
1730
|
+
let o = e.toString();
|
|
1731
|
+
if (o === "ArrayContaining" || o === "ArrayNotContaining") return ++r > t.maxDepth ? `[${o}]` : `${o + zt}[${It(e.sample, t, n, r, i, a)}]`;
|
|
1732
|
+
if (o === "ObjectContaining" || o === "ObjectNotContaining") return ++r > t.maxDepth ? `[${o}]` : `${o + zt}{${Lt(e.sample, t, n, r, i, a)}}`;
|
|
1733
|
+
if (o === "StringMatching" || o === "StringNotMatching" || o === "StringContaining" || o === "StringNotContaining") return o + zt + a(e.sample, t, n, r, i);
|
|
1734
|
+
if (typeof e.toAsymmetricMatcher != "function") throw TypeError(`Asymmetric matcher ${e.constructor.name} does not implement toAsymmetricMatcher()`);
|
|
1735
|
+
return e.toAsymmetricMatcher();
|
|
1736
|
+
},
|
|
1737
|
+
test: (e) => e && e.$$typeof === Rt
|
|
1738
|
+
}, Vt = " ", Ht = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]), Ut = /^(?:HTML\w*Collection|NodeList)$/;
|
|
1739
|
+
function Wt(e) {
|
|
1740
|
+
return Ht.has(e) || Ut.test(e);
|
|
1741
|
+
}
|
|
1742
|
+
var Gt = (e) => e && e.constructor && !!e.constructor.name && Wt(e.constructor.name);
|
|
1743
|
+
function Kt(e) {
|
|
1744
|
+
return e.constructor.name === "NamedNodeMap";
|
|
1745
|
+
}
|
|
1746
|
+
var qt = {
|
|
1747
|
+
serialize: (e, t, n, r, i, a) => {
|
|
1748
|
+
let o = e.constructor.name;
|
|
1749
|
+
return ++r > t.maxDepth ? `[${o}]` : (t.min ? "" : o + Vt) + (Ht.has(o) ? `{${Lt(Kt(e) ? [...e].reduce((e, t) => (e[t.name] = t.value, e), {}) : { ...e }, t, n, r, i, a)}}` : `[${It([...e], t, n, r, i, a)}]`);
|
|
1750
|
+
},
|
|
1751
|
+
test: Gt
|
|
1752
|
+
};
|
|
1753
|
+
function Jt(e) {
|
|
1754
|
+
return e.replaceAll("<", "<").replaceAll(">", ">");
|
|
1755
|
+
}
|
|
1756
|
+
function Yt(e, t, n, r, i, a, o) {
|
|
1757
|
+
let s = r + n.indent, c = n.colors;
|
|
1758
|
+
return e.map((e) => {
|
|
1759
|
+
let l = t[e];
|
|
1760
|
+
if (typeof l == "string" && l[0] === "_" && l.startsWith("__vitest_") && l.match(/__vitest_\d+__/)) return "";
|
|
1761
|
+
let u = o(l, n, s, i, a);
|
|
1762
|
+
return typeof l != "string" && (u.includes("\n") && (u = n.spacingOuter + s + u + n.spacingOuter + r), u = `{${u}}`), `${n.spacingInner + r + c.prop.open + e + c.prop.close}=${c.value.open}${u}${c.value.close}`;
|
|
1763
|
+
}).join("");
|
|
1764
|
+
}
|
|
1765
|
+
function Xt(e, t, n, r, i, a) {
|
|
1766
|
+
return e.map((e) => t.spacingOuter + n + (typeof e == "string" ? Qt(e, t) : a(e, t, n, r, i))).join("");
|
|
1767
|
+
}
|
|
1768
|
+
function Zt(e, t, n, r, i, a) {
|
|
1769
|
+
return t.printShadowRoot === !1 ? "" : [`${t.spacingOuter + n}#shadow-root`, Xt(e, t, n + t.indent, r, i, a)].join("");
|
|
1770
|
+
}
|
|
1771
|
+
function Qt(e, t) {
|
|
1772
|
+
let n = t.colors.content;
|
|
1773
|
+
return n.open + Jt(e) + n.close;
|
|
1774
|
+
}
|
|
1775
|
+
function $t(e, t) {
|
|
1776
|
+
let n = t.colors.comment;
|
|
1777
|
+
return `${n.open}<!--${Jt(e)}-->${n.close}`;
|
|
1778
|
+
}
|
|
1779
|
+
function en(e, t, n, r, i) {
|
|
1780
|
+
let a = r.colors.tag;
|
|
1781
|
+
return `${a.open}<${e}${t && a.close + t + r.spacingOuter + i + a.open}${n ? `>${a.close}${n}${r.spacingOuter}${i}${a.open}</${e}` : `${t && !r.min ? "" : " "}/`}>${a.close}`;
|
|
1782
|
+
}
|
|
1783
|
+
function tn(e, t) {
|
|
1784
|
+
let n = t.colors.tag;
|
|
1785
|
+
return `${n.open}<${e}${n.close} …${n.open} />${n.close}`;
|
|
1786
|
+
}
|
|
1787
|
+
var nn = 1, rn = 3, an = 8, on = 11, sn = /^(?:(?:HTML|SVG)\w*)?Element$/;
|
|
1788
|
+
function cn(e) {
|
|
1789
|
+
try {
|
|
1790
|
+
return typeof e.hasAttribute == "function" && e.hasAttribute("is");
|
|
1791
|
+
} catch {
|
|
1792
|
+
return !1;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
function ln(e) {
|
|
1796
|
+
let t = e.constructor.name, { nodeType: n, tagName: r } = e, i = typeof r == "string" && r.includes("-") || cn(e);
|
|
1797
|
+
return n === nn && (sn.test(t) || i) || n === rn && t === "Text" || n === an && t === "Comment" || n === on && t === "DocumentFragment";
|
|
1798
|
+
}
|
|
1799
|
+
var un = (e) => e?.constructor?.name && ln(e);
|
|
1800
|
+
function dn(e) {
|
|
1801
|
+
return e.nodeType === rn;
|
|
1802
|
+
}
|
|
1803
|
+
function fn(e) {
|
|
1804
|
+
return e.nodeType === an;
|
|
1805
|
+
}
|
|
1806
|
+
function pn(e) {
|
|
1807
|
+
return e.nodeType === on;
|
|
1808
|
+
}
|
|
1809
|
+
function mn(e, t) {
|
|
1810
|
+
let n = e.filter((e) => e.nodeType !== rn || (e.data || "").trim().length > 0);
|
|
1811
|
+
return t && (n = n.filter(t)), n;
|
|
1812
|
+
}
|
|
1813
|
+
function hn(e, t, n, r, i, a, o) {
|
|
1814
|
+
if (dn(e)) return Qt(e.data, t);
|
|
1815
|
+
if (fn(e)) return $t(e.data, t);
|
|
1816
|
+
let s = pn(e) ? "DocumentFragment" : e.tagName.toLowerCase();
|
|
1817
|
+
if (++r > t.maxDepth) return tn(s, t);
|
|
1818
|
+
let c = Array.prototype.slice.call(e.childNodes || e.children), l = pn(e) || !e.shadowRoot ? [] : Array.prototype.slice.call(e.shadowRoot.children), u = o ? mn(c, o) : c, d = o ? mn(l, o) : l;
|
|
1819
|
+
return en(s, Yt(pn(e) ? [] : Array.from(e.attributes, (e) => e.name).sort(), pn(e) ? {} : [...e.attributes].reduce((e, t) => (e[t.name] = t.value, e), {}), t, n + t.indent, r, i, a), (d.length > 0 ? Zt(d, t, n + t.indent, r, i, a) : "") + Xt(u, t, n + t.indent, r, i, a), t, n);
|
|
1820
|
+
}
|
|
1821
|
+
var gn = (e, t, n, r, i, a) => hn(e, t, n, r, i, a);
|
|
1822
|
+
function _n(e) {
|
|
1823
|
+
return {
|
|
1824
|
+
test: un,
|
|
1825
|
+
serialize: (t, n, r, i, a, o) => hn(t, n, r, i, a, o, e)
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
var vn = {
|
|
1829
|
+
serialize: gn,
|
|
1830
|
+
test: un
|
|
1831
|
+
}, yn = "@@__IMMUTABLE_ITERABLE__@@", bn = "@@__IMMUTABLE_LIST__@@", xn = "@@__IMMUTABLE_KEYED__@@", Sn = "@@__IMMUTABLE_MAP__@@", Cn = "@@__IMMUTABLE_ORDERED__@@", wn = "@@__IMMUTABLE_RECORD__@@", Tn = "@@__IMMUTABLE_SEQ__@@", En = "@@__IMMUTABLE_SET__@@", Dn = "@@__IMMUTABLE_STACK__@@", E = (e) => `Immutable.${e}`, On = (e) => `[${e}]`, D = " ", kn = "…";
|
|
1832
|
+
function An(e, t, n, r, i, a, o) {
|
|
1833
|
+
return ++r > t.maxDepth ? On(E(o)) : `${E(o) + D}{${T(e.entries(), t, n, r, i, a)}}`;
|
|
1834
|
+
}
|
|
1835
|
+
function jn(e) {
|
|
1836
|
+
let t = 0;
|
|
1837
|
+
return { next() {
|
|
1838
|
+
if (t < e._keys.length) {
|
|
1839
|
+
let n = e._keys[t++];
|
|
1840
|
+
return {
|
|
1841
|
+
done: !1,
|
|
1842
|
+
value: [n, e.get(n)]
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
return {
|
|
1846
|
+
done: !0,
|
|
1847
|
+
value: void 0
|
|
1848
|
+
};
|
|
1849
|
+
} };
|
|
1850
|
+
}
|
|
1851
|
+
function Mn(e, t, n, r, i, a) {
|
|
1852
|
+
let o = E(e._name || "Record");
|
|
1853
|
+
return ++r > t.maxDepth ? On(o) : `${o + D}{${T(jn(e), t, n, r, i, a)}}`;
|
|
1854
|
+
}
|
|
1855
|
+
function Nn(e, t, n, r, i, a) {
|
|
1856
|
+
let o = E("Seq");
|
|
1857
|
+
return ++r > t.maxDepth ? On(o) : e[xn] ? `${o + D}{${e._iter || e._object ? T(e.entries(), t, n, r, i, a) : kn}}` : `${o + D}[${e._iter || e._array || e._collection || e._iterable ? Ft(e.values(), t, n, r, i, a) : kn}]`;
|
|
1858
|
+
}
|
|
1859
|
+
function Pn(e, t, n, r, i, a, o) {
|
|
1860
|
+
return ++r > t.maxDepth ? On(E(o)) : `${E(o) + D}[${Ft(e.values(), t, n, r, i, a)}]`;
|
|
1861
|
+
}
|
|
1862
|
+
var Fn = {
|
|
1863
|
+
serialize: (e, t, n, r, i, a) => e[Sn] ? An(e, t, n, r, i, a, e[Cn] ? "OrderedMap" : "Map") : e[bn] ? Pn(e, t, n, r, i, a, "List") : e[En] ? Pn(e, t, n, r, i, a, e[Cn] ? "OrderedSet" : "Set") : e[Dn] ? Pn(e, t, n, r, i, a, "Stack") : e[Tn] ? Nn(e, t, n, r, i, a) : Mn(e, t, n, r, i, a),
|
|
1864
|
+
test: (e) => e && (e[yn] === !0 || e[wn] === !0)
|
|
1865
|
+
};
|
|
1866
|
+
function In(e) {
|
|
1867
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1868
|
+
}
|
|
1869
|
+
var Ln = { exports: {} }, O = {}, Rn;
|
|
1870
|
+
function zn() {
|
|
1871
|
+
if (Rn) return O;
|
|
1872
|
+
Rn = 1;
|
|
1873
|
+
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), r = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), a = Symbol.for("react.consumer"), o = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), l = Symbol.for("react.suspense_list"), u = Symbol.for("react.memo"), d = Symbol.for("react.lazy"), f = Symbol.for("react.view_transition"), p = Symbol.for("react.client.reference");
|
|
1874
|
+
function m(p) {
|
|
1875
|
+
if (typeof p == "object" && p) {
|
|
1876
|
+
var m = p.$$typeof;
|
|
1877
|
+
switch (m) {
|
|
1878
|
+
case e: switch (p = p.type, p) {
|
|
1879
|
+
case n:
|
|
1880
|
+
case i:
|
|
1881
|
+
case r:
|
|
1882
|
+
case c:
|
|
1883
|
+
case l:
|
|
1884
|
+
case f: return p;
|
|
1885
|
+
default: switch (p &&= p.$$typeof, p) {
|
|
1886
|
+
case o:
|
|
1887
|
+
case s:
|
|
1888
|
+
case d:
|
|
1889
|
+
case u: return p;
|
|
1890
|
+
case a: return p;
|
|
1891
|
+
default: return m;
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
case t: return m;
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
return O.ContextConsumer = a, O.ContextProvider = o, O.Element = e, O.ForwardRef = s, O.Fragment = n, O.Lazy = d, O.Memo = u, O.Portal = t, O.Profiler = i, O.StrictMode = r, O.Suspense = c, O.SuspenseList = l, O.isContextConsumer = function(e) {
|
|
1899
|
+
return m(e) === a;
|
|
1900
|
+
}, O.isContextProvider = function(e) {
|
|
1901
|
+
return m(e) === o;
|
|
1902
|
+
}, O.isElement = function(t) {
|
|
1903
|
+
return typeof t == "object" && !!t && t.$$typeof === e;
|
|
1904
|
+
}, O.isForwardRef = function(e) {
|
|
1905
|
+
return m(e) === s;
|
|
1906
|
+
}, O.isFragment = function(e) {
|
|
1907
|
+
return m(e) === n;
|
|
1908
|
+
}, O.isLazy = function(e) {
|
|
1909
|
+
return m(e) === d;
|
|
1910
|
+
}, O.isMemo = function(e) {
|
|
1911
|
+
return m(e) === u;
|
|
1912
|
+
}, O.isPortal = function(e) {
|
|
1913
|
+
return m(e) === t;
|
|
1914
|
+
}, O.isProfiler = function(e) {
|
|
1915
|
+
return m(e) === i;
|
|
1916
|
+
}, O.isStrictMode = function(e) {
|
|
1917
|
+
return m(e) === r;
|
|
1918
|
+
}, O.isSuspense = function(e) {
|
|
1919
|
+
return m(e) === c;
|
|
1920
|
+
}, O.isSuspenseList = function(e) {
|
|
1921
|
+
return m(e) === l;
|
|
1922
|
+
}, O.isValidElementType = function(e) {
|
|
1923
|
+
return !!(typeof e == "string" || typeof e == "function" || e === n || e === i || e === r || e === c || e === l || typeof e == "object" && e && (e.$$typeof === d || e.$$typeof === u || e.$$typeof === o || e.$$typeof === a || e.$$typeof === s || e.$$typeof === p || e.getModuleId !== void 0));
|
|
1924
|
+
}, O.typeOf = m, O;
|
|
1925
|
+
}
|
|
1926
|
+
var Bn;
|
|
1927
|
+
function Vn() {
|
|
1928
|
+
return Bn ? Ln.exports : (Bn = 1, Ln.exports = zn(), Ln.exports);
|
|
1929
|
+
}
|
|
1930
|
+
var Hn = Vn(), Un = /*#__PURE__*/ Nt({
|
|
1931
|
+
__proto__: null,
|
|
1932
|
+
default: /* @__PURE__ */ In(Hn)
|
|
1933
|
+
}, [Hn]), Wn = { exports: {} }, k = {}, Gn;
|
|
1934
|
+
function Kn() {
|
|
1935
|
+
if (Gn) return k;
|
|
1936
|
+
Gn = 1;
|
|
1937
|
+
var e = Symbol.for("react.element"), t = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), r = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), o = Symbol.for("react.context"), s = Symbol.for("react.server_context"), c = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), p = Symbol.for("react.offscreen"), m = Symbol.for("react.module.reference");
|
|
1938
|
+
function h(p) {
|
|
1939
|
+
if (typeof p == "object" && p) {
|
|
1940
|
+
var m = p.$$typeof;
|
|
1941
|
+
switch (m) {
|
|
1942
|
+
case e: switch (p = p.type, p) {
|
|
1943
|
+
case n:
|
|
1944
|
+
case i:
|
|
1945
|
+
case r:
|
|
1946
|
+
case l:
|
|
1947
|
+
case u: return p;
|
|
1948
|
+
default: switch (p &&= p.$$typeof, p) {
|
|
1949
|
+
case s:
|
|
1950
|
+
case o:
|
|
1951
|
+
case c:
|
|
1952
|
+
case f:
|
|
1953
|
+
case d:
|
|
1954
|
+
case a: return p;
|
|
1955
|
+
default: return m;
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
case t: return m;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
return k.ContextConsumer = o, k.ContextProvider = a, k.Element = e, k.ForwardRef = c, k.Fragment = n, k.Lazy = f, k.Memo = d, k.Portal = t, k.Profiler = i, k.StrictMode = r, k.Suspense = l, k.SuspenseList = u, k.isAsyncMode = function() {
|
|
1963
|
+
return !1;
|
|
1964
|
+
}, k.isConcurrentMode = function() {
|
|
1965
|
+
return !1;
|
|
1966
|
+
}, k.isContextConsumer = function(e) {
|
|
1967
|
+
return h(e) === o;
|
|
1968
|
+
}, k.isContextProvider = function(e) {
|
|
1969
|
+
return h(e) === a;
|
|
1970
|
+
}, k.isElement = function(t) {
|
|
1971
|
+
return typeof t == "object" && !!t && t.$$typeof === e;
|
|
1972
|
+
}, k.isForwardRef = function(e) {
|
|
1973
|
+
return h(e) === c;
|
|
1974
|
+
}, k.isFragment = function(e) {
|
|
1975
|
+
return h(e) === n;
|
|
1976
|
+
}, k.isLazy = function(e) {
|
|
1977
|
+
return h(e) === f;
|
|
1978
|
+
}, k.isMemo = function(e) {
|
|
1979
|
+
return h(e) === d;
|
|
1980
|
+
}, k.isPortal = function(e) {
|
|
1981
|
+
return h(e) === t;
|
|
1982
|
+
}, k.isProfiler = function(e) {
|
|
1983
|
+
return h(e) === i;
|
|
1984
|
+
}, k.isStrictMode = function(e) {
|
|
1985
|
+
return h(e) === r;
|
|
1986
|
+
}, k.isSuspense = function(e) {
|
|
1987
|
+
return h(e) === l;
|
|
1988
|
+
}, k.isSuspenseList = function(e) {
|
|
1989
|
+
return h(e) === u;
|
|
1990
|
+
}, k.isValidElementType = function(e) {
|
|
1991
|
+
return !!(typeof e == "string" || typeof e == "function" || e === n || e === i || e === r || e === l || e === u || e === p || typeof e == "object" && e && (e.$$typeof === f || e.$$typeof === d || e.$$typeof === a || e.$$typeof === o || e.$$typeof === c || e.$$typeof === m || e.getModuleId !== void 0));
|
|
1992
|
+
}, k.typeOf = h, k;
|
|
1993
|
+
}
|
|
1994
|
+
var qn;
|
|
1995
|
+
function Jn() {
|
|
1996
|
+
return qn ? Wn.exports : (qn = 1, Wn.exports = Kn(), Wn.exports);
|
|
1997
|
+
}
|
|
1998
|
+
var Yn = Jn(), Xn = /*#__PURE__*/ Nt({
|
|
1999
|
+
__proto__: null,
|
|
2000
|
+
default: /* @__PURE__ */ In(Yn)
|
|
2001
|
+
}, [Yn]), A = Object.fromEntries([
|
|
2002
|
+
"isAsyncMode",
|
|
2003
|
+
"isConcurrentMode",
|
|
2004
|
+
"isContextConsumer",
|
|
2005
|
+
"isContextProvider",
|
|
2006
|
+
"isElement",
|
|
2007
|
+
"isForwardRef",
|
|
2008
|
+
"isFragment",
|
|
2009
|
+
"isLazy",
|
|
2010
|
+
"isMemo",
|
|
2011
|
+
"isPortal",
|
|
2012
|
+
"isProfiler",
|
|
2013
|
+
"isStrictMode",
|
|
2014
|
+
"isSuspense",
|
|
2015
|
+
"isSuspenseList",
|
|
2016
|
+
"isValidElementType"
|
|
2017
|
+
].map((e) => [e, (t) => Xn[e](t) || Un[e](t)]));
|
|
2018
|
+
function Zn(e, t = []) {
|
|
2019
|
+
if (Array.isArray(e)) for (let n of e) Zn(n, t);
|
|
2020
|
+
else e != null && e !== !1 && e !== "" && t.push(e);
|
|
2021
|
+
return t;
|
|
2022
|
+
}
|
|
2023
|
+
function Qn(e) {
|
|
2024
|
+
let t = e.type;
|
|
2025
|
+
if (typeof t == "string") return t;
|
|
2026
|
+
if (typeof t == "function") return t.displayName || t.name || "Unknown";
|
|
2027
|
+
if (A.isFragment(e)) return "React.Fragment";
|
|
2028
|
+
if (A.isSuspense(e)) return "React.Suspense";
|
|
2029
|
+
if (typeof t == "object" && t) {
|
|
2030
|
+
if (A.isContextProvider(e)) return "Context.Provider";
|
|
2031
|
+
if (A.isContextConsumer(e)) return "Context.Consumer";
|
|
2032
|
+
if (A.isForwardRef(e)) {
|
|
2033
|
+
if (t.displayName) return t.displayName;
|
|
2034
|
+
let e = t.render.displayName || t.render.name || "";
|
|
2035
|
+
return e === "" ? "ForwardRef" : `ForwardRef(${e})`;
|
|
2036
|
+
}
|
|
2037
|
+
if (A.isMemo(e)) {
|
|
2038
|
+
let e = t.displayName || t.type.displayName || t.type.name || "";
|
|
2039
|
+
return e === "" ? "Memo" : `Memo(${e})`;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
return "UNDEFINED";
|
|
2043
|
+
}
|
|
2044
|
+
function $n(e) {
|
|
2045
|
+
let { props: t } = e;
|
|
2046
|
+
return Object.keys(t).filter((e) => e !== "children" && t[e] !== void 0).sort();
|
|
2047
|
+
}
|
|
2048
|
+
var er = {
|
|
2049
|
+
serialize: (e, t, n, r, i, a) => ++r > t.maxDepth ? tn(Qn(e), t) : en(Qn(e), Yt($n(e), e.props, t, n + t.indent, r, i, a), Xt(Zn(e.props.children), t, n + t.indent, r, i, a), t, n),
|
|
2050
|
+
test: (e) => e != null && A.isElement(e)
|
|
2051
|
+
}, tr = typeof Symbol == "function" && Symbol.for ? Symbol.for("react.test.json") : 245830487;
|
|
2052
|
+
function nr(e) {
|
|
2053
|
+
let { props: t } = e;
|
|
2054
|
+
return t ? Object.keys(t).filter((e) => t[e] !== void 0).sort() : [];
|
|
2055
|
+
}
|
|
2056
|
+
var rr = {
|
|
2057
|
+
serialize: (e, t, n, r, i, a) => ++r > t.maxDepth ? tn(e.type, t) : en(e.type, e.props ? Yt(nr(e), e.props, t, n + t.indent, r, i, a) : "", e.children ? Xt(e.children, t, n + t.indent, r, i, a) : "", t, n),
|
|
2058
|
+
test: (e) => e && e.$$typeof === tr
|
|
2059
|
+
}, ir = Object.prototype.toString, ar = Date.prototype.toISOString, or = Error.prototype.toString, sr = RegExp.prototype.toString;
|
|
2060
|
+
function cr(e) {
|
|
2061
|
+
return typeof e.constructor == "function" && e.constructor.name || "Object";
|
|
2062
|
+
}
|
|
2063
|
+
function lr(e) {
|
|
2064
|
+
return typeof window < "u" && e === window;
|
|
2065
|
+
}
|
|
2066
|
+
var ur = /^Symbol\((.*)\)(.*)$/, dr = /\n/g, fr = class extends Error {
|
|
2067
|
+
constructor(e, t) {
|
|
2068
|
+
super(e), this.stack = t, this.name = this.constructor.name;
|
|
2069
|
+
}
|
|
2070
|
+
};
|
|
2071
|
+
function pr(e) {
|
|
2072
|
+
return e === "[object Array]" || e === "[object ArrayBuffer]" || e === "[object DataView]" || e === "[object Float32Array]" || e === "[object Float64Array]" || e === "[object Int8Array]" || e === "[object Int16Array]" || e === "[object Int32Array]" || e === "[object Uint8Array]" || e === "[object Uint8ClampedArray]" || e === "[object Uint16Array]" || e === "[object Uint32Array]";
|
|
2073
|
+
}
|
|
2074
|
+
function mr(e) {
|
|
2075
|
+
return Object.is(e, -0) ? "-0" : String(e);
|
|
2076
|
+
}
|
|
2077
|
+
function hr(e) {
|
|
2078
|
+
return String(`${e}n`);
|
|
2079
|
+
}
|
|
2080
|
+
function gr(e, t) {
|
|
2081
|
+
return t ? `[Function ${e.name || "anonymous"}]` : "[Function]";
|
|
2082
|
+
}
|
|
2083
|
+
function _r(e) {
|
|
2084
|
+
return String(e).replace(ur, "Symbol($1)");
|
|
2085
|
+
}
|
|
2086
|
+
function vr(e) {
|
|
2087
|
+
return `[${or.call(e)}]`;
|
|
2088
|
+
}
|
|
2089
|
+
function yr(e, t, n, r) {
|
|
2090
|
+
if (e === !0 || e === !1) return `${e}`;
|
|
2091
|
+
if (e === void 0) return "undefined";
|
|
2092
|
+
if (e === null) return "null";
|
|
2093
|
+
let i = typeof e;
|
|
2094
|
+
if (i === "number") return mr(e);
|
|
2095
|
+
if (i === "bigint") return hr(e);
|
|
2096
|
+
if (i === "string") return r ? `"${e.replaceAll(/"|\\/g, "\\$&")}"` : `"${e}"`;
|
|
2097
|
+
if (i === "function") return gr(e, t);
|
|
2098
|
+
if (i === "symbol") return _r(e);
|
|
2099
|
+
let a = ir.call(e);
|
|
2100
|
+
return a === "[object WeakMap]" ? "WeakMap {}" : a === "[object WeakSet]" ? "WeakSet {}" : a === "[object Function]" || a === "[object GeneratorFunction]" ? gr(e, t) : a === "[object Symbol]" ? _r(e) : a === "[object Date]" ? Number.isNaN(+e) ? "Date { NaN }" : ar.call(e) : a === "[object Error]" ? vr(e) : a === "[object RegExp]" ? n ? sr.call(e).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&") : sr.call(e) : e instanceof Error ? vr(e) : null;
|
|
2101
|
+
}
|
|
2102
|
+
function br(e, t, n, r, i, a) {
|
|
2103
|
+
if (i.includes(e)) return "[Circular]";
|
|
2104
|
+
i = [...i], i.push(e);
|
|
2105
|
+
let o = ++r > t.maxDepth, s = t.min;
|
|
2106
|
+
if (t.callToJSON && !o && e.toJSON && typeof e.toJSON == "function" && !a) return j(e.toJSON(), t, n, r, i, !0);
|
|
2107
|
+
let c = ir.call(e);
|
|
2108
|
+
return c === "[object Arguments]" ? o ? "[Arguments]" : `${s ? "" : "Arguments "}[${It(e, t, n, r, i, j)}]` : pr(c) ? o ? `[${e.constructor.name}]` : `${s || !t.printBasicPrototype && e.constructor.name === "Array" ? "" : `${e.constructor.name} `}[${It(e, t, n, r, i, j)}]` : c === "[object Map]" ? o ? "[Map]" : `Map {${T(e.entries(), t, n, r, i, j, " => ")}}` : c === "[object Set]" ? o ? "[Set]" : `Set {${Ft(e.values(), t, n, r, i, j)}}` : o || lr(e) ? `[${cr(e)}]` : `${s || !t.printBasicPrototype && cr(e) === "Object" ? "" : `${cr(e)} `}{${Lt(e, t, n, r, i, j)}}`;
|
|
2109
|
+
}
|
|
2110
|
+
var xr = {
|
|
2111
|
+
test: (e) => e && e instanceof Error,
|
|
2112
|
+
serialize(e, t, n, r, i, a) {
|
|
2113
|
+
if (i.includes(e)) return "[Circular]";
|
|
2114
|
+
i = [...i, e];
|
|
2115
|
+
let o = ++r > t.maxDepth, { message: s, cause: c, ...l } = e, u = {
|
|
2116
|
+
message: s,
|
|
2117
|
+
...c === void 0 ? {} : { cause: c },
|
|
2118
|
+
...e instanceof AggregateError ? { errors: e.errors } : {},
|
|
2119
|
+
...l
|
|
2120
|
+
}, d = e.name === "Error" ? cr(e) : e.name;
|
|
2121
|
+
return o ? `[${d}]` : `${d} {${T(Object.entries(u).values(), t, n, r, i, a)}}`;
|
|
2122
|
+
}
|
|
2123
|
+
};
|
|
2124
|
+
function Sr(e) {
|
|
2125
|
+
return e.serialize != null;
|
|
2126
|
+
}
|
|
2127
|
+
function Cr(e, t, n, r, i, a) {
|
|
2128
|
+
let o;
|
|
2129
|
+
try {
|
|
2130
|
+
o = Sr(e) ? e.serialize(t, n, r, i, a, j) : e.print(t, (e) => j(e, n, r, i, a), (e) => {
|
|
2131
|
+
let t = r + n.indent;
|
|
2132
|
+
return t + e.replaceAll(dr, `\n${t}`);
|
|
2133
|
+
}, {
|
|
2134
|
+
edgeSpacing: n.spacingOuter,
|
|
2135
|
+
min: n.min,
|
|
2136
|
+
spacing: n.spacingInner
|
|
2137
|
+
}, n.colors);
|
|
2138
|
+
} catch (e) {
|
|
2139
|
+
throw new fr(e.message, e.stack);
|
|
2140
|
+
}
|
|
2141
|
+
if (typeof o != "string") throw TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof o}".`);
|
|
2142
|
+
return o;
|
|
2143
|
+
}
|
|
2144
|
+
function wr(e, t) {
|
|
2145
|
+
for (let n of e) try {
|
|
2146
|
+
if (n.test(t)) return n;
|
|
2147
|
+
} catch (e) {
|
|
2148
|
+
throw new fr(e.message, e.stack);
|
|
2149
|
+
}
|
|
2150
|
+
return null;
|
|
2151
|
+
}
|
|
2152
|
+
function j(e, t, n, r, i, a) {
|
|
2153
|
+
let o, s = wr(t.plugins, e);
|
|
2154
|
+
if (s !== null) o = Cr(s, e, t, n, r, i);
|
|
2155
|
+
else {
|
|
2156
|
+
let s = yr(e, t.printFunctionName, t.escapeRegex, t.escapeString);
|
|
2157
|
+
o = s === null ? br(e, t, n, r, i, a) : s;
|
|
2158
|
+
}
|
|
2159
|
+
return t._outputLengthPerDepth[r] ??= 0, t._outputLengthPerDepth[r] += o.length, t._outputLengthPerDepth[r] > t.maxOutputLength && (t.maxDepth = 0), o;
|
|
2160
|
+
}
|
|
2161
|
+
var Tr = {
|
|
2162
|
+
comment: "gray",
|
|
2163
|
+
content: "reset",
|
|
2164
|
+
prop: "yellow",
|
|
2165
|
+
tag: "cyan",
|
|
2166
|
+
value: "green"
|
|
2167
|
+
}, Er = Object.keys(Tr), M = {
|
|
2168
|
+
callToJSON: !0,
|
|
2169
|
+
compareKeys: void 0,
|
|
2170
|
+
escapeRegex: !1,
|
|
2171
|
+
escapeString: !0,
|
|
2172
|
+
highlight: !1,
|
|
2173
|
+
indent: 2,
|
|
2174
|
+
maxDepth: Infinity,
|
|
2175
|
+
maxOutputLength: 1e6,
|
|
2176
|
+
maxWidth: Infinity,
|
|
2177
|
+
min: !1,
|
|
2178
|
+
plugins: [],
|
|
2179
|
+
printBasicPrototype: !0,
|
|
2180
|
+
printFunctionName: !0,
|
|
2181
|
+
printShadowRoot: !0,
|
|
2182
|
+
theme: Tr
|
|
2183
|
+
};
|
|
2184
|
+
function Dr(e) {
|
|
2185
|
+
for (let t of Object.keys(e)) if (!Object.hasOwn(M, t)) throw Error(`pretty-format: Unknown option "${t}".`);
|
|
2186
|
+
if (e.min && e.indent !== void 0 && e.indent !== 0) throw Error("pretty-format: Options \"min\" and \"indent\" cannot be used together.");
|
|
2187
|
+
}
|
|
2188
|
+
function Or() {
|
|
2189
|
+
return Er.reduce((e, t) => {
|
|
2190
|
+
let n = Tr[t], r = n && Mt[n];
|
|
2191
|
+
if (r && typeof r.close == "string" && typeof r.open == "string") e[t] = r;
|
|
2192
|
+
else throw Error(`pretty-format: Option "theme" has a key "${t}" whose value "${n}" is undefined in ansi-styles.`);
|
|
2193
|
+
return e;
|
|
2194
|
+
}, Object.create(null));
|
|
2195
|
+
}
|
|
2196
|
+
function kr() {
|
|
2197
|
+
return Er.reduce((e, t) => (e[t] = {
|
|
2198
|
+
close: "",
|
|
2199
|
+
open: ""
|
|
2200
|
+
}, e), Object.create(null));
|
|
2201
|
+
}
|
|
2202
|
+
function Ar(e) {
|
|
2203
|
+
return e?.printFunctionName ?? M.printFunctionName;
|
|
2204
|
+
}
|
|
2205
|
+
function jr(e) {
|
|
2206
|
+
return e?.escapeRegex ?? M.escapeRegex;
|
|
2207
|
+
}
|
|
2208
|
+
function Mr(e) {
|
|
2209
|
+
return e?.escapeString ?? M.escapeString;
|
|
2210
|
+
}
|
|
2211
|
+
function Nr(e) {
|
|
2212
|
+
return {
|
|
2213
|
+
callToJSON: e?.callToJSON ?? M.callToJSON,
|
|
2214
|
+
colors: e?.highlight ? Or() : kr(),
|
|
2215
|
+
compareKeys: typeof e?.compareKeys == "function" || e?.compareKeys === null ? e.compareKeys : M.compareKeys,
|
|
2216
|
+
escapeRegex: jr(e),
|
|
2217
|
+
escapeString: Mr(e),
|
|
2218
|
+
indent: e?.min ? "" : Pr(e?.indent ?? M.indent),
|
|
2219
|
+
maxDepth: e?.maxDepth ?? M.maxDepth,
|
|
2220
|
+
maxWidth: e?.maxWidth ?? M.maxWidth,
|
|
2221
|
+
min: e?.min ?? M.min,
|
|
2222
|
+
plugins: e?.plugins ?? M.plugins,
|
|
2223
|
+
printBasicPrototype: e?.printBasicPrototype ?? !0,
|
|
2224
|
+
printFunctionName: Ar(e),
|
|
2225
|
+
printShadowRoot: e?.printShadowRoot ?? !0,
|
|
2226
|
+
spacingInner: e?.min ? " " : "\n",
|
|
2227
|
+
spacingOuter: e?.min ? "" : "\n",
|
|
2228
|
+
maxOutputLength: e?.maxOutputLength ?? M.maxOutputLength,
|
|
2229
|
+
_outputLengthPerDepth: []
|
|
2230
|
+
};
|
|
2231
|
+
}
|
|
2232
|
+
function Pr(e) {
|
|
2233
|
+
return Array.from({ length: e + 1 }).join(" ");
|
|
2234
|
+
}
|
|
2235
|
+
function Fr(e, t) {
|
|
2236
|
+
if (t && (Dr(t), t.plugins)) {
|
|
2237
|
+
let n = wr(t.plugins, e);
|
|
2238
|
+
if (n !== null) return Cr(n, e, Nr(t), "", 0, []);
|
|
2239
|
+
}
|
|
2240
|
+
let n = yr(e, Ar(t), jr(t), Mr(t));
|
|
2241
|
+
return n === null ? br(e, Nr(t), "", 0, []) : n;
|
|
2242
|
+
}
|
|
2243
|
+
var Ir = {
|
|
2244
|
+
AsymmetricMatcher: Bt,
|
|
2245
|
+
DOMCollection: qt,
|
|
2246
|
+
DOMElement: vn,
|
|
2247
|
+
Immutable: Fn,
|
|
2248
|
+
ReactElement: er,
|
|
2249
|
+
ReactTestComponent: rr,
|
|
2250
|
+
Error: xr
|
|
2251
|
+
}, Lr = {
|
|
2252
|
+
bold: ["1", "22"],
|
|
2253
|
+
dim: ["2", "22"],
|
|
2254
|
+
italic: ["3", "23"],
|
|
2255
|
+
underline: ["4", "24"],
|
|
2256
|
+
inverse: ["7", "27"],
|
|
2257
|
+
hidden: ["8", "28"],
|
|
2258
|
+
strike: ["9", "29"],
|
|
2259
|
+
black: ["30", "39"],
|
|
2260
|
+
red: ["31", "39"],
|
|
2261
|
+
green: ["32", "39"],
|
|
2262
|
+
yellow: ["33", "39"],
|
|
2263
|
+
blue: ["34", "39"],
|
|
2264
|
+
magenta: ["35", "39"],
|
|
2265
|
+
cyan: ["36", "39"],
|
|
2266
|
+
white: ["37", "39"],
|
|
2267
|
+
brightblack: ["30;1", "39"],
|
|
2268
|
+
brightred: ["31;1", "39"],
|
|
2269
|
+
brightgreen: ["32;1", "39"],
|
|
2270
|
+
brightyellow: ["33;1", "39"],
|
|
2271
|
+
brightblue: ["34;1", "39"],
|
|
2272
|
+
brightmagenta: ["35;1", "39"],
|
|
2273
|
+
brightcyan: ["36;1", "39"],
|
|
2274
|
+
brightwhite: ["37;1", "39"],
|
|
2275
|
+
grey: ["90", "39"]
|
|
2276
|
+
}, Rr = {
|
|
2277
|
+
special: "cyan",
|
|
2278
|
+
number: "yellow",
|
|
2279
|
+
bigint: "yellow",
|
|
2280
|
+
boolean: "yellow",
|
|
2281
|
+
undefined: "grey",
|
|
2282
|
+
null: "bold",
|
|
2283
|
+
string: "green",
|
|
2284
|
+
symbol: "green",
|
|
2285
|
+
date: "magenta",
|
|
2286
|
+
regexp: "red"
|
|
2287
|
+
}, N = "…";
|
|
2288
|
+
function zr(e, t) {
|
|
2289
|
+
let n = Lr[Rr[t]] || Lr[t] || "";
|
|
2290
|
+
return n ? `\u001b[${n[0]}m${String(e)}\u001b[${n[1]}m` : String(e);
|
|
2291
|
+
}
|
|
2292
|
+
function Br({ showHidden: e = !1, depth: t = 2, colors: n = !1, customInspect: r = !0, showProxy: i = !1, maxArrayLength: a = Infinity, breakLength: o = Infinity, seen: s = [], truncate: c = Infinity, stylize: l = String } = {}, u) {
|
|
2293
|
+
let d = {
|
|
2294
|
+
showHidden: !!e,
|
|
2295
|
+
depth: Number(t),
|
|
2296
|
+
colors: !!n,
|
|
2297
|
+
customInspect: !!r,
|
|
2298
|
+
showProxy: !!i,
|
|
2299
|
+
maxArrayLength: Number(a),
|
|
2300
|
+
breakLength: Number(o),
|
|
2301
|
+
truncate: Number(c),
|
|
2302
|
+
seen: s,
|
|
2303
|
+
inspect: u,
|
|
2304
|
+
stylize: l
|
|
2305
|
+
};
|
|
2306
|
+
return d.colors && (d.stylize = zr), d;
|
|
2307
|
+
}
|
|
2308
|
+
function Vr(e) {
|
|
2309
|
+
return e >= "\ud800" && e <= "\udbff";
|
|
2310
|
+
}
|
|
2311
|
+
function P(e, t, n = N) {
|
|
2312
|
+
e = String(e);
|
|
2313
|
+
let r = n.length, i = e.length;
|
|
2314
|
+
if (r > t && i > r) return n;
|
|
2315
|
+
if (i > t && i > r) {
|
|
2316
|
+
let i = t - r;
|
|
2317
|
+
return i > 0 && Vr(e[i - 1]) && --i, `${e.slice(0, i)}${n}`;
|
|
2318
|
+
}
|
|
2319
|
+
return e;
|
|
2320
|
+
}
|
|
2321
|
+
function F(e, t, n, r = ", ") {
|
|
2322
|
+
n ||= t.inspect;
|
|
2323
|
+
let i = e.length;
|
|
2324
|
+
if (i === 0) return "";
|
|
2325
|
+
let a = t.truncate, o = "", s = "", c = "";
|
|
2326
|
+
for (let l = 0; l < i; l += 1) {
|
|
2327
|
+
let i = l + 1 === e.length, u = l + 2 === e.length;
|
|
2328
|
+
c = `${N}(${e.length - l})`;
|
|
2329
|
+
let d = e[l];
|
|
2330
|
+
t.truncate = a - o.length - (i ? 0 : r.length);
|
|
2331
|
+
let f = s || n(d, t) + (i ? "" : r), p = o.length + f.length, m = p + c.length;
|
|
2332
|
+
if (i && p > a && o.length + c.length <= a || !i && !u && m > a || (s = i ? "" : n(e[l + 1], t) + (u ? "" : r), !i && u && m > a && p + s.length > a)) break;
|
|
2333
|
+
if (o += f, !i && !u && p + s.length >= a) {
|
|
2334
|
+
c = `${N}(${e.length - l - 1})`;
|
|
2335
|
+
break;
|
|
2336
|
+
}
|
|
2337
|
+
c = "";
|
|
2338
|
+
}
|
|
2339
|
+
return `${o}${c}`;
|
|
2340
|
+
}
|
|
2341
|
+
function Hr(e) {
|
|
2342
|
+
return e.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/) ? e : JSON.stringify(e).replace(/'/g, "\\'").replace(/\\"/g, "\"").replace(/(^"|"$)/g, "'");
|
|
2343
|
+
}
|
|
2344
|
+
function I([e, t], n) {
|
|
2345
|
+
return n.truncate -= 2, typeof e == "string" ? e = Hr(e) : typeof e != "number" && (e = `[${n.inspect(e, n)}]`), n.truncate -= e.length, t = n.inspect(t, n), `${e}: ${t}`;
|
|
2346
|
+
}
|
|
2347
|
+
function Ur(e, t) {
|
|
2348
|
+
let n = Object.keys(e).slice(e.length);
|
|
2349
|
+
if (!e.length && !n.length) return "[]";
|
|
2350
|
+
t.truncate -= 4;
|
|
2351
|
+
let r = F(e, t);
|
|
2352
|
+
t.truncate -= r.length;
|
|
2353
|
+
let i = "";
|
|
2354
|
+
return n.length && (i = F(n.map((t) => [t, e[t]]), t, I)), `[ ${r}${i ? `, ${i}` : ""} ]`;
|
|
2355
|
+
}
|
|
2356
|
+
var Wr = (e) => typeof Buffer == "function" && e instanceof Buffer ? "Buffer" : e[Symbol.toStringTag] ? e[Symbol.toStringTag] : e.constructor.name;
|
|
2357
|
+
function L(e, t) {
|
|
2358
|
+
let n = Wr(e);
|
|
2359
|
+
t.truncate -= n.length + 4;
|
|
2360
|
+
let r = Object.keys(e).slice(e.length);
|
|
2361
|
+
if (!e.length && !r.length) return `${n}[]`;
|
|
2362
|
+
let i = "";
|
|
2363
|
+
for (let n = 0; n < e.length; n++) {
|
|
2364
|
+
let r = `${t.stylize(P(e[n], t.truncate), "number")}${n === e.length - 1 ? "" : ", "}`;
|
|
2365
|
+
if (t.truncate -= r.length, e[n] !== e.length && t.truncate <= 3) {
|
|
2366
|
+
i += `${N}(${e.length - e[n] + 1})`;
|
|
2367
|
+
break;
|
|
2368
|
+
}
|
|
2369
|
+
i += r;
|
|
2370
|
+
}
|
|
2371
|
+
let a = "";
|
|
2372
|
+
return r.length && (a = F(r.map((t) => [t, e[t]]), t, I)), `${n}[ ${i}${a ? `, ${a}` : ""} ]`;
|
|
2373
|
+
}
|
|
2374
|
+
function Gr(e, t) {
|
|
2375
|
+
let n = e.toJSON();
|
|
2376
|
+
if (n === null) return "Invalid Date";
|
|
2377
|
+
let r = n.split("T"), i = r[0];
|
|
2378
|
+
return t.stylize(`${i}T${P(r[1], t.truncate - i.length - 1)}`, "date");
|
|
2379
|
+
}
|
|
2380
|
+
function Kr(e, t) {
|
|
2381
|
+
let n = e[Symbol.toStringTag] || "Function", r = e.name;
|
|
2382
|
+
return r ? t.stylize(`[${n} ${P(r, t.truncate - 11)}]`, "special") : t.stylize(`[${n}]`, "special");
|
|
2383
|
+
}
|
|
2384
|
+
function qr([e, t], n) {
|
|
2385
|
+
return n.truncate -= 4, e = n.inspect(e, n), n.truncate -= e.length, t = n.inspect(t, n), `${e} => ${t}`;
|
|
2386
|
+
}
|
|
2387
|
+
function Jr(e) {
|
|
2388
|
+
let t = [];
|
|
2389
|
+
return e.forEach((e, n) => {
|
|
2390
|
+
t.push([n, e]);
|
|
2391
|
+
}), t;
|
|
2392
|
+
}
|
|
2393
|
+
function Yr(e, t) {
|
|
2394
|
+
return e.size === 0 ? "Map{}" : (t.truncate -= 7, `Map{ ${F(Jr(e), t, qr)} }`);
|
|
2395
|
+
}
|
|
2396
|
+
var Xr = Number.isNaN || ((e) => e !== e);
|
|
2397
|
+
function Zr(e, t) {
|
|
2398
|
+
return Xr(e) ? t.stylize("NaN", "number") : e === Infinity ? t.stylize("Infinity", "number") : e === -Infinity ? t.stylize("-Infinity", "number") : e === 0 ? t.stylize(1 / e == Infinity ? "+0" : "-0", "number") : t.stylize(P(String(e), t.truncate), "number");
|
|
2399
|
+
}
|
|
2400
|
+
function Qr(e, t) {
|
|
2401
|
+
let n = P(e.toString(), t.truncate - 1);
|
|
2402
|
+
return n !== N && (n += "n"), t.stylize(n, "bigint");
|
|
2403
|
+
}
|
|
2404
|
+
function $r(e, t) {
|
|
2405
|
+
let n = e.toString().split("/")[2], r = t.truncate - (2 + n.length), i = e.source;
|
|
2406
|
+
return t.stylize(`/${P(i, r)}/${n}`, "regexp");
|
|
2407
|
+
}
|
|
2408
|
+
function ei(e) {
|
|
2409
|
+
let t = [];
|
|
2410
|
+
return e.forEach((e) => {
|
|
2411
|
+
t.push(e);
|
|
2412
|
+
}), t;
|
|
2413
|
+
}
|
|
2414
|
+
function ti(e, t) {
|
|
2415
|
+
return e.size === 0 ? "Set{}" : (t.truncate -= 7, `Set{ ${F(ei(e), t)} }`);
|
|
2416
|
+
}
|
|
2417
|
+
var ni = /* @__PURE__ */ RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g"), ri = {
|
|
2418
|
+
"\b": "\\b",
|
|
2419
|
+
" ": "\\t",
|
|
2420
|
+
"\n": "\\n",
|
|
2421
|
+
"\f": "\\f",
|
|
2422
|
+
"\r": "\\r",
|
|
2423
|
+
"'": "\\'",
|
|
2424
|
+
"\\": "\\\\"
|
|
2425
|
+
}, ii = 16;
|
|
2426
|
+
function ai(e) {
|
|
2427
|
+
return ri[e] || `\\u${`0000${e.charCodeAt(0).toString(ii)}`.slice(-4)}`;
|
|
2428
|
+
}
|
|
2429
|
+
function oi(e, t) {
|
|
2430
|
+
return ni.test(e) && (e = e.replace(ni, ai)), t.stylize(`'${P(e, t.truncate - 2)}'`, "string");
|
|
2431
|
+
}
|
|
2432
|
+
function si(e) {
|
|
2433
|
+
return "description" in Symbol.prototype ? e.description ? `Symbol(${e.description})` : "Symbol()" : e.toString();
|
|
2434
|
+
}
|
|
2435
|
+
var ci = () => "Promise{…}";
|
|
2436
|
+
function li(e, t) {
|
|
2437
|
+
let n = Object.getOwnPropertyNames(e), r = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e) : [];
|
|
2438
|
+
if (n.length === 0 && r.length === 0) return "{}";
|
|
2439
|
+
if (t.truncate -= 4, t.seen = t.seen || [], t.seen.includes(e)) return "[Circular]";
|
|
2440
|
+
t.seen.push(e);
|
|
2441
|
+
let i = F(n.map((t) => [t, e[t]]), t, I), a = F(r.map((t) => [t, e[t]]), t, I);
|
|
2442
|
+
t.seen.pop();
|
|
2443
|
+
let o = "";
|
|
2444
|
+
return i && a && (o = ", "), `{ ${i}${o}${a} }`;
|
|
2445
|
+
}
|
|
2446
|
+
var ui = typeof Symbol < "u" && Symbol.toStringTag ? Symbol.toStringTag : !1;
|
|
2447
|
+
function di(e, t) {
|
|
2448
|
+
let n = "";
|
|
2449
|
+
return ui && ui in e && (n = e[ui]), n ||= e.constructor.name, (!n || n === "_class") && (n = "<Anonymous Class>"), t.truncate -= n.length, `${n}${li(e, t)}`;
|
|
2450
|
+
}
|
|
2451
|
+
function fi(e, t) {
|
|
2452
|
+
return e.length === 0 ? "Arguments[]" : (t.truncate -= 13, `Arguments[ ${F(e, t)} ]`);
|
|
2453
|
+
}
|
|
2454
|
+
var pi = [
|
|
2455
|
+
"stack",
|
|
2456
|
+
"line",
|
|
2457
|
+
"column",
|
|
2458
|
+
"name",
|
|
2459
|
+
"message",
|
|
2460
|
+
"fileName",
|
|
2461
|
+
"lineNumber",
|
|
2462
|
+
"columnNumber",
|
|
2463
|
+
"number",
|
|
2464
|
+
"description",
|
|
2465
|
+
"cause"
|
|
2466
|
+
];
|
|
2467
|
+
function mi(e, t) {
|
|
2468
|
+
let n = Object.getOwnPropertyNames(e).filter((e) => pi.indexOf(e) === -1), r = e.name;
|
|
2469
|
+
t.truncate -= r.length;
|
|
2470
|
+
let i = "";
|
|
2471
|
+
if (typeof e.message == "string" ? i = P(e.message, t.truncate) : n.unshift("message"), i = i ? `: ${i}` : "", t.truncate -= i.length + 5, t.seen = t.seen || [], t.seen.includes(e)) return "[Circular]";
|
|
2472
|
+
t.seen.push(e);
|
|
2473
|
+
let a = F(n.map((t) => [t, e[t]]), t, I);
|
|
2474
|
+
return `${r}${i}${a ? ` { ${a} }` : ""}`;
|
|
2475
|
+
}
|
|
2476
|
+
function hi([e, t], n) {
|
|
2477
|
+
return n.truncate -= 3, t ? `${n.stylize(String(e), "yellow")}=${n.stylize(`"${t}"`, "string")}` : `${n.stylize(String(e), "yellow")}`;
|
|
2478
|
+
}
|
|
2479
|
+
function gi(e, t) {
|
|
2480
|
+
return F(e, t, _i, "\n");
|
|
2481
|
+
}
|
|
2482
|
+
function _i(e, t) {
|
|
2483
|
+
switch (e.nodeType) {
|
|
2484
|
+
case 1: return vi(e, t);
|
|
2485
|
+
case 3: return t.inspect(e.data, t);
|
|
2486
|
+
default: return t.inspect(e, t);
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
function vi(e, t) {
|
|
2490
|
+
let n = e.getAttributeNames(), r = e.tagName.toLowerCase(), i = t.stylize(`<${r}`, "special"), a = t.stylize(">", "special"), o = t.stylize(`</${r}>`, "special");
|
|
2491
|
+
t.truncate -= r.length * 2 + 5;
|
|
2492
|
+
let s = "";
|
|
2493
|
+
n.length > 0 && (s += " ", s += F(n.map((t) => [t, e.getAttribute(t)]), t, hi, " ")), t.truncate -= s.length;
|
|
2494
|
+
let c = t.truncate, l = gi(e.children, t);
|
|
2495
|
+
return l && l.length > c && (l = `${N}(${e.children.length})`), `${i}${s}${a}${l}${o}`;
|
|
2496
|
+
}
|
|
2497
|
+
var yi = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("chai/inspect") : "@@chai/inspect", bi = Symbol.for("nodejs.util.inspect.custom"), xi = /* @__PURE__ */ new WeakMap(), Si = {}, Ci = {
|
|
2498
|
+
undefined: (e, t) => t.stylize("undefined", "undefined"),
|
|
2499
|
+
null: (e, t) => t.stylize("null", "null"),
|
|
2500
|
+
boolean: (e, t) => t.stylize(String(e), "boolean"),
|
|
2501
|
+
Boolean: (e, t) => t.stylize(String(e), "boolean"),
|
|
2502
|
+
number: Zr,
|
|
2503
|
+
Number: Zr,
|
|
2504
|
+
bigint: Qr,
|
|
2505
|
+
BigInt: Qr,
|
|
2506
|
+
string: oi,
|
|
2507
|
+
String: oi,
|
|
2508
|
+
function: Kr,
|
|
2509
|
+
Function: Kr,
|
|
2510
|
+
symbol: si,
|
|
2511
|
+
Symbol: si,
|
|
2512
|
+
Array: Ur,
|
|
2513
|
+
Date: Gr,
|
|
2514
|
+
Map: Yr,
|
|
2515
|
+
Set: ti,
|
|
2516
|
+
RegExp: $r,
|
|
2517
|
+
Promise: ci,
|
|
2518
|
+
WeakSet: (e, t) => t.stylize("WeakSet{…}", "special"),
|
|
2519
|
+
WeakMap: (e, t) => t.stylize("WeakMap{…}", "special"),
|
|
2520
|
+
Arguments: fi,
|
|
2521
|
+
Int8Array: L,
|
|
2522
|
+
Uint8Array: L,
|
|
2523
|
+
Uint8ClampedArray: L,
|
|
2524
|
+
Int16Array: L,
|
|
2525
|
+
Uint16Array: L,
|
|
2526
|
+
Int32Array: L,
|
|
2527
|
+
Uint32Array: L,
|
|
2528
|
+
Float32Array: L,
|
|
2529
|
+
Float64Array: L,
|
|
2530
|
+
Generator: () => "",
|
|
2531
|
+
DataView: () => "",
|
|
2532
|
+
ArrayBuffer: () => "",
|
|
2533
|
+
Error: mi,
|
|
2534
|
+
HTMLCollection: gi,
|
|
2535
|
+
NodeList: gi
|
|
2536
|
+
}, wi = (e, t, n, r) => yi in e && typeof e[yi] == "function" ? e[yi](t) : bi in e && typeof e[bi] == "function" ? e[bi](t.depth, t, r) : "inspect" in e && typeof e.inspect == "function" ? e.inspect(t.depth, t) : "constructor" in e && xi.has(e.constructor) ? xi.get(e.constructor)(e, t) : Si[n] ? Si[n](e, t) : "", Ti = Object.prototype.toString;
|
|
2537
|
+
function Ei(e, t = {}) {
|
|
2538
|
+
let n = Br(t, Ei), { customInspect: r } = n, i = e === null ? "null" : typeof e;
|
|
2539
|
+
if (i === "object" && (i = Ti.call(e).slice(8, -1)), i in Ci) return Ci[i](e, n);
|
|
2540
|
+
if (r && e) {
|
|
2541
|
+
let t = wi(e, n, i, Ei);
|
|
2542
|
+
if (t) return typeof t == "string" ? t : Ei(t, n);
|
|
2543
|
+
}
|
|
2544
|
+
let a = e ? Object.getPrototypeOf(e) : !1;
|
|
2545
|
+
return a === Object.prototype || a === null ? li(e, n) : e && typeof HTMLElement == "function" && e instanceof HTMLElement ? vi(e, n) : "constructor" in e ? e.constructor === Object ? li(e, n) : di(e, n) : e === Object(e) ? li(e, n) : n.stylize(String(e), i);
|
|
2546
|
+
}
|
|
2547
|
+
var { AsymmetricMatcher: Di, DOMCollection: Oi, DOMElement: ki, Immutable: Ai, ReactElement: ji, ReactTestComponent: Mi } = Ir, Ni = [
|
|
2548
|
+
Mi,
|
|
2549
|
+
ji,
|
|
2550
|
+
ki,
|
|
2551
|
+
Oi,
|
|
2552
|
+
Ai,
|
|
2553
|
+
Di
|
|
2554
|
+
];
|
|
2555
|
+
function Pi(e, t = 10, { maxLength: n, filterNode: r, ...i } = {}) {
|
|
2556
|
+
let a = n ?? 1e4, o, s = typeof r == "string" ? Fi(r) : r, c = s ? [
|
|
2557
|
+
Mi,
|
|
2558
|
+
ji,
|
|
2559
|
+
_n(s),
|
|
2560
|
+
Oi,
|
|
2561
|
+
Ai,
|
|
2562
|
+
Di
|
|
2563
|
+
] : Ni;
|
|
2564
|
+
try {
|
|
2565
|
+
o = Fr(e, {
|
|
2566
|
+
maxDepth: t,
|
|
2567
|
+
escapeString: !1,
|
|
2568
|
+
plugins: c,
|
|
2569
|
+
...i
|
|
2570
|
+
});
|
|
2571
|
+
} catch {
|
|
2572
|
+
o = Fr(e, {
|
|
2573
|
+
callToJSON: !1,
|
|
2574
|
+
maxDepth: t,
|
|
2575
|
+
escapeString: !1,
|
|
2576
|
+
plugins: c,
|
|
2577
|
+
...i
|
|
2578
|
+
});
|
|
2579
|
+
}
|
|
2580
|
+
return o.length >= a && t > 1 ? Pi(e, Math.floor(Math.min(t, 2 ** 53 - 1) / 2), {
|
|
2581
|
+
maxLength: n,
|
|
2582
|
+
filterNode: r,
|
|
2583
|
+
...i
|
|
2584
|
+
}) : o;
|
|
2585
|
+
}
|
|
2586
|
+
function Fi(e) {
|
|
2587
|
+
return (t) => {
|
|
2588
|
+
if (t.nodeType === 8) return !1;
|
|
2589
|
+
if (t.nodeType === 1 && t.matches) try {
|
|
2590
|
+
return !t.matches(e);
|
|
2591
|
+
} catch {
|
|
2592
|
+
return !0;
|
|
2593
|
+
}
|
|
2594
|
+
return !0;
|
|
2595
|
+
};
|
|
2596
|
+
}
|
|
2597
|
+
var Ii = /%[sdjifoOc%]/g;
|
|
2598
|
+
function Li(e, t = {}) {
|
|
2599
|
+
let n = (e, n) => t.prettifyObject ? Pi(e, void 0, {
|
|
2600
|
+
printBasicPrototype: !1,
|
|
2601
|
+
escapeString: !1
|
|
2602
|
+
}) : zi(e, n);
|
|
2603
|
+
if (typeof e[0] != "string") {
|
|
2604
|
+
let t = [];
|
|
2605
|
+
for (let r = 0; r < e.length; r++) t.push(n(e[r], {
|
|
2606
|
+
depth: 0,
|
|
2607
|
+
colors: !1
|
|
2608
|
+
}));
|
|
2609
|
+
return t.join(" ");
|
|
2610
|
+
}
|
|
2611
|
+
let r = e.length, i = 1, a = e[0], o = String(a).replace(Ii, (t) => {
|
|
2612
|
+
if (t === "%%") return "%";
|
|
2613
|
+
if (i >= r) return t;
|
|
2614
|
+
switch (t) {
|
|
2615
|
+
case "%s": {
|
|
2616
|
+
let t = e[i++];
|
|
2617
|
+
return typeof t == "bigint" ? `${t.toString()}n` : typeof t == "number" && t === 0 && 1 / t < 0 ? "-0" : typeof t == "object" && t ? typeof t.toString == "function" && t.toString !== Object.prototype.toString ? t.toString() : n(t, {
|
|
2618
|
+
depth: 0,
|
|
2619
|
+
colors: !1
|
|
2620
|
+
}) : String(t);
|
|
2621
|
+
}
|
|
2622
|
+
case "%d": {
|
|
2623
|
+
let t = e[i++];
|
|
2624
|
+
return typeof t == "bigint" ? `${t.toString()}n` : typeof t == "symbol" ? "NaN" : Number(t).toString();
|
|
2625
|
+
}
|
|
2626
|
+
case "%i": {
|
|
2627
|
+
let t = e[i++];
|
|
2628
|
+
return typeof t == "bigint" ? `${t.toString()}n` : Number.parseInt(String(t)).toString();
|
|
2629
|
+
}
|
|
2630
|
+
case "%f": return Number.parseFloat(String(e[i++])).toString();
|
|
2631
|
+
case "%o": return n(e[i++], {
|
|
2632
|
+
showHidden: !0,
|
|
2633
|
+
showProxy: !0
|
|
2634
|
+
});
|
|
2635
|
+
case "%O": return n(e[i++]);
|
|
2636
|
+
case "%c": return i++, "";
|
|
2637
|
+
case "%j": try {
|
|
2638
|
+
return JSON.stringify(e[i++]);
|
|
2639
|
+
} catch (e) {
|
|
2640
|
+
let t = e.message;
|
|
2641
|
+
if (t.includes("circular structure") || t.includes("cyclic structures") || t.includes("cyclic object")) return "[Circular]";
|
|
2642
|
+
throw e;
|
|
2643
|
+
}
|
|
2644
|
+
default: return t;
|
|
2645
|
+
}
|
|
2646
|
+
});
|
|
2647
|
+
for (let t = e[i]; i < r; t = e[++i]) o += typeof t != "object" || !t ? ` ${typeof t == "symbol" ? t.toString() : t}` : ` ${n(t)}`;
|
|
2648
|
+
return o;
|
|
2649
|
+
}
|
|
2650
|
+
function Ri(...e) {
|
|
2651
|
+
return Li(e);
|
|
2652
|
+
}
|
|
2653
|
+
function zi(e, t = {}) {
|
|
2654
|
+
return t.truncate === 0 && (t.truncate = Infinity), Ei(e, t);
|
|
2655
|
+
}
|
|
2656
|
+
function Bi(e, t = {}) {
|
|
2657
|
+
t.truncate === void 0 && (t.truncate = 40);
|
|
2658
|
+
let n = zi(e, t), r = Object.prototype.toString.call(e);
|
|
2659
|
+
if (t.truncate && n.length >= t.truncate) {
|
|
2660
|
+
if (r === "[object Function]") {
|
|
2661
|
+
let t = e;
|
|
2662
|
+
return t.name ? `[Function: ${t.name}]` : "[Function]";
|
|
2663
|
+
}
|
|
2664
|
+
if (r === "[object Array]") return `[ Array(${e.length}) ]`;
|
|
2665
|
+
if (r === "[object Object]") {
|
|
2666
|
+
let t = Object.keys(e);
|
|
2667
|
+
return `{ Object (${t.length > 2 ? `${t.splice(0, 2).join(", ")}, ...` : t.join(", ")}) }`;
|
|
2668
|
+
}
|
|
2669
|
+
return n;
|
|
2670
|
+
}
|
|
2671
|
+
return n;
|
|
2672
|
+
}
|
|
2673
|
+
//#endregion
|
|
2674
|
+
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/helpers.js
|
|
2675
|
+
function R(e, t, n) {
|
|
2676
|
+
let r = typeof e;
|
|
2677
|
+
if (!n.includes(r)) throw TypeError(`${t} value must be ${n.join(" or ")}, received "${r}"`);
|
|
2678
|
+
}
|
|
2679
|
+
function Vi(e) {
|
|
2680
|
+
let t = [], n = "none";
|
|
2681
|
+
for (let r = 0; r < e.length; ++r) n === "singleline" ? e[r] === "\n" && (n = "none") : n === "multiline" ? e[r - 1] === "*" && e[r] === "/" && (n = "none") : n === "none" && (e[r] === "/" && e[r + 1] === "/" ? n = "singleline" : e[r] === "/" && e[r + 1] === "*" ? (n = "multiline", r += 2) : t.push(e[r]));
|
|
2682
|
+
return t.join("");
|
|
2683
|
+
}
|
|
2684
|
+
function Hi(e) {
|
|
2685
|
+
return e ??= [], Array.isArray(e) ? e : [e];
|
|
2686
|
+
}
|
|
2687
|
+
function Ui(e) {
|
|
2688
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
2689
|
+
}
|
|
2690
|
+
function Wi(e, t, n = void 0) {
|
|
2691
|
+
let r = t.replace(/\[(\d+)\]/g, ".$1").split("."), i = e;
|
|
2692
|
+
for (let e of r) if (i = new Object(i)[e], i === void 0) return n;
|
|
2693
|
+
return i;
|
|
2694
|
+
}
|
|
2695
|
+
function Gi() {
|
|
2696
|
+
let e = null, t = null, n = new Promise((n, r) => {
|
|
2697
|
+
e = n, t = r;
|
|
2698
|
+
});
|
|
2699
|
+
return n.resolve = e, n.reject = t, n;
|
|
2700
|
+
}
|
|
2701
|
+
function Ki(e) {
|
|
2702
|
+
if (!Number.isNaN(e)) return !1;
|
|
2703
|
+
let t = /* @__PURE__ */ new Float64Array(1);
|
|
2704
|
+
return t[0] = e, new Uint32Array(t.buffer)[1] >>> 31 == 1;
|
|
2705
|
+
}
|
|
2706
|
+
function qi(e) {
|
|
2707
|
+
let t = e % 10, n = e % 100;
|
|
2708
|
+
return t === 1 && n !== 11 ? `${e}st` : t === 2 && n !== 12 ? `${e}nd` : t === 3 && n !== 13 ? `${e}rd` : `${e}th`;
|
|
2709
|
+
}
|
|
2710
|
+
function Ji(e) {
|
|
2711
|
+
return Array.from(new Set(e));
|
|
2712
|
+
}
|
|
2713
|
+
//#endregion
|
|
2714
|
+
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/timers.js
|
|
2715
|
+
var Yi = Symbol("vitest:SAFE_TIMERS");
|
|
2716
|
+
function Xi() {
|
|
2717
|
+
let { setTimeout: e, setInterval: t, clearInterval: n, clearTimeout: r, setImmediate: i, clearImmediate: a, queueMicrotask: o } = globalThis[Yi] || globalThis, { nextTick: s } = globalThis[Yi] || globalThis.process || {};
|
|
2718
|
+
return {
|
|
2719
|
+
nextTick: s,
|
|
2720
|
+
setTimeout: e,
|
|
2721
|
+
setInterval: t,
|
|
2722
|
+
clearInterval: n,
|
|
2723
|
+
clearTimeout: r,
|
|
2724
|
+
setImmediate: i,
|
|
2725
|
+
clearImmediate: a,
|
|
2726
|
+
queueMicrotask: o
|
|
2727
|
+
};
|
|
2728
|
+
}
|
|
2729
|
+
//#endregion
|
|
2730
|
+
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
|
|
2731
|
+
var Zi = /^[A-Za-z]:\//;
|
|
2732
|
+
function Qi(e = "") {
|
|
2733
|
+
return e && e.replace(/\\/g, "/").replace(Zi, (e) => e.toUpperCase());
|
|
2734
|
+
}
|
|
2735
|
+
var $i = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
2736
|
+
function ea() {
|
|
2737
|
+
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
2738
|
+
}
|
|
2739
|
+
var ta = function(...e) {
|
|
2740
|
+
e = e.map((e) => Qi(e));
|
|
2741
|
+
let t = "", n = !1;
|
|
2742
|
+
for (let r = e.length - 1; r >= -1 && !n; r--) {
|
|
2743
|
+
let i = r >= 0 ? e[r] : ea();
|
|
2744
|
+
i && i.length !== 0 && (t = `${i}/${t}`, n = ra(i));
|
|
2745
|
+
}
|
|
2746
|
+
return t = na(t, !n), n && !ra(t) ? `/${t}` : t.length > 0 ? t : ".";
|
|
2747
|
+
};
|
|
2748
|
+
function na(e, t) {
|
|
2749
|
+
let n = "", r = 0, i = -1, a = 0, o = null;
|
|
2750
|
+
for (let s = 0; s <= e.length; ++s) {
|
|
2751
|
+
if (s < e.length) o = e[s];
|
|
2752
|
+
else if (o === "/") break;
|
|
2753
|
+
else o = "/";
|
|
2754
|
+
if (o === "/") {
|
|
2755
|
+
if (i !== s - 1 && a !== 1) {
|
|
2756
|
+
if (a === 2) {
|
|
2757
|
+
if (n.length < 2 || r !== 2 || n[n.length - 1] !== "." || n[n.length - 2] !== ".") {
|
|
2758
|
+
if (n.length > 2) {
|
|
2759
|
+
let e = n.lastIndexOf("/");
|
|
2760
|
+
e === -1 ? (n = "", r = 0) : (n = n.slice(0, e), r = n.length - 1 - n.lastIndexOf("/")), i = s, a = 0;
|
|
2761
|
+
continue;
|
|
2762
|
+
}
|
|
2763
|
+
if (n.length > 0) {
|
|
2764
|
+
n = "", r = 0, i = s, a = 0;
|
|
2765
|
+
continue;
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
t && (n += n.length > 0 ? "/.." : "..", r = 2);
|
|
2769
|
+
} else n.length > 0 ? n += `/${e.slice(i + 1, s)}` : n = e.slice(i + 1, s), r = s - i - 1;
|
|
2770
|
+
}
|
|
2771
|
+
i = s, a = 0;
|
|
2772
|
+
} else o === "." && a !== -1 ? ++a : a = -1;
|
|
2773
|
+
}
|
|
2774
|
+
return n;
|
|
2775
|
+
}
|
|
2776
|
+
var ra = function(e) {
|
|
2777
|
+
return $i.test(e);
|
|
2778
|
+
}, ia = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", aa = /* @__PURE__ */ new Uint8Array(64), oa = /* @__PURE__ */ new Uint8Array(128);
|
|
2779
|
+
for (let e = 0; e < ia.length; e++) {
|
|
2780
|
+
let t = ia.charCodeAt(e);
|
|
2781
|
+
aa[e] = t, oa[t] = e;
|
|
2782
|
+
}
|
|
2783
|
+
var sa = /^\s*at .*(?:\S:\d+|\(native\))/m, ca = /^(?:eval@)?(?:\[native code\])?$/, la = Date.now().toString().length, ua = RegExp(`vitest=\\d{${la}}`);
|
|
2784
|
+
function da(e) {
|
|
2785
|
+
if (!e.includes(":")) return [e];
|
|
2786
|
+
let t = /(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/^\(|\)$/g, ""));
|
|
2787
|
+
if (!t) return [e];
|
|
2788
|
+
let n = t[1];
|
|
2789
|
+
if (n.startsWith("async ") && (n = n.slice(6)), n.startsWith("http:") || n.startsWith("https:")) {
|
|
2790
|
+
let e = new URL(n);
|
|
2791
|
+
e.searchParams.delete("import"), e.searchParams.delete("browserv"), n = e.pathname + e.hash + e.search;
|
|
2792
|
+
}
|
|
2793
|
+
if (n.startsWith("/@fs/")) {
|
|
2794
|
+
let e = /^\/@fs\/[a-zA-Z]:\//.test(n);
|
|
2795
|
+
n = n.slice(e ? 5 : 4);
|
|
2796
|
+
}
|
|
2797
|
+
return n.includes("vitest=") && (n = n.replace(ua, "").replace(/[?&]$/, "")), [
|
|
2798
|
+
n,
|
|
2799
|
+
t[2] || void 0,
|
|
2800
|
+
t[3] || void 0
|
|
2801
|
+
];
|
|
2802
|
+
}
|
|
2803
|
+
function fa(e) {
|
|
2804
|
+
let t = e.trim();
|
|
2805
|
+
if (ca.test(t) || (t.includes(" > eval") && (t = t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1")), !t.includes("@"))) return null;
|
|
2806
|
+
let n = -1, r = "", i;
|
|
2807
|
+
for (let e = 0; e < t.length; e++) if (t[e] === "@") {
|
|
2808
|
+
let a = t.slice(e + 1);
|
|
2809
|
+
if (a.includes(":") && a.length >= 3) {
|
|
2810
|
+
n = e, r = a, i = e > 0 ? t.slice(0, e) : void 0;
|
|
2811
|
+
break;
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
if (n === -1 || !r.includes(":") || r.length < 3) return null;
|
|
2815
|
+
let [a, o, s] = da(r);
|
|
2816
|
+
return !a || !o || !s ? null : {
|
|
2817
|
+
file: a,
|
|
2818
|
+
method: i || "",
|
|
2819
|
+
line: Number.parseInt(o),
|
|
2820
|
+
column: Number.parseInt(s)
|
|
2821
|
+
};
|
|
2822
|
+
}
|
|
2823
|
+
function pa(e) {
|
|
2824
|
+
let t = e.trim();
|
|
2825
|
+
return sa.test(t) ? ma(t) : fa(t);
|
|
2826
|
+
}
|
|
2827
|
+
function ma(e) {
|
|
2828
|
+
let t = e.trim();
|
|
2829
|
+
if (!sa.test(t)) return null;
|
|
2830
|
+
t.includes("(eval ") && (t = t.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""));
|
|
2831
|
+
let n = t.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""), r = n.match(/ (\(.+\)$)/);
|
|
2832
|
+
n = r ? n.replace(r[0], "") : n;
|
|
2833
|
+
let [i, a, o] = da(r ? r[1] : n), s = r && n || "", c = i && ["eval", "<anonymous>"].includes(i) ? void 0 : i;
|
|
2834
|
+
return !c || !a || !o ? null : (s.startsWith("async ") && (s = s.slice(6)), c.startsWith("file://") && (c = c.slice(7)), c = c.startsWith("node:") || c.startsWith("internal:") ? c : ta(c), s &&= s.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, ""), {
|
|
2835
|
+
method: s,
|
|
2836
|
+
file: c,
|
|
2837
|
+
line: Number.parseInt(a),
|
|
2838
|
+
column: Number.parseInt(o)
|
|
2839
|
+
});
|
|
2840
|
+
}
|
|
2841
|
+
//#endregion
|
|
2842
|
+
//#region ../../node_modules/.pnpm/@vitest+runner@4.1.11/node_modules/@vitest/runner/dist/chunk-artifact.js
|
|
2843
|
+
var ha = class extends Error {
|
|
2844
|
+
code = "VITEST_PENDING";
|
|
2845
|
+
taskId;
|
|
2846
|
+
constructor(e, t, n) {
|
|
2847
|
+
super(e), this.message = e, this.note = n, this.taskId = t.id;
|
|
2848
|
+
}
|
|
2849
|
+
}, z = class extends Error {
|
|
2850
|
+
name = "FixtureDependencyError";
|
|
2851
|
+
}, ga = class extends Error {
|
|
2852
|
+
name = "FixtureAccessError";
|
|
2853
|
+
}, _a = class extends Error {
|
|
2854
|
+
name = "FixtureParseError";
|
|
2855
|
+
}, va = /* @__PURE__ */ new WeakMap(), ya = /* @__PURE__ */ new WeakMap(), ba = /* @__PURE__ */ new WeakMap();
|
|
2856
|
+
function xa(e, t) {
|
|
2857
|
+
va.set(e, t);
|
|
2858
|
+
}
|
|
2859
|
+
function Sa(e, t) {
|
|
2860
|
+
ya.set(e, t);
|
|
2861
|
+
}
|
|
2862
|
+
function Ca(e) {
|
|
2863
|
+
return ya.get(e);
|
|
2864
|
+
}
|
|
2865
|
+
function wa(e, t) {
|
|
2866
|
+
ba.set(e, t);
|
|
2867
|
+
}
|
|
2868
|
+
function Ta(e) {
|
|
2869
|
+
return ba.get(e);
|
|
2870
|
+
}
|
|
2871
|
+
var Ea = Symbol.for("VITEST_FIXTURE_STACK_TRACE"), Da = class e {
|
|
2872
|
+
_suiteContexts;
|
|
2873
|
+
_overrides = /* @__PURE__ */ new WeakMap();
|
|
2874
|
+
_registrations;
|
|
2875
|
+
static _definitions = [];
|
|
2876
|
+
static _builtinFixtures = [
|
|
2877
|
+
"task",
|
|
2878
|
+
"signal",
|
|
2879
|
+
"onTestFailed",
|
|
2880
|
+
"onTestFinished",
|
|
2881
|
+
"skip",
|
|
2882
|
+
"annotate"
|
|
2883
|
+
];
|
|
2884
|
+
static _fixtureOptionKeys = [
|
|
2885
|
+
"auto",
|
|
2886
|
+
"injected",
|
|
2887
|
+
"scope"
|
|
2888
|
+
];
|
|
2889
|
+
static _fixtureScopes = [
|
|
2890
|
+
"test",
|
|
2891
|
+
"file",
|
|
2892
|
+
"worker"
|
|
2893
|
+
];
|
|
2894
|
+
static _workerContextSuite = { type: "worker" };
|
|
2895
|
+
static clearDefinitions() {
|
|
2896
|
+
e._definitions.length = 0;
|
|
2897
|
+
}
|
|
2898
|
+
static getWorkerContexts() {
|
|
2899
|
+
return e._definitions.map((e) => e.getWorkerContext());
|
|
2900
|
+
}
|
|
2901
|
+
static getFileContexts(t) {
|
|
2902
|
+
return e._definitions.map((e) => e.getFileContext(t));
|
|
2903
|
+
}
|
|
2904
|
+
static isFixtureOptions(t) {
|
|
2905
|
+
return Ui(t) && Object.keys(t).some((t) => e._fixtureOptionKeys.includes(t));
|
|
2906
|
+
}
|
|
2907
|
+
constructor(t) {
|
|
2908
|
+
this._registrations = t ?? /* @__PURE__ */ new Map(), this._suiteContexts = /* @__PURE__ */ new WeakMap(), e._definitions.push(this);
|
|
2909
|
+
}
|
|
2910
|
+
extend(t, n) {
|
|
2911
|
+
let { suite: r } = q(), i = !r || r.file === r, a = this.parseUserFixtures(t, n, i);
|
|
2912
|
+
return new e(a);
|
|
2913
|
+
}
|
|
2914
|
+
get(e) {
|
|
2915
|
+
let t = e;
|
|
2916
|
+
for (; t;) {
|
|
2917
|
+
let e = this._overrides.get(t);
|
|
2918
|
+
if (e) return e;
|
|
2919
|
+
if (t === t.file) break;
|
|
2920
|
+
t = t.suite || t.file;
|
|
2921
|
+
}
|
|
2922
|
+
return this._registrations;
|
|
2923
|
+
}
|
|
2924
|
+
override(e, t) {
|
|
2925
|
+
let { suite: n, file: r } = q(), i = n || r, a = !n || n.file === n, o = new Map(this.get(i)), s = this.parseUserFixtures(e, t, a, o);
|
|
2926
|
+
a ? this._registrations = s : this._overrides.set(i, s);
|
|
2927
|
+
}
|
|
2928
|
+
getFileContext(e) {
|
|
2929
|
+
return this._suiteContexts.has(e) || this._suiteContexts.set(e, Object.create(null)), this._suiteContexts.get(e);
|
|
2930
|
+
}
|
|
2931
|
+
getWorkerContext() {
|
|
2932
|
+
return this._suiteContexts.has(e._workerContextSuite) || this._suiteContexts.set(e._workerContextSuite, Object.create(null)), this._suiteContexts.get(e._workerContextSuite);
|
|
2933
|
+
}
|
|
2934
|
+
parseUserFixtures(t, n, r, i = new Map(this._registrations)) {
|
|
2935
|
+
let a = [];
|
|
2936
|
+
Object.entries(n).forEach(([n, o]) => {
|
|
2937
|
+
let s, c, l;
|
|
2938
|
+
Array.isArray(o) && o.length >= 2 && e.isFixtureOptions(o[1]) ? (l = o[1], s = {
|
|
2939
|
+
auto: l.auto ?? !1,
|
|
2940
|
+
scope: l.scope ?? "test",
|
|
2941
|
+
injected: l.injected ?? !1
|
|
2942
|
+
}, c = s.injected ? t.injectValue?.(n) ?? o[0] : o[0]) : c = o;
|
|
2943
|
+
let u = i.get(n);
|
|
2944
|
+
u && s ? (u.scope !== s.scope && a.push(new z(`The "${n}" fixture was already registered with a "${s.scope}" scope.`)), u.auto !== s.auto && a.push(new z(`The "${n}" fixture was already registered as { auto: ${s.auto} }.`))) : u ? s = {
|
|
2945
|
+
auto: u.auto,
|
|
2946
|
+
scope: u.scope,
|
|
2947
|
+
injected: u.injected
|
|
2948
|
+
} : s ||= {
|
|
2949
|
+
auto: !1,
|
|
2950
|
+
injected: !1,
|
|
2951
|
+
scope: "test"
|
|
2952
|
+
}, s.scope && !e._fixtureScopes.includes(s.scope) && a.push(new z(`The "${n}" fixture has unknown scope "${s.scope}".`)), !r && s.scope !== "test" && a.push(new z(`The "${n}" fixture cannot be defined with a ${s.scope} scope${!l?.scope && u?.scope ? " (inherited from the base fixture)" : ""} inside the describe block. Define it at the top level of the file instead.`));
|
|
2953
|
+
let d = H(c) ? Ba(c) : /* @__PURE__ */ new Set(), f = {
|
|
2954
|
+
name: n,
|
|
2955
|
+
value: c,
|
|
2956
|
+
auto: s.auto ?? !1,
|
|
2957
|
+
injected: s.injected ?? !1,
|
|
2958
|
+
scope: s.scope ?? "test",
|
|
2959
|
+
deps: d,
|
|
2960
|
+
parent: u
|
|
2961
|
+
};
|
|
2962
|
+
H(c) && Object.assign(c, { [Ea]: /* @__PURE__ */ Error("STACK_TRACE_ERROR") }), i.set(n, f), f.scope === "worker" && (t.pool === "vmThreads" || t.pool === "vmForks") && (f.scope = "file");
|
|
2963
|
+
});
|
|
2964
|
+
for (let t of i.values()) for (let n of t.deps) {
|
|
2965
|
+
if (e._builtinFixtures.includes(n)) continue;
|
|
2966
|
+
let r = i.get(n);
|
|
2967
|
+
if (!r) {
|
|
2968
|
+
a.push(new z(`The "${t.name}" fixture depends on unknown fixture "${n}".`));
|
|
2969
|
+
continue;
|
|
2970
|
+
}
|
|
2971
|
+
if (n === t.name && !t.parent) {
|
|
2972
|
+
a.push(new z(`The "${t.name}" fixture depends on itself, but does not have a base implementation.`));
|
|
2973
|
+
continue;
|
|
2974
|
+
}
|
|
2975
|
+
if (e._fixtureScopes.indexOf(t.scope) > e._fixtureScopes.indexOf(r.scope)) {
|
|
2976
|
+
a.push(new z(`The ${t.scope} "${t.name}" fixture cannot depend on a ${r.scope} fixture "${r.name}".`));
|
|
2977
|
+
continue;
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
if (a.length === 1) throw a[0];
|
|
2981
|
+
if (a.length > 1) throw AggregateError(a, "Cannot resolve user fixtures. See errors for more information.");
|
|
2982
|
+
return i;
|
|
2983
|
+
}
|
|
2984
|
+
}, B = /* @__PURE__ */ new WeakMap(), Oa = /* @__PURE__ */ new WeakMap();
|
|
2985
|
+
function V(e, t) {
|
|
2986
|
+
let n = q(), r = t?.suite || n.suite || n.file;
|
|
2987
|
+
return async (n) => {
|
|
2988
|
+
let i = n || t?.context;
|
|
2989
|
+
if (!i) return t?.suiteHook && Fa(e, t.suiteHook, t.stackTraceError), e({});
|
|
2990
|
+
let a = t?.fixtures || Ca(i);
|
|
2991
|
+
if (!a) return e(i);
|
|
2992
|
+
let o = a.get(r);
|
|
2993
|
+
if (!o.size) return e(i);
|
|
2994
|
+
let s = [], c = Ba(e);
|
|
2995
|
+
for (let e of o.values()) (ka(e, t) || c.has(e.name)) && s.push(e);
|
|
2996
|
+
if (!s.length) return e(i);
|
|
2997
|
+
B.has(i) || B.set(i, []);
|
|
2998
|
+
let l = B.get(i), u = Pa(s, o);
|
|
2999
|
+
if (!u.length) return e(i);
|
|
3000
|
+
if (t?.suiteHook) {
|
|
3001
|
+
let e = u.filter((e) => e.scope === "test");
|
|
3002
|
+
if (e.length > 0) {
|
|
3003
|
+
let n = e.map((e) => `"${e.name}"`).join(", "), r = new z(`Test-scoped fixtures cannot be used inside ${t.suiteHook} hook. The following fixtures are test-scoped: ${n}. Use { scope: 'file' } or { scope: 'worker' } fixtures instead, or move the logic to ${{
|
|
3004
|
+
aroundAll: "aroundEach",
|
|
3005
|
+
beforeAll: "beforeEach",
|
|
3006
|
+
afterAll: "afterEach"
|
|
3007
|
+
}[t.suiteHook]} hook.`);
|
|
3008
|
+
throw t.stackTraceError?.stack && (r.stack = r.message + t.stackTraceError.stack.replace(t.stackTraceError.message, "")), r;
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
Oa.has(i) || Oa.set(i, /* @__PURE__ */ new WeakSet());
|
|
3012
|
+
let d = Oa.get(i);
|
|
3013
|
+
for (let e of u) if (e.scope === "test") {
|
|
3014
|
+
if (d.has(e)) continue;
|
|
3015
|
+
d.add(e);
|
|
3016
|
+
let t = await Aa(e, i, l);
|
|
3017
|
+
i[e.name] = t, l.push(() => {
|
|
3018
|
+
d.delete(e);
|
|
3019
|
+
});
|
|
3020
|
+
} else {
|
|
3021
|
+
let t = await Ma(a, r, e);
|
|
3022
|
+
i[e.name] = t;
|
|
3023
|
+
}
|
|
3024
|
+
return e(i);
|
|
3025
|
+
};
|
|
3026
|
+
}
|
|
3027
|
+
function ka(e, t) {
|
|
3028
|
+
return !(!e.auto || t?.suiteHook && e.scope === "test");
|
|
3029
|
+
}
|
|
3030
|
+
function H(e) {
|
|
3031
|
+
return typeof e == "function";
|
|
3032
|
+
}
|
|
3033
|
+
function Aa(e, t, n) {
|
|
3034
|
+
return H(e.value) ? Na(e.value, e.name, t, n) : e.value;
|
|
3035
|
+
}
|
|
3036
|
+
var ja = /* @__PURE__ */ new WeakMap();
|
|
3037
|
+
async function Ma(e, t, n) {
|
|
3038
|
+
let r = e.getWorkerContext(), i = e.getFileContext(t.file), a = n.scope === "worker" ? r : i;
|
|
3039
|
+
if (!H(n.value)) return a[n.name] = n.value, n.value;
|
|
3040
|
+
if (n.name in a) return a[n.name];
|
|
3041
|
+
if (ja.has(n)) return ja.get(n);
|
|
3042
|
+
B.has(a) || B.set(a, []);
|
|
3043
|
+
let o = B.get(a), s = Na(n.value, n.name, n.scope === "file" ? {
|
|
3044
|
+
...r,
|
|
3045
|
+
...i
|
|
3046
|
+
} : a, o).then((e) => (a[n.name] = e, ja.delete(n), e));
|
|
3047
|
+
return ja.set(n, s), s;
|
|
3048
|
+
}
|
|
3049
|
+
async function Na(e, t, n, r) {
|
|
3050
|
+
let i = Gi(), a = Ea in e && e[Ea] instanceof Error ? e[Ea] : void 0, o = !1, s = e(n, async (e) => {
|
|
3051
|
+
o = !0, i.resolve(e);
|
|
3052
|
+
let t = Gi();
|
|
3053
|
+
r.push(async () => {
|
|
3054
|
+
t.resolve(), await s;
|
|
3055
|
+
}), await t;
|
|
3056
|
+
}).then(() => {
|
|
3057
|
+
if (!o) {
|
|
3058
|
+
let e = /* @__PURE__ */ Error(`Fixture "${t}" returned without calling "use". Make sure to call "use" in every code path of the fixture function.`);
|
|
3059
|
+
a?.stack && (e.stack = e.message + a.stack.replace(a.message, "")), i.reject(e);
|
|
3060
|
+
}
|
|
3061
|
+
}).catch((e) => {
|
|
3062
|
+
if (!o) {
|
|
3063
|
+
i.reject(e);
|
|
3064
|
+
return;
|
|
3065
|
+
}
|
|
3066
|
+
throw e;
|
|
3067
|
+
});
|
|
3068
|
+
return i;
|
|
3069
|
+
}
|
|
3070
|
+
function Pa(e, t, n = /* @__PURE__ */ new Set(), r = []) {
|
|
3071
|
+
return e.forEach((e) => {
|
|
3072
|
+
if (!r.includes(e)) {
|
|
3073
|
+
if (!H(e.value) || !e.deps) {
|
|
3074
|
+
r.push(e);
|
|
3075
|
+
return;
|
|
3076
|
+
}
|
|
3077
|
+
if (n.has(e)) {
|
|
3078
|
+
if (e.parent) e = e.parent;
|
|
3079
|
+
else throw Error(`Circular fixture dependency detected: ${e.name} <- ${[...n].reverse().map((e) => e.name).join(" <- ")}`);
|
|
3080
|
+
}
|
|
3081
|
+
n.add(e), Pa([...e.deps].map((n) => n === e.name ? e.parent : t.get(n)).filter((e) => !!e), t, n, r), r.push(e), n.clear();
|
|
3082
|
+
}
|
|
3083
|
+
}), r;
|
|
3084
|
+
}
|
|
3085
|
+
function Fa(e, t, n) {
|
|
3086
|
+
let r = Ba(e, {
|
|
3087
|
+
sourceError: n,
|
|
3088
|
+
suiteHook: t
|
|
3089
|
+
});
|
|
3090
|
+
if (r.size) {
|
|
3091
|
+
let e = new ga(`The ${t} hook uses fixtures "${[...r].join("\", \"")}", but has no access to context. Did you forget to call it as "test.${t}()" instead of "${t}()"?\nIf you used internal "suite" task as the first argument previously, access it in the second argument instead. See https://vitest.dev/guide/test-context#suite-level-hooks`);
|
|
3092
|
+
throw n && (e.stack = n.stack?.replace(n.message, e.message)), e;
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
var Ia = Symbol("$vitest:fixture-props"), La = Symbol("$vitest:fixture-prop-names");
|
|
3096
|
+
function Ra(e, t) {
|
|
3097
|
+
Object.defineProperty(e, Ia, {
|
|
3098
|
+
value: t,
|
|
3099
|
+
enumerable: !1
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
function za(e, t) {
|
|
3103
|
+
return e[La] = t, t;
|
|
3104
|
+
}
|
|
3105
|
+
function Ba(e, { sourceError: t, suiteHook: n } = {}) {
|
|
3106
|
+
if (La in e) return e[La];
|
|
3107
|
+
let { index: r = 0, original: i = e } = Ia in e ? e[Ia] : {}, a = Vi(i.toString());
|
|
3108
|
+
/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(a) && (a = a.split(/__async\((?:this|null),/)[1]);
|
|
3109
|
+
let o = a.match(/[^(]*\(([^)]*)/);
|
|
3110
|
+
if (!o) return za(e, /* @__PURE__ */ new Set());
|
|
3111
|
+
let s = Va(o[1]);
|
|
3112
|
+
if (!s.length) return za(e, /* @__PURE__ */ new Set());
|
|
3113
|
+
let c = s[r];
|
|
3114
|
+
if (!c) return za(e, /* @__PURE__ */ new Set());
|
|
3115
|
+
if (!(c[0] === "{" && c.endsWith("}"))) {
|
|
3116
|
+
let e = qi(r + 1), i = new _a(`The ${e} argument inside a fixture must use object destructuring pattern, e.g. ({ task } => {}). Instead, received "${c}".${n ? ` If you used internal "suite" task as the ${e} argument previously, access it in the ${qi(r + 2)} argument instead.` : ""}`);
|
|
3117
|
+
throw t && (i.stack = t.stack?.replace(t.message, i.message)), i;
|
|
3118
|
+
}
|
|
3119
|
+
let l = Va(c.slice(1, -1).replace(/\s/g, "")).map((e) => e.replace(/:.*|=.*/g, "")), u = l.at(-1);
|
|
3120
|
+
if (u && u.startsWith("...")) {
|
|
3121
|
+
let e = new _a(`Rest parameters are not supported in fixtures, received "${u}".`);
|
|
3122
|
+
throw t && (e.stack = t.stack?.replace(t.message, e.message)), e;
|
|
3123
|
+
}
|
|
3124
|
+
return za(e, new Set(l));
|
|
3125
|
+
}
|
|
3126
|
+
function Va(e) {
|
|
3127
|
+
let t = [], n = [], r = 0;
|
|
3128
|
+
for (let i = 0; i < e.length; i++) if (e[i] === "{" || e[i] === "[") n.push(e[i] === "{" ? "}" : "]");
|
|
3129
|
+
else if (e[i] === n.at(-1)) n.pop();
|
|
3130
|
+
else if (!n.length && e[i] === ",") {
|
|
3131
|
+
let n = e.substring(r, i).trim();
|
|
3132
|
+
n && t.push(n), r = i + 1;
|
|
3133
|
+
}
|
|
3134
|
+
let i = e.substring(r).trim();
|
|
3135
|
+
return i && t.push(i), t;
|
|
3136
|
+
}
|
|
3137
|
+
var Ha = Symbol("kChainableContext");
|
|
3138
|
+
function U(e) {
|
|
3139
|
+
return e?.[Ha];
|
|
3140
|
+
}
|
|
3141
|
+
function Ua(e, t, n) {
|
|
3142
|
+
function r(n) {
|
|
3143
|
+
let i = function(...e) {
|
|
3144
|
+
return t.apply(n, e);
|
|
3145
|
+
};
|
|
3146
|
+
Object.assign(i, t), Object.defineProperty(i, Ha, {
|
|
3147
|
+
value: {
|
|
3148
|
+
withContext: () => i.bind(n),
|
|
3149
|
+
getFixtures: () => n.fixtures,
|
|
3150
|
+
setContext: (e, t) => {
|
|
3151
|
+
n[e] = t;
|
|
3152
|
+
},
|
|
3153
|
+
mergeContext: (e) => {
|
|
3154
|
+
Object.assign(n, e);
|
|
3155
|
+
}
|
|
3156
|
+
},
|
|
3157
|
+
enumerable: !1
|
|
3158
|
+
});
|
|
3159
|
+
for (let t of e) Object.defineProperty(i, t, { get() {
|
|
3160
|
+
return r({
|
|
3161
|
+
...n,
|
|
3162
|
+
[t]: !0
|
|
3163
|
+
});
|
|
3164
|
+
} });
|
|
3165
|
+
return i;
|
|
3166
|
+
}
|
|
3167
|
+
let i = r(n ?? {});
|
|
3168
|
+
return Object.defineProperty(i, "fn", {
|
|
3169
|
+
value: t,
|
|
3170
|
+
enumerable: !1
|
|
3171
|
+
}), i;
|
|
3172
|
+
}
|
|
3173
|
+
function W() {
|
|
3174
|
+
return co().config.hookTimeout;
|
|
3175
|
+
}
|
|
3176
|
+
var Wa = Symbol.for("VITEST_CLEANUP_TIMEOUT"), Ga = Symbol.for("VITEST_CLEANUP_STACK_TRACE"), Ka = Symbol.for("VITEST_AROUND_TIMEOUT"), qa = Symbol.for("VITEST_AROUND_STACK_TRACE");
|
|
3177
|
+
function Ja(e, t = W()) {
|
|
3178
|
+
R(e, "\"beforeAll\" callback", ["function"]);
|
|
3179
|
+
let n = /* @__PURE__ */ Error("STACK_TRACE_ERROR"), r = U(this);
|
|
3180
|
+
return q().on("beforeAll", Object.assign(Q(eo("beforeAll", e, r, n), t, !0, n), {
|
|
3181
|
+
[Wa]: t,
|
|
3182
|
+
[Ga]: n
|
|
3183
|
+
}));
|
|
3184
|
+
}
|
|
3185
|
+
function Ya(e, t) {
|
|
3186
|
+
R(e, "\"afterAll\" callback", ["function"]);
|
|
3187
|
+
let n = U(this), r = /* @__PURE__ */ Error("STACK_TRACE_ERROR");
|
|
3188
|
+
return q().on("afterAll", Q(eo("afterAll", e, n, r), t ?? W(), !0, r));
|
|
3189
|
+
}
|
|
3190
|
+
function Xa(e, t = W()) {
|
|
3191
|
+
R(e, "\"beforeEach\" callback", ["function"]);
|
|
3192
|
+
let n = /* @__PURE__ */ Error("STACK_TRACE_ERROR");
|
|
3193
|
+
return q().on("beforeEach", Object.assign(Q((t, n) => V(e, { suite: n })(t), t ?? W(), !0, n, wo), {
|
|
3194
|
+
[Wa]: t,
|
|
3195
|
+
[Ga]: n
|
|
3196
|
+
}));
|
|
3197
|
+
}
|
|
3198
|
+
function Za(e, t) {
|
|
3199
|
+
return R(e, "\"afterEach\" callback", ["function"]), q().on("afterEach", Q((t, n) => V(e, { suite: n })(t), t ?? W(), !0, /* @__PURE__ */ Error("STACK_TRACE_ERROR"), wo));
|
|
3200
|
+
}
|
|
3201
|
+
function Qa(e, t) {
|
|
3202
|
+
R(e, "\"aroundAll\" callback", ["function"]);
|
|
3203
|
+
let n = /* @__PURE__ */ Error("STACK_TRACE_ERROR"), r = t ?? W(), i = U(this);
|
|
3204
|
+
return q().on("aroundAll", Object.assign(eo("aroundAll", e, i, n, 1), {
|
|
3205
|
+
[Ka]: r,
|
|
3206
|
+
[qa]: n
|
|
3207
|
+
}));
|
|
3208
|
+
}
|
|
3209
|
+
function $a(e, t) {
|
|
3210
|
+
R(e, "\"aroundEach\" callback", ["function"]);
|
|
3211
|
+
let n = /* @__PURE__ */ Error("STACK_TRACE_ERROR"), r = t ?? W();
|
|
3212
|
+
return q().on("aroundEach", Object.assign((t, n, r) => {
|
|
3213
|
+
let i = (n) => e(t, n, r);
|
|
3214
|
+
return Ra(i, {
|
|
3215
|
+
index: 1,
|
|
3216
|
+
original: e
|
|
3217
|
+
}), V(i, { suite: r })(n);
|
|
3218
|
+
}, {
|
|
3219
|
+
[Ka]: r,
|
|
3220
|
+
[qa]: n
|
|
3221
|
+
}));
|
|
3222
|
+
}
|
|
3223
|
+
function eo(e, t, n, r, i = 0) {
|
|
3224
|
+
return (...a) => {
|
|
3225
|
+
let o = a.at(-1), s = a.slice(0, -1), c = (e) => t(...s, e, o);
|
|
3226
|
+
Ra(c, {
|
|
3227
|
+
index: i,
|
|
3228
|
+
original: t
|
|
3229
|
+
});
|
|
3230
|
+
let l = n?.getFixtures(), u = l?.getFileContext(o.file);
|
|
3231
|
+
return V(c, {
|
|
3232
|
+
suiteHook: e,
|
|
3233
|
+
fixtures: l,
|
|
3234
|
+
context: u,
|
|
3235
|
+
stackTraceError: r
|
|
3236
|
+
})();
|
|
3237
|
+
};
|
|
3238
|
+
}
|
|
3239
|
+
function to(e, t) {
|
|
3240
|
+
let n = t.split("\n").slice(1);
|
|
3241
|
+
for (let t of n) {
|
|
3242
|
+
let n = pa(t);
|
|
3243
|
+
if (n && n.file === e) return n;
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
function no(e, t) {
|
|
3247
|
+
if (!e.strictTags) return;
|
|
3248
|
+
let n = new Set(e.tags.map((e) => e.name));
|
|
3249
|
+
for (let r of t) if (!n.has(r)) throw ro(e.tags, r);
|
|
3250
|
+
}
|
|
3251
|
+
function ro(e, t, n = "tag") {
|
|
3252
|
+
throw e.length ? Error(`The ${n} "${t}" is not defined in the configuration. Available tags are:\n${e.map((e) => `- ${e.name}${e.description ? `: ${e.description}` : ""}`).join("\n")}`) : Error(`The Vitest config does't define any "tags", cannot apply "${t}" ${n} for this test. See: https://vitest.dev/guide/test-tags`);
|
|
3253
|
+
}
|
|
3254
|
+
function io(e, t = " > ") {
|
|
3255
|
+
return e.filter((e) => e !== void 0).join(t);
|
|
3256
|
+
}
|
|
3257
|
+
var G = mo();
|
|
3258
|
+
go(function(e, t, n) {
|
|
3259
|
+
q().test.fn.call(this, Y(e), t, n);
|
|
3260
|
+
});
|
|
3261
|
+
var K, ao, oo;
|
|
3262
|
+
function so(e, t) {
|
|
3263
|
+
if (!e) throw Error(`Vitest failed to find ${t}. One of the following is possible:
|
|
3264
|
+
- "vitest" is imported directly without running "vitest" command
|
|
3265
|
+
- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)
|
|
3266
|
+
- "vitest" is imported inside Vite / Vitest config file
|
|
3267
|
+
- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues
|
|
3268
|
+
`);
|
|
3269
|
+
}
|
|
3270
|
+
function co() {
|
|
3271
|
+
so(K, "the runner");
|
|
3272
|
+
}
|
|
3273
|
+
function q() {
|
|
3274
|
+
let e = Z.currentSuite || ao;
|
|
3275
|
+
return so(e, "the current suite"), e;
|
|
3276
|
+
}
|
|
3277
|
+
function lo() {
|
|
3278
|
+
return {
|
|
3279
|
+
beforeAll: [],
|
|
3280
|
+
afterAll: [],
|
|
3281
|
+
beforeEach: [],
|
|
3282
|
+
afterEach: [],
|
|
3283
|
+
aroundEach: [],
|
|
3284
|
+
aroundAll: []
|
|
3285
|
+
};
|
|
3286
|
+
}
|
|
3287
|
+
var uo = Infinity;
|
|
3288
|
+
function J(e, t) {
|
|
3289
|
+
if (typeof t == "object" && t) throw TypeError("Signature \"test(name, fn, { ... })\" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.");
|
|
3290
|
+
let n = {}, r;
|
|
3291
|
+
if (typeof t == "number" ? n = { timeout: t } : typeof e == "object" && (n = e), typeof e == "function") {
|
|
3292
|
+
if (typeof t == "function") throw TypeError("Cannot use two functions as arguments. Please use the second argument for options.");
|
|
3293
|
+
r = e;
|
|
3294
|
+
} else typeof t == "function" && (r = t);
|
|
3295
|
+
return {
|
|
3296
|
+
options: n,
|
|
3297
|
+
handler: r
|
|
3298
|
+
};
|
|
3299
|
+
}
|
|
3300
|
+
function fo(e, t = () => {}, n, r, i) {
|
|
3301
|
+
let a = [], o;
|
|
3302
|
+
d(!0);
|
|
3303
|
+
let s = function(e = "", t = {}) {
|
|
3304
|
+
let n = Z.currentSuite?.suite, r = Ji([...(n ?? Z.currentSuite?.file)?.tags || [], ...Hi(t.tags)]), o = r.map((e) => {
|
|
3305
|
+
let t = K.config.tags?.find((t) => t.name === e);
|
|
3306
|
+
if (!t && K.config.strictTags) throw ro(K.config.tags, e);
|
|
3307
|
+
return t;
|
|
3308
|
+
}).filter((e) => e != null).sort((e, t) => (t.priority ?? uo) - (e.priority ?? uo)).reduce((e, t) => {
|
|
3309
|
+
let { name: n, description: r, priority: i, meta: a, ...o } = t;
|
|
3310
|
+
return Object.assign(e, o), a && (e.meta = Object.assign(e.meta ?? Object.create(null), a)), e;
|
|
3311
|
+
}, {}), s = t.meta;
|
|
3312
|
+
t = {
|
|
3313
|
+
...o,
|
|
3314
|
+
...t
|
|
3315
|
+
};
|
|
3316
|
+
let c = t.timeout ?? K.config.testTimeout, l = n?.meta, u = o.meta, d = Object.create(null);
|
|
3317
|
+
u && Object.assign(d, u), l && Object.assign(d, l), s && Object.assign(d, s);
|
|
3318
|
+
let f = {
|
|
3319
|
+
id: "",
|
|
3320
|
+
name: e,
|
|
3321
|
+
fullName: io([n?.fullName ?? Z.currentSuite?.file?.fullName, e]),
|
|
3322
|
+
fullTestName: io([n?.fullTestName, e]),
|
|
3323
|
+
suite: n,
|
|
3324
|
+
each: t.each,
|
|
3325
|
+
fails: t.fails,
|
|
3326
|
+
context: void 0,
|
|
3327
|
+
type: "test",
|
|
3328
|
+
file: n?.file ?? Z.currentSuite?.file,
|
|
3329
|
+
timeout: c,
|
|
3330
|
+
retry: t.retry ?? K.config.retry,
|
|
3331
|
+
repeats: t.repeats,
|
|
3332
|
+
mode: t.only ? "only" : t.skip ? "skip" : t.todo ? "todo" : "run",
|
|
3333
|
+
meta: d,
|
|
3334
|
+
annotations: [],
|
|
3335
|
+
artifacts: [],
|
|
3336
|
+
tags: r
|
|
3337
|
+
}, p = t.handler;
|
|
3338
|
+
f.mode === "run" && !p && (f.mode = "todo"), (t.concurrent ?? (!t.sequential && K.config.sequence.concurrent)) && (f.concurrent = !0), f.shuffle = i?.shuffle;
|
|
3339
|
+
let m = Eo(f, K);
|
|
3340
|
+
Object.defineProperty(f, "context", {
|
|
3341
|
+
value: m,
|
|
3342
|
+
enumerable: !1
|
|
3343
|
+
}), Sa(m, t.fixtures ?? new Da());
|
|
3344
|
+
let h = Error.stackTraceLimit;
|
|
3345
|
+
Error.stackTraceLimit = 10;
|
|
3346
|
+
let ee = /* @__PURE__ */ Error("STACK_TRACE_ERROR");
|
|
3347
|
+
if (Error.stackTraceLimit = h, p && xa(f, Q(So(po(V(p, { context: m }), f), f.context.signal), c, !1, ee, (e, t) => wo([m], t))), K.config.includeTaskLocation) {
|
|
3348
|
+
let e = ee.stack, t = to(oo, e);
|
|
3349
|
+
t && (f.location = {
|
|
3350
|
+
line: t.line,
|
|
3351
|
+
column: t.column
|
|
3352
|
+
});
|
|
3353
|
+
}
|
|
3354
|
+
return a.push(f), f;
|
|
3355
|
+
}, c = go(function(e, t, n) {
|
|
3356
|
+
let { options: r, handler: a } = J(t, n);
|
|
3357
|
+
typeof i == "object" && (r = Object.assign({}, i, r));
|
|
3358
|
+
let o = this.concurrent ?? (!this.sequential && r?.concurrent);
|
|
3359
|
+
r.concurrent != null && o != null && (r.concurrent = o);
|
|
3360
|
+
let c = this.sequential ?? (!this.concurrent && r?.sequential);
|
|
3361
|
+
r.sequential != null && c != null && (r.sequential = c);
|
|
3362
|
+
let l = s(Y(e), {
|
|
3363
|
+
...this,
|
|
3364
|
+
...r,
|
|
3365
|
+
handler: a
|
|
3366
|
+
});
|
|
3367
|
+
l.type = "test";
|
|
3368
|
+
}), l = {
|
|
3369
|
+
type: "collector",
|
|
3370
|
+
name: e,
|
|
3371
|
+
mode: n,
|
|
3372
|
+
suite: o,
|
|
3373
|
+
options: i,
|
|
3374
|
+
test: c,
|
|
3375
|
+
file: o.file,
|
|
3376
|
+
tasks: a,
|
|
3377
|
+
collect: p,
|
|
3378
|
+
task: s,
|
|
3379
|
+
clear: f,
|
|
3380
|
+
on: u
|
|
3381
|
+
};
|
|
3382
|
+
function u(e, ...t) {
|
|
3383
|
+
Ta(o)[e].push(...t);
|
|
3384
|
+
}
|
|
3385
|
+
function d(t) {
|
|
3386
|
+
typeof i == "number" && (i = { timeout: i });
|
|
3387
|
+
let a = Z.currentSuite?.suite, s = a ?? Z.currentSuite?.file, c = Hi(i?.tags);
|
|
3388
|
+
no(K.config, c), o = {
|
|
3389
|
+
id: "",
|
|
3390
|
+
type: "suite",
|
|
3391
|
+
name: e,
|
|
3392
|
+
fullName: io([a?.fullName ?? Z.currentSuite?.file?.fullName, e]),
|
|
3393
|
+
fullTestName: io([a?.fullTestName, e]),
|
|
3394
|
+
suite: a,
|
|
3395
|
+
mode: n,
|
|
3396
|
+
each: r,
|
|
3397
|
+
file: a?.file ?? Z.currentSuite?.file,
|
|
3398
|
+
shuffle: i?.shuffle,
|
|
3399
|
+
tasks: [],
|
|
3400
|
+
meta: i?.meta ?? Object.create(null),
|
|
3401
|
+
concurrent: i?.concurrent,
|
|
3402
|
+
tags: Ji([...s?.tags || [], ...c])
|
|
3403
|
+
}, wa(o, lo());
|
|
3404
|
+
}
|
|
3405
|
+
function f() {
|
|
3406
|
+
a.length = 0, d(!1);
|
|
3407
|
+
}
|
|
3408
|
+
async function p(e) {
|
|
3409
|
+
if (!e) throw TypeError("File is required to collect tasks.");
|
|
3410
|
+
t && await xo(l, () => t(c));
|
|
3411
|
+
let n = [];
|
|
3412
|
+
for (let t of a) n.push(t.type === "collector" ? await t.collect(e) : t);
|
|
3413
|
+
return o.tasks = n, o;
|
|
3414
|
+
}
|
|
3415
|
+
return bo(l), l;
|
|
3416
|
+
}
|
|
3417
|
+
function po(e, t) {
|
|
3418
|
+
return (async (...n) => {
|
|
3419
|
+
let r = await e(...n);
|
|
3420
|
+
if (t.promises) {
|
|
3421
|
+
let e = (await Promise.allSettled(t.promises)).map((e) => e.status === "rejected" ? e.reason : void 0).filter(Boolean);
|
|
3422
|
+
if (e.length) throw e;
|
|
3423
|
+
}
|
|
3424
|
+
return r;
|
|
3425
|
+
});
|
|
3426
|
+
}
|
|
3427
|
+
function mo() {
|
|
3428
|
+
function e(e, t, n) {
|
|
3429
|
+
let r = Z.currentSuite || ao, { options: i, handler: a } = J(t, n), o = i.concurrent || this.concurrent || i.sequential === !1, s = i.sequential || this.sequential || i.concurrent === !1, { meta: c, ...l } = r?.options || {};
|
|
3430
|
+
i = {
|
|
3431
|
+
...l,
|
|
3432
|
+
...i
|
|
3433
|
+
};
|
|
3434
|
+
let u = this.shuffle ?? i.shuffle ?? r?.options?.shuffle ?? void 0;
|
|
3435
|
+
u != null && (i.shuffle = u);
|
|
3436
|
+
let d = this.only ?? i.only ? "only" : this.skip ?? i.skip ? "skip" : this.todo ?? i.todo ? "todo" : "run";
|
|
3437
|
+
d === "run" && !a && (d = "todo");
|
|
3438
|
+
let f = o || i.concurrent && !s, p = s || i.sequential && !o;
|
|
3439
|
+
return f != null && (i.concurrent = f && !p), p != null && (i.sequential = p && !f), c && (i.meta = Object.assign(Object.create(null), c, i.meta)), fo(Y(e), a, d, this.each, i);
|
|
3440
|
+
}
|
|
3441
|
+
return e.each = function(e, ...t) {
|
|
3442
|
+
let n = U(this), r = n.withContext();
|
|
3443
|
+
return n.setContext("each", !0), Array.isArray(e) && t.length && (e = vo(e, t)), (t, i, a) => {
|
|
3444
|
+
let o = Y(t), s = e.every(Array.isArray), { options: c, handler: l } = J(i, a), u = typeof i == "function";
|
|
3445
|
+
e.forEach((e, t) => {
|
|
3446
|
+
let n = Array.isArray(e) ? e : [e];
|
|
3447
|
+
u ? s ? r(X(o, n, t), l ? () => l(...n) : void 0, c.timeout) : r(X(o, n, t), l ? () => l(e) : void 0, c.timeout) : s ? r(X(o, n, t), c, l ? () => l(...n) : void 0) : r(X(o, n, t), c, l ? () => l(e) : void 0);
|
|
3448
|
+
}), n.setContext("each", void 0);
|
|
3449
|
+
};
|
|
3450
|
+
}, e.for = function(e, ...t) {
|
|
3451
|
+
return Array.isArray(e) && t.length && (e = vo(e, t)), (t, n, r) => {
|
|
3452
|
+
let i = Y(t), { options: a, handler: o } = J(n, r);
|
|
3453
|
+
e.forEach((e, t) => {
|
|
3454
|
+
G(X(i, Hi(e), t), a, o ? () => o(e) : void 0);
|
|
3455
|
+
});
|
|
3456
|
+
};
|
|
3457
|
+
}, e.skipIf = (e) => e ? G.skip : G, e.runIf = (e) => e ? G : G.skip, Ua([
|
|
3458
|
+
"concurrent",
|
|
3459
|
+
"sequential",
|
|
3460
|
+
"shuffle",
|
|
3461
|
+
"skip",
|
|
3462
|
+
"only",
|
|
3463
|
+
"todo"
|
|
3464
|
+
], e);
|
|
3465
|
+
}
|
|
3466
|
+
function ho(e) {
|
|
3467
|
+
let t = e;
|
|
3468
|
+
t.each = function(e, ...t) {
|
|
3469
|
+
let n = U(this), r = n.withContext();
|
|
3470
|
+
return n.setContext("each", !0), Array.isArray(e) && t.length && (e = vo(e, t)), (t, i, a) => {
|
|
3471
|
+
let o = Y(t), s = e.every(Array.isArray), { options: c, handler: l } = J(i, a), u = typeof i == "function";
|
|
3472
|
+
e.forEach((e, t) => {
|
|
3473
|
+
let n = Array.isArray(e) ? e : [e];
|
|
3474
|
+
u ? s ? r(X(o, n, t), l ? () => l(...n) : void 0, c.timeout) : r(X(o, n, t), l ? () => l(e) : void 0, c.timeout) : s ? r(X(o, n, t), c, l ? () => l(...n) : void 0) : r(X(o, n, t), c, l ? () => l(e) : void 0);
|
|
3475
|
+
}), n.setContext("each", void 0);
|
|
3476
|
+
};
|
|
3477
|
+
}, t.for = function(e, ...t) {
|
|
3478
|
+
let n = U(this).withContext();
|
|
3479
|
+
return Array.isArray(e) && t.length && (e = vo(e, t)), (t, r, i) => {
|
|
3480
|
+
let a = Y(t), { options: o, handler: s } = J(r, i);
|
|
3481
|
+
e.forEach((e, t) => {
|
|
3482
|
+
let r = s ? (t) => s(e, t) : void 0;
|
|
3483
|
+
r && Ra(r, {
|
|
3484
|
+
index: 1,
|
|
3485
|
+
original: s
|
|
3486
|
+
}), n(X(a, Hi(e), t), o, r);
|
|
3487
|
+
});
|
|
3488
|
+
};
|
|
3489
|
+
}, t.skipIf = function(e) {
|
|
3490
|
+
return e ? this.skip : this;
|
|
3491
|
+
}, t.runIf = function(e) {
|
|
3492
|
+
return e ? this : this.skip;
|
|
3493
|
+
};
|
|
3494
|
+
function n(e, t, n) {
|
|
3495
|
+
if (typeof e != "string") return e;
|
|
3496
|
+
let r = e, i, a;
|
|
3497
|
+
if (n === void 0 ? typeof t == "object" && t && !Array.isArray(t) && Da.isFixtureOptions(t) ? (i = t, a = {}) : (i = void 0, a = t) : (i = t, a = n), typeof a == "function") {
|
|
3498
|
+
let e = a, t = async (t, n) => {
|
|
3499
|
+
let r;
|
|
3500
|
+
await n(await e(t, { onCleanup: (e) => {
|
|
3501
|
+
if (r !== void 0) throw Error("onCleanup can only be called once per fixture. Define separate fixtures if you need multiple cleanup functions.");
|
|
3502
|
+
r = e;
|
|
3503
|
+
} })), r && await r();
|
|
3504
|
+
};
|
|
3505
|
+
return Ra(t, { original: e }), i ? { [r]: [t, i] } : { [r]: t };
|
|
3506
|
+
}
|
|
3507
|
+
return i ? { [r]: [a, i] } : { [r]: a };
|
|
3508
|
+
}
|
|
3509
|
+
return t.override = function(e, t, r) {
|
|
3510
|
+
let i = n(e, t, r);
|
|
3511
|
+
return U(this).getFixtures().override(K, i), this;
|
|
3512
|
+
}, t.scoped = function(e) {
|
|
3513
|
+
return console.warn("test.scoped() is deprecated and will be removed in future versions. Please use test.override() instead."), this.override(e);
|
|
3514
|
+
}, t.extend = function(t, r, i) {
|
|
3515
|
+
let a = n(t, r, i), o = U(this).getFixtures().extend(K, a), s = go(function(t, n, r) {
|
|
3516
|
+
e.call(this, Y(t), n, r);
|
|
3517
|
+
});
|
|
3518
|
+
return U(s).mergeContext({ fixtures: o }), s;
|
|
3519
|
+
}, t.describe = G, t.suite = G, t.beforeEach = Xa, t.afterEach = Za, t.beforeAll = Ja, t.afterAll = Ya, t.aroundEach = $a, t.aroundAll = Qa, Ua([
|
|
3520
|
+
"concurrent",
|
|
3521
|
+
"sequential",
|
|
3522
|
+
"skip",
|
|
3523
|
+
"only",
|
|
3524
|
+
"todo",
|
|
3525
|
+
"fails"
|
|
3526
|
+
], t, { fixtures: new Da() });
|
|
3527
|
+
}
|
|
3528
|
+
function go(e) {
|
|
3529
|
+
return ho(e);
|
|
3530
|
+
}
|
|
3531
|
+
function Y(e) {
|
|
3532
|
+
return typeof e == "string" ? e : typeof e == "function" ? e.name || "<anonymous>" : String(e);
|
|
3533
|
+
}
|
|
3534
|
+
function X(e, t, n) {
|
|
3535
|
+
(e.includes("%#") || e.includes("%$")) && (e = e.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${n}`).replace(/%\$/g, `${n + 1}`).replace(/__vitest_escaped_%__/g, "%%"));
|
|
3536
|
+
let r = e.split("%").length - 1;
|
|
3537
|
+
e.includes("%f") && (e.match(/%f/g) || []).forEach((n, r) => {
|
|
3538
|
+
if (Ki(t[r]) || Object.is(t[r], -0)) {
|
|
3539
|
+
let t = 0;
|
|
3540
|
+
e = e.replace(/%f/g, (e) => (t++, t === r + 1 ? "-%f" : e));
|
|
3541
|
+
}
|
|
3542
|
+
});
|
|
3543
|
+
let i = Ui(t[0]);
|
|
3544
|
+
function a(e) {
|
|
3545
|
+
return e.replace(/\$([$\w.]+)/g, (e, n) => {
|
|
3546
|
+
let r = /^\d+$/.test(n);
|
|
3547
|
+
if (!i && !r) return `$${n}`;
|
|
3548
|
+
let a = r ? Wi(t, n) : void 0;
|
|
3549
|
+
return Bi(i ? Wi(t[0], n, a) : a, { truncate: void 0 });
|
|
3550
|
+
});
|
|
3551
|
+
}
|
|
3552
|
+
let o = "", s = 0;
|
|
3553
|
+
return _o(e, Ii, (e) => {
|
|
3554
|
+
o += s < r ? Ri(e[0], t[s++]) : e[0];
|
|
3555
|
+
}, (e) => {
|
|
3556
|
+
o += a(e);
|
|
3557
|
+
}), o;
|
|
3558
|
+
}
|
|
3559
|
+
function _o(e, t, n, r) {
|
|
3560
|
+
let i = 0;
|
|
3561
|
+
for (let a of e.matchAll(t)) i < a.index && r(e.slice(i, a.index)), n(a), i = a.index + a[0].length;
|
|
3562
|
+
i < e.length && r(e.slice(i));
|
|
3563
|
+
}
|
|
3564
|
+
function vo(e, t) {
|
|
3565
|
+
let n = e.join("").trim().replace(/ /g, "").split("\n").map((e) => e.split("|"))[0], r = [];
|
|
3566
|
+
for (let e = 0; e < Math.floor(t.length / n.length); e++) {
|
|
3567
|
+
let i = {};
|
|
3568
|
+
for (let r = 0; r < n.length; r++) i[n[r]] = t[e * n.length + r];
|
|
3569
|
+
r.push(i);
|
|
3570
|
+
}
|
|
3571
|
+
return r;
|
|
3572
|
+
}
|
|
3573
|
+
var yo = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now, Z = {
|
|
3574
|
+
tasks: [],
|
|
3575
|
+
currentSuite: null
|
|
3576
|
+
};
|
|
3577
|
+
function bo(e) {
|
|
3578
|
+
Z.currentSuite?.tasks.push(e);
|
|
3579
|
+
}
|
|
3580
|
+
async function xo(e, t) {
|
|
3581
|
+
let n = Z.currentSuite;
|
|
3582
|
+
Z.currentSuite = e, await t(), Z.currentSuite = n;
|
|
3583
|
+
}
|
|
3584
|
+
function Q(e, t, n = !1, r, i) {
|
|
3585
|
+
if (t <= 0 || t === Infinity) return e;
|
|
3586
|
+
let { setTimeout: a, clearTimeout: o } = Xi();
|
|
3587
|
+
return (function(...s) {
|
|
3588
|
+
let c = yo(), l = co();
|
|
3589
|
+
return l._currentTaskStartTime = c, l._currentTaskTimeout = t, new Promise((u, d) => {
|
|
3590
|
+
let f = a(() => {
|
|
3591
|
+
o(f), p();
|
|
3592
|
+
}, t);
|
|
3593
|
+
f.unref?.();
|
|
3594
|
+
function p() {
|
|
3595
|
+
let e = Do(n, t, r);
|
|
3596
|
+
i?.(s, e), d(e);
|
|
3597
|
+
}
|
|
3598
|
+
function m(e) {
|
|
3599
|
+
if (l._currentTaskStartTime = void 0, l._currentTaskTimeout = void 0, o(f), yo() - c >= t) {
|
|
3600
|
+
p();
|
|
3601
|
+
return;
|
|
3602
|
+
}
|
|
3603
|
+
u(e);
|
|
3604
|
+
}
|
|
3605
|
+
function h(e) {
|
|
3606
|
+
l._currentTaskStartTime = void 0, l._currentTaskTimeout = void 0, o(f), d(e);
|
|
3607
|
+
}
|
|
3608
|
+
try {
|
|
3609
|
+
let t = e(...s);
|
|
3610
|
+
typeof t == "object" && t && typeof t.then == "function" ? t.then(m, h) : m(t);
|
|
3611
|
+
} catch (e) {
|
|
3612
|
+
h(e);
|
|
3613
|
+
}
|
|
3614
|
+
});
|
|
3615
|
+
});
|
|
3616
|
+
}
|
|
3617
|
+
function So(e, t) {
|
|
3618
|
+
return (function(...n) {
|
|
3619
|
+
return new Promise((r, i) => {
|
|
3620
|
+
t.addEventListener("abort", () => i(t.reason));
|
|
3621
|
+
try {
|
|
3622
|
+
let t = e(...n);
|
|
3623
|
+
typeof t == "object" && t && typeof t.then == "function" ? t.then(r, i) : r(t);
|
|
3624
|
+
} catch (e) {
|
|
3625
|
+
i(e);
|
|
3626
|
+
}
|
|
3627
|
+
});
|
|
3628
|
+
});
|
|
3629
|
+
}
|
|
3630
|
+
var Co = /* @__PURE__ */ new WeakMap();
|
|
3631
|
+
function wo([e], t) {
|
|
3632
|
+
e && To(e, t);
|
|
3633
|
+
}
|
|
3634
|
+
function To(e, t) {
|
|
3635
|
+
Co.get(e)?.abort(t);
|
|
3636
|
+
}
|
|
3637
|
+
function Eo(e, t) {
|
|
3638
|
+
let n = function() {
|
|
3639
|
+
throw Error("done() callback is deprecated, use promise instead");
|
|
3640
|
+
}, r = Co.get(n);
|
|
3641
|
+
return r || (r = new AbortController(), Co.set(n, r)), n.signal = r.signal, n.task = e, n.skip = (t, n) => {
|
|
3642
|
+
if (t !== !1) throw e.result ??= { state: "skip" }, e.result.pending = !0, new ha("test is skipped; abort execution", e, typeof t == "string" ? t : n);
|
|
3643
|
+
}, n.annotate = ((n, r, i) => {
|
|
3644
|
+
if (e.result && e.result.state !== "run") throw Error(`Cannot annotate tests outside of the test run. The test "${e.name}" finished running with the "${e.result.state}" state already.`);
|
|
3645
|
+
let a = {
|
|
3646
|
+
message: n,
|
|
3647
|
+
type: typeof r == "object" || r === void 0 ? "notice" : r
|
|
3648
|
+
}, o = typeof r == "object" ? r : i;
|
|
3649
|
+
return o && (a.attachment = o, Ro(a.attachment)), Lo(e, Fo(e, {
|
|
3650
|
+
type: "internal:annotation",
|
|
3651
|
+
annotation: a
|
|
3652
|
+
}).then(async ({ annotation: n }) => {
|
|
3653
|
+
if (!t.onTestAnnotate) throw Error("Test runner doesn't support test annotations.");
|
|
3654
|
+
await Po(t);
|
|
3655
|
+
let r = await t.onTestAnnotate(e, n);
|
|
3656
|
+
return e.annotations.push(r), r;
|
|
3657
|
+
}));
|
|
3658
|
+
}), n.onTestFailed = (n, i) => {
|
|
3659
|
+
e.onFailed ||= [], e.onFailed.push(Q(n, i ?? t.config.hookTimeout, !0, /* @__PURE__ */ Error("STACK_TRACE_ERROR"), (e, t) => r.abort(t)));
|
|
3660
|
+
}, n.onTestFinished = (n, i) => {
|
|
3661
|
+
e.onFinished ||= [], e.onFinished.push(Q(n, i ?? t.config.hookTimeout, !0, /* @__PURE__ */ Error("STACK_TRACE_ERROR"), (e, t) => r.abort(t)));
|
|
3662
|
+
}, t.extendTaskContext?.(n) || n;
|
|
3663
|
+
}
|
|
3664
|
+
function Do(e, t, n) {
|
|
3665
|
+
let r = `${e ? "Hook" : "Test"} timed out in ${t}ms.\nIf this is a long-running ${e ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${e ? "hookTimeout" : "testTimeout"}".`, i = Error(r);
|
|
3666
|
+
return n?.stack && (i.stack = n.stack.replace(i.message, n.message)), i;
|
|
3667
|
+
}
|
|
3668
|
+
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now, globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now, Date.now;
|
|
3669
|
+
var { clearTimeout: Oo, setTimeout: ko } = Xi(), Ao = /* @__PURE__ */ new Map(), jo = [], Mo = [];
|
|
3670
|
+
function No(e) {
|
|
3671
|
+
if (Ao.size) {
|
|
3672
|
+
let t = Array.from(Ao).map(([e, t]) => [
|
|
3673
|
+
e,
|
|
3674
|
+
t[0],
|
|
3675
|
+
t[1]
|
|
3676
|
+
]), n = e.onTaskUpdate?.(t, jo);
|
|
3677
|
+
n && (Mo.push(n), n.then(() => Mo.splice(Mo.indexOf(n), 1), () => {})), jo.length = 0, Ao.clear();
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
async function Po(e) {
|
|
3681
|
+
No(e), await Promise.all(Mo);
|
|
3682
|
+
}
|
|
3683
|
+
async function Fo(e, t) {
|
|
3684
|
+
let n = co(), r = to(e.file.filepath, (/* @__PURE__ */ Error("STACK_TRACE")).stack);
|
|
3685
|
+
if (r && (t.location = {
|
|
3686
|
+
file: r.file,
|
|
3687
|
+
line: r.line,
|
|
3688
|
+
column: r.column
|
|
3689
|
+
}, t.type === "internal:annotation" && (t.annotation.location = t.location)), Array.isArray(t.attachments)) for (let e of t.attachments) Ro(e);
|
|
3690
|
+
if (t.type === "internal:annotation") return t;
|
|
3691
|
+
if (!n.onTestArtifactRecord) throw Error("Test runner doesn't support test artifacts.");
|
|
3692
|
+
await Po(n);
|
|
3693
|
+
let i = await n.onTestArtifactRecord(e, t);
|
|
3694
|
+
return e.artifacts.push(i), i;
|
|
3695
|
+
}
|
|
3696
|
+
var $ = [];
|
|
3697
|
+
for (let e = 65; e < 91; e++) $.push(String.fromCharCode(e));
|
|
3698
|
+
for (let e = 97; e < 123; e++) $.push(String.fromCharCode(e));
|
|
3699
|
+
for (let e = 0; e < 10; e++) $.push(e.toString(10));
|
|
3700
|
+
$.push("+", "/");
|
|
3701
|
+
function Io(e) {
|
|
3702
|
+
let t = "", n = e.byteLength;
|
|
3703
|
+
for (let r = 0; r < n; r += 3) if (n === r + 1) {
|
|
3704
|
+
let n = (e[r] & 252) >> 2, i = (e[r] & 3) << 4;
|
|
3705
|
+
t += $[n], t += $[i], t += "==";
|
|
3706
|
+
} else if (n === r + 2) {
|
|
3707
|
+
let n = (e[r] & 252) >> 2, i = (e[r] & 3) << 4 | (e[r + 1] & 240) >> 4, a = (e[r + 1] & 15) << 2;
|
|
3708
|
+
t += $[n], t += $[i], t += $[a], t += "=";
|
|
3709
|
+
} else {
|
|
3710
|
+
let n = (e[r] & 252) >> 2, i = (e[r] & 3) << 4 | (e[r + 1] & 240) >> 4, a = (e[r + 1] & 15) << 2 | (e[r + 2] & 192) >> 6, o = e[r + 2] & 63;
|
|
3711
|
+
t += $[n], t += $[i], t += $[a], t += $[o];
|
|
3712
|
+
}
|
|
3713
|
+
return t;
|
|
3714
|
+
}
|
|
3715
|
+
function Lo(e, t) {
|
|
3716
|
+
return t = t.finally(() => {
|
|
3717
|
+
if (!e.promises) return;
|
|
3718
|
+
let n = e.promises.indexOf(t);
|
|
3719
|
+
n !== -1 && e.promises.splice(n, 1);
|
|
3720
|
+
}), e.promises ||= [], e.promises.push(t), t;
|
|
3721
|
+
}
|
|
3722
|
+
function Ro(e) {
|
|
3723
|
+
if (e.body == null && !e.path) throw TypeError("Test attachment requires \"body\" or \"path\" to be set. Both are missing.");
|
|
3724
|
+
if (e.body && e.path) throw TypeError("Test attachment requires only one of \"body\" or \"path\" to be set. Both are specified.");
|
|
3725
|
+
if (e.path && e.bodyEncoding) throw TypeError("Test attachment with \"path\" should not have \"bodyEncoding\" specified.");
|
|
3726
|
+
e.body instanceof Uint8Array && (e.body = Io(e.body)), e.body != null && (e.bodyEncoding ??= "base64");
|
|
3727
|
+
}
|
|
3728
|
+
//#endregion
|
|
3729
|
+
//#region ../rxdb-test/dist/encrypted/index.js
|
|
3730
|
+
var zo = class extends i {
|
|
3731
|
+
minimum;
|
|
3732
|
+
maximum;
|
|
3733
|
+
payload;
|
|
3734
|
+
};
|
|
3735
|
+
zo = w([r({
|
|
3736
|
+
name: "EncryptedBigIntBinaryRecord",
|
|
3737
|
+
tableName: "encrypted_bigint_binary_record",
|
|
3738
|
+
namespace: "encrypted-bigint-binary",
|
|
3739
|
+
log: !1,
|
|
3740
|
+
properties: [
|
|
3741
|
+
{
|
|
3742
|
+
name: "id",
|
|
3743
|
+
type: l.bigint,
|
|
3744
|
+
primary: !0
|
|
3745
|
+
},
|
|
3746
|
+
{
|
|
3747
|
+
name: "minimum",
|
|
3748
|
+
type: l.bigint,
|
|
3749
|
+
encrypted: !0
|
|
3750
|
+
},
|
|
3751
|
+
{
|
|
3752
|
+
name: "maximum",
|
|
3753
|
+
type: l.bigint,
|
|
3754
|
+
encrypted: !0
|
|
3755
|
+
},
|
|
3756
|
+
{
|
|
3757
|
+
name: "payload",
|
|
3758
|
+
type: l.binary,
|
|
3759
|
+
encrypted: !0
|
|
3760
|
+
}
|
|
3761
|
+
]
|
|
3762
|
+
})], zo);
|
|
3763
|
+
var Bo = class extends i {
|
|
3764
|
+
counter;
|
|
3765
|
+
payload;
|
|
3766
|
+
};
|
|
3767
|
+
Bo = w([r({
|
|
3768
|
+
name: "EncryptedBigIntBinaryHistoryRecord",
|
|
3769
|
+
tableName: "encrypted_bigint_binary_history_record",
|
|
3770
|
+
namespace: "encrypted-bigint-binary-history",
|
|
3771
|
+
properties: [
|
|
3772
|
+
{
|
|
3773
|
+
name: "id",
|
|
3774
|
+
type: l.bigint,
|
|
3775
|
+
primary: !0
|
|
3776
|
+
},
|
|
3777
|
+
{
|
|
3778
|
+
name: "counter",
|
|
3779
|
+
type: l.bigint,
|
|
3780
|
+
encrypted: !0
|
|
3781
|
+
},
|
|
3782
|
+
{
|
|
3783
|
+
name: "payload",
|
|
3784
|
+
type: l.binary,
|
|
3785
|
+
encrypted: !0
|
|
3786
|
+
}
|
|
3787
|
+
]
|
|
3788
|
+
})], Bo);
|
|
3789
|
+
var Vo = class extends i {
|
|
3790
|
+
name;
|
|
3791
|
+
creditCardInfo;
|
|
3792
|
+
apiSecret;
|
|
3793
|
+
metadata;
|
|
3794
|
+
loginCount;
|
|
3795
|
+
active;
|
|
3796
|
+
lastSeenAt;
|
|
3797
|
+
};
|
|
3798
|
+
Vo = w([r({
|
|
3799
|
+
name: "EncryptedUser",
|
|
3800
|
+
tableName: "encrypted_user",
|
|
3801
|
+
namespace: "encrypted-fixtures",
|
|
3802
|
+
log: !1,
|
|
3803
|
+
properties: [
|
|
3804
|
+
{
|
|
3805
|
+
name: "name",
|
|
3806
|
+
type: l.string,
|
|
3807
|
+
required: !0
|
|
3808
|
+
},
|
|
3809
|
+
{
|
|
3810
|
+
name: "creditCardInfo",
|
|
3811
|
+
type: l.string,
|
|
3812
|
+
encrypted: !0,
|
|
3813
|
+
nullable: !0
|
|
3814
|
+
},
|
|
3815
|
+
{
|
|
3816
|
+
name: "apiSecret",
|
|
3817
|
+
type: l.string,
|
|
3818
|
+
encrypted: !0,
|
|
3819
|
+
nullable: !0
|
|
3820
|
+
},
|
|
3821
|
+
{
|
|
3822
|
+
name: "metadata",
|
|
3823
|
+
type: l.json,
|
|
3824
|
+
encrypted: !0,
|
|
3825
|
+
nullable: !0
|
|
3826
|
+
},
|
|
3827
|
+
{
|
|
3828
|
+
name: "loginCount",
|
|
3829
|
+
type: l.integer,
|
|
3830
|
+
encrypted: !0,
|
|
3831
|
+
nullable: !0
|
|
3832
|
+
},
|
|
3833
|
+
{
|
|
3834
|
+
name: "active",
|
|
3835
|
+
type: l.boolean,
|
|
3836
|
+
encrypted: !0,
|
|
3837
|
+
nullable: !0
|
|
3838
|
+
},
|
|
3839
|
+
{
|
|
3840
|
+
name: "lastSeenAt",
|
|
3841
|
+
type: l.date,
|
|
3842
|
+
encrypted: !0,
|
|
3843
|
+
nullable: !0
|
|
3844
|
+
}
|
|
3845
|
+
]
|
|
3846
|
+
})], Vo);
|
|
3847
|
+
var Ho = class extends i {
|
|
3848
|
+
name;
|
|
3849
|
+
creditCardInfo;
|
|
3850
|
+
apiSecret;
|
|
3851
|
+
metadata;
|
|
3852
|
+
tags;
|
|
3853
|
+
scores;
|
|
3854
|
+
loginCount;
|
|
3855
|
+
active;
|
|
3856
|
+
lastSeenAt;
|
|
3857
|
+
};
|
|
3858
|
+
Ho = w([r({
|
|
3859
|
+
name: "EncryptedAuditedUser",
|
|
3860
|
+
tableName: "encrypted_audited_user",
|
|
3861
|
+
namespace: "encrypted-fixtures",
|
|
3862
|
+
log: !0,
|
|
3863
|
+
properties: [
|
|
3864
|
+
{
|
|
3865
|
+
name: "name",
|
|
3866
|
+
type: l.string,
|
|
3867
|
+
required: !0
|
|
3868
|
+
},
|
|
3869
|
+
{
|
|
3870
|
+
name: "creditCardInfo",
|
|
3871
|
+
type: l.string,
|
|
3872
|
+
encrypted: !0,
|
|
3873
|
+
nullable: !0
|
|
3874
|
+
},
|
|
3875
|
+
{
|
|
3876
|
+
name: "apiSecret",
|
|
3877
|
+
type: l.string,
|
|
3878
|
+
encrypted: !0,
|
|
3879
|
+
nullable: !0
|
|
3880
|
+
},
|
|
3881
|
+
{
|
|
3882
|
+
name: "metadata",
|
|
3883
|
+
type: l.json,
|
|
3884
|
+
encrypted: !0,
|
|
3885
|
+
nullable: !0
|
|
3886
|
+
},
|
|
3887
|
+
{
|
|
3888
|
+
name: "tags",
|
|
3889
|
+
type: l.stringArray,
|
|
3890
|
+
encrypted: !0,
|
|
3891
|
+
nullable: !0
|
|
3892
|
+
},
|
|
3893
|
+
{
|
|
3894
|
+
name: "scores",
|
|
3895
|
+
type: l.numberArray,
|
|
3896
|
+
encrypted: !0,
|
|
3897
|
+
nullable: !0
|
|
3898
|
+
},
|
|
3899
|
+
{
|
|
3900
|
+
name: "loginCount",
|
|
3901
|
+
type: l.integer,
|
|
3902
|
+
encrypted: !0,
|
|
3903
|
+
nullable: !0
|
|
3904
|
+
},
|
|
3905
|
+
{
|
|
3906
|
+
name: "active",
|
|
3907
|
+
type: l.boolean,
|
|
3908
|
+
encrypted: !0,
|
|
3909
|
+
nullable: !0
|
|
3910
|
+
},
|
|
3911
|
+
{
|
|
3912
|
+
name: "lastSeenAt",
|
|
3913
|
+
type: l.date,
|
|
3914
|
+
encrypted: !0,
|
|
3915
|
+
nullable: !0
|
|
3916
|
+
}
|
|
3917
|
+
]
|
|
3918
|
+
})], Ho);
|
|
3919
|
+
var Uo = class extends i {
|
|
3920
|
+
label;
|
|
3921
|
+
};
|
|
3922
|
+
Uo = w([r({
|
|
3923
|
+
name: "PlainEntity",
|
|
3924
|
+
tableName: "plain_entity",
|
|
3925
|
+
namespace: "lifecycle-plain",
|
|
3926
|
+
log: !1,
|
|
3927
|
+
properties: [{
|
|
3928
|
+
name: "label",
|
|
3929
|
+
type: l.string,
|
|
3930
|
+
required: !0
|
|
3931
|
+
}]
|
|
3932
|
+
})], Uo);
|
|
3933
|
+
var Wo = /* @__PURE__ */ new WeakMap(), Go = (e, t) => (Wo.set(e, t), e), Ko = (e) => {
|
|
3934
|
+
let t = Wo.get(e);
|
|
3935
|
+
if (t === void 0) throw Error("[rxdb-test] 该 adapter 没有登记查询计数:EncryptedAdapterFactory.createAdapter() 必须用 registerQueryCount() 登记它交还的**那一个**对象(代理包装过的工厂,登记键是代理,不是内层实例)");
|
|
3936
|
+
return t();
|
|
3937
|
+
}, qo = class extends i {
|
|
3938
|
+
name;
|
|
3939
|
+
creditCardInfo;
|
|
3940
|
+
apiSecret;
|
|
3941
|
+
};
|
|
3942
|
+
qo = w([r({
|
|
3943
|
+
name: "EncryptedTamperTableSwap",
|
|
3944
|
+
tableName: "encrypted_tamper_table_swap",
|
|
3945
|
+
namespace: "encrypted-fixtures",
|
|
3946
|
+
log: !1,
|
|
3947
|
+
properties: [
|
|
3948
|
+
{
|
|
3949
|
+
name: "name",
|
|
3950
|
+
type: l.string,
|
|
3951
|
+
required: !0
|
|
3952
|
+
},
|
|
3953
|
+
{
|
|
3954
|
+
name: "creditCardInfo",
|
|
3955
|
+
type: l.string,
|
|
3956
|
+
encrypted: !0,
|
|
3957
|
+
nullable: !0
|
|
3958
|
+
},
|
|
3959
|
+
{
|
|
3960
|
+
name: "apiSecret",
|
|
3961
|
+
type: l.string,
|
|
3962
|
+
encrypted: !0,
|
|
3963
|
+
nullable: !0
|
|
3964
|
+
}
|
|
3965
|
+
]
|
|
3966
|
+
})], qo);
|
|
3967
|
+
var Jo = class extends i {
|
|
3968
|
+
name;
|
|
3969
|
+
creditCardInfo;
|
|
3970
|
+
apiSecret;
|
|
3971
|
+
};
|
|
3972
|
+
Jo = w([r({
|
|
3973
|
+
name: "EncryptedTamperNamespaceSwap",
|
|
3974
|
+
tableName: "encrypted_tamper_table_swap",
|
|
3975
|
+
namespace: "encrypted-fixtures-alt",
|
|
3976
|
+
log: !1,
|
|
3977
|
+
properties: [
|
|
3978
|
+
{
|
|
3979
|
+
name: "name",
|
|
3980
|
+
type: l.string,
|
|
3981
|
+
required: !0
|
|
3982
|
+
},
|
|
3983
|
+
{
|
|
3984
|
+
name: "creditCardInfo",
|
|
3985
|
+
type: l.string,
|
|
3986
|
+
encrypted: !0,
|
|
3987
|
+
nullable: !0
|
|
3988
|
+
},
|
|
3989
|
+
{
|
|
3990
|
+
name: "apiSecret",
|
|
3991
|
+
type: l.string,
|
|
3992
|
+
encrypted: !0,
|
|
3993
|
+
nullable: !0
|
|
3994
|
+
}
|
|
3995
|
+
]
|
|
3996
|
+
})], Jo);
|
|
3997
|
+
//#endregion
|
|
3998
|
+
//#region src/__tests__/sqliteai-factory.ts
|
|
3999
|
+
var Yo = /* @__PURE__ */ Me({
|
|
4000
|
+
sqliteaiEncryptedFactory: () => ns,
|
|
4001
|
+
sqliteaiFactory: () => es
|
|
4002
|
+
}), Xo = class extends t {
|
|
1470
4003
|
queryCount = 0;
|
|
1471
4004
|
query(...e) {
|
|
1472
4005
|
return this.queryCount++, super.query(...e);
|
|
1473
4006
|
}
|
|
1474
|
-
},
|
|
1475
|
-
let t =
|
|
1476
|
-
t && (
|
|
1477
|
-
},
|
|
4007
|
+
}, Zo = () => void 0, Qo = /* @__PURE__ */ new WeakMap(), $o = (e) => {
|
|
4008
|
+
let t = Qo.get(e);
|
|
4009
|
+
t && (Qo.delete(e), t.terminate());
|
|
4010
|
+
}, es = {
|
|
1478
4011
|
name: "sqliteai",
|
|
1479
4012
|
async createAdapter(e) {
|
|
1480
|
-
return await
|
|
4013
|
+
return await ts(e);
|
|
1481
4014
|
},
|
|
1482
4015
|
async createClient(t, n) {
|
|
1483
4016
|
return await e(t, {
|
|
1484
|
-
printErr:
|
|
4017
|
+
printErr: Zo,
|
|
1485
4018
|
...n
|
|
1486
4019
|
});
|
|
1487
4020
|
},
|
|
1488
4021
|
cleanupAdapter(e) {
|
|
1489
|
-
$(e.rxdb);
|
|
4022
|
+
$o(e.rxdb);
|
|
1490
4023
|
}
|
|
1491
4024
|
};
|
|
1492
|
-
async function
|
|
1493
|
-
let { entities: t, persistent: n,
|
|
1494
|
-
dbName:
|
|
4025
|
+
async function ts(e) {
|
|
4026
|
+
let { entities: t, persistent: n, plugins: r = [], remoteAdapter: i, ...a } = e ?? {}, o = (t ?? []).slice(), s = `sqliteai-test-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, c = new d({
|
|
4027
|
+
dbName: s,
|
|
1495
4028
|
context: { userId: "userId" },
|
|
1496
|
-
entities:
|
|
4029
|
+
entities: o,
|
|
1497
4030
|
sync: {
|
|
1498
4031
|
local: { adapter: "sqliteai" },
|
|
1499
|
-
|
|
4032
|
+
...i === void 0 ? {} : { remote: { adapter: i } },
|
|
4033
|
+
type: ae.None
|
|
1500
4034
|
}
|
|
1501
4035
|
});
|
|
1502
4036
|
try {
|
|
1503
4037
|
let e;
|
|
1504
|
-
|
|
1505
|
-
$(t);
|
|
1506
|
-
let
|
|
4038
|
+
c.adapter("sqliteai", async (t) => {
|
|
4039
|
+
$o(t);
|
|
4040
|
+
let r = n === !0 ? new Worker(new URL(
|
|
1507
4041
|
/* @vite-ignore */
|
|
1508
|
-
"/assets/sqliteai-test.worker-
|
|
4042
|
+
"/assets/sqliteai-test.worker-DhICqctS.js",
|
|
1509
4043
|
"" + import.meta.url
|
|
1510
4044
|
), {
|
|
1511
4045
|
type: "module",
|
|
1512
|
-
name: `${
|
|
4046
|
+
name: `${s}-worker`
|
|
1513
4047
|
}) : void 0;
|
|
1514
|
-
return
|
|
1515
|
-
...
|
|
4048
|
+
return r && Qo.set(t, r), e = new Xo(t, {
|
|
4049
|
+
...r ? {
|
|
1516
4050
|
opfs: !0,
|
|
1517
4051
|
opfsFallback: "throw",
|
|
1518
4052
|
worker: !0,
|
|
1519
|
-
workerInstance:
|
|
1520
|
-
} : { printErr:
|
|
1521
|
-
...
|
|
4053
|
+
workerInstance: r
|
|
4054
|
+
} : { printErr: Zo },
|
|
4055
|
+
...a
|
|
1522
4056
|
}), e;
|
|
1523
|
-
}),
|
|
4057
|
+
}), c.use(Dt);
|
|
4058
|
+
for (let e of r) c.use(e);
|
|
4059
|
+
return await c.getAdapter("sqliteai"), await c.connect("sqliteai"), e;
|
|
1524
4060
|
} catch (e) {
|
|
1525
|
-
throw $(
|
|
4061
|
+
throw $o(c), e;
|
|
1526
4062
|
}
|
|
1527
4063
|
}
|
|
1528
|
-
var
|
|
4064
|
+
var ns = {
|
|
1529
4065
|
name: "sqliteai",
|
|
1530
|
-
getQueryCount:
|
|
4066
|
+
getQueryCount: Ko,
|
|
1531
4067
|
createAdapter: async (e) => {
|
|
1532
|
-
let t = await
|
|
1533
|
-
return
|
|
4068
|
+
let t = await ts(e);
|
|
4069
|
+
return Go(t, () => t.queryCount);
|
|
1534
4070
|
}
|
|
1535
|
-
},
|
|
4071
|
+
}, rs = (/* @__PURE__ */ Object.assign({ "./__tests__/sqliteai-factory.ts": Yo }))["./__tests__/sqliteai-factory.ts"].sqliteaiFactory;
|
|
1536
4072
|
//#endregion
|
|
1537
|
-
export {
|
|
4073
|
+
export { rs as sqliteaiFactory };
|