@dialecte/core 0.1.5 → 0.1.7

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.
@@ -1,5 +1,5 @@
1
- import { t as je, a as Ue } from "./index-CqwLClK7.js";
2
- import { e as lr, j as _e, l as fr, h as sr, s as Qa, t as Ha, C as sa } from "./standardizing-27Zk5ECm.js";
1
+ import { t as je, a as Ue } from "./index-BCraeB5h.js";
2
+ import { isRecordOf as lr, toRef as _e, toTreeRecord as fr, toRawRecord as sr, standardizeRecord as Ha, toFullAttributeArray as Za, CUSTOM_RECORD_ID_ATTRIBUTE as ua, mergeExtensions as Ja } from "./helpers.js";
3
3
  function ur(m, o) {
4
4
  if (!m) return {};
5
5
  const c = {};
@@ -13,7 +13,7 @@ function ur(m, o) {
13
13
  }
14
14
  return c;
15
15
  }
16
- function Za(m) {
16
+ function ei(m) {
17
17
  const { stagedOperations: o, tagName: c, id: i } = m;
18
18
  for (let d = o.length - 1; d >= 0; d--) {
19
19
  const h = o[d];
@@ -62,7 +62,7 @@ function Za(m) {
62
62
  }
63
63
  }
64
64
  }
65
- function Ja(m) {
65
+ function ti(m) {
66
66
  const { rawRecords: o, stagedOperations: c, tagName: i } = m, d = new Map(
67
67
  o.map((h) => [h.id, { ...h, status: "unchanged" }])
68
68
  );
@@ -78,7 +78,7 @@ function Ja(m) {
78
78
  async function Ee(m) {
79
79
  const { context: o, ref: c } = m;
80
80
  if (o.stagedOperations.length > 0) {
81
- const d = Za({
81
+ const d = ei({
82
82
  stagedOperations: o.stagedOperations,
83
83
  tagName: c.tagName,
84
84
  id: c.id
@@ -97,43 +97,43 @@ async function Ee(m) {
97
97
  if (i)
98
98
  return { ...i, status: "unchanged" };
99
99
  }
100
- async function ua(m) {
100
+ async function ca(m) {
101
101
  const { context: o, refs: c } = m;
102
102
  return Promise.all(c.map((i) => Ee({ context: o, ref: i })));
103
103
  }
104
- async function ca(m) {
104
+ async function la(m) {
105
105
  const { context: o, tagName: c } = m, i = await o.store.getByTagName(c);
106
106
  for (const d of i)
107
107
  Xt(o) && o.recordCache.set(d.id, d);
108
- return Ja({ rawRecords: i, stagedOperations: o.stagedOperations, tagName: c });
108
+ return ti({ rawRecords: i, stagedOperations: o.stagedOperations, tagName: c });
109
109
  }
110
- async function ei(m) {
110
+ async function ni(m) {
111
111
  const { context: o, ref: c, tagName: i } = m, d = await Ee({ context: o, ref: c });
112
112
  if (!d) return;
113
113
  const h = d.children.find((y) => y.tagName === i);
114
114
  if (h)
115
115
  return Ee({ context: o, ref: h });
116
116
  }
117
- async function ti(m) {
117
+ async function ri(m) {
118
118
  const { context: o, ref: c, tagName: i } = m, d = await Ee({ context: o, ref: c });
119
119
  if (!d) return [];
120
120
  const h = d.children.filter((w) => w.tagName === i).map((w) => ({ tagName: i, id: w.id }));
121
- return (await ua({ context: o, refs: h })).filter(
121
+ return (await ca({ context: o, refs: h })).filter(
122
122
  (w) => w !== void 0
123
123
  );
124
124
  }
125
- async function ni(m) {
125
+ async function ai(m) {
126
126
  const { context: o, ref: c, options: i } = m, d = i?.depth ?? 1 / 0, h = i?.stopAtTagName, y = [];
127
127
  let w = await Ee({ context: o, ref: c });
128
128
  for (; w?.parent && y.length < d; ) {
129
- const R = w.parent, j = await Ee({ context: o, ref: R });
130
- if (!j || (y.push(j), h && j.tagName === h)) break;
131
- w = j;
129
+ const R = w.parent, B = await Ee({ context: o, ref: R });
130
+ if (!B || (y.push(B), h && B.tagName === h)) break;
131
+ w = B;
132
132
  }
133
133
  return y;
134
134
  }
135
135
  async function Nn(m) {
136
- const { context: o, tagName: c, attributes: i } = m, d = await ca({ context: o, tagName: c }), h = [];
136
+ const { context: o, tagName: c, attributes: i } = m, d = await la({ context: o, tagName: c }), h = [];
137
137
  for (const y of d)
138
138
  pr({ record: y, attributeFilter: i }) && h.push(y);
139
139
  return h;
@@ -156,50 +156,50 @@ function pr(m) {
156
156
  }
157
157
  return !0;
158
158
  }
159
- async function ri(m) {
159
+ async function ii(m) {
160
160
  const { context: o, dialecteConfig: c, ref: i, filter: d } = m;
161
- return d ? ii({
161
+ return d ? si({
162
162
  context: o,
163
163
  ref: i,
164
164
  filter: d
165
- }) : ai({
165
+ }) : oi({
166
166
  context: o,
167
167
  dialecteConfig: c,
168
168
  ref: i
169
169
  });
170
170
  }
171
- async function ai(m) {
172
- const { context: o, dialecteConfig: c, ref: i } = m, d = await da({ context: o, ref: i });
171
+ async function oi(m) {
172
+ const { context: o, dialecteConfig: c, ref: i } = m, d = await ha({ context: o, ref: i });
173
173
  if (!d) return {};
174
- const h = oi(d), y = [i.tagName, ...c.descendants[i.tagName]], w = {};
174
+ const h = ui(d), y = [i.tagName, ...c.descendants[i.tagName]], w = {};
175
175
  for (const R of y)
176
176
  w[R] = [];
177
177
  for (const R of h)
178
178
  w[R.tagName] && w[R.tagName].push(R);
179
179
  return w;
180
180
  }
181
- async function ii(m) {
182
- const { context: o, ref: c, filter: i } = m, d = la(i), h = new Set(fa(i)), y = d[d.length - 1], w = y.attributes ? await Nn({
181
+ async function si(m) {
182
+ const { context: o, ref: c, filter: i } = m, d = fa(i), h = new Set(da(i)), y = d[d.length - 1], w = y.attributes ? await Nn({
183
183
  context: o,
184
184
  tagName: y.tagName,
185
185
  attributes: y.attributes
186
- }) : await li({
186
+ }) : await di({
187
187
  context: o,
188
188
  tagName: y.tagName
189
189
  }), R = /* @__PURE__ */ new Map();
190
- for (const j of w) {
191
- const X = await si({
190
+ for (const B of w) {
191
+ const X = await ci({
192
192
  context: o,
193
- record: j,
193
+ record: B,
194
194
  targetRef: c
195
195
  });
196
- if (X.length !== 0 && ui({ ancestry: X, conditions: d }))
196
+ if (X.length !== 0 && li({ ancestry: X, conditions: d }))
197
197
  for (const W of X)
198
198
  h.has(W.tagName) && (R.has(W.tagName) || R.set(W.tagName, /* @__PURE__ */ new Map()), R.get(W.tagName).set(W.id, W));
199
199
  }
200
- return ci({ collected: R, collectTags: h });
200
+ return fi({ collected: R, collectTags: h });
201
201
  }
202
- function oi(m) {
202
+ function ui(m) {
203
203
  const o = [];
204
204
  function c(i) {
205
205
  if (i.tree?.length)
@@ -208,7 +208,7 @@ function oi(m) {
208
208
  }
209
209
  return c(m), o;
210
210
  }
211
- function la(m) {
211
+ function fa(m) {
212
212
  const o = [
213
213
  {
214
214
  tagName: m.tagName,
@@ -217,14 +217,14 @@ function la(m) {
217
217
  }
218
218
  ];
219
219
  return m.descendant && o.push(
220
- ...la(m.descendant)
220
+ ...fa(m.descendant)
221
221
  ), o;
222
222
  }
223
- function fa(m) {
223
+ function da(m) {
224
224
  const o = [m.tagName];
225
- return m.descendant && o.push(...fa(m.descendant)), o;
225
+ return m.descendant && o.push(...da(m.descendant)), o;
226
226
  }
227
- async function si(m) {
227
+ async function ci(m) {
228
228
  const { context: o, record: c, targetRef: i } = m, d = [];
229
229
  let h = c;
230
230
  for (; h && h.id !== i.id; ) {
@@ -238,14 +238,14 @@ async function si(m) {
238
238
  }
239
239
  return !h || h.id !== i.id ? [] : (d.push(h), d);
240
240
  }
241
- function ui(m) {
241
+ function li(m) {
242
242
  const { ancestry: o, conditions: c } = m;
243
243
  return c.every((i) => o.some((h) => h.tagName !== i.tagName ? !1 : i.attributes ? pr({
244
244
  record: h,
245
245
  attributeFilter: i.attributes
246
246
  }) : !0) || i.optional === !0);
247
247
  }
248
- function ci(m) {
248
+ function fi(m) {
249
249
  const { collected: o, collectTags: c } = m, i = {};
250
250
  for (const d of c)
251
251
  i[d] = [];
@@ -253,7 +253,7 @@ function ci(m) {
253
253
  c.has(d) && (i[d] = Array.from(h.values()));
254
254
  return i;
255
255
  }
256
- async function li(m) {
256
+ async function di(m) {
257
257
  const { context: o, tagName: c } = m;
258
258
  return Nn({
259
259
  context: o,
@@ -261,66 +261,66 @@ async function li(m) {
261
261
  attributes: {}
262
262
  });
263
263
  }
264
- async function fi(m) {
264
+ async function hi(m) {
265
265
  const { context: o, ref: c, name: i } = m;
266
266
  return ((await Ee({ context: o, ref: c }))?.attributes ?? []).find((w) => w.name === i)?.value ?? "";
267
267
  }
268
- async function di(m) {
268
+ async function pi(m) {
269
269
  const { context: o, ref: c, name: i } = m;
270
270
  return ((await Ee({ context: o, ref: c }))?.attributes ?? []).find((w) => w.name === i);
271
271
  }
272
- async function hi(m) {
272
+ async function mi(m) {
273
273
  const { context: o, ref: c } = m;
274
274
  return ((await Ee({ context: o, ref: c }))?.attributes ?? []).reduce(
275
275
  (h, y) => (h[y.name] = y.value ?? "", h),
276
276
  {}
277
277
  );
278
278
  }
279
- async function pi(m) {
279
+ async function gi(m) {
280
280
  const { context: o, ref: c } = m;
281
281
  return (await Ee({ context: o, ref: c }))?.attributes ?? [];
282
282
  }
283
- async function da(m) {
283
+ async function ha(m) {
284
284
  const { context: o, ref: c, options: i = {} } = m, { include: d, exclude: h, unwrap: y } = i, w = await Ee({ context: o, ref: c });
285
285
  Ue(w, {
286
286
  detail: "No record found for provided ref",
287
287
  key: "ELEMENT_NOT_FOUND"
288
288
  });
289
- const R = await ha({
289
+ const R = await pa({
290
290
  context: o,
291
291
  record: w,
292
292
  includeFilters: d ? [d] : void 0,
293
293
  exclude: h
294
294
  });
295
- return R ? y ? bi({ tree: R, unwrapTagNames: y }) : R : fr({ record: w });
295
+ return R ? y ? _i({ tree: R, unwrapTagNames: y }) : R : fr({ record: w });
296
296
  }
297
- async function ha(m) {
297
+ async function pa(m) {
298
298
  const { context: o, record: c, includeFilters: i, exclude: d } = m;
299
- if (mi({ record: c, excludeFilters: d }))
299
+ if (yi({ record: c, excludeFilters: d }))
300
300
  return fr({ record: c });
301
- const h = await yi({
301
+ const h = await bi({
302
302
  context: o,
303
303
  record: c,
304
304
  currentIncludeFilters: i,
305
305
  excludeFilters: d
306
306
  }), w = (await Promise.all(
307
307
  h.map(
308
- ({ record: R, includeFilters: j }) => ha({ context: o, record: R, includeFilters: j, exclude: d })
308
+ ({ record: R, includeFilters: B }) => pa({ context: o, record: R, includeFilters: B, exclude: d })
309
309
  )
310
310
  )).filter(
311
311
  (R) => R !== null
312
312
  );
313
313
  return fr({ record: c, tree: w });
314
314
  }
315
- function mi(m) {
315
+ function yi(m) {
316
316
  const { record: o, excludeFilters: c } = m;
317
317
  return c ? c.some((i) => (i.scope ?? "self") !== "children" ? !1 : mr({ record: o, filter: i })) : !1;
318
318
  }
319
- function gi(m) {
319
+ function vi(m) {
320
320
  const { record: o, excludeFilters: c } = m;
321
321
  return c ? c.some((i) => (i.scope ?? "self") !== "self" ? !1 : mr({ record: o, filter: i })) : !1;
322
322
  }
323
- async function yi(m) {
323
+ async function bi(m) {
324
324
  const { context: o, record: c, currentIncludeFilters: i, excludeFilters: d } = m;
325
325
  if (!c.children?.length) return [];
326
326
  const w = (await Promise.all(
@@ -333,11 +333,11 @@ async function yi(m) {
333
333
  )).filter(
334
334
  (R) => R !== void 0
335
335
  ).filter(
336
- (R) => !gi({ record: R, excludeFilters: d })
336
+ (R) => !vi({ record: R, excludeFilters: d })
337
337
  );
338
- return vi({ children: w, currentIncludeFilters: i });
338
+ return wi({ children: w, currentIncludeFilters: i });
339
339
  }
340
- function vi(m) {
340
+ function wi(m) {
341
341
  const { children: o, currentIncludeFilters: c } = m;
342
342
  if (!c)
343
343
  return o.map((d) => ({ record: d, includeFilters: void 0 }));
@@ -360,14 +360,14 @@ function mr(m) {
360
360
  attributeFilter: c.attributes
361
361
  }) : !0;
362
362
  }
363
- function bi(m) {
363
+ function _i(m) {
364
364
  const { tree: o, unwrapTagNames: c } = m;
365
365
  function i(d) {
366
366
  return d.flatMap((h) => c.includes(h.tagName) ? i(h.tree) : [{ ...h, tree: i(h.tree) }]);
367
367
  }
368
368
  return { ...o, tree: i(o.tree) };
369
369
  }
370
- class pa {
370
+ class ma {
371
371
  constructor(o, c) {
372
372
  this.store = o, this.dialecteConfig = c;
373
373
  }
@@ -439,7 +439,7 @@ class pa {
439
439
  */
440
440
  async getRecords(o) {
441
441
  const c = o.map((i) => _e(i));
442
- return ua({ context: this.context, refs: c });
442
+ return ca({ context: this.context, refs: c });
443
443
  }
444
444
  /**
445
445
  * Get the first direct child of an element matching a given tag name.
@@ -455,7 +455,7 @@ class pa {
455
455
  */
456
456
  async getChild(o, c) {
457
457
  if (o)
458
- return ei({ context: this.context, ref: _e(o), tagName: c });
458
+ return ni({ context: this.context, ref: _e(o), tagName: c });
459
459
  }
460
460
  /**
461
461
  * Get all direct children of an element matching a given tag name.
@@ -470,7 +470,7 @@ class pa {
470
470
  * ```
471
471
  */
472
472
  async getChildren(o, c) {
473
- return o ? ti({ context: this.context, ref: _e(o), tagName: c }) : [];
473
+ return o ? ri({ context: this.context, ref: _e(o), tagName: c }) : [];
474
474
  }
475
475
  /**
476
476
  * Get all records of a given tag name.
@@ -484,7 +484,7 @@ class pa {
484
484
  * ```
485
485
  */
486
486
  async getRecordsByTagName(o) {
487
- return ca({ context: this.context, tagName: o });
487
+ return la({ context: this.context, tagName: o });
488
488
  }
489
489
  /**
490
490
  * Find all descendants of an element, grouped by tag name.
@@ -499,7 +499,7 @@ class pa {
499
499
  * ```
500
500
  */
501
501
  async findDescendants(o, c) {
502
- return ri({
502
+ return ii({
503
503
  context: this.context,
504
504
  dialecteConfig: this.dialecteConfig,
505
505
  ref: _e(o),
@@ -520,7 +520,7 @@ class pa {
520
520
  * ```
521
521
  */
522
522
  async findAncestors(o, c) {
523
- return o ? ni({ context: this.context, ref: _e(o), options: c }) : [];
523
+ return o ? ai({ context: this.context, ref: _e(o), options: c }) : [];
524
524
  }
525
525
  /**
526
526
  * Build a full tree structure from an element down.
@@ -535,15 +535,15 @@ class pa {
535
535
  * ```
536
536
  */
537
537
  async getTree(o, c) {
538
- return da({ context: this.context, ref: _e(o), options: c });
538
+ return ha({ context: this.context, ref: _e(o), options: c });
539
539
  }
540
540
  async getAttribute(o, c) {
541
541
  const i = _e(o), { fullObject: d } = c;
542
- return d ? di({ context: this.context, ref: i, ...c }) : fi({ context: this.context, ref: i, ...c });
542
+ return d ? pi({ context: this.context, ref: i, ...c }) : hi({ context: this.context, ref: i, ...c });
543
543
  }
544
544
  async getAttributes(o, c) {
545
545
  const i = _e(o), { fullObject: d } = c || {};
546
- return d ? pi({ context: this.context, ref: i, ...c }) : hi({ context: this.context, ref: i, ...c });
546
+ return d ? gi({ context: this.context, ref: i, ...c }) : mi({ context: this.context, ref: i, ...c });
547
547
  }
548
548
  //== Find queries
549
549
  /**
@@ -578,7 +578,7 @@ function ze(m) {
578
578
  key: "ELEMENT_NOT_FOUND"
579
579
  }), o.stagedOperations.push({ status: c, oldRecord: y, newRecord: void 0 }));
580
580
  }
581
- function wi(m) {
581
+ function gr(m) {
582
582
  const { context: o, operations: c } = m;
583
583
  for (const i of c)
584
584
  switch (i.status) {
@@ -598,21 +598,21 @@ function wi(m) {
598
598
  break;
599
599
  }
600
600
  }
601
- async function gr(m) {
602
- const { dialecteConfig: o, context: c, parentRef: i, params: d } = m, { id: h, tagName: y, attributes: w, namespace: R, value: j } = d, X = await Ee({ context: c, ref: i });
601
+ async function yr(m) {
602
+ const { dialecteConfig: o, context: c, parentRef: i, params: d } = m, { id: h, tagName: y, attributes: w, namespace: R, value: B } = d, X = await Ee({ context: c, ref: i });
603
603
  Ue(X, {
604
604
  detail: "Parent record not found",
605
605
  key: "ELEMENT_NOT_FOUND",
606
606
  ref: i
607
607
  });
608
- const W = Qa({
608
+ const W = Ha({
609
609
  dialecteConfig: o,
610
610
  record: {
611
611
  id: h ?? crypto.randomUUID(),
612
612
  tagName: y,
613
613
  attributes: w,
614
614
  namespace: R,
615
- value: j,
615
+ value: B,
616
616
  parent: { id: X.id, tagName: X.tagName },
617
617
  children: []
618
618
  }
@@ -637,32 +637,36 @@ async function gr(m) {
637
637
  parentRecord: J,
638
638
  context: c
639
639
  });
640
- wi({ context: c, operations: fe });
640
+ gr({ context: c, operations: fe });
641
641
  }
642
642
  return W;
643
643
  }
644
- async function _i(m) {
645
- const { dialecteConfig: o, context: c, parentRef: i, record: d } = m, h = [];
644
+ async function Ei(m) {
645
+ const { dialecteConfig: o, context: c, parentRef: i, record: d } = m, h = [], y = await ga({
646
+ dialecteConfig: o,
647
+ context: c,
648
+ parentRef: i,
649
+ record: d,
650
+ mappings: h
651
+ });
652
+ if (o.hooks?.afterDeepClone) {
653
+ const w = await o.hooks.afterDeepClone({ mappings: h, context: c });
654
+ c.stagedOperations.push(...w);
655
+ }
646
656
  return {
647
- record: await ma({
648
- dialecteConfig: o,
649
- context: c,
650
- parentRef: i,
651
- record: d,
652
- mappings: h
653
- }),
657
+ record: y,
654
658
  mappings: h
655
659
  };
656
660
  }
657
- async function ma(m) {
661
+ async function ga(m) {
658
662
  const { dialecteConfig: o, context: c, parentRef: i, record: d, mappings: h } = m;
659
663
  let y = !0, w = d;
660
664
  if (o.hooks?.beforeClone) {
661
- const j = o.hooks.beforeClone({ record: d });
662
- y = j.shouldBeCloned, w = j.transformedRecord;
665
+ const B = o.hooks.beforeClone({ record: d });
666
+ y = B.shouldBeCloned, w = B.transformedRecord;
663
667
  }
664
668
  if (!y) return w;
665
- const R = await gr({
669
+ const R = await yr({
666
670
  dialecteConfig: o,
667
671
  context: c,
668
672
  parentRef: i,
@@ -677,17 +681,17 @@ async function ma(m) {
677
681
  source: _e(d),
678
682
  target: _e(R)
679
683
  });
680
- for (const j of w.tree)
681
- await ma({
684
+ for (const B of w.tree)
685
+ await ga({
682
686
  dialecteConfig: o,
683
687
  context: c,
684
688
  parentRef: _e(R),
685
- record: j,
689
+ record: B,
686
690
  mappings: h
687
691
  });
688
692
  return R;
689
693
  }
690
- function Ei(m) {
694
+ function Ti(m) {
691
695
  const o = /* @__PURE__ */ new Map();
692
696
  for (const i of m) {
693
697
  const d = (i.status === "deleted" ? i.oldRecord : i.newRecord).id, h = o.get(d);
@@ -716,16 +720,16 @@ function Ei(m) {
716
720
  deletes: c.filter((i) => i.status === "deleted")
717
721
  };
718
722
  }
719
- async function Ti(m) {
720
- const { stagedOperations: o, store: c, documentState: i } = m, { creates: d, updates: h, deletes: y } = Ei(o), w = d.length + h.length + y.length;
723
+ async function xi(m) {
724
+ const { stagedOperations: o, store: c, documentState: i } = m, { creates: d, updates: h, deletes: y } = Ti(o), w = d.length + h.length + y.length;
721
725
  i.loading = !0, i.progress = { message: "Committing changes...", current: 0, total: w };
722
726
  try {
723
727
  await c.commit({
724
728
  creates: d.map((R) => R.newRecord),
725
729
  updates: h.map((R) => R.newRecord),
726
730
  deletes: y.map((R) => R.oldRecord.id),
727
- onProgress: (R, j) => {
728
- i.progress = { message: "Committing changes...", current: R, total: j };
731
+ onProgress: (R, B) => {
732
+ i.progress = { message: "Committing changes...", current: R, total: B };
729
733
  }
730
734
  });
731
735
  } catch (R) {
@@ -733,35 +737,39 @@ async function Ti(m) {
733
737
  }
734
738
  i.lastUpdate = Date.now();
735
739
  }
736
- async function xi(m) {
737
- const { context: o, ref: c } = m, i = await Ee({ context: o, ref: c });
738
- Ue(i, {
739
- detail: `Record not found (tagName=${c.tagName}, id=${c.id})`,
740
+ async function Ni(m) {
741
+ const { dialecteConfig: o, context: c, ref: i } = m, d = await Ee({ context: c, ref: i });
742
+ if (Ue(d, {
743
+ detail: `Record not found (tagName=${i.tagName}, id=${i.id})`,
740
744
  key: "ELEMENT_NOT_FOUND",
741
- ref: c
742
- }), Ue(i.parent, {
745
+ ref: i
746
+ }), Ue(d.parent, {
743
747
  detail: "Cannot delete root element",
744
748
  key: "PROTECTED_ROOT"
745
- }), await ga({ context: o, record: i }), ze({ context: o, status: "deleted", record: i });
746
- const d = _e(i.parent), h = await Ee({ context: o, ref: d });
747
- Ue(h, {
748
- detail: `Parent record not found (tagName=${i.parent.tagName}, id=${i.parent.id})`,
749
+ }), o.hooks?.beforeDelete) {
750
+ const R = await o.hooks.beforeDelete({ record: d, context: c });
751
+ gr({ context: c, operations: R });
752
+ }
753
+ await ya({ context: c, record: d }), ze({ context: c, status: "deleted", record: d });
754
+ const h = _e(d.parent), y = await Ee({ context: c, ref: h });
755
+ Ue(y, {
756
+ detail: `Parent record not found (tagName=${d.parent.tagName}, id=${d.parent.id})`,
749
757
  key: "ELEMENT_NOT_FOUND"
750
758
  });
751
- const y = {
752
- ...h,
753
- children: h.children.filter((w) => w.id !== i.id)
759
+ const w = {
760
+ ...y,
761
+ children: y.children.filter((R) => R.id !== d.id)
754
762
  };
755
- return ze({ context: o, status: "updated", oldRecord: h, newRecord: y }), y;
763
+ return ze({ context: c, status: "updated", oldRecord: y, newRecord: w }), w;
756
764
  }
757
- async function ga(m) {
765
+ async function ya(m) {
758
766
  const { context: o, record: c } = m;
759
767
  for (const i of c.children) {
760
768
  const d = _e(i), h = await Ee({ context: o, ref: d });
761
- h && (h.children.length > 0 && await ga({ context: o, record: h }), ze({ context: o, status: "deleted", record: h }));
769
+ h && (h.children.length > 0 && await ya({ context: o, record: h }), ze({ context: o, status: "deleted", record: h }));
762
770
  }
763
771
  }
764
- async function Ni(m) {
772
+ async function Oi(m) {
765
773
  const { dialecteConfig: o, context: c, parentRef: i, params: d } = m, h = Ai(d.attributes);
766
774
  if (h) {
767
775
  const [y] = await Nn({
@@ -774,7 +782,7 @@ async function Ni(m) {
774
782
  const y = { tagName: d.tagName, id: d.id }, w = await Ee({ context: c, ref: y });
775
783
  if (w) return w;
776
784
  }
777
- return gr({
785
+ return yr({
778
786
  dialecteConfig: o,
779
787
  context: c,
780
788
  parentRef: i,
@@ -785,7 +793,7 @@ function Ai(m) {
785
793
  const o = Array.isArray(m) ? Object.fromEntries(m.map((i) => [i.name, i.value])) : m;
786
794
  return Object.values(o).some((i) => i !== void 0 && i !== "") ? o : void 0;
787
795
  }
788
- async function Oi(m) {
796
+ async function Ci(m) {
789
797
  const { dialecteConfig: o, context: c, ref: i, params: d } = m, { attributes: h, value: y } = d, w = await Ee({ context: c, ref: i });
790
798
  Ue(w, {
791
799
  detail: `Record not found (tagName=${i.tagName}, id=${i.id})`,
@@ -794,7 +802,7 @@ async function Oi(m) {
794
802
  });
795
803
  let R = w.attributes;
796
804
  if (h) {
797
- const X = Ha({
805
+ const X = Za({
798
806
  dialecteConfig: o,
799
807
  tagName: w.tagName,
800
808
  attributes: h
@@ -805,14 +813,22 @@ async function Oi(m) {
805
813
  (J) => J.value !== void 0 && J.value !== null
806
814
  );
807
815
  }
808
- const j = {
816
+ const B = {
809
817
  ...w,
810
818
  attributes: R,
811
819
  value: y !== void 0 ? y : w.value
812
820
  };
813
- return ze({ context: c, status: "updated", oldRecord: w, newRecord: j }), j;
821
+ if (ze({ context: c, status: "updated", oldRecord: w, newRecord: B }), o.hooks?.afterUpdated) {
822
+ const X = await o.hooks.afterUpdated({
823
+ oldRecord: w,
824
+ newRecord: B,
825
+ context: c
826
+ });
827
+ gr({ context: c, operations: X });
828
+ }
829
+ return B;
814
830
  }
815
- class Ci extends pa {
831
+ class Di extends ma {
816
832
  constructor(o, c, i) {
817
833
  super(o, c), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.documentState = i;
818
834
  }
@@ -852,7 +868,7 @@ class Ci extends pa {
852
868
  * ```
853
869
  */
854
870
  async addChild(o, c) {
855
- return gr({
871
+ return yr({
856
872
  context: this.context,
857
873
  parentRef: _e(o),
858
874
  params: c,
@@ -881,7 +897,7 @@ class Ci extends pa {
881
897
  * If A already exists under root, returns its ref. Otherwise, creates it and returns the new ref.
882
898
  */
883
899
  async ensureChild(o, c) {
884
- return Ni({
900
+ return Oi({
885
901
  context: this.context,
886
902
  parentRef: _e(o),
887
903
  params: c,
@@ -903,7 +919,7 @@ class Ci extends pa {
903
919
  * ```
904
920
  */
905
921
  async update(o, c) {
906
- return Oi({
922
+ return Ci({
907
923
  context: this.context,
908
924
  ref: _e(o),
909
925
  params: c,
@@ -922,7 +938,11 @@ class Ci extends pa {
922
938
  * ```
923
939
  */
924
940
  async delete(o) {
925
- return xi({ context: this.context, ref: _e(o) });
941
+ return Ni({
942
+ context: this.context,
943
+ ref: _e(o),
944
+ dialecteConfig: this.dialecteConfig
945
+ });
926
946
  }
927
947
  /**
928
948
  * Deep-clone a subtree under a new parent.
@@ -938,7 +958,7 @@ class Ci extends pa {
938
958
  * ```
939
959
  */
940
960
  async deepClone(o, c) {
941
- return _i({
961
+ return Ei({
942
962
  dialecteConfig: this.dialecteConfig,
943
963
  context: this.context,
944
964
  parentRef: _e(o),
@@ -966,7 +986,7 @@ class Ci extends pa {
966
986
  * Merges operations by ID to optimize database writes.
967
987
  */
968
988
  async commit() {
969
- await Ti({
989
+ await xi({
970
990
  stagedOperations: this.stagedOperations,
971
991
  store: this.store,
972
992
  documentState: this.documentState
@@ -976,7 +996,7 @@ class Ci extends pa {
976
996
  function Xt(m) {
977
997
  return m.recordCache !== void 0;
978
998
  }
979
- class Qr {
999
+ class Hr {
980
1000
  constructor(o, c, i) {
981
1001
  this.state = {
982
1002
  loading: !1,
@@ -1001,7 +1021,7 @@ class Qr {
1001
1021
  * Override in dialecte subclass to return a domain-specific Query.
1002
1022
  */
1003
1023
  createQuery() {
1004
- return new pa(this.store, this.config);
1024
+ return new ma(this.store, this.config);
1005
1025
  }
1006
1026
  get query() {
1007
1027
  return this.withQueryExtensions(this.createQuery());
@@ -1012,7 +1032,7 @@ class Qr {
1012
1032
  * e.g. SclDocument overrides this to return new SclTransaction(...)
1013
1033
  */
1014
1034
  createTransaction() {
1015
- return new Ci(this.store, this.config, this.state);
1035
+ return new Di(this.store, this.config, this.state);
1016
1036
  }
1017
1037
  async transaction(o, c) {
1018
1038
  this.activeTransactions > 0 && je("CONCURRENT_TRANSACTION", {
@@ -1137,10 +1157,10 @@ class Qr {
1137
1157
  }
1138
1158
  }
1139
1159
  var Ii = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1140
- function ya(m) {
1160
+ function va(m) {
1141
1161
  return m && m.__esModule && Object.prototype.hasOwnProperty.call(m, "default") ? m.default : m;
1142
1162
  }
1143
- function Di(m) {
1163
+ function Ri(m) {
1144
1164
  if (Object.prototype.hasOwnProperty.call(m, "__esModule")) return m;
1145
1165
  var o = m.default;
1146
1166
  if (typeof o == "function") {
@@ -1164,12 +1184,12 @@ function Di(m) {
1164
1184
  });
1165
1185
  }), c;
1166
1186
  }
1167
- var xn = { exports: {} }, Ri = xn.exports, Hr;
1168
- function Si() {
1169
- return Hr || (Hr = 1, (function(m, o) {
1187
+ var xn = { exports: {} }, Si = xn.exports, Zr;
1188
+ function ki() {
1189
+ return Zr || (Zr = 1, (function(m, o) {
1170
1190
  (function(c, i) {
1171
1191
  m.exports = i();
1172
- })(Ri, function() {
1192
+ })(Si, function() {
1173
1193
  var c = function(e, t) {
1174
1194
  return (c = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
1175
1195
  n.__proto__ = r;
@@ -1193,22 +1213,22 @@ function Si() {
1193
1213
  }), e;
1194
1214
  }
1195
1215
  typeof Promise > "u" || h.Promise || (h.Promise = Promise);
1196
- var j = Object.getPrototypeOf, X = {}.hasOwnProperty;
1216
+ var B = Object.getPrototypeOf, X = {}.hasOwnProperty;
1197
1217
  function W(e, t) {
1198
1218
  return X.call(e, t);
1199
1219
  }
1200
1220
  function J(e, t) {
1201
- typeof t == "function" && (t = t(j(e))), (typeof Reflect > "u" ? y : Reflect.ownKeys)(t).forEach(function(n) {
1202
- B(e, n, t[n]);
1221
+ typeof t == "function" && (t = t(B(e))), (typeof Reflect > "u" ? y : Reflect.ownKeys)(t).forEach(function(n) {
1222
+ j(e, n, t[n]);
1203
1223
  });
1204
1224
  }
1205
1225
  var fe = Object.defineProperty;
1206
- function B(e, t, n, r) {
1226
+ function j(e, t, n, r) {
1207
1227
  fe(e, t, R(n && W(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
1208
1228
  }
1209
1229
  function F(e) {
1210
1230
  return { from: function(t) {
1211
- return e.prototype = Object.create(t.prototype), B(e.prototype, "constructor", e), { extend: J.bind(null, e.prototype) };
1231
+ return e.prototype = Object.create(t.prototype), j(e.prototype, "constructor", e), { extend: J.bind(null, e.prototype) };
1212
1232
  } };
1213
1233
  }
1214
1234
  var se = Object.getOwnPropertyDescriptor, ce = [].slice;
@@ -1254,11 +1274,11 @@ function Si() {
1254
1274
  for (t in e) W(e, t) && (n[t] = e[t]);
1255
1275
  return n;
1256
1276
  }
1257
- var D = [].concat;
1258
- function It(e) {
1259
- return D.apply([], e);
1277
+ var I = [].concat;
1278
+ function Dt(e) {
1279
+ return I.apply([], e);
1260
1280
  }
1261
- 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) {
1281
+ 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) {
1262
1282
  return ["Int", "Uint", "Float"].map(function(t) {
1263
1283
  return t + e + "Array";
1264
1284
  });
@@ -1277,7 +1297,7 @@ function Si() {
1277
1297
  for (var a = 0, u = n.length; a < u; ++a) r.push(t(n[a]));
1278
1298
  } else if (He.has(n.constructor)) r = n;
1279
1299
  else {
1280
- var f, p = j(n);
1300
+ var f, p = B(n);
1281
1301
  for (f in r = p === Object.prototype ? {} : Object.create(p), de.set(n, r), n) W(n, f) && (r[f] = t(n[f]));
1282
1302
  }
1283
1303
  return r;
@@ -1318,7 +1338,7 @@ function Si() {
1318
1338
  return e[Symbol.toStringTag] === "AsyncFunction";
1319
1339
  } : function() {
1320
1340
  return !1;
1321
- }, Pt = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], Me = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(Pt), 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" };
1341
+ }, Pt = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], Me = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(Pt), 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" };
1322
1342
  function Ze(e, t) {
1323
1343
  this.name = e, this.message = t;
1324
1344
  }
@@ -1347,7 +1367,7 @@ function Si() {
1347
1367
  var n = t + "Error";
1348
1368
  function r(a, u) {
1349
1369
  this.name = n, a ? typeof a == "string" ? (this.message = "".concat(a).concat(u ? `
1350
- ` + u : ""), this.inner = u || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = Dt[t] || n, this.inner = null);
1370
+ ` + u : ""), this.inner = u || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = It[t] || n, this.inner = null);
1351
1371
  }
1352
1372
  return F(r).from(s), e[t] = r, e;
1353
1373
  }, {});
@@ -1362,7 +1382,7 @@ function Si() {
1362
1382
  function he(e) {
1363
1383
  return e;
1364
1384
  }
1365
- function Oe(e, t) {
1385
+ function Ae(e, t) {
1366
1386
  return e == null || e === he ? t : function(n) {
1367
1387
  return t(e(n));
1368
1388
  };
@@ -1397,7 +1417,7 @@ function Si() {
1397
1417
  return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), a && (this.onsuccess = this.onsuccess ? ye(a, this.onsuccess) : a), u && (this.onerror = this.onerror ? ye(u, this.onerror) : u), r === void 0 ? n === void 0 ? void 0 : n : R(r, n);
1398
1418
  };
1399
1419
  }
1400
- function An(e, t) {
1420
+ function On(e, t) {
1401
1421
  return e === Q ? t : function() {
1402
1422
  return t.apply(this, arguments) !== !1 && e.apply(this, arguments);
1403
1423
  };
@@ -1419,14 +1439,14 @@ function Si() {
1419
1439
  function St(e) {
1420
1440
  ke = e;
1421
1441
  }
1422
- var kt = {}, yr = 100, ct = typeof Promise > "u" ? [] : (function() {
1442
+ var kt = {}, vr = 100, ct = typeof Promise > "u" ? [] : (function() {
1423
1443
  var e = Promise.resolve();
1424
- if (typeof crypto > "u" || !crypto.subtle) return [e, j(e), e];
1444
+ if (typeof crypto > "u" || !crypto.subtle) return [e, B(e), e];
1425
1445
  var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
1426
- return [t, j(t), e];
1427
- })(), Pt = ct[0], Me = ct[1], ct = ct[2], Me = Me && Me.then, lt = Pt && Pt.constructor, On = !!ct, Ft = function(e, t) {
1446
+ return [t, B(t), e];
1447
+ })(), Pt = ct[0], Me = ct[1], ct = ct[2], Me = Me && Me.then, lt = Pt && Pt.constructor, An = !!ct, Ft = function(e, t) {
1428
1448
  Bt.push([e, t]), Qt && (queueMicrotask(Aa), Qt = !1);
1429
- }, Cn = !0, Qt = !0, ft = [], Ht = [], In = he, nt = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: Q, pgp: !1, env: {}, finalize: Q }, z = nt, Bt = [], dt = 0, Zt = [];
1449
+ }, Cn = !0, Qt = !0, ft = [], Ht = [], Dn = he, nt = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: Q, pgp: !1, env: {}, finalize: Q }, z = nt, Bt = [], dt = 0, Zt = [];
1430
1450
  function G(e) {
1431
1451
  if (typeof this != "object") throw new TypeError("Promises must be constructed via new");
1432
1452
  this._listeners = [], this._lib = !1;
@@ -1443,7 +1463,7 @@ function Si() {
1443
1463
  var f = r._lib && _t();
1444
1464
  u && typeof u.then == "function" ? n(r, function(p, v) {
1445
1465
  u instanceof G ? u._then(p, v) : u.then(p, v);
1446
- }) : (r._state = !0, r._value = u, br(r)), f && Et();
1466
+ }) : (r._state = !0, r._value = u, wr(r)), f && Et();
1447
1467
  }
1448
1468
  }, Rn.bind(null, r));
1449
1469
  } catch (u) {
@@ -1451,30 +1471,30 @@ function Si() {
1451
1471
  }
1452
1472
  })(this, e);
1453
1473
  }
1454
- var Dn = { get: function() {
1474
+ var In = { get: function() {
1455
1475
  var e = z, t = nn;
1456
1476
  function n(r, a) {
1457
1477
  var u = this, f = !e.global && (e !== z || t !== nn), p = f && !at(), v = new G(function(_, T) {
1458
- Sn(u, new vr(_r(r, e, f, p), _r(a, e, f, p), _, T, e));
1478
+ Sn(u, new br(Er(r, e, f, p), Er(a, e, f, p), _, T, e));
1459
1479
  });
1460
1480
  return this._consoleTask && (v._consoleTask = this._consoleTask), v;
1461
1481
  }
1462
1482
  return n.prototype = kt, n;
1463
1483
  }, set: function(e) {
1464
- B(this, "then", e && e.prototype === kt ? Dn : { get: function() {
1484
+ j(this, "then", e && e.prototype === kt ? In : { get: function() {
1465
1485
  return e;
1466
- }, set: Dn.set });
1486
+ }, set: In.set });
1467
1487
  } };
1468
- function vr(e, t, n, r, a) {
1488
+ function br(e, t, n, r, a) {
1469
1489
  this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = a;
1470
1490
  }
1471
1491
  function Rn(e, t) {
1472
1492
  var n, r;
1473
- Ht.push(t), e._state === null && (n = e._lib && _t(), t = In(t), e._state = !1, e._value = t, r = e, ft.some(function(a) {
1493
+ Ht.push(t), e._state === null && (n = e._lib && _t(), t = Dn(t), e._state = !1, e._value = t, r = e, ft.some(function(a) {
1474
1494
  return a._value === r._value;
1475
- }) || ft.push(r), br(e), n && Et());
1495
+ }) || ft.push(r), wr(e), n && Et());
1476
1496
  }
1477
- function br(e) {
1497
+ function wr(e) {
1478
1498
  var t = e._listeners;
1479
1499
  e._listeners = [];
1480
1500
  for (var n = 0, r = t.length; n < r; ++n) Sn(e, t[n]);
@@ -1487,10 +1507,10 @@ function Si() {
1487
1507
  if (e._state !== null) {
1488
1508
  var n = e._state ? t.onFulfilled : t.onRejected;
1489
1509
  if (n === null) return (e._state ? t.resolve : t.reject)(e._value);
1490
- ++t.psd.ref, ++dt, Ft(Na, [n, e, t]);
1510
+ ++t.psd.ref, ++dt, Ft(Oa, [n, e, t]);
1491
1511
  } else e._listeners.push(t);
1492
1512
  }
1493
- function Na(e, t, n) {
1513
+ function Oa(e, t, n) {
1494
1514
  try {
1495
1515
  var r, a = t._value;
1496
1516
  !t._state && Ht.length && (Ht = []), r = ke && t._consoleTask ? t._consoleTask.run(function() {
@@ -1546,8 +1566,8 @@ function Si() {
1546
1566
  }
1547
1567
  };
1548
1568
  }
1549
- J(G.prototype, { then: Dn, _then: function(e, t) {
1550
- Sn(this, new vr(null, null, e, t, z));
1569
+ J(G.prototype, { then: In, _then: function(e, t) {
1570
+ Sn(this, new br(null, null, e, t, z));
1551
1571
  }, catch: function(e) {
1552
1572
  if (arguments.length === 1) return this.then(null, e);
1553
1573
  var t = e, n = arguments[1];
@@ -1574,7 +1594,7 @@ function Si() {
1574
1594
  }, e);
1575
1595
  n.then(r, a).finally(clearTimeout.bind(null, u));
1576
1596
  }) : this;
1577
- } }), typeof Symbol < "u" && Symbol.toStringTag && B(G.prototype, Symbol.toStringTag, "Dexie.Promise"), nt.env = wr(), J(G, { all: function() {
1597
+ } }), typeof Symbol < "u" && Symbol.toStringTag && j(G.prototype, Symbol.toStringTag, "Dexie.Promise"), nt.env = _r(), J(G, { all: function() {
1578
1598
  var e = Fe.apply(null, arguments).map(rn);
1579
1599
  return new G(function(t, n) {
1580
1600
  e.length === 0 && t([]);
@@ -1607,9 +1627,9 @@ function Si() {
1607
1627
  }, set: function(e) {
1608
1628
  Ft = e;
1609
1629
  } }, rejectionMapper: { get: function() {
1610
- return In;
1630
+ return Dn;
1611
1631
  }, set: function(e) {
1612
- In = e;
1632
+ Dn = e;
1613
1633
  } }, follow: function(e, t) {
1614
1634
  return new G(function(n, r) {
1615
1635
  return rt(function(a, u) {
@@ -1626,7 +1646,7 @@ function Si() {
1626
1646
  }, f.finalize), e();
1627
1647
  }, t, n, r);
1628
1648
  });
1629
- } }), lt && (lt.allSettled && B(G, "allSettled", function() {
1649
+ } }), lt && (lt.allSettled && j(G, "allSettled", function() {
1630
1650
  var e = Fe.apply(null, arguments).map(rn);
1631
1651
  return new G(function(t) {
1632
1652
  e.length === 0 && t([]);
@@ -1641,7 +1661,7 @@ function Si() {
1641
1661
  });
1642
1662
  });
1643
1663
  });
1644
- }), lt.any && typeof AggregateError < "u" && B(G, "any", function() {
1664
+ }), lt.any && typeof AggregateError < "u" && j(G, "any", function() {
1645
1665
  var e = Fe.apply(null, arguments).map(rn);
1646
1666
  return new G(function(t, n) {
1647
1667
  e.length === 0 && n(new AggregateError([]));
@@ -1655,18 +1675,18 @@ function Si() {
1655
1675
  });
1656
1676
  });
1657
1677
  }), lt.withResolvers && (G.withResolvers = lt.withResolvers));
1658
- var Ne = { awaits: 0, echoes: 0, id: 0 }, Oa = 0, en = [], tn = 0, nn = 0, Ca = 0;
1678
+ var Ne = { awaits: 0, echoes: 0, id: 0 }, Ca = 0, en = [], tn = 0, nn = 0, Da = 0;
1659
1679
  function rt(e, t, n, r) {
1660
1680
  var a = z, u = Object.create(a);
1661
- return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Ca, nt.env, u.env = On ? { Promise: G, PromiseProp: { value: G, configurable: !0, writable: !0 }, all: G.all, race: G.race, allSettled: G.allSettled, any: G.any, resolve: G.resolve, reject: G.reject } : {}, t && R(u, t), ++a.ref, u.finalize = function() {
1681
+ return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Da, nt.env, u.env = An ? { Promise: G, PromiseProp: { value: G, configurable: !0, writable: !0 }, all: G.all, race: G.race, allSettled: G.allSettled, any: G.any, resolve: G.resolve, reject: G.reject } : {}, t && R(u, t), ++a.ref, u.finalize = function() {
1662
1682
  --this.parent.ref || this.parent.finalize();
1663
1683
  }, r = ht(u, e, n, r), u.ref === 0 && u.finalize(), r;
1664
1684
  }
1665
1685
  function Tt() {
1666
- return Ne.id || (Ne.id = ++Oa), ++Ne.awaits, Ne.echoes += yr, Ne.id;
1686
+ return Ne.id || (Ne.id = ++Ca), ++Ne.awaits, Ne.echoes += vr, Ne.id;
1667
1687
  }
1668
1688
  function at() {
1669
- return !!Ne.awaits && (--Ne.awaits == 0 && (Ne.id = 0), Ne.echoes = Ne.awaits * yr, !0);
1689
+ return !!Ne.awaits && (--Ne.awaits == 0 && (Ne.id = 0), Ne.echoes = Ne.awaits * vr, !0);
1670
1690
  }
1671
1691
  function rn(e) {
1672
1692
  return Ne.echoes && e && e.constructor === lt ? (Tt(), e.then(function(t) {
@@ -1683,11 +1703,11 @@ function Si() {
1683
1703
  var n, r = z;
1684
1704
  (t ? !Ne.echoes || tn++ && e === z : !tn || --tn && e === z) || queueMicrotask(t ? (function(a) {
1685
1705
  ++nn, Ne.echoes && --Ne.echoes != 0 || (Ne.echoes = Ne.awaits = Ne.id = 0), en.push(z), it(a, !0);
1686
- }).bind(null, e) : Ia), e !== z && (z = e, r === nt && (nt.env = wr()), On && (n = nt.env.Promise, t = e.env, (r.global || e.global) && (Object.defineProperty(h, "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))));
1706
+ }).bind(null, e) : Ia), e !== z && (z = e, r === nt && (nt.env = _r()), An && (n = nt.env.Promise, t = e.env, (r.global || e.global) && (Object.defineProperty(h, "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))));
1687
1707
  }
1688
- function wr() {
1708
+ function _r() {
1689
1709
  var e = h.Promise;
1690
- return On ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(h, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
1710
+ return An ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(h, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
1691
1711
  }
1692
1712
  function ht(e, t, n, r, a) {
1693
1713
  var u = z;
@@ -1697,7 +1717,7 @@ function Si() {
1697
1717
  it(u, !1);
1698
1718
  }
1699
1719
  }
1700
- function _r(e, t, n, r) {
1720
+ function Er(e, t, n, r) {
1701
1721
  return typeof e != "function" ? e : function() {
1702
1722
  var a = z;
1703
1723
  n && Tt(), it(t, !0);
@@ -1712,13 +1732,13 @@ function Si() {
1712
1732
  Promise === lt && Ne.echoes === 0 ? tn === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
1713
1733
  }
1714
1734
  ("" + Me).indexOf("[native code]") === -1 && (Tt = at = Q);
1715
- var be = G.reject, pt = "￿", We = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Er = "String expected.", xt = [], an = "__dbnames", Fn = "readonly", Bn = "readwrite";
1735
+ var be = G.reject, pt = "￿", We = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Tr = "String expected.", xt = [], an = "__dbnames", Fn = "readonly", Bn = "readwrite";
1716
1736
  function mt(e, t) {
1717
1737
  return e ? t ? function() {
1718
1738
  return e.apply(this, arguments) && t.apply(this, arguments);
1719
1739
  } : e : t;
1720
1740
  }
1721
- var Tr = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 };
1741
+ var xr = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 };
1722
1742
  function on(e) {
1723
1743
  return typeof e != "string" || /\./.test(e) ? function(t) {
1724
1744
  return t;
@@ -1726,12 +1746,12 @@ function Si() {
1726
1746
  return t[e] === void 0 && e in t && delete (t = Pe(t))[e], t;
1727
1747
  };
1728
1748
  }
1729
- function xr() {
1749
+ function Nr() {
1730
1750
  throw C.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.");
1731
1751
  }
1732
1752
  function re(e, t) {
1733
1753
  try {
1734
- var n = Nr(e), r = Nr(t);
1754
+ var n = Or(e), r = Or(t);
1735
1755
  if (n !== r) return n === "Array" ? 1 : r === "Array" ? -1 : n === "binary" ? 1 : r === "binary" ? -1 : n === "string" ? 1 : r === "string" ? -1 : n === "Date" ? 1 : r !== "Date" ? NaN : -1;
1736
1756
  switch (n) {
1737
1757
  case "number":
@@ -1756,7 +1776,7 @@ function Si() {
1756
1776
  }
1757
1777
  return NaN;
1758
1778
  }
1759
- function Nr(e) {
1779
+ function Or(e) {
1760
1780
  var t = typeof e;
1761
1781
  return t != "object" ? t : ArrayBuffer.isView(e) ? "binary" : (e = Ke(e), e === "ArrayBuffer" ? "binary" : e);
1762
1782
  }
@@ -1773,7 +1793,7 @@ function Si() {
1773
1793
  return n;
1774
1794
  })) : n;
1775
1795
  }
1776
- var Or = (pe.prototype._trans = function(e, t, n) {
1796
+ var Cr = (pe.prototype._trans = function(e, t, n) {
1777
1797
  var r = this._tx || z.trans, a = this.name, u = ke && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
1778
1798
  function f(_, T, g) {
1779
1799
  if (!g.schema[a]) throw new C.NotFound("Table " + a + " not part of transaction");
@@ -1783,27 +1803,27 @@ function Si() {
1783
1803
  try {
1784
1804
  var v = r && r.db._novip === this.db._novip ? r === z.trans ? r._promise(e, f, n) : rt(function() {
1785
1805
  return r._promise(e, f, n);
1786
- }, { trans: r, transless: z.transless || z }) : (function _(T, g, O, b) {
1806
+ }, { trans: r, transless: z.transless || z }) : (function _(T, g, A, b) {
1787
1807
  if (T.idbdb && (T._state.openComplete || z.letThrough || T._vip)) {
1788
- var E = T._createTransaction(g, O, T._dbSchema);
1808
+ var E = T._createTransaction(g, A, T._dbSchema);
1789
1809
  try {
1790
1810
  E.create(), T._state.PR1398_maxLoop = 3;
1791
- } catch (A) {
1792
- 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() {
1793
- return _(T, g, O, b);
1794
- })) : be(A);
1811
+ } catch (O) {
1812
+ return O.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() {
1813
+ return _(T, g, A, b);
1814
+ })) : be(O);
1795
1815
  }
1796
- return E._promise(g, function(A, N) {
1816
+ return E._promise(g, function(O, N) {
1797
1817
  return rt(function() {
1798
- return z.trans = E, b(A, N, E);
1818
+ return z.trans = E, b(O, N, E);
1799
1819
  });
1800
- }).then(function(A) {
1820
+ }).then(function(O) {
1801
1821
  if (g === "readwrite") try {
1802
1822
  E.idbtrans.commit();
1803
1823
  } catch {
1804
1824
  }
1805
- return g === "readonly" ? A : E._completion.then(function() {
1806
- return A;
1825
+ return g === "readonly" ? O : E._completion.then(function() {
1826
+ return O;
1807
1827
  });
1808
1828
  });
1809
1829
  }
@@ -1813,7 +1833,7 @@ function Si() {
1813
1833
  T.open().catch(Q);
1814
1834
  }
1815
1835
  return T._state.dbReadyPromise.then(function() {
1816
- return _(T, g, O, b);
1836
+ return _(T, g, A, b);
1817
1837
  });
1818
1838
  })(this.db, e, [this.name], f);
1819
1839
  return u && (v._consoleTask = u, v = v.catch(function(_) {
@@ -1857,13 +1877,13 @@ function Si() {
1857
1877
  return re(p, v) === 0;
1858
1878
  }
1859
1879
  var f = t.reduce(function(g, v) {
1860
- var _ = g[0], T = g[1], g = r[v], O = e[v];
1880
+ var _ = g[0], T = g[1], g = r[v], A = e[v];
1861
1881
  return [_ || g, _ || !g ? mt(T, g && g.multi ? function(b) {
1862
1882
  return b = me(b, v), w(b) && b.some(function(E) {
1863
- return a(O, E);
1883
+ return a(A, E);
1864
1884
  });
1865
1885
  } : function(b) {
1866
- return a(O, me(b, v));
1886
+ return a(A, me(b, v));
1867
1887
  }) : T];
1868
1888
  }, [null, null]), u = f[0], f = f[1];
1869
1889
  return u ? this.where(u.name).equals(e[u.keyPath]).filter(f) : n ? this.filter(f) : this.where(t).equals("");
@@ -1890,7 +1910,7 @@ function Si() {
1890
1910
  function a() {
1891
1911
  return t !== null && t.apply(this, arguments) || this;
1892
1912
  }
1893
- (this.schema.mappedClass = e).prototype instanceof xr && ((function(v, _) {
1913
+ (this.schema.mappedClass = e).prototype instanceof Nr && ((function(v, _) {
1894
1914
  if (typeof _ != "function" && _ !== null) throw new TypeError("Class extends value " + String(_) + " is not a constructor or null");
1895
1915
  function T() {
1896
1916
  this.constructor = v;
@@ -1901,7 +1921,7 @@ function Si() {
1901
1921
  }, enumerable: !1, configurable: !0 }), a.prototype.table = function() {
1902
1922
  return r;
1903
1923
  }, e = a);
1904
- for (var u = /* @__PURE__ */ new Set(), f = e.prototype; f; f = j(f)) Object.getOwnPropertyNames(f).forEach(function(v) {
1924
+ for (var u = /* @__PURE__ */ new Set(), f = e.prototype; f; f = B(f)) Object.getOwnPropertyNames(f).forEach(function(v) {
1905
1925
  return u.add(v);
1906
1926
  });
1907
1927
  function p(v) {
@@ -1958,7 +1978,7 @@ function Si() {
1958
1978
  }, pe.prototype.clear = function() {
1959
1979
  var e = this;
1960
1980
  return this._trans("readwrite", function(t) {
1961
- return e.core.mutate({ trans: t, type: "deleteRange", range: Tr }).then(function(n) {
1981
+ return e.core.mutate({ trans: t, type: "deleteRange", range: xr }).then(function(n) {
1962
1982
  return sn(e, null, n);
1963
1983
  });
1964
1984
  }).then(function(t) {
@@ -1981,8 +2001,8 @@ function Si() {
1981
2001
  if (a && a.length !== e.length) throw new C.InvalidArgument("Arguments objects and keys must have the same length");
1982
2002
  var v = e.length, _ = _ && p ? e.map(on(_)) : e;
1983
2003
  return r.core.mutate({ trans: f, type: "add", keys: a, values: _, wantResults: u }).then(function(E) {
1984
- var g = E.numFailures, O = E.results, b = E.lastResult, E = E.failures;
1985
- if (g === 0) return u ? O : b;
2004
+ var g = E.numFailures, A = E.results, b = E.lastResult, E = E.failures;
2005
+ if (g === 0) return u ? A : b;
1986
2006
  throw new et("".concat(r.name, ".bulkAdd(): ").concat(g, " of ").concat(v, " operations failed"), E);
1987
2007
  });
1988
2008
  });
@@ -1994,8 +2014,8 @@ function Si() {
1994
2014
  if (a && a.length !== e.length) throw new C.InvalidArgument("Arguments objects and keys must have the same length");
1995
2015
  var v = e.length, _ = _ && p ? e.map(on(_)) : e;
1996
2016
  return r.core.mutate({ trans: f, type: "put", keys: a, values: _, wantResults: u }).then(function(E) {
1997
- var g = E.numFailures, O = E.results, b = E.lastResult, E = E.failures;
1998
- if (g === 0) return u ? O : b;
2017
+ var g = E.numFailures, A = E.results, b = E.lastResult, E = E.failures;
2018
+ if (g === 0) return u ? A : b;
1999
2019
  throw new et("".concat(r.name, ".bulkPut(): ").concat(g, " of ").concat(v, " operations failed"), E);
2000
2020
  });
2001
2021
  });
@@ -2008,27 +2028,27 @@ function Si() {
2008
2028
  return this._trans("readwrite", function(f) {
2009
2029
  return n.getMany({ trans: f, keys: r, cache: "clone" }).then(function(p) {
2010
2030
  var v = [], _ = [];
2011
- e.forEach(function(g, O) {
2012
- var b = g.key, E = g.changes, A = p[O];
2013
- if (A) {
2014
- for (var N = 0, I = Object.keys(E); N < I.length; N++) {
2015
- var S = I[N], k = E[S];
2031
+ e.forEach(function(g, A) {
2032
+ var b = g.key, E = g.changes, O = p[A];
2033
+ if (O) {
2034
+ for (var N = 0, D = Object.keys(E); N < D.length; N++) {
2035
+ var S = D[N], k = E[S];
2016
2036
  if (S === t.schema.primKey.keyPath) {
2017
2037
  if (re(k, b) !== 0) throw new C.Constraint("Cannot update primary key in bulkUpdate()");
2018
- } else ne(A, S, k);
2038
+ } else ne(O, S, k);
2019
2039
  }
2020
- u.push(O), v.push(b), _.push(A);
2040
+ u.push(A), v.push(b), _.push(O);
2021
2041
  }
2022
2042
  });
2023
2043
  var T = v.length;
2024
2044
  return n.mutate({ trans: f, type: "put", keys: v, values: _, updates: { keys: r, changeSpecs: a } }).then(function(g) {
2025
- var O = g.numFailures, b = g.failures;
2026
- if (O === 0) return T;
2027
- for (var E = 0, A = Object.keys(b); E < A.length; E++) {
2028
- var N, I = A[E], S = u[Number(I)];
2029
- S != null && (N = b[I], delete b[I], b[S] = N);
2045
+ var A = g.numFailures, b = g.failures;
2046
+ if (A === 0) return T;
2047
+ for (var E = 0, O = Object.keys(b); E < O.length; E++) {
2048
+ var N, D = O[E], S = u[Number(D)];
2049
+ S != null && (N = b[D], delete b[D], b[S] = N);
2030
2050
  }
2031
- throw new et("".concat(t.name, ".bulkUpdate(): ").concat(O, " of ").concat(T, " operations failed"), b);
2051
+ throw new et("".concat(t.name, ".bulkUpdate(): ").concat(A, " of ").concat(T, " operations failed"), b);
2032
2052
  });
2033
2053
  });
2034
2054
  });
@@ -2061,26 +2081,26 @@ function Si() {
2061
2081
  function u(f, p, v) {
2062
2082
  if (typeof f != "object") {
2063
2083
  var _;
2064
- p = p || An;
2084
+ p = p || On;
2065
2085
  var T = { subscribers: [], fire: v = v || Q, subscribe: function(g) {
2066
2086
  T.subscribers.indexOf(g) === -1 && (T.subscribers.push(g), T.fire = p(T.fire, g));
2067
2087
  }, unsubscribe: function(g) {
2068
- T.subscribers = T.subscribers.filter(function(O) {
2069
- return O !== g;
2088
+ T.subscribers = T.subscribers.filter(function(A) {
2089
+ return A !== g;
2070
2090
  }), T.fire = T.subscribers.reduce(p, v);
2071
2091
  } };
2072
2092
  return n[f] = t[f] = T;
2073
2093
  }
2074
2094
  y(_ = f).forEach(function(g) {
2075
- var O = _[g];
2076
- if (w(O)) u(g, _[g][0], _[g][1]);
2095
+ var A = _[g];
2096
+ if (w(A)) u(g, _[g][0], _[g][1]);
2077
2097
  else {
2078
- if (O !== "asap") throw new C.InvalidArgument("Invalid event config");
2098
+ if (A !== "asap") throw new C.InvalidArgument("Invalid event config");
2079
2099
  var b = u(g, he, function() {
2080
- for (var E = arguments.length, A = new Array(E); E--; ) A[E] = arguments[E];
2100
+ for (var E = arguments.length, O = new Array(E); E--; ) O[E] = arguments[E];
2081
2101
  b.subscribers.forEach(function(N) {
2082
2102
  ae(function() {
2083
- N.apply(null, A);
2103
+ N.apply(null, O);
2084
2104
  });
2085
2105
  });
2086
2106
  });
@@ -2109,7 +2129,7 @@ function Si() {
2109
2129
  if (!n) throw new C.Schema("KeyPath " + e.index + " on object store " + t.name + " is not indexed");
2110
2130
  return n;
2111
2131
  }
2112
- function Cr(e, t, n) {
2132
+ function Dr(e, t, n) {
2113
2133
  var r = un(e, t.schema);
2114
2134
  return t.openCursor({ trans: n, values: !e.keysOnly, reverse: e.dir === "prev", unique: !!e.unique, query: { index: r, range: e.range } });
2115
2135
  }
@@ -2118,15 +2138,15 @@ function Si() {
2118
2138
  if (e.or) {
2119
2139
  var u = {}, f = function(p, v, _) {
2120
2140
  var T, g;
2121
- a && !a(v, _, function(O) {
2122
- return v.stop(O);
2123
- }, function(O) {
2124
- return v.fail(O);
2141
+ a && !a(v, _, function(A) {
2142
+ return v.stop(A);
2143
+ }, function(A) {
2144
+ return v.fail(A);
2125
2145
  }) || ((g = "" + (T = v.primaryKey)) == "[object ArrayBuffer]" && (g = "" + new Uint8Array(T)), W(u, g) || (u[g] = !0, t(p, v, _)));
2126
2146
  };
2127
- return Promise.all([e.or._iterate(f, n), Ir(Cr(e, r, n), e.algorithm, f, !e.keysOnly && e.valueMapper)]);
2147
+ return Promise.all([e.or._iterate(f, n), Ir(Dr(e, r, n), e.algorithm, f, !e.keysOnly && e.valueMapper)]);
2128
2148
  }
2129
- return Ir(Cr(e, r, n), mt(e.algorithm, a), t, !e.keysOnly && e.valueMapper);
2149
+ return Ir(Dr(e, r, n), mt(e.algorithm, a), t, !e.keysOnly && e.valueMapper);
2130
2150
  }
2131
2151
  function Ir(e, t, n, r) {
2132
2152
  var a = ge(r ? function(u, f, p) {
@@ -2149,7 +2169,7 @@ function Si() {
2149
2169
  });
2150
2170
  });
2151
2171
  }
2152
- var Kt = (Dr.prototype.execute = function(e) {
2172
+ var Kt = (Rr.prototype.execute = function(e) {
2153
2173
  var t = this["@@propmod"];
2154
2174
  if (t.add !== void 0) {
2155
2175
  var n = t.add;
@@ -2176,11 +2196,11 @@ function Si() {
2176
2196
  throw new TypeError("Invalid subtrahend ".concat(r));
2177
2197
  }
2178
2198
  return n = (n = t.replacePrefix) === null || n === void 0 ? void 0 : n[0], n && typeof e == "string" && e.startsWith(n) ? t.replacePrefix[1] + e.substring(n.length) : e;
2179
- }, Dr);
2180
- function Dr(e) {
2199
+ }, Rr);
2200
+ function Rr(e) {
2181
2201
  this["@@propmod"] = e;
2182
2202
  }
2183
- var Da = (ue.prototype._read = function(e, t) {
2203
+ var Ra = (ue.prototype._read = function(e, t) {
2184
2204
  var n = this._ctx;
2185
2205
  return n.error ? n.table._trans(null, be.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
2186
2206
  }, ue.prototype._write = function(e) {
@@ -2345,61 +2365,61 @@ function Si() {
2345
2365
  var t = this, n = this._ctx;
2346
2366
  return this._write(function(r) {
2347
2367
  var a, u, f;
2348
- f = typeof e == "function" ? e : (a = y(e), u = a.length, function(I) {
2368
+ f = typeof e == "function" ? e : (a = y(e), u = a.length, function(D) {
2349
2369
  for (var S = !1, k = 0; k < u; ++k) {
2350
- var P = a[k], M = e[P], L = me(I, P);
2351
- M instanceof Kt ? (ne(I, P, M.execute(L)), S = !0) : L !== M && (ne(I, P, M), S = !0);
2370
+ var P = a[k], M = e[P], L = me(D, P);
2371
+ M instanceof Kt ? (ne(D, P, M.execute(L)), S = !0) : L !== M && (ne(D, P, M), S = !0);
2352
2372
  }
2353
2373
  return S;
2354
2374
  });
2355
2375
  var p = n.table.core, g = p.schema.primaryKey, v = g.outbound, _ = g.extractKey, T = 200, g = t.db._options.modifyChunkSize;
2356
2376
  g && (T = typeof g == "object" ? g[p.name] || g["*"] || 200 : g);
2357
- function O(I, P) {
2377
+ function A(D, P) {
2358
2378
  var k = P.failures, P = P.numFailures;
2359
- E += I - P;
2379
+ E += D - P;
2360
2380
  for (var M = 0, L = y(k); M < L.length; M++) {
2361
2381
  var K = L[M];
2362
2382
  b.push(k[K]);
2363
2383
  }
2364
2384
  }
2365
- var b = [], E = 0, A = [], N = e === Rr;
2366
- return t.clone().primaryKeys().then(function(I) {
2385
+ var b = [], E = 0, O = [], N = e === Sr;
2386
+ return t.clone().primaryKeys().then(function(D) {
2367
2387
  function S(P) {
2368
- var M = Math.min(T, I.length - P), L = I.slice(P, P + M);
2388
+ var M = Math.min(T, D.length - P), L = D.slice(P, P + M);
2369
2389
  return (N ? Promise.resolve([]) : p.getMany({ trans: r, keys: L, cache: "immutable" })).then(function(K) {
2370
2390
  var q = [], V = [], U = v ? [] : null, $ = N ? L : [];
2371
2391
  if (!N) for (var te = 0; te < M; ++te) {
2372
- var oe = K[te], Z = { value: Pe(oe), primKey: I[P + te] };
2373
- f.call(Z, Z.value, Z) !== !1 && (Z.value == null ? $.push(I[P + te]) : v || re(_(oe), _(Z.value)) === 0 ? (V.push(Z.value), v && U.push(I[P + te])) : ($.push(I[P + te]), q.push(Z.value)));
2392
+ var oe = K[te], Z = { value: Pe(oe), primKey: D[P + te] };
2393
+ f.call(Z, Z.value, Z) !== !1 && (Z.value == null ? $.push(D[P + te]) : v || re(_(oe), _(Z.value)) === 0 ? (V.push(Z.value), v && U.push(D[P + te])) : ($.push(D[P + te]), q.push(Z.value)));
2374
2394
  }
2375
2395
  return Promise.resolve(0 < q.length && p.mutate({ trans: r, type: "add", values: q }).then(function(ve) {
2376
2396
  for (var H in ve.failures) $.splice(parseInt(H), 1);
2377
- O(q.length, ve);
2397
+ A(q.length, ve);
2378
2398
  })).then(function() {
2379
2399
  return (0 < V.length || k && typeof e == "object") && p.mutate({ trans: r, type: "put", keys: U, values: V, criteria: k, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < P }).then(function(ve) {
2380
- return O(V.length, ve);
2400
+ return A(V.length, ve);
2381
2401
  });
2382
2402
  }).then(function() {
2383
2403
  return (0 < $.length || k && N) && p.mutate({ trans: r, type: "delete", keys: $, criteria: k, isAdditionalChunk: 0 < P }).then(function(ve) {
2384
2404
  return sn(n.table, $, ve);
2385
2405
  }).then(function(ve) {
2386
- return O($.length, ve);
2406
+ return A($.length, ve);
2387
2407
  });
2388
2408
  }).then(function() {
2389
- return I.length > P + M && S(P + T);
2409
+ return D.length > P + M && S(P + T);
2390
2410
  });
2391
2411
  });
2392
2412
  }
2393
2413
  var k = Nt(n) && n.limit === 1 / 0 && (typeof e != "function" || N) && { index: n.index, range: n.range };
2394
2414
  return S(0).then(function() {
2395
- if (0 < b.length) throw new Je("Error modifying one or more objects", b, E, A);
2396
- return I.length;
2415
+ if (0 < b.length) throw new Je("Error modifying one or more objects", b, E, O);
2416
+ return D.length;
2397
2417
  });
2398
2418
  });
2399
2419
  });
2400
2420
  }, ue.prototype.delete = function() {
2401
2421
  var e = this._ctx, t = e.range;
2402
- return !Nt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Rr) : this._write(function(n) {
2422
+ return !Nt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Sr) : this._write(function(n) {
2403
2423
  var r = e.table.core.schema.primaryKey, a = t;
2404
2424
  return e.table.core.count({ trans: n, query: { index: r, range: a } }).then(function(u) {
2405
2425
  return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(v) {
@@ -2414,29 +2434,29 @@ function Si() {
2414
2434
  }, ue);
2415
2435
  function ue() {
2416
2436
  }
2417
- var Rr = function(e, t) {
2437
+ var Sr = function(e, t) {
2418
2438
  return t.value = null;
2419
2439
  };
2420
- function Ra(e, t) {
2440
+ function Sa(e, t) {
2421
2441
  return e < t ? -1 : e === t ? 0 : 1;
2422
2442
  }
2423
- function Sa(e, t) {
2443
+ function ka(e, t) {
2424
2444
  return t < e ? -1 : e === t ? 0 : 1;
2425
2445
  }
2426
2446
  function Be(e, t, n) {
2427
- return e = e instanceof kr ? new e.Collection(e) : e, e._ctx.error = new (n || TypeError)(t), e;
2447
+ return e = e instanceof Pr ? new e.Collection(e) : e, e._ctx.error = new (n || TypeError)(t), e;
2428
2448
  }
2429
- function At(e) {
2449
+ function Ot(e) {
2430
2450
  return new e.Collection(e, function() {
2431
- return Sr("");
2451
+ return kr("");
2432
2452
  }).limit(0);
2433
2453
  }
2434
2454
  function ln(e, t, n, r) {
2435
2455
  var a, u, f, p, v, _, T, g = n.length;
2436
2456
  if (!n.every(function(E) {
2437
2457
  return typeof E == "string";
2438
- })) return Be(e, Er);
2439
- function O(E) {
2458
+ })) return Be(e, Tr);
2459
+ function A(E) {
2440
2460
  a = E === "next" ? function(N) {
2441
2461
  return N.toUpperCase();
2442
2462
  } : function(N) {
@@ -2445,28 +2465,28 @@ function Si() {
2445
2465
  return N.toLowerCase();
2446
2466
  } : function(N) {
2447
2467
  return N.toUpperCase();
2448
- }, f = E === "next" ? Ra : Sa;
2449
- var A = n.map(function(N) {
2468
+ }, f = E === "next" ? Sa : ka;
2469
+ var O = n.map(function(N) {
2450
2470
  return { lower: u(N), upper: a(N) };
2451
- }).sort(function(N, I) {
2452
- return f(N.lower, I.lower);
2471
+ }).sort(function(N, D) {
2472
+ return f(N.lower, D.lower);
2453
2473
  });
2454
- p = A.map(function(N) {
2474
+ p = O.map(function(N) {
2455
2475
  return N.upper;
2456
- }), v = A.map(function(N) {
2476
+ }), v = O.map(function(N) {
2457
2477
  return N.lower;
2458
2478
  }), T = (_ = E) === "next" ? "" : r;
2459
2479
  }
2460
- O("next"), e = new e.Collection(e, function() {
2480
+ A("next"), e = new e.Collection(e, function() {
2461
2481
  return ot(p[0], v[g - 1] + r);
2462
2482
  }), e._ondirectionchange = function(E) {
2463
- O(E);
2483
+ A(E);
2464
2484
  };
2465
2485
  var b = 0;
2466
- return e._addAlgorithm(function(E, A, N) {
2467
- var I = E.key;
2468
- if (typeof I != "string") return !1;
2469
- var S = u(I);
2486
+ return e._addAlgorithm(function(E, O, N) {
2487
+ var D = E.key;
2488
+ if (typeof D != "string") return !1;
2489
+ var S = u(D);
2470
2490
  if (t(S, v, b)) return !0;
2471
2491
  for (var k = null, P = b; P < g; ++P) {
2472
2492
  var M = (function(L, K, q, V, U, $) {
@@ -2476,10 +2496,10 @@ function Si() {
2476
2496
  U(L[Z], ve) < 0 && (oe = Z);
2477
2497
  }
2478
2498
  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);
2479
- })(I, S, p[P], v[P], f, _);
2499
+ })(D, S, p[P], v[P], f, _);
2480
2500
  M === null && k === null ? b = P + 1 : (k === null || 0 < f(k, M)) && (k = M);
2481
2501
  }
2482
- return A(k !== null ? function() {
2502
+ return O(k !== null ? function() {
2483
2503
  E.continue(k + T);
2484
2504
  } : N), !1;
2485
2505
  }), e;
@@ -2487,70 +2507,70 @@ function Si() {
2487
2507
  function ot(e, t, n, r) {
2488
2508
  return { type: 2, lower: e, upper: t, lowerOpen: n, upperOpen: r };
2489
2509
  }
2490
- function Sr(e) {
2510
+ function kr(e) {
2491
2511
  return { type: 1, lower: e, upper: e };
2492
2512
  }
2493
- var kr = (Object.defineProperty(Ae.prototype, "Collection", { get: function() {
2513
+ var Pr = (Object.defineProperty(Oe.prototype, "Collection", { get: function() {
2494
2514
  return this._ctx.table.db.Collection;
2495
- }, enumerable: !1, configurable: !0 }), Ae.prototype.between = function(e, t, n, r) {
2515
+ }, enumerable: !1, configurable: !0 }), Oe.prototype.between = function(e, t, n, r) {
2496
2516
  n = n !== !1, r = r === !0;
2497
2517
  try {
2498
- return 0 < this._cmp(e, t) || this._cmp(e, t) === 0 && (n || r) && (!n || !r) ? At(this) : new this.Collection(this, function() {
2518
+ return 0 < this._cmp(e, t) || this._cmp(e, t) === 0 && (n || r) && (!n || !r) ? Ot(this) : new this.Collection(this, function() {
2499
2519
  return ot(e, t, !n, !r);
2500
2520
  });
2501
2521
  } catch {
2502
2522
  return Be(this, We);
2503
2523
  }
2504
- }, Ae.prototype.equals = function(e) {
2524
+ }, Oe.prototype.equals = function(e) {
2505
2525
  return e == null ? Be(this, We) : new this.Collection(this, function() {
2506
- return Sr(e);
2526
+ return kr(e);
2507
2527
  });
2508
- }, Ae.prototype.above = function(e) {
2528
+ }, Oe.prototype.above = function(e) {
2509
2529
  return e == null ? Be(this, We) : new this.Collection(this, function() {
2510
2530
  return ot(e, void 0, !0);
2511
2531
  });
2512
- }, Ae.prototype.aboveOrEqual = function(e) {
2532
+ }, Oe.prototype.aboveOrEqual = function(e) {
2513
2533
  return e == null ? Be(this, We) : new this.Collection(this, function() {
2514
2534
  return ot(e, void 0, !1);
2515
2535
  });
2516
- }, Ae.prototype.below = function(e) {
2536
+ }, Oe.prototype.below = function(e) {
2517
2537
  return e == null ? Be(this, We) : new this.Collection(this, function() {
2518
2538
  return ot(void 0, e, !1, !0);
2519
2539
  });
2520
- }, Ae.prototype.belowOrEqual = function(e) {
2540
+ }, Oe.prototype.belowOrEqual = function(e) {
2521
2541
  return e == null ? Be(this, We) : new this.Collection(this, function() {
2522
2542
  return ot(void 0, e);
2523
2543
  });
2524
- }, Ae.prototype.startsWith = function(e) {
2525
- return typeof e != "string" ? Be(this, Er) : this.between(e, e + pt, !0, !0);
2526
- }, Ae.prototype.startsWithIgnoreCase = function(e) {
2544
+ }, Oe.prototype.startsWith = function(e) {
2545
+ return typeof e != "string" ? Be(this, Tr) : this.between(e, e + pt, !0, !0);
2546
+ }, Oe.prototype.startsWithIgnoreCase = function(e) {
2527
2547
  return e === "" ? this.startsWith(e) : ln(this, function(t, n) {
2528
2548
  return t.indexOf(n[0]) === 0;
2529
2549
  }, [e], pt);
2530
- }, Ae.prototype.equalsIgnoreCase = function(e) {
2550
+ }, Oe.prototype.equalsIgnoreCase = function(e) {
2531
2551
  return ln(this, function(t, n) {
2532
2552
  return t === n[0];
2533
2553
  }, [e], "");
2534
- }, Ae.prototype.anyOfIgnoreCase = function() {
2554
+ }, Oe.prototype.anyOfIgnoreCase = function() {
2535
2555
  var e = Fe.apply(Ve, arguments);
2536
- return e.length === 0 ? At(this) : ln(this, function(t, n) {
2556
+ return e.length === 0 ? Ot(this) : ln(this, function(t, n) {
2537
2557
  return n.indexOf(t) !== -1;
2538
2558
  }, e, "");
2539
- }, Ae.prototype.startsWithAnyOfIgnoreCase = function() {
2559
+ }, Oe.prototype.startsWithAnyOfIgnoreCase = function() {
2540
2560
  var e = Fe.apply(Ve, arguments);
2541
- return e.length === 0 ? At(this) : ln(this, function(t, n) {
2561
+ return e.length === 0 ? Ot(this) : ln(this, function(t, n) {
2542
2562
  return n.some(function(r) {
2543
2563
  return t.indexOf(r) === 0;
2544
2564
  });
2545
2565
  }, e, pt);
2546
- }, Ae.prototype.anyOf = function() {
2566
+ }, Oe.prototype.anyOf = function() {
2547
2567
  var e = this, t = Fe.apply(Ve, arguments), n = this._cmp;
2548
2568
  try {
2549
2569
  t.sort(n);
2550
2570
  } catch {
2551
2571
  return Be(this, We);
2552
2572
  }
2553
- if (t.length === 0) return At(this);
2573
+ if (t.length === 0) return Ot(this);
2554
2574
  var r = new this.Collection(this, function() {
2555
2575
  return ot(t[0], t[t.length - 1]);
2556
2576
  });
@@ -2564,9 +2584,9 @@ function Si() {
2564
2584
  u.continue(t[a]);
2565
2585
  }), !1);
2566
2586
  }), r;
2567
- }, Ae.prototype.notEqual = function(e) {
2587
+ }, Oe.prototype.notEqual = function(e) {
2568
2588
  return this.inAnyRange([[-1 / 0, e], [e, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 });
2569
- }, Ae.prototype.noneOf = function() {
2589
+ }, Oe.prototype.noneOf = function() {
2570
2590
  var e = Fe.apply(Ve, arguments);
2571
2591
  if (e.length === 0) return new this.Collection(this);
2572
2592
  try {
@@ -2578,18 +2598,18 @@ function Si() {
2578
2598
  return n ? n.concat([[n[n.length - 1][1], r]]) : [[-1 / 0, r]];
2579
2599
  }, null);
2580
2600
  return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, { includeLowers: !1, includeUppers: !1 });
2581
- }, Ae.prototype.inAnyRange = function(I, t) {
2601
+ }, Oe.prototype.inAnyRange = function(D, t) {
2582
2602
  var n = this, r = this._cmp, a = this._ascending, u = this._descending, f = this._min, p = this._max;
2583
- if (I.length === 0) return At(this);
2584
- if (!I.every(function(S) {
2603
+ if (D.length === 0) return Ot(this);
2604
+ if (!D.every(function(S) {
2585
2605
  return S[0] !== void 0 && S[1] !== void 0 && a(S[0], S[1]) <= 0;
2586
2606
  })) 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);
2587
2607
  var v = !t || t.includeLowers !== !1, _ = t && t.includeUppers === !0, T, g = a;
2588
- function O(S, k) {
2608
+ function A(S, k) {
2589
2609
  return g(S[0], k[0]);
2590
2610
  }
2591
2611
  try {
2592
- (T = I.reduce(function(S, k) {
2612
+ (T = D.reduce(function(S, k) {
2593
2613
  for (var P = 0, M = S.length; P < M; ++P) {
2594
2614
  var L = S[P];
2595
2615
  if (r(k[0], L[1]) < 0 && 0 < r(k[1], L[0])) {
@@ -2598,7 +2618,7 @@ function Si() {
2598
2618
  }
2599
2619
  }
2600
2620
  return P === M && S.push(k), S;
2601
- }, [])).sort(O);
2621
+ }, [])).sort(A);
2602
2622
  } catch {
2603
2623
  return Be(this, We);
2604
2624
  }
@@ -2606,30 +2626,30 @@ function Si() {
2606
2626
  return 0 < a(S, T[b][1]);
2607
2627
  } : function(S) {
2608
2628
  return 0 <= a(S, T[b][1]);
2609
- }, A = v ? function(S) {
2629
+ }, O = v ? function(S) {
2610
2630
  return 0 < u(S, T[b][0]);
2611
2631
  } : function(S) {
2612
2632
  return 0 <= u(S, T[b][0]);
2613
- }, N = E, I = new this.Collection(this, function() {
2633
+ }, N = E, D = new this.Collection(this, function() {
2614
2634
  return ot(T[0][0], T[T.length - 1][1], !v, !_);
2615
2635
  });
2616
- return I._ondirectionchange = function(S) {
2617
- g = S === "next" ? (N = E, a) : (N = A, u), T.sort(O);
2618
- }, I._addAlgorithm(function(S, k, P) {
2636
+ return D._ondirectionchange = function(S) {
2637
+ g = S === "next" ? (N = E, a) : (N = O, u), T.sort(A);
2638
+ }, D._addAlgorithm(function(S, k, P) {
2619
2639
  for (var M, L = S.key; N(L); ) if (++b === T.length) return k(P), !1;
2620
- return !E(M = L) && !A(M) || (n._cmp(L, T[b][1]) === 0 || n._cmp(L, T[b][0]) === 0 || k(function() {
2640
+ return !E(M = L) && !O(M) || (n._cmp(L, T[b][1]) === 0 || n._cmp(L, T[b][0]) === 0 || k(function() {
2621
2641
  g === a ? S.continue(T[b][0]) : S.continue(T[b][1]);
2622
2642
  }), !1);
2623
- }), I;
2624
- }, Ae.prototype.startsWithAnyOf = function() {
2643
+ }), D;
2644
+ }, Oe.prototype.startsWithAnyOf = function() {
2625
2645
  var e = Fe.apply(Ve, arguments);
2626
2646
  return e.every(function(t) {
2627
2647
  return typeof t == "string";
2628
- }) ? e.length === 0 ? At(this) : this.inAnyRange(e.map(function(t) {
2648
+ }) ? e.length === 0 ? Ot(this) : this.inAnyRange(e.map(function(t) {
2629
2649
  return [t, t + pt];
2630
2650
  })) : Be(this, "startsWithAnyOf() only works with strings");
2631
- }, Ae);
2632
- function Ae() {
2651
+ }, Oe);
2652
+ function Oe() {
2633
2653
  }
2634
2654
  function Ge(e) {
2635
2655
  return ge(function(t) {
@@ -2639,7 +2659,7 @@ function Si() {
2639
2659
  function qt(e) {
2640
2660
  e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
2641
2661
  }
2642
- var Lt = "storagemutated", Kn = "x-storagemutated-1", st = jt(null, Lt), ka = ($e.prototype._lock = function() {
2662
+ var Lt = "storagemutated", Kn = "x-storagemutated-1", st = jt(null, Lt), Pa = ($e.prototype._lock = function() {
2643
2663
  return Y(!z.global), ++this._reculock, this._reculock !== 1 || z.global || (z.lockOwnerFor = this), this;
2644
2664
  }, $e.prototype._unlock = function() {
2645
2665
  if (Y(!z.global), --this._reculock == 0) for (z.global || (z.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) {
@@ -2728,9 +2748,9 @@ function Si() {
2728
2748
  function $e() {
2729
2749
  }
2730
2750
  function qn(e, t, n, r, a, u, f, p) {
2731
- return { name: e, keyPath: t, unique: n, multi: r, auto: a, compound: u, src: (n && !f ? "&" : "") + (r ? "*" : "") + (a ? "++" : "") + Pr(t), type: p };
2751
+ return { name: e, keyPath: t, unique: n, multi: r, auto: a, compound: u, src: (n && !f ? "&" : "") + (r ? "*" : "") + (a ? "++" : "") + Fr(t), type: p };
2732
2752
  }
2733
- function Pr(e) {
2753
+ function Fr(e) {
2734
2754
  return typeof e == "string" ? e : e ? "[" + [].join.call(e, "+") + "]" : "";
2735
2755
  }
2736
2756
  function Ln(e, t, n) {
@@ -2763,28 +2783,28 @@ function Si() {
2763
2783
  };
2764
2784
  var t;
2765
2785
  }
2766
- function Fr(e) {
2786
+ function Br(e) {
2767
2787
  return [].slice.call(e);
2768
2788
  }
2769
- var Pa = 0;
2789
+ var Fa = 0;
2770
2790
  function Vt(e) {
2771
2791
  return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
2772
2792
  }
2773
- function Fa(e, t, v) {
2793
+ function Ba(e, t, v) {
2774
2794
  function r(N) {
2775
2795
  if (N.type === 3) return null;
2776
2796
  if (N.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
2777
- var b = N.lower, E = N.upper, A = N.lowerOpen, N = N.upperOpen;
2778
- return b === void 0 ? E === void 0 ? null : t.upperBound(E, !!N) : E === void 0 ? t.lowerBound(b, !!A) : t.bound(b, E, !!A, !!N);
2797
+ var b = N.lower, E = N.upper, O = N.lowerOpen, N = N.upperOpen;
2798
+ return b === void 0 ? E === void 0 ? null : t.upperBound(E, !!N) : E === void 0 ? t.lowerBound(b, !!O) : t.bound(b, E, !!O, !!N);
2779
2799
  }
2780
- function a(O) {
2781
- var b, E = O.name;
2782
- return { name: E, schema: O, mutate: function(A) {
2783
- var N = A.trans, I = A.type, S = A.keys, k = A.values, P = A.range;
2800
+ function a(A) {
2801
+ var b, E = A.name;
2802
+ return { name: E, schema: A, mutate: function(O) {
2803
+ var N = O.trans, D = O.type, S = O.keys, k = O.values, P = O.range;
2784
2804
  return new Promise(function(M, L) {
2785
2805
  M = ge(M);
2786
- var K = N.objectStore(E), q = K.keyPath == null, V = I === "put" || I === "add";
2787
- if (!V && I !== "delete" && I !== "deleteRange") throw new Error("Invalid operation type: " + I);
2806
+ var K = N.objectStore(E), q = K.keyPath == null, V = D === "put" || D === "add";
2807
+ if (!V && D !== "delete" && D !== "deleteRange") throw new Error("Invalid operation type: " + D);
2788
2808
  var U, $ = (S || k || { length: 1 }).length;
2789
2809
  if (S && k && S.length !== k.length) throw new Error("Given keys array must have same length as given values array.");
2790
2810
  if ($ === 0) return M({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
@@ -2792,18 +2812,18 @@ function Si() {
2792
2812
  ++ve, qt(Se);
2793
2813
  }
2794
2814
  var oe = [], Z = [], ve = 0;
2795
- if (I === "deleteRange") {
2815
+ if (D === "deleteRange") {
2796
2816
  if (P.type === 4) return M({ numFailures: ve, failures: Z, results: [], lastResult: void 0 });
2797
2817
  P.type === 3 ? oe.push(U = K.clear()) : oe.push(U = K.delete(r(P)));
2798
2818
  } else {
2799
- var q = V ? q ? [k, S] : [k, null] : [S, null], H = q[0], Ie = q[1];
2800
- if (V) for (var De = 0; De < $; ++De) oe.push(U = Ie && Ie[De] !== void 0 ? K[I](H[De], Ie[De]) : K[I](H[De])), U.onerror = te;
2801
- else for (De = 0; De < $; ++De) oe.push(U = K[I](H[De])), U.onerror = te;
2819
+ var q = V ? q ? [k, S] : [k, null] : [S, null], H = q[0], De = q[1];
2820
+ if (V) for (var Ie = 0; Ie < $; ++Ie) oe.push(U = De && De[Ie] !== void 0 ? K[D](H[Ie], De[Ie]) : K[D](H[Ie])), U.onerror = te;
2821
+ else for (Ie = 0; Ie < $; ++Ie) oe.push(U = K[D](H[Ie])), U.onerror = te;
2802
2822
  }
2803
2823
  function En(Se) {
2804
2824
  Se = Se.target.result, oe.forEach(function(vt, or) {
2805
2825
  return vt.error != null && (Z[or] = vt.error);
2806
- }), M({ numFailures: ve, failures: Z, results: I === "delete" ? S : oe.map(function(vt) {
2826
+ }), M({ numFailures: ve, failures: Z, results: D === "delete" ? S : oe.map(function(vt) {
2807
2827
  return vt.result;
2808
2828
  }), lastResult: Se });
2809
2829
  }
@@ -2811,58 +2831,58 @@ function Si() {
2811
2831
  te(Se), En(Se);
2812
2832
  }, U.onsuccess = En;
2813
2833
  });
2814
- }, getMany: function(A) {
2815
- var N = A.trans, I = A.keys;
2834
+ }, getMany: function(O) {
2835
+ var N = O.trans, D = O.keys;
2816
2836
  return new Promise(function(S, k) {
2817
2837
  S = ge(S);
2818
- for (var P, M = N.objectStore(E), L = I.length, K = new Array(L), q = 0, V = 0, U = function(oe) {
2838
+ for (var P, M = N.objectStore(E), L = D.length, K = new Array(L), q = 0, V = 0, U = function(oe) {
2819
2839
  oe = oe.target, K[oe._pos] = oe.result, ++V === q && S(K);
2820
- }, $ = Ge(k), te = 0; te < L; ++te) I[te] != null && ((P = M.get(I[te]))._pos = te, P.onsuccess = U, P.onerror = $, ++q);
2840
+ }, $ = Ge(k), te = 0; te < L; ++te) D[te] != null && ((P = M.get(D[te]))._pos = te, P.onsuccess = U, P.onerror = $, ++q);
2821
2841
  q === 0 && S(K);
2822
2842
  });
2823
- }, get: function(A) {
2824
- var N = A.trans, I = A.key;
2843
+ }, get: function(O) {
2844
+ var N = O.trans, D = O.key;
2825
2845
  return new Promise(function(S, k) {
2826
2846
  S = ge(S);
2827
- var P = N.objectStore(E).get(I);
2847
+ var P = N.objectStore(E).get(D);
2828
2848
  P.onsuccess = function(M) {
2829
2849
  return S(M.target.result);
2830
2850
  }, P.onerror = Ge(k);
2831
2851
  });
2832
- }, query: (b = _, function(A) {
2833
- return new Promise(function(N, I) {
2852
+ }, query: (b = _, function(O) {
2853
+ return new Promise(function(N, D) {
2834
2854
  N = ge(N);
2835
- var S, k, P, 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(E), V = V.isPrimaryKey ? q : q.index(V.name), U = r(U);
2855
+ var S, k, P, q = O.trans, M = O.values, L = O.limit, U = O.query, K = L === 1 / 0 ? void 0 : L, V = U.index, U = U.range, q = q.objectStore(E), V = V.isPrimaryKey ? q : q.index(V.name), U = r(U);
2836
2856
  if (L === 0) return N({ result: [] });
2837
2857
  b ? ((K = M ? V.getAll(U, K) : V.getAllKeys(U, K)).onsuccess = function($) {
2838
2858
  return N({ result: $.target.result });
2839
- }, K.onerror = Ge(I)) : (S = 0, k = !M && "openKeyCursor" in V ? V.openKeyCursor(U) : V.openCursor(U), P = [], k.onsuccess = function($) {
2859
+ }, K.onerror = Ge(D)) : (S = 0, k = !M && "openKeyCursor" in V ? V.openKeyCursor(U) : V.openCursor(U), P = [], k.onsuccess = function($) {
2840
2860
  var te = k.result;
2841
2861
  return te ? (P.push(M ? te.value : te.primaryKey), ++S === L ? N({ result: P }) : void te.continue()) : N({ result: P });
2842
- }, k.onerror = Ge(I));
2862
+ }, k.onerror = Ge(D));
2843
2863
  });
2844
- }), openCursor: function(A) {
2845
- var N = A.trans, I = A.values, S = A.query, k = A.reverse, P = A.unique;
2864
+ }), openCursor: function(O) {
2865
+ var N = O.trans, D = O.values, S = O.query, k = O.reverse, P = O.unique;
2846
2866
  return new Promise(function(M, L) {
2847
2867
  M = ge(M);
2848
- var V = S.index, K = S.range, q = N.objectStore(E), q = V.isPrimaryKey ? q : q.index(V.name), V = k ? P ? "prevunique" : "prev" : P ? "nextunique" : "next", U = !I && "openKeyCursor" in q ? q.openKeyCursor(r(K), V) : q.openCursor(r(K), V);
2868
+ var V = S.index, K = S.range, q = N.objectStore(E), q = V.isPrimaryKey ? q : q.index(V.name), V = k ? P ? "prevunique" : "prev" : P ? "nextunique" : "next", U = !D && "openKeyCursor" in q ? q.openKeyCursor(r(K), V) : q.openCursor(r(K), V);
2849
2869
  U.onerror = Ge(L), U.onsuccess = ge(function($) {
2850
2870
  var te, oe, Z, ve, H = U.result;
2851
- H ? (H.___id = ++Pa, H.done = !1, te = H.continue.bind(H), oe = (oe = H.continuePrimaryKey) && oe.bind(H), Z = H.advance.bind(H), ve = function() {
2871
+ H ? (H.___id = ++Fa, H.done = !1, te = H.continue.bind(H), oe = (oe = H.continuePrimaryKey) && oe.bind(H), Z = H.advance.bind(H), ve = function() {
2852
2872
  throw new Error("Cursor not stopped");
2853
2873
  }, H.trans = N, H.stop = H.continue = H.continuePrimaryKey = H.advance = function() {
2854
2874
  throw new Error("Cursor not started");
2855
2875
  }, H.fail = ge(L), H.next = function() {
2856
- var Ie = this, De = 1;
2876
+ var De = this, Ie = 1;
2857
2877
  return this.start(function() {
2858
- return De-- ? Ie.continue() : Ie.stop();
2878
+ return Ie-- ? De.continue() : De.stop();
2859
2879
  }).then(function() {
2860
- return Ie;
2880
+ return De;
2861
2881
  });
2862
- }, H.start = function(Ie) {
2863
- function De() {
2882
+ }, H.start = function(De) {
2883
+ function Ie() {
2864
2884
  if (U.result) try {
2865
- Ie();
2885
+ De();
2866
2886
  } catch (Se) {
2867
2887
  H.fail(Se);
2868
2888
  }
@@ -2876,49 +2896,49 @@ function Si() {
2876
2896
  };
2877
2897
  });
2878
2898
  return U.onsuccess = ge(function(Se) {
2879
- U.onsuccess = De, De();
2880
- }), H.continue = te, H.continuePrimaryKey = oe, H.advance = Z, De(), En;
2899
+ U.onsuccess = Ie, Ie();
2900
+ }), H.continue = te, H.continuePrimaryKey = oe, H.advance = Z, Ie(), En;
2881
2901
  }, M(H)) : M(null);
2882
2902
  }, L);
2883
2903
  });
2884
- }, count: function(A) {
2885
- var N = A.query, I = A.trans, S = N.index, k = N.range;
2904
+ }, count: function(O) {
2905
+ var N = O.query, D = O.trans, S = N.index, k = N.range;
2886
2906
  return new Promise(function(P, M) {
2887
- var L = I.objectStore(E), K = S.isPrimaryKey ? L : L.index(S.name), L = r(k), K = L ? K.count(L) : K.count();
2907
+ var L = D.objectStore(E), K = S.isPrimaryKey ? L : L.index(S.name), L = r(k), K = L ? K.count(L) : K.count();
2888
2908
  K.onsuccess = ge(function(q) {
2889
2909
  return P(q.target.result);
2890
2910
  }), K.onerror = Ge(M);
2891
2911
  });
2892
2912
  } };
2893
2913
  }
2894
- var u, f, p, T = (f = v, p = Fr((u = e).objectStoreNames), { schema: { name: u.name, tables: p.map(function(O) {
2895
- return f.objectStore(O);
2896
- }).map(function(O) {
2897
- var b = O.keyPath, N = O.autoIncrement, E = w(b), A = {}, N = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: b == null, compound: E, keyPath: b, autoIncrement: N, unique: !0, extractKey: Un(b) }, indexes: Fr(O.indexNames).map(function(I) {
2898
- return O.index(I);
2914
+ var u, f, p, T = (f = v, p = Br((u = e).objectStoreNames), { schema: { name: u.name, tables: p.map(function(A) {
2915
+ return f.objectStore(A);
2916
+ }).map(function(A) {
2917
+ var b = A.keyPath, N = A.autoIncrement, E = w(b), O = {}, N = { name: A.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: b == null, compound: E, keyPath: b, autoIncrement: N, unique: !0, extractKey: Un(b) }, indexes: Br(A.indexNames).map(function(D) {
2918
+ return A.index(D);
2899
2919
  }).map(function(P) {
2900
2920
  var S = P.name, k = P.unique, M = P.multiEntry, P = P.keyPath, M = { name: S, compound: w(P), keyPath: P, unique: k, multiEntry: M, extractKey: Un(P) };
2901
- return A[Vt(P)] = M;
2902
- }), getIndexByKeyPath: function(I) {
2903
- return A[Vt(I)];
2921
+ return O[Vt(P)] = M;
2922
+ }), getIndexByKeyPath: function(D) {
2923
+ return O[Vt(D)];
2904
2924
  } };
2905
- return A[":id"] = N.primaryKey, b != null && (A[Vt(b)] = N.primaryKey), N;
2925
+ return O[":id"] = N.primaryKey, b != null && (O[Vt(b)] = N.primaryKey), N;
2906
2926
  }) }, hasGetAll: 0 < p.length && "getAll" in f.objectStore(p[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = T.schema, _ = T.hasGetAll, T = v.tables.map(a), g = {};
2907
- return T.forEach(function(O) {
2908
- return g[O.name] = O;
2909
- }), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(O) {
2910
- if (!g[O]) throw new Error("Table '".concat(O, "' not found"));
2911
- return g[O];
2927
+ return T.forEach(function(A) {
2928
+ return g[A.name] = A;
2929
+ }), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(A) {
2930
+ if (!g[A]) throw new Error("Table '".concat(A, "' not found"));
2931
+ return g[A];
2912
2932
  }, MIN_KEY: -1 / 0, MAX_KEY: Ut(t), schema: v };
2913
2933
  }
2914
- function Ba(e, t, n, r) {
2934
+ function ja(e, t, n, r) {
2915
2935
  var a = n.IDBKeyRange;
2916
- return n.indexedDB, { dbcore: (r = Fa(t, a, r), e.dbcore.reduce(function(u, f) {
2936
+ return n.indexedDB, { dbcore: (r = Ba(t, a, r), e.dbcore.reduce(function(u, f) {
2917
2937
  return f = f.create, i(i({}, u), f(u));
2918
2938
  }, r)) };
2919
2939
  }
2920
2940
  function fn(e, r) {
2921
- var n = r.db, r = Ba(e._middlewares, n, e._deps, r);
2941
+ var n = r.db, r = ja(e._middlewares, n, e._deps, r);
2922
2942
  e.core = r.dbcore, e.tables.forEach(function(a) {
2923
2943
  var u = a.name;
2924
2944
  e.core.schema.tables.some(function(f) {
@@ -2931,9 +2951,9 @@ function Si() {
2931
2951
  var u = r[a];
2932
2952
  t.forEach(function(f) {
2933
2953
  var p = (function v(_, T) {
2934
- return se(_, T) || (_ = j(_)) && v(_, T);
2954
+ return se(_, T) || (_ = B(_)) && v(_, T);
2935
2955
  })(f, a);
2936
- (!p || "value" in p && p.value === void 0) && (f === e.Transaction.prototype || f instanceof e.Transaction ? B(f, a, { get: function() {
2956
+ (!p || "value" in p && p.value === void 0) && (f === e.Transaction.prototype || f instanceof e.Transaction ? j(f, a, { get: function() {
2937
2957
  return this.table(a);
2938
2958
  }, set: function(v) {
2939
2959
  fe(this, a, { value: v, writable: !0, configurable: !0, enumerable: !0 });
@@ -2946,12 +2966,12 @@ function Si() {
2946
2966
  for (var r in n) n[r] instanceof e.Table && delete n[r];
2947
2967
  });
2948
2968
  }
2949
- function ja(e, t) {
2969
+ function Ma(e, t) {
2950
2970
  return e._cfg.version - t._cfg.version;
2951
2971
  }
2952
- function Ma(e, t, n, r) {
2972
+ function Ka(e, t, n, r) {
2953
2973
  var a = e._dbSchema;
2954
- n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Ln("$meta", jr("")[0], []), e._storeNames.push("$meta"));
2974
+ n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Ln("$meta", Mr("")[0], []), e._storeNames.push("$meta"));
2955
2975
  var u = e._createTransaction("readwrite", e._storeNames, a);
2956
2976
  u.create(n), u._completion.catch(r);
2957
2977
  var f = u._reject.bind(u), p = z.transless || z;
@@ -2959,11 +2979,11 @@ function Si() {
2959
2979
  return z.trans = u, z.transless = p, t !== 0 ? (fn(e, n), _ = t, ((v = u).storeNames.includes("$meta") ? v.table("$meta").get("version").then(function(T) {
2960
2980
  return T ?? _;
2961
2981
  }) : G.resolve(_)).then(function(T) {
2962
- return O = T, b = u, E = n, A = [], T = (g = e)._versions, N = g._dbSchema = pn(0, g.idbdb, E), (T = T.filter(function(I) {
2963
- return I._cfg.version >= O;
2964
- })).length !== 0 ? (T.forEach(function(I) {
2965
- A.push(function() {
2966
- var S = N, k = I._cfg.dbschema;
2982
+ return A = T, b = u, E = n, O = [], T = (g = e)._versions, N = g._dbSchema = pn(0, g.idbdb, E), (T = T.filter(function(D) {
2983
+ return D._cfg.version >= A;
2984
+ })).length !== 0 ? (T.forEach(function(D) {
2985
+ O.push(function() {
2986
+ var S = N, k = D._cfg.dbschema;
2967
2987
  mn(g, S, E), mn(g, k, E), N = g._dbSchema = k;
2968
2988
  var P = Gn(S, k);
2969
2989
  P.add.forEach(function(V) {
@@ -2979,8 +2999,8 @@ function Si() {
2979
2999
  return U.deleteIndex($);
2980
3000
  });
2981
3001
  });
2982
- var M = I._cfg.contentUpgrade;
2983
- if (M && I._cfg.version > O) {
3002
+ var M = D._cfg.contentUpgrade;
3003
+ if (M && D._cfg.version > A) {
2984
3004
  fn(g, E), b._memoizedTables = {};
2985
3005
  var L = Re(k);
2986
3006
  P.del.forEach(function(V) {
@@ -2994,22 +3014,22 @@ function Si() {
2994
3014
  return K;
2995
3015
  });
2996
3016
  }
2997
- }), A.push(function(S) {
2998
- var k, P, M = I._cfg.dbschema;
3017
+ }), O.push(function(S) {
3018
+ var k, P, M = D._cfg.dbschema;
2999
3019
  k = M, P = S, [].slice.call(P.db.objectStoreNames).forEach(function(L) {
3000
3020
  return k[L] == null && P.db.deleteObjectStore(L);
3001
3021
  }), Vn(g, [g.Transaction.prototype]), dn(g, [g.Transaction.prototype], g._storeNames, g._dbSchema), b.schema = g._dbSchema;
3002
- }), A.push(function(S) {
3003
- g.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(g.idbdb.version / 10) === I._cfg.version ? (g.idbdb.deleteObjectStore("$meta"), delete g._dbSchema.$meta, g._storeNames = g._storeNames.filter(function(k) {
3022
+ }), O.push(function(S) {
3023
+ g.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(g.idbdb.version / 10) === D._cfg.version ? (g.idbdb.deleteObjectStore("$meta"), delete g._dbSchema.$meta, g._storeNames = g._storeNames.filter(function(k) {
3004
3024
  return k !== "$meta";
3005
- })) : S.objectStore("$meta").put(I._cfg.version, "version"));
3025
+ })) : S.objectStore("$meta").put(D._cfg.version, "version"));
3006
3026
  });
3007
- }), (function I() {
3008
- return A.length ? G.resolve(A.shift()(b.idbtrans)).then(I) : G.resolve();
3027
+ }), (function D() {
3028
+ return O.length ? G.resolve(O.shift()(b.idbtrans)).then(D) : G.resolve();
3009
3029
  })().then(function() {
3010
- Br(N, E);
3030
+ jr(N, E);
3011
3031
  })) : G.resolve();
3012
- var g, O, b, E, A, N;
3032
+ var g, A, b, E, O, N;
3013
3033
  }).catch(f)) : (y(a).forEach(function(T) {
3014
3034
  $n(n, T, a[T].primKey, a[T].indexes);
3015
3035
  }), fn(e, n), void G.follow(function() {
@@ -3018,8 +3038,8 @@ function Si() {
3018
3038
  var v, _;
3019
3039
  });
3020
3040
  }
3021
- function Ka(e, t) {
3022
- Br(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");
3041
+ function qa(e, t) {
3042
+ jr(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");
3023
3043
  var n = pn(0, e.idbdb, t);
3024
3044
  mn(e, e._dbSchema, t);
3025
3045
  for (var r = 0, a = Gn(n, e._dbSchema).change; r < a.length; r++) {
@@ -3060,7 +3080,7 @@ function Si() {
3060
3080
  return hn(a, u);
3061
3081
  }), a;
3062
3082
  }
3063
- function Br(e, t) {
3083
+ function jr(e, t) {
3064
3084
  y(e).forEach(function(n) {
3065
3085
  t.db.objectStoreNames.contains(n) || (ke && console.debug("Dexie: Creating missing table", n), $n(t, n, e[n].primKey, e[n].indexes));
3066
3086
  });
@@ -3071,7 +3091,7 @@ function Si() {
3071
3091
  function pn(e, t, n) {
3072
3092
  var r = {};
3073
3093
  return xe(t.objectStoreNames, 0).forEach(function(a) {
3074
- for (var u = n.objectStore(a), f = qn(Pr(_ = u.keyPath), _ || "", !0, !1, !!u.autoIncrement, _ && typeof _ != "string", !0), p = [], v = 0; v < u.indexNames.length; ++v) {
3094
+ for (var u = n.objectStore(a), f = qn(Fr(_ = u.keyPath), _ || "", !0, !1, !!u.autoIncrement, _ && typeof _ != "string", !0), p = [], v = 0; v < u.indexNames.length; ++v) {
3075
3095
  var T = u.index(u.indexNames[v]), _ = T.keyPath, T = qn(T.name, _, !!T.unique, !!T.multiEntry, !1, _ && typeof _ != "string", !1);
3076
3096
  p.push(T);
3077
3097
  }
@@ -3089,13 +3109,13 @@ function Si() {
3089
3109
  }
3090
3110
  typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && h.WorkerGlobalScope && h instanceof h.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
3091
3111
  }
3092
- function jr(e) {
3112
+ function Mr(e) {
3093
3113
  return e.split(",").map(function(t, n) {
3094
3114
  var u = t.split(":"), r = (a = u[1]) === null || a === void 0 ? void 0 : a.trim(), a = (t = u[0].trim()).replace(/([&*]|\+\+)/g, ""), u = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
3095
3115
  return qn(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), w(u), n === 0, r);
3096
3116
  });
3097
3117
  }
3098
- var qa = (Ot.prototype._createTableSchema = Ln, Ot.prototype._parseIndexSyntax = jr, Ot.prototype._parseStoresSpec = function(e, t) {
3118
+ var La = (At.prototype._createTableSchema = Ln, At.prototype._parseIndexSyntax = Mr, At.prototype._parseStoresSpec = function(e, t) {
3099
3119
  var n = this;
3100
3120
  y(e).forEach(function(r) {
3101
3121
  if (e[r] !== null) {
@@ -3108,17 +3128,17 @@ function Si() {
3108
3128
  }), a = n._createTableSchema(r, u, a), t[r] = a;
3109
3129
  }
3110
3130
  });
3111
- }, Ot.prototype.stores = function(n) {
3131
+ }, At.prototype.stores = function(n) {
3112
3132
  var t = this.db;
3113
3133
  this._cfg.storesSource = this._cfg.storesSource ? R(this._cfg.storesSource, n) : n;
3114
3134
  var n = t._versions, r = {}, a = {};
3115
3135
  return n.forEach(function(u) {
3116
3136
  R(r, u._cfg.storesSource), a = u._cfg.dbschema = {}, u._parseStoresSpec(r, a);
3117
3137
  }), t._dbSchema = a, Vn(t, [t._allTables, t, t.Transaction.prototype]), dn(t, [t._allTables, t, t.Transaction.prototype, this._cfg.tables], y(a), a), t._storeNames = y(a), this;
3118
- }, Ot.prototype.upgrade = function(e) {
3138
+ }, At.prototype.upgrade = function(e) {
3119
3139
  return this._cfg.contentUpgrade = wt(this._cfg.contentUpgrade || Q, e), this;
3120
- }, Ot);
3121
- function Ot() {
3140
+ }, At);
3141
+ function At() {
3122
3142
  }
3123
3143
  function Xn(e, t) {
3124
3144
  var n = e._dbNamesDB;
@@ -3148,8 +3168,8 @@ function Si() {
3148
3168
  if (0 < r) throw RangeError();
3149
3169
  if (zn(e)) return R(e, { from: t, to: n, d: 1 });
3150
3170
  var a = e.l, r = e.r;
3151
- if (re(n, e.from) < 0) return a ? Gt(a, t, n) : e.l = { from: t, to: n, d: 1, l: null, r: null }, Kr(e);
3152
- if (0 < re(t, e.to)) return r ? Gt(r, t, n) : e.r = { from: t, to: n, d: 1, l: null, r: null }, Kr(e);
3171
+ if (re(n, e.from) < 0) return a ? Gt(a, t, n) : e.l = { from: t, to: n, d: 1, l: null, r: null }, qr(e);
3172
+ if (0 < re(t, e.to)) return r ? Gt(r, t, n) : e.r = { from: t, to: n, d: 1, l: null, r: null }, qr(e);
3153
3173
  re(t, e.from) < 0 && (e.from = t, e.l = null, e.d = r ? r.d + 1 : 1), 0 < re(n, e.to) && (e.to = n, e.r = null, e.d = e.l ? e.l.d + 1 : 1), n = !e.r, a && !e.l && $t(e, a), r && n && $t(e, r);
3154
3174
  }
3155
3175
  }
@@ -3159,7 +3179,7 @@ function Si() {
3159
3179
  Gt(r, u, f), p && n(r, p), v && n(r, v);
3160
3180
  })(e, t);
3161
3181
  }
3162
- function Mr(e, t) {
3182
+ function Kr(e, t) {
3163
3183
  var n = gn(t), r = n.next();
3164
3184
  if (r.done) return !1;
3165
3185
  for (var a = r.value, u = gn(e), f = u.next(a.from), p = f.value; !r.done && !f.done; ) {
@@ -3188,11 +3208,11 @@ function Si() {
3188
3208
  return { done: !0 };
3189
3209
  } };
3190
3210
  }
3191
- function Kr(e) {
3211
+ function qr(e) {
3192
3212
  var t, n, r = (((t = e.r) === null || t === void 0 ? void 0 : t.d) || 0) - (((n = e.l) === null || n === void 0 ? void 0 : n.d) || 0), a = 1 < r ? "r" : r < -1 ? "l" : "";
3193
- a && (t = a == "r" ? "l" : "r", n = i({}, e), r = e[a], e.from = r.from, e.to = r.to, e[a] = r[a], n[a] = r[t], (e[t] = n).d = qr(n)), e.d = qr(e);
3213
+ a && (t = a == "r" ? "l" : "r", n = i({}, e), r = e[a], e.from = r.from, e.to = r.to, e[a] = r[a], n[a] = r[t], (e[t] = n).d = Lr(n)), e.d = Lr(e);
3194
3214
  }
3195
- function qr(n) {
3215
+ function Lr(n) {
3196
3216
  var t = n.r, n = n.l;
3197
3217
  return (t ? n ? Math.max(t.d, n.d) : t.d : n ? n.d : 0) + 1;
3198
3218
  }
@@ -3207,7 +3227,7 @@ function Si() {
3207
3227
  }
3208
3228
  function Qn(e, t) {
3209
3229
  return e.all || t.all || Object.keys(e).some(function(n) {
3210
- return t[n] && Mr(t[n], e[n]);
3230
+ return t[n] && Kr(t[n], e[n]);
3211
3231
  });
3212
3232
  }
3213
3233
  J(Ce.prototype, ((Me = { add: function(e) {
@@ -3234,31 +3254,31 @@ function Si() {
3234
3254
  function Jn(e, t) {
3235
3255
  t === void 0 && (t = !1);
3236
3256
  var n = /* @__PURE__ */ new Set();
3237
- if (e.all) for (var r = 0, a = Object.values(gt); r < a.length; r++) Lr(f = a[r], e, n, t);
3257
+ if (e.all) for (var r = 0, a = Object.values(gt); r < a.length; r++) Ur(f = a[r], e, n, t);
3238
3258
  else for (var u in e) {
3239
3259
  var f, p = /^idb\:\/\/(.*)\/(.*)\//.exec(u);
3240
- p && (u = p[1], p = p[2], (f = gt["idb://".concat(u, "/").concat(p)]) && Lr(f, e, n, t));
3260
+ p && (u = p[1], p = p[2], (f = gt["idb://".concat(u, "/").concat(p)]) && Ur(f, e, n, t));
3241
3261
  }
3242
3262
  n.forEach(function(v) {
3243
3263
  return v();
3244
3264
  });
3245
3265
  }
3246
- function Lr(e, t, n, r) {
3266
+ function Ur(e, t, n, r) {
3247
3267
  for (var a = [], u = 0, f = Object.entries(e.queries.query); u < f.length; u++) {
3248
3268
  for (var p = f[u], v = p[0], _ = [], T = 0, g = p[1]; T < g.length; T++) {
3249
- var O = g[T];
3250
- Qn(t, O.obsSet) ? O.subscribers.forEach(function(N) {
3269
+ var A = g[T];
3270
+ Qn(t, A.obsSet) ? A.subscribers.forEach(function(N) {
3251
3271
  return n.add(N);
3252
- }) : r && _.push(O);
3272
+ }) : r && _.push(A);
3253
3273
  }
3254
3274
  r && a.push([v, _]);
3255
3275
  }
3256
3276
  if (r) for (var b = 0, E = a; b < E.length; b++) {
3257
- var A = E[b], v = A[0], _ = A[1];
3277
+ var O = E[b], v = O[0], _ = O[1];
3258
3278
  e.queries.query[v] = _;
3259
3279
  }
3260
3280
  }
3261
- function La(e) {
3281
+ function Ua(e) {
3262
3282
  var t = e._state, n = e._deps.indexedDB;
3263
3283
  if (t.isBeingOpened || e.idbdb) return t.dbReadyPromise.then(function() {
3264
3284
  return t.dbOpenError ? be(t.dbOpenError) : e;
@@ -3269,24 +3289,24 @@ function Si() {
3269
3289
  if (t.openCanceller !== r) throw new C.DatabaseClosed("db.open() was cancelled");
3270
3290
  }
3271
3291
  function p() {
3272
- return new G(function(O, b) {
3292
+ return new G(function(A, b) {
3273
3293
  if (f(), !n) throw new C.MissingAPI();
3274
- var E = e.name, A = t.autoSchema || !a ? n.open(E) : n.open(E, a);
3275
- if (!A) throw new C.MissingAPI();
3276
- A.onerror = Ge(b), A.onblocked = ge(e._fireOnBlocked), A.onupgradeneeded = ge(function(N) {
3277
- var I;
3278
- T = A.transaction, t.autoSchema && !e._options.allowEmptyDB ? (A.onerror = qt, T.abort(), A.result.close(), (I = n.deleteDatabase(E)).onsuccess = I.onerror = ge(function() {
3294
+ var E = e.name, O = t.autoSchema || !a ? n.open(E) : n.open(E, a);
3295
+ if (!O) throw new C.MissingAPI();
3296
+ O.onerror = Ge(b), O.onblocked = ge(e._fireOnBlocked), O.onupgradeneeded = ge(function(N) {
3297
+ var D;
3298
+ T = O.transaction, t.autoSchema && !e._options.allowEmptyDB ? (O.onerror = qt, T.abort(), O.result.close(), (D = n.deleteDatabase(E)).onsuccess = D.onerror = ge(function() {
3279
3299
  b(new C.NoSuchDatabase("Database ".concat(E, " doesnt exist")));
3280
- })) : (T.onerror = Ge(b), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, g = N < 1, e.idbdb = A.result, u && Ka(e, T), Ma(e, N / 10, T, b));
3281
- }, b), A.onsuccess = ge(function() {
3300
+ })) : (T.onerror = Ge(b), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, g = N < 1, e.idbdb = O.result, u && qa(e, T), Ka(e, N / 10, T, b));
3301
+ }, b), O.onsuccess = ge(function() {
3282
3302
  T = null;
3283
- var N, I, S, k, P, M = e.idbdb = A.result, L = xe(M.objectStoreNames);
3303
+ var N, D, S, k, P, M = e.idbdb = O.result, L = xe(M.objectStoreNames);
3284
3304
  if (0 < L.length) try {
3285
3305
  var K = M.transaction((k = L).length === 1 ? k[0] : k, "readonly");
3286
- if (t.autoSchema) I = M, S = K, (N = e).verno = I.version / 10, S = N._dbSchema = pn(0, I, S), N._storeNames = xe(I.objectStoreNames, 0), dn(N, [N._allTables], y(S), S);
3306
+ if (t.autoSchema) D = M, S = K, (N = e).verno = D.version / 10, S = N._dbSchema = pn(0, D, S), N._storeNames = xe(D.objectStoreNames, 0), dn(N, [N._allTables], y(S), S);
3287
3307
  else if (mn(e, e._dbSchema, K), ((P = Gn(pn(0, (P = e).idbdb, K), P._dbSchema)).add.length || P.change.some(function(q) {
3288
3308
  return q.add.length || q.change.length;
3289
- })) && !u) 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, u = !0, O(p());
3309
+ })) && !u) 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, u = !0, A(p());
3290
3310
  fn(e, K);
3291
3311
  } catch {
3292
3312
  }
@@ -3294,23 +3314,23 @@ function Si() {
3294
3314
  t.vcFired = !0, e.on("versionchange").fire(q);
3295
3315
  }), M.onclose = ge(function(q) {
3296
3316
  e.on("close").fire(q);
3297
- }), g && (P = e._deps, K = E, M = P.indexedDB, P = P.IDBKeyRange, Wn(M) || K === an || Xn(M, P).put({ name: K }).catch(Q)), O();
3317
+ }), g && (P = e._deps, K = E, M = P.indexedDB, P = P.IDBKeyRange, Wn(M) || K === an || Xn(M, P).put({ name: K }).catch(Q)), A();
3298
3318
  }, b);
3299
- }).catch(function(O) {
3300
- switch (O?.name) {
3319
+ }).catch(function(A) {
3320
+ switch (A?.name) {
3301
3321
  case "UnknownError":
3302
3322
  if (0 < t.PR1398_maxLoop) return t.PR1398_maxLoop--, console.warn("Dexie: Workaround for Chrome UnknownError on open()"), p();
3303
3323
  break;
3304
3324
  case "VersionError":
3305
3325
  if (0 < a) return a = 0, p();
3306
3326
  }
3307
- return G.reject(O);
3327
+ return G.reject(A);
3308
3328
  });
3309
3329
  }
3310
3330
  var v, _ = t.dbReadyResolve, T = null, g = !1;
3311
- 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) {
3331
+ 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(A) {
3312
3332
  function b() {
3313
- return indexedDB.databases().finally(O);
3333
+ return indexedDB.databases().finally(A);
3314
3334
  }
3315
3335
  v = setInterval(b, 100), b();
3316
3336
  }).finally(function() {
@@ -3318,32 +3338,32 @@ function Si() {
3318
3338
  }) : Promise.resolve()).then(p)]).then(function() {
3319
3339
  return f(), t.onReadyBeingFired = [], G.resolve(Yn(function() {
3320
3340
  return e.on.ready.fire(e.vip);
3321
- })).then(function O() {
3341
+ })).then(function A() {
3322
3342
  if (0 < t.onReadyBeingFired.length) {
3323
3343
  var b = t.onReadyBeingFired.reduce(wt, Q);
3324
3344
  return t.onReadyBeingFired = [], G.resolve(Yn(function() {
3325
3345
  return b(e.vip);
3326
- })).then(O);
3346
+ })).then(A);
3327
3347
  }
3328
3348
  });
3329
3349
  }).finally(function() {
3330
3350
  t.openCanceller === r && (t.onReadyBeingFired = null, t.isBeingOpened = !1);
3331
- }).catch(function(O) {
3332
- t.dbOpenError = O;
3351
+ }).catch(function(A) {
3352
+ t.dbOpenError = A;
3333
3353
  try {
3334
3354
  T && T.abort();
3335
3355
  } catch {
3336
3356
  }
3337
- return r === t.openCanceller && e._close(), be(O);
3357
+ return r === t.openCanceller && e._close(), be(A);
3338
3358
  }).finally(function() {
3339
3359
  t.openComplete = !0, _();
3340
3360
  }).then(function() {
3341
- var O;
3342
- return g && (O = {}, e.tables.forEach(function(b) {
3361
+ var A;
3362
+ return g && (A = {}, e.tables.forEach(function(b) {
3343
3363
  b.schema.indexes.forEach(function(E) {
3344
- E.name && (O["idb://".concat(e.name, "/").concat(b.name, "/").concat(E.name)] = new Ce(-1 / 0, [[[]]]));
3345
- }), O["idb://".concat(e.name, "/").concat(b.name, "/")] = O["idb://".concat(e.name, "/").concat(b.name, "/:dels")] = new Ce(-1 / 0, [[[]]]);
3346
- }), st(Lt).fire(O), Jn(O, !0)), e;
3364
+ E.name && (A["idb://".concat(e.name, "/").concat(b.name, "/").concat(E.name)] = new Ce(-1 / 0, [[[]]]));
3365
+ }), A["idb://".concat(e.name, "/").concat(b.name, "/")] = A["idb://".concat(e.name, "/").concat(b.name, "/:dels")] = new Ce(-1 / 0, [[[]]]);
3366
+ }), st(Lt).fire(A), Jn(A, !0)), e;
3347
3367
  });
3348
3368
  }
3349
3369
  function er(e) {
@@ -3365,14 +3385,14 @@ function Si() {
3365
3385
  for (var r = w(e) ? e.slice() : [e], a = 0; a < n; ++a) r.push(t);
3366
3386
  return r;
3367
3387
  }
3368
- var Ua = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3388
+ var Va = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3369
3389
  return i(i({}, e), { table: function(t) {
3370
3390
  var n = e.table(t), r = n.schema, a = {}, u = [];
3371
- function f(g, O, b) {
3372
- var E = Vt(g), A = a[E] = a[E] || [], N = g == null ? 0 : typeof g == "string" ? 1 : g.length, I = 0 < O, I = i(i({}, b), { name: I ? "".concat(E, "(virtual-from:").concat(b.name, ")") : b.name, lowLevelIndex: b, isVirtual: I, keyTail: O, keyLength: N, extractKey: Un(g), unique: !I && b.unique });
3373
- return A.push(I), I.isPrimaryKey || u.push(I), 1 < N && f(N === 2 ? g[0] : g.slice(0, N - 1), O + 1, b), A.sort(function(S, k) {
3391
+ function f(g, A, b) {
3392
+ var E = Vt(g), O = a[E] = a[E] || [], N = g == null ? 0 : typeof g == "string" ? 1 : g.length, D = 0 < A, D = i(i({}, b), { name: D ? "".concat(E, "(virtual-from:").concat(b.name, ")") : b.name, lowLevelIndex: b, isVirtual: D, keyTail: A, keyLength: N, extractKey: Un(g), unique: !D && b.unique });
3393
+ return O.push(D), D.isPrimaryKey || u.push(D), 1 < N && f(N === 2 ? g[0] : g.slice(0, N - 1), A + 1, b), O.sort(function(S, k) {
3374
3394
  return S.keyTail - k.keyTail;
3375
- }), I;
3395
+ }), D;
3376
3396
  }
3377
3397
  t = f(r.primaryKey.keyPath, 0, r.primaryKey), a[":id"] = [t];
3378
3398
  for (var p = 0, v = r.indexes; p < v.length; p++) {
@@ -3380,8 +3400,8 @@ function Si() {
3380
3400
  f(_.keyPath, 0, _);
3381
3401
  }
3382
3402
  function T(g) {
3383
- var O, b = g.query.index;
3384
- return b.isVirtual ? i(i({}, g), { query: { index: b.lowLevelIndex, range: (O = g.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 }) } }) : g;
3403
+ var A, b = g.query.index;
3404
+ return b.isVirtual ? i(i({}, g), { query: { index: b.lowLevelIndex, range: (A = g.query.range, b = b.keyTail, { type: A.type === 1 ? 2 : A.type, lower: bn(A.lower, A.lowerOpen ? e.MAX_KEY : e.MIN_KEY, b), lowerOpen: !0, upper: bn(A.upper, A.upperOpen ? e.MIN_KEY : e.MAX_KEY, b), upperOpen: !0 }) } }) : g;
3385
3405
  }
3386
3406
  return i(i({}, n), { schema: i(i({}, r), { primaryKey: t, indexes: u, getIndexByKeyPath: function(g) {
3387
3407
  return (g = a[Vt(g)]) && g[0];
@@ -3390,22 +3410,22 @@ function Si() {
3390
3410
  }, query: function(g) {
3391
3411
  return n.query(T(g));
3392
3412
  }, openCursor: function(g) {
3393
- var O = g.query.index, b = O.keyTail, E = O.isVirtual, A = O.keyLength;
3394
- return E ? n.openCursor(T(g)).then(function(I) {
3395
- return I && N(I);
3413
+ var A = g.query.index, b = A.keyTail, E = A.isVirtual, O = A.keyLength;
3414
+ return E ? n.openCursor(T(g)).then(function(D) {
3415
+ return D && N(D);
3396
3416
  }) : n.openCursor(g);
3397
- function N(I) {
3398
- return Object.create(I, { continue: { value: function(S) {
3399
- S != null ? I.continue(bn(S, g.reverse ? e.MAX_KEY : e.MIN_KEY, b)) : g.unique ? I.continue(I.key.slice(0, A).concat(g.reverse ? e.MIN_KEY : e.MAX_KEY, b)) : I.continue();
3417
+ function N(D) {
3418
+ return Object.create(D, { continue: { value: function(S) {
3419
+ S != null ? D.continue(bn(S, g.reverse ? e.MAX_KEY : e.MIN_KEY, b)) : g.unique ? D.continue(D.key.slice(0, O).concat(g.reverse ? e.MIN_KEY : e.MAX_KEY, b)) : D.continue();
3400
3420
  } }, continuePrimaryKey: { value: function(S, k) {
3401
- I.continuePrimaryKey(bn(S, e.MAX_KEY, b), k);
3421
+ D.continuePrimaryKey(bn(S, e.MAX_KEY, b), k);
3402
3422
  } }, primaryKey: { get: function() {
3403
- return I.primaryKey;
3423
+ return D.primaryKey;
3404
3424
  } }, key: { get: function() {
3405
- var S = I.key;
3406
- return A === 1 ? S[0] : S.slice(0, A);
3425
+ var S = D.key;
3426
+ return O === 1 ? S[0] : S.slice(0, O);
3407
3427
  } }, value: { get: function() {
3408
- return I.value;
3428
+ return D.value;
3409
3429
  } } });
3410
3430
  }
3411
3431
  } });
@@ -3422,7 +3442,7 @@ function Si() {
3422
3442
  function nr(e, t) {
3423
3443
  return t.type === "delete" ? t.keys : t.keys || t.values.map(e.extractKey);
3424
3444
  }
3425
- var Va = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
3445
+ var Ga = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
3426
3446
  return i(i({}, e), { table: function(t) {
3427
3447
  var n = e.table(t), r = n.schema.primaryKey;
3428
3448
  return i(i({}, n), { mutate: function(a) {
@@ -3446,11 +3466,11 @@ function Si() {
3446
3466
  case "deleteRange":
3447
3467
  if (p.fire === Q) break;
3448
3468
  return u._promise("readwrite", function() {
3449
- return (function g(O, b, E) {
3450
- return n.query({ trans: O, values: !1, query: { index: r, range: b }, limit: E }).then(function(A) {
3451
- var N = A.result;
3452
- return T({ type: "delete", keys: N, trans: O }).then(function(I) {
3453
- return 0 < I.numFailures ? Promise.reject(I.failures[0]) : N.length < E ? { failures: [], numFailures: 0, lastResult: void 0 } : g(O, i(i({}, b), { lower: N[N.length - 1], lowerOpen: !0 }), E);
3469
+ return (function g(A, b, E) {
3470
+ return n.query({ trans: A, values: !1, query: { index: r, range: b }, limit: E }).then(function(O) {
3471
+ var N = O.result;
3472
+ return T({ type: "delete", keys: N, trans: A }).then(function(D) {
3473
+ return 0 < D.numFailures ? Promise.reject(D.failures[0]) : N.length < E ? { failures: [], numFailures: 0, lastResult: void 0 } : g(A, i(i({}, b), { lower: N[N.length - 1], lowerOpen: !0 }), E);
3454
3474
  });
3455
3475
  });
3456
3476
  })(a.trans, a.range, 1e4);
@@ -3458,19 +3478,19 @@ function Si() {
3458
3478
  }
3459
3479
  return n.mutate(a);
3460
3480
  function T(g) {
3461
- var O, b, E, A = z.trans, N = g.keys || nr(r, g);
3481
+ var A, b, E, O = z.trans, N = g.keys || nr(r, g);
3462
3482
  if (!N) throw new Error("Keys missing");
3463
- return (g = g.type === "add" || g.type === "put" ? i(i({}, g), { keys: N }) : i({}, g)).type !== "delete" && (g.values = d([], g.values)), g.keys && (g.keys = d([], g.keys)), O = n, E = N, ((b = g).type === "add" ? Promise.resolve([]) : O.getMany({ trans: b.trans, keys: E, cache: "immutable" })).then(function(I) {
3483
+ return (g = g.type === "add" || g.type === "put" ? i(i({}, g), { keys: N }) : i({}, g)).type !== "delete" && (g.values = d([], g.values)), g.keys && (g.keys = d([], g.keys)), A = n, E = N, ((b = g).type === "add" ? Promise.resolve([]) : A.getMany({ trans: b.trans, keys: E, cache: "immutable" })).then(function(D) {
3464
3484
  var S = N.map(function(k, P) {
3465
- var M, L, K, q = I[P], V = { onerror: null, onsuccess: null };
3466
- return g.type === "delete" ? p.fire.call(V, k, q, A) : g.type === "add" || q === void 0 ? (M = v.fire.call(V, k, g.values[P], A), k == null && M != null && (g.keys[P] = k = M, r.outbound || ne(g.values[P], r.keyPath, k))) : (M = tr(q, g.values[P]), (L = _.fire.call(V, M, k, q, A)) && (K = g.values[P], Object.keys(L).forEach(function(U) {
3485
+ var M, L, K, q = D[P], V = { onerror: null, onsuccess: null };
3486
+ return g.type === "delete" ? p.fire.call(V, k, q, O) : g.type === "add" || q === void 0 ? (M = v.fire.call(V, k, g.values[P], O), k == null && M != null && (g.keys[P] = k = M, r.outbound || ne(g.values[P], r.keyPath, k))) : (M = tr(q, g.values[P]), (L = _.fire.call(V, M, k, q, O)) && (K = g.values[P], Object.keys(L).forEach(function(U) {
3467
3487
  W(K, U) ? K[U] = L[U] : ne(K, U, L[U]);
3468
3488
  }))), V;
3469
3489
  });
3470
3490
  return n.mutate(g).then(function(k) {
3471
3491
  for (var P = k.failures, M = k.results, L = k.numFailures, k = k.lastResult, K = 0; K < N.length; ++K) {
3472
3492
  var q = (M || N)[K], V = S[K];
3473
- q == null ? V.onerror && V.onerror(P[K]) : V.onsuccess && V.onsuccess(g.type === "put" && I[K] ? g.values[K] : q);
3493
+ q == null ? V.onerror && V.onerror(P[K]) : V.onsuccess && V.onsuccess(g.type === "put" && D[K] ? g.values[K] : q);
3474
3494
  }
3475
3495
  return { failures: P, results: M, numFailures: L, lastResult: k };
3476
3496
  }).catch(function(k) {
@@ -3483,7 +3503,7 @@ function Si() {
3483
3503
  } });
3484
3504
  } });
3485
3505
  } };
3486
- function Ur(e, t, n) {
3506
+ function Vr(e, t, n) {
3487
3507
  try {
3488
3508
  if (!t || t.keys.length < e.length) return null;
3489
3509
  for (var r = [], a = 0, u = 0; a < t.keys.length && u < e.length; ++a) re(t.keys[a], e[u]) === 0 && (r.push(n ? Pe(t.values[a]) : t.values[a]), ++u);
@@ -3492,12 +3512,12 @@ function Si() {
3492
3512
  return null;
3493
3513
  }
3494
3514
  }
3495
- var Ga = { stack: "dbcore", level: -1, create: function(e) {
3515
+ var $a = { stack: "dbcore", level: -1, create: function(e) {
3496
3516
  return { table: function(t) {
3497
3517
  var n = e.table(t);
3498
3518
  return i(i({}, n), { getMany: function(r) {
3499
3519
  if (!r.cache) return n.getMany(r);
3500
- var a = Ur(r.keys, r.trans._cache, r.cache === "clone");
3520
+ var a = Vr(r.keys, r.trans._cache, r.cache === "clone");
3501
3521
  return a ? G.resolve(a) : n.getMany(r).then(function(u) {
3502
3522
  return r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? Pe(u) : u }, u;
3503
3523
  });
@@ -3506,10 +3526,10 @@ function Si() {
3506
3526
  } });
3507
3527
  } };
3508
3528
  } };
3509
- function Vr(e, t) {
3529
+ function Gr(e, t) {
3510
3530
  return e.trans.mode === "readonly" && !!e.subscr && !e.trans.explicit && e.trans.db._options.cache !== "disabled" && !t.schema.primaryKey.outbound;
3511
3531
  }
3512
- function Gr(e, t) {
3532
+ function $r(e, t) {
3513
3533
  switch (e) {
3514
3534
  case "query":
3515
3535
  return t.values && !t.unique;
@@ -3520,7 +3540,7 @@ function Si() {
3520
3540
  return !1;
3521
3541
  }
3522
3542
  }
3523
- var $a = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3543
+ var Xa = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3524
3544
  var t = e.schema.name, n = new Ce(e.MIN_KEY, e.MAX_KEY);
3525
3545
  return i(i({}, e), { transaction: function(r, a, u) {
3526
3546
  if (z.subscr && a !== "readonly") throw new C.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(z.querier));
@@ -3532,11 +3552,11 @@ function Si() {
3532
3552
  function E(U) {
3533
3553
  return U = "idb://".concat(t, "/").concat(r, "/").concat(U), k[U] || (k[U] = new Ce());
3534
3554
  }
3535
- var A, N, I, S = b.trans, k = b.mutatedParts || (b.mutatedParts = {}), P = E(""), M = E(":dels"), L = b.type, V = b.type === "deleteRange" ? [b.range] : b.type === "delete" ? [b.keys] : b.values.length < 50 ? [nr(f, b).filter(function(U) {
3555
+ var O, N, D, S = b.trans, k = b.mutatedParts || (b.mutatedParts = {}), P = E(""), M = E(":dels"), L = b.type, V = b.type === "deleteRange" ? [b.range] : b.type === "delete" ? [b.keys] : b.values.length < 50 ? [nr(f, b).filter(function(U) {
3536
3556
  return U;
3537
3557
  }), b.values] : [], K = V[0], q = V[1], V = b.trans._cache;
3538
- return w(K) ? (P.addKeys(K), (V = L === "delete" || K.length === q.length ? Ur(K, V) : null) || M.addKeys(K), (V || q) && (A = E, N = V, I = q, u.indexes.forEach(function(U) {
3539
- var $ = A(U.name || "");
3558
+ return w(K) ? (P.addKeys(K), (V = L === "delete" || K.length === q.length ? Vr(K, V) : null) || M.addKeys(K), (V || q) && (O = E, N = V, D = q, u.indexes.forEach(function(U) {
3559
+ var $ = O(U.name || "");
3540
3560
  function te(Z) {
3541
3561
  return Z != null ? U.extractKey(Z) : null;
3542
3562
  }
@@ -3545,9 +3565,9 @@ function Si() {
3545
3565
  return $.addKey(ve);
3546
3566
  }) : $.addKey(Z);
3547
3567
  }
3548
- (N || I).forEach(function(Z, Ie) {
3549
- var H = N && te(N[Ie]), Ie = I && te(I[Ie]);
3550
- re(H, Ie) !== 0 && (H != null && oe(H), Ie != null && oe(Ie));
3568
+ (N || D).forEach(function(Z, De) {
3569
+ var H = N && te(N[De]), De = D && te(D[De]);
3570
+ re(H, De) !== 0 && (H != null && oe(H), De != null && oe(De));
3551
3571
  });
3552
3572
  }))) : 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), P.add(q)) : (P.add(n), M.add(n), u.indexes.forEach(function(U) {
3553
3573
  return E(U.name).add(n);
@@ -3562,21 +3582,21 @@ function Si() {
3562
3582
  })), S.mutatedParts = yn(S.mutatedParts || {}, k), U;
3563
3583
  });
3564
3584
  } }), g = function(E) {
3565
- var A = E.query, E = A.index, A = A.range;
3566
- return [E, new Ce((E = A.lower) !== null && E !== void 0 ? E : e.MIN_KEY, (A = A.upper) !== null && A !== void 0 ? A : e.MAX_KEY)];
3567
- }, O = { get: function(b) {
3585
+ var O = E.query, E = O.index, O = O.range;
3586
+ return [E, new Ce((E = O.lower) !== null && E !== void 0 ? E : e.MIN_KEY, (O = O.upper) !== null && O !== void 0 ? O : e.MAX_KEY)];
3587
+ }, A = { get: function(b) {
3568
3588
  return [f, new Ce(b.key)];
3569
3589
  }, getMany: function(b) {
3570
3590
  return [f, new Ce().addKeys(b.keys)];
3571
3591
  }, count: g, query: g, openCursor: g };
3572
- return y(O).forEach(function(b) {
3592
+ return y(A).forEach(function(b) {
3573
3593
  T[b] = function(E) {
3574
- var A = z.subscr, N = !!A, I = Vr(z, a) && Gr(b, E) ? E.obsSet = {} : A;
3594
+ var O = z.subscr, N = !!O, D = Gr(z, a) && $r(b, E) ? E.obsSet = {} : O;
3575
3595
  if (N) {
3576
3596
  var S = function(q) {
3577
- return q = "idb://".concat(t, "/").concat(r, "/").concat(q), I[q] || (I[q] = new Ce());
3578
- }, k = S(""), P = S(":dels"), A = O[b](E), N = A[0], A = A[1];
3579
- if ((b === "query" && N.isPrimaryKey && !E.values ? P : S(N.name || "")).add(A), !N.isPrimaryKey) {
3597
+ return q = "idb://".concat(t, "/").concat(r, "/").concat(q), D[q] || (D[q] = new Ce());
3598
+ }, k = S(""), P = S(":dels"), O = A[b](E), N = O[0], O = O[1];
3599
+ if ((b === "query" && N.isPrimaryKey && !E.values ? P : S(N.name || "")).add(O), !N.isPrimaryKey) {
3580
3600
  if (b !== "count") {
3581
3601
  var M = b === "query" && v && E.values && a.query(i(i({}, E), { values: !1 }));
3582
3602
  return a[b].apply(this, arguments).then(function(q) {
@@ -3608,7 +3628,7 @@ function Si() {
3608
3628
  }), T;
3609
3629
  } });
3610
3630
  } };
3611
- function $r(e, t, n) {
3631
+ function Xr(e, t, n) {
3612
3632
  if (n.numFailures === 0) return t;
3613
3633
  if (t.type === "deleteRange") return null;
3614
3634
  var r = t.keys ? t.keys.length : "values" in t && t.values ? t.values.length : 1;
@@ -3622,21 +3642,21 @@ function Si() {
3622
3642
  return n = e, ((r = t).lower === void 0 || (r.lowerOpen ? 0 < re(n, r.lower) : 0 <= re(n, r.lower))) && (e = e, (t = t).upper === void 0 || (t.upperOpen ? re(e, t.upper) < 0 : re(e, t.upper) <= 0));
3623
3643
  var n, r;
3624
3644
  }
3625
- function Xr(e, t, O, r, a, u) {
3626
- if (!O || O.length === 0) return e;
3627
- var f = t.query.index, p = f.multiEntry, v = t.query.range, _ = r.schema.primaryKey.extractKey, T = f.extractKey, g = (f.lowLevelIndex || f).extractKey, O = O.reduce(function(b, E) {
3628
- var A = b, N = [];
3629
- if (E.type === "add" || E.type === "put") for (var I = new Ce(), S = E.values.length - 1; 0 <= S; --S) {
3645
+ function Wr(e, t, A, r, a, u) {
3646
+ if (!A || A.length === 0) return e;
3647
+ var f = t.query.index, p = f.multiEntry, v = t.query.range, _ = r.schema.primaryKey.extractKey, T = f.extractKey, g = (f.lowLevelIndex || f).extractKey, A = A.reduce(function(b, E) {
3648
+ var O = b, N = [];
3649
+ if (E.type === "add" || E.type === "put") for (var D = new Ce(), S = E.values.length - 1; 0 <= S; --S) {
3630
3650
  var k, P = E.values[S], M = _(P);
3631
- I.hasKey(M) || (k = T(P), (p && w(k) ? k.some(function(U) {
3651
+ D.hasKey(M) || (k = T(P), (p && w(k) ? k.some(function(U) {
3632
3652
  return rr(U, v);
3633
- }) : rr(k, v)) && (I.addKey(M), N.push(P)));
3653
+ }) : rr(k, v)) && (D.addKey(M), N.push(P)));
3634
3654
  }
3635
3655
  switch (E.type) {
3636
3656
  case "add":
3637
3657
  var L = new Ce().addKeys(t.values ? b.map(function($) {
3638
3658
  return _($);
3639
- }) : b), A = b.concat(t.values ? N.filter(function($) {
3659
+ }) : b), O = b.concat(t.values ? N.filter(function($) {
3640
3660
  return $ = _($), !L.hasKey($) && (L.addKey($), !0);
3641
3661
  }) : N.map(function($) {
3642
3662
  return _($);
@@ -3648,7 +3668,7 @@ function Si() {
3648
3668
  var K = new Ce().addKeys(E.values.map(function($) {
3649
3669
  return _($);
3650
3670
  }));
3651
- A = b.filter(function($) {
3671
+ O = b.filter(function($) {
3652
3672
  return !K.hasKey(t.values ? _($) : $);
3653
3673
  }).concat(t.values ? N : N.map(function($) {
3654
3674
  return _($);
@@ -3656,26 +3676,26 @@ function Si() {
3656
3676
  break;
3657
3677
  case "delete":
3658
3678
  var q = new Ce().addKeys(E.keys);
3659
- A = b.filter(function($) {
3679
+ O = b.filter(function($) {
3660
3680
  return !q.hasKey(t.values ? _($) : $);
3661
3681
  });
3662
3682
  break;
3663
3683
  case "deleteRange":
3664
3684
  var V = E.range;
3665
- A = b.filter(function($) {
3685
+ O = b.filter(function($) {
3666
3686
  return !rr(_($), V);
3667
3687
  });
3668
3688
  }
3669
- return A;
3689
+ return O;
3670
3690
  }, e);
3671
- return O === e ? e : (O.sort(function(b, E) {
3691
+ return A === e ? e : (A.sort(function(b, E) {
3672
3692
  return re(g(b), g(E)) || re(_(b), _(E));
3673
- }), 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)), u ? Object.freeze(O) : O);
3693
+ }), t.limit && t.limit < 1 / 0 && (A.length > t.limit ? A.length = t.limit : e.length === t.limit && A.length < t.limit && (a.dirty = !0)), u ? Object.freeze(A) : A);
3674
3694
  }
3675
- function Wr(e, t) {
3695
+ function Yr(e, t) {
3676
3696
  return re(e.lower, t.lower) === 0 && re(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
3677
3697
  }
3678
- function Xa(e, t) {
3698
+ function Wa(e, t) {
3679
3699
  return (function(n, r, a, u) {
3680
3700
  if (n === void 0) return r !== void 0 ? -1 : 0;
3681
3701
  if (r === void 0) return 1;
@@ -3696,7 +3716,7 @@ function Si() {
3696
3716
  return r;
3697
3717
  })(e.upper, t.upper, e.upperOpen, t.upperOpen);
3698
3718
  }
3699
- function Wa(e, t, n, r) {
3719
+ function Ya(e, t, n, r) {
3700
3720
  e.subscribers.add(n), r.addEventListener("abort", function() {
3701
3721
  var a, u;
3702
3722
  e.subscribers.delete(n), e.subscribers.size === 0 && (a = e, u = t, setTimeout(function() {
@@ -3704,7 +3724,7 @@ function Si() {
3704
3724
  }, 3e3));
3705
3725
  });
3706
3726
  }
3707
- var Ya = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
3727
+ var za = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
3708
3728
  var t = e.schema.name;
3709
3729
  return i(i({}, e), { transaction: function(n, r, a) {
3710
3730
  var u, f, p = e.transaction(n, r, a);
@@ -3712,19 +3732,19 @@ function Si() {
3712
3732
  return function() {
3713
3733
  if (u.abort(), r === "readwrite") {
3714
3734
  for (var _ = /* @__PURE__ */ new Set(), T = 0, g = n; T < g.length; T++) {
3715
- var O = g[T], b = gt["idb://".concat(t, "/").concat(O)];
3735
+ var A = g[T], b = gt["idb://".concat(t, "/").concat(A)];
3716
3736
  if (b) {
3717
- var E = e.table(O), A = b.optimisticOps.filter(function($) {
3737
+ var E = e.table(A), O = b.optimisticOps.filter(function($) {
3718
3738
  return $.trans === p;
3719
3739
  });
3720
- if (p._explicit && v && p.mutatedParts) for (var N = 0, I = Object.values(b.queries.query); N < I.length; N++) for (var S = 0, k = (L = I[N]).slice(); S < k.length; S++) Qn((K = k[S]).obsSet, p.mutatedParts) && (Xe(L, K), K.subscribers.forEach(function($) {
3740
+ if (p._explicit && v && p.mutatedParts) for (var N = 0, D = Object.values(b.queries.query); N < D.length; N++) for (var S = 0, k = (L = D[N]).slice(); S < k.length; S++) Qn((K = k[S]).obsSet, p.mutatedParts) && (Xe(L, K), K.subscribers.forEach(function($) {
3721
3741
  return _.add($);
3722
3742
  }));
3723
- else if (0 < A.length) {
3743
+ else if (0 < O.length) {
3724
3744
  b.optimisticOps = b.optimisticOps.filter(function($) {
3725
3745
  return $.trans !== p;
3726
3746
  });
3727
- for (var P = 0, M = Object.values(b.queries.query); P < M.length; P++) for (var L, K, q, V = 0, U = (L = M[P]).slice(); V < U.length; V++) (K = U[V]).res != null && p.mutatedParts && (v && !K.dirty ? (q = Object.isFrozen(K.res), q = Xr(K.res, K.req, A, E, K, q), K.dirty ? (Xe(L, K), K.subscribers.forEach(function($) {
3747
+ for (var P = 0, M = Object.values(b.queries.query); P < M.length; P++) for (var L, K, q, V = 0, U = (L = M[P]).slice(); V < U.length; V++) (K = U[V]).res != null && p.mutatedParts && (v && !K.dirty ? (q = Object.isFrozen(K.res), q = Wr(K.res, K.req, O, E, K, q), K.dirty ? (Xe(L, K), K.subscribers.forEach(function($) {
3728
3748
  return _.add($);
3729
3749
  })) : q !== K.res && (K.res = q, K.promise = G.resolve({ result: q }))) : (K.dirty && Xe(L, K), K.subscribers.forEach(function($) {
3730
3750
  return _.add($);
@@ -3747,51 +3767,51 @@ function Si() {
3747
3767
  return p ? (f = r.mutate(u), u.type !== "add" && u.type !== "put" || !(50 <= u.values.length || nr(a, u).some(function(v) {
3748
3768
  return v == null;
3749
3769
  })) ? (p.optimisticOps.push(u), u.mutatedParts && vn(u.mutatedParts), f.then(function(v) {
3750
- 0 < v.numFailures && (Xe(p.optimisticOps, u), (v = $r(0, u, v)) && p.optimisticOps.push(v), u.mutatedParts && vn(u.mutatedParts));
3770
+ 0 < v.numFailures && (Xe(p.optimisticOps, u), (v = Xr(0, u, v)) && p.optimisticOps.push(v), u.mutatedParts && vn(u.mutatedParts));
3751
3771
  }), f.catch(function() {
3752
3772
  Xe(p.optimisticOps, u), u.mutatedParts && vn(u.mutatedParts);
3753
3773
  })) : f.then(function(v) {
3754
- var _ = $r(0, i(i({}, u), { values: u.values.map(function(T, g) {
3755
- var O;
3756
- return v.failures[g] ? T : (T = (O = a.keyPath) !== null && O !== void 0 && O.includes(".") ? Pe(T) : i({}, T), ne(T, a.keyPath, v.results[g]), T);
3774
+ var _ = Xr(0, i(i({}, u), { values: u.values.map(function(T, g) {
3775
+ var A;
3776
+ return v.failures[g] ? T : (T = (A = a.keyPath) !== null && A !== void 0 && A.includes(".") ? Pe(T) : i({}, T), ne(T, a.keyPath, v.results[g]), T);
3757
3777
  }) }), v);
3758
3778
  p.optimisticOps.push(_), queueMicrotask(function() {
3759
3779
  return u.mutatedParts && vn(u.mutatedParts);
3760
3780
  });
3761
3781
  }), f) : r.mutate(u);
3762
3782
  }, query: function(u) {
3763
- if (!Vr(z, r) || !Gr("query", u)) return r.query(u);
3764
- var f = ((_ = z.trans) === null || _ === void 0 ? void 0 : _.db._options.cache) === "immutable", g = z, p = g.requery, v = g.signal, _ = (function(E, A, N, I) {
3765
- var S = gt["idb://".concat(E, "/").concat(A)];
3783
+ if (!Gr(z, r) || !$r("query", u)) return r.query(u);
3784
+ var f = ((_ = z.trans) === null || _ === void 0 ? void 0 : _.db._options.cache) === "immutable", g = z, p = g.requery, v = g.signal, _ = (function(E, O, N, D) {
3785
+ var S = gt["idb://".concat(E, "/").concat(O)];
3766
3786
  if (!S) return [];
3767
- if (!(A = S.queries[N])) return [null, !1, S, null];
3768
- var k = A[(I.query ? I.query.index.name : null) || ""];
3787
+ if (!(O = S.queries[N])) return [null, !1, S, null];
3788
+ var k = O[(D.query ? D.query.index.name : null) || ""];
3769
3789
  if (!k) return [null, !1, S, null];
3770
3790
  switch (N) {
3771
3791
  case "query":
3772
3792
  var P = k.find(function(M) {
3773
- return M.req.limit === I.limit && M.req.values === I.values && Wr(M.req.query.range, I.query.range);
3793
+ return M.req.limit === D.limit && M.req.values === D.values && Yr(M.req.query.range, D.query.range);
3774
3794
  });
3775
3795
  return P ? [P, !0, S, k] : [k.find(function(M) {
3776
- return ("limit" in M.req ? M.req.limit : 1 / 0) >= I.limit && (!I.values || M.req.values) && Xa(M.req.query.range, I.query.range);
3796
+ return ("limit" in M.req ? M.req.limit : 1 / 0) >= D.limit && (!D.values || M.req.values) && Wa(M.req.query.range, D.query.range);
3777
3797
  }), !1, S, k];
3778
3798
  case "count":
3779
3799
  return P = k.find(function(M) {
3780
- return Wr(M.req.query.range, I.query.range);
3800
+ return Yr(M.req.query.range, D.query.range);
3781
3801
  }), [P, !!P, S, k];
3782
3802
  }
3783
- })(t, n, "query", u), T = _[0], g = _[1], O = _[2], b = _[3];
3803
+ })(t, n, "query", u), T = _[0], g = _[1], A = _[2], b = _[3];
3784
3804
  return T && g ? T.obsSet = u.obsSet : (g = r.query(u).then(function(E) {
3785
- var A = E.result;
3786
- if (T && (T.res = A), f) {
3787
- for (var N = 0, I = A.length; N < I; ++N) Object.freeze(A[N]);
3788
- Object.freeze(A);
3789
- } else E.result = Pe(A);
3805
+ var O = E.result;
3806
+ if (T && (T.res = O), f) {
3807
+ for (var N = 0, D = O.length; N < D; ++N) Object.freeze(O[N]);
3808
+ Object.freeze(O);
3809
+ } else E.result = Pe(O);
3790
3810
  return E;
3791
3811
  }).catch(function(E) {
3792
3812
  return b && T && Xe(b, T), Promise.reject(E);
3793
- }), T = { obsSet: u.obsSet, promise: g, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, 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[u.query.index.name || ""] = b)), Wa(T, b, p, v), T.promise.then(function(E) {
3794
- return { result: Xr(E.result, u, O?.optimisticOps, r, T, f) };
3813
+ }), T = { obsSet: u.obsSet, promise: g, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, b ? b.push(T) : (b = [T], (A = A || (gt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = b)), Ya(T, b, p, v), T.promise.then(function(E) {
3814
+ return { result: Wr(E.result, u, A?.optimisticOps, r, T, f) };
3795
3815
  });
3796
3816
  } });
3797
3817
  } });
@@ -3808,7 +3828,7 @@ function Si() {
3808
3828
  var t = this._versions, n = t.filter(function(r) {
3809
3829
  return r._cfg.version === e;
3810
3830
  })[0];
3811
- return n || (n = new this.Version(e), t.push(n), t.sort(ja), n.stores({}), this._state.autoSchema = !1, n);
3831
+ return n || (n = new this.Version(e), t.push(n), t.sort(Ma), n.stores({}), this._state.autoSchema = !1, n);
3812
3832
  }, we.prototype._whenReady = function(e) {
3813
3833
  var t = this;
3814
3834
  return this.idbdb && (this._state.openComplete || z.letThrough || this._vip) ? e() : new G(function(n, r) {
@@ -3832,7 +3852,7 @@ function Si() {
3832
3852
  }, we.prototype.open = function() {
3833
3853
  var e = this;
3834
3854
  return ht(nt, function() {
3835
- return La(e);
3855
+ return Ua(e);
3836
3856
  });
3837
3857
  }, we.prototype._close = function() {
3838
3858
  this.on.close.fire(new CustomEvent("close"));
@@ -3889,7 +3909,7 @@ function Si() {
3889
3909
  var a = arguments.length;
3890
3910
  if (a < 2) throw new C.InvalidArgument("Too few arguments");
3891
3911
  for (var u = new Array(a - 1); --a; ) u[a - 1] = arguments[a];
3892
- return r = u.pop(), [t, It(u), r];
3912
+ return r = u.pop(), [t, Dt(u), r];
3893
3913
  }).apply(this, arguments);
3894
3914
  return this._transaction.apply(this, e);
3895
3915
  }, we.prototype._transaction = function(e, t, n) {
@@ -3923,25 +3943,25 @@ function Si() {
3923
3943
  g(_);
3924
3944
  }) : be(_);
3925
3945
  }
3926
- var v = (function _(T, g, O, b, E) {
3946
+ var v = (function _(T, g, A, b, E) {
3927
3947
  return G.resolve().then(function() {
3928
- var A = z.transless || z, N = T._createTransaction(g, O, T._dbSchema, b);
3929
- if (N.explicit = !0, A = { trans: N, transless: A }, b) N.idbtrans = b.idbtrans;
3948
+ var O = z.transless || z, N = T._createTransaction(g, A, T._dbSchema, b);
3949
+ if (N.explicit = !0, O = { trans: N, transless: O }, b) N.idbtrans = b.idbtrans;
3930
3950
  else try {
3931
3951
  N.create(), N.idbtrans._explicit = !0, T._state.PR1398_maxLoop = 3;
3932
3952
  } catch (k) {
3933
3953
  return k.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() {
3934
- return _(T, g, O, null, E);
3954
+ return _(T, g, A, null, E);
3935
3955
  })) : be(k);
3936
3956
  }
3937
- var I, S = qe(E);
3938
- return S && Tt(), A = G.follow(function() {
3957
+ var D, S = qe(E);
3958
+ return S && Tt(), O = G.follow(function() {
3939
3959
  var k;
3940
- (I = E.call(N, N)) && (S ? (k = at.bind(null, null), I.then(k, k)) : typeof I.next == "function" && typeof I.throw == "function" && (I = er(I)));
3941
- }, A), (I && typeof I.then == "function" ? G.resolve(I).then(function(k) {
3960
+ (D = E.call(N, N)) && (S ? (k = at.bind(null, null), D.then(k, k)) : typeof D.next == "function" && typeof D.throw == "function" && (D = er(D)));
3961
+ }, O), (D && typeof D.then == "function" ? G.resolve(D).then(function(k) {
3942
3962
  return N.active ? k : be(new C.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
3943
- }) : A.then(function() {
3944
- return I;
3963
+ }) : O.then(function() {
3964
+ return D;
3945
3965
  })).then(function(k) {
3946
3966
  return b && N._resolve(), N._completion.then(function() {
3947
3967
  return k;
@@ -3966,81 +3986,81 @@ function Si() {
3966
3986
  var a, u, f, p, v, _ = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: Q, dbReadyPromise: null, cancelOpen: Q, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
3967
3987
  _.dbReadyPromise = new G(function(g) {
3968
3988
  _.dbReadyResolve = g;
3969
- }), _.openCanceller = new G(function(g, O) {
3970
- _.cancelOpen = O;
3971
- }), this._state = _, this.name = e, this.on = jt(this, "populate", "blocked", "versionchange", "close", { ready: [wt, Q] }), this.once = function(g, O) {
3989
+ }), _.openCanceller = new G(function(g, A) {
3990
+ _.cancelOpen = A;
3991
+ }), this._state = _, this.name = e, this.on = jt(this, "populate", "blocked", "versionchange", "close", { ready: [wt, Q] }), this.once = function(g, A) {
3972
3992
  var b = function() {
3973
- for (var E = [], A = 0; A < arguments.length; A++) E[A] = arguments[A];
3974
- n.on(g).unsubscribe(b), O.apply(n, E);
3993
+ for (var E = [], O = 0; O < arguments.length; O++) E[O] = arguments[O];
3994
+ n.on(g).unsubscribe(b), A.apply(n, E);
3975
3995
  };
3976
3996
  return n.on(g, b);
3977
3997
  }, this.on.ready.subscribe = ee(this.on.ready.subscribe, function(g) {
3978
- return function(O, b) {
3998
+ return function(A, b) {
3979
3999
  we.vip(function() {
3980
- var E, A = n._state;
3981
- A.openComplete ? (A.dbOpenError || G.resolve().then(O), b && g(O)) : A.onReadyBeingFired ? (A.onReadyBeingFired.push(O), b && g(O)) : (g(O), E = n, b || g(function N() {
3982
- E.on.ready.unsubscribe(O), E.on.ready.unsubscribe(N);
4000
+ var E, O = n._state;
4001
+ O.openComplete ? (O.dbOpenError || G.resolve().then(A), b && g(A)) : O.onReadyBeingFired ? (O.onReadyBeingFired.push(A), b && g(A)) : (g(A), E = n, b || g(function N() {
4002
+ E.on.ready.unsubscribe(A), E.on.ready.unsubscribe(N);
3983
4003
  }));
3984
4004
  });
3985
4005
  };
3986
- }), this.Collection = (a = this, Mt(Da.prototype, function(I, N) {
4006
+ }), this.Collection = (a = this, Mt(Ra.prototype, function(D, N) {
3987
4007
  this.db = a;
3988
- var b = Tr, E = null;
4008
+ var b = xr, E = null;
3989
4009
  if (N) try {
3990
4010
  b = N();
3991
4011
  } catch (S) {
3992
4012
  E = S;
3993
4013
  }
3994
- var A = I._ctx, N = A.table, I = N.hook.reading.fire;
3995
- this._ctx = { table: N, index: A.index, isPrimKey: !A.index || N.schema.primKey.keyPath && A.index === N.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: E, or: A.or, valueMapper: I !== he ? I : null };
3996
- })), this.Table = (u = this, Mt(Or.prototype, function(g, O, b) {
3997
- this.db = u, this._tx = b, this.name = g, this.schema = O, this.hook = u._allTables[g] ? u._allTables[g].hook : jt(null, { creating: [tt, Q], reading: [Oe, he], updating: [Le, Q], deleting: [Te, Q] });
3998
- })), this.Transaction = (f = this, Mt(ka.prototype, function(g, O, b, E, A) {
4014
+ var O = D._ctx, N = O.table, D = N.hook.reading.fire;
4015
+ this._ctx = { table: N, index: O.index, isPrimKey: !O.index || N.schema.primKey.keyPath && O.index === N.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: E, or: O.or, valueMapper: D !== he ? D : null };
4016
+ })), this.Table = (u = this, Mt(Cr.prototype, function(g, A, b) {
4017
+ this.db = u, this._tx = b, this.name = g, this.schema = A, this.hook = u._allTables[g] ? u._allTables[g].hook : jt(null, { creating: [tt, Q], reading: [Ae, he], updating: [Le, Q], deleting: [Te, Q] });
4018
+ })), this.Transaction = (f = this, Mt(Pa.prototype, function(g, A, b, E, O) {
3999
4019
  var N = this;
4000
- g !== "readonly" && O.forEach(function(I) {
4001
- I = (I = b[I]) === null || I === void 0 ? void 0 : I.yProps, I && (O = O.concat(I.map(function(S) {
4020
+ g !== "readonly" && A.forEach(function(D) {
4021
+ D = (D = b[D]) === null || D === void 0 ? void 0 : D.yProps, D && (A = A.concat(D.map(function(S) {
4002
4022
  return S.updatesTable;
4003
4023
  })));
4004
- }), this.db = f, this.mode = g, this.storeNames = O, this.schema = b, this.chromeTransactionDurability = E, this.idbtrans = null, this.on = jt(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) {
4005
- N._resolve = I, N._reject = S;
4024
+ }), this.db = f, this.mode = g, this.storeNames = A, this.schema = b, this.chromeTransactionDurability = E, this.idbtrans = null, this.on = jt(this, "complete", "error", "abort"), this.parent = O || 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) {
4025
+ N._resolve = D, N._reject = S;
4006
4026
  }), this._completion.then(function() {
4007
4027
  N.active = !1, N.on.complete.fire();
4008
- }, function(I) {
4028
+ }, function(D) {
4009
4029
  var S = N.active;
4010
- return N.active = !1, N.on.error.fire(I), N.parent ? N.parent._reject(I) : S && N.idbtrans && N.idbtrans.abort(), be(I);
4030
+ return N.active = !1, N.on.error.fire(D), N.parent ? N.parent._reject(D) : S && N.idbtrans && N.idbtrans.abort(), be(D);
4011
4031
  });
4012
- })), this.Version = (p = this, Mt(qa.prototype, function(g) {
4032
+ })), this.Version = (p = this, Mt(La.prototype, function(g) {
4013
4033
  this.db = p, this._cfg = { version: g, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
4014
- })), this.WhereClause = (v = this, Mt(kr.prototype, function(g, O, b) {
4015
- if (this.db = v, this._ctx = { table: g, index: O === ":id" ? null : O, or: b }, this._cmp = this._ascending = re, this._descending = function(E, A) {
4016
- return re(A, E);
4017
- }, this._max = function(E, A) {
4018
- return 0 < re(E, A) ? E : A;
4019
- }, this._min = function(E, A) {
4020
- return re(E, A) < 0 ? E : A;
4034
+ })), this.WhereClause = (v = this, Mt(Pr.prototype, function(g, A, b) {
4035
+ if (this.db = v, this._ctx = { table: g, index: A === ":id" ? null : A, or: b }, this._cmp = this._ascending = re, this._descending = function(E, O) {
4036
+ return re(O, E);
4037
+ }, this._max = function(E, O) {
4038
+ return 0 < re(E, O) ? E : O;
4039
+ }, this._min = function(E, O) {
4040
+ return re(E, O) < 0 ? E : O;
4021
4041
  }, this._IDBKeyRange = v._deps.IDBKeyRange, !this._IDBKeyRange) throw new C.MissingAPI();
4022
4042
  })), this.on("versionchange", function(g) {
4023
4043
  0 < g.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 });
4024
4044
  }), this.on("blocked", function(g) {
4025
4045
  !g.newVersion || g.newVersion < g.oldVersion ? console.warn("Dexie.delete('".concat(n.name, "') was blocked")) : console.warn("Upgrade '".concat(n.name, "' blocked by other connection holding version ").concat(g.oldVersion / 10));
4026
- }), this._maxKey = Ut(t.IDBKeyRange), this._createTransaction = function(g, O, b, E) {
4027
- return new n.Transaction(g, O, b, n._options.chromeTransactionDurability, E);
4046
+ }), this._maxKey = Ut(t.IDBKeyRange), this._createTransaction = function(g, A, b, E) {
4047
+ return new n.Transaction(g, A, b, n._options.chromeTransactionDurability, E);
4028
4048
  }, this._fireOnBlocked = function(g) {
4029
- n.on("blocked").fire(g), xt.filter(function(O) {
4030
- return O.name === n.name && O !== n && !O._state.vcFired;
4031
- }).map(function(O) {
4032
- return O.on("versionchange").fire(g);
4049
+ n.on("blocked").fire(g), xt.filter(function(A) {
4050
+ return A.name === n.name && A !== n && !A._state.vcFired;
4051
+ }).map(function(A) {
4052
+ return A.on("versionchange").fire(g);
4033
4053
  });
4034
- }, this.use(Ga), this.use(Ya), this.use($a), this.use(Ua), this.use(Va);
4035
- var T = new Proxy(this, { get: function(g, O, b) {
4036
- if (O === "_vip") return !0;
4037
- if (O === "table") return function(A) {
4038
- return wn(n.table(A), T);
4054
+ }, this.use($a), this.use(za), this.use(Xa), this.use(Va), this.use(Ga);
4055
+ var T = new Proxy(this, { get: function(g, A, b) {
4056
+ if (A === "_vip") return !0;
4057
+ if (A === "table") return function(O) {
4058
+ return wn(n.table(O), T);
4039
4059
  };
4040
- var E = Reflect.get(g, O, b);
4041
- return E instanceof Or ? wn(E, T) : O === "tables" ? E.map(function(A) {
4042
- return wn(A, T);
4043
- }) : O === "_createTransaction" ? function() {
4060
+ var E = Reflect.get(g, A, b);
4061
+ return E instanceof Cr ? wn(E, T) : A === "tables" ? E.map(function(O) {
4062
+ return wn(O, T);
4063
+ }) : A === "_createTransaction" ? function() {
4044
4064
  return wn(E.apply(this, arguments), T);
4045
4065
  } : E;
4046
4066
  } });
@@ -4048,7 +4068,7 @@ function Si() {
4048
4068
  return g(n);
4049
4069
  });
4050
4070
  }
4051
- var _n, Me = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", za = (ar.prototype.subscribe = function(e, t, n) {
4071
+ var _n, Me = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", Qa = (ar.prototype.subscribe = function(e, t, n) {
4052
4072
  return this._subscribe(e && typeof e != "function" ? e : { next: e, error: t, complete: n });
4053
4073
  }, ar.prototype[Me] = function() {
4054
4074
  return this;
@@ -4061,21 +4081,21 @@ function Si() {
4061
4081
  } catch {
4062
4082
  _n = { indexedDB: null, IDBKeyRange: null };
4063
4083
  }
4064
- function Yr(e) {
4065
- var t, n = !1, r = new za(function(a) {
4084
+ function zr(e) {
4085
+ var t, n = !1, r = new Qa(function(a) {
4066
4086
  var u = qe(e), f, p = !1, v = {}, _ = {}, T = { get closed() {
4067
4087
  return p;
4068
4088
  }, unsubscribe: function() {
4069
4089
  p || (p = !0, f && f.abort(), g && st.storagemutated.unsubscribe(b));
4070
4090
  } };
4071
4091
  a.start && a.start(T);
4072
- var g = !1, O = function() {
4092
+ var g = !1, A = function() {
4073
4093
  return Pn(E);
4074
- }, b = function(A) {
4075
- yn(v, A), Qn(_, v) && O();
4094
+ }, b = function(O) {
4095
+ yn(v, O), Qn(_, v) && A();
4076
4096
  }, E = function() {
4077
- var A, N, I;
4078
- !p && _n.indexedDB && (v = {}, A = {}, f && f.abort(), f = new AbortController(), I = (function(S) {
4097
+ var O, N, D;
4098
+ !p && _n.indexedDB && (v = {}, O = {}, f && f.abort(), f = new AbortController(), D = (function(S) {
4079
4099
  var k = _t();
4080
4100
  try {
4081
4101
  u && Tt();
@@ -4084,11 +4104,11 @@ function Si() {
4084
4104
  } finally {
4085
4105
  k && Et();
4086
4106
  }
4087
- })(N = { subscr: A, signal: f.signal, requery: O, querier: e, trans: null }), Promise.resolve(I).then(function(S) {
4107
+ })(N = { subscr: O, signal: f.signal, requery: A, querier: e, trans: null }), Promise.resolve(D).then(function(S) {
4088
4108
  n = !0, t = S, p || N.signal.aborted || (v = {}, (function(k) {
4089
4109
  for (var P in k) if (W(k, P)) return;
4090
4110
  return 1;
4091
- })(_ = A) || g || (st(Lt, b), g = !0), Pn(function() {
4111
+ })(_ = O) || g || (st(Lt, b), g = !0), Pn(function() {
4092
4112
  return !p && a.next && a.next(S);
4093
4113
  }));
4094
4114
  }, function(S) {
@@ -4097,7 +4117,7 @@ function Si() {
4097
4117
  });
4098
4118
  }));
4099
4119
  };
4100
- return setTimeout(O, 0), T;
4120
+ return setTimeout(A, 0), T;
4101
4121
  });
4102
4122
  return r.hasValue = function() {
4103
4123
  return n;
@@ -4165,7 +4185,7 @@ function Si() {
4165
4185
  return ke;
4166
4186
  }, set: function(e) {
4167
4187
  St(e);
4168
- } }, derive: F, extend: R, props: J, override: ee, Events: jt, on: st, liveQuery: Yr, extendObservabilitySet: yn, getByKeyPath: me, setByKeyPath: ne, delByKeyPath: function(e, t) {
4188
+ } }, derive: F, extend: R, props: J, override: ee, Events: jt, on: st, liveQuery: zr, extendObservabilitySet: yn, getByKeyPath: me, setByKeyPath: ne, delByKeyPath: function(e, t) {
4169
4189
  typeof t == "string" ? ne(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
4170
4190
  ne(e, n, void 0);
4171
4191
  });
@@ -4178,9 +4198,9 @@ function Si() {
4178
4198
  }), addEventListener(Kn, function(e) {
4179
4199
  e = e.detail, ut || ir(e);
4180
4200
  }));
4181
- var Ct, ut = !1, zr = function() {
4201
+ var Ct, ut = !1, Qr = function() {
4182
4202
  };
4183
- return typeof BroadcastChannel < "u" && ((zr = function() {
4203
+ return typeof BroadcastChannel < "u" && ((Qr = function() {
4184
4204
  (Ct = new BroadcastChannel(Kn)).onmessage = function(e) {
4185
4205
  return e.data && ir(e.data);
4186
4206
  };
@@ -4192,39 +4212,39 @@ function Si() {
4192
4212
  for (var t = 0, n = xt; t < n.length; t++) n[t].close({ disableAutoOpen: !1 });
4193
4213
  }
4194
4214
  }), addEventListener("pageshow", function(e) {
4195
- !Ye.disableBfCache && e.persisted && (ke && console.debug("Dexie: handling persisted pageshow"), zr(), ir({ all: new Ce(-1 / 0, [[]]) }));
4215
+ !Ye.disableBfCache && e.persisted && (ke && console.debug("Dexie: handling persisted pageshow"), Qr(), ir({ all: new Ce(-1 / 0, [[]]) }));
4196
4216
  })), G.rejectionMapper = function(e, t) {
4197
- return !e || e instanceof Ze || e instanceof TypeError || e instanceof SyntaxError || !e.name || !x[e.name] ? e : (t = new x[e.name](t || e.message, e), "stack" in e && B(t, "stack", { get: function() {
4217
+ return !e || e instanceof Ze || e instanceof TypeError || e instanceof SyntaxError || !e.name || !x[e.name] ? e : (t = new x[e.name](t || e.message, e), "stack" in e && j(t, "stack", { get: function() {
4198
4218
  return this.inner.stack;
4199
4219
  } }), t);
4200
- }, St(ke), i(Ye, Object.freeze({ __proto__: null, Dexie: Ye, liveQuery: Yr, Entity: xr, cmp: re, PropModification: Kt, replacePrefix: function(e, t) {
4220
+ }, St(ke), i(Ye, Object.freeze({ __proto__: null, Dexie: Ye, liveQuery: zr, Entity: Nr, cmp: re, PropModification: Kt, replacePrefix: function(e, t) {
4201
4221
  return new Kt({ replacePrefix: [e, t] });
4202
4222
  }, add: function(e) {
4203
4223
  return new Kt({ add: e });
4204
4224
  }, remove: function(e) {
4205
4225
  return new Kt({ remove: e });
4206
- }, default: Ye, RangeSet: Ce, mergeRanges: $t, rangesOverlap: Mr }), { default: Ye }), Ye;
4226
+ }, default: Ye, RangeSet: Ce, mergeRanges: $t, rangesOverlap: Kr }), { default: Ye }), Ye;
4207
4227
  });
4208
4228
  })(xn)), xn.exports;
4209
4229
  }
4210
- var ki = Si();
4211
- const dr = /* @__PURE__ */ ya(ki), Zr = /* @__PURE__ */ Symbol.for("Dexie"), Qe = globalThis[Zr] || (globalThis[Zr] = dr);
4230
+ var Pi = ki();
4231
+ const dr = /* @__PURE__ */ va(Pi), Jr = /* @__PURE__ */ Symbol.for("Dexie"), Qe = globalThis[Jr] || (globalThis[Jr] = dr);
4212
4232
  if (dr.semVer !== Qe.semVer)
4213
4233
  throw new Error(`Two different versions of Dexie loaded in the same app: ${dr.semVer} and ${Qe.semVer}`);
4214
4234
  const {
4215
- liveQuery: xo,
4216
- mergeRanges: No,
4235
+ liveQuery: No,
4236
+ mergeRanges: Oo,
4217
4237
  rangesOverlap: Ao,
4218
- RangeSet: Oo,
4219
- cmp: Co,
4238
+ RangeSet: Co,
4239
+ cmp: Do,
4220
4240
  Entity: Io,
4221
- PropModification: Do,
4222
- replacePrefix: Ro,
4223
- add: So,
4224
- remove: ko,
4225
- DexieYProvider: Po
4226
- } = Qe, Jr = "_changeLog", ea = "_meta";
4227
- class Pi {
4241
+ PropModification: Ro,
4242
+ replacePrefix: So,
4243
+ add: ko,
4244
+ remove: Po,
4245
+ DexieYProvider: Fo
4246
+ } = Qe, ea = "_changeLog", ta = "_meta";
4247
+ class Fi {
4228
4248
  constructor(o, c) {
4229
4249
  this.name = o;
4230
4250
  const { xmlElements: i, additionalTables: d } = c.database.tables;
@@ -4235,7 +4255,7 @@ class Pi {
4235
4255
  if (d)
4236
4256
  for (const [y, w] of Object.entries(d))
4237
4257
  h[y] = w.schema;
4238
- h[Jr] = "++sequenceNumber, id", h[ea] = "key", this.databaseInstance.version(1).stores(h);
4258
+ h[ea] = "++sequenceNumber, id", h[ta] = "key", this.databaseInstance.version(1).stores(h);
4239
4259
  }
4240
4260
  async get(o) {
4241
4261
  return this.databaseInstance.table(this.tableName).get(o);
@@ -4244,10 +4264,10 @@ class Pi {
4244
4264
  return this.databaseInstance.table(this.tableName).where({ tagName: o }).toArray();
4245
4265
  }
4246
4266
  get changeLogTable() {
4247
- return this.databaseInstance.table(Jr);
4267
+ return this.databaseInstance.table(ea);
4248
4268
  }
4249
4269
  get metaTable() {
4250
- return this.databaseInstance.table(ea);
4270
+ return this.databaseInstance.table(ta);
4251
4271
  }
4252
4272
  async getHead() {
4253
4273
  return (await this.metaTable.get("head"))?.value ?? 0;
@@ -4265,15 +4285,15 @@ class Pi {
4265
4285
  this.changeLogTable,
4266
4286
  this.metaTable,
4267
4287
  async () => {
4268
- const j = i.length > 0 ? await y.bulkGet(i.map((B) => B.id)) : [], X = d.length > 0 ? await y.bulkGet(d) : [];
4288
+ const B = i.length > 0 ? await y.bulkGet(i.map((j) => j.id)) : [], X = d.length > 0 ? await y.bulkGet(d) : [];
4269
4289
  if (c.length > 0)
4270
4290
  try {
4271
4291
  await y.bulkAdd(c), R += c.length, h(R, w);
4272
- } catch (B) {
4273
- const F = this.extractFailedRecordFromError(B, c);
4292
+ } catch (j) {
4293
+ const F = this.extractFailedRecordFromError(j, c);
4274
4294
  je("STORE_BULK_ADD_FAILED", {
4275
- detail: B instanceof Error ? B.message : String(B),
4276
- cause: B instanceof Error ? B : void 0,
4295
+ detail: j instanceof Error ? j.message : String(j),
4296
+ cause: j instanceof Error ? j : void 0,
4277
4297
  ...F && {
4278
4298
  ref: { tagName: F.tagName, id: F.id }
4279
4299
  }
@@ -4282,11 +4302,11 @@ class Pi {
4282
4302
  if (i.length > 0)
4283
4303
  try {
4284
4304
  await y.bulkPut(i), R += i.length, h(R, w);
4285
- } catch (B) {
4286
- const F = this.extractFailedRecordFromError(B, i);
4305
+ } catch (j) {
4306
+ const F = this.extractFailedRecordFromError(j, i);
4287
4307
  je("STORE_BULK_UPDATE_FAILED", {
4288
- detail: B instanceof Error ? B.message : String(B),
4289
- cause: B instanceof Error ? B : void 0,
4308
+ detail: j instanceof Error ? j.message : String(j),
4309
+ cause: j instanceof Error ? j : void 0,
4290
4310
  ...F && {
4291
4311
  ref: { tagName: F.tagName, id: F.id }
4292
4312
  }
@@ -4295,10 +4315,10 @@ class Pi {
4295
4315
  if (d.length > 0)
4296
4316
  try {
4297
4317
  await y.bulkDelete(d), R += d.length, h(R, w);
4298
- } catch (B) {
4318
+ } catch (j) {
4299
4319
  je("STORE_DELETE_FAILED", {
4300
- detail: B instanceof Error ? B.message : String(B),
4301
- cause: B instanceof Error ? B : void 0
4320
+ detail: j instanceof Error ? j.message : String(j),
4321
+ cause: j instanceof Error ? j : void 0
4302
4322
  });
4303
4323
  }
4304
4324
  const W = await this.getHead();
@@ -4309,9 +4329,9 @@ class Pi {
4309
4329
  timestamp: Date.now(),
4310
4330
  operations: {
4311
4331
  creates: c,
4312
- updates: i.map((B, F) => ({
4313
- before: j[F],
4314
- after: B
4332
+ updates: i.map((j, F) => ({
4333
+ before: B[F],
4334
+ after: j
4315
4335
  })),
4316
4336
  deletes: X.filter(Boolean)
4317
4337
  }
@@ -4319,12 +4339,12 @@ class Pi {
4319
4339
  await this.changeLogTable.add(fe), await this.setHead(J);
4320
4340
  }
4321
4341
  );
4322
- } catch (j) {
4323
- if (j instanceof Error && j.message.includes("dialecte"))
4324
- throw j;
4342
+ } catch (B) {
4343
+ if (B instanceof Error && B.message.includes("dialecte"))
4344
+ throw B;
4325
4345
  je("STORE_COMMIT_FAILED", {
4326
- detail: j instanceof Error ? j.message : String(j),
4327
- cause: j instanceof Error ? j : void 0
4346
+ detail: B instanceof Error ? B.message : String(B),
4347
+ cause: B instanceof Error ? B : void 0
4328
4348
  });
4329
4349
  }
4330
4350
  }
@@ -4377,7 +4397,7 @@ class Pi {
4377
4397
  this.databaseInstance.isOpen() && (this.databaseInstance.close(), await new Promise((o) => setTimeout(o, 20))), await Qe.delete(this.databaseInstance.name);
4378
4398
  }
4379
4399
  }
4380
- function Fi(m) {
4400
+ function Bi(m) {
4381
4401
  const { databaseName: o, dialecteConfig: c } = m, { xmlElements: i, additionalTables: d } = c.database.tables, h = new Qe(o), y = {
4382
4402
  [i.name]: i.schema
4383
4403
  };
@@ -4386,11 +4406,11 @@ function Fi(m) {
4386
4406
  y[w] = R.schema;
4387
4407
  return h.version(1).stores(y), h;
4388
4408
  }
4389
- async function va(m) {
4409
+ async function ba(m) {
4390
4410
  const { databaseInstance: o, elementsTableName: c, records: i } = m, d = o.table(c);
4391
4411
  await o.transaction("rw", d, () => d.bulkAdd(i));
4392
4412
  }
4393
- async function Bi(m) {
4413
+ async function ji(m) {
4394
4414
  const { databaseInstance: o, elementsTableName: c, updates: i } = m;
4395
4415
  if (i.length === 0) return;
4396
4416
  const d = o.table(c);
@@ -4400,26 +4420,26 @@ async function Bi(m) {
4400
4420
  if (!w) continue;
4401
4421
  const R = { ...y };
4402
4422
  if (y.attributes) {
4403
- const j = [...w.attributes];
4423
+ const B = [...w.attributes];
4404
4424
  for (const X of y.attributes) {
4405
- const W = j.findIndex((J) => J.name === X.name);
4406
- W >= 0 ? j[W] = X : j.push(X);
4425
+ const W = B.findIndex((J) => J.name === X.name);
4426
+ W >= 0 ? B[W] = X : B.push(X);
4407
4427
  }
4408
- R.attributes = j;
4428
+ R.attributes = B;
4409
4429
  }
4410
4430
  if (y.children) {
4411
- const j = [...w.children];
4431
+ const B = [...w.children];
4412
4432
  for (const X of y.children) {
4413
- const W = j.findIndex((J) => J.id === X.id);
4414
- W >= 0 ? j[W] = X : j.push(X);
4433
+ const W = B.findIndex((J) => J.id === X.id);
4434
+ W >= 0 ? B[W] = X : B.push(X);
4415
4435
  }
4416
- R.children = j;
4436
+ R.children = B;
4417
4437
  }
4418
4438
  await d.update(h, R);
4419
4439
  }
4420
4440
  });
4421
4441
  }
4422
- async function Fo(m) {
4442
+ async function Bo(m) {
4423
4443
  const { databaseInstance: o, elementsTableName: c, updates: i } = m;
4424
4444
  if (i.length === 0) return;
4425
4445
  const d = o.table(c);
@@ -4428,29 +4448,29 @@ async function Fo(m) {
4428
4448
  const w = await d.get(h);
4429
4449
  if (!w) continue;
4430
4450
  const R = [...w.attributes];
4431
- for (const j of y) {
4432
- const X = R.findIndex((W) => W.name === j.name);
4433
- X >= 0 ? R[X] = j : R.push(j);
4451
+ for (const B of y) {
4452
+ const X = R.findIndex((W) => W.name === B.name);
4453
+ X >= 0 ? R[X] = B : R.push(B);
4434
4454
  }
4435
4455
  await d.update(h, { attributes: R });
4436
4456
  }
4437
4457
  });
4438
4458
  }
4439
- async function ji(m) {
4459
+ async function Mi(m) {
4440
4460
  const { databaseInstance: o, elementsTableName: c, ids: i } = m;
4441
4461
  if (i.length === 0) return;
4442
4462
  const d = o.table(c);
4443
4463
  await o.transaction("rw", d, () => d.bulkDelete(i));
4444
4464
  }
4445
- async function Bo(m) {
4465
+ async function jo(m) {
4446
4466
  if (await Qe.exists(m))
4447
4467
  return await Qe.delete(m);
4448
4468
  }
4449
- function Mi(m) {
4469
+ function Ki(m) {
4450
4470
  return "prefix" in m && "uri" in m && !!m.prefix && !!m.uri;
4451
4471
  }
4452
4472
  const Yt = {};
4453
- function Ki(m) {
4473
+ function qi(m) {
4454
4474
  const { parentId: o, child: c } = m;
4455
4475
  Yt[o] || (Yt[o] = []);
4456
4476
  const i = {
@@ -4459,32 +4479,32 @@ function Ki(m) {
4459
4479
  };
4460
4480
  Yt[o].push(i);
4461
4481
  }
4462
- function qi(m) {
4482
+ function Li(m) {
4463
4483
  const { currentBatch: o } = m, c = [...o];
4464
4484
  for (const [i, d] of c.entries()) {
4465
4485
  const h = Yt[d.id] || [];
4466
- h.length > 0 && (c[i].children.push(...h), Li({
4486
+ h.length > 0 && (c[i].children.push(...h), Ui({
4467
4487
  parentId: d.id
4468
4488
  }));
4469
4489
  }
4470
4490
  return c;
4471
4491
  }
4472
- function Li(m) {
4492
+ function Ui(m) {
4473
4493
  const { parentId: o } = m;
4474
4494
  delete Yt[o];
4475
4495
  }
4476
4496
  var cr = {};
4477
- const Ui = {}, Vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4497
+ const Vi = {}, Gi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4478
4498
  __proto__: null,
4479
- default: Ui
4480
- }, Symbol.toStringTag, { value: "Module" })), Gi = /* @__PURE__ */ Di(Vi);
4481
- var ta;
4482
- function $i() {
4483
- return ta || (ta = 1, (function(m) {
4499
+ default: Vi
4500
+ }, Symbol.toStringTag, { value: "Module" })), $i = /* @__PURE__ */ Ri(Gi);
4501
+ var na;
4502
+ function Xi() {
4503
+ return na || (na = 1, (function(m) {
4484
4504
  (function(o) {
4485
4505
  o.parser = function(l, s) {
4486
4506
  return new i(l, s);
4487
- }, o.SAXParser = i, o.SAXStream = X, o.createStream = j, o.MAX_BUFFER_LENGTH = 64 * 1024;
4507
+ }, o.SAXParser = i, o.SAXStream = X, o.createStream = B, o.MAX_BUFFER_LENGTH = 64 * 1024;
4488
4508
  var c = [
4489
4509
  "comment",
4490
4510
  "sgmlDecl",
@@ -4523,7 +4543,7 @@ function $i() {
4523
4543
  if (!(this instanceof i))
4524
4544
  return new i(l, s);
4525
4545
  var C = this;
4526
- h(C), C.q = C.c = "", C.bufferCheckPosition = o.MAX_BUFFER_LENGTH, C.opt = s || {}, 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(o.XML_ENTITIES) : Object.create(o.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");
4546
+ h(C), C.q = C.c = "", C.bufferCheckPosition = o.MAX_BUFFER_LENGTH, C.opt = s || {}, 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(o.XML_ENTITIES) : Object.create(o.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");
4527
4547
  }
4528
4548
  Object.create || (Object.create = function(l) {
4529
4549
  function s() {
@@ -4582,7 +4602,7 @@ function $i() {
4582
4602
  };
4583
4603
  var w;
4584
4604
  try {
4585
- w = Gi.Stream;
4605
+ w = $i.Stream;
4586
4606
  } catch {
4587
4607
  w = function() {
4588
4608
  };
@@ -4592,7 +4612,7 @@ function $i() {
4592
4612
  var R = o.EVENTS.filter(function(l) {
4593
4613
  return l !== "error" && l !== "end";
4594
4614
  });
4595
- function j(l, s) {
4615
+ function B(l, s) {
4596
4616
  return new X(l, s);
4597
4617
  }
4598
4618
  function X(l, s) {
@@ -4638,7 +4658,7 @@ function $i() {
4638
4658
  x.splice(0, 0, l), C.emit.apply(C, x);
4639
4659
  }), w.prototype.on.call(C, l, s);
4640
4660
  };
4641
- var W = "[CDATA[", J = "DOCTYPE", fe = "http://www.w3.org/XML/1998/namespace", B = "http://www.w3.org/2000/xmlns/", F = { xml: fe, xmlns: B }, se = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, ce = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, xe = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, ee = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
4661
+ var W = "[CDATA[", J = "DOCTYPE", fe = "http://www.w3.org/XML/1998/namespace", j = "http://www.w3.org/2000/xmlns/", F = { xml: fe, xmlns: j }, se = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, ce = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, xe = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, ee = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
4642
4662
  function Y(l) {
4643
4663
  return l === " " || l === `
4644
4664
  ` || l === "\r" || l === " ";
@@ -4655,79 +4675,79 @@ function $i() {
4655
4675
  function Re(l, s) {
4656
4676
  return !ne(l, s);
4657
4677
  }
4658
- var D = 0;
4678
+ var I = 0;
4659
4679
  o.STATE = {
4660
- BEGIN: D++,
4680
+ BEGIN: I++,
4661
4681
  // leading byte order mark or whitespace
4662
- BEGIN_WHITESPACE: D++,
4682
+ BEGIN_WHITESPACE: I++,
4663
4683
  // leading whitespace
4664
- TEXT: D++,
4684
+ TEXT: I++,
4665
4685
  // general stuff
4666
- TEXT_ENTITY: D++,
4686
+ TEXT_ENTITY: I++,
4667
4687
  // &amp and such.
4668
- OPEN_WAKA: D++,
4688
+ OPEN_WAKA: I++,
4669
4689
  // <
4670
- SGML_DECL: D++,
4690
+ SGML_DECL: I++,
4671
4691
  // <!BLARG
4672
- SGML_DECL_QUOTED: D++,
4692
+ SGML_DECL_QUOTED: I++,
4673
4693
  // <!BLARG foo "bar
4674
- DOCTYPE: D++,
4694
+ DOCTYPE: I++,
4675
4695
  // <!DOCTYPE
4676
- DOCTYPE_QUOTED: D++,
4696
+ DOCTYPE_QUOTED: I++,
4677
4697
  // <!DOCTYPE "//blah
4678
- DOCTYPE_DTD: D++,
4698
+ DOCTYPE_DTD: I++,
4679
4699
  // <!DOCTYPE "//blah" [ ...
4680
- DOCTYPE_DTD_QUOTED: D++,
4700
+ DOCTYPE_DTD_QUOTED: I++,
4681
4701
  // <!DOCTYPE "//blah" [ "foo
4682
- COMMENT_STARTING: D++,
4702
+ COMMENT_STARTING: I++,
4683
4703
  // <!-
4684
- COMMENT: D++,
4704
+ COMMENT: I++,
4685
4705
  // <!--
4686
- COMMENT_ENDING: D++,
4706
+ COMMENT_ENDING: I++,
4687
4707
  // <!-- blah -
4688
- COMMENT_ENDED: D++,
4708
+ COMMENT_ENDED: I++,
4689
4709
  // <!-- blah --
4690
- CDATA: D++,
4710
+ CDATA: I++,
4691
4711
  // <![CDATA[ something
4692
- CDATA_ENDING: D++,
4712
+ CDATA_ENDING: I++,
4693
4713
  // ]
4694
- CDATA_ENDING_2: D++,
4714
+ CDATA_ENDING_2: I++,
4695
4715
  // ]]
4696
- PROC_INST: D++,
4716
+ PROC_INST: I++,
4697
4717
  // <?hi
4698
- PROC_INST_BODY: D++,
4718
+ PROC_INST_BODY: I++,
4699
4719
  // <?hi there
4700
- PROC_INST_ENDING: D++,
4720
+ PROC_INST_ENDING: I++,
4701
4721
  // <?hi "there" ?
4702
- OPEN_TAG: D++,
4722
+ OPEN_TAG: I++,
4703
4723
  // <strong
4704
- OPEN_TAG_SLASH: D++,
4724
+ OPEN_TAG_SLASH: I++,
4705
4725
  // <strong /
4706
- ATTRIB: D++,
4726
+ ATTRIB: I++,
4707
4727
  // <a
4708
- ATTRIB_NAME: D++,
4728
+ ATTRIB_NAME: I++,
4709
4729
  // <a foo
4710
- ATTRIB_NAME_SAW_WHITE: D++,
4730
+ ATTRIB_NAME_SAW_WHITE: I++,
4711
4731
  // <a foo _
4712
- ATTRIB_VALUE: D++,
4732
+ ATTRIB_VALUE: I++,
4713
4733
  // <a foo=
4714
- ATTRIB_VALUE_QUOTED: D++,
4734
+ ATTRIB_VALUE_QUOTED: I++,
4715
4735
  // <a foo="bar
4716
- ATTRIB_VALUE_CLOSED: D++,
4736
+ ATTRIB_VALUE_CLOSED: I++,
4717
4737
  // <a foo="bar"
4718
- ATTRIB_VALUE_UNQUOTED: D++,
4738
+ ATTRIB_VALUE_UNQUOTED: I++,
4719
4739
  // <a foo=bar
4720
- ATTRIB_VALUE_ENTITY_Q: D++,
4740
+ ATTRIB_VALUE_ENTITY_Q: I++,
4721
4741
  // <foo bar="&quot;"
4722
- ATTRIB_VALUE_ENTITY_U: D++,
4742
+ ATTRIB_VALUE_ENTITY_U: I++,
4723
4743
  // <foo bar=&quot
4724
- CLOSE_TAG: D++,
4744
+ CLOSE_TAG: I++,
4725
4745
  // </a
4726
- CLOSE_TAG_SAW_WHITE: D++,
4746
+ CLOSE_TAG_SAW_WHITE: I++,
4727
4747
  // </a >
4728
- SCRIPT: D++,
4748
+ SCRIPT: I++,
4729
4749
  // <script> ...
4730
- SCRIPT_ENDING: D++
4750
+ SCRIPT_ENDING: I++
4731
4751
  // <script> ... <
4732
4752
  }, o.XML_ENTITIES = {
4733
4753
  amp: "&",
@@ -4993,9 +5013,9 @@ function $i() {
4993
5013
  var s = o.ENTITIES[l], C = typeof s == "number" ? String.fromCharCode(s) : s;
4994
5014
  o.ENTITIES[l] = C;
4995
5015
  });
4996
- for (var It in o.STATE)
4997
- o.STATE[o.STATE[It]] = It;
4998
- D = o.STATE;
5016
+ for (var Dt in o.STATE)
5017
+ o.STATE[o.STATE[Dt]] = Dt;
5018
+ I = o.STATE;
4999
5019
  function He(l, s, C) {
5000
5020
  l[s] && l[s](C);
5001
5021
  }
@@ -5015,7 +5035,7 @@ Column: ` + l.column + `
5015
5035
  Char: ` + l.c), s = new Error(s), l.error = s, He(l, "onerror", s), l;
5016
5036
  }
5017
5037
  function bt(l) {
5018
- 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"), Pe(l), l.c = "", l.closed = !0, He(l, "onend"), i.call(l, l.strict, l.opt), l;
5038
+ 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"), Pe(l), l.c = "", l.closed = !0, He(l, "onend"), i.call(l, l.strict, l.opt), l;
5019
5039
  }
5020
5040
  function le(l, s) {
5021
5041
  if (typeof l != "object" || !(l instanceof i))
@@ -5045,10 +5065,10 @@ Char: ` + l.c), s = new Error(s), l.error = s, He(l, "onerror", s), l;
5045
5065
  "xml: prefix must be bound to " + fe + `
5046
5066
  Actual: ` + l.attribValue
5047
5067
  );
5048
- else if (x === "xmlns" && l.attribValue !== B)
5068
+ else if (x === "xmlns" && l.attribValue !== j)
5049
5069
  le(
5050
5070
  l,
5051
- "xmlns: prefix must be bound to " + B + `
5071
+ "xmlns: prefix must be bound to " + j + `
5052
5072
  Actual: ` + l.attribValue
5053
5073
  );
5054
5074
  else {
@@ -5078,11 +5098,11 @@ Actual: ` + l.attribValue
5078
5098
  });
5079
5099
  });
5080
5100
  for (var Q = 0, he = l.attribList.length; Q < he; Q++) {
5081
- var Oe = l.attribList[Q], ye = Oe[0], tt = Oe[1], Te = Ve(ye, !0), Le = Te.prefix, An = Te.local, wt = Le === "" ? "" : C.ns[Le] || "", ke = {
5101
+ var Ae = l.attribList[Q], ye = Ae[0], tt = Ae[1], Te = Ve(ye, !0), Le = Te.prefix, On = Te.local, wt = Le === "" ? "" : C.ns[Le] || "", ke = {
5082
5102
  name: ye,
5083
5103
  value: tt,
5084
5104
  prefix: Le,
5085
- local: An,
5105
+ local: On,
5086
5106
  uri: wt
5087
5107
  };
5088
5108
  Le && Le !== "xmlns" && !wt && (le(
@@ -5092,16 +5112,16 @@ Actual: ` + l.attribValue
5092
5112
  }
5093
5113
  l.attribList.length = 0;
5094
5114
  }
5095
- l.tag.isSelfClosing = !!s, l.sawRoot = !0, l.tags.push(l.tag), de(l, "onopentag", l.tag), s || (!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;
5115
+ l.tag.isSelfClosing = !!s, l.sawRoot = !0, l.tags.push(l.tag), de(l, "onopentag", l.tag), s || (!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;
5096
5116
  }
5097
- function Dt(l) {
5117
+ function It(l) {
5098
5118
  if (!l.tagName) {
5099
- le(l, "Weird empty close tag."), l.textNode += "</>", l.state = D.TEXT;
5119
+ le(l, "Weird empty close tag."), l.textNode += "</>", l.state = I.TEXT;
5100
5120
  return;
5101
5121
  }
5102
5122
  if (l.script) {
5103
5123
  if (l.tagName !== "script") {
5104
- l.script += "</" + l.tagName + ">", l.tagName = "", l.state = D.SCRIPT;
5124
+ l.script += "</" + l.tagName + ">", l.tagName = "", l.state = I.SCRIPT;
5105
5125
  return;
5106
5126
  }
5107
5127
  de(l, "onscript", l.script), l.script = "";
@@ -5116,30 +5136,30 @@ Actual: ` + l.attribValue
5116
5136
  break;
5117
5137
  }
5118
5138
  if (s < 0) {
5119
- le(l, "Unmatched closing tag: " + l.tagName), l.textNode += "</" + l.tagName + ">", l.state = D.TEXT;
5139
+ le(l, "Unmatched closing tag: " + l.tagName), l.textNode += "</" + l.tagName + ">", l.state = I.TEXT;
5120
5140
  return;
5121
5141
  }
5122
5142
  l.tagName = C;
5123
5143
  for (var Q = l.tags.length; Q-- > s; ) {
5124
5144
  var he = l.tag = l.tags.pop();
5125
5145
  l.tagName = l.tag.name, de(l, "onclosetag", l.tagName);
5126
- var Oe = {};
5146
+ var Ae = {};
5127
5147
  for (var ye in he.ns)
5128
- Oe[ye] = he.ns[ye];
5148
+ Ae[ye] = he.ns[ye];
5129
5149
  var tt = l.tags[l.tags.length - 1] || l;
5130
5150
  l.opt.xmlns && he.ns !== tt.ns && Object.keys(he.ns).forEach(function(Te) {
5131
5151
  var Le = he.ns[Te];
5132
5152
  de(l, "onclosenamespace", { prefix: Te, uri: Le });
5133
5153
  });
5134
5154
  }
5135
- s === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state = D.TEXT;
5155
+ s === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state = I.TEXT;
5136
5156
  }
5137
5157
  function Ze(l) {
5138
5158
  var s = l.entity, C = s.toLowerCase(), x, ie = "";
5139
5159
  return l.ENTITIES[s] ? l.ENTITIES[s] : l.ENTITIES[C] ? l.ENTITIES[C] : (s = C, s.charAt(0) === "#" && (s.charAt(1) === "x" ? (s = s.slice(2), x = parseInt(s, 16), ie = x.toString(16)) : (s = s.slice(1), x = parseInt(s, 10), ie = x.toString(10))), s = s.replace(/^0+/, ""), isNaN(x) || ie.toLowerCase() !== s || x < 0 || x > 1114111 ? (le(l, "Invalid character entity"), "&" + l.entity + ";") : String.fromCodePoint(x));
5140
5160
  }
5141
5161
  function Rt(l, s) {
5142
- s === "<" ? (l.state = D.OPEN_WAKA, l.startTagPosition = l.position) : Y(s) || (le(l, "Non-whitespace before first tag."), l.textNode = s, l.state = D.TEXT);
5162
+ s === "<" ? (l.state = I.OPEN_WAKA, l.startTagPosition = l.position) : Y(s) || (le(l, "Non-whitespace before first tag."), l.textNode = s, l.state = I.TEXT);
5143
5163
  }
5144
5164
  function Je(l, s) {
5145
5165
  var C = "";
@@ -5160,184 +5180,184 @@ Actual: ` + l.attribValue
5160
5180
  for (var C = 0, x = ""; x = Je(l, C++), s.c = x, !!x; )
5161
5181
  switch (s.trackPosition && (s.position++, x === `
5162
5182
  ` ? (s.line++, s.column = 0) : s.column++), s.state) {
5163
- case D.BEGIN:
5164
- if (s.state = D.BEGIN_WHITESPACE, x === "\uFEFF")
5183
+ case I.BEGIN:
5184
+ if (s.state = I.BEGIN_WHITESPACE, x === "\uFEFF")
5165
5185
  continue;
5166
5186
  Rt(s, x);
5167
5187
  continue;
5168
- case D.BEGIN_WHITESPACE:
5188
+ case I.BEGIN_WHITESPACE:
5169
5189
  Rt(s, x);
5170
5190
  continue;
5171
- case D.TEXT:
5191
+ case I.TEXT:
5172
5192
  if (s.sawRoot && !s.closedRoot) {
5173
5193
  for (var Q = C - 1; x && x !== "<" && x !== "&"; )
5174
5194
  x = Je(l, C++), x && s.trackPosition && (s.position++, x === `
5175
5195
  ` ? (s.line++, s.column = 0) : s.column++);
5176
5196
  s.textNode += l.substring(Q, C - 1);
5177
5197
  }
5178
- x === "<" && !(s.sawRoot && s.closedRoot && !s.strict) ? (s.state = D.OPEN_WAKA, s.startTagPosition = s.position) : (!Y(x) && (!s.sawRoot || s.closedRoot) && le(s, "Text data outside of root node."), x === "&" ? s.state = D.TEXT_ENTITY : s.textNode += x);
5198
+ x === "<" && !(s.sawRoot && s.closedRoot && !s.strict) ? (s.state = I.OPEN_WAKA, s.startTagPosition = s.position) : (!Y(x) && (!s.sawRoot || s.closedRoot) && le(s, "Text data outside of root node."), x === "&" ? s.state = I.TEXT_ENTITY : s.textNode += x);
5179
5199
  continue;
5180
- case D.SCRIPT:
5181
- x === "<" ? s.state = D.SCRIPT_ENDING : s.script += x;
5200
+ case I.SCRIPT:
5201
+ x === "<" ? s.state = I.SCRIPT_ENDING : s.script += x;
5182
5202
  continue;
5183
- case D.SCRIPT_ENDING:
5184
- x === "/" ? s.state = D.CLOSE_TAG : (s.script += "<" + x, s.state = D.SCRIPT);
5203
+ case I.SCRIPT_ENDING:
5204
+ x === "/" ? s.state = I.CLOSE_TAG : (s.script += "<" + x, s.state = I.SCRIPT);
5185
5205
  continue;
5186
- case D.OPEN_WAKA:
5206
+ case I.OPEN_WAKA:
5187
5207
  if (x === "!")
5188
- s.state = D.SGML_DECL, s.sgmlDecl = "";
5208
+ s.state = I.SGML_DECL, s.sgmlDecl = "";
5189
5209
  else if (!Y(x)) if (ne(se, x))
5190
- s.state = D.OPEN_TAG, s.tagName = x;
5210
+ s.state = I.OPEN_TAG, s.tagName = x;
5191
5211
  else if (x === "/")
5192
- s.state = D.CLOSE_TAG, s.tagName = "";
5212
+ s.state = I.CLOSE_TAG, s.tagName = "";
5193
5213
  else if (x === "?")
5194
- s.state = D.PROC_INST, s.procInstName = s.procInstBody = "";
5214
+ s.state = I.PROC_INST, s.procInstName = s.procInstBody = "";
5195
5215
  else {
5196
5216
  if (le(s, "Unencoded <"), s.startTagPosition + 1 < s.position) {
5197
5217
  var ie = s.position - s.startTagPosition;
5198
5218
  x = new Array(ie).join(" ") + x;
5199
5219
  }
5200
- s.textNode += "<" + x, s.state = D.TEXT;
5220
+ s.textNode += "<" + x, s.state = I.TEXT;
5201
5221
  }
5202
5222
  continue;
5203
- case D.SGML_DECL:
5223
+ case I.SGML_DECL:
5204
5224
  if (s.sgmlDecl + x === "--") {
5205
- s.state = D.COMMENT, s.comment = "", s.sgmlDecl = "";
5225
+ s.state = I.COMMENT, s.comment = "", s.sgmlDecl = "";
5206
5226
  continue;
5207
5227
  }
5208
- s.doctype && s.doctype !== !0 && s.sgmlDecl ? (s.state = D.DOCTYPE_DTD, s.doctype += "<!" + s.sgmlDecl + x, s.sgmlDecl = "") : (s.sgmlDecl + x).toUpperCase() === W ? (de(s, "onopencdata"), s.state = D.CDATA, s.sgmlDecl = "", s.cdata = "") : (s.sgmlDecl + x).toUpperCase() === J ? (s.state = D.DOCTYPE, (s.doctype || s.sawRoot) && le(
5228
+ s.doctype && s.doctype !== !0 && s.sgmlDecl ? (s.state = I.DOCTYPE_DTD, s.doctype += "<!" + s.sgmlDecl + x, s.sgmlDecl = "") : (s.sgmlDecl + x).toUpperCase() === W ? (de(s, "onopencdata"), s.state = I.CDATA, s.sgmlDecl = "", s.cdata = "") : (s.sgmlDecl + x).toUpperCase() === J ? (s.state = I.DOCTYPE, (s.doctype || s.sawRoot) && le(
5209
5229
  s,
5210
5230
  "Inappropriately located doctype declaration"
5211
- ), s.doctype = "", s.sgmlDecl = "") : x === ">" ? (de(s, "onsgmldeclaration", s.sgmlDecl), s.sgmlDecl = "", s.state = D.TEXT) : (ae(x) && (s.state = D.SGML_DECL_QUOTED), s.sgmlDecl += x);
5231
+ ), s.doctype = "", s.sgmlDecl = "") : x === ">" ? (de(s, "onsgmldeclaration", s.sgmlDecl), s.sgmlDecl = "", s.state = I.TEXT) : (ae(x) && (s.state = I.SGML_DECL_QUOTED), s.sgmlDecl += x);
5212
5232
  continue;
5213
- case D.SGML_DECL_QUOTED:
5214
- x === s.q && (s.state = D.SGML_DECL, s.q = ""), s.sgmlDecl += x;
5233
+ case I.SGML_DECL_QUOTED:
5234
+ x === s.q && (s.state = I.SGML_DECL, s.q = ""), s.sgmlDecl += x;
5215
5235
  continue;
5216
- case D.DOCTYPE:
5217
- x === ">" ? (s.state = D.TEXT, de(s, "ondoctype", s.doctype), s.doctype = !0) : (s.doctype += x, x === "[" ? s.state = D.DOCTYPE_DTD : ae(x) && (s.state = D.DOCTYPE_QUOTED, s.q = x));
5236
+ case I.DOCTYPE:
5237
+ x === ">" ? (s.state = I.TEXT, de(s, "ondoctype", s.doctype), s.doctype = !0) : (s.doctype += x, x === "[" ? s.state = I.DOCTYPE_DTD : ae(x) && (s.state = I.DOCTYPE_QUOTED, s.q = x));
5218
5238
  continue;
5219
- case D.DOCTYPE_QUOTED:
5220
- s.doctype += x, x === s.q && (s.q = "", s.state = D.DOCTYPE);
5239
+ case I.DOCTYPE_QUOTED:
5240
+ s.doctype += x, x === s.q && (s.q = "", s.state = I.DOCTYPE);
5221
5241
  continue;
5222
- case D.DOCTYPE_DTD:
5223
- x === "]" ? (s.doctype += x, s.state = D.DOCTYPE) : x === "<" ? (s.state = D.OPEN_WAKA, s.startTagPosition = s.position) : ae(x) ? (s.doctype += x, s.state = D.DOCTYPE_DTD_QUOTED, s.q = x) : s.doctype += x;
5242
+ case I.DOCTYPE_DTD:
5243
+ x === "]" ? (s.doctype += x, s.state = I.DOCTYPE) : x === "<" ? (s.state = I.OPEN_WAKA, s.startTagPosition = s.position) : ae(x) ? (s.doctype += x, s.state = I.DOCTYPE_DTD_QUOTED, s.q = x) : s.doctype += x;
5224
5244
  continue;
5225
- case D.DOCTYPE_DTD_QUOTED:
5226
- s.doctype += x, x === s.q && (s.state = D.DOCTYPE_DTD, s.q = "");
5245
+ case I.DOCTYPE_DTD_QUOTED:
5246
+ s.doctype += x, x === s.q && (s.state = I.DOCTYPE_DTD, s.q = "");
5227
5247
  continue;
5228
- case D.COMMENT:
5229
- x === "-" ? s.state = D.COMMENT_ENDING : s.comment += x;
5248
+ case I.COMMENT:
5249
+ x === "-" ? s.state = I.COMMENT_ENDING : s.comment += x;
5230
5250
  continue;
5231
- case D.COMMENT_ENDING:
5232
- x === "-" ? (s.state = D.COMMENT_ENDED, s.comment = zt(s.opt, s.comment), s.comment && de(s, "oncomment", s.comment), s.comment = "") : (s.comment += "-" + x, s.state = D.COMMENT);
5251
+ case I.COMMENT_ENDING:
5252
+ x === "-" ? (s.state = I.COMMENT_ENDED, s.comment = zt(s.opt, s.comment), s.comment && de(s, "oncomment", s.comment), s.comment = "") : (s.comment += "-" + x, s.state = I.COMMENT);
5233
5253
  continue;
5234
- case D.COMMENT_ENDED:
5235
- x !== ">" ? (le(s, "Malformed comment"), s.comment += "--" + x, s.state = D.COMMENT) : s.doctype && s.doctype !== !0 ? s.state = D.DOCTYPE_DTD : s.state = D.TEXT;
5254
+ case I.COMMENT_ENDED:
5255
+ x !== ">" ? (le(s, "Malformed comment"), s.comment += "--" + x, s.state = I.COMMENT) : s.doctype && s.doctype !== !0 ? s.state = I.DOCTYPE_DTD : s.state = I.TEXT;
5236
5256
  continue;
5237
- case D.CDATA:
5257
+ case I.CDATA:
5238
5258
  for (var Q = C - 1; x && x !== "]"; )
5239
5259
  x = Je(l, C++), x && s.trackPosition && (s.position++, x === `
5240
5260
  ` ? (s.line++, s.column = 0) : s.column++);
5241
- s.cdata += l.substring(Q, C - 1), x === "]" && (s.state = D.CDATA_ENDING);
5261
+ s.cdata += l.substring(Q, C - 1), x === "]" && (s.state = I.CDATA_ENDING);
5242
5262
  continue;
5243
- case D.CDATA_ENDING:
5244
- x === "]" ? s.state = D.CDATA_ENDING_2 : (s.cdata += "]" + x, s.state = D.CDATA);
5263
+ case I.CDATA_ENDING:
5264
+ x === "]" ? s.state = I.CDATA_ENDING_2 : (s.cdata += "]" + x, s.state = I.CDATA);
5245
5265
  continue;
5246
- case D.CDATA_ENDING_2:
5247
- x === ">" ? (s.cdata && de(s, "oncdata", s.cdata), de(s, "onclosecdata"), s.cdata = "", s.state = D.TEXT) : x === "]" ? s.cdata += "]" : (s.cdata += "]]" + x, s.state = D.CDATA);
5266
+ case I.CDATA_ENDING_2:
5267
+ x === ">" ? (s.cdata && de(s, "oncdata", s.cdata), de(s, "onclosecdata"), s.cdata = "", s.state = I.TEXT) : x === "]" ? s.cdata += "]" : (s.cdata += "]]" + x, s.state = I.CDATA);
5248
5268
  continue;
5249
- case D.PROC_INST:
5250
- x === "?" ? s.state = D.PROC_INST_ENDING : Y(x) ? s.state = D.PROC_INST_BODY : s.procInstName += x;
5269
+ case I.PROC_INST:
5270
+ x === "?" ? s.state = I.PROC_INST_ENDING : Y(x) ? s.state = I.PROC_INST_BODY : s.procInstName += x;
5251
5271
  continue;
5252
- case D.PROC_INST_BODY:
5272
+ case I.PROC_INST_BODY:
5253
5273
  if (!s.procInstBody && Y(x))
5254
5274
  continue;
5255
- x === "?" ? s.state = D.PROC_INST_ENDING : s.procInstBody += x;
5275
+ x === "?" ? s.state = I.PROC_INST_ENDING : s.procInstBody += x;
5256
5276
  continue;
5257
- case D.PROC_INST_ENDING:
5277
+ case I.PROC_INST_ENDING:
5258
5278
  x === ">" ? (de(s, "onprocessinginstruction", {
5259
5279
  name: s.procInstName,
5260
5280
  body: s.procInstBody
5261
- }), s.procInstName = s.procInstBody = "", s.state = D.TEXT) : (s.procInstBody += "?" + x, s.state = D.PROC_INST_BODY);
5281
+ }), s.procInstName = s.procInstBody = "", s.state = I.TEXT) : (s.procInstBody += "?" + x, s.state = I.PROC_INST_BODY);
5262
5282
  continue;
5263
- case D.OPEN_TAG:
5264
- ne(ce, x) ? s.tagName += x : (Xe(s), x === ">" ? qe(s) : x === "/" ? s.state = D.OPEN_TAG_SLASH : (Y(x) || le(s, "Invalid character in tag name"), s.state = D.ATTRIB));
5283
+ case I.OPEN_TAG:
5284
+ ne(ce, x) ? s.tagName += x : (Xe(s), x === ">" ? qe(s) : x === "/" ? s.state = I.OPEN_TAG_SLASH : (Y(x) || le(s, "Invalid character in tag name"), s.state = I.ATTRIB));
5265
5285
  continue;
5266
- case D.OPEN_TAG_SLASH:
5267
- x === ">" ? (qe(s, !0), Dt(s)) : (le(
5286
+ case I.OPEN_TAG_SLASH:
5287
+ x === ">" ? (qe(s, !0), It(s)) : (le(
5268
5288
  s,
5269
5289
  "Forward-slash in opening tag not followed by >"
5270
- ), s.state = D.ATTRIB);
5290
+ ), s.state = I.ATTRIB);
5271
5291
  continue;
5272
- case D.ATTRIB:
5292
+ case I.ATTRIB:
5273
5293
  if (Y(x))
5274
5294
  continue;
5275
- x === ">" ? qe(s) : x === "/" ? s.state = D.OPEN_TAG_SLASH : ne(se, x) ? (s.attribName = x, s.attribValue = "", s.state = D.ATTRIB_NAME) : le(s, "Invalid attribute name");
5295
+ x === ">" ? qe(s) : x === "/" ? s.state = I.OPEN_TAG_SLASH : ne(se, x) ? (s.attribName = x, s.attribValue = "", s.state = I.ATTRIB_NAME) : le(s, "Invalid attribute name");
5276
5296
  continue;
5277
- case D.ATTRIB_NAME:
5278
- x === "=" ? s.state = D.ATTRIB_VALUE : x === ">" ? (le(s, "Attribute without value"), s.attribValue = s.attribName, Fe(s), qe(s)) : Y(x) ? s.state = D.ATTRIB_NAME_SAW_WHITE : ne(ce, x) ? s.attribName += x : le(s, "Invalid attribute name");
5297
+ case I.ATTRIB_NAME:
5298
+ x === "=" ? s.state = I.ATTRIB_VALUE : x === ">" ? (le(s, "Attribute without value"), s.attribValue = s.attribName, Fe(s), qe(s)) : Y(x) ? s.state = I.ATTRIB_NAME_SAW_WHITE : ne(ce, x) ? s.attribName += x : le(s, "Invalid attribute name");
5279
5299
  continue;
5280
- case D.ATTRIB_NAME_SAW_WHITE:
5300
+ case I.ATTRIB_NAME_SAW_WHITE:
5281
5301
  if (x === "=")
5282
- s.state = D.ATTRIB_VALUE;
5302
+ s.state = I.ATTRIB_VALUE;
5283
5303
  else {
5284
5304
  if (Y(x))
5285
5305
  continue;
5286
5306
  le(s, "Attribute without value"), s.tag.attributes[s.attribName] = "", s.attribValue = "", de(s, "onattribute", {
5287
5307
  name: s.attribName,
5288
5308
  value: ""
5289
- }), s.attribName = "", x === ">" ? qe(s) : ne(se, x) ? (s.attribName = x, s.state = D.ATTRIB_NAME) : (le(s, "Invalid attribute name"), s.state = D.ATTRIB);
5309
+ }), s.attribName = "", x === ">" ? qe(s) : ne(se, x) ? (s.attribName = x, s.state = I.ATTRIB_NAME) : (le(s, "Invalid attribute name"), s.state = I.ATTRIB);
5290
5310
  }
5291
5311
  continue;
5292
- case D.ATTRIB_VALUE:
5312
+ case I.ATTRIB_VALUE:
5293
5313
  if (Y(x))
5294
5314
  continue;
5295
- ae(x) ? (s.q = x, s.state = D.ATTRIB_VALUE_QUOTED) : (s.opt.unquotedAttributeValues || Ke(s, "Unquoted attribute value"), s.state = D.ATTRIB_VALUE_UNQUOTED, s.attribValue = x);
5315
+ ae(x) ? (s.q = x, s.state = I.ATTRIB_VALUE_QUOTED) : (s.opt.unquotedAttributeValues || Ke(s, "Unquoted attribute value"), s.state = I.ATTRIB_VALUE_UNQUOTED, s.attribValue = x);
5296
5316
  continue;
5297
- case D.ATTRIB_VALUE_QUOTED:
5317
+ case I.ATTRIB_VALUE_QUOTED:
5298
5318
  if (x !== s.q) {
5299
- x === "&" ? s.state = D.ATTRIB_VALUE_ENTITY_Q : s.attribValue += x;
5319
+ x === "&" ? s.state = I.ATTRIB_VALUE_ENTITY_Q : s.attribValue += x;
5300
5320
  continue;
5301
5321
  }
5302
- Fe(s), s.q = "", s.state = D.ATTRIB_VALUE_CLOSED;
5322
+ Fe(s), s.q = "", s.state = I.ATTRIB_VALUE_CLOSED;
5303
5323
  continue;
5304
- case D.ATTRIB_VALUE_CLOSED:
5305
- Y(x) ? s.state = D.ATTRIB : x === ">" ? qe(s) : x === "/" ? s.state = D.OPEN_TAG_SLASH : ne(se, x) ? (le(s, "No whitespace between attributes"), s.attribName = x, s.attribValue = "", s.state = D.ATTRIB_NAME) : le(s, "Invalid attribute name");
5324
+ case I.ATTRIB_VALUE_CLOSED:
5325
+ Y(x) ? s.state = I.ATTRIB : x === ">" ? qe(s) : x === "/" ? s.state = I.OPEN_TAG_SLASH : ne(se, x) ? (le(s, "No whitespace between attributes"), s.attribName = x, s.attribValue = "", s.state = I.ATTRIB_NAME) : le(s, "Invalid attribute name");
5306
5326
  continue;
5307
- case D.ATTRIB_VALUE_UNQUOTED:
5327
+ case I.ATTRIB_VALUE_UNQUOTED:
5308
5328
  if (!me(x)) {
5309
- x === "&" ? s.state = D.ATTRIB_VALUE_ENTITY_U : s.attribValue += x;
5329
+ x === "&" ? s.state = I.ATTRIB_VALUE_ENTITY_U : s.attribValue += x;
5310
5330
  continue;
5311
5331
  }
5312
- Fe(s), x === ">" ? qe(s) : s.state = D.ATTRIB;
5332
+ Fe(s), x === ">" ? qe(s) : s.state = I.ATTRIB;
5313
5333
  continue;
5314
- case D.CLOSE_TAG:
5334
+ case I.CLOSE_TAG:
5315
5335
  if (s.tagName)
5316
- x === ">" ? Dt(s) : ne(ce, x) ? s.tagName += x : s.script ? (s.script += "</" + s.tagName + x, s.tagName = "", s.state = D.SCRIPT) : (Y(x) || le(s, "Invalid tagname in closing tag"), s.state = D.CLOSE_TAG_SAW_WHITE);
5336
+ x === ">" ? It(s) : ne(ce, x) ? s.tagName += x : s.script ? (s.script += "</" + s.tagName + x, s.tagName = "", s.state = I.SCRIPT) : (Y(x) || le(s, "Invalid tagname in closing tag"), s.state = I.CLOSE_TAG_SAW_WHITE);
5317
5337
  else {
5318
5338
  if (Y(x))
5319
5339
  continue;
5320
- Re(se, x) ? s.script ? (s.script += "</" + x, s.state = D.SCRIPT) : le(s, "Invalid tagname in closing tag.") : s.tagName = x;
5340
+ Re(se, x) ? s.script ? (s.script += "</" + x, s.state = I.SCRIPT) : le(s, "Invalid tagname in closing tag.") : s.tagName = x;
5321
5341
  }
5322
5342
  continue;
5323
- case D.CLOSE_TAG_SAW_WHITE:
5343
+ case I.CLOSE_TAG_SAW_WHITE:
5324
5344
  if (Y(x))
5325
5345
  continue;
5326
- x === ">" ? Dt(s) : le(s, "Invalid characters in closing tag");
5346
+ x === ">" ? It(s) : le(s, "Invalid characters in closing tag");
5327
5347
  continue;
5328
- case D.TEXT_ENTITY:
5329
- case D.ATTRIB_VALUE_ENTITY_Q:
5330
- case D.ATTRIB_VALUE_ENTITY_U:
5331
- var he, Oe;
5348
+ case I.TEXT_ENTITY:
5349
+ case I.ATTRIB_VALUE_ENTITY_Q:
5350
+ case I.ATTRIB_VALUE_ENTITY_U:
5351
+ var he, Ae;
5332
5352
  switch (s.state) {
5333
- case D.TEXT_ENTITY:
5334
- he = D.TEXT, Oe = "textNode";
5353
+ case I.TEXT_ENTITY:
5354
+ he = I.TEXT, Ae = "textNode";
5335
5355
  break;
5336
- case D.ATTRIB_VALUE_ENTITY_Q:
5337
- he = D.ATTRIB_VALUE_QUOTED, Oe = "attribValue";
5356
+ case I.ATTRIB_VALUE_ENTITY_Q:
5357
+ he = I.ATTRIB_VALUE_QUOTED, Ae = "attribValue";
5338
5358
  break;
5339
- case D.ATTRIB_VALUE_ENTITY_U:
5340
- he = D.ATTRIB_VALUE_UNQUOTED, Oe = "attribValue";
5359
+ case I.ATTRIB_VALUE_ENTITY_U:
5360
+ he = I.ATTRIB_VALUE_UNQUOTED, Ae = "attribValue";
5341
5361
  break;
5342
5362
  }
5343
5363
  if (x === ";") {
@@ -5348,8 +5368,8 @@ Actual: ` + l.attribValue
5348
5368
  ), (s.entityDepth += 1) > s.opt.maxEntityDepth && Ke(
5349
5369
  s,
5350
5370
  "Parsed entity depth exceeds max entity depth"
5351
- ), s.entity = "", s.state = he, s.write(ye), s.entityDepth -= 1) : (s[Oe] += ye, s.entity = "", s.state = he);
5352
- } else ne(s.entity.length ? ee : xe, x) ? s.entity += x : (le(s, "Invalid character in entity name"), s[Oe] += "&" + s.entity + x, s.entity = "", s.state = he);
5371
+ ), s.entity = "", s.state = he, s.write(ye), s.entityDepth -= 1) : (s[Ae] += ye, s.entity = "", s.state = he);
5372
+ } else ne(s.entity.length ? ee : xe, x) ? s.entity += x : (le(s, "Invalid character in entity name"), s[Ae] += "&" + s.entity + x, s.entity = "", s.state = he);
5353
5373
  continue;
5354
5374
  default:
5355
5375
  throw new Error(s, "Unknown state: " + s.state);
@@ -5358,17 +5378,17 @@ Actual: ` + l.attribValue
5358
5378
  }
5359
5379
  String.fromCodePoint || (function() {
5360
5380
  var l = String.fromCharCode, s = Math.floor, C = function() {
5361
- var x = 16384, ie = [], Q, he, Oe = -1, ye = arguments.length;
5381
+ var x = 16384, ie = [], Q, he, Ae = -1, ye = arguments.length;
5362
5382
  if (!ye)
5363
5383
  return "";
5364
- for (var tt = ""; ++Oe < ye; ) {
5365
- var Te = Number(arguments[Oe]);
5384
+ for (var tt = ""; ++Ae < ye; ) {
5385
+ var Te = Number(arguments[Ae]);
5366
5386
  if (!isFinite(Te) || // `NaN`, `+Infinity`, or `-Infinity`
5367
5387
  Te < 0 || // not a valid Unicode code point
5368
5388
  Te > 1114111 || // not a valid Unicode code point
5369
5389
  s(Te) !== Te)
5370
5390
  throw RangeError("Invalid code point: " + Te);
5371
- Te <= 65535 ? ie.push(Te) : (Te -= 65536, Q = (Te >> 10) + 55296, he = Te % 1024 + 56320, ie.push(Q, he)), (Oe + 1 === ye || ie.length > x) && (tt += l.apply(null, ie), ie.length = 0);
5391
+ Te <= 65535 ? ie.push(Te) : (Te -= 65536, Q = (Te >> 10) + 55296, he = Te % 1024 + 56320, ie.push(Q, he)), (Ae + 1 === ye || ie.length > x) && (tt += l.apply(null, ie), ie.length = 0);
5372
5392
  }
5373
5393
  return tt;
5374
5394
  };
@@ -5381,15 +5401,15 @@ Actual: ` + l.attribValue
5381
5401
  })(m);
5382
5402
  })(cr)), cr;
5383
5403
  }
5384
- var Xi = $i();
5385
- function Wi(m) {
5404
+ var Wi = Xi();
5405
+ function Yi(m) {
5386
5406
  const { dialecteConfig: o, useCustomRecordsIds: c } = m, i = o.io.hooks;
5387
5407
  let h = {
5388
5408
  defaultNamespace: null,
5389
5409
  stack: [],
5390
5410
  recordsBatch: []
5391
5411
  };
5392
- const y = Xi.parser(
5412
+ const y = Wi.parser(
5393
5413
  !0,
5394
5414
  // strict mode
5395
5415
  {
@@ -5405,18 +5425,18 @@ function Wi(m) {
5405
5425
  // Enable namespace handling
5406
5426
  }
5407
5427
  );
5408
- y.onopentag = (j) => h = Yi({
5409
- node: j,
5428
+ y.onopentag = (B) => h = zi({
5429
+ node: B,
5410
5430
  state: h,
5411
5431
  dialecteConfig: o,
5412
5432
  useCustomRecordsIds: c
5413
- }), y.ontext = (j) => h = zi({ text: j, state: h }), y.onclosetag = () => ({ updatedState: h } = Qi({
5433
+ }), y.ontext = (B) => h = Qi({ text: B, state: h }), y.onclosetag = () => ({ updatedState: h } = Hi({
5414
5434
  state: h,
5415
5435
  ioHooks: i
5416
- })), y.onerror = Hi;
5436
+ })), y.onerror = Zi;
5417
5437
  function w() {
5418
- const j = h.recordsBatch;
5419
- return h.recordsBatch = [], j;
5438
+ const B = h.recordsBatch;
5439
+ return h.recordsBatch = [], B;
5420
5440
  }
5421
5441
  function R() {
5422
5442
  return h.recordsBatch.length;
@@ -5427,17 +5447,17 @@ function Wi(m) {
5427
5447
  getSize: R
5428
5448
  };
5429
5449
  }
5430
- function Yi(m) {
5431
- const { node: o, state: c, dialecteConfig: i, useCustomRecordsIds: d } = m, h = { ...c }, y = Zi(o);
5432
- h.defaultNamespace || (h.defaultNamespace = Ji({
5450
+ function zi(m) {
5451
+ const { node: o, state: c, dialecteConfig: i, useCustomRecordsIds: d } = m, h = { ...c }, y = Ji(o);
5452
+ h.defaultNamespace || (h.defaultNamespace = eo({
5433
5453
  element: o,
5434
5454
  defaultNamespace: i.namespaces.default,
5435
5455
  rootElementName: i.rootElementName
5436
5456
  }));
5437
- const w = eo(o, h.defaultNamespace), R = ro({ attributes: o.attributes, useCustomRecordsIds: d }), j = ao({
5457
+ const w = to(o, h.defaultNamespace), R = ao({ attributes: o.attributes, useCustomRecordsIds: d }), B = io({
5438
5458
  attributes: o.attributes,
5439
5459
  useCustomRecordsIds: d
5440
- }), X = to(j), W = no(c.stack), J = {
5460
+ }), X = no(B), W = ro(c.stack), J = {
5441
5461
  id: R,
5442
5462
  tagName: y,
5443
5463
  namespace: w,
@@ -5448,11 +5468,11 @@ function Yi(m) {
5448
5468
  };
5449
5469
  return h.stack.push(J), h;
5450
5470
  }
5451
- function zi(m) {
5471
+ function Qi(m) {
5452
5472
  const { text: o, state: c } = m;
5453
5473
  return o && c.stack.length > 0 && (c.stack[c.stack.length - 1].value += o), c;
5454
5474
  }
5455
- function Qi(m) {
5475
+ function Hi(m) {
5456
5476
  const { state: o, ioHooks: c } = m, i = o.stack.at(-1);
5457
5477
  let d = o.stack.slice(0, -1);
5458
5478
  const h = [...o.recordsBatch];
@@ -5471,7 +5491,7 @@ function Qi(m) {
5471
5491
  ]
5472
5492
  } : w
5473
5493
  );
5474
- } else i.parent && Ki({
5494
+ } else i.parent && qi({
5475
5495
  parentId: i.parent.id,
5476
5496
  child: { id: i.id, tagName: i.tagName }
5477
5497
  });
@@ -5485,13 +5505,13 @@ function Qi(m) {
5485
5505
  }
5486
5506
  };
5487
5507
  }
5488
- function Hi(m) {
5508
+ function Zi(m) {
5489
5509
  return new Error(`XML parsing error: ${m}`);
5490
5510
  }
5491
- function Zi(m) {
5511
+ function Ji(m) {
5492
5512
  return m.local;
5493
5513
  }
5494
- function Ji(m) {
5514
+ function eo(m) {
5495
5515
  const { element: o, defaultNamespace: c, rootElementName: i } = m;
5496
5516
  return Ue(o.name === i, {
5497
5517
  detail: `Expected root element <${i}>, got <${o.name}>`
@@ -5500,13 +5520,13 @@ function Ji(m) {
5500
5520
  uri: o.attributes.xmlns.value
5501
5521
  } : c;
5502
5522
  }
5503
- function eo(m, o) {
5504
- return Mi(m) ? {
5523
+ function to(m, o) {
5524
+ return Ki(m) ? {
5505
5525
  prefix: m.prefix,
5506
5526
  uri: m.uri
5507
5527
  } : o;
5508
5528
  }
5509
- function to(m) {
5529
+ function no(m) {
5510
5530
  return m.map((o) => {
5511
5531
  const c = o.prefix && o.uri ? {
5512
5532
  prefix: o.prefix,
@@ -5519,60 +5539,60 @@ function to(m) {
5519
5539
  };
5520
5540
  });
5521
5541
  }
5522
- function no(m) {
5542
+ function ro(m) {
5523
5543
  if (m.length === 0) return null;
5524
5544
  const o = m[m.length - 1];
5525
5545
  return o ? { id: o.id, tagName: o.tagName } : null;
5526
5546
  }
5527
- function ro(m) {
5528
- const { attributes: o, useCustomRecordsIds: c } = m, i = o[sa];
5547
+ function ao(m) {
5548
+ const { attributes: o, useCustomRecordsIds: c } = m, i = o[ua];
5529
5549
  return c && i && i.value ? i.value : crypto.randomUUID();
5530
5550
  }
5531
- function ao(m) {
5551
+ function io(m) {
5532
5552
  const { attributes: o, useCustomRecordsIds: c } = m;
5533
- return c ? Object.values(o).filter((i) => i.name !== sa) : Object.values(o);
5553
+ return c ? Object.values(o).filter((i) => i.name !== ua) : Object.values(o);
5534
5554
  }
5535
- const na = {
5555
+ const ra = {
5536
5556
  useBrowserApi: !0,
5537
5557
  chunkSize: 32 * 1024,
5538
5558
  // 32KB
5539
5559
  batchSize: 2e3
5540
5560
  };
5541
- async function jo(m) {
5561
+ async function Mo(m) {
5542
5562
  const { files: o, dialecteConfig: c, useCustomRecordsIds: i = !1 } = m, d = [];
5543
5563
  if (o.length === 0) throw new Error("No files provided for import.");
5544
- const { importOptions: h = na, supportedFileExtensions: y } = c.io, w = {
5545
- ...na,
5564
+ const { importOptions: h = ra, supportedFileExtensions: y } = c.io, w = {
5565
+ ...ra,
5546
5566
  ...h
5547
5567
  };
5548
5568
  for (const R of o) {
5549
- if (!io({ file: R, supportedExtensions: y })) {
5569
+ if (!oo({ file: R, supportedExtensions: y })) {
5550
5570
  console.error(`Unsupported file type: ${R.name}`);
5551
5571
  continue;
5552
5572
  }
5553
5573
  R.size === 0 && console.warn(`File is empty: ${R.name}`);
5554
- const j = await so({
5574
+ const B = await uo({
5555
5575
  file: R,
5556
5576
  dialecteConfig: c,
5557
5577
  options: w,
5558
5578
  useCustomRecordsIds: i
5559
5579
  });
5560
- d.push(j);
5580
+ d.push(B);
5561
5581
  }
5562
5582
  return d;
5563
5583
  }
5564
- function io(m) {
5584
+ function oo(m) {
5565
5585
  const { file: o, supportedExtensions: c } = m;
5566
5586
  return c.some((i) => o.name.toLowerCase().endsWith(i));
5567
5587
  }
5568
- function oo(m) {
5588
+ function so(m) {
5569
5589
  return m.name.replace(/\.[^.]+$/, "");
5570
5590
  }
5571
- async function so(m) {
5572
- const { file: o, dialecteConfig: c, options: i, useCustomRecordsIds: d } = m, h = oo(o), y = await Fi({ databaseName: h, dialecteConfig: c });
5591
+ async function uo(m) {
5592
+ const { file: o, dialecteConfig: c, options: i, useCustomRecordsIds: d } = m, h = so(o), y = await Bi({ databaseName: h, dialecteConfig: c });
5573
5593
  try {
5574
5594
  const w = c.database.tables.xmlElements.name;
5575
- if (await y.table(w).clear(), i.useBrowserApi && o.size !== 0 && await uo({
5595
+ if (await y.table(w).clear(), i.useBrowserApi && o.size !== 0 && await co({
5576
5596
  file: o,
5577
5597
  databaseInstance: y,
5578
5598
  elementsTableName: w,
@@ -5583,8 +5603,8 @@ async function so(m) {
5583
5603
  batchSize: i.batchSize
5584
5604
  }
5585
5605
  }), c.io.hooks?.afterImport) {
5586
- const { creates: R, updates: j, deletes: X } = await c.io.hooks.afterImport();
5587
- R?.length && await va({ databaseInstance: y, elementsTableName: w, records: R }), j?.length && await Bi({ databaseInstance: y, elementsTableName: w, updates: j }), X?.length && await ji({ databaseInstance: y, elementsTableName: w, ids: X });
5606
+ const { creates: R, updates: B, deletes: X } = await c.io.hooks.afterImport();
5607
+ R?.length && await ba({ databaseInstance: y, elementsTableName: w, records: R }), B?.length && await ji({ databaseInstance: y, elementsTableName: w, updates: B }), X?.length && await Mi({ databaseInstance: y, elementsTableName: w, ids: X });
5588
5608
  }
5589
5609
  return h;
5590
5610
  } catch (w) {
@@ -5593,29 +5613,29 @@ async function so(m) {
5593
5613
  y.close();
5594
5614
  }
5595
5615
  }
5596
- async function uo(m) {
5597
- const { file: o, databaseInstance: c, elementsTableName: i, dialecteConfig: d, options: h } = m, y = o.stream().getReader(), w = Wi({
5616
+ async function co(m) {
5617
+ const { file: o, databaseInstance: c, elementsTableName: i, dialecteConfig: d, options: h } = m, y = o.stream().getReader(), w = Yi({
5598
5618
  dialecteConfig: d,
5599
5619
  useCustomRecordsIds: h.useCustomRecordsIds
5600
- }), R = new TextDecoder(), j = new Uint8Array(0);
5620
+ }), R = new TextDecoder(), B = new Uint8Array(0);
5601
5621
  return await hr({
5602
5622
  databaseInstance: c,
5603
5623
  elementsTableName: i,
5604
5624
  reader: y,
5605
5625
  sax: w,
5606
5626
  textDecoder: R,
5607
- buffer: j,
5627
+ buffer: B,
5608
5628
  options: h
5609
5629
  });
5610
5630
  }
5611
5631
  async function hr(m) {
5612
- const { databaseInstance: o, elementsTableName: c, reader: i, sax: d, textDecoder: h, buffer: y, options: w } = m, { chunkSize: R, batchSize: j } = w, { done: X, value: W } = await i.read();
5632
+ const { databaseInstance: o, elementsTableName: c, reader: i, sax: d, textDecoder: h, buffer: y, options: w } = m, { chunkSize: R, batchSize: B } = w, { done: X, value: W } = await i.read();
5613
5633
  if (X) {
5614
5634
  if (y.length > 0) {
5615
5635
  const fe = h.decode(y);
5616
5636
  d.parser.write(fe);
5617
5637
  }
5618
- return d.parser.close(), await ra({
5638
+ return d.parser.close(), await aa({
5619
5639
  databaseInstance: o,
5620
5640
  elementsTableName: c,
5621
5641
  sax: d,
@@ -5628,33 +5648,33 @@ async function hr(m) {
5628
5648
  for (J.set(y), J.set(W, y.length); J.length >= R; ) {
5629
5649
  const fe = J.slice(0, R);
5630
5650
  J = J.slice(R);
5631
- const B = h.decode(fe, { stream: !0 });
5632
- d.parser.write(B), await ra({
5651
+ const j = h.decode(fe, { stream: !0 });
5652
+ d.parser.write(j), await aa({
5633
5653
  databaseInstance: o,
5634
5654
  elementsTableName: c,
5635
5655
  sax: d,
5636
- batchSize: j
5656
+ batchSize: B
5637
5657
  });
5638
5658
  }
5639
5659
  return await hr({ ...m, buffer: J });
5640
5660
  }
5641
- async function ra(m) {
5661
+ async function aa(m) {
5642
5662
  const { databaseInstance: o, elementsTableName: c, sax: i, batchSize: d } = m;
5643
5663
  if (i.getSize() >= d) {
5644
- const y = i.drainBatch(), w = qi({
5664
+ const y = i.drainBatch(), w = Li({
5645
5665
  currentBatch: y
5646
5666
  });
5647
- await va({
5667
+ await ba({
5648
5668
  databaseInstance: o,
5649
5669
  elementsTableName: c,
5650
5670
  records: w
5651
5671
  });
5652
5672
  }
5653
5673
  }
5654
- const ba = "_temp-idb-id";
5655
- var Wt = { exports: {} }, Tn = { exports: {} }, aa;
5656
- function co() {
5657
- return aa || (aa = 1, (function(m, o) {
5674
+ const wa = "_temp-idb-id";
5675
+ var Wt = { exports: {} }, Tn = { exports: {} }, ia;
5676
+ function lo() {
5677
+ return ia || (ia = 1, (function(m, o) {
5658
5678
  Object.defineProperty(o, "__esModule", { value: !0 }), o.ParsingError = void 0;
5659
5679
  class c extends Error {
5660
5680
  constructor(Y, ae) {
@@ -5667,7 +5687,7 @@ function co() {
5667
5687
  return R(!1) || J() || W() || X() || w();
5668
5688
  }
5669
5689
  function h() {
5670
- return F(/\s*/), R(!0) || W() || j() || w();
5690
+ return F(/\s*/), R(!0) || W() || B() || w();
5671
5691
  }
5672
5692
  function y() {
5673
5693
  const ee = w(), Y = [];
@@ -5747,7 +5767,7 @@ function co() {
5747
5767
  node: ae
5748
5768
  };
5749
5769
  }
5750
- function j() {
5770
+ function B() {
5751
5771
  const ee = F(/^<!DOCTYPE\s+\S+\s+SYSTEM[^>]*>/) || F(/^<!DOCTYPE\s+\S+\s+PUBLIC[^>]*>/) || F(/^<!DOCTYPE\s+\S+\s*\[[^\]]*]>/) || F(/^<!DOCTYPE\s+\S+\s*>/);
5752
5772
  if (ee) {
5753
5773
  const Y = {
@@ -5806,10 +5826,10 @@ function co() {
5806
5826
  if (ee)
5807
5827
  return {
5808
5828
  name: ee[1].trim(),
5809
- value: B(ee[2].trim())
5829
+ value: j(ee[2].trim())
5810
5830
  };
5811
5831
  }
5812
- function B(ee) {
5832
+ function j(ee) {
5813
5833
  return ee.replace(/^['"]|['"]$/g, "");
5814
5834
  }
5815
5835
  function F(ee) {
@@ -5834,63 +5854,63 @@ function co() {
5834
5854
  m.exports = xe, o.default = xe;
5835
5855
  })(Tn, Tn.exports)), Tn.exports;
5836
5856
  }
5837
- var ia = Wt.exports, oa;
5838
- function lo() {
5839
- return oa || (oa = 1, (function(m, o) {
5840
- var c = ia && ia.__importDefault || function(B) {
5841
- return B && B.__esModule ? B : { default: B };
5857
+ var oa = Wt.exports, sa;
5858
+ function fo() {
5859
+ return sa || (sa = 1, (function(m, o) {
5860
+ var c = oa && oa.__importDefault || function(j) {
5861
+ return j && j.__esModule ? j : { default: j };
5842
5862
  };
5843
5863
  Object.defineProperty(o, "__esModule", { value: !0 });
5844
- const i = c(/* @__PURE__ */ co());
5845
- function d(B) {
5846
- if (!B.options.indentation && !B.options.lineSeparator)
5864
+ const i = c(/* @__PURE__ */ lo());
5865
+ function d(j) {
5866
+ if (!j.options.indentation && !j.options.lineSeparator)
5847
5867
  return;
5848
- B.content += B.options.lineSeparator;
5868
+ j.content += j.options.lineSeparator;
5849
5869
  let F;
5850
- for (F = 0; F < B.level; F++)
5851
- B.content += B.options.indentation;
5870
+ for (F = 0; F < j.level; F++)
5871
+ j.content += j.options.indentation;
5852
5872
  }
5853
- function h(B) {
5854
- B.content = B.content.replace(/ +$/, "");
5873
+ function h(j) {
5874
+ j.content = j.content.replace(/ +$/, "");
5855
5875
  let F;
5856
- for (F = 0; F < B.level; F++)
5857
- B.content += B.options.indentation;
5876
+ for (F = 0; F < j.level; F++)
5877
+ j.content += j.options.indentation;
5858
5878
  }
5859
- function y(B, F) {
5860
- B.content += F;
5879
+ function y(j, F) {
5880
+ j.content += F;
5861
5881
  }
5862
- function w(B, F, se) {
5863
- if (B.type === "Element")
5864
- X(B, F, se);
5865
- else if (B.type === "ProcessingInstruction")
5866
- J(B, F);
5867
- else if (typeof B.content == "string")
5868
- R(B.content, F, se);
5882
+ function w(j, F, se) {
5883
+ if (j.type === "Element")
5884
+ X(j, F, se);
5885
+ else if (j.type === "ProcessingInstruction")
5886
+ J(j, F);
5887
+ else if (typeof j.content == "string")
5888
+ R(j.content, F, se);
5869
5889
  else
5870
- throw new Error("Unknown node type: " + B.type);
5890
+ throw new Error("Unknown node type: " + j.type);
5871
5891
  }
5872
- function R(B, F, se) {
5892
+ function R(j, F, se) {
5873
5893
  if (!se) {
5874
- const ce = B.trim();
5875
- (F.options.lineSeparator || ce.length === 0) && (B = ce);
5894
+ const ce = j.trim();
5895
+ (F.options.lineSeparator || ce.length === 0) && (j = ce);
5876
5896
  }
5877
- B.length > 0 && (!se && F.content.length > 0 && d(F), y(F, B));
5897
+ j.length > 0 && (!se && F.content.length > 0 && d(F), y(F, j));
5878
5898
  }
5879
- function j(B, F) {
5880
- const se = "/" + B.join("/"), ce = B[B.length - 1];
5899
+ function B(j, F) {
5900
+ const se = "/" + j.join("/"), ce = j[j.length - 1];
5881
5901
  return F.includes(ce) || F.includes(se);
5882
5902
  }
5883
- function X(B, F, se) {
5884
- if (F.path.push(B.name), !se && F.content.length > 0 && d(F), y(F, "<" + B.name), W(F, B.attributes), B.children === null || F.options.forceSelfClosingEmptyTag && B.children.length === 0) {
5903
+ function X(j, F, se) {
5904
+ if (F.path.push(j.name), !se && F.content.length > 0 && d(F), y(F, "<" + j.name), W(F, j.attributes), j.children === null || F.options.forceSelfClosingEmptyTag && j.children.length === 0) {
5885
5905
  const ce = F.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>";
5886
5906
  y(F, ce);
5887
- } else if (B.children.length === 0)
5888
- y(F, "></" + B.name + ">");
5907
+ } else if (j.children.length === 0)
5908
+ y(F, "></" + j.name + ">");
5889
5909
  else {
5890
- const ce = B.children;
5910
+ const ce = j.children;
5891
5911
  y(F, ">"), F.level++;
5892
- let xe = B.attributes["xml:space"] === "preserve" || se, ee = !1;
5893
- if (!xe && F.options.ignoredPaths && (ee = j(F.path, F.options.ignoredPaths), xe = ee), !xe && F.options.collapseContent) {
5912
+ let xe = j.attributes["xml:space"] === "preserve" || se, ee = !1;
5913
+ if (!xe && F.options.ignoredPaths && (ee = B(F.path, F.options.ignoredPaths), xe = ee), !xe && F.options.collapseContent) {
5894
5914
  let Y = !1, ae = !1, me = !1;
5895
5915
  ce.forEach(function(ne, Re) {
5896
5916
  ne.type === "Text" ? (ne.content.includes(`
@@ -5899,24 +5919,24 @@ function lo() {
5899
5919
  }
5900
5920
  ce.forEach(function(Y) {
5901
5921
  w(Y, F, se || xe);
5902
- }), F.level--, !se && !xe && d(F), ee && h(F), y(F, "</" + B.name + ">");
5922
+ }), F.level--, !se && !xe && d(F), ee && h(F), y(F, "</" + j.name + ">");
5903
5923
  }
5904
5924
  F.path.pop();
5905
5925
  }
5906
- function W(B, F) {
5926
+ function W(j, F) {
5907
5927
  Object.keys(F).forEach(function(se) {
5908
5928
  const ce = F[se].replace(/"/g, "&quot;");
5909
- y(B, " " + se + '="' + ce + '"');
5929
+ y(j, " " + se + '="' + ce + '"');
5910
5930
  });
5911
5931
  }
5912
- function J(B, F) {
5913
- F.content.length > 0 && d(F), y(F, "<?" + B.name), y(F, " " + B.content.trim()), y(F, "?>");
5932
+ function J(j, F) {
5933
+ F.content.length > 0 && d(F), y(F, "<?" + j.name), y(F, " " + j.content.trim()), y(F, "?>");
5914
5934
  }
5915
- function fe(B, F = {}) {
5935
+ function fe(j, F = {}) {
5916
5936
  F.indentation = "indentation" in F ? F.indentation : " ", F.collapseContent = F.collapseContent === !0, F.lineSeparator = "lineSeparator" in F ? F.lineSeparator : `\r
5917
5937
  `, F.whiteSpaceAtEndOfSelfclosingTag = F.whiteSpaceAtEndOfSelfclosingTag === !0, F.throwOnFailure = F.throwOnFailure !== !1;
5918
5938
  try {
5919
- const se = (0, i.default)(B, { filter: F.filter, strictMode: F.strictMode }), ce = { content: "", level: 0, options: F, path: [] };
5939
+ const se = (0, i.default)(j, { filter: F.filter, strictMode: F.strictMode }), ce = { content: "", level: 0, options: F, path: [] };
5920
5940
  return se.declaration && J(se.declaration, ce), se.children.forEach(function(xe) {
5921
5941
  w(xe, ce, !1);
5922
5942
  }), F.lineSeparator ? ce.content.replace(/\r\n/g, `
@@ -5924,20 +5944,20 @@ function lo() {
5924
5944
  } catch (se) {
5925
5945
  if (F.throwOnFailure)
5926
5946
  throw se;
5927
- return B;
5947
+ return j;
5928
5948
  }
5929
5949
  }
5930
- fe.minify = (B, F = {}) => fe(B, Object.assign(Object.assign({}, F), { indentation: "", lineSeparator: "" })), m.exports = fe, o.default = fe;
5950
+ fe.minify = (j, F = {}) => fe(j, Object.assign(Object.assign({}, F), { indentation: "", lineSeparator: "" })), m.exports = fe, o.default = fe;
5931
5951
  })(Wt, Wt.exports)), Wt.exports;
5932
5952
  }
5933
- var fo = /* @__PURE__ */ lo();
5934
- const ho = /* @__PURE__ */ ya(fo);
5935
- function po(m) {
5936
- return ho(m);
5953
+ var ho = /* @__PURE__ */ fo();
5954
+ const po = /* @__PURE__ */ va(ho);
5955
+ function mo(m) {
5956
+ return po(m);
5937
5957
  }
5938
- async function mo(m) {
5958
+ async function go(m) {
5939
5959
  const { extension: o, xmlDocument: c, filename: i } = m, w = `<?xml version="1.0" encoding="UTF-8"?>
5940
- ` + new XMLSerializer().serializeToString(c), R = po(w), j = new Blob([R], { type: "application/xml" });
5960
+ ` + new XMLSerializer().serializeToString(c), R = mo(w), B = new Blob([R], { type: "application/xml" });
5941
5961
  if ("showSaveFilePicker" in window)
5942
5962
  try {
5943
5963
  const W = await (await window.showSaveFilePicker({
@@ -5949,39 +5969,39 @@ async function mo(m) {
5949
5969
  }
5950
5970
  ]
5951
5971
  })).createWritable();
5952
- await W.write(j), await W.close();
5972
+ await W.write(B), await W.close();
5953
5973
  } catch (X) {
5954
5974
  X.name !== "AbortError" && console.error("Save failed:", X);
5955
5975
  }
5956
5976
  else {
5957
- const X = URL.createObjectURL(j), W = document.createElement("a");
5977
+ const X = URL.createObjectURL(B), W = document.createElement("a");
5958
5978
  W.href = X, W.download = i, document.body.appendChild(W), W.click(), W.remove(), URL.revokeObjectURL(X);
5959
5979
  }
5960
5980
  }
5961
- async function Mo(m) {
5981
+ async function Ko(m) {
5962
5982
  const {
5963
5983
  dialecteConfig: o,
5964
5984
  databaseName: c,
5965
5985
  extension: i,
5966
5986
  withDownload: d = !1,
5967
5987
  withDatabaseIds: h = !1
5968
- } = m, y = await go({
5988
+ } = m, y = await yo({
5969
5989
  databaseName: c,
5970
5990
  extension: i,
5971
5991
  dialecteConfig: o,
5972
5992
  withDatabaseIds: h
5973
5993
  });
5974
- return d && await mo({
5994
+ return d && await go({
5975
5995
  extension: i,
5976
5996
  xmlDocument: y.xmlDocument,
5977
5997
  filename: y.filename
5978
5998
  }), y;
5979
5999
  }
5980
- async function go(m) {
6000
+ async function yo(m) {
5981
6001
  const { databaseName: o, extension: c = "xml", dialecteConfig: i, withDatabaseIds: d } = m, h = new Qe(o);
5982
6002
  await h.open();
5983
6003
  try {
5984
- const y = await yo({
6004
+ const y = await vo({
5985
6005
  databaseInstance: h,
5986
6006
  dialecteConfig: i,
5987
6007
  withDatabaseIds: d
@@ -5996,37 +6016,37 @@ async function go(m) {
5996
6016
  h.close();
5997
6017
  }
5998
6018
  }
5999
- async function yo(m) {
6019
+ async function vo(m) {
6000
6020
  const { databaseInstance: o, dialecteConfig: c, withDatabaseIds: i } = m, { useBrowserApi: d = !0 } = c.io.exportOptions ?? { useBrowserApi: !0 }, h = c.rootElementName, y = c.namespaces.default, w = c.database.tables.xmlElements.name;
6001
6021
  if (d) {
6002
6022
  const R = document.implementation.createDocument(
6003
6023
  y.uri,
6004
6024
  null,
6005
6025
  null
6006
- ), j = await o.table(w).where({ tagName: h }).first();
6007
- if (!j) throw new Error(`No ${h} root element found in DB`);
6026
+ ), B = await o.table(w).where({ tagName: h }).first();
6027
+ if (!B) throw new Error(`No ${h} root element found in DB`);
6008
6028
  const X = R.createElementNS(
6009
- j.namespace.uri,
6010
- j.tagName
6029
+ B.namespace.uri,
6030
+ B.tagName
6011
6031
  );
6012
- return X.setAttribute("xmlns", j.namespace.uri), j.attributes && _a({
6032
+ return X.setAttribute("xmlns", B.namespace.uri), B.attributes && Ea({
6013
6033
  dialecteConfig: c,
6014
6034
  document: R,
6015
6035
  element: X,
6016
- attributes: j.attributes,
6036
+ attributes: B.attributes,
6017
6037
  isRoot: !0
6018
- }), Ta({ dialecteConfig: c, rootElement: X, namespace: j.namespace }), j.value && (X.textContent = j.value.trim()), i && X.setAttribute(ba, j.id), R.appendChild(X), await wa({
6038
+ }), xa({ dialecteConfig: c, rootElement: X, namespace: B.namespace }), B.value && (X.textContent = B.value.trim()), i && X.setAttribute(wa, B.id), R.appendChild(X), await _a({
6019
6039
  databaseInstance: o,
6020
6040
  dialecteConfig: c,
6021
6041
  elementsTableName: w,
6022
6042
  withDatabaseIds: i,
6023
6043
  xmlDocument: R,
6024
- databaseRecord: j,
6044
+ databaseRecord: B,
6025
6045
  parentDomElement: X
6026
6046
  });
6027
6047
  }
6028
6048
  }
6029
- async function wa(m) {
6049
+ async function _a(m) {
6030
6050
  const {
6031
6051
  databaseInstance: o,
6032
6052
  dialecteConfig: c,
@@ -6038,24 +6058,24 @@ async function wa(m) {
6038
6058
  } = m;
6039
6059
  if (!y.children) return;
6040
6060
  const R = y.children.map((J) => J.id), X = await o.table(i).bulkGet(R);
6041
- wo({
6061
+ _o({
6042
6062
  childrenRecords: X,
6043
6063
  parentRecord: y
6044
6064
  });
6045
- const W = bo({
6065
+ const W = wo({
6046
6066
  parentTagName: y.tagName,
6047
6067
  availableChildren: c.children,
6048
6068
  childrenRecords: X
6049
6069
  });
6050
6070
  for (const J of W) {
6051
- const fe = vo({
6071
+ const fe = bo({
6052
6072
  dialecteConfig: c,
6053
6073
  document: h,
6054
6074
  record: J,
6055
6075
  defaultNamespace: c.namespaces.default,
6056
6076
  withDatabaseIds: d
6057
6077
  });
6058
- w.appendChild(fe), await wa({
6078
+ w.appendChild(fe), await _a({
6059
6079
  databaseInstance: o,
6060
6080
  dialecteConfig: c,
6061
6081
  elementsTableName: i,
@@ -6067,50 +6087,50 @@ async function wa(m) {
6067
6087
  }
6068
6088
  return m.xmlDocument;
6069
6089
  }
6070
- function vo(m) {
6090
+ function bo(m) {
6071
6091
  const { dialecteConfig: o, document: c, record: i, defaultNamespace: d, withDatabaseIds: h } = m;
6072
6092
  let y;
6073
- return !(i.namespace.uri === d.uri) && i.namespace.prefix && i.namespace.prefix !== "xmlns" ? (Ea({
6093
+ return !(i.namespace.uri === d.uri) && i.namespace.prefix && i.namespace.prefix !== "xmlns" ? (Ta({
6074
6094
  dialecteConfig: o,
6075
6095
  document: c,
6076
6096
  namespace: i.namespace
6077
6097
  }), y = c.createElementNS(
6078
6098
  i.namespace.uri,
6079
6099
  `${i.namespace.prefix}:${i.tagName}`
6080
- )) : y = c.createElementNS(i.namespace.uri, i.tagName), i.attributes && _a({
6100
+ )) : y = c.createElementNS(i.namespace.uri, i.tagName), i.attributes && Ea({
6081
6101
  dialecteConfig: o,
6082
6102
  document: c,
6083
6103
  element: y,
6084
6104
  attributes: i.attributes,
6085
6105
  isRoot: !1
6086
- }), i.value && (y.textContent = i.value.trim()), h && y.setAttribute(ba, i.id), y;
6106
+ }), i.value && (y.textContent = i.value.trim()), h && y.setAttribute(wa, i.id), y;
6087
6107
  }
6088
- function _a(m) {
6108
+ function Ea(m) {
6089
6109
  const { dialecteConfig: o, document: c, element: i, attributes: d, isRoot: h } = m;
6090
6110
  for (const y of d)
6091
- if (!_o(y))
6092
- if (xa(y)) {
6111
+ if (!Eo(y))
6112
+ if (Na(y)) {
6093
6113
  const w = y.namespace?.prefix || "";
6094
6114
  if (!w) {
6095
6115
  i.setAttribute(y.name, String(y.value));
6096
6116
  continue;
6097
6117
  }
6098
- h || Ea({
6118
+ h || Ta({
6099
6119
  dialecteConfig: o,
6100
6120
  document: c,
6101
6121
  namespace: y.namespace
6102
6122
  });
6103
- const R = y.name.includes(":") && y.name.split(":").pop() || y.name, j = `${w}:${R}`;
6104
- i.setAttributeNS(y.namespace.uri, j, String(y.value));
6123
+ const R = y.name.includes(":") && y.name.split(":").pop() || y.name, B = `${w}:${R}`;
6124
+ i.setAttributeNS(y.namespace.uri, B, String(y.value));
6105
6125
  } else i.setAttribute(y.name, String(y.value));
6106
6126
  }
6107
- function Ea(m) {
6127
+ function Ta(m) {
6108
6128
  const { dialecteConfig: o, document: c, namespace: i } = m, d = c.documentElement;
6109
6129
  if (!d || !i.prefix || i.prefix === "xmlns") return;
6110
6130
  const h = "http://www.w3.org/2000/xmlns/";
6111
- d.getAttributeNS(h, i.prefix) === null && (d.setAttributeNS(h, `xmlns:${i.prefix}`, i.uri), Ta({ dialecteConfig: o, rootElement: d, namespace: i }));
6131
+ d.getAttributeNS(h, i.prefix) === null && (d.setAttributeNS(h, `xmlns:${i.prefix}`, i.uri), xa({ dialecteConfig: o, rootElement: d, namespace: i }));
6112
6132
  }
6113
- function Ta(m) {
6133
+ function xa(m) {
6114
6134
  const { dialecteConfig: o, rootElement: c, namespace: i } = m, d = Object.entries(
6115
6135
  o.definition[o.rootElementName].attributes.details
6116
6136
  ).filter(([y, w]) => i.uri === o.namespaces.default.uri ? !w.namespace : w.namespace?.prefix === i.prefix && w.namespace?.uri === i.uri);
@@ -6125,7 +6145,7 @@ function Ta(m) {
6125
6145
  c.setAttribute(R, w.default || "");
6126
6146
  }
6127
6147
  }
6128
- function bo(m) {
6148
+ function wo(m) {
6129
6149
  const { parentTagName: o, availableChildren: c, childrenRecords: i } = m, d = [], h = new Set(c[o]);
6130
6150
  if (!h.size) return i;
6131
6151
  const y = /* @__PURE__ */ new Map(), w = [];
@@ -6134,12 +6154,12 @@ function bo(m) {
6134
6154
  for (const R of i)
6135
6155
  h.has(R.tagName) ? y.get(R.tagName)?.push(R) : w.push(R);
6136
6156
  for (const R of h) {
6137
- const j = y.get(R);
6138
- j && j.length && d.push(...j);
6157
+ const B = y.get(R);
6158
+ B && B.length && d.push(...B);
6139
6159
  }
6140
6160
  return d.push(...w), d;
6141
6161
  }
6142
- function wo(m) {
6162
+ function _o(m) {
6143
6163
  const { childrenRecords: o, parentRecord: c } = m, i = o.map((d, h) => d === void 0 ? h : -1).filter((d) => d !== -1);
6144
6164
  if (i.length > 0) {
6145
6165
  const d = i.map((h) => {
@@ -6151,47 +6171,47 @@ function wo(m) {
6151
6171
  );
6152
6172
  }
6153
6173
  }
6154
- function xa(m) {
6174
+ function Na(m) {
6155
6175
  return m !== null && typeof m == "object" && "namespace" in m && !!m.namespace;
6156
6176
  }
6157
- function _o(m) {
6158
- return !!(m.name === "xmlns" || m.name.startsWith("xmlns:") || xa(m) && m.namespace?.prefix === "xmlns");
6177
+ function Eo(m) {
6178
+ return !!(m.name === "xmlns" || m.name.startsWith("xmlns:") || Na(m) && m.namespace?.prefix === "xmlns");
6159
6179
  }
6160
- function Ko(m) {
6161
- const { config: o, storage: c, extensions: i } = m;
6162
- return c.type === "local" ? new Qr(new Pi(c.databaseName, o), o, i) : new Qr(c.store, o, i);
6180
+ function qo(m) {
6181
+ const { config: o, storage: c, extensions: i } = m, d = Ja({ base: i?.base, custom: i?.custom });
6182
+ return c.type === "local" ? new Hr(new Fi(c.databaseName, o), o, d) : new Hr(c.store, o, d);
6163
6183
  }
6164
6184
  export {
6165
- io as A,
6185
+ oo as A,
6166
6186
  Xt as B,
6167
6187
  pr as C,
6168
- Pi as D,
6169
- pa as Q,
6170
- ba as T,
6171
- Qr as a,
6172
- Ci as b,
6173
- va as c,
6174
- ji as d,
6175
- Mo as e,
6176
- Fo as f,
6177
- Bi as g,
6178
- Bo as h,
6179
- jo as i,
6180
- ni as j,
6188
+ Fi as D,
6189
+ ma as Q,
6190
+ wa as T,
6191
+ Hr as a,
6192
+ Di as b,
6193
+ ba as c,
6194
+ Mi as d,
6195
+ Ko as e,
6196
+ Bo as f,
6197
+ ji as g,
6198
+ jo as h,
6199
+ Mo as i,
6200
+ ai as j,
6181
6201
  Nn as k,
6182
- ri as l,
6183
- po as m,
6184
- fi as n,
6185
- Ko as o,
6186
- di as p,
6187
- hi as q,
6188
- pi as r,
6189
- ei as s,
6190
- ti as t,
6191
- oo as u,
6202
+ ii as l,
6203
+ mo as m,
6204
+ hi as n,
6205
+ qo as o,
6206
+ pi as p,
6207
+ mi as q,
6208
+ gi as r,
6209
+ ni as s,
6210
+ ri as t,
6211
+ so as u,
6192
6212
  Ee as v,
6193
- ua as w,
6194
- ho as x,
6195
- ca as y,
6196
- da as z
6213
+ ca as w,
6214
+ po as x,
6215
+ la as y,
6216
+ ha as z
6197
6217
  };