@dialecte/core 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/document/document.d.ts.map +1 -1
  2. package/dist/document/query/find/descendant/find-descendant.types.d.ts +2 -2
  3. package/dist/document/query/find/descendant/find-descendant.types.d.ts.map +1 -1
  4. package/dist/document/query/get/record/staged-lookup.d.ts.map +1 -1
  5. package/dist/document/query/get/tree/get-tree.d.ts.map +1 -1
  6. package/dist/document/query/main.d.ts +134 -10
  7. package/dist/document/query/main.d.ts.map +1 -1
  8. package/dist/document/transaction/create/create.d.ts.map +1 -1
  9. package/dist/document/transaction/delete/delete.d.ts.map +1 -1
  10. package/dist/document/transaction/main.d.ts +53 -0
  11. package/dist/document/transaction/main.d.ts.map +1 -1
  12. package/dist/document/transaction/stage-operations.d.ts.map +1 -1
  13. package/dist/document/transaction/update/update.d.ts.map +1 -1
  14. package/dist/errors/errors.d.ts +2 -2
  15. package/dist/errors/errors.d.ts.map +1 -1
  16. package/dist/helpers.js +12 -13
  17. package/dist/{index-B67NZSGJ.js → index-CqwLClK7.js} +26 -16
  18. package/dist/{index-B8aWgmfS.js → index-ni-jr0mc.js} +816 -716
  19. package/dist/index.js +2 -2
  20. package/dist/store/dexie-store.d.ts.map +1 -1
  21. package/dist/test-fixtures/index.d.ts +1 -0
  22. package/dist/test-fixtures/index.d.ts.map +1 -1
  23. package/dist/test-fixtures/test-record.d.ts +1609 -33
  24. package/dist/test-fixtures/test-record.d.ts.map +1 -1
  25. package/dist/test-fixtures/test-record.types.d.ts +8 -0
  26. package/dist/test-fixtures/test-record.types.d.ts.map +1 -0
  27. package/dist/test.js +26 -24
  28. package/dist/types/io.d.ts +14 -5
  29. package/dist/types/io.d.ts.map +1 -1
  30. package/dist/utils/assert.d.ts +2 -3
  31. package/dist/utils/assert.d.ts.map +1 -1
  32. package/dist/utils.js +1 -1
  33. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  import { toRef as Ne, isRecordOf as ur, toTreeRecord as cr, toRawRecord as or, standardizeRecord as Ya, toFullAttributeArray as za, CUSTOM_RECORD_ID_ATTRIBUTE as ia } from "./helpers.js";
2
- import { t as Me, a as $e } from "./index-B67NZSGJ.js";
2
+ import { t as Me, a as $e } from "./index-CqwLClK7.js";
3
3
  async function dr(g) {
4
- const { context: u, tagName: c, attributes: i } = g, h = await ua({ context: u, tagName: c }), m = [];
4
+ const { context: u, tagName: c, attributes: i } = g, h = await ua({ context: u, tagName: c }), p = [];
5
5
  for (const y of h)
6
- hr({ record: y, attributeFilter: i }) && m.push(y);
7
- return m;
6
+ hr({ record: y, attributeFilter: i }) && p.push(y);
7
+ return p;
8
8
  }
9
9
  function hr(g) {
10
10
  const { record: u, attributeFilter: c } = g;
@@ -39,15 +39,15 @@ async function Qa(g) {
39
39
  async function Ha(g) {
40
40
  const { context: u, dialecteConfig: c, ref: i } = g, h = await ca({ context: u, ref: i });
41
41
  if (!h) return {};
42
- const m = Ja(h), y = [i.tagName, ...c.descendants[i.tagName]], N = {};
42
+ const p = Ja(h), y = [i.tagName, ...c.descendants[i.tagName]], N = {};
43
43
  for (const R of y)
44
44
  N[R] = [];
45
- for (const R of m)
45
+ for (const R of p)
46
46
  N[R.tagName] && N[R.tagName].push(R);
47
47
  return N;
48
48
  }
49
49
  async function Za(g) {
50
- const { context: u, ref: c, filter: i } = g, h = oa(i), m = new Set(sa(i)), y = h[h.length - 1], N = y.attributes ? await dr({
50
+ const { context: u, ref: c, filter: i } = g, h = oa(i), p = new Set(sa(i)), y = h[h.length - 1], N = y.attributes ? await dr({
51
51
  context: u,
52
52
  tagName: y.tagName,
53
53
  attributes: y.attributes
@@ -63,9 +63,9 @@ async function Za(g) {
63
63
  });
64
64
  if (X.length !== 0 && ti({ ancestry: X, conditions: h }))
65
65
  for (const W of X)
66
- m.has(W.tagName) && (R.has(W.tagName) || R.set(W.tagName, /* @__PURE__ */ new Map()), R.get(W.tagName).set(W.id, W));
66
+ p.has(W.tagName) && (R.has(W.tagName) || R.set(W.tagName, /* @__PURE__ */ new Map()), R.get(W.tagName).set(W.id, W));
67
67
  }
68
- return ni({ collected: R, collectTags: m });
68
+ return ni({ collected: R, collectTags: p });
69
69
  }
70
70
  function Ja(g) {
71
71
  const u = [];
@@ -94,22 +94,22 @@ function sa(g) {
94
94
  }
95
95
  async function ei(g) {
96
96
  const { context: u, record: c, targetRef: i } = g, h = [];
97
- let m = c;
98
- for (; m && m.id !== i.id; ) {
99
- if (h.push(m), !m.parent) return [];
97
+ let p = c;
98
+ for (; p && p.id !== i.id; ) {
99
+ if (h.push(p), !p.parent) return [];
100
100
  const y = await Re({
101
101
  context: u,
102
- ref: Ne(m.parent)
102
+ ref: Ne(p.parent)
103
103
  });
104
104
  if (!y) return [];
105
- m = y;
105
+ p = y;
106
106
  }
107
- return !m || m.id !== i.id ? [] : (h.push(m), h);
107
+ return !p || p.id !== i.id ? [] : (h.push(p), h);
108
108
  }
109
109
  function ti(g) {
110
110
  const { ancestry: u, conditions: c } = g;
111
- return c.every((i) => u.some((m) => m.tagName !== i.tagName ? !1 : i.attributes ? hr({
112
- record: m,
111
+ return c.every((i) => u.some((p) => p.tagName !== i.tagName ? !1 : i.attributes ? hr({
112
+ record: p,
113
113
  attributeFilter: i.attributes
114
114
  }) : !0) || i.optional === !0);
115
115
  }
@@ -117,8 +117,8 @@ function ni(g) {
117
117
  const { collected: u, collectTags: c } = g, i = {};
118
118
  for (const h of c)
119
119
  i[h] = [];
120
- for (const [h, m] of u.entries())
121
- c.has(h) && (i[h] = Array.from(m.values()));
120
+ for (const [h, p] of u.entries())
121
+ c.has(h) && (i[h] = Array.from(p.values()));
122
122
  return i;
123
123
  }
124
124
  async function ri(g) {
@@ -140,7 +140,7 @@ async function ii(g) {
140
140
  async function oi(g) {
141
141
  const { context: u, ref: c } = g;
142
142
  return ((await Re({ context: u, ref: c }))?.attributes ?? []).reduce(
143
- (m, y) => (m[y.name] = y.value ?? "", m),
143
+ (p, y) => (p[y.name] = y.value ?? "", p),
144
144
  {}
145
145
  );
146
146
  }
@@ -151,50 +151,47 @@ async function si(g) {
151
151
  function ui(g) {
152
152
  const { stagedOperations: u, tagName: c, id: i } = g;
153
153
  for (let h = u.length - 1; h >= 0; h--) {
154
- const m = u[h];
154
+ const p = u[h];
155
155
  if (i === void 0) {
156
- if ((m.status === "created" || m.status === "updated") && ur(m.newRecord, c))
156
+ if ((p.status === "created" || p.status === "updated") && ur(p.newRecord, c))
157
157
  return {
158
- ...m.newRecord,
159
- status: m.status
158
+ ...p.newRecord,
159
+ status: p.status
160
160
  };
161
- if (m.status === "deleted" && ur(m.oldRecord, c))
161
+ if (p.status === "deleted" && ur(p.oldRecord, c))
162
162
  return {
163
- ...m.oldRecord,
163
+ ...p.oldRecord,
164
164
  status: "deleted"
165
165
  };
166
166
  continue;
167
167
  }
168
- if (m.status === "created" && m.newRecord.id === i) {
169
- const y = m.newRecord.tagName;
168
+ if (p.status === "created" && p.newRecord.id === i) {
169
+ const y = p.newRecord.tagName;
170
170
  return y !== c && Me("ELEMENT_TAGNAME_MISMATCH", {
171
- method: "getLatestStagedRecord",
172
171
  detail: `Expected tagName '${c}', got '${y}' for id '${i}'`,
173
172
  ref: { tagName: c, id: i }
174
173
  }), {
175
- ...m.newRecord,
174
+ ...p.newRecord,
176
175
  status: "created"
177
176
  };
178
177
  }
179
- if (m.status === "updated" && m.newRecord.id === i) {
180
- const y = m.newRecord.tagName;
178
+ if (p.status === "updated" && p.newRecord.id === i) {
179
+ const y = p.newRecord.tagName;
181
180
  return y !== c && Me("ELEMENT_TAGNAME_MISMATCH", {
182
- method: "getLatestStagedRecord",
183
181
  detail: `Expected tagName '${c}', got '${y}' for id '${i}'`,
184
182
  ref: { tagName: c, id: i }
185
183
  }), {
186
- ...m.newRecord,
184
+ ...p.newRecord,
187
185
  status: "updated"
188
186
  };
189
187
  }
190
- if (m.status === "deleted" && m.oldRecord.id === i) {
191
- const y = m.oldRecord.tagName;
188
+ if (p.status === "deleted" && p.oldRecord.id === i) {
189
+ const y = p.oldRecord.tagName;
192
190
  return y !== c && Me("ELEMENT_TAGNAME_MISMATCH", {
193
- method: "getLatestStagedRecord",
194
191
  detail: `Expected tagName '${c}', got '${y}' for id '${i}'`,
195
192
  ref: { tagName: c, id: i }
196
193
  }), {
197
- ...m.oldRecord,
194
+ ...p.oldRecord,
198
195
  status: "deleted"
199
196
  };
200
197
  }
@@ -202,14 +199,14 @@ function ui(g) {
202
199
  }
203
200
  function ci(g) {
204
201
  const { rawRecords: u, stagedOperations: c, tagName: i } = g, h = new Map(
205
- u.map((m) => [m.id, { ...m, status: "unchanged" }])
202
+ u.map((p) => [p.id, { ...p, status: "unchanged" }])
206
203
  );
207
- for (const m of c) {
208
- if (m.status === "created" || m.status === "updated") {
209
- if (!ur(m.newRecord, i)) continue;
210
- h.set(m.newRecord.id, { ...m.newRecord, status: m.status });
204
+ for (const p of c) {
205
+ if (p.status === "created" || p.status === "updated") {
206
+ if (!ur(p.newRecord, i)) continue;
207
+ h.set(p.newRecord.id, { ...p.newRecord, status: p.status });
211
208
  }
212
- m.status === "deleted" && m.oldRecord.tagName === i && h.delete(m.oldRecord.id);
209
+ p.status === "deleted" && p.oldRecord.tagName === i && h.delete(p.oldRecord.id);
213
210
  }
214
211
  return Array.from(h.values());
215
212
  }
@@ -226,8 +223,8 @@ async function Re(g) {
226
223
  }
227
224
  let i;
228
225
  if (c.id === void 0) {
229
- const h = `__singleton_${c.tagName}`, m = Xt(u) ? u.recordCache.get(h) : void 0;
230
- m ? i = m : (i = (await u.store.getByTagName(c.tagName))[0], i && Xt(u) && (u.recordCache.set(i.id, i), u.recordCache.set(h, i)));
226
+ const h = `__singleton_${c.tagName}`, p = Xt(u) ? u.recordCache.get(h) : void 0;
227
+ p ? i = p : (i = (await u.store.getByTagName(c.tagName))[0], i && Xt(u) && (u.recordCache.set(i.id, i), u.recordCache.set(h, i)));
231
228
  } else {
232
229
  const h = Xt(u) ? u.recordCache.get(c.id) : void 0;
233
230
  h ? i = h : (i = await u.store.get(c.id), i && Xt(u) && u.recordCache.set(c.id, i));
@@ -246,31 +243,30 @@ async function ua(g) {
246
243
  return ci({ rawRecords: i, stagedOperations: u.stagedOperations, tagName: c });
247
244
  }
248
245
  async function ca(g) {
249
- const { context: u, ref: c, options: i = {} } = g, { include: h, exclude: m, unwrap: y } = i, N = await Re({ context: u, ref: c });
246
+ const { context: u, ref: c, options: i = {} } = g, { include: h, exclude: p, unwrap: y } = i, N = await Re({ context: u, ref: c });
250
247
  $e(N, {
251
248
  detail: "No record found for provided ref",
252
- method: "getTree",
253
249
  key: "ELEMENT_NOT_FOUND"
254
250
  });
255
251
  const R = await la({
256
252
  context: u,
257
253
  record: N,
258
254
  includeFilters: h ? [h] : void 0,
259
- exclude: m
255
+ exclude: p
260
256
  });
261
- return R ? y ? pi({ tree: R, unwrapTagNames: y }) : R : cr({ record: N });
257
+ return R ? y ? mi({ tree: R, unwrapTagNames: y }) : R : cr({ record: N });
262
258
  }
263
259
  async function la(g) {
264
260
  const { context: u, record: c, includeFilters: i, exclude: h } = g;
265
261
  if (fi({ record: c, excludeFilters: h }))
266
262
  return cr({ record: c });
267
- const m = await hi({
263
+ const p = await hi({
268
264
  context: u,
269
265
  record: c,
270
266
  currentIncludeFilters: i,
271
267
  excludeFilters: h
272
268
  }), N = (await Promise.all(
273
- m.map(
269
+ p.map(
274
270
  ({ record: R, includeFilters: j }) => la({ context: u, record: R, includeFilters: j, exclude: h })
275
271
  )
276
272
  )).filter(
@@ -280,11 +276,11 @@ async function la(g) {
280
276
  }
281
277
  function fi(g) {
282
278
  const { record: u, excludeFilters: c } = g;
283
- return c ? c.some((i) => (i.scope ?? "self") !== "children" ? !1 : mr({ record: u, filter: i })) : !1;
279
+ return c ? c.some((i) => (i.scope ?? "self") !== "children" ? !1 : pr({ record: u, filter: i })) : !1;
284
280
  }
285
281
  function di(g) {
286
282
  const { record: u, excludeFilters: c } = g;
287
- return c ? c.some((i) => (i.scope ?? "self") !== "self" ? !1 : mr({ record: u, filter: i })) : !1;
283
+ return c ? c.some((i) => (i.scope ?? "self") !== "self" ? !1 : pr({ record: u, filter: i })) : !1;
288
284
  }
289
285
  async function hi(g) {
290
286
  const { context: u, record: c, currentIncludeFilters: i, excludeFilters: h } = g;
@@ -301,35 +297,35 @@ async function hi(g) {
301
297
  ).filter(
302
298
  (R) => !di({ record: R, excludeFilters: h })
303
299
  );
304
- return mi({ children: N, currentIncludeFilters: i });
300
+ return pi({ children: N, currentIncludeFilters: i });
305
301
  }
306
- function mi(g) {
302
+ function pi(g) {
307
303
  const { children: u, currentIncludeFilters: c } = g;
308
304
  if (!c)
309
305
  return u.map((h) => ({ record: h, includeFilters: void 0 }));
310
306
  const i = [];
311
307
  for (const h of u) {
312
- const m = c.find(
313
- (y) => mr({ record: h, filter: y })
308
+ const p = c.find(
309
+ (y) => pr({ record: h, filter: y })
314
310
  );
315
- m && i.push({
311
+ p && i.push({
316
312
  record: h,
317
- includeFilters: m.children?.length ? m.children : void 0
313
+ includeFilters: p.children?.length ? p.children : void 0
318
314
  });
319
315
  }
320
316
  return i;
321
317
  }
322
- function mr(g) {
318
+ function pr(g) {
323
319
  const { record: u, filter: c } = g;
324
320
  return u.tagName !== c.tagName ? !1 : c.attributes ? hr({
325
321
  record: u,
326
322
  attributeFilter: c.attributes
327
323
  }) : !0;
328
324
  }
329
- function pi(g) {
325
+ function mi(g) {
330
326
  const { tree: u, unwrapTagNames: c } = g;
331
327
  function i(h) {
332
- return h.flatMap((m) => c.includes(m.tagName) ? i(m.tree) : [{ ...m, tree: i(m.tree) }]);
328
+ return h.flatMap((p) => c.includes(p.tagName) ? i(p.tree) : [{ ...p, tree: i(p.tree) }]);
333
329
  }
334
330
  return { ...u, tree: i(u.tree) };
335
331
  }
@@ -358,22 +354,77 @@ class fa {
358
354
  };
359
355
  }
360
356
  //== Record lookup
357
+ /**
358
+ * Get the root element of the document.
359
+ *
360
+ * @returns The root record, or `undefined` if the database is empty.
361
+ *
362
+ * @example
363
+ * ```ts
364
+ * const root = await query.getRoot()
365
+ * ```
366
+ */
361
367
  async getRoot() {
362
368
  return Re({
363
369
  context: this.context,
364
370
  ref: { tagName: this.dialecteConfig.rootElementName }
365
371
  });
366
372
  }
373
+ /**
374
+ * Get a single record by ref, record, or relationship.
375
+ *
376
+ * @param refOrRecord - A ref `{ tagName, id }`, or any record/relationship.
377
+ * @returns The tracked record, or `undefined` if not found.
378
+ *
379
+ * @example
380
+ * ```ts
381
+ * const ied = await query.getRecord({ tagName: 'IED', id: knownId })
382
+ * ```
383
+ */
367
384
  async getRecord(u) {
368
385
  return Re({ context: this.context, ref: Ne(u) });
369
386
  }
387
+ /**
388
+ * Get multiple records in a single call.
389
+ *
390
+ * @param refsOrRecords - Array of refs, records, or relationships.
391
+ * @returns Array of tracked records (same order, `undefined` for missing).
392
+ *
393
+ * @example
394
+ * ```ts
395
+ * const [bay1, bay2] = await query.getRecords([ref1, ref2])
396
+ * ```
397
+ */
370
398
  async getRecords(u) {
371
399
  const c = u.map((i) => Ne(i));
372
400
  return li({ context: this.context, refs: c });
373
401
  }
402
+ /**
403
+ * Get all records of a given tag name.
404
+ *
405
+ * @param tagName - The element type to retrieve.
406
+ * @returns All tracked records matching that tag name.
407
+ *
408
+ * @example
409
+ * ```ts
410
+ * const ieds = await query.getRecordsByTagName('IED')
411
+ * ```
412
+ */
374
413
  async getRecordsByTagName(u) {
375
414
  return ua({ context: this.context, tagName: u });
376
415
  }
416
+ /**
417
+ * Find all descendants of an element, grouped by tag name.
418
+ *
419
+ * @param refOrRecord - The ancestor element.
420
+ * @param filter - Optional filter to restrict which tag names are returned.
421
+ * @returns Object keyed by tag name, each value an array of tracked records.
422
+ *
423
+ * @example
424
+ * ```ts
425
+ * const { Bay, VoltageLevel } = await query.findDescendants(substation)
426
+ * ```
427
+ */
377
428
  async findDescendants(u, c) {
378
429
  return Qa({
379
430
  context: this.context,
@@ -382,47 +433,59 @@ class fa {
382
433
  filter: c
383
434
  });
384
435
  }
385
- async getTree(u, c) {
386
- return ca({ context: this.context, ref: Ne(u), options: c });
387
- }
388
- //== Attribute queries
389
436
  /**
437
+ * Build a full tree structure from an element down.
438
+ *
439
+ * @param refOrRecord - The root of the subtree.
440
+ * @param options - Optional depth/filter controls.
441
+ * @returns A tree record with nested children, or `undefined` if not found.
442
+ *
390
443
  * @example
391
- * await doc.query.getAttribute({ ref, name: 'name' }) // → string | ''
392
- * await doc.query.getAttribute({ ref, name: 'name', fullObject: true }) // → FullAttributeObject | undefined
444
+ * ```ts
445
+ * const tree = await query.getTree(bay)
446
+ * ```
393
447
  */
448
+ async getTree(u, c) {
449
+ return ca({ context: this.context, ref: Ne(u), options: c });
450
+ }
394
451
  async getAttribute(u, c) {
395
452
  const i = Ne(u), { fullObject: h } = c;
396
453
  return h ? ii({ context: this.context, ref: i, ...c }) : ai({ context: this.context, ref: i, ...c });
397
454
  }
398
- /**
399
- * @example
400
- * const { name, desc } = await doc.query.getAttributes({ ref }) // destructurable
401
- * const fullAttrs = await doc.query.getAttributes({ ref, fullObject: true }) // FullAttributeObject[]
402
- */
403
455
  async getAttributes(u, c) {
404
456
  const i = Ne(u), { fullObject: h } = c || {};
405
457
  return h ? si({ context: this.context, ref: i, ...c }) : oi({ context: this.context, ref: i, ...c });
406
458
  }
407
459
  //== Find queries
460
+ /**
461
+ * Find records matching specific attribute values.
462
+ *
463
+ * @param params - Tag name and attribute filter criteria.
464
+ * @returns All matching tracked records.
465
+ *
466
+ * @example
467
+ * ```ts
468
+ * const bays = await query.findByAttributes({
469
+ * tagName: 'Bay',
470
+ * attributes: { name: 'Q01' },
471
+ * })
472
+ * ```
473
+ */
408
474
  async findByAttributes(u) {
409
475
  return dr({ context: this.context, ...u });
410
476
  }
411
477
  }
412
478
  function ze(g) {
413
- const { context: u, status: c, record: i, oldRecord: h, newRecord: m } = g;
479
+ const { context: u, status: c, record: i, oldRecord: h, newRecord: p } = g;
414
480
  let y, N, R;
415
- i && (y = or(i)), h && (N = or(h)), m && (R = or(m)), c === "created" ? ($e(y, {
481
+ i && (y = or(i)), h && (N = or(h)), p && (R = or(p)), c === "created" ? ($e(y, {
416
482
  detail: "Record is required for created",
417
- method: "stageOperation",
418
483
  key: "ELEMENT_NOT_FOUND"
419
484
  }), u.stagedOperations.push({ status: c, oldRecord: void 0, newRecord: y })) : c === "updated" ? ($e(N && R, {
420
485
  detail: "Old record and new record are required for updated",
421
- method: "stageOperation",
422
486
  key: "ELEMENT_NOT_FOUND"
423
487
  }), u.stagedOperations.push({ status: c, oldRecord: N, newRecord: R })) : c === "deleted" && y && ($e(y, {
424
488
  detail: "Record is required for deleted",
425
- method: "stageOperation",
426
489
  key: "ELEMENT_NOT_FOUND"
427
490
  }), u.stagedOperations.push({ status: c, oldRecord: y, newRecord: void 0 }));
428
491
  }
@@ -447,17 +510,16 @@ function gi(g) {
447
510
  }
448
511
  }
449
512
  async function da(g) {
450
- const { dialecteConfig: u, context: c, parentRef: i, params: h } = g, { id: m, tagName: y, attributes: N, namespace: R, value: j } = h, X = await Re({ context: c, ref: i });
513
+ const { dialecteConfig: u, context: c, parentRef: i, params: h } = g, { id: p, tagName: y, attributes: N, namespace: R, value: j } = h, X = await Re({ context: c, ref: i });
451
514
  $e(X, {
452
515
  detail: "Parent record not found",
453
- method: "addChild",
454
516
  key: "ELEMENT_NOT_FOUND",
455
517
  ref: i
456
518
  });
457
519
  const W = Ya({
458
520
  dialecteConfig: u,
459
521
  record: {
460
- id: m ?? crypto.randomUUID(),
522
+ id: p ?? crypto.randomUUID(),
461
523
  tagName: y,
462
524
  attributes: N,
463
525
  namespace: R,
@@ -491,20 +553,20 @@ async function da(g) {
491
553
  return Ne(W);
492
554
  }
493
555
  async function yi(g) {
494
- const { dialecteConfig: u, context: c, parentRef: i, record: h } = g, m = [];
556
+ const { dialecteConfig: u, context: c, parentRef: i, record: h } = g, p = [];
495
557
  return await ha({
496
558
  dialecteConfig: u,
497
559
  context: c,
498
560
  parentRef: i,
499
561
  record: h,
500
- mappings: m
562
+ mappings: p
501
563
  }), {
502
564
  ref: Ne(h),
503
- mappings: m
565
+ mappings: p
504
566
  };
505
567
  }
506
568
  async function ha(g) {
507
- const { dialecteConfig: u, context: c, parentRef: i, record: h, mappings: m } = g;
569
+ const { dialecteConfig: u, context: c, parentRef: i, record: h, mappings: p } = g;
508
570
  let y = !0, N = h;
509
571
  if (u.hooks?.beforeClone) {
510
572
  const j = u.hooks.beforeClone({ record: h });
@@ -522,7 +584,7 @@ async function ha(g) {
522
584
  value: N.value
523
585
  }
524
586
  });
525
- m.push({
587
+ p.push({
526
588
  source: Ne(h),
527
589
  target: R
528
590
  });
@@ -532,28 +594,28 @@ async function ha(g) {
532
594
  context: c,
533
595
  parentRef: R,
534
596
  record: j,
535
- mappings: m
597
+ mappings: p
536
598
  });
537
599
  }
538
600
  function vi(g) {
539
601
  const u = /* @__PURE__ */ new Map();
540
602
  for (const i of g) {
541
- const h = (i.status === "deleted" ? i.oldRecord : i.newRecord).id, m = u.get(h);
542
- if (!m) {
603
+ const h = (i.status === "deleted" ? i.oldRecord : i.newRecord).id, p = u.get(h);
604
+ if (!p) {
543
605
  u.set(h, i);
544
606
  continue;
545
607
  }
546
- m.status === "created" ? i.status === "updated" ? u.set(h, {
608
+ p.status === "created" ? i.status === "updated" ? u.set(h, {
547
609
  status: "created",
548
610
  oldRecord: void 0,
549
611
  newRecord: i.newRecord
550
- }) : i.status === "deleted" && u.delete(h) : m.status === "updated" && (i.status === "updated" ? u.set(h, {
612
+ }) : i.status === "deleted" && u.delete(h) : p.status === "updated" && (i.status === "updated" ? u.set(h, {
551
613
  status: "updated",
552
- oldRecord: m.oldRecord,
614
+ oldRecord: p.oldRecord,
553
615
  newRecord: i.newRecord
554
616
  }) : i.status === "deleted" && u.set(h, {
555
617
  status: "deleted",
556
- oldRecord: m.oldRecord,
618
+ oldRecord: p.oldRecord,
557
619
  newRecord: void 0
558
620
  }));
559
621
  }
@@ -565,12 +627,12 @@ function vi(g) {
565
627
  };
566
628
  }
567
629
  async function bi(g) {
568
- const { stagedOperations: u, store: c, documentState: i } = g, { creates: h, updates: m, deletes: y } = vi(u), N = h.length + m.length + y.length;
630
+ const { stagedOperations: u, store: c, documentState: i } = g, { creates: h, updates: p, deletes: y } = vi(u), N = h.length + p.length + y.length;
569
631
  i.activity = { method: "commit", message: "Committing changes..." }, i.progress = { current: 0, total: N };
570
632
  try {
571
633
  await c.commit({
572
634
  creates: h.map((R) => R.newRecord),
573
- updates: m.map((R) => R.newRecord),
635
+ updates: p.map((R) => R.newRecord),
574
636
  deletes: y.map((R) => R.oldRecord.id),
575
637
  onProgress: (R, j) => {
576
638
  i.progress = { current: R, total: j };
@@ -585,47 +647,43 @@ async function wi(g) {
585
647
  const { context: u, ref: c } = g, i = await Re({ context: u, ref: c });
586
648
  $e(i, {
587
649
  detail: `Record not found (tagName=${c.tagName}, id=${c.id})`,
588
- method: "delete",
589
650
  key: "ELEMENT_NOT_FOUND",
590
651
  ref: c
591
652
  }), $e(i.parent, {
592
653
  detail: "Cannot delete root element",
593
- method: "delete",
594
654
  key: "PROTECTED_ROOT"
595
- }), await ma({ context: u, record: i }), ze({ context: u, status: "deleted", record: i });
596
- const h = Ne(i.parent), m = await Re({ context: u, ref: h });
597
- $e(m, {
655
+ }), await pa({ context: u, record: i }), ze({ context: u, status: "deleted", record: i });
656
+ const h = Ne(i.parent), p = await Re({ context: u, ref: h });
657
+ $e(p, {
598
658
  detail: `Parent record not found (tagName=${i.parent.tagName}, id=${i.parent.id})`,
599
- method: "delete",
600
659
  key: "ELEMENT_NOT_FOUND"
601
660
  });
602
661
  const y = {
603
- ...m,
604
- children: m.children.filter((N) => N.id !== i.id)
662
+ ...p,
663
+ children: p.children.filter((N) => N.id !== i.id)
605
664
  };
606
- return ze({ context: u, status: "updated", oldRecord: m, newRecord: y }), h;
665
+ return ze({ context: u, status: "updated", oldRecord: p, newRecord: y }), h;
607
666
  }
608
- async function ma(g) {
667
+ async function pa(g) {
609
668
  const { context: u, record: c } = g;
610
669
  for (const i of c.children) {
611
- const h = Ne(i), m = await Re({ context: u, ref: h });
612
- m && (m.children.length > 0 && await ma({ context: u, record: m }), ze({ context: u, status: "deleted", record: m }));
670
+ const h = Ne(i), p = await Re({ context: u, ref: h });
671
+ p && (p.children.length > 0 && await pa({ context: u, record: p }), ze({ context: u, status: "deleted", record: p }));
613
672
  }
614
673
  }
615
674
  async function _i(g) {
616
- const { dialecteConfig: u, context: c, ref: i, params: h } = g, { attributes: m, value: y } = h, N = await Re({ context: c, ref: i });
675
+ const { dialecteConfig: u, context: c, ref: i, params: h } = g, { attributes: p, value: y } = h, N = await Re({ context: c, ref: i });
617
676
  $e(N, {
618
677
  detail: `Record not found (tagName=${i.tagName}, id=${i.id})`,
619
- method: "update",
620
678
  key: "ELEMENT_NOT_FOUND",
621
679
  ref: i
622
680
  });
623
681
  let R = N.attributes;
624
- if (m) {
682
+ if (p) {
625
683
  const X = za({
626
684
  dialecteConfig: u,
627
685
  tagName: N.tagName,
628
- attributes: m
686
+ attributes: p
629
687
  });
630
688
  R = [...N.attributes.filter(
631
689
  (J) => !X.some((fe) => fe.name === J.name)
@@ -664,6 +722,21 @@ class Ti extends fa {
664
722
  };
665
723
  }
666
724
  //== Mutation methods
725
+ /**
726
+ * Add a child element to a parent.
727
+ *
728
+ * @param parentRefOrRecord - The parent element (ref, record, or relationship). `undefined` for root.
729
+ * @param params - Child tagName, attributes and optional namespace, value, id.
730
+ * @returns Ref to the created child.
731
+ *
732
+ * @example
733
+ * ```ts
734
+ * const bayRef = await tx.addChild(substation, {
735
+ * tagName: 'VoltageLevel',
736
+ * attributes: { name: 'VL1' },
737
+ * })
738
+ * ```
739
+ */
667
740
  async addChild(u, c) {
668
741
  return da({
669
742
  context: this.context,
@@ -672,6 +745,20 @@ class Ti extends fa {
672
745
  dialecteConfig: this.dialecteConfig
673
746
  });
674
747
  }
748
+ /**
749
+ * Update attributes of an existing element.
750
+ *
751
+ * @param refOrRecord - The element to update (ref, record, or relationship).
752
+ * @param params - New attribute values.
753
+ * @returns Ref to the updated element.
754
+ *
755
+ * @example
756
+ * ```ts
757
+ * await tx.update(bay, {
758
+ * attributes: { name: 'Q02', desc: 'Feeder bay' },
759
+ * })
760
+ * ```
761
+ */
675
762
  async update(u, c) {
676
763
  return _i({
677
764
  context: this.context,
@@ -680,9 +767,33 @@ class Ti extends fa {
680
767
  dialecteConfig: this.dialecteConfig
681
768
  });
682
769
  }
770
+ /**
771
+ * Delete an element and its entire subtree.
772
+ *
773
+ * @param refOrRecord - The element to delete (ref, record, or relationship).
774
+ * @returns Ref to the deleted element's parent.
775
+ *
776
+ * @example
777
+ * ```ts
778
+ * const parentRef = await tx.delete(bay)
779
+ * ```
780
+ */
683
781
  async delete(u) {
684
782
  return wi({ context: this.context, ref: Ne(u) });
685
783
  }
784
+ /**
785
+ * Deep-clone a subtree under a new parent.
786
+ *
787
+ * @param parentRefOrRecord - The target parent for the clone.
788
+ * @param record - The tree record to clone (from `getTree`).
789
+ * @returns The cloned root ref and an ID mapping from old to new.
790
+ *
791
+ * @example
792
+ * ```ts
793
+ * const tree = await tx.getTree(bay)
794
+ * const { ref, idMap } = await tx.deepClone(substation, tree)
795
+ * ```
796
+ */
686
797
  async deepClone(u, c) {
687
798
  return yi({
688
799
  dialecteConfig: this.dialecteConfig,
@@ -755,8 +866,7 @@ class Yr {
755
866
  }
756
867
  async transaction(u, c) {
757
868
  this.activeTransactions > 0 && Me("CONCURRENT_TRANSACTION", {
758
- detail: `${this.activeTransactions} transaction(s) already active. Concurrent transactions risk lost updates — serialize them or implement a transaction queue.`,
759
- method: "transaction"
869
+ detail: `${this.activeTransactions} transaction(s) already active. Concurrent transactions risk lost updates — serialize them or implement a transaction queue.`
760
870
  }), this.activeTransactions++, this.state.loading = !0, this.state.error = null;
761
871
  const i = this.createTransaction();
762
872
  try {
@@ -769,7 +879,6 @@ class Yr {
769
879
  } catch (h) {
770
880
  throw this.state.activity = null, this.state.progress = null, this.state.error ?? Me("UNKNOWN", {
771
881
  detail: h instanceof Error ? h.message : String(h),
772
- method: "transaction",
773
882
  cause: h instanceof Error ? h : void 0
774
883
  });
775
884
  } finally {
@@ -804,12 +913,11 @@ class Yr {
804
913
  } catch (N) {
805
914
  throw this.activeTransactions--, this.state.loading = this.activeTransactions > 0, this.state.error ?? Me("UNKNOWN", {
806
915
  detail: N instanceof Error ? N.message : String(N),
807
- method: "prepare",
808
916
  cause: N instanceof Error ? N : void 0
809
917
  });
810
918
  }
811
919
  this.activeTransactions--, this.state.loading = this.activeTransactions > 0;
812
- const h = i.getStagedOperations(), m = {
920
+ const h = i.getStagedOperations(), p = {
813
921
  creates: h.filter((N) => N.status === "created").length,
814
922
  updates: h.filter((N) => N.status === "updated").length,
815
923
  deletes: h.filter((N) => N.status === "deleted").length
@@ -817,7 +925,7 @@ class Yr {
817
925
  let y = !1;
818
926
  return {
819
927
  operations: h,
820
- summary: m,
928
+ summary: p,
821
929
  commit: async () => {
822
930
  if (!y) {
823
931
  y = !0, this.activeTransactions++, this.state.loading = !0, this.state.activity = { method: "commit", message: "Saving changes..." };
@@ -830,7 +938,6 @@ class Yr {
830
938
  } catch (N) {
831
939
  throw this.state.activity = null, this.state.error ?? Me("UNKNOWN", {
832
940
  detail: N instanceof Error ? N.message : String(N),
833
- method: "commit",
834
941
  cause: N instanceof Error ? N : void 0
835
942
  });
836
943
  } finally {
@@ -851,7 +958,6 @@ class Yr {
851
958
  } catch (u) {
852
959
  throw this.state.activity = null, this.state.error ?? Me("UNKNOWN", {
853
960
  detail: u instanceof Error ? u.message : String(u),
854
- method: "undo",
855
961
  cause: u instanceof Error ? u : void 0
856
962
  });
857
963
  } finally {
@@ -865,7 +971,6 @@ class Yr {
865
971
  } catch (u) {
866
972
  throw this.state.activity = null, this.state.error ?? Me("UNKNOWN", {
867
973
  detail: u instanceof Error ? u.message : String(u),
868
- method: "redo",
869
974
  cause: u instanceof Error ? u : void 0
870
975
  });
871
976
  } finally {
@@ -882,7 +987,7 @@ class Yr {
882
987
  }
883
988
  }
884
989
  var Ei = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
885
- function pa(g) {
990
+ function ma(g) {
886
991
  return g && g.__esModule && Object.prototype.hasOwnProperty.call(g, "default") ? g.default : g;
887
992
  }
888
993
  function xi(g) {
@@ -931,13 +1036,13 @@ function Ai() {
931
1036
  for (var r, a = 0, s = t.length; a < s; a++) !r && a in t || ((r = r || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
932
1037
  return e.concat(r || Array.prototype.slice.call(t));
933
1038
  }
934
- var m = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ei, y = Object.keys, N = Array.isArray;
1039
+ var p = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ei, y = Object.keys, N = Array.isArray;
935
1040
  function R(e, t) {
936
1041
  return typeof t != "object" || y(t).forEach(function(n) {
937
1042
  e[n] = t[n];
938
1043
  }), e;
939
1044
  }
940
- typeof Promise > "u" || m.Promise || (m.Promise = Promise);
1045
+ typeof Promise > "u" || p.Promise || (p.Promise = Promise);
941
1046
  var j = Object.getPrototypeOf, X = {}.hasOwnProperty;
942
1047
  function W(e, t) {
943
1048
  return X.call(e, t);
@@ -967,14 +1072,14 @@ function Ai() {
967
1072
  if (!e) throw new Error("Assertion Failed");
968
1073
  }
969
1074
  function ae(e) {
970
- m.setImmediate ? setImmediate(e) : setTimeout(e, 0);
1075
+ p.setImmediate ? setImmediate(e) : setTimeout(e, 0);
971
1076
  }
972
- function pe(e, t) {
1077
+ function me(e, t) {
973
1078
  if (typeof t == "string" && W(e, t)) return e[t];
974
1079
  if (!t) return e;
975
1080
  if (typeof t != "string") {
976
1081
  for (var n = [], r = 0, a = t.length; r < a; ++r) {
977
- var s = pe(e, t[r]);
1082
+ var s = me(e, t[r]);
978
1083
  n.push(s);
979
1084
  }
980
1085
  return n;
@@ -982,7 +1087,7 @@ function Ai() {
982
1087
  var f = t.indexOf(".");
983
1088
  if (f !== -1) {
984
1089
  var d = e[t.substr(0, f)];
985
- return d == null ? void 0 : pe(d, t.substr(f + 1));
1090
+ return d == null ? void 0 : me(d, t.substr(f + 1));
986
1091
  }
987
1092
  }
988
1093
  function ne(e, t, n) {
@@ -994,23 +1099,23 @@ function Ai() {
994
1099
  d !== -1 ? (s = t.substr(0, d), (f = t.substr(d + 1)) === "" ? n === void 0 ? N(e) && !isNaN(parseInt(s)) ? e.splice(s, 1) : delete e[s] : e[s] = n : ne(d = !(d = e[s]) || !W(e, s) ? e[s] = {} : d, f, n)) : n === void 0 ? N(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
995
1100
  }
996
1101
  }
997
- function Ie(e) {
1102
+ function De(e) {
998
1103
  var t, n = {};
999
1104
  for (t in e) W(e, t) && (n[t] = e[t]);
1000
1105
  return n;
1001
1106
  }
1002
- var I = [].concat;
1003
- function Dt(e) {
1004
- return I.apply([], e);
1107
+ var D = [].concat;
1108
+ function It(e) {
1109
+ return D.apply([], e);
1005
1110
  }
1006
- var ct = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Dt([8, 16, 32, 64].map(function(e) {
1111
+ var ct = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(It([8, 16, 32, 64].map(function(e) {
1007
1112
  return ["Int", "Uint", "Float"].map(function(t) {
1008
1113
  return t + e + "Array";
1009
1114
  });
1010
1115
  }))).filter(function(e) {
1011
- return m[e];
1116
+ return p[e];
1012
1117
  }), He = new Set(ct.map(function(e) {
1013
- return m[e];
1118
+ return p[e];
1014
1119
  })), de = null;
1015
1120
  function ke(e) {
1016
1121
  return de = /* @__PURE__ */ new WeakMap(), e = (function t(n) {
@@ -1063,7 +1168,7 @@ function Ai() {
1063
1168
  return e[Symbol.toStringTag] === "AsyncFunction";
1064
1169
  } : function() {
1065
1170
  return !1;
1066
- }, kt = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], je = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(kt), It = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" };
1171
+ }, kt = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], je = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(kt), Dt = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" };
1067
1172
  function Ze(e, t) {
1068
1173
  this.name = e, this.message = t;
1069
1174
  }
@@ -1092,7 +1197,7 @@ function Ai() {
1092
1197
  var n = t + "Error";
1093
1198
  function r(a, s) {
1094
1199
  this.name = n, a ? typeof a == "string" ? (this.message = "".concat(a).concat(s ? `
1095
- ` + s : ""), this.inner = s || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = It[t] || n, this.inner = null);
1200
+ ` + s : ""), this.inner = s || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = Dt[t] || n, this.inner = null);
1096
1201
  }
1097
1202
  return F(r).from(o), e[t] = r, e;
1098
1203
  }, {});
@@ -1164,7 +1269,7 @@ function Ai() {
1164
1269
  function Rt(e) {
1165
1270
  Pe = e;
1166
1271
  }
1167
- var Pt = {}, pr = 100, ct = typeof Promise > "u" ? [] : (function() {
1272
+ var Pt = {}, mr = 100, ct = typeof Promise > "u" ? [] : (function() {
1168
1273
  var e = Promise.resolve();
1169
1274
  if (typeof crypto > "u" || !crypto.subtle) return [e, j(e), e];
1170
1275
  var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
@@ -1178,7 +1283,7 @@ function Ai() {
1178
1283
  var t = this._PSD = z;
1179
1284
  if (typeof e != "function") {
1180
1285
  if (e !== Pt) throw new TypeError("Not a function");
1181
- return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && In(this, this._value));
1286
+ return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Dn(this, this._value));
1182
1287
  }
1183
1288
  this._state = null, this._value = null, ++t.ref, (function n(r, a) {
1184
1289
  try {
@@ -1190,13 +1295,13 @@ function Ai() {
1190
1295
  s instanceof G ? s._then(d, v) : s.then(d, v);
1191
1296
  }) : (r._state = !0, r._value = s, yr(r)), f && Tt();
1192
1297
  }
1193
- }, In.bind(null, r));
1298
+ }, Dn.bind(null, r));
1194
1299
  } catch (s) {
1195
- In(r, s);
1300
+ Dn(r, s);
1196
1301
  }
1197
1302
  })(this, e);
1198
1303
  }
1199
- var Dn = { get: function() {
1304
+ var In = { get: function() {
1200
1305
  var e = z, t = nn;
1201
1306
  function n(r, a) {
1202
1307
  var s = this, f = !e.global && (e !== z || t !== nn), d = f && !at(), v = new G(function(w, T) {
@@ -1206,14 +1311,14 @@ function Ai() {
1206
1311
  }
1207
1312
  return n.prototype = Pt, n;
1208
1313
  }, set: function(e) {
1209
- B(this, "then", e && e.prototype === Pt ? Dn : { get: function() {
1314
+ B(this, "then", e && e.prototype === Pt ? In : { get: function() {
1210
1315
  return e;
1211
- }, set: Dn.set });
1316
+ }, set: In.set });
1212
1317
  } };
1213
1318
  function gr(e, t, n, r, a) {
1214
1319
  this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = a;
1215
1320
  }
1216
- function In(e, t) {
1321
+ function Dn(e, t) {
1217
1322
  var n, r;
1218
1323
  Ht.push(t), e._state === null && (n = e._lib && _t(), t = Cn(t), e._state = !1, e._value = t, r = e, ft.some(function(a) {
1219
1324
  return a._value === r._value;
@@ -1291,7 +1396,7 @@ function Ai() {
1291
1396
  }
1292
1397
  };
1293
1398
  }
1294
- J(G.prototype, { then: Dn, _then: function(e, t) {
1399
+ J(G.prototype, { then: In, _then: function(e, t) {
1295
1400
  Sn(this, new gr(null, null, e, t, z));
1296
1401
  }, catch: function(e) {
1297
1402
  if (arguments.length === 1) return this.then(null, e);
@@ -1408,10 +1513,10 @@ function Ai() {
1408
1513
  }, r = ht(s, e, n, r), s.ref === 0 && s.finalize(), r;
1409
1514
  }
1410
1515
  function Et() {
1411
- return Ee.id || (Ee.id = ++Na), ++Ee.awaits, Ee.echoes += pr, Ee.id;
1516
+ return Ee.id || (Ee.id = ++Na), ++Ee.awaits, Ee.echoes += mr, Ee.id;
1412
1517
  }
1413
1518
  function at() {
1414
- return !!Ee.awaits && (--Ee.awaits == 0 && (Ee.id = 0), Ee.echoes = Ee.awaits * pr, !0);
1519
+ return !!Ee.awaits && (--Ee.awaits == 0 && (Ee.id = 0), Ee.echoes = Ee.awaits * mr, !0);
1415
1520
  }
1416
1521
  function rn(e) {
1417
1522
  return Ee.echoes && e && e.constructor === lt ? (Et(), e.then(function(t) {
@@ -1428,11 +1533,11 @@ function Ai() {
1428
1533
  var n, r = z;
1429
1534
  (t ? !Ee.echoes || tn++ && e === z : !tn || --tn && e === z) || queueMicrotask(t ? (function(a) {
1430
1535
  ++nn, Ee.echoes && --Ee.echoes != 0 || (Ee.echoes = Ee.awaits = Ee.id = 0), en.push(z), it(a, !0);
1431
- }).bind(null, e) : Oa), e !== z && (z = e, r === nt && (nt.env = vr()), An && (n = nt.env.Promise, t = e.env, (r.global || e.global) && (Object.defineProperty(m, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
1536
+ }).bind(null, e) : Oa), e !== z && (z = e, r === nt && (nt.env = vr()), An && (n = nt.env.Promise, t = e.env, (r.global || e.global) && (Object.defineProperty(p, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
1432
1537
  }
1433
1538
  function vr() {
1434
- var e = m.Promise;
1435
- return An ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(m, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
1539
+ var e = p.Promise;
1540
+ return An ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(p, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
1436
1541
  }
1437
1542
  function ht(e, t, n, r, a) {
1438
1543
  var s = z;
@@ -1457,8 +1562,8 @@ function Ai() {
1457
1562
  Promise === lt && Ee.echoes === 0 ? tn === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
1458
1563
  }
1459
1564
  ("" + je).indexOf("[native code]") === -1 && (Et = at = Q);
1460
- var be = G.reject, mt = "￿", We = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", wr = "String expected.", xt = [], an = "__dbnames", kn = "readonly", Fn = "readwrite";
1461
- function pt(e, t) {
1565
+ var be = G.reject, pt = "￿", We = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", wr = "String expected.", xt = [], an = "__dbnames", kn = "readonly", Fn = "readwrite";
1566
+ function mt(e, t) {
1462
1567
  return e ? t ? function() {
1463
1568
  return e.apply(this, arguments) && t.apply(this, arguments);
1464
1569
  } : e : t;
@@ -1518,36 +1623,36 @@ function Ai() {
1518
1623
  return n;
1519
1624
  })) : n;
1520
1625
  }
1521
- var Nr = (me.prototype._trans = function(e, t, n) {
1626
+ var Nr = (pe.prototype._trans = function(e, t, n) {
1522
1627
  var r = this._tx || z.trans, a = this.name, s = Pe && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
1523
- function f(w, T, p) {
1524
- if (!p.schema[a]) throw new C.NotFound("Table " + a + " not part of transaction");
1525
- return t(p.idbtrans, p);
1628
+ function f(w, T, m) {
1629
+ if (!m.schema[a]) throw new C.NotFound("Table " + a + " not part of transaction");
1630
+ return t(m.idbtrans, m);
1526
1631
  }
1527
1632
  var d = _t();
1528
1633
  try {
1529
1634
  var v = r && r.db._novip === this.db._novip ? r === z.trans ? r._promise(e, f, n) : rt(function() {
1530
1635
  return r._promise(e, f, n);
1531
- }, { trans: r, transless: z.transless || z }) : (function w(T, p, O, b) {
1636
+ }, { trans: r, transless: z.transless || z }) : (function w(T, m, O, b) {
1532
1637
  if (T.idbdb && (T._state.openComplete || z.letThrough || T._vip)) {
1533
- var _ = T._createTransaction(p, O, T._dbSchema);
1638
+ var _ = T._createTransaction(m, O, T._dbSchema);
1534
1639
  try {
1535
1640
  _.create(), T._state.PR1398_maxLoop = 3;
1536
1641
  } catch (A) {
1537
1642
  return A.name === l.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
1538
- return w(T, p, O, b);
1643
+ return w(T, m, O, b);
1539
1644
  })) : be(A);
1540
1645
  }
1541
- return _._promise(p, function(A, x) {
1646
+ return _._promise(m, function(A, x) {
1542
1647
  return rt(function() {
1543
1648
  return z.trans = _, b(A, x, _);
1544
1649
  });
1545
1650
  }).then(function(A) {
1546
- if (p === "readwrite") try {
1651
+ if (m === "readwrite") try {
1547
1652
  _.idbtrans.commit();
1548
1653
  } catch {
1549
1654
  }
1550
- return p === "readonly" ? A : _._completion.then(function() {
1655
+ return m === "readonly" ? A : _._completion.then(function() {
1551
1656
  return A;
1552
1657
  });
1553
1658
  });
@@ -1558,7 +1663,7 @@ function Ai() {
1558
1663
  T.open().catch(Q);
1559
1664
  }
1560
1665
  return T._state.dbReadyPromise.then(function() {
1561
- return w(T, p, O, b);
1666
+ return w(T, m, O, b);
1562
1667
  });
1563
1668
  })(this.db, e, [this.name], f);
1564
1669
  return s && (v._consoleTask = s, v = v.catch(function(w) {
@@ -1567,14 +1672,14 @@ function Ai() {
1567
1672
  } finally {
1568
1673
  d && Tt();
1569
1674
  }
1570
- }, me.prototype.get = function(e, t) {
1675
+ }, pe.prototype.get = function(e, t) {
1571
1676
  var n = this;
1572
1677
  return e && e.constructor === Object ? this.where(e).first(t) : e == null ? be(new C.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(r) {
1573
1678
  return n.core.get({ trans: r, key: e }).then(function(a) {
1574
1679
  return n.hook.reading.fire(a);
1575
1680
  });
1576
1681
  }).then(t);
1577
- }, me.prototype.where = function(e) {
1682
+ }, pe.prototype.where = function(e) {
1578
1683
  if (typeof e == "string") return new this.db.WhereClause(this, e);
1579
1684
  if (N(e)) return new this.db.WhereClause(this, "[".concat(e.join("+"), "]"));
1580
1685
  var t = y(e);
@@ -1590,7 +1695,7 @@ function Ai() {
1590
1695
  }).sort(function(d, v) {
1591
1696
  return d.keyPath.length - v.keyPath.length;
1592
1697
  })[0];
1593
- if (n && this.db._maxKey !== mt) {
1698
+ if (n && this.db._maxKey !== pt) {
1594
1699
  var s = n.keyPath.slice(0, t.length);
1595
1700
  return this.where(s).equals(s.map(function(v) {
1596
1701
  return e[v];
@@ -1601,36 +1706,36 @@ function Ai() {
1601
1706
  function a(d, v) {
1602
1707
  return re(d, v) === 0;
1603
1708
  }
1604
- var f = t.reduce(function(p, v) {
1605
- var w = p[0], T = p[1], p = r[v], O = e[v];
1606
- return [w || p, w || !p ? pt(T, p && p.multi ? function(b) {
1607
- return b = pe(b, v), N(b) && b.some(function(_) {
1709
+ var f = t.reduce(function(m, v) {
1710
+ var w = m[0], T = m[1], m = r[v], O = e[v];
1711
+ return [w || m, w || !m ? mt(T, m && m.multi ? function(b) {
1712
+ return b = me(b, v), N(b) && b.some(function(_) {
1608
1713
  return a(O, _);
1609
1714
  });
1610
1715
  } : function(b) {
1611
- return a(O, pe(b, v));
1716
+ return a(O, me(b, v));
1612
1717
  }) : T];
1613
1718
  }, [null, null]), s = f[0], f = f[1];
1614
1719
  return s ? this.where(s.name).equals(e[s.keyPath]).filter(f) : n ? this.filter(f) : this.where(t).equals("");
1615
- }, me.prototype.filter = function(e) {
1720
+ }, pe.prototype.filter = function(e) {
1616
1721
  return this.toCollection().and(e);
1617
- }, me.prototype.count = function(e) {
1722
+ }, pe.prototype.count = function(e) {
1618
1723
  return this.toCollection().count(e);
1619
- }, me.prototype.offset = function(e) {
1724
+ }, pe.prototype.offset = function(e) {
1620
1725
  return this.toCollection().offset(e);
1621
- }, me.prototype.limit = function(e) {
1726
+ }, pe.prototype.limit = function(e) {
1622
1727
  return this.toCollection().limit(e);
1623
- }, me.prototype.each = function(e) {
1728
+ }, pe.prototype.each = function(e) {
1624
1729
  return this.toCollection().each(e);
1625
- }, me.prototype.toArray = function(e) {
1730
+ }, pe.prototype.toArray = function(e) {
1626
1731
  return this.toCollection().toArray(e);
1627
- }, me.prototype.toCollection = function() {
1732
+ }, pe.prototype.toCollection = function() {
1628
1733
  return new this.db.Collection(new this.db.WhereClause(this));
1629
- }, me.prototype.orderBy = function(e) {
1734
+ }, pe.prototype.orderBy = function(e) {
1630
1735
  return new this.db.Collection(new this.db.WhereClause(this, N(e) ? "[".concat(e.join("+"), "]") : e));
1631
- }, me.prototype.reverse = function() {
1736
+ }, pe.prototype.reverse = function() {
1632
1737
  return this.toCollection().reverse();
1633
- }, me.prototype.mapToClass = function(e) {
1738
+ }, pe.prototype.mapToClass = function(e) {
1634
1739
  var t, n = this.db, r = this.name;
1635
1740
  function a() {
1636
1741
  return t !== null && t.apply(this, arguments) || this;
@@ -1659,11 +1764,11 @@ function Ai() {
1659
1764
  return T;
1660
1765
  }
1661
1766
  return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = d, this.hook("reading", d), e;
1662
- }, me.prototype.defineClass = function() {
1767
+ }, pe.prototype.defineClass = function() {
1663
1768
  return this.mapToClass(function(e) {
1664
1769
  R(this, e);
1665
1770
  });
1666
- }, me.prototype.add = function(e, t) {
1771
+ }, pe.prototype.add = function(e, t) {
1667
1772
  var n = this, r = this.schema.primKey, a = r.auto, s = r.keyPath, f = e;
1668
1773
  return s && a && (f = on(s)(e)), this._trans("readwrite", function(d) {
1669
1774
  return n.core.mutate({ trans: d, type: "add", keys: t != null ? [t] : null, values: [f] });
@@ -1676,9 +1781,9 @@ function Ai() {
1676
1781
  }
1677
1782
  return d;
1678
1783
  });
1679
- }, me.prototype.update = function(e, t) {
1680
- return typeof e != "object" || N(e) ? this.where(":id").equals(e).modify(t) : (e = pe(e, this.schema.primKey.keyPath), e === void 0 ? be(new C.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
1681
- }, me.prototype.put = function(e, t) {
1784
+ }, pe.prototype.update = function(e, t) {
1785
+ return typeof e != "object" || N(e) ? this.where(":id").equals(e).modify(t) : (e = me(e, this.schema.primKey.keyPath), e === void 0 ? be(new C.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
1786
+ }, pe.prototype.put = function(e, t) {
1682
1787
  var n = this, r = this.schema.primKey, a = r.auto, s = r.keyPath, f = e;
1683
1788
  return s && a && (f = on(s)(e)), this._trans("readwrite", function(d) {
1684
1789
  return n.core.mutate({ trans: d, type: "put", values: [f], keys: t != null ? [t] : null });
@@ -1691,7 +1796,7 @@ function Ai() {
1691
1796
  }
1692
1797
  return d;
1693
1798
  });
1694
- }, me.prototype.delete = function(e) {
1799
+ }, pe.prototype.delete = function(e) {
1695
1800
  var t = this;
1696
1801
  return this._trans("readwrite", function(n) {
1697
1802
  return t.core.mutate({ trans: n, type: "delete", keys: [e] }).then(function(r) {
@@ -1700,7 +1805,7 @@ function Ai() {
1700
1805
  return r.numFailures ? G.reject(r.failures[0]) : void 0;
1701
1806
  });
1702
1807
  });
1703
- }, me.prototype.clear = function() {
1808
+ }, pe.prototype.clear = function() {
1704
1809
  var e = this;
1705
1810
  return this._trans("readwrite", function(t) {
1706
1811
  return e.core.mutate({ trans: t, type: "deleteRange", range: _r }).then(function(n) {
@@ -1709,7 +1814,7 @@ function Ai() {
1709
1814
  }).then(function(t) {
1710
1815
  return t.numFailures ? G.reject(t.failures[0]) : void 0;
1711
1816
  });
1712
- }, me.prototype.bulkGet = function(e) {
1817
+ }, pe.prototype.bulkGet = function(e) {
1713
1818
  var t = this;
1714
1819
  return this._trans("readonly", function(n) {
1715
1820
  return t.core.getMany({ keys: e, trans: n }).then(function(r) {
@@ -1718,7 +1823,7 @@ function Ai() {
1718
1823
  });
1719
1824
  });
1720
1825
  });
1721
- }, me.prototype.bulkAdd = function(e, t, n) {
1826
+ }, pe.prototype.bulkAdd = function(e, t, n) {
1722
1827
  var r = this, a = Array.isArray(t) ? t : void 0, s = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
1723
1828
  return this._trans("readwrite", function(f) {
1724
1829
  var w = r.schema.primKey, d = w.auto, w = w.keyPath;
@@ -1726,12 +1831,12 @@ function Ai() {
1726
1831
  if (a && a.length !== e.length) throw new C.InvalidArgument("Arguments objects and keys must have the same length");
1727
1832
  var v = e.length, w = w && d ? e.map(on(w)) : e;
1728
1833
  return r.core.mutate({ trans: f, type: "add", keys: a, values: w, wantResults: s }).then(function(_) {
1729
- var p = _.numFailures, O = _.results, b = _.lastResult, _ = _.failures;
1730
- if (p === 0) return s ? O : b;
1731
- throw new et("".concat(r.name, ".bulkAdd(): ").concat(p, " of ").concat(v, " operations failed"), _);
1834
+ var m = _.numFailures, O = _.results, b = _.lastResult, _ = _.failures;
1835
+ if (m === 0) return s ? O : b;
1836
+ throw new et("".concat(r.name, ".bulkAdd(): ").concat(m, " of ").concat(v, " operations failed"), _);
1732
1837
  });
1733
1838
  });
1734
- }, me.prototype.bulkPut = function(e, t, n) {
1839
+ }, pe.prototype.bulkPut = function(e, t, n) {
1735
1840
  var r = this, a = Array.isArray(t) ? t : void 0, s = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
1736
1841
  return this._trans("readwrite", function(f) {
1737
1842
  var w = r.schema.primKey, d = w.auto, w = w.keyPath;
@@ -1739,12 +1844,12 @@ function Ai() {
1739
1844
  if (a && a.length !== e.length) throw new C.InvalidArgument("Arguments objects and keys must have the same length");
1740
1845
  var v = e.length, w = w && d ? e.map(on(w)) : e;
1741
1846
  return r.core.mutate({ trans: f, type: "put", keys: a, values: w, wantResults: s }).then(function(_) {
1742
- var p = _.numFailures, O = _.results, b = _.lastResult, _ = _.failures;
1743
- if (p === 0) return s ? O : b;
1744
- throw new et("".concat(r.name, ".bulkPut(): ").concat(p, " of ").concat(v, " operations failed"), _);
1847
+ var m = _.numFailures, O = _.results, b = _.lastResult, _ = _.failures;
1848
+ if (m === 0) return s ? O : b;
1849
+ throw new et("".concat(r.name, ".bulkPut(): ").concat(m, " of ").concat(v, " operations failed"), _);
1745
1850
  });
1746
1851
  });
1747
- }, me.prototype.bulkUpdate = function(e) {
1852
+ }, pe.prototype.bulkUpdate = function(e) {
1748
1853
  var t = this, n = this.core, r = e.map(function(f) {
1749
1854
  return f.key;
1750
1855
  }), a = e.map(function(f) {
@@ -1753,11 +1858,11 @@ function Ai() {
1753
1858
  return this._trans("readwrite", function(f) {
1754
1859
  return n.getMany({ trans: f, keys: r, cache: "clone" }).then(function(d) {
1755
1860
  var v = [], w = [];
1756
- e.forEach(function(p, O) {
1757
- var b = p.key, _ = p.changes, A = d[O];
1861
+ e.forEach(function(m, O) {
1862
+ var b = m.key, _ = m.changes, A = d[O];
1758
1863
  if (A) {
1759
- for (var x = 0, D = Object.keys(_); x < D.length; x++) {
1760
- var S = D[x], P = _[S];
1864
+ for (var x = 0, I = Object.keys(_); x < I.length; x++) {
1865
+ var S = I[x], P = _[S];
1761
1866
  if (S === t.schema.primKey.keyPath) {
1762
1867
  if (re(P, b) !== 0) throw new C.Constraint("Cannot update primary key in bulkUpdate()");
1763
1868
  } else ne(A, S, P);
@@ -1766,18 +1871,18 @@ function Ai() {
1766
1871
  }
1767
1872
  });
1768
1873
  var T = v.length;
1769
- return n.mutate({ trans: f, type: "put", keys: v, values: w, updates: { keys: r, changeSpecs: a } }).then(function(p) {
1770
- var O = p.numFailures, b = p.failures;
1874
+ return n.mutate({ trans: f, type: "put", keys: v, values: w, updates: { keys: r, changeSpecs: a } }).then(function(m) {
1875
+ var O = m.numFailures, b = m.failures;
1771
1876
  if (O === 0) return T;
1772
1877
  for (var _ = 0, A = Object.keys(b); _ < A.length; _++) {
1773
- var x, D = A[_], S = s[Number(D)];
1774
- S != null && (x = b[D], delete b[D], b[S] = x);
1878
+ var x, I = A[_], S = s[Number(I)];
1879
+ S != null && (x = b[I], delete b[I], b[S] = x);
1775
1880
  }
1776
1881
  throw new et("".concat(t.name, ".bulkUpdate(): ").concat(O, " of ").concat(T, " operations failed"), b);
1777
1882
  });
1778
1883
  });
1779
1884
  });
1780
- }, me.prototype.bulkDelete = function(e) {
1885
+ }, pe.prototype.bulkDelete = function(e) {
1781
1886
  var t = this, n = e.length;
1782
1887
  return this._trans("readwrite", function(r) {
1783
1888
  return t.core.mutate({ trans: r, type: "delete", keys: e }).then(function(a) {
@@ -1788,8 +1893,8 @@ function Ai() {
1788
1893
  if (a === 0) return s;
1789
1894
  throw new et("".concat(t.name, ".bulkDelete(): ").concat(a, " of ").concat(n, " operations failed"), f);
1790
1895
  });
1791
- }, me);
1792
- function me() {
1896
+ }, pe);
1897
+ function pe() {
1793
1898
  }
1794
1899
  function Mt(e) {
1795
1900
  function t(f, d) {
@@ -1807,21 +1912,21 @@ function Ai() {
1807
1912
  if (typeof f != "object") {
1808
1913
  var w;
1809
1914
  d = d || Nn;
1810
- var T = { subscribers: [], fire: v = v || Q, subscribe: function(p) {
1811
- T.subscribers.indexOf(p) === -1 && (T.subscribers.push(p), T.fire = d(T.fire, p));
1812
- }, unsubscribe: function(p) {
1915
+ var T = { subscribers: [], fire: v = v || Q, subscribe: function(m) {
1916
+ T.subscribers.indexOf(m) === -1 && (T.subscribers.push(m), T.fire = d(T.fire, m));
1917
+ }, unsubscribe: function(m) {
1813
1918
  T.subscribers = T.subscribers.filter(function(O) {
1814
- return O !== p;
1919
+ return O !== m;
1815
1920
  }), T.fire = T.subscribers.reduce(d, v);
1816
1921
  } };
1817
1922
  return n[f] = t[f] = T;
1818
1923
  }
1819
- y(w = f).forEach(function(p) {
1820
- var O = w[p];
1821
- if (N(O)) s(p, w[p][0], w[p][1]);
1924
+ y(w = f).forEach(function(m) {
1925
+ var O = w[m];
1926
+ if (N(O)) s(m, w[m][0], w[m][1]);
1822
1927
  else {
1823
1928
  if (O !== "asap") throw new C.InvalidArgument("Invalid event config");
1824
- var b = s(p, he, function() {
1929
+ var b = s(m, he, function() {
1825
1930
  for (var _ = arguments.length, A = new Array(_); _--; ) A[_] = arguments[_];
1826
1931
  b.subscribers.forEach(function(x) {
1827
1932
  ae(function() {
@@ -1840,12 +1945,12 @@ function Ai() {
1840
1945
  return !(e.filter || e.algorithm || e.or) && (t ? e.justLimit : !e.replayFilter);
1841
1946
  }
1842
1947
  function Bn(e, t) {
1843
- e.filter = pt(e.filter, t);
1948
+ e.filter = mt(e.filter, t);
1844
1949
  }
1845
1950
  function Mn(e, t, n) {
1846
1951
  var r = e.replayFilter;
1847
1952
  e.replayFilter = r ? function() {
1848
- return pt(r(), t());
1953
+ return mt(r(), t());
1849
1954
  } : t, e.justLimit = n && !r;
1850
1955
  }
1851
1956
  function un(e, t) {
@@ -1859,19 +1964,19 @@ function Ai() {
1859
1964
  return t.openCursor({ trans: n, values: !e.keysOnly, reverse: e.dir === "prev", unique: !!e.unique, query: { index: r, range: e.range } });
1860
1965
  }
1861
1966
  function cn(e, t, n, r) {
1862
- var a = e.replayFilter ? pt(e.filter, e.replayFilter()) : e.filter;
1967
+ var a = e.replayFilter ? mt(e.filter, e.replayFilter()) : e.filter;
1863
1968
  if (e.or) {
1864
1969
  var s = {}, f = function(d, v, w) {
1865
- var T, p;
1970
+ var T, m;
1866
1971
  a && !a(v, w, function(O) {
1867
1972
  return v.stop(O);
1868
1973
  }, function(O) {
1869
1974
  return v.fail(O);
1870
- }) || ((p = "" + (T = v.primaryKey)) == "[object ArrayBuffer]" && (p = "" + new Uint8Array(T)), W(s, p) || (s[p] = !0, t(d, v, w)));
1975
+ }) || ((m = "" + (T = v.primaryKey)) == "[object ArrayBuffer]" && (m = "" + new Uint8Array(T)), W(s, m) || (s[m] = !0, t(d, v, w)));
1871
1976
  };
1872
1977
  return Promise.all([e.or._iterate(f, n), Or(Ar(e, r, n), e.algorithm, f, !e.keysOnly && e.valueMapper)]);
1873
1978
  }
1874
- return Or(Ar(e, r, n), pt(e.algorithm, a), t, !e.keysOnly && e.valueMapper);
1979
+ return Or(Ar(e, r, n), mt(e.algorithm, a), t, !e.keysOnly && e.valueMapper);
1875
1980
  }
1876
1981
  function Or(e, t, n, r) {
1877
1982
  var a = ge(r ? function(s, f, d) {
@@ -1933,7 +2038,7 @@ function Ai() {
1933
2038
  return t.error ? t.table._trans(null, be.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
1934
2039
  }, ue.prototype._addAlgorithm = function(e) {
1935
2040
  var t = this._ctx;
1936
- t.algorithm = pt(t.algorithm, e);
2041
+ t.algorithm = mt(t.algorithm, e);
1937
2042
  }, ue.prototype._iterate = function(e, t) {
1938
2043
  return cn(this._ctx, e, t, this._ctx.table.core);
1939
2044
  }, ue.prototype.clone = function(e) {
@@ -2025,7 +2130,7 @@ function Ai() {
2025
2130
  var t;
2026
2131
  return Bn(this._ctx, function(n) {
2027
2132
  return e(n.value);
2028
- }), (t = this._ctx).isMatch = pt(t.isMatch, e), this;
2133
+ }), (t = this._ctx).isMatch = mt(t.isMatch, e), this;
2029
2134
  }, ue.prototype.and = function(e) {
2030
2135
  return this.filter(e);
2031
2136
  }, ue.prototype.or = function(e) {
@@ -2090,32 +2195,32 @@ function Ai() {
2090
2195
  var t = this, n = this._ctx;
2091
2196
  return this._write(function(r) {
2092
2197
  var a, s, f;
2093
- f = typeof e == "function" ? e : (a = y(e), s = a.length, function(D) {
2198
+ f = typeof e == "function" ? e : (a = y(e), s = a.length, function(I) {
2094
2199
  for (var S = !1, P = 0; P < s; ++P) {
2095
- var k = a[P], M = e[k], L = pe(D, k);
2096
- M instanceof Kt ? (ne(D, k, M.execute(L)), S = !0) : L !== M && (ne(D, k, M), S = !0);
2200
+ var k = a[P], M = e[k], L = me(I, k);
2201
+ M instanceof Kt ? (ne(I, k, M.execute(L)), S = !0) : L !== M && (ne(I, k, M), S = !0);
2097
2202
  }
2098
2203
  return S;
2099
2204
  });
2100
- var d = n.table.core, p = d.schema.primaryKey, v = p.outbound, w = p.extractKey, T = 200, p = t.db._options.modifyChunkSize;
2101
- p && (T = typeof p == "object" ? p[d.name] || p["*"] || 200 : p);
2102
- function O(D, k) {
2205
+ var d = n.table.core, m = d.schema.primaryKey, v = m.outbound, w = m.extractKey, T = 200, m = t.db._options.modifyChunkSize;
2206
+ m && (T = typeof m == "object" ? m[d.name] || m["*"] || 200 : m);
2207
+ function O(I, k) {
2103
2208
  var P = k.failures, k = k.numFailures;
2104
- _ += D - k;
2209
+ _ += I - k;
2105
2210
  for (var M = 0, L = y(P); M < L.length; M++) {
2106
2211
  var K = L[M];
2107
2212
  b.push(P[K]);
2108
2213
  }
2109
2214
  }
2110
- var b = [], _ = 0, A = [], x = e === Dr;
2111
- return t.clone().primaryKeys().then(function(D) {
2215
+ var b = [], _ = 0, A = [], x = e === Ir;
2216
+ return t.clone().primaryKeys().then(function(I) {
2112
2217
  function S(k) {
2113
- var M = Math.min(T, D.length - k), L = D.slice(k, k + M);
2218
+ var M = Math.min(T, I.length - k), L = I.slice(k, k + M);
2114
2219
  return (x ? Promise.resolve([]) : d.getMany({ trans: r, keys: L, cache: "immutable" })).then(function(K) {
2115
2220
  var q = [], V = [], U = v ? [] : null, $ = x ? L : [];
2116
2221
  if (!x) for (var te = 0; te < M; ++te) {
2117
- var oe = K[te], Z = { value: ke(oe), primKey: D[k + te] };
2118
- f.call(Z, Z.value, Z) !== !1 && (Z.value == null ? $.push(D[k + te]) : v || re(w(oe), w(Z.value)) === 0 ? (V.push(Z.value), v && U.push(D[k + te])) : ($.push(D[k + te]), q.push(Z.value)));
2222
+ var oe = K[te], Z = { value: ke(oe), primKey: I[k + te] };
2223
+ f.call(Z, Z.value, Z) !== !1 && (Z.value == null ? $.push(I[k + te]) : v || re(w(oe), w(Z.value)) === 0 ? (V.push(Z.value), v && U.push(I[k + te])) : ($.push(I[k + te]), q.push(Z.value)));
2119
2224
  }
2120
2225
  return Promise.resolve(0 < q.length && d.mutate({ trans: r, type: "add", values: q }).then(function(ve) {
2121
2226
  for (var H in ve.failures) $.splice(parseInt(H), 1);
@@ -2131,20 +2236,20 @@ function Ai() {
2131
2236
  return O($.length, ve);
2132
2237
  });
2133
2238
  }).then(function() {
2134
- return D.length > k + M && S(k + T);
2239
+ return I.length > k + M && S(k + T);
2135
2240
  });
2136
2241
  });
2137
2242
  }
2138
2243
  var P = Nt(n) && n.limit === 1 / 0 && (typeof e != "function" || x) && { index: n.index, range: n.range };
2139
2244
  return S(0).then(function() {
2140
2245
  if (0 < b.length) throw new Je("Error modifying one or more objects", b, _, A);
2141
- return D.length;
2246
+ return I.length;
2142
2247
  });
2143
2248
  });
2144
2249
  });
2145
2250
  }, ue.prototype.delete = function() {
2146
2251
  var e = this._ctx, t = e.range;
2147
- return !Nt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Dr) : this._write(function(n) {
2252
+ return !Nt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Ir) : this._write(function(n) {
2148
2253
  var r = e.table.core.schema.primaryKey, a = t;
2149
2254
  return e.table.core.count({ trans: n, query: { index: r, range: a } }).then(function(s) {
2150
2255
  return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(v) {
@@ -2159,13 +2264,13 @@ function Ai() {
2159
2264
  }, ue);
2160
2265
  function ue() {
2161
2266
  }
2162
- var Dr = function(e, t) {
2267
+ var Ir = function(e, t) {
2163
2268
  return t.value = null;
2164
2269
  };
2165
- function Da(e, t) {
2270
+ function Ia(e, t) {
2166
2271
  return e < t ? -1 : e === t ? 0 : 1;
2167
2272
  }
2168
- function Ia(e, t) {
2273
+ function Da(e, t) {
2169
2274
  return t < e ? -1 : e === t ? 0 : 1;
2170
2275
  }
2171
2276
  function Be(e, t, n) {
@@ -2173,11 +2278,11 @@ function Ai() {
2173
2278
  }
2174
2279
  function At(e) {
2175
2280
  return new e.Collection(e, function() {
2176
- return Ir("");
2281
+ return Dr("");
2177
2282
  }).limit(0);
2178
2283
  }
2179
2284
  function ln(e, t, n, r) {
2180
- var a, s, f, d, v, w, T, p = n.length;
2285
+ var a, s, f, d, v, w, T, m = n.length;
2181
2286
  if (!n.every(function(_) {
2182
2287
  return typeof _ == "string";
2183
2288
  })) return Be(e, wr);
@@ -2190,11 +2295,11 @@ function Ai() {
2190
2295
  return x.toLowerCase();
2191
2296
  } : function(x) {
2192
2297
  return x.toUpperCase();
2193
- }, f = _ === "next" ? Da : Ia;
2298
+ }, f = _ === "next" ? Ia : Da;
2194
2299
  var A = n.map(function(x) {
2195
2300
  return { lower: s(x), upper: a(x) };
2196
- }).sort(function(x, D) {
2197
- return f(x.lower, D.lower);
2301
+ }).sort(function(x, I) {
2302
+ return f(x.lower, I.lower);
2198
2303
  });
2199
2304
  d = A.map(function(x) {
2200
2305
  return x.upper;
@@ -2203,17 +2308,17 @@ function Ai() {
2203
2308
  }), T = (w = _) === "next" ? "" : r;
2204
2309
  }
2205
2310
  O("next"), e = new e.Collection(e, function() {
2206
- return ot(d[0], v[p - 1] + r);
2311
+ return ot(d[0], v[m - 1] + r);
2207
2312
  }), e._ondirectionchange = function(_) {
2208
2313
  O(_);
2209
2314
  };
2210
2315
  var b = 0;
2211
2316
  return e._addAlgorithm(function(_, A, x) {
2212
- var D = _.key;
2213
- if (typeof D != "string") return !1;
2214
- var S = s(D);
2317
+ var I = _.key;
2318
+ if (typeof I != "string") return !1;
2319
+ var S = s(I);
2215
2320
  if (t(S, v, b)) return !0;
2216
- for (var P = null, k = b; k < p; ++k) {
2321
+ for (var P = null, k = b; k < m; ++k) {
2217
2322
  var M = (function(L, K, q, V, U, $) {
2218
2323
  for (var te = Math.min(L.length, V.length), oe = -1, Z = 0; Z < te; ++Z) {
2219
2324
  var ve = K[Z];
@@ -2221,7 +2326,7 @@ function Ai() {
2221
2326
  U(L[Z], ve) < 0 && (oe = Z);
2222
2327
  }
2223
2328
  return te < V.length && $ === "next" ? L + q.substr(L.length) : te < L.length && $ === "prev" ? L.substr(0, q.length) : oe < 0 ? null : L.substr(0, oe) + V[oe] + q.substr(oe + 1);
2224
- })(D, S, d[k], v[k], f, w);
2329
+ })(I, S, d[k], v[k], f, w);
2225
2330
  M === null && P === null ? b = k + 1 : (P === null || 0 < f(P, M)) && (P = M);
2226
2331
  }
2227
2332
  return A(P !== null ? function() {
@@ -2232,7 +2337,7 @@ function Ai() {
2232
2337
  function ot(e, t, n, r) {
2233
2338
  return { type: 2, lower: e, upper: t, lowerOpen: n, upperOpen: r };
2234
2339
  }
2235
- function Ir(e) {
2340
+ function Dr(e) {
2236
2341
  return { type: 1, lower: e, upper: e };
2237
2342
  }
2238
2343
  var Sr = (Object.defineProperty(xe.prototype, "Collection", { get: function() {
@@ -2248,7 +2353,7 @@ function Ai() {
2248
2353
  }
2249
2354
  }, xe.prototype.equals = function(e) {
2250
2355
  return e == null ? Be(this, We) : new this.Collection(this, function() {
2251
- return Ir(e);
2356
+ return Dr(e);
2252
2357
  });
2253
2358
  }, xe.prototype.above = function(e) {
2254
2359
  return e == null ? Be(this, We) : new this.Collection(this, function() {
@@ -2267,11 +2372,11 @@ function Ai() {
2267
2372
  return ot(void 0, e);
2268
2373
  });
2269
2374
  }, xe.prototype.startsWith = function(e) {
2270
- return typeof e != "string" ? Be(this, wr) : this.between(e, e + mt, !0, !0);
2375
+ return typeof e != "string" ? Be(this, wr) : this.between(e, e + pt, !0, !0);
2271
2376
  }, xe.prototype.startsWithIgnoreCase = function(e) {
2272
2377
  return e === "" ? this.startsWith(e) : ln(this, function(t, n) {
2273
2378
  return t.indexOf(n[0]) === 0;
2274
- }, [e], mt);
2379
+ }, [e], pt);
2275
2380
  }, xe.prototype.equalsIgnoreCase = function(e) {
2276
2381
  return ln(this, function(t, n) {
2277
2382
  return t === n[0];
@@ -2287,7 +2392,7 @@ function Ai() {
2287
2392
  return n.some(function(r) {
2288
2393
  return t.indexOf(r) === 0;
2289
2394
  });
2290
- }, e, mt);
2395
+ }, e, pt);
2291
2396
  }, xe.prototype.anyOf = function() {
2292
2397
  var e = this, t = Fe.apply(Ue, arguments), n = this._cmp;
2293
2398
  try {
@@ -2323,18 +2428,18 @@ function Ai() {
2323
2428
  return n ? n.concat([[n[n.length - 1][1], r]]) : [[-1 / 0, r]];
2324
2429
  }, null);
2325
2430
  return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, { includeLowers: !1, includeUppers: !1 });
2326
- }, xe.prototype.inAnyRange = function(D, t) {
2431
+ }, xe.prototype.inAnyRange = function(I, t) {
2327
2432
  var n = this, r = this._cmp, a = this._ascending, s = this._descending, f = this._min, d = this._max;
2328
- if (D.length === 0) return At(this);
2329
- if (!D.every(function(S) {
2433
+ if (I.length === 0) return At(this);
2434
+ if (!I.every(function(S) {
2330
2435
  return S[0] !== void 0 && S[1] !== void 0 && a(S[0], S[1]) <= 0;
2331
2436
  })) return Be(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", C.InvalidArgument);
2332
- var v = !t || t.includeLowers !== !1, w = t && t.includeUppers === !0, T, p = a;
2437
+ var v = !t || t.includeLowers !== !1, w = t && t.includeUppers === !0, T, m = a;
2333
2438
  function O(S, P) {
2334
- return p(S[0], P[0]);
2439
+ return m(S[0], P[0]);
2335
2440
  }
2336
2441
  try {
2337
- (T = D.reduce(function(S, P) {
2442
+ (T = I.reduce(function(S, P) {
2338
2443
  for (var k = 0, M = S.length; k < M; ++k) {
2339
2444
  var L = S[k];
2340
2445
  if (r(P[0], L[1]) < 0 && 0 < r(P[1], L[0])) {
@@ -2355,23 +2460,23 @@ function Ai() {
2355
2460
  return 0 < s(S, T[b][0]);
2356
2461
  } : function(S) {
2357
2462
  return 0 <= s(S, T[b][0]);
2358
- }, x = _, D = new this.Collection(this, function() {
2463
+ }, x = _, I = new this.Collection(this, function() {
2359
2464
  return ot(T[0][0], T[T.length - 1][1], !v, !w);
2360
2465
  });
2361
- return D._ondirectionchange = function(S) {
2362
- p = S === "next" ? (x = _, a) : (x = A, s), T.sort(O);
2363
- }, D._addAlgorithm(function(S, P, k) {
2466
+ return I._ondirectionchange = function(S) {
2467
+ m = S === "next" ? (x = _, a) : (x = A, s), T.sort(O);
2468
+ }, I._addAlgorithm(function(S, P, k) {
2364
2469
  for (var M, L = S.key; x(L); ) if (++b === T.length) return P(k), !1;
2365
2470
  return !_(M = L) && !A(M) || (n._cmp(L, T[b][1]) === 0 || n._cmp(L, T[b][0]) === 0 || P(function() {
2366
- p === a ? S.continue(T[b][0]) : S.continue(T[b][1]);
2471
+ m === a ? S.continue(T[b][0]) : S.continue(T[b][1]);
2367
2472
  }), !1);
2368
- }), D;
2473
+ }), I;
2369
2474
  }, xe.prototype.startsWithAnyOf = function() {
2370
2475
  var e = Fe.apply(Ue, arguments);
2371
2476
  return e.every(function(t) {
2372
2477
  return typeof t == "string";
2373
2478
  }) ? e.length === 0 ? At(this) : this.inAnyRange(e.map(function(t) {
2374
- return [t, t + mt];
2479
+ return [t, t + pt];
2375
2480
  })) : Be(this, "startsWithAnyOf() only works with strings");
2376
2481
  }, xe);
2377
2482
  function xe() {
@@ -2493,8 +2598,8 @@ function Ai() {
2493
2598
  }, [[]];
2494
2599
  } catch {
2495
2600
  return Ut = function() {
2496
- return mt;
2497
- }, mt;
2601
+ return pt;
2602
+ }, pt;
2498
2603
  }
2499
2604
  };
2500
2605
  function Ln(e) {
@@ -2502,9 +2607,9 @@ function Ai() {
2502
2607
  } : typeof e == "string" ? (t = e).split(".").length === 1 ? function(n) {
2503
2608
  return n[t];
2504
2609
  } : function(n) {
2505
- return pe(n, t);
2610
+ return me(n, t);
2506
2611
  } : function(n) {
2507
- return pe(n, e);
2612
+ return me(n, e);
2508
2613
  };
2509
2614
  var t;
2510
2615
  }
@@ -2525,11 +2630,11 @@ function Ai() {
2525
2630
  function a(O) {
2526
2631
  var b, _ = O.name;
2527
2632
  return { name: _, schema: O, mutate: function(A) {
2528
- var x = A.trans, D = A.type, S = A.keys, P = A.values, k = A.range;
2633
+ var x = A.trans, I = A.type, S = A.keys, P = A.values, k = A.range;
2529
2634
  return new Promise(function(M, L) {
2530
2635
  M = ge(M);
2531
- var K = x.objectStore(_), q = K.keyPath == null, V = D === "put" || D === "add";
2532
- if (!V && D !== "delete" && D !== "deleteRange") throw new Error("Invalid operation type: " + D);
2636
+ var K = x.objectStore(_), q = K.keyPath == null, V = I === "put" || I === "add";
2637
+ if (!V && I !== "delete" && I !== "deleteRange") throw new Error("Invalid operation type: " + I);
2533
2638
  var U, $ = (S || P || { length: 1 }).length;
2534
2639
  if (S && P && S.length !== P.length) throw new Error("Given keys array must have same length as given values array.");
2535
2640
  if ($ === 0) return M({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
@@ -2537,18 +2642,18 @@ function Ai() {
2537
2642
  ++ve, qt(Se);
2538
2643
  }
2539
2644
  var oe = [], Z = [], ve = 0;
2540
- if (D === "deleteRange") {
2645
+ if (I === "deleteRange") {
2541
2646
  if (k.type === 4) return M({ numFailures: ve, failures: Z, results: [], lastResult: void 0 });
2542
2647
  k.type === 3 ? oe.push(U = K.clear()) : oe.push(U = K.delete(r(k)));
2543
2648
  } else {
2544
2649
  var q = V ? q ? [P, S] : [P, null] : [S, null], H = q[0], Ce = q[1];
2545
- if (V) for (var De = 0; De < $; ++De) oe.push(U = Ce && Ce[De] !== void 0 ? K[D](H[De], Ce[De]) : K[D](H[De])), U.onerror = te;
2546
- else for (De = 0; De < $; ++De) oe.push(U = K[D](H[De])), U.onerror = te;
2650
+ if (V) for (var Ie = 0; Ie < $; ++Ie) oe.push(U = Ce && Ce[Ie] !== void 0 ? K[I](H[Ie], Ce[Ie]) : K[I](H[Ie])), U.onerror = te;
2651
+ else for (Ie = 0; Ie < $; ++Ie) oe.push(U = K[I](H[Ie])), U.onerror = te;
2547
2652
  }
2548
2653
  function Tn(Se) {
2549
2654
  Se = Se.target.result, oe.forEach(function(vt, ir) {
2550
2655
  return vt.error != null && (Z[ir] = vt.error);
2551
- }), M({ numFailures: ve, failures: Z, results: D === "delete" ? S : oe.map(function(vt) {
2656
+ }), M({ numFailures: ve, failures: Z, results: I === "delete" ? S : oe.map(function(vt) {
2552
2657
  return vt.result;
2553
2658
  }), lastResult: Se });
2554
2659
  }
@@ -2557,40 +2662,40 @@ function Ai() {
2557
2662
  }, U.onsuccess = Tn;
2558
2663
  });
2559
2664
  }, getMany: function(A) {
2560
- var x = A.trans, D = A.keys;
2665
+ var x = A.trans, I = A.keys;
2561
2666
  return new Promise(function(S, P) {
2562
2667
  S = ge(S);
2563
- for (var k, M = x.objectStore(_), L = D.length, K = new Array(L), q = 0, V = 0, U = function(oe) {
2668
+ for (var k, M = x.objectStore(_), L = I.length, K = new Array(L), q = 0, V = 0, U = function(oe) {
2564
2669
  oe = oe.target, K[oe._pos] = oe.result, ++V === q && S(K);
2565
- }, $ = Ve(P), te = 0; te < L; ++te) D[te] != null && ((k = M.get(D[te]))._pos = te, k.onsuccess = U, k.onerror = $, ++q);
2670
+ }, $ = Ve(P), te = 0; te < L; ++te) I[te] != null && ((k = M.get(I[te]))._pos = te, k.onsuccess = U, k.onerror = $, ++q);
2566
2671
  q === 0 && S(K);
2567
2672
  });
2568
2673
  }, get: function(A) {
2569
- var x = A.trans, D = A.key;
2674
+ var x = A.trans, I = A.key;
2570
2675
  return new Promise(function(S, P) {
2571
2676
  S = ge(S);
2572
- var k = x.objectStore(_).get(D);
2677
+ var k = x.objectStore(_).get(I);
2573
2678
  k.onsuccess = function(M) {
2574
2679
  return S(M.target.result);
2575
2680
  }, k.onerror = Ve(P);
2576
2681
  });
2577
2682
  }, query: (b = w, function(A) {
2578
- return new Promise(function(x, D) {
2683
+ return new Promise(function(x, I) {
2579
2684
  x = ge(x);
2580
2685
  var S, P, k, q = A.trans, M = A.values, L = A.limit, U = A.query, K = L === 1 / 0 ? void 0 : L, V = U.index, U = U.range, q = q.objectStore(_), V = V.isPrimaryKey ? q : q.index(V.name), U = r(U);
2581
2686
  if (L === 0) return x({ result: [] });
2582
2687
  b ? ((K = M ? V.getAll(U, K) : V.getAllKeys(U, K)).onsuccess = function($) {
2583
2688
  return x({ result: $.target.result });
2584
- }, K.onerror = Ve(D)) : (S = 0, P = !M && "openKeyCursor" in V ? V.openKeyCursor(U) : V.openCursor(U), k = [], P.onsuccess = function($) {
2689
+ }, K.onerror = Ve(I)) : (S = 0, P = !M && "openKeyCursor" in V ? V.openKeyCursor(U) : V.openCursor(U), k = [], P.onsuccess = function($) {
2585
2690
  var te = P.result;
2586
2691
  return te ? (k.push(M ? te.value : te.primaryKey), ++S === L ? x({ result: k }) : void te.continue()) : x({ result: k });
2587
- }, P.onerror = Ve(D));
2692
+ }, P.onerror = Ve(I));
2588
2693
  });
2589
2694
  }), openCursor: function(A) {
2590
- var x = A.trans, D = A.values, S = A.query, P = A.reverse, k = A.unique;
2695
+ var x = A.trans, I = A.values, S = A.query, P = A.reverse, k = A.unique;
2591
2696
  return new Promise(function(M, L) {
2592
2697
  M = ge(M);
2593
- var V = S.index, K = S.range, q = x.objectStore(_), q = V.isPrimaryKey ? q : q.index(V.name), V = P ? k ? "prevunique" : "prev" : k ? "nextunique" : "next", U = !D && "openKeyCursor" in q ? q.openKeyCursor(r(K), V) : q.openCursor(r(K), V);
2698
+ var V = S.index, K = S.range, q = x.objectStore(_), q = V.isPrimaryKey ? q : q.index(V.name), V = P ? k ? "prevunique" : "prev" : k ? "nextunique" : "next", U = !I && "openKeyCursor" in q ? q.openKeyCursor(r(K), V) : q.openCursor(r(K), V);
2594
2699
  U.onerror = Ve(L), U.onsuccess = ge(function($) {
2595
2700
  var te, oe, Z, ve, H = U.result;
2596
2701
  H ? (H.___id = ++Ra, H.done = !1, te = H.continue.bind(H), oe = (oe = H.continuePrimaryKey) && oe.bind(H), Z = H.advance.bind(H), ve = function() {
@@ -2598,14 +2703,14 @@ function Ai() {
2598
2703
  }, H.trans = x, H.stop = H.continue = H.continuePrimaryKey = H.advance = function() {
2599
2704
  throw new Error("Cursor not started");
2600
2705
  }, H.fail = ge(L), H.next = function() {
2601
- var Ce = this, De = 1;
2706
+ var Ce = this, Ie = 1;
2602
2707
  return this.start(function() {
2603
- return De-- ? Ce.continue() : Ce.stop();
2708
+ return Ie-- ? Ce.continue() : Ce.stop();
2604
2709
  }).then(function() {
2605
2710
  return Ce;
2606
2711
  });
2607
2712
  }, H.start = function(Ce) {
2608
- function De() {
2713
+ function Ie() {
2609
2714
  if (U.result) try {
2610
2715
  Ce();
2611
2716
  } catch (Se) {
@@ -2621,15 +2726,15 @@ function Ai() {
2621
2726
  };
2622
2727
  });
2623
2728
  return U.onsuccess = ge(function(Se) {
2624
- U.onsuccess = De, De();
2625
- }), H.continue = te, H.continuePrimaryKey = oe, H.advance = Z, De(), Tn;
2729
+ U.onsuccess = Ie, Ie();
2730
+ }), H.continue = te, H.continuePrimaryKey = oe, H.advance = Z, Ie(), Tn;
2626
2731
  }, M(H)) : M(null);
2627
2732
  }, L);
2628
2733
  });
2629
2734
  }, count: function(A) {
2630
- var x = A.query, D = A.trans, S = x.index, P = x.range;
2735
+ var x = A.query, I = A.trans, S = x.index, P = x.range;
2631
2736
  return new Promise(function(k, M) {
2632
- var L = D.objectStore(_), K = S.isPrimaryKey ? L : L.index(S.name), L = r(P), K = L ? K.count(L) : K.count();
2737
+ var L = I.objectStore(_), K = S.isPrimaryKey ? L : L.index(S.name), L = r(P), K = L ? K.count(L) : K.count();
2633
2738
  K.onsuccess = ge(function(q) {
2634
2739
  return k(q.target.result);
2635
2740
  }), K.onerror = Ve(M);
@@ -2639,21 +2744,21 @@ function Ai() {
2639
2744
  var s, f, d, T = (f = v, d = Pr((s = e).objectStoreNames), { schema: { name: s.name, tables: d.map(function(O) {
2640
2745
  return f.objectStore(O);
2641
2746
  }).map(function(O) {
2642
- var b = O.keyPath, x = O.autoIncrement, _ = N(b), A = {}, x = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: b == null, compound: _, keyPath: b, autoIncrement: x, unique: !0, extractKey: Ln(b) }, indexes: Pr(O.indexNames).map(function(D) {
2643
- return O.index(D);
2747
+ var b = O.keyPath, x = O.autoIncrement, _ = N(b), A = {}, x = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: b == null, compound: _, keyPath: b, autoIncrement: x, unique: !0, extractKey: Ln(b) }, indexes: Pr(O.indexNames).map(function(I) {
2748
+ return O.index(I);
2644
2749
  }).map(function(k) {
2645
2750
  var S = k.name, P = k.unique, M = k.multiEntry, k = k.keyPath, M = { name: S, compound: N(k), keyPath: k, unique: P, multiEntry: M, extractKey: Ln(k) };
2646
2751
  return A[Vt(k)] = M;
2647
- }), getIndexByKeyPath: function(D) {
2648
- return A[Vt(D)];
2752
+ }), getIndexByKeyPath: function(I) {
2753
+ return A[Vt(I)];
2649
2754
  } };
2650
2755
  return A[":id"] = x.primaryKey, b != null && (A[Vt(b)] = x.primaryKey), x;
2651
- }) }, hasGetAll: 0 < d.length && "getAll" in f.objectStore(d[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = T.schema, w = T.hasGetAll, T = v.tables.map(a), p = {};
2756
+ }) }, hasGetAll: 0 < d.length && "getAll" in f.objectStore(d[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = T.schema, w = T.hasGetAll, T = v.tables.map(a), m = {};
2652
2757
  return T.forEach(function(O) {
2653
- return p[O.name] = O;
2758
+ return m[O.name] = O;
2654
2759
  }), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(O) {
2655
- if (!p[O]) throw new Error("Table '".concat(O, "' not found"));
2656
- return p[O];
2760
+ if (!m[O]) throw new Error("Table '".concat(O, "' not found"));
2761
+ return m[O];
2657
2762
  }, MIN_KEY: -1 / 0, MAX_KEY: Ut(t), schema: v };
2658
2763
  }
2659
2764
  function ka(e, t, n, r) {
@@ -2704,12 +2809,12 @@ function Ai() {
2704
2809
  return z.trans = s, z.transless = d, t !== 0 ? (fn(e, n), w = t, ((v = s).storeNames.includes("$meta") ? v.table("$meta").get("version").then(function(T) {
2705
2810
  return T ?? w;
2706
2811
  }) : G.resolve(w)).then(function(T) {
2707
- return O = T, b = s, _ = n, A = [], T = (p = e)._versions, x = p._dbSchema = mn(0, p.idbdb, _), (T = T.filter(function(D) {
2708
- return D._cfg.version >= O;
2709
- })).length !== 0 ? (T.forEach(function(D) {
2812
+ return O = T, b = s, _ = n, A = [], T = (m = e)._versions, x = m._dbSchema = pn(0, m.idbdb, _), (T = T.filter(function(I) {
2813
+ return I._cfg.version >= O;
2814
+ })).length !== 0 ? (T.forEach(function(I) {
2710
2815
  A.push(function() {
2711
- var S = x, P = D._cfg.dbschema;
2712
- pn(p, S, _), pn(p, P, _), x = p._dbSchema = P;
2816
+ var S = x, P = I._cfg.dbschema;
2817
+ mn(m, S, _), mn(m, P, _), x = m._dbSchema = P;
2713
2818
  var k = Vn(S, P);
2714
2819
  k.add.forEach(function(V) {
2715
2820
  Gn(_, V[0], V[1].primKey, V[1].indexes);
@@ -2724,13 +2829,13 @@ function Ai() {
2724
2829
  return U.deleteIndex($);
2725
2830
  });
2726
2831
  });
2727
- var M = D._cfg.contentUpgrade;
2728
- if (M && D._cfg.version > O) {
2729
- fn(p, _), b._memoizedTables = {};
2730
- var L = Ie(P);
2832
+ var M = I._cfg.contentUpgrade;
2833
+ if (M && I._cfg.version > O) {
2834
+ fn(m, _), b._memoizedTables = {};
2835
+ var L = De(P);
2731
2836
  k.del.forEach(function(V) {
2732
2837
  L[V] = S[V];
2733
- }), Un(p, [p.Transaction.prototype]), dn(p, [p.Transaction.prototype], y(L), L), b.schema = L;
2838
+ }), Un(m, [m.Transaction.prototype]), dn(m, [m.Transaction.prototype], y(L), L), b.schema = L;
2734
2839
  var K, q = qe(M);
2735
2840
  return q && Et(), k = G.follow(function() {
2736
2841
  var V;
@@ -2740,21 +2845,21 @@ function Ai() {
2740
2845
  });
2741
2846
  }
2742
2847
  }), A.push(function(S) {
2743
- var P, k, M = D._cfg.dbschema;
2848
+ var P, k, M = I._cfg.dbschema;
2744
2849
  P = M, k = S, [].slice.call(k.db.objectStoreNames).forEach(function(L) {
2745
2850
  return P[L] == null && k.db.deleteObjectStore(L);
2746
- }), Un(p, [p.Transaction.prototype]), dn(p, [p.Transaction.prototype], p._storeNames, p._dbSchema), b.schema = p._dbSchema;
2851
+ }), Un(m, [m.Transaction.prototype]), dn(m, [m.Transaction.prototype], m._storeNames, m._dbSchema), b.schema = m._dbSchema;
2747
2852
  }), A.push(function(S) {
2748
- p.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(p.idbdb.version / 10) === D._cfg.version ? (p.idbdb.deleteObjectStore("$meta"), delete p._dbSchema.$meta, p._storeNames = p._storeNames.filter(function(P) {
2853
+ m.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(m.idbdb.version / 10) === I._cfg.version ? (m.idbdb.deleteObjectStore("$meta"), delete m._dbSchema.$meta, m._storeNames = m._storeNames.filter(function(P) {
2749
2854
  return P !== "$meta";
2750
- })) : S.objectStore("$meta").put(D._cfg.version, "version"));
2855
+ })) : S.objectStore("$meta").put(I._cfg.version, "version"));
2751
2856
  });
2752
- }), (function D() {
2753
- return A.length ? G.resolve(A.shift()(b.idbtrans)).then(D) : G.resolve();
2857
+ }), (function I() {
2858
+ return A.length ? G.resolve(A.shift()(b.idbtrans)).then(I) : G.resolve();
2754
2859
  })().then(function() {
2755
2860
  kr(x, _);
2756
2861
  })) : G.resolve();
2757
- var p, O, b, _, A, x;
2862
+ var m, O, b, _, A, x;
2758
2863
  }).catch(f)) : (y(a).forEach(function(T) {
2759
2864
  Gn(n, T, a[T].primKey, a[T].indexes);
2760
2865
  }), fn(e, n), void G.follow(function() {
@@ -2765,8 +2870,8 @@ function Ai() {
2765
2870
  }
2766
2871
  function Ma(e, t) {
2767
2872
  kr(e._dbSchema, t), t.db.version % 10 != 0 || t.objectStoreNames.contains("$meta") || t.db.createObjectStore("$meta").add(Math.ceil(t.db.version / 10 - 1), "version");
2768
- var n = mn(0, e.idbdb, t);
2769
- pn(e, e._dbSchema, t);
2873
+ var n = pn(0, e.idbdb, t);
2874
+ mn(e, e._dbSchema, t);
2770
2875
  for (var r = 0, a = Vn(n, e._dbSchema).change; r < a.length; r++) {
2771
2876
  var s = (function(f) {
2772
2877
  if (f.change.length || f.recreate) return console.warn("Unable to patch indexes of table ".concat(f.name, " because it has changes on the type of index or primary key.")), { value: void 0 };
@@ -2790,8 +2895,8 @@ function Ai() {
2790
2895
  var d = a.idxByName, v = s.idxByName, w = void 0;
2791
2896
  for (w in d) v[w] || f.del.push(w);
2792
2897
  for (w in v) {
2793
- var T = d[w], p = v[w];
2794
- T ? T.src !== p.src && f.change.push(p) : f.add.push(p);
2898
+ var T = d[w], m = v[w];
2899
+ T ? T.src !== m.src && f.change.push(m) : f.add.push(m);
2795
2900
  }
2796
2901
  (0 < f.del.length || 0 < f.add.length || 0 < f.change.length) && r.change.push(f);
2797
2902
  }
@@ -2813,7 +2918,7 @@ function Ai() {
2813
2918
  function hn(e, t) {
2814
2919
  e.createIndex(t.name, t.keyPath, { unique: t.unique, multiEntry: t.multi });
2815
2920
  }
2816
- function mn(e, t, n) {
2921
+ function pn(e, t, n) {
2817
2922
  var r = {};
2818
2923
  return Te(t.objectStoreNames, 0).forEach(function(a) {
2819
2924
  for (var s = n.objectStore(a), f = Kn(Rr(w = s.keyPath), w || "", !0, !1, !!s.autoIncrement, w && typeof w != "string", !0), d = [], v = 0; v < s.indexNames.length; ++v) {
@@ -2823,7 +2928,7 @@ function Ai() {
2823
2928
  r[a] = qn(a, f, d);
2824
2929
  }), r;
2825
2930
  }
2826
- function pn(e, t, n) {
2931
+ function mn(e, t, n) {
2827
2932
  for (var r = n.db.objectStoreNames, a = 0; a < r.length; ++a) {
2828
2933
  var s = r[a], f = n.objectStore(s);
2829
2934
  e._hasGetAll = "getAll" in f;
@@ -2832,7 +2937,7 @@ function Ai() {
2832
2937
  !t[s] || (w = t[s].idxByName[T]) && (w.name = v, delete t[s].idxByName[T], t[s].idxByName[v] = w);
2833
2938
  }
2834
2939
  }
2835
- typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && m.WorkerGlobalScope && m instanceof m.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
2940
+ typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && p.WorkerGlobalScope && p instanceof p.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
2836
2941
  }
2837
2942
  function Fr(e) {
2838
2943
  return e.split(",").map(function(t, n) {
@@ -2990,8 +3095,8 @@ function Ai() {
2990
3095
  }
2991
3096
  function Kr(e, t, n, r) {
2992
3097
  for (var a = [], s = 0, f = Object.entries(e.queries.query); s < f.length; s++) {
2993
- for (var d = f[s], v = d[0], w = [], T = 0, p = d[1]; T < p.length; T++) {
2994
- var O = p[T];
3098
+ for (var d = f[s], v = d[0], w = [], T = 0, m = d[1]; T < m.length; T++) {
3099
+ var O = m[T];
2995
3100
  zn(t, O.obsSet) ? O.subscribers.forEach(function(x) {
2996
3101
  return n.add(x);
2997
3102
  }) : r && w.push(O);
@@ -3019,17 +3124,17 @@ function Ai() {
3019
3124
  var _ = e.name, A = t.autoSchema || !a ? n.open(_) : n.open(_, a);
3020
3125
  if (!A) throw new C.MissingAPI();
3021
3126
  A.onerror = Ve(b), A.onblocked = ge(e._fireOnBlocked), A.onupgradeneeded = ge(function(x) {
3022
- var D;
3023
- T = A.transaction, t.autoSchema && !e._options.allowEmptyDB ? (A.onerror = qt, T.abort(), A.result.close(), (D = n.deleteDatabase(_)).onsuccess = D.onerror = ge(function() {
3127
+ var I;
3128
+ T = A.transaction, t.autoSchema && !e._options.allowEmptyDB ? (A.onerror = qt, T.abort(), A.result.close(), (I = n.deleteDatabase(_)).onsuccess = I.onerror = ge(function() {
3024
3129
  b(new C.NoSuchDatabase("Database ".concat(_, " doesnt exist")));
3025
- })) : (T.onerror = Ve(b), x = x.oldVersion > Math.pow(2, 62) ? 0 : x.oldVersion, p = x < 1, e.idbdb = A.result, s && Ma(e, T), Ba(e, x / 10, T, b));
3130
+ })) : (T.onerror = Ve(b), x = x.oldVersion > Math.pow(2, 62) ? 0 : x.oldVersion, m = x < 1, e.idbdb = A.result, s && Ma(e, T), Ba(e, x / 10, T, b));
3026
3131
  }, b), A.onsuccess = ge(function() {
3027
3132
  T = null;
3028
- var x, D, S, P, k, M = e.idbdb = A.result, L = Te(M.objectStoreNames);
3133
+ var x, I, S, P, k, M = e.idbdb = A.result, L = Te(M.objectStoreNames);
3029
3134
  if (0 < L.length) try {
3030
3135
  var K = M.transaction((P = L).length === 1 ? P[0] : P, "readonly");
3031
- if (t.autoSchema) D = M, S = K, (x = e).verno = D.version / 10, S = x._dbSchema = mn(0, D, S), x._storeNames = Te(D.objectStoreNames, 0), dn(x, [x._allTables], y(S), S);
3032
- else if (pn(e, e._dbSchema, K), ((k = Vn(mn(0, (k = e).idbdb, K), k._dbSchema)).add.length || k.change.some(function(q) {
3136
+ if (t.autoSchema) I = M, S = K, (x = e).verno = I.version / 10, S = x._dbSchema = pn(0, I, S), x._storeNames = Te(I.objectStoreNames, 0), dn(x, [x._allTables], y(S), S);
3137
+ else if (mn(e, e._dbSchema, K), ((k = Vn(pn(0, (k = e).idbdb, K), k._dbSchema)).add.length || k.change.some(function(q) {
3033
3138
  return q.add.length || q.change.length;
3034
3139
  })) && !s) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), M.close(), a = M.version + 1, s = !0, O(d());
3035
3140
  fn(e, K);
@@ -3039,7 +3144,7 @@ function Ai() {
3039
3144
  t.vcFired = !0, e.on("versionchange").fire(q);
3040
3145
  }), M.onclose = ge(function(q) {
3041
3146
  e.on("close").fire(q);
3042
- }), p && (k = e._deps, K = _, M = k.indexedDB, k = k.IDBKeyRange, Xn(M) || K === an || $n(M, k).put({ name: K }).catch(Q)), O();
3147
+ }), m && (k = e._deps, K = _, M = k.indexedDB, k = k.IDBKeyRange, Xn(M) || K === an || $n(M, k).put({ name: K }).catch(Q)), O();
3043
3148
  }, b);
3044
3149
  }).catch(function(O) {
3045
3150
  switch (O?.name) {
@@ -3052,7 +3157,7 @@ function Ai() {
3052
3157
  return G.reject(O);
3053
3158
  });
3054
3159
  }
3055
- var v, w = t.dbReadyResolve, T = null, p = !1;
3160
+ var v, w = t.dbReadyResolve, T = null, m = !1;
3056
3161
  return G.race([r, (typeof navigator > "u" ? G.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(O) {
3057
3162
  function b() {
3058
3163
  return indexedDB.databases().finally(O);
@@ -3084,7 +3189,7 @@ function Ai() {
3084
3189
  t.openComplete = !0, w();
3085
3190
  }).then(function() {
3086
3191
  var O;
3087
- return p && (O = {}, e.tables.forEach(function(b) {
3192
+ return m && (O = {}, e.tables.forEach(function(b) {
3088
3193
  b.schema.indexes.forEach(function(_) {
3089
3194
  _.name && (O["idb://".concat(e.name, "/").concat(b.name, "/").concat(_.name)] = new Oe(-1 / 0, [[[]]]));
3090
3195
  }), O["idb://".concat(e.name, "/").concat(b.name, "/")] = O["idb://".concat(e.name, "/").concat(b.name, "/:dels")] = new Oe(-1 / 0, [[[]]]);
@@ -3113,44 +3218,44 @@ function Ai() {
3113
3218
  var qa = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3114
3219
  return i(i({}, e), { table: function(t) {
3115
3220
  var n = e.table(t), r = n.schema, a = {}, s = [];
3116
- function f(p, O, b) {
3117
- var _ = Vt(p), A = a[_] = a[_] || [], x = p == null ? 0 : typeof p == "string" ? 1 : p.length, D = 0 < O, D = i(i({}, b), { name: D ? "".concat(_, "(virtual-from:").concat(b.name, ")") : b.name, lowLevelIndex: b, isVirtual: D, keyTail: O, keyLength: x, extractKey: Ln(p), unique: !D && b.unique });
3118
- return A.push(D), D.isPrimaryKey || s.push(D), 1 < x && f(x === 2 ? p[0] : p.slice(0, x - 1), O + 1, b), A.sort(function(S, P) {
3221
+ function f(m, O, b) {
3222
+ var _ = Vt(m), A = a[_] = a[_] || [], x = m == null ? 0 : typeof m == "string" ? 1 : m.length, I = 0 < O, I = i(i({}, b), { name: I ? "".concat(_, "(virtual-from:").concat(b.name, ")") : b.name, lowLevelIndex: b, isVirtual: I, keyTail: O, keyLength: x, extractKey: Ln(m), unique: !I && b.unique });
3223
+ return A.push(I), I.isPrimaryKey || s.push(I), 1 < x && f(x === 2 ? m[0] : m.slice(0, x - 1), O + 1, b), A.sort(function(S, P) {
3119
3224
  return S.keyTail - P.keyTail;
3120
- }), D;
3225
+ }), I;
3121
3226
  }
3122
3227
  t = f(r.primaryKey.keyPath, 0, r.primaryKey), a[":id"] = [t];
3123
3228
  for (var d = 0, v = r.indexes; d < v.length; d++) {
3124
3229
  var w = v[d];
3125
3230
  f(w.keyPath, 0, w);
3126
3231
  }
3127
- function T(p) {
3128
- var O, b = p.query.index;
3129
- return b.isVirtual ? i(i({}, p), { query: { index: b.lowLevelIndex, range: (O = p.query.range, b = b.keyTail, { type: O.type === 1 ? 2 : O.type, lower: bn(O.lower, O.lowerOpen ? e.MAX_KEY : e.MIN_KEY, b), lowerOpen: !0, upper: bn(O.upper, O.upperOpen ? e.MIN_KEY : e.MAX_KEY, b), upperOpen: !0 }) } }) : p;
3232
+ function T(m) {
3233
+ var O, b = m.query.index;
3234
+ return b.isVirtual ? i(i({}, m), { query: { index: b.lowLevelIndex, range: (O = m.query.range, b = b.keyTail, { type: O.type === 1 ? 2 : O.type, lower: bn(O.lower, O.lowerOpen ? e.MAX_KEY : e.MIN_KEY, b), lowerOpen: !0, upper: bn(O.upper, O.upperOpen ? e.MIN_KEY : e.MAX_KEY, b), upperOpen: !0 }) } }) : m;
3130
3235
  }
3131
- return i(i({}, n), { schema: i(i({}, r), { primaryKey: t, indexes: s, getIndexByKeyPath: function(p) {
3132
- return (p = a[Vt(p)]) && p[0];
3133
- } }), count: function(p) {
3134
- return n.count(T(p));
3135
- }, query: function(p) {
3136
- return n.query(T(p));
3137
- }, openCursor: function(p) {
3138
- var O = p.query.index, b = O.keyTail, _ = O.isVirtual, A = O.keyLength;
3139
- return _ ? n.openCursor(T(p)).then(function(D) {
3140
- return D && x(D);
3141
- }) : n.openCursor(p);
3142
- function x(D) {
3143
- return Object.create(D, { continue: { value: function(S) {
3144
- S != null ? D.continue(bn(S, p.reverse ? e.MAX_KEY : e.MIN_KEY, b)) : p.unique ? D.continue(D.key.slice(0, A).concat(p.reverse ? e.MIN_KEY : e.MAX_KEY, b)) : D.continue();
3236
+ return i(i({}, n), { schema: i(i({}, r), { primaryKey: t, indexes: s, getIndexByKeyPath: function(m) {
3237
+ return (m = a[Vt(m)]) && m[0];
3238
+ } }), count: function(m) {
3239
+ return n.count(T(m));
3240
+ }, query: function(m) {
3241
+ return n.query(T(m));
3242
+ }, openCursor: function(m) {
3243
+ var O = m.query.index, b = O.keyTail, _ = O.isVirtual, A = O.keyLength;
3244
+ return _ ? n.openCursor(T(m)).then(function(I) {
3245
+ return I && x(I);
3246
+ }) : n.openCursor(m);
3247
+ function x(I) {
3248
+ return Object.create(I, { continue: { value: function(S) {
3249
+ S != null ? I.continue(bn(S, m.reverse ? e.MAX_KEY : e.MIN_KEY, b)) : m.unique ? I.continue(I.key.slice(0, A).concat(m.reverse ? e.MIN_KEY : e.MAX_KEY, b)) : I.continue();
3145
3250
  } }, continuePrimaryKey: { value: function(S, P) {
3146
- D.continuePrimaryKey(bn(S, e.MAX_KEY, b), P);
3251
+ I.continuePrimaryKey(bn(S, e.MAX_KEY, b), P);
3147
3252
  } }, primaryKey: { get: function() {
3148
- return D.primaryKey;
3253
+ return I.primaryKey;
3149
3254
  } }, key: { get: function() {
3150
- var S = D.key;
3255
+ var S = I.key;
3151
3256
  return A === 1 ? S[0] : S.slice(0, A);
3152
3257
  } }, value: { get: function() {
3153
- return D.value;
3258
+ return I.value;
3154
3259
  } } });
3155
3260
  }
3156
3261
  } });
@@ -3191,31 +3296,31 @@ function Ai() {
3191
3296
  case "deleteRange":
3192
3297
  if (d.fire === Q) break;
3193
3298
  return s._promise("readwrite", function() {
3194
- return (function p(O, b, _) {
3299
+ return (function m(O, b, _) {
3195
3300
  return n.query({ trans: O, values: !1, query: { index: r, range: b }, limit: _ }).then(function(A) {
3196
3301
  var x = A.result;
3197
- return T({ type: "delete", keys: x, trans: O }).then(function(D) {
3198
- return 0 < D.numFailures ? Promise.reject(D.failures[0]) : x.length < _ ? { failures: [], numFailures: 0, lastResult: void 0 } : p(O, i(i({}, b), { lower: x[x.length - 1], lowerOpen: !0 }), _);
3302
+ return T({ type: "delete", keys: x, trans: O }).then(function(I) {
3303
+ return 0 < I.numFailures ? Promise.reject(I.failures[0]) : x.length < _ ? { failures: [], numFailures: 0, lastResult: void 0 } : m(O, i(i({}, b), { lower: x[x.length - 1], lowerOpen: !0 }), _);
3199
3304
  });
3200
3305
  });
3201
3306
  })(a.trans, a.range, 1e4);
3202
3307
  }, !0);
3203
3308
  }
3204
3309
  return n.mutate(a);
3205
- function T(p) {
3206
- var O, b, _, A = z.trans, x = p.keys || tr(r, p);
3310
+ function T(m) {
3311
+ var O, b, _, A = z.trans, x = m.keys || tr(r, m);
3207
3312
  if (!x) throw new Error("Keys missing");
3208
- return (p = p.type === "add" || p.type === "put" ? i(i({}, p), { keys: x }) : i({}, p)).type !== "delete" && (p.values = h([], p.values)), p.keys && (p.keys = h([], p.keys)), O = n, _ = x, ((b = p).type === "add" ? Promise.resolve([]) : O.getMany({ trans: b.trans, keys: _, cache: "immutable" })).then(function(D) {
3313
+ return (m = m.type === "add" || m.type === "put" ? i(i({}, m), { keys: x }) : i({}, m)).type !== "delete" && (m.values = h([], m.values)), m.keys && (m.keys = h([], m.keys)), O = n, _ = x, ((b = m).type === "add" ? Promise.resolve([]) : O.getMany({ trans: b.trans, keys: _, cache: "immutable" })).then(function(I) {
3209
3314
  var S = x.map(function(P, k) {
3210
- var M, L, K, q = D[k], V = { onerror: null, onsuccess: null };
3211
- return p.type === "delete" ? d.fire.call(V, P, q, A) : p.type === "add" || q === void 0 ? (M = v.fire.call(V, P, p.values[k], A), P == null && M != null && (p.keys[k] = P = M, r.outbound || ne(p.values[k], r.keyPath, P))) : (M = er(q, p.values[k]), (L = w.fire.call(V, M, P, q, A)) && (K = p.values[k], Object.keys(L).forEach(function(U) {
3315
+ var M, L, K, q = I[k], V = { onerror: null, onsuccess: null };
3316
+ return m.type === "delete" ? d.fire.call(V, P, q, A) : m.type === "add" || q === void 0 ? (M = v.fire.call(V, P, m.values[k], A), P == null && M != null && (m.keys[k] = P = M, r.outbound || ne(m.values[k], r.keyPath, P))) : (M = er(q, m.values[k]), (L = w.fire.call(V, M, P, q, A)) && (K = m.values[k], Object.keys(L).forEach(function(U) {
3212
3317
  W(K, U) ? K[U] = L[U] : ne(K, U, L[U]);
3213
3318
  }))), V;
3214
3319
  });
3215
- return n.mutate(p).then(function(P) {
3320
+ return n.mutate(m).then(function(P) {
3216
3321
  for (var k = P.failures, M = P.results, L = P.numFailures, P = P.lastResult, K = 0; K < x.length; ++K) {
3217
3322
  var q = (M || x)[K], V = S[K];
3218
- q == null ? V.onerror && V.onerror(k[K]) : V.onsuccess && V.onsuccess(p.type === "put" && D[K] ? p.values[K] : q);
3323
+ q == null ? V.onerror && V.onerror(k[K]) : V.onsuccess && V.onsuccess(m.type === "put" && I[K] ? m.values[K] : q);
3219
3324
  }
3220
3325
  return { failures: k, results: M, numFailures: L, lastResult: P };
3221
3326
  }).catch(function(P) {
@@ -3271,16 +3376,16 @@ function Ai() {
3271
3376
  if (z.subscr && a !== "readonly") throw new C.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(z.querier));
3272
3377
  return e.transaction(r, a, s);
3273
3378
  }, table: function(r) {
3274
- var a = e.table(r), s = a.schema, f = s.primaryKey, p = s.indexes, d = f.extractKey, v = f.outbound, w = f.autoIncrement && p.filter(function(b) {
3379
+ var a = e.table(r), s = a.schema, f = s.primaryKey, m = s.indexes, d = f.extractKey, v = f.outbound, w = f.autoIncrement && m.filter(function(b) {
3275
3380
  return b.compound && b.keyPath.includes(f.keyPath);
3276
3381
  }), T = i(i({}, a), { mutate: function(b) {
3277
3382
  function _(U) {
3278
3383
  return U = "idb://".concat(t, "/").concat(r, "/").concat(U), P[U] || (P[U] = new Oe());
3279
3384
  }
3280
- var A, x, D, S = b.trans, P = b.mutatedParts || (b.mutatedParts = {}), k = _(""), M = _(":dels"), L = b.type, V = b.type === "deleteRange" ? [b.range] : b.type === "delete" ? [b.keys] : b.values.length < 50 ? [tr(f, b).filter(function(U) {
3385
+ var A, x, I, S = b.trans, P = b.mutatedParts || (b.mutatedParts = {}), k = _(""), M = _(":dels"), L = b.type, V = b.type === "deleteRange" ? [b.range] : b.type === "delete" ? [b.keys] : b.values.length < 50 ? [tr(f, b).filter(function(U) {
3281
3386
  return U;
3282
3387
  }), b.values] : [], K = V[0], q = V[1], V = b.trans._cache;
3283
- return N(K) ? (k.addKeys(K), (V = L === "delete" || K.length === q.length ? qr(K, V) : null) || M.addKeys(K), (V || q) && (A = _, x = V, D = q, s.indexes.forEach(function(U) {
3388
+ return N(K) ? (k.addKeys(K), (V = L === "delete" || K.length === q.length ? qr(K, V) : null) || M.addKeys(K), (V || q) && (A = _, x = V, I = q, s.indexes.forEach(function(U) {
3284
3389
  var $ = A(U.name || "");
3285
3390
  function te(Z) {
3286
3391
  return Z != null ? U.extractKey(Z) : null;
@@ -3290,8 +3395,8 @@ function Ai() {
3290
3395
  return $.addKey(ve);
3291
3396
  }) : $.addKey(Z);
3292
3397
  }
3293
- (x || D).forEach(function(Z, Ce) {
3294
- var H = x && te(x[Ce]), Ce = D && te(D[Ce]);
3398
+ (x || I).forEach(function(Z, Ce) {
3399
+ var H = x && te(x[Ce]), Ce = I && te(I[Ce]);
3295
3400
  re(H, Ce) !== 0 && (H != null && oe(H), Ce != null && oe(Ce));
3296
3401
  });
3297
3402
  }))) : K ? (q = { from: (q = K.lower) !== null && q !== void 0 ? q : e.MIN_KEY, to: (q = K.upper) !== null && q !== void 0 ? q : e.MAX_KEY }, M.add(q), k.add(q)) : (k.add(n), M.add(n), s.indexes.forEach(function(U) {
@@ -3306,20 +3411,20 @@ function Ai() {
3306
3411
  _($.name).addKeys(te);
3307
3412
  })), S.mutatedParts = yn(S.mutatedParts || {}, P), U;
3308
3413
  });
3309
- } }), p = function(_) {
3414
+ } }), m = function(_) {
3310
3415
  var A = _.query, _ = A.index, A = A.range;
3311
3416
  return [_, new Oe((_ = A.lower) !== null && _ !== void 0 ? _ : e.MIN_KEY, (A = A.upper) !== null && A !== void 0 ? A : e.MAX_KEY)];
3312
3417
  }, O = { get: function(b) {
3313
3418
  return [f, new Oe(b.key)];
3314
3419
  }, getMany: function(b) {
3315
3420
  return [f, new Oe().addKeys(b.keys)];
3316
- }, count: p, query: p, openCursor: p };
3421
+ }, count: m, query: m, openCursor: m };
3317
3422
  return y(O).forEach(function(b) {
3318
3423
  T[b] = function(_) {
3319
- var A = z.subscr, x = !!A, D = Lr(z, a) && Ur(b, _) ? _.obsSet = {} : A;
3424
+ var A = z.subscr, x = !!A, I = Lr(z, a) && Ur(b, _) ? _.obsSet = {} : A;
3320
3425
  if (x) {
3321
3426
  var S = function(q) {
3322
- return q = "idb://".concat(t, "/").concat(r, "/").concat(q), D[q] || (D[q] = new Oe());
3427
+ return q = "idb://".concat(t, "/").concat(r, "/").concat(q), I[q] || (I[q] = new Oe());
3323
3428
  }, P = S(""), k = S(":dels"), A = O[b](_), x = A[0], A = A[1];
3324
3429
  if ((b === "query" && x.isPrimaryKey && !_.values ? k : S(x.name || "")).add(A), !x.isPrimaryKey) {
3325
3430
  if (b !== "count") {
@@ -3369,13 +3474,13 @@ function Ai() {
3369
3474
  }
3370
3475
  function Gr(e, t, O, r, a, s) {
3371
3476
  if (!O || O.length === 0) return e;
3372
- var f = t.query.index, d = f.multiEntry, v = t.query.range, w = r.schema.primaryKey.extractKey, T = f.extractKey, p = (f.lowLevelIndex || f).extractKey, O = O.reduce(function(b, _) {
3477
+ var f = t.query.index, d = f.multiEntry, v = t.query.range, w = r.schema.primaryKey.extractKey, T = f.extractKey, m = (f.lowLevelIndex || f).extractKey, O = O.reduce(function(b, _) {
3373
3478
  var A = b, x = [];
3374
- if (_.type === "add" || _.type === "put") for (var D = new Oe(), S = _.values.length - 1; 0 <= S; --S) {
3479
+ if (_.type === "add" || _.type === "put") for (var I = new Oe(), S = _.values.length - 1; 0 <= S; --S) {
3375
3480
  var P, k = _.values[S], M = w(k);
3376
- D.hasKey(M) || (P = T(k), (d && N(P) ? P.some(function(U) {
3481
+ I.hasKey(M) || (P = T(k), (d && N(P) ? P.some(function(U) {
3377
3482
  return nr(U, v);
3378
- }) : nr(P, v)) && (D.addKey(M), x.push(k)));
3483
+ }) : nr(P, v)) && (I.addKey(M), x.push(k)));
3379
3484
  }
3380
3485
  switch (_.type) {
3381
3486
  case "add":
@@ -3414,7 +3519,7 @@ function Ai() {
3414
3519
  return A;
3415
3520
  }, e);
3416
3521
  return O === e ? e : (O.sort(function(b, _) {
3417
- return re(p(b), p(_)) || re(w(b), w(_));
3522
+ return re(m(b), m(_)) || re(w(b), w(_));
3418
3523
  }), t.limit && t.limit < 1 / 0 && (O.length > t.limit ? O.length = t.limit : e.length === t.limit && O.length < t.limit && (a.dirty = !0)), s ? Object.freeze(O) : O);
3419
3524
  }
3420
3525
  function $r(e, t) {
@@ -3456,13 +3561,13 @@ function Ai() {
3456
3561
  return r === "readwrite" && (f = (s = new AbortController()).signal, a = function(v) {
3457
3562
  return function() {
3458
3563
  if (s.abort(), r === "readwrite") {
3459
- for (var w = /* @__PURE__ */ new Set(), T = 0, p = n; T < p.length; T++) {
3460
- var O = p[T], b = gt["idb://".concat(t, "/").concat(O)];
3564
+ for (var w = /* @__PURE__ */ new Set(), T = 0, m = n; T < m.length; T++) {
3565
+ var O = m[T], b = gt["idb://".concat(t, "/").concat(O)];
3461
3566
  if (b) {
3462
3567
  var _ = e.table(O), A = b.optimisticOps.filter(function($) {
3463
3568
  return $.trans === d;
3464
3569
  });
3465
- if (d._explicit && v && d.mutatedParts) for (var x = 0, D = Object.values(b.queries.query); x < D.length; x++) for (var S = 0, P = (L = D[x]).slice(); S < P.length; S++) zn((K = P[S]).obsSet, d.mutatedParts) && (Xe(L, K), K.subscribers.forEach(function($) {
3570
+ if (d._explicit && v && d.mutatedParts) for (var x = 0, I = Object.values(b.queries.query); x < I.length; x++) for (var S = 0, P = (L = I[x]).slice(); S < P.length; S++) zn((K = P[S]).obsSet, d.mutatedParts) && (Xe(L, K), K.subscribers.forEach(function($) {
3466
3571
  return w.add($);
3467
3572
  }));
3468
3573
  else if (0 < A.length) {
@@ -3496,9 +3601,9 @@ function Ai() {
3496
3601
  }), f.catch(function() {
3497
3602
  Xe(d.optimisticOps, s), s.mutatedParts && vn(s.mutatedParts);
3498
3603
  })) : f.then(function(v) {
3499
- var w = Vr(0, i(i({}, s), { values: s.values.map(function(T, p) {
3604
+ var w = Vr(0, i(i({}, s), { values: s.values.map(function(T, m) {
3500
3605
  var O;
3501
- return v.failures[p] ? T : (T = (O = a.keyPath) !== null && O !== void 0 && O.includes(".") ? ke(T) : i({}, T), ne(T, a.keyPath, v.results[p]), T);
3606
+ return v.failures[m] ? T : (T = (O = a.keyPath) !== null && O !== void 0 && O.includes(".") ? ke(T) : i({}, T), ne(T, a.keyPath, v.results[m]), T);
3502
3607
  }) }), v);
3503
3608
  d.optimisticOps.push(w), queueMicrotask(function() {
3504
3609
  return s.mutatedParts && vn(s.mutatedParts);
@@ -3506,36 +3611,36 @@ function Ai() {
3506
3611
  }), f) : r.mutate(s);
3507
3612
  }, query: function(s) {
3508
3613
  if (!Lr(z, r) || !Ur("query", s)) return r.query(s);
3509
- var f = ((w = z.trans) === null || w === void 0 ? void 0 : w.db._options.cache) === "immutable", p = z, d = p.requery, v = p.signal, w = (function(_, A, x, D) {
3614
+ var f = ((w = z.trans) === null || w === void 0 ? void 0 : w.db._options.cache) === "immutable", m = z, d = m.requery, v = m.signal, w = (function(_, A, x, I) {
3510
3615
  var S = gt["idb://".concat(_, "/").concat(A)];
3511
3616
  if (!S) return [];
3512
3617
  if (!(A = S.queries[x])) return [null, !1, S, null];
3513
- var P = A[(D.query ? D.query.index.name : null) || ""];
3618
+ var P = A[(I.query ? I.query.index.name : null) || ""];
3514
3619
  if (!P) return [null, !1, S, null];
3515
3620
  switch (x) {
3516
3621
  case "query":
3517
3622
  var k = P.find(function(M) {
3518
- return M.req.limit === D.limit && M.req.values === D.values && $r(M.req.query.range, D.query.range);
3623
+ return M.req.limit === I.limit && M.req.values === I.values && $r(M.req.query.range, I.query.range);
3519
3624
  });
3520
3625
  return k ? [k, !0, S, P] : [P.find(function(M) {
3521
- return ("limit" in M.req ? M.req.limit : 1 / 0) >= D.limit && (!D.values || M.req.values) && Ga(M.req.query.range, D.query.range);
3626
+ return ("limit" in M.req ? M.req.limit : 1 / 0) >= I.limit && (!I.values || M.req.values) && Ga(M.req.query.range, I.query.range);
3522
3627
  }), !1, S, P];
3523
3628
  case "count":
3524
3629
  return k = P.find(function(M) {
3525
- return $r(M.req.query.range, D.query.range);
3630
+ return $r(M.req.query.range, I.query.range);
3526
3631
  }), [k, !!k, S, P];
3527
3632
  }
3528
- })(t, n, "query", s), T = w[0], p = w[1], O = w[2], b = w[3];
3529
- return T && p ? T.obsSet = s.obsSet : (p = r.query(s).then(function(_) {
3633
+ })(t, n, "query", s), T = w[0], m = w[1], O = w[2], b = w[3];
3634
+ return T && m ? T.obsSet = s.obsSet : (m = r.query(s).then(function(_) {
3530
3635
  var A = _.result;
3531
3636
  if (T && (T.res = A), f) {
3532
- for (var x = 0, D = A.length; x < D; ++x) Object.freeze(A[x]);
3637
+ for (var x = 0, I = A.length; x < I; ++x) Object.freeze(A[x]);
3533
3638
  Object.freeze(A);
3534
3639
  } else _.result = ke(A);
3535
3640
  return _;
3536
3641
  }).catch(function(_) {
3537
3642
  return b && T && Xe(b, T), Promise.reject(_);
3538
- }), T = { obsSet: s.obsSet, promise: p, subscribers: /* @__PURE__ */ new Set(), type: "query", req: s, dirty: !1 }, b ? b.push(T) : (b = [T], (O = O || (gt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[s.query.index.name || ""] = b)), $a(T, b, d, v), T.promise.then(function(_) {
3643
+ }), T = { obsSet: s.obsSet, promise: m, subscribers: /* @__PURE__ */ new Set(), type: "query", req: s, dirty: !1 }, b ? b.push(T) : (b = [T], (O = O || (gt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[s.query.index.name || ""] = b)), $a(T, b, d, v), T.promise.then(function(_) {
3539
3644
  return { result: Gr(_.result, s, O?.optimisticOps, r, T, f) };
3540
3645
  });
3541
3646
  } });
@@ -3634,7 +3739,7 @@ function Ai() {
3634
3739
  var a = arguments.length;
3635
3740
  if (a < 2) throw new C.InvalidArgument("Too few arguments");
3636
3741
  for (var s = new Array(a - 1); --a; ) s[a - 1] = arguments[a];
3637
- return r = s.pop(), [t, Dt(s), r];
3742
+ return r = s.pop(), [t, It(s), r];
3638
3743
  }).apply(this, arguments);
3639
3744
  return this._transaction.apply(this, e);
3640
3745
  }, we.prototype._transaction = function(e, t, n) {
@@ -3664,29 +3769,29 @@ function Ai() {
3664
3769
  }), d && a && !a.active && (a = null);
3665
3770
  }
3666
3771
  } catch (w) {
3667
- return a ? a._promise(null, function(T, p) {
3668
- p(w);
3772
+ return a ? a._promise(null, function(T, m) {
3773
+ m(w);
3669
3774
  }) : be(w);
3670
3775
  }
3671
- var v = (function w(T, p, O, b, _) {
3776
+ var v = (function w(T, m, O, b, _) {
3672
3777
  return G.resolve().then(function() {
3673
- var A = z.transless || z, x = T._createTransaction(p, O, T._dbSchema, b);
3778
+ var A = z.transless || z, x = T._createTransaction(m, O, T._dbSchema, b);
3674
3779
  if (x.explicit = !0, A = { trans: x, transless: A }, b) x.idbtrans = b.idbtrans;
3675
3780
  else try {
3676
3781
  x.create(), x.idbtrans._explicit = !0, T._state.PR1398_maxLoop = 3;
3677
3782
  } catch (P) {
3678
3783
  return P.name === l.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
3679
- return w(T, p, O, null, _);
3784
+ return w(T, m, O, null, _);
3680
3785
  })) : be(P);
3681
3786
  }
3682
- var D, S = qe(_);
3787
+ var I, S = qe(_);
3683
3788
  return S && Et(), A = G.follow(function() {
3684
3789
  var P;
3685
- (D = _.call(x, x)) && (S ? (P = at.bind(null, null), D.then(P, P)) : typeof D.next == "function" && typeof D.throw == "function" && (D = Jn(D)));
3686
- }, A), (D && typeof D.then == "function" ? G.resolve(D).then(function(P) {
3790
+ (I = _.call(x, x)) && (S ? (P = at.bind(null, null), I.then(P, P)) : typeof I.next == "function" && typeof I.throw == "function" && (I = Jn(I)));
3791
+ }, A), (I && typeof I.then == "function" ? G.resolve(I).then(function(P) {
3687
3792
  return x.active ? P : be(new C.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
3688
3793
  }) : A.then(function() {
3689
- return D;
3794
+ return I;
3690
3795
  })).then(function(P) {
3691
3796
  return b && x._resolve(), x._completion.then(function() {
3692
3797
  return P;
@@ -3709,26 +3814,26 @@ function Ai() {
3709
3814
  var r = we.dependencies;
3710
3815
  this._options = t = i({ addons: we.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, r = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
3711
3816
  var a, s, f, d, v, w = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: Q, dbReadyPromise: null, cancelOpen: Q, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
3712
- w.dbReadyPromise = new G(function(p) {
3713
- w.dbReadyResolve = p;
3714
- }), w.openCanceller = new G(function(p, O) {
3817
+ w.dbReadyPromise = new G(function(m) {
3818
+ w.dbReadyResolve = m;
3819
+ }), w.openCanceller = new G(function(m, O) {
3715
3820
  w.cancelOpen = O;
3716
- }), this._state = w, this.name = e, this.on = Mt(this, "populate", "blocked", "versionchange", "close", { ready: [wt, Q] }), this.once = function(p, O) {
3821
+ }), this._state = w, this.name = e, this.on = Mt(this, "populate", "blocked", "versionchange", "close", { ready: [wt, Q] }), this.once = function(m, O) {
3717
3822
  var b = function() {
3718
3823
  for (var _ = [], A = 0; A < arguments.length; A++) _[A] = arguments[A];
3719
- n.on(p).unsubscribe(b), O.apply(n, _);
3824
+ n.on(m).unsubscribe(b), O.apply(n, _);
3720
3825
  };
3721
- return n.on(p, b);
3722
- }, this.on.ready.subscribe = ee(this.on.ready.subscribe, function(p) {
3826
+ return n.on(m, b);
3827
+ }, this.on.ready.subscribe = ee(this.on.ready.subscribe, function(m) {
3723
3828
  return function(O, b) {
3724
3829
  we.vip(function() {
3725
3830
  var _, A = n._state;
3726
- A.openComplete ? (A.dbOpenError || G.resolve().then(O), b && p(O)) : A.onReadyBeingFired ? (A.onReadyBeingFired.push(O), b && p(O)) : (p(O), _ = n, b || p(function x() {
3831
+ A.openComplete ? (A.dbOpenError || G.resolve().then(O), b && m(O)) : A.onReadyBeingFired ? (A.onReadyBeingFired.push(O), b && m(O)) : (m(O), _ = n, b || m(function x() {
3727
3832
  _.on.ready.unsubscribe(O), _.on.ready.unsubscribe(x);
3728
3833
  }));
3729
3834
  });
3730
3835
  };
3731
- }), this.Collection = (a = this, jt(Ca.prototype, function(D, x) {
3836
+ }), this.Collection = (a = this, jt(Ca.prototype, function(I, x) {
3732
3837
  this.db = a;
3733
3838
  var b = _r, _ = null;
3734
3839
  if (x) try {
@@ -3736,61 +3841,61 @@ function Ai() {
3736
3841
  } catch (S) {
3737
3842
  _ = S;
3738
3843
  }
3739
- var A = D._ctx, x = A.table, D = x.hook.reading.fire;
3740
- this._ctx = { table: x, index: A.index, isPrimKey: !A.index || x.schema.primKey.keyPath && A.index === x.schema.primKey.name, range: b, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: _, or: A.or, valueMapper: D !== he ? D : null };
3741
- })), this.Table = (s = this, jt(Nr.prototype, function(p, O, b) {
3742
- this.db = s, this._tx = b, this.name = p, this.schema = O, this.hook = s._allTables[p] ? s._allTables[p].hook : Mt(null, { creating: [tt, Q], reading: [Ae, he], updating: [Le, Q], deleting: [_e, Q] });
3743
- })), this.Transaction = (f = this, jt(Sa.prototype, function(p, O, b, _, A) {
3844
+ var A = I._ctx, x = A.table, I = x.hook.reading.fire;
3845
+ this._ctx = { table: x, index: A.index, isPrimKey: !A.index || x.schema.primKey.keyPath && A.index === x.schema.primKey.name, range: b, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: _, or: A.or, valueMapper: I !== he ? I : null };
3846
+ })), this.Table = (s = this, jt(Nr.prototype, function(m, O, b) {
3847
+ this.db = s, this._tx = b, this.name = m, this.schema = O, this.hook = s._allTables[m] ? s._allTables[m].hook : Mt(null, { creating: [tt, Q], reading: [Ae, he], updating: [Le, Q], deleting: [_e, Q] });
3848
+ })), this.Transaction = (f = this, jt(Sa.prototype, function(m, O, b, _, A) {
3744
3849
  var x = this;
3745
- p !== "readonly" && O.forEach(function(D) {
3746
- D = (D = b[D]) === null || D === void 0 ? void 0 : D.yProps, D && (O = O.concat(D.map(function(S) {
3850
+ m !== "readonly" && O.forEach(function(I) {
3851
+ I = (I = b[I]) === null || I === void 0 ? void 0 : I.yProps, I && (O = O.concat(I.map(function(S) {
3747
3852
  return S.updatesTable;
3748
3853
  })));
3749
- }), this.db = f, this.mode = p, this.storeNames = O, this.schema = b, this.chromeTransactionDurability = _, this.idbtrans = null, this.on = Mt(this, "complete", "error", "abort"), this.parent = A || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new G(function(D, S) {
3750
- x._resolve = D, x._reject = S;
3854
+ }), this.db = f, this.mode = m, this.storeNames = O, this.schema = b, this.chromeTransactionDurability = _, this.idbtrans = null, this.on = Mt(this, "complete", "error", "abort"), this.parent = A || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new G(function(I, S) {
3855
+ x._resolve = I, x._reject = S;
3751
3856
  }), this._completion.then(function() {
3752
3857
  x.active = !1, x.on.complete.fire();
3753
- }, function(D) {
3858
+ }, function(I) {
3754
3859
  var S = x.active;
3755
- return x.active = !1, x.on.error.fire(D), x.parent ? x.parent._reject(D) : S && x.idbtrans && x.idbtrans.abort(), be(D);
3860
+ return x.active = !1, x.on.error.fire(I), x.parent ? x.parent._reject(I) : S && x.idbtrans && x.idbtrans.abort(), be(I);
3756
3861
  });
3757
- })), this.Version = (d = this, jt(ja.prototype, function(p) {
3758
- this.db = d, this._cfg = { version: p, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
3759
- })), this.WhereClause = (v = this, jt(Sr.prototype, function(p, O, b) {
3760
- if (this.db = v, this._ctx = { table: p, index: O === ":id" ? null : O, or: b }, this._cmp = this._ascending = re, this._descending = function(_, A) {
3862
+ })), this.Version = (d = this, jt(ja.prototype, function(m) {
3863
+ this.db = d, this._cfg = { version: m, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
3864
+ })), this.WhereClause = (v = this, jt(Sr.prototype, function(m, O, b) {
3865
+ if (this.db = v, this._ctx = { table: m, index: O === ":id" ? null : O, or: b }, this._cmp = this._ascending = re, this._descending = function(_, A) {
3761
3866
  return re(A, _);
3762
3867
  }, this._max = function(_, A) {
3763
3868
  return 0 < re(_, A) ? _ : A;
3764
3869
  }, this._min = function(_, A) {
3765
3870
  return re(_, A) < 0 ? _ : A;
3766
3871
  }, this._IDBKeyRange = v._deps.IDBKeyRange, !this._IDBKeyRange) throw new C.MissingAPI();
3767
- })), this.on("versionchange", function(p) {
3768
- 0 < p.newVersion ? console.warn("Another connection wants to upgrade database '".concat(n.name, "'. Closing db now to resume the upgrade.")) : console.warn("Another connection wants to delete database '".concat(n.name, "'. Closing db now to resume the delete request.")), n.close({ disableAutoOpen: !1 });
3769
- }), this.on("blocked", function(p) {
3770
- !p.newVersion || p.newVersion < p.oldVersion ? console.warn("Dexie.delete('".concat(n.name, "') was blocked")) : console.warn("Upgrade '".concat(n.name, "' blocked by other connection holding version ").concat(p.oldVersion / 10));
3771
- }), this._maxKey = Ut(t.IDBKeyRange), this._createTransaction = function(p, O, b, _) {
3772
- return new n.Transaction(p, O, b, n._options.chromeTransactionDurability, _);
3773
- }, this._fireOnBlocked = function(p) {
3774
- n.on("blocked").fire(p), xt.filter(function(O) {
3872
+ })), this.on("versionchange", function(m) {
3873
+ 0 < m.newVersion ? console.warn("Another connection wants to upgrade database '".concat(n.name, "'. Closing db now to resume the upgrade.")) : console.warn("Another connection wants to delete database '".concat(n.name, "'. Closing db now to resume the delete request.")), n.close({ disableAutoOpen: !1 });
3874
+ }), this.on("blocked", function(m) {
3875
+ !m.newVersion || m.newVersion < m.oldVersion ? console.warn("Dexie.delete('".concat(n.name, "') was blocked")) : console.warn("Upgrade '".concat(n.name, "' blocked by other connection holding version ").concat(m.oldVersion / 10));
3876
+ }), this._maxKey = Ut(t.IDBKeyRange), this._createTransaction = function(m, O, b, _) {
3877
+ return new n.Transaction(m, O, b, n._options.chromeTransactionDurability, _);
3878
+ }, this._fireOnBlocked = function(m) {
3879
+ n.on("blocked").fire(m), xt.filter(function(O) {
3775
3880
  return O.name === n.name && O !== n && !O._state.vcFired;
3776
3881
  }).map(function(O) {
3777
- return O.on("versionchange").fire(p);
3882
+ return O.on("versionchange").fire(m);
3778
3883
  });
3779
3884
  }, this.use(Ua), this.use(Xa), this.use(Va), this.use(qa), this.use(La);
3780
- var T = new Proxy(this, { get: function(p, O, b) {
3885
+ var T = new Proxy(this, { get: function(m, O, b) {
3781
3886
  if (O === "_vip") return !0;
3782
3887
  if (O === "table") return function(A) {
3783
3888
  return wn(n.table(A), T);
3784
3889
  };
3785
- var _ = Reflect.get(p, O, b);
3890
+ var _ = Reflect.get(m, O, b);
3786
3891
  return _ instanceof Nr ? wn(_, T) : O === "tables" ? _.map(function(A) {
3787
3892
  return wn(A, T);
3788
3893
  }) : O === "_createTransaction" ? function() {
3789
3894
  return wn(_.apply(this, arguments), T);
3790
3895
  } : _;
3791
3896
  } });
3792
- this.vip = T, r.forEach(function(p) {
3793
- return p(n);
3897
+ this.vip = T, r.forEach(function(m) {
3898
+ return m(n);
3794
3899
  });
3795
3900
  }
3796
3901
  var _n, je = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", Wa = (rr.prototype.subscribe = function(e, t, n) {
@@ -3802,7 +3907,7 @@ function Ai() {
3802
3907
  this._subscribe = e;
3803
3908
  }
3804
3909
  try {
3805
- _n = { indexedDB: m.indexedDB || m.mozIndexedDB || m.webkitIndexedDB || m.msIndexedDB, IDBKeyRange: m.IDBKeyRange || m.webkitIDBKeyRange };
3910
+ _n = { indexedDB: p.indexedDB || p.mozIndexedDB || p.webkitIndexedDB || p.msIndexedDB, IDBKeyRange: p.IDBKeyRange || p.webkitIDBKeyRange };
3806
3911
  } catch {
3807
3912
  _n = { indexedDB: null, IDBKeyRange: null };
3808
3913
  }
@@ -3811,16 +3916,16 @@ function Ai() {
3811
3916
  var s = qe(e), f, d = !1, v = {}, w = {}, T = { get closed() {
3812
3917
  return d;
3813
3918
  }, unsubscribe: function() {
3814
- d || (d = !0, f && f.abort(), p && st.storagemutated.unsubscribe(b));
3919
+ d || (d = !0, f && f.abort(), m && st.storagemutated.unsubscribe(b));
3815
3920
  } };
3816
3921
  a.start && a.start(T);
3817
- var p = !1, O = function() {
3922
+ var m = !1, O = function() {
3818
3923
  return Pn(_);
3819
3924
  }, b = function(A) {
3820
3925
  yn(v, A), zn(w, v) && O();
3821
3926
  }, _ = function() {
3822
- var A, x, D;
3823
- !d && _n.indexedDB && (v = {}, A = {}, f && f.abort(), f = new AbortController(), D = (function(S) {
3927
+ var A, x, I;
3928
+ !d && _n.indexedDB && (v = {}, A = {}, f && f.abort(), f = new AbortController(), I = (function(S) {
3824
3929
  var P = _t();
3825
3930
  try {
3826
3931
  s && Et();
@@ -3829,11 +3934,11 @@ function Ai() {
3829
3934
  } finally {
3830
3935
  P && Tt();
3831
3936
  }
3832
- })(x = { subscr: A, signal: f.signal, requery: O, querier: e, trans: null }), Promise.resolve(D).then(function(S) {
3937
+ })(x = { subscr: A, signal: f.signal, requery: O, querier: e, trans: null }), Promise.resolve(I).then(function(S) {
3833
3938
  n = !0, t = S, d || x.signal.aborted || (v = {}, (function(P) {
3834
3939
  for (var k in P) if (W(P, k)) return;
3835
3940
  return 1;
3836
- })(w = A) || p || (st(Lt, b), p = !0), Pn(function() {
3941
+ })(w = A) || m || (st(Lt, b), m = !0), Pn(function() {
3837
3942
  return !d && a.next && a.next(S);
3838
3943
  }));
3839
3944
  }, function(S) {
@@ -3910,11 +4015,11 @@ function Ai() {
3910
4015
  return Pe;
3911
4016
  }, set: function(e) {
3912
4017
  Rt(e);
3913
- } }, derive: F, extend: R, props: J, override: ee, Events: Mt, on: st, liveQuery: Xr, extendObservabilitySet: yn, getByKeyPath: pe, setByKeyPath: ne, delByKeyPath: function(e, t) {
4018
+ } }, derive: F, extend: R, props: J, override: ee, Events: Mt, on: st, liveQuery: Xr, extendObservabilitySet: yn, getByKeyPath: me, setByKeyPath: ne, delByKeyPath: function(e, t) {
3914
4019
  typeof t == "string" ? ne(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
3915
4020
  ne(e, n, void 0);
3916
4021
  });
3917
- }, shallowClone: Ie, deepClone: ke, getObjectDiff: er, cmp: re, asap: ae, minKey: -1 / 0, addons: [], connections: xt, errnames: l, dependencies: _n, cache: gt, semVer: "4.2.0", version: "4.2.0".split(".").map(function(e) {
4022
+ }, shallowClone: De, deepClone: ke, getObjectDiff: er, cmp: re, asap: ae, minKey: -1 / 0, addons: [], connections: xt, errnames: l, dependencies: _n, cache: gt, semVer: "4.2.0", version: "4.2.0".split(".").map(function(e) {
3918
4023
  return parseInt(e);
3919
4024
  }).reduce(function(e, t, n) {
3920
4025
  return e + t / Math.pow(10, 2 * n);
@@ -3953,7 +4058,7 @@ function Ai() {
3953
4058
  })(xn)), xn.exports;
3954
4059
  }
3955
4060
  var Oi = Ai();
3956
- const lr = /* @__PURE__ */ pa(Oi), Qr = /* @__PURE__ */ Symbol.for("Dexie"), Qe = globalThis[Qr] || (globalThis[Qr] = lr);
4061
+ const lr = /* @__PURE__ */ ma(Oi), Qr = /* @__PURE__ */ Symbol.for("Dexie"), Qe = globalThis[Qr] || (globalThis[Qr] = lr);
3957
4062
  if (lr.semVer !== Qe.semVer)
3958
4063
  throw new Error(`Two different versions of Dexie loaded in the same app: ${lr.semVer} and ${Qe.semVer}`);
3959
4064
  const {
@@ -3974,13 +4079,13 @@ class Ci {
3974
4079
  this.name = u;
3975
4080
  const { xmlElements: i, additionalTables: h } = c.database.tables;
3976
4081
  this.tableName = i.name, this.databaseInstance = new Qe(u);
3977
- const m = {
4082
+ const p = {
3978
4083
  [i.name]: i.schema
3979
4084
  };
3980
4085
  if (h)
3981
4086
  for (const [y, N] of Object.entries(h))
3982
- m[y] = N.schema;
3983
- m[Hr] = "++sequenceNumber, id", m[Zr] = "key", this.databaseInstance.version(1).stores(m);
4087
+ p[y] = N.schema;
4088
+ p[Hr] = "++sequenceNumber, id", p[Zr] = "key", this.databaseInstance.version(1).stores(p);
3984
4089
  }
3985
4090
  async get(u) {
3986
4091
  return this.databaseInstance.table(this.tableName).get(u);
@@ -4001,7 +4106,7 @@ class Ci {
4001
4106
  await this.metaTable.put({ key: "head", value: u });
4002
4107
  }
4003
4108
  async commit(u) {
4004
- const { creates: c, updates: i, deletes: h, onProgress: m } = u, y = this.databaseInstance.table(this.tableName), N = c.length + i.length + h.length;
4109
+ const { creates: c, updates: i, deletes: h, onProgress: p } = u, y = this.databaseInstance.table(this.tableName), N = c.length + i.length + h.length;
4005
4110
  let R = 0;
4006
4111
  try {
4007
4112
  await this.databaseInstance.transaction(
@@ -4013,12 +4118,11 @@ class Ci {
4013
4118
  const j = i.length > 0 ? await y.bulkGet(i.map((B) => B.id)) : [], X = h.length > 0 ? await y.bulkGet(h) : [];
4014
4119
  if (c.length > 0)
4015
4120
  try {
4016
- await y.bulkAdd(c), R += c.length, m(R, N);
4121
+ await y.bulkAdd(c), R += c.length, p(R, N);
4017
4122
  } catch (B) {
4018
4123
  const F = this.extractFailedRecordFromError(B, c);
4019
4124
  Me("STORE_BULK_ADD_FAILED", {
4020
4125
  detail: B instanceof Error ? B.message : String(B),
4021
- method: "commit.bulkAdd",
4022
4126
  cause: B instanceof Error ? B : void 0,
4023
4127
  ...F && {
4024
4128
  ref: { tagName: F.tagName, id: F.id }
@@ -4027,12 +4131,11 @@ class Ci {
4027
4131
  }
4028
4132
  if (i.length > 0)
4029
4133
  try {
4030
- await y.bulkPut(i), R += i.length, m(R, N);
4134
+ await y.bulkPut(i), R += i.length, p(R, N);
4031
4135
  } catch (B) {
4032
4136
  const F = this.extractFailedRecordFromError(B, i);
4033
4137
  Me("STORE_BULK_UPDATE_FAILED", {
4034
4138
  detail: B instanceof Error ? B.message : String(B),
4035
- method: "commit.bulkPut",
4036
4139
  cause: B instanceof Error ? B : void 0,
4037
4140
  ...F && {
4038
4141
  ref: { tagName: F.tagName, id: F.id }
@@ -4041,11 +4144,10 @@ class Ci {
4041
4144
  }
4042
4145
  if (h.length > 0)
4043
4146
  try {
4044
- await y.bulkDelete(h), R += h.length, m(R, N);
4147
+ await y.bulkDelete(h), R += h.length, p(R, N);
4045
4148
  } catch (B) {
4046
4149
  Me("STORE_DELETE_FAILED", {
4047
4150
  detail: B instanceof Error ? B.message : String(B),
4048
- method: "commit.bulkDelete",
4049
4151
  cause: B instanceof Error ? B : void 0
4050
4152
  });
4051
4153
  }
@@ -4072,7 +4174,6 @@ class Ci {
4072
4174
  throw j;
4073
4175
  Me("STORE_COMMIT_FAILED", {
4074
4176
  detail: j instanceof Error ? j.message : String(j),
4075
- method: "commit",
4076
4177
  cause: j instanceof Error ? j : void 0
4077
4178
  });
4078
4179
  }
@@ -4082,7 +4183,7 @@ class Ci {
4082
4183
  const i = u.failures;
4083
4184
  if (i && i.length > 0) {
4084
4185
  const h = i[0].key;
4085
- return c.find((m) => m.id === h);
4186
+ return c.find((p) => p.id === h);
4086
4187
  }
4087
4188
  }
4088
4189
  return c[0];
@@ -4099,8 +4200,8 @@ class Ci {
4099
4200
  return;
4100
4201
  const i = this.databaseInstance.table(this.tableName);
4101
4202
  await this.databaseInstance.transaction("rw", i, this.metaTable, async () => {
4102
- const { creates: h, updates: m, deletes: y } = c.operations;
4103
- h.length > 0 && await i.bulkDelete(h.map((N) => N.id)), m.length > 0 && await i.bulkPut(m.map((N) => N.before)), y.length > 0 && await i.bulkAdd(y), await this.setHead(u - 1);
4203
+ const { creates: h, updates: p, deletes: y } = c.operations;
4204
+ h.length > 0 && await i.bulkDelete(h.map((N) => N.id)), p.length > 0 && await i.bulkPut(p.map((N) => N.before)), y.length > 0 && await i.bulkAdd(y), await this.setHead(u - 1);
4104
4205
  });
4105
4206
  }
4106
4207
  async redo() {
@@ -4109,8 +4210,8 @@ class Ci {
4109
4210
  return;
4110
4211
  const h = this.databaseInstance.table(this.tableName);
4111
4212
  await this.databaseInstance.transaction("rw", h, this.metaTable, async () => {
4112
- const { creates: m, updates: y, deletes: N } = i.operations;
4113
- m.length > 0 && await h.bulkAdd(m), y.length > 0 && await h.bulkPut(y.map((R) => R.after)), N.length > 0 && await h.bulkDelete(N.map((R) => R.id)), await this.setHead(c);
4213
+ const { creates: p, updates: y, deletes: N } = i.operations;
4214
+ p.length > 0 && await h.bulkAdd(p), y.length > 0 && await h.bulkPut(y.map((R) => R.after)), N.length > 0 && await h.bulkDelete(N.map((R) => R.id)), await this.setHead(c);
4114
4215
  });
4115
4216
  }
4116
4217
  async getChangeLog() {
@@ -4126,26 +4227,26 @@ class Ci {
4126
4227
  this.databaseInstance.isOpen() && (this.databaseInstance.close(), await new Promise((u) => setTimeout(u, 20))), await Qe.delete(this.databaseInstance.name);
4127
4228
  }
4128
4229
  }
4129
- function Di(g) {
4130
- const { databaseName: u, dialecteConfig: c } = g, { xmlElements: i, additionalTables: h } = c.database.tables, m = new Qe(u), y = {
4230
+ function Ii(g) {
4231
+ const { databaseName: u, dialecteConfig: c } = g, { xmlElements: i, additionalTables: h } = c.database.tables, p = new Qe(u), y = {
4131
4232
  [i.name]: i.schema
4132
4233
  };
4133
4234
  if (h)
4134
4235
  for (const [N, R] of Object.entries(h))
4135
4236
  y[N] = R.schema;
4136
- return m.version(1).stores(y), m;
4237
+ return p.version(1).stores(y), p;
4137
4238
  }
4138
4239
  async function ga(g) {
4139
4240
  const { databaseInstance: u, elementsTableName: c, records: i } = g, h = u.table(c);
4140
4241
  await u.transaction("rw", h, () => h.bulkAdd(i));
4141
4242
  }
4142
- async function Ii(g) {
4243
+ async function Di(g) {
4143
4244
  const { databaseInstance: u, elementsTableName: c, updates: i } = g;
4144
4245
  if (i.length === 0) return;
4145
4246
  const h = u.table(c);
4146
4247
  await u.transaction("rw", h, async () => {
4147
- for (const { recordId: m, ...y } of i) {
4148
- const N = await h.get(m);
4248
+ for (const { recordId: p, ...y } of i) {
4249
+ const N = await h.get(p);
4149
4250
  if (!N) continue;
4150
4251
  const R = { ...y };
4151
4252
  if (y.attributes) {
@@ -4164,24 +4265,24 @@ async function Ii(g) {
4164
4265
  }
4165
4266
  R.children = j;
4166
4267
  }
4167
- await h.update(m, R);
4268
+ await h.update(p, R);
4168
4269
  }
4169
4270
  });
4170
4271
  }
4171
- async function Do(g) {
4272
+ async function Io(g) {
4172
4273
  const { databaseInstance: u, elementsTableName: c, updates: i } = g;
4173
4274
  if (i.length === 0) return;
4174
4275
  const h = u.table(c);
4175
4276
  await u.transaction("rw", h, async () => {
4176
- for (const { recordId: m, attributes: y } of i) {
4177
- const N = await h.get(m);
4277
+ for (const { recordId: p, attributes: y } of i) {
4278
+ const N = await h.get(p);
4178
4279
  if (!N) continue;
4179
4280
  const R = [...N.attributes];
4180
4281
  for (const j of y) {
4181
4282
  const X = R.findIndex((W) => W.name === j.name);
4182
4283
  X >= 0 ? R[X] = j : R.push(j);
4183
4284
  }
4184
- await h.update(m, { attributes: R });
4285
+ await h.update(p, { attributes: R });
4185
4286
  }
4186
4287
  });
4187
4288
  }
@@ -4191,7 +4292,7 @@ async function Si(g) {
4191
4292
  const h = u.table(c);
4192
4293
  await u.transaction("rw", h, () => h.bulkDelete(i));
4193
4294
  }
4194
- async function Io(g) {
4295
+ async function Do(g) {
4195
4296
  if (await Qe.exists(g))
4196
4297
  return await Qe.delete(g);
4197
4298
  }
@@ -4211,8 +4312,8 @@ function Pi(g) {
4211
4312
  function ki(g) {
4212
4313
  const { currentBatch: u } = g, c = [...u];
4213
4314
  for (const [i, h] of c.entries()) {
4214
- const m = Yt[h.id] || [];
4215
- m.length > 0 && (c[i].children.push(...m), Fi({
4315
+ const p = Yt[h.id] || [];
4316
+ p.length > 0 && (c[i].children.push(...p), Fi({
4216
4317
  parentId: h.id
4217
4318
  }));
4218
4319
  }
@@ -4272,7 +4373,7 @@ function Ki() {
4272
4373
  if (!(this instanceof i))
4273
4374
  return new i(l, o);
4274
4375
  var C = this;
4275
- m(C), C.q = C.c = "", C.bufferCheckPosition = u.MAX_BUFFER_LENGTH, C.opt = o || {}, C.opt.lowercase = C.opt.lowercase || C.opt.lowercasetags, C.looseCase = C.opt.lowercase ? "toLowerCase" : "toUpperCase", C.opt.maxEntityCount = C.opt.maxEntityCount || 512, C.opt.maxEntityDepth = C.opt.maxEntityDepth || 4, C.entityCount = C.entityDepth = 0, C.tags = [], C.closed = C.closedRoot = C.sawRoot = !1, C.tag = C.error = null, C.strict = !!l, C.noscript = !!(l || C.opt.noscript), C.state = I.BEGIN, C.strictEntities = C.opt.strictEntities, C.ENTITIES = C.strictEntities ? Object.create(u.XML_ENTITIES) : Object.create(u.ENTITIES), C.attribList = [], C.opt.xmlns && (C.ns = Object.create(F)), C.opt.unquotedAttributeValues === void 0 && (C.opt.unquotedAttributeValues = !l), C.trackPosition = C.opt.position !== !1, C.trackPosition && (C.position = C.line = C.column = 0), He(C, "onready");
4376
+ p(C), C.q = C.c = "", C.bufferCheckPosition = u.MAX_BUFFER_LENGTH, C.opt = o || {}, C.opt.lowercase = C.opt.lowercase || C.opt.lowercasetags, C.looseCase = C.opt.lowercase ? "toLowerCase" : "toUpperCase", C.opt.maxEntityCount = C.opt.maxEntityCount || 512, C.opt.maxEntityDepth = C.opt.maxEntityDepth || 4, C.entityCount = C.entityDepth = 0, C.tags = [], C.closed = C.closedRoot = C.sawRoot = !1, C.tag = C.error = null, C.strict = !!l, C.noscript = !!(l || C.opt.noscript), C.state = D.BEGIN, C.strictEntities = C.opt.strictEntities, C.ENTITIES = C.strictEntities ? Object.create(u.XML_ENTITIES) : Object.create(u.ENTITIES), C.attribList = [], C.opt.xmlns && (C.ns = Object.create(F)), C.opt.unquotedAttributeValues === void 0 && (C.opt.unquotedAttributeValues = !l), C.trackPosition = C.opt.position !== !1, C.trackPosition && (C.position = C.line = C.column = 0), He(C, "onready");
4276
4377
  }
4277
4378
  Object.create || (Object.create = function(l) {
4278
4379
  function o() {
@@ -4307,7 +4408,7 @@ function Ki() {
4307
4408
  var he = u.MAX_BUFFER_LENGTH - C;
4308
4409
  l.bufferCheckPosition = he + l.position;
4309
4410
  }
4310
- function m(l) {
4411
+ function p(l) {
4311
4412
  for (var o = 0, C = c.length; o < C; o++)
4312
4413
  l[c[o]] = "";
4313
4414
  }
@@ -4395,88 +4496,88 @@ function Ki() {
4395
4496
  function ae(l) {
4396
4497
  return l === '"' || l === "'";
4397
4498
  }
4398
- function pe(l) {
4499
+ function me(l) {
4399
4500
  return l === ">" || Y(l);
4400
4501
  }
4401
4502
  function ne(l, o) {
4402
4503
  return l.test(o);
4403
4504
  }
4404
- function Ie(l, o) {
4505
+ function De(l, o) {
4405
4506
  return !ne(l, o);
4406
4507
  }
4407
- var I = 0;
4508
+ var D = 0;
4408
4509
  u.STATE = {
4409
- BEGIN: I++,
4510
+ BEGIN: D++,
4410
4511
  // leading byte order mark or whitespace
4411
- BEGIN_WHITESPACE: I++,
4512
+ BEGIN_WHITESPACE: D++,
4412
4513
  // leading whitespace
4413
- TEXT: I++,
4514
+ TEXT: D++,
4414
4515
  // general stuff
4415
- TEXT_ENTITY: I++,
4516
+ TEXT_ENTITY: D++,
4416
4517
  // &amp and such.
4417
- OPEN_WAKA: I++,
4518
+ OPEN_WAKA: D++,
4418
4519
  // <
4419
- SGML_DECL: I++,
4520
+ SGML_DECL: D++,
4420
4521
  // <!BLARG
4421
- SGML_DECL_QUOTED: I++,
4522
+ SGML_DECL_QUOTED: D++,
4422
4523
  // <!BLARG foo "bar
4423
- DOCTYPE: I++,
4524
+ DOCTYPE: D++,
4424
4525
  // <!DOCTYPE
4425
- DOCTYPE_QUOTED: I++,
4526
+ DOCTYPE_QUOTED: D++,
4426
4527
  // <!DOCTYPE "//blah
4427
- DOCTYPE_DTD: I++,
4528
+ DOCTYPE_DTD: D++,
4428
4529
  // <!DOCTYPE "//blah" [ ...
4429
- DOCTYPE_DTD_QUOTED: I++,
4530
+ DOCTYPE_DTD_QUOTED: D++,
4430
4531
  // <!DOCTYPE "//blah" [ "foo
4431
- COMMENT_STARTING: I++,
4532
+ COMMENT_STARTING: D++,
4432
4533
  // <!-
4433
- COMMENT: I++,
4534
+ COMMENT: D++,
4434
4535
  // <!--
4435
- COMMENT_ENDING: I++,
4536
+ COMMENT_ENDING: D++,
4436
4537
  // <!-- blah -
4437
- COMMENT_ENDED: I++,
4538
+ COMMENT_ENDED: D++,
4438
4539
  // <!-- blah --
4439
- CDATA: I++,
4540
+ CDATA: D++,
4440
4541
  // <![CDATA[ something
4441
- CDATA_ENDING: I++,
4542
+ CDATA_ENDING: D++,
4442
4543
  // ]
4443
- CDATA_ENDING_2: I++,
4544
+ CDATA_ENDING_2: D++,
4444
4545
  // ]]
4445
- PROC_INST: I++,
4546
+ PROC_INST: D++,
4446
4547
  // <?hi
4447
- PROC_INST_BODY: I++,
4548
+ PROC_INST_BODY: D++,
4448
4549
  // <?hi there
4449
- PROC_INST_ENDING: I++,
4550
+ PROC_INST_ENDING: D++,
4450
4551
  // <?hi "there" ?
4451
- OPEN_TAG: I++,
4552
+ OPEN_TAG: D++,
4452
4553
  // <strong
4453
- OPEN_TAG_SLASH: I++,
4554
+ OPEN_TAG_SLASH: D++,
4454
4555
  // <strong /
4455
- ATTRIB: I++,
4556
+ ATTRIB: D++,
4456
4557
  // <a
4457
- ATTRIB_NAME: I++,
4558
+ ATTRIB_NAME: D++,
4458
4559
  // <a foo
4459
- ATTRIB_NAME_SAW_WHITE: I++,
4560
+ ATTRIB_NAME_SAW_WHITE: D++,
4460
4561
  // <a foo _
4461
- ATTRIB_VALUE: I++,
4562
+ ATTRIB_VALUE: D++,
4462
4563
  // <a foo=
4463
- ATTRIB_VALUE_QUOTED: I++,
4564
+ ATTRIB_VALUE_QUOTED: D++,
4464
4565
  // <a foo="bar
4465
- ATTRIB_VALUE_CLOSED: I++,
4566
+ ATTRIB_VALUE_CLOSED: D++,
4466
4567
  // <a foo="bar"
4467
- ATTRIB_VALUE_UNQUOTED: I++,
4568
+ ATTRIB_VALUE_UNQUOTED: D++,
4468
4569
  // <a foo=bar
4469
- ATTRIB_VALUE_ENTITY_Q: I++,
4570
+ ATTRIB_VALUE_ENTITY_Q: D++,
4470
4571
  // <foo bar="&quot;"
4471
- ATTRIB_VALUE_ENTITY_U: I++,
4572
+ ATTRIB_VALUE_ENTITY_U: D++,
4472
4573
  // <foo bar=&quot
4473
- CLOSE_TAG: I++,
4574
+ CLOSE_TAG: D++,
4474
4575
  // </a
4475
- CLOSE_TAG_SAW_WHITE: I++,
4576
+ CLOSE_TAG_SAW_WHITE: D++,
4476
4577
  // </a >
4477
- SCRIPT: I++,
4578
+ SCRIPT: D++,
4478
4579
  // <script> ...
4479
- SCRIPT_ENDING: I++
4580
+ SCRIPT_ENDING: D++
4480
4581
  // <script> ... <
4481
4582
  }, u.XML_ENTITIES = {
4482
4583
  amp: "&",
@@ -4742,9 +4843,9 @@ function Ki() {
4742
4843
  var o = u.ENTITIES[l], C = typeof o == "number" ? String.fromCharCode(o) : o;
4743
4844
  u.ENTITIES[l] = C;
4744
4845
  });
4745
- for (var Dt in u.STATE)
4746
- u.STATE[u.STATE[Dt]] = Dt;
4747
- I = u.STATE;
4846
+ for (var It in u.STATE)
4847
+ u.STATE[u.STATE[It]] = It;
4848
+ D = u.STATE;
4748
4849
  function He(l, o, C) {
4749
4850
  l[o] && l[o](C);
4750
4851
  }
@@ -4764,7 +4865,7 @@ Column: ` + l.column + `
4764
4865
  Char: ` + l.c), o = new Error(o), l.error = o, He(l, "onerror", o), l;
4765
4866
  }
4766
4867
  function bt(l) {
4767
- return l.sawRoot && !l.closedRoot && le(l, "Unclosed root tag"), l.state !== I.BEGIN && l.state !== I.BEGIN_WHITESPACE && l.state !== I.TEXT && Ke(l, "Unexpected end"), ke(l), l.c = "", l.closed = !0, He(l, "onend"), i.call(l, l.strict, l.opt), l;
4868
+ return l.sawRoot && !l.closedRoot && le(l, "Unclosed root tag"), l.state !== D.BEGIN && l.state !== D.BEGIN_WHITESPACE && l.state !== D.TEXT && Ke(l, "Unexpected end"), ke(l), l.c = "", l.closed = !0, He(l, "onend"), i.call(l, l.strict, l.opt), l;
4768
4869
  }
4769
4870
  function le(l, o) {
4770
4871
  if (typeof l != "object" || !(l instanceof i))
@@ -4841,16 +4942,16 @@ Actual: ` + l.attribValue
4841
4942
  }
4842
4943
  l.attribList.length = 0;
4843
4944
  }
4844
- l.tag.isSelfClosing = !!o, l.sawRoot = !0, l.tags.push(l.tag), de(l, "onopentag", l.tag), o || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state = I.SCRIPT : l.state = I.TEXT, l.tag = null, l.tagName = ""), l.attribName = l.attribValue = "", l.attribList.length = 0;
4945
+ l.tag.isSelfClosing = !!o, l.sawRoot = !0, l.tags.push(l.tag), de(l, "onopentag", l.tag), o || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state = D.SCRIPT : l.state = D.TEXT, l.tag = null, l.tagName = ""), l.attribName = l.attribValue = "", l.attribList.length = 0;
4845
4946
  }
4846
- function It(l) {
4947
+ function Dt(l) {
4847
4948
  if (!l.tagName) {
4848
- le(l, "Weird empty close tag."), l.textNode += "</>", l.state = I.TEXT;
4949
+ le(l, "Weird empty close tag."), l.textNode += "</>", l.state = D.TEXT;
4849
4950
  return;
4850
4951
  }
4851
4952
  if (l.script) {
4852
4953
  if (l.tagName !== "script") {
4853
- l.script += "</" + l.tagName + ">", l.tagName = "", l.state = I.SCRIPT;
4954
+ l.script += "</" + l.tagName + ">", l.tagName = "", l.state = D.SCRIPT;
4854
4955
  return;
4855
4956
  }
4856
4957
  de(l, "onscript", l.script), l.script = "";
@@ -4865,7 +4966,7 @@ Actual: ` + l.attribValue
4865
4966
  break;
4866
4967
  }
4867
4968
  if (o < 0) {
4868
- le(l, "Unmatched closing tag: " + l.tagName), l.textNode += "</" + l.tagName + ">", l.state = I.TEXT;
4969
+ le(l, "Unmatched closing tag: " + l.tagName), l.textNode += "</" + l.tagName + ">", l.state = D.TEXT;
4869
4970
  return;
4870
4971
  }
4871
4972
  l.tagName = C;
@@ -4881,14 +4982,14 @@ Actual: ` + l.attribValue
4881
4982
  de(l, "onclosenamespace", { prefix: _e, uri: Le });
4882
4983
  });
4883
4984
  }
4884
- o === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state = I.TEXT;
4985
+ o === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state = D.TEXT;
4885
4986
  }
4886
4987
  function Ze(l) {
4887
4988
  var o = l.entity, C = o.toLowerCase(), E, ie = "";
4888
4989
  return l.ENTITIES[o] ? l.ENTITIES[o] : l.ENTITIES[C] ? l.ENTITIES[C] : (o = C, o.charAt(0) === "#" && (o.charAt(1) === "x" ? (o = o.slice(2), E = parseInt(o, 16), ie = E.toString(16)) : (o = o.slice(1), E = parseInt(o, 10), ie = E.toString(10))), o = o.replace(/^0+/, ""), isNaN(E) || ie.toLowerCase() !== o || E < 0 || E > 1114111 ? (le(l, "Invalid character entity"), "&" + l.entity + ";") : String.fromCodePoint(E));
4889
4990
  }
4890
4991
  function St(l, o) {
4891
- o === "<" ? (l.state = I.OPEN_WAKA, l.startTagPosition = l.position) : Y(o) || (le(l, "Non-whitespace before first tag."), l.textNode = o, l.state = I.TEXT);
4992
+ o === "<" ? (l.state = D.OPEN_WAKA, l.startTagPosition = l.position) : Y(o) || (le(l, "Non-whitespace before first tag."), l.textNode = o, l.state = D.TEXT);
4892
4993
  }
4893
4994
  function Je(l, o) {
4894
4995
  var C = "";
@@ -4909,184 +5010,184 @@ Actual: ` + l.attribValue
4909
5010
  for (var C = 0, E = ""; E = Je(l, C++), o.c = E, !!E; )
4910
5011
  switch (o.trackPosition && (o.position++, E === `
4911
5012
  ` ? (o.line++, o.column = 0) : o.column++), o.state) {
4912
- case I.BEGIN:
4913
- if (o.state = I.BEGIN_WHITESPACE, E === "\uFEFF")
5013
+ case D.BEGIN:
5014
+ if (o.state = D.BEGIN_WHITESPACE, E === "\uFEFF")
4914
5015
  continue;
4915
5016
  St(o, E);
4916
5017
  continue;
4917
- case I.BEGIN_WHITESPACE:
5018
+ case D.BEGIN_WHITESPACE:
4918
5019
  St(o, E);
4919
5020
  continue;
4920
- case I.TEXT:
5021
+ case D.TEXT:
4921
5022
  if (o.sawRoot && !o.closedRoot) {
4922
5023
  for (var Q = C - 1; E && E !== "<" && E !== "&"; )
4923
5024
  E = Je(l, C++), E && o.trackPosition && (o.position++, E === `
4924
5025
  ` ? (o.line++, o.column = 0) : o.column++);
4925
5026
  o.textNode += l.substring(Q, C - 1);
4926
5027
  }
4927
- E === "<" && !(o.sawRoot && o.closedRoot && !o.strict) ? (o.state = I.OPEN_WAKA, o.startTagPosition = o.position) : (!Y(E) && (!o.sawRoot || o.closedRoot) && le(o, "Text data outside of root node."), E === "&" ? o.state = I.TEXT_ENTITY : o.textNode += E);
5028
+ E === "<" && !(o.sawRoot && o.closedRoot && !o.strict) ? (o.state = D.OPEN_WAKA, o.startTagPosition = o.position) : (!Y(E) && (!o.sawRoot || o.closedRoot) && le(o, "Text data outside of root node."), E === "&" ? o.state = D.TEXT_ENTITY : o.textNode += E);
4928
5029
  continue;
4929
- case I.SCRIPT:
4930
- E === "<" ? o.state = I.SCRIPT_ENDING : o.script += E;
5030
+ case D.SCRIPT:
5031
+ E === "<" ? o.state = D.SCRIPT_ENDING : o.script += E;
4931
5032
  continue;
4932
- case I.SCRIPT_ENDING:
4933
- E === "/" ? o.state = I.CLOSE_TAG : (o.script += "<" + E, o.state = I.SCRIPT);
5033
+ case D.SCRIPT_ENDING:
5034
+ E === "/" ? o.state = D.CLOSE_TAG : (o.script += "<" + E, o.state = D.SCRIPT);
4934
5035
  continue;
4935
- case I.OPEN_WAKA:
5036
+ case D.OPEN_WAKA:
4936
5037
  if (E === "!")
4937
- o.state = I.SGML_DECL, o.sgmlDecl = "";
5038
+ o.state = D.SGML_DECL, o.sgmlDecl = "";
4938
5039
  else if (!Y(E)) if (ne(se, E))
4939
- o.state = I.OPEN_TAG, o.tagName = E;
5040
+ o.state = D.OPEN_TAG, o.tagName = E;
4940
5041
  else if (E === "/")
4941
- o.state = I.CLOSE_TAG, o.tagName = "";
5042
+ o.state = D.CLOSE_TAG, o.tagName = "";
4942
5043
  else if (E === "?")
4943
- o.state = I.PROC_INST, o.procInstName = o.procInstBody = "";
5044
+ o.state = D.PROC_INST, o.procInstName = o.procInstBody = "";
4944
5045
  else {
4945
5046
  if (le(o, "Unencoded <"), o.startTagPosition + 1 < o.position) {
4946
5047
  var ie = o.position - o.startTagPosition;
4947
5048
  E = new Array(ie).join(" ") + E;
4948
5049
  }
4949
- o.textNode += "<" + E, o.state = I.TEXT;
5050
+ o.textNode += "<" + E, o.state = D.TEXT;
4950
5051
  }
4951
5052
  continue;
4952
- case I.SGML_DECL:
5053
+ case D.SGML_DECL:
4953
5054
  if (o.sgmlDecl + E === "--") {
4954
- o.state = I.COMMENT, o.comment = "", o.sgmlDecl = "";
5055
+ o.state = D.COMMENT, o.comment = "", o.sgmlDecl = "";
4955
5056
  continue;
4956
5057
  }
4957
- o.doctype && o.doctype !== !0 && o.sgmlDecl ? (o.state = I.DOCTYPE_DTD, o.doctype += "<!" + o.sgmlDecl + E, o.sgmlDecl = "") : (o.sgmlDecl + E).toUpperCase() === W ? (de(o, "onopencdata"), o.state = I.CDATA, o.sgmlDecl = "", o.cdata = "") : (o.sgmlDecl + E).toUpperCase() === J ? (o.state = I.DOCTYPE, (o.doctype || o.sawRoot) && le(
5058
+ o.doctype && o.doctype !== !0 && o.sgmlDecl ? (o.state = D.DOCTYPE_DTD, o.doctype += "<!" + o.sgmlDecl + E, o.sgmlDecl = "") : (o.sgmlDecl + E).toUpperCase() === W ? (de(o, "onopencdata"), o.state = D.CDATA, o.sgmlDecl = "", o.cdata = "") : (o.sgmlDecl + E).toUpperCase() === J ? (o.state = D.DOCTYPE, (o.doctype || o.sawRoot) && le(
4958
5059
  o,
4959
5060
  "Inappropriately located doctype declaration"
4960
- ), o.doctype = "", o.sgmlDecl = "") : E === ">" ? (de(o, "onsgmldeclaration", o.sgmlDecl), o.sgmlDecl = "", o.state = I.TEXT) : (ae(E) && (o.state = I.SGML_DECL_QUOTED), o.sgmlDecl += E);
5061
+ ), o.doctype = "", o.sgmlDecl = "") : E === ">" ? (de(o, "onsgmldeclaration", o.sgmlDecl), o.sgmlDecl = "", o.state = D.TEXT) : (ae(E) && (o.state = D.SGML_DECL_QUOTED), o.sgmlDecl += E);
4961
5062
  continue;
4962
- case I.SGML_DECL_QUOTED:
4963
- E === o.q && (o.state = I.SGML_DECL, o.q = ""), o.sgmlDecl += E;
5063
+ case D.SGML_DECL_QUOTED:
5064
+ E === o.q && (o.state = D.SGML_DECL, o.q = ""), o.sgmlDecl += E;
4964
5065
  continue;
4965
- case I.DOCTYPE:
4966
- E === ">" ? (o.state = I.TEXT, de(o, "ondoctype", o.doctype), o.doctype = !0) : (o.doctype += E, E === "[" ? o.state = I.DOCTYPE_DTD : ae(E) && (o.state = I.DOCTYPE_QUOTED, o.q = E));
5066
+ case D.DOCTYPE:
5067
+ E === ">" ? (o.state = D.TEXT, de(o, "ondoctype", o.doctype), o.doctype = !0) : (o.doctype += E, E === "[" ? o.state = D.DOCTYPE_DTD : ae(E) && (o.state = D.DOCTYPE_QUOTED, o.q = E));
4967
5068
  continue;
4968
- case I.DOCTYPE_QUOTED:
4969
- o.doctype += E, E === o.q && (o.q = "", o.state = I.DOCTYPE);
5069
+ case D.DOCTYPE_QUOTED:
5070
+ o.doctype += E, E === o.q && (o.q = "", o.state = D.DOCTYPE);
4970
5071
  continue;
4971
- case I.DOCTYPE_DTD:
4972
- E === "]" ? (o.doctype += E, o.state = I.DOCTYPE) : E === "<" ? (o.state = I.OPEN_WAKA, o.startTagPosition = o.position) : ae(E) ? (o.doctype += E, o.state = I.DOCTYPE_DTD_QUOTED, o.q = E) : o.doctype += E;
5072
+ case D.DOCTYPE_DTD:
5073
+ E === "]" ? (o.doctype += E, o.state = D.DOCTYPE) : E === "<" ? (o.state = D.OPEN_WAKA, o.startTagPosition = o.position) : ae(E) ? (o.doctype += E, o.state = D.DOCTYPE_DTD_QUOTED, o.q = E) : o.doctype += E;
4973
5074
  continue;
4974
- case I.DOCTYPE_DTD_QUOTED:
4975
- o.doctype += E, E === o.q && (o.state = I.DOCTYPE_DTD, o.q = "");
5075
+ case D.DOCTYPE_DTD_QUOTED:
5076
+ o.doctype += E, E === o.q && (o.state = D.DOCTYPE_DTD, o.q = "");
4976
5077
  continue;
4977
- case I.COMMENT:
4978
- E === "-" ? o.state = I.COMMENT_ENDING : o.comment += E;
5078
+ case D.COMMENT:
5079
+ E === "-" ? o.state = D.COMMENT_ENDING : o.comment += E;
4979
5080
  continue;
4980
- case I.COMMENT_ENDING:
4981
- E === "-" ? (o.state = I.COMMENT_ENDED, o.comment = zt(o.opt, o.comment), o.comment && de(o, "oncomment", o.comment), o.comment = "") : (o.comment += "-" + E, o.state = I.COMMENT);
5081
+ case D.COMMENT_ENDING:
5082
+ E === "-" ? (o.state = D.COMMENT_ENDED, o.comment = zt(o.opt, o.comment), o.comment && de(o, "oncomment", o.comment), o.comment = "") : (o.comment += "-" + E, o.state = D.COMMENT);
4982
5083
  continue;
4983
- case I.COMMENT_ENDED:
4984
- E !== ">" ? (le(o, "Malformed comment"), o.comment += "--" + E, o.state = I.COMMENT) : o.doctype && o.doctype !== !0 ? o.state = I.DOCTYPE_DTD : o.state = I.TEXT;
5084
+ case D.COMMENT_ENDED:
5085
+ E !== ">" ? (le(o, "Malformed comment"), o.comment += "--" + E, o.state = D.COMMENT) : o.doctype && o.doctype !== !0 ? o.state = D.DOCTYPE_DTD : o.state = D.TEXT;
4985
5086
  continue;
4986
- case I.CDATA:
5087
+ case D.CDATA:
4987
5088
  for (var Q = C - 1; E && E !== "]"; )
4988
5089
  E = Je(l, C++), E && o.trackPosition && (o.position++, E === `
4989
5090
  ` ? (o.line++, o.column = 0) : o.column++);
4990
- o.cdata += l.substring(Q, C - 1), E === "]" && (o.state = I.CDATA_ENDING);
5091
+ o.cdata += l.substring(Q, C - 1), E === "]" && (o.state = D.CDATA_ENDING);
4991
5092
  continue;
4992
- case I.CDATA_ENDING:
4993
- E === "]" ? o.state = I.CDATA_ENDING_2 : (o.cdata += "]" + E, o.state = I.CDATA);
5093
+ case D.CDATA_ENDING:
5094
+ E === "]" ? o.state = D.CDATA_ENDING_2 : (o.cdata += "]" + E, o.state = D.CDATA);
4994
5095
  continue;
4995
- case I.CDATA_ENDING_2:
4996
- E === ">" ? (o.cdata && de(o, "oncdata", o.cdata), de(o, "onclosecdata"), o.cdata = "", o.state = I.TEXT) : E === "]" ? o.cdata += "]" : (o.cdata += "]]" + E, o.state = I.CDATA);
5096
+ case D.CDATA_ENDING_2:
5097
+ E === ">" ? (o.cdata && de(o, "oncdata", o.cdata), de(o, "onclosecdata"), o.cdata = "", o.state = D.TEXT) : E === "]" ? o.cdata += "]" : (o.cdata += "]]" + E, o.state = D.CDATA);
4997
5098
  continue;
4998
- case I.PROC_INST:
4999
- E === "?" ? o.state = I.PROC_INST_ENDING : Y(E) ? o.state = I.PROC_INST_BODY : o.procInstName += E;
5099
+ case D.PROC_INST:
5100
+ E === "?" ? o.state = D.PROC_INST_ENDING : Y(E) ? o.state = D.PROC_INST_BODY : o.procInstName += E;
5000
5101
  continue;
5001
- case I.PROC_INST_BODY:
5102
+ case D.PROC_INST_BODY:
5002
5103
  if (!o.procInstBody && Y(E))
5003
5104
  continue;
5004
- E === "?" ? o.state = I.PROC_INST_ENDING : o.procInstBody += E;
5105
+ E === "?" ? o.state = D.PROC_INST_ENDING : o.procInstBody += E;
5005
5106
  continue;
5006
- case I.PROC_INST_ENDING:
5107
+ case D.PROC_INST_ENDING:
5007
5108
  E === ">" ? (de(o, "onprocessinginstruction", {
5008
5109
  name: o.procInstName,
5009
5110
  body: o.procInstBody
5010
- }), o.procInstName = o.procInstBody = "", o.state = I.TEXT) : (o.procInstBody += "?" + E, o.state = I.PROC_INST_BODY);
5111
+ }), o.procInstName = o.procInstBody = "", o.state = D.TEXT) : (o.procInstBody += "?" + E, o.state = D.PROC_INST_BODY);
5011
5112
  continue;
5012
- case I.OPEN_TAG:
5013
- ne(ce, E) ? o.tagName += E : (Xe(o), E === ">" ? qe(o) : E === "/" ? o.state = I.OPEN_TAG_SLASH : (Y(E) || le(o, "Invalid character in tag name"), o.state = I.ATTRIB));
5113
+ case D.OPEN_TAG:
5114
+ ne(ce, E) ? o.tagName += E : (Xe(o), E === ">" ? qe(o) : E === "/" ? o.state = D.OPEN_TAG_SLASH : (Y(E) || le(o, "Invalid character in tag name"), o.state = D.ATTRIB));
5014
5115
  continue;
5015
- case I.OPEN_TAG_SLASH:
5016
- E === ">" ? (qe(o, !0), It(o)) : (le(
5116
+ case D.OPEN_TAG_SLASH:
5117
+ E === ">" ? (qe(o, !0), Dt(o)) : (le(
5017
5118
  o,
5018
5119
  "Forward-slash in opening tag not followed by >"
5019
- ), o.state = I.ATTRIB);
5120
+ ), o.state = D.ATTRIB);
5020
5121
  continue;
5021
- case I.ATTRIB:
5122
+ case D.ATTRIB:
5022
5123
  if (Y(E))
5023
5124
  continue;
5024
- E === ">" ? qe(o) : E === "/" ? o.state = I.OPEN_TAG_SLASH : ne(se, E) ? (o.attribName = E, o.attribValue = "", o.state = I.ATTRIB_NAME) : le(o, "Invalid attribute name");
5125
+ E === ">" ? qe(o) : E === "/" ? o.state = D.OPEN_TAG_SLASH : ne(se, E) ? (o.attribName = E, o.attribValue = "", o.state = D.ATTRIB_NAME) : le(o, "Invalid attribute name");
5025
5126
  continue;
5026
- case I.ATTRIB_NAME:
5027
- E === "=" ? o.state = I.ATTRIB_VALUE : E === ">" ? (le(o, "Attribute without value"), o.attribValue = o.attribName, Fe(o), qe(o)) : Y(E) ? o.state = I.ATTRIB_NAME_SAW_WHITE : ne(ce, E) ? o.attribName += E : le(o, "Invalid attribute name");
5127
+ case D.ATTRIB_NAME:
5128
+ E === "=" ? o.state = D.ATTRIB_VALUE : E === ">" ? (le(o, "Attribute without value"), o.attribValue = o.attribName, Fe(o), qe(o)) : Y(E) ? o.state = D.ATTRIB_NAME_SAW_WHITE : ne(ce, E) ? o.attribName += E : le(o, "Invalid attribute name");
5028
5129
  continue;
5029
- case I.ATTRIB_NAME_SAW_WHITE:
5130
+ case D.ATTRIB_NAME_SAW_WHITE:
5030
5131
  if (E === "=")
5031
- o.state = I.ATTRIB_VALUE;
5132
+ o.state = D.ATTRIB_VALUE;
5032
5133
  else {
5033
5134
  if (Y(E))
5034
5135
  continue;
5035
5136
  le(o, "Attribute without value"), o.tag.attributes[o.attribName] = "", o.attribValue = "", de(o, "onattribute", {
5036
5137
  name: o.attribName,
5037
5138
  value: ""
5038
- }), o.attribName = "", E === ">" ? qe(o) : ne(se, E) ? (o.attribName = E, o.state = I.ATTRIB_NAME) : (le(o, "Invalid attribute name"), o.state = I.ATTRIB);
5139
+ }), o.attribName = "", E === ">" ? qe(o) : ne(se, E) ? (o.attribName = E, o.state = D.ATTRIB_NAME) : (le(o, "Invalid attribute name"), o.state = D.ATTRIB);
5039
5140
  }
5040
5141
  continue;
5041
- case I.ATTRIB_VALUE:
5142
+ case D.ATTRIB_VALUE:
5042
5143
  if (Y(E))
5043
5144
  continue;
5044
- ae(E) ? (o.q = E, o.state = I.ATTRIB_VALUE_QUOTED) : (o.opt.unquotedAttributeValues || Ke(o, "Unquoted attribute value"), o.state = I.ATTRIB_VALUE_UNQUOTED, o.attribValue = E);
5145
+ ae(E) ? (o.q = E, o.state = D.ATTRIB_VALUE_QUOTED) : (o.opt.unquotedAttributeValues || Ke(o, "Unquoted attribute value"), o.state = D.ATTRIB_VALUE_UNQUOTED, o.attribValue = E);
5045
5146
  continue;
5046
- case I.ATTRIB_VALUE_QUOTED:
5147
+ case D.ATTRIB_VALUE_QUOTED:
5047
5148
  if (E !== o.q) {
5048
- E === "&" ? o.state = I.ATTRIB_VALUE_ENTITY_Q : o.attribValue += E;
5149
+ E === "&" ? o.state = D.ATTRIB_VALUE_ENTITY_Q : o.attribValue += E;
5049
5150
  continue;
5050
5151
  }
5051
- Fe(o), o.q = "", o.state = I.ATTRIB_VALUE_CLOSED;
5152
+ Fe(o), o.q = "", o.state = D.ATTRIB_VALUE_CLOSED;
5052
5153
  continue;
5053
- case I.ATTRIB_VALUE_CLOSED:
5054
- Y(E) ? o.state = I.ATTRIB : E === ">" ? qe(o) : E === "/" ? o.state = I.OPEN_TAG_SLASH : ne(se, E) ? (le(o, "No whitespace between attributes"), o.attribName = E, o.attribValue = "", o.state = I.ATTRIB_NAME) : le(o, "Invalid attribute name");
5154
+ case D.ATTRIB_VALUE_CLOSED:
5155
+ Y(E) ? o.state = D.ATTRIB : E === ">" ? qe(o) : E === "/" ? o.state = D.OPEN_TAG_SLASH : ne(se, E) ? (le(o, "No whitespace between attributes"), o.attribName = E, o.attribValue = "", o.state = D.ATTRIB_NAME) : le(o, "Invalid attribute name");
5055
5156
  continue;
5056
- case I.ATTRIB_VALUE_UNQUOTED:
5057
- if (!pe(E)) {
5058
- E === "&" ? o.state = I.ATTRIB_VALUE_ENTITY_U : o.attribValue += E;
5157
+ case D.ATTRIB_VALUE_UNQUOTED:
5158
+ if (!me(E)) {
5159
+ E === "&" ? o.state = D.ATTRIB_VALUE_ENTITY_U : o.attribValue += E;
5059
5160
  continue;
5060
5161
  }
5061
- Fe(o), E === ">" ? qe(o) : o.state = I.ATTRIB;
5162
+ Fe(o), E === ">" ? qe(o) : o.state = D.ATTRIB;
5062
5163
  continue;
5063
- case I.CLOSE_TAG:
5164
+ case D.CLOSE_TAG:
5064
5165
  if (o.tagName)
5065
- E === ">" ? It(o) : ne(ce, E) ? o.tagName += E : o.script ? (o.script += "</" + o.tagName + E, o.tagName = "", o.state = I.SCRIPT) : (Y(E) || le(o, "Invalid tagname in closing tag"), o.state = I.CLOSE_TAG_SAW_WHITE);
5166
+ E === ">" ? Dt(o) : ne(ce, E) ? o.tagName += E : o.script ? (o.script += "</" + o.tagName + E, o.tagName = "", o.state = D.SCRIPT) : (Y(E) || le(o, "Invalid tagname in closing tag"), o.state = D.CLOSE_TAG_SAW_WHITE);
5066
5167
  else {
5067
5168
  if (Y(E))
5068
5169
  continue;
5069
- Ie(se, E) ? o.script ? (o.script += "</" + E, o.state = I.SCRIPT) : le(o, "Invalid tagname in closing tag.") : o.tagName = E;
5170
+ De(se, E) ? o.script ? (o.script += "</" + E, o.state = D.SCRIPT) : le(o, "Invalid tagname in closing tag.") : o.tagName = E;
5070
5171
  }
5071
5172
  continue;
5072
- case I.CLOSE_TAG_SAW_WHITE:
5173
+ case D.CLOSE_TAG_SAW_WHITE:
5073
5174
  if (Y(E))
5074
5175
  continue;
5075
- E === ">" ? It(o) : le(o, "Invalid characters in closing tag");
5176
+ E === ">" ? Dt(o) : le(o, "Invalid characters in closing tag");
5076
5177
  continue;
5077
- case I.TEXT_ENTITY:
5078
- case I.ATTRIB_VALUE_ENTITY_Q:
5079
- case I.ATTRIB_VALUE_ENTITY_U:
5178
+ case D.TEXT_ENTITY:
5179
+ case D.ATTRIB_VALUE_ENTITY_Q:
5180
+ case D.ATTRIB_VALUE_ENTITY_U:
5080
5181
  var he, Ae;
5081
5182
  switch (o.state) {
5082
- case I.TEXT_ENTITY:
5083
- he = I.TEXT, Ae = "textNode";
5183
+ case D.TEXT_ENTITY:
5184
+ he = D.TEXT, Ae = "textNode";
5084
5185
  break;
5085
- case I.ATTRIB_VALUE_ENTITY_Q:
5086
- he = I.ATTRIB_VALUE_QUOTED, Ae = "attribValue";
5186
+ case D.ATTRIB_VALUE_ENTITY_Q:
5187
+ he = D.ATTRIB_VALUE_QUOTED, Ae = "attribValue";
5087
5188
  break;
5088
- case I.ATTRIB_VALUE_ENTITY_U:
5089
- he = I.ATTRIB_VALUE_UNQUOTED, Ae = "attribValue";
5189
+ case D.ATTRIB_VALUE_ENTITY_U:
5190
+ he = D.ATTRIB_VALUE_UNQUOTED, Ae = "attribValue";
5090
5191
  break;
5091
5192
  }
5092
5193
  if (E === ";") {
@@ -5133,7 +5234,7 @@ Actual: ` + l.attribValue
5133
5234
  var qi = Ki();
5134
5235
  function Li(g) {
5135
5236
  const { dialecteConfig: u, useCustomRecordsIds: c } = g, i = u.io.hooks;
5136
- let m = {
5237
+ let p = {
5137
5238
  defaultNamespace: null,
5138
5239
  stack: [],
5139
5240
  recordsBatch: []
@@ -5154,21 +5255,21 @@ function Li(g) {
5154
5255
  // Enable namespace handling
5155
5256
  }
5156
5257
  );
5157
- y.onopentag = (j) => m = Ui({
5258
+ y.onopentag = (j) => p = Ui({
5158
5259
  node: j,
5159
- state: m,
5260
+ state: p,
5160
5261
  dialecteConfig: u,
5161
5262
  useCustomRecordsIds: c
5162
- }), y.ontext = (j) => m = Vi({ text: j, state: m }), y.onclosetag = () => ({ updatedState: m } = Gi({
5163
- state: m,
5263
+ }), y.ontext = (j) => p = Vi({ text: j, state: p }), y.onclosetag = () => ({ updatedState: p } = Gi({
5264
+ state: p,
5164
5265
  ioHooks: i
5165
5266
  })), y.onerror = $i;
5166
5267
  function N() {
5167
- const j = m.recordsBatch;
5168
- return m.recordsBatch = [], j;
5268
+ const j = p.recordsBatch;
5269
+ return p.recordsBatch = [], j;
5169
5270
  }
5170
5271
  function R() {
5171
- return m.recordsBatch.length;
5272
+ return p.recordsBatch.length;
5172
5273
  }
5173
5274
  return {
5174
5275
  parser: y,
@@ -5177,13 +5278,13 @@ function Li(g) {
5177
5278
  };
5178
5279
  }
5179
5280
  function Ui(g) {
5180
- const { node: u, state: c, dialecteConfig: i, useCustomRecordsIds: h } = g, m = { ...c }, y = Xi(u);
5181
- m.defaultNamespace || (m.defaultNamespace = Wi({
5281
+ const { node: u, state: c, dialecteConfig: i, useCustomRecordsIds: h } = g, p = { ...c }, y = Xi(u);
5282
+ p.defaultNamespace || (p.defaultNamespace = Wi({
5182
5283
  element: u,
5183
5284
  defaultNamespace: i.namespaces.default,
5184
5285
  rootElementName: i.rootElementName
5185
5286
  }));
5186
- const N = Yi(u, m.defaultNamespace), R = Hi({ attributes: u.attributes, useCustomRecordsIds: h }), j = Zi({
5287
+ const N = Yi(u, p.defaultNamespace), R = Hi({ attributes: u.attributes, useCustomRecordsIds: h }), j = Zi({
5187
5288
  attributes: u.attributes,
5188
5289
  useCustomRecordsIds: h
5189
5290
  }), X = zi(j), W = Qi(c.stack), J = {
@@ -5195,7 +5296,7 @@ function Ui(g) {
5195
5296
  parent: W,
5196
5297
  children: []
5197
5298
  };
5198
- return m.stack.push(J), m;
5299
+ return p.stack.push(J), p;
5199
5300
  }
5200
5301
  function Vi(g) {
5201
5302
  const { text: u, state: c } = g;
@@ -5204,7 +5305,7 @@ function Vi(g) {
5204
5305
  function Gi(g) {
5205
5306
  const { state: u, ioHooks: c } = g, i = u.stack.at(-1);
5206
5307
  let h = u.stack.slice(0, -1);
5207
- const m = [...u.recordsBatch];
5308
+ const p = [...u.recordsBatch];
5208
5309
  if (i) {
5209
5310
  if (c?.beforeImportRecord && c.beforeImportRecord({
5210
5311
  record: i,
@@ -5224,13 +5325,13 @@ function Gi(g) {
5224
5325
  parentId: i.parent.id,
5225
5326
  child: { id: i.id, tagName: i.tagName }
5226
5327
  });
5227
- m.push(i);
5328
+ p.push(i);
5228
5329
  }
5229
5330
  return {
5230
5331
  updatedState: {
5231
5332
  defaultNamespace: u.defaultNamespace,
5232
5333
  stack: h,
5233
- recordsBatch: m
5334
+ recordsBatch: p
5234
5335
  }
5235
5336
  };
5236
5337
  }
@@ -5243,8 +5344,7 @@ function Xi(g) {
5243
5344
  function Wi(g) {
5244
5345
  const { element: u, defaultNamespace: c, rootElementName: i } = g;
5245
5346
  return $e(u.name === i, {
5246
- detail: `Expected root element <${i}>, got <${u.name}>`,
5247
- method: "import::getDefaultNamespace"
5347
+ detail: `Expected root element <${i}>, got <${u.name}>`
5248
5348
  }), u.attributes?.xmlns?.value ? {
5249
5349
  prefix: "",
5250
5350
  uri: u.attributes.xmlns.value
@@ -5291,9 +5391,9 @@ const ea = {
5291
5391
  async function So(g) {
5292
5392
  const { files: u, dialecteConfig: c, useCustomRecordsIds: i = !1 } = g, h = [];
5293
5393
  if (u.length === 0) throw new Error("No files provided for import.");
5294
- const { importOptions: m = ea, supportedFileExtensions: y } = c.io, N = {
5394
+ const { importOptions: p = ea, supportedFileExtensions: y } = c.io, N = {
5295
5395
  ...ea,
5296
- ...m
5396
+ ...p
5297
5397
  };
5298
5398
  for (const R of u) {
5299
5399
  if (!Ji({ file: R, supportedExtensions: y })) {
@@ -5319,7 +5419,7 @@ function eo(g) {
5319
5419
  return g.name.replace(/\.[^.]+$/, "");
5320
5420
  }
5321
5421
  async function to(g) {
5322
- const { file: u, dialecteConfig: c, options: i, useCustomRecordsIds: h } = g, m = eo(u), y = await Di({ databaseName: m, dialecteConfig: c });
5422
+ const { file: u, dialecteConfig: c, options: i, useCustomRecordsIds: h } = g, p = eo(u), y = await Ii({ databaseName: p, dialecteConfig: c });
5323
5423
  try {
5324
5424
  const N = c.database.tables.xmlElements.name;
5325
5425
  if (await y.table(N).clear(), i.useBrowserApi && u.size !== 0 && await no({
@@ -5334,9 +5434,9 @@ async function to(g) {
5334
5434
  }
5335
5435
  }), c.io.hooks?.afterImport) {
5336
5436
  const { creates: R, updates: j, deletes: X } = await c.io.hooks.afterImport();
5337
- R?.length && await ga({ databaseInstance: y, elementsTableName: N, records: R }), j?.length && await Ii({ databaseInstance: y, elementsTableName: N, updates: j }), X?.length && await Si({ databaseInstance: y, elementsTableName: N, ids: X });
5437
+ R?.length && await ga({ databaseInstance: y, elementsTableName: N, records: R }), j?.length && await Di({ databaseInstance: y, elementsTableName: N, updates: j }), X?.length && await Si({ databaseInstance: y, elementsTableName: N, ids: X });
5338
5438
  }
5339
- return m;
5439
+ return p;
5340
5440
  } catch (N) {
5341
5441
  throw console.error(`Error importing file ${u.name}:`, N), N;
5342
5442
  } finally {
@@ -5344,9 +5444,9 @@ async function to(g) {
5344
5444
  }
5345
5445
  }
5346
5446
  async function no(g) {
5347
- const { file: u, databaseInstance: c, elementsTableName: i, dialecteConfig: h, options: m } = g, y = u.stream().getReader(), N = Li({
5447
+ const { file: u, databaseInstance: c, elementsTableName: i, dialecteConfig: h, options: p } = g, y = u.stream().getReader(), N = Li({
5348
5448
  dialecteConfig: h,
5349
- useCustomRecordsIds: m.useCustomRecordsIds
5449
+ useCustomRecordsIds: p.useCustomRecordsIds
5350
5450
  }), R = new TextDecoder(), j = new Uint8Array(0);
5351
5451
  return await fr({
5352
5452
  databaseInstance: c,
@@ -5355,14 +5455,14 @@ async function no(g) {
5355
5455
  sax: N,
5356
5456
  textDecoder: R,
5357
5457
  buffer: j,
5358
- options: m
5458
+ options: p
5359
5459
  });
5360
5460
  }
5361
5461
  async function fr(g) {
5362
- const { databaseInstance: u, elementsTableName: c, reader: i, sax: h, textDecoder: m, buffer: y, options: N } = g, { chunkSize: R, batchSize: j } = N, { done: X, value: W } = await i.read();
5462
+ const { databaseInstance: u, elementsTableName: c, reader: i, sax: h, textDecoder: p, buffer: y, options: N } = g, { chunkSize: R, batchSize: j } = N, { done: X, value: W } = await i.read();
5363
5463
  if (X) {
5364
5464
  if (y.length > 0) {
5365
- const fe = m.decode(y);
5465
+ const fe = p.decode(y);
5366
5466
  h.parser.write(fe);
5367
5467
  }
5368
5468
  return h.parser.close(), await ta({
@@ -5378,7 +5478,7 @@ async function fr(g) {
5378
5478
  for (J.set(y), J.set(W, y.length); J.length >= R; ) {
5379
5479
  const fe = J.slice(0, R);
5380
5480
  J = J.slice(R);
5381
- const B = m.decode(fe, { stream: !0 });
5481
+ const B = p.decode(fe, { stream: !0 });
5382
5482
  h.parser.write(B), await ta({
5383
5483
  databaseInstance: u,
5384
5484
  elementsTableName: c,
@@ -5416,19 +5516,19 @@ function ro() {
5416
5516
  function h() {
5417
5517
  return R(!1) || J() || W() || X() || N();
5418
5518
  }
5419
- function m() {
5519
+ function p() {
5420
5520
  return F(/\s*/), R(!0) || W() || j() || N();
5421
5521
  }
5422
5522
  function y() {
5423
5523
  const ee = N(), Y = [];
5424
- let ae, pe = m();
5425
- for (; pe; ) {
5426
- if (pe.node.type === "Element") {
5524
+ let ae, me = p();
5525
+ for (; me; ) {
5526
+ if (me.node.type === "Element") {
5427
5527
  if (ae)
5428
5528
  throw new Error("Found multiple root nodes");
5429
- ae = pe.node;
5529
+ ae = me.node;
5430
5530
  }
5431
- pe.excluded || Y.push(pe.node), pe = m();
5531
+ me.excluded || Y.push(me.node), me = p();
5432
5532
  }
5433
5533
  if (!ae)
5434
5534
  throw new c("Failed to parse XML", "Root Element not found");
@@ -5467,17 +5567,17 @@ function ro() {
5467
5567
  name: Y[1],
5468
5568
  attributes: {},
5469
5569
  children: []
5470
- }, pe = ee ? !1 : i.options.filter(ae) === !1;
5570
+ }, me = ee ? !1 : i.options.filter(ae) === !1;
5471
5571
  for (; !(se() || ce(">") || ce("?>") || ce("/>")); ) {
5472
- const Ie = fe();
5473
- if (Ie)
5474
- ae.attributes[Ie.name] = Ie.value;
5572
+ const De = fe();
5573
+ if (De)
5574
+ ae.attributes[De.name] = De.value;
5475
5575
  else
5476
5576
  return;
5477
5577
  }
5478
5578
  if (F(/^\s*\/>/))
5479
5579
  return ae.children = null, {
5480
- excluded: pe,
5580
+ excluded: me,
5481
5581
  node: ae
5482
5582
  };
5483
5583
  F(/\??>/);
@@ -5485,15 +5585,15 @@ function ro() {
5485
5585
  for (; ne; )
5486
5586
  ne.excluded || ae.children.push(ne.node), ne = h();
5487
5587
  if (i.options.strictMode) {
5488
- const Ie = `</${ae.name}>`;
5489
- if (i.xml.startsWith(Ie))
5490
- i.xml = i.xml.slice(Ie.length);
5588
+ const De = `</${ae.name}>`;
5589
+ if (i.xml.startsWith(De))
5590
+ i.xml = i.xml.slice(De.length);
5491
5591
  else
5492
- throw new c("Failed to parse XML", `Closing tag not matching "${Ie}"`);
5592
+ throw new c("Failed to parse XML", `Closing tag not matching "${De}"`);
5493
5593
  } else
5494
5594
  F(/^<\/[\w-:.\u00C0-\u00FF]+\s*>/);
5495
5595
  return {
5496
- excluded: pe,
5596
+ excluded: me,
5497
5597
  node: ae
5498
5598
  };
5499
5599
  }
@@ -5600,7 +5700,7 @@ function ao() {
5600
5700
  for (F = 0; F < B.level; F++)
5601
5701
  B.content += B.options.indentation;
5602
5702
  }
5603
- function m(B) {
5703
+ function p(B) {
5604
5704
  B.content = B.content.replace(/ +$/, "");
5605
5705
  let F;
5606
5706
  for (F = 0; F < B.level; F++)
@@ -5641,15 +5741,15 @@ function ao() {
5641
5741
  y(F, ">"), F.level++;
5642
5742
  let Te = B.attributes["xml:space"] === "preserve" || se, ee = !1;
5643
5743
  if (!Te && F.options.ignoredPaths && (ee = j(F.path, F.options.ignoredPaths), Te = ee), !Te && F.options.collapseContent) {
5644
- let Y = !1, ae = !1, pe = !1;
5645
- ce.forEach(function(ne, Ie) {
5744
+ let Y = !1, ae = !1, me = !1;
5745
+ ce.forEach(function(ne, De) {
5646
5746
  ne.type === "Text" ? (ne.content.includes(`
5647
- `) ? (ae = !0, ne.content = ne.content.trim()) : (Ie === 0 || Ie === ce.length - 1) && !se && ne.content.trim().length === 0 && (ne.content = ""), (ne.content.trim().length > 0 || ce.length === 1) && (Y = !0)) : ne.type === "CDATA" ? Y = !0 : pe = !0;
5648
- }), Y && (!pe || !ae) && (Te = !0);
5747
+ `) ? (ae = !0, ne.content = ne.content.trim()) : (De === 0 || De === ce.length - 1) && !se && ne.content.trim().length === 0 && (ne.content = ""), (ne.content.trim().length > 0 || ce.length === 1) && (Y = !0)) : ne.type === "CDATA" ? Y = !0 : me = !0;
5748
+ }), Y && (!me || !ae) && (Te = !0);
5649
5749
  }
5650
5750
  ce.forEach(function(Y) {
5651
5751
  N(Y, F, se || Te);
5652
- }), F.level--, !se && !Te && h(F), ee && m(F), y(F, "</" + B.name + ">");
5752
+ }), F.level--, !se && !Te && h(F), ee && p(F), y(F, "</" + B.name + ">");
5653
5753
  }
5654
5754
  F.path.pop();
5655
5755
  }
@@ -5681,7 +5781,7 @@ function ao() {
5681
5781
  })(Wt, Wt.exports)), Wt.exports;
5682
5782
  }
5683
5783
  var io = /* @__PURE__ */ ao();
5684
- const oo = /* @__PURE__ */ pa(io);
5784
+ const oo = /* @__PURE__ */ ma(io);
5685
5785
  function so(g) {
5686
5786
  return oo(g);
5687
5787
  }
@@ -5714,12 +5814,12 @@ async function Ro(g) {
5714
5814
  databaseName: c,
5715
5815
  extension: i,
5716
5816
  withDownload: h = !1,
5717
- withDatabaseIds: m = !1
5817
+ withDatabaseIds: p = !1
5718
5818
  } = g, y = await co({
5719
5819
  databaseName: c,
5720
5820
  extension: i,
5721
5821
  dialecteConfig: u,
5722
- withDatabaseIds: m
5822
+ withDatabaseIds: p
5723
5823
  });
5724
5824
  return h && await uo({
5725
5825
  extension: i,
@@ -5728,11 +5828,11 @@ async function Ro(g) {
5728
5828
  }), y;
5729
5829
  }
5730
5830
  async function co(g) {
5731
- const { databaseName: u, extension: c = "xml", dialecteConfig: i, withDatabaseIds: h } = g, m = new Qe(u);
5732
- await m.open();
5831
+ const { databaseName: u, extension: c = "xml", dialecteConfig: i, withDatabaseIds: h } = g, p = new Qe(u);
5832
+ await p.open();
5733
5833
  try {
5734
5834
  const y = await lo({
5735
- databaseInstance: m,
5835
+ databaseInstance: p,
5736
5836
  dialecteConfig: i,
5737
5837
  withDatabaseIds: h
5738
5838
  });
@@ -5740,21 +5840,21 @@ async function co(g) {
5740
5840
  throw new Error("Failed to rebuild XML document from IndexedDB.");
5741
5841
  return {
5742
5842
  xmlDocument: y,
5743
- filename: m.name + c
5843
+ filename: p.name + c
5744
5844
  };
5745
5845
  } finally {
5746
- m.close();
5846
+ p.close();
5747
5847
  }
5748
5848
  }
5749
5849
  async function lo(g) {
5750
- const { databaseInstance: u, dialecteConfig: c, withDatabaseIds: i } = g, { useBrowserApi: h = !0 } = c.io.exportOptions ?? { useBrowserApi: !0 }, m = c.rootElementName, y = c.namespaces.default, N = c.database.tables.xmlElements.name;
5850
+ const { databaseInstance: u, dialecteConfig: c, withDatabaseIds: i } = g, { useBrowserApi: h = !0 } = c.io.exportOptions ?? { useBrowserApi: !0 }, p = c.rootElementName, y = c.namespaces.default, N = c.database.tables.xmlElements.name;
5751
5851
  if (h) {
5752
5852
  const R = document.implementation.createDocument(
5753
5853
  y.uri,
5754
5854
  null,
5755
5855
  null
5756
- ), j = await u.table(N).where({ tagName: m }).first();
5757
- if (!j) throw new Error(`No ${m} root element found in DB`);
5856
+ ), j = await u.table(N).where({ tagName: p }).first();
5857
+ if (!j) throw new Error(`No ${p} root element found in DB`);
5758
5858
  const X = R.createElementNS(
5759
5859
  j.namespace.uri,
5760
5860
  j.tagName
@@ -5782,13 +5882,13 @@ async function va(g) {
5782
5882
  dialecteConfig: c,
5783
5883
  elementsTableName: i,
5784
5884
  withDatabaseIds: h,
5785
- xmlDocument: m,
5885
+ xmlDocument: p,
5786
5886
  databaseRecord: y,
5787
5887
  parentDomElement: N
5788
5888
  } = g;
5789
5889
  if (!y.children) return;
5790
5890
  const R = y.children.map((J) => J.id), X = await u.table(i).bulkGet(R);
5791
- mo({
5891
+ po({
5792
5892
  childrenRecords: X,
5793
5893
  parentRecord: y
5794
5894
  });
@@ -5800,7 +5900,7 @@ async function va(g) {
5800
5900
  for (const J of W) {
5801
5901
  const fe = fo({
5802
5902
  dialecteConfig: c,
5803
- document: m,
5903
+ document: p,
5804
5904
  record: J,
5805
5905
  defaultNamespace: c.namespaces.default,
5806
5906
  withDatabaseIds: h
@@ -5810,7 +5910,7 @@ async function va(g) {
5810
5910
  dialecteConfig: c,
5811
5911
  elementsTableName: i,
5812
5912
  withDatabaseIds: h,
5813
- xmlDocument: m,
5913
+ xmlDocument: p,
5814
5914
  databaseRecord: J,
5815
5915
  parentDomElement: fe
5816
5916
  });
@@ -5818,7 +5918,7 @@ async function va(g) {
5818
5918
  return g.xmlDocument;
5819
5919
  }
5820
5920
  function fo(g) {
5821
- const { dialecteConfig: u, document: c, record: i, defaultNamespace: h, withDatabaseIds: m } = g;
5921
+ const { dialecteConfig: u, document: c, record: i, defaultNamespace: h, withDatabaseIds: p } = g;
5822
5922
  let y;
5823
5923
  return !(i.namespace.uri === h.uri) && i.namespace.prefix && i.namespace.prefix !== "xmlns" ? (wa({
5824
5924
  dialecteConfig: u,
@@ -5833,19 +5933,19 @@ function fo(g) {
5833
5933
  element: y,
5834
5934
  attributes: i.attributes,
5835
5935
  isRoot: !1
5836
- }), i.value && (y.textContent = i.value.trim()), m && y.setAttribute(ya, i.id), y;
5936
+ }), i.value && (y.textContent = i.value.trim()), p && y.setAttribute(ya, i.id), y;
5837
5937
  }
5838
5938
  function ba(g) {
5839
- const { dialecteConfig: u, document: c, element: i, attributes: h, isRoot: m } = g;
5939
+ const { dialecteConfig: u, document: c, element: i, attributes: h, isRoot: p } = g;
5840
5940
  for (const y of h)
5841
- if (!po(y))
5941
+ if (!mo(y))
5842
5942
  if (Ta(y)) {
5843
5943
  const N = y.namespace?.prefix || "";
5844
5944
  if (!N) {
5845
5945
  i.setAttribute(y.name, String(y.value));
5846
5946
  continue;
5847
5947
  }
5848
- m || wa({
5948
+ p || wa({
5849
5949
  dialecteConfig: u,
5850
5950
  document: c,
5851
5951
  namespace: y.namespace
@@ -5857,8 +5957,8 @@ function ba(g) {
5857
5957
  function wa(g) {
5858
5958
  const { dialecteConfig: u, document: c, namespace: i } = g, h = c.documentElement;
5859
5959
  if (!h || !i.prefix || i.prefix === "xmlns") return;
5860
- const m = "http://www.w3.org/2000/xmlns/";
5861
- h.getAttributeNS(m, i.prefix) === null && (h.setAttributeNS(m, `xmlns:${i.prefix}`, i.uri), _a({ dialecteConfig: u, rootElement: h, namespace: i }));
5960
+ const p = "http://www.w3.org/2000/xmlns/";
5961
+ h.getAttributeNS(p, i.prefix) === null && (h.setAttributeNS(p, `xmlns:${i.prefix}`, i.uri), _a({ dialecteConfig: u, rootElement: h, namespace: i }));
5862
5962
  }
5863
5963
  function _a(g) {
5864
5964
  const { dialecteConfig: u, rootElement: c, namespace: i } = g, h = Object.entries(
@@ -5877,24 +5977,24 @@ function _a(g) {
5877
5977
  }
5878
5978
  }
5879
5979
  function ho(g) {
5880
- const { parentTagName: u, availableChildren: c, childrenRecords: i } = g, h = [], m = new Set(c[u]);
5881
- if (!m.size) return i;
5980
+ const { parentTagName: u, availableChildren: c, childrenRecords: i } = g, h = [], p = new Set(c[u]);
5981
+ if (!p.size) return i;
5882
5982
  const y = /* @__PURE__ */ new Map(), N = [];
5883
- for (const R of m)
5983
+ for (const R of p)
5884
5984
  y.set(R, []);
5885
5985
  for (const R of i)
5886
- m.has(R.tagName) ? y.get(R.tagName)?.push(R) : N.push(R);
5887
- for (const R of m) {
5986
+ p.has(R.tagName) ? y.get(R.tagName)?.push(R) : N.push(R);
5987
+ for (const R of p) {
5888
5988
  const j = y.get(R);
5889
5989
  j && j.length && h.push(...j);
5890
5990
  }
5891
5991
  return h.push(...N), h;
5892
5992
  }
5893
- function mo(g) {
5894
- const { childrenRecords: u, parentRecord: c } = g, i = u.map((h, m) => h === void 0 ? m : -1).filter((h) => h !== -1);
5993
+ function po(g) {
5994
+ const { childrenRecords: u, parentRecord: c } = g, i = u.map((h, p) => h === void 0 ? p : -1).filter((h) => h !== -1);
5895
5995
  if (i.length > 0) {
5896
- const h = i.map((m) => {
5897
- const y = c.children[m];
5996
+ const h = i.map((p) => {
5997
+ const y = c.children[p];
5898
5998
  return `'${y.tagName}' (id: ${y.id})`;
5899
5999
  });
5900
6000
  throw new Error(
@@ -5905,7 +6005,7 @@ function mo(g) {
5905
6005
  function Ta(g) {
5906
6006
  return g !== null && typeof g == "object" && "namespace" in g && !!g.namespace;
5907
6007
  }
5908
- function po(g) {
6008
+ function mo(g) {
5909
6009
  return !!(g.name === "xmlns" || g.name.startsWith("xmlns:") || Ta(g) && g.namespace?.prefix === "xmlns");
5910
6010
  }
5911
6011
  function Po(g) {
@@ -5922,11 +6022,11 @@ export {
5922
6022
  ga as c,
5923
6023
  Si as d,
5924
6024
  Ro as e,
5925
- Do as f,
5926
- pa as g,
5927
- Ii as h,
6025
+ Io as f,
6026
+ ma as g,
6027
+ Di as h,
5928
6028
  So as i,
5929
- Io as j,
6029
+ Do as j,
5930
6030
  dr as k,
5931
6031
  Qa as l,
5932
6032
  so as m,